@cfx-dev/ui-components 4.2.11 → 4.2.13

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