From c3adc381c90dad7152e27fc303ee678efc7c4c94 Mon Sep 17 00:00:00 2001 From: Artea Date: Tue, 24 Jun 2025 23:16:13 +0800 Subject: [PATCH] fix(Card/Drawer/Modal): prevent scrollbars overflow (#4368) Co-authored-by: Benjamin Canac --- src/theme/card.ts | 2 +- src/theme/drawer.ts | 2 +- src/theme/modal.ts | 2 +- .../__snapshots__/Card-vue.spec.ts.snap | 20 +++++------ .../__snapshots__/Card.spec.ts.snap | 20 +++++------ .../__snapshots__/Drawer-vue.spec.ts.snap | 8 ++--- .../__snapshots__/Drawer.spec.ts.snap | 8 ++--- .../__snapshots__/Modal-vue.spec.ts.snap | 34 +++++++++---------- .../__snapshots__/Modal.spec.ts.snap | 34 +++++++++---------- 9 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/theme/card.ts b/src/theme/card.ts index a5525837..8b3694d7 100644 --- a/src/theme/card.ts +++ b/src/theme/card.ts @@ -1,6 +1,6 @@ export default { slots: { - root: 'rounded-lg', + root: 'rounded-lg overflow-hidden', header: 'p-4 sm:px-6', body: 'p-4 sm:p-6', footer: 'p-4 sm:px-6' diff --git a/src/theme/drawer.ts b/src/theme/drawer.ts index f2d3b3bb..4a6f4a02 100644 --- a/src/theme/drawer.ts +++ b/src/theme/drawer.ts @@ -33,7 +33,7 @@ export default (options: Required) => ({ }, inset: { true: { - content: 'rounded-lg after:hidden' + content: 'rounded-lg after:hidden overflow-hidden' } } }, diff --git a/src/theme/modal.ts b/src/theme/modal.ts index 8be8e39b..cb57c157 100644 --- a/src/theme/modal.ts +++ b/src/theme/modal.ts @@ -22,7 +22,7 @@ export default { content: 'inset-0' }, false: { - content: 'top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[calc(100vw-2rem)] max-w-lg max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)] rounded-lg shadow-lg ring ring-default' + content: 'top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[calc(100vw-2rem)] max-w-lg max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)] rounded-lg shadow-lg ring ring-default overflow-hidden' } } } diff --git a/test/components/__snapshots__/Card-vue.spec.ts.snap b/test/components/__snapshots__/Card-vue.spec.ts.snap index a7180199..0d098cbd 100644 --- a/test/components/__snapshots__/Card-vue.spec.ts.snap +++ b/test/components/__snapshots__/Card-vue.spec.ts.snap @@ -1,7 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Card > renders with as correctly 1`] = ` -"
+"
@@ -9,7 +9,7 @@ exports[`Card > renders with as correctly 1`] = ` `; exports[`Card > renders with class correctly 1`] = ` -"
+"
@@ -17,7 +17,7 @@ exports[`Card > renders with class correctly 1`] = ` `; exports[`Card > renders with default slot correctly 1`] = ` -"
+"
Default slot
@@ -25,7 +25,7 @@ exports[`Card > renders with default slot correctly 1`] = ` `; exports[`Card > renders with footer slot correctly 1`] = ` -"
+"
Footer slot
@@ -33,7 +33,7 @@ exports[`Card > renders with footer slot correctly 1`] = ` `; exports[`Card > renders with header slot correctly 1`] = ` -"
+"
Header slot
@@ -41,7 +41,7 @@ exports[`Card > renders with header slot correctly 1`] = ` `; exports[`Card > renders with ui correctly 1`] = ` -"
+"
@@ -49,7 +49,7 @@ exports[`Card > renders with ui correctly 1`] = ` `; exports[`Card > renders with variant outline correctly 1`] = ` -"
+"
@@ -57,7 +57,7 @@ exports[`Card > renders with variant outline correctly 1`] = ` `; exports[`Card > renders with variant soft correctly 1`] = ` -"
+"
@@ -65,7 +65,7 @@ exports[`Card > renders with variant soft correctly 1`] = ` `; exports[`Card > renders with variant solid correctly 1`] = ` -"
+"
@@ -73,7 +73,7 @@ exports[`Card > renders with variant solid correctly 1`] = ` `; exports[`Card > renders with variant subtle correctly 1`] = ` -"
+"
diff --git a/test/components/__snapshots__/Card.spec.ts.snap b/test/components/__snapshots__/Card.spec.ts.snap index a7180199..0d098cbd 100644 --- a/test/components/__snapshots__/Card.spec.ts.snap +++ b/test/components/__snapshots__/Card.spec.ts.snap @@ -1,7 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Card > renders with as correctly 1`] = ` -"
+"
@@ -9,7 +9,7 @@ exports[`Card > renders with as correctly 1`] = ` `; exports[`Card > renders with class correctly 1`] = ` -"
+"
@@ -17,7 +17,7 @@ exports[`Card > renders with class correctly 1`] = ` `; exports[`Card > renders with default slot correctly 1`] = ` -"
+"
Default slot
@@ -25,7 +25,7 @@ exports[`Card > renders with default slot correctly 1`] = ` `; exports[`Card > renders with footer slot correctly 1`] = ` -"
+"
Footer slot
@@ -33,7 +33,7 @@ exports[`Card > renders with footer slot correctly 1`] = ` `; exports[`Card > renders with header slot correctly 1`] = ` -"
+"
Header slot
@@ -41,7 +41,7 @@ exports[`Card > renders with header slot correctly 1`] = ` `; exports[`Card > renders with ui correctly 1`] = ` -"
+"
@@ -49,7 +49,7 @@ exports[`Card > renders with ui correctly 1`] = ` `; exports[`Card > renders with variant outline correctly 1`] = ` -"
+"
@@ -57,7 +57,7 @@ exports[`Card > renders with variant outline correctly 1`] = ` `; exports[`Card > renders with variant soft correctly 1`] = ` -"
+"
@@ -65,7 +65,7 @@ exports[`Card > renders with variant soft correctly 1`] = ` `; exports[`Card > renders with variant solid correctly 1`] = ` -"
+"
@@ -73,7 +73,7 @@ exports[`Card > renders with variant solid correctly 1`] = ` `; exports[`Card > renders with variant subtle correctly 1`] = ` -"
+"
diff --git a/test/components/__snapshots__/Drawer-vue.spec.ts.snap b/test/components/__snapshots__/Drawer-vue.spec.ts.snap index 8fc84a37..ad704a10 100644 --- a/test/components/__snapshots__/Drawer-vue.spec.ts.snap +++ b/test/components/__snapshots__/Drawer-vue.spec.ts.snap @@ -150,7 +150,7 @@ exports[`Drawer > renders with direction bottom inset correctly 1`] = `
-