@adea-ai/ui 0.82.1 → 0.83.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.
Files changed (70) hide show
  1. package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
  2. package/dist/components/composites/appearance-editor/appearance-choices.js +3 -3
  3. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  4. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
  5. package/dist/components/composites/appearance-editor/appearance-rows.js +13 -2
  6. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  7. package/dist/components/layout/orbit-layout/index.d.ts +3 -0
  8. package/dist/components/layout/orbit-layout/index.d.ts.map +1 -0
  9. package/dist/components/layout/orbit-layout/index.js +2 -0
  10. package/dist/components/layout/orbit-layout/orbit-layout.d.ts +38 -0
  11. package/dist/components/layout/orbit-layout/orbit-layout.d.ts.map +1 -0
  12. package/dist/components/layout/orbit-layout/orbit-layout.js +83 -0
  13. package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -0
  14. package/dist/components/layout/side-rail/side-rail.d.ts +1 -0
  15. package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
  16. package/dist/components/layout/side-rail/side-rail.js +6 -2
  17. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  18. package/dist/components/layout/virtual-window/index.d.ts +3 -0
  19. package/dist/components/layout/virtual-window/index.d.ts.map +1 -0
  20. package/dist/components/layout/virtual-window/index.js +2 -0
  21. package/dist/components/layout/virtual-window/virtual-window.d.ts +22 -0
  22. package/dist/components/layout/virtual-window/virtual-window.d.ts.map +1 -0
  23. package/dist/components/layout/virtual-window/virtual-window.js +45 -0
  24. package/dist/components/layout/virtual-window/virtual-window.js.map +1 -0
  25. package/dist/components/ui/command/command.d.ts +5 -6
  26. package/dist/components/ui/command/command.d.ts.map +1 -1
  27. package/dist/components/ui/command/command.js +73 -15
  28. package/dist/components/ui/command/command.js.map +1 -1
  29. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +3 -0
  30. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
  31. package/dist/components/ui/dropdown-menu/dropdown-menu.js +7 -1
  32. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  33. package/dist/components/ui/status-chip/status-chip.d.ts +2 -0
  34. package/dist/components/ui/status-chip/status-chip.d.ts.map +1 -1
  35. package/dist/components/ui/status-chip/status-chip.js +26 -17
  36. package/dist/components/ui/status-chip/status-chip.js.map +1 -1
  37. package/dist/index.d.ts +2 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +4 -2
  40. package/dist/lib/overlay.js +1 -1
  41. package/dist/lib/overlay.js.map +1 -1
  42. package/dist/r/command.json +2 -0
  43. package/dist/r/orbit-layout.json +22 -0
  44. package/dist/r/registry.json +46 -0
  45. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +3 -5
  46. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +9 -3
  47. package/dist/r/src/components/layout/orbit-layout/index.ts +8 -0
  48. package/dist/r/src/components/layout/orbit-layout/orbit-layout.tsx +112 -0
  49. package/dist/r/src/components/layout/side-rail/side-rail.tsx +8 -3
  50. package/dist/r/src/components/layout/virtual-window/index.ts +2 -0
  51. package/dist/r/src/components/layout/virtual-window/virtual-window.tsx +55 -0
  52. package/dist/r/src/components/ui/command/command.tsx +81 -29
  53. package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +5 -1
  54. package/dist/r/src/components/ui/status-chip/status-chip.tsx +11 -2
  55. package/dist/r/src/lib/overlay.ts +1 -1
  56. package/dist/r/virtual-window.json +22 -0
  57. package/package.json +1 -1
  58. package/registry.json +46 -0
  59. package/src/components/composites/appearance-editor/appearance-choices.tsx +3 -5
  60. package/src/components/composites/appearance-editor/appearance-rows.tsx +9 -3
  61. package/src/components/layout/orbit-layout/index.ts +8 -0
  62. package/src/components/layout/orbit-layout/orbit-layout.tsx +112 -0
  63. package/src/components/layout/side-rail/side-rail.tsx +8 -3
  64. package/src/components/layout/virtual-window/index.ts +2 -0
  65. package/src/components/layout/virtual-window/virtual-window.tsx +55 -0
  66. package/src/components/ui/command/command.tsx +81 -29
  67. package/src/components/ui/dropdown-menu/dropdown-menu.tsx +5 -1
  68. package/src/components/ui/status-chip/status-chip.tsx +11 -2
  69. package/src/index.ts +2 -0
  70. package/src/lib/overlay.ts +1 -1
@@ -25,13 +25,17 @@ import { cn } from '../../../lib/utils'
25
25
  * Kobalte supplies the full menu contract — arrow keys, typeahead, the roving
26
26
  * highlight, Escape to close and return focus — which is exactly what a
27
27
  * hand-rolled `div` with click handlers gets wrong.
28
+ * Menus are nonmodal by default so their generated focus guards do not become
29
+ * invalid direct children of the ARIA menu. Set `modal` explicitly when the
30
+ * surrounding interaction needs modal containment.
28
31
  *
29
32
  * The `destructive` variant marks the row with a status-coloured edge and
30
33
  * highlighted tint while keeping its label on the body foreground. Pairing it
31
34
  * with an AlertDialog is the caller's job.
32
35
  */
33
36
  export function DropdownMenu(props: ComponentProps<typeof KobalteDropdownMenu>) {
34
- return <KobalteDropdownMenu {...props} />
37
+ const [local, rest] = splitProps(props, ['modal'])
38
+ return <KobalteDropdownMenu modal={local.modal ?? false} {...rest} />
35
39
  }
36
40
 
37
41
  export function DropdownMenuTrigger(props: ComponentProps<typeof KobalteDropdownMenu.Trigger>) {
@@ -59,6 +59,8 @@ export type StatusTone = 'neutral' | 'success' | 'warning' | 'danger' | 'info' |
59
59
  export type StatusChipProps = Omit<ComponentProps<'span'>, 'children'> & {
60
60
  tone?: StatusTone
61
61
  label: string
62
+ /** Visually hide the text while preserving it for assistive technology. */
63
+ compact?: boolean
62
64
  /** Why the status is what it is. Shown in a tooltip; omit for a self-evident label. */
63
65
  detail?: string
64
66
  /** A trailing slot: a timestamp, a retry affordance, a count. */
@@ -66,7 +68,14 @@ export type StatusChipProps = Omit<ComponentProps<'span'>, 'children'> & {
66
68
  }
67
69
 
68
70
  export function StatusChip(props: StatusChipProps) {
69
- const [local, rest] = splitProps(props, ['tone', 'label', 'detail', 'trailing', 'class'])
71
+ const [local, rest] = splitProps(props, [
72
+ 'tone',
73
+ 'label',
74
+ 'compact',
75
+ 'detail',
76
+ 'trailing',
77
+ 'class',
78
+ ])
70
79
 
71
80
  const chip = (
72
81
  <span
@@ -78,7 +87,7 @@ export function StatusChip(props: StatusChipProps) {
78
87
  {...rest}
79
88
  >
80
89
  <span class={statusDotVariants({ tone: local.tone })} aria-hidden="true" />
81
- {local.label}
90
+ <span class={cn(local.compact && 'sr-only')}>{local.label}</span>
82
91
  {local.trailing}
83
92
  </span>
84
93
  )
@@ -54,7 +54,7 @@ export const menuItem = [
54
54
  'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none',
55
55
  'transition-colors ease-out',
56
56
  'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground',
57
- 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
57
+ 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground',
58
58
  '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',
59
59
  '[&_svg:not([class*=text-])]:text-muted-foreground',
60
60
  ].join(' ')
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "virtual-window",
3
+ "type": "registry:ui",
4
+ "title": "Virtual Window",
5
+ "description": "Geometry wrappers for a virtual list; scrolling and range ownership stay with the caller.",
6
+ "dependencies": [],
7
+ "registryDependencies": [
8
+ "lib"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/components/layout/virtual-window/index.ts",
13
+ "type": "registry:ui",
14
+ "target": "components/layout/virtual-window/index.ts"
15
+ },
16
+ {
17
+ "path": "src/components/layout/virtual-window/virtual-window.tsx",
18
+ "type": "registry:ui",
19
+ "target": "components/layout/virtual-window/virtual-window.tsx"
20
+ }
21
+ ]
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/ui",
3
- "version": "0.82.1",
3
+ "version": "0.83.0",
4
4
  "description": "The Adea design system: Kobalte-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
5
5
  "keywords": [
6
6
  "adea",
package/registry.json CHANGED
@@ -442,10 +442,12 @@
442
442
  "title": "Command",
443
443
  "description": "",
444
444
  "dependencies": [
445
+ "@kobalte/core@^0.13.14",
445
446
  "cmdk-solid@^1.2.0",
446
447
  "lucide-solid@^1.48.0"
447
448
  ],
448
449
  "registryDependencies": [
450
+ "@adea-ai/ui/dialog",
449
451
  "lib"
450
452
  ],
451
453
  "files": [
@@ -1455,6 +1457,28 @@
1455
1457
  }
1456
1458
  ]
1457
1459
  },
1460
+ {
1461
+ "name": "orbit-layout",
1462
+ "type": "registry:ui",
1463
+ "title": "Orbit Layout",
1464
+ "description": "Geometry-only wrappers for arranging content around a circle.",
1465
+ "dependencies": [],
1466
+ "registryDependencies": [
1467
+ "lib"
1468
+ ],
1469
+ "files": [
1470
+ {
1471
+ "path": "src/components/layout/orbit-layout/index.ts",
1472
+ "type": "registry:ui",
1473
+ "target": "components/layout/orbit-layout/index.ts"
1474
+ },
1475
+ {
1476
+ "path": "src/components/layout/orbit-layout/orbit-layout.tsx",
1477
+ "type": "registry:ui",
1478
+ "target": "components/layout/orbit-layout/orbit-layout.tsx"
1479
+ }
1480
+ ]
1481
+ },
1458
1482
  {
1459
1483
  "name": "page",
1460
1484
  "type": "registry:ui",
@@ -1638,6 +1662,28 @@
1638
1662
  }
1639
1663
  ]
1640
1664
  },
1665
+ {
1666
+ "name": "virtual-window",
1667
+ "type": "registry:ui",
1668
+ "title": "Virtual Window",
1669
+ "description": "Geometry wrappers for a virtual list; scrolling and range ownership stay with the caller.",
1670
+ "dependencies": [],
1671
+ "registryDependencies": [
1672
+ "lib"
1673
+ ],
1674
+ "files": [
1675
+ {
1676
+ "path": "src/components/layout/virtual-window/index.ts",
1677
+ "type": "registry:ui",
1678
+ "target": "components/layout/virtual-window/index.ts"
1679
+ },
1680
+ {
1681
+ "path": "src/components/layout/virtual-window/virtual-window.tsx",
1682
+ "type": "registry:ui",
1683
+ "target": "components/layout/virtual-window/virtual-window.tsx"
1684
+ }
1685
+ ]
1686
+ },
1641
1687
  {
1642
1688
  "name": "account-menu",
1643
1689
  "type": "registry:ui",
@@ -93,9 +93,7 @@ export function AccentChoices(props: AppearanceEditorProps) {
93
93
  disabled={props.saving}
94
94
  orientation="horizontal"
95
95
  aria-label="Accent"
96
- /* Narrow hosts wrap the swatches into a three-column grid so the row
97
- control stays beside its label; wide hosts keep one inline row. */
98
- class="grid grid-cols-3 items-center gap-2 sm:flex sm:flex-wrap sm:justify-end"
96
+ class="flex flex-wrap items-center gap-2"
99
97
  onChange={(accent) =>
100
98
  props.onChange({
101
99
  accent: accent === 'custom' ? (props.customAccentValue ?? '') : accent,
@@ -104,11 +102,11 @@ export function AccentChoices(props: AppearanceEditorProps) {
104
102
  >
105
103
  <Radio.Item value="theme">
106
104
  <Radio.ItemInput />
107
- <Radio.ItemLabel class="flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary">
105
+ <Radio.ItemLabel class="flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary">
108
106
  Theme default
109
107
  </Radio.ItemLabel>
110
108
  </Radio.Item>
111
- <div class="col-span-3 grid grid-cols-3 gap-2 sm:col-span-1 sm:flex sm:gap-2">
109
+ <div class="flex max-w-full flex-wrap gap-2">
112
110
  <For each={props.accentOptions}>
113
111
  {(option) => (
114
112
  <Radio.Item
@@ -60,9 +60,15 @@ export function SettingsRow(props: {
60
60
  }) {
61
61
  return (
62
62
  <section
63
- class={cn('flex flex-col gap-3 px-4 py-4', { 'sm:flex-row sm:items-center': !props.stacked })}
63
+ class={cn('flex gap-3 px-4 py-4', {
64
+ 'flex-col': props.stacked,
65
+ 'flex-wrap items-center': !props.stacked,
66
+ })}
64
67
  >
65
- <div class="flex min-w-0 flex-1 items-center gap-3">
68
+ {/* Reserve readable copy before choosing a side-by-side control row.
69
+ Wrapping follows the actual host width and enlarged text, rather
70
+ than a viewport breakpoint that also matches a narrow popover. */}
71
+ <div class={cn('flex min-w-0 flex-1 items-center gap-3', { 'basis-48': !props.stacked })}>
66
72
  <span
67
73
  class="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4"
68
74
  aria-hidden="true"
@@ -76,7 +82,7 @@ export function SettingsRow(props: {
76
82
  </Show>
77
83
  </div>
78
84
  </div>
79
- <div class="min-w-0 shrink-0">{props.children}</div>
85
+ <div class="min-w-0 max-w-full shrink-0">{props.children}</div>
80
86
  </section>
81
87
  )
82
88
  }
@@ -0,0 +1,8 @@
1
+ /** Geometry-only wrappers for arranging content around a circle. */
2
+ export {
3
+ OrbitItem,
4
+ OrbitLayout,
5
+ type OrbitItemProps,
6
+ type OrbitLayoutProps,
7
+ type OrbitRadius,
8
+ } from './orbit-layout'
@@ -0,0 +1,112 @@
1
+ import type { ComponentProps } from 'solid-js'
2
+ import { createContext, createMemo, splitProps, useContext, type Accessor } from 'solid-js'
3
+ import { cn } from '#lib/utils'
4
+
5
+ /** A CSS length or expression used to place an item away from the orbit center. */
6
+ export type OrbitRadius = number | string
7
+ export type OrbitLayoutMode = 'radial' | 'flow'
8
+
9
+ const DEFAULT_ORBIT_RADIUS = 'calc(50% - 2rem)'
10
+ const OrbitRadiusContext = createContext<Accessor<string>>()
11
+ const OrbitModeContext = createContext<Accessor<OrbitLayoutMode>>()
12
+
13
+ function resolveRadius(radius: OrbitRadius | undefined): string {
14
+ if (typeof radius === 'number') return `${Number.isFinite(radius) ? Math.max(0, radius) : 0}px`
15
+ return radius?.trim() || DEFAULT_ORBIT_RADIUS
16
+ }
17
+
18
+ /**
19
+ * OrbitLayout.
20
+ *
21
+ * Provides a positioned canvas and a shared radius for its OrbitItems. It does
22
+ * not assign list semantics or alter DOM order: callers choose semantics, and
23
+ * keyboard and screen-reader order remain the source order of the children.
24
+ */
25
+ export type OrbitLayoutProps = Omit<ComponentProps<'div'>, 'style'> & {
26
+ /** JSX style props are owned by this geometry primitive. */
27
+ style?: never
28
+ /** Responsive radius used by every OrbitItem unless that item overrides it. */
29
+ radius?: OrbitRadius
30
+ /** `flow` places items in source order; `radial` positions them around the host. */
31
+ mode?: OrbitLayoutMode
32
+ }
33
+
34
+ export function OrbitLayout(props: OrbitLayoutProps) {
35
+ const [local, rest] = splitProps(props, ['class', 'radius', 'mode', 'style', 'children'])
36
+ const radius = createMemo(() => resolveRadius(local.radius))
37
+ const mode = createMemo(() => local.mode ?? 'radial')
38
+
39
+ return (
40
+ <OrbitRadiusContext.Provider value={radius}>
41
+ <OrbitModeContext.Provider value={mode}>
42
+ <div
43
+ {...rest}
44
+ data-slot="orbit-layout"
45
+ class={cn(mode() === 'flow' ? 'grid gap-3' : 'relative size-full', local.class)}
46
+ >
47
+ {local.children}
48
+ </div>
49
+ </OrbitModeContext.Provider>
50
+ </OrbitRadiusContext.Provider>
51
+ )
52
+ }
53
+
54
+ /**
55
+ * OrbitItem.
56
+ *
57
+ * Positions one ordinary child around its OrbitLayout. This is geometry only:
58
+ * the wrapper has no role, tabindex, or interaction of its own.
59
+ */
60
+ export type OrbitItemProps = Omit<ComponentProps<'div'>, 'style'> & {
61
+ /** JSX style props are owned by this geometry primitive. */
62
+ style?: never
63
+ /** Zero-based position in the rendered sequence. */
64
+ index: number
65
+ /** Number of items sharing this orbit. */
66
+ count: number
67
+ /** Per-item override for OrbitLayout's responsive radius. */
68
+ radius?: OrbitRadius
69
+ }
70
+
71
+ export function OrbitItem(props: OrbitItemProps) {
72
+ const [local, rest] = splitProps(props, [
73
+ 'class',
74
+ 'index',
75
+ 'count',
76
+ 'radius',
77
+ 'style',
78
+ 'children',
79
+ ])
80
+ const inheritedRadius = useContext(OrbitRadiusContext)
81
+ const inheritedMode = useContext(OrbitModeContext)
82
+ const mode = () => inheritedMode?.() ?? 'radial'
83
+ const radius = () =>
84
+ local.radius !== undefined
85
+ ? resolveRadius(local.radius)
86
+ : (inheritedRadius?.() ?? DEFAULT_ORBIT_RADIUS)
87
+ const angle = createMemo(() => {
88
+ const count = Number.isFinite(local.count) ? Math.max(1, Math.trunc(local.count)) : 1
89
+ const rawIndex = Number.isFinite(local.index) ? Math.trunc(local.index) : 0
90
+ const index = ((rawIndex % count) + count) % count
91
+ return `${(index / count) * Math.PI * 2}rad`
92
+ })
93
+ const positionStyle = () =>
94
+ mode() === 'flow'
95
+ ? undefined
96
+ : {
97
+ top: `calc(50% + sin(${angle()}) * ${radius()})`,
98
+ left: `calc(50% + cos(${angle()}) * ${radius()})`,
99
+ translate: '-50% -50%',
100
+ }
101
+
102
+ return (
103
+ <div
104
+ {...rest}
105
+ data-slot="orbit-item"
106
+ class={cn(mode() === 'flow' ? undefined : 'absolute', local.class)}
107
+ style={positionStyle()}
108
+ >
109
+ {local.children}
110
+ </div>
111
+ )
112
+ }
@@ -329,9 +329,13 @@ export function SideRailItem<T extends ValidComponent = 'a'>(props: SideRailItem
329
329
 
330
330
  /** A non-navigating rail control: a collapse toggle, a "new" action. */
331
331
  export function SideRailButton(
332
- props: Omit<ComponentProps<'button'>, 'type'> & { label: string; shortcut?: string }
332
+ props: Omit<ComponentProps<'button'>, 'type'> & {
333
+ label: string
334
+ shortcut?: string
335
+ active?: boolean
336
+ }
333
337
  ) {
334
- const [local, rest] = splitProps(props, ['class', 'label', 'shortcut', 'children'])
338
+ const [local, rest] = splitProps(props, ['class', 'label', 'shortcut', 'children', 'active'])
335
339
  const [row, setRow] = createSignal<HTMLElement>()
336
340
  const [tip, setTip] = createSignal<{ top: number; left: number; height: number } | null>(null)
337
341
 
@@ -351,13 +355,14 @@ export function SideRailButton(
351
355
  type="button"
352
356
  ref={setRow}
353
357
  aria-label={local.label}
358
+ data-active={local.active ? 'true' : undefined}
354
359
  onPointerEnter={showTip}
355
360
  onPointerLeave={() => setTip(null)}
356
361
  onFocus={showTip}
357
362
  onBlur={() => setTip(null)}
358
363
  class={cn(
359
364
  sideRailItemClass,
360
- sideRailItemStateClass.idle,
365
+ local.active ? sideRailItemStateClass.active : sideRailItemStateClass.idle,
361
366
  'disabled:pointer-events-none disabled:opacity-50',
362
367
  local.class
363
368
  )}
@@ -0,0 +1,2 @@
1
+ /** Geometry wrappers for a virtual list; scrolling and range ownership stay with the caller. */
2
+ export { VirtualWindow, type VirtualWindowProps } from './virtual-window'
@@ -0,0 +1,55 @@
1
+ import type { ComponentProps, JSX } from 'solid-js'
2
+ import { splitProps } from 'solid-js'
3
+ import { cn } from '#lib/utils'
4
+
5
+ /**
6
+ * VirtualWindow.
7
+ *
8
+ * Supplies the two geometry wrappers a virtualized viewport needs: a full-height
9
+ * scroll space and a translated window containing the mounted rows. The caller
10
+ * owns the scroll region, its semantics, keyboard model, and range calculation;
11
+ * this component only keeps those rows at their measured position.
12
+ */
13
+ export type VirtualWindowProps = Omit<ComponentProps<'div'>, 'children' | 'style'> & {
14
+ /** JSX style props are owned by this geometry primitive. */
15
+ style?: never
16
+ /** The full scrollable height, in pixels. */
17
+ totalSize: number
18
+ /** The mounted window's top offset from the start of the full list, in pixels. */
19
+ offset?: number
20
+ /** Optional layout classes for the translated row container. */
21
+ contentClass?: string
22
+ children?: JSX.Element
23
+ }
24
+
25
+ function finitePixels(value: number): string {
26
+ return `${Number.isFinite(value) ? value : 0}px`
27
+ }
28
+
29
+ export function VirtualWindow(props: VirtualWindowProps) {
30
+ const [local, rest] = splitProps(props, [
31
+ 'class',
32
+ 'children',
33
+ 'totalSize',
34
+ 'offset',
35
+ 'contentClass',
36
+ 'style',
37
+ ])
38
+
39
+ return (
40
+ <div
41
+ {...rest}
42
+ data-slot="virtual-window-space"
43
+ class={cn('relative', local.class)}
44
+ style={{ height: finitePixels(Math.max(0, local.totalSize)) }}
45
+ >
46
+ <div
47
+ data-slot="virtual-window-content"
48
+ class={local.contentClass}
49
+ style={{ transform: `translateY(${finitePixels(local.offset ?? 0)})` }}
50
+ >
51
+ {local.children}
52
+ </div>
53
+ </div>
54
+ )
55
+ }
@@ -10,17 +10,20 @@ import {
10
10
  CommandSeparator as CmdkSeparator,
11
11
  useCommandState,
12
12
  } from 'cmdk-solid'
13
+ import { Dialog as KobalteDialog } from '@kobalte/core/dialog'
13
14
  import { Search } from 'lucide-solid'
14
15
  import type { ComponentProps } from 'solid-js'
15
16
  import { createEffect, createSignal, splitProps } from 'solid-js'
17
+ import { createDialogFocusRestoration } from '../dialog/dialog'
16
18
  import { menuItem } from '#lib/overlay'
17
19
  import { cn } from '#lib/utils'
18
20
 
19
- // cmdk emits data-disabled="false" on enabled items; Kobalte omits it.
20
- // Presence selectors would dim and disable every command in an app palette.
21
+ // cmdk emits data-disabled="false" on enabled items, unlike the presence-only
22
+ // attributes Kobalte menu rows use. Apply those shared disabled styles only when
23
+ // cmdk's value is true.
21
24
  const commandItem = menuItem
22
25
  .replace('data-[disabled]:pointer-events-none', '')
23
- .replace('data-[disabled]:opacity-50', '')
26
+ .replace('data-[disabled]:text-muted-foreground', '')
24
27
 
25
28
  /**
26
29
  * Command.
@@ -52,26 +55,76 @@ export function Command(props: ComponentProps<typeof CmdkRoot>) {
52
55
  )
53
56
  }
54
57
 
55
- export function CommandDialog(props: ComponentProps<typeof CmdkDialog>) {
56
- // cmdk's Dialog splits `contentClassName` onto the role="dialog" content
57
- // element and routes every other prop (including `class`) to the inner
58
- // Command. The surface must live on the content: a `class` here styles the
59
- // Command (fixed, so visible) while the dialog element itself renders as an
60
- // unstyled zero-height wrapper at the end of body — invisible to role
61
- // queries and axe.
62
- const [local, rest] = splitProps(props, ['class'])
58
+ type CommandDialogProps = ComponentProps<typeof CmdkDialog> &
59
+ Pick<ComponentProps<typeof KobalteDialog.Content>, 'onCloseAutoFocus' | 'onOpenAutoFocus'>
60
+
61
+ export function CommandDialog(props: CommandDialogProps) {
62
+ // cmdk-solid's Dialog does not forward Content autofocus props: unknown
63
+ // props fall through to its Command root. Compose Kobalte's dialog surface
64
+ // here so Escape and other close paths can restore focus to the real opener.
65
+ // Preserve the shared wrapper's `class` contract on the dialog surface;
66
+ // `contentClassName` adds to it, while the nested Command keeps its own API.
67
+ const [local, dialogProps, commandProps] = splitProps(
68
+ props,
69
+ [
70
+ 'class',
71
+ 'contentClassName',
72
+ 'overlayClassName',
73
+ 'container',
74
+ 'onCloseAutoFocus',
75
+ 'onOpenAutoFocus',
76
+ ],
77
+ [
78
+ 'open',
79
+ 'defaultOpen',
80
+ 'onOpenChange',
81
+ 'id',
82
+ 'modal',
83
+ 'preventScroll',
84
+ 'forceMount',
85
+ 'translations',
86
+ ]
87
+ )
88
+ const [isOpen, setIsOpen] = createSignal(dialogProps.open ?? dialogProps.defaultOpen ?? false)
89
+
90
+ createEffect(() => {
91
+ if (dialogProps.open !== undefined) setIsOpen(dialogProps.open)
92
+ })
93
+
94
+ const focus = createDialogFocusRestoration({
95
+ open: isOpen,
96
+ onCloseAutoFocus: local.onCloseAutoFocus,
97
+ onOpenAutoFocus: local.onOpenAutoFocus,
98
+ })
63
99
 
64
100
  return (
65
- <CmdkDialog
66
- contentClassName={cn(
67
- 'bg-popover text-popover-foreground fixed top-1/3 left-1/2 z-(--z-dialog) w-full max-w-lg -translate-x-1/2 -translate-y-1/2',
68
- 'overflow-hidden rounded-xl border border-border shadow-xl',
69
- 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',
70
- 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
71
- local.class
72
- )}
73
- {...rest}
74
- />
101
+ <KobalteDialog
102
+ {...dialogProps}
103
+ onOpenChange={(open) => {
104
+ setIsOpen(open)
105
+ dialogProps.onOpenChange?.(open)
106
+ }}
107
+ >
108
+ <KobalteDialog.Portal mount={local.container}>
109
+ <KobalteDialog.Overlay cmdk-overlay="" class={local.overlayClassName} />
110
+ <KobalteDialog.Content
111
+ aria-label={commandProps.label}
112
+ cmdk-dialog=""
113
+ class={cn(
114
+ 'bg-popover text-popover-foreground fixed top-1/3 left-1/2 z-(--z-dialog) w-full max-w-lg -translate-x-1/2 -translate-y-1/2',
115
+ 'overflow-hidden rounded-xl border border-border shadow-xl',
116
+ 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',
117
+ 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
118
+ local.class,
119
+ local.contentClassName
120
+ )}
121
+ onOpenAutoFocus={focus.onOpenAutoFocus}
122
+ onCloseAutoFocus={focus.onCloseAutoFocus}
123
+ >
124
+ <Command {...commandProps} />
125
+ </KobalteDialog.Content>
126
+ </KobalteDialog.Portal>
127
+ </KobalteDialog>
75
128
  )
76
129
  }
77
130
 
@@ -188,8 +241,8 @@ export function CommandItem(props: ComponentProps<typeof CmdkItem>) {
188
241
  <CmdkItem
189
242
  class={cn(
190
243
  commandItem,
191
- 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',
192
- 'text-popover-foreground data-[selected=true]:bg-surface-hover data-[selected=true]:text-popover-foreground',
244
+ 'data-[disabled=true]:pointer-events-none data-[disabled=true]:text-muted-foreground',
245
+ 'group/command-item text-popover-foreground data-[selected=true]:bg-card data-[selected=true]:text-popover-foreground',
193
246
  local.class
194
247
  )}
195
248
  {...rest}
@@ -212,18 +265,17 @@ export function CommandLoading(props: ComponentProps<typeof CmdkLoading>) {
212
265
  )
213
266
  }
214
267
 
215
- /**
216
- * The keyboard hint a palette item usually carries.
217
- * Muted canvas text can fail contrast on a raised or selected command row;
218
- * hierarchy comes from its size and monospace face, with the row's readable ink.
219
- */
268
+ /** The keyboard hint a palette item usually carries. */
220
269
  export function CommandShortcut(props: {
221
270
  class?: string
222
271
  children?: ComponentProps<'span'>['children']
223
272
  }) {
224
273
  return (
225
274
  <span
226
- class={cn('text-popover-foreground ms-auto font-mono text-2xs tracking-widest', props.class)}
275
+ class={cn(
276
+ 'text-muted-foreground ms-auto font-mono text-2xs tracking-widest group-data-[selected=true]/command-item:text-foreground',
277
+ props.class
278
+ )}
227
279
  >
228
280
  {props.children}
229
281
  </span>
@@ -25,13 +25,17 @@ import { cn } from '#lib/utils'
25
25
  * Kobalte supplies the full menu contract — arrow keys, typeahead, the roving
26
26
  * highlight, Escape to close and return focus — which is exactly what a
27
27
  * hand-rolled `div` with click handlers gets wrong.
28
+ * Menus are nonmodal by default so their generated focus guards do not become
29
+ * invalid direct children of the ARIA menu. Set `modal` explicitly when the
30
+ * surrounding interaction needs modal containment.
28
31
  *
29
32
  * The `destructive` variant marks the row with a status-coloured edge and
30
33
  * highlighted tint while keeping its label on the body foreground. Pairing it
31
34
  * with an AlertDialog is the caller's job.
32
35
  */
33
36
  export function DropdownMenu(props: ComponentProps<typeof KobalteDropdownMenu>) {
34
- return <KobalteDropdownMenu {...props} />
37
+ const [local, rest] = splitProps(props, ['modal'])
38
+ return <KobalteDropdownMenu modal={local.modal ?? false} {...rest} />
35
39
  }
36
40
 
37
41
  export function DropdownMenuTrigger(props: ComponentProps<typeof KobalteDropdownMenu.Trigger>) {
@@ -59,6 +59,8 @@ export type StatusTone = 'neutral' | 'success' | 'warning' | 'danger' | 'info' |
59
59
  export type StatusChipProps = Omit<ComponentProps<'span'>, 'children'> & {
60
60
  tone?: StatusTone
61
61
  label: string
62
+ /** Visually hide the text while preserving it for assistive technology. */
63
+ compact?: boolean
62
64
  /** Why the status is what it is. Shown in a tooltip; omit for a self-evident label. */
63
65
  detail?: string
64
66
  /** A trailing slot: a timestamp, a retry affordance, a count. */
@@ -66,7 +68,14 @@ export type StatusChipProps = Omit<ComponentProps<'span'>, 'children'> & {
66
68
  }
67
69
 
68
70
  export function StatusChip(props: StatusChipProps) {
69
- const [local, rest] = splitProps(props, ['tone', 'label', 'detail', 'trailing', 'class'])
71
+ const [local, rest] = splitProps(props, [
72
+ 'tone',
73
+ 'label',
74
+ 'compact',
75
+ 'detail',
76
+ 'trailing',
77
+ 'class',
78
+ ])
70
79
 
71
80
  const chip = (
72
81
  <span
@@ -78,7 +87,7 @@ export function StatusChip(props: StatusChipProps) {
78
87
  {...rest}
79
88
  >
80
89
  <span class={statusDotVariants({ tone: local.tone })} aria-hidden="true" />
81
- {local.label}
90
+ <span class={cn(local.compact && 'sr-only')}>{local.label}</span>
82
91
  {local.trailing}
83
92
  </span>
84
93
  )
package/src/index.ts CHANGED
@@ -79,6 +79,8 @@ export * from './components/motion'
79
79
 
80
80
  /* --- Layout -------------------------------------------------------------- */
81
81
  export * from './components/layout/split-layout'
82
+ export * from './components/layout/orbit-layout'
83
+ export * from './components/layout/virtual-window'
82
84
  export * from './components/layout/app-shell'
83
85
  export * from './components/layout/page'
84
86
  export * from './components/layout/panel'