diff --git a/docs/app/components/content/examples/popover/PopoverCommandPaletteExample.vue b/docs/app/components/content/examples/popover/PopoverCommandPaletteExample.vue index ebf73b337a..21bb213950 100644 --- a/docs/app/components/content/examples/popover/PopoverCommandPaletteExample.vue +++ b/docs/app/components/content/examples/popover/PopoverCommandPaletteExample.vue @@ -43,7 +43,6 @@ const label = ref([]) multiple :filter="{ placeholder: 'Search labels...' }" :groups="[{ id: 'labels', items }]" - :ui="{ filter: '[&>input]:h-8 [&>input]:text-sm' }" /> diff --git a/docs/content/docs/1.getting-started/3.migration.md b/docs/content/docs/1.getting-started/3.migration.md index 7518e13310..9597f3ac9a 100644 --- a/docs/content/docs/1.getting-started/3.migration.md +++ b/docs/content/docs/1.getting-started/3.migration.md @@ -1330,6 +1330,30 @@ The theme slot of that input follows the prop on all six components: `input` is A prop left behind fails silently: Vue passes an unknown prop on as an attribute, so the filter input shows again where you hid it, and a `placeholder` or an `icon` set on a CommandPalette, a DashboardSearch or a ContentSearch is ignored. `search-input` can be renamed with a find and replace. The rest can't: `placeholder`, `icon`, `trailing-icon` and `autofocus` have to be merged into the `filter` object, and they keep their meaning on other components. The `input` prop and slot only change on the six components above: AuthForm keeps its `input` slot, and `input` is also the app config key of the Input component. Props passed through `v-bind` or `` have to be found by hand. TypeScript reports a leftover `input` slot in `app.config.ts` and on the `ui` prop, not in a `ui` object built at runtime. :: +### Filter field + +The filter input of CommandPalette, DashboardSearch, ContentSearch, SelectMenu, DropdownMenu and Listbox is now a field inside the menu instead of a full-width bar with a border under it. It uses the `soft` variant of Input instead of `none`, without its focus outline since the field keeps the focus while the menu is open, and is as large as an item: it sits 4px from the edges of the menu like the items, and takes their padding through `--ui-control-px` in each `size`, so its icon and text line up with the items and the group labels. + +```diff +-
++
+``` + +On CommandPalette, the filter no longer sets the height of its input and is as tall as its items. The divider under it is gone: `root` loses `divide-y divide-default` and `footer` gets `border-t border-default`. The back and close buttons take back the inset of the field with `-ms-1` and `-me-1`, so their icons sit where the search icon does. The filter of DashboardSearch and ContentSearch no longer sets `--ui-control-text-step`, so its text is the size of the items. + +```diff +-
+-
++
++
+``` + +A class you set on `filter` to remove the border, like `border-b-0`, is no longer needed. To get the bar back, pass `variant: 'none'` in the `filter` prop and reset the slot: + +```vue + +``` + ### Stacked toasts Toasts are now stacked by default: the `expand` prop of the Toaster defaults to `false`, and hovering or focusing the stack expands it. Set it back to `true` on the App to keep every toast visible: diff --git a/src/runtime/components/CommandPalette.vue b/src/runtime/components/CommandPalette.vue index cfea52a6f8..3e0a312bfc 100644 --- a/src/runtime/components/CommandPalette.vue +++ b/src/runtime/components/CommandPalette.vue @@ -116,7 +116,7 @@ export interface CommandPaletteProps = CommandP /** * Whether to display a filter input or not. * Can be an object to pass additional props to the input, set `icon: false` to hide its icon. - * `{ placeholder: t('commandPalette.filterPlaceholder'), icon: appConfig.ui.icons.search, autofocus: true, variant: 'none' }`{lang="ts-type"} + * `{ placeholder: t('commandPalette.filterPlaceholder'), icon: appConfig.ui.icons.search, autofocus: true, variant: 'soft' }`{lang="ts-type"} * @defaultValue true */ filter?: boolean | (Omit & { icon?: IconProps['name'] | false }) @@ -312,7 +312,7 @@ const history = ref<(CommandPaletteGroup & { placeholder?: string })[]>([]) const filterProps = computed(() => { const filter = typeof props.filter === 'object' ? props.filter : {} - return defu({ ...filter, icon: filter.icon === false ? undefined : (filter.icon ?? appConfig.ui.icons.search) }, { autofocus: true, variant: 'none' }) as Omit + return defu({ ...filter, icon: filter.icon === false ? undefined : (filter.icon ?? appConfig.ui.icons.search) }, { autofocus: true, variant: 'soft' }) as Omit }) const placeholder = computed(() => history.value[history.value.length - 1]?.placeholder || filterProps.value.placeholder || t('commandPalette.filterPlaceholder')) diff --git a/src/runtime/components/DashboardSearch.vue b/src/runtime/components/DashboardSearch.vue index c892b16936..9161c914e6 100644 --- a/src/runtime/components/DashboardSearch.vue +++ b/src/runtime/components/DashboardSearch.vue @@ -27,7 +27,7 @@ export interface DashboardSearchProps = A /** * Whether to display a filter input or not. * Can be an object to pass additional props to the input. - * `{ placeholder: t('dropdownMenu.filterPlaceholder'), autofocus: true, variant: 'none' }`{lang="ts-type"} + * `{ placeholder: t('dropdownMenu.filterPlaceholder'), autofocus: true, variant: 'soft' }`{lang="ts-type"} * @defaultValue false */ filter?: boolean | Omit @@ -230,7 +230,7 @@ watch(() => props.open, (open) => { }) const childrenIcon = computed(() => dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight) -const getFilterProps = (filter: DropdownMenuItem['filter']) => defu(filter, { placeholder: t('dropdownMenu.filterPlaceholder'), variant: 'none' }) as Omit +const getFilterProps = (filter: DropdownMenuItem['filter']) => defu(filter, { placeholder: t('dropdownMenu.filterPlaceholder'), variant: 'soft' }) as Omit const isStructuralItem = (item: DropdownMenuItem) => !!item.type && ['label', 'separator'].includes(item.type) function getFilteredGroups({ items, path, filter, filterFields, ignoreFilter }: { items?: ArrayOrNested, path: string, filter?: DropdownMenuItem['filter'], filterFields?: string[], ignoreFilter?: boolean }) { diff --git a/src/runtime/components/Listbox.vue b/src/runtime/components/Listbox.vue index 2b75982fd5..6378042fd7 100644 --- a/src/runtime/components/Listbox.vue +++ b/src/runtime/components/Listbox.vue @@ -96,7 +96,7 @@ export interface ListboxProps = ArrayOrNest /** * Whether to display a filter input or not. * Can be an object to pass additional props to the input. - * `{ placeholder: t('listbox.filterPlaceholder'), variant: 'none' }`{lang="ts-type"} + * `{ placeholder: t('listbox.filterPlaceholder'), variant: 'soft' }`{lang="ts-type"} * @defaultValue false */ filter?: boolean | Omit @@ -210,7 +210,7 @@ const virtualizerProps = toRef(() => { estimateSize: getEstimateSize(filteredItems.value, size.value ?? 'md', props.descriptionKey as string, !!slots['item-description']) }) }) -const filterProps = toRef(() => defu(typeof props.filter === 'object' ? props.filter : {}, { placeholder: t('listbox.filterPlaceholder'), variant: 'none' }) as Omit) +const filterProps = toRef(() => defu(typeof props.filter === 'object' ? props.filter : {}, { placeholder: t('listbox.filterPlaceholder'), variant: 'soft' }) as Omit) const { emitFormChange, emitFormInput, name, size: formFieldSize, color: formFieldColor, id, highlight: formFieldHighlight, disabled: formFieldDisabled, labelId, ariaAttrs } = useFormField(_props, { bind: false }) diff --git a/src/runtime/components/SelectMenu.vue b/src/runtime/components/SelectMenu.vue index 3ff2aece7f..359e55dc4c 100644 --- a/src/runtime/components/SelectMenu.vue +++ b/src/runtime/components/SelectMenu.vue @@ -52,7 +52,7 @@ export interface SelectMenuProps = Array /** * Whether to display a filter input or not. * Can be an object to pass additional props to the input. - * `{ placeholder: t('selectMenu.filterPlaceholder'), autofocus: true, variant: 'none' }`{lang="ts-type"} + * `{ placeholder: t('selectMenu.filterPlaceholder'), autofocus: true, variant: 'soft' }`{lang="ts-type"} * Set `autofocus: false` to prevent the filter input from being focused when the menu opens (e.g. to avoid opening the virtual keyboard on touch devices). * @defaultValue true */ @@ -290,7 +290,7 @@ const virtualizerProps = toRef(() => { estimateSize: getEstimateSize(filteredItems.value, size.value ?? 'md', props.descriptionKey as string, !!slots['item-description']) }) }) -const filterProps = toRef(() => defu(props.filter, { placeholder: t('selectMenu.filterPlaceholder'), variant: 'none' }) as Omit) +const filterProps = toRef(() => defu(props.filter, { placeholder: t('selectMenu.filterPlaceholder'), variant: 'soft' }) as Omit) const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formFieldSize, color: formFieldColor, id, name, highlight: formFieldHighlight, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props) diff --git a/src/runtime/components/content/ContentSearch.vue b/src/runtime/components/content/ContentSearch.vue index bddbb837bd..addf83e0e6 100644 --- a/src/runtime/components/content/ContentSearch.vue +++ b/src/runtime/components/content/ContentSearch.vue @@ -74,7 +74,7 @@ export interface ContentSearchProps:focus-visible]:outline-0', + // The back and the close take back the inset of the field, so their icon sits where + // the search icon does + back: '-ms-1', + close: '-me-1', content: 'relative overflow-hidden flex flex-col', - footer: 'p-1', + footer: 'p-1 border-t border-default', viewport: 'relative scroll-py-1 overflow-y-auto flex-1 focus:outline-none', group: 'p-1 isolate', empty: 'text-center text-muted', @@ -42,7 +44,7 @@ export default defineTheme({ size: { xs: { content: '[--ui-control-py:var(--ui-control-py-xs)] [--ui-control-gap:var(--ui-control-gap-xs)] [--ui-control-icon-size:var(--ui-control-icon-size-xs)]', - filter: '[&>input]:h-10', + filter: '[--ui-control-px:var(--ui-control-py-xs)]', empty: 'py-3 text-xs', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-xs--leading)-var(--ui-control-text-xs--line-height))/2)] text-[calc(var(--ui-control-text-xs)-0.125rem)]/[calc(var(--ui-control-text-xs--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-xs)/(--ui-control-text-xs--line-height) gap-(--ui-control-gap)', @@ -56,7 +58,7 @@ export default defineTheme({ }, sm: { content: '[--ui-control-py:var(--ui-control-py-sm)] [--ui-control-gap:var(--ui-control-gap-sm)] [--ui-control-icon-size:var(--ui-control-icon-size-sm)]', - filter: '[&>input]:h-11', + filter: '[--ui-control-px:var(--ui-control-py-sm)]', empty: 'py-4 text-xs', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-sm--leading)-var(--ui-control-text-sm--line-height))/2)] text-[calc(var(--ui-control-text-sm)-0.125rem)]/[calc(var(--ui-control-text-sm--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-sm)/(--ui-control-text-sm--line-height) gap-(--ui-control-gap)', @@ -70,7 +72,7 @@ export default defineTheme({ }, md: { content: '[--ui-control-py:var(--ui-control-py-md)] [--ui-control-gap:var(--ui-control-gap-md)] [--ui-control-icon-size:var(--ui-control-icon-size-md)]', - filter: '[&>input]:h-12', + filter: '[--ui-control-px:var(--ui-control-py-md)]', empty: 'py-6 text-sm', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-md--leading)-var(--ui-control-text-md--line-height))/2)] text-[calc(var(--ui-control-text-md)-0.125rem)]/[calc(var(--ui-control-text-md--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-md)/(--ui-control-text-md--line-height) gap-(--ui-control-gap)', @@ -84,7 +86,7 @@ export default defineTheme({ }, lg: { content: '[--ui-control-py:var(--ui-control-py-lg)] [--ui-control-gap:var(--ui-control-gap-lg)] [--ui-control-icon-size:var(--ui-control-icon-size-lg)]', - filter: '[&>input]:h-13', + filter: '[--ui-control-px:var(--ui-control-py-lg)]', empty: 'py-7 text-sm', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-lg--leading)-var(--ui-control-text-lg--line-height))/2)] text-[calc(var(--ui-control-text-lg)-0.125rem)]/[calc(var(--ui-control-text-lg--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-lg)/(--ui-control-text-lg--line-height) gap-(--ui-control-gap)', @@ -98,7 +100,7 @@ export default defineTheme({ }, xl: { content: '[--ui-control-py:var(--ui-control-py-xl)] [--ui-control-gap:var(--ui-control-gap-xl)] [--ui-control-icon-size:var(--ui-control-icon-size-xl)]', - filter: '[&>input]:h-14', + filter: '[--ui-control-px:var(--ui-control-py-xl)]', empty: 'py-8 text-base', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-xl--leading)-var(--ui-control-text-xl--line-height))/2)] text-[calc(var(--ui-control-text-xl)-0.125rem)]/[calc(var(--ui-control-text-xl--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-xl)/(--ui-control-text-xl--line-height) gap-(--ui-control-gap)', diff --git a/src/runtime/theme/content/content-search.ts b/src/runtime/theme/content/content-search.ts index 0d88dc103a..102e927629 100644 --- a/src/runtime/theme/content/content-search.ts +++ b/src/runtime/theme/content/content-search.ts @@ -3,8 +3,7 @@ import { defineTheme } from '../../utils/theme' export default defineTheme({ slots: { modal: '', - // The search keeps the larger text of a field on every breakpoint - filter: '[--ui-control-text-step:0.125rem]' + filter: '' }, variants: { fullscreen: { diff --git a/src/runtime/theme/dashboard-search.ts b/src/runtime/theme/dashboard-search.ts index 089aac139d..082c9fbff7 100644 --- a/src/runtime/theme/dashboard-search.ts +++ b/src/runtime/theme/dashboard-search.ts @@ -3,8 +3,7 @@ import { defineTheme } from '../utils/theme' export default defineTheme({ slots: { modal: '', - // The search keeps the larger text of a field on every breakpoint - filter: '[--ui-control-text-step:0.125rem]' + filter: '' }, variants: { fullscreen: { diff --git a/src/runtime/theme/dropdown-menu.ts b/src/runtime/theme/dropdown-menu.ts index f80274b253..1836f58876 100644 --- a/src/runtime/theme/dropdown-menu.ts +++ b/src/runtime/theme/dropdown-menu.ts @@ -4,7 +4,10 @@ import { defineTheme } from '../utils/theme' export default defineTheme({ slots: { content: 'min-w-32 max-h-(--reka-dropdown-menu-content-available-height) bg-overlay shadow-lg rounded-md ring ring-default overflow-hidden data-[state=open]:animate-[scale-in_100ms_var(--ease-out)] data-[state=closed]:animate-[scale-out_100ms_var(--ease-out)] origin-(--reka-dropdown-menu-content-transform-origin) flex flex-col', - filter: 'rounded-none border-b border-default', + // A field as large as an item, inset like the items: its padding is theirs, so its + // icon and text line up with them + // It holds the focus as long as the menu is open, so it shows no focus outline + filter: 'mx-1 mt-1 has-[>:focus-visible]:outline-0', empty: 'p-[calc(var(--ui-control-py)+(--spacing(1)))] text-center text-muted', viewport: 'relative divide-y divide-default scroll-py-1 overflow-y-auto flex-1', arrow: 'fill-bg stroke-default', @@ -42,6 +45,7 @@ export default defineTheme({ size: { xs: { content: '[--ui-control-py:var(--ui-control-py-xs)] [--ui-control-gap:var(--ui-control-gap-xs)] [--ui-control-icon-size:var(--ui-control-icon-size-xs)]', + filter: '[--ui-control-px:var(--ui-control-py-xs)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-xs--leading)-var(--ui-control-text-xs--line-height))/2)] text-[calc(var(--ui-control-text-xs)-0.125rem)]/[calc(var(--ui-control-text-xs--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-xs)/(--ui-control-text-xs--line-height) gap-(--ui-control-gap)', itemDescription: 'leading-(--ui-control-text-xs--leading)', @@ -52,6 +56,7 @@ export default defineTheme({ }, sm: { content: '[--ui-control-py:var(--ui-control-py-sm)] [--ui-control-gap:var(--ui-control-gap-sm)] [--ui-control-icon-size:var(--ui-control-icon-size-sm)]', + filter: '[--ui-control-px:var(--ui-control-py-sm)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-sm--leading)-var(--ui-control-text-sm--line-height))/2)] text-[calc(var(--ui-control-text-sm)-0.125rem)]/[calc(var(--ui-control-text-sm--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-sm)/(--ui-control-text-sm--line-height) gap-(--ui-control-gap)', itemDescription: 'leading-(--ui-control-text-sm--leading)', @@ -62,6 +67,7 @@ export default defineTheme({ }, md: { content: '[--ui-control-py:var(--ui-control-py-md)] [--ui-control-gap:var(--ui-control-gap-md)] [--ui-control-icon-size:var(--ui-control-icon-size-md)]', + filter: '[--ui-control-px:var(--ui-control-py-md)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-md--leading)-var(--ui-control-text-md--line-height))/2)] text-[calc(var(--ui-control-text-md)-0.125rem)]/[calc(var(--ui-control-text-md--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-md)/(--ui-control-text-md--line-height) gap-(--ui-control-gap)', itemDescription: 'leading-(--ui-control-text-md--leading)', @@ -72,6 +78,7 @@ export default defineTheme({ }, lg: { content: '[--ui-control-py:var(--ui-control-py-lg)] [--ui-control-gap:var(--ui-control-gap-lg)] [--ui-control-icon-size:var(--ui-control-icon-size-lg)]', + filter: '[--ui-control-px:var(--ui-control-py-lg)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-lg--leading)-var(--ui-control-text-lg--line-height))/2)] text-[calc(var(--ui-control-text-lg)-0.125rem)]/[calc(var(--ui-control-text-lg--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-lg)/(--ui-control-text-lg--line-height) gap-(--ui-control-gap)', itemDescription: 'leading-(--ui-control-text-lg--leading)', @@ -82,6 +89,7 @@ export default defineTheme({ }, xl: { content: '[--ui-control-py:var(--ui-control-py-xl)] [--ui-control-gap:var(--ui-control-gap-xl)] [--ui-control-icon-size:var(--ui-control-icon-size-xl)]', + filter: '[--ui-control-px:var(--ui-control-py-xl)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-xl--leading)-var(--ui-control-text-xl--line-height))/2)] text-[calc(var(--ui-control-text-xl)-0.125rem)]/[calc(var(--ui-control-text-xl--leading)-0.25rem)] gap-(--ui-control-gap)', item: 'p-(--ui-control-py) text-(length:--ui-control-text-xl)/(--ui-control-text-xl--line-height) gap-(--ui-control-gap)', itemDescription: 'leading-(--ui-control-text-xl--leading)', diff --git a/src/runtime/theme/listbox.ts b/src/runtime/theme/listbox.ts index ada4ff01d1..de0c5a9d7d 100644 --- a/src/runtime/theme/listbox.ts +++ b/src/runtime/theme/listbox.ts @@ -4,7 +4,10 @@ import { defineTheme } from '../utils/theme' export default defineTheme({ slots: { root: 'flex flex-col min-h-0 min-w-0 ring ring-inset ring-default rounded-lg overflow-hidden outline-accent-focus has-focus-visible:outline-(length:--ui-focus-width) has-focus-visible:ring-accent', - filter: 'rounded-none border-b border-default', + // A field as large as an item, inset like the items: its padding is theirs, so its + // icon and text line up with them + // The root shows the focus outline, so the field shows none + filter: 'mx-1 mt-1 has-[>:focus-visible]:outline-0', content: 'relative overflow-y-auto flex-1 max-h-60 scroll-py-1 focus:outline-none', group: 'p-1 isolate', label: 'font-semibold text-strong', @@ -26,6 +29,7 @@ export default defineTheme({ size: { xs: { content: '[--ui-control-py:var(--ui-control-py-xs)] [--ui-control-gap:var(--ui-control-gap-xs)] [--ui-control-icon-size:var(--ui-control-icon-size-xs)]', + filter: '[--ui-control-px:var(--ui-control-py-xs)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-xs--leading)-var(--ui-control-text-xs--line-height))/2)] text-[calc(var(--ui-control-text-xs)-0.125rem)]/[calc(var(--ui-control-text-xs--leading)-0.25rem)] gap-(--ui-control-gap)', empty: 'py-3 text-xs', loading: 'py-3', @@ -38,6 +42,7 @@ export default defineTheme({ }, sm: { content: '[--ui-control-py:var(--ui-control-py-sm)] [--ui-control-gap:var(--ui-control-gap-sm)] [--ui-control-icon-size:var(--ui-control-icon-size-sm)]', + filter: '[--ui-control-px:var(--ui-control-py-sm)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-sm--leading)-var(--ui-control-text-sm--line-height))/2)] text-[calc(var(--ui-control-text-sm)-0.125rem)]/[calc(var(--ui-control-text-sm--leading)-0.25rem)] gap-(--ui-control-gap)', empty: 'py-4 text-xs', loading: 'py-4', @@ -50,6 +55,7 @@ export default defineTheme({ }, md: { content: '[--ui-control-py:var(--ui-control-py-md)] [--ui-control-gap:var(--ui-control-gap-md)] [--ui-control-icon-size:var(--ui-control-icon-size-md)]', + filter: '[--ui-control-px:var(--ui-control-py-md)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-md--leading)-var(--ui-control-text-md--line-height))/2)] text-[calc(var(--ui-control-text-md)-0.125rem)]/[calc(var(--ui-control-text-md--leading)-0.25rem)] gap-(--ui-control-gap)', empty: 'py-6 text-sm', loading: 'py-6', @@ -62,6 +68,7 @@ export default defineTheme({ }, lg: { content: '[--ui-control-py:var(--ui-control-py-lg)] [--ui-control-gap:var(--ui-control-gap-lg)] [--ui-control-icon-size:var(--ui-control-icon-size-lg)]', + filter: '[--ui-control-px:var(--ui-control-py-lg)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-lg--leading)-var(--ui-control-text-lg--line-height))/2)] text-[calc(var(--ui-control-text-lg)-0.125rem)]/[calc(var(--ui-control-text-lg--leading)-0.25rem)] gap-(--ui-control-gap)', empty: 'py-7 text-sm', loading: 'py-7', @@ -74,6 +81,7 @@ export default defineTheme({ }, xl: { content: '[--ui-control-py:var(--ui-control-py-xl)] [--ui-control-gap:var(--ui-control-gap-xl)] [--ui-control-icon-size:var(--ui-control-icon-size-xl)]', + filter: '[--ui-control-px:var(--ui-control-py-xl)]', label: 'px-(--ui-control-py) py-[calc(var(--ui-control-py)-(var(--ui-control-text-xl--leading)-var(--ui-control-text-xl--line-height))/2)] text-[calc(var(--ui-control-text-xl)-0.125rem)]/[calc(var(--ui-control-text-xl--leading)-0.25rem)] gap-(--ui-control-gap)', empty: 'py-8 text-base', loading: 'py-8', diff --git a/src/runtime/theme/select-menu.ts b/src/runtime/theme/select-menu.ts index 4952833698..5f26143c25 100644 --- a/src/runtime/theme/select-menu.ts +++ b/src/runtime/theme/select-menu.ts @@ -3,7 +3,10 @@ import { extendTheme } from '../utils/theme' export default extendTheme(select, { slots: { - filter: 'rounded-none border-b border-default', + // A field as large as an item, inset like the items: its padding is theirs, so its + // icon and text line up with them + // It holds the focus as long as the menu is open, so it shows no focus outline + filter: 'mx-1 mt-1 has-[>:focus-visible]:outline-0', focusScope: 'flex flex-col min-h-0 focus:outline-none', viewport: () => 'relative scroll-py-1 overflow-y-auto flex-1', content: (content: string) => [content, 'max-h-[min(15rem,var(--reka-combobox-content-available-height,15rem))] origin-(--reka-combobox-content-transform-origin) w-(--reka-combobox-trigger-width)'], @@ -12,11 +15,26 @@ export default extendTheme(select, { }, variants: { size: { - xs: { empty: 'text-(length:--ui-control-text-xs)/(--ui-control-text-xs--line-height)' }, - sm: { empty: 'text-(length:--ui-control-text-sm)/(--ui-control-text-sm--line-height)' }, - md: { empty: 'text-(length:--ui-control-text-md)/(--ui-control-text-md--line-height)' }, - lg: { empty: 'text-(length:--ui-control-text-lg)/(--ui-control-text-lg--line-height)' }, - xl: { empty: 'text-(length:--ui-control-text-xl)/(--ui-control-text-xl--line-height)' } + xs: { + filter: '[--ui-control-px:var(--ui-control-py-xs)]', + empty: 'text-(length:--ui-control-text-xs)/(--ui-control-text-xs--line-height)' + }, + sm: { + filter: '[--ui-control-px:var(--ui-control-py-sm)]', + empty: 'text-(length:--ui-control-text-sm)/(--ui-control-text-sm--line-height)' + }, + md: { + filter: '[--ui-control-px:var(--ui-control-py-md)]', + empty: 'text-(length:--ui-control-text-md)/(--ui-control-text-md--line-height)' + }, + lg: { + filter: '[--ui-control-px:var(--ui-control-py-lg)]', + empty: 'text-(length:--ui-control-text-lg)/(--ui-control-text-lg--line-height)' + }, + xl: { + filter: '[--ui-control-px:var(--ui-control-py-xl)]', + empty: 'text-(length:--ui-control-text-xl)/(--ui-control-text-xl--line-height)' + } }, virtualize: { true: { diff --git a/test/components/__snapshots__/CommandPalette-vue.spec.ts.snap b/test/components/__snapshots__/CommandPalette-vue.spec.ts.snap index a26afbee99..8be43a2f28 100644 --- a/test/components/__snapshots__/CommandPalette-vue.spec.ts.snap +++ b/test/components/__snapshots__/CommandPalette-vue.spec.ts.snap @@ -1,8 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`CommandPalette > renders with as correctly 1`] = ` -"
-
+"
+
@@ -51,8 +51,8 @@ exports[`CommandPalette > renders with as correctly 1`] = ` `; exports[`CommandPalette > renders with by correctly 1`] = ` -"
-
+"
+
@@ -100,8 +100,8 @@ exports[`CommandPalette > renders with by correctly 1`] = ` `; exports[`CommandPalette > renders with childrenIcon correctly 1`] = ` -"
-
+"
+
@@ -150,8 +150,8 @@ exports[`CommandPalette > renders with childrenIcon correctly 1`] = ` `; exports[`CommandPalette > renders with class correctly 1`] = ` -"
-
+"
+
@@ -200,8 +200,8 @@ exports[`CommandPalette > renders with class correctly 1`] = ` `; exports[`CommandPalette > renders with close correctly 1`] = ` -"
-
+"
+