@vvedantb/ui 0.48.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -340,12 +340,12 @@ import {
340
340
  </AppShell>
341
341
  ```
342
342
 
343
- - Widths: `AppShell` sets `--app-shell-rail-width` (default `4rem`), `--app-shell-sidebar-width` (rail plus panel, default `20rem`) and `--app-shell-mobile-header-height` (default `calc(3.5rem + env(safe-area-inset-top, 0px))`) as inline style. Change them with `railWidth`, `sidebarWidth` and `mobileHeaderHeight`. The other pieces read these variables. Outside `AppShell`, set the variables yourself or pass a width class with `className`.
343
+ - Widths: `AppShell` sets `--app-shell-rail-width` (default `3.5rem`; `4rem` before 0.49.0), `--app-shell-sidebar-width` (rail plus panel, default `19.5rem`; `20rem` before 0.49.0) and `--app-shell-mobile-header-height` (default `calc(3.5rem + env(safe-area-inset-top, 0px))`) as inline style. Change them with `railWidth`, `sidebarWidth` and `mobileHeaderHeight`. The other pieces read these variables. Outside `AppShell`, set the variables yourself or pass a width class with `className`.
344
344
  - `AppShell`: `sidebar`, `children`, `panelHidden` (main offsets by the rail width instead of the sidebar width), `skipLinkLabel` (`"Skip to main content"`), `mainId` (`"main-content"`), `className`, `mainClassName`, `contentClassName`.
345
345
  - `AppSidebar`: legacy (still supported) `rail`, `panel` and `mobile*` props; compose `Sidebar.*` instead. `rail`, `panel` (not rendered while `panelHidden`), `collapsed`, `panelHidden`, `isDesktop`, `mobileOpen`, `onMobileOpenChange`, `id` (default from `useId`), `asideProps` (`data-*` attributes for the `<aside>`), `className`, `mobileTitle`, `mobileHeaderActions` (0.5.2; trailing actions such as icon buttons, in place of the end spacer), `mobileMenuIcon` (`(open) => node`, default a menu icon), `mobileMenuLabel` (`"Open navigation menu"`), `closeLabel` (`"Close navigation"`). Swipe left or Escape closes the drawer. The drawer is `inert` while closed on mobile, and closes when `isDesktop` becomes `true`. Close it on route change in the app. The mobile header is a three-column grid, so the title and trailing actions stay on one row and a long title truncates (0.5.4).
346
346
  - `SidebarRail`: legacy (still supported) `top`, `footer`, `bodyAsChild`, `tabs` and `*ClassName` props; compose `Sidebar.Rail` parts instead. `top`, `children` (scroll body), `footer`, `showDivider`, `bodyAsChild` (the single child, for example a tabs list, becomes the body), `className`, `topClassName`, `bodyClassName`, `footerClassName`. Other HTML attributes (`id`, `data-*`, `aria-*`) go to the root `<div>`. The top and footer wrappers render only when their slot is set.
347
347
  - `RailTile`: `label` (`aria-label` and tooltip), `active`, `tooltip`, `showTooltip` (default `true`), `badge` (inside the tile, after the children; style it with `railBadgeClass`), `asChild`, `app`, `className`. Without `asChild` it is a native `<button type="button">` (0.5.3), so icons keep their authored size; other props go to it. With `asChild` the child (for example a router link) gets the tile classes and `aria-current="page"` when active.
348
- - Rail app icon: the home `RailTile` icon is 26px across the apps, enforced by the tile. Pass `app="vmem"` (any `ProductAppName`) and the tile renders `APP_ICONS[app]` at `SIDEBAR_RAIL_APP_ICON_SIZE` (`26`). With `asChild` it goes inside the child (`<Link to="/" />`); without it, `children` are ignored. Tiles without `app` are unchanged: the tile renders the icon you pass, at its size. `Sidebar.MobileHeader` is the standard mobile bar: 56px plus safe-area, solid `bg-surface`, centred `text-base font-semibold tracking-tight` title, 20px menu icon.
348
+ - Rail app icon: the home `RailTile` icon is 24px across the apps (26px before 0.49.0), enforced by the tile. Pass `app="vmem"` (any `ProductAppName`) and the tile renders `APP_ICONS[app]` at `SIDEBAR_RAIL_APP_ICON_SIZE` (`24`). With `asChild` it goes inside the child (`<Link to="/" />`); without it, `children` are ignored. Tiles without `app` are unchanged: the tile renders the icon you pass, at its size. `Sidebar.MobileHeader` is the standard mobile bar: 56px plus safe-area, solid `bg-surface`, centred `text-base font-semibold tracking-tight` title, 20px menu icon.
349
349
  - `RailDivider`, `SidebarIconTooltip` (`label`, `enabled`, `side` `"right"`, `sideOffset` 8).
350
350
  - `SidebarPanel`: legacy (still supported) `headerTrailing`, `onClose`, `closeLabel` and `closeButtonClassName`; compose `Sidebar.Panel` parts instead. `title`, `headerTrailing`, `onClose` (adds the close button; pass it on the mobile drawer only), `closeLabel`, `closeButtonClassName`, `collapsed` (`md:hidden`), `className`, `children`.
351
351
  - `SidebarAccountMenu`: legacy (still supported) `badge`, `triggerProps`, `contentProps` and `stackedLabel`; compose `Sidebar.Account*` parts instead. `name`, `email` (two-line label when set), `stackedLabel` (two-line layout even without `email`, default `false`), `imageUrl` (initials without it), `align` (`"center"`), `side` (`"right"`), `sideOffset` (8), `collisionPadding`, `contentClassName`, `children` (menu items). 0.5.2 adds `badge` (unread dot beside the trigger, in a `relative` wrapper around the menu, so the trigger's dimming and press scale skip it: `true` shows it, `false` fades it out, omitted renders no wrapper and no dot), `triggerProps` (spread onto the trigger `Button` after the defaults; `className` merges last) and `contentProps` (spread onto `DropdownMenuContent`, for example `fitViewport` or `aria-label`; no `className`, use `contentClassName`). `SidebarAccountMenuPlaceholder` is the tile-sized loading box.
@@ -681,6 +681,7 @@ The radius utilities now come with `tokens.css` (and `compat-shadcn-rgb.css`), s
681
681
  | --- | --- | --- |
682
682
  | `rounded-surface` | `clamp(0.75rem, var(--radius), 1rem)` (16px) | Opt-in surfaces (Toaster `toastRadius="surface"`, `SessionsHoverCard`). Was in `utilities.css`. |
683
683
  | `rounded-menu-item` | `min(var(--radius), 0.5rem)` (8px) | Menu items and sidebar nav rows. |
684
+ | `rounded-menu` | `min(var(--radius), calc(min(var(--radius), 0.5rem) + var(--spacing)))` (12px) | Menu surfaces, from 0.49.0: the item radius plus the `p-1` inset, so the gap between a highlighted item and the surface edge is the same round the corner. |
684
685
  | `rounded-control` | `min(var(--radius), 0.625rem)` (10px) | Apps. |
685
686
 
686
687
  The root `cn` knows these are radius classes, so `cn("rounded-lg", "rounded-menu-item")` keeps only the last one.
@@ -692,6 +693,8 @@ The root `cn` knows these are radius classes, so `cn("rounded-lg", "rounded-menu
692
693
  | `DropdownMenu` and `ContextMenu` item, sub-trigger, checkbox item and radio item | `rounded-md`, `calc(var(--radius) - 2px)` (14px) | `rounded-menu-item` (8px) |
693
694
  | Menu surface | `rounded-lg` (16px) | unchanged |
694
695
 
696
+ From 0.49.0 the `DropdownMenu`, `ContextMenu`, `Select` and `RadixSelect` surfaces use `rounded-menu` (12px) in place of `rounded-lg` (16px), and menus are more compact: the surface inset is `p-1` (was `p-1.5`), items, sub-triggers, checkbox, radio and select items are `py-1.5` (32px, was `py-2`, 36px; still `max-sm:min-h-10`), and separators are `-mx-1`. `Command` matches: the root and, from `sm`, the `CommandDialog` content use `rounded-menu`, `CommandGroup` is `p-1`, `CommandItem` is `py-1.5`, `CommandSeparator` is `-mx-1` and `CommandList` no longer has `pb-2`. `ComposerSlashMenu` (was `rounded-surface`, 16px) and the model picker (`modelPickerSurfaceClass` and `ModelPickerContent`, was `rounded-lg`, 16px) use `rounded-menu` too; the model picker list inset is `p-1` (was `px-1.5 py-1.5`) and its rows and rail tiles use `rounded-menu-item` (was `rounded-md`, 14px). `Popover`, `HoverCard` and `FloatingBar` keep `floatingSurfaceClass` (`rounded-lg`).
697
+
695
698
  From 0.16.2, `Select` and `RadixSelect` items (`rounded-lg`, 16px), `CommandItem` (`rounded-md`, 14px) and `ComposerSlashMenu` rows (`rounded-lg`, 16px) also use `rounded-menu-item` (8px).
696
699
 
697
700
  ### Sidebar panel nav rows
@@ -53,8 +53,8 @@ function Root(t0) {
53
53
  t5 = $[9];
54
54
  }
55
55
  const panelHidden = t1 === undefined ? false : t1;
56
- const railWidth = t2 === undefined ? "4rem" : t2;
57
- const sidebarWidth = t3 === undefined ? "20rem" : t3;
56
+ const railWidth = t2 === undefined ? "3.5rem" : t2;
57
+ const sidebarWidth = t3 === undefined ? "19.5rem" : t3;
58
58
  const mobileHeaderHeight = t4 === undefined ? "calc(3.5rem + env(safe-area-inset-top, 0px))" : t4;
59
59
  const mainId = t5 === undefined ? "main-content" : t5;
60
60
  const resize = useSidebarResizeState(resizable);
@@ -410,7 +410,7 @@ export function AccountTrigger(t0) {
410
410
  const t1 = `Account menu for ${userName}`;
411
411
  let t2;
412
412
  if ($[6] !== className) {
413
- t2 = cn(railTileClass, "h-11 w-11 p-0", railTileStateClass(false), className);
413
+ t2 = cn(railTileClass, "h-11 w-11 p-0 md:h-10 md:w-10", railTileStateClass(false), className);
414
414
  $[6] = className;
415
415
  $[7] = t2;
416
416
  } else {
@@ -633,7 +633,7 @@ export function SidebarAccountMenuPlaceholder(t0) {
633
633
  } = t0;
634
634
  let t1;
635
635
  if ($[0] !== className) {
636
- t1 = cn("size-11 rounded-lg bg-surface-tertiary", className);
636
+ t1 = cn("size-11 rounded-lg bg-surface-tertiary md:size-10", className);
637
637
  $[0] = className;
638
638
  $[1] = t1;
639
639
  } else {
@@ -194,7 +194,7 @@ export function RailHeader(t0) {
194
194
  }
195
195
  let t1;
196
196
  if ($[3] !== className) {
197
- t1 = cn("flex w-full flex-col items-center gap-1.5 px-0 pt-3", className);
197
+ t1 = cn("flex w-full flex-col items-center gap-1 px-0 pt-3", className);
198
198
  $[3] = className;
199
199
  $[4] = t1;
200
200
  } else {
@@ -243,7 +243,7 @@ export function RailBody(t0) {
243
243
  const tabs = t2 === undefined ? false : t2;
244
244
  let t3;
245
245
  if ($[5] !== className) {
246
- t3 = cn("flex w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto py-2", className);
246
+ t3 = cn("flex w-full flex-1 flex-col items-center gap-1 overflow-y-auto py-2", className);
247
247
  $[5] = className;
248
248
  $[6] = t3;
249
249
  } else {
@@ -302,7 +302,7 @@ export function RailFooter(t0) {
302
302
  }
303
303
  let t1;
304
304
  if ($[3] !== className) {
305
- t1 = cn("flex w-full flex-col items-center gap-1.5 py-3", className);
305
+ t1 = cn("flex w-full flex-col items-center gap-1 py-3", className);
306
306
  $[3] = className;
307
307
  $[4] = t1;
308
308
  } else {
@@ -6,10 +6,10 @@ import { cn } from "../../src/utils/cn.js";
6
6
  // on the marked lines only.
7
7
 
8
8
  /** App icon size in px for the home `RailTile`. Fixed across the apps. `RailTile` applies it when you pass `app`. */
9
- export const SIDEBAR_RAIL_APP_ICON_SIZE = 26;
9
+ export const SIDEBAR_RAIL_APP_ICON_SIZE = 24;
10
10
 
11
- /** Rail tile: size-11, rounded-lg, press scale. */
12
- export const railTileClass = "relative flex size-11 items-center justify-center rounded-lg border active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring";
11
+ /** Rail tile: 44px on touch layouts, 40px from `md`, rounded-lg, press scale. */
12
+ export const railTileClass = "relative flex size-11 md:size-10 items-center justify-center rounded-lg border active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring";
13
13
  const railTileActiveClass = "border-transparent bg-surface-tertiary text-foreground";
14
14
  const railTileIdleClass = "border-transparent text-muted opacity-75 hover:bg-surface-tertiary/50 hover:opacity-100 hover:text-foreground"; // check-tokens-allow: text-muted
15
15
 
@@ -441,7 +441,7 @@ export function ModelPickerContent(t0) {
441
441
  type: "button",
442
442
  "data-model-picker-instance": instance_4.key,
443
443
  disabled: isLockedTeam,
444
- className: merge("relative isolate flex aspect-square w-full items-center justify-center rounded-md transition-colors", isPersonalTeamVariant ? "opacity-40" : "hover:bg-surface-secondary", isLockedTeam ? "cursor-not-allowed" : "cursor-pointer hover:bg-surface-secondary"),
444
+ className: merge("relative isolate flex aspect-square w-full items-center justify-center rounded-menu-item transition-colors", isPersonalTeamVariant ? "opacity-40" : "hover:bg-surface-secondary", isLockedTeam ? "cursor-not-allowed" : "cursor-pointer hover:bg-surface-secondary"),
445
445
  "aria-label": instance_4.label,
446
446
  onClick: () => {
447
447
  if (isLockedTeam) {
@@ -558,7 +558,7 @@ export function ModelPickerContent(t0) {
558
558
  let t24;
559
559
  if ($[72] !== activeCompositeKey || $[73] !== canSelectTeamWhilePersonal || $[74] !== lockedTeamKey || $[75] !== lockedTeamLabel || $[76] !== merge || $[77] !== onSelect || $[78] !== options || $[79] !== providerCounts || $[80] !== rows) {
560
560
  t24 = /*#__PURE__*/_jsxs(CommandList, {
561
- className: "max-h-none h-full flex-1 overflow-y-auto overscroll-contain px-1.5 py-1.5",
561
+ className: "max-h-none h-full flex-1 overflow-y-auto overscroll-contain p-1",
562
562
  onScroll: t21,
563
563
  ref: t22,
564
564
  children: [t23, rows.map(row => {
@@ -583,7 +583,7 @@ export function ModelPickerContent(t0) {
583
583
  setSearch("");
584
584
  onSelect(option_2.id, row.instance.accountId);
585
585
  },
586
- className: merge("flex flex-col items-stretch gap-1 rounded-md px-2 py-2.5 data-[selected=true]:bg-surface-secondary", isPersonalTeamVariant_0 && "opacity-50", isLockedTeamRow ? "cursor-not-allowed" : "cursor-pointer"),
586
+ className: merge("flex flex-col items-stretch gap-1 rounded-menu-item px-2 py-2.5 data-[selected=true]:bg-surface-secondary", isPersonalTeamVariant_0 && "opacity-50", isLockedTeamRow ? "cursor-not-allowed" : "cursor-pointer"),
587
587
  children: /*#__PURE__*/_jsxs(Tooltip, {
588
588
  children: [/*#__PURE__*/_jsx(TooltipTrigger, {
589
589
  asChild: true,
@@ -674,7 +674,7 @@ export function ModelPickerContent(t0) {
674
674
  if ($[94] !== t14 || $[95] !== t27) {
675
675
  t28 = /*#__PURE__*/_jsx(TooltipProvider, {
676
676
  children: /*#__PURE__*/_jsxs("div", {
677
- className: "flex h-96 max-h-[min(24rem,var(--radix-popover-content-available-height))] w-full flex-col overflow-hidden rounded-lg bg-popover smooth-shadow-ring-lg",
677
+ className: "flex h-96 max-h-[min(24rem,var(--radix-popover-content-available-height))] w-full flex-col overflow-hidden rounded-menu bg-popover smooth-shadow-ring-lg",
678
678
  "data-model-picker-content": true,
679
679
  children: [t14, t27]
680
680
  })
@@ -31,7 +31,7 @@ const TRIGGER_CLASS =
31
31
  * Shared chrome for the picker panel (popover + menu submenu). Keep these in
32
32
  * sync so trigger vs embed surfaces cannot drift.
33
33
  */
34
- export const modelPickerSurfaceClass = "w-100 max-w-[calc(100vw-1rem)] overflow-hidden rounded-lg border-0 bg-transparent p-0 shadow-none";
34
+ export const modelPickerSurfaceClass = "w-100 max-w-[calc(100vw-1rem)] overflow-hidden rounded-menu border-0 bg-transparent p-0 shadow-none";
35
35
  /**
36
36
  * Button + popover model picker (create modal, composers, toolbars).
37
37
  * For context/dropdown menus, embed `ModelPickerContent` with
@@ -94,7 +94,7 @@ export function ComposerSlashMenu(t0) {
94
94
  } else {
95
95
  t10 = $[10];
96
96
  }
97
- const t11 = "flex flex-col overflow-hidden rounded-surface bg-popover/95 text-popover-foreground backdrop-blur-md smooth-shadow-ring-lg " + (isAbove ? "origin-bottom" : "origin-top");
97
+ const t11 = "flex flex-col overflow-hidden rounded-menu bg-popover/95 text-popover-foreground backdrop-blur-md smooth-shadow-ring-lg " + (isAbove ? "origin-bottom" : "origin-top");
98
98
  const t12 = flatItems.length > 0 ? /*#__PURE__*/_jsx("div", {
99
99
  ref: listRef,
100
100
  id: listboxId,
@@ -1,12 +1,17 @@
1
1
  // floating overlay: tone + smooth-shadow-ring, never border+shadow
2
- export const floatingSurfaceClass = "rounded-lg bg-overlay text-overlay-foreground smooth-shadow-ring-lg max-sm:max-w-[calc(100vw-2rem)]";
2
+ const floatingSurfaceToneClass = "bg-overlay text-overlay-foreground smooth-shadow-ring-lg max-sm:max-w-[calc(100vw-2rem)]";
3
+ export const floatingSurfaceClass = `rounded-lg ${floatingSurfaceToneClass}`;
4
+
5
+ // Menu surface: the corner is the item radius plus the `p-1` inset, so a
6
+ // highlighted item keeps the same gap to the edge round the corner.
7
+ export const menuSurfaceClass = `rounded-menu ${floatingSurfaceToneClass}`;
3
8
  export const floatingSurfaceAnimateClass = ["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=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"].join(" ");
4
9
 
5
10
  // shared floating menu surfaces: popover tone + smooth-shadow-ring-lg
6
- export const menuContentClass = ["z-50 min-w-[12rem] overflow-hidden p-1.5 outline-none max-sm:max-h-[85dvh] max-sm:overflow-y-auto", floatingSurfaceClass, floatingSurfaceAnimateClass].join(" ");
7
- export const menuSubTriggerClass = "flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-2 max-sm:min-h-10 text-sm text-foreground outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[state=open]:bg-default data-[disabled]:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
8
- export const menuItemClass = "relative flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-2 max-sm:min-h-10 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0 [&_svg]:pointer-events-none";
9
- export const menuCheckboxRadioItemClass = "relative flex cursor-pointer select-none items-center rounded-menu-item py-2 max-sm:min-h-10 pl-8 pr-2.5 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
11
+ export const menuContentClass = ["z-50 min-w-[12rem] overflow-hidden p-1 outline-none max-sm:max-h-[85dvh] max-sm:overflow-y-auto", menuSurfaceClass, floatingSurfaceAnimateClass].join(" ");
12
+ export const menuSubTriggerClass = "flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm text-foreground outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[state=open]:bg-default data-[disabled]:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
13
+ export const menuItemClass = "relative flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0 [&_svg]:pointer-events-none";
14
+ export const menuCheckboxRadioItemClass = "relative flex cursor-pointer select-none items-center rounded-menu-item py-1.5 max-sm:min-h-10 pl-8 pr-2.5 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
10
15
  export const menuLabelClass = "px-2.5 py-1.5 text-xs font-semibold uppercase tracking-widest text-muted-foreground";
11
- export const menuSeparatorClass = "-mx-1.5 my-1 h-px bg-separator";
16
+ export const menuSeparatorClass = "-mx-1 my-1 h-px bg-separator";
12
17
  export const menuShortcutClass = "ml-auto text-xs tracking-wide text-muted-foreground/90";
@@ -25,7 +25,7 @@ const Command = /*#__PURE__*/React.forwardRef((t0, ref) => {
25
25
  }
26
26
  const root = useUiConfig("Command")?.classes?.root;
27
27
  const merge = useCn();
28
- const t1 = root ?? "flex h-full w-full flex-col overflow-hidden rounded-lg bg-overlay text-overlay-foreground";
28
+ const t1 = root ?? "flex h-full w-full flex-col overflow-hidden rounded-menu bg-overlay text-overlay-foreground";
29
29
  let t2;
30
30
  if ($[3] !== className || $[4] !== merge || $[5] !== t1) {
31
31
  t2 = merge(t1, className);
@@ -100,7 +100,7 @@ function CommandDialog(t0) {
100
100
  const listLayout = t1 === undefined ? "pinned" : t1;
101
101
  const classes = useUiConfig("Command")?.classes;
102
102
  const merge = useCn();
103
- const t2 = classes?.dialogContent ?? "overflow-hidden p-0 sm:max-w-xl";
103
+ const t2 = classes?.dialogContent ?? "overflow-hidden p-0 sm:max-w-xl sm:rounded-menu";
104
104
  let t3;
105
105
  if ($[8] !== className || $[9] !== merge || $[10] !== t2) {
106
106
  t3 = merge(t2, className);
@@ -259,7 +259,7 @@ const CommandList = /*#__PURE__*/React.forwardRef((t0, ref) => {
259
259
  }
260
260
  const list = useUiConfig("Command")?.classes?.list;
261
261
  const merge = useCn();
262
- const t1 = list ?? "max-h-80 max-sm:max-h-[60dvh] overflow-y-auto overflow-x-hidden pb-2";
262
+ const t1 = list ?? "max-h-80 max-sm:max-h-[60dvh] overflow-y-auto overflow-x-hidden";
263
263
  let t2;
264
264
  if ($[3] !== className || $[4] !== merge || $[5] !== t1) {
265
265
  t2 = merge(t1, className);
@@ -352,7 +352,7 @@ const CommandGroup = /*#__PURE__*/React.forwardRef((t0, ref) => {
352
352
  }
353
353
  const group = useUiConfig("Command")?.classes?.group;
354
354
  const merge = useCn();
355
- const t1 = group ?? "overflow-hidden p-1.5 text-foreground [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-widest [&_[cmdk-group-heading]]:text-muted-foreground";
355
+ const t1 = group ?? "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-widest [&_[cmdk-group-heading]]:text-muted-foreground";
356
356
  let t2;
357
357
  if ($[3] !== className || $[4] !== merge || $[5] !== t1) {
358
358
  t2 = merge(t1, className);
@@ -398,7 +398,7 @@ const CommandSeparator = /*#__PURE__*/React.forwardRef((t0, ref) => {
398
398
  }
399
399
  const separator = useUiConfig("Command")?.classes?.separator;
400
400
  const merge = useCn();
401
- const t1 = separator ?? "-mx-1.5 h-px bg-separator";
401
+ const t1 = separator ?? "-mx-1 h-px bg-separator";
402
402
  let t2;
403
403
  if ($[3] !== className || $[4] !== merge || $[5] !== t1) {
404
404
  t2 = merge(t1, className);
@@ -444,7 +444,7 @@ const CommandItem = /*#__PURE__*/React.forwardRef((t0, ref) => {
444
444
  }
445
445
  const item = useUiConfig("Command")?.classes?.item;
446
446
  const merge = useCn();
447
- const t1 = item ?? "relative flex cursor-default gap-2 select-none items-center rounded-menu-item px-2.5 py-2 max-sm:min-h-10 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[selected=true]:bg-surface-tertiary/80 data-[selected=true]:text-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
447
+ const t1 = item ?? "relative flex cursor-default gap-2 select-none items-center rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[selected=true]:bg-surface-tertiary/80 data-[selected=true]:text-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
448
448
  let t2;
449
449
  if ($[3] !== className || $[4] !== merge || $[5] !== t1) {
450
450
  t2 = merge(t1, className);
@@ -4,7 +4,7 @@ import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
4
4
  import { Select as SelectPrimitive } from "radix-ui";
5
5
  import { cn } from "../utils/cn.js";
6
6
  import { fieldFocusClass } from "./_field-classes.js";
7
- import { floatingSurfaceAnimateClass, floatingSurfaceClass, menuItemClass } from "./_menu-classes.js";
7
+ import { floatingSurfaceAnimateClass, menuSurfaceClass, menuItemClass } from "./_menu-classes.js";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  function Select(t0) {
10
10
  const $ = _c(4);
@@ -178,7 +178,7 @@ function SelectContent(t0) {
178
178
  const t3 = 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";
179
179
  let t4;
180
180
  if ($[6] !== className || $[7] !== t3) {
181
- t4 = cn("relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto", floatingSurfaceClass, floatingSurfaceAnimateClass, t3, className);
181
+ t4 = cn("relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto", menuSurfaceClass, floatingSurfaceAnimateClass, t3, className);
182
182
  $[6] = className;
183
183
  $[7] = t3;
184
184
  $[8] = t4;
@@ -195,7 +195,7 @@ function SelectContent(t0) {
195
195
  const t6 = position === "popper" && "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1";
196
196
  let t7;
197
197
  if ($[10] !== t6) {
198
- t7 = cn("p-1.5", t6);
198
+ t7 = cn("p-1", t6);
199
199
  $[10] = t6;
200
200
  $[11] = t7;
201
201
  } else {
@@ -304,7 +304,7 @@ function SelectItem(t0) {
304
304
  }
305
305
  let t1;
306
306
  if ($[4] !== className) {
307
- t1 = cn("[&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-pointer select-none items-center gap-2 rounded-menu-item py-2 pl-2.5 pr-8 text-sm outline-hidden [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 last:[span]:*:flex last:[span]:*:items-center last:[span]:*:gap-2", menuItemClass, className);
307
+ t1 = cn("[&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-pointer select-none items-center gap-2 rounded-menu-item py-1.5 pl-2.5 pr-8 text-sm outline-hidden [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 last:[span]:*:flex last:[span]:*:items-center last:[span]:*:gap-2", menuItemClass, className);
308
308
  $[4] = className;
309
309
  $[5] = t1;
310
310
  } else {
@@ -370,7 +370,7 @@ function SelectSeparator(t0) {
370
370
  }
371
371
  let t1;
372
372
  if ($[3] !== className) {
373
- t1 = cn("bg-separator pointer-events-none -mx-1.5 my-1 h-px", className);
373
+ t1 = cn("bg-separator pointer-events-none -mx-1 my-1 h-px", className);
374
374
  $[3] = className;
375
375
  $[4] = t1;
376
376
  } else {
@@ -4,7 +4,7 @@ import * as SelectPrimitive from "@radix-ui/react-select";
4
4
  import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
5
5
  import { cn } from "../utils/cn.js";
6
6
  import { fieldFocusClass } from "./_field-classes.js";
7
- import { floatingSurfaceAnimateClass, floatingSurfaceClass } from "./_menu-classes.js";
7
+ import { floatingSurfaceAnimateClass, menuSurfaceClass } from "./_menu-classes.js";
8
8
  import { useCn, useUiConfig } from "./ui-config.js";
9
9
 
10
10
  /** App defaults for `Select*` (see `UiConfigProvider`). */
@@ -247,7 +247,7 @@ const SelectContent = /*#__PURE__*/React.forwardRef((t0, ref) => {
247
247
  const t2 = collisionPadding ?? config?.collisionPadding ?? 8;
248
248
  let t3;
249
249
  if ($[6] !== classes?.content) {
250
- t3 = classes?.content ?? ["relative z-50 max-h-96 max-sm:max-h-[85dvh] min-w-32 overflow-hidden outline-none", floatingSurfaceClass, floatingSurfaceAnimateClass];
250
+ t3 = classes?.content ?? ["relative z-50 max-h-96 max-sm:max-h-[85dvh] min-w-32 overflow-hidden outline-none", menuSurfaceClass, floatingSurfaceAnimateClass];
251
251
  $[6] = classes?.content;
252
252
  $[7] = t3;
253
253
  } else {
@@ -272,7 +272,7 @@ const SelectContent = /*#__PURE__*/React.forwardRef((t0, ref) => {
272
272
  } else {
273
273
  t6 = $[13];
274
274
  }
275
- const t7 = classes?.viewport ?? "p-1.5";
275
+ const t7 = classes?.viewport ?? "p-1";
276
276
  const t8 = position === "popper" && (classes?.popperViewport ?? "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]");
277
277
  let t9;
278
278
  if ($[14] !== t7 || $[15] !== t8) {
@@ -395,7 +395,7 @@ const SelectItem = /*#__PURE__*/React.forwardRef((t0, ref) => {
395
395
  }
396
396
  const config = useUiConfig("Select");
397
397
  const merge = useCn();
398
- const t1 = config?.classes?.item ?? "relative flex w-full cursor-pointer select-none items-center rounded-menu-item py-2 max-sm:min-h-10 pl-2.5 pr-8 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
398
+ const t1 = config?.classes?.item ?? "relative flex w-full cursor-pointer select-none items-center rounded-menu-item py-1.5 max-sm:min-h-10 pl-2.5 pr-8 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
399
399
  let t2;
400
400
  if ($[4] !== className || $[5] !== merge || $[6] !== t1) {
401
401
  t2 = merge(t1, className);
@@ -477,7 +477,7 @@ const SelectSeparator = /*#__PURE__*/React.forwardRef((t0, ref) => {
477
477
  }
478
478
  const separator = useUiConfig("Select")?.classes?.separator;
479
479
  const merge = useCn();
480
- const t1 = separator ?? "-mx-1.5 my-1 h-px bg-separator";
480
+ const t1 = separator ?? "-mx-1 my-1 h-px bg-separator";
481
481
  let t2;
482
482
  if ($[3] !== className || $[4] !== merge || $[5] !== t1) {
483
483
  t2 = merge(t1, className);
@@ -2,13 +2,13 @@ import { clsx } from "clsx";
2
2
  import { extendTailwindMerge } from "tailwind-merge";
3
3
 
4
4
  // `rounded-field` and the tokens.css radii (`rounded-surface`,
5
- // `rounded-menu-item`, `rounded-control`) are custom radius tokens — teach
5
+ // `rounded-menu`, `rounded-menu-item`, `rounded-control`) are custom radius tokens — teach
6
6
  // twMerge they conflict with `rounded-none` / `rounded-md` / etc. so the last
7
7
  // radius class wins.
8
8
  const twMerge = extendTailwindMerge({
9
9
  extend: {
10
10
  theme: {
11
- borderRadius: ["field", "surface", "menu-item", "control"]
11
+ borderRadius: ["field", "surface", "menu", "menu-item", "control"]
12
12
  }
13
13
  }
14
14
  });
@@ -95,6 +95,13 @@
95
95
  border-radius: min(var(--radius), 0.5rem);
96
96
  }
97
97
 
98
+ @utility rounded-menu {
99
+ border-radius: min(
100
+ var(--radius),
101
+ calc(min(var(--radius), 0.5rem) + var(--spacing))
102
+ );
103
+ }
104
+
98
105
  @utility rounded-control {
99
106
  border-radius: min(var(--radius), 0.625rem);
100
107
  }
@@ -113,7 +113,9 @@
113
113
  /* Radius utilities that follow the theme `--radius` (values at the default
114
114
  1rem in brackets). Surfaces: kept between 0.75rem and 1rem (16px). Menu
115
115
  items and sidebar nav rows: capped at 0.5rem (8px) so they sit inside the
116
- surface corner. Controls: capped at 0.625rem (10px). */
116
+ surface corner. Menu surfaces: the item radius plus the `p-1` inset
117
+ (12px), so the gap between a highlighted item and the surface edge is the
118
+ same round the corner. Controls: capped at 0.625rem (10px). */
117
119
  @utility rounded-surface {
118
120
  border-radius: clamp(0.75rem, var(--radius), 1rem);
119
121
  }
@@ -132,6 +134,13 @@
132
134
  border-radius: min(var(--radius), 0.5rem);
133
135
  }
134
136
 
137
+ @utility rounded-menu {
138
+ border-radius: min(
139
+ var(--radius),
140
+ calc(min(var(--radius), 0.5rem) + var(--spacing))
141
+ );
142
+ }
143
+
135
144
  @utility rounded-control {
136
145
  border-radius: min(var(--radius), 0.625rem);
137
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/ui",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
6
6
  "type": "module",
@@ -17,9 +17,9 @@ export type AppShellProps = {
17
17
  * instead of the sidebar width.
18
18
  */
19
19
  panelHidden?: boolean;
20
- /** Sets `--app-shell-rail-width`. Default `"4rem"`. */
20
+ /** Sets `--app-shell-rail-width`. Default `"3.5rem"`. */
21
21
  railWidth?: string;
22
- /** Sets `--app-shell-sidebar-width` (rail plus panel). Default `"20rem"`. Ignored with `resizable`. */
22
+ /** Sets `--app-shell-sidebar-width` (rail plus panel). Default `"19.5rem"`. Ignored with `resizable`. */
23
23
  sidebarWidth?: string;
24
24
  /**
25
25
  * Opt-in resizable panel. The shell owns the persisted panel width, sets
@@ -54,8 +54,8 @@ export type AppShellRootProps = ComponentProps<"div"> &
54
54
  /** Frame `<div>`: sets the `--app-shell-*` variables and owns the resize state. `style` merges over the variables. */
55
55
  function Root({
56
56
  panelHidden = false,
57
- railWidth = "4rem",
58
- sidebarWidth = "20rem",
57
+ railWidth = "3.5rem",
58
+ sidebarWidth = "19.5rem",
59
59
  resizable,
60
60
  mobileHeaderHeight = "calc(3.5rem + env(safe-area-inset-top, 0px))",
61
61
  mainId = "main-content",
@@ -258,7 +258,7 @@ export function AccountTrigger({ userName, imageUrl, className, children, ...pro
258
258
  title={userName}
259
259
  aria-label={`Account menu for ${userName}`}
260
260
  {...props}
261
- className={cn(railTileClass, "h-11 w-11 p-0", railTileStateClass(false), className)}
261
+ className={cn(railTileClass, "h-11 w-11 p-0 md:h-10 md:w-10", railTileStateClass(false), className)}
262
262
  >
263
263
  {children ?? <AccountAvatar imageUrl={imageUrl} userName={userName} className="h-7 w-7" />}
264
264
  </Button>
@@ -327,5 +327,5 @@ export type SidebarAccountMenuPlaceholderProps = { className?: string };
327
327
 
328
328
  /** Tile-sized placeholder while the account loads. */
329
329
  export function SidebarAccountMenuPlaceholder({ className }: SidebarAccountMenuPlaceholderProps) {
330
- return <div className={cn("size-11 rounded-lg bg-surface-tertiary", className)} />;
330
+ return <div className={cn("size-11 rounded-lg bg-surface-tertiary md:size-10", className)} />;
331
331
  }
@@ -85,7 +85,7 @@ export type SidebarRailHeaderProps = ComponentPropsWithoutRef<"div">;
85
85
 
86
86
  /** Block pinned at the top of the rail, above the scroll body. */
87
87
  export function RailHeader({ className, ...props }: SidebarRailHeaderProps) {
88
- return <div {...props} className={cn("flex w-full flex-col items-center gap-1.5 px-0 pt-3", className)} />;
88
+ return <div {...props} className={cn("flex w-full flex-col items-center gap-1 px-0 pt-3", className)} />;
89
89
  }
90
90
 
91
91
  export type SidebarRailBodyProps = ComponentPropsWithoutRef<"div"> & {
@@ -100,7 +100,7 @@ export type SidebarRailBodyProps = ComponentPropsWithoutRef<"div"> & {
100
100
 
101
101
  /** Scroll body of the rail. */
102
102
  export function RailBody({ asChild = false, tabs = false, className, ...props }: SidebarRailBodyProps) {
103
- const bodyClass = cn("flex w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto py-2", className);
103
+ const bodyClass = cn("flex w-full flex-1 flex-col items-center gap-1 overflow-y-auto py-2", className);
104
104
  if (tabs) return <TabsPrimitive.List {...props} asChild={asChild} className={bodyClass} />;
105
105
  const Body = asChild ? Slot : "div";
106
106
  return <Body {...props} className={bodyClass} />;
@@ -110,7 +110,7 @@ export type SidebarRailFooterProps = ComponentPropsWithoutRef<"div">;
110
110
 
111
111
  /** Block pinned at the bottom of the rail. */
112
112
  export function RailFooter({ className, ...props }: SidebarRailFooterProps) {
113
- return <div {...props} className={cn("flex w-full flex-col items-center gap-1.5 py-3", className)} />;
113
+ return <div {...props} className={cn("flex w-full flex-col items-center gap-1 py-3", className)} />;
114
114
  }
115
115
 
116
116
  type SidebarRailItemBaseProps = Omit<ComponentPropsWithoutRef<"button">, "children"> & {
@@ -138,7 +138,7 @@ export type SidebarRailItemProps = SidebarRailItemBaseProps &
138
138
  | {
139
139
  /**
140
140
  * Product app id for the home tile. The tile renders `APP_ICONS[app]` at
141
- * `SIDEBAR_RAIL_APP_ICON_SIZE` (26px), so apps cannot drift. With `asChild` the
141
+ * `SIDEBAR_RAIL_APP_ICON_SIZE` (24px), so apps cannot drift. With `asChild` the
142
142
  * icon goes inside the child element (for example `<Link to="/" />`). Without
143
143
  * `asChild`, `children` are ignored.
144
144
  */
@@ -6,11 +6,11 @@ import { cn } from "../../src/utils/cn";
6
6
  // on the marked lines only.
7
7
 
8
8
  /** App icon size in px for the home `RailTile`. Fixed across the apps. `RailTile` applies it when you pass `app`. */
9
- export const SIDEBAR_RAIL_APP_ICON_SIZE = 26;
9
+ export const SIDEBAR_RAIL_APP_ICON_SIZE = 24;
10
10
 
11
- /** Rail tile: size-11, rounded-lg, press scale. */
11
+ /** Rail tile: 44px on touch layouts, 40px from `md`, rounded-lg, press scale. */
12
12
  export const railTileClass =
13
- "relative flex size-11 items-center justify-center rounded-lg border active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring";
13
+ "relative flex size-11 md:size-10 items-center justify-center rounded-lg border active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring";
14
14
 
15
15
  const railTileActiveClass = "border-transparent bg-surface-tertiary text-foreground";
16
16
  const railTileIdleClass = "border-transparent text-muted opacity-75 hover:bg-surface-tertiary/50 hover:opacity-100 hover:text-foreground"; // check-tokens-allow: text-muted
@@ -286,7 +286,7 @@ export function ModelPickerContent<TModel extends string>({
286
286
  return (
287
287
  <TooltipProvider>
288
288
  <div
289
- className="flex h-96 max-h-[min(24rem,var(--radix-popover-content-available-height))] w-full flex-col overflow-hidden rounded-lg bg-popover smooth-shadow-ring-lg"
289
+ className="flex h-96 max-h-[min(24rem,var(--radix-popover-content-available-height))] w-full flex-col overflow-hidden rounded-menu bg-popover smooth-shadow-ring-lg"
290
290
  data-model-picker-content
291
291
  >
292
292
  {header ? (
@@ -335,7 +335,7 @@ export function ModelPickerContent<TModel extends string>({
335
335
  data-model-picker-instance={instance.key}
336
336
  disabled={isLockedTeam}
337
337
  className={merge(
338
- "relative isolate flex aspect-square w-full items-center justify-center rounded-md transition-colors",
338
+ "relative isolate flex aspect-square w-full items-center justify-center rounded-menu-item transition-colors",
339
339
  isPersonalTeamVariant
340
340
  ? "opacity-40"
341
341
  : "hover:bg-surface-secondary",
@@ -412,7 +412,7 @@ export function ModelPickerContent<TModel extends string>({
412
412
  ) : null}
413
413
 
414
414
  <CommandList
415
- className="max-h-none h-full flex-1 overflow-y-auto overscroll-contain px-1.5 py-1.5"
415
+ className="max-h-none h-full flex-1 overflow-y-auto overscroll-contain p-1"
416
416
  onScroll={(event) => updateScrollFades(event.currentTarget)}
417
417
  ref={(node) => {
418
418
  if (node) updateScrollFades(node);
@@ -455,7 +455,7 @@ export function ModelPickerContent<TModel extends string>({
455
455
  onSelect(option.id, row.instance.accountId);
456
456
  }}
457
457
  className={merge(
458
- "flex flex-col items-stretch gap-1 rounded-md px-2 py-2.5 data-[selected=true]:bg-surface-secondary",
458
+ "flex flex-col items-stretch gap-1 rounded-menu-item px-2 py-2.5 data-[selected=true]:bg-surface-secondary",
459
459
  isPersonalTeamVariant && "opacity-50",
460
460
  isLockedTeamRow ? "cursor-not-allowed" : "cursor-pointer",
461
461
  )}
@@ -47,7 +47,7 @@ const TRIGGER_CLASS =
47
47
  * sync so trigger vs embed surfaces cannot drift.
48
48
  */
49
49
  export const modelPickerSurfaceClass =
50
- "w-100 max-w-[calc(100vw-1rem)] overflow-hidden rounded-lg border-0 bg-transparent p-0 shadow-none";
50
+ "w-100 max-w-[calc(100vw-1rem)] overflow-hidden rounded-menu border-0 bg-transparent p-0 shadow-none";
51
51
 
52
52
  export interface ModelPickerProps<TModel extends string = string> {
53
53
  value: TModel;
@@ -62,7 +62,7 @@ export function ComposerSlashMenu({
62
62
  transition={motionFast}
63
63
  style={{ maxHeight: placement.maxHeight }}
64
64
  className={
65
- "flex flex-col overflow-hidden rounded-surface " +
65
+ "flex flex-col overflow-hidden rounded-menu " +
66
66
  "bg-popover/95 text-popover-foreground backdrop-blur-md smooth-shadow-ring-lg " +
67
67
  (isAbove ? "origin-bottom" : "origin-top")
68
68
  }
@@ -1,6 +1,12 @@
1
1
  // floating overlay: tone + smooth-shadow-ring, never border+shadow
2
- export const floatingSurfaceClass =
3
- "rounded-lg bg-overlay text-overlay-foreground smooth-shadow-ring-lg max-sm:max-w-[calc(100vw-2rem)]";
2
+ const floatingSurfaceToneClass =
3
+ "bg-overlay text-overlay-foreground smooth-shadow-ring-lg max-sm:max-w-[calc(100vw-2rem)]";
4
+
5
+ export const floatingSurfaceClass = `rounded-lg ${floatingSurfaceToneClass}`;
6
+
7
+ // Menu surface: the corner is the item radius plus the `p-1` inset, so a
8
+ // highlighted item keeps the same gap to the edge round the corner.
9
+ export const menuSurfaceClass = `rounded-menu ${floatingSurfaceToneClass}`;
4
10
 
5
11
  export const floatingSurfaceAnimateClass = [
6
12
  "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=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
@@ -8,23 +14,23 @@ export const floatingSurfaceAnimateClass = [
8
14
 
9
15
  // shared floating menu surfaces: popover tone + smooth-shadow-ring-lg
10
16
  export const menuContentClass = [
11
- "z-50 min-w-[12rem] overflow-hidden p-1.5 outline-none max-sm:max-h-[85dvh] max-sm:overflow-y-auto",
12
- floatingSurfaceClass,
17
+ "z-50 min-w-[12rem] overflow-hidden p-1 outline-none max-sm:max-h-[85dvh] max-sm:overflow-y-auto",
18
+ menuSurfaceClass,
13
19
  floatingSurfaceAnimateClass,
14
20
  ].join(" ");
15
21
 
16
22
  export const menuSubTriggerClass =
17
- "flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-2 max-sm:min-h-10 text-sm text-foreground outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[state=open]:bg-default data-[disabled]:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
23
+ "flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm text-foreground outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[state=open]:bg-default data-[disabled]:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
18
24
 
19
25
  export const menuItemClass =
20
- "relative flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-2 max-sm:min-h-10 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0 [&_svg]:pointer-events-none";
26
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0 [&_svg]:pointer-events-none";
21
27
 
22
28
  export const menuCheckboxRadioItemClass =
23
- "relative flex cursor-pointer select-none items-center rounded-menu-item py-2 max-sm:min-h-10 pl-8 pr-2.5 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
29
+ "relative flex cursor-pointer select-none items-center rounded-menu-item py-1.5 max-sm:min-h-10 pl-8 pr-2.5 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
24
30
 
25
31
  export const menuLabelClass =
26
32
  "px-2.5 py-1.5 text-xs font-semibold uppercase tracking-widest text-muted-foreground";
27
33
 
28
- export const menuSeparatorClass = "-mx-1.5 my-1 h-px bg-separator";
34
+ export const menuSeparatorClass = "-mx-1 my-1 h-px bg-separator";
29
35
 
30
36
  export const menuShortcutClass = "ml-auto text-xs tracking-wide text-muted-foreground/90";
@@ -48,7 +48,7 @@ const Command = React.forwardRef<
48
48
  ref={ref}
49
49
  className={merge(
50
50
  root ??
51
- "flex h-full w-full flex-col overflow-hidden rounded-lg bg-overlay text-overlay-foreground",
51
+ "flex h-full w-full flex-col overflow-hidden rounded-menu bg-overlay text-overlay-foreground",
52
52
  className,
53
53
  )}
54
54
  {...props}
@@ -92,7 +92,7 @@ function CommandDialog({
92
92
  const merge = useCn();
93
93
  return (
94
94
  <Dialog {...props}>
95
- <DialogContent className={merge(classes?.dialogContent ?? "overflow-hidden p-0 sm:max-w-xl", className)}>
95
+ <DialogContent className={merge(classes?.dialogContent ?? "overflow-hidden p-0 sm:max-w-xl sm:rounded-menu", className)}>
96
96
  {title !== undefined || description !== undefined ? (
97
97
  <DialogHeader className="sr-only">
98
98
  <DialogTitle>{title}</DialogTitle>
@@ -150,7 +150,7 @@ const CommandList = React.forwardRef<
150
150
  return (
151
151
  <CommandPrimitive.List
152
152
  ref={ref}
153
- className={merge(list ?? "max-h-80 max-sm:max-h-[60dvh] overflow-y-auto overflow-x-hidden pb-2", className)}
153
+ className={merge(list ?? "max-h-80 max-sm:max-h-[60dvh] overflow-y-auto overflow-x-hidden", className)}
154
154
  {...props}
155
155
  />
156
156
  );
@@ -189,7 +189,7 @@ const CommandGroup = React.forwardRef<
189
189
  ref={ref}
190
190
  className={merge(
191
191
  group ??
192
- "overflow-hidden p-1.5 text-foreground [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-widest [&_[cmdk-group-heading]]:text-muted-foreground",
192
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-widest [&_[cmdk-group-heading]]:text-muted-foreground",
193
193
  className,
194
194
  )}
195
195
  {...props}
@@ -207,7 +207,7 @@ const CommandSeparator = React.forwardRef<
207
207
  return (
208
208
  <CommandPrimitive.Separator
209
209
  ref={ref}
210
- className={merge(separator ?? "-mx-1.5 h-px bg-separator", className)}
210
+ className={merge(separator ?? "-mx-1 h-px bg-separator", className)}
211
211
  {...props}
212
212
  />
213
213
  );
@@ -225,7 +225,7 @@ const CommandItem = React.forwardRef<
225
225
  ref={ref}
226
226
  className={merge(
227
227
  item ??
228
- "relative flex cursor-default gap-2 select-none items-center rounded-menu-item px-2.5 py-2 max-sm:min-h-10 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[selected=true]:bg-surface-tertiary/80 data-[selected=true]:text-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
228
+ "relative flex cursor-default gap-2 select-none items-center rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[selected=true]:bg-surface-tertiary/80 data-[selected=true]:text-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
229
229
  className,
230
230
  )}
231
231
  {...props}
@@ -6,7 +6,7 @@ import { cn } from "../utils/cn";
6
6
  import { fieldFocusClass } from "./_field-classes";
7
7
  import {
8
8
  floatingSurfaceAnimateClass,
9
- floatingSurfaceClass,
9
+ menuSurfaceClass,
10
10
  menuItemClass,
11
11
  } from "./_menu-classes";
12
12
 
@@ -68,7 +68,7 @@ function SelectContent({
68
68
  data-slot="select-content"
69
69
  className={cn(
70
70
  "relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto",
71
- floatingSurfaceClass,
71
+ menuSurfaceClass,
72
72
  floatingSurfaceAnimateClass,
73
73
  position === "popper" &&
74
74
  "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
@@ -81,7 +81,7 @@ function SelectContent({
81
81
  <SelectScrollUpButton />
82
82
  <SelectPrimitive.Viewport
83
83
  className={cn(
84
- "p-1.5",
84
+ "p-1",
85
85
  position === "popper" &&
86
86
  "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1",
87
87
  )}
@@ -119,7 +119,7 @@ function SelectItem({
119
119
  <SelectPrimitive.Item
120
120
  data-slot="select-item"
121
121
  className={cn(
122
- "[&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-pointer select-none items-center gap-2 rounded-menu-item py-2 pl-2.5 pr-8 text-sm outline-hidden [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 last:[span]:*:flex last:[span]:*:items-center last:[span]:*:gap-2",
122
+ "[&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-pointer select-none items-center gap-2 rounded-menu-item py-1.5 pl-2.5 pr-8 text-sm outline-hidden [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 last:[span]:*:flex last:[span]:*:items-center last:[span]:*:gap-2",
123
123
  menuItemClass,
124
124
  className,
125
125
  )}
@@ -146,7 +146,7 @@ function SelectSeparator({
146
146
  <SelectPrimitive.Separator
147
147
  data-slot="select-separator"
148
148
  className={cn(
149
- "bg-separator pointer-events-none -mx-1.5 my-1 h-px",
149
+ "bg-separator pointer-events-none -mx-1 my-1 h-px",
150
150
  className,
151
151
  )}
152
152
  {...props}
package/src/ui/select.tsx CHANGED
@@ -5,7 +5,7 @@ import { cn } from "../utils/cn";
5
5
  import { fieldFocusClass } from "./_field-classes";
6
6
  import {
7
7
  floatingSurfaceAnimateClass,
8
- floatingSurfaceClass,
8
+ menuSurfaceClass,
9
9
  } from "./_menu-classes";
10
10
  import { useCn, useUiConfig } from "./ui-config";
11
11
 
@@ -131,7 +131,7 @@ const SelectContent = React.forwardRef<
131
131
  className={merge(
132
132
  classes?.content ?? [
133
133
  "relative z-50 max-h-96 max-sm:max-h-[85dvh] min-w-32 overflow-hidden outline-none",
134
- floatingSurfaceClass,
134
+ menuSurfaceClass,
135
135
  floatingSurfaceAnimateClass,
136
136
  ],
137
137
  position === "popper" &&
@@ -144,7 +144,7 @@ const SelectContent = React.forwardRef<
144
144
  <SelectScrollUpButton />
145
145
  <SelectPrimitive.Viewport
146
146
  className={cn(
147
- classes?.viewport ?? "p-1.5",
147
+ classes?.viewport ?? "p-1",
148
148
  position === "popper" &&
149
149
  (classes?.popperViewport ??
150
150
  "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),
@@ -190,7 +190,7 @@ const SelectItem = React.forwardRef<
190
190
  ref={ref}
191
191
  className={merge(
192
192
  config?.classes?.item ??
193
- "relative flex w-full cursor-pointer select-none items-center rounded-menu-item py-2 max-sm:min-h-10 pl-2.5 pr-8 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
193
+ "relative flex w-full cursor-pointer select-none items-center rounded-menu-item py-1.5 max-sm:min-h-10 pl-2.5 pr-8 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
194
194
  className,
195
195
  )}
196
196
  {...props}
@@ -215,7 +215,7 @@ const SelectSeparator = React.forwardRef<
215
215
  return (
216
216
  <SelectPrimitive.Separator
217
217
  ref={ref}
218
- className={merge(separator ?? "-mx-1.5 my-1 h-px bg-separator", className)}
218
+ className={merge(separator ?? "-mx-1 my-1 h-px bg-separator", className)}
219
219
  {...props}
220
220
  />
221
221
  );
package/src/utils/cn.ts CHANGED
@@ -2,13 +2,13 @@ import { type ClassValue, clsx } from "clsx";
2
2
  import { extendTailwindMerge } from "tailwind-merge";
3
3
 
4
4
  // `rounded-field` and the tokens.css radii (`rounded-surface`,
5
- // `rounded-menu-item`, `rounded-control`) are custom radius tokens — teach
5
+ // `rounded-menu`, `rounded-menu-item`, `rounded-control`) are custom radius tokens — teach
6
6
  // twMerge they conflict with `rounded-none` / `rounded-md` / etc. so the last
7
7
  // radius class wins.
8
8
  const twMerge = extendTailwindMerge({
9
9
  extend: {
10
10
  theme: {
11
- borderRadius: ["field", "surface", "menu-item", "control"],
11
+ borderRadius: ["field", "surface", "menu", "menu-item", "control"],
12
12
  },
13
13
  },
14
14
  });
@@ -95,6 +95,13 @@
95
95
  border-radius: min(var(--radius), 0.5rem);
96
96
  }
97
97
 
98
+ @utility rounded-menu {
99
+ border-radius: min(
100
+ var(--radius),
101
+ calc(min(var(--radius), 0.5rem) + var(--spacing))
102
+ );
103
+ }
104
+
98
105
  @utility rounded-control {
99
106
  border-radius: min(var(--radius), 0.625rem);
100
107
  }
@@ -113,7 +113,9 @@
113
113
  /* Radius utilities that follow the theme `--radius` (values at the default
114
114
  1rem in brackets). Surfaces: kept between 0.75rem and 1rem (16px). Menu
115
115
  items and sidebar nav rows: capped at 0.5rem (8px) so they sit inside the
116
- surface corner. Controls: capped at 0.625rem (10px). */
116
+ surface corner. Menu surfaces: the item radius plus the `p-1` inset
117
+ (12px), so the gap between a highlighted item and the surface edge is the
118
+ same round the corner. Controls: capped at 0.625rem (10px). */
117
119
  @utility rounded-surface {
118
120
  border-radius: clamp(0.75rem, var(--radius), 1rem);
119
121
  }
@@ -132,6 +134,13 @@
132
134
  border-radius: min(var(--radius), 0.5rem);
133
135
  }
134
136
 
137
+ @utility rounded-menu {
138
+ border-radius: min(
139
+ var(--radius),
140
+ calc(min(var(--radius), 0.5rem) + var(--spacing))
141
+ );
142
+ }
143
+
135
144
  @utility rounded-control {
136
145
  border-radius: min(var(--radius), 0.625rem);
137
146
  }