2 changed files with 36 additions and 39 deletions
@ -1,31 +1,34 @@ |
|||
<script setup lang="ts"> |
|||
import type { DialogOverlayProps } from 'reka-ui'; |
|||
|
|||
import type { HTMLAttributes } from 'vue'; |
|||
import { inject } from 'vue'; |
|||
|
|||
import { useScrollLock } from '@vben-core/composables'; |
|||
import { cn } from '@vben-core/shared/utils'; |
|||
|
|||
import { reactiveOmit } from '@vueuse/core'; |
|||
import { DialogOverlay } from 'reka-ui'; |
|||
|
|||
const props = defineProps< |
|||
DialogOverlayProps & { class?: HTMLAttributes['class'] } |
|||
>(); |
|||
const props = withDefaults( |
|||
defineProps<{ |
|||
class?: any; |
|||
overlayBlur?: number; |
|||
position?: 'absolute' | 'fixed'; |
|||
zIndex?: number; |
|||
}>(), |
|||
{ |
|||
position: 'fixed', |
|||
}, |
|||
); |
|||
|
|||
const delegatedProps = reactiveOmit(props, 'class'); |
|||
useScrollLock(); |
|||
const dismissableModalId = inject('DISMISSABLE_MODAL_ID', undefined); |
|||
</script> |
|||
|
|||
<template> |
|||
<DialogOverlay |
|||
data-slot="dialog-overlay" |
|||
v-bind="delegatedProps" |
|||
:class=" |
|||
cn( |
|||
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', |
|||
props.class, |
|||
) |
|||
" |
|||
> |
|||
<slot></slot> |
|||
</DialogOverlay> |
|||
<div |
|||
:data-dismissable-modal="dismissableModalId" |
|||
:style="{ |
|||
...(zIndex ? { zIndex } : {}), |
|||
position, |
|||
backdropFilter: |
|||
overlayBlur && overlayBlur > 0 ? `blur(${overlayBlur}px)` : 'none', |
|||
}" |
|||
:class="cn('z-popup bg-overlay inset-0 fixed', props.class)" |
|||
></div> |
|||
</template> |
|||
|
|||
Loading…
Reference in new issue