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