fix(Modal/Popover/Slideover)!: rename prevent-close to dismissible + uniformize docs

This commit is contained in:
Benjamin Canac
2024-12-16 13:11:10 +01:00
parent fdaff6630f
commit 6fb426fc17
10 changed files with 148 additions and 73 deletions

View File

@@ -48,10 +48,10 @@ export interface ModalProps extends DialogRootProps {
*/
closeIcon?: string
/**
* When `true`, the modal will not close when clicking outside.
* @defaultValue false
* When `false`, the modal will not close when clicking outside or pressing escape.
* @defaultValue true
*/
preventClose?: boolean
dismissible?: boolean
class?: any
ui?: Partial<typeof modal.slots>
}
@@ -85,7 +85,8 @@ const props = withDefaults(defineProps<ModalProps>(), {
portal: true,
overlay: true,
transition: true,
modal: true
modal: true,
dismissible: true
})
const emits = defineEmits<ModalEmits>()
const slots = defineSlots<ModalSlots>()
@@ -96,7 +97,7 @@ const appConfig = useAppConfig()
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
const contentProps = toRef(() => props.content)
const contentEvents = computed(() => {
if (props.preventClose) {
if (!props.dismissible) {
return {
pointerDownOutside: (e: Event) => e.preventDefault(),
interactOutside: (e: Event) => e.preventDefault(),