jenosize-ui 0.2.1 → 0.3.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 (225) hide show
  1. package/README.md +183 -63
  2. package/THIRD-PARTY-NOTICES.md +15 -0
  3. package/dist/GradientPicker-CQm3GT7F.d.ts +144 -0
  4. package/dist/{PaymentInput-Dn5WVQVy.d.ts → PaymentInput-Cz5jFB3p.d.ts} +1 -1
  5. package/dist/{Select-Dt5ARIH8.d.ts → Select-CXOAMlk7.d.ts} +15 -1
  6. package/dist/{TagInput-BaBeve6L.d.ts → TagInput-CzIrONr-.d.ts} +1 -1
  7. package/dist/area-chart.d.ts +2 -2
  8. package/dist/area-chart.js +7 -6
  9. package/dist/at-least-one-BZ2dsck-.d.ts +18 -0
  10. package/dist/avatar.d.ts +1 -1
  11. package/dist/avatar.js +12 -11
  12. package/dist/badge.d.ts +1 -1
  13. package/dist/badge.js +6 -6
  14. package/dist/bar-chart.d.ts +2 -2
  15. package/dist/bar-chart.js +7 -6
  16. package/dist/breadcrumb.d.ts +1 -1
  17. package/dist/breadcrumb.js +4 -4
  18. package/dist/button.d.ts +1 -1
  19. package/dist/button.js +11 -10
  20. package/dist/calendar.d.ts +1 -1
  21. package/dist/calendar.js +16 -15
  22. package/dist/callout.d.ts +4 -2
  23. package/dist/callout.js +12 -11
  24. package/dist/card.d.ts +59 -3
  25. package/dist/card.js +4 -4
  26. package/dist/carousel.d.ts +169 -0
  27. package/dist/carousel.js +9 -0
  28. package/dist/catalog.json +11180 -0
  29. package/dist/checkbox.js +8 -7
  30. package/dist/{chunk-MVG5MABV.js → chunk-26XQU3TC.js} +8 -8
  31. package/dist/{chunk-X2X7Q7NW.js → chunk-2R3QWWOT.js} +3 -3
  32. package/dist/{chunk-AIARANKE.js → chunk-3JQKVC2K.js} +4 -4
  33. package/dist/chunk-3P3QZPHV.js +109 -0
  34. package/dist/{chunk-GLKFFA7N.js → chunk-44AWXIQK.js} +5 -5
  35. package/dist/{chunk-FWRHBMWT.js → chunk-4Y32RIC7.js} +5 -19
  36. package/dist/{chunk-5XPMY2LF.js → chunk-5ECTNYKU.js} +5 -5
  37. package/dist/{chunk-6B6BWTXC.js → chunk-5GBA6X6A.js} +5 -5
  38. package/dist/{chunk-UGKELBNC.js → chunk-5SGF47TZ.js} +9 -9
  39. package/dist/{chunk-POQTE7JI.js → chunk-5XSR757T.js} +7 -7
  40. package/dist/{chunk-GZMDZF2V.js → chunk-6FGLABYH.js} +3 -3
  41. package/dist/{chunk-MCQG4H6T.js → chunk-6T3QAO5K.js} +12 -4
  42. package/dist/{chunk-SKRR3ZMP.js → chunk-737A4YNC.js} +3 -3
  43. package/dist/{chunk-AFYXSZGW.js → chunk-7LSUUEAF.js} +7 -5
  44. package/dist/{chunk-7VLYQR4D.js → chunk-7OFGPDYJ.js} +3 -3
  45. package/dist/{chunk-54SIZR63.js → chunk-7UCKFULR.js} +7 -7
  46. package/dist/{chunk-LQURV7HQ.js → chunk-7ZA3QZRP.js} +4 -4
  47. package/dist/{chunk-X2VMIBK5.js → chunk-A4YPUS6C.js} +4 -4
  48. package/dist/{chunk-5ZEUTSCV.js → chunk-B4OVIE2X.js} +6 -6
  49. package/dist/{chunk-P6CON2R2.js → chunk-BH32X25C.js} +3 -3
  50. package/dist/{chunk-667ZHY3T.js → chunk-BJHLW25G.js} +85 -538
  51. package/dist/{chunk-ULGCGKOE.js → chunk-BKBINQJZ.js} +4 -4
  52. package/dist/{chunk-CFFWYXDW.js → chunk-BXQFBFT7.js} +5 -5
  53. package/dist/{chunk-I6WMNXC7.js → chunk-CQGMOPLG.js} +6 -6
  54. package/dist/{chunk-FNQJJO63.js → chunk-CUONE6LA.js} +4 -4
  55. package/dist/{chunk-FFMTYQXE.js → chunk-CVCS5G3E.js} +43 -21
  56. package/dist/{chunk-33TOK7ES.js → chunk-DCKVNHV5.js} +5 -5
  57. package/dist/{chunk-A323V6AI.js → chunk-DYRGHXT5.js} +3 -3
  58. package/dist/{chunk-T4ZFZTY6.js → chunk-EHML2DLR.js} +4 -4
  59. package/dist/{chunk-N3RVMBPX.js → chunk-EJKQGUUM.js} +4 -4
  60. package/dist/{chunk-E2YZ7IMT.js → chunk-ESDSTS5N.js} +6 -6
  61. package/dist/{chunk-LCG34A5T.js → chunk-EVINS473.js} +5 -3
  62. package/dist/chunk-EXRVOGJ5.js +325 -0
  63. package/dist/{chunk-YHBI52P2.js → chunk-GDW6NFYN.js} +3 -3
  64. package/dist/chunk-GOCO45FF.js +619 -0
  65. package/dist/{chunk-7ZM7SNCZ.js → chunk-GPHGPY6T.js} +3 -3
  66. package/dist/{chunk-PO2TYK3C.js → chunk-GWYDOZGQ.js} +3 -3
  67. package/dist/{chunk-LO22VQL5.js → chunk-HNNNJP3A.js} +4 -4
  68. package/dist/{chunk-ZZSNTCCL.js → chunk-IESEBPYA.js} +4 -4
  69. package/dist/{chunk-3H444OJA.js → chunk-JZ4HGFWK.js} +3 -3
  70. package/dist/chunk-KBQJIVUB.js +33 -0
  71. package/dist/{chunk-CKMWBVRR.js → chunk-KCM4KEZ2.js} +4 -4
  72. package/dist/{chunk-3QXLIZIX.js → chunk-KNGJ3CSB.js} +3 -3
  73. package/dist/{chunk-FH7Z7SGQ.js → chunk-KNW3IUWX.js} +12 -11
  74. package/dist/{chunk-KZP6B6B3.js → chunk-KTWTYK5U.js} +16 -5
  75. package/dist/{chunk-LYXPJERB.js → chunk-L7Z6XGBU.js} +5 -5
  76. package/dist/{chunk-ZHAT2XZ4.js → chunk-LLUWBQK6.js} +10 -10
  77. package/dist/{chunk-QHH6AUR3.js → chunk-MDKVYC6R.js} +7 -7
  78. package/dist/{chunk-22M75A3N.js → chunk-MS6DY4CE.js} +14 -11
  79. package/dist/{chunk-LLPWQDF7.js → chunk-MTOTPAYZ.js} +3 -3
  80. package/dist/{chunk-AZ7DKRBY.js → chunk-MVF7FA4D.js} +5 -5
  81. package/dist/{chunk-AIGYMTCU.js → chunk-MVUNB43J.js} +3 -3
  82. package/dist/{chunk-ZMFY7WAY.js → chunk-O24HHIQG.js} +41 -39
  83. package/dist/{chunk-NKG4N6HA.js → chunk-O5EHNNPS.js} +4 -4
  84. package/dist/{chunk-5DP7W5HX.js → chunk-OIPFTJS6.js} +3 -3
  85. package/dist/{chunk-U4WSJAYK.js → chunk-OXNIEIOY.js} +20 -20
  86. package/dist/chunk-P2BGR77C.js +344 -0
  87. package/dist/{chunk-CGHYXWTT.js → chunk-PFAFTLN3.js} +4 -4
  88. package/dist/{chunk-4RBIWI2Q.js → chunk-Q2KR7PSX.js} +3 -3
  89. package/dist/{chunk-7GUPNTAH.js → chunk-QSOLK2I2.js} +7 -7
  90. package/dist/chunk-QTWRR7IS.js +1129 -0
  91. package/dist/{chunk-OLLD2BZN.js → chunk-QZHAL4BL.js} +3 -3
  92. package/dist/{chunk-OACWA4TC.js → chunk-R25NHHYT.js} +6 -6
  93. package/dist/{chunk-QDKETK7D.js → chunk-S55JKMG7.js} +5 -5
  94. package/dist/{chunk-S5TEWPWW.js → chunk-S5LLA36K.js} +10 -10
  95. package/dist/{chunk-QDYE5LVT.js → chunk-SF3HCW4G.js} +45 -4
  96. package/dist/{chunk-KHGW72BM.js → chunk-SGMVB7HD.js} +3 -3
  97. package/dist/{chunk-FKVPAEJ6.js → chunk-SKJC2KYD.js} +4 -3
  98. package/dist/chunk-SKPKL47Y.js +5671 -0
  99. package/dist/{chunk-6MMBQVRO.js → chunk-TCTTZHUS.js} +9 -9
  100. package/dist/chunk-U5X3MLM5.js +67 -0
  101. package/dist/chunk-UHSGD4CD.js +364 -0
  102. package/dist/chunk-UJ4WEQHR.js +525 -0
  103. package/dist/{chunk-6H4LNWQ7.js → chunk-VDFWWWLL.js} +9 -4
  104. package/dist/{chunk-5KSD4WKN.js → chunk-VIKV25VP.js} +5 -5
  105. package/dist/chunk-WJB5GWAZ.js +20 -0
  106. package/dist/{chunk-HHYEAFCL.js → chunk-XAQQ4LYL.js} +11 -11
  107. package/dist/{chunk-4VGEJG4M.js → chunk-XCFFM2C7.js} +9 -9
  108. package/dist/chunk-XKTD3X6Z.js +183 -0
  109. package/dist/{chunk-GQRSABRN.js → chunk-XWXXKEG6.js} +4 -4
  110. package/dist/chunk-YGFTNICV.js +110 -0
  111. package/dist/{chunk-T5574MXM.js → chunk-YGJL7QS7.js} +8 -8
  112. package/dist/{chunk-SB3DG572.js → chunk-YKPTUANT.js} +6 -6
  113. package/dist/{chunk-YQYVGWIC.js → chunk-YQAYAJ2T.js} +33 -11
  114. package/dist/chunk-YXYZW6WU.js +998 -0
  115. package/dist/{chunk-IQNVSQRK.js → chunk-Z6NSOC6T.js} +5 -5
  116. package/dist/{chunk-BBKE4W3B.js → chunk-ZAWGG4H2.js} +7 -7
  117. package/dist/{chunk-BFVJHH7S.js → chunk-ZF362B2X.js} +5 -5
  118. package/dist/{chunk-RJTVCA62.js → chunk-ZJIY642R.js} +3 -3
  119. package/dist/color-input.d.ts +93 -0
  120. package/dist/color-input.js +35 -0
  121. package/dist/color-picker.d.ts +268 -0
  122. package/dist/color-picker.js +28 -0
  123. package/dist/color-value-DYzChVOW.d.ts +129 -0
  124. package/dist/combobox.d.ts +1 -1
  125. package/dist/combobox.js +13 -12
  126. package/dist/date-calendar.d.ts +49 -0
  127. package/dist/date-calendar.js +12 -0
  128. package/dist/date-input.d.ts +1 -1
  129. package/dist/date-input.js +11 -10
  130. package/dist/date-picker.d.ts +15 -131
  131. package/dist/date-picker.js +26 -22
  132. package/dist/date-types-DrDdF6WJ.d.ts +100 -0
  133. package/dist/dialog.d.ts +1 -1
  134. package/dist/dialog.js +10 -10
  135. package/dist/drawer.d.ts +1 -1
  136. package/dist/drawer.js +9 -9
  137. package/dist/dropdown-menu.d.ts +1 -1
  138. package/dist/dropdown-menu.js +6 -6
  139. package/dist/dropzone.d.ts +3 -3
  140. package/dist/dropzone.js +17 -16
  141. package/dist/form.d.ts +15 -5
  142. package/dist/form.js +75 -36
  143. package/dist/header-navigation.d.ts +2 -2
  144. package/dist/header-navigation.js +21 -20
  145. package/dist/helper.d.ts +1 -1
  146. package/dist/index.d.ts +25 -11
  147. package/dist/index.js +92 -79
  148. package/dist/indicator.js +4 -4
  149. package/dist/inline-banner.d.ts +68 -0
  150. package/dist/inline-banner.js +20 -0
  151. package/dist/input.d.ts +1 -1
  152. package/dist/input.js +10 -9
  153. package/dist/kanban-board.d.ts +2 -2
  154. package/dist/kanban-board.js +16 -15
  155. package/dist/labels-C992bt7G.d.ts +1160 -0
  156. package/dist/line-chart.d.ts +2 -2
  157. package/dist/line-chart.js +7 -6
  158. package/dist/mcp.js +231 -0
  159. package/dist/number-input.d.ts +1 -1
  160. package/dist/number-input.js +10 -9
  161. package/dist/pagination.d.ts +1 -1
  162. package/dist/pagination.js +14 -13
  163. package/dist/{card-D56VxyAe.d.ts → panel-CUGm_Mxy.d.ts} +9 -57
  164. package/dist/payment-input.d.ts +3 -3
  165. package/dist/payment-input.js +10 -9
  166. package/dist/picker-draft-BPV3MUPY.d.ts +9 -0
  167. package/dist/pie-chart.d.ts +2 -2
  168. package/dist/pie-chart.js +7 -6
  169. package/dist/popover.d.ts +65 -4
  170. package/dist/popover.js +9 -9
  171. package/dist/progress-steps.js +4 -4
  172. package/dist/progress.js +3 -3
  173. package/dist/provider.d.ts +1 -1
  174. package/dist/provider.js +3 -3
  175. package/dist/qr-code.d.ts +227 -0
  176. package/dist/qr-code.js +19 -0
  177. package/dist/radar-chart.d.ts +2 -2
  178. package/dist/radar-chart.js +7 -6
  179. package/dist/radial-chart.d.ts +2 -2
  180. package/dist/radial-chart.js +7 -6
  181. package/dist/radio.js +8 -7
  182. package/dist/rich-text-editor.d.ts +624 -0
  183. package/dist/rich-text-editor.js +51 -0
  184. package/dist/rich-text-highlight.d.ts +11 -0
  185. package/dist/rich-text-highlight.js +65 -0
  186. package/dist/rich-text-sanitize.d.ts +17 -0
  187. package/dist/rich-text-sanitize.js +176 -0
  188. package/dist/scroll-area.js +2 -2
  189. package/dist/select.d.ts +2 -2
  190. package/dist/select.js +17 -16
  191. package/dist/separator.js +2 -2
  192. package/dist/shared-CGf2D8ZX.d.ts +20 -0
  193. package/dist/sidebar-navigation.d.ts +76 -27
  194. package/dist/sidebar-navigation.js +16 -15
  195. package/dist/sidebar-state.d.ts +76 -0
  196. package/dist/sidebar-state.js +27 -0
  197. package/dist/skeleton.js +2 -2
  198. package/dist/slider.d.ts +321 -0
  199. package/dist/slider.js +13 -0
  200. package/dist/styles.css +1 -1
  201. package/dist/switch.d.ts +1 -1
  202. package/dist/switch.js +2 -2
  203. package/dist/table.d.ts +3 -19
  204. package/dist/table.js +34 -33
  205. package/dist/tabs.js +2 -2
  206. package/dist/tag-input.d.ts +3 -3
  207. package/dist/tag-input.js +13 -12
  208. package/dist/tag.d.ts +1 -1
  209. package/dist/tag.js +4 -4
  210. package/dist/textarea.js +8 -7
  211. package/dist/theme.css +965 -0
  212. package/dist/theme.js +12 -11
  213. package/dist/toast.d.ts +1 -1
  214. package/dist/toast.js +12 -11
  215. package/dist/tooltip.js +4 -3
  216. package/dist/tree.d.ts +1 -1
  217. package/dist/tree.js +6 -6
  218. package/dist/{types-DR9rAEy1.d.ts → types-DYFl0CEB.d.ts} +1 -1
  219. package/dist/{use-uploads-KaPqDklo.d.ts → use-uploads-2E7n0PWT.d.ts} +1 -1
  220. package/dist/verification-code-input.js +10 -9
  221. package/package.json +92 -8
  222. package/dist/chunk-BLIZ3CL3.js +0 -49
  223. package/dist/labels-DPrh0se9.d.ts +0 -627
  224. package/dist/panel-El4oI68p.d.ts +0 -9
  225. package/dist/shared-BYXJPnsN.d.ts +0 -11
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Anywhere a cookie can be read from.
3
+ *
4
+ * - a **string** — `document.cookie` in the browser, or a raw `Cookie:` request header on a server;
5
+ * - a **jar** — Next's `await cookies()`, or any object exposing `.get(name)`. The return is typed
6
+ * loosely (`{ value?: string }`) because every framework spells the rest of that record
7
+ * differently and we only ever want the value.
8
+ */
9
+ type CookieSource = string | {
10
+ get(name: string): {
11
+ value?: string;
12
+ } | undefined;
13
+ };
14
+
15
+ /**
16
+ * The rail's persisted state, as read on the server (or before the first client render).
17
+ *
18
+ * **Produced by {@link readSidebarState} and nothing else, and that is the point.** The key travels
19
+ * INSIDE the value, so the name the server reads and the name the client writes back cannot drift
20
+ * apart — a hand-written `{ key, collapsed }` is a type error, so there is no second place to spell
21
+ * `"app-sidebar"` and get it wrong.
22
+ */
23
+ interface SidebarState {
24
+ /** The cookie name this was read from, and the one the provider writes back to. */
25
+ readonly key: string;
26
+ /** Whether the rail should render as the icon rail. */
27
+ readonly collapsed: boolean;
28
+ /**
29
+ * Brand. Never present at runtime, never written by a caller.
30
+ *
31
+ * A STRING key, not the `declare const BRAND: unique symbol` this shipped as for an hour, because
32
+ * that brand does not survive the package boundary: tsup emits one `.d.ts` per entry, each with
33
+ * its OWN `unique symbol` declaration, and TypeScript treats two of those as different types. So
34
+ * the `SidebarState` returned by `jenosize-ui/sidebar-state` was not assignable to the `state` prop
35
+ * declared in `jenosize-ui/sidebar-navigation` — the one call this whole design prescribes, broken
36
+ * for every consumer and invisible in-repo, where `pnpm typecheck` resolves both from this file.
37
+ * A structural marker is identical in both copies. It buys slightly less (a caller CAN type this
38
+ * key out) in exchange for working at all, and typing it out is sabotage rather than a slip.
39
+ */
40
+ readonly "~jenosize.sidebarState": true;
41
+ }
42
+ interface ReadSidebarStateOptions {
43
+ /** Cookie name to keep the choice under. One string, used for both the read and every later write. */
44
+ key: string;
45
+ /** What to render when nothing is stored yet — a first-ever visitor. @default false */
46
+ defaultCollapsed?: boolean;
47
+ }
48
+ /**
49
+ * Read the rail's collapse state from a cookie, for `<SidebarProvider state={…}>`.
50
+ *
51
+ * Server-rendered app — read it where the HTML is produced, so the first byte is already right:
52
+ *
53
+ * ```tsx
54
+ * // app/(admin)/layout.tsx — a server component
55
+ * import { cookies } from "next/headers";
56
+ * import { readSidebarState } from "jenosize-ui/sidebar-state";
57
+ *
58
+ * const sidebar = readSidebarState(await cookies(), { key: "app-sidebar" });
59
+ * return <SidebarProvider state={sidebar}>{children}</SidebarProvider>;
60
+ * ```
61
+ *
62
+ * Client-only app (Vite, CRA) — the same call, synchronously, off `document.cookie`. There is no
63
+ * server HTML to disagree with, and reading during render rather than in an effect means the rail
64
+ * never paints wide and snaps:
65
+ *
66
+ * ```tsx
67
+ * <SidebarProvider state={readSidebarState(document.cookie, { key: "app-sidebar" })}>
68
+ * ```
69
+ *
70
+ * Note for a framework with a router cache (Next's included): the value is captured when the layout
71
+ * renders. In-session toggles are client state and stay correct; a cached RSC payload only matters
72
+ * across a full reload, which re-runs this.
73
+ */
74
+ declare function readSidebarState(source: CookieSource, options: ReadSidebarStateOptions): SidebarState;
75
+
76
+ export { type CookieSource, type ReadSidebarStateOptions, type SidebarState, readSidebarState };
@@ -0,0 +1,27 @@
1
+ // src/lib/cookie.ts
2
+ function readCookie(source, name) {
3
+ if (typeof source !== "string") return source.get(name)?.value;
4
+ for (const part of source.split(";")) {
5
+ const eq = part.indexOf("=");
6
+ if (eq === -1) continue;
7
+ if (part.slice(0, eq).trim() !== name) continue;
8
+ try {
9
+ return decodeURIComponent(part.slice(eq + 1).trim());
10
+ } catch {
11
+ return part.slice(eq + 1).trim();
12
+ }
13
+ }
14
+ return void 0;
15
+ }
16
+
17
+ // src/components/sidebar-navigation/state.ts
18
+ function readSidebarState(source, options) {
19
+ const { key, defaultCollapsed = false } = options;
20
+ const stored = readCookie(source, key);
21
+ const collapsed = stored === "true" ? true : stored === "false" ? false : defaultCollapsed;
22
+ return { key, collapsed };
23
+ }
24
+
25
+ export { readSidebarState };
26
+ //# sourceMappingURL=sidebar-state.js.map
27
+ //# sourceMappingURL=sidebar-state.js.map
package/dist/skeleton.js CHANGED
@@ -1,5 +1,5 @@
1
- "use client";export { Skeleton, SkeletonText } from './chunk-LLPWQDF7.js';
1
+ "use client";export { Skeleton, SkeletonText } from './chunk-MTOTPAYZ.js';
2
2
  import './chunk-ZSNJ6UA3.js';
3
- import './chunk-QDYE5LVT.js';
3
+ import './chunk-SF3HCW4G.js';
4
4
  //# sourceMappingURL=skeleton.js.map
5
5
  //# sourceMappingURL=skeleton.js.map
@@ -0,0 +1,321 @@
1
+ import * as React from 'react';
2
+ import { n as SliderLabels } from './labels-C992bt7G.js';
3
+
4
+ /** Rail thickness and thumb diameter, on the reference's own 3:1 ratio at every step. */
5
+ type SliderSize = "sm" | "md" | "lg";
6
+ /**
7
+ * Where the value reads, relative to the track.
8
+ *
9
+ * `none` is a real member, not the absence of one: a slider whose value is already stated beside it
10
+ * (a settings row, a filter chip) must not repeat it, and that case needs a name.
11
+ *
12
+ * Named for the **value**, not for a "label": the printed `62%` is a readout of `aria-valuenow`,
13
+ * while `label` is this component's visible field name on the `FieldFrame` — the same word every
14
+ * other control here uses. `Progress` already shipped `valuePosition` for exactly this readout.
15
+ */
16
+ type SliderValuePosition = "none" | "bottom" | "top-floating";
17
+ /**
18
+ * What the band under the track shows at each of its positions.
19
+ *
20
+ * The band has ONE slot per position and until now it had one occupant: a label where the position
21
+ * carried one, a bare notch where it did not. `both` is what lifts that — a tick AND its label, the
22
+ * ruler under a pricing ladder — and once the two can coexist, "notches only" needs a name of its
23
+ * own rather than being the unspellable state between two booleans (AGENTS §4).
24
+ *
25
+ * `labels` is the default and is byte-identical to what shipped before this prop existed.
26
+ *
27
+ * `ticks` is the only way ORDINAL mode can draw a bare ruler: a {@link SliderStop}'s `label` is
28
+ * required, so unlike a {@link SliderMark} it can never omit its way to a notch.
29
+ */
30
+ type SliderBand = "labels" | "ticks" | "both";
31
+ /** Which way the track runs. */
32
+ type SliderOrientation = "horizontal" | "vertical";
33
+ /** What triggered a change. Base UI's own reason vocabulary, re-exposed unchanged. */
34
+ type SliderChangeReason = "input-change" | "track-press" | "drag" | "keyboard" | "none";
35
+ /** Second argument to {@link SliderNumericMode.onValueChange}. */
36
+ interface SliderChangeDetails {
37
+ /** What triggered it. Read it to skip a network call while `reason === "drag"`. */
38
+ reason: SliderChangeReason;
39
+ /** Which thumb moved. `0` on a single-thumb slider. */
40
+ activeThumbIndex: number;
41
+ }
42
+ /** Second argument to {@link SliderNumericMode.onValueCommitted}. Carries no thumb index —
43
+ * a commit is a release, and Base UI's commit event does not report which thumb it belonged to. */
44
+ interface SliderCommitDetails {
45
+ /** What triggered it. */
46
+ reason: SliderChangeReason;
47
+ }
48
+ /** A tick on the NUMERIC scale. `label` absent ⇒ a bare tick, no text. */
49
+ interface SliderMark {
50
+ /** Where it sits, in `min`…`max` units. A value outside that range is reported and skipped. */
51
+ value: number;
52
+ /** Optional text under the tick. Omit for an unlabelled notch. */
53
+ label?: React.ReactNode;
54
+ }
55
+ /** What an ordinal stop's value may be. */
56
+ type SliderStopValue = string | number;
57
+ /**
58
+ * One stop on an ORDINAL slider.
59
+ *
60
+ * Deliberately does NOT extend `Option` from `src/components/field/options.ts`: that base constrains
61
+ * `value` to a `string`, and a tier slider's stops are NUMBERS with one unbounded member
62
+ * (`150, 300, 400, 500, "unlimited"`) — the very shape that makes this mode worth having. So the
63
+ * identity is re-declared here over `string | number` rather than widened there, where it would
64
+ * loosen five other controls' value checks.
65
+ */
66
+ interface SliderStop<T extends SliderStopValue = SliderStopValue> {
67
+ /** The value emitted when this stop is selected. */
68
+ value: T;
69
+ /** The stop's text, shown in the band under the track and in the readout. */
70
+ label: string;
71
+ /**
72
+ * Marks the stop unreachable and dims its label.
73
+ *
74
+ * Base UI cannot skip a stop, so this is enforced on the way in: a move that lands here is
75
+ * redirected to the nearest enabled stop in the direction of travel, which is what makes the thumb
76
+ * step OVER it under both drag and arrow keys rather than resting on a value the caller refused.
77
+ * @default false
78
+ */
79
+ disabled?: boolean;
80
+ }
81
+ /** Everything both modes share — the chrome, and the whole `FieldFrame` contract (AGENTS §6). */
82
+ interface SliderBaseProps {
83
+ /** Rail thickness / thumb diameter. @default "md" */
84
+ size?: SliderSize;
85
+ /** Which way the track runs. A vertical slider takes its height from `className` (`h-64`). @default "horizontal" */
86
+ orientation?: SliderOrientation;
87
+ /** Where the value reads, relative to the track. @default "none" */
88
+ valuePosition?: SliderValuePosition;
89
+ /**
90
+ * What the band under the track shows — labels (the default), notches only, or both.
91
+ *
92
+ * Applies to whichever channel feeds the band in this mode: `stops`, `anchors`, or numeric
93
+ * `marks`. With no band at all — numeric mode without `marks` — there is nothing to show and
94
+ * anything but `"labels"` warns.
95
+ *
96
+ * At `"both"` the notch of an END position sits under the CENTRE OF ITS OWN LABEL rather than at
97
+ * the exact 0 % / 100 %, because the first and last label stay flush so the band never overflows
98
+ * the track. Every interior notch is on its true percentage.
99
+ *
100
+ * @default "labels"
101
+ */
102
+ band?: SliderBand;
103
+ /** Override the component's own copy — the two range-thumb names and the editable input's. */
104
+ labels?: SliderLabels;
105
+ /** Identifies the field when a form is submitted. */
106
+ name?: string;
107
+ /** Identifies the form that owns the slider's inputs — for a slider rendered outside it. */
108
+ form?: string;
109
+ /** Accessible name, for a slider with no visible `label`. */
110
+ "aria-label"?: string;
111
+ /** Accessible name by reference, for a slider named by an element elsewhere. */
112
+ "aria-labelledby"?: string;
113
+ /** Visible label above the track. */
114
+ label?: React.ReactNode;
115
+ /** Help-circle tooltip after the label (its title line). */
116
+ tooltip?: string;
117
+ /** Secondary line under {@link tooltip}. */
118
+ tooltipDescription?: string;
119
+ /** Helper text under the control; hidden while an error shows. */
120
+ hint?: React.ReactNode;
121
+ /** Append a required `*` after the label. @default false */
122
+ required?: boolean;
123
+ /** Keep `required` semantics without the visible `*`. @default false */
124
+ hideRequiredIndicator?: boolean;
125
+ /** Error styling + `aria-invalid`. A non-empty {@link error} implies it. @default false */
126
+ invalid?: boolean;
127
+ /** Error message under the control. Non-empty ⇒ `invalid`. */
128
+ error?: string;
129
+ /** Dims the control and blocks every interaction. @default false */
130
+ disabled?: boolean;
131
+ /** Whether the field column takes `w-full`. Bound a slider with a width in `className`. @default true */
132
+ fullWidth?: boolean;
133
+ /** Layout/spacing only, merged via `cn()` onto the field column. */
134
+ className?: string;
135
+ }
136
+ /** The numeric branch: a continuous scale. */
137
+ interface SliderNumericMode<V extends number | readonly number[] = number> {
138
+ stops?: never;
139
+ anchors?: never;
140
+ /** Controlled value. An array renders one thumb per member (a range). */
141
+ value?: V;
142
+ /** Uncontrolled initial value. An array renders a range. */
143
+ defaultValue?: V;
144
+ /** Fired on every move. Emits the shape it was given — a number for one thumb, an array for a range. */
145
+ onValueChange?: (value: V extends number ? number : readonly number[], details: SliderChangeDetails) => void;
146
+ /** Fired once when a move is released, not per drag frame. */
147
+ onValueCommitted?: (value: V extends number ? number : readonly number[], details: SliderCommitDetails) => void;
148
+ /** Low end of the scale. @default 0 */
149
+ min?: number;
150
+ /** High end of the scale. @default 100 */
151
+ max?: number;
152
+ /**
153
+ * Snap granularity, from `min`. @default 1
154
+ *
155
+ * Non-positive dev-warns — and so does a grid the track cannot address: `max={1_000_000} step={1}`
156
+ * is a million steps along ~450px of travel, which snaps correctly and still prints readout values a
157
+ * drag can never produce again. Measured against the rendered control, because the same scale is fine
158
+ * on a wide track and absurd in a toolbar cell.
159
+ */
160
+ step?: number;
161
+ /** Distance moved by PageUp/PageDown and Shift+Arrow. @default 10 */
162
+ largeStep?: number;
163
+ /** Minimum number of STEPS a range's thumbs must keep between them. @default 0 */
164
+ minStepsBetweenValues?: number;
165
+ /**
166
+ * Turns a value into its readout text — a function of DATA → STRING, the same category
167
+ * `Table`'s `cell` and `Progress`'s `formatValue` occupy. Feeds the readout, the `marks="ends"`
168
+ * labels AND `aria-valuetext`, so what is shown and what is announced cannot disagree.
169
+ *
170
+ * **ONE prop, not a function beside an `Intl` options bag.** It shipped briefly as both, with the
171
+ * function winning — i.e. a documented priority chain between two props answering one question,
172
+ * which AGENTS §4 says to collapse. That chain also hid a real defect: the bag was forwarded to
173
+ * Base UI (which derives `aria-valuetext` from it) while the function was not, so the MORE
174
+ * expressive of the two silently desynced the visible readout from the announcement — measured at
175
+ * `aria-valuetext: null` against a visible `7 seats`.
176
+ *
177
+ * **What that costs, accepted deliberately:** an `Intl` options bag is locale-aware for free, and
178
+ * a hand-written function is not — so a currency scale writes the `Intl.NumberFormat` call itself
179
+ * rather than declaring `{ style: "currency" }`. The DEFAULT readout is still locale-aware (see
180
+ * `readoutOf`), so this is only paid by callers who override it.
181
+ *
182
+ * **It is not in `SliderStopsMode` at all** — an ordinal stop's `label` IS its text, and no
183
+ * `(value: number) => string` could produce `"500+"` anyway.
184
+ */
185
+ format?: (value: number) => string;
186
+ /** Ticks under the track. `"ends"` is the shorthand for the `min`/`max` pair. */
187
+ marks?: readonly SliderMark[] | "ends";
188
+ /** Makes the floating bubble a real input. Needs `valuePosition="top-floating"`. @default false */
189
+ editable?: boolean;
190
+ }
191
+ /**
192
+ * One boundary on an UNEVEN numeric scale — see {@link SliderAnchorsMode}.
193
+ *
194
+ * `label` absent ⇒ a bare notch, exactly as {@link SliderMark} behaves: in this mode the anchors ARE
195
+ * the band, so an unlabelled boundary still has to be visible.
196
+ */
197
+ interface SliderAnchor {
198
+ /** Where the boundary sits, in the caller's own units. Ascending — the FIRST anchor is the
199
+ * scale's minimum and the LAST is its maximum, which is why this mode has no `min`/`max`. */
200
+ value: number;
201
+ /** Text under the boundary. Omit for an unlabelled notch. */
202
+ label?: React.ReactNode;
203
+ /**
204
+ * The value grid from THIS anchor to the next — "from here, step by X". Falls back to the
205
+ * top-level `step`.
206
+ *
207
+ * A step at least as wide as its own band makes that band offer only its two boundaries, which is
208
+ * how a snapped cap is written: `{ value: 500, label: "500 Users", step: 500 }` over a 500…1000
209
+ * band reaches 500 and 1000 and nothing between. Meaningless on the LAST anchor — no band starts
210
+ * there — and reported.
211
+ */
212
+ step?: number;
213
+ }
214
+ /**
215
+ * The anchored branch: a numeric scale whose bands are EQUAL on the track and UNEQUAL in value.
216
+ *
217
+ * Six anchors draw five bands of 20% each, so `0…150` and `300…400` occupy the same width while
218
+ * holding 150 and 100 steps of 1. **The value grid stays uniform in the DOMAIN** — a step is a step
219
+ * wherever the thumb is — and only the mapping to pixels is piecewise, which is why `snapToStep`,
220
+ * `format` and the editable readout all work here unchanged.
221
+ *
222
+ * **The list answers `min`, `max` and `marks`**, so all three are `never` and this mode adds exactly
223
+ * ONE prop to the numeric surface rather than four.
224
+ */
225
+ interface SliderAnchorsMode<V extends number | readonly number[] = number> {
226
+ /** The boundaries, ascending. At least two, because one point is not a scale — the type says so
227
+ * rather than leaving it to a warning (the `AtLeastOne` precedent in `src/lib/at-least-one.ts`). */
228
+ anchors: readonly [SliderAnchor, SliderAnchor, ...SliderAnchor[]];
229
+ stops?: never;
230
+ /** Controlled value, in the caller's own units. An array renders a range. */
231
+ value?: V;
232
+ /** Uncontrolled initial value. An array renders a range. */
233
+ defaultValue?: V;
234
+ /** Fired on every move, with the value snapped onto its band's grid. */
235
+ onValueChange?: (value: V extends number ? number : readonly number[], details: SliderChangeDetails) => void;
236
+ /** Fired once when a move is released — and once per keypress, because this mode drives its own
237
+ * keyboard (see the handler on the thumb). */
238
+ onValueCommitted?: (value: V extends number ? number : readonly number[], details: SliderCommitDetails) => void;
239
+ min?: never;
240
+ max?: never;
241
+ marks?: never;
242
+ minStepsBetweenValues?: never;
243
+ /** The value grid inside any band that declares none of its own. @default 1 */
244
+ step?: number;
245
+ /** Distance moved by PageUp/PageDown and Shift+Arrow, in the caller's units — never less than one
246
+ * step of the band it is moving through. @default 10 */
247
+ largeStep?: number;
248
+ /** Turns a value into its readout text. Same prop, same contract, as the numeric branch. */
249
+ format?: (value: number) => string;
250
+ /** Makes the floating bubble a real input. Needs `valuePosition="top-floating"`. @default false */
251
+ editable?: boolean;
252
+ }
253
+ /**
254
+ * The ordinal branch: a closed set of stops, drawn as equal segments.
255
+ *
256
+ * **Generic in the OPTION, not in the stop value** — and that is load-bearing rather than a style
257
+ * choice. Every other list control here threads `V extends string`, where TypeScript happily unions
258
+ * the inference candidates from a literal `stops` array. This one's stops span `string | number`
259
+ * on purpose (`150, 300, "unlimited"`), and across a MIXED candidate set inference collapses to the
260
+ * FIRST one — measured: `stops={TIERS}` was inferred as `SliderStop<150>`, so the second stop
261
+ * failed to assign to its own list. Inferring the option type and reading `O["value"]` back off it
262
+ * keeps the whole union, negative cases included.
263
+ */
264
+ interface SliderStopsMode<O extends SliderStop = SliderStop> {
265
+ /**
266
+ * The stops, in order. The track becomes an INDEX slider (`min: 0`, `max: stops.length - 1`,
267
+ * `step: 1`) and the emitted value is `stops[i].value`.
268
+ *
269
+ * **Named `stops`, not `options`** — the one place this library departs from AGENTS §11's
270
+ * "every value list is `options`", and only because the component now carries a SECOND
271
+ * list-shaped prop: `stops` is the closed set the thumb may rest on, `anchors` is where the axis
272
+ * is pinned. A generic name beside a specific one tells a reader nothing.
273
+ */
274
+ stops: readonly O[];
275
+ /** Controlled value — **checked against `stops`**. An array renders a range. */
276
+ value?: NoInfer<O["value"]> | readonly NoInfer<O["value"]>[];
277
+ /** Uncontrolled initial value — checked against `stops` exactly like {@link value}. */
278
+ defaultValue?: NoInfer<O["value"]> | readonly NoInfer<O["value"]>[];
279
+ /** Fired on every move, with the stop's own `value`. */
280
+ onValueChange?: (value: O["value"] | readonly O["value"][], details: SliderChangeDetails) => void;
281
+ /** Fired once when a move is released. */
282
+ onValueCommitted?: (value: O["value"] | readonly O["value"][], details: SliderCommitDetails) => void;
283
+ anchors?: never;
284
+ min?: never;
285
+ max?: never;
286
+ step?: never;
287
+ largeStep?: never;
288
+ minStepsBetweenValues?: never;
289
+ format?: never;
290
+ marks?: never;
291
+ editable?: never;
292
+ }
293
+ type SliderProps<O extends SliderStop = SliderStop, V extends number | readonly number[] = number> = SliderBaseProps & (SliderNumericMode<V> | SliderAnchorsMode<V> | SliderStopsMode<O>);
294
+ /**
295
+ * A value on a track — flat, data-first, no exported parts.
296
+ *
297
+ * ```tsx
298
+ * <Slider label="Opacity" defaultValue={60} valuePosition="top-floating" />
299
+ *
300
+ * <Slider
301
+ * label="Team size"
302
+ * stops={[
303
+ * { value: 150, label: "150 Users" },
304
+ * { value: "unlimited", label: "500+" },
305
+ * ]}
306
+ * defaultValue={150}
307
+ * />
308
+ *
309
+ * <Slider
310
+ * label="Seats"
311
+ * step={1}
312
+ * anchors={[{ value: 0 }, { value: 150, label: "150 Users" }, { value: 500, label: "500+", step: 500 }]}
313
+ * defaultValue={186}
314
+ * />
315
+ * ```
316
+ */
317
+ declare function Slider<V extends number | readonly number[] = number>(props: SliderBaseProps & SliderNumericMode<V>): React.JSX.Element;
318
+ declare function Slider<V extends number | readonly number[] = number>(props: SliderBaseProps & SliderAnchorsMode<V>): React.JSX.Element;
319
+ declare function Slider<const O extends SliderStop>(props: SliderBaseProps & SliderStopsMode<O>): React.JSX.Element;
320
+
321
+ export { Slider, type SliderAnchor, type SliderAnchorsMode, type SliderBand, type SliderBaseProps, type SliderChangeDetails, type SliderChangeReason, type SliderCommitDetails, type SliderMark, type SliderNumericMode, type SliderOrientation, type SliderProps, type SliderSize, type SliderStop, type SliderStopValue, type SliderStopsMode, type SliderValuePosition };
package/dist/slider.js ADDED
@@ -0,0 +1,13 @@
1
+ "use client";export { Slider } from './chunk-GOCO45FF.js';
2
+ import './chunk-7S2TBALK.js';
3
+ import './chunk-VIKV25VP.js';
4
+ import './chunk-KTWTYK5U.js';
5
+ import './chunk-7LSUUEAF.js';
6
+ import './chunk-O4GRKO3I.js';
7
+ import './chunk-YGFTNICV.js';
8
+ import './chunk-ZSNJ6UA3.js';
9
+ import './chunk-ZJIY642R.js';
10
+ import './chunk-SF3HCW4G.js';
11
+ import './chunk-3ZEEGXYF.js';
12
+ //# sourceMappingURL=slider.js.map
13
+ //# sourceMappingURL=slider.js.map