From d25265c8b7d34e01af8827d9af5eccb98bf30e9e Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Tue, 8 Apr 2025 17:29:02 +0200 Subject: [PATCH] fix(CommandPalette): consistent alignement with other components --- src/runtime/components/CommandPalette.vue | 1 - src/theme/command-palette.ts | 6 +- .../CommandPalette-vue.spec.ts.snap | 378 +++++++++--------- .../__snapshots__/CommandPalette.spec.ts.snap | 378 +++++++++--------- 4 files changed, 381 insertions(+), 382 deletions(-) diff --git a/src/runtime/components/CommandPalette.vue b/src/runtime/components/CommandPalette.vue index 49435d82..6ad53ef2 100644 --- a/src/runtime/components/CommandPalette.vue +++ b/src/runtime/components/CommandPalette.vue @@ -258,7 +258,6 @@ const groups = computed(() => { :placeholder="placeholder || t('commandPalette.placeholder')" variant="none" :autofocus="autofocus" - size="lg" v-bind="inputProps" :icon="icon || appConfig.ui.icons.search" :class="ui.input({ class: props.ui?.input })" diff --git a/src/theme/command-palette.ts b/src/theme/command-palette.ts index c434124a..95c34980 100644 --- a/src/theme/command-palette.ts +++ b/src/theme/command-palette.ts @@ -3,14 +3,14 @@ import type { ModuleOptions } from '../module' export default (options: Required) => ({ slots: { root: 'flex flex-col min-h-0 min-w-0 divide-y divide-(--ui-border)', - input: '[&>input]:h-12 [&>input]:text-base/5', + input: '[&>input]:h-12', close: '', content: 'relative overflow-hidden flex flex-col', viewport: 'relative divide-y divide-(--ui-border) scroll-py-1 overflow-y-auto flex-1 focus:outline-none', group: 'p-1 isolate', empty: 'py-6 text-center text-sm text-(--ui-text-muted)', - label: 'px-2 py-1.5 text-xs font-semibold text-(--ui-text-highlighted)', - item: 'group relative w-full flex items-center gap-2 px-2 py-1.5 text-sm select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75', + label: 'p-1.5 text-xs font-semibold text-(--ui-text-highlighted)', + item: 'group relative w-full flex items-center gap-1.5 p-1.5 text-sm select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75', itemLeadingIcon: 'shrink-0 size-5', itemLeadingAvatar: 'shrink-0', itemLeadingAvatarSize: '2xs', diff --git a/test/components/__snapshots__/CommandPalette-vue.spec.ts.snap b/test/components/__snapshots__/CommandPalette-vue.spec.ts.snap index 735f4bc1..f7d02f4a 100644 --- a/test/components/__snapshots__/CommandPalette-vue.spec.ts.snap +++ b/test/components/__snapshots__/CommandPalette-vue.spec.ts.snap @@ -2,33 +2,33 @@ exports[`CommandPalette > renders with as correctly 1`] = ` "
-
+
-
-
Labels
@@ -38,33 +38,33 @@ exports[`CommandPalette > renders with as correctly 1`] = ` exports[`CommandPalette > renders with class correctly 1`] = ` "
-
+
-
-
Labels
@@ -74,31 +74,31 @@ exports[`CommandPalette > renders with class correctly 1`] = ` exports[`CommandPalette > renders with close correctly 1`] = ` "
-
+
-
-
Labels
@@ -108,31 +108,31 @@ exports[`CommandPalette > renders with close correctly 1`] = ` exports[`CommandPalette > renders with close slot correctly 1`] = ` "
-
Close slot
+
Close slot
-
-
Labels
@@ -142,31 +142,31 @@ exports[`CommandPalette > renders with close slot correctly 1`] = ` exports[`CommandPalette > renders with closeIcon correctly 1`] = ` "
-
+
-
-
Labels
@@ -176,31 +176,31 @@ exports[`CommandPalette > renders with closeIcon correctly 1`] = ` exports[`CommandPalette > renders with custom slot correctly 1`] = ` "
-
+
- +
-
Labels
@@ -210,33 +210,33 @@ exports[`CommandPalette > renders with custom slot correctly 1`] = ` exports[`CommandPalette > renders with defaultValue correctly 1`] = ` "
-
+
-
-
Labels
@@ -246,33 +246,33 @@ exports[`CommandPalette > renders with defaultValue correctly 1`] = ` exports[`CommandPalette > renders with disabled correctly 1`] = ` "
-
+
-
-
Labels
@@ -282,33 +282,33 @@ exports[`CommandPalette > renders with disabled correctly 1`] = ` exports[`CommandPalette > renders with empty slot correctly 1`] = ` "
-
+
-
-
Labels
@@ -318,33 +318,33 @@ exports[`CommandPalette > renders with empty slot correctly 1`] = ` exports[`CommandPalette > renders with groups correctly 1`] = ` "
-
+
-
-
Labels
@@ -354,33 +354,33 @@ exports[`CommandPalette > renders with groups correctly 1`] = ` exports[`CommandPalette > renders with icon correctly 1`] = ` "
-
+
-
-
Labels
@@ -390,21 +390,21 @@ exports[`CommandPalette > renders with icon correctly 1`] = ` exports[`CommandPalette > renders with item slot correctly 1`] = ` "
-
+
-
-
Labels
+
Labels
-
Users
Item slot +
Users
Item slot
@@ -414,33 +414,33 @@ exports[`CommandPalette > renders with item slot correctly 1`] = ` exports[`CommandPalette > renders with item-label slot correctly 1`] = ` "
-
+
-
-
Labels
@@ -450,27 +450,27 @@ exports[`CommandPalette > renders with item-label slot correctly 1`] = ` exports[`CommandPalette > renders with item-leading slot correctly 1`] = ` "
-
+
-
-
Labels
+
Labels
@@ -480,27 +480,27 @@ exports[`CommandPalette > renders with item-leading slot correctly 1`] = ` exports[`CommandPalette > renders with item-trailing slot correctly 1`] = ` "
-
+
-
-
Labels
@@ -510,36 +510,36 @@ exports[`CommandPalette > renders with item-trailing slot correctly 1`] = ` exports[`CommandPalette > renders with labelKey correctly 1`] = ` "
-
+
-
-
@@ -551,33 +551,33 @@ exports[`CommandPalette > renders with labelKey correctly 1`] = ` exports[`CommandPalette > renders with loading correctly 1`] = ` "
-
+
-
-
Labels
@@ -587,33 +587,33 @@ exports[`CommandPalette > renders with loading correctly 1`] = ` exports[`CommandPalette > renders with loadingIcon correctly 1`] = ` "
-
+
-
-
Labels
@@ -623,33 +623,33 @@ exports[`CommandPalette > renders with loadingIcon correctly 1`] = ` exports[`CommandPalette > renders with modelValue correctly 1`] = ` "
-
+
-
-
Labels
@@ -659,33 +659,33 @@ exports[`CommandPalette > renders with modelValue correctly 1`] = ` exports[`CommandPalette > renders with placeholder correctly 1`] = ` "
-
+
-
-
Labels
@@ -695,33 +695,33 @@ exports[`CommandPalette > renders with placeholder correctly 1`] = ` exports[`CommandPalette > renders with selectedIcon correctly 1`] = ` "
-
+
-
-
Labels
@@ -731,33 +731,33 @@ exports[`CommandPalette > renders with selectedIcon correctly 1`] = ` exports[`CommandPalette > renders with ui correctly 1`] = ` "
-
+
-
-
Labels
@@ -767,7 +767,7 @@ exports[`CommandPalette > renders with ui correctly 1`] = ` exports[`CommandPalette > renders without data correctly 1`] = ` "
-
+
diff --git a/test/components/__snapshots__/CommandPalette.spec.ts.snap b/test/components/__snapshots__/CommandPalette.spec.ts.snap index bf5d91a7..d4f0374b 100644 --- a/test/components/__snapshots__/CommandPalette.spec.ts.snap +++ b/test/components/__snapshots__/CommandPalette.spec.ts.snap @@ -2,33 +2,33 @@ exports[`CommandPalette > renders with as correctly 1`] = ` "
-
+
-
-
Labels
@@ -38,33 +38,33 @@ exports[`CommandPalette > renders with as correctly 1`] = ` exports[`CommandPalette > renders with class correctly 1`] = ` "
-
+
-
-
Labels
@@ -74,34 +74,34 @@ exports[`CommandPalette > renders with class correctly 1`] = ` exports[`CommandPalette > renders with close correctly 1`] = ` "
-
-
-
Labels
@@ -111,31 +111,31 @@ exports[`CommandPalette > renders with close correctly 1`] = ` exports[`CommandPalette > renders with close slot correctly 1`] = ` "
-
Close slot
+
Close slot
-
-
Labels
@@ -145,34 +145,34 @@ exports[`CommandPalette > renders with close slot correctly 1`] = ` exports[`CommandPalette > renders with closeIcon correctly 1`] = ` "
-
-
-
Labels
@@ -182,31 +182,31 @@ exports[`CommandPalette > renders with closeIcon correctly 1`] = ` exports[`CommandPalette > renders with custom slot correctly 1`] = ` "
-
+
- +
-
Labels
@@ -216,33 +216,33 @@ exports[`CommandPalette > renders with custom slot correctly 1`] = ` exports[`CommandPalette > renders with defaultValue correctly 1`] = ` "
-
+
-
-
Labels
@@ -252,33 +252,33 @@ exports[`CommandPalette > renders with defaultValue correctly 1`] = ` exports[`CommandPalette > renders with disabled correctly 1`] = ` "
-
+
-
-
Labels
@@ -288,33 +288,33 @@ exports[`CommandPalette > renders with disabled correctly 1`] = ` exports[`CommandPalette > renders with empty slot correctly 1`] = ` "
-
+
-
-
Labels
@@ -324,33 +324,33 @@ exports[`CommandPalette > renders with empty slot correctly 1`] = ` exports[`CommandPalette > renders with groups correctly 1`] = ` "
-
+
-
-
Labels
@@ -360,33 +360,33 @@ exports[`CommandPalette > renders with groups correctly 1`] = ` exports[`CommandPalette > renders with icon correctly 1`] = ` "
-
+
-
-
Labels
@@ -396,21 +396,21 @@ exports[`CommandPalette > renders with icon correctly 1`] = ` exports[`CommandPalette > renders with item slot correctly 1`] = ` "
-
+
-
-
Labels
+
Labels
-
Users
Item slot +
Users
Item slot
@@ -420,33 +420,33 @@ exports[`CommandPalette > renders with item slot correctly 1`] = ` exports[`CommandPalette > renders with item-label slot correctly 1`] = ` "
-
+
-
-
Labels
@@ -456,27 +456,27 @@ exports[`CommandPalette > renders with item-label slot correctly 1`] = ` exports[`CommandPalette > renders with item-leading slot correctly 1`] = ` "
-
+
-
-
Labels
+
Labels
@@ -486,27 +486,27 @@ exports[`CommandPalette > renders with item-leading slot correctly 1`] = ` exports[`CommandPalette > renders with item-trailing slot correctly 1`] = ` "
-
+
-
-
Labels
@@ -516,36 +516,36 @@ exports[`CommandPalette > renders with item-trailing slot correctly 1`] = ` exports[`CommandPalette > renders with labelKey correctly 1`] = ` "
-
+
-
-
@@ -557,33 +557,33 @@ exports[`CommandPalette > renders with labelKey correctly 1`] = ` exports[`CommandPalette > renders with loading correctly 1`] = ` "
-
+
-
-
Labels
@@ -593,33 +593,33 @@ exports[`CommandPalette > renders with loading correctly 1`] = ` exports[`CommandPalette > renders with loadingIcon correctly 1`] = ` "
-
+
-
-
Labels
@@ -629,33 +629,33 @@ exports[`CommandPalette > renders with loadingIcon correctly 1`] = ` exports[`CommandPalette > renders with modelValue correctly 1`] = ` "
-
+
-
-
Labels
@@ -665,33 +665,33 @@ exports[`CommandPalette > renders with modelValue correctly 1`] = ` exports[`CommandPalette > renders with placeholder correctly 1`] = ` "
-
+
-
-
Labels
@@ -701,33 +701,33 @@ exports[`CommandPalette > renders with placeholder correctly 1`] = ` exports[`CommandPalette > renders with selectedIcon correctly 1`] = ` "
-
+
-
-
Labels
@@ -737,33 +737,33 @@ exports[`CommandPalette > renders with selectedIcon correctly 1`] = ` exports[`CommandPalette > renders with ui correctly 1`] = ` "
-
+
-
-
Labels
@@ -773,7 +773,7 @@ exports[`CommandPalette > renders with ui correctly 1`] = ` exports[`CommandPalette > renders without data correctly 1`] = ` "
-
+