From 81569713e9da9d5531ecdf4614660b84c686fa81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Est=C3=A9ban?= Date: Tue, 24 Jun 2025 18:03:53 +0200 Subject: [PATCH] feat(Modal/Slideover): add `actions` slot (#4358) Co-authored-by: Benjamin Canac --- src/runtime/components/Modal.vue | 3 +++ src/runtime/components/Slideover.vue | 3 +++ test/components/Modal.spec.ts | 1 + test/components/Slideover.spec.ts | 1 + .../__snapshots__/Modal-vue.spec.ts.snap | 25 +++++++++++++++++++ .../__snapshots__/Modal.spec.ts.snap | 25 +++++++++++++++++++ .../__snapshots__/Slideover-vue.spec.ts.snap | 25 +++++++++++++++++++ .../__snapshots__/Slideover.spec.ts.snap | 25 +++++++++++++++++++ 8 files changed, 108 insertions(+) diff --git a/src/runtime/components/Modal.vue b/src/runtime/components/Modal.vue index d2ded79a..228e335b 100644 --- a/src/runtime/components/Modal.vue +++ b/src/runtime/components/Modal.vue @@ -65,6 +65,7 @@ export interface ModalSlots { header(props: { close: () => void }): any title(props?: {}): any description(props?: {}): any + actions(props?: {}): any close(props: { close: () => void, ui: { [K in keyof Required]: (props?: Record) => string } }): any body(props: { close: () => void }): any footer(props: { close: () => void }): any @@ -166,6 +167,8 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.modal || {}) + + void }): any title(props?: {}): any description(props?: {}): any + actions(props?: {}): any close(props: { close: () => void, ui: { [K in keyof Required]: (props?: Record) => string } }): any body(props: { close: () => void }): any footer(props: { close: () => void }): any @@ -174,6 +175,8 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.slideover || + + { ['with header slot', { props, slots: { header: () => 'Header slot' } }], ['with title slot', { props, slots: { title: () => 'Title slot' } }], ['with description slot', { props, slots: { description: () => 'Description slot' } }], + ['with actions slot', { props, slots: { actions: () => 'Actions slot' } }], ['with close slot', { props, slots: { close: () => 'Close slot' } }], ['with body slot', { props, slots: { body: () => 'Body slot' } }], ['with footer slot', { props, slots: { footer: () => 'Footer slot' } }] diff --git a/test/components/Slideover.spec.ts b/test/components/Slideover.spec.ts index df7158cb..fec119dc 100644 --- a/test/components/Slideover.spec.ts +++ b/test/components/Slideover.spec.ts @@ -25,6 +25,7 @@ describe('Slideover', () => { ['with header slot', { props, slots: { header: () => 'Header slot' } }], ['with title slot', { props, slots: { title: () => 'Title slot' } }], ['with description slot', { props, slots: { description: () => 'Description slot' } }], + ['with actions slot', { props, slots: { actions: () => 'Actions slot' } }], ['with close slot', { props, slots: { close: () => 'Close slot' } }], ['with body slot', { props, slots: { body: () => 'Body slot' } }], ['with footer slot', { props, slots: { footer: () => 'Footer slot' } }] diff --git a/test/components/__snapshots__/Modal-vue.spec.ts.snap b/test/components/__snapshots__/Modal-vue.spec.ts.snap index 64145f5b..207d9785 100644 --- a/test/components/__snapshots__/Modal-vue.spec.ts.snap +++ b/test/components/__snapshots__/Modal-vue.spec.ts.snap @@ -1,5 +1,30 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`Modal > renders with actions slot correctly 1`] = ` +" + + + +
+ + + +" +`; + exports[`Modal > renders with body slot correctly 1`] = ` " diff --git a/test/components/__snapshots__/Modal.spec.ts.snap b/test/components/__snapshots__/Modal.spec.ts.snap index 92910f07..6e2af5e8 100644 --- a/test/components/__snapshots__/Modal.spec.ts.snap +++ b/test/components/__snapshots__/Modal.spec.ts.snap @@ -1,5 +1,30 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`Modal > renders with actions slot correctly 1`] = ` +" + + + +
+ + + +" +`; + exports[`Modal > renders with body slot correctly 1`] = ` " diff --git a/test/components/__snapshots__/Slideover-vue.spec.ts.snap b/test/components/__snapshots__/Slideover-vue.spec.ts.snap index 8b42a00a..7eb54062 100644 --- a/test/components/__snapshots__/Slideover-vue.spec.ts.snap +++ b/test/components/__snapshots__/Slideover-vue.spec.ts.snap @@ -1,5 +1,30 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`Slideover > renders with actions slot correctly 1`] = ` +" + + + +
+ + + +" +`; + exports[`Slideover > renders with body slot correctly 1`] = ` " diff --git a/test/components/__snapshots__/Slideover.spec.ts.snap b/test/components/__snapshots__/Slideover.spec.ts.snap index 61593e34..eec7dcde 100644 --- a/test/components/__snapshots__/Slideover.spec.ts.snap +++ b/test/components/__snapshots__/Slideover.spec.ts.snap @@ -1,5 +1,30 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`Slideover > renders with actions slot correctly 1`] = ` +" + + + +
+ + + +" +`; + exports[`Slideover > renders with body slot correctly 1`] = ` "