@cfx-dev/ui-components 4.2.1 → 4.2.4

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.
@@ -1,120 +1,40 @@
1
- import { jsx as f, Fragment as pe, jsxs as B } from "react/jsx-runtime";
1
+ import { jsx as u, Fragment as me, jsxs as k } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import z from "react";
3
+ import L from "react";
4
4
  import { c as Z } from "../../index-rKs9bXHr.js";
5
- import { u as he, a as Se } from "../../index-Cf5Yu9oD.js";
6
- import { u as ge } from "../../index-ByaXH_ih.js";
7
- import { u as be } from "../../index-BZPx6jYI.js";
5
+ import { c as pe, a as he, b as Se, d as V, u as I } from "../../index-AweK2ufS.js";
6
+ import { u as ge, a as be } from "../../index-Cf5Yu9oD.js";
7
+ import { u as ve } from "../../index-ByaXH_ih.js";
8
+ import { u as _e } from "../../index-BZPx6jYI.js";
8
9
  import "../../index-2hJuj4UN.js";
9
- import { c as _e } from "../../index-CjTSD6zB.js";
10
- import { clsx as ve } from "../../utils/clsx.js";
11
- function V(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
12
- return function(o) {
13
- if (e == null || e(o), n === !1 || !o.defaultPrevented)
14
- return t == null ? void 0 : t(o);
15
- };
16
- }
17
- function G(e, t) {
18
- if (typeof e == "function")
19
- return e(t);
20
- e != null && (e.current = t);
21
- }
22
- function q(...e) {
23
- return (t) => {
24
- let n = !1;
25
- const r = e.map((o) => {
26
- const s = G(o, t);
27
- return !n && typeof s == "function" && (n = !0), s;
28
- });
29
- if (n)
30
- return () => {
31
- for (let o = 0; o < r.length; o++) {
32
- const s = r[o];
33
- typeof s == "function" ? s() : G(e[o], null);
34
- }
35
- };
36
- };
37
- }
38
- function k(...e) {
39
- return c.useCallback(q(...e), e);
40
- }
41
- function we(e, t = []) {
42
- let n = [];
43
- function r(s, i) {
44
- const a = c.createContext(i), u = n.length;
45
- n = [...n, i];
46
- const m = (l) => {
47
- var h;
48
- const { scope: d, children: p, ..._ } = l, S = ((h = d == null ? void 0 : d[e]) == null ? void 0 : h[u]) || a, g = c.useMemo(() => _, Object.values(_));
49
- return /* @__PURE__ */ f(S.Provider, { value: g, children: p });
50
- };
51
- m.displayName = s + "Provider";
52
- function b(l, d) {
53
- var S;
54
- const p = ((S = d == null ? void 0 : d[e]) == null ? void 0 : S[u]) || a, _ = c.useContext(p);
55
- if (_) return _;
56
- if (i !== void 0) return i;
57
- throw new Error(`\`${l}\` must be used within \`${s}\``);
58
- }
59
- return [m, b];
60
- }
61
- const o = () => {
62
- const s = n.map((i) => c.createContext(i));
63
- return function(a) {
64
- const u = (a == null ? void 0 : a[e]) || s;
65
- return c.useMemo(
66
- () => ({ [`__scope${e}`]: { ...a, [e]: u } }),
67
- [a, u]
68
- );
69
- };
70
- };
71
- return o.scopeName = e, [r, xe(o, ...t)];
72
- }
73
- function xe(...e) {
74
- const t = e[0];
75
- if (e.length === 1) return t;
76
- const n = () => {
77
- const r = e.map((o) => ({
78
- useScope: o(),
79
- scopeName: o.scopeName
80
- }));
81
- return function(s) {
82
- const i = r.reduce((a, { useScope: u, scopeName: m }) => {
83
- const l = u(s)[`__scope${m}`];
84
- return { ...a, ...l };
85
- }, {});
86
- return c.useMemo(() => ({ [`__scope${t.scopeName}`]: i }), [i]);
87
- };
88
- };
89
- return n.scopeName = t.scopeName, n;
90
- }
91
- var J = c.forwardRef((e, t) => {
10
+ import { clsx as G } from "../../utils/clsx.js";
11
+ var q = c.forwardRef((e, t) => {
92
12
  const { children: n, ...r } = e, o = c.Children.toArray(n), s = o.find(ye);
93
13
  if (s) {
94
- const i = s.props.children, a = o.map((u) => u === s ? c.Children.count(i) > 1 ? c.Children.only(null) : c.isValidElement(i) ? i.props.children : null : u);
95
- return /* @__PURE__ */ f(F, { ...r, ref: t, children: c.isValidElement(i) ? c.cloneElement(i, void 0, a) : null });
14
+ const i = s.props.children, a = o.map((d) => d === s ? c.Children.count(i) > 1 ? c.Children.only(null) : c.isValidElement(i) ? i.props.children : null : d);
15
+ return /* @__PURE__ */ u(F, { ...r, ref: t, children: c.isValidElement(i) ? c.cloneElement(i, void 0, a) : null });
96
16
  }
97
- return /* @__PURE__ */ f(F, { ...r, ref: t, children: n });
17
+ return /* @__PURE__ */ u(F, { ...r, ref: t, children: n });
98
18
  });
99
- J.displayName = "Slot";
19
+ q.displayName = "Slot";
100
20
  var F = c.forwardRef((e, t) => {
101
21
  const { children: n, ...r } = e;
102
22
  if (c.isValidElement(n)) {
103
- const o = Ce(n);
23
+ const o = Pe(n);
104
24
  return c.cloneElement(n, {
105
- ...Pe(r, n.props),
25
+ ...Re(r, n.props),
106
26
  // @ts-ignore
107
- ref: t ? q(t, o) : o
27
+ ref: t ? pe(t, o) : o
108
28
  });
109
29
  }
110
30
  return c.Children.count(n) > 1 ? c.Children.only(null) : null;
111
31
  });
112
32
  F.displayName = "SlotClone";
113
- var Re = ({ children: e }) => /* @__PURE__ */ f(pe, { children: e });
33
+ var we = ({ children: e }) => /* @__PURE__ */ u(me, { children: e });
114
34
  function ye(e) {
115
- return c.isValidElement(e) && e.type === Re;
35
+ return c.isValidElement(e) && e.type === we;
116
36
  }
117
- function Pe(e, t) {
37
+ function Re(e, t) {
118
38
  const n = { ...t };
119
39
  for (const r in t) {
120
40
  const o = e[r], s = t[r];
@@ -124,12 +44,12 @@ function Pe(e, t) {
124
44
  }
125
45
  return { ...e, ...n };
126
46
  }
127
- function Ce(e) {
47
+ function Pe(e) {
128
48
  var r, o;
129
49
  let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
130
50
  return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
131
51
  }
132
- var De = [
52
+ var xe = [
133
53
  "a",
134
54
  "button",
135
55
  "div",
@@ -146,20 +66,20 @@ var De = [
146
66
  "span",
147
67
  "svg",
148
68
  "ul"
149
- ], I = De.reduce((e, t) => {
69
+ ], K = xe.reduce((e, t) => {
150
70
  const n = c.forwardRef((r, o) => {
151
- const { asChild: s, ...i } = r, a = s ? J : t;
152
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(a, { ...i, ref: o });
71
+ const { asChild: s, ...i } = r, a = s ? q : t;
72
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(a, { ...i, ref: o });
153
73
  });
154
74
  return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
155
- }, {}), Q = ["PageUp", "PageDown"], ee = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], te = {
75
+ }, {}), J = ["PageUp", "PageDown"], Q = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], ee = {
156
76
  "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
157
77
  "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
158
78
  "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
159
79
  "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
160
- }, M = "Slider", [H, Ee, Ve] = _e(M), [ne, lt] = we(M, [
161
- Ve
162
- ]), [Me, K] = ne(M), re = c.forwardRef(
80
+ }, M = "Slider", [j, Ce, Ee] = he(M), [te, at] = Se(M, [
81
+ Ee
82
+ ]), [De, T] = te(M), ne = c.forwardRef(
163
83
  (e, t) => {
164
84
  const {
165
85
  name: n,
@@ -168,49 +88,49 @@ var De = [
168
88
  step: s = 1,
169
89
  orientation: i = "horizontal",
170
90
  disabled: a = !1,
171
- minStepsBetweenThumbs: u = 0,
91
+ minStepsBetweenThumbs: d = 0,
172
92
  defaultValue: m = [r],
173
- value: b,
93
+ value: v,
174
94
  onValueChange: l = () => {
175
95
  },
176
- onValueCommit: d = () => {
96
+ onValueCommit: f = () => {
177
97
  },
178
- inverted: p = !1,
98
+ inverted: g = !1,
179
99
  form: _,
180
100
  ...S
181
- } = e, g = c.useRef(/* @__PURE__ */ new Set()), h = c.useRef(0), w = i === "horizontal" ? Te : Ne, [v = [], T] = he({
182
- prop: b,
101
+ } = e, p = c.useRef(/* @__PURE__ */ new Set()), h = c.useRef(0), w = i === "horizontal" ? Ve : Me, [b = [], A] = ge({
102
+ prop: v,
183
103
  defaultProp: m,
184
- onChange: (x) => {
185
- var D;
186
- (D = [...g.current][h.current]) == null || D.focus(), l(x);
104
+ onChange: (y) => {
105
+ var E;
106
+ (E = [...p.current][h.current]) == null || E.focus(), l(y);
187
107
  }
188
- }), O = c.useRef(v);
189
- function L(x) {
190
- const R = Ke(v, x);
191
- N(x, R);
108
+ }), H = c.useRef(b);
109
+ function O(y) {
110
+ const R = ke(b, y);
111
+ N(y, R);
192
112
  }
193
- function fe(x) {
194
- N(x, h.current);
113
+ function ue(y) {
114
+ N(y, h.current);
195
115
  }
196
- function me() {
197
- const x = O.current[h.current];
198
- v[h.current] !== x && d(v);
116
+ function fe() {
117
+ const y = H.current[h.current];
118
+ b[h.current] !== y && f(b);
199
119
  }
200
- function N(x, R, { commit: D } = { commit: !1 }) {
201
- const Y = ze(s), $ = Fe(Math.round((x - r) / s) * s + r, Y), A = Z($, [r, o]);
202
- T((E = []) => {
203
- const y = Be(E, A, R);
204
- if ($e(y, u * s)) {
205
- h.current = y.indexOf(A);
206
- const X = String(y) !== String(E);
207
- return X && D && d(y), X ? y : E;
120
+ function N(y, R, { commit: E } = { commit: !1 }) {
121
+ const $ = Oe(s), z = ze(Math.round((y - r) / s) * s + r, $), B = Z(z, [r, o]);
122
+ A((D = []) => {
123
+ const P = Be(D, B, R);
124
+ if (He(P, d * s)) {
125
+ h.current = P.indexOf(B);
126
+ const X = String(P) !== String(D);
127
+ return X && E && f(P), X ? P : D;
208
128
  } else
209
- return E;
129
+ return D;
210
130
  });
211
131
  }
212
- return /* @__PURE__ */ f(
213
- Me,
132
+ return /* @__PURE__ */ u(
133
+ De,
214
134
  {
215
135
  scope: e.__scopeSlider,
216
136
  name: n,
@@ -218,11 +138,11 @@ var De = [
218
138
  min: r,
219
139
  max: o,
220
140
  valueIndexToChangeRef: h,
221
- thumbs: g.current,
222
- values: v,
141
+ thumbs: p.current,
142
+ values: b,
223
143
  orientation: i,
224
144
  form: _,
225
- children: /* @__PURE__ */ f(H.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ f(H.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ f(
145
+ children: /* @__PURE__ */ u(j.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ u(j.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ u(
226
146
  w,
227
147
  {
228
148
  "aria-disabled": a,
@@ -230,20 +150,20 @@ var De = [
230
150
  ...S,
231
151
  ref: t,
232
152
  onPointerDown: V(S.onPointerDown, () => {
233
- a || (O.current = v);
153
+ a || (H.current = b);
234
154
  }),
235
155
  min: r,
236
156
  max: o,
237
- inverted: p,
238
- onSlideStart: a ? void 0 : L,
239
- onSlideMove: a ? void 0 : fe,
240
- onSlideEnd: a ? void 0 : me,
157
+ inverted: g,
158
+ onSlideStart: a ? void 0 : O,
159
+ onSlideMove: a ? void 0 : ue,
160
+ onSlideEnd: a ? void 0 : fe,
241
161
  onHomeKeyDown: () => !a && N(r, 0, { commit: !0 }),
242
- onEndKeyDown: () => !a && N(o, v.length - 1, { commit: !0 }),
243
- onStepKeyDown: ({ event: x, direction: R }) => {
162
+ onEndKeyDown: () => !a && N(o, b.length - 1, { commit: !0 }),
163
+ onStepKeyDown: ({ event: y, direction: R }) => {
244
164
  if (!a) {
245
- const $ = Q.includes(x.key) || x.shiftKey && ee.includes(x.key) ? 10 : 1, A = h.current, E = v[A], y = s * $ * R;
246
- N(E + y, A, { commit: !0 });
165
+ const z = J.includes(y.key) || y.shiftKey && Q.includes(y.key) ? 10 : 1, B = h.current, D = b[B], P = s * z * R;
166
+ N(D + P, B, { commit: !0 });
247
167
  }
248
168
  }
249
169
  }
@@ -252,13 +172,13 @@ var De = [
252
172
  );
253
173
  }
254
174
  );
255
- re.displayName = M;
256
- var [oe, ie] = ne(M, {
175
+ ne.displayName = M;
176
+ var [re, oe] = te(M, {
257
177
  startEdge: "left",
258
178
  endEdge: "right",
259
179
  size: "width",
260
180
  direction: 1
261
- }), Te = c.forwardRef(
181
+ }), Ve = c.forwardRef(
262
182
  (e, t) => {
263
183
  const {
264
184
  min: n,
@@ -267,54 +187,54 @@ var [oe, ie] = ne(M, {
267
187
  inverted: s,
268
188
  onSlideStart: i,
269
189
  onSlideMove: a,
270
- onSlideEnd: u,
190
+ onSlideEnd: d,
271
191
  onStepKeyDown: m,
272
- ...b
273
- } = e, [l, d] = c.useState(null), p = k(t, (w) => d(w)), _ = c.useRef(void 0), S = ge(o), g = S === "ltr", h = g && !s || !g && s;
192
+ ...v
193
+ } = e, [l, f] = c.useState(null), g = I(t, (w) => f(w)), _ = c.useRef(void 0), S = ve(o), p = S === "ltr", h = p && !s || !p && s;
274
194
  function C(w) {
275
- const v = _.current || l.getBoundingClientRect(), T = [0, v.width], L = U(T, h ? [n, r] : [r, n]);
276
- return _.current = v, L(w - v.left);
195
+ const b = _.current || l.getBoundingClientRect(), A = [0, b.width], O = Y(A, h ? [n, r] : [r, n]);
196
+ return _.current = b, O(w - b.left);
277
197
  }
278
- return /* @__PURE__ */ f(
279
- oe,
198
+ return /* @__PURE__ */ u(
199
+ re,
280
200
  {
281
201
  scope: e.__scopeSlider,
282
202
  startEdge: h ? "left" : "right",
283
203
  endEdge: h ? "right" : "left",
284
204
  direction: h ? 1 : -1,
285
205
  size: "width",
286
- children: /* @__PURE__ */ f(
287
- se,
206
+ children: /* @__PURE__ */ u(
207
+ ie,
288
208
  {
289
209
  dir: S,
290
210
  "data-orientation": "horizontal",
291
- ...b,
292
- ref: p,
211
+ ...v,
212
+ ref: g,
293
213
  style: {
294
- ...b.style,
214
+ ...v.style,
295
215
  "--radix-slider-thumb-transform": "translateX(-50%)"
296
216
  },
297
217
  onSlideStart: (w) => {
298
- const v = C(w.clientX);
299
- i == null || i(v);
218
+ const b = C(w.clientX);
219
+ i == null || i(b);
300
220
  },
301
221
  onSlideMove: (w) => {
302
- const v = C(w.clientX);
303
- a == null || a(v);
222
+ const b = C(w.clientX);
223
+ a == null || a(b);
304
224
  },
305
225
  onSlideEnd: () => {
306
- _.current = void 0, u == null || u();
226
+ _.current = void 0, d == null || d();
307
227
  },
308
228
  onStepKeyDown: (w) => {
309
- const T = te[h ? "from-left" : "from-right"].includes(w.key);
310
- m == null || m({ event: w, direction: T ? -1 : 1 });
229
+ const A = ee[h ? "from-left" : "from-right"].includes(w.key);
230
+ m == null || m({ event: w, direction: A ? -1 : 1 });
311
231
  }
312
232
  }
313
233
  )
314
234
  }
315
235
  );
316
236
  }
317
- ), Ne = c.forwardRef(
237
+ ), Me = c.forwardRef(
318
238
  (e, t) => {
319
239
  const {
320
240
  min: n,
@@ -323,23 +243,23 @@ var [oe, ie] = ne(M, {
323
243
  onSlideStart: s,
324
244
  onSlideMove: i,
325
245
  onSlideEnd: a,
326
- onStepKeyDown: u,
246
+ onStepKeyDown: d,
327
247
  ...m
328
- } = e, b = c.useRef(null), l = k(t, b), d = c.useRef(void 0), p = !o;
248
+ } = e, v = c.useRef(null), l = I(t, v), f = c.useRef(void 0), g = !o;
329
249
  function _(S) {
330
- const g = d.current || b.current.getBoundingClientRect(), h = [0, g.height], w = U(h, p ? [r, n] : [n, r]);
331
- return d.current = g, w(S - g.top);
250
+ const p = f.current || v.current.getBoundingClientRect(), h = [0, p.height], w = Y(h, g ? [r, n] : [n, r]);
251
+ return f.current = p, w(S - p.top);
332
252
  }
333
- return /* @__PURE__ */ f(
334
- oe,
253
+ return /* @__PURE__ */ u(
254
+ re,
335
255
  {
336
256
  scope: e.__scopeSlider,
337
- startEdge: p ? "bottom" : "top",
338
- endEdge: p ? "top" : "bottom",
257
+ startEdge: g ? "bottom" : "top",
258
+ endEdge: g ? "top" : "bottom",
339
259
  size: "height",
340
- direction: p ? 1 : -1,
341
- children: /* @__PURE__ */ f(
342
- se,
260
+ direction: g ? 1 : -1,
261
+ children: /* @__PURE__ */ u(
262
+ ie,
343
263
  {
344
264
  "data-orientation": "vertical",
345
265
  ...m,
@@ -349,26 +269,26 @@ var [oe, ie] = ne(M, {
349
269
  "--radix-slider-thumb-transform": "translateY(50%)"
350
270
  },
351
271
  onSlideStart: (S) => {
352
- const g = _(S.clientY);
353
- s == null || s(g);
272
+ const p = _(S.clientY);
273
+ s == null || s(p);
354
274
  },
355
275
  onSlideMove: (S) => {
356
- const g = _(S.clientY);
357
- i == null || i(g);
276
+ const p = _(S.clientY);
277
+ i == null || i(p);
358
278
  },
359
279
  onSlideEnd: () => {
360
- d.current = void 0, a == null || a();
280
+ f.current = void 0, a == null || a();
361
281
  },
362
282
  onStepKeyDown: (S) => {
363
- const h = te[p ? "from-bottom" : "from-top"].includes(S.key);
364
- u == null || u({ event: S, direction: h ? -1 : 1 });
283
+ const h = ee[g ? "from-bottom" : "from-top"].includes(S.key);
284
+ d == null || d({ event: S, direction: h ? -1 : 1 });
365
285
  }
366
286
  }
367
287
  )
368
288
  }
369
289
  );
370
290
  }
371
- ), se = c.forwardRef(
291
+ ), ie = c.forwardRef(
372
292
  (e, t) => {
373
293
  const {
374
294
  __scopeSlider: n,
@@ -377,36 +297,36 @@ var [oe, ie] = ne(M, {
377
297
  onSlideEnd: s,
378
298
  onHomeKeyDown: i,
379
299
  onEndKeyDown: a,
380
- onStepKeyDown: u,
300
+ onStepKeyDown: d,
381
301
  ...m
382
- } = e, b = K(M, n);
383
- return /* @__PURE__ */ f(
384
- I.span,
302
+ } = e, v = T(M, n);
303
+ return /* @__PURE__ */ u(
304
+ K.span,
385
305
  {
386
306
  ...m,
387
307
  ref: t,
388
308
  onKeyDown: V(e.onKeyDown, (l) => {
389
- l.key === "Home" ? (i(l), l.preventDefault()) : l.key === "End" ? (a(l), l.preventDefault()) : Q.concat(ee).includes(l.key) && (u(l), l.preventDefault());
309
+ l.key === "Home" ? (i(l), l.preventDefault()) : l.key === "End" ? (a(l), l.preventDefault()) : J.concat(Q).includes(l.key) && (d(l), l.preventDefault());
390
310
  }),
391
311
  onPointerDown: V(e.onPointerDown, (l) => {
392
- const d = l.target;
393
- d.setPointerCapture(l.pointerId), l.preventDefault(), b.thumbs.has(d) ? d.focus() : r(l);
312
+ const f = l.target;
313
+ f.setPointerCapture(l.pointerId), l.preventDefault(), v.thumbs.has(f) ? f.focus() : r(l);
394
314
  }),
395
315
  onPointerMove: V(e.onPointerMove, (l) => {
396
316
  l.target.hasPointerCapture(l.pointerId) && o(l);
397
317
  }),
398
318
  onPointerUp: V(e.onPointerUp, (l) => {
399
- const d = l.target;
400
- d.hasPointerCapture(l.pointerId) && (d.releasePointerCapture(l.pointerId), s(l));
319
+ const f = l.target;
320
+ f.hasPointerCapture(l.pointerId) && (f.releasePointerCapture(l.pointerId), s(l));
401
321
  })
402
322
  }
403
323
  );
404
324
  }
405
- ), ae = "SliderTrack", ce = c.forwardRef(
325
+ ), se = "SliderTrack", ae = c.forwardRef(
406
326
  (e, t) => {
407
- const { __scopeSlider: n, ...r } = e, o = K(ae, n);
408
- return /* @__PURE__ */ f(
409
- I.span,
327
+ const { __scopeSlider: n, ...r } = e, o = T(se, n);
328
+ return /* @__PURE__ */ u(
329
+ K.span,
410
330
  {
411
331
  "data-disabled": o.disabled ? "" : void 0,
412
332
  "data-orientation": o.orientation,
@@ -416,14 +336,14 @@ var [oe, ie] = ne(M, {
416
336
  );
417
337
  }
418
338
  );
419
- ce.displayName = ae;
420
- var j = "SliderRange", le = c.forwardRef(
339
+ ae.displayName = se;
340
+ var W = "SliderRange", le = c.forwardRef(
421
341
  (e, t) => {
422
- const { __scopeSlider: n, ...r } = e, o = K(j, n), s = ie(j, n), i = c.useRef(null), a = k(t, i), u = o.values.length, m = o.values.map(
423
- (d) => de(d, o.min, o.max)
424
- ), b = u > 1 ? Math.min(...m) : 0, l = 100 - Math.max(...m);
425
- return /* @__PURE__ */ f(
426
- I.span,
342
+ const { __scopeSlider: n, ...r } = e, o = T(W, n), s = oe(W, n), i = c.useRef(null), a = I(t, i), d = o.values.length, m = o.values.map(
343
+ (f) => de(f, o.min, o.max)
344
+ ), v = d > 1 ? Math.min(...m) : 0, l = 100 - Math.max(...m);
345
+ return /* @__PURE__ */ u(
346
+ K.span,
427
347
  {
428
348
  "data-orientation": o.orientation,
429
349
  "data-disabled": o.disabled ? "" : void 0,
@@ -431,31 +351,31 @@ var j = "SliderRange", le = c.forwardRef(
431
351
  ref: a,
432
352
  style: {
433
353
  ...e.style,
434
- [s.startEdge]: b + "%",
354
+ [s.startEdge]: v + "%",
435
355
  [s.endEdge]: l + "%"
436
356
  }
437
357
  }
438
358
  );
439
359
  }
440
360
  );
441
- le.displayName = j;
442
- var W = "SliderThumb", ue = c.forwardRef(
361
+ le.displayName = W;
362
+ var U = "SliderThumb", ce = c.forwardRef(
443
363
  (e, t) => {
444
- const n = Ee(e.__scopeSlider), [r, o] = c.useState(null), s = k(t, (a) => o(a)), i = c.useMemo(
364
+ const n = Ce(e.__scopeSlider), [r, o] = c.useState(null), s = I(t, (a) => o(a)), i = c.useMemo(
445
365
  () => r ? n().findIndex((a) => a.ref.current === r) : -1,
446
366
  [n, r]
447
367
  );
448
- return /* @__PURE__ */ f(Ae, { ...e, ref: s, index: i });
368
+ return /* @__PURE__ */ u(Ae, { ...e, ref: s, index: i });
449
369
  }
450
370
  ), Ae = c.forwardRef(
451
371
  (e, t) => {
452
- const { __scopeSlider: n, index: r, name: o, ...s } = e, i = K(W, n), a = ie(W, n), [u, m] = c.useState(null), b = k(t, (C) => m(C)), l = u ? i.form || !!u.closest("form") : !0, d = Se(u), p = i.values[r], _ = p === void 0 ? 0 : de(p, i.min, i.max), S = Ie(r, i.values.length), g = d == null ? void 0 : d[a.size], h = g ? Oe(g, _, a.direction) : 0;
372
+ const { __scopeSlider: n, index: r, name: o, ...s } = e, i = T(U, n), a = oe(U, n), [d, m] = c.useState(null), v = I(t, (C) => m(C)), l = d ? i.form || !!d.closest("form") : !0, f = be(d), g = i.values[r], _ = g === void 0 ? 0 : de(g, i.min, i.max), S = Ie(r, i.values.length), p = f == null ? void 0 : f[a.size], h = p ? Ke(p, _, a.direction) : 0;
453
373
  return c.useEffect(() => {
454
- if (u)
455
- return i.thumbs.add(u), () => {
456
- i.thumbs.delete(u);
374
+ if (d)
375
+ return i.thumbs.add(d), () => {
376
+ i.thumbs.delete(d);
457
377
  };
458
- }, [u, i.thumbs]), /* @__PURE__ */ B(
378
+ }, [d, i.thumbs]), /* @__PURE__ */ k(
459
379
  "span",
460
380
  {
461
381
  style: {
@@ -464,32 +384,32 @@ var W = "SliderThumb", ue = c.forwardRef(
464
384
  [a.startEdge]: `calc(${_}% + ${h}px)`
465
385
  },
466
386
  children: [
467
- /* @__PURE__ */ f(H.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ f(
468
- I.span,
387
+ /* @__PURE__ */ u(j.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ u(
388
+ K.span,
469
389
  {
470
390
  role: "slider",
471
391
  "aria-label": e["aria-label"] || S,
472
392
  "aria-valuemin": i.min,
473
- "aria-valuenow": p,
393
+ "aria-valuenow": g,
474
394
  "aria-valuemax": i.max,
475
395
  "aria-orientation": i.orientation,
476
396
  "data-orientation": i.orientation,
477
397
  "data-disabled": i.disabled ? "" : void 0,
478
398
  tabIndex: i.disabled ? void 0 : 0,
479
399
  ...s,
480
- ref: b,
481
- style: p === void 0 ? { display: "none" } : e.style,
400
+ ref: v,
401
+ style: g === void 0 ? { display: "none" } : e.style,
482
402
  onFocus: V(e.onFocus, () => {
483
403
  i.valueIndexToChangeRef.current = r;
484
404
  })
485
405
  }
486
406
  ) }),
487
- l && /* @__PURE__ */ f(
488
- ke,
407
+ l && /* @__PURE__ */ u(
408
+ Ne,
489
409
  {
490
410
  name: o ?? (i.name ? i.name + (i.values.length > 1 ? "[]" : "") : void 0),
491
411
  form: i.form,
492
- value: p
412
+ value: g
493
413
  },
494
414
  r
495
415
  )
@@ -498,16 +418,16 @@ var W = "SliderThumb", ue = c.forwardRef(
498
418
  );
499
419
  }
500
420
  );
501
- ue.displayName = W;
502
- var ke = (e) => {
503
- const { value: t, ...n } = e, r = c.useRef(null), o = be(t);
421
+ ce.displayName = U;
422
+ var Ne = (e) => {
423
+ const { value: t, ...n } = e, r = c.useRef(null), o = _e(t);
504
424
  return c.useEffect(() => {
505
- const s = r.current, i = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(i, "value").set;
506
- if (o !== t && u) {
425
+ const s = r.current, i = window.HTMLInputElement.prototype, d = Object.getOwnPropertyDescriptor(i, "value").set;
426
+ if (o !== t && d) {
507
427
  const m = new Event("input", { bubbles: !0 });
508
- u.call(s, t), s.dispatchEvent(m);
428
+ d.call(s, t), s.dispatchEvent(m);
509
429
  }
510
- }, [o, t]), /* @__PURE__ */ f("input", { style: { display: "none" }, ...n, ref: r, defaultValue: t });
430
+ }, [o, t]), /* @__PURE__ */ u("input", { style: { display: "none" }, ...n, ref: r, defaultValue: t });
511
431
  };
512
432
  function Be(e = [], t, n) {
513
433
  const r = [...e];
@@ -520,90 +440,95 @@ function de(e, t, n) {
520
440
  function Ie(e, t) {
521
441
  return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
522
442
  }
523
- function Ke(e, t) {
443
+ function ke(e, t) {
524
444
  if (e.length === 1) return 0;
525
445
  const n = e.map((o) => Math.abs(o - t)), r = Math.min(...n);
526
446
  return n.indexOf(r);
527
447
  }
528
- function Oe(e, t, n) {
529
- const r = e / 2, s = U([0, 50], [0, r]);
448
+ function Ke(e, t, n) {
449
+ const r = e / 2, s = Y([0, 50], [0, r]);
530
450
  return (r - s(t) * n) * n;
531
451
  }
532
- function Le(e) {
452
+ function Te(e) {
533
453
  return e.slice(0, -1).map((t, n) => e[n + 1] - t);
534
454
  }
535
- function $e(e, t) {
455
+ function He(e, t) {
536
456
  if (t > 0) {
537
- const n = Le(e);
457
+ const n = Te(e);
538
458
  return Math.min(...n) >= t;
539
459
  }
540
460
  return !0;
541
461
  }
542
- function U(e, t) {
462
+ function Y(e, t) {
543
463
  return (n) => {
544
464
  if (e[0] === e[1] || t[0] === t[1]) return t[0];
545
465
  const r = (t[1] - t[0]) / (e[1] - e[0]);
546
466
  return t[0] + r * (n - e[0]);
547
467
  };
548
468
  }
549
- function ze(e) {
469
+ function Oe(e) {
550
470
  return (String(e).split(".")[1] || "").length;
551
471
  }
552
- function Fe(e, t) {
472
+ function ze(e, t) {
553
473
  const n = Math.pow(10, t);
554
474
  return Math.round(e * n) / n;
555
475
  }
556
- var He = re, je = ce, We = le, Ue = ue;
557
- const Ye = "cfxui__Slider__sliderContainer__fac82", Xe = "cfxui__Slider__sliderLabels__f63f4", Ge = "cfxui__Slider__sliderRoot__032df", Ze = "cfxui__Slider__sliderTrack__b32a8", qe = "cfxui__Slider__sliderRange__a13a7", Je = "cfxui__Slider__sliderThumb__e8450", Qe = "cfxui__Slider__sliderValueBubble__086d6", P = {
558
- sliderContainer: Ye,
559
- sliderLabels: Xe,
560
- sliderRoot: Ge,
561
- sliderTrack: Ze,
562
- sliderRange: qe,
563
- sliderThumb: Je,
564
- sliderValueBubble: Qe
565
- }, ut = function({
476
+ var Le = ne, Fe = ae, je = le, We = ce;
477
+ const Ue = "cfxui__Slider__container__997ea", Ye = "cfxui__Slider__labels__2a966", $e = "cfxui__Slider__root__a6c1b", Xe = "cfxui__Slider__track__570cb", Ge = "cfxui__Slider__range__5ae17", Ze = "cfxui__Slider__thumb__27d80", qe = "cfxui__Slider__valueBubble__ebce8", x = {
478
+ container: Ue,
479
+ labels: Ye,
480
+ root: $e,
481
+ track: Xe,
482
+ range: Ge,
483
+ thumb: Ze,
484
+ valueBubble: qe
485
+ }, lt = function({
566
486
  value: t,
567
487
  defaultValue: n,
568
488
  title: r,
569
489
  ariaLabel: o,
570
490
  className: s,
571
- minLabel: i = 0,
572
- maxLabel: a = 5e3,
573
- onValueChange: u,
574
- ...m
491
+ trackClassName: i,
492
+ minLabel: a,
493
+ maxLabel: d,
494
+ min: m = 0,
495
+ max: v,
496
+ onValueChange: l,
497
+ ...f
575
498
  }) {
576
- const [b, l] = z.useState(() => {
499
+ const [g, _] = L.useState(() => {
577
500
  if (t)
578
501
  return t;
579
502
  if (n)
580
503
  return n;
581
- }), d = z.useCallback((p) => {
582
- u && u(p), l(p);
583
- }, [u]);
584
- return z.useEffect(() => {
585
- t && l(t);
586
- }, [t]), /* @__PURE__ */ B("div", { className: P.sliderContainer, children: [
587
- /* @__PURE__ */ B(
588
- He,
504
+ }), S = L.useCallback((p) => {
505
+ l && l(p), _(p);
506
+ }, [l]);
507
+ return L.useEffect(() => {
508
+ t && _(t);
509
+ }, [t]), /* @__PURE__ */ k("div", { className: x.container, children: [
510
+ /* @__PURE__ */ k(
511
+ Le,
589
512
  {
590
- ...m,
513
+ ...f,
514
+ min: m,
515
+ max: v,
591
516
  value: t,
592
- className: ve(P.sliderRoot, s),
593
- onValueChange: d,
517
+ className: G(x.root, s),
518
+ onValueChange: S,
594
519
  children: [
595
- /* @__PURE__ */ f(je, { className: P.sliderTrack, children: /* @__PURE__ */ f(We, { className: P.sliderRange }) }),
596
- /* @__PURE__ */ f(Ue, { className: P.sliderThumb, "aria-label": o, children: /* @__PURE__ */ f("div", { className: P.sliderValueBubble, children: `${b} ${r}` }) })
520
+ /* @__PURE__ */ u(Fe, { className: G(x.track, i), children: /* @__PURE__ */ u(je, { className: x.range }) }),
521
+ /* @__PURE__ */ u(We, { className: x.thumb, "aria-label": o, children: /* @__PURE__ */ u("div", { className: x.valueBubble, children: [g, r].join(" ") }) })
597
522
  ]
598
523
  }
599
524
  ),
600
- /* @__PURE__ */ B("div", { className: P.sliderLabels, children: [
601
- /* @__PURE__ */ f("span", { children: i }),
602
- /* @__PURE__ */ f("span", { children: a })
525
+ /* @__PURE__ */ k("div", { className: x.labels, children: [
526
+ /* @__PURE__ */ u("span", { children: typeof a < "u" ? a : m }),
527
+ /* @__PURE__ */ u("span", { children: typeof d < "u" ? d : v })
603
528
  ] })
604
529
  ] });
605
530
  };
606
531
  export {
607
- ut as Slider,
608
- ut as default
532
+ lt as Slider,
533
+ lt as default
609
534
  };