@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,196 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { createComponent as t, mergeProps as n, template as r } from "solid-js/web";
3
+ import { createContext as i, createMemo as a, createSignal as o, splitProps as s, useContext as c } from "solid-js";
4
+ import l from "@corvu/resizable";
5
+ //#region src/primitives/Resizable.tsx
6
+ var u = /*#__PURE__*/ r("<span aria-hidden=true>"), d = i();
7
+ function f(e, t) {
8
+ if (e.length < 2) throw Error(`${t} requires at least two panel sizes`);
9
+ let n = 0, r = e.map((e, r) => {
10
+ if (!Number.isFinite(e) || e < 0 || e > 1) throw Error(`${t} panel ${r + 1} must be between zero and one`);
11
+ return n += e, e;
12
+ });
13
+ if (Math.abs(n - 1) > .001) throw Error(`${t} must sum to one`);
14
+ return r;
15
+ }
16
+ function p(e, t) {
17
+ if (e !== void 0) {
18
+ if (!Number.isFinite(e) || e < 0 || e > 1) throw Error(`${t} must be between zero and one`);
19
+ return e;
20
+ }
21
+ }
22
+ function m(e, t) {
23
+ return e.length === t.length && e.every((e, n) => Math.abs(e - (t[n] ?? NaN)) < 1e-6);
24
+ }
25
+ function h(r) {
26
+ let [i, c] = s(r, [
27
+ "class",
28
+ "style",
29
+ "children",
30
+ "orientation",
31
+ "sizes",
32
+ "defaultSizes",
33
+ "onSizesChange",
34
+ "keyboardStep",
35
+ "persistence",
36
+ "ref"
37
+ ]), [u, p] = o(!1), h = 0, g = () => f(i.defaultSizes ?? i.persistence?.initialSizes ?? [.5, .5], "Resizable initial sizes"), [_, v] = o(g()), y = a(() => f(i.sizes ?? _(), "Resizable sizes")), b = () => {
38
+ let e = i.keyboardStep ?? .05;
39
+ if (!Number.isFinite(e) || e <= 0 || e > 1) throw Error("Resizable keyboardStep must be greater than zero and at most one");
40
+ return e;
41
+ }, x = (e) => {
42
+ if (e.length !== g().length) return;
43
+ let t = Object.freeze(f(e, "Resizable result"));
44
+ if (m(t, y())) return;
45
+ i.sizes === void 0 && v(t), i.onSizesChange?.(t);
46
+ let n = i.persistence;
47
+ if (n) try {
48
+ let e = n.save(t);
49
+ e instanceof Promise && (h += 1, p(!0), e.catch(n.onError).finally(() => {
50
+ --h, h === 0 && p(!1);
51
+ }));
52
+ } catch (e) {
53
+ n.onError(e);
54
+ }
55
+ }, S = () => ({
56
+ ...i.ref === void 0 ? {} : { ref: i.ref },
57
+ ...i.style === void 0 ? {} : { style: i.style }
58
+ }), C = {
59
+ at: (e) => {
60
+ if (!Number.isSafeInteger(e) || e < 0 || e >= g().length) throw Error("ResizablePanel index must address an initial size");
61
+ let t = g()[e];
62
+ if (t === void 0) throw Error("ResizablePanel index must address an initial size");
63
+ return t;
64
+ },
65
+ sizes: y
66
+ };
67
+ return t(l, n(c, S, {
68
+ get sizes() {
69
+ return y();
70
+ },
71
+ get class() {
72
+ return e("sheen-resizable", i.class);
73
+ },
74
+ get orientation() {
75
+ return i.orientation ?? "horizontal";
76
+ },
77
+ get initialSizes() {
78
+ return g();
79
+ },
80
+ get keyboardDelta() {
81
+ return b();
82
+ },
83
+ onSizesChange: x,
84
+ get "data-saving"() {
85
+ return u() || void 0;
86
+ },
87
+ get children() {
88
+ return t(d.Provider, {
89
+ value: C,
90
+ get children() {
91
+ return i.children;
92
+ }
93
+ });
94
+ }
95
+ }));
96
+ }
97
+ function g(r) {
98
+ let i = c(d), [a, o] = s(r, [
99
+ "class",
100
+ "style",
101
+ "children",
102
+ "index",
103
+ "panelId",
104
+ "initialSize",
105
+ "minSize",
106
+ "maxSize",
107
+ "collapsible",
108
+ "collapsedSize",
109
+ "collapseThreshold",
110
+ "onResize",
111
+ "onCollapse",
112
+ "onExpand",
113
+ "ref"
114
+ ]);
115
+ return t(l.Panel, n(o, () => {
116
+ let e = p(a.initialSize ?? i?.at(a.index), "ResizablePanel initialSize"), t = p(a.minSize, "ResizablePanel minSize"), n = p(a.maxSize, "ResizablePanel maxSize"), r = p(a.collapsedSize, "ResizablePanel collapsedSize"), o = p(a.collapseThreshold, "ResizablePanel collapseThreshold");
117
+ return {
118
+ ...a.ref === void 0 ? {} : { ref: a.ref },
119
+ ...a.style === void 0 ? {} : { style: a.style },
120
+ ...a.panelId === void 0 ? {} : { panelId: a.panelId },
121
+ ...e === void 0 ? {} : { initialSize: e },
122
+ ...t === void 0 ? {} : { minSize: t },
123
+ ...n === void 0 ? {} : { maxSize: n },
124
+ ...a.collapsible === void 0 ? {} : { collapsible: a.collapsible },
125
+ ...r === void 0 ? {} : { collapsedSize: r },
126
+ ...o === void 0 ? {} : { collapseThreshold: o },
127
+ ...a.onResize === void 0 ? {} : { onResize: a.onResize },
128
+ ...a.onCollapse === void 0 ? {} : { onCollapse: a.onCollapse },
129
+ ...a.onExpand === void 0 ? {} : { onExpand: a.onExpand }
130
+ };
131
+ }, {
132
+ get class() {
133
+ return e("sheen-resizable-panel", a.class);
134
+ },
135
+ get children() {
136
+ return a.children;
137
+ }
138
+ }));
139
+ }
140
+ function _(r) {
141
+ let i = c(d);
142
+ if (!i) throw Error("ResizableHandle requires a Resizable parent");
143
+ let [a, o] = s(r, [
144
+ "class",
145
+ "style",
146
+ "label",
147
+ "index",
148
+ "ref",
149
+ "disabled",
150
+ "onBlur",
151
+ "onFocus",
152
+ "onKeyDown",
153
+ "onKeyUp",
154
+ "onMouseEnter",
155
+ "onMouseLeave",
156
+ "onPointerDown"
157
+ ]);
158
+ if (!a.label.trim()) throw Error("ResizableHandle requires a nonempty label");
159
+ let f = () => {
160
+ let e = i.sizes();
161
+ if (!Number.isSafeInteger(a.index) || a.index < 0 || a.index >= e.length - 1) throw Error("ResizableHandle index must address the preceding panel");
162
+ return Math.round(e.slice(0, a.index + 1).reduce((e, t) => e + t, 0) * 100);
163
+ };
164
+ return t(l.Handle, n(o, () => ({
165
+ ...a.ref === void 0 ? {} : { ref: a.ref },
166
+ ...a.style === void 0 ? {} : { style: a.style },
167
+ ...a.disabled === void 0 ? {} : { disabled: a.disabled },
168
+ ...a.onBlur === void 0 ? {} : { onBlur: a.onBlur },
169
+ ...a.onFocus === void 0 ? {} : { onFocus: a.onFocus },
170
+ ...a.onKeyDown === void 0 ? {} : { onKeyDown: a.onKeyDown },
171
+ ...a.onKeyUp === void 0 ? {} : { onKeyUp: a.onKeyUp },
172
+ ...a.onMouseEnter === void 0 ? {} : { onMouseEnter: a.onMouseEnter },
173
+ ...a.onMouseLeave === void 0 ? {} : { onMouseLeave: a.onMouseLeave },
174
+ ...a.onPointerDown === void 0 ? {} : { onPointerDown: a.onPointerDown }
175
+ }), {
176
+ get class() {
177
+ return e("sheen-resizable-handle", a.class);
178
+ },
179
+ get "aria-label"() {
180
+ return a.label;
181
+ },
182
+ "aria-valuemin": 0,
183
+ "aria-valuemax": 100,
184
+ get "aria-valuenow"() {
185
+ return f();
186
+ },
187
+ get "aria-valuetext"() {
188
+ return `${f()}%`;
189
+ },
190
+ get children() {
191
+ return u();
192
+ }
193
+ }));
194
+ }
195
+ //#endregion
196
+ export { h as Resizable, _ as ResizableHandle, g as ResizablePanel };
@@ -0,0 +1,6 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface ScrollAreaProps extends JSX.HTMLAttributes<HTMLDivElement> {
3
+ label: string;
4
+ orientation?: "vertical" | "horizontal" | "both";
5
+ }
6
+ export declare function ScrollArea(props: ScrollAreaProps): JSX.Element;
@@ -0,0 +1,178 @@
1
+ import { cn as e } from "../utils/cn.js";
2
+ import { createComponent as t, delegateEvents as n, effect as r, insert as i, mergeProps as a, setAttribute as o, setStyleProperty as s, spread as c, template as l, use as u } from "solid-js/web";
3
+ import { Show as d, createEffect as f, createMemo as p, createSignal as m, onCleanup as h, onMount as g, splitProps as _ } from "solid-js";
4
+ //#region src/primitives/ScrollArea.tsx
5
+ var v = /*#__PURE__*/ l("<div aria-hidden=true class=sheen-scroll-track data-axis=y><div class=sheen-scroll-thumb>"), y = /*#__PURE__*/ l("<div aria-hidden=true class=sheen-scroll-track data-axis=x><div class=sheen-scroll-thumb>"), b = /*#__PURE__*/ l("<div class=sheen-scroll-frame><div role=region><div class=sheen-scroll-content>");
6
+ function x(n) {
7
+ let [l, x] = _(n, [
8
+ "label",
9
+ "orientation",
10
+ "class",
11
+ "onScroll",
12
+ "ref",
13
+ "children"
14
+ ]), S, C, w, [T, E] = m({
15
+ x: 0,
16
+ y: 0,
17
+ width: 0,
18
+ height: 0,
19
+ scrollWidth: 0,
20
+ scrollHeight: 0,
21
+ left: 0,
22
+ top: 0,
23
+ rtl: !1
24
+ }), [D, O] = m(!1), k = () => {
25
+ w = void 0, S && E({
26
+ x: S.offsetLeft + S.clientLeft,
27
+ y: S.offsetTop + S.clientTop,
28
+ width: S.clientWidth,
29
+ height: S.clientHeight,
30
+ scrollWidth: S.scrollWidth,
31
+ scrollHeight: S.scrollHeight,
32
+ left: Math.abs(S.scrollLeft),
33
+ top: S.scrollTop,
34
+ rtl: S.matches(":dir(rtl)")
35
+ });
36
+ }, A = () => {
37
+ w === void 0 && (w = S?.ownerDocument.defaultView?.requestAnimationFrame(k));
38
+ }, j = () => l.orientation !== "horizontal" && T().scrollHeight > T().height, M = () => (l.orientation === "horizontal" || l.orientation === "both") && T().scrollWidth > T().width, N = (e) => {
39
+ let t = T(), n = e === "y" ? t.height : t.width, r = e === "y" ? t.scrollHeight : t.scrollWidth, i = Math.max(0, n - ((e === "y" ? M() : j()) ? 8 : 0)), a = Math.min(i, Math.max(20, r > 0 ? n / r * i : i)), o = Math.max(0, r - n), s = e === "y" ? t.top : t.left, c = o > 0 ? Math.min(1, Math.max(0, s / o)) : 0;
40
+ return {
41
+ length: i,
42
+ size: a,
43
+ maximum: o,
44
+ travel: i - a,
45
+ offset: (e === "x" && t.rtl ? 1 - c : c) * (i - a)
46
+ };
47
+ }, P = (e, t, n) => {
48
+ let r = t.getBoundingClientRect(), i = n === "y" ? r.height : r.width, a = n === "y" ? t.clientHeight : t.clientWidth, o = n === "y" ? e.clientY - r.top : e.clientX - r.left;
49
+ return i > 0 ? o * a / i : 0;
50
+ }, F, I = (e, t) => {
51
+ if (!F || !S || e.pointerId !== F.pointer) return;
52
+ let n = N(F.axis), r = P(e, t, F.axis), i = n.travel > 0 ? Math.min(1, Math.max(0, (r - F.grab) / n.travel)) : 0;
53
+ F.axis === "x" && T().rtl && (i = 1 - i), F.axis === "y" ? S.scrollTop = i * n.maximum : S.scrollLeft = i * n.maximum * (T().rtl ? -1 : 1), A();
54
+ }, L = (e, t) => {
55
+ if (t.button !== 0 || !S || F) return;
56
+ t.preventDefault();
57
+ let n = N(e), r = P(t, t.currentTarget, e);
58
+ F = {
59
+ pointer: t.pointerId,
60
+ axis: e,
61
+ grab: t.target === t.currentTarget ? n.size / 2 : r - n.offset,
62
+ track: t.currentTarget
63
+ }, t.currentTarget.setPointerCapture(t.pointerId), O(!0), I(t, t.currentTarget);
64
+ }, R = () => {
65
+ let e = F;
66
+ F = void 0, O(!1), e?.track.hasPointerCapture(e.pointer) && e.track.releasePointerCapture(e.pointer);
67
+ }, z = (e) => {
68
+ e.pointerId === F?.pointer && R();
69
+ };
70
+ f(() => {
71
+ D() && F && !(F.axis === "y" ? j() : M()) && R();
72
+ }), g(() => {
73
+ k();
74
+ let e = new ResizeObserver(A);
75
+ S && e.observe(S), S?.parentElement && e.observe(S.parentElement), C && e.observe(C);
76
+ let t = new MutationObserver(A), n = S;
77
+ for (; n;) t.observe(n, {
78
+ attributes: !0,
79
+ attributeFilter: [
80
+ "dir",
81
+ "data-sheen-direction",
82
+ "data-orientation",
83
+ "class",
84
+ "style"
85
+ ]
86
+ }), n = n.parentElement;
87
+ h(() => {
88
+ e.disconnect(), t.disconnect();
89
+ });
90
+ });
91
+ let [B, V] = m(!1), H;
92
+ h(() => {
93
+ R(), H !== void 0 && clearTimeout(H), w !== void 0 && S?.ownerDocument.defaultView?.cancelAnimationFrame(w);
94
+ });
95
+ let U = p(() => {
96
+ if (!l.label.trim()) throw Error("ScrollArea requires a nonempty accessible label");
97
+ return l.label;
98
+ }), W = (e) => {
99
+ A(), V(!0), H !== void 0 && clearTimeout(H), H = setTimeout(() => {
100
+ H = void 0, V(!1);
101
+ }, 800);
102
+ let t = l.onScroll;
103
+ typeof t == "function" ? t(e) : t && t[0](t[1], e);
104
+ };
105
+ return (() => {
106
+ var n = b(), f = n.firstChild, p = f.firstChild;
107
+ u((e) => {
108
+ S = e, typeof l.ref == "function" && l.ref(e);
109
+ }, f), c(f, a(x, {
110
+ get "aria-label"() {
111
+ return U();
112
+ },
113
+ get tabIndex() {
114
+ return x.tabIndex ?? 0;
115
+ },
116
+ get class() {
117
+ return e("sheen-scroll-area", l.class);
118
+ },
119
+ get "data-orientation"() {
120
+ return l.orientation ?? "vertical";
121
+ },
122
+ get "data-scrolling"() {
123
+ return B() || void 0;
124
+ },
125
+ onScroll: W
126
+ }), !1, !0);
127
+ var m = C;
128
+ return typeof m == "function" ? u(m, p) : C = p, i(p, () => l.children), i(n, t(d, {
129
+ get when() {
130
+ return j();
131
+ },
132
+ get children() {
133
+ var e = v(), t = e.firstChild;
134
+ return e.addEventListener("lostpointercapture", z), e.addEventListener("pointercancel", z), e.$$pointerup = z, e.$$pointermove = (e) => I(e, e.currentTarget), e.$$pointerdown = (e) => L("y", e), r((n) => {
135
+ var r = `${T().x + (T().rtl ? 0 : T().width - 8)}px`, i = `${T().y}px`, a = `${N("y").length}px`, o = `${N("y").size}px`, c = `translateY(${N("y").offset}px)`;
136
+ return r !== n.e && s(e, "left", n.e = r), i !== n.t && s(e, "top", n.t = i), a !== n.a && s(e, "height", n.a = a), o !== n.o && s(t, "height", n.o = o), c !== n.i && s(t, "transform", n.i = c), n;
137
+ }, {
138
+ e: void 0,
139
+ t: void 0,
140
+ a: void 0,
141
+ o: void 0,
142
+ i: void 0
143
+ }), e;
144
+ }
145
+ }), null), i(n, t(d, {
146
+ get when() {
147
+ return M();
148
+ },
149
+ get children() {
150
+ var e = y(), t = e.firstChild;
151
+ return e.addEventListener("lostpointercapture", z), e.addEventListener("pointercancel", z), e.$$pointerup = z, e.$$pointermove = (e) => I(e, e.currentTarget), e.$$pointerdown = (e) => L("x", e), r((n) => {
152
+ var r = `${T().x + (T().rtl && j() ? 8 : 0)}px`, i = `${T().y + T().height - 8}px`, a = `${N("x").length}px`, o = `${N("x").size}px`, c = `translateX(${N("x").offset}px)`;
153
+ return r !== n.e && s(e, "left", n.e = r), i !== n.t && s(e, "top", n.t = i), a !== n.a && s(e, "width", n.a = a), o !== n.o && s(t, "width", n.o = o), c !== n.i && s(t, "transform", n.i = c), n;
154
+ }, {
155
+ e: void 0,
156
+ t: void 0,
157
+ a: void 0,
158
+ o: void 0,
159
+ i: void 0
160
+ }), e;
161
+ }
162
+ }), null), r((e) => {
163
+ var t = x.dir, r = B() || D() || void 0, i = j() && M() || void 0;
164
+ return t !== e.e && o(n, "dir", e.e = t), r !== e.t && o(n, "data-scrolling", e.t = r), i !== e.a && o(n, "data-both", e.a = i), e;
165
+ }, {
166
+ e: void 0,
167
+ t: void 0,
168
+ a: void 0
169
+ }), n;
170
+ })();
171
+ }
172
+ n([
173
+ "pointerdown",
174
+ "pointermove",
175
+ "pointerup"
176
+ ]);
177
+ //#endregion
178
+ export { x as ScrollArea };
@@ -0,0 +1,12 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { InputProps } from "./Input.tsx";
3
+ import type { ShortcutAction } from "../utils/shortcut-registry.ts";
4
+ export interface SearchInputProps extends Omit<InputProps, "type" | "value"> {
5
+ value?: string;
6
+ defaultValue?: string;
7
+ onValueChange?: (value: string) => void;
8
+ clearLabel?: string;
9
+ /** Optional registry-backed shortcut that focuses the search input. */
10
+ shortcut?: ShortcutAction | undefined;
11
+ }
12
+ export declare function SearchInput(props: SearchInputProps): JSX.Element;
@@ -0,0 +1,89 @@
1
+ import { useTheme as e } from "../theme/ThemeProvider.js";
2
+ import { cn as t } from "../utils/cn.js";
3
+ import { useShortcutAction as n } from "./ShortcutProvider.js";
4
+ import { Button as r } from "./Button.js";
5
+ import { InputGroup as i } from "./InputGroup.js";
6
+ import { createComponent as a, mergeProps as o, template as s } from "solid-js/web";
7
+ import { createSignal as c, onCleanup as l, onMount as u, splitProps as d } from "solid-js";
8
+ //#region src/primitives/SearchInput.tsx
9
+ var f = /*#__PURE__*/ s("<span class=sheen-search-input-indicator aria-hidden=true>");
10
+ function p(s) {
11
+ let p = e(), [m, h] = d(s, [
12
+ "value",
13
+ "defaultValue",
14
+ "onValueChange",
15
+ "clearLabel",
16
+ "shortcut",
17
+ "onInput",
18
+ "onCompositionStart",
19
+ "onCompositionEnd",
20
+ "ref",
21
+ "class"
22
+ ]), g = m.defaultValue ?? "", [_, v] = c(g), y = () => m.value ?? _(), [b, x] = c(), S = () => b() ?? y(), C, w = (e) => {
23
+ m.value === void 0 && v(e), m.onValueChange?.(e);
24
+ }, T = n(() => m.shortcut, () => C?.focus({ preventScroll: !0 }));
25
+ return u(() => {
26
+ let e = C;
27
+ if (!e) return;
28
+ e.value !== y() && (w(e.value), e.value !== y() && (e.value = y()));
29
+ let t = e.ownerDocument.defaultView;
30
+ if (!t) return;
31
+ let n = !1, r = /* @__PURE__ */ new Set(), i = (i) => {
32
+ if (i.target !== e.form) return;
33
+ let a = t.setTimeout(() => {
34
+ r.delete(a), !(n || i.defaultPrevented) && (x(void 0), m.value === void 0 && _() !== g && w(g), e.value !== y() && (e.value = y()));
35
+ }, 0);
36
+ r.add(a);
37
+ };
38
+ e.ownerDocument.addEventListener("reset", i, !0), l(() => {
39
+ n = !0;
40
+ for (let e of r) t.clearTimeout(e);
41
+ r.clear(), e.ownerDocument.removeEventListener("reset", i, !0);
42
+ });
43
+ }), a(i, o(h, {
44
+ type: "search",
45
+ get class() {
46
+ return t("sheen-search-input", m.class);
47
+ },
48
+ get "data-sheen-shortcut"() {
49
+ return T()?.displayKeys;
50
+ },
51
+ get value() {
52
+ return S();
53
+ },
54
+ onInput: (e) => {
55
+ (e.isComposing || b() !== void 0) && x(e.currentTarget.value), w(e.currentTarget.value);
56
+ let t = m.onInput;
57
+ typeof t == "function" ? t(e) : t && t[0](t[1], e), b() === void 0 && !e.isComposing && e.currentTarget.value !== y() && (e.currentTarget.value = y());
58
+ },
59
+ onCompositionStart: (e) => {
60
+ x(e.currentTarget.value);
61
+ let t = m.onCompositionStart;
62
+ typeof t == "function" ? t(e) : t && t[0](t[1], e);
63
+ },
64
+ onCompositionEnd: (e) => {
65
+ let t = m.onCompositionEnd;
66
+ typeof t == "function" ? t(e) : t && t[0](t[1], e), x(void 0), e.currentTarget.value !== y() && (e.currentTarget.value = y());
67
+ },
68
+ ref: (e) => {
69
+ C = e, typeof m.ref == "function" && m.ref(e);
70
+ },
71
+ get endContent() {
72
+ return [a(r, {
73
+ class: "sheen-search-input-clear",
74
+ type: "button",
75
+ get disabled() {
76
+ return h.disabled || h.readOnly || h.readonly || b() !== void 0 || !y();
77
+ },
78
+ onClick: () => {
79
+ h.disabled || h.readOnly || h.readonly || b() !== void 0 || !y() || (w(""), C && C.value !== y() && (C.value = y()), C?.focus());
80
+ },
81
+ get children() {
82
+ return m.clearLabel ?? p.messages().clearSearch;
83
+ }
84
+ }), f()];
85
+ }
86
+ }));
87
+ }
88
+ //#endregion
89
+ export { p as SearchInput };
@@ -0,0 +1,25 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface SegmentedControlOption {
3
+ readonly value: string;
4
+ readonly label: string;
5
+ readonly disabled?: boolean;
6
+ }
7
+ export interface SegmentedControlProps extends Omit<JSX.FieldsetHTMLAttributes<HTMLFieldSetElement>, "children" | "onChange" | "id" | "ref" | "name"> {
8
+ id?: string;
9
+ ref?: HTMLFieldSetElement | ((element: HTMLFieldSetElement) => void);
10
+ name: string;
11
+ label: string;
12
+ options: readonly SegmentedControlOption[];
13
+ value?: string | null;
14
+ defaultValue?: string | null;
15
+ onValueChange?: (value: string | null) => void;
16
+ description?: string;
17
+ error?: string;
18
+ readOnly?: boolean;
19
+ required?: boolean;
20
+ orientation?: "horizontal" | "vertical";
21
+ size?: "sm" | "md";
22
+ overflowBehavior?: "scroll" | "wrap";
23
+ }
24
+ /** A compact, native-radio single-selection control with roving focus. */
25
+ export declare function SegmentedControl(props: SegmentedControlProps): JSX.Element;