@jfrader/ui 0.5.0 → 0.5.1

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 (179) hide show
  1. package/dist/accordion-DLul6vIl.js +205 -0
  2. package/dist/accordion.js +1 -1
  3. package/dist/{announcement-bar-B58xempt.js → announcement-bar-Dlbq5-9D.js} +1 -1
  4. package/dist/announcement-bar.js +1 -1
  5. package/dist/avatar-CaGJHy1N.js +145 -0
  6. package/dist/{avatar-group-DOQQuV51.js → avatar-group-M1opAQEG.js} +1 -1
  7. package/dist/avatar-group.js +1 -1
  8. package/dist/avatar.js +1 -1
  9. package/dist/badge-CjM5Agqk.js +119 -0
  10. package/dist/badge.js +1 -1
  11. package/dist/{bottom-sheet-DPJBFkie.js → bottom-sheet-DjZOPq4k.js} +10 -9
  12. package/dist/bottom-sheet.js +1 -1
  13. package/dist/{breadcrumbs-Cfw_hgt2.js → breadcrumbs-BDK_LiwH.js} +10 -3
  14. package/dist/breadcrumbs.js +1 -1
  15. package/dist/{button-C92uYFJW.js → button-NLY0h6EJ.js} +7 -7
  16. package/dist/button.js +1 -1
  17. package/dist/{calendar-B3Svu0X2.js → calendar-BzJdv_SZ.js} +3 -1
  18. package/dist/calendar.js +1 -1
  19. package/dist/card-Ca4KQKYQ.js +154 -0
  20. package/dist/card.js +1 -1
  21. package/dist/carousel-B7OrvD6J.js +474 -0
  22. package/dist/carousel.js +1 -1
  23. package/dist/{checkbox-cFquiSdy.js → checkbox-DKSzExj2.js} +16 -15
  24. package/dist/checkbox.js +1 -1
  25. package/dist/{chip-group-DTQd_M-G.js → chip-group-DjQ0_6Y9.js} +2 -1
  26. package/dist/chip-group.js +1 -1
  27. package/dist/{code-block-ahnRi-g8.js → code-block-B5we2lZa.js} +75 -74
  28. package/dist/code-block.js +1 -1
  29. package/dist/{combobox-Bhzvu9ma.js → combobox-DFFqOBCi.js} +114 -109
  30. package/dist/combobox.js +1 -1
  31. package/dist/command-palette-BmQu2w4H.js +391 -0
  32. package/dist/command-palette.js +1 -1
  33. package/dist/comment-thread-ASaXDcGo.js +1410 -0
  34. package/dist/comment-thread.js +2 -0
  35. package/dist/context-menu-__1c2Dk9.js +370 -0
  36. package/dist/context-menu.js +2 -0
  37. package/dist/{copy-button-ByiA6D3R.js → copy-button-DCSLcYS-.js} +1 -1
  38. package/dist/copy-button.js +1 -1
  39. package/dist/{date-picker-5zKSSuFF.js → date-picker-BiPN7yeK.js} +4 -4
  40. package/dist/date-picker.js +1 -1
  41. package/dist/date-range-picker-DQpUeKqV.js +570 -0
  42. package/dist/date-range-picker.js +1 -1
  43. package/dist/{dialog-ciiv9H2b.js → dialog-BX1zYMs-.js} +2 -1
  44. package/dist/dialog.js +1 -1
  45. package/dist/{divider-DYoJf0I_.js → divider-Cp7aNbhM.js} +21 -20
  46. package/dist/divider.js +1 -1
  47. package/dist/elastic-slider-BG6K019r.js +395 -0
  48. package/dist/elastic-slider.js +2 -0
  49. package/dist/{expandable-card-C-qJcZ14.js → expandable-card-rUATve0o.js} +8 -1
  50. package/dist/expandable-card.js +1 -1
  51. package/dist/expanding-search-BxOwtdwt.js +238 -0
  52. package/dist/expanding-search.js +2 -0
  53. package/dist/file-dropzone-BuXm3Tea.js +457 -0
  54. package/dist/file-dropzone.js +1 -1
  55. package/dist/{filter-toolbar-D5KEKTSe.js → filter-toolbar-Cy5Hqur-.js} +4 -2
  56. package/dist/filter-toolbar.js +1 -1
  57. package/dist/{hover-card-B-nrCIy2.js → hover-card-CoMJKg1g.js} +7 -7
  58. package/dist/hover-card.js +1 -1
  59. package/dist/{image-compare-ciuhPtQZ.js → image-compare-BxY8Ykzt.js} +1 -1
  60. package/dist/image-compare.js +1 -1
  61. package/dist/index.js +81 -76
  62. package/dist/{json-viewer-BcySQfjZ.js → json-viewer-DgWqyU75.js} +7 -3
  63. package/dist/json-viewer.js +1 -1
  64. package/dist/mention-input-sq61si9L.js +600 -0
  65. package/dist/mention-input.js +1 -1
  66. package/dist/menu-DDKgmK2F.js +295 -0
  67. package/dist/menu.js +1 -1
  68. package/dist/{metric-card-Bh9K4fZs.js → metric-card--lVTz5Wn.js} +2 -2
  69. package/dist/metric-card.js +1 -1
  70. package/dist/{multi-select-Pce_IYnz.js → multi-select-DG1BCFX7.js} +14 -6
  71. package/dist/multi-select.js +1 -1
  72. package/dist/{navigation-sP5fiuQS.js → navigation-CC26JDr-.js} +20 -14
  73. package/dist/navigation.js +1 -1
  74. package/dist/{overlay-layer-SeUyyEPD.js → overlay-layer-qEbpEtb8.js} +16 -2
  75. package/dist/{pagination-DmXZ8E85.js → pagination-BfkeWbmP.js} +23 -22
  76. package/dist/pagination.js +1 -1
  77. package/dist/pill-BaS-uIbn.js +58 -0
  78. package/dist/pill.js +1 -1
  79. package/dist/popover-CErIw2q3.js +125 -0
  80. package/dist/popover.js +1 -1
  81. package/dist/{progress-CbOWBUdA.js → progress-DAQkfhPd.js} +1 -1
  82. package/dist/progress.js +1 -1
  83. package/dist/{radio-cards-D2QZENI_.js → radio-cards-Cu9cBssN.js} +35 -34
  84. package/dist/radio-cards.js +1 -1
  85. package/dist/{radio-group-E6mMRgo7.js → radio-group-TIK0-iPX.js} +18 -15
  86. package/dist/radio-group.js +1 -1
  87. package/dist/{resizable-panels-BhjUVXZZ.js → resizable-panels-DUpQEpwG.js} +3 -2
  88. package/dist/resizable-panels.js +1 -1
  89. package/dist/{search-field-IxF0IJXm.js → search-field-DMvho0KQ.js} +2 -2
  90. package/dist/search-field.js +1 -1
  91. package/dist/{segmented-control-yO1K1nbi.js → segmented-control-8ZUGnsZm.js} +2 -1
  92. package/dist/segmented-control.js +1 -1
  93. package/dist/{select-n_H52W1Z.js → select-D5rhJ8gi.js} +3 -2
  94. package/dist/select.js +1 -1
  95. package/dist/{signature-pad-q2SAsrdD.js → signature-pad-_bTeguN9.js} +256 -251
  96. package/dist/signature-pad.js +1 -1
  97. package/dist/slider-DVG6-Awh.js +308 -0
  98. package/dist/slider.js +1 -1
  99. package/dist/{sortable-data-table-tirqlLY2.js → sortable-data-table-CYKT_Ng7.js} +2 -2
  100. package/dist/sortable-data-table.js +1 -1
  101. package/dist/{split-button-Cb3EHs64.js → split-button-BCw4zZom.js} +75 -81
  102. package/dist/split-button.js +1 -1
  103. package/dist/{swipe-actions-DiZC57-3.js → swipe-actions-CBuJREU1.js} +4 -2
  104. package/dist/swipe-actions.js +1 -1
  105. package/dist/switch-C1WrKrf-.js +145 -0
  106. package/dist/switch.js +1 -1
  107. package/dist/tabs-XluwRjgg.js +210 -0
  108. package/dist/tabs.js +1 -1
  109. package/dist/{text-field-C8TWG-tY.js → text-field-hU72iSVS.js} +15 -13
  110. package/dist/text-field.js +1 -1
  111. package/dist/{textarea-BrW0XcG_.js → textarea-3k4Y0QQ3.js} +18 -16
  112. package/dist/textarea.js +1 -1
  113. package/dist/theme-root.js +1 -1
  114. package/dist/theme-switch-C505TtU8.js +166 -0
  115. package/dist/theme-switch.js +2 -0
  116. package/dist/{time-picker-Db8D49cP.js → time-picker-CPlhW0tr.js} +26 -20
  117. package/dist/time-picker.js +1 -1
  118. package/dist/{timeline-k3nURuCP.js → timeline-B0uAAVfT.js} +8 -2
  119. package/dist/timeline.js +1 -1
  120. package/dist/{toast-BHxI32ZA.js → toast-B7wo3sX1.js} +98 -79
  121. package/dist/{toast-stack-DqrAzdg5.js → toast-stack-B40VpS4M.js} +18 -4
  122. package/dist/toast-stack.js +1 -1
  123. package/dist/toast.js +1 -1
  124. package/dist/{toggle-group-fcjzpifI.js → toggle-group-B2fpFZwV.js} +1 -1
  125. package/dist/toggle-group.js +1 -1
  126. package/dist/tooltip-BvgVTCTN.js +120 -0
  127. package/dist/tooltip.js +1 -1
  128. package/dist/{tree-view-C2liIxqy.js → tree-view-j8qLqkb_.js} +5 -1
  129. package/dist/tree-view.js +1 -1
  130. package/dist/types/components/checkbox/checkbox.d.ts +1 -1
  131. package/dist/types/components/command-palette/command-palette.d.ts +1 -1
  132. package/dist/types/components/comment-thread/comment-thread.d.ts +118 -0
  133. package/dist/types/components/comment-thread/index.d.ts +1 -0
  134. package/dist/types/components/comment-thread/thread-core.d.ts +96 -0
  135. package/dist/types/components/comment-thread/thread-parts.d.ts +114 -0
  136. package/dist/types/components/context-menu/context-menu.d.ts +55 -0
  137. package/dist/types/components/context-menu/index.d.ts +2 -0
  138. package/dist/types/components/date-range-picker/date-range-picker.d.ts +1 -1
  139. package/dist/types/components/elastic-slider/elastic-slider.d.ts +53 -0
  140. package/dist/types/components/elastic-slider/index.d.ts +1 -0
  141. package/dist/types/components/expanding-search/expanding-search.d.ts +22 -0
  142. package/dist/types/components/expanding-search/index.d.ts +1 -0
  143. package/dist/types/components/menu/menu.d.ts +50 -7
  144. package/dist/types/components/pagination/pagination.d.ts +1 -1
  145. package/dist/types/components/radio-cards/radio-cards.d.ts +1 -1
  146. package/dist/types/components/radio-group/radio-group.d.ts +1 -1
  147. package/dist/types/components/slider/slider-style.d.ts +14 -0
  148. package/dist/types/components/slider/slider.d.ts +2 -10
  149. package/dist/types/components/slider/use-slider-interaction.d.ts +79 -0
  150. package/dist/types/components/split-button/split-button.d.ts +2 -2
  151. package/dist/types/components/tabs/tabs.d.ts +1 -1
  152. package/dist/types/components/text-field/text-field.d.ts +1 -1
  153. package/dist/types/components/textarea/textarea.d.ts +1 -1
  154. package/dist/types/components/theme-switch/index.d.ts +1 -0
  155. package/dist/types/components/theme-switch/theme-switch.d.ts +33 -0
  156. package/dist/types/components/tooltip/tooltip.d.ts +1 -1
  157. package/dist/types/index.d.ts +5 -0
  158. package/dist/types/overlay/overlay-layer.d.ts +20 -0
  159. package/dist/types/overlay/use-overlay-floating.d.ts +9 -2
  160. package/dist/{use-overlay-floating-DvJifLpF.js → use-overlay-floating-Bx2jBKAA.js} +8 -6
  161. package/dist/use-slider-interaction-ChL-208h.js +234 -0
  162. package/package.json +22 -2
  163. package/dist/accordion-xCI_u0BV.js +0 -198
  164. package/dist/avatar-BahDVO9t.js +0 -132
  165. package/dist/badge-B_sLygxU.js +0 -108
  166. package/dist/card-D-aI2QHx.js +0 -158
  167. package/dist/carousel-IvPqN-oM.js +0 -472
  168. package/dist/command-palette-BQ5LleGb.js +0 -384
  169. package/dist/date-range-picker-B5uFWsm-.js +0 -562
  170. package/dist/file-dropzone-pR4v7owg.js +0 -457
  171. package/dist/mention-input-BcQKX2EJ.js +0 -599
  172. package/dist/menu-xwOOUtWP.js +0 -275
  173. package/dist/pill-DO2gHzMb.js +0 -56
  174. package/dist/popover-QHcEvf9c.js +0 -119
  175. package/dist/slider-t0B5cecO.js +0 -477
  176. package/dist/switch-qwv8jQnR.js +0 -142
  177. package/dist/tabs-CAVJndX1.js +0 -203
  178. package/dist/tooltip-CkeiW9C1.js +0 -113
  179. package/dist/{theme-root-BbTBuLMQ.js → theme-root-Bs1U3uPA.js} +2 -2
@@ -1,477 +0,0 @@
1
- 'use client';
2
- import { r as e, t } from "./sx-Dx9JUKp5.js";
3
- import { n } from "./focus-ring-BK5W5_NY.js";
4
- import { n as r, r as i } from "./media-8yrN85VT.js";
5
- import { t as a } from "./use-controlled-state-DpeVQZNR.js";
6
- import { t as o } from "./visually-hidden-BJdvqqvn.js";
7
- import { t as s } from "./renderable-DzcIj1Lo.js";
8
- import { useEffect as c, useId as ee, useMemo as te, useRef as l, useState as u } from "react";
9
- import { vars as d } from "@jfrader/tokens/vars";
10
- import { createElement as ne } from "@emotion/react";
11
- import { jsx as f, jsxs as p } from "@emotion/react/jsx-runtime";
12
- import { MotionConfig as re, motion as ie, useReducedMotion as ae } from "motion/react";
13
- //#region src/components/slider/slider.tsx
14
- var m = 1e-7, oe = {
15
- type: "spring",
16
- stiffness: 420,
17
- damping: 30
18
- }, se = 8, ce = e({
19
- label: "slider",
20
- display: "grid",
21
- gap: d.space[2],
22
- minInlineSize: 0,
23
- inlineSize: "100%",
24
- fontFamily: d.font.sans,
25
- fontSize: d.textSize.sm,
26
- lineHeight: d.lineHeight.base,
27
- color: d.color.text
28
- }), le = e({
29
- display: "flex",
30
- flexWrap: "wrap",
31
- justifyContent: "space-between",
32
- gap: d.space[2],
33
- alignItems: "baseline"
34
- }), ue = e({ fontWeight: d.fontWeight.medium }), de = e({
35
- fontVariantNumeric: "tabular-nums",
36
- overflowWrap: "anywhere"
37
- }), fe = e({ color: d.color.textMuted }), pe = e({ color: d.color.dangerText }), me = e({
38
- display: "flex",
39
- alignItems: "center",
40
- gap: d.space[3],
41
- minInlineSize: 0,
42
- paddingBlockStart: d.space[8]
43
- }), he = e({
44
- position: "relative",
45
- flex: 1,
46
- minInlineSize: d.space[8],
47
- marginInline: d.space[4],
48
- touchAction: "pan-y",
49
- userSelect: "none",
50
- cursor: "pointer",
51
- "&[data-disabled]": { cursor: "default" }
52
- }), ge = {
53
- sm: e({ minBlockSize: d.space[8] }),
54
- md: e({ minBlockSize: d.space[10] })
55
- }, _e = e({
56
- position: "absolute",
57
- insetInline: 0,
58
- insetBlockStart: "50%",
59
- transform: "translateY(-50%)",
60
- blockSize: d.space[1],
61
- boxSizing: "border-box",
62
- border: `1px solid ${d.color.borderControl}`,
63
- borderRadius: d.radius.full,
64
- background: d.color.surfaceInset,
65
- pointerEvents: "none",
66
- [r]: {
67
- forcedColorAdjust: "none",
68
- background: "Canvas",
69
- borderColor: "CanvasText"
70
- }
71
- }), ve = e({
72
- position: "absolute",
73
- insetBlock: 0,
74
- background: d.color.accent,
75
- borderRadius: d.radius.full,
76
- [r]: { background: "Highlight" }
77
- }), ye = e({
78
- position: "absolute",
79
- insetBlockStart: "50%",
80
- transform: "translate(-50%, -50%)",
81
- "&:dir(rtl)": { transform: "translate(50%, -50%)" },
82
- inlineSize: d.space[8],
83
- blockSize: d.space[8],
84
- display: "grid",
85
- placeItems: "center",
86
- borderRadius: d.radius.full,
87
- cursor: "grab",
88
- "&:focus-visible": {
89
- ...n,
90
- zIndex: 2
91
- },
92
- "&[data-dragging]": {
93
- cursor: "grabbing",
94
- zIndex: 3
95
- },
96
- "&[aria-disabled=\"true\"]": { cursor: "default" }
97
- }), be = e({
98
- inlineSize: d.space[6],
99
- blockSize: d.space[6],
100
- boxSizing: "border-box",
101
- border: `2px solid ${d.color.borderControl}`,
102
- borderRadius: d.radius.full,
103
- background: d.color.surfaceRaised,
104
- boxShadow: d.shadow.raised,
105
- pointerEvents: "none",
106
- [r]: {
107
- forcedColorAdjust: "none",
108
- background: "Canvas",
109
- borderColor: "CanvasText",
110
- boxShadow: "none"
111
- }
112
- }), xe = e({
113
- position: "absolute",
114
- insetBlockEnd: `calc(100% + ${d.space[2]})`,
115
- paddingInline: d.space[2],
116
- paddingBlock: d.space[1],
117
- inlineSize: "max-content",
118
- maxInlineSize: "min(24rem, 80vw)",
119
- overflowWrap: "anywhere",
120
- border: `1px solid ${d.color.borderControl}`,
121
- borderRadius: d.radius.md,
122
- background: d.color.surfaceRaised,
123
- color: d.color.text,
124
- boxShadow: d.shadow.raised,
125
- pointerEvents: "none",
126
- fontSize: d.textSize.xs,
127
- opacity: 0,
128
- transition: `opacity ${d.motion.duration.fast} ${d.motion.easeStandard}`,
129
- "[data-dragging] > &, [data-slider-thumb]:focus-visible > &": { opacity: 1 },
130
- [i]: { transitionDuration: "0s" },
131
- [r]: {
132
- borderColor: "CanvasText",
133
- boxShadow: "none"
134
- }
135
- }), Se = e({
136
- position: "absolute",
137
- insetBlockStart: "50%",
138
- transform: "translate(-50%, -50%)",
139
- inlineSize: d.space[1],
140
- blockSize: d.space[2],
141
- border: `1px solid ${d.color.borderControl}`,
142
- background: d.color.surfaceRaised,
143
- boxSizing: "border-box",
144
- pointerEvents: "none",
145
- [r]: {
146
- background: "Canvas",
147
- borderColor: "CanvasText"
148
- }
149
- }), Ce = e({
150
- display: "flex",
151
- flexWrap: "wrap",
152
- gap: d.space[2]
153
- }), we = e({
154
- minBlockSize: d.space[8],
155
- minInlineSize: d.space[8],
156
- paddingBlock: d.space[1],
157
- paddingInline: d.space[2],
158
- font: "inherit",
159
- overflowWrap: "anywhere",
160
- maxInlineSize: "100%",
161
- color: d.color.text,
162
- background: d.color.surfaceRaised,
163
- border: `1px solid ${d.color.borderControl}`,
164
- borderRadius: d.radius.md,
165
- cursor: "pointer",
166
- "&:focus-visible": n,
167
- "&:disabled": { cursor: "default" },
168
- [r]: { borderColor: "ButtonText" }
169
- });
170
- function h(e, t) {
171
- return typeof e == "number" ? e === t : typeof t != "number" && e[0] === t[0] && e[1] === t[1];
172
- }
173
- function Te(...e) {
174
- return e.filter(Boolean).join(" ") || void 0;
175
- }
176
- function g(e) {
177
- return s(e) && e !== "";
178
- }
179
- function Ee(e, t) {
180
- return typeof e == "function" ? e(t) : e;
181
- }
182
- function _(e) {
183
- let { ref: n, type: r = "single", value: i, defaultValue: s, label: d, description: _, error: De, invalid: Oe = !1, disabled: v = !1, min: y = 0, max: b = 100, step: x = 1, largeStep: S, minStepsBetweenThumbs: C = 0, marks: ke = [], thumbLabels: w, locale: Ae, formatOptions: je, formatValue: T, showValue: Me = !0, start: Ne, end: Pe, name: E, size: Fe = "md", slotProps: D, onValueChange: Ie, onValueCommit: Le, className: Re, sx: ze, onKeyDown: Be, "aria-label": Ve, "aria-labelledby": He, "aria-describedby": Ue, "aria-invalid": We, ...Ge } = e, O = r === "range", k = (b - y) / x;
184
- if (![
185
- y,
186
- b,
187
- x,
188
- k
189
- ].every(Number.isFinite) || b <= y || x <= 0 || !Number.isSafeInteger(Math.round(k)) || Math.abs(k - Math.round(k)) > m) throw Error("Slider requires finite min < max, a positive step, and max aligned to min + n * step.");
190
- if (!Number.isInteger(C) || C < 0 || C > Math.round(k)) throw Error("Slider minStepsBetweenThumbs must be a nonnegative integer that fits the domain.");
191
- if (S !== void 0 && (!Number.isFinite(S) || S <= 0)) throw Error("Slider largeStep must be finite and positive.");
192
- let A = C * x, j = Math.max(1, Math.round((S ?? (b - y) / 10) / x)) * x, M = (e) => {
193
- if (!Number.isFinite(e)) throw Error("Slider values must be finite.");
194
- let t = Math.max(0, Math.min(Math.round(k), Math.round((e - y) / x))), n = y + t * x, r = Number(n.toPrecision(15));
195
- return Math.abs(r - n) <= x * m ? r : n;
196
- }, Ke = (e) => {
197
- if (!O) {
198
- if (typeof e != "number") throw Error("Slider single mode requires a number.");
199
- return M(e);
200
- }
201
- if (typeof e == "number" || e.length !== 2 || e[0] > e[1]) throw Error("Slider range requires an ordered [lower, upper] tuple.");
202
- let t = M(e[0]), n = M(e[1]);
203
- if ((n - t) / x + m < C) throw Error("Slider range values must respect minStepsBetweenThumbs.");
204
- return [t, n];
205
- }, [qe] = u(() => Ke(s ?? (O ? [y, b] : y))), Je = (t) => {
206
- e.type, e.onValueChange?.(t);
207
- }, N = (t) => {
208
- e.type, e.onValueCommit?.(t);
209
- }, [Ye, Xe, Ze] = a(i, qe, Je), P = Ke(Ye ?? qe), F = typeof P == "number" ? [P] : P, I = ee(), L = te(() => new Intl.NumberFormat(Ae, je), [Ae, je]), R = (e) => T ? T(e, L) : L.format(e), Qe = typeof P == "number" ? R(P) : !T && "formatRange" in L ? L.formatRange(P[0], P[1]) : `${R(P[0])} – ${R(P[1])}`, z = ae(), B = l(null), V = l(null), $e = l(0), [H, U] = u(null), [et, tt] = u(0), W = (e) => O ? [e === 0 ? y : F[0] + A, e === 0 ? F[1] - A : b] : [y, b], G = (e, t) => {
210
- let [n, r] = W(e), i = M(Math.max(n, Math.min(r, t)));
211
- return O ? e === 0 ? [i, F[1]] : [F[0], i] : i;
212
- }, K = (e) => {
213
- h(P, e) || Xe(e);
214
- }, q = (e) => {
215
- let t = V.current;
216
- t && (V.current = null, U(null), tt(0), t.control.hasPointerCapture(t.pointerId) && t.control.releasePointerCapture(t.pointerId), e && !h(t.initial, t.candidate) && N(t.candidate));
217
- };
218
- c(() => {
219
- v && q(!1);
220
- }, [v]), c(() => () => {
221
- let e = V.current;
222
- V.current = null, e?.control.hasPointerCapture(e.pointerId) && e.control.releasePointerCapture(e.pointerId);
223
- }, []), c(() => {
224
- let e = B.current?.closest("form");
225
- if (!e) return;
226
- let t = (e) => {
227
- queueMicrotask(() => {
228
- e.defaultPrevented || (q(!1), Ze());
229
- });
230
- };
231
- return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
232
- }, [Ze]);
233
- let nt = (e) => B.current?.querySelector(`[data-slider-thumb="${e}"]`)?.focus(), J = () => B.current?.matches(":dir(rtl)") ?? !1, rt = (e) => {
234
- let t = B.current.getBoundingClientRect(), n = t.width > 0 ? (e - t.left) / t.width : 0;
235
- return y + (J() ? 1 - n : n) * (b - y);
236
- }, it = (e) => O ? Math.abs(e - F[0]) === Math.abs(e - F[1]) ? $e.current : Math.abs(e - F[0]) < Math.abs(e - F[1]) ? 0 : 1 : 0, at = (e) => {
237
- let t = V.current;
238
- if (!t || e.pointerId !== t.pointerId || v) return;
239
- t.coincident && e.clientX !== t.originX && (t.thumb = e.clientX > t.originX === J() ? 0 : 1, t.coincident = !1, U(t.thumb), nt(t.thumb));
240
- let n = rt(e.clientX - t.offset), r = G(t.thumb, n), [i, a] = W(t.thumb);
241
- tt(z ? 0 : Math.max(-8, Math.min(se, (n - Math.max(i, Math.min(a, n))) * (J() ? -1 : 1)))), h(t.candidate, r) || (t.candidate = r, K(r));
242
- }, ot = (e) => {
243
- if (e.defaultPrevented || v || V.current || !e.isPrimary || e.button !== 0) return;
244
- let t = e.target.closest("[data-slider-thumb]"), n = t ? Number(t.dataset.sliderThumb) : it(rt(e.clientX)), r = t?.getBoundingClientRect(), i = r ? e.clientX - (r.left + r.width / 2) : 0;
245
- V.current = {
246
- pointerId: e.pointerId,
247
- thumb: n,
248
- offset: i,
249
- originX: e.clientX,
250
- coincident: O && F[0] === F[1],
251
- initial: P,
252
- candidate: P,
253
- control: e.currentTarget
254
- }, e.currentTarget.setPointerCapture(e.pointerId), e.preventDefault(), U(n), nt(n), t || at(e);
255
- }, st = (e, t) => {
256
- if (v || e.defaultPrevented) return;
257
- let n = J() ? -1 : 1, r = e.shiftKey ? j : x, [i, a] = W(t), o = {
258
- ArrowRight: F[t] + r * n,
259
- ArrowLeft: F[t] - r * n,
260
- ArrowUp: F[t] + r,
261
- ArrowDown: F[t] - r,
262
- PageUp: F[t] + j,
263
- PageDown: F[t] - j,
264
- Home: i,
265
- End: a
266
- }[e.key];
267
- if (o === void 0) return;
268
- e.preventDefault();
269
- let s = G(t, o);
270
- h(P, s) || (K(s), N(s));
271
- }, Y = Array.from(new Map(ke.flatMap((e) => {
272
- let t = typeof e == "number" ? { value: e } : e;
273
- return Number.isFinite(t.value) && t.value >= y && t.value <= b ? [[M(t.value), {
274
- ...t,
275
- value: M(t.value)
276
- }]] : [];
277
- })).values()), X = (e) => (e - y) / (b - y) * 100, ct = O ? X(F[0]) : 0, lt = X(F[+!!O]), Z = g(d), Q = g(_), $ = g(De);
278
- return /* @__PURE__ */ f(re, {
279
- reducedMotion: "user",
280
- children: /* @__PURE__ */ f(t, {
281
- className: Re,
282
- styles: ce,
283
- sx: ze,
284
- children: (e) => /* @__PURE__ */ p("div", {
285
- ...Ge,
286
- ref: n,
287
- className: e,
288
- "data-ui": "slider",
289
- "data-disabled": v || void 0,
290
- onKeyDown: (e) => {
291
- Be?.(e);
292
- let t = e.target.closest("[data-slider-thumb]");
293
- t && B.current?.contains(t) && st(e, Number(t.dataset.sliderThumb));
294
- },
295
- children: [
296
- (Z || Me) && /* @__PURE__ */ p("div", {
297
- css: le,
298
- children: [Z && /* @__PURE__ */ f("span", {
299
- ...D?.label,
300
- id: `${I}-label`,
301
- css: [ue, D?.label?.css],
302
- children: d
303
- }), Me && /* @__PURE__ */ f("span", {
304
- ...D?.readout,
305
- "aria-hidden": "true",
306
- css: [de, D?.readout?.css],
307
- children: Qe
308
- })]
309
- }),
310
- Q && /* @__PURE__ */ f("div", {
311
- ...D?.description,
312
- id: `${I}-description`,
313
- css: [fe, D?.description?.css],
314
- children: _
315
- }),
316
- $ && /* @__PURE__ */ f("div", {
317
- ...D?.error,
318
- id: `${I}-error`,
319
- role: "alert",
320
- css: [pe, D?.error?.css],
321
- children: De
322
- }),
323
- /* @__PURE__ */ p("div", {
324
- css: me,
325
- children: [
326
- g(Ne) && /* @__PURE__ */ f("div", {
327
- ...D?.start,
328
- children: Ne
329
- }),
330
- /* @__PURE__ */ p("div", {
331
- ...D?.control,
332
- ref: (e) => {
333
- B.current = e;
334
- let t = D?.control?.ref;
335
- if (typeof t == "function") return t(e);
336
- t && (t.current = e);
337
- },
338
- css: [
339
- he,
340
- ge[Fe],
341
- D?.control?.css
342
- ],
343
- "data-ui": "slider-control",
344
- "data-disabled": v || void 0,
345
- onPointerDown: (e) => {
346
- D?.control?.onPointerDown?.(e), ot(e);
347
- },
348
- onPointerMove: (e) => {
349
- D?.control?.onPointerMove?.(e), e.defaultPrevented || at(e);
350
- },
351
- onPointerUp: (e) => {
352
- D?.control?.onPointerUp?.(e), V.current?.pointerId === e.pointerId && q(!0);
353
- },
354
- onPointerCancel: (e) => {
355
- D?.control?.onPointerCancel?.(e), V.current?.pointerId === e.pointerId && q(!1);
356
- },
357
- onLostPointerCapture: (e) => {
358
- D?.control?.onLostPointerCapture?.(e), V.current?.pointerId === e.pointerId && q(!1);
359
- },
360
- children: [
361
- /* @__PURE__ */ f("div", {
362
- ...D?.track,
363
- "data-ui": "slider-track",
364
- "aria-hidden": "true",
365
- css: [_e, D?.track?.css],
366
- children: /* @__PURE__ */ f("div", {
367
- ...D?.fill,
368
- "data-ui": "slider-fill",
369
- css: [ve, D?.fill?.css],
370
- style: {
371
- ...D?.fill?.style,
372
- insetInlineStart: `${ct}%`,
373
- inlineSize: `${lt - ct}%`
374
- }
375
- })
376
- }),
377
- Y.map((e, t) => /* @__PURE__ */ f("span", {
378
- "aria-hidden": "true",
379
- css: Se,
380
- style: { insetInlineStart: `${X(e.value)}%` }
381
- }, t)),
382
- F.map((e, t) => {
383
- let n = Ee(D?.thumb, t), [r, i] = W(t);
384
- return /* @__PURE__ */ ne("div", {
385
- ...n,
386
- key: t,
387
- id: `${I}-thumb-${t}`,
388
- "data-slider-thumb": t,
389
- "data-dragging": H === t || void 0,
390
- role: "slider",
391
- tabIndex: v ? -1 : 0,
392
- "aria-orientation": "horizontal",
393
- "aria-disabled": v,
394
- "aria-invalid": $ || Oe ? !0 : n?.["aria-invalid"] ?? We,
395
- "aria-valuemin": r,
396
- "aria-valuemax": i,
397
- "aria-valuenow": e,
398
- "aria-valuetext": R(e),
399
- "aria-label": n?.["aria-label"] ?? (O ? w?.[t] : Ve),
400
- "aria-labelledby": Te(He, n?.["aria-labelledby"], O ? `${I}-name-${t}` : Z && `${I}-label`),
401
- "aria-describedby": Te(Ue, n?.["aria-describedby"], Q && `${I}-description`, $ && `${I}-error`),
402
- css: [ye, n?.css],
403
- style: {
404
- ...n?.style,
405
- insetInlineStart: `${X(e)}%`
406
- },
407
- onFocus: (e) => {
408
- $e.current = t, n?.onFocus?.(e);
409
- },
410
- onKeyDown: (e) => {
411
- n?.onKeyDown?.(e);
412
- }
413
- }, /* @__PURE__ */ f(ie.span, {
414
- "aria-hidden": "true",
415
- css: be,
416
- animate: {
417
- scale: z ? 1 : H === t ? .95 : 1,
418
- x: z ? 0 : H === t ? et : 0
419
- },
420
- transition: z ? { duration: 0 } : oe
421
- }), O && /* @__PURE__ */ f("span", {
422
- id: `${I}-name-${t}`,
423
- css: o,
424
- children: w?.[t]
425
- }), /* @__PURE__ */ f("span", {
426
- ...D?.bubble,
427
- "data-ui": "slider-bubble",
428
- "aria-hidden": "true",
429
- css: [xe, D?.bubble?.css],
430
- style: {
431
- ...D?.bubble?.style,
432
- ...X(e) <= 50 ? { insetInlineStart: 0 } : { insetInlineEnd: 0 }
433
- },
434
- children: R(e)
435
- }));
436
- })
437
- ]
438
- }),
439
- g(Pe) && /* @__PURE__ */ f("div", {
440
- ...D?.end,
441
- children: Pe
442
- })
443
- ]
444
- }),
445
- Y.some((e) => g(e.label)) && /* @__PURE__ */ f("div", {
446
- css: Ce,
447
- children: Y.map((e, t) => {
448
- if (!g(e.label)) return null;
449
- let n = Ee(D?.mark, t);
450
- return /* @__PURE__ */ ne("button", {
451
- ...n,
452
- key: t,
453
- type: "button",
454
- disabled: v,
455
- css: [we, n?.css],
456
- onClick: (t) => {
457
- if (n?.onClick?.(t), v || t.defaultPrevented) return;
458
- let r = G(it(e.value), e.value);
459
- h(P, r) || (K(r), N(r));
460
- }
461
- }, e.label);
462
- })
463
- }),
464
- E !== void 0 && F.map((e, t) => /* @__PURE__ */ f("input", {
465
- type: "hidden",
466
- disabled: v,
467
- name: typeof E == "string" ? E : E[t],
468
- value: e
469
- }, t))
470
- ]
471
- })
472
- })
473
- });
474
- }
475
- _.displayName = "Slider";
476
- //#endregion
477
- export { _ as t };
@@ -1,142 +0,0 @@
1
- 'use client';
2
- import { r as e, t } from "./sx-Dx9JUKp5.js";
3
- import { r as n } from "./media-8yrN85VT.js";
4
- import { t as r } from "./renderable-DzcIj1Lo.js";
5
- import { i, n as a, r as o, t as s } from "./choice-control-5kJkLXgv.js";
6
- import { useId as c } from "react";
7
- import { vars as l } from "@jfrader/tokens/vars";
8
- import { jsx as u, jsxs as d } from "@emotion/react/jsx-runtime";
9
- //#region src/components/switch/switch.tsx
10
- var f = {
11
- sm: "36px",
12
- md: "44px"
13
- }, p = e({
14
- position: "relative",
15
- display: "inline-block",
16
- flexShrink: 0,
17
- boxSizing: "border-box",
18
- border: `1px solid ${l.color.borderControl}`,
19
- borderRadius: l.radius.full,
20
- backgroundColor: l.color.surfaceHover,
21
- transitionProperty: "background-color, border-color",
22
- transitionDuration: l.motion.duration.fast,
23
- transitionTimingFunction: l.motion.easeStandard,
24
- "&::after": {
25
- content: "\"\"",
26
- position: "absolute",
27
- insetBlockStart: "2px",
28
- insetInlineStart: "2px",
29
- borderRadius: l.radius.full,
30
- backgroundColor: l.color.text,
31
- transitionProperty: "transform, background-color",
32
- transitionDuration: l.motion.duration.fast,
33
- transitionTimingFunction: l.motion.easeStandard
34
- },
35
- [n]: {
36
- transitionDuration: "0s",
37
- "&::after": { transitionDuration: "0s" }
38
- }
39
- }), m = {
40
- sm: e({
41
- inlineSize: f.sm,
42
- blockSize: "20px",
43
- "&::after": {
44
- inlineSize: "14px",
45
- blockSize: "14px"
46
- }
47
- }),
48
- md: e({
49
- inlineSize: f.md,
50
- blockSize: "24px",
51
- "&::after": {
52
- inlineSize: "18px",
53
- blockSize: "18px"
54
- }
55
- })
56
- }, h = {
57
- sm: e({
58
- "input:checked + span::after": {
59
- transform: "translateX(16px)",
60
- backgroundColor: l.color.accentContrast
61
- },
62
- "&:dir(rtl) input:checked + span::after": { transform: "translateX(-16px)" }
63
- }),
64
- md: e({
65
- "input:checked + span::after": {
66
- transform: "translateX(20px)",
67
- backgroundColor: l.color.accentContrast
68
- },
69
- "&:dir(rtl) input:checked + span::after": { transform: "translateX(-20px)" }
70
- })
71
- }, g = {
72
- sm: e({ fontSize: l.textSize.sm }),
73
- md: e({ fontSize: l.textSize.md })
74
- }, _ = e({
75
- fontSize: l.textSize.sm,
76
- color: l.color.textMuted
77
- }), v = {
78
- sm: e({ marginInlineStart: `calc(${f.sm} + ${l.space[2]})` }),
79
- md: e({ marginInlineStart: `calc(${f.md} + ${l.space[2]})` })
80
- };
81
- function y({ ref: e, label: n, description: l, size: f = "md", onChange: y, onCheckedChange: b, slotProps: x, className: S, sx: C, dir: w, "aria-labelledby": T, "aria-describedby": E, ...D }) {
82
- let O = c(), k = `${O}-label`, A = `${O}-description`, j = r(n), M = r(l), N = [T, j && k].filter(Boolean).join(" ") || void 0, P = [E, M && A].filter(Boolean).join(" ") || void 0, F = [S, x?.root?.className].filter(Boolean).join(" ") || void 0, I = (e) => {
83
- y?.(e), b?.(e.currentTarget.checked);
84
- };
85
- return /* @__PURE__ */ u(t, {
86
- className: F,
87
- styles: [
88
- o,
89
- a,
90
- h[f],
91
- x?.root?.css
92
- ],
93
- sx: C,
94
- children: (t) => /* @__PURE__ */ d("label", {
95
- "data-ui": "switch",
96
- dir: w,
97
- className: t,
98
- children: [/* @__PURE__ */ d("span", {
99
- css: i,
100
- children: [
101
- /* @__PURE__ */ u("input", {
102
- ...D,
103
- ref: e,
104
- type: "checkbox",
105
- role: "switch",
106
- "aria-labelledby": N,
107
- "aria-describedby": P,
108
- onChange: I,
109
- css: s
110
- }),
111
- /* @__PURE__ */ u("span", {
112
- "aria-hidden": "true",
113
- className: x?.control?.className,
114
- css: [
115
- p,
116
- m[f],
117
- x?.control?.css
118
- ]
119
- }),
120
- j && /* @__PURE__ */ u("span", {
121
- id: k,
122
- className: x?.label?.className,
123
- css: [g[f], x?.label?.css],
124
- children: n
125
- })
126
- ]
127
- }), M && /* @__PURE__ */ u("span", {
128
- id: A,
129
- className: x?.description?.className,
130
- css: [
131
- _,
132
- v[f],
133
- x?.description?.css
134
- ],
135
- children: l
136
- })]
137
- })
138
- });
139
- }
140
- y.displayName = "Switch";
141
- //#endregion
142
- export { y as t };