@gemologic/sheen 0.1.0-rc.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 (271) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +32 -0
  3. package/dist/core.d.ts +52 -0
  4. package/dist/core.js +29 -0
  5. package/dist/formisch.d.ts +5 -0
  6. package/dist/formisch.js +22 -0
  7. package/dist/forms.d.ts +34 -0
  8. package/dist/forms.js +18 -0
  9. package/dist/index.d.ts +144 -0
  10. package/dist/index.js +75 -0
  11. package/dist/layout/Layout.d.ts +28 -0
  12. package/dist/layout/Layout.js +121 -0
  13. package/dist/metadata.d.ts +46 -0
  14. package/dist/metadata.js +47 -0
  15. package/dist/navigation.d.ts +30 -0
  16. package/dist/navigation.js +16 -0
  17. package/dist/overlays.d.ts +28 -0
  18. package/dist/overlays.js +15 -0
  19. package/dist/primitives/Accordion.d.ts +16 -0
  20. package/dist/primitives/Accordion.js +223 -0
  21. package/dist/primitives/ActivityTimeline.d.ts +20 -0
  22. package/dist/primitives/ActivityTimeline.js +104 -0
  23. package/dist/primitives/AlertDialog.d.ts +7 -0
  24. package/dist/primitives/AlertDialog.js +8 -0
  25. package/dist/primitives/Avatar.d.ts +22 -0
  26. package/dist/primitives/Avatar.js +115 -0
  27. package/dist/primitives/Breadcrumb.d.ts +11 -0
  28. package/dist/primitives/Breadcrumb.js +66 -0
  29. package/dist/primitives/Button.d.ts +11 -0
  30. package/dist/primitives/Button.js +59 -0
  31. package/dist/primitives/ButtonGroup.d.ts +7 -0
  32. package/dist/primitives/ButtonGroup.js +33 -0
  33. package/dist/primitives/Checkbox.d.ts +22 -0
  34. package/dist/primitives/Checkbox.js +93 -0
  35. package/dist/primitives/CheckboxGroup.d.ts +18 -0
  36. package/dist/primitives/CheckboxGroup.js +122 -0
  37. package/dist/primitives/Collapsible.d.ts +9 -0
  38. package/dist/primitives/Collapsible.js +72 -0
  39. package/dist/primitives/Combobox.d.ts +41 -0
  40. package/dist/primitives/Combobox.js +684 -0
  41. package/dist/primitives/CommandPalette.d.ts +42 -0
  42. package/dist/primitives/CommandPalette.js +319 -0
  43. package/dist/primitives/ConfirmDialog.d.ts +11 -0
  44. package/dist/primitives/ConfirmDialog.js +42 -0
  45. package/dist/primitives/ContextMenu.d.ts +16 -0
  46. package/dist/primitives/ContextMenu.js +132 -0
  47. package/dist/primitives/DescriptionList.d.ts +11 -0
  48. package/dist/primitives/DescriptionList.js +44 -0
  49. package/dist/primitives/Dialog.d.ts +21 -0
  50. package/dist/primitives/Dialog.js +141 -0
  51. package/dist/primitives/Drawer.d.ts +9 -0
  52. package/dist/primitives/Drawer.js +21 -0
  53. package/dist/primitives/DropdownMenu.d.ts +59 -0
  54. package/dist/primitives/DropdownMenu.js +441 -0
  55. package/dist/primitives/EditableTextField.d.ts +11 -0
  56. package/dist/primitives/EditableTextField.js +126 -0
  57. package/dist/primitives/EmptyState.d.ts +7 -0
  58. package/dist/primitives/EmptyState.js +45 -0
  59. package/dist/primitives/Field.d.ts +18 -0
  60. package/dist/primitives/Field.js +72 -0
  61. package/dist/primitives/FileDropzone.d.ts +40 -0
  62. package/dist/primitives/FileDropzone.js +261 -0
  63. package/dist/primitives/IconButton.d.ts +8 -0
  64. package/dist/primitives/IconButton.js +34 -0
  65. package/dist/primitives/Input.d.ts +7 -0
  66. package/dist/primitives/Input.js +55 -0
  67. package/dist/primitives/InputGroup.d.ts +7 -0
  68. package/dist/primitives/InputGroup.js +73 -0
  69. package/dist/primitives/Link.d.ts +7 -0
  70. package/dist/primitives/Link.js +35 -0
  71. package/dist/primitives/LinkTooltip.d.ts +11 -0
  72. package/dist/primitives/LinkTooltip.js +88 -0
  73. package/dist/primitives/NavList.d.ts +17 -0
  74. package/dist/primitives/NavList.js +143 -0
  75. package/dist/primitives/Notice.d.ts +8 -0
  76. package/dist/primitives/Notice.js +64 -0
  77. package/dist/primitives/NumberField.d.ts +22 -0
  78. package/dist/primitives/NumberField.js +177 -0
  79. package/dist/primitives/Pagination.d.ts +12 -0
  80. package/dist/primitives/Pagination.js +127 -0
  81. package/dist/primitives/Popover.d.ts +12 -0
  82. package/dist/primitives/Popover.js +103 -0
  83. package/dist/primitives/Progress.d.ts +17 -0
  84. package/dist/primitives/Progress.js +98 -0
  85. package/dist/primitives/RadioGroup.d.ts +19 -0
  86. package/dist/primitives/RadioGroup.js +173 -0
  87. package/dist/primitives/Resizable.d.ts +36 -0
  88. package/dist/primitives/Resizable.js +196 -0
  89. package/dist/primitives/ScrollArea.d.ts +6 -0
  90. package/dist/primitives/ScrollArea.js +178 -0
  91. package/dist/primitives/SearchInput.d.ts +12 -0
  92. package/dist/primitives/SearchInput.js +89 -0
  93. package/dist/primitives/SegmentedControl.d.ts +25 -0
  94. package/dist/primitives/SegmentedControl.js +188 -0
  95. package/dist/primitives/Select.d.ts +24 -0
  96. package/dist/primitives/Select.js +320 -0
  97. package/dist/primitives/Separator.d.ts +6 -0
  98. package/dist/primitives/Separator.js +31 -0
  99. package/dist/primitives/ShortcutPending.d.ts +6 -0
  100. package/dist/primitives/ShortcutPending.js +40 -0
  101. package/dist/primitives/ShortcutProvider.d.ts +32 -0
  102. package/dist/primitives/ShortcutProvider.js +172 -0
  103. package/dist/primitives/ShortcutScope.d.ts +6 -0
  104. package/dist/primitives/ShortcutScope.js +29 -0
  105. package/dist/primitives/ShortcutSheet.d.ts +5 -0
  106. package/dist/primitives/ShortcutSheet.js +87 -0
  107. package/dist/primitives/Skeleton.d.ts +5 -0
  108. package/dist/primitives/Skeleton.js +23 -0
  109. package/dist/primitives/Slider.d.ts +35 -0
  110. package/dist/primitives/Slider.js +210 -0
  111. package/dist/primitives/Spinner.d.ts +7 -0
  112. package/dist/primitives/Spinner.js +44 -0
  113. package/dist/primitives/Status.d.ts +15 -0
  114. package/dist/primitives/Status.js +78 -0
  115. package/dist/primitives/Stepper.d.ts +32 -0
  116. package/dist/primitives/Stepper.js +147 -0
  117. package/dist/primitives/Surface.d.ts +11 -0
  118. package/dist/primitives/Surface.js +58 -0
  119. package/dist/primitives/Switch.d.ts +4 -0
  120. package/dist/primitives/Switch.js +7 -0
  121. package/dist/primitives/Table.d.ts +23 -0
  122. package/dist/primitives/Table.js +101 -0
  123. package/dist/primitives/Tabs.d.ts +17 -0
  124. package/dist/primitives/Tabs.js +157 -0
  125. package/dist/primitives/TagInput.d.ts +33 -0
  126. package/dist/primitives/TagInput.js +288 -0
  127. package/dist/primitives/Textarea.d.ts +8 -0
  128. package/dist/primitives/Textarea.js +106 -0
  129. package/dist/primitives/Toast.d.ts +10 -0
  130. package/dist/primitives/Toast.js +78 -0
  131. package/dist/primitives/Toaster.d.ts +9 -0
  132. package/dist/primitives/Toaster.js +183 -0
  133. package/dist/primitives/Tooltip.d.ts +13 -0
  134. package/dist/primitives/Tooltip.js +84 -0
  135. package/dist/primitives/Tree.d.ts +23 -0
  136. package/dist/primitives/Tree.js +275 -0
  137. package/dist/primitives/Typography.d.ts +16 -0
  138. package/dist/primitives/Typography.js +82 -0
  139. package/dist/primitives/boolean-input-state.d.ts +14 -0
  140. package/dist/primitives/boolean-input-state.js +39 -0
  141. package/dist/primitives/button-variants.d.ts +9 -0
  142. package/dist/primitives/button-variants.js +7 -0
  143. package/dist/primitives/choice-options.d.ts +7 -0
  144. package/dist/primitives/choice-options.js +35 -0
  145. package/dist/primitives/create-confirm.d.ts +15 -0
  146. package/dist/primitives/create-confirm.js +49 -0
  147. package/dist/primitives/create-toaster.d.ts +51 -0
  148. package/dist/primitives/create-toaster.js +87 -0
  149. package/dist/primitives/link-focus.d.ts +2 -0
  150. package/dist/primitives/link-focus.js +38 -0
  151. package/dist/primitives/menu-focus.d.ts +3 -0
  152. package/dist/primitives/menu-focus.js +32 -0
  153. package/dist/primitives/tooltip-layer.d.ts +14 -0
  154. package/dist/primitives/tooltip-layer.js +84 -0
  155. package/dist/theme/ThemeProvider.d.ts +59 -0
  156. package/dist/theme/ThemeProvider.js +239 -0
  157. package/dist/theme/intl.d.ts +6 -0
  158. package/dist/theme/intl.js +13 -0
  159. package/dist/theme/keyboard-script.d.ts +2 -0
  160. package/dist/theme/keyboard-script.js +6 -0
  161. package/dist/theme/layers.d.ts +7 -0
  162. package/dist/theme/layers.js +23 -0
  163. package/dist/theme/messages.d.ts +235 -0
  164. package/dist/theme/messages.js +115 -0
  165. package/dist/theme/script.d.ts +9 -0
  166. package/dist/theme/script.js +49 -0
  167. package/dist/theme/state.d.ts +27 -0
  168. package/dist/theme/state.js +55 -0
  169. package/dist/utils/browser-status.d.ts +5 -0
  170. package/dist/utils/browser-status.js +22 -0
  171. package/dist/utils/cn.d.ts +3 -0
  172. package/dist/utils/cn.js +7 -0
  173. package/dist/utils/optimistic.d.ts +6 -0
  174. package/dist/utils/optimistic.js +16 -0
  175. package/dist/utils/polymorphic.d.ts +1 -0
  176. package/dist/utils/shortcut-platform.d.ts +2 -0
  177. package/dist/utils/shortcut-platform.js +10 -0
  178. package/dist/utils/shortcut-registry.d.ts +61 -0
  179. package/dist/utils/shortcut-registry.js +186 -0
  180. package/package.json +100 -0
  181. package/src/core.ts +55 -0
  182. package/src/formisch.ts +28 -0
  183. package/src/forms.ts +34 -0
  184. package/src/index.ts +144 -0
  185. package/src/layout/Layout.tsx +43 -0
  186. package/src/metadata.d.ts +46 -0
  187. package/src/metadata.ts +66 -0
  188. package/src/navigation.ts +30 -0
  189. package/src/overlays.ts +28 -0
  190. package/src/primitives/Accordion.tsx +145 -0
  191. package/src/primitives/ActivityTimeline.tsx +72 -0
  192. package/src/primitives/AlertDialog.tsx +8 -0
  193. package/src/primitives/Avatar.tsx +85 -0
  194. package/src/primitives/Breadcrumb.tsx +41 -0
  195. package/src/primitives/Button.tsx +27 -0
  196. package/src/primitives/ButtonGroup.tsx +18 -0
  197. package/src/primitives/Checkbox.tsx +51 -0
  198. package/src/primitives/CheckboxGroup.tsx +73 -0
  199. package/src/primitives/Collapsible.tsx +43 -0
  200. package/src/primitives/Combobox.tsx +402 -0
  201. package/src/primitives/CommandPalette.tsx +234 -0
  202. package/src/primitives/ConfirmDialog.tsx +25 -0
  203. package/src/primitives/ContextMenu.tsx +100 -0
  204. package/src/primitives/DescriptionList.tsx +26 -0
  205. package/src/primitives/Dialog.tsx +81 -0
  206. package/src/primitives/Drawer.tsx +26 -0
  207. package/src/primitives/DropdownMenu.tsx +221 -0
  208. package/src/primitives/EditableTextField.tsx +91 -0
  209. package/src/primitives/EmptyState.tsx +21 -0
  210. package/src/primitives/Field.tsx +38 -0
  211. package/src/primitives/FileDropzone.tsx +189 -0
  212. package/src/primitives/IconButton.tsx +22 -0
  213. package/src/primitives/Input.tsx +17 -0
  214. package/src/primitives/InputGroup.tsx +23 -0
  215. package/src/primitives/Link.tsx +19 -0
  216. package/src/primitives/LinkTooltip.tsx +31 -0
  217. package/src/primitives/NavList.tsx +58 -0
  218. package/src/primitives/Notice.tsx +25 -0
  219. package/src/primitives/NumberField.tsx +168 -0
  220. package/src/primitives/Pagination.tsx +64 -0
  221. package/src/primitives/Popover.tsx +44 -0
  222. package/src/primitives/Progress.tsx +62 -0
  223. package/src/primitives/RadioGroup.tsx +104 -0
  224. package/src/primitives/Resizable.tsx +170 -0
  225. package/src/primitives/ScrollArea.tsx +115 -0
  226. package/src/primitives/SearchInput.tsx +98 -0
  227. package/src/primitives/SegmentedControl.tsx +140 -0
  228. package/src/primitives/Select.tsx +171 -0
  229. package/src/primitives/Separator.tsx +13 -0
  230. package/src/primitives/ShortcutPending.tsx +21 -0
  231. package/src/primitives/ShortcutProvider.tsx +179 -0
  232. package/src/primitives/ShortcutScope.tsx +17 -0
  233. package/src/primitives/ShortcutSheet.tsx +35 -0
  234. package/src/primitives/Skeleton.tsx +12 -0
  235. package/src/primitives/Slider.tsx +153 -0
  236. package/src/primitives/Spinner.tsx +19 -0
  237. package/src/primitives/Status.tsx +33 -0
  238. package/src/primitives/Stepper.tsx +106 -0
  239. package/src/primitives/Surface.tsx +21 -0
  240. package/src/primitives/Switch.tsx +9 -0
  241. package/src/primitives/Table.tsx +57 -0
  242. package/src/primitives/Tabs.tsx +96 -0
  243. package/src/primitives/TagInput.tsx +282 -0
  244. package/src/primitives/Textarea.tsx +77 -0
  245. package/src/primitives/Toast.tsx +36 -0
  246. package/src/primitives/Toaster.tsx +175 -0
  247. package/src/primitives/Tooltip.tsx +41 -0
  248. package/src/primitives/Tree.tsx +256 -0
  249. package/src/primitives/Typography.tsx +39 -0
  250. package/src/primitives/boolean-input-state.ts +65 -0
  251. package/src/primitives/button-variants.ts +20 -0
  252. package/src/primitives/choice-options.ts +39 -0
  253. package/src/primitives/create-confirm.tsx +56 -0
  254. package/src/primitives/create-toaster.ts +128 -0
  255. package/src/primitives/link-focus.ts +38 -0
  256. package/src/primitives/menu-focus.ts +43 -0
  257. package/src/primitives/tooltip-layer.tsx +53 -0
  258. package/src/styles.css +655 -0
  259. package/src/theme/ThemeProvider.tsx +215 -0
  260. package/src/theme/intl.ts +14 -0
  261. package/src/theme/keyboard-script.ts +4 -0
  262. package/src/theme/layers.ts +16 -0
  263. package/src/theme/messages.ts +157 -0
  264. package/src/theme/script.ts +70 -0
  265. package/src/theme/state.ts +48 -0
  266. package/src/utils/browser-status.ts +36 -0
  267. package/src/utils/cn.ts +5 -0
  268. package/src/utils/optimistic.ts +22 -0
  269. package/src/utils/polymorphic.ts +1 -0
  270. package/src/utils/shortcut-platform.ts +4 -0
  271. package/src/utils/shortcut-registry.ts +216 -0
@@ -0,0 +1,115 @@
1
+ import { useTheme as e } from "../theme/ThemeProvider.js";
2
+ import { cn as t } from "../utils/cn.js";
3
+ import { useNumberFormatter as n } from "../theme/intl.js";
4
+ import { createComponent as r, effect as i, insert as a, memo as o, mergeProps as s, setAttribute as c, spread as l, template as u, use as d } from "solid-js/web";
5
+ import { For as f, Show as p, createEffect as m, createMemo as h, createSignal as g, on as _, onMount as v, splitProps as y } from "solid-js";
6
+ //#region src/primitives/Avatar.tsx
7
+ var b = /*#__PURE__*/ u("<img class=sheen-avatar-image alt>"), x = /*#__PURE__*/ u("<span><span class=sheen-avatar-fallback aria-hidden=true>"), S = /*#__PURE__*/ u("<div>"), C = /*#__PURE__*/ u("<span class=\"sheen-avatar sheen-avatar-overflow\">+");
8
+ function w(e, t) {
9
+ if (t !== void 0) {
10
+ if (!t.trim()) throw Error("Avatar fallback must be nonempty when supplied");
11
+ return t;
12
+ }
13
+ return e.trim().split(/\s+/u).slice(0, 2).map((e) => Array.from(e)[0] ?? "").join("").toUpperCase();
14
+ }
15
+ function T(e) {
16
+ let [n, u] = y(e, [
17
+ "label",
18
+ "src",
19
+ "fallback",
20
+ "size",
21
+ "class"
22
+ ]);
23
+ if (!n.label?.trim()) throw Error("Avatar requires a nonempty label");
24
+ let f = () => {
25
+ let e = n.size ?? "md";
26
+ if (e !== "sm" && e !== "md" && e !== "lg") throw Error("Avatar size is invalid");
27
+ return e;
28
+ }, [S, C] = g(!1), T;
29
+ m(_(() => n.src, () => C(!1), { defer: !0 })), v(() => {
30
+ T?.complete && T.naturalWidth === 0 && C(!0);
31
+ });
32
+ let E = h(() => w(n.label, n.fallback));
33
+ return (() => {
34
+ var e = x(), m = e.firstChild;
35
+ return l(e, s(u, {
36
+ get class() {
37
+ return t("sheen-avatar", n.class);
38
+ },
39
+ role: "img",
40
+ get "aria-label"() {
41
+ return n.label;
42
+ },
43
+ get "data-size"() {
44
+ return f();
45
+ }
46
+ }), !1, !0), a(m, E), a(e, r(p, {
47
+ get when() {
48
+ return o(() => !!n.src)() && !S();
49
+ },
50
+ get children() {
51
+ var e = b();
52
+ e.addEventListener("error", () => C(!0));
53
+ var t = T;
54
+ return typeof t == "function" ? d(t, e) : T = e, c(e, "draggable", !1), i(() => c(e, "src", n.src)), e;
55
+ }
56
+ }), null), e;
57
+ })();
58
+ }
59
+ function E(o) {
60
+ let [u, d] = y(o, [
61
+ "label",
62
+ "avatars",
63
+ "max",
64
+ "size",
65
+ "class"
66
+ ]);
67
+ if (!u.label?.trim()) throw Error("AvatarGroup requires a nonempty label");
68
+ let m = e(), g = n(), _ = h(() => {
69
+ let e = /* @__PURE__ */ new Set();
70
+ for (let t of u.avatars) {
71
+ if (!t.id?.trim() || e.has(t.id)) throw Error("AvatarGroup IDs must be unique nonempty strings");
72
+ e.add(t.id);
73
+ }
74
+ return u.avatars;
75
+ }), v = () => {
76
+ let e = u.max ?? 5;
77
+ if (!Number.isSafeInteger(e) || e <= 0) throw Error("AvatarGroup max must be a positive safe integer");
78
+ return e;
79
+ }, b = h(() => _().slice(0, v())), x = h(() => Math.max(0, _().length - b().length));
80
+ return (() => {
81
+ var e = S();
82
+ return l(e, s(d, {
83
+ get class() {
84
+ return t("sheen-avatar-group", u.class);
85
+ },
86
+ role: "group",
87
+ get "aria-label"() {
88
+ return u.label;
89
+ }
90
+ }), !1, !0), a(e, r(f, {
91
+ get each() {
92
+ return b();
93
+ },
94
+ children: (e) => r(T, s({ get label() {
95
+ return e.label;
96
+ } }, () => e.src === void 0 ? {} : { src: e.src }, () => e.fallback === void 0 ? {} : { fallback: e.fallback }, () => u.size === void 0 ? {} : { size: u.size }))
97
+ }), null), a(e, r(p, {
98
+ get when() {
99
+ return x();
100
+ },
101
+ children: (e) => (() => {
102
+ var t = C();
103
+ return t.firstChild, a(t, () => g().format(e()), null), i((n) => {
104
+ var r = u.size ?? "md", i = m.messages().avatarOverflow.replaceAll("{count}", g().format(e()));
105
+ return r !== n.e && c(t, "data-size", n.e = r), i !== n.t && c(t, "aria-label", n.t = i), n;
106
+ }, {
107
+ e: void 0,
108
+ t: void 0
109
+ }), t;
110
+ })()
111
+ }), null), e;
112
+ })();
113
+ }
114
+ //#endregion
115
+ export { T as Avatar, E as AvatarGroup };
@@ -0,0 +1,11 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface BreadcrumbEntry {
3
+ readonly id: string;
4
+ readonly label: string;
5
+ readonly href?: string;
6
+ }
7
+ export interface BreadcrumbProps extends Omit<JSX.HTMLAttributes<HTMLElement>, "children"> {
8
+ items: readonly BreadcrumbEntry[];
9
+ label?: string;
10
+ }
11
+ export declare function Breadcrumb(props: BreadcrumbProps): JSX.Element;
@@ -0,0 +1,66 @@
1
+ import { useTheme as e } from "../theme/ThemeProvider.js";
2
+ import { cn as t } from "../utils/cn.js";
3
+ import { createLinkFocusRecovery as n } from "./link-focus.js";
4
+ import { createComponent as r, effect as i, insert as a, mergeProps as o, setAttribute as s, spread as c, template as l, use as u } from "solid-js/web";
5
+ import { For as d, Show as f, createMemo as p, splitProps as m } from "solid-js";
6
+ //#region src/primitives/Breadcrumb.tsx
7
+ var h = /*#__PURE__*/ l("<nav><ol>"), g = /*#__PURE__*/ l("<a>"), _ = /*#__PURE__*/ l("<li>"), v = /*#__PURE__*/ l("<span aria-current=page>");
8
+ function y(l) {
9
+ let y = e(), [b, x] = m(l, [
10
+ "items",
11
+ "label",
12
+ "class",
13
+ "ref"
14
+ ]), S;
15
+ n(() => S);
16
+ let C = p(() => {
17
+ let e = /* @__PURE__ */ new Map();
18
+ for (let [t, n] of b.items.entries()) {
19
+ if (!n.id.trim() || !n.label.trim()) throw Error("Breadcrumb requires nonempty item IDs and labels");
20
+ if (e.has(n.id)) throw Error(`Breadcrumb duplicate item ID: ${n.id}`);
21
+ if (t < b.items.length - 1 && !n.href?.trim()) throw Error(`Breadcrumb ancestor requires href: ${n.id}`);
22
+ e.set(n.id, n);
23
+ }
24
+ if (!e.size) throw Error("Breadcrumb requires at least the current page");
25
+ return e;
26
+ }), w = () => b.items.at(-1)?.id;
27
+ return (() => {
28
+ var e = h(), n = e.firstChild;
29
+ return u((e) => {
30
+ S = e, typeof b.ref == "function" && b.ref(e);
31
+ }, e), c(e, o({ get "aria-label"() {
32
+ return b.label ?? y.messages().breadcrumb;
33
+ } }, x, {
34
+ get tabIndex() {
35
+ return x.tabIndex ?? -1;
36
+ },
37
+ get class() {
38
+ return t("sheen-breadcrumb", b.class);
39
+ }
40
+ }), !1, !0), a(n, r(d, {
41
+ get each() {
42
+ return [...C().keys()];
43
+ },
44
+ children: (e) => (() => {
45
+ var t = _();
46
+ return a(t, r(f, {
47
+ get when() {
48
+ return e !== w();
49
+ },
50
+ get fallback() {
51
+ return (() => {
52
+ var t = v();
53
+ return a(t, () => C().get(e)?.label), t;
54
+ })();
55
+ },
56
+ get children() {
57
+ var t = g();
58
+ return a(t, () => C().get(e)?.label), i(() => s(t, "href", C().get(e)?.href)), t;
59
+ }
60
+ })), t;
61
+ })()
62
+ })), e;
63
+ })();
64
+ }
65
+ //#endregion
66
+ export { y as Breadcrumb };
@@ -0,0 +1,11 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { ButtonVariantProps } from "./button-variants.ts";
3
+ import type { ShortcutAction } from "../utils/shortcut-registry.ts";
4
+ export interface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
5
+ variant?: NonNullable<ButtonVariantProps["variant"]>;
6
+ tone?: NonNullable<ButtonVariantProps["tone"]>;
7
+ size?: NonNullable<ButtonVariantProps["size"]>;
8
+ loading?: boolean;
9
+ shortcut?: ShortcutAction | undefined;
10
+ }
11
+ export declare function Button(props: ButtonProps): JSX.Element;
@@ -0,0 +1,59 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { buttonVariants as t } from "./button-variants.js";
3
+ import { useShortcutAction as n } from "./ShortcutProvider.js";
4
+ import { insert as r, mergeProps as i, spread as a, template as o, use as s } from "solid-js/web";
5
+ import { splitProps as c } from "solid-js";
6
+ //#region src/primitives/Button.tsx
7
+ var l = /*#__PURE__*/ o("<button>");
8
+ function u(o) {
9
+ let [u, d] = c(o, [
10
+ "class",
11
+ "variant",
12
+ "tone",
13
+ "size",
14
+ "loading",
15
+ "disabled",
16
+ "shortcut",
17
+ "ref",
18
+ "children"
19
+ ]), f, p = n(() => u.shortcut, () => {
20
+ !u.disabled && !u.loading && f?.click();
21
+ });
22
+ return (() => {
23
+ var n = l();
24
+ return s((e) => {
25
+ f = e, typeof u.ref == "function" && u.ref(e);
26
+ }, n), a(n, i(d, {
27
+ get type() {
28
+ return d.type ?? "button";
29
+ },
30
+ get class() {
31
+ return e(t({
32
+ variant: u.variant,
33
+ tone: u.tone,
34
+ size: u.size
35
+ }), u.class);
36
+ },
37
+ get "data-variant"() {
38
+ return u.variant ?? "ghost";
39
+ },
40
+ get "data-tone"() {
41
+ return u.tone ?? "neutral";
42
+ },
43
+ get "data-size"() {
44
+ return u.size ?? "md";
45
+ },
46
+ get "data-sheen-shortcut"() {
47
+ return p()?.displayKeys;
48
+ },
49
+ get disabled() {
50
+ return u.disabled || u.loading;
51
+ },
52
+ get "aria-busy"() {
53
+ return u.loading || void 0;
54
+ }
55
+ }), !1, !0), r(n, () => u.children), n;
56
+ })();
57
+ }
58
+ //#endregion
59
+ export { u as Button };
@@ -0,0 +1,7 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface ButtonGroupProps extends JSX.HTMLAttributes<HTMLDivElement> {
3
+ label: string;
4
+ orientation?: "horizontal" | "vertical";
5
+ }
6
+ /** Related actions, not a toolbar or a selection widget. */
7
+ export declare function ButtonGroup(props: ButtonGroupProps): JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { insert as t, mergeProps as n, spread as r, template as i } from "solid-js/web";
3
+ import { createMemo as a, splitProps as o } from "solid-js";
4
+ //#region src/primitives/ButtonGroup.tsx
5
+ var s = /*#__PURE__*/ i("<div>");
6
+ function c(i) {
7
+ let [c, l] = o(i, [
8
+ "label",
9
+ "orientation",
10
+ "class",
11
+ "children"
12
+ ]), u = a(() => {
13
+ if (!c.label.trim()) throw Error("ButtonGroup requires a nonempty accessible label");
14
+ return c.label;
15
+ });
16
+ return (() => {
17
+ var i = s();
18
+ return r(i, n(l, {
19
+ role: "group",
20
+ get "aria-label"() {
21
+ return u();
22
+ },
23
+ get class() {
24
+ return e("sheen-button-group", c.class);
25
+ },
26
+ get "data-orientation"() {
27
+ return c.orientation ?? "horizontal";
28
+ }
29
+ }), !1, !0), t(i, () => c.children), i;
30
+ })();
31
+ }
32
+ //#endregion
33
+ export { c as ButtonGroup };
@@ -0,0 +1,22 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface CheckboxProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "children" | "onChange" | "id" | "ref" | "onPointerDown"> {
3
+ id?: string;
4
+ ref?: HTMLDivElement | ((element: HTMLDivElement) => void);
5
+ onPointerDown?: NonNullable<JSX.HTMLAttributes<HTMLDivElement>["onPointerDown"]>;
6
+ label: string;
7
+ description?: string;
8
+ error?: string;
9
+ checked?: boolean;
10
+ defaultChecked?: boolean;
11
+ indeterminate?: boolean;
12
+ onCheckedChange?: (checked: boolean) => void;
13
+ disabled?: boolean;
14
+ readOnly?: boolean;
15
+ required?: boolean;
16
+ name?: string;
17
+ form?: string | undefined;
18
+ value?: string;
19
+ inputRef?: (element: HTMLInputElement) => void;
20
+ }
21
+ export declare function createNativeBooleanControl(props: CheckboxProps, kind: "checkbox" | "switch"): JSX.Element;
22
+ export declare function Checkbox(props: CheckboxProps): JSX.Element;
@@ -0,0 +1,93 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { createBooleanInputState as t } from "./boolean-input-state.js";
3
+ import { className as n, createComponent as r, delegateEvents as i, effect as a, insert as o, mergeProps as s, setAttribute as c, spread as l, template as u, use as d } from "solid-js/web";
4
+ import { Show as f, createUniqueId as p, splitProps as m } from "solid-js";
5
+ //#region src/primitives/Checkbox.tsx
6
+ var h = /*#__PURE__*/ u("<span aria-hidden=true> *"), g = /*#__PURE__*/ u("<p>"), _ = /*#__PURE__*/ u("<div><div><input type=checkbox><span aria-hidden=true></span><label>"), v = /*#__PURE__*/ u("<span class=sheen-checkbox-indicator><span class=sheen-checkbox-mark>"), y = /*#__PURE__*/ u("<span class=sheen-switch-thumb>");
7
+ function b(i, u) {
8
+ let [b, x, S] = m(i, [
9
+ "label",
10
+ "description",
11
+ "error",
12
+ "class",
13
+ "onCheckedChange",
14
+ "inputRef",
15
+ "form"
16
+ ], [
17
+ "checked",
18
+ "defaultChecked",
19
+ "indeterminate",
20
+ "disabled",
21
+ "readOnly",
22
+ "required",
23
+ "name",
24
+ "value"
25
+ ]), C = `sheen-${u}`, w = p(), T = `${w}-input`, E, D = () => [b.description ? `${w}-description` : "", b.error ? `${w}-error` : ""].filter(Boolean).join(" ") || void 0, { checked: O, requestChange: k, setInput: A } = t(x, (e) => b.onCheckedChange?.(e));
26
+ return (() => {
27
+ var t = _(), i = t.firstChild, p = i.firstChild, m = p.nextSibling, j = m.nextSibling;
28
+ return l(t, s(S, {
29
+ get class() {
30
+ return e(C, b.class);
31
+ },
32
+ get "data-checked"() {
33
+ return O() || void 0;
34
+ },
35
+ get "data-indeterminate"() {
36
+ return x.indeterminate || void 0;
37
+ },
38
+ get "data-disabled"() {
39
+ return x.disabled || void 0;
40
+ },
41
+ get "data-readonly"() {
42
+ return x.readOnly || void 0;
43
+ },
44
+ get "data-invalid"() {
45
+ return b.error ? "" : void 0;
46
+ }
47
+ }), !1, !0), n(i, `${C}-row`), p.addEventListener("change", (e) => k(e.currentTarget)), d((e) => {
48
+ E = e, A(e), b.inputRef?.(e);
49
+ }, p), c(p, "id", T), c(p, "role", u === "switch" ? "switch" : void 0), n(p, `${C}-input`), m.$$click = () => E?.click(), n(m, `${C}-control`), o(m, u === "checkbox" ? v() : y()), c(j, "for", T), n(j, `${C}-label`), o(j, () => b.label, null), o(j, r(f, {
50
+ get when() {
51
+ return x.required;
52
+ },
53
+ get children() {
54
+ return h();
55
+ }
56
+ }), null), o(t, r(f, {
57
+ get when() {
58
+ return b.description;
59
+ },
60
+ get children() {
61
+ var e = g();
62
+ return c(e, "id", `${w}-description`), n(e, `${C}-description`), o(e, () => b.description), e;
63
+ }
64
+ }), null), o(t, r(f, {
65
+ get when() {
66
+ return b.error;
67
+ },
68
+ get children() {
69
+ var e = g();
70
+ return c(e, "id", `${w}-error`), n(e, `${C}-error`), o(e, () => b.error), e;
71
+ }
72
+ }), null), a((e) => {
73
+ var t = x.name ?? "", n = b.form, r = x.disabled, i = x.required, a = x.readOnly, o = x.readOnly || void 0, s = b.error ? "true" : void 0, l = D(), u = x.indeterminate || void 0;
74
+ return t !== e.e && c(p, "name", e.e = t), n !== e.t && c(p, "form", e.t = n), r !== e.a && (p.disabled = e.a = r), i !== e.o && (p.required = e.o = i), a !== e.i && (p.readOnly = e.i = a), o !== e.n && c(p, "aria-readonly", e.n = o), s !== e.s && c(p, "aria-invalid", e.s = s), l !== e.h && c(p, "aria-describedby", e.h = l), u !== e.r && c(m, "data-indeterminate", e.r = u), e;
75
+ }, {
76
+ e: void 0,
77
+ t: void 0,
78
+ a: void 0,
79
+ o: void 0,
80
+ i: void 0,
81
+ n: void 0,
82
+ s: void 0,
83
+ h: void 0,
84
+ r: void 0
85
+ }), a(() => p.value = x.value), a(() => p.checked = O()), t;
86
+ })();
87
+ }
88
+ function x(e) {
89
+ return b(e, "checkbox");
90
+ }
91
+ i(["click"]);
92
+ //#endregion
93
+ export { x as Checkbox, b as createNativeBooleanControl };
@@ -0,0 +1,18 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface CheckboxOption {
3
+ readonly value: string;
4
+ readonly label: string;
5
+ readonly description?: string;
6
+ readonly disabled?: boolean;
7
+ }
8
+ export interface CheckboxGroupProps extends Omit<JSX.FieldsetHTMLAttributes<HTMLFieldSetElement>, "children" | "onChange"> {
9
+ label: string;
10
+ options: readonly CheckboxOption[];
11
+ value?: readonly string[];
12
+ defaultValue?: readonly string[];
13
+ onValueChange?: (value: string[]) => void;
14
+ description?: string;
15
+ error?: string;
16
+ readOnly?: boolean;
17
+ }
18
+ export declare function CheckboxGroup(props: CheckboxGroupProps): JSX.Element;
@@ -0,0 +1,122 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { Checkbox as t } from "./Checkbox.js";
3
+ import { createChoiceOptions as n } from "./choice-options.js";
4
+ import { createComponent as r, insert as i, mergeProps as a, setAttribute as o, spread as s, template as c, use as l } from "solid-js/web";
5
+ import { For as u, Show as d, createSignal as f, createUniqueId as p, onCleanup as m, onMount as h, splitProps as g, untrack as _ } from "solid-js";
6
+ //#region src/primitives/CheckboxGroup.tsx
7
+ var v = /*#__PURE__*/ c("<p class=sheen-checkbox-group-description>"), y = /*#__PURE__*/ c("<p class=sheen-checkbox-group-error>"), b = /*#__PURE__*/ c("<fieldset><legend class=sheen-checkbox-group-label></legend><div class=sheen-checkbox-group-options>");
8
+ function x(c) {
9
+ let x = p(), [S, C] = g(c, [
10
+ "label",
11
+ "options",
12
+ "value",
13
+ "defaultValue",
14
+ "onValueChange",
15
+ "description",
16
+ "error",
17
+ "readOnly",
18
+ "disabled",
19
+ "name",
20
+ "class",
21
+ "ref",
22
+ "aria-describedby"
23
+ ]), w = [...new Set(S.defaultValue ?? [])], [T, E] = f(w), D = () => S.value ?? T(), O, { byValue: k, keys: A } = n(() => S.options, () => O, "CheckboxGroup"), j = (e) => {
24
+ let t = [...new Set(e)];
25
+ t.length === D().length && t.every((e, t) => e === D()[t]) || (S.value === void 0 && E(t), S.onValueChange?.([...t]));
26
+ };
27
+ h(() => {
28
+ let e = O, t = e?.ownerDocument.defaultView;
29
+ if (!e || !t) return;
30
+ let n = /* @__PURE__ */ new Set(), r = (r) => {
31
+ if (r.target !== e.form) return;
32
+ let i = t.setTimeout(() => {
33
+ n.delete(i), !r.defaultPrevented && S.value === void 0 && j(w);
34
+ }, 0);
35
+ n.add(i);
36
+ };
37
+ e.ownerDocument.addEventListener("reset", r, !0), m(() => {
38
+ e.ownerDocument.removeEventListener("reset", r, !0);
39
+ for (let e of n) t.clearTimeout(e);
40
+ });
41
+ });
42
+ let M = () => [
43
+ S.description ? `${x}-description` : "",
44
+ S.error ? `${x}-error` : "",
45
+ S["aria-describedby"]
46
+ ].filter(Boolean).join(" ") || void 0;
47
+ return (() => {
48
+ var n = b(), c = n.firstChild, f = c.nextSibling;
49
+ return l((e) => {
50
+ O = e, typeof S.ref == "function" && S.ref(e);
51
+ }, n), s(n, a(C, {
52
+ get tabIndex() {
53
+ return C.tabIndex ?? -1;
54
+ },
55
+ get class() {
56
+ return e("sheen-checkbox-group", S.class);
57
+ },
58
+ get disabled() {
59
+ return S.disabled;
60
+ },
61
+ get "aria-describedby"() {
62
+ return M();
63
+ },
64
+ get "aria-invalid"() {
65
+ return S.error ? !0 : void 0;
66
+ },
67
+ get "data-invalid"() {
68
+ return S.error ? "true" : void 0;
69
+ },
70
+ get "data-readonly"() {
71
+ return S.readOnly || void 0;
72
+ }
73
+ }), !1, !0), i(c, () => S.label), i(n, r(d, {
74
+ get when() {
75
+ return S.description;
76
+ },
77
+ get children() {
78
+ var e = v();
79
+ return o(e, "id", `${x}-description`), i(e, () => S.description), e;
80
+ }
81
+ }), f), i(f, r(u, {
82
+ get each() {
83
+ return A();
84
+ },
85
+ children: (e) => {
86
+ let n = _(() => k().get(e));
87
+ if (!n) throw Error("CheckboxGroup: missing option during creation");
88
+ let i = () => k().get(e) ?? n;
89
+ return r(t, a(i, {
90
+ get name() {
91
+ return S.name ?? "";
92
+ },
93
+ get form() {
94
+ return C.form;
95
+ },
96
+ get checked() {
97
+ return D().includes(e);
98
+ },
99
+ get disabled() {
100
+ return !!S.disabled || !!i().disabled;
101
+ },
102
+ get readOnly() {
103
+ return S.readOnly ?? !1;
104
+ },
105
+ onCheckedChange: (t) => {
106
+ S.disabled || S.readOnly || i().disabled || j(t ? [...D(), e] : D().filter((t) => t !== e));
107
+ }
108
+ }));
109
+ }
110
+ })), i(n, r(d, {
111
+ get when() {
112
+ return S.error;
113
+ },
114
+ get children() {
115
+ var e = y();
116
+ return o(e, "id", `${x}-error`), i(e, () => S.error), e;
117
+ }
118
+ }), null), n;
119
+ })();
120
+ }
121
+ //#endregion
122
+ export { x as CheckboxGroup };
@@ -0,0 +1,9 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface CollapsibleProps extends JSX.HTMLAttributes<HTMLDivElement> {
3
+ label: string;
4
+ open?: boolean;
5
+ defaultOpen?: boolean;
6
+ onOpenChange?: (open: boolean) => void;
7
+ disabled?: boolean;
8
+ }
9
+ export declare function Collapsible(props: CollapsibleProps): JSX.Element;
@@ -0,0 +1,72 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { Button as t } from "./Button.js";
3
+ import { createComponent as n, effect as r, insert as i, memo as a, mergeProps as o, setAttribute as s, template as c, use as l } from "solid-js/web";
4
+ import { createEffect as u, createSignal as d, createUniqueId as f, splitProps as p } from "solid-js";
5
+ import * as m from "@kobalte/core/collapsible";
6
+ //#region src/primitives/Collapsible.tsx
7
+ var h = /*#__PURE__*/ c("<span class=sheen-collapsible-indicator aria-hidden=true>"), g = /*#__PURE__*/ c("<div class=sheen-collapsible-content><div class=sheen-collapsible-clip><div class=sheen-collapsible-body>");
8
+ function _(c) {
9
+ let [_, v] = p(c, [
10
+ "label",
11
+ "open",
12
+ "defaultOpen",
13
+ "onOpenChange",
14
+ "disabled",
15
+ "class",
16
+ "children",
17
+ "id"
18
+ ]), y = f(), b = () => _.id ?? `sheen-collapsible-${y}`, [x, S] = d(_.defaultOpen ?? !1), C = () => _.open === void 0 ? x() : _.open, w, T, E = () => {
19
+ T?.contains(T.ownerDocument.activeElement) && w?.focus({ preventScroll: !0 });
20
+ };
21
+ return u(() => {
22
+ C() || E();
23
+ }), n(m.Root, o(v, {
24
+ get id() {
25
+ return b();
26
+ },
27
+ get class() {
28
+ return e("sheen-collapsible", _.class);
29
+ },
30
+ get open() {
31
+ return C();
32
+ },
33
+ onOpenChange: (e) => {
34
+ _.disabled || e === C() || (_.open === void 0 && (e || E(), S(e)), _.onOpenChange?.(e));
35
+ },
36
+ get disabled() {
37
+ return _.disabled ?? !1;
38
+ },
39
+ get children() {
40
+ return [n(m.Trigger, {
41
+ as: t,
42
+ ref(e) {
43
+ var t = w;
44
+ typeof t == "function" ? t(e) : w = e;
45
+ },
46
+ get id() {
47
+ return `${b()}-trigger`;
48
+ },
49
+ get "aria-controls"() {
50
+ return `${b()}-content`;
51
+ },
52
+ class: "sheen-collapsible-trigger",
53
+ get children() {
54
+ return [h(), a(() => _.label)];
55
+ }
56
+ }), (() => {
57
+ var e = g(), t = e.firstChild.firstChild, n = T;
58
+ return typeof n == "function" ? l(n, e) : T = e, i(t, () => _.children), r((t) => {
59
+ var n = `${b()}-content`, r = C(), i = !C() || void 0, a = !C();
60
+ return n !== t.e && s(e, "id", t.e = n), r !== t.t && s(e, "data-open", t.t = r), i !== t.a && s(e, "aria-hidden", t.a = i), a !== t.o && (e.inert = t.o = a), t;
61
+ }, {
62
+ e: void 0,
63
+ t: void 0,
64
+ a: void 0,
65
+ o: void 0
66
+ }), e;
67
+ })()];
68
+ }
69
+ }));
70
+ }
71
+ //#endregion
72
+ export { _ as Collapsible };