Skip to content

The agent that grows with you

refactor(desktop): one menu surface for DropdownMenu, Select and cmdk pickers

brooklyn!71098a70b2b0
diff --git a/apps/desktop/DESIGN.md b/apps/desktop/DESIGN.md
index 974101afa7a..26fabb5b572 100644
--- a/apps/desktop/DESIGN.md
+++ b/apps/desktop/DESIGN.md
@@ -92,7 +92,14 @@ Don't add per-overlay `shadow-[…]` or `border-(--ui-stroke-secondary)`
one-offs; if elevation needs to change, change the token.
Menus and popovers use their own shared `shadow-md` +
-`--ui-stroke-secondary` primitive treatment. Drag affordances may use tokenized
+`--ui-stroke-secondary` primitive treatment. Every floating list —
+`DropdownMenu`, `Select`, and Popover + cmdk pickers
+(`<PopoverContent variant="menu">` + `<Command variant="menu">`) — paints
+through `src/components/ui/menu.ts`, so a list reads the same wherever it
+opens. Typed fields with suggestions use `ComboboxInput`, never
+`<input list>` + `<datalist>` (Chromium paints that as its own OS popup).
+
+Drag affordances may use tokenized
dashed targets and local blur. These are semantic surface classes, not licenses
for call-site shadow or border inventions.
diff --git a/apps/desktop/src/components/ui/command.tsx b/apps/desktop/src/components/ui/command.tsx
index 760bb1452a3..81a8dce9483 100644
--- a/apps/desktop/src/components/ui/command.tsx
+++ b/apps/desktop/src/components/ui/command.tsx
@@ -1,20 +1,36 @@
import { Command as CommandPrimitive } from 'cmdk'
import * as React from 'react'
+import { Codicon } from '@/components/ui/codicon'
import { usePointerQuiet } from '@/components/ui/keyboard-first'
+import { menuItemClass } from '@/components/ui/menu'
import { SearchIcon } from '@/lib/icons'
import { cn } from '@/lib/utils'
-function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
+type CommandVariant = 'default' | 'menu'
+
+// `default` is the palette look (command palette, model/session pickers).
+// `menu` is a picker list inside `<PopoverContent variant="menu">`: the parts
+// read the DropdownMenu/Select rows, so a combobox looks like every other menu.
+const CommandVariantContext = React.createContext<CommandVariant>('default')
+
+function Command({
+ className,
+ variant = 'default',
+ ...props
+}: React.ComponentProps<typeof CommandPrimitive> & { variant?: CommandVariant }) {
return (
- <CommandPrimitive
- className={cn(
- 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground',
- className
- )}
- data-slot="command"
- {...props}
- />
+ <CommandVariantContext.Provider value={variant}>
+ <CommandPrimitive
+ className={cn(
+ 'flex h-full w-full flex-col overflow-hidden text-popover-foreground',
+ variant === 'menu' ? 'bg-transparent' : 'rounded-md bg-popover',
+ className
+ )}
+ data-slot="command"
+ {...props}
+ />
+ </CommandVariantContext.Provider>
)
}
@@ -24,6 +40,29 @@ interface CommandInputProps extends React.ComponentProps<typeof CommandPrimitive
}
function CommandInput({ className, right, ...props }: CommandInputProps) {
+ const variant = React.useContext(CommandVariantContext)
+
+ if (variant === 'menu') {
+ // Same row as DropdownMenuSearch + its hairline: no icon, no box.
+ return (
+ <div
+ className="mb-1 flex items-center gap-2 border-b border-(--ui-stroke-tertiary) px-2 py-1.5"
+ data-slot="command-input-wrapper"
+ >
+ <CommandPrimitive.Input
+ className={cn(
+ 'h-4 w-full bg-transparent text-xs leading-none text-foreground outline-none placeholder:text-(--ui-text-tertiary) disabled:cursor-not-allowed disabled:opacity-50',
+ className
+ )}
+ data-slot="command-input"
+ spellCheck={false}
+ {...props}
+ />
+ {right}
+ </div>
+ )
+ }
+
return (
<div className="flex h-11 items-center gap-2 border-b border-border px-3" data-slot="command-input-wrapper">
<SearchIcon className="size-4 shrink-0 text-muted-foreground" />
@@ -41,6 +80,7 @@ function CommandInput({ className, right, ...props }: CommandInputProps) {
}
function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
+ const variant = React.useContext(CommandVariantContext)
// cmdk selects on pointer-enter, so a list that opens under a parked cursor —
// or re-flows under one as the query narrows — hands the selection to
// whatever row slid beneath the mouse, and Enter commits THAT. Inert until
@@ -49,17 +89,29 @@ function CommandList({ className, ...props }: React.ComponentProps<typeof Comman
return (
<CommandPrimitive.List
- className={cn('max-h-100 overflow-y-auto overflow-x-hidden', pointerQuiet && 'pointer-events-none', className)}
+ className={cn(
+ 'overflow-y-auto overflow-x-hidden',
+ variant === 'menu' ? 'dt-portal-scrollbar max-h-72' : 'max-h-100',
+ pointerQuiet && 'pointer-events-none',
+ className
+ )}
data-slot="command-list"
{...props}
/>
)
}
-function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
+function CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
+ const variant = React.useContext(CommandVariantContext)
+
return (
<CommandPrimitive.Empty
- className="py-6 text-center text-sm text-muted-foreground"
+ className={cn(
+ variant === 'menu'
+ ? 'px-2 py-3 text-center text-xs text-(--ui-text-tertiary)'
+ : 'py-6 text-center text-sm text-muted-foreground',
+ className
+ )}
data-slot="command-empty"
{...props}
/>
@@ -67,10 +119,16 @@ function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive
}
function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>) {
+ const variant = React.useContext(CommandVariantContext)
+
return (
<CommandPrimitive.Group
className={cn(
- 'overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:sticky **:[[cmdk-group-heading]]:top-0 **:[[cmdk-group-heading]]:z-10 **:[[cmdk-group-heading]]:bg-popover **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground',
+ 'overflow-hidden text-foreground **:[[cmdk-group-heading]]:sticky **:[[cmdk-group-heading]]:top-0 **:[[cmdk-group-heading]]:z-10',
+ variant === 'menu'
+ ? // menuLabelClass, spelled out so Tailwind can see it.
+ 'p-0 **:[[cmdk-group-heading]]:bg-(--ui-bg-elevated) **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-(--ui-text-tertiary)'
+ : 'p-1 **:[[cmdk-group-heading]]:bg-popover **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground',
className
)}
data-slot="command-group"
@@ -80,9 +138,11 @@ function CommandGroup({ className, ...props }: React.ComponentProps<typeof Comma
}
function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
+ const variant = React.useContext(CommandVariantContext)
+
return (
<CommandPrimitive.Separator
- className={cn('-mx-1 h-px bg-border', className)}
+ className={cn('-mx-1 h-px', variant === 'menu' ? 'my-1 bg-(--ui-stroke-tertiary)' : 'bg-border', className)}
data-slot="command-separator"
{...props}
/>
@@ -90,10 +150,18 @@ function CommandSeparator({ className, ...props }: React.ComponentProps<typeof C
}
function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
+ const variant = React.useContext(CommandVariantContext)
+
return (
<CommandPrimitive.Item
className={cn(
- 'relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50',
+ variant === 'menu'
+ ? cn(
+ menuItemClass,
+ 'cursor-pointer data-[selected=true]:bg-(--ui-control-active-background) data-[selected=true]:text-foreground'
+ )
+ : 'relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground',
+ 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',
className
)}
data-slot="command-item"
@@ -102,6 +170,11 @@ function CommandItem({ className, ...props }: React.ComponentProps<typeof Comman
)
}
+/** The trailing check a menu row wears when it's the current value — same glyph and spot as DropdownMenu/Select. */
+function CommandItemCheck({ checked }: { checked: boolean }) {
+ return checked ? <Codicon className="ml-auto pl-2 text-foreground" name="check" size="0.75rem" /> : null
+}
+
function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {
return (
<span
@@ -118,6 +191,7 @@ export {
CommandGroup,
CommandInput,
CommandItem,
+ CommandItemCheck,
CommandList,
CommandSeparator,
CommandShortcut
diff --git a/apps/desktop/src/components/ui/dropdown-menu.tsx b/apps/desktop/src/components/ui/dropdown-menu.tsx
index 465e2efab41..5da802b6902 100644
--- a/apps/desktop/src/components/ui/dropdown-menu.tsx
+++ b/apps/desktop/src/components/ui/dropdown-menu.tsx
@@ -3,6 +3,13 @@ import * as React from 'react'
import { Codicon } from '@/components/ui/codicon'
import { usePopoverPortalContainer } from '@/components/ui/dialog-portal-context'
+import {
+ menuItemClass,
+ menuItemFocusClass,
+ menuLabelClass,
+ menuMotionClass,
+ menuSurfaceClass
+} from '@/components/ui/menu'
import { cn } from '@/lib/utils'
// Shared class tokens for edge-to-edge menus (use with `p-0` content): rows go
@@ -89,11 +96,10 @@ function DropdownMenuContent({
return (
<DropdownMenuPrimitive.Portal container={container}>
<DropdownMenuPrimitive.Content
- // `dt-portal-scrollbar` reproduces the thin themed scrollbar from
- // `.scrollbar-dt` for portaled overlays (Radix renders this under
- // document.body, outside #root's scope). See styles.css.
className={cn(
- 'dt-portal-scrollbar z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-36 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-(--ui-stroke-secondary) bg-[color-mix(in_srgb,var(--ui-bg-elevated)_96%,transparent)] p-1 text-[length:var(--conversation-text-font-size)] text-popover-foreground shadow-md backdrop-blur-md data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
+ menuSurfaceClass,
+ menuMotionClass,
+ 'z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-36 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto',
className
)}
// Keep the menu inside the viewport: Radix flips/shifts away from edges
@@ -123,7 +129,9 @@ function DropdownMenuItem({
return (
<DropdownMenuPrimitive.Item
className={cn(
- "relative flex items-center gap-2 rounded-md px-2 py-1 text-xs outline-hidden select-none focus:bg-(--ui-control-active-background) focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 [&_svg:not([class*='text-'])]:text-(--ui-text-tertiary) data-[variant=destructive]:*:[svg]:text-destructive!",
+ menuItemClass,
+ menuItemFocusClass,
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg:not([class*='text-'])]:text-(--ui-text-tertiary) data-[variant=destructive]:*:[svg]:text-destructive!",
className
)}
data-inset={inset}
@@ -144,7 +152,9 @@ function DropdownMenuCheckboxItem({
<DropdownMenuPrimitive.CheckboxItem
checked={checked}
className={cn(
- "relative flex items-center gap-2 rounded-md px-2 py-1 text-xs outline-hidden select-none focus:bg-(--ui-control-active-background) focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
+ menuItemClass,
+ menuItemFocusClass,
+ 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className
)}
data-slot="dropdown-menu-checkbox-item"
@@ -170,7 +180,9 @@ function DropdownMenuRadioItem({
return (
<DropdownMenuPrimitive.RadioItem
className={cn(
- "relative flex items-center gap-2 rounded-md px-2 py-1 text-xs outline-hidden select-none focus:bg-(--ui-control-active-background) focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
+ menuItemClass,
+ menuItemFocusClass,
+ 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className
)}
data-slot="dropdown-menu-radio-item"
@@ -193,7 +205,7 @@ function DropdownMenuLabel({
}) {
return (
<DropdownMenuPrimitive.Label
- className={cn('px-2 py-1 text-xs font-medium text-(--ui-text-tertiary) data-[inset]:pl-7', className)}
+ className={cn(menuLabelClass, 'data-[inset]:pl-7', className)}
data-inset={inset}
data-slot="dropdown-menu-label"
{...props}
@@ -264,13 +276,13 @@ function DropdownMenuSubContent({
// it to the SubTrigger and handles collision/flip, so portaling is safe.
<DropdownMenuPrimitive.Portal>
<DropdownMenuPrimitive.SubContent
- // `dt-portal-scrollbar` reproduces the themed scrollbar for portaled
- // overlays (rendered under document.body). Use a fixed `max-h-80`
- // rather than the Radix available-height variable: that variable is
- // only published on Content, NOT SubContent — using it here collapses
- // the submenu to 0px height.
+ // Fixed `max-h-80` rather than the Radix available-height variable:
+ // that variable is only published on Content, NOT SubContent — using
+ // it here collapses the submenu to 0px height.
className={cn(
- 'dt-portal-scrollbar z-50 max-h-80 min-w-36 origin-(--radix-dropdown-menu-content-transform-origin) overflow-y-auto rounded-lg border border-(--ui-stroke-secondary) bg-[color-mix(in_srgb,var(--ui-bg-elevated)_96%,transparent)] p-1 text-[length:var(--conversation-text-font-size)] text-popover-foreground shadow-md backdrop-blur-md data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
+ menuSurfaceClass,
+ menuMotionClass,
+ 'z-50 max-h-80 min-w-36 origin-(--radix-dropdown-menu-content-transform-origin) overflow-y-auto',
className
)}
// Flip to the other side / shift vertically when near a viewport edge
diff --git a/apps/desktop/src/components/ui/menu.ts b/apps/desktop/src/components/ui/menu.ts
new file mode 100644
index 00000000000..d9c83851b20
--- /dev/null
+++ b/apps/desktop/src/components/ui/menu.ts
@@ -0,0 +1,23 @@
+// The one floating-list look. DropdownMenu, Select, and every Popover + cmdk
+// picker (`<PopoverContent variant="menu">` + `<Command variant="menu">`) paint
+// through these, so a list reads the same wherever it opens. Change the menu
+// here, never per call site.
+
+// `dt-portal-scrollbar` reproduces the thin themed scrollbar from
+// `.scrollbar-dt` for portaled overlays (Radix renders under document.body,
+// outside #root's scope). See styles.css.
+export const menuSurfaceClass =
+ 'dt-portal-scrollbar rounded-lg border border-(--ui-stroke-secondary) bg-[color-mix(in_srgb,var(--ui-bg-elevated)_96%,transparent)] p-1 text-[length:var(--conversation-text-font-size)] text-popover-foreground shadow-md backdrop-blur-md'
+
+export const menuMotionClass =
+ 'data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95'
+
+// Row shape only. Each primitive adds its own highlight/disabled selectors:
+// Radix rows take real focus (`focus:`), cmdk rows stay behind the input and
+// mark `data-selected="true"`.
+export const menuItemClass =
+ "relative flex items-center gap-2 rounded-md px-2 py-1 text-xs outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5"
+
+export const menuItemFocusClass = 'focus:bg-(--ui-control-active-background) focus:text-foreground'
+
+export const menuLabelClass = 'px-2 py-1 text-xs font-medium text-(--ui-text-tertiary)'
diff --git a/apps/desktop/src/components/ui/popover.tsx b/apps/desktop/src/components/ui/popover.tsx
index 040bb1f988c..e40a27dd26f 100644
--- a/apps/desktop/src/components/ui/popover.tsx
+++ b/apps/desktop/src/components/ui/popover.tsx
@@ -3,6 +3,7 @@ import { Popover as PopoverPrimitive } from 'radix-ui'
import * as React from 'react'
import { usePopoverPortalContainer } from '@/components/ui/dialog-portal-context'
+import { menuSurfaceClass } from '@/components/ui/menu'
import { cn } from '@/lib/utils'
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
@@ -36,7 +37,11 @@ const popoverContentVariants = cva(
// `primary`: a pale accent would otherwise fill this with a pastel and
// pair it with near-black text (themes/context.tsx).
accent:
- 'bg-(--popover-surface) text-(--dt-primary-solid-foreground) [--popover-surface:var(--dt-primary-solid)]'
+ 'bg-(--popover-surface) text-(--dt-primary-solid-foreground) [--popover-surface:var(--dt-primary-solid)]',
+ // A picker list (Popover + `<Command variant="menu">`): the exact
+ // DropdownMenu/Select surface, and no arrow — menus drop from their
+ // trigger, they don't point at it.
+ menu: cn(menuSurfaceClass, 'w-auto')
}
},
defaultVariants: { variant: 'default' }
@@ -55,8 +60,8 @@ function PopoverContent({
children,
className,
collisionPadding = 8,
- sideOffset = 6,
variant,
+ sideOffset = variant === 'menu' ? 4 : 6,
...props
}: PopoverContentProps) {
// Portal into the enclosing dialog when nested in one (keeps focus inside so
@@ -80,19 +85,21 @@ function PopoverContent({
the border on its two outer edges only. Radix authors the child pointing
"down" and rotates the wrapper per side, so the V always faces outward.
The square's inner half tucks under the body, opening the border seam. */}
- <PopoverPrimitive.Arrow asChild height={7} width={16}>
- <span className="relative block h-[7px] w-4 overflow-visible">
- <span
- className={cn(
- 'absolute top-0 left-1/2 size-[11px] -translate-x-1/2 -translate-y-1/2 rotate-45 bg-(--popover-surface)',
- variant === 'accent'
- ? // Borderless and opaque: nothing to seam, nothing to blur.
- 'rounded-[1px]'
- : 'border-r border-b border-(--ui-stroke-secondary) backdrop-blur-md'
- )}
- />
- </span>
- </PopoverPrimitive.Arrow>
+ {variant !== 'menu' && (
+ <PopoverPrimitive.Arrow asChild height={7} width={16}>
+ <span className="relative block h-[7px] w-4 overflow-visible">
+ <span
+ className={cn(
+ 'absolute top-0 left-1/2 size-[11px] -translate-x-1/2 -translate-y-1/2 rotate-45 bg-(--popover-surface)',
+ variant === 'accent'
+ ? // Borderless and opaque: nothing to seam, nothing to blur.
+ 'rounded-[1px]'
+ : 'border-r border-b border-(--ui-stroke-secondary) backdrop-blur-md'
+ )}
+ />
+ </span>
+ </PopoverPrimitive.Arrow>
+ )}
</PopoverPrimitive.Content>
</PopoverPrimitive.Portal>
)
diff --git a/apps/desktop/src/components/ui/select.tsx b/apps/desktop/src/components/ui/select.tsx
index 059575a1c82..20749fe223e 100644
--- a/apps/desktop/src/components/ui/select.tsx
+++ b/apps/desktop/src/components/ui/select.tsx
@@ -4,6 +4,13 @@ import * as React from 'react'
import { Codicon } from '@/components/ui/codicon'
import { type ControlVariantProps, controlVariants } from '@/components/ui/control'
import { usePopoverPortalContainer } from '@/components/ui/dialog-portal-context'
+import {
+ menuItemClass,
+ menuItemFocusClass,
+ menuLabelClass,
+ menuMotionClass,
+ menuSurfaceClass
+} from '@/components/ui/menu'
import { cn } from '@/lib/utils'
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
@@ -41,7 +48,9 @@ function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.V
function SelectContent({
className,
children,
+ collisionPadding = 8,
position = 'popper',
+ sideOffset = 4,
...props
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
// Portal into the enclosing dialog (if any) so the dropdown is a DOM
@@ -53,19 +62,23 @@ function SelectContent({
<SelectPrimitive.Portal container={container}>
<SelectPrimitive.Content
className={cn(
- 'relative z-(--z-modal-popover) max-h-72 min-w-32 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=top]:slide-in-from-bottom-2 data-[side=right]:slide-in-from-left-2',
+ menuSurfaceClass,
+ menuMotionClass,
+ 'relative z-(--z-modal-popover) max-h-72 min-w-36 overflow-hidden p-0',
position === 'popper' &&
- 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
+ 'max-h-[min(18rem,var(--radix-select-content-available-height))] origin-(--radix-select-content-transform-origin)',
className
)}
+ collisionPadding={position === 'popper' ? collisionPadding : undefined}
data-slot="select-content"
position={position}
+ sideOffset={position === 'popper' ? sideOffset : undefined}
{...props}
>
<SelectPrimitive.Viewport
className={cn(
- 'p-1',
- position === 'popper' && 'h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)'
+ 'dt-portal-scrollbar p-1',
+ position === 'popper' && 'w-full min-w-(--radix-select-trigger-width)'
)}
>
{children}
@@ -80,28 +93,24 @@ function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.G
}
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
- return (
- <SelectPrimitive.Label
- className={cn('px-2 py-1.5 text-[0.65rem] font-medium uppercase tracking-wide text-muted-foreground', className)}
- data-slot="select-label"
- {...props}
- />
- )
+ return <SelectPrimitive.Label className={cn(menuLabelClass, className)} data-slot="select-label" {...props} />
}
function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {
return (
<SelectPrimitive.Item
className={cn(
- 'relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-xs outline-none select-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:cursor-default data-disabled:opacity-50',
+ menuItemClass,
+ menuItemFocusClass,
+ 'w-full cursor-pointer pr-7 data-disabled:pointer-events-none data-disabled:cursor-default data-disabled:opacity-50',
className
)}
data-slot="select-item"
{...props}
>
- <span className="absolute right-2 flex size-3.5 items-center justify-center">
+ <span className="absolute right-2 flex size-3.5 items-center justify-center text-foreground">
<SelectPrimitive.ItemIndicator>
- <Codicon name="check" size="1rem" />
+ <Codicon name="check" size="0.75rem" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>