@adea-ai/ui 0.153.0 → 0.154.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 (40) hide show
  1. package/dist/NOTICE +10 -1
  2. package/dist/components/composites/model-selector/model-selector.d.ts +15 -1
  3. package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -1
  4. package/dist/components/composites/model-selector/model-selector.js +263 -29
  5. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  6. package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
  7. package/dist/components/layout/side-rail/side-rail.js +46 -42
  8. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  9. package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
  10. package/dist/components/layout/top-bar/top-bar.js +13 -12
  11. package/dist/components/layout/top-bar/top-bar.js.map +1 -1
  12. package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -1
  13. package/dist/components/ui/dialog/dialog-layer.js +10 -10
  14. package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
  15. package/dist/components/ui/kbd/kbd.d.ts +23 -10
  16. package/dist/components/ui/kbd/kbd.d.ts.map +1 -1
  17. package/dist/components/ui/kbd/kbd.js +42 -11
  18. package/dist/components/ui/kbd/kbd.js.map +1 -1
  19. package/dist/lib/overlay.d.ts +1 -1
  20. package/dist/lib/overlay.d.ts.map +1 -1
  21. package/dist/lib/overlay.js +1 -1
  22. package/dist/lib/overlay.js.map +1 -1
  23. package/dist/r/model-selector.json +1 -0
  24. package/dist/r/registry.json +3 -0
  25. package/dist/r/side-rail.json +1 -0
  26. package/dist/r/src/components/composites/model-selector/model-selector.tsx +186 -10
  27. package/dist/r/src/components/layout/side-rail/side-rail.tsx +16 -19
  28. package/dist/r/src/components/layout/top-bar/top-bar.tsx +3 -7
  29. package/dist/r/src/components/ui/dialog/dialog-layer.tsx +16 -18
  30. package/dist/r/src/components/ui/kbd/kbd.tsx +53 -12
  31. package/dist/r/src/lib/overlay.ts +1 -1
  32. package/dist/r/top-bar.json +1 -0
  33. package/package.json +1 -1
  34. package/registry.json +3 -0
  35. package/src/components/composites/model-selector/model-selector.tsx +186 -10
  36. package/src/components/layout/side-rail/side-rail.tsx +16 -19
  37. package/src/components/layout/top-bar/top-bar.tsx +3 -7
  38. package/src/components/ui/dialog/dialog-layer.tsx +16 -18
  39. package/src/components/ui/kbd/kbd.tsx +53 -12
  40. package/src/lib/overlay.ts +1 -1
@@ -3,15 +3,19 @@ import { type VariantProps } from '#lib/variants';
3
3
  /**
4
4
  * Kbd.
5
5
  *
6
- * A keyboard key, in the order the user presses them. The element is a real
7
- * `<kbd>` so the semantics survive copy-paste, and the mono face is what makes
8
- * a shortcut visually distinct from the sentence around it.
6
+ * A keyboard key, ported from shadcn/ui's `Kbd` (MIT, see NOTICE). The element
7
+ * is a real `<kbd>` so the semantics survive copy-paste.
8
+ *
9
+ * The cap is set in the UI face at `text-xs`, as shadcn draws it, not in the
10
+ * code face. Monospace faces carry letters but rarely the modifier glyphs, so
11
+ * a mono `⌘` fell back to another font and sat visibly smaller than the mono
12
+ * `K` beside it. The UI face draws `⌘ ⇧ ⌥ ⌃` and letters as one family, so
13
+ * every cap in a chord reads at the same size.
9
14
  *
10
15
  * `size="compact"` exists for the dense rows a default cap would outweigh, a
11
16
  * rail search row, a sidebar shortcut hint. It drops a height rung, and it
12
17
  * lightens the fill and weight with it because at that size a solid muted cap
13
- * reads heavier than the row text it sits in. The default rendering is every
14
- * cap that is not inside such a row, and it is untouched by the rung.
18
+ * reads heavier than the row text it sits in.
15
19
  *
16
20
  * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`
17
21
  * needs a gap between them that is a layout concern, not punctuation.
@@ -26,24 +30,33 @@ export declare function Kbd(props: ComponentProps<'kbd'> & {
26
30
  export declare const kbdGroupVariants: (props?: ({
27
31
  size?: "compact" | "default" | null | undefined;
28
32
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
33
+ /**
34
+ * shadcn renders the group as a `<kbd>`; it stays a `<span>` here so a
35
+ * `kbd` selector still finds exactly the caps, which hosts and tests count.
36
+ */
29
37
  export declare function KbdGroup(props: ComponentProps<'span'> & {
30
38
  size?: KbdSize;
31
39
  }): import("solid-js").JSX.Element;
32
40
  /**
33
- * Split a written chord into one entry per key cap. Every character is a key:
34
- * `⌘K` renders as `⌘` + `K`, and a longer chord like `⇧⌘P` stays three caps
35
- * wide, which matches how the system draws chords in menus.
41
+ * Split a written chord into one entry per key cap.
42
+ *
43
+ * - Glyph chords draw one cap per character: `⌘K` is `⌘` + `K`, and `⇧⌘P`
44
+ * stays three caps wide, which matches how the system draws chords in menus.
45
+ * - Spelled-out names stay whole: `CtrlK` is `Ctrl` + `K`, `⇧Enter` is
46
+ * `⇧` + `Enter`.
47
+ * - `+` and spaces separate keys and are not drawn (`Ctrl+K`, `Ctrl Shift P`),
48
+ * except a `+` that is itself the key (`Ctrl++`, `⌘+`).
36
49
  */
37
50
  export declare function kbdChordKeys(keys: string): string[];
38
51
  export type KbdChordProps = Omit<ComponentProps<'span'>, 'children'> & {
39
- /** The chord as it is drawn, e.g. `"⌘K"` or `"⇧⌘P"`. One cap per character. */
52
+ /** The chord as it is drawn, e.g. `"⌘K"`, `"⇧⌘P"` or `"Ctrl+K"`. See `kbdChordKeys`. */
40
53
  keys: string;
41
54
  size?: KbdSize;
42
55
  };
43
56
  /**
44
57
  * KbdChord.
45
58
  *
46
- * A written chord drawn as caps, one per character. Decoration only: the
59
+ * A written chord drawn as caps, one per key (see `kbdChordKeys`). Decoration only: the
47
60
  * composition renders `aria-hidden`, so the accessible name and the parseable
48
61
  * `aria-keyshortcuts` stay on the control the chord belongs to. That is why
49
62
  * there is no children, the chord says what was drawn, nothing more.
@@ -1 +1 @@
1
- {"version":3,"file":"kbd.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/kbd/kbd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA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,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,kCAMpE;AAED,eAAO,MAAM,gBAAgB;;8EAW3B,CAAA;AAEF;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,kCAU1E;AAMD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBnD;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kCAQ5C"}
@@ -8,20 +8,24 @@ var _tmpl$2 = /*#__PURE__*/ template(`<span data-slot=kbd-group>`);
8
8
  /**
9
9
  * Kbd.
10
10
  *
11
- * A keyboard key, in the order the user presses them. The element is a real
12
- * `<kbd>` so the semantics survive copy-paste, and the mono face is what makes
13
- * a shortcut visually distinct from the sentence around it.
11
+ * A keyboard key, ported from shadcn/ui's `Kbd` (MIT, see NOTICE). The element
12
+ * is a real `<kbd>` so the semantics survive copy-paste.
13
+ *
14
+ * The cap is set in the UI face at `text-xs`, as shadcn draws it, not in the
15
+ * code face. Monospace faces carry letters but rarely the modifier glyphs, so
16
+ * a mono `⌘` fell back to another font and sat visibly smaller than the mono
17
+ * `K` beside it. The UI face draws `⌘ ⇧ ⌥ ⌃` and letters as one family, so
18
+ * every cap in a chord reads at the same size.
14
19
  *
15
20
  * `size="compact"` exists for the dense rows a default cap would outweigh, a
16
21
  * rail search row, a sidebar shortcut hint. It drops a height rung, and it
17
22
  * lightens the fill and weight with it because at that size a solid muted cap
18
- * reads heavier than the row text it sits in. The default rendering is every
19
- * cap that is not inside such a row, and it is untouched by the rung.
23
+ * reads heavier than the row text it sits in.
20
24
  *
21
25
  * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`
22
26
  * needs a gap between them that is a layout concern, not punctuation.
23
27
  */
24
- var kbdVariants = cva("bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 min-w-5 items-center justify-center gap-1 rounded-sm border border-border px-1 font-code text-code font-medium select-none", {
28
+ var kbdVariants = cva(["bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none", "[&_svg:not([class*='size-'])]:size-3"], {
25
29
  variants: { size: {
26
30
  default: "",
27
31
  compact: "min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none"
@@ -46,6 +50,10 @@ var kbdGroupVariants = cva("inline-flex items-center gap-1", {
46
50
  } },
47
51
  defaultVariants: { size: "default" }
48
52
  });
53
+ /**
54
+ * shadcn renders the group as a `<kbd>`; it stays a `<span>` here so a
55
+ * `kbd` selector still finds exactly the caps, which hosts and tests count.
56
+ */
49
57
  function KbdGroup(props) {
50
58
  const [local, rest] = splitProps(props, ["size", "class"]);
51
59
  return (() => {
@@ -56,18 +64,41 @@ function KbdGroup(props) {
56
64
  return _el$2;
57
65
  })();
58
66
  }
67
+ /** Key names that are drawn as one word on one cap. */
68
+ var NAMED_KEY = /^(?:Ctrl|Control|Alt|Option|Opt|Shift|Cmd|Command|Meta|Super|Win|Fn|Enter|Return|Escape|Esc|Tab|Space|Backspace|Delete|Del|Insert|Home|End|PageUp|PageDown|PgUp|PgDn|Up|Down|Left|Right|F(?:1\d|2[0-4]|[1-9]))/;
59
69
  /**
60
- * Split a written chord into one entry per key cap. Every character is a key:
61
- * `⌘K` renders as `⌘` + `K`, and a longer chord like `⇧⌘P` stays three caps
62
- * wide, which matches how the system draws chords in menus.
70
+ * Split a written chord into one entry per key cap.
71
+ *
72
+ * - Glyph chords draw one cap per character: `⌘K` is `⌘` + `K`, and `⇧⌘P`
73
+ * stays three caps wide, which matches how the system draws chords in menus.
74
+ * - Spelled-out names stay whole: `CtrlK` is `Ctrl` + `K`, `⇧Enter` is
75
+ * `⇧` + `Enter`.
76
+ * - `+` and spaces separate keys and are not drawn (`Ctrl+K`, `Ctrl Shift P`),
77
+ * except a `+` that is itself the key (`Ctrl++`, `⌘+`).
63
78
  */
64
79
  function kbdChordKeys(keys) {
65
- return [...keys];
80
+ const caps = [];
81
+ let rest = keys;
82
+ let separated = true;
83
+ while (rest.length > 0) {
84
+ const first = rest[0];
85
+ if (first === " " || first === "+" && !separated && rest.length > 1) {
86
+ rest = rest.slice(1);
87
+ separated = true;
88
+ continue;
89
+ }
90
+ const named = NAMED_KEY.exec(rest)?.[0];
91
+ const cap = named && !/^[a-z]/.test(rest.charAt(named.length)) ? named : String.fromCodePoint(rest.codePointAt(0));
92
+ caps.push(cap);
93
+ rest = rest.slice(cap.length);
94
+ separated = false;
95
+ }
96
+ return caps;
66
97
  }
67
98
  /**
68
99
  * KbdChord.
69
100
  *
70
- * A written chord drawn as caps, one per character. Decoration only: the
101
+ * A written chord drawn as caps, one per key (see `kbdChordKeys`). Decoration only: the
71
102
  * composition renders `aria-hidden`, so the accessible name and the parseable
72
103
  * `aria-keyshortcuts` stay on the control the chord belongs to. That is why
73
104
  * there is no children, the chord says what was drawn, nothing more.
@@ -1 +1 @@
1
- {"version":3,"file":"kbd.js","names":["For","splitProps","cva","cn","kbdVariants","variants","size","default","compact","defaultVariants","Kbd","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","kbdGroupVariants","KbdGroup","_el$2","_tmpl$2","kbdChordKeys","keys","KbdChord","_$createComponent","children","each","key"],"sources":["../../../../src/components/ui/kbd/kbd.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Kbd.\n *\n * A keyboard key, in the order the user presses them. The element is a real\n * `<kbd>` so the semantics survive copy-paste, and the mono face is what makes\n * a shortcut visually distinct from the sentence around it.\n *\n * `size=\"compact\"` exists for the dense rows a default cap would outweigh, a\n * rail search row, a sidebar shortcut hint. It drops a height rung, and it\n * lightens the fill and weight with it because at that size a solid muted cap\n * reads heavier than the row text it sits in. The default rendering is every\n * cap that is not inside such a row, and it is untouched by the rung.\n *\n * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`\n * needs a gap between them that is a layout concern, not punctuation.\n */\nexport const kbdVariants = cva(\n 'bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 min-w-5 items-center justify-center gap-1 rounded-sm border border-border px-1 font-code text-code font-medium select-none',\n {\n variants: {\n size: {\n default: '',\n compact: 'min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\nexport type KbdSize = NonNullable<VariantProps<typeof kbdVariants>['size']>\n\nexport function Kbd(props: ComponentProps<'kbd'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <kbd data-slot=\"kbd\" class={cn(kbdVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\nexport const kbdGroupVariants = cva('inline-flex items-center gap-1', {\n variants: {\n size: {\n default: '',\n /** The gap is what separates caps, so it tightens with them. */\n compact: 'gap-0.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n})\n\nexport function KbdGroup(props: ComponentProps<'span'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <span\n data-slot=\"kbd-group\"\n class={cn(kbdGroupVariants({ size: local.size }), local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * Split a written chord into one entry per key cap. Every character is a key:\n * `⌘K` renders as `⌘` + `K`, and a longer chord like `⇧⌘P` stays three caps\n * wide, which matches how the system draws chords in menus.\n */\nexport function kbdChordKeys(keys: string): string[] {\n return [...keys]\n}\n\nexport type KbdChordProps = Omit<ComponentProps<'span'>, 'children'> & {\n /** The chord as it is drawn, e.g. `\"⌘K\"` or `\"⇧⌘P\"`. One cap per character. */\n keys: string\n size?: KbdSize\n}\n\n/**\n * KbdChord.\n *\n * A written chord drawn as caps, one per character. Decoration only: the\n * composition renders `aria-hidden`, so the accessible name and the parseable\n * `aria-keyshortcuts` stay on the control the chord belongs to. That is why\n * there is no children, the chord says what was drawn, nothing more.\n */\nexport function KbdChord(props: KbdChordProps) {\n const [local, rest] = splitProps(props, ['keys', 'size', 'class'])\n\n return (\n <KbdGroup {...rest} size={local.size} class={local.class} aria-hidden=\"true\">\n <For each={kbdChordKeys(local.keys)}>{(key) => <Kbd size={local.size}>{key}</Kbd>}</For>\n </KbdGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAaI,cAAcF,IACzB,qMACA;CACEG,UAAU,EACRC,MAAM;EACJC,SAAS;EACTC,SAAS;CACX,EACF;CACAC,iBAAiB,EACfH,MAAM,UACR;AACF,CACF;AAIA,SAAgBI,IAAIC,OAAmD;CACrE,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO,CAAC,QAAQ,OAAO,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAC8Bd,GAAGC,YAAY,EAAEE,MAAMM,MAAMN,KAAK,CAAC,GAAGM,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAE5F;AAEA,IAAaK,mBAAmBjB,IAAI,kCAAkC;CACpEG,UAAU,EACRC,MAAM;EACJC,SAAS;;EAETC,SAAS;CACX,EACF;CACAC,iBAAiB,EACfH,MAAM,UACR;AACF,CAAC;AAED,SAAgBc,SAAST,OAAoD;CAC3E,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO,CAAC,QAAQ,OAAO,CAAC;CAEzD,cAAA;EAAA,IAAAU,QAAAC,QAAA;EAAAN,OAAAK,OAAAJ,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWd,GAAGgB,iBAAiB,EAAEb,MAAMM,MAAMN,KAAK,CAAC,GAAGM,MAAMM,KAAK;EAAC,EAAA,GAC1DL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAQ;CAAA,EAAA,CAAA;AAGd;;;;;;AAOA,SAAgBE,aAAaC,MAAwB;CACnD,OAAO,CAAC,GAAGA,IAAI;AACjB;;;;;;;;;AAgBA,SAAgBC,SAASd,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO;EAAC;EAAQ;EAAQ;CAAO,CAAC;CAEjE,OAAAe,gBACGN,UAAQH,WAAKJ,MAAI;EAAA,IAAEP,OAAI;GAAA,OAAEM,MAAMN;EAAI;EAAA,KAAA,WAAA;GAAA,OAASM,MAAMM;EAAK;EAAA,eAAA;EAAA,IAAAS,WAAA;GAAA,OAAAD,gBACrD1B,KAAG;IAAA,IAAC4B,OAAI;KAAA,OAAEL,aAAaX,MAAMY,IAAI;IAAC;IAAAG,WAAIE,QAAGH,gBAAMhB,KAAG;KAAA,IAACJ,OAAI;MAAA,OAAEM,MAAMN;KAAI;KAAAqB,UAAGE;IAAG,CAAA;GAAO,CAAA;EAAA;CAAA,CAAA,CAAA;AAGvF"}
1
+ {"version":3,"file":"kbd.js","names":["For","splitProps","cva","cn","kbdVariants","variants","size","default","compact","defaultVariants","Kbd","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","kbdGroupVariants","KbdGroup","_el$2","_tmpl$2","NAMED_KEY","kbdChordKeys","keys","caps","separated","length","first","slice","named","exec","cap","test","charAt","String","fromCodePoint","codePointAt","push","KbdChord","_$createComponent","children","each","key"],"sources":["../../../../src/components/ui/kbd/kbd.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Kbd.\n *\n * A keyboard key, ported from shadcn/ui's `Kbd` (MIT, see NOTICE). The element\n * is a real `<kbd>` so the semantics survive copy-paste.\n *\n * The cap is set in the UI face at `text-xs`, as shadcn draws it, not in the\n * code face. Monospace faces carry letters but rarely the modifier glyphs, so\n * a mono `⌘` fell back to another font and sat visibly smaller than the mono\n * `K` beside it. The UI face draws `⌘ ⇧ ⌥ ⌃` and letters as one family, so\n * every cap in a chord reads at the same size.\n *\n * `size=\"compact\"` exists for the dense rows a default cap would outweigh, a\n * rail search row, a sidebar shortcut hint. It drops a height rung, and it\n * lightens the fill and weight with it because at that size a solid muted cap\n * reads heavier than the row text it sits in.\n *\n * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`\n * needs a gap between them that is a layout concern, not punctuation.\n */\nexport const kbdVariants = cva(\n [\n 'bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none',\n \"[&_svg:not([class*='size-'])]:size-3\",\n ],\n {\n variants: {\n size: {\n default: '',\n compact: 'min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\nexport type KbdSize = NonNullable<VariantProps<typeof kbdVariants>['size']>\n\nexport function Kbd(props: ComponentProps<'kbd'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <kbd data-slot=\"kbd\" class={cn(kbdVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\nexport const kbdGroupVariants = cva('inline-flex items-center gap-1', {\n variants: {\n size: {\n default: '',\n /** The gap is what separates caps, so it tightens with them. */\n compact: 'gap-0.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n})\n\n/**\n * shadcn renders the group as a `<kbd>`; it stays a `<span>` here so a\n * `kbd` selector still finds exactly the caps, which hosts and tests count.\n */\nexport function KbdGroup(props: ComponentProps<'span'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <span\n data-slot=\"kbd-group\"\n class={cn(kbdGroupVariants({ size: local.size }), local.class)}\n {...rest}\n />\n )\n}\n\n/** Key names that are drawn as one word on one cap. */\nconst NAMED_KEY =\n /^(?:Ctrl|Control|Alt|Option|Opt|Shift|Cmd|Command|Meta|Super|Win|Fn|Enter|Return|Escape|Esc|Tab|Space|Backspace|Delete|Del|Insert|Home|End|PageUp|PageDown|PgUp|PgDn|Up|Down|Left|Right|F(?:1\\d|2[0-4]|[1-9]))/\n\n/**\n * Split a written chord into one entry per key cap.\n *\n * - Glyph chords draw one cap per character: `⌘K` is `⌘` + `K`, and `⇧⌘P`\n * stays three caps wide, which matches how the system draws chords in menus.\n * - Spelled-out names stay whole: `CtrlK` is `Ctrl` + `K`, `⇧Enter` is\n * `⇧` + `Enter`.\n * - `+` and spaces separate keys and are not drawn (`Ctrl+K`, `Ctrl Shift P`),\n * except a `+` that is itself the key (`Ctrl++`, `⌘+`).\n */\nexport function kbdChordKeys(keys: string): string[] {\n const caps: string[] = []\n let rest = keys\n let separated = true\n while (rest.length > 0) {\n const first = rest[0]!\n if (first === ' ' || (first === '+' && !separated && rest.length > 1)) {\n rest = rest.slice(1)\n separated = true\n continue\n }\n const named = NAMED_KEY.exec(rest)?.[0]\n // A name only counts when a lowercase letter does not continue it: `Tab`\n // in `Table` is not a key, so a caller's literal text is drawn as written.\n const cap =\n named && !/^[a-z]/.test(rest.charAt(named.length))\n ? named\n : String.fromCodePoint(rest.codePointAt(0)!)\n caps.push(cap)\n rest = rest.slice(cap.length)\n separated = false\n }\n return caps\n}\n\nexport type KbdChordProps = Omit<ComponentProps<'span'>, 'children'> & {\n /** The chord as it is drawn, e.g. `\"⌘K\"`, `\"⇧⌘P\"` or `\"Ctrl+K\"`. See `kbdChordKeys`. */\n keys: string\n size?: KbdSize\n}\n\n/**\n * KbdChord.\n *\n * A written chord drawn as caps, one per key (see `kbdChordKeys`). Decoration only: the\n * composition renders `aria-hidden`, so the accessible name and the parseable\n * `aria-keyshortcuts` stay on the control the chord belongs to. That is why\n * there is no children, the chord says what was drawn, nothing more.\n */\nexport function KbdChord(props: KbdChordProps) {\n const [local, rest] = splitProps(props, ['keys', 'size', 'class'])\n\n return (\n <KbdGroup {...rest} size={local.size} class={local.class} aria-hidden=\"true\">\n <For each={kbdChordKeys(local.keys)}>{(key) => <Kbd size={local.size}>{key}</Kbd>}</For>\n </KbdGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAaI,cAAcF,IACzB,CACE,oLACA,sCAAsC,GAExC;CACEG,UAAU,EACRC,MAAM;EACJC,SAAS;EACTC,SAAS;CACX,EACF;CACAC,iBAAiB,EACfH,MAAM,UACR;AACF,CACF;AAIA,SAAgBI,IAAIC,OAAmD;CACrE,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO,CAAC,QAAQ,OAAO,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAC8Bd,GAAGC,YAAY,EAAEE,MAAMM,MAAMN,KAAK,CAAC,GAAGM,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAE5F;AAEA,IAAaK,mBAAmBjB,IAAI,kCAAkC;CACpEG,UAAU,EACRC,MAAM;EACJC,SAAS;;EAETC,SAAS;CACX,EACF;CACAC,iBAAiB,EACfH,MAAM,UACR;AACF,CAAC;;;;;AAMD,SAAgBc,SAAST,OAAoD;CAC3E,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO,CAAC,QAAQ,OAAO,CAAC;CAEzD,cAAA;EAAA,IAAAU,QAAAC,QAAA;EAAAN,OAAAK,OAAAJ,WA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IAACJ,OAAI;MAAA,OAAEM,MAAMN;KAAI;KAAAoC,UAAGE;IAAG,CAAA;GAAO,CAAA;EAAA;CAAA,CAAA,CAAA;AAGvF"}
@@ -88,7 +88,7 @@ export declare const destructiveMenuItem = "border-s-2 border-destructive ps-1.5
88
88
  /** The label above a group of menu rows. */
89
89
  export declare const menuLabel = "px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase";
90
90
  /** The chord drawn at a row's trailing edge: menus and the command palette. */
91
- export declare const menuShortcut = "text-muted-foreground ms-auto font-code text-code tracking-widest";
91
+ export declare const menuShortcut = "text-muted-foreground ms-auto text-xs tracking-widest";
92
92
  /** The rule between menu groups. */
93
93
  export declare const menuSeparator = "bg-border -mx-1 my-1 h-px";
94
94
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/lib/overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtD;+EAC+E;AAC/E,eAAO,MAAM,cAAc,iFACqD,CAAA;AAEhF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,4EACiD,CAAA;AAE3E;;;GAGG;AACH,eAAO,MAAM,YAAY,wDAAwD,CAAA;AAEjF,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,6DAA6D,CAAA;AAE3F,gDAAgD;AAChD,eAAO,MAAM,YAAY,yFAC+D,CAAA;AAExF,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,oGACoE,CAAA;AAEnG,gDAAgD;AAChD,eAAO,MAAM,aAAa,qCAAqC,CAAA;AAE/D,+FAA+F;AAC/F,eAAO,MAAM,aAAa,2DAA2D,CAAA;AAErF,2CAA2C;AAC3C,eAAO,MAAM,kBAAkB,kCAAkC,CAAA;AAEjE,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,QAGkE,CAAA;AAEjG;;;;;GAKG;AACH,eAAO,MAAM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AO,MAAM,kBAAkB,QAAQ,CAAA;AAEvC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;aAAK,mBAAmB,EAAE,EAAE;CAAW,CAAA;AAEjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,8BAA8B,CAAA"}
@@ -89,7 +89,7 @@ var destructiveMenuItem = "border-s-2 border-destructive ps-1.5 text-foreground
89
89
  /** The label above a group of menu rows. */
90
90
  var menuLabel = "px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase";
91
91
  /** The chord drawn at a row's trailing edge: menus and the command palette. */
92
- var menuShortcut = "text-muted-foreground ms-auto font-code text-code tracking-widest";
92
+ var menuShortcut = "text-muted-foreground ms-auto text-xs tracking-widest";
93
93
  /** The rule between menu groups. */
94
94
  var menuSeparator = "bg-border -mx-1 my-1 h-px";
95
95
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.js","names":[],"sources":["../../src/lib/overlay.ts"],"sourcesContent":["/**\n * Shared strings for the overlay layer: dialogs, sheets, menus, popovers,\n * tooltips and the command palette.\n *\n * These live here rather than in each component because the overlay family is\n * where consistency is most visible and least likely to survive duplication.\n * A dialog, a sheet and a dropdown that disagree about their border, radius,\n * motion or shadow read as three different apps, and an app that adopts this\n * library would inherit all three. Declaring the surface once is what makes\n * \"an overlay looks like this\" a fact rather than a convention.\n */\n\nimport { cva, type VariantProps } from '#lib/variants'\n\n/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers\n * and the command palette float on the elevated overlay rung (`--popover`). */\nexport const overlaySurface =\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * The modal panel: the same hairline edge, radius and elevation, painted on the\n * *neutral* theme surface instead of the elevated overlay rung.\n *\n * `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies\n * the canvas hue's chroma on the elevated step. On the dark default's violet\n * canvas that makes the dialog the most chromatic surface in the ladder,\n * `oklch(0.2406 0.0088 300.91)`, red above green in sRGB, and on a full dialog\n * panel that cast reads as a warm tint the canvas never has. shadcn's own\n * convention already splits the two: a Dialog paints `bg-background`, menus and\n * popovers paint `bg-popover`. The veil, the hairline and the elevation shadow\n * carry the separation the lighter fill no longer provides.\n */\nexport const dialogSurface =\n 'bg-background text-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * Overlay titles have one fixed typography role. Keep this small recipe shared\n * without loading the configurable Heading component into every dialog.\n */\nexport const overlayTitle = 'font-semibold text-base tracking-tight leading-none'\n\n/** The span of the portal wrapper that centres a dialog-like overlay. */\nexport const overlayPositioner = 'fixed inset-0 z-(--z-dialog) grid place-items-center p-4'\n\n/** The dimming layer behind a modal overlay. */\nexport const overlayScrim =\n 'fixed inset-0 z-(--z-dialog) bg-scrim/50 supports-[backdrop-filter]:backdrop-blur-xs'\n\n/** The scrim fades; it never zooms with the panel above it. */\nexport const overlayScrimMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0'\n\n/** The title block of a dialog-shaped panel. */\nexport const overlayHeader = 'flex flex-col gap-1.5 text-start'\n\n/** The action row of a dialog-shaped panel: stacked on a phone, trailing on a wider window. */\nexport const overlayFooter = 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'\n\n/** The sentence under an overlay title. */\nexport const overlayDescription = 'text-muted-foreground text-sm'\n\n/** The icon-only close in a dialog or sheet's top-end corner. */\nexport const overlayCornerClose =\n 'absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground ' +\n 'transition-colors ease-out hover:bg-surface-hover hover:text-foreground ' +\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle outline-none'\n\n/**\n * The tip: the card-toned bubble an explanation shows in. The side rail draws\n * it flush to a collapsed row and every floating tooltip composes the same\n * fill, edge, and type, so a control never explains itself in two visual\n * languages.\n */\nexport const tooltipTip =\n 'bg-card text-card-foreground rounded-md border border-border text-sm font-medium shadow-lg'\n\n/**\n * Entrance and exit motion, expressed as data-state classes.\n *\n * `data-expanded` / `data-closed` are Kobalte's; `data-side-*` come from its\n * popper positioning and let a menu slide in from the edge it is anchored to,\n * which is what makes a dropdown feel attached to its trigger rather than\n * dropped on the screen. Exit motion is shorter than entry, because a\n * dismissal should feel immediate while an arrival benefits from being seen.\n */\nexport const overlayZoom =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95 ' +\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95'\n\n/** `overlayZoom` at the panel's pace: menus, dialogs. */\nexport const overlayMotion = `${overlayZoom} data-expanded:duration-200 data-closed:duration-150`\n\n/** `overlayZoom` at a hint's pace: the tooltip and the hover card. */\nexport const tooltipMotion = `${overlayZoom} data-expanded:duration-150 data-closed:duration-100`\n\n/** Popover-style motion: no zoom, so a panel anchored to a control does not\n * appear to breathe away from it. */\nexport const popoverMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0 ' +\n 'data-expanded:duration-150 data-closed:duration-100'\n\n/** The popper arrow. Sized in the component; coloured here. */\nexport const popoverArrow = 'fill-popover stroke-border'\n\n/**\n * A menu row: the shared height, radius, hover fill and focus treatment for\n * every item inside a menu, listbox or command list.\n *\n * The row sizes and dims the icons a caller puts in it, but not the glyph of\n * its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`\n * rule outranks a single utility on the glyph, so without the exclusion a\n * radio item's `size-2` dot drew as a 16px muted disc and every check lost the\n * indicator's accent.\n */\nexport const menuItem =\n 'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none ' +\n 'transition-colors ease-out ' +\n 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground ' +\n 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground ' +\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 ' +\n '[&_svg:not([data-slot$=-indicator]_*)]:size-4 ' +\n '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground'\n\n/** A destructive action keeps readable text and marks its row with a status edge. */\nexport const destructiveMenuItem =\n 'border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle'\n\n/** The label above a group of menu rows. */\nexport const menuLabel =\n 'px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase'\n\n/** The chord drawn at a row's trailing edge: menus and the command palette. */\nexport const menuShortcut = 'text-muted-foreground ms-auto font-code text-code tracking-widest'\n\n/** The rule between menu groups. */\nexport const menuSeparator = 'bg-border -mx-1 my-1 h-px'\n\n/**\n * A leading colour swatch on a menu or select row: the sanctioned way to carry\n * a card-tone colour into a list of options. The tones are the system's accent\n * and status roles, the vocabulary a Badge already speaks, so the colour an\n * option shows in a menu is the colour its badge carries on a card, and a\n * caller never passes a raw colour into a list. The dot is `aria-hidden`; the\n * label carries the meaning, so a tone is never the only signal.\n */\nexport const menuSwatchTone = cva('size-2 shrink-0 rounded-full', {\n variants: {\n tone: {\n neutral: 'bg-muted-foreground',\n primary: 'bg-primary',\n success: 'bg-success',\n warning: 'bg-warning',\n destructive: 'bg-destructive',\n info: 'bg-info',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\n/** The tones a menu row's swatch can take. */\nexport type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>\n\n/** Padding shared by every menu-list surface. */\nexport const menuContentPadding = 'p-1'\n\n/**\n * Marks a floating layer, a menu, a listbox, a popover, as part of the top\n * layer.\n *\n * A modal dialog hides everything outside itself from assistive technology\n * (`aria-hidden` on its siblings) and keeps watching `<body>` for new nodes.\n * A menu or select opened from inside the dialog portals to `<body>`, so the\n * dialog hid it too: the list was on screen, focused, and invisible to a\n * screen reader, and an outside-click check could treat a click on it as a\n * click away from the dialog. Kobalte exempts nodes carrying this attribute\n * from both, so every floating layer carries it.\n */\nexport const topLayerProps = { 'data-kb-top-layer': '' } as const\n\n/**\n * Marks a portal mounted while another modal layer is already open as a layer\n * of its own rather than background.\n *\n * Kobalte's hide-outside observer walks body children added after its layer\n * opened and aria-hides them a frame later, so a non-modal dialog portaled in\n * during that window would land outside the accessibility tree. That observer\n * exempts added nodes carrying the React Aria spelling it ported;\n * `data-kb-top-layer` (`topLayerProps`) is only honoured by a newer layer's\n * initial walk, which must still hide this portal.\n */\nexport const lateLayerAttribute = 'data-react-aria-top-layer'\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBACX;;;;;;;;;;;;;;AAeF,IAAa,gBACX;;;;;AAMF,IAAa,eAAe;;AAG5B,IAAa,oBAAoB;;AAGjC,IAAa,eACX;;AAGF,IAAa,qBACX;;AAGF,IAAa,gBAAgB;;AAG7B,IAAa,gBAAgB;;AAG7B,IAAa,qBAAqB;;AAGlC,IAAa,qBACX;;;;;;;AAUF,IAAa,aACX;;;;;;;;;;AAWF,IAAa,cACX;;AAIF,IAAa,gBAAgB,GAAG,YAAY;;AAG5C,IAAa,gBAAgB,GAAG,YAAY;;;AAI5C,IAAa,gBACX;;AAIF,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,WACX;;AASF,IAAa,sBACX;;AAGF,IAAa,YACX;;AAGF,IAAa,eAAe;;AAG5B,IAAa,gBAAgB;;;;;;;;;AAU7B,IAAa,iBAAiB,IAAI,gCAAgC;CAChE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,aAAa;EACb,MAAM;CACR,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;;AAMD,IAAa,qBAAqB;;;;;;;;;;;;;AAclC,IAAa,gBAAgB,EAAE,qBAAqB,GAAG;;;;;;;;;;;;AAavD,IAAa,qBAAqB"}
1
+ {"version":3,"file":"overlay.js","names":[],"sources":["../../src/lib/overlay.ts"],"sourcesContent":["/**\n * Shared strings for the overlay layer: dialogs, sheets, menus, popovers,\n * tooltips and the command palette.\n *\n * These live here rather than in each component because the overlay family is\n * where consistency is most visible and least likely to survive duplication.\n * A dialog, a sheet and a dropdown that disagree about their border, radius,\n * motion or shadow read as three different apps, and an app that adopts this\n * library would inherit all three. Declaring the surface once is what makes\n * \"an overlay looks like this\" a fact rather than a convention.\n */\n\nimport { cva, type VariantProps } from '#lib/variants'\n\n/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers\n * and the command palette float on the elevated overlay rung (`--popover`). */\nexport const overlaySurface =\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * The modal panel: the same hairline edge, radius and elevation, painted on the\n * *neutral* theme surface instead of the elevated overlay rung.\n *\n * `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies\n * the canvas hue's chroma on the elevated step. On the dark default's violet\n * canvas that makes the dialog the most chromatic surface in the ladder,\n * `oklch(0.2406 0.0088 300.91)`, red above green in sRGB, and on a full dialog\n * panel that cast reads as a warm tint the canvas never has. shadcn's own\n * convention already splits the two: a Dialog paints `bg-background`, menus and\n * popovers paint `bg-popover`. The veil, the hairline and the elevation shadow\n * carry the separation the lighter fill no longer provides.\n */\nexport const dialogSurface =\n 'bg-background text-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * Overlay titles have one fixed typography role. Keep this small recipe shared\n * without loading the configurable Heading component into every dialog.\n */\nexport const overlayTitle = 'font-semibold text-base tracking-tight leading-none'\n\n/** The span of the portal wrapper that centres a dialog-like overlay. */\nexport const overlayPositioner = 'fixed inset-0 z-(--z-dialog) grid place-items-center p-4'\n\n/** The dimming layer behind a modal overlay. */\nexport const overlayScrim =\n 'fixed inset-0 z-(--z-dialog) bg-scrim/50 supports-[backdrop-filter]:backdrop-blur-xs'\n\n/** The scrim fades; it never zooms with the panel above it. */\nexport const overlayScrimMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0'\n\n/** The title block of a dialog-shaped panel. */\nexport const overlayHeader = 'flex flex-col gap-1.5 text-start'\n\n/** The action row of a dialog-shaped panel: stacked on a phone, trailing on a wider window. */\nexport const overlayFooter = 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'\n\n/** The sentence under an overlay title. */\nexport const overlayDescription = 'text-muted-foreground text-sm'\n\n/** The icon-only close in a dialog or sheet's top-end corner. */\nexport const overlayCornerClose =\n 'absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground ' +\n 'transition-colors ease-out hover:bg-surface-hover hover:text-foreground ' +\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle outline-none'\n\n/**\n * The tip: the card-toned bubble an explanation shows in. The side rail draws\n * it flush to a collapsed row and every floating tooltip composes the same\n * fill, edge, and type, so a control never explains itself in two visual\n * languages.\n */\nexport const tooltipTip =\n 'bg-card text-card-foreground rounded-md border border-border text-sm font-medium shadow-lg'\n\n/**\n * Entrance and exit motion, expressed as data-state classes.\n *\n * `data-expanded` / `data-closed` are Kobalte's; `data-side-*` come from its\n * popper positioning and let a menu slide in from the edge it is anchored to,\n * which is what makes a dropdown feel attached to its trigger rather than\n * dropped on the screen. Exit motion is shorter than entry, because a\n * dismissal should feel immediate while an arrival benefits from being seen.\n */\nexport const overlayZoom =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95 ' +\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95'\n\n/** `overlayZoom` at the panel's pace: menus, dialogs. */\nexport const overlayMotion = `${overlayZoom} data-expanded:duration-200 data-closed:duration-150`\n\n/** `overlayZoom` at a hint's pace: the tooltip and the hover card. */\nexport const tooltipMotion = `${overlayZoom} data-expanded:duration-150 data-closed:duration-100`\n\n/** Popover-style motion: no zoom, so a panel anchored to a control does not\n * appear to breathe away from it. */\nexport const popoverMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0 ' +\n 'data-expanded:duration-150 data-closed:duration-100'\n\n/** The popper arrow. Sized in the component; coloured here. */\nexport const popoverArrow = 'fill-popover stroke-border'\n\n/**\n * A menu row: the shared height, radius, hover fill and focus treatment for\n * every item inside a menu, listbox or command list.\n *\n * The row sizes and dims the icons a caller puts in it, but not the glyph of\n * its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`\n * rule outranks a single utility on the glyph, so without the exclusion a\n * radio item's `size-2` dot drew as a 16px muted disc and every check lost the\n * indicator's accent.\n */\nexport const menuItem =\n 'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none ' +\n 'transition-colors ease-out ' +\n 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground ' +\n 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground ' +\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 ' +\n '[&_svg:not([data-slot$=-indicator]_*)]:size-4 ' +\n '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground'\n\n/** A destructive action keeps readable text and marks its row with a status edge. */\nexport const destructiveMenuItem =\n 'border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle'\n\n/** The label above a group of menu rows. */\nexport const menuLabel =\n 'px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase'\n\n/** The chord drawn at a row's trailing edge: menus and the command palette. */\nexport const menuShortcut = 'text-muted-foreground ms-auto text-xs tracking-widest'\n\n/** The rule between menu groups. */\nexport const menuSeparator = 'bg-border -mx-1 my-1 h-px'\n\n/**\n * A leading colour swatch on a menu or select row: the sanctioned way to carry\n * a card-tone colour into a list of options. The tones are the system's accent\n * and status roles, the vocabulary a Badge already speaks, so the colour an\n * option shows in a menu is the colour its badge carries on a card, and a\n * caller never passes a raw colour into a list. The dot is `aria-hidden`; the\n * label carries the meaning, so a tone is never the only signal.\n */\nexport const menuSwatchTone = cva('size-2 shrink-0 rounded-full', {\n variants: {\n tone: {\n neutral: 'bg-muted-foreground',\n primary: 'bg-primary',\n success: 'bg-success',\n warning: 'bg-warning',\n destructive: 'bg-destructive',\n info: 'bg-info',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\n/** The tones a menu row's swatch can take. */\nexport type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>\n\n/** Padding shared by every menu-list surface. */\nexport const menuContentPadding = 'p-1'\n\n/**\n * Marks a floating layer, a menu, a listbox, a popover, as part of the top\n * layer.\n *\n * A modal dialog hides everything outside itself from assistive technology\n * (`aria-hidden` on its siblings) and keeps watching `<body>` for new nodes.\n * A menu or select opened from inside the dialog portals to `<body>`, so the\n * dialog hid it too: the list was on screen, focused, and invisible to a\n * screen reader, and an outside-click check could treat a click on it as a\n * click away from the dialog. Kobalte exempts nodes carrying this attribute\n * from both, so every floating layer carries it.\n */\nexport const topLayerProps = { 'data-kb-top-layer': '' } as const\n\n/**\n * Marks a portal mounted while another modal layer is already open as a layer\n * of its own rather than background.\n *\n * Kobalte's hide-outside observer walks body children added after its layer\n * opened and aria-hides them a frame later, so a non-modal dialog portaled in\n * during that window would land outside the accessibility tree. That observer\n * exempts added nodes carrying the React Aria spelling it ported;\n * `data-kb-top-layer` (`topLayerProps`) is only honoured by a newer layer's\n * initial walk, which must still hide this portal.\n */\nexport const lateLayerAttribute = 'data-react-aria-top-layer'\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBACX;;;;;;;;;;;;;;AAeF,IAAa,gBACX;;;;;AAMF,IAAa,eAAe;;AAG5B,IAAa,oBAAoB;;AAGjC,IAAa,eACX;;AAGF,IAAa,qBACX;;AAGF,IAAa,gBAAgB;;AAG7B,IAAa,gBAAgB;;AAG7B,IAAa,qBAAqB;;AAGlC,IAAa,qBACX;;;;;;;AAUF,IAAa,aACX;;;;;;;;;;AAWF,IAAa,cACX;;AAIF,IAAa,gBAAgB,GAAG,YAAY;;AAG5C,IAAa,gBAAgB,GAAG,YAAY;;;AAI5C,IAAa,gBACX;;AAIF,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,WACX;;AASF,IAAa,sBACX;;AAGF,IAAa,YACX;;AAGF,IAAa,eAAe;;AAG5B,IAAa,gBAAgB;;;;;;;;;AAU7B,IAAa,iBAAiB,IAAI,gCAAgC;CAChE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,aAAa;EACb,MAAM;CACR,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;;AAMD,IAAa,qBAAqB;;;;;;;;;;;;;AAclC,IAAa,gBAAgB,EAAE,qBAAqB,GAAG;;;;;;;;;;;;AAavD,IAAa,qBAAqB"}
@@ -11,6 +11,7 @@
11
11
  "@adea-ai/ui/command",
12
12
  "@adea-ai/ui/dropdown-menu",
13
13
  "@adea-ai/ui/popover",
14
+ "@adea-ai/ui/tabs",
14
15
  "lib"
15
16
  ],
16
17
  "files": [
@@ -2017,6 +2017,7 @@
2017
2017
  "@kobalte/core@^0.13.14"
2018
2018
  ],
2019
2019
  "registryDependencies": [
2020
+ "@adea-ai/ui/kbd",
2020
2021
  "lib"
2021
2022
  ],
2022
2023
  "files": [
@@ -2175,6 +2176,7 @@
2175
2176
  "lucide-solid@^1.71.0"
2176
2177
  ],
2177
2178
  "registryDependencies": [
2179
+ "@adea-ai/ui/kbd",
2178
2180
  "lib"
2179
2181
  ],
2180
2182
  "files": [
@@ -2803,6 +2805,7 @@
2803
2805
  "@adea-ai/ui/command",
2804
2806
  "@adea-ai/ui/dropdown-menu",
2805
2807
  "@adea-ai/ui/popover",
2808
+ "@adea-ai/ui/tabs",
2806
2809
  "lib"
2807
2810
  ],
2808
2811
  "files": [
@@ -7,6 +7,7 @@
7
7
  "@kobalte/core@^0.13.14"
8
8
  ],
9
9
  "registryDependencies": [
10
+ "@adea-ai/ui/kbd",
10
11
  "lib"
11
12
  ],
12
13
  "files": [
@@ -7,6 +7,7 @@ import {
7
7
  For,
8
8
  Show,
9
9
  splitProps,
10
+ type JSX,
10
11
  } from 'solid-js'
11
12
  import { cn } from '../../../lib/utils'
12
13
  import { Button } from '../../ui/button'
@@ -28,6 +29,7 @@ import {
28
29
  DropdownMenuTrigger,
29
30
  } from '../../ui/dropdown-menu'
30
31
  import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'
32
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../ui/tabs'
31
33
  import { REASON_TEXT_LIMIT, boundText } from '../../../lib/text'
32
34
  import {
33
35
  findModel,
@@ -74,6 +76,15 @@ import {
74
76
  * search box, because scanning thirty rows is slower than typing four letters.
75
77
  * Both close on choice and return focus to the trigger. Triggers use
76
78
  * `aria-disabled` so a blocked control is still reachable and its reason read.
79
+ *
80
+ * ## Tabs
81
+ *
82
+ * `layout="tabs"` is for a list whose providers are the first choice, such as
83
+ * one row of harnesses. The popover opens with one tab per provider, in the
84
+ * order they first appear (the host's order), each drawn with `providerIcon`
85
+ * or the provider's initial and named by its tooltip. Under the tabs, a search
86
+ * box and the list cover the selected tab's models only. The tab starts on the
87
+ * selected model's provider. Effort stays its own menu.
77
88
  */
78
89
  export type ModelSelectorProps = {
79
90
  models: readonly ModelOption[]
@@ -89,6 +100,10 @@ export type ModelSelectorProps = {
89
100
  disabledReason?: string
90
101
  /** The group's accessible name. */
91
102
  label?: string
103
+ /** `tabs`: one tab per provider above a searchable list of that provider's models. */
104
+ layout?: 'list' | 'tabs'
105
+ /** The provider's mark, drawn with `currentColor`, for the tabs and the trigger. */
106
+ providerIcon?: (provider: string) => JSX.Element
92
107
  class?: string
93
108
  }
94
109
 
@@ -102,6 +117,8 @@ export function ModelSelector(props: ModelSelectorProps) {
102
117
  'searchThreshold',
103
118
  'disabledReason',
104
119
  'label',
120
+ 'layout',
121
+ 'providerIcon',
105
122
  'class',
106
123
  ])
107
124
  const blocked = () => local.disabledReason !== undefined
@@ -132,26 +149,41 @@ export function ModelSelector(props: ModelSelectorProps) {
132
149
  }
133
150
  >
134
151
  <Show
135
- when={needsSearch(local.models.length, local.searchThreshold)}
152
+ when={local.layout !== 'tabs'}
136
153
  fallback={
137
- <ModelMenu
154
+ <ModelTabs
138
155
  models={local.models}
139
156
  selected={selected()}
140
157
  value={local.value}
141
158
  blocked={blocked()}
142
159
  describedBy={describedBy()}
160
+ providerIcon={local.providerIcon}
143
161
  onChange={(id) => local.onChange?.(id)}
144
162
  />
145
163
  }
146
164
  >
147
- <ModelSearch
148
- models={local.models}
149
- selected={selected()}
150
- value={local.value}
151
- blocked={blocked()}
152
- describedBy={describedBy()}
153
- onChange={(id) => local.onChange?.(id)}
154
- />
165
+ <Show
166
+ when={needsSearch(local.models.length, local.searchThreshold)}
167
+ fallback={
168
+ <ModelMenu
169
+ models={local.models}
170
+ selected={selected()}
171
+ value={local.value}
172
+ blocked={blocked()}
173
+ describedBy={describedBy()}
174
+ onChange={(id) => local.onChange?.(id)}
175
+ />
176
+ }
177
+ >
178
+ <ModelSearch
179
+ models={local.models}
180
+ selected={selected()}
181
+ value={local.value}
182
+ blocked={blocked()}
183
+ describedBy={describedBy()}
184
+ onChange={(id) => local.onChange?.(id)}
185
+ />
186
+ </Show>
155
187
  </Show>
156
188
  </Show>
157
189
  <Show when={efforts().length > 0}>
@@ -361,6 +393,150 @@ function ModelSearch(props: PickerProps) {
361
393
  )
362
394
  }
363
395
 
396
+ /** The provider's mark, or its initial when the host gives none. */
397
+ function ProviderGlyph(props: { provider: string; icon?: (provider: string) => JSX.Element }) {
398
+ return (
399
+ <Show
400
+ when={props.icon?.(props.provider)}
401
+ fallback={
402
+ <span aria-hidden="true" class="text-xs font-semibold uppercase">
403
+ {props.provider.charAt(0)}
404
+ </span>
405
+ }
406
+ >
407
+ {(icon) => (
408
+ <span aria-hidden="true" class="inline-flex size-4 shrink-0 items-center justify-center">
409
+ {icon()}
410
+ </span>
411
+ )}
412
+ </Show>
413
+ )
414
+ }
415
+
416
+ function ModelTabs(props: PickerProps & { providerIcon?: (provider: string) => JSX.Element }) {
417
+ const [open, setOpen] = createSignal(false)
418
+ const groups = createMemo(() => groupModels(props.models))
419
+ const inert = () => props.blocked || props.models.length === 0
420
+ const groupOf = (model: ModelOption | undefined) =>
421
+ model ? groups().find((group) => group.models.includes(model))?.provider : undefined
422
+ const [tab, setTab] = createSignal<string>()
423
+ // Each opening starts on the selected model's provider, else the first.
424
+ const current = () => {
425
+ const chosen = tab()
426
+ return chosen && groups().some((group) => group.provider === chosen)
427
+ ? chosen
428
+ : (groupOf(props.selected) ?? groups()[0]?.provider)
429
+ }
430
+ let content: HTMLDivElement | undefined
431
+ const focusSearch = () =>
432
+ queueMicrotask(() => content?.querySelector<HTMLInputElement>('[cmdk-input]')?.focus())
433
+
434
+ createEffect(() => {
435
+ if (inert()) setOpen(false)
436
+ })
437
+
438
+ return (
439
+ <Popover
440
+ open={open()}
441
+ onOpenChange={(next) => {
442
+ setOpen(next && !inert())
443
+ if (!next) setTab(undefined)
444
+ }}
445
+ placement="top-start"
446
+ gutter={6}
447
+ >
448
+ <PopoverTrigger
449
+ as={Button}
450
+ variant="ghost"
451
+ size="sm"
452
+ aria-label={`Model: ${props.models.length === 0 ? 'No models available' : triggerText(props)}`}
453
+ aria-disabled={inert() || undefined}
454
+ aria-describedby={props.describedBy}
455
+ >
456
+ <Show when={groupOf(props.selected)}>
457
+ {(provider) => <ProviderGlyph provider={provider()} icon={props.providerIcon} />}
458
+ </Show>
459
+ <ModelTrigger
460
+ selected={props.selected}
461
+ value={props.value}
462
+ empty={props.models.length === 0}
463
+ />
464
+ </PopoverTrigger>
465
+ <PopoverContent
466
+ ref={(element: HTMLDivElement) => (content = element)}
467
+ hideArrow
468
+ class="w-80 max-w-full p-0"
469
+ onOpenAutoFocus={(event: Event) => {
470
+ event.preventDefault()
471
+ focusSearch()
472
+ }}
473
+ >
474
+ <Tabs
475
+ value={current()}
476
+ onChange={(next: string) => {
477
+ setTab(next)
478
+ focusSearch()
479
+ }}
480
+ class="gap-0"
481
+ >
482
+ <TabsList fill scrollable aria-label="Providers" class="px-1.5 pt-1">
483
+ <For each={groups()}>
484
+ {(group) => (
485
+ <TabsTrigger
486
+ value={group.provider}
487
+ aria-label={group.provider}
488
+ title={group.provider}
489
+ class="h-8 min-w-8 px-1.5 pb-1.5 text-muted-foreground data-[selected]:text-foreground"
490
+ >
491
+ <ProviderGlyph provider={group.provider} icon={props.providerIcon} />
492
+ </TabsTrigger>
493
+ )}
494
+ </For>
495
+ </TabsList>
496
+ <For each={groups()}>
497
+ {(group) => (
498
+ <TabsContent value={group.provider}>
499
+ <Command
500
+ label={`${group.provider} models`}
501
+ defaultValue={
502
+ props.selected && group.models.includes(props.selected)
503
+ ? modelSearchValue(props.selected).trim()
504
+ : undefined
505
+ }
506
+ >
507
+ <CommandInput placeholder="Search models" />
508
+ <CommandList>
509
+ <CommandEmpty>No model matches.</CommandEmpty>
510
+ <For each={group.models}>
511
+ {(model) => (
512
+ <CommandItem
513
+ value={modelSearchValue(model)}
514
+ disabled={props.blocked || model.disabledReason !== undefined}
515
+ onSelect={() => {
516
+ if (props.blocked || model.disabledReason !== undefined) return
517
+ props.onChange(model.id)
518
+ setOpen(false)
519
+ }}
520
+ >
521
+ <ModelOptionBody model={model} />
522
+ <Show when={model.id === props.value}>
523
+ <Check aria-hidden="true" class="ms-auto text-primary" />
524
+ <span class="visually-hidden">Current model</span>
525
+ </Show>
526
+ </CommandItem>
527
+ )}
528
+ </For>
529
+ </CommandList>
530
+ </Command>
531
+ </TabsContent>
532
+ )}
533
+ </For>
534
+ </Tabs>
535
+ </PopoverContent>
536
+ </Popover>
537
+ )
538
+ }
539
+
364
540
  function EffortMenu(props: {
365
541
  efforts: ReturnType<typeof normalizeEfforts>
366
542
  value?: string
@@ -11,6 +11,7 @@ import {
11
11
  import { Portal } from 'solid-js/web'
12
12
  import { tooltipTip } from '../../../lib/overlay'
13
13
  import { cn } from '../../../lib/utils'
14
+ import { KbdChord } from '../../ui/kbd'
14
15
  import { SideRailContext } from './side-rail-context'
15
16
 
16
17
  /**
@@ -227,11 +228,7 @@ function RailTip(props: {
227
228
  </span>
228
229
  {props.label}
229
230
  <Show when={props.shortcut}>
230
- {(shortcutSlot) => (
231
- <span class="text-muted-foreground shrink-0 font-code text-code leading-none">
232
- {shortcutSlot()}
233
- </span>
234
- )}
231
+ {(shortcut) => <KbdChord keys={shortcut()} class="shrink-0" />}
235
232
  </Show>
236
233
  </div>
237
234
  </Portal>
@@ -362,13 +359,14 @@ export function SideRailItem<T extends ValidComponent = 'a'>(props: SideRailItem
362
359
  )}
363
360
  </Show>
364
361
 
365
- <Show when={local.shortcut && trailing() === undefined}>
366
- <span
367
- aria-hidden="true"
368
- class="text-sidebar-muted-foreground shrink-0 font-code text-code leading-none opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden"
369
- >
370
- {local.shortcut}
371
- </span>
362
+ <Show when={trailing() === undefined && local.shortcut}>
363
+ {(shortcut) => (
364
+ <KbdChord
365
+ keys={shortcut()}
366
+ size="compact"
367
+ class="shrink-0 opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden"
368
+ />
369
+ )}
372
370
  </Show>
373
371
 
374
372
  <Show when={trailing()}>
@@ -424,13 +422,12 @@ export function SideRailButton(
424
422
  {local.label}
425
423
  </span>
426
424
  <Show when={local.shortcut}>
427
- {(shortcutSlot) => (
428
- <span
429
- aria-hidden="true"
430
- class="text-sidebar-muted-foreground shrink-0 font-code text-code leading-none opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden"
431
- >
432
- {shortcutSlot()}
433
- </span>
425
+ {(shortcut) => (
426
+ <KbdChord
427
+ keys={shortcut()}
428
+ size="compact"
429
+ class="shrink-0 opacity-0 transition-opacity group-hover/rail-item:opacity-100 group-focus-visible/rail-item:opacity-100 group-data-[collapsed=true]/rail:hidden"
430
+ />
434
431
  )}
435
432
  </Show>
436
433
  </button>