@cfx-dev/ui-components 4.2.5 → 4.2.6

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