@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,126 @@
1
+ import { useTheme as e } from "../theme/ThemeProvider.js";
2
+ import { cn as t } from "../utils/cn.js";
3
+ import { createComponent as n, delegateEvents 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";
4
+ import { Show as d, createEffect as f, createSignal as p, createUniqueId as m, onCleanup as h, splitProps as g } from "solid-js";
5
+ //#region src/primitives/EditableTextField.tsx
6
+ var _ = /*#__PURE__*/ l("<input>"), v = /*#__PURE__*/ l("<div>"), y = /*#__PURE__*/ l("<span role=button>"), b = /*#__PURE__*/ l("<span role=alert>");
7
+ function x(r) {
8
+ let l = e(), [x, S] = g(r, [
9
+ "class",
10
+ "value",
11
+ "label",
12
+ "onCommit",
13
+ "validate",
14
+ "onCommitError",
15
+ "emptyLabel",
16
+ "disabled"
17
+ ]), [C, w] = p(!1), [T, E] = p(""), [D, O] = p(""), [k, A] = p(), [j, M] = p(!1), N, P, F = 0, I = m(), L = () => `${S.id ?? I}-error`, R = () => {
18
+ x.disabled || C() || (O(x.value), E(x.value), A(void 0), w(!0));
19
+ };
20
+ f(() => {
21
+ C() && N && N.focus({ preventScroll: !0 });
22
+ }), h(() => P?.abort());
23
+ let z = () => {
24
+ j() && P?.abort(), F += 1, M(!1), A(void 0), w(!1);
25
+ }, B = () => {
26
+ if (!C() || j()) return;
27
+ let e = T(), t = x.validate?.(e);
28
+ if (t) {
29
+ A(t);
30
+ return;
31
+ }
32
+ if (e === D()) {
33
+ w(!1), A(void 0);
34
+ return;
35
+ }
36
+ P?.abort(), P = new AbortController();
37
+ let n = ++F, r;
38
+ try {
39
+ r = x.onCommit(e, P.signal);
40
+ } catch (e) {
41
+ A(l.messages().editableUpdateFailed), x.onCommitError?.(e);
42
+ return;
43
+ }
44
+ if (!(r instanceof Promise)) {
45
+ A(void 0), w(!1);
46
+ return;
47
+ }
48
+ M(!0), r.then(() => {
49
+ n !== F || P?.signal.aborted || (M(!1), A(void 0), w(!1));
50
+ }).catch((e) => {
51
+ n !== F || P?.signal.aborted || (M(!1), A(l.messages().editableUpdateFailed), x.onCommitError?.(e));
52
+ });
53
+ };
54
+ return (() => {
55
+ var e = v();
56
+ return c(e, o(S, {
57
+ get class() {
58
+ return t("sheen-editable-text", x.class);
59
+ },
60
+ get "data-editing"() {
61
+ return C() || void 0;
62
+ },
63
+ get "data-invalid"() {
64
+ return k() ? "" : void 0;
65
+ },
66
+ get "data-pending"() {
67
+ return j() || void 0;
68
+ },
69
+ get "data-stale"() {
70
+ return C() && x.value !== D() ? "" : void 0;
71
+ }
72
+ }), !1, !0), a(e, n(d, {
73
+ get when() {
74
+ return C();
75
+ },
76
+ get fallback() {
77
+ return (() => {
78
+ var e = y();
79
+ return e.$$keydown = (e) => {
80
+ e.key === "Enter" && (e.preventDefault(), R());
81
+ }, e.$$click = R, e.addEventListener("focus", R), a(e, () => x.value || x.emptyLabel || l.messages().empty), i((t) => {
82
+ var n = x.disabled ? void 0 : 0, r = x.label, i = x.disabled || void 0;
83
+ return n !== t.e && s(e, "tabindex", t.e = n), r !== t.t && s(e, "aria-label", t.t = r), i !== t.a && s(e, "aria-disabled", t.a = i), t;
84
+ }, {
85
+ e: void 0,
86
+ t: void 0,
87
+ a: void 0
88
+ }), e;
89
+ })();
90
+ },
91
+ get children() {
92
+ var e = _();
93
+ return e.$$keydown = (e) => {
94
+ e.isComposing || e.key === "Process" || (e.key === "Enter" ? (e.preventDefault(), B()) : e.key === "Escape" && (e.preventDefault(), z()));
95
+ }, e.addEventListener("blur", B), e.$$input = (e) => {
96
+ E(e.currentTarget.value), A(void 0);
97
+ }, u((e) => {
98
+ N = e;
99
+ }, e), i((t) => {
100
+ var n = x.label, r = k() ? !0 : void 0, i = k() ? L() : void 0, a = j();
101
+ return n !== t.e && s(e, "aria-label", t.e = n), r !== t.t && s(e, "aria-invalid", t.t = r), i !== t.a && s(e, "aria-describedby", t.a = i), a !== t.o && (e.disabled = t.o = a), t;
102
+ }, {
103
+ e: void 0,
104
+ t: void 0,
105
+ a: void 0,
106
+ o: void 0
107
+ }), i(() => e.value = T()), e;
108
+ }
109
+ }), null), a(e, n(d, {
110
+ get when() {
111
+ return k();
112
+ },
113
+ children: (e) => (() => {
114
+ var t = b();
115
+ return a(t, e), i(() => s(t, "id", L())), t;
116
+ })()
117
+ }), null), e;
118
+ })();
119
+ }
120
+ r([
121
+ "input",
122
+ "keydown",
123
+ "click"
124
+ ]);
125
+ //#endregion
126
+ export { x as EditableTextField };
@@ -0,0 +1,7 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface EmptyStateProps extends JSX.HTMLAttributes<HTMLDivElement> {
3
+ kind?: "empty" | "no-results";
4
+ heading?: string;
5
+ description?: string;
6
+ }
7
+ export declare function EmptyState(props: EmptyStateProps): JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { useTheme as e } from "../theme/ThemeProvider.js";
2
+ import { cn as t } from "../utils/cn.js";
3
+ import { createComponent as n, insert as r, mergeProps as i, setAttribute as a, spread as o, template as s } from "solid-js/web";
4
+ import { Show as c, createUniqueId as l, splitProps as u } from "solid-js";
5
+ //#region src/primitives/EmptyState.tsx
6
+ var d = /*#__PURE__*/ s("<p class=sheen-empty-state-description>"), f = /*#__PURE__*/ s("<div><strong class=sheen-empty-state-heading>");
7
+ function p(s) {
8
+ let p = e(), m = l(), [h, g] = u(s, [
9
+ "class",
10
+ "kind",
11
+ "heading",
12
+ "description",
13
+ "children",
14
+ "aria-label",
15
+ "aria-labelledby"
16
+ ]);
17
+ return (() => {
18
+ var e = f(), s = e.firstChild;
19
+ return o(e, i(g, {
20
+ get class() {
21
+ return t("sheen-empty-state", h.class);
22
+ },
23
+ get "data-kind"() {
24
+ return h.kind ?? "empty";
25
+ },
26
+ role: "region",
27
+ get "aria-label"() {
28
+ return h["aria-label"];
29
+ },
30
+ get "aria-labelledby"() {
31
+ return h["aria-labelledby"] ?? (h["aria-label"] ? void 0 : m);
32
+ }
33
+ }), !1, !0), a(s, "id", m), r(s, () => h.heading ?? (h.kind === "no-results" ? p.messages().noResults : p.messages().empty)), r(e, n(c, {
34
+ get when() {
35
+ return h.description;
36
+ },
37
+ get children() {
38
+ var e = d();
39
+ return r(e, () => h.description), e;
40
+ }
41
+ }), null), r(e, () => h.children, null), e;
42
+ })();
43
+ }
44
+ //#endregion
45
+ export { p as EmptyState };
@@ -0,0 +1,18 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface FieldControlProps {
3
+ readonly id: string;
4
+ readonly "aria-describedby": string | undefined;
5
+ readonly "aria-invalid": true | undefined;
6
+ readonly required: boolean;
7
+ readonly disabled: boolean;
8
+ }
9
+ export interface FieldProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "children"> {
10
+ label: string;
11
+ controlId?: string | undefined;
12
+ description?: string | undefined;
13
+ error?: string | undefined;
14
+ required?: boolean | undefined;
15
+ disabled?: boolean | undefined;
16
+ children: (control: FieldControlProps) => JSX.Element;
17
+ }
18
+ export declare function Field(props: FieldProps): JSX.Element;
@@ -0,0 +1,72 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { createComponent as t, effect as n, insert as r, mergeProps as i, setAttribute as a, spread as o, template as s } from "solid-js/web";
3
+ import { Show as c, createUniqueId as l, splitProps as u } from "solid-js";
4
+ //#region src/primitives/Field.tsx
5
+ var d = /*#__PURE__*/ s("<span aria-hidden=true> *"), f = /*#__PURE__*/ s("<span class=sheen-field-description>"), p = /*#__PURE__*/ s("<span class=sheen-field-error>"), m = /*#__PURE__*/ s("<div><label class=sheen-field-label>");
6
+ function h(s) {
7
+ let h = l(), [g, _] = u(s, [
8
+ "class",
9
+ "label",
10
+ "controlId",
11
+ "description",
12
+ "error",
13
+ "required",
14
+ "disabled",
15
+ "children"
16
+ ]), v = {
17
+ get id() {
18
+ return g.controlId ?? h;
19
+ },
20
+ get "aria-describedby"() {
21
+ return [g.description ? `${h}-description` : "", g.error ? `${h}-error` : ""].filter(Boolean).join(" ") || void 0;
22
+ },
23
+ get "aria-invalid"() {
24
+ return g.error ? !0 : void 0;
25
+ },
26
+ get required() {
27
+ return g.required ?? !1;
28
+ },
29
+ get disabled() {
30
+ return g.disabled ?? !1;
31
+ }
32
+ };
33
+ return (() => {
34
+ var s = m(), l = s.firstChild;
35
+ return o(s, i(_, {
36
+ get class() {
37
+ return e("sheen-field", g.class);
38
+ },
39
+ get "data-invalid"() {
40
+ return g.error ? "true" : void 0;
41
+ },
42
+ get "data-disabled"() {
43
+ return g.disabled || void 0;
44
+ }
45
+ }), !1, !0), r(l, () => g.label, null), r(l, t(c, {
46
+ get when() {
47
+ return g.required;
48
+ },
49
+ get children() {
50
+ return d();
51
+ }
52
+ }), null), r(s, () => g.children(v), null), r(s, t(c, {
53
+ get when() {
54
+ return g.description;
55
+ },
56
+ get children() {
57
+ var e = f();
58
+ return a(e, "id", `${h}-description`), r(e, () => g.description), e;
59
+ }
60
+ }), null), r(s, t(c, {
61
+ get when() {
62
+ return g.error;
63
+ },
64
+ get children() {
65
+ var e = p();
66
+ return a(e, "id", `${h}-error`), r(e, () => g.error), e;
67
+ }
68
+ }), null), n(() => a(l, "for", v.id)), s;
69
+ })();
70
+ }
71
+ //#endregion
72
+ export { h as Field };
@@ -0,0 +1,40 @@
1
+ import type { JSX } from "solid-js";
2
+ export type FileDropzoneStatus = "queued" | "uploading" | "complete" | "error";
3
+ export interface FileDropzoneItem {
4
+ readonly id: string;
5
+ readonly name: string;
6
+ readonly size: number;
7
+ readonly type?: string;
8
+ readonly status: FileDropzoneStatus;
9
+ readonly statusLabel: string;
10
+ readonly progress?: number;
11
+ }
12
+ export type FileDropzoneRejectionReason = "count" | "size" | "type" | "custom";
13
+ export interface FileDropzoneRejection {
14
+ readonly file: File;
15
+ readonly reason: FileDropzoneRejectionReason;
16
+ readonly message: string;
17
+ }
18
+ export interface FileDropzoneProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "children" | "onDrop" | "onDragEnter" | "onDragLeave" | "onDragOver" | "ref"> {
19
+ ref?: HTMLDivElement | ((element: HTMLDivElement) => void);
20
+ inputRef?: HTMLInputElement | ((element: HTMLInputElement) => void);
21
+ label: string;
22
+ description?: string;
23
+ chooseLabel?: string;
24
+ dropLabel?: string;
25
+ accept?: string;
26
+ multiple?: boolean;
27
+ capture?: "user" | "environment";
28
+ maxFiles?: number;
29
+ maxSize?: number;
30
+ validateFile?: (file: File) => string | null;
31
+ items?: readonly FileDropzoneItem[];
32
+ onFilesSelected: (files: readonly File[]) => void;
33
+ onFilesRejected?: (rejections: readonly FileDropzoneRejection[]) => void;
34
+ onRemove?: (id: string) => void;
35
+ onRetry?: (id: string) => void;
36
+ disabled?: boolean;
37
+ readOnly?: boolean;
38
+ }
39
+ /** A native-picker-first file intake surface whose upload transport remains app-owned. */
40
+ export declare function FileDropzone(props: FileDropzoneProps): JSX.Element;
@@ -0,0 +1,261 @@
1
+ import { useTheme as e } from "../theme/ThemeProvider.js";
2
+ import { cn as t } from "../utils/cn.js";
3
+ import { Button as n } from "./Button.js";
4
+ import { useNumberFormatter as r } from "../theme/intl.js";
5
+ import { Progress as i } from "./Progress.js";
6
+ import { createComponent as a, effect as o, insert as s, memo as c, mergeProps as l, setAttribute as u, spread as d, template as f, use as p } from "solid-js/web";
7
+ import { For as m, Show as h, createMemo as g, createSignal as _, createUniqueId as v, onMount as y, splitProps as b } from "solid-js";
8
+ //#region src/primitives/FileDropzone.tsx
9
+ var x = /*#__PURE__*/ f("<span class=sheen-field-description>"), S = /*#__PURE__*/ f("<div class=sheen-file-dropzone-errors role=alert><ul>"), C = /*#__PURE__*/ f("<ul class=sheen-file-dropzone-items>"), w = /*#__PURE__*/ f("<div><span class=sheen-field-label></span><div class=sheen-file-dropzone-target><input class=sheen-file-dropzone-input type=file><label class=sheen-file-dropzone-picker><span class=sheen-file-dropzone-picker-action dir=auto></span><span class=sheen-file-dropzone-prompt dir=auto></span></label></div><span class=sheen-file-dropzone-announcer role=status aria-live=polite aria-atomic=true>"), T = /*#__PURE__*/ f("<li>"), E = /*#__PURE__*/ f("<li class=sheen-file-dropzone-item><div class=sheen-file-dropzone-item-copy dir=auto><strong></strong><span></span></div><span class=sheen-file-dropzone-status dir=auto></span><div class=sheen-file-dropzone-actions>");
10
+ function D(e) {
11
+ return (e ?? "").split(",").map((e) => e.trim().toLocaleLowerCase("en-US")).filter(Boolean);
12
+ }
13
+ function O(e, t) {
14
+ if (t.length === 0) return !0;
15
+ let n = e.name.toLocaleLowerCase("en-US"), r = e.type.toLocaleLowerCase("en-US");
16
+ return t.some((e) => e.startsWith(".") ? n.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r === e);
17
+ }
18
+ function k(e) {
19
+ return [...e.dataTransfer?.types ?? []].includes("Files");
20
+ }
21
+ function A(f) {
22
+ let A = e(), j = r({ maximumFractionDigits: 1 }), M = v(), [N, P] = b(f, [
23
+ "id",
24
+ "ref",
25
+ "inputRef",
26
+ "class",
27
+ "label",
28
+ "description",
29
+ "chooseLabel",
30
+ "dropLabel",
31
+ "accept",
32
+ "multiple",
33
+ "capture",
34
+ "maxFiles",
35
+ "maxSize",
36
+ "validateFile",
37
+ "items",
38
+ "onFilesSelected",
39
+ "onFilesRejected",
40
+ "onRemove",
41
+ "onRetry",
42
+ "disabled",
43
+ "readOnly",
44
+ "aria-describedby",
45
+ "aria-label",
46
+ "aria-labelledby"
47
+ ]), [F, I] = _(0), [L, R] = _([]), z, B = g(() => D(N.accept)), V = g(() => {
48
+ if (N.maxFiles !== void 0 && (!Number.isSafeInteger(N.maxFiles) || N.maxFiles <= 0)) throw Error("FileDropzone: maxFiles must be a positive integer");
49
+ if (N.maxSize !== void 0 && (!Number.isFinite(N.maxSize) || N.maxSize <= 0)) throw Error("FileDropzone: maxSize must be a positive finite byte count");
50
+ let e = /* @__PURE__ */ new Map();
51
+ for (let t of N.items ?? []) {
52
+ if (!t.id.trim()) throw Error("FileDropzone: item IDs must be nonempty");
53
+ if (e.has(t.id)) throw Error(`FileDropzone: duplicate item ID ${JSON.stringify(t.id)}`);
54
+ if (!t.name.trim() || !Number.isFinite(t.size) || t.size < 0 || !t.statusLabel.trim()) throw Error(`FileDropzone: invalid item ${JSON.stringify(t.id)}`);
55
+ if (t.progress !== void 0 && (!Number.isFinite(t.progress) || t.progress < 0 || t.progress > 1)) throw Error(`FileDropzone: invalid progress for ${JSON.stringify(t.id)}`);
56
+ e.set(t.id, t);
57
+ }
58
+ return e;
59
+ }), H = g(() => [...V().keys()]), U = () => [
60
+ N.description ? `${M}-description` : "",
61
+ L().length ? `${M}-errors` : "",
62
+ N["aria-describedby"]
63
+ ].filter(Boolean).join(" ") || void 0, W = (e) => e < 1e3 ? `${j().format(e)} B` : e < 1e6 ? `${j().format(e / 1e3)} kB` : e < 1e9 ? `${j().format(e / 1e6)} MB` : `${j().format(e / 1e9)} GB`, G = (e) => {
64
+ if (N.disabled || N.readOnly || e.length === 0) return;
65
+ let t = [], n = [], r = N.maxFiles === void 0 ? 2 ** 53 - 1 : Math.max(0, N.maxFiles - H().length), i = N.multiple ? r : Math.min(1, r);
66
+ for (let r of e) {
67
+ let e, a = "";
68
+ if (t.length >= i) e = "count", a = A.messages().fileCountRejected.replaceAll("{count}", j().format(i));
69
+ else if (N.maxSize !== void 0 && r.size > N.maxSize) e = "size", a = A.messages().fileTooLarge.replaceAll("{name}", r.name).replaceAll("{size}", W(N.maxSize));
70
+ else if (!O(r, B())) e = "type", a = A.messages().fileTypeRejected.replaceAll("{name}", r.name);
71
+ else {
72
+ let t = N.validateFile?.(r);
73
+ t && (e = "custom", a = t);
74
+ }
75
+ e ? n.push({
76
+ file: r,
77
+ reason: e,
78
+ message: a
79
+ }) : t.push(r);
80
+ }
81
+ R(n), n.length > 0 && N.onFilesRejected?.(n), t.length > 0 && N.onFilesSelected(t), z && (z.value = "");
82
+ }, K = () => F() > 0, q = (e) => {
83
+ N.disabled || N.readOnly || !k(e) || (e.preventDefault(), I((e) => e + 1));
84
+ }, J = (e) => {
85
+ k(e) && (e.preventDefault(), I((e) => Math.max(0, e - 1)));
86
+ }, Y = (e) => {
87
+ N.disabled || N.readOnly || !k(e) || (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
88
+ }, X = (e) => {
89
+ k(e) && (e.preventDefault(), I(0), G([...e.dataTransfer?.files ?? []]));
90
+ };
91
+ y(() => {
92
+ let e = z?.files;
93
+ e && e.length > 0 && G([...e]);
94
+ });
95
+ let Z = (e, t) => {
96
+ !N.disabled && !N.readOnly && e?.(t);
97
+ };
98
+ return (() => {
99
+ var e = w(), r = e.firstChild, f = r.nextSibling, g = f.firstChild, _ = g.nextSibling, v = _.firstChild, y = v.nextSibling, b = f.nextSibling;
100
+ return p((e) => {
101
+ typeof N.ref == "function" && N.ref(e);
102
+ }, e), d(e, l(P, {
103
+ get id() {
104
+ return N.id ?? M;
105
+ },
106
+ get class() {
107
+ return t("sheen-field sheen-file-dropzone", N.class);
108
+ },
109
+ get "data-drag-active"() {
110
+ return K() || void 0;
111
+ },
112
+ get "data-disabled"() {
113
+ return N.disabled || void 0;
114
+ },
115
+ get "data-readonly"() {
116
+ return N.readOnly || void 0;
117
+ },
118
+ onDragEnter: q,
119
+ onDragLeave: J,
120
+ onDragOver: Y,
121
+ onDrop: X
122
+ }), !1, !0), u(r, "id", `${M}-label`), s(r, () => N.label), g.addEventListener("change", (e) => G([...e.currentTarget.files ?? []])), p((e) => {
123
+ z = e, typeof N.inputRef == "function" && N.inputRef(e);
124
+ }, g), u(g, "id", `${M}-input`), u(_, "for", `${M}-input`), s(v, () => N.chooseLabel ?? A.messages().chooseFiles), s(y, (() => {
125
+ var e = c(() => !!K());
126
+ return () => e() ? N.dropLabel ?? A.messages().dropFilesHere : A.messages().fileDropHint;
127
+ })()), s(e, a(h, {
128
+ get when() {
129
+ return N.description;
130
+ },
131
+ get children() {
132
+ var e = x();
133
+ return u(e, "id", `${M}-description`), s(e, () => N.description), e;
134
+ }
135
+ }), b), s(e, a(h, {
136
+ get when() {
137
+ return L().length > 0;
138
+ },
139
+ get children() {
140
+ var e = S(), t = e.firstChild;
141
+ return u(e, "id", `${M}-errors`), s(t, a(m, {
142
+ get each() {
143
+ return L();
144
+ },
145
+ children: (e) => (() => {
146
+ var t = T();
147
+ return s(t, () => e.message), t;
148
+ })()
149
+ })), e;
150
+ }
151
+ }), b), s(e, a(h, {
152
+ get when() {
153
+ return H().length > 0;
154
+ },
155
+ get children() {
156
+ var e = C();
157
+ return s(e, a(m, {
158
+ get each() {
159
+ return H();
160
+ },
161
+ children: (e) => {
162
+ let t = () => V().get(e);
163
+ return a(h, {
164
+ get when() {
165
+ return t();
166
+ },
167
+ children: (t) => (() => {
168
+ var r = E(), d = r.firstChild, f = d.firstChild, p = f.nextSibling, m = d.nextSibling, g = m.nextSibling;
169
+ return u(r, "data-file-id", e), s(f, () => t().name), s(p, () => W(t().size), null), s(p, a(h, {
170
+ get when() {
171
+ return t().type;
172
+ },
173
+ get children() {
174
+ return [" · ", c(() => t().type)];
175
+ }
176
+ }), null), s(m, () => t().statusLabel), s(r, a(h, {
177
+ get when() {
178
+ return t().status === "uploading";
179
+ },
180
+ get children() {
181
+ return a(i, l({ get label() {
182
+ return A.messages().uploadProgress.replaceAll("{name}", t().name);
183
+ } }, () => t().progress === void 0 ? {} : { value: t().progress }));
184
+ }
185
+ }), g), s(g, a(h, {
186
+ get when() {
187
+ return c(() => t().status === "error")() && N.onRetry;
188
+ },
189
+ get children() {
190
+ return a(n, {
191
+ size: "xs",
192
+ get disabled() {
193
+ return N.disabled;
194
+ },
195
+ get "aria-disabled"() {
196
+ return N.readOnly || void 0;
197
+ },
198
+ get "aria-label"() {
199
+ return `${A.messages().retry} ${t().name}`;
200
+ },
201
+ onClick: () => Z(N.onRetry, e),
202
+ get children() {
203
+ return A.messages().retry;
204
+ }
205
+ });
206
+ }
207
+ }), null), s(g, a(h, {
208
+ get when() {
209
+ return N.onRemove;
210
+ },
211
+ get children() {
212
+ return a(n, {
213
+ size: "xs",
214
+ get disabled() {
215
+ return N.disabled;
216
+ },
217
+ get "aria-disabled"() {
218
+ return N.readOnly || void 0;
219
+ },
220
+ get "aria-label"() {
221
+ return `${A.messages().remove} ${t().name}`;
222
+ },
223
+ onClick: () => Z(N.onRemove, e),
224
+ get children() {
225
+ return A.messages().remove;
226
+ }
227
+ });
228
+ }
229
+ }), null), o((e) => {
230
+ var n = t().status, i = t().status === "uploading" || void 0, a = t().status;
231
+ return n !== e.e && u(r, "data-status", e.e = n), i !== e.t && u(r, "aria-busy", e.t = i), a !== e.a && u(m, "data-status", e.a = a), e;
232
+ }, {
233
+ e: void 0,
234
+ t: void 0,
235
+ a: void 0
236
+ }), r;
237
+ })()
238
+ });
239
+ }
240
+ })), o(() => u(e, "aria-label", A.messages().selectedFiles)), e;
241
+ }
242
+ }), b), s(b, (() => {
243
+ var e = c(() => !!K());
244
+ return () => e() ? N.dropLabel ?? A.messages().dropFilesHere : "";
245
+ })()), o((e) => {
246
+ var t = N.accept, n = N.multiple, r = N.capture, i = N.disabled || N.readOnly, a = N["aria-label"], o = N["aria-label"] === void 0 ? N["aria-labelledby"] ?? `${M}-label` : void 0, s = U(), c = N.disabled || N.readOnly || void 0;
247
+ return t !== e.e && u(g, "accept", e.e = t), n !== e.t && (g.multiple = e.t = n), r !== e.a && u(g, "capture", e.a = r), i !== e.o && (g.disabled = e.o = i), a !== e.i && u(g, "aria-label", e.i = a), o !== e.n && u(g, "aria-labelledby", e.n = o), s !== e.s && u(g, "aria-describedby", e.s = s), c !== e.h && u(_, "aria-disabled", e.h = c), e;
248
+ }, {
249
+ e: void 0,
250
+ t: void 0,
251
+ a: void 0,
252
+ o: void 0,
253
+ i: void 0,
254
+ n: void 0,
255
+ s: void 0,
256
+ h: void 0
257
+ }), e;
258
+ })();
259
+ }
260
+ //#endregion
261
+ export { A as FileDropzone };
@@ -0,0 +1,8 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { TooltipProps } from "./Tooltip.tsx";
3
+ export interface IconButtonProps extends Omit<TooltipProps, "content" | "aria-label" | "aria-labelledby"> {
4
+ label: string;
5
+ children: JSX.Element;
6
+ }
7
+ /** A native icon-only action whose label also supplies its tooltip. */
8
+ export declare function IconButton(props: IconButtonProps): JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { Tooltip as t } from "./Tooltip.js";
3
+ import { createComponent as n, insert as r, mergeProps as i, template as a } from "solid-js/web";
4
+ import { createMemo as o, splitProps as s } from "solid-js";
5
+ //#region src/primitives/IconButton.tsx
6
+ var c = /*#__PURE__*/ a("<span class=sheen-icon-button-glyph aria-hidden=true>");
7
+ function l(a) {
8
+ let [l, u] = s(a, [
9
+ "label",
10
+ "class",
11
+ "children"
12
+ ]), d = o(() => {
13
+ if (!l.label.trim()) throw Error("IconButton requires a nonempty accessible label");
14
+ return l.label;
15
+ });
16
+ return n(t, i(u, {
17
+ get content() {
18
+ return d();
19
+ },
20
+ get "aria-label"() {
21
+ return d();
22
+ },
23
+ "aria-labelledby": void 0,
24
+ get class() {
25
+ return e("sheen-icon-button", l.class);
26
+ },
27
+ get children() {
28
+ var e = c();
29
+ return r(e, () => l.children), e;
30
+ }
31
+ }));
32
+ }
33
+ //#endregion
34
+ export { l as IconButton };
@@ -0,0 +1,7 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface InputProps extends JSX.InputHTMLAttributes<HTMLInputElement> {
3
+ label: string;
4
+ description?: string;
5
+ error?: string;
6
+ }
7
+ export declare function Input(props: InputProps): JSX.Element;
@@ -0,0 +1,55 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { Field as t } from "./Field.js";
3
+ import { createComponent as n, memo as r, mergeProps as i, spread as a, template as o } from "solid-js/web";
4
+ import { splitProps as s } from "solid-js";
5
+ //#region src/primitives/Input.tsx
6
+ var c = /*#__PURE__*/ o("<input>");
7
+ function l(o) {
8
+ let [l, u] = s(o, [
9
+ "label",
10
+ "id",
11
+ "class",
12
+ "description",
13
+ "error",
14
+ "required",
15
+ "disabled",
16
+ "aria-describedby",
17
+ "aria-invalid"
18
+ ]);
19
+ return n(t, {
20
+ get label() {
21
+ return l.label;
22
+ },
23
+ get controlId() {
24
+ return l.id;
25
+ },
26
+ get description() {
27
+ return l.description;
28
+ },
29
+ get error() {
30
+ return l.error;
31
+ },
32
+ get required() {
33
+ return l.required;
34
+ },
35
+ get disabled() {
36
+ return l.disabled;
37
+ },
38
+ children: (t) => (() => {
39
+ var n = c();
40
+ return a(n, i(u, t, {
41
+ get "aria-describedby"() {
42
+ return [t["aria-describedby"], l["aria-describedby"]].filter(Boolean).join(" ") || void 0;
43
+ },
44
+ get "aria-invalid"() {
45
+ return r(() => !!l.error)() ? !0 : l["aria-invalid"];
46
+ },
47
+ get class() {
48
+ return e("sheen-input", l.class);
49
+ }
50
+ }), !1, !1), n;
51
+ })()
52
+ });
53
+ }
54
+ //#endregion
55
+ export { l as Input };