From bdc32175719b538828b4f63ad952dbd6f81b99b9 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Tue, 9 Jul 2024 17:44:46 +0200 Subject: [PATCH] fix(CommandPalette/InputMenu/Select/SelectMenu): adapt chip size --- src/theme/command-palette.ts | 2 +- src/theme/input-menu.ts | 7 +- src/theme/select.ts | 7 +- .../__snapshots__/CommandPalette.spec.ts.snap | 108 +++++++++--------- 4 files changed, 67 insertions(+), 57 deletions(-) diff --git a/src/theme/command-palette.ts b/src/theme/command-palette.ts index 4762b455..8012d799 100644 --- a/src/theme/command-palette.ts +++ b/src/theme/command-palette.ts @@ -14,7 +14,7 @@ export default (options: Required) => ({ itemLeadingIcon: ['shrink-0 size-5 text-gray-400 dark:text-gray-500 group-data-highlighted:text-gray-700 dark:group-data-highlighted:text-gray-200', options.transitions && 'transition-colors'], itemLeadingAvatar: 'shrink-0', itemLeadingAvatarSize: '2xs', - itemLeadingChip: 'shrink-0 mx-1.5', + itemLeadingChip: 'shrink-0 size-5', itemLeadingChipSize: 'md', itemTrailing: 'ms-auto inline-flex gap-1.5 items-center', itemTrailingIcon: 'shrink-0 size-5', diff --git a/src/theme/input-menu.ts b/src/theme/input-menu.ts index 08885302..a614c749 100644 --- a/src/theme/input-menu.ts +++ b/src/theme/input-menu.ts @@ -16,7 +16,7 @@ export default (options: Required) => { itemLeadingIcon: ['shrink-0 text-gray-400 dark:text-gray-500 group-data-highlighted:text-gray-700 dark:group-data-highlighted:text-gray-200', options.transitions && 'transition-colors'], itemLeadingAvatar: 'shrink-0', itemLeadingAvatarSize: '', - itemLeadingChip: 'shrink-0 mx-1.5', + itemLeadingChip: 'shrink-0', itemLeadingChipSize: '', itemTrailing: 'ms-auto inline-flex gap-1.5 items-center', itemTrailingIcon: 'shrink-0', @@ -48,6 +48,7 @@ export default (options: Required) => { item: 'p-1 text-xs gap-1', itemLeadingIcon: 'size-4', itemLeadingAvatarSize: '3xs', + itemLeadingChip: 'size-4', itemLeadingChipSize: 'sm', itemTrailingIcon: 'size-4', tagsItem: 'text-[10px]/3', @@ -58,6 +59,7 @@ export default (options: Required) => { item: 'p-1.5 text-xs gap-1.5', itemLeadingIcon: 'size-4', itemLeadingAvatarSize: '3xs', + itemLeadingChip: 'size-4', itemLeadingChipSize: 'sm', itemTrailingIcon: 'size-4', tagsItem: 'text-[10px]/3', @@ -68,6 +70,7 @@ export default (options: Required) => { item: 'p-1.5 text-sm gap-1.5', itemLeadingIcon: 'size-5', itemLeadingAvatarSize: '2xs', + itemLeadingChip: 'size-5', itemLeadingChipSize: 'md', itemTrailingIcon: 'size-5', tagsItem: 'text-xs', @@ -78,6 +81,7 @@ export default (options: Required) => { item: 'p-2 text-sm gap-2', itemLeadingIcon: 'size-5', itemLeadingAvatarSize: '2xs', + itemLeadingChip: 'size-5', itemLeadingChipSize: 'md', itemTrailingIcon: 'size-5', tagsItem: 'text-xs', @@ -88,6 +92,7 @@ export default (options: Required) => { item: 'p-2 text-base gap-2', itemLeadingIcon: 'size-6', itemLeadingAvatarSize: 'xs', + itemLeadingChip: 'size-6', itemLeadingChipSize: 'lg', itemTrailingIcon: 'size-6', tagsItem: 'text-sm', diff --git a/src/theme/select.ts b/src/theme/select.ts index 3bd07089..a337e7b6 100644 --- a/src/theme/select.ts +++ b/src/theme/select.ts @@ -17,7 +17,7 @@ export default (options: Required) => { itemLeadingIcon: ['shrink-0 text-gray-400 dark:text-gray-500 group-data-highlighted:text-gray-700 dark:group-data-highlighted:text-gray-200', options.transitions && 'transition-colors'], itemLeadingAvatar: 'shrink-0', itemLeadingAvatarSize: '', - itemLeadingChip: 'shrink-0 mx-1.5', + itemLeadingChip: 'shrink-0', itemLeadingChipSize: '', itemTrailing: 'ms-auto inline-flex gap-1.5 items-center', itemTrailingIcon: 'shrink-0', @@ -30,6 +30,7 @@ export default (options: Required) => { item: 'p-1 text-xs gap-1', itemLeadingIcon: 'size-4', itemLeadingAvatarSize: '3xs', + itemLeadingChip: 'size-4', itemLeadingChipSize: 'sm', itemTrailingIcon: 'size-4' }, @@ -38,6 +39,7 @@ export default (options: Required) => { item: 'p-1.5 text-xs gap-1.5', itemLeadingIcon: 'size-4', itemLeadingAvatarSize: '3xs', + itemLeadingChip: 'size-4', itemLeadingChipSize: 'sm', itemTrailingIcon: 'size-4' }, @@ -46,6 +48,7 @@ export default (options: Required) => { item: 'p-1.5 text-sm gap-1.5', itemLeadingIcon: 'size-5', itemLeadingAvatarSize: '2xs', + itemLeadingChip: 'size-5', itemLeadingChipSize: 'md', itemTrailingIcon: 'size-5' }, @@ -54,6 +57,7 @@ export default (options: Required) => { item: 'p-2 text-sm gap-2', itemLeadingIcon: 'size-5', itemLeadingAvatarSize: '2xs', + itemLeadingChip: 'size-5', itemLeadingChipSize: 'md', itemTrailingIcon: 'size-5' }, @@ -62,6 +66,7 @@ export default (options: Required) => { item: 'p-2 text-base gap-2', itemLeadingIcon: 'size-6', itemLeadingAvatarSize: 'xs', + itemLeadingChip: 'size-6', itemLeadingChipSize: 'lg', itemTrailingIcon: 'size-6' } diff --git a/test/components/__snapshots__/CommandPalette.spec.ts.snap b/test/components/__snapshots__/CommandPalette.spec.ts.snap index 663cb944..f086b185 100644 --- a/test/components/__snapshots__/CommandPalette.spec.ts.snap +++ b/test/components/__snapshots__/CommandPalette.spec.ts.snap @@ -31,13 +31,13 @@ exports[`CommandPalette > renders with as correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -94,13 +94,13 @@ exports[`CommandPalette > renders with class correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -158,13 +158,13 @@ exports[`CommandPalette > renders with close correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -219,13 +219,13 @@ exports[`CommandPalette > renders with close slot correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -283,13 +283,13 @@ exports[`CommandPalette > renders with closeIcon correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -343,13 +343,13 @@ exports[`CommandPalette > renders with custom slot correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -406,13 +406,13 @@ exports[`CommandPalette > renders with defaultValue correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -469,13 +469,13 @@ exports[`CommandPalette > renders with disabled correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -532,13 +532,13 @@ exports[`CommandPalette > renders with empty slot correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -595,13 +595,13 @@ exports[`CommandPalette > renders with groups correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -658,13 +658,13 @@ exports[`CommandPalette > renders with icon correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -769,13 +769,13 @@ exports[`CommandPalette > renders with item-label slot correctly 1`] = `
Labels
-
Item label slot +
Item label slot
-
Item label slot +
Item label slot
-
Item label slot +
Item label slot
@@ -883,13 +883,13 @@ exports[`CommandPalette > renders with item-trailing slot correctly 1`] = `
Labels
-
bugItem trailing slot +
bugItem trailing slot
-
featureItem trailing slot +
featureItem trailing slot
-
enhancementItem trailing slot +
enhancementItem trailing slot
@@ -946,13 +946,13 @@ exports[`CommandPalette > renders with loading correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -1036,13 +1036,13 @@ exports[`CommandPalette > renders with modelValue correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -1099,13 +1099,13 @@ exports[`CommandPalette > renders with placeholder correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -1162,13 +1162,13 @@ exports[`CommandPalette > renders with selectedIcon correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement
@@ -1225,13 +1225,13 @@ exports[`CommandPalette > renders with ui correctly 1`] = `
Labels
-
bug +
bug
-
feature +
feature
-
enhancement +
enhancement