@adea-ai/ui 0.85.0 → 0.88.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 (239) hide show
  1. package/README.md +17 -1
  2. package/dist/NOTICE +34 -0
  3. package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
  4. package/dist/components/composites/action-button/action-button.js +2 -2
  5. package/dist/components/composites/action-button/action-button.js.map +1 -1
  6. package/dist/components/composites/list-row/list-row.d.ts +6 -3
  7. package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
  8. package/dist/components/composites/list-row/list-row.js +69 -7
  9. package/dist/components/composites/list-row/list-row.js.map +1 -1
  10. package/dist/components/composites/settings/settings.d.ts +9 -11
  11. package/dist/components/composites/settings/settings.d.ts.map +1 -1
  12. package/dist/components/composites/settings/settings.js +48 -33
  13. package/dist/components/composites/settings/settings.js.map +1 -1
  14. package/dist/components/conversation/message-composer.js +1 -1
  15. package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
  16. package/dist/components/conversation/scroll-follow.js +95 -15
  17. package/dist/components/conversation/scroll-follow.js.map +1 -1
  18. package/dist/components/layout/app-shell/index.d.ts +1 -0
  19. package/dist/components/layout/app-shell/index.d.ts.map +1 -1
  20. package/dist/components/layout/app-shell/index.js +2 -1
  21. package/dist/components/layout/app-shell/skip-link.d.ts +11 -0
  22. package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -0
  23. package/dist/components/layout/app-shell/skip-link.js +44 -0
  24. package/dist/components/layout/app-shell/skip-link.js.map +1 -0
  25. package/dist/components/layout/floating-preview/floating-preview.d.ts +12 -0
  26. package/dist/components/layout/floating-preview/floating-preview.d.ts.map +1 -0
  27. package/dist/components/layout/floating-preview/floating-preview.js +283 -0
  28. package/dist/components/layout/floating-preview/floating-preview.js.map +1 -0
  29. package/dist/components/layout/floating-preview/index.d.ts +3 -0
  30. package/dist/components/layout/floating-preview/index.d.ts.map +1 -0
  31. package/dist/components/layout/floating-preview/index.js +3 -0
  32. package/dist/components/layout/floating-preview/model.d.ts +74 -0
  33. package/dist/components/layout/floating-preview/model.d.ts.map +1 -0
  34. package/dist/components/layout/floating-preview/model.js +146 -0
  35. package/dist/components/layout/floating-preview/model.js.map +1 -0
  36. package/dist/components/layout/sidebar-nav/index.d.ts +1 -1
  37. package/dist/components/layout/sidebar-nav/index.d.ts.map +1 -1
  38. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts +18 -2
  39. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
  40. package/dist/components/layout/sidebar-nav/sidebar-nav.js +42 -11
  41. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  42. package/dist/components/theme/index.d.ts +1 -0
  43. package/dist/components/theme/index.d.ts.map +1 -1
  44. package/dist/components/theme/index.js +2 -1
  45. package/dist/components/theme/theme-mode-toggle.d.ts +10 -0
  46. package/dist/components/theme/theme-mode-toggle.d.ts.map +1 -0
  47. package/dist/components/theme/theme-mode-toggle.js +82 -0
  48. package/dist/components/theme/theme-mode-toggle.js.map +1 -0
  49. package/dist/components/ui/checkbox/checkbox.d.ts +2 -0
  50. package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
  51. package/dist/components/ui/checkbox/checkbox.js +24 -3
  52. package/dist/components/ui/checkbox/checkbox.js.map +1 -1
  53. package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
  54. package/dist/components/ui/combobox/combobox.js +41 -4
  55. package/dist/components/ui/combobox/combobox.js.map +1 -1
  56. package/dist/components/ui/combobox/index.d.ts +1 -0
  57. package/dist/components/ui/combobox/index.d.ts.map +1 -1
  58. package/dist/components/ui/combobox/index.js +2 -1
  59. package/dist/components/ui/combobox/value-combobox.d.ts +19 -0
  60. package/dist/components/ui/combobox/value-combobox.d.ts.map +1 -0
  61. package/dist/components/ui/combobox/value-combobox.js +42 -0
  62. package/dist/components/ui/combobox/value-combobox.js.map +1 -0
  63. package/dist/components/ui/empty/empty-state.d.ts +15 -0
  64. package/dist/components/ui/empty/empty-state.d.ts.map +1 -0
  65. package/dist/components/ui/empty/empty-state.js +96 -0
  66. package/dist/components/ui/empty/empty-state.js.map +1 -0
  67. package/dist/components/ui/empty/index.d.ts +1 -0
  68. package/dist/components/ui/empty/index.d.ts.map +1 -1
  69. package/dist/components/ui/empty/index.js +2 -1
  70. package/dist/components/ui/entity-icon/entity-icon.d.ts +4 -1
  71. package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
  72. package/dist/components/ui/entity-icon/entity-icon.js +37 -13
  73. package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
  74. package/dist/components/ui/field/field.d.ts +36 -13
  75. package/dist/components/ui/field/field.d.ts.map +1 -1
  76. package/dist/components/ui/field/field.js +146 -24
  77. package/dist/components/ui/field/field.js.map +1 -1
  78. package/dist/components/ui/field/index.d.ts +3 -1
  79. package/dist/components/ui/field/index.d.ts.map +1 -1
  80. package/dist/components/ui/field/index.js +3 -2
  81. package/dist/components/ui/field/number-field.d.ts +19 -0
  82. package/dist/components/ui/field/number-field.d.ts.map +1 -0
  83. package/dist/components/ui/field/number-field.js +76 -0
  84. package/dist/components/ui/field/number-field.js.map +1 -0
  85. package/dist/components/ui/input/index.d.ts +1 -0
  86. package/dist/components/ui/input/index.d.ts.map +1 -1
  87. package/dist/components/ui/input/index.js +2 -1
  88. package/dist/components/ui/input/input-control.d.ts +11 -0
  89. package/dist/components/ui/input/input-control.d.ts.map +1 -0
  90. package/dist/components/ui/input/input-control.js +24 -0
  91. package/dist/components/ui/input/input-control.js.map +1 -0
  92. package/dist/components/ui/input/input.d.ts.map +1 -1
  93. package/dist/components/ui/input/input.js +56 -28
  94. package/dist/components/ui/input/input.js.map +1 -1
  95. package/dist/components/ui/input-group/index.d.ts +1 -0
  96. package/dist/components/ui/input-group/index.d.ts.map +1 -1
  97. package/dist/components/ui/input-group/index.js +2 -1
  98. package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
  99. package/dist/components/ui/input-group/input-group.js +42 -5
  100. package/dist/components/ui/input-group/input-group.js.map +1 -1
  101. package/dist/components/ui/input-group/secret-input-group.d.ts +11 -0
  102. package/dist/components/ui/input-group/secret-input-group.d.ts.map +1 -0
  103. package/dist/components/ui/input-group/secret-input-group.js +67 -0
  104. package/dist/components/ui/input-group/secret-input-group.js.map +1 -0
  105. package/dist/components/ui/native-select/native-select.d.ts.map +1 -1
  106. package/dist/components/ui/native-select/native-select.js +39 -4
  107. package/dist/components/ui/native-select/native-select.js.map +1 -1
  108. package/dist/components/ui/progress/progress.d.ts.map +1 -1
  109. package/dist/components/ui/progress/progress.js +30 -18
  110. package/dist/components/ui/progress/progress.js.map +1 -1
  111. package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
  112. package/dist/components/ui/radio-group/radio-group.js +41 -4
  113. package/dist/components/ui/radio-group/radio-group.js.map +1 -1
  114. package/dist/components/ui/switch/switch.d.ts +2 -0
  115. package/dist/components/ui/switch/switch.d.ts.map +1 -1
  116. package/dist/components/ui/switch/switch.js +24 -3
  117. package/dist/components/ui/switch/switch.js.map +1 -1
  118. package/dist/components/ui/tabs/tabs.js +1 -1
  119. package/dist/components/ui/tabs/tabs.js.map +1 -1
  120. package/dist/components/ui/text-link/index.d.ts +2 -0
  121. package/dist/components/ui/text-link/index.d.ts.map +1 -0
  122. package/dist/components/ui/text-link/index.js +2 -0
  123. package/dist/components/ui/text-link/text-link.d.ts +9 -0
  124. package/dist/components/ui/text-link/text-link.d.ts.map +1 -0
  125. package/dist/components/ui/text-link/text-link.js +30 -0
  126. package/dist/components/ui/text-link/text-link.js.map +1 -0
  127. package/dist/components/ui/textarea/textarea.d.ts.map +1 -1
  128. package/dist/components/ui/textarea/textarea.js +41 -4
  129. package/dist/components/ui/textarea/textarea.js.map +1 -1
  130. package/dist/index.d.ts +3 -0
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.js +18 -7
  133. package/dist/lib/clipboard.d.ts +3 -0
  134. package/dist/lib/clipboard.d.ts.map +1 -0
  135. package/dist/lib/clipboard.js +35 -0
  136. package/dist/lib/clipboard.js.map +1 -0
  137. package/dist/lib/download.d.ts +3 -0
  138. package/dist/lib/download.d.ts.map +1 -0
  139. package/dist/lib/download.js +31 -0
  140. package/dist/lib/download.js.map +1 -0
  141. package/dist/lib/form-field.d.ts +37 -0
  142. package/dist/lib/form-field.d.ts.map +1 -0
  143. package/dist/lib/form-field.js +47 -0
  144. package/dist/lib/form-field.js.map +1 -0
  145. package/dist/r/app-shell.json +5 -0
  146. package/dist/r/combobox.json +5 -0
  147. package/dist/r/empty.json +10 -1
  148. package/dist/r/field.json +7 -0
  149. package/dist/r/floating-preview.json +30 -0
  150. package/dist/r/input-group.json +6 -0
  151. package/dist/r/input.json +5 -0
  152. package/dist/r/lib.json +15 -0
  153. package/dist/r/list-row.json +1 -0
  154. package/dist/r/registry.json +112 -1
  155. package/dist/r/src/components/composites/action-button/action-button.tsx +5 -1
  156. package/dist/r/src/components/composites/list-row/list-row.tsx +81 -8
  157. package/dist/r/src/components/composites/settings/settings.tsx +67 -37
  158. package/dist/r/src/components/conversation/scroll-follow.ts +109 -15
  159. package/dist/r/src/components/layout/app-shell/index.ts +1 -0
  160. package/dist/r/src/components/layout/app-shell/skip-link.tsx +35 -0
  161. package/dist/r/src/components/layout/floating-preview/floating-preview.tsx +260 -0
  162. package/dist/r/src/components/layout/floating-preview/index.ts +2 -0
  163. package/dist/r/src/components/layout/floating-preview/model.ts +285 -0
  164. package/dist/r/src/components/layout/sidebar-nav/index.ts +2 -0
  165. package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +71 -16
  166. package/dist/r/src/components/theme/index.ts +1 -0
  167. package/dist/r/src/components/theme/theme-mode-toggle.tsx +56 -0
  168. package/dist/r/src/components/ui/checkbox/checkbox.tsx +20 -3
  169. package/dist/r/src/components/ui/combobox/combobox.tsx +24 -1
  170. package/dist/r/src/components/ui/combobox/index.ts +1 -0
  171. package/dist/r/src/components/ui/combobox/value-combobox.tsx +38 -0
  172. package/dist/r/src/components/ui/empty/empty-state.tsx +71 -0
  173. package/dist/r/src/components/ui/empty/index.ts +1 -0
  174. package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +33 -2
  175. package/dist/r/src/components/ui/field/field.tsx +102 -5
  176. package/dist/r/src/components/ui/field/index.ts +5 -0
  177. package/dist/r/src/components/ui/field/number-field.tsx +71 -0
  178. package/dist/r/src/components/ui/input/index.ts +1 -0
  179. package/dist/r/src/components/ui/input/input-control.tsx +38 -0
  180. package/dist/r/src/components/ui/input/input.tsx +32 -20
  181. package/dist/r/src/components/ui/input-group/index.ts +1 -0
  182. package/dist/r/src/components/ui/input-group/input-group.tsx +25 -2
  183. package/dist/r/src/components/ui/input-group/secret-input-group.tsx +58 -0
  184. package/dist/r/src/components/ui/native-select/native-select.tsx +27 -1
  185. package/dist/r/src/components/ui/progress/progress.tsx +12 -8
  186. package/dist/r/src/components/ui/radio-group/radio-group.tsx +30 -2
  187. package/dist/r/src/components/ui/switch/switch.tsx +20 -3
  188. package/dist/r/src/components/ui/tabs/tabs.tsx +1 -1
  189. package/dist/r/src/components/ui/text-link/index.ts +2 -0
  190. package/dist/r/src/components/ui/text-link/text-link.tsx +28 -0
  191. package/dist/r/src/components/ui/textarea/textarea.tsx +24 -1
  192. package/dist/r/src/lib/clipboard.ts +41 -0
  193. package/dist/r/src/lib/download.ts +29 -0
  194. package/dist/r/src/lib/form-field.ts +93 -0
  195. package/dist/r/text-link.json +22 -0
  196. package/dist/r/theming.json +6 -0
  197. package/package.json +1 -1
  198. package/registry.json +112 -1
  199. package/src/components/composites/action-button/action-button.tsx +5 -1
  200. package/src/components/composites/list-row/list-row.tsx +81 -8
  201. package/src/components/composites/settings/settings.tsx +67 -37
  202. package/src/components/conversation/scroll-follow.ts +109 -15
  203. package/src/components/layout/app-shell/index.ts +1 -0
  204. package/src/components/layout/app-shell/skip-link.tsx +35 -0
  205. package/src/components/layout/floating-preview/floating-preview.tsx +260 -0
  206. package/src/components/layout/floating-preview/index.ts +2 -0
  207. package/src/components/layout/floating-preview/model.ts +285 -0
  208. package/src/components/layout/sidebar-nav/index.ts +2 -0
  209. package/src/components/layout/sidebar-nav/sidebar-nav.tsx +71 -16
  210. package/src/components/theme/index.ts +1 -0
  211. package/src/components/theme/theme-mode-toggle.tsx +56 -0
  212. package/src/components/ui/checkbox/checkbox.tsx +20 -3
  213. package/src/components/ui/combobox/combobox.tsx +24 -1
  214. package/src/components/ui/combobox/index.ts +1 -0
  215. package/src/components/ui/combobox/value-combobox.tsx +38 -0
  216. package/src/components/ui/empty/empty-state.tsx +71 -0
  217. package/src/components/ui/empty/index.ts +1 -0
  218. package/src/components/ui/entity-icon/entity-icon.tsx +33 -2
  219. package/src/components/ui/field/field.tsx +102 -5
  220. package/src/components/ui/field/index.ts +5 -0
  221. package/src/components/ui/field/number-field.tsx +71 -0
  222. package/src/components/ui/input/index.ts +1 -0
  223. package/src/components/ui/input/input-control.tsx +38 -0
  224. package/src/components/ui/input/input.tsx +32 -20
  225. package/src/components/ui/input-group/index.ts +1 -0
  226. package/src/components/ui/input-group/input-group.tsx +25 -2
  227. package/src/components/ui/input-group/secret-input-group.tsx +58 -0
  228. package/src/components/ui/native-select/native-select.tsx +27 -1
  229. package/src/components/ui/progress/progress.tsx +12 -8
  230. package/src/components/ui/radio-group/radio-group.tsx +30 -2
  231. package/src/components/ui/switch/switch.tsx +20 -3
  232. package/src/components/ui/tabs/tabs.tsx +1 -1
  233. package/src/components/ui/text-link/index.ts +2 -0
  234. package/src/components/ui/text-link/text-link.tsx +28 -0
  235. package/src/components/ui/textarea/textarea.tsx +24 -1
  236. package/src/index.ts +3 -0
  237. package/src/lib/clipboard.ts +41 -0
  238. package/src/lib/download.ts +29 -0
  239. package/src/lib/form-field.ts +93 -0
@@ -0,0 +1,82 @@
1
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip/tooltip.js";
2
+ import { ToggleGroup, ToggleGroupItem } from "../ui/toggle-group/toggle-group.js";
3
+ import { createComponent, insert, memo, mergeProps, template } from "solid-js/web";
4
+ import { Monitor, Moon, Sun } from "lucide-solid";
5
+ import { For, splitProps } from "solid-js";
6
+ //#region src/components/theme/theme-mode-toggle.tsx
7
+ var _tmpl$ = /*#__PURE__*/ template(`<span>`);
8
+ var APPEARANCES = [
9
+ {
10
+ value: "light",
11
+ label: "Light",
12
+ icon: Sun
13
+ },
14
+ {
15
+ value: "dark",
16
+ label: "Dark",
17
+ icon: Moon
18
+ },
19
+ {
20
+ value: "system",
21
+ label: "System",
22
+ icon: Monitor
23
+ }
24
+ ];
25
+ function ThemeModeToggle(props) {
26
+ const [local, rest] = splitProps(props, [
27
+ "mode",
28
+ "onModeChange",
29
+ "withLabels"
30
+ ]);
31
+ return createComponent(ToggleGroup, mergeProps(rest, {
32
+ attached: true,
33
+ multiple: false,
34
+ get value() {
35
+ return local.mode;
36
+ },
37
+ onChange: (value) => {
38
+ const option = APPEARANCES.find((candidate) => candidate.value === value);
39
+ if (option) local.onModeChange(option.value);
40
+ },
41
+ get ["aria-label"]() {
42
+ return rest["aria-label"] ?? "Appearance";
43
+ },
44
+ get children() {
45
+ return createComponent(For, {
46
+ each: APPEARANCES,
47
+ children: (appearance) => createComponent(Tooltip, { get children() {
48
+ return [createComponent(TooltipTrigger, {
49
+ as: ToggleGroupItem,
50
+ get value() {
51
+ return appearance.value;
52
+ },
53
+ variant: "outline",
54
+ get size() {
55
+ return local.withLabels ? "sm" : "icon-sm";
56
+ },
57
+ get ["aria-label"]() {
58
+ return appearance.label;
59
+ },
60
+ get children() {
61
+ return [createComponent(appearance.icon, { "aria-hidden": "true" }), memo(() => memo(() => !!local.withLabels)() ? (() => {
62
+ var _el$ = _tmpl$();
63
+ insert(_el$, () => appearance.label);
64
+ return _el$;
65
+ })() : null)];
66
+ }
67
+ }), createComponent(TooltipContent, { get children() {
68
+ return [
69
+ "Use ",
70
+ memo(() => appearance.label.toLowerCase()),
71
+ " appearance"
72
+ ];
73
+ } })];
74
+ } })
75
+ });
76
+ }
77
+ }));
78
+ }
79
+ //#endregion
80
+ export { ThemeModeToggle };
81
+
82
+ //# sourceMappingURL=theme-mode-toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-mode-toggle.js","names":["Monitor","Moon","Sun","ComponentProps","For","splitProps","ToggleGroup","ToggleGroupItem","Tooltip","TooltipContent","TooltipTrigger","APPEARANCES","value","label","icon","const","ThemeModeToggleProps","Omit","mode","onModeChange","withLabels","ThemeModeToggle","props","local","rest","_$createComponent","_$mergeProps","attached","multiple","onChange","option","find","candidate","aria-label","children","each","appearance","as","variant","size","_$memo","_el$","_tmpl$","_$insert","toLowerCase","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../src/components/theme/theme-mode-toggle.tsx"],"sourcesContent":["import { Monitor, Moon, Sun } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { ToggleGroup, ToggleGroupItem } from '../ui/toggle-group/toggle-group'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip'\n\nconst APPEARANCES = [\n { value: 'light', label: 'Light', icon: Sun },\n { value: 'dark', label: 'Dark', icon: Moon },\n { value: 'system', label: 'System', icon: Monitor },\n] as const\n\n/** Controlled appearance selection for hosts that own their preference storage. */\nexport type ThemeModeToggleProps = Omit<\n ComponentProps<typeof ToggleGroup>,\n 'children' | 'value' | 'onChange' | 'multiple'\n> & {\n mode: 'light' | 'dark' | 'system'\n onModeChange: (mode: 'light' | 'dark' | 'system') => void\n withLabels?: boolean\n}\n\nexport function ThemeModeToggle(props: ThemeModeToggleProps) {\n const [local, rest] = splitProps(props, ['mode', 'onModeChange', 'withLabels'])\n return (\n <ToggleGroup\n {...rest}\n attached\n multiple={false}\n value={local.mode}\n onChange={(value: string | null) => {\n const option = APPEARANCES.find((candidate) => candidate.value === value)\n if (option) local.onModeChange(option.value)\n }}\n aria-label={rest['aria-label'] ?? 'Appearance'}\n >\n <For each={APPEARANCES}>\n {(appearance) => (\n <Tooltip>\n <TooltipTrigger\n as={ToggleGroupItem}\n value={appearance.value}\n variant=\"outline\"\n size={local.withLabels ? 'sm' : 'icon-sm'}\n aria-label={appearance.label}\n >\n <appearance.icon aria-hidden=\"true\" />\n {local.withLabels ? <span>{appearance.label}</span> : null}\n </TooltipTrigger>\n <TooltipContent>Use {appearance.label.toLowerCase()} appearance</TooltipContent>\n </Tooltip>\n )}\n </For>\n </ToggleGroup>\n )\n}\n"],"mappings":";;;;;;;AAMA,IAAMW,cAAc;CAClB;EAAEC,OAAO;EAASC,OAAO;EAASC,MAAMZ;CAAI;CAC5C;EAAEU,OAAO;EAAQC,OAAO;EAAQC,MAAMb;CAAK;CAC3C;EAAEW,OAAO;EAAUC,OAAO;EAAUC,MAAMd;CAAQ;AAAC;AAarD,SAAgBqB,gBAAgBC,OAA6B;CAC3D,MAAM,CAACC,OAAOC,QAAQnB,WAAWiB,OAAO;EAAC;EAAQ;EAAgB;CAAY,CAAC;CAC9E,OAAAG,gBACGnB,aAAWoB,WACNF,MAAI;EACRG,UAAQ;EACRC,UAAU;EAAK,IACfhB,QAAK;GAAA,OAAEW,MAAML;EAAI;EACjBW,WAAWjB,UAAyB;GAClC,MAAMkB,SAASnB,YAAYoB,MAAMC,cAAcA,UAAUpB,UAAUA,KAAK;GACxE,IAAIkB,QAAQP,MAAMJ,aAAaW,OAAOlB,KAAK;EAC7C;EAAC,KAAA,gBAAA;GAAA,OACWY,KAAK,iBAAiB;EAAY;EAAA,IAAAU,WAAA;GAAA,OAAAT,gBAE7CrB,KAAG;IAAC+B,MAAMxB;IAAWuB,WAClBE,eAAUX,gBACTjB,SAAO,EAAA,IAAA0B,WAAA;KAAA,OAAA,CAAAT,gBACLf,gBAAc;MACb2B,IAAI9B;MAAe,IACnBK,QAAK;OAAA,OAAEwB,WAAWxB;MAAK;MACvB0B,SAAO;MAAA,IACPC,OAAI;OAAA,OAAEhB,MAAMH,aAAa,OAAO;MAAS;MAAA,KAAA,gBAAA;OAAA,OAC7BgB,WAAWvB;MAAK;MAAA,IAAAqB,WAAA;OAAA,OAAA,CAAAT,gBAE3BW,WAAWtB,MAAI,EAAA,eAAA,OAAA,CAAA,GAAA0B,WACfA,WAAA,CAAA,CAAAjB,MAAMH,UAAU,CAAA,CAAA,WAAA;QAAA,IAAAqB,OAAAC,OAAA;QAAAC,OAAAF,YAAUL,WAAWvB,KAAK;QAAA,OAAA4B;OAAA,EAAA,CAAA,IAAW,IAAI,CAAA;MAAA;KAAA,CAAA,GAAAhB,gBAE3DhB,gBAAc,EAAA,IAAAyB,WAAA;MAAA,OAAA;OAAA;OAAAM,WAAMJ,WAAWvB,MAAM+B,YAAY,CAAC;OAAA;MAAA;KAAA,EAAA,CAAA,CAAA;IAAA,EAAA,CAAA;GAEtD,CAAA;EAAA;CAAA,CAAA,CAAA;AAIT"}
@@ -14,6 +14,8 @@ import type { ComponentProps, JSX } from 'solid-js';
14
14
  * the ring lives on the control and reads the input's focus state.
15
15
  */
16
16
  export type CheckboxProps = Omit<ComponentProps<typeof KobalteCheckbox>, 'children'> & {
17
+ /** ID for the hidden native checkbox input; useful with an external label. */
18
+ inputId?: string;
17
19
  controlClass?: string;
18
20
  labelClass?: string;
19
21
  descriptionClass?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAInD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAAE,UAAU,CAAC,GAAG;IACrF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,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AAK,CAAC,eAGhF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,eAQ5F"}
@@ -1,4 +1,5 @@
1
1
  import { cn } from "../../../lib/utils.js";
2
+ import { useFormFieldControl } from "../../../lib/form-field.js";
2
3
  import { createComponent, insert, memo, mergeProps, template } from "solid-js/web";
3
4
  import { Check, Minus } from "lucide-solid";
4
5
  import { splitProps } from "solid-js";
@@ -19,10 +20,24 @@ function Checkbox$1(props) {
19
20
  "aria-labelledby",
20
21
  "aria-describedby",
21
22
  "aria-invalid",
23
+ "aria-errormessage",
22
24
  "aria-busy",
25
+ "id",
26
+ "inputId",
23
27
  "title"
24
28
  ]);
29
+ const field = useFormFieldControl("control", {
30
+ id: local.inputId ?? local.id,
31
+ "aria-label": local["aria-label"],
32
+ "aria-labelledby": local["aria-labelledby"],
33
+ "aria-describedby": local["aria-describedby"],
34
+ "aria-invalid": local["aria-invalid"],
35
+ "aria-errormessage": local["aria-errormessage"]
36
+ });
25
37
  return createComponent(Checkbox, mergeProps({
38
+ get id() {
39
+ return field ? void 0 : local.id;
40
+ },
26
41
  get title() {
27
42
  return local.title;
28
43
  },
@@ -32,17 +47,23 @@ function Checkbox$1(props) {
32
47
  }, rest, { get children() {
33
48
  return [
34
49
  createComponent(Checkbox.Input, {
50
+ get id() {
51
+ return field?.id ?? local.inputId;
52
+ },
35
53
  get ["aria-label"]() {
36
54
  return local["aria-label"];
37
55
  },
38
56
  get ["aria-labelledby"]() {
39
- return local["aria-labelledby"];
57
+ return field?.["aria-labelledby"] ?? local["aria-labelledby"];
40
58
  },
41
59
  get ["aria-describedby"]() {
42
- return local["aria-describedby"];
60
+ return field?.["aria-describedby"] ?? local["aria-describedby"];
43
61
  },
44
62
  get ["aria-invalid"]() {
45
- return local["aria-invalid"];
63
+ return field?.["aria-invalid"] ?? local["aria-invalid"];
64
+ },
65
+ get ["aria-errormessage"]() {
66
+ return field?.["aria-errormessage"] ?? local["aria-errormessage"];
46
67
  },
47
68
  get ["aria-busy"]() {
48
69
  return local["aria-busy"];
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","names":["Checkbox","KobalteCheckbox","Check","Minus","ComponentProps","JSX","splitProps","cn","CheckboxProps","Omit","controlClass","labelClass","descriptionClass","label","Element","description","children","props","local","rest","_$createComponent","_$mergeProps","title","class","Input","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-busy","Control","Indicator","_$memo","indeterminate","_el$","_tmpl$","_$insert","_c$","Label","_c$2","Description","CheckboxLabel","CheckboxDescription","Checkbox","_$createComponent","KobalteCheckbox","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"sourcesContent":["import { Checkbox as KobalteCheckbox } from '@kobalte/core/checkbox'\nimport { Check, Minus } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Checkbox.\n *\n * Three states: unchecked, checked, and indeterminate. Indeterminate is what a\n * \"select all\" box shows when only some rows are selected; Kobalte expresses\n * it through `checked=\"indeterminate\"` rather than a second boolean, so there\n * is no way to render a box that is both.\n *\n * The paint is `Control` and the value is a real hidden `Input`, so the control\n * participates in a form submission and in native validation while looking\n * nothing like a browser checkbox. Focus is tracked by the input, which is why\n * the ring lives on the control and reads the input's focus state.\n */\nexport type CheckboxProps = Omit<ComponentProps<typeof KobalteCheckbox>, 'children'> & {\n controlClass?: string\n labelClass?: string\n descriptionClass?: string\n label?: JSX.Element\n description?: JSX.Element\n /**\n * Replaces the control and label. Omit it to get the default control beside\n * `label` and `description`; supply it to compose the parts yourself.\n */\n children?: JSX.Element\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'controlClass',\n 'labelClass',\n 'descriptionClass',\n 'children',\n 'label',\n 'description',\n 'indeterminate',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-busy',\n 'title',\n ])\n\n return (\n <KobalteCheckbox\n title={local.title}\n class={cn('group/checkbox flex items-start gap-2.5', local.class)}\n {...rest}\n >\n {/*\n * The name goes on the input, which is what carries the value and takes\n * focus. On the Root it would land on a plain div and name nothing — the\n * box would announce its state with no subject.\n */}\n <KobalteCheckbox.Input\n aria-label={local['aria-label']}\n aria-labelledby={local['aria-labelledby']}\n aria-describedby={local['aria-describedby']}\n aria-invalid={local['aria-invalid']}\n aria-busy={local['aria-busy']}\n title={local.title}\n />\n <KobalteCheckbox.Control\n class={cn(\n 'border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-sm border',\n 'transition-[color,box-shadow,border-color,background-color] ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'data-[checked]:bg-primary data-[checked]:border-primary data-[checked]:text-primary-foreground',\n 'data-[indeterminate]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:text-primary-foreground',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.controlClass\n )}\n >\n <KobalteCheckbox.Indicator class=\"flex items-center justify-center\">\n {local.indeterminate ? <Minus class=\"size-3\" /> : <Check class=\"size-3\" />}\n </KobalteCheckbox.Indicator>\n </KobalteCheckbox.Control>\n {local.children ??\n (local.label || local.description ? (\n <div class=\"grid gap-0.5\">\n {local.label ? (\n <KobalteCheckbox.Label class={cn('text-sm font-medium', local.labelClass)}>\n {local.label}\n </KobalteCheckbox.Label>\n ) : null}\n {local.description ? (\n <KobalteCheckbox.Description\n class={cn('text-muted-foreground text-sm', local.descriptionClass)}\n >\n {local.description}\n </KobalteCheckbox.Description>\n ) : null}\n </div>\n ) : null)}\n </KobalteCheckbox>\n )\n}\n\n/**\n * The box's own label. Valid only inside a `<Checkbox>`, for the same reason as\n * `SwitchLabel`: outside its root there is no control to associate with.\n */\nexport function CheckboxLabel(props: ComponentProps<typeof KobalteCheckbox.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteCheckbox.Label class={cn('text-sm font-medium', local.class)} {...rest} />\n}\n\nexport function CheckboxDescription(props: ComponentProps<typeof KobalteCheckbox.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteCheckbox.Description\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AAgCA,SAAgBA,WAASiB,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQb,WAAWW,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,OAAAG,gBACGnB,UAAeoB,WAAA;EAAA,IACdC,QAAK;GAAA,OAAEJ,MAAMI;EAAK;EAAA,KAAA,WAAA;GAAA,OACXf,GAAG,2CAA2CW,MAAMK,KAAK;EAAC;CAAA,GAC7DJ,MAAI,EAAA,IAAAH,WAAA;EAAA,OAAA;GAAAI,gBAOPnB,SAAgBuB,OAAK;IAAA,KAAA,gBAAA;KAAA,OACRN,MAAM;IAAa;IAAA,KAAA,qBAAA;KAAA,OACdA,MAAM;IAAkB;IAAA,KAAA,sBAAA;KAAA,OACvBA,MAAM;IAAmB;IAAA,KAAA,kBAAA;KAAA,OAC7BA,MAAM;IAAe;IAAA,KAAA,eAAA;KAAA,OACxBA,MAAM;IAAY;IAAA,IAC7BI,QAAK;KAAA,OAAEJ,MAAMI;IAAK;GAAA,CAAA;GAAAF,gBAEnBnB,SAAgB6B,SAAO;IAAA,KAAA,WAAA;KAAA,OACfvB,GACL,kGACA,qFACA,oFACA,kGACA,oHACA,kGACA,iEACAW,MAAMR,YACR;IAAC;IAAA,IAAAM,WAAA;KAAA,OAAAI,gBAEAnB,SAAgB8B,WAAS;MAAA,SAAA;MAAA,IAAAf,WAAA;OAAA,OACvBgB,WAAA,CAAA,CAAAd,MAAMe,aAAa,CAA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;CACjD,OAAAG,gBACGnB,SAAgBuC,aAAWnB,WAAA,EAAA,KAAA,WAAA;EAAA,OACnBd,GAAG,iCAAiCW,MAAMK,KAAK;CAAC,EAAA,GACnDJ,IAAI,CAAA;AAGd"}
1
+ {"version":3,"file":"checkbox.js","names":["Checkbox","KobalteCheckbox","Check","Minus","ComponentProps","JSX","splitProps","useFormFieldControl","cn","CheckboxProps","Omit","inputId","controlClass","labelClass","descriptionClass","label","Element","description","children","props","local","rest","field","id","_$createComponent","_$mergeProps","undefined","title","class","Input","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-errormessage","aria-busy","Control","Indicator","_$memo","indeterminate","_el$","_tmpl$","_$insert","_c$","Label","_c$2","Description","CheckboxLabel","CheckboxDescription","Checkbox","_$createComponent","KobalteCheckbox","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"sourcesContent":["import { Checkbox as KobalteCheckbox } from '@kobalte/core/checkbox'\nimport { Check, Minus } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\n/**\n * Checkbox.\n *\n * Three states: unchecked, checked, and indeterminate. Indeterminate is what a\n * \"select all\" box shows when only some rows are selected; Kobalte expresses\n * it through `checked=\"indeterminate\"` rather than a second boolean, so there\n * is no way to render a box that is both.\n *\n * The paint is `Control` and the value is a real hidden `Input`, so the control\n * participates in a form submission and in native validation while looking\n * nothing like a browser checkbox. Focus is tracked by the input, which is why\n * the ring lives on the control and reads the input's focus state.\n */\nexport type CheckboxProps = Omit<ComponentProps<typeof KobalteCheckbox>, 'children'> & {\n /** ID for the hidden native checkbox input; useful with an external label. */\n inputId?: string\n controlClass?: string\n labelClass?: string\n descriptionClass?: string\n label?: JSX.Element\n description?: JSX.Element\n /**\n * Replaces the control and label. Omit it to get the default control beside\n * `label` and `description`; supply it to compose the parts yourself.\n */\n children?: JSX.Element\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'controlClass',\n 'labelClass',\n 'descriptionClass',\n 'children',\n 'label',\n 'description',\n 'indeterminate',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n 'aria-busy',\n 'id',\n 'inputId',\n 'title',\n ])\n const field = useFormFieldControl('control', {\n id: local.inputId ?? local.id,\n 'aria-label': local['aria-label'],\n 'aria-labelledby': local['aria-labelledby'],\n 'aria-describedby': local['aria-describedby'],\n 'aria-invalid': local['aria-invalid'],\n 'aria-errormessage': local['aria-errormessage'],\n })\n\n return (\n <KobalteCheckbox\n id={field ? undefined : local.id}\n title={local.title}\n class={cn('group/checkbox flex items-start gap-2.5', local.class)}\n {...rest}\n >\n {/*\n * The name goes on the input, which is what carries the value and takes\n * focus. On the Root it would land on a plain div and name nothing — the\n * box would announce its state with no subject.\n */}\n <KobalteCheckbox.Input\n id={field?.id ?? local.inputId}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n aria-busy={local['aria-busy']}\n title={local.title}\n />\n <KobalteCheckbox.Control\n class={cn(\n 'border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-sm border',\n 'transition-[color,box-shadow,border-color,background-color] ease-out outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'data-[checked]:bg-primary data-[checked]:border-primary data-[checked]:text-primary-foreground',\n 'data-[indeterminate]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:text-primary-foreground',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.controlClass\n )}\n >\n <KobalteCheckbox.Indicator class=\"flex items-center justify-center\">\n {local.indeterminate ? <Minus class=\"size-3\" /> : <Check class=\"size-3\" />}\n </KobalteCheckbox.Indicator>\n </KobalteCheckbox.Control>\n {local.children ??\n (local.label || local.description ? (\n <div class=\"grid gap-0.5\">\n {local.label ? (\n <KobalteCheckbox.Label class={cn('text-sm font-medium', local.labelClass)}>\n {local.label}\n </KobalteCheckbox.Label>\n ) : null}\n {local.description ? (\n <KobalteCheckbox.Description\n class={cn('text-muted-foreground text-sm', local.descriptionClass)}\n >\n {local.description}\n </KobalteCheckbox.Description>\n ) : null}\n </div>\n ) : null)}\n </KobalteCheckbox>\n )\n}\n\n/**\n * The box's own label. Valid only inside a `<Checkbox>`, for the same reason as\n * `SwitchLabel`: outside its root there is no control to associate with.\n */\nexport function CheckboxLabel(props: ComponentProps<typeof KobalteCheckbox.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteCheckbox.Label class={cn('text-sm font-medium', local.class)} {...rest} />\n}\n\nexport function CheckboxDescription(props: ComponentProps<typeof KobalteCheckbox.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteCheckbox.Description\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;AAmCA,SAAgBA,WAASmB,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQf,WAAWa,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CACD,MAAMG,QAAQf,oBAAoB,WAAW;EAC3CgB,IAAIH,MAAMT,WAAWS,MAAMG;EAC3B,cAAcH,MAAM;EACpB,mBAAmBA,MAAM;EACzB,oBAAoBA,MAAM;EAC1B,gBAAgBA,MAAM;EACtB,qBAAqBA,MAAM;CAC7B,CAAC;CAED,OAAAI,gBACGvB,UAAewB,WAAA;EAAA,IACdF,KAAE;GAAA,OAAED,Q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C/C,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kCAGhE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,kCAgBpF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,kCAmChF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,kCAoBpF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,kCAsBpF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,kCAW9E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,kCAGpF;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,kCAkB3E"}
@@ -1,5 +1,6 @@
1
1
  import { cn } from "../../../lib/utils.js";
2
2
  import { menuItem, popoverArrow } from "../../../lib/overlay.js";
3
+ import { useFormFieldControl } from "../../../lib/form-field.js";
3
4
  import { className, createComponent, delegateEvents, effect, insert, memo, mergeProps, template } from "solid-js/web";
4
5
  import { Check, ChevronDown, X } from "lucide-solid";
5
6
  import { Show, splitProps } from "solid-js";
@@ -29,10 +30,46 @@ function ComboboxControl(props) {
29
30
  } }, rest));
30
31
  }
31
32
  function ComboboxInput(props) {
32
- const [local, rest] = splitProps(props, ["class"]);
33
- return createComponent(Combobox.Input, mergeProps({ get ["class"]() {
34
- return cn("h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground", "disabled:cursor-not-allowed", local.class);
35
- } }, rest));
33
+ const [local, rest] = splitProps(props, [
34
+ "class",
35
+ "id",
36
+ "aria-label",
37
+ "aria-labelledby",
38
+ "aria-describedby",
39
+ "aria-invalid",
40
+ "aria-errormessage"
41
+ ]);
42
+ const field = useFormFieldControl("control", {
43
+ id: local.id,
44
+ "aria-label": local["aria-label"],
45
+ "aria-labelledby": local["aria-labelledby"],
46
+ "aria-describedby": local["aria-describedby"],
47
+ "aria-invalid": local["aria-invalid"],
48
+ "aria-errormessage": local["aria-errormessage"]
49
+ });
50
+ return createComponent(Combobox.Input, mergeProps({
51
+ get id() {
52
+ return field?.id ?? local.id;
53
+ },
54
+ get ["aria-label"]() {
55
+ return local["aria-label"];
56
+ },
57
+ get ["aria-labelledby"]() {
58
+ return field?.["aria-labelledby"] ?? local["aria-labelledby"];
59
+ },
60
+ get ["aria-describedby"]() {
61
+ return field?.["aria-describedby"] ?? local["aria-describedby"];
62
+ },
63
+ get ["aria-invalid"]() {
64
+ return field?.["aria-invalid"] ?? local["aria-invalid"];
65
+ },
66
+ get ["aria-errormessage"]() {
67
+ return field?.["aria-errormessage"] ?? local["aria-errormessage"];
68
+ },
69
+ get ["class"]() {
70
+ return cn("h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground", "disabled:cursor-not-allowed", local.class);
71
+ }
72
+ }, rest));
36
73
  }
37
74
  function ComboboxTrigger(props) {
38
75
  const [local, rest] = splitProps(props, ["class", "children"]);
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.js","names":["Combobox","KobalteCombobox","Check","ChevronDown","X","ComponentProps","Show","splitProps","menuContentPadding","menuItem","popoverArrow","cn","props","Option","OptGroup","_$createComponent","ComboboxControl","Control","local","rest","_$mergeProps","class","ComboboxInput","Input","ComboboxTrigger","Trigger","children","_$memo","Icon","ComboboxContent","Content","Portal","Listbox","Arrow","ComboboxItem","Item","ItemLabel","ItemIndicator","ComboboxSection","Section","ComboboxClear","onClear","when","_el$","_tmpl$","$$click","_$insert","_$effect","_$className","_$delegateEvents","Combobox","_$createComponent","KobalteCombobox","_$mergeProps","_$memo","_$className","_$delegateEvents"],"sources":["../../../../src/components/ui/combobox/combobox.tsx"],"sourcesContent":["import { Combobox as KobalteCombobox } from '@kobalte/core/combobox'\nimport { Check, ChevronDown, X } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { menuContentPadding, menuItem, popoverArrow } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * Combobox.\n *\n * A Select whose list is filterable by typing. The difference from Select is\n * not cosmetic: a Combobox has a text input, so the user can narrow forty\n * options to one without reading the list. Above roughly ten options the\n * search is the feature; below it, a Select is quieter and a RadioGroup is\n * better still.\n *\n * Kobalte supplies the filtering, the `aria-activedescendant` wiring, the\n * keyboard selection and the multiple-selection mode, which is the part a\n * hand-rolled version reliably gets wrong.\n */\nexport function Combobox<Option, OptGroup = never>(\n props: ComponentProps<typeof KobalteCombobox<Option, OptGroup>>\n) {\n return <KobalteCombobox {...props} />\n}\n\nexport function ComboboxControl(props: ComponentProps<typeof KobalteCombobox.Control>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteCombobox.Control\n class={cn(\n 'border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function ComboboxInput(props: ComponentProps<typeof KobalteCombobox.Input>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteCombobox.Input\n class={cn(\n 'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function ComboboxTrigger(props: ComponentProps<typeof KobalteCombobox.Trigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Trigger\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none',\n 'transition-colors ease-out hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <KobalteCombobox.Icon>\n <ChevronDown class=\"size-4\" />\n </KobalteCombobox.Icon>\n </KobalteCombobox.Trigger>\n )\n}\n\nexport function ComboboxContent(props: ComponentProps<typeof KobalteCombobox.Content>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Portal>\n <KobalteCombobox.Content\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-72 min-w-(--kb-popper-anchor-width) origin-(--kb-combobox-content-transform-origin) overflow-hidden',\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 'data-expanded:duration-150 data-closed:duration-100',\n local.class\n )}\n {...rest}\n >\n <KobalteCombobox.Listbox class={cn('max-h-72 overflow-y-auto', menuContentPadding)} />\n {local.children}\n <KobalteCombobox.Arrow aria-hidden=\"true\" class={popoverArrow} />\n </KobalteCombobox.Content>\n </KobalteCombobox.Portal>\n )\n}\n\nexport function ComboboxItem(props: ComponentProps<typeof KobalteCombobox.Item>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Item class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <KobalteCombobox.ItemLabel>{local.children}</KobalteCombobox.ItemLabel>\n <KobalteCombobox.ItemIndicator class=\"absolute end-2 flex size-4 items-center justify-center\">\n <Check class=\"size-4\" />\n </KobalteCombobox.ItemIndicator>\n </KobalteCombobox.Item>\n )\n}\n\nexport function ComboboxSection(props: ComponentProps<typeof KobalteCombobox.Section>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteCombobox.Section class={cn('flex flex-col', local.class)} {...rest} />\n}\n\n/** The clear affordance for a single-select Combobox with a value. */\nexport function ComboboxClear(props: { class?: string; onClear: () => void }) {\n return (\n <Show when={props.onClear}>\n <button\n type=\"button\"\n aria-label=\"Clear selection\"\n onClick={() => props.onClear()}\n class={cn(\n 'text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n props.class\n )}\n >\n <X class=\"size-3.5\" />\n </button>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,SAAgBA,WACdY,OACA;CACA,OAAAG,gBAAQd,UAAoBW,KAAK;AACnC;AAEA,SAAgBI,gBAAgBJ,OAAuD;CACrF,MAAM,CAACM,OAAOC,QAAQZ,WAAWK,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAG,gBACGd,SAAgBgB,SAAOG,WAAA,EAAA,KAAA,WAAA;EAAA,OACfT,GACL,6GACA,uDACA,iFACA,kGACA,iEACAO,MAAMG,KACR;CAAC,EAAA,GACGF,IAAI,CAAA;AAGd;AAEA,SAAgBG,cAAcV,OAAqD;CACjF,MAAM,CAACM,OAAOC,QAAQZ,WAAWK,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAG,gBACGd,SAAgBsB,OAAKH,WAAA,EAAA,KAAA,WAAA;EAAA,OACbT,GACL,uFACA,+BACAO,MAAMG,KACR;CAAC,EAAA,GACGF,IAAI,CAAA;AAGd;AAEA,SAAgBK,gBAAgBZ,OAAuD;CACrF,MAAM,CAACM,OAAOC,QAAQZ,WAAWK,OAAO,CAAC,SAAS,UAAU,CAAC;CAE7D,OAAAG,gBACGd,SAAgBwB,SAAOL,WAAA,EAAA,KAAA,WAAA;EAAA,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Q,EAAA,CAAA,GAAAX,gBACzCd,SAAgBoC,eAAa;GAAA,SAAA;GAAA,IAAAX,WAAA;IAAA,OAAAX,gBAC3Bb,OAAK,EAAA,SAAA,SAAA,CAAA;GAAA;EAAA,CAAA,CAAA;CAAA,EAAA,CAAA,CAAA;AAId;AAEA,SAAgBoC,gBAAgB1B,OAAuD;CACrF,MAAM,CAACM,OAAOC,QAAQZ,WAAWK,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQd,SAAgBsC,SAAOnB,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQT,GAAG,iBAAiBO,MAAMG,KAAK;CAAC,EAAA,GAAMF,IAAI,CAAA;AACnF;;AAGA,SAAgBqB,cAAc5B,OAAgD;CAC5E,OAAAG,gBACGT,MAAI;EAAA,IAACoC,OAAI;GAAA,OAAE9B,MAAM6B;EAAO;EAAA,IAAAf,WAAA;GAAA,IAAAiB,OAAAC,OAAA;GAAAD,KAAAE,gBAINjC,MAAM6B,QAAQ;GAACK,OAAAH,MAAA5B,gBAQ7BX,GAAC,EAAA,SAAA,WAAA,CAAA,CAAA;GAAA2C,aAAAC,UAAAL,MAPKhC,GACL,qFACA,iEACA,oFACAC,MAAMS,KACR,CAAC,CAAA;GAAA,OAAAsB;EAAA;CAAA,CAAA;AAMT;AAACM,eAAA,CAAA,OAAA,CAAA"}
1
+ {"version":3,"file":"combobox.js","names":["Combobox","KobalteCombobox","Check","ChevronDown","X","ComponentProps","Show","splitProps","menuContentPadding","menuItem","popoverArrow","useFormFieldControl","cn","props","Option","OptGroup","_$createComponent","ComboboxControl","Control","local","rest","_$mergeProps","class","ComboboxInput","Input","field","id","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-errormessage","ComboboxTrigger","Trigger","children","_$memo","Icon","ComboboxContent","Content","Portal","Listbox","Arrow","ComboboxItem","Item","ItemLabel","ItemIndicator","ComboboxSection","Section","ComboboxClear","onClear","when","_el$","_tmpl$","$$click","_$insert","_$effect","_$className","_$delegateEvents","Combobox","_$createComponent","KobalteCombobox","_$mergeProps","_$memo","_$className","_$delegateEvents"],"sources":["../../../../src/components/ui/combobox/combobox.tsx"],"sourcesContent":["import { Combobox as KobalteCombobox } from '@kobalte/core/combobox'\nimport { Check, ChevronDown, X } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { menuContentPadding, menuItem, popoverArrow } from '#lib/overlay'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\n/**\n * Combobox.\n *\n * A Select whose list is filterable by typing. The difference from Select is\n * not cosmetic: a Combobox has a text input, so the user can narrow forty\n * options to one without reading the list. Above roughly ten options the\n * search is the feature; below it, a Select is quieter and a RadioGroup is\n * better still.\n *\n * Kobalte supplies the filtering, the `aria-activedescendant` wiring, the\n * keyboard selection and the multiple-selection mode, which is the part a\n * hand-rolled version reliably gets wrong.\n */\nexport function Combobox<Option, OptGroup = never>(\n props: ComponentProps<typeof KobalteCombobox<Option, OptGroup>>\n) {\n return <KobalteCombobox {...props} />\n}\n\nexport function ComboboxControl(props: ComponentProps<typeof KobalteCombobox.Control>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteCombobox.Control\n class={cn(\n 'border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function ComboboxInput(props: ComponentProps<typeof KobalteCombobox.Input>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', {\n id: local.id,\n 'aria-label': local['aria-label'],\n 'aria-labelledby': local['aria-labelledby'],\n 'aria-describedby': local['aria-describedby'],\n 'aria-invalid': local['aria-invalid'],\n 'aria-errormessage': local['aria-errormessage'],\n })\n\n return (\n <KobalteCombobox.Input\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n class={cn(\n 'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function ComboboxTrigger(props: ComponentProps<typeof KobalteCombobox.Trigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Trigger\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none',\n 'transition-colors ease-out hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <KobalteCombobox.Icon>\n <ChevronDown class=\"size-4\" />\n </KobalteCombobox.Icon>\n </KobalteCombobox.Trigger>\n )\n}\n\nexport function ComboboxContent(props: ComponentProps<typeof KobalteCombobox.Content>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Portal>\n <KobalteCombobox.Content\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-72 min-w-(--kb-popper-anchor-width) origin-(--kb-combobox-content-transform-origin) overflow-hidden',\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 'data-expanded:duration-150 data-closed:duration-100',\n local.class\n )}\n {...rest}\n >\n <KobalteCombobox.Listbox class={cn('max-h-72 overflow-y-auto', menuContentPadding)} />\n {local.children}\n <KobalteCombobox.Arrow aria-hidden=\"true\" class={popoverArrow} />\n </KobalteCombobox.Content>\n </KobalteCombobox.Portal>\n )\n}\n\nexport function ComboboxItem(props: ComponentProps<typeof KobalteCombobox.Item>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Item class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <KobalteCombobox.ItemLabel>{local.children}</KobalteCombobox.ItemLabel>\n <KobalteCombobox.ItemIndicator class=\"absolute end-2 flex size-4 items-center justify-center\">\n <Check class=\"size-4\" />\n </KobalteCombobox.ItemIndicator>\n </KobalteCombobox.Item>\n )\n}\n\nexport function ComboboxSection(props: ComponentProps<typeof KobalteCombobox.Section>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteCombobox.Section class={cn('flex flex-col', local.class)} {...rest} />\n}\n\n/** The clear affordance for a single-select Combobox with a value. */\nexport function ComboboxClear(props: { class?: string; onClear: () => void }) {\n return (\n <Show when={props.onClear}>\n <button\n type=\"button\"\n aria-label=\"Clear selection\"\n onClick={() => props.onClear()}\n class={cn(\n 'text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n props.class\n )}\n >\n <X class=\"size-3.5\" />\n </button>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgBA,WACda,OACA;CACA,OAAAG,gBAAQf,UAAoBY,KAAK;AACnC;AAEA,SAAgBI,gBAAgBJ,OAAuD;CACrF,MAAM,CAACM,OAAOC,QAAQb,WAAWM,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAG,gBACGf,SAAgBiB,SAAOG,WAAA,EAAA,KAAA,WAAA;EAAA,OACfT,GACL,6GACA,uDACA,iFAC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gB4C,gBAAgBjC,OAAuD;CACrF,MAAM,CAACM,OAAOC,QAAQb,WAAWM,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQf,SAAgB8C,SAAO1B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQT,GAAG,iBAAiBO,MAAMG,KAAK;CAAC,EAAA,GAAMF,IAAI,CAAA;AACnF;;AAGA,SAAgB4B,cAAcnC,OAAgD;CAC5E,OAAAG,gBACGV,MAAI;EAAA,IAAC4C,OAAI;GAAA,OAAErC,MAAMoC;EAAO;EAAA,IAAAf,WAAA;GAAA,IAAAiB,OAAAC,OAAA;GAAAD,KAAAE,gBAINxC,MAAMoC,QAAQ;GAACK,OAAAH,MAAAnC,gBAQ7BZ,GAAC,EAAA,SAAA,WAAA,CAAA,CAAA;GAAAmD,aAAAC,UAAAL,MAPKvC,GACL,qFACA,iEACA,oFACAC,MAAMS,KACR,CAAC,CAAA;GAAA,OAAA6B;EAAA;CAAA,CAAA;AAMT;AAACM,eAAA,CAAA,OAAA,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export { Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger, } from './combobox';
2
+ export { ValueCombobox, type ValueComboboxProps } from './value-combobox';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/combobox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/combobox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1,2 +1,3 @@
1
1
  import { Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger } from "./combobox.js";
2
- export { Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger };
2
+ import { ValueCombobox } from "./value-combobox.js";
3
+ export { Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger, ValueCombobox };
@@ -0,0 +1,19 @@
1
+ import { type ComponentProps, type JSX } from 'solid-js';
2
+ import { ComboboxInput } from './combobox';
3
+ export type ValueComboboxChoice = {
4
+ value: string;
5
+ label: string | number;
6
+ textValue?: string;
7
+ } | {
8
+ value: string;
9
+ label: JSX.Element;
10
+ textValue: string;
11
+ };
12
+ export type ValueComboboxProps = Omit<ComponentProps<typeof ComboboxInput>, 'value'> & {
13
+ value: string;
14
+ choices: ValueComboboxChoice[];
15
+ onValueChange: (value: string) => void;
16
+ };
17
+ /** A single-choice combobox for a controlled string value and labelled choices. */
18
+ export declare function ValueCombobox(props: ValueComboboxProps): JSX.Element;
19
+ //# sourceMappingURL=value-combobox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-combobox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/combobox/value-combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AACpE,OAAO,EAA6B,aAAa,EAAgB,MAAM,YAAY,CAAA;AAEnF,MAAM,MAAM,mBAAmB,GAC3B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAE5D,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAAE,OAAO,CAAC,GAAG;IACrF,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,mBAAmB,EAAE,CAAA;IAC9B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC,CAAA;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAmBtD"}
@@ -0,0 +1,42 @@
1
+ import { Combobox, ComboboxContent, ComboboxInput, ComboboxItem } from "./combobox.js";
2
+ import { createComponent } from "solid-js/web";
3
+ import { splitProps } from "solid-js";
4
+ //#region src/components/ui/combobox/value-combobox.tsx
5
+ /** A single-choice combobox for a controlled string value and labelled choices. */
6
+ function ValueCombobox(props) {
7
+ const [local, rest] = splitProps(props, [
8
+ "value",
9
+ "choices",
10
+ "onValueChange"
11
+ ]);
12
+ return createComponent(Combobox, {
13
+ get options() {
14
+ return local.choices;
15
+ },
16
+ optionValue: "value",
17
+ optionTextValue: (choice) => choice.textValue ?? textFromLabel(choice.label),
18
+ optionLabel: (choice) => choice.textValue ?? textFromLabel(choice.label),
19
+ get value() {
20
+ return local.choices.find((choice) => String(choice.value) === local.value) ?? null;
21
+ },
22
+ onChange: (option) => option && local.onValueChange(String(option.value)),
23
+ itemComponent: (itemProps) => createComponent(ComboboxItem, {
24
+ get item() {
25
+ return itemProps.item;
26
+ },
27
+ get children() {
28
+ return itemProps.item.rawValue.label;
29
+ }
30
+ }),
31
+ get children() {
32
+ return [createComponent(ComboboxInput, rest), createComponent(ComboboxContent, {})];
33
+ }
34
+ });
35
+ }
36
+ function textFromLabel(label) {
37
+ return typeof label === "string" || typeof label === "number" ? String(label) : "";
38
+ }
39
+ //#endregion
40
+ export { ValueCombobox };
41
+
42
+ //# sourceMappingURL=value-combobox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-combobox.js","names":["splitProps","ComponentProps","JSX","Combobox","ComboboxContent","ComboboxInput","ComboboxItem","ValueComboboxChoice","value","label","textValue","Element","ValueComboboxProps","Omit","choices","onValueChange","ValueCombobox","props","local","rest","_$createComponent","options","optionValue","optionTextValue","choice","textFromLabel","optionLabel","find","String","onChange","option","itemComponent","itemProps","item","children","rawValue","_$createComponent"],"sources":["../../../../src/components/ui/combobox/value-combobox.tsx"],"sourcesContent":["import { splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { Combobox, ComboboxContent, ComboboxInput, ComboboxItem } from './combobox'\n\nexport type ValueComboboxChoice =\n | { value: string; label: string | number; textValue?: string }\n | { value: string; label: JSX.Element; textValue: string }\n\nexport type ValueComboboxProps = Omit<ComponentProps<typeof ComboboxInput>, 'value'> & {\n value: string\n choices: ValueComboboxChoice[]\n onValueChange: (value: string) => void\n}\n\n/** A single-choice combobox for a controlled string value and labelled choices. */\nexport function ValueCombobox(props: ValueComboboxProps) {\n const [local, rest] = splitProps(props, ['value', 'choices', 'onValueChange'])\n\n return (\n <Combobox\n options={local.choices}\n optionValue=\"value\"\n optionTextValue={(choice) => choice.textValue ?? textFromLabel(choice.label)}\n optionLabel={(choice) => choice.textValue ?? textFromLabel(choice.label)}\n value={local.choices.find((choice) => String(choice.value) === local.value) ?? null}\n onChange={(option) => option && local.onValueChange(String(option.value))}\n itemComponent={(itemProps) => (\n <ComboboxItem item={itemProps.item}>{itemProps.item.rawValue.label}</ComboboxItem>\n )}\n >\n <ComboboxInput {...rest} />\n <ComboboxContent />\n </Combobox>\n )\n}\n\nfunction textFromLabel(label: JSX.Element) {\n return typeof label === 'string' || typeof label === 'number' ? String(label) : ''\n}\n"],"mappings":";;;;;AAcA,SAAgBgB,cAAcC,OAA2B;CACvD,MAAM,CAACC,OAAOC,QAAQnB,WAAWiB,OAAO;EAAC;EAAS;EAAW;CAAe,CAAC;CAE7E,OAAAG,gBACGjB,UAAQ;EAAA,IACPkB,UAAO;GAAA,OAAEH,MAAMJ;EAAO;EACtBQ,aAAW;EACXC,kBAAkBC,WAAWA,OAAOd,aAAae,cAAcD,OAAOf,KAAK;EAC3EiB,cAAcF,WAAWA,OAAOd,aAAae,cAAcD,OAAOf,KAAK;EAAC,IACxED,QAAK;GAAA,OAAEU,MAAMJ,QAAQa,MAAMH,WAAWI,OAAOJ,OAAOhB,KAAK,MAAMU,MAAMV,KAAK,KAAK;EAAI;EACnFqB,WAAWC,WAAWA,UAAUZ,MAAMH,cAAca,OAAOE,OAAOtB,KAAK,CAAC;EACxEuB,gBAAgBC,cAASZ,gBACtBd,cAAY;GAAA,IAAC2B,OAAI;IAAA,OAAED,UAAUC;GAAI;GAAA,IAAAC,WAAA;IAAA,OAAGF,UAAUC,KAAKE,SAAS1B;GAAK;EAAA,CAAA;EACnE,IAAAyB,WAAA;GAAA,OAAA,CAAAd,gBAEAf,eAAkBc,IAAI,GAAAC,gBACtBhB,iBAAe,CAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAGtB;AAEA,SAASqB,cAAchB,OAAoB;CACzC,OAAO,OAAOA,UAAU,YAAY,OAAOA,UAAU,WAAWmB,OAAOnB,KAAK,IAAI;AAClF"}
@@ -0,0 +1,15 @@
1
+ import type { ComponentProps, JSX } from 'solid-js';
2
+ export type EmptyStateProps = Omit<ComponentProps<'div'>, 'children' | 'role' | 'aria-live'> & {
3
+ title: string;
4
+ detail: string;
5
+ busy?: boolean;
6
+ icon?: JSX.Element;
7
+ announceAs?: 'alert' | 'status';
8
+ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
9
+ action?: () => void;
10
+ actionLabel?: string;
11
+ actionTooltip?: string;
12
+ };
13
+ /** A semantic empty, loading, or error state built from the shared empty parts. */
14
+ export declare function EmptyState(props: EmptyStateProps): JSX.Element;
15
+ //# sourceMappingURL=empty-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/empty/empty-state.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAMnD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC,GAAG;IAC7F,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC/B,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAkDhD"}
@@ -0,0 +1,96 @@
1
+ import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./empty.js";
2
+ import { Spinner } from "../spinner/spinner.js";
3
+ import { ActionButton } from "../../composites/action-button/action-button.js";
4
+ import { createComponent, memo, mergeProps } from "solid-js/web";
5
+ import { Search } from "lucide-solid";
6
+ import { Show, splitProps } from "solid-js";
7
+ //#region src/components/ui/empty/empty-state.tsx
8
+ /** A semantic empty, loading, or error state built from the shared empty parts. */
9
+ function EmptyState(props) {
10
+ const [local, rest] = splitProps(props, [
11
+ "title",
12
+ "detail",
13
+ "busy",
14
+ "icon",
15
+ "announceAs",
16
+ "headingLevel",
17
+ "action",
18
+ "actionLabel",
19
+ "actionTooltip",
20
+ "class"
21
+ ]);
22
+ return createComponent(Empty, mergeProps(rest, {
23
+ get ["class"]() {
24
+ return local.class;
25
+ },
26
+ get role() {
27
+ return local.announceAs;
28
+ },
29
+ get ["aria-live"]() {
30
+ return local.announceAs === "status" ? "polite" : void 0;
31
+ },
32
+ get ["aria-busy"]() {
33
+ return local.busy || void 0;
34
+ },
35
+ get children() {
36
+ return [createComponent(EmptyHeader, { get children() {
37
+ return [
38
+ createComponent(Show, {
39
+ get when() {
40
+ return local.busy || local.icon;
41
+ },
42
+ get children() {
43
+ return createComponent(EmptyMedia, {
44
+ variant: "icon",
45
+ get children() {
46
+ return memo(() => !!local.busy)() ? createComponent(Spinner, {
47
+ label: false,
48
+ "aria-hidden": "true"
49
+ }) : local.icon ?? createComponent(Search, { "aria-hidden": "true" });
50
+ }
51
+ });
52
+ }
53
+ }),
54
+ createComponent(EmptyTitle, {
55
+ role: "heading",
56
+ get ["aria-level"]() {
57
+ return local.headingLevel ?? 1;
58
+ },
59
+ get children() {
60
+ return local.title;
61
+ }
62
+ }),
63
+ createComponent(EmptyDescription, { get children() {
64
+ return local.detail;
65
+ } })
66
+ ];
67
+ } }), createComponent(Show, {
68
+ get when() {
69
+ return local.action;
70
+ },
71
+ get children() {
72
+ return createComponent(EmptyContent, { get children() {
73
+ return createComponent(ActionButton, {
74
+ get tooltip() {
75
+ return local.actionTooltip ?? local.actionLabel ?? "Try again";
76
+ },
77
+ get ["aria-label"]() {
78
+ return local.actionLabel ?? "Try again";
79
+ },
80
+ get onClick() {
81
+ return local.action;
82
+ },
83
+ get children() {
84
+ return local.actionLabel ?? "Try again";
85
+ }
86
+ });
87
+ } });
88
+ }
89
+ })];
90
+ }
91
+ }));
92
+ }
93
+ //#endregion
94
+ export { EmptyState };
95
+
96
+ //# sourceMappingURL=empty-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-state.js","names":["Search","ComponentProps","JSX","Show","splitProps","ActionButton","Spinner","Empty","EmptyContent","EmptyDescription","EmptyHeader","EmptyMedia","EmptyTitle","EmptyStateProps","Omit","title","detail","busy","icon","Element","announceAs","headingLevel","action","actionLabel","actionTooltip","EmptyState","props","local","rest","_$createComponent","_$mergeProps","class","role","aria-live","undefined","aria-busy","children","when","variant","_$memo","label","aria-level","tooltip","aria-label","onClick","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/empty/empty-state.tsx"],"sourcesContent":["import { Search } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { ActionButton } from '../../composites/action-button'\nimport { Spinner } from '../spinner'\nimport { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from './empty'\n\nexport type EmptyStateProps = Omit<ComponentProps<'div'>, 'children' | 'role' | 'aria-live'> & {\n title: string\n detail: string\n busy?: boolean\n icon?: JSX.Element\n announceAs?: 'alert' | 'status'\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6\n action?: () => void\n actionLabel?: string\n actionTooltip?: string\n}\n\n/** A semantic empty, loading, or error state built from the shared empty parts. */\nexport function EmptyState(props: EmptyStateProps) {\n const [local, rest] = splitProps(props, [\n 'title',\n 'detail',\n 'busy',\n 'icon',\n 'announceAs',\n 'headingLevel',\n 'action',\n 'actionLabel',\n 'actionTooltip',\n 'class',\n ])\n\n return (\n <Empty\n {...rest}\n class={local.class}\n role={local.announceAs}\n aria-live={local.announceAs === 'status' ? 'polite' : undefined}\n aria-busy={local.busy || undefined}\n >\n <EmptyHeader>\n <Show when={local.busy || local.icon}>\n <EmptyMedia variant=\"icon\">\n {local.busy ? (\n <Spinner label={false} aria-hidden=\"true\" />\n ) : (\n (local.icon ?? <Search aria-hidden=\"true\" />)\n )}\n </EmptyMedia>\n </Show>\n <EmptyTitle role=\"heading\" aria-level={local.headingLevel ?? 1}>\n {local.title}\n </EmptyTitle>\n <EmptyDescription>{local.detail}</EmptyDescription>\n </EmptyHeader>\n <Show when={local.action}>\n <EmptyContent>\n <ActionButton\n tooltip={local.actionTooltip ?? local.actionLabel ?? 'Try again'}\n aria-label={local.actionLabel ?? 'Try again'}\n onClick={local.action}\n >\n {local.actionLabel ?? 'Try again'}\n </ActionButton>\n </EmptyContent>\n </Show>\n </Empty>\n )\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgByB,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQxB,WAAWsB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,OAAAG,gBACGtB,OAAKuB,WACAF,MAAI;EAAA,KAAA,WAAA;GAAA,OACDD,MAAMI;EAAK;EAAA,IAClBC,OAAI;GAAA,OAAEL,MAAMP;EAAU;EAAA,KAAA,eAAA;GAAA,OACXO,MAAMP,eAAe,WAAW,WAAWc,KAAAA;EAAS;EAAA,KAAA,eAAA;GAAA,OACpDP,MAAMV,QAAQiB,KAAAA;EAAS;EAAA,IAAAE,WAAA;GAAA,OAAA,CAAAP,gBAEjCnB,aAAW,EAAA,IAAA0B,WAAA;IAAA,OAAA;KAAAP,gBACT1B,MAAI;MAAA,IAACkC,OAAI;OAAA,OAAEV,MAAMV,QAAQU,MAAMT;MAAI;MAAA,IAAAkB,WAAA;OAAA,OAAAP,gBACjClB,YAAU;QAAC2B,SAAO;QAAA,IAAAF,WAAA;SAAA,OAChBG,WAAA,CAAA,CAAAZ,MAAMV,IAAI,CAAA,CAAA,IAAAY,gBACRvB,SAAO;UAACkC,OAAO;UAAK,eAAA;SAAA,CAAA,IAEpBb,MAAMT,QAAIW,gBAAK7B,QAAM,EAAA,eAAA,OAAA,CAAA;QACvB;OAAA,CAAA;MAAA;KAAA,CAAA;KAAA6B,gBAGJjB,YAAU;MAACoB,MAAI;MAAA,KAAA,gBAAA;OAAA,OAAuBL,MAAMN,gBAAgB;MAAC;MAAA,IAAAe,WAAA;OAAA,OAC3DT,MAAMZ;MAAK;KAAA,CAAA;KAAAc,gBAEbpB,kBAAgB,EAAA,IAAA2B,WAAA;MAAA,OAAET,MAAMX;KAAM,EAAA,CAAA;IAAA;GAAA,EAAA,CAAA,GAAAa,gBAEhC1B,MAAI;IAAA,IAACkC,OAAI;KAAA,OAAEV,MAAML;IAAM;IAAA,IAAAc,WAAA;KAAA,OAAAP,gBACrBrB,cAAY,EAAA,IAAA4B,WAAA;MAAA,OAAAP,gBACVxB,cAAY;OAAA,IACXqC,UAAO;QAAA,OAAEf,MAAMH,iBAAiBG,MAAMJ,eAAe;OAAW;OAAA,KAAA,gBAAA;QAAA,OACpDI,MAAMJ,eAAe;OAAW;OAAA,IAC5CqB,UAAO;QAAA,OAAEjB,MAAML;OAAM;OAAA,IAAAc,WAAA;QAAA,OAEpBT,MAAMJ,eAAe;OAAW;MAAA,CAAA;KAAA,EAAA,CAAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA,CAAA;AAM7C"}
@@ -1,2 +1,3 @@
1
1
  export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, type EmptyMediaProps, type EmptyProps, } from './empty';
2
+ export { EmptyState, type EmptyStateProps } from './empty-state';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/empty/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/empty/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA"}
@@ -1,2 +1,3 @@
1
1
  import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./empty.js";
2
- export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
2
+ import { EmptyState } from "./empty-state.js";
3
+ export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle };
@@ -13,7 +13,8 @@ import { type VariantProps } from '#lib/variants';
13
13
  *
14
14
  * 1. **A glyph is always present.** A brand with no logo gets a monogram, not an
15
15
  * empty box. `fallback` takes the name and returns the glyph, so a caller can
16
- * choose initials, a domain letter, or a kind icon.
16
+ * choose initials, a domain letter, or a kind icon. When `src` is supplied,
17
+ * its contained image overlays that glyph and failure reveals the glyph below.
17
18
  * 2. **The tile owns its own contrast.** `tone` tints the background while
18
19
  * monogram text keeps the body foreground; vector glyphs retain the status
19
20
  * colour. A caller never picks a colour pair or ships a glyph that disappears.
@@ -34,6 +35,8 @@ type EntityIconVariantProps = VariantProps<typeof entityIconVariants>;
34
35
  export type EntityIconProps = Omit<ComponentProps<'span'>, 'children'> & EntityIconVariantProps & {
35
36
  /** The entity's name. Used for the accessible label and, via `fallback`, the monogram. */
36
37
  name: string;
38
+ /** Optional image URL. The image is decorative; `name` remains the accessible label. */
39
+ src?: string;
37
40
  /**
38
41
  * A logo or icon — a Lucide icon reference (`icon={Wrench}`) or an element
39
42
  * (`icon={<Wrench />}`). Both are accepted because both are what a caller
@@ -1 +1 @@
1
- {"version":3,"file":"entity-icon.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/entity-icon/entity-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAE1F,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;G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