@gemologic/sheen 0.2.1 → 0.4.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 (226) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/ai.d.ts +8 -0
  4. package/dist/ai.js +5 -0
  5. package/dist/core.d.ts +11 -4
  6. package/dist/core.js +32 -28
  7. package/dist/formisch.js +1 -2
  8. package/dist/forms.d.ts +2 -0
  9. package/dist/forms.js +16 -15
  10. package/dist/index.d.ts +27 -5
  11. package/dist/index.js +87 -76
  12. package/dist/layout/Layout.js +1 -2
  13. package/dist/metadata.js +1 -2
  14. package/dist/navigation.d.ts +2 -1
  15. package/dist/navigation.js +16 -16
  16. package/dist/overlays.d.ts +2 -0
  17. package/dist/overlays.js +9 -8
  18. package/dist/primitives/Accordion.js +9 -9
  19. package/dist/primitives/ActivityTimeline.js +57 -49
  20. package/dist/primitives/AlertDialog.js +1 -2
  21. package/dist/primitives/Avatar.js +16 -17
  22. package/dist/primitives/Board.d.ts +39 -0
  23. package/dist/primitives/Board.js +471 -0
  24. package/dist/primitives/Breadcrumb.js +1 -2
  25. package/dist/primitives/Button.js +38 -27
  26. package/dist/primitives/ButtonGroup.js +1 -2
  27. package/dist/primitives/Checkbox.d.ts +16 -2
  28. package/dist/primitives/Checkbox.js +46 -36
  29. package/dist/primitives/CheckboxGroup.js +11 -12
  30. package/dist/primitives/Collapsible.js +6 -6
  31. package/dist/primitives/Combobox.js +203 -201
  32. package/dist/primitives/CommandPalette.d.ts +4 -0
  33. package/dist/primitives/CommandPalette.js +138 -116
  34. package/dist/primitives/ConfirmDialog.js +5 -6
  35. package/dist/primitives/ContextMenu.js +7 -8
  36. package/dist/primitives/Conversation.d.ts +17 -0
  37. package/dist/primitives/Conversation.js +107 -0
  38. package/dist/primitives/DescriptionList.js +1 -2
  39. package/dist/primitives/Dialog.js +101 -68
  40. package/dist/primitives/Drawer.js +12 -13
  41. package/dist/primitives/DropdownMenu.js +163 -157
  42. package/dist/primitives/EditableTextField.js +3 -8
  43. package/dist/primitives/EmptyState.js +1 -2
  44. package/dist/primitives/Field.js +1 -2
  45. package/dist/primitives/FileDropzone.js +19 -18
  46. package/dist/primitives/Form.d.ts +23 -0
  47. package/dist/primitives/Form.js +76 -0
  48. package/dist/primitives/Glyph.d.ts +40 -0
  49. package/dist/primitives/Glyph.js +65 -0
  50. package/dist/primitives/IconButton.js +5 -6
  51. package/dist/primitives/Input.js +1 -2
  52. package/dist/primitives/InputGroup.js +8 -9
  53. package/dist/primitives/Link.d.ts +9 -1
  54. package/dist/primitives/Link.js +23 -17
  55. package/dist/primitives/LinkTooltip.js +6 -7
  56. package/dist/primitives/List.d.ts +34 -0
  57. package/dist/primitives/List.js +135 -0
  58. package/dist/primitives/Message.d.ts +13 -0
  59. package/dist/primitives/Message.js +75 -0
  60. package/dist/primitives/NavList.js +15 -16
  61. package/dist/primitives/Notice.d.ts +15 -1
  62. package/dist/primitives/Notice.js +91 -43
  63. package/dist/primitives/NumberField.js +81 -81
  64. package/dist/primitives/NumberText.d.ts +4 -0
  65. package/dist/primitives/NumberText.js +50 -25
  66. package/dist/primitives/Pagination.js +81 -60
  67. package/dist/primitives/Popover.d.ts +1 -0
  68. package/dist/primitives/Popover.js +65 -57
  69. package/dist/primitives/Progress.js +1 -2
  70. package/dist/primitives/PromptInput.d.ts +23 -0
  71. package/dist/primitives/PromptInput.js +135 -0
  72. package/dist/primitives/RadioGroup.js +12 -17
  73. package/dist/primitives/Resizable.js +1 -2
  74. package/dist/primitives/ScrollArea.js +1 -2
  75. package/dist/primitives/SearchInput.js +45 -38
  76. package/dist/primitives/SegmentedControl.d.ts +2 -0
  77. package/dist/primitives/SegmentedControl.js +92 -78
  78. package/dist/primitives/Select.js +105 -100
  79. package/dist/primitives/Separator.js +1 -2
  80. package/dist/primitives/ShortcutPending.js +11 -12
  81. package/dist/primitives/ShortcutProvider.d.ts +5 -0
  82. package/dist/primitives/ShortcutProvider.js +71 -65
  83. package/dist/primitives/ShortcutScope.js +8 -9
  84. package/dist/primitives/ShortcutSheet.js +30 -24
  85. package/dist/primitives/Skeleton.js +1 -2
  86. package/dist/primitives/Slider.js +1 -2
  87. package/dist/primitives/SortableList.d.ts +19 -0
  88. package/dist/primitives/SortableList.js +235 -0
  89. package/dist/primitives/Spinner.js +1 -2
  90. package/dist/primitives/Status.js +14 -14
  91. package/dist/primitives/Stepper.js +54 -52
  92. package/dist/primitives/StreamingText.d.ts +12 -0
  93. package/dist/primitives/StreamingText.js +42 -0
  94. package/dist/primitives/Surface.js +1 -2
  95. package/dist/primitives/Switch.d.ts +2 -2
  96. package/dist/primitives/Switch.js +1 -2
  97. package/dist/primitives/Table.js +1 -2
  98. package/dist/primitives/Tabs.js +20 -17
  99. package/dist/primitives/TagInput.js +6 -9
  100. package/dist/primitives/Textarea.js +37 -63
  101. package/dist/primitives/Toast.js +42 -41
  102. package/dist/primitives/Toaster.js +27 -28
  103. package/dist/primitives/Tooltip.js +32 -32
  104. package/dist/primitives/TooltipTrigger.d.ts +18 -0
  105. package/dist/primitives/TooltipTrigger.js +76 -0
  106. package/dist/primitives/Tree.js +1 -2
  107. package/dist/primitives/Typography.d.ts +6 -2
  108. package/dist/primitives/Typography.js +20 -12
  109. package/dist/primitives/boolean-input-state.js +3 -8
  110. package/dist/primitives/button-variants.js +2 -3
  111. package/dist/primitives/choice-options.js +1 -2
  112. package/dist/primitives/create-confirm.js +1 -2
  113. package/dist/primitives/create-toaster.js +1 -2
  114. package/dist/primitives/link-focus.js +1 -2
  115. package/dist/primitives/menu-focus.js +1 -2
  116. package/dist/primitives/sortable-core.d.ts +70 -0
  117. package/dist/primitives/sortable-core.js +109 -0
  118. package/dist/primitives/sortable-drag.d.ts +29 -0
  119. package/dist/primitives/sortable-drag.js +50 -0
  120. package/dist/primitives/tooltip-layer.js +26 -27
  121. package/dist/sortable.d.ts +6 -0
  122. package/dist/sortable.js +4 -0
  123. package/dist/theme/ThemeProvider.d.ts +6 -1
  124. package/dist/theme/ThemeProvider.js +65 -58
  125. package/dist/theme/intl.js +1 -2
  126. package/dist/theme/keyboard-script.js +1 -2
  127. package/dist/theme/layers.js +1 -2
  128. package/dist/theme/messages.d.ts +26 -0
  129. package/dist/theme/messages.js +9 -2
  130. package/dist/theme/number-format-cache.js +1 -2
  131. package/dist/theme/script.d.ts +1 -0
  132. package/dist/theme/script.js +3 -3
  133. package/dist/theme/state.d.ts +4 -4
  134. package/dist/theme/state.js +12 -13
  135. package/dist/utils/auto-resize.d.ts +6 -0
  136. package/dist/utils/auto-resize.js +31 -0
  137. package/dist/utils/browser-status.js +1 -2
  138. package/dist/utils/change-motion.d.ts +8 -0
  139. package/dist/utils/change-motion.js +19 -0
  140. package/dist/utils/cn.js +1 -2
  141. package/dist/utils/media-query.d.ts +10 -0
  142. package/dist/utils/media-query.js +16 -0
  143. package/dist/utils/optimistic.js +1 -2
  144. package/dist/utils/shortcut-platform.js +1 -2
  145. package/dist/utils/shortcut-registry.d.ts +5 -0
  146. package/dist/utils/shortcut-registry.js +61 -51
  147. package/dist/vite.js +3 -4
  148. package/package.json +23 -5
  149. package/src/ai.ts +8 -0
  150. package/src/core.ts +11 -4
  151. package/src/forms.ts +2 -0
  152. package/src/index.ts +27 -5
  153. package/src/navigation.ts +2 -1
  154. package/src/overlays.ts +2 -0
  155. package/src/primitives/Accordion.tsx +1 -1
  156. package/src/primitives/ActivityTimeline.tsx +12 -7
  157. package/src/primitives/Board.tsx +406 -0
  158. package/src/primitives/Button.tsx +15 -4
  159. package/src/primitives/Checkbox.tsx +14 -7
  160. package/src/primitives/Collapsible.tsx +1 -1
  161. package/src/primitives/Combobox.tsx +2 -1
  162. package/src/primitives/CommandPalette.tsx +13 -4
  163. package/src/primitives/Conversation.tsx +108 -0
  164. package/src/primitives/Dialog.tsx +5 -1
  165. package/src/primitives/DropdownMenu.tsx +12 -6
  166. package/src/primitives/FileDropzone.tsx +2 -2
  167. package/src/primitives/Form.tsx +58 -0
  168. package/src/primitives/Glyph.tsx +55 -0
  169. package/src/primitives/Link.tsx +15 -6
  170. package/src/primitives/List.tsx +68 -0
  171. package/src/primitives/Message.tsx +40 -0
  172. package/src/primitives/Notice.tsx +45 -12
  173. package/src/primitives/NumberField.tsx +3 -2
  174. package/src/primitives/NumberText.tsx +31 -4
  175. package/src/primitives/Pagination.tsx +6 -5
  176. package/src/primitives/Popover.tsx +7 -5
  177. package/src/primitives/PromptInput.tsx +116 -0
  178. package/src/primitives/SearchInput.tsx +4 -3
  179. package/src/primitives/SegmentedControl.tsx +29 -4
  180. package/src/primitives/Select.tsx +3 -2
  181. package/src/primitives/ShortcutProvider.tsx +14 -1
  182. package/src/primitives/ShortcutSheet.tsx +1 -1
  183. package/src/primitives/SortableList.tsx +208 -0
  184. package/src/primitives/Status.tsx +1 -1
  185. package/src/primitives/Stepper.tsx +7 -7
  186. package/src/primitives/StreamingText.tsx +32 -0
  187. package/src/primitives/Switch.tsx +2 -2
  188. package/src/primitives/Tabs.tsx +2 -1
  189. package/src/primitives/TagInput.tsx +1 -1
  190. package/src/primitives/Textarea.tsx +3 -47
  191. package/src/primitives/Toast.tsx +2 -1
  192. package/src/primitives/Tooltip.tsx +4 -2
  193. package/src/primitives/TooltipTrigger.tsx +60 -0
  194. package/src/primitives/Typography.tsx +11 -2
  195. package/src/primitives/button-variants.ts +1 -1
  196. package/src/primitives/sortable-core.ts +139 -0
  197. package/src/primitives/sortable-drag.ts +75 -0
  198. package/src/sortable.ts +6 -0
  199. package/src/styles/ai.css +57 -0
  200. package/src/styles/core.css +321 -0
  201. package/src/styles/forms.css +263 -0
  202. package/src/styles/navigation.css +137 -0
  203. package/src/styles/overlays.css +107 -0
  204. package/src/styles/sortable.css +87 -0
  205. package/src/styles.css +5 -658
  206. package/src/theme/ThemeProvider.tsx +20 -8
  207. package/src/theme/messages.ts +20 -1
  208. package/src/theme/script.ts +2 -2
  209. package/src/theme/state.ts +5 -5
  210. package/src/utils/auto-resize.ts +58 -0
  211. package/src/utils/change-motion.ts +28 -0
  212. package/src/utils/media-query.ts +26 -0
  213. package/src/utils/shortcut-registry.ts +19 -2
  214. package/src/vite.ts +3 -3
  215. package/vendor/integrity.json +13 -13
  216. package/vendor/kobalte-core/chunk/3D6FM2PJ.js +7 -1
  217. package/vendor/kobalte-core/chunk/G3KI2B4X.js +2 -1
  218. package/vendor/kobalte-core/chunk/KEL2LLJM.jsx +2 -1
  219. package/vendor/kobalte-core/chunk/RFN6X5VH.jsx +7 -1
  220. package/vendor/origins.json +4 -4
  221. package/vendor/solid-web/dev.cjs +21 -17
  222. package/vendor/solid-web/dev.js +21 -17
  223. package/vendor/solid-web/server.cjs +1 -1
  224. package/vendor/solid-web/server.js +1 -1
  225. package/vendor/solid-web/web.cjs +21 -17
  226. package/vendor/solid-web/web.js +21 -17
@@ -1,26 +1,27 @@
1
- import { useTheme as e } from "../theme/ThemeProvider.js";
2
- import { cn as t } from "../utils/cn.js";
3
- import { delegateEvents as n, effect as r, insert as i, memo as a, mergeProps as o, setAttribute as s, spread as c, template as l, use as u } from "solid-js/web";
4
- import { createSignal as d, createUniqueId as f, onMount as p, splitProps as m } from "solid-js";
5
- //#region src/primitives/NumberField.tsx
6
- var h = /*#__PURE__*/ l("<div><label class=sheen-field-label></label><div class=sheen-number-field-control><input class=\"sheen-input sheen-number-field-input\"type=text role=spinbutton inputmode=decimal><div class=sheen-number-field-steps><button type=button class=sheen-number-field-step><span aria-hidden=true>−</span></button><button type=button class=sheen-number-field-step><span aria-hidden=true>+"), g = /*#__PURE__*/ l("<span aria-hidden=true> *"), _ = /*#__PURE__*/ l("<input type=hidden>"), v = /*#__PURE__*/ l("<p class=sheen-field-description>"), y = /*#__PURE__*/ l("<p class=sheen-field-error>");
7
- function b(e, t, n, r) {
1
+ import { Glyph as e } from "./Glyph.js";
2
+ import { useTheme as t } from "../theme/ThemeProvider.js";
3
+ import { cn as n } from "../utils/cn.js";
4
+ import { createComponent as r, delegateEvents as i, effect as a, insert as o, memo as s, mergeProps as c, setAttribute as l, spread as u, template as d, use as f } from "solid-js/web";
5
+ import { createSignal as p, createUniqueId as m, onMount as h, splitProps as g } from "solid-js";
6
+ // src/primitives/NumberField.tsx
7
+ var _ = /*#__PURE__*/ d("<div><label class=sheen-field-label></label><div class=sheen-number-field-control><input class=\"sheen-input sheen-number-field-input\"type=text role=spinbutton inputmode=decimal><div class=sheen-number-field-steps><button type=button class=sheen-number-field-step></button><button type=button class=sheen-number-field-step>"), v = /*#__PURE__*/ d("<span aria-hidden=true> *"), y = /*#__PURE__*/ d("<input type=hidden>"), b = /*#__PURE__*/ d("<p class=sheen-field-description>"), x = /*#__PURE__*/ d("<p class=sheen-field-error>");
8
+ function S(e, t, n, r) {
8
9
  if (!Number.isFinite(e) || !Number.isFinite(t) || e >= t) throw Error("NumberField min and max must be finite and increasing");
9
10
  if (!Number.isFinite(n) || n <= 0) throw Error("NumberField step must be positive and finite");
10
11
  if (r !== void 0 && (!Number.isFinite(r) || r <= 0)) throw Error("NumberField largeStep must be positive and finite");
11
12
  }
12
- function x(e, t) {
13
+ function C(e, t) {
13
14
  return e.replace("{label}", t);
14
15
  }
15
- function S(e) {
16
+ function w(e) {
16
17
  let t = e.toString().match(/(?:\.(\d+))?(?:e-([0-9]+))?$/iu);
17
18
  return Math.min(12, Math.max(t?.[1]?.length ?? 0, Number(t?.[2] ?? 0)));
18
19
  }
19
- function C(e, t, n, r, i) {
20
- let a = 10 ** Math.max(S(i), S(n)), o = Math.round((e + t) * a) / a;
20
+ function T(e, t, n, r, i) {
21
+ let a = 10 ** Math.max(w(i), w(n)), o = Math.round((e + t) * a) / a;
21
22
  return Math.min(r, Math.max(n, o));
22
23
  }
23
- function w(e, t) {
24
+ function E(e, t) {
24
25
  let n = new Intl.NumberFormat(e, t), r = new Intl.NumberFormat(e, { useGrouping: !1 }), i = Array.from({ length: 10 }, (e, t) => r.format(t)), a = [], o = ".", s = "-", c = "+";
25
26
  for (let e of n.formatToParts(-12345.6)) e.type === "decimal" ? o = e.value : e.type === "minusSign" ? s = e.value : e.type === "plusSign" ? c = e.value : e.type !== "integer" && e.type !== "fraction" && a.push(e.value);
26
27
  let l = t?.style === "percent";
@@ -36,8 +37,8 @@ function w(e, t) {
36
37
  return Number.isFinite(n) ? n / (l ? 100 : 1) : void 0;
37
38
  };
38
39
  }
39
- function T(n) {
40
- let [l, S] = m(n, [
40
+ function D(i) {
41
+ let [d, w] = g(i, [
41
42
  "id",
42
43
  "class",
43
44
  "label",
@@ -57,95 +58,95 @@ function T(n) {
57
58
  "readOnly",
58
59
  "required",
59
60
  "inputRef"
60
- ]), T = e(), E = f(), D = () => l.id ?? E, O = () => `${D()}-input`, k = () => `${D()}-label`, A = () => `${D()}-description`, j = () => `${D()}-error`, M = () => [l.description ? A() : void 0, l.error ? j() : void 0].filter((e) => e !== void 0).join(" ") || void 0, N = () => l.min ?? -(2 ** 53 - 1), P = () => l.max ?? 2 ** 53 - 1, F = () => l.step ?? 1, I = () => new Intl.NumberFormat(T.state().locale, l.formatOptions), L = () => w(T.state().locale, l.formatOptions), [R, z] = d(l.defaultValue ?? null), B = () => l.value === void 0 ? R() : l.value, V = (e) => e === null ? "" : I().format(e), [H, U] = d(V(B())), [W, G] = d(!1), K, q;
61
+ ]), D = t(), O = m(), k = () => d.id ?? O, A = () => `${k()}-input`, j = () => `${k()}-label`, M = () => `${k()}-description`, N = () => `${k()}-error`, P = () => [d.description ? M() : void 0, d.error ? N() : void 0].filter((e) => e !== void 0).join(" ") || void 0, F = () => d.min ?? -(2 ** 53 - 1), I = () => d.max ?? 2 ** 53 - 1, L = () => d.step ?? 1, R = () => new Intl.NumberFormat(D.state().locale, d.formatOptions), z = () => E(D.state().locale, d.formatOptions), [B, V] = p(d.defaultValue ?? null), H = () => d.value === void 0 ? B() : d.value, U = (e) => e === null ? "" : R().format(e), [W, G] = p(U(H())), [K, q] = p(!1), J, Y;
61
62
  (() => {
62
- if (!l.label.trim()) throw Error("NumberField label must be nonempty");
63
- b(N(), P(), F(), l.largeStep);
64
- for (let [e, t] of [["value", l.value], ["defaultValue", l.defaultValue]]) if (t != null && (!Number.isFinite(t) || t < N() || t > P())) throw Error(`NumberField ${e} must be finite and within range`);
63
+ if (!d.label.trim()) throw Error("NumberField label must be nonempty");
64
+ S(F(), I(), L(), d.largeStep);
65
+ for (let [e, t] of [["value", d.value], ["defaultValue", d.defaultValue]]) if (t != null && (!Number.isFinite(t) || t < F() || t > I())) throw Error(`NumberField ${e} must be finite and within range`);
65
66
  })();
66
- let J = () => W() ? H() : V(B()), Y = (e, t) => {
67
- l.value === void 0 && z(e), l.onValueChange?.(e), t && U(V(B()));
68
- }, X = (e) => e === null ? !l.required : e !== void 0 && e >= N() && e <= P(), Z = () => {
69
- let e = (q ?? L())(H());
70
- X(e) ? Y(e, !0) : U(V(B()));
71
- }, Q = (e) => {
72
- if (l.disabled || l.readOnly) return;
73
- let t = B() ?? Math.min(P(), Math.max(N(), 0));
74
- Y(C(t, e, N(), P(), F()), !0);
67
+ let ee = () => K() ? W() : U(H()), X = (e, t) => {
68
+ d.value === void 0 && V(e), d.onValueChange?.(e), t && G(U(H()));
69
+ }, Z = (e) => e === null ? !d.required : e !== void 0 && e >= F() && e <= I(), Q = () => {
70
+ let e = (Y ?? z())(W());
71
+ Z(e) ? X(e, !0) : G(U(H()));
75
72
  }, $ = (e) => {
76
- K = e, typeof l.inputRef == "function" && l.inputRef(e);
73
+ if (d.disabled || d.readOnly) return;
74
+ let t = H() ?? Math.min(I(), Math.max(F(), 0));
75
+ X(T(t, e, F(), I(), L()), !0);
76
+ }, te = (e) => {
77
+ J = e, typeof d.inputRef == "function" && d.inputRef(e);
77
78
  };
78
- return p(() => {
79
- if (!K) return;
80
- let e = K.ownerDocument.activeElement === K;
81
- if (G(e), e && (q = L()), K.value !== V(B())) {
82
- U(K.value);
83
- let e = L()(K.value);
84
- X(e) && Y(e, !1);
79
+ return h(() => {
80
+ if (!J) return;
81
+ let e = J.ownerDocument.activeElement === J;
82
+ if (q(e), e && (Y = z()), J.value !== U(H())) {
83
+ G(J.value);
84
+ let e = z()(J.value);
85
+ Z(e) && X(e, !1);
85
86
  }
86
87
  }), (() => {
87
- var e = h(), n = e.firstChild, d = n.nextSibling.firstChild, f = d.nextSibling.firstChild, p = f.nextSibling;
88
- return c(e, o(S, {
88
+ var t = _(), i = t.firstChild, p = i.nextSibling.firstChild, m = p.nextSibling.firstChild, h = m.nextSibling;
89
+ return u(t, c(w, {
89
90
  get id() {
90
- return D();
91
+ return k();
91
92
  },
92
93
  get class() {
93
- return t("sheen-field sheen-number-field", l.class);
94
+ return n("sheen-field sheen-number-field", d.class);
94
95
  },
95
96
  role: "group",
96
97
  get "data-invalid"() {
97
- return l.error ? "" : void 0;
98
+ return d.error ? "" : void 0;
98
99
  },
99
100
  get "data-disabled"() {
100
- return l.disabled ? "" : void 0;
101
+ return d.disabled ? "" : void 0;
101
102
  }
102
- }), !1, !0), i(n, () => l.label, null), i(n, (() => {
103
- var e = a(() => !!l.required);
104
- return () => e() ? g() : null;
105
- })(), null), d.$$keydown = (e) => {
106
- if (e.key === "Enter") e.preventDefault(), Z();
107
- else if (e.key === "Escape") e.preventDefault(), U(V(B())), e.currentTarget.select();
103
+ }), !1, !0), o(i, () => d.label, null), o(i, (() => {
104
+ var e = s(() => !!d.required);
105
+ return () => e() ? v() : null;
106
+ })(), null), p.$$keydown = (e) => {
107
+ if (e.key === "Enter") e.preventDefault(), Q();
108
+ else if (e.key === "Escape") e.preventDefault(), G(U(H())), e.currentTarget.select();
108
109
  else if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "PageUp" || e.key === "PageDown") {
109
- if (l.readOnly) return;
110
+ if (d.readOnly) return;
110
111
  e.preventDefault();
111
- let t = e.key.startsWith("Page") ? l.largeStep ?? F() * 10 : F();
112
- Q(e.key === "ArrowDown" || e.key === "PageDown" ? -t : t);
113
- } else e.key === "Home" && !l.readOnly ? (e.preventDefault(), Y(N(), !0)) : e.key === "End" && !l.readOnly && (e.preventDefault(), Y(P(), !0));
114
- }, d.addEventListener("blur", () => {
115
- G(!1), Z(), q = void 0;
116
- }), d.$$input = (e) => {
117
- U(e.currentTarget.value);
118
- let t = (q ?? L())(e.currentTarget.value);
119
- X(t) && Y(t, !1);
120
- }, d.addEventListener("focus", () => {
121
- q = L(), G(!0);
122
- }), u($, d), f.$$click = () => Q(-F()), p.$$click = () => Q(F()), i(e, (() => {
123
- var e = a(() => !!l.name);
112
+ let t = e.key.startsWith("Page") ? d.largeStep ?? L() * 10 : L();
113
+ $(e.key === "ArrowDown" || e.key === "PageDown" ? -t : t);
114
+ } else e.key === "Home" && !d.readOnly ? (e.preventDefault(), X(F(), !0)) : e.key === "End" && !d.readOnly && (e.preventDefault(), X(I(), !0));
115
+ }, p.addEventListener("blur", () => {
116
+ q(!1), Q(), Y = void 0;
117
+ }), p.$$input = (e) => {
118
+ G(e.currentTarget.value);
119
+ let t = (Y ?? z())(e.currentTarget.value);
120
+ Z(t) && X(t, !1);
121
+ }, p.addEventListener("focus", () => {
122
+ Y = z(), q(!0);
123
+ }), f(te, p), m.$$click = () => $(-L()), o(m, r(e, { name: "minus" })), h.$$click = () => $(L()), o(h, r(e, { name: "plus" })), o(t, (() => {
124
+ var e = s(() => !!d.name);
124
125
  return () => e() ? (() => {
125
- var e = _();
126
- return r((t) => {
127
- var n = l.name, r = l.form;
128
- return n !== t.e && s(e, "name", t.e = n), r !== t.t && s(e, "form", t.t = r), t;
126
+ var e = y();
127
+ return a((t) => {
128
+ var n = d.name, r = d.form;
129
+ return n !== t.e && l(e, "name", t.e = n), r !== t.t && l(e, "form", t.t = r), t;
129
130
  }, {
130
131
  e: void 0,
131
132
  t: void 0
132
- }), r(() => e.value = B() ?? ""), e;
133
+ }), a(() => e.value = H() ?? ""), e;
133
134
  })() : null;
134
- })(), null), i(e, (() => {
135
- var e = a(() => !!l.description);
135
+ })(), null), o(t, (() => {
136
+ var e = s(() => !!d.description);
136
137
  return () => e() ? (() => {
137
- var e = v();
138
- return i(e, () => l.description), r(() => s(e, "id", A())), e;
138
+ var e = b();
139
+ return o(e, () => d.description), a(() => l(e, "id", M())), e;
139
140
  })() : null;
140
- })(), null), i(e, (() => {
141
- var e = a(() => !!l.error);
141
+ })(), null), o(t, (() => {
142
+ var e = s(() => !!d.error);
142
143
  return () => e() ? (() => {
143
- var e = y();
144
- return i(e, () => l.error), r(() => s(e, "id", j())), e;
144
+ var e = x();
145
+ return o(e, () => d.error), a(() => l(e, "id", N())), e;
145
146
  })() : null;
146
- })(), null), r((e) => {
147
- var t = k(), r = O(), i = O(), a = k(), o = M(), c = N(), u = P(), m = B() ?? void 0, h = B() === null ? void 0 : V(B()), g = l.error ? "true" : void 0, _ = l.required, v = l.disabled, y = l.readOnly, b = l.form, S = x(T.messages().decreaseValue, l.label), C = l.disabled || l.readOnly, w = x(T.messages().increaseValue, l.label), E = l.disabled || l.readOnly;
148
- return t !== e.e && s(n, "id", e.e = t), r !== e.t && s(n, "for", e.t = r), i !== e.a && s(d, "id", e.a = i), a !== e.o && s(d, "aria-labelledby", e.o = a), o !== e.i && s(d, "aria-describedby", e.i = o), c !== e.n && s(d, "aria-valuemin", e.n = c), u !== e.s && s(d, "aria-valuemax", e.s = u), m !== e.h && s(d, "aria-valuenow", e.h = m), h !== e.r && s(d, "aria-valuetext", e.r = h), g !== e.d && s(d, "aria-invalid", e.d = g), _ !== e.l && (d.required = e.l = _), v !== e.u && (d.disabled = e.u = v), y !== e.c && (d.readOnly = e.c = y), b !== e.w && s(d, "form", e.w = b), S !== e.m && s(f, "aria-label", e.m = S), C !== e.f && (f.disabled = e.f = C), w !== e.y && s(p, "aria-label", e.y = w), E !== e.g && (p.disabled = e.g = E), e;
147
+ })(), null), a((e) => {
148
+ var t = j(), n = A(), r = A(), a = j(), o = P(), s = F(), c = I(), u = H() ?? void 0, f = H() === null ? void 0 : U(H()), g = d.error ? "true" : void 0, _ = d.required, v = d.disabled, y = d.readOnly, b = d.form, x = C(D.messages().decreaseValue, d.label), S = d.disabled || d.readOnly, w = C(D.messages().increaseValue, d.label), T = d.disabled || d.readOnly;
149
+ return t !== e.e && l(i, "id", e.e = t), n !== e.t && l(i, "for", e.t = n), r !== e.a && l(p, "id", e.a = r), a !== e.o && l(p, "aria-labelledby", e.o = a), o !== e.i && l(p, "aria-describedby", e.i = o), s !== e.n && l(p, "aria-valuemin", e.n = s), c !== e.s && l(p, "aria-valuemax", e.s = c), u !== e.h && l(p, "aria-valuenow", e.h = u), f !== e.r && l(p, "aria-valuetext", e.r = f), g !== e.d && l(p, "aria-invalid", e.d = g), _ !== e.l && (p.required = e.l = _), v !== e.u && (p.disabled = e.u = v), y !== e.c && (p.readOnly = e.c = y), b !== e.w && l(p, "form", e.w = b), x !== e.m && l(m, "aria-label", e.m = x), S !== e.f && (m.disabled = e.f = S), w !== e.y && l(h, "aria-label", e.y = w), T !== e.g && (h.disabled = e.g = T), e;
149
150
  }, {
150
151
  e: void 0,
151
152
  t: void 0,
@@ -165,13 +166,12 @@ function T(n) {
165
166
  f: void 0,
166
167
  y: void 0,
167
168
  g: void 0
168
- }), r(() => d.value = J()), e;
169
+ }), a(() => p.value = ee()), t;
169
170
  })();
170
171
  }
171
- n([
172
+ i([
172
173
  "input",
173
174
  "keydown",
174
175
  "click"
175
176
  ]);
176
- //#endregion
177
- export { T as NumberField };
177
+ export { D as NumberField };
@@ -2,6 +2,10 @@ import type { JSX } from "solid-js";
2
2
  export interface NumberTextProps extends Omit<JSX.HTMLAttributes<HTMLSpanElement>, "children"> {
3
3
  value: number;
4
4
  format?: Intl.NumberFormatOptions;
5
+ /** Tint the number up or down when the value changes after the first render. */
6
+ flash?: boolean;
7
+ /** Count from the previous value to the next one when the value changes after the first render. */
8
+ tween?: boolean;
5
9
  }
6
10
  /** Keep locale ordering and punctuation intact while quieting fractional digits and units. */
7
11
  export declare function NumberText(props: NumberTextProps): JSX.Element;
@@ -1,10 +1,11 @@
1
- import { NumberFormatContext as e } from "../theme/number-format-cache.js";
2
- import { useTheme as t } from "../theme/ThemeProvider.js";
3
- import { cn as n } from "../utils/cn.js";
4
- import { createComponent as r, effect as i, insert as a, mergeProps as o, setAttribute as s, spread as c, template as l } from "solid-js/web";
5
- import { Index as u, Show as d, createMemo as f, splitProps as p, useContext as m } from "solid-js";
6
- //#region src/primitives/NumberText.tsx
7
- var h = /*#__PURE__*/ l("<span>"), g = /* @__PURE__ */ new Set([
1
+ import { useTheme as e } from "../theme/ThemeProvider.js";
2
+ import { cn as t } from "../utils/cn.js";
3
+ import { NumberFormatContext as n } from "../theme/number-format-cache.js";
4
+ import { flashChange as r, motionDuration as i } from "../utils/change-motion.js";
5
+ import { createComponent as a, effect as o, insert as s, mergeProps as c, setAttribute as l, spread as u, template as d, use as f } from "solid-js/web";
6
+ import { Index as p, Show as m, createEffect as h, createMemo as g, createSignal as _, on as v, onCleanup as y, splitProps as b, useContext as x } from "solid-js";
7
+ // src/primitives/NumberText.tsx
8
+ var S = /*#__PURE__*/ d("<span>"), C = /* @__PURE__ */ new Set([
8
9
  "decimal",
9
10
  "fraction",
10
11
  "unit",
@@ -12,17 +13,40 @@ var h = /*#__PURE__*/ l("<span>"), g = /* @__PURE__ */ new Set([
12
13
  "currency",
13
14
  "compact"
14
15
  ]);
15
- function _(l) {
16
- let [_, v] = p(l, [
16
+ function w(d) {
17
+ let [w, T] = b(d, [
17
18
  "value",
18
19
  "format",
19
- "class"
20
- ]), y = t(), b = m(e), x = f(() => y.state().locale), S = f(() => b ? b(x(), _.format) : new Intl.NumberFormat(x(), _.format)), C = f(() => {
21
- if (!Number.isFinite(_.value)) throw Error("NumberText requires a finite value");
20
+ "class",
21
+ "flash",
22
+ "tween",
23
+ "ref"
24
+ ]), E = e(), D = x(n), O = g(() => E.state().locale), k = g(() => D ? D(O(), w.format) : new Intl.NumberFormat(O(), w.format)), A, j = 0, [M, N] = _(w.value), P = () => w.tween ? M() : w.value;
25
+ h(v(() => w.value, (e, t) => {
26
+ if (j && cancelAnimationFrame(j), !A || t === void 0 || e === t || !Number.isFinite(e)) {
27
+ N(e);
28
+ return;
29
+ }
30
+ w.flash && r(A, e > t ? "up" : "down");
31
+ let n = w.tween ? i(A) * 2 : 0;
32
+ if (n === 0) {
33
+ N(e);
34
+ return;
35
+ }
36
+ let a = M(), o = performance.now(), s = (t) => {
37
+ let r = Math.min(1, (t - o) / n);
38
+ N(r === 1 ? e : a + (e - a) * (1 - (1 - r) ** 3)), r < 1 && (j = requestAnimationFrame(s));
39
+ };
40
+ j = requestAnimationFrame(s);
41
+ }, { defer: !0 })), y(() => {
42
+ j && cancelAnimationFrame(j);
43
+ });
44
+ let F = g(() => {
45
+ if (!Number.isFinite(w.value)) throw Error("NumberText requires a finite value");
22
46
  let e = [];
23
- for (let t of S().formatToParts(_.value)) {
47
+ for (let t of k().formatToParts(P())) {
24
48
  let n = e.at(-1);
25
- !g.has(t.type) && n?.type === "literal" ? n.value += t.value : e.push(g.has(t.type) ? t : {
49
+ !C.has(t.type) && n?.type === "literal" ? n.value += t.value : e.push(C.has(t.type) ? t : {
26
50
  type: "literal",
27
51
  value: t.value
28
52
  });
@@ -30,27 +54,28 @@ function _(l) {
30
54
  return e;
31
55
  });
32
56
  return (() => {
33
- var e = h();
34
- return c(e, o(v, { get class() {
35
- return n("sheen-number-text", _.class);
36
- } }), !1, !0), a(e, r(u, {
57
+ var e = S();
58
+ return f((e) => {
59
+ A = e, typeof w.ref == "function" && w.ref(e);
60
+ }, e), u(e, c(T, { get class() {
61
+ return t("sheen-number-text", w.class);
62
+ } }), !1, !0), s(e, a(p, {
37
63
  get each() {
38
- return C();
64
+ return F();
39
65
  },
40
- children: (e) => r(d, {
66
+ children: (e) => a(m, {
41
67
  get when() {
42
- return g.has(e().type);
68
+ return C.has(e().type);
43
69
  },
44
70
  get fallback() {
45
71
  return e().value;
46
72
  },
47
73
  get children() {
48
- var t = h();
49
- return a(t, () => e().value), i(() => s(t, "data-number-part", e().type)), t;
74
+ var t = S();
75
+ return s(t, () => e().value), o(() => l(t, "data-number-part", e().type)), t;
50
76
  }
51
77
  })
52
78
  })), e;
53
79
  })();
54
80
  }
55
- //#endregion
56
- export { _ as NumberText };
81
+ export { w as NumberText };
@@ -1,13 +1,14 @@
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 { createComponent as i, insert as a, mergeProps as o, spread as s, template as c, use as l } from "solid-js/web";
6
- import { For as u, createMemo as d, onCleanup as f, onMount as p, splitProps as m } from "solid-js";
7
- //#region src/primitives/Pagination.tsx
8
- var h = /*#__PURE__*/ c("<nav><output aria-live=polite aria-atomic=true>");
9
- function g(c) {
10
- let [g, _] = m(c, [
1
+ import { Button as e } from "./Button.js";
2
+ import { useTheme as t } from "../theme/ThemeProvider.js";
3
+ import { useNumberFormatter as n } from "../theme/intl.js";
4
+ import { cn as r } from "../utils/cn.js";
5
+ import { Glyph as i } from "./Glyph.js";
6
+ import { createComponent as a, insert as o, mergeProps as s, spread as c, template as l, use as u } from "solid-js/web";
7
+ import { For as d, createMemo as f, onCleanup as p, onMount as m, splitProps as h } from "solid-js";
8
+ // src/primitives/Pagination.tsx
9
+ var g = /*#__PURE__*/ l("<nav><output aria-live=polite aria-atomic=true>");
10
+ function _(l) {
11
+ let [_, v] = h(l, [
11
12
  "pageIndex",
12
13
  "pageCount",
13
14
  "onPageChange",
@@ -16,9 +17,9 @@ function g(c) {
16
17
  "label",
17
18
  "class",
18
19
  "ref"
19
- ]), v;
20
- p(() => {
21
- let e = v;
20
+ ]), y;
21
+ m(() => {
22
+ let e = y;
22
23
  if (!e) return;
23
24
  let t = e.ownerDocument, n, r = () => {
24
25
  n = e.contains(t.activeElement) ? t.activeElement ?? void 0 : void 0;
@@ -32,96 +33,116 @@ function g(c) {
32
33
  i.observe(e, {
33
34
  childList: !0,
34
35
  subtree: !0
35
- }), f(() => {
36
+ }), p(() => {
36
37
  i.disconnect(), t.removeEventListener("focusin", r);
37
38
  });
38
39
  });
39
- let y = e(), b = r(), x = d(() => {
40
- if (!Number.isSafeInteger(g.pageCount) || g.pageCount < 0) throw Error("Pagination pageCount must be a nonnegative safe integer");
41
- if (!Number.isSafeInteger(g.pageIndex) || g.pageIndex < 0 || g.pageIndex >= Math.max(1, g.pageCount)) throw Error("Pagination pageIndex must identify an accepted page, or zero for empty results");
40
+ let b = t(), x = n(), S = f(() => {
41
+ if (!Number.isSafeInteger(_.pageCount) || _.pageCount < 0) throw Error("Pagination pageCount must be a nonnegative safe integer");
42
+ if (!Number.isSafeInteger(_.pageIndex) || _.pageIndex < 0 || _.pageIndex >= Math.max(1, _.pageCount)) throw Error("Pagination pageIndex must identify an accepted page, or zero for empty results");
42
43
  return {
43
- index: g.pageIndex,
44
- count: g.pageCount
44
+ index: _.pageIndex,
45
+ count: _.pageCount
45
46
  };
46
- }), S = d(() => {
47
- let { index: e, count: t } = x(), n = Math.max(0, Math.min(e - 2, t - 5));
47
+ }), C = f(() => {
48
+ let { index: e, count: t } = S(), n = Math.max(0, Math.min(e - 2, t - 5));
48
49
  return Array.from({ length: Math.min(5, t) }, (e, t) => n + t);
49
- }), C = (e) => g.pending || g.disabled || e < 0 || e >= x().count || e === x().index, w = (e) => {
50
- C(e) || g.onPageChange(e);
51
- }, T = (e) => y.messages().pageLabel.replaceAll("{page}", b().format(e + 1)), E = () => y.messages().pageStatus.replaceAll("{page}", b().format(x().count ? x().index + 1 : 0)).replaceAll("{pages}", b().format(x().count));
50
+ }), w = (e) => _.pending || _.disabled || e < 0 || e >= S().count || e === S().index, T = (e) => {
51
+ w(e) || _.onPageChange(e);
52
+ }, E = (e) => b.messages().pageLabel.replaceAll("{page}", x().format(e + 1)), D = () => b.messages().pageStatus.replaceAll("{page}", x().format(S().count ? S().index + 1 : 0)).replaceAll("{pages}", x().format(S().count));
52
53
  return (() => {
53
- var e = h(), r = e.firstChild;
54
- return l((e) => {
55
- v = e, typeof g.ref == "function" && g.ref(e);
56
- }, e), s(e, o(_, {
54
+ var t = g(), n = t.firstChild;
55
+ return u((e) => {
56
+ y = e, typeof _.ref == "function" && _.ref(e);
57
+ }, t), c(t, s(v, {
57
58
  get class() {
58
- return t("sheen-pagination", g.class);
59
+ return r("sheen-pagination", _.class);
59
60
  },
60
61
  get "aria-label"() {
61
- return g.label ?? y.messages().pagination;
62
+ return _.label ?? b.messages().pagination;
62
63
  },
63
64
  get "aria-busy"() {
64
- return g.pending || void 0;
65
+ return _.pending || void 0;
65
66
  },
66
67
  get "aria-disabled"() {
67
- return g.disabled || void 0;
68
+ return _.disabled || void 0;
68
69
  },
69
70
  get "data-pending"() {
70
- return g.pending ? "" : void 0;
71
+ return _.pending ? "" : void 0;
71
72
  }
72
- }), !1, !0), a(e, i(n, {
73
+ }), !1, !0), o(t, a(e, {
74
+ variant: "ghost",
75
+ class: "sheen-pagination-step",
76
+ get "aria-label"() {
77
+ return b.messages().firstPage;
78
+ },
73
79
  get "aria-disabled"() {
74
- return C(0) || void 0;
80
+ return w(0) || void 0;
75
81
  },
76
- onClick: () => w(0),
82
+ onClick: () => T(0),
77
83
  get children() {
78
- return y.messages().firstPage;
84
+ return a(i, { name: "chevrons-left" });
79
85
  }
80
- }), r), a(e, i(n, {
86
+ }), n), o(t, a(e, {
87
+ variant: "ghost",
88
+ class: "sheen-pagination-step",
89
+ get "aria-label"() {
90
+ return b.messages().previousPage;
91
+ },
81
92
  get "aria-disabled"() {
82
- return C(x().index - 1) || void 0;
93
+ return w(S().index - 1) || void 0;
83
94
  },
84
- onClick: () => w(x().index - 1),
95
+ onClick: () => T(S().index - 1),
85
96
  get children() {
86
- return y.messages().previousPage;
97
+ return a(i, { name: "chevron-left" });
87
98
  }
88
- }), r), a(e, i(u, {
99
+ }), n), o(t, a(d, {
89
100
  get each() {
90
- return S();
101
+ return C();
91
102
  },
92
- children: (e) => i(n, {
103
+ children: (t) => a(e, {
104
+ variant: "ghost",
93
105
  get "aria-label"() {
94
- return T(e);
106
+ return E(t);
95
107
  },
96
108
  get "aria-current"() {
97
- return e === x().index ? "page" : void 0;
109
+ return t === S().index ? "page" : void 0;
98
110
  },
99
111
  get "aria-disabled"() {
100
- return C(e) || void 0;
112
+ return w(t) || void 0;
101
113
  },
102
- onClick: () => w(e),
114
+ onClick: () => T(t),
103
115
  get children() {
104
- return b().format(e + 1);
116
+ return x().format(t + 1);
105
117
  }
106
118
  })
107
- }), r), a(e, i(n, {
119
+ }), n), o(t, a(e, {
120
+ variant: "ghost",
121
+ class: "sheen-pagination-step",
122
+ get "aria-label"() {
123
+ return b.messages().nextPage;
124
+ },
108
125
  get "aria-disabled"() {
109
- return C(x().index + 1) || void 0;
126
+ return w(S().index + 1) || void 0;
110
127
  },
111
- onClick: () => w(x().index + 1),
128
+ onClick: () => T(S().index + 1),
112
129
  get children() {
113
- return y.messages().nextPage;
130
+ return a(i, { name: "chevron-right" });
114
131
  }
115
- }), r), a(e, i(n, {
132
+ }), n), o(t, a(e, {
133
+ variant: "ghost",
134
+ class: "sheen-pagination-step",
135
+ get "aria-label"() {
136
+ return b.messages().lastPage;
137
+ },
116
138
  get "aria-disabled"() {
117
- return C(x().count - 1) || void 0;
139
+ return w(S().count - 1) || void 0;
118
140
  },
119
- onClick: () => w(x().count - 1),
141
+ onClick: () => T(S().count - 1),
120
142
  get children() {
121
- return y.messages().lastPage;
143
+ return a(i, { name: "chevrons-right" });
122
144
  }
123
- }), r), a(r, E), e;
145
+ }), n), o(n, D), t;
124
146
  })();
125
147
  }
126
- //#endregion
127
- export { g as Pagination };
148
+ export { _ as Pagination };
@@ -6,6 +6,7 @@ export interface PopoverProps extends ParentProps {
6
6
  open?: boolean;
7
7
  defaultOpen?: boolean;
8
8
  onOpenChange?: (open: boolean) => void;
9
+ disabled?: boolean;
9
10
  placement?: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "right";
10
11
  class?: string;
11
12
  }