@drjoshcsimmons/scl 0.1.6 → 0.1.8

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 (133) hide show
  1. package/dist/index100.js +30 -4
  2. package/dist/index101.js +11 -13
  3. package/dist/index102.js +9 -30
  4. package/dist/index103.js +51 -177
  5. package/dist/index104.js +30 -650
  6. package/dist/index105.js +47 -11
  7. package/dist/index106.js +12 -203
  8. package/dist/index107.js +47 -21
  9. package/dist/index108.js +29 -399
  10. package/dist/index109.js +30 -6
  11. package/dist/index11.js +2 -2
  12. package/dist/index110.js +648 -19
  13. package/dist/index111.js +30 -9
  14. package/dist/index112.js +9 -38
  15. package/dist/index113.js +48 -18
  16. package/dist/index114.js +45 -22
  17. package/dist/index115.js +6 -29
  18. package/dist/index116.js +12 -5
  19. package/dist/index117.js +206 -2
  20. package/dist/index118.js +21 -52
  21. package/dist/index119.js +394 -59
  22. package/dist/index12.js +1 -1
  23. package/dist/index120.js +21 -2
  24. package/dist/index121.js +9 -2
  25. package/dist/index122.js +38 -5
  26. package/dist/index123.js +18 -3
  27. package/dist/index124.js +45 -21
  28. package/dist/index125.js +2 -113
  29. package/dist/index126.js +52 -15
  30. package/dist/index127.js +58 -518
  31. package/dist/index128.js +23 -126
  32. package/dist/index129.js +28 -133
  33. package/dist/index13.js +2 -2
  34. package/dist/index130.js +5 -65
  35. package/dist/index131.js +2 -69
  36. package/dist/index132.js +2 -9
  37. package/dist/index133.js +5 -14
  38. package/dist/index134.js +3 -66
  39. package/dist/index135.js +23 -3
  40. package/dist/index136.js +110 -20
  41. package/dist/index137.js +15 -22
  42. package/dist/index138.js +522 -10
  43. package/dist/index139.js +123 -23
  44. package/dist/index14.js +2 -2
  45. package/dist/index140.js +134 -5
  46. package/dist/index141.js +67 -0
  47. package/dist/index142.js +71 -0
  48. package/dist/index143.js +11 -0
  49. package/dist/index144.js +16 -0
  50. package/dist/index145.js +68 -0
  51. package/dist/index146.js +6 -0
  52. package/dist/index147.js +25 -0
  53. package/dist/index148.js +25 -0
  54. package/dist/index149.js +15 -0
  55. package/dist/index15.js +2 -2
  56. package/dist/index150.js +30 -0
  57. package/dist/index151.js +7 -0
  58. package/dist/index17.js +4 -4
  59. package/dist/index18.js +2 -2
  60. package/dist/index20.js +2 -2
  61. package/dist/index21.js +1 -1
  62. package/dist/index22.js +1 -1
  63. package/dist/index23.js +2 -2
  64. package/dist/index24.js +1 -1
  65. package/dist/index25.js +4 -4
  66. package/dist/index26.js +1 -1
  67. package/dist/index27.js +3 -3
  68. package/dist/index29.js +1 -1
  69. package/dist/index31.js +1 -1
  70. package/dist/index33.js +1 -1
  71. package/dist/index36.js +2 -2
  72. package/dist/index37.js +1 -1
  73. package/dist/index4.js +2 -2
  74. package/dist/index45.js +237 -33
  75. package/dist/index46.js +11 -241
  76. package/dist/index47.js +508 -227
  77. package/dist/index48.js +241 -9
  78. package/dist/index49.js +33 -12
  79. package/dist/index5.js +1 -1
  80. package/dist/index50.js +214 -238
  81. package/dist/index51.js +4 -5
  82. package/dist/index52.js +5 -5
  83. package/dist/index53.js +112 -219
  84. package/dist/index54.js +125 -11
  85. package/dist/index55.js +54 -524
  86. package/dist/index56.js +250 -121
  87. package/dist/index57.js +71 -299
  88. package/dist/index58.js +260 -12
  89. package/dist/index59.js +12 -435
  90. package/dist/index6.js +1 -1
  91. package/dist/index60.js +856 -56
  92. package/dist/index61.js +9 -254
  93. package/dist/index62.js +9 -130
  94. package/dist/index63.js +299 -71
  95. package/dist/index64.js +12 -22
  96. package/dist/index65.js +112 -25
  97. package/dist/index66.js +223 -16
  98. package/dist/index67.js +11 -236
  99. package/dist/index68.js +249 -11
  100. package/dist/index69.js +16 -159
  101. package/dist/index70.js +18 -332
  102. package/dist/index71.js +148 -212
  103. package/dist/index72.js +336 -11
  104. package/dist/index73.js +390 -815
  105. package/dist/index74.js +31 -9
  106. package/dist/index75.js +12 -118
  107. package/dist/index76.js +66 -5
  108. package/dist/index77.js +44 -25
  109. package/dist/index78.js +23 -64
  110. package/dist/index79.js +5 -123
  111. package/dist/index8.js +1 -1
  112. package/dist/index80.js +50 -13
  113. package/dist/index81.js +32 -133
  114. package/dist/index82.js +1 -1
  115. package/dist/index83.js +7 -218
  116. package/dist/index84.js +69 -14
  117. package/dist/index85.js +10 -68
  118. package/dist/index86.js +4 -34
  119. package/dist/index87.js +3 -53
  120. package/dist/index88.js +177 -48
  121. package/dist/index89.js +25 -50
  122. package/dist/index9.js +2 -2
  123. package/dist/index90.js +6 -9
  124. package/dist/index91.js +124 -5
  125. package/dist/index92.js +14 -24
  126. package/dist/index93.js +130 -50
  127. package/dist/index94.js +218 -10
  128. package/dist/index95.js +14 -4
  129. package/dist/index96.js +47 -29
  130. package/dist/index97.js +50 -13
  131. package/dist/index98.js +9 -46
  132. package/dist/index99.js +54 -7
  133. package/package.json +1 -1
package/dist/index73.js CHANGED
@@ -1,862 +1,437 @@
1
- import * as t from "react";
2
- import * as be from "react-dom";
3
- import { clamp as Re } from "./index100.js";
4
- import { composeEventHandlers as E } from "./index76.js";
5
- import { createCollection as st } from "./index98.js";
6
- import { useComposedRefs as B } from "./index77.js";
7
- import { createContextScope as lt } from "./index78.js";
8
- import { useDirection as ct } from "./index99.js";
9
- import { DismissableLayer as it } from "./index79.js";
10
- import { useFocusGuards as at } from "./index80.js";
11
- import { FocusScope as dt } from "./index81.js";
12
- import { useId as Ie } from "./index82.js";
13
- import { createPopperScope as _e, Root as ut, Anchor as pt, Content as ft, Arrow as mt } from "./index83.js";
14
- import { Portal as ht } from "./index84.js";
15
- import { Primitive as M } from "./index86.js";
16
- import { createSlot as vt } from "./index87.js";
17
- import { useCallbackRef as gt } from "./index94.js";
18
- import { useControllableState as Ee } from "./index88.js";
19
- import { useLayoutEffect as Y } from "./index95.js";
20
- import { usePrevious as St } from "./index91.js";
21
- import { VISUALLY_HIDDEN_STYLES as wt } from "./index102.js";
22
- import { hideOthers as Ct } from "./index89.js";
23
- import yt from "./index90.js";
24
- import { jsx as m, jsxs as ce, Fragment as Te } from "react/jsx-runtime";
25
- var xt = [" ", "Enter", "ArrowUp", "ArrowDown"], It = [" ", "Enter"], J = "Select", [ae, de, Tt] = st(J), [te] = lt(J, [
26
- Tt,
27
- _e
28
- ]), ue = _e(), [Pt, j] = te(J), [Rt, Et] = te(J), Ne = (n) => {
29
- const {
30
- __scopeSelect: c,
31
- children: e,
32
- open: i,
33
- defaultOpen: l,
34
- onOpenChange: u,
35
- value: r,
36
- defaultValue: s,
37
- onValueChange: o,
38
- dir: p,
39
- name: g,
40
- autoComplete: C,
41
- disabled: P,
42
- required: R,
43
- form: T
44
- } = n, a = ue(c), [v, y] = t.useState(null), [d, h] = t.useState(null), [A, O] = t.useState(!1), oe = ct(p), [b, L] = Ee({
45
- prop: i,
46
- defaultProp: l ?? !1,
47
- onChange: u,
48
- caller: J
49
- }), [K, X] = Ee({
50
- prop: r,
51
- defaultProp: s,
52
- onChange: o,
53
- caller: J
54
- }), V = t.useRef(null), H = v ? T || !!v.closest("form") : !0, [G, U] = t.useState(/* @__PURE__ */ new Set()), W = Array.from(G).map((_) => _.props.value).join(";");
55
- return /* @__PURE__ */ m(ut, { ...a, children: /* @__PURE__ */ ce(
56
- Pt,
57
- {
58
- required: R,
59
- scope: c,
60
- trigger: v,
61
- onTriggerChange: y,
62
- valueNode: d,
63
- onValueNodeChange: h,
64
- valueNodeHasChildren: A,
65
- onValueNodeHasChildrenChange: O,
66
- contentId: Ie(),
67
- value: K,
68
- onValueChange: X,
69
- open: b,
70
- onOpenChange: L,
71
- dir: oe,
72
- triggerPointerDownPosRef: V,
73
- disabled: P,
74
- children: [
75
- /* @__PURE__ */ m(ae.Provider, { scope: c, children: /* @__PURE__ */ m(
76
- Rt,
77
- {
78
- scope: n.__scopeSelect,
79
- onNativeOptionAdd: t.useCallback((_) => {
80
- U((k) => new Set(k).add(_));
81
- }, []),
82
- onNativeOptionRemove: t.useCallback((_) => {
83
- U((k) => {
84
- const F = new Set(k);
85
- return F.delete(_), F;
86
- });
87
- }, []),
88
- children: e
89
- }
90
- ) }),
91
- H ? /* @__PURE__ */ ce(
92
- tt,
93
- {
94
- "aria-hidden": !0,
95
- required: R,
96
- tabIndex: -1,
97
- name: g,
98
- autoComplete: C,
99
- value: K,
100
- onChange: (_) => X(_.target.value),
101
- disabled: P,
102
- form: T,
103
- children: [
104
- K === void 0 ? /* @__PURE__ */ m("option", { value: "" }) : null,
105
- Array.from(G)
106
- ]
107
- },
108
- W
109
- ) : null
110
- ]
1
+ import * as d from "react";
2
+ import { clamp as $ } from "./index87.js";
3
+ import { composeEventHandlers as C } from "./index79.js";
4
+ import { useComposedRefs as M } from "./index78.js";
5
+ import { createContextScope as ce } from "./index76.js";
6
+ import { useControllableState as le } from "./index80.js";
7
+ import { useDirection as de } from "./index83.js";
8
+ import { usePrevious as ue } from "./index90.js";
9
+ import { useSize as fe } from "./index89.js";
10
+ import { Primitive as K } from "./index81.js";
11
+ import { createCollection as me } from "./index77.js";
12
+ import { jsx as v, jsxs as pe } from "react/jsx-runtime";
13
+ var j = ["PageUp", "PageDown"], X = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], G = {
14
+ "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
15
+ "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
16
+ "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
17
+ "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
18
+ }, I = "Slider", [z, he, Se] = me(I), [W] = ce(I, [
19
+ Se
20
+ ]), [ge, T] = W(I), q = d.forwardRef(
21
+ (e, t) => {
22
+ const {
23
+ name: o,
24
+ min: n = 0,
25
+ max: a = 100,
26
+ step: c = 1,
27
+ orientation: r = "horizontal",
28
+ disabled: s = !1,
29
+ minStepsBetweenThumbs: l = 0,
30
+ defaultValue: h = [n],
31
+ value: S,
32
+ onValueChange: i = () => {
33
+ },
34
+ onValueCommit: u = () => {
35
+ },
36
+ inverted: w = !1,
37
+ form: P,
38
+ ...g
39
+ } = e, m = d.useRef(/* @__PURE__ */ new Set()), f = d.useRef(0), b = r === "horizontal" ? ve : we, [p = [], A] = le({
40
+ prop: S,
41
+ defaultProp: h,
42
+ onChange: (R) => {
43
+ var E;
44
+ (E = [...m.current][f.current]) == null || E.focus(), i(R);
45
+ }
46
+ }), k = d.useRef(p);
47
+ function H(R) {
48
+ const x = ye(p, R);
49
+ V(R, x);
111
50
  }
112
- ) });
113
- };
114
- Ne.displayName = J;
115
- var Me = "SelectTrigger", Ae = t.forwardRef(
116
- (n, c) => {
117
- const { __scopeSelect: e, disabled: i = !1, ...l } = n, u = ue(e), r = j(Me, e), s = r.disabled || i, o = B(c, r.onTriggerChange), p = de(e), g = t.useRef("touch"), [C, P, R] = nt((a) => {
118
- const v = p().filter((h) => !h.disabled), y = v.find((h) => h.value === r.value), d = rt(v, a, y);
119
- d !== void 0 && r.onValueChange(d.value);
120
- }), T = (a) => {
121
- s || (r.onOpenChange(!0), R()), a && (r.triggerPointerDownPosRef.current = {
122
- x: Math.round(a.pageX),
123
- y: Math.round(a.pageY)
51
+ function se(R) {
52
+ V(R, f.current);
53
+ }
54
+ function ae() {
55
+ const R = k.current[f.current];
56
+ p[f.current] !== R && u(p);
57
+ }
58
+ function V(R, x, { commit: E } = { commit: !1 }) {
59
+ const F = Ce(c), N = Me(Math.round((R - n) / c) * c + n, F), B = $(N, [n, a]);
60
+ A((_ = []) => {
61
+ const y = Pe(_, B, x);
62
+ if (_e(y, l * c)) {
63
+ f.current = y.indexOf(B);
64
+ const Y = String(y) !== String(_);
65
+ return Y && E && u(y), Y ? y : _;
66
+ } else
67
+ return _;
124
68
  });
125
- };
126
- return /* @__PURE__ */ m(pt, { asChild: !0, ...u, children: /* @__PURE__ */ m(
127
- M.button,
69
+ }
70
+ return /* @__PURE__ */ v(
71
+ ge,
128
72
  {
129
- type: "button",
130
- role: "combobox",
131
- "aria-controls": r.contentId,
132
- "aria-expanded": r.open,
133
- "aria-required": r.required,
134
- "aria-autocomplete": "none",
135
- dir: r.dir,
136
- "data-state": r.open ? "open" : "closed",
73
+ scope: e.__scopeSlider,
74
+ name: o,
137
75
  disabled: s,
138
- "data-disabled": s ? "" : void 0,
139
- "data-placeholder": ot(r.value) ? "" : void 0,
140
- ...l,
141
- ref: o,
142
- onClick: E(l.onClick, (a) => {
143
- a.currentTarget.focus(), g.current !== "mouse" && T(a);
144
- }),
145
- onPointerDown: E(l.onPointerDown, (a) => {
146
- g.current = a.pointerType;
147
- const v = a.target;
148
- v.hasPointerCapture(a.pointerId) && v.releasePointerCapture(a.pointerId), a.button === 0 && a.ctrlKey === !1 && a.pointerType === "mouse" && (T(a), a.preventDefault());
149
- }),
150
- onKeyDown: E(l.onKeyDown, (a) => {
151
- const v = C.current !== "";
152
- !(a.ctrlKey || a.altKey || a.metaKey) && a.key.length === 1 && P(a.key), !(v && a.key === " ") && xt.includes(a.key) && (T(), a.preventDefault());
153
- })
154
- }
155
- ) });
156
- }
157
- );
158
- Ae.displayName = Me;
159
- var Oe = "SelectValue", De = t.forwardRef(
160
- (n, c) => {
161
- const { __scopeSelect: e, className: i, style: l, children: u, placeholder: r = "", ...s } = n, o = j(Oe, e), { onValueNodeHasChildrenChange: p } = o, g = u !== void 0, C = B(c, o.onValueNodeChange);
162
- return Y(() => {
163
- p(g);
164
- }, [p, g]), /* @__PURE__ */ m(
165
- M.span,
166
- {
167
- ...s,
168
- ref: C,
169
- style: { pointerEvents: "none" },
170
- children: ot(o.value) ? /* @__PURE__ */ m(Te, { children: r }) : u
76
+ min: n,
77
+ max: a,
78
+ valueIndexToChangeRef: f,
79
+ thumbs: m.current,
80
+ values: p,
81
+ orientation: r,
82
+ form: P,
83
+ children: /* @__PURE__ */ v(z.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ v(z.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ v(
84
+ b,
85
+ {
86
+ "aria-disabled": s,
87
+ "data-disabled": s ? "" : void 0,
88
+ ...g,
89
+ ref: t,
90
+ onPointerDown: C(g.onPointerDown, () => {
91
+ s || (k.current = p);
92
+ }),
93
+ min: n,
94
+ max: a,
95
+ inverted: w,
96
+ onSlideStart: s ? void 0 : H,
97
+ onSlideMove: s ? void 0 : se,
98
+ onSlideEnd: s ? void 0 : ae,
99
+ onHomeKeyDown: () => !s && V(n, 0, { commit: !0 }),
100
+ onEndKeyDown: () => !s && V(a, p.length - 1, { commit: !0 }),
101
+ onStepKeyDown: ({ event: R, direction: x }) => {
102
+ if (!s) {
103
+ const N = j.includes(R.key) || R.shiftKey && X.includes(R.key) ? 10 : 1, B = f.current, _ = p[B], y = c * N * x;
104
+ V(_ + y, B, { commit: !0 });
105
+ }
106
+ }
107
+ }
108
+ ) }) })
171
109
  }
172
110
  );
173
111
  }
174
112
  );
175
- De.displayName = Oe;
176
- var bt = "SelectIcon", Le = t.forwardRef(
177
- (n, c) => {
178
- const { __scopeSelect: e, children: i, ...l } = n;
179
- return /* @__PURE__ */ m(M.span, { "aria-hidden": !0, ...l, ref: c, children: i || "▼" });
180
- }
181
- );
182
- Le.displayName = bt;
183
- var _t = "SelectPortal", ke = (n) => /* @__PURE__ */ m(ht, { asChild: !0, ...n });
184
- ke.displayName = _t;
185
- var Q = "SelectContent", Be = t.forwardRef(
186
- (n, c) => {
187
- const e = j(Q, n.__scopeSelect), [i, l] = t.useState();
188
- if (Y(() => {
189
- l(new DocumentFragment());
190
- }, []), !e.open) {
191
- const u = i;
192
- return u ? be.createPortal(
193
- /* @__PURE__ */ m(Ve, { scope: n.__scopeSelect, children: /* @__PURE__ */ m(ae.Slot, { scope: n.__scopeSelect, children: /* @__PURE__ */ m("div", { children: n.children }) }) }),
194
- u
195
- ) : null;
196
- }
197
- return /* @__PURE__ */ m(He, { ...n, ref: c });
198
- }
199
- );
200
- Be.displayName = Q;
201
- var D = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.RemoveScroll"), He = t.forwardRef(
202
- (n, c) => {
113
+ q.displayName = I;
114
+ var [J, Q] = W(I, {
115
+ startEdge: "left",
116
+ endEdge: "right",
117
+ size: "width",
118
+ direction: 1
119
+ }), ve = d.forwardRef(
120
+ (e, t) => {
203
121
  const {
204
- __scopeSelect: e,
205
- position: i = "item-aligned",
206
- onCloseAutoFocus: l,
207
- onEscapeKeyDown: u,
208
- onPointerDownOutside: r,
209
- //
210
- // PopperContent props
211
- side: s,
212
- sideOffset: o,
213
- align: p,
214
- alignOffset: g,
215
- arrowPadding: C,
216
- collisionBoundary: P,
217
- collisionPadding: R,
218
- sticky: T,
219
- hideWhenDetached: a,
220
- avoidCollisions: v,
221
- //
222
- ...y
223
- } = n, d = j(Q, e), [h, A] = t.useState(null), [O, oe] = t.useState(null), b = B(c, (f) => A(f)), [L, K] = t.useState(null), [X, V] = t.useState(
224
- null
225
- ), H = de(e), [G, U] = t.useState(!1), W = t.useRef(!1);
226
- t.useEffect(() => {
227
- if (h) return Ct(h);
228
- }, [h]), at();
229
- const _ = t.useCallback(
230
- (f) => {
231
- const [I, ...N] = H().map((w) => w.ref.current), [x] = N.slice(-1), S = document.activeElement;
232
- for (const w of f)
233
- if (w === S || (w == null || w.scrollIntoView({ block: "nearest" }), w === I && O && (O.scrollTop = 0), w === x && O && (O.scrollTop = O.scrollHeight), w == null || w.focus(), document.activeElement !== S)) return;
234
- },
235
- [H, O]
236
- ), k = t.useCallback(
237
- () => _([L, h]),
238
- [_, L, h]
239
- );
240
- t.useEffect(() => {
241
- G && k();
242
- }, [G, k]);
243
- const { onOpenChange: F, triggerPointerDownPosRef: z } = d;
244
- t.useEffect(() => {
245
- if (h) {
246
- let f = { x: 0, y: 0 };
247
- const I = (x) => {
248
- var S, w;
249
- f = {
250
- x: Math.abs(Math.round(x.pageX) - (((S = z.current) == null ? void 0 : S.x) ?? 0)),
251
- y: Math.abs(Math.round(x.pageY) - (((w = z.current) == null ? void 0 : w.y) ?? 0))
252
- };
253
- }, N = (x) => {
254
- f.x <= 10 && f.y <= 10 ? x.preventDefault() : h.contains(x.target) || F(!1), document.removeEventListener("pointermove", I), z.current = null;
255
- };
256
- return z.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", N, { capture: !0, once: !0 })), () => {
257
- document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", N, { capture: !0 });
258
- };
259
- }
260
- }, [h, F, z]), t.useEffect(() => {
261
- const f = () => F(!1);
262
- return window.addEventListener("blur", f), window.addEventListener("resize", f), () => {
263
- window.removeEventListener("blur", f), window.removeEventListener("resize", f);
264
- };
265
- }, [F]);
266
- const [pe, se] = nt((f) => {
267
- const I = H().filter((S) => !S.disabled), N = I.find((S) => S.ref.current === document.activeElement), x = rt(I, f, N);
268
- x && setTimeout(() => x.ref.current.focus());
269
- }), fe = t.useCallback(
270
- (f, I, N) => {
271
- const x = !W.current && !N;
272
- (d.value !== void 0 && d.value === I || x) && (K(f), x && (W.current = !0));
273
- },
274
- [d.value]
275
- ), me = t.useCallback(() => h == null ? void 0 : h.focus(), [h]), ee = t.useCallback(
276
- (f, I, N) => {
277
- const x = !W.current && !N;
278
- (d.value !== void 0 && d.value === I || x) && V(f);
279
- },
280
- [d.value]
281
- ), le = i === "popper" ? Se : Ue, ne = le === Se ? {
282
- side: s,
283
- sideOffset: o,
284
- align: p,
285
- alignOffset: g,
286
- arrowPadding: C,
287
- collisionBoundary: P,
288
- collisionPadding: R,
289
- sticky: T,
290
- hideWhenDetached: a,
291
- avoidCollisions: v
292
- } : {};
293
- return /* @__PURE__ */ m(
294
- Ve,
122
+ min: o,
123
+ max: n,
124
+ dir: a,
125
+ inverted: c,
126
+ onSlideStart: r,
127
+ onSlideMove: s,
128
+ onSlideEnd: l,
129
+ onStepKeyDown: h,
130
+ ...S
131
+ } = e, [i, u] = d.useState(null), w = M(t, (b) => u(b)), P = d.useRef(void 0), g = de(a), m = g === "ltr", f = m && !c || !m && c;
132
+ function D(b) {
133
+ const p = P.current || i.getBoundingClientRect(), A = [0, p.width], H = U(A, f ? [o, n] : [n, o]);
134
+ return P.current = p, H(b - p.left);
135
+ }
136
+ return /* @__PURE__ */ v(
137
+ J,
295
138
  {
296
- scope: e,
297
- content: h,
298
- viewport: O,
299
- onViewportChange: oe,
300
- itemRefCallback: fe,
301
- selectedItem: L,
302
- onItemLeave: me,
303
- itemTextRefCallback: ee,
304
- focusSelectedItem: k,
305
- selectedItemText: X,
306
- position: i,
307
- isPositioned: G,
308
- searchRef: pe,
309
- children: /* @__PURE__ */ m(yt, { as: Mt, allowPinchZoom: !0, children: /* @__PURE__ */ m(
310
- dt,
139
+ scope: e.__scopeSlider,
140
+ startEdge: f ? "left" : "right",
141
+ endEdge: f ? "right" : "left",
142
+ direction: f ? 1 : -1,
143
+ size: "width",
144
+ children: /* @__PURE__ */ v(
145
+ Z,
311
146
  {
312
- asChild: !0,
313
- trapped: d.open,
314
- onMountAutoFocus: (f) => {
315
- f.preventDefault();
147
+ dir: g,
148
+ "data-orientation": "horizontal",
149
+ ...S,
150
+ ref: w,
151
+ style: {
152
+ ...S.style,
153
+ "--radix-slider-thumb-transform": "translateX(-50%)"
316
154
  },
317
- onUnmountAutoFocus: E(l, (f) => {
318
- var I;
319
- (I = d.trigger) == null || I.focus({ preventScroll: !0 }), f.preventDefault();
320
- }),
321
- children: /* @__PURE__ */ m(
322
- it,
323
- {
324
- asChild: !0,
325
- disableOutsidePointerEvents: !0,
326
- onEscapeKeyDown: u,
327
- onPointerDownOutside: r,
328
- onFocusOutside: (f) => f.preventDefault(),
329
- onDismiss: () => d.onOpenChange(!1),
330
- children: /* @__PURE__ */ m(
331
- le,
332
- {
333
- role: "listbox",
334
- id: d.contentId,
335
- "data-state": d.open ? "open" : "closed",
336
- dir: d.dir,
337
- onContextMenu: (f) => f.preventDefault(),
338
- ...y,
339
- ...ne,
340
- onPlaced: () => U(!0),
341
- ref: b,
342
- style: {
343
- // flex layout so we can place the scroll buttons properly
344
- display: "flex",
345
- flexDirection: "column",
346
- // reset the outline by default as the content MAY get focused
347
- outline: "none",
348
- ...y.style
349
- },
350
- onKeyDown: E(y.onKeyDown, (f) => {
351
- const I = f.ctrlKey || f.altKey || f.metaKey;
352
- if (f.key === "Tab" && f.preventDefault(), !I && f.key.length === 1 && se(f.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(f.key)) {
353
- let x = H().filter((S) => !S.disabled).map((S) => S.ref.current);
354
- if (["ArrowUp", "End"].includes(f.key) && (x = x.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(f.key)) {
355
- const S = f.target, w = x.indexOf(S);
356
- x = x.slice(w + 1);
357
- }
358
- setTimeout(() => _(x)), f.preventDefault();
359
- }
360
- })
361
- }
362
- )
363
- }
364
- )
155
+ onSlideStart: (b) => {
156
+ const p = D(b.clientX);
157
+ r == null || r(p);
158
+ },
159
+ onSlideMove: (b) => {
160
+ const p = D(b.clientX);
161
+ s == null || s(p);
162
+ },
163
+ onSlideEnd: () => {
164
+ P.current = void 0, l == null || l();
165
+ },
166
+ onStepKeyDown: (b) => {
167
+ const A = G[f ? "from-left" : "from-right"].includes(b.key);
168
+ h == null || h({ event: b, direction: A ? -1 : 1 });
169
+ }
365
170
  }
366
- ) })
171
+ )
367
172
  }
368
173
  );
369
174
  }
370
- );
371
- He.displayName = Nt;
372
- var At = "SelectItemAlignedPosition", Ue = t.forwardRef((n, c) => {
373
- const { __scopeSelect: e, onPlaced: i, ...l } = n, u = j(Q, e), r = q(Q, e), [s, o] = t.useState(null), [p, g] = t.useState(null), C = B(c, (b) => g(b)), P = de(e), R = t.useRef(!1), T = t.useRef(!0), { viewport: a, selectedItem: v, selectedItemText: y, focusSelectedItem: d } = r, h = t.useCallback(() => {
374
- if (u.trigger && u.valueNode && s && p && a && v && y) {
375
- const b = u.trigger.getBoundingClientRect(), L = p.getBoundingClientRect(), K = u.valueNode.getBoundingClientRect(), X = y.getBoundingClientRect();
376
- if (u.dir !== "rtl") {
377
- const S = X.left - L.left, w = K.left - S, Z = b.left - w, $ = b.width + Z, he = Math.max($, L.width), ve = window.innerWidth - D, ge = Re(w, [
378
- D,
379
- // Prevents the content from going off the starting edge of the
380
- // viewport. It may still go off the ending edge, but this can be
381
- // controlled by the user since they may want to manage overflow in a
382
- // specific way.
383
- // https://github.com/radix-ui/primitives/issues/2049
384
- Math.max(D, ve - he)
385
- ]);
386
- s.style.minWidth = $ + "px", s.style.left = ge + "px";
387
- } else {
388
- const S = L.right - X.right, w = window.innerWidth - K.right - S, Z = window.innerWidth - b.right - w, $ = b.width + Z, he = Math.max($, L.width), ve = window.innerWidth - D, ge = Re(w, [
389
- D,
390
- Math.max(D, ve - he)
391
- ]);
392
- s.style.minWidth = $ + "px", s.style.right = ge + "px";
393
- }
394
- const V = P(), H = window.innerHeight - D * 2, G = a.scrollHeight, U = window.getComputedStyle(p), W = parseInt(U.borderTopWidth, 10), _ = parseInt(U.paddingTop, 10), k = parseInt(U.borderBottomWidth, 10), F = parseInt(U.paddingBottom, 10), z = W + _ + G + F + k, pe = Math.min(v.offsetHeight * 5, z), se = window.getComputedStyle(a), fe = parseInt(se.paddingTop, 10), me = parseInt(se.paddingBottom, 10), ee = b.top + b.height / 2 - D, le = H - ee, ne = v.offsetHeight / 2, f = v.offsetTop + ne, I = W + _ + f, N = z - I;
395
- if (I <= ee) {
396
- const S = V.length > 0 && v === V[V.length - 1].ref.current;
397
- s.style.bottom = "0px";
398
- const w = p.clientHeight - a.offsetTop - a.offsetHeight, Z = Math.max(
399
- le,
400
- ne + // viewport might have padding bottom, include it to avoid a scrollable viewport
401
- (S ? me : 0) + w + k
402
- ), $ = I + Z;
403
- s.style.height = $ + "px";
404
- } else {
405
- const S = V.length > 0 && v === V[0].ref.current;
406
- s.style.top = "0px";
407
- const Z = Math.max(
408
- ee,
409
- W + a.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
410
- (S ? fe : 0) + ne
411
- ) + N;
412
- s.style.height = Z + "px", a.scrollTop = I - ee + a.offsetTop;
413
- }
414
- s.style.margin = `${D}px 0`, s.style.minHeight = pe + "px", s.style.maxHeight = H + "px", i == null || i(), requestAnimationFrame(() => R.current = !0);
175
+ ), we = d.forwardRef(
176
+ (e, t) => {
177
+ const {
178
+ min: o,
179
+ max: n,
180
+ inverted: a,
181
+ onSlideStart: c,
182
+ onSlideMove: r,
183
+ onSlideEnd: s,
184
+ onStepKeyDown: l,
185
+ ...h
186
+ } = e, S = d.useRef(null), i = M(t, S), u = d.useRef(void 0), w = !a;
187
+ function P(g) {
188
+ const m = u.current || S.current.getBoundingClientRect(), f = [0, m.height], b = U(f, w ? [n, o] : [o, n]);
189
+ return u.current = m, b(g - m.top);
415
190
  }
416
- }, [
417
- P,
418
- u.trigger,
419
- u.valueNode,
420
- s,
421
- p,
422
- a,
423
- v,
424
- y,
425
- u.dir,
426
- i
427
- ]);
428
- Y(() => h(), [h]);
429
- const [A, O] = t.useState();
430
- Y(() => {
431
- p && O(window.getComputedStyle(p).zIndex);
432
- }, [p]);
433
- const oe = t.useCallback(
434
- (b) => {
435
- b && T.current === !0 && (h(), d == null || d(), T.current = !1);
436
- },
437
- [h, d]
438
- );
439
- return /* @__PURE__ */ m(
440
- Dt,
441
- {
442
- scope: e,
443
- contentWrapper: s,
444
- shouldExpandOnScrollRef: R,
445
- onScrollButtonChange: oe,
446
- children: /* @__PURE__ */ m(
447
- "div",
448
- {
449
- ref: o,
450
- style: {
451
- display: "flex",
452
- flexDirection: "column",
453
- position: "fixed",
454
- zIndex: A
455
- },
456
- children: /* @__PURE__ */ m(
457
- M.div,
458
- {
459
- ...l,
460
- ref: C,
461
- style: {
462
- // When we get the height of the content, it includes borders. If we were to set
463
- // the height without having `boxSizing: 'border-box'` it would be too big.
464
- boxSizing: "border-box",
465
- // We need to ensure the content doesn't get taller than the wrapper
466
- maxHeight: "100%",
467
- ...l.style
468
- }
191
+ return /* @__PURE__ */ v(
192
+ J,
193
+ {
194
+ scope: e.__scopeSlider,
195
+ startEdge: w ? "bottom" : "top",
196
+ endEdge: w ? "top" : "bottom",
197
+ size: "height",
198
+ direction: w ? 1 : -1,
199
+ children: /* @__PURE__ */ v(
200
+ Z,
201
+ {
202
+ "data-orientation": "vertical",
203
+ ...h,
204
+ ref: i,
205
+ style: {
206
+ ...h.style,
207
+ "--radix-slider-thumb-transform": "translateY(50%)"
208
+ },
209
+ onSlideStart: (g) => {
210
+ const m = P(g.clientY);
211
+ c == null || c(m);
212
+ },
213
+ onSlideMove: (g) => {
214
+ const m = P(g.clientY);
215
+ r == null || r(m);
216
+ },
217
+ onSlideEnd: () => {
218
+ u.current = void 0, s == null || s();
219
+ },
220
+ onStepKeyDown: (g) => {
221
+ const f = G[w ? "from-bottom" : "from-top"].includes(g.key);
222
+ l == null || l({ event: g, direction: f ? -1 : 1 });
469
223
  }
470
- )
471
- }
472
- )
473
- }
474
- );
475
- });
476
- Ue.displayName = At;
477
- var Ot = "SelectPopperPosition", Se = t.forwardRef((n, c) => {
478
- const {
479
- __scopeSelect: e,
480
- align: i = "start",
481
- collisionPadding: l = D,
482
- ...u
483
- } = n, r = ue(e);
484
- return /* @__PURE__ */ m(
485
- ft,
486
- {
487
- ...r,
488
- ...u,
489
- ref: c,
490
- align: i,
491
- collisionPadding: l,
492
- style: {
493
- // Ensure border-box for floating-ui calculations
494
- boxSizing: "border-box",
495
- ...u.style,
496
- "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
497
- "--radix-select-content-available-width": "var(--radix-popper-available-width)",
498
- "--radix-select-content-available-height": "var(--radix-popper-available-height)",
499
- "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
500
- "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
224
+ }
225
+ )
501
226
  }
502
- }
503
- );
504
- });
505
- Se.displayName = Ot;
506
- var [Dt, Pe] = te(Q, {}), we = "SelectViewport", We = t.forwardRef(
507
- (n, c) => {
508
- const { __scopeSelect: e, nonce: i, ...l } = n, u = q(we, e), r = Pe(we, e), s = B(c, u.onViewportChange), o = t.useRef(0);
509
- return /* @__PURE__ */ ce(Te, { children: [
510
- /* @__PURE__ */ m(
511
- "style",
512
- {
513
- dangerouslySetInnerHTML: {
514
- __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
515
- },
516
- nonce: i
517
- }
518
- ),
519
- /* @__PURE__ */ m(ae.Slot, { scope: e, children: /* @__PURE__ */ m(
520
- M.div,
521
- {
522
- "data-radix-select-viewport": "",
523
- role: "presentation",
524
- ...l,
525
- ref: s,
526
- style: {
527
- // we use position: 'relative' here on the `viewport` so that when we call
528
- // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
529
- // (independent of the scrollUpButton).
530
- position: "relative",
531
- flex: 1,
532
- // Viewport should only be scrollable in the vertical direction.
533
- // This won't work in vertical writing modes, so we'll need to
534
- // revisit this if/when that is supported
535
- // https://developer.chrome.com/blog/vertical-form-controls
536
- overflow: "hidden auto",
537
- ...l.style
538
- },
539
- onScroll: E(l.onScroll, (p) => {
540
- const g = p.currentTarget, { contentWrapper: C, shouldExpandOnScrollRef: P } = r;
541
- if (P != null && P.current && C) {
542
- const R = Math.abs(o.current - g.scrollTop);
543
- if (R > 0) {
544
- const T = window.innerHeight - D * 2, a = parseFloat(C.style.minHeight), v = parseFloat(C.style.height), y = Math.max(a, v);
545
- if (y < T) {
546
- const d = y + R, h = Math.min(T, d), A = d - h;
547
- C.style.height = h + "px", C.style.bottom === "0px" && (g.scrollTop = A > 0 ? A : 0, C.style.justifyContent = "flex-end");
548
- }
549
- }
550
- }
551
- o.current = g.scrollTop;
552
- })
553
- }
554
- ) })
555
- ] });
556
- }
557
- );
558
- We.displayName = we;
559
- var Fe = "SelectGroup", [Lt, kt] = te(Fe), Ke = t.forwardRef(
560
- (n, c) => {
561
- const { __scopeSelect: e, ...i } = n, l = Ie();
562
- return /* @__PURE__ */ m(Lt, { scope: e, id: l, children: /* @__PURE__ */ m(M.div, { role: "group", "aria-labelledby": l, ...i, ref: c }) });
563
- }
564
- );
565
- Ke.displayName = Fe;
566
- var Ge = "SelectLabel", ze = t.forwardRef(
567
- (n, c) => {
568
- const { __scopeSelect: e, ...i } = n, l = kt(Ge, e);
569
- return /* @__PURE__ */ m(M.div, { id: l.id, ...i, ref: c });
227
+ );
570
228
  }
571
- );
572
- ze.displayName = Ge;
573
- var ie = "SelectItem", [Bt, Ye] = te(ie), je = t.forwardRef(
574
- (n, c) => {
229
+ ), Z = d.forwardRef(
230
+ (e, t) => {
575
231
  const {
576
- __scopeSelect: e,
577
- value: i,
578
- disabled: l = !1,
579
- textValue: u,
580
- ...r
581
- } = n, s = j(ie, e), o = q(ie, e), p = s.value === i, [g, C] = t.useState(u ?? ""), [P, R] = t.useState(!1), T = B(
582
- c,
583
- (d) => {
584
- var h;
585
- return (h = o.itemRefCallback) == null ? void 0 : h.call(o, d, i, l);
232
+ __scopeSlider: o,
233
+ onSlideStart: n,
234
+ onSlideMove: a,
235
+ onSlideEnd: c,
236
+ onHomeKeyDown: r,
237
+ onEndKeyDown: s,
238
+ onStepKeyDown: l,
239
+ ...h
240
+ } = e, S = T(I, o);
241
+ return /* @__PURE__ */ v(
242
+ K.span,
243
+ {
244
+ ...h,
245
+ ref: t,
246
+ onKeyDown: C(e.onKeyDown, (i) => {
247
+ i.key === "Home" ? (r(i), i.preventDefault()) : i.key === "End" ? (s(i), i.preventDefault()) : j.concat(X).includes(i.key) && (l(i), i.preventDefault());
248
+ }),
249
+ onPointerDown: C(e.onPointerDown, (i) => {
250
+ const u = i.target;
251
+ u.setPointerCapture(i.pointerId), i.preventDefault(), S.thumbs.has(u) ? u.focus() : n(i);
252
+ }),
253
+ onPointerMove: C(e.onPointerMove, (i) => {
254
+ i.target.hasPointerCapture(i.pointerId) && a(i);
255
+ }),
256
+ onPointerUp: C(e.onPointerUp, (i) => {
257
+ const u = i.target;
258
+ u.hasPointerCapture(i.pointerId) && (u.releasePointerCapture(i.pointerId), c(i));
259
+ })
586
260
  }
587
- ), a = Ie(), v = t.useRef("touch"), y = () => {
588
- l || (s.onValueChange(i), s.onOpenChange(!1));
589
- };
590
- if (i === "")
591
- throw new Error(
592
- "A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
593
- );
594
- return /* @__PURE__ */ m(
595
- Bt,
261
+ );
262
+ }
263
+ ), ee = "SliderTrack", te = d.forwardRef(
264
+ (e, t) => {
265
+ const { __scopeSlider: o, ...n } = e, a = T(ee, o);
266
+ return /* @__PURE__ */ v(
267
+ K.span,
596
268
  {
597
- scope: e,
598
- value: i,
599
- disabled: l,
600
- textId: a,
601
- isSelected: p,
602
- onItemTextChange: t.useCallback((d) => {
603
- C((h) => h || ((d == null ? void 0 : d.textContent) ?? "").trim());
604
- }, []),
605
- children: /* @__PURE__ */ m(
606
- ae.ItemSlot,
607
- {
608
- scope: e,
609
- value: i,
610
- disabled: l,
611
- textValue: g,
612
- children: /* @__PURE__ */ m(
613
- M.div,
614
- {
615
- role: "option",
616
- "aria-labelledby": a,
617
- "data-highlighted": P ? "" : void 0,
618
- "aria-selected": p && P,
619
- "data-state": p ? "checked" : "unchecked",
620
- "aria-disabled": l || void 0,
621
- "data-disabled": l ? "" : void 0,
622
- tabIndex: l ? void 0 : -1,
623
- ...r,
624
- ref: T,
625
- onFocus: E(r.onFocus, () => R(!0)),
626
- onBlur: E(r.onBlur, () => R(!1)),
627
- onClick: E(r.onClick, () => {
628
- v.current !== "mouse" && y();
629
- }),
630
- onPointerUp: E(r.onPointerUp, () => {
631
- v.current === "mouse" && y();
632
- }),
633
- onPointerDown: E(r.onPointerDown, (d) => {
634
- v.current = d.pointerType;
635
- }),
636
- onPointerMove: E(r.onPointerMove, (d) => {
637
- var h;
638
- v.current = d.pointerType, l ? (h = o.onItemLeave) == null || h.call(o) : v.current === "mouse" && d.currentTarget.focus({ preventScroll: !0 });
639
- }),
640
- onPointerLeave: E(r.onPointerLeave, (d) => {
641
- var h;
642
- d.currentTarget === document.activeElement && ((h = o.onItemLeave) == null || h.call(o));
643
- }),
644
- onKeyDown: E(r.onKeyDown, (d) => {
645
- var A;
646
- ((A = o.searchRef) == null ? void 0 : A.current) !== "" && d.key === " " || (It.includes(d.key) && y(), d.key === " " && d.preventDefault());
647
- })
648
- }
649
- )
650
- }
651
- )
269
+ "data-disabled": a.disabled ? "" : void 0,
270
+ "data-orientation": a.orientation,
271
+ ...n,
272
+ ref: t
652
273
  }
653
274
  );
654
275
  }
655
276
  );
656
- je.displayName = ie;
657
- var re = "SelectItemText", qe = t.forwardRef(
658
- (n, c) => {
659
- const { __scopeSelect: e, className: i, style: l, ...u } = n, r = j(re, e), s = q(re, e), o = Ye(re, e), p = Et(re, e), [g, C] = t.useState(null), P = B(
660
- c,
661
- (y) => C(y),
662
- o.onItemTextChange,
663
- (y) => {
664
- var d;
665
- return (d = s.itemTextRefCallback) == null ? void 0 : d.call(s, y, o.value, o.disabled);
277
+ te.displayName = ee;
278
+ var L = "SliderRange", ne = d.forwardRef(
279
+ (e, t) => {
280
+ const { __scopeSlider: o, ...n } = e, a = T(L, o), c = Q(L, o), r = d.useRef(null), s = M(t, r), l = a.values.length, h = a.values.map(
281
+ (u) => ie(u, a.min, a.max)
282
+ ), S = l > 1 ? Math.min(...h) : 0, i = 100 - Math.max(...h);
283
+ return /* @__PURE__ */ v(
284
+ K.span,
285
+ {
286
+ "data-orientation": a.orientation,
287
+ "data-disabled": a.disabled ? "" : void 0,
288
+ ...n,
289
+ ref: s,
290
+ style: {
291
+ ...e.style,
292
+ [c.startEdge]: S + "%",
293
+ [c.endEdge]: i + "%"
294
+ }
666
295
  }
667
- ), R = g == null ? void 0 : g.textContent, T = t.useMemo(
668
- () => /* @__PURE__ */ m("option", { value: o.value, disabled: o.disabled, children: R }, o.value),
669
- [o.disabled, o.value, R]
670
- ), { onNativeOptionAdd: a, onNativeOptionRemove: v } = p;
671
- return Y(() => (a(T), () => v(T)), [a, v, T]), /* @__PURE__ */ ce(Te, { children: [
672
- /* @__PURE__ */ m(M.span, { id: o.textId, ...u, ref: P }),
673
- o.isSelected && r.valueNode && !r.valueNodeHasChildren ? be.createPortal(u.children, r.valueNode) : null
674
- ] });
296
+ );
675
297
  }
676
298
  );
677
- qe.displayName = re;
678
- var Xe = "SelectItemIndicator", Ze = t.forwardRef(
679
- (n, c) => {
680
- const { __scopeSelect: e, ...i } = n;
681
- return Ye(Xe, e).isSelected ? /* @__PURE__ */ m(M.span, { "aria-hidden": !0, ...i, ref: c }) : null;
299
+ ne.displayName = L;
300
+ var O = "SliderThumb", oe = d.forwardRef(
301
+ (e, t) => {
302
+ const o = he(e.__scopeSlider), [n, a] = d.useState(null), c = M(t, (s) => a(s)), r = d.useMemo(
303
+ () => n ? o().findIndex((s) => s.ref.current === n) : -1,
304
+ [o, n]
305
+ );
306
+ return /* @__PURE__ */ v(be, { ...e, ref: c, index: r });
682
307
  }
683
- );
684
- Ze.displayName = Xe;
685
- var Ce = "SelectScrollUpButton", $e = t.forwardRef((n, c) => {
686
- const e = q(Ce, n.__scopeSelect), i = Pe(Ce, n.__scopeSelect), [l, u] = t.useState(!1), r = B(c, i.onScrollButtonChange);
687
- return Y(() => {
688
- if (e.viewport && e.isPositioned) {
689
- let s = function() {
690
- const p = o.scrollTop > 0;
691
- u(p);
692
- };
693
- const o = e.viewport;
694
- return s(), o.addEventListener("scroll", s), () => o.removeEventListener("scroll", s);
695
- }
696
- }, [e.viewport, e.isPositioned]), l ? /* @__PURE__ */ m(
697
- Qe,
698
- {
699
- ...n,
700
- ref: r,
701
- onAutoScroll: () => {
702
- const { viewport: s, selectedItem: o } = e;
703
- s && o && (s.scrollTop = s.scrollTop - o.offsetHeight);
704
- }
705
- }
706
- ) : null;
707
- });
708
- $e.displayName = Ce;
709
- var ye = "SelectScrollDownButton", Je = t.forwardRef((n, c) => {
710
- const e = q(ye, n.__scopeSelect), i = Pe(ye, n.__scopeSelect), [l, u] = t.useState(!1), r = B(c, i.onScrollButtonChange);
711
- return Y(() => {
712
- if (e.viewport && e.isPositioned) {
713
- let s = function() {
714
- const p = o.scrollHeight - o.clientHeight, g = Math.ceil(o.scrollTop) < p;
715
- u(g);
716
- };
717
- const o = e.viewport;
718
- return s(), o.addEventListener("scroll", s), () => o.removeEventListener("scroll", s);
719
- }
720
- }, [e.viewport, e.isPositioned]), l ? /* @__PURE__ */ m(
721
- Qe,
722
- {
723
- ...n,
724
- ref: r,
725
- onAutoScroll: () => {
726
- const { viewport: s, selectedItem: o } = e;
727
- s && o && (s.scrollTop = s.scrollTop + o.offsetHeight);
308
+ ), be = d.forwardRef(
309
+ (e, t) => {
310
+ const { __scopeSlider: o, index: n, name: a, ...c } = e, r = T(O, o), s = Q(O, o), [l, h] = d.useState(null), S = M(t, (D) => h(D)), i = l ? r.form || !!l.closest("form") : !0, u = fe(l), w = r.values[n], P = w === void 0 ? 0 : ie(w, r.min, r.max), g = xe(n, r.values.length), m = u == null ? void 0 : u[s.size], f = m ? De(m, P, s.direction) : 0;
311
+ return d.useEffect(() => {
312
+ if (l)
313
+ return r.thumbs.add(l), () => {
314
+ r.thumbs.delete(l);
315
+ };
316
+ }, [l, r.thumbs]), /* @__PURE__ */ pe(
317
+ "span",
318
+ {
319
+ style: {
320
+ transform: "var(--radix-slider-thumb-transform)",
321
+ position: "absolute",
322
+ [s.startEdge]: `calc(${P}% + ${f}px)`
323
+ },
324
+ children: [
325
+ /* @__PURE__ */ v(z.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ v(
326
+ K.span,
327
+ {
328
+ role: "slider",
329
+ "aria-label": e["aria-label"] || g,
330
+ "aria-valuemin": r.min,
331
+ "aria-valuenow": w,
332
+ "aria-valuemax": r.max,
333
+ "aria-orientation": r.orientation,
334
+ "data-orientation": r.orientation,
335
+ "data-disabled": r.disabled ? "" : void 0,
336
+ tabIndex: r.disabled ? void 0 : 0,
337
+ ...c,
338
+ ref: S,
339
+ style: w === void 0 ? { display: "none" } : e.style,
340
+ onFocus: C(e.onFocus, () => {
341
+ r.valueIndexToChangeRef.current = n;
342
+ })
343
+ }
344
+ ) }),
345
+ i && /* @__PURE__ */ v(
346
+ re,
347
+ {
348
+ name: a ?? (r.name ? r.name + (r.values.length > 1 ? "[]" : "") : void 0),
349
+ form: r.form,
350
+ value: w
351
+ },
352
+ n
353
+ )
354
+ ]
728
355
  }
729
- }
730
- ) : null;
731
- });
732
- Je.displayName = ye;
733
- var Qe = t.forwardRef((n, c) => {
734
- const { __scopeSelect: e, onAutoScroll: i, ...l } = n, u = q("SelectScrollButton", e), r = t.useRef(null), s = de(e), o = t.useCallback(() => {
735
- r.current !== null && (window.clearInterval(r.current), r.current = null);
736
- }, []);
737
- return t.useEffect(() => () => o(), [o]), Y(() => {
738
- var g;
739
- const p = s().find((C) => C.ref.current === document.activeElement);
740
- (g = p == null ? void 0 : p.ref.current) == null || g.scrollIntoView({ block: "nearest" });
741
- }, [s]), /* @__PURE__ */ m(
742
- M.div,
743
- {
744
- "aria-hidden": !0,
745
- ...l,
746
- ref: c,
747
- style: { flexShrink: 0, ...l.style },
748
- onPointerDown: E(l.onPointerDown, () => {
749
- r.current === null && (r.current = window.setInterval(i, 50));
750
- }),
751
- onPointerMove: E(l.onPointerMove, () => {
752
- var p;
753
- (p = u.onItemLeave) == null || p.call(u), r.current === null && (r.current = window.setInterval(i, 50));
754
- }),
755
- onPointerLeave: E(l.onPointerLeave, () => {
756
- o();
757
- })
758
- }
759
- );
760
- }), Vt = "SelectSeparator", et = t.forwardRef(
761
- (n, c) => {
762
- const { __scopeSelect: e, ...i } = n;
763
- return /* @__PURE__ */ m(M.div, { "aria-hidden": !0, ...i, ref: c });
764
- }
765
- );
766
- et.displayName = Vt;
767
- var xe = "SelectArrow", Ht = t.forwardRef(
768
- (n, c) => {
769
- const { __scopeSelect: e, ...i } = n, l = ue(e), u = j(xe, e), r = q(xe, e);
770
- return u.open && r.position === "popper" ? /* @__PURE__ */ m(mt, { ...l, ...i, ref: c }) : null;
356
+ );
771
357
  }
772
358
  );
773
- Ht.displayName = xe;
774
- var Ut = "SelectBubbleInput", tt = t.forwardRef(
775
- ({ __scopeSelect: n, value: c, ...e }, i) => {
776
- const l = t.useRef(null), u = B(i, l), r = St(c);
777
- return t.useEffect(() => {
778
- const s = l.current;
359
+ oe.displayName = O;
360
+ var Re = "RadioBubbleInput", re = d.forwardRef(
361
+ ({ __scopeSlider: e, value: t, ...o }, n) => {
362
+ const a = d.useRef(null), c = M(a, n), r = ue(t);
363
+ return d.useEffect(() => {
364
+ const s = a.current;
779
365
  if (!s) return;
780
- const o = window.HTMLSelectElement.prototype, g = Object.getOwnPropertyDescriptor(
781
- o,
782
- "value"
783
- ).set;
784
- if (r !== c && g) {
785
- const C = new Event("change", { bubbles: !0 });
786
- g.call(s, c), s.dispatchEvent(C);
366
+ const l = window.HTMLInputElement.prototype, S = Object.getOwnPropertyDescriptor(l, "value").set;
367
+ if (r !== t && S) {
368
+ const i = new Event("input", { bubbles: !0 });
369
+ S.call(s, t), s.dispatchEvent(i);
787
370
  }
788
- }, [r, c]), /* @__PURE__ */ m(
789
- M.select,
371
+ }, [r, t]), /* @__PURE__ */ v(
372
+ K.input,
790
373
  {
791
- ...e,
792
- style: { ...wt, ...e.style },
793
- ref: u,
794
- defaultValue: c
374
+ style: { display: "none" },
375
+ ...o,
376
+ ref: c,
377
+ defaultValue: t
795
378
  }
796
379
  );
797
380
  }
798
381
  );
799
- tt.displayName = Ut;
800
- function ot(n) {
801
- return n === "" || n === void 0;
382
+ re.displayName = Re;
383
+ function Pe(e = [], t, o) {
384
+ const n = [...e];
385
+ return n[o] = t, n.sort((a, c) => a - c);
386
+ }
387
+ function ie(e, t, o) {
388
+ const c = 100 / (o - t) * (e - t);
389
+ return $(c, [0, 100]);
390
+ }
391
+ function xe(e, t) {
392
+ return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
393
+ }
394
+ function ye(e, t) {
395
+ if (e.length === 1) return 0;
396
+ const o = e.map((a) => Math.abs(a - t)), n = Math.min(...o);
397
+ return o.indexOf(n);
398
+ }
399
+ function De(e, t, o) {
400
+ const n = e / 2, c = U([0, 50], [0, n]);
401
+ return (n - c(t) * o) * o;
402
+ }
403
+ function Ee(e) {
404
+ return e.slice(0, -1).map((t, o) => e[o + 1] - t);
405
+ }
406
+ function _e(e, t) {
407
+ if (t > 0) {
408
+ const o = Ee(e);
409
+ return Math.min(...o) >= t;
410
+ }
411
+ return !0;
802
412
  }
803
- function nt(n) {
804
- const c = gt(n), e = t.useRef(""), i = t.useRef(0), l = t.useCallback(
805
- (r) => {
806
- const s = e.current + r;
807
- c(s), function o(p) {
808
- e.current = p, window.clearTimeout(i.current), p !== "" && (i.current = window.setTimeout(() => o(""), 1e3));
809
- }(s);
810
- },
811
- [c]
812
- ), u = t.useCallback(() => {
813
- e.current = "", window.clearTimeout(i.current);
814
- }, []);
815
- return t.useEffect(() => () => window.clearTimeout(i.current), []), [e, l, u];
413
+ function U(e, t) {
414
+ return (o) => {
415
+ if (e[0] === e[1] || t[0] === t[1]) return t[0];
416
+ const n = (t[1] - t[0]) / (e[1] - e[0]);
417
+ return t[0] + n * (o - e[0]);
418
+ };
816
419
  }
817
- function rt(n, c, e) {
818
- const l = c.length > 1 && Array.from(c).every((p) => p === c[0]) ? c[0] : c, u = e ? n.indexOf(e) : -1;
819
- let r = Wt(n, Math.max(u, 0));
820
- l.length === 1 && (r = r.filter((p) => p !== e));
821
- const o = r.find(
822
- (p) => p.textValue.toLowerCase().startsWith(l.toLowerCase())
823
- );
824
- return o !== e ? o : void 0;
420
+ function Ce(e) {
421
+ return (String(e).split(".")[1] || "").length;
825
422
  }
826
- function Wt(n, c) {
827
- return n.map((e, i) => n[(c + i) % n.length]);
423
+ function Me(e, t) {
424
+ const o = Math.pow(10, t);
425
+ return Math.round(e * o) / o;
828
426
  }
829
- var uo = Ne, po = Ae, fo = De, mo = Le, ho = ke, vo = Be, go = We, So = Ke, wo = ze, Co = je, yo = qe, xo = Ze, Io = $e, To = Je, Po = et;
427
+ var Oe = q, Ue = te, Fe = ne, Ye = oe;
830
428
  export {
831
- vo as Content,
832
- So as Group,
833
- mo as Icon,
834
- Co as Item,
835
- xo as ItemIndicator,
836
- yo as ItemText,
837
- wo as Label,
838
- ho as Portal,
839
- uo as Root,
840
- To as ScrollDownButton,
841
- Io as ScrollUpButton,
842
- Ne as Select,
843
- Ht as SelectArrow,
844
- Be as SelectContent,
845
- Ke as SelectGroup,
846
- Le as SelectIcon,
847
- je as SelectItem,
848
- Ze as SelectItemIndicator,
849
- qe as SelectItemText,
850
- ze as SelectLabel,
851
- ke as SelectPortal,
852
- Je as SelectScrollDownButton,
853
- $e as SelectScrollUpButton,
854
- et as SelectSeparator,
855
- Ae as SelectTrigger,
856
- De as SelectValue,
857
- We as SelectViewport,
858
- Po as Separator,
859
- po as Trigger,
860
- fo as Value,
861
- go as Viewport
429
+ Fe as Range,
430
+ Oe as Root,
431
+ q as Slider,
432
+ ne as SliderRange,
433
+ oe as SliderThumb,
434
+ te as SliderTrack,
435
+ Ye as Thumb,
436
+ Ue as Track
862
437
  };