feat: modal and drawer locking improve (#5648)

* feat: add `unlock` for modalApi

* fix: modal's close button style in locking

* fix: fix modal's close button disabled on locking

* feat: add `lock` and `unlock` for drawerApi
This commit is contained in:
Netfan
2025-03-04 22:00:32 +08:00
committed by GitHub
parent decd9c55e5
commit f380452ef0
10 changed files with 95 additions and 21 deletions

View File

@@ -23,6 +23,7 @@ const props = withDefaults(
appendTo?: HTMLElement | string;
class?: ClassType;
closeClass?: ClassType;
closeDisabled?: boolean;
modal?: boolean;
open?: boolean;
overlayBlur?: number;
@@ -30,7 +31,7 @@ const props = withDefaults(
zIndex?: number;
}
>(),
{ appendTo: 'body', showClose: true },
{ appendTo: 'body', closeDisabled: false, showClose: true },
);
const emits = defineEmits<
DialogContentEmits & { close: []; closed: []; opened: [] }
@@ -108,6 +109,7 @@ defineExpose({
<DialogClose
v-if="showClose"
:disabled="closeDisabled"
:class="
cn(
'data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:bg-accent hover:text-accent-foreground text-foreground/80 flex-center absolute right-3 top-3 h-6 w-6 rounded-full px-1 text-lg opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none',