@cfx-dev/ui-components 4.5.16 → 4.5.18

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 (49) hide show
  1. package/dist/{Combination-2dfXEDc9.js → Combination-CcTTSYNP.js} +1 -1
  2. package/dist/{DropdownContent-CLtPVRZg.js → DropdownContent-MvHlrWi6.js} +4 -4
  3. package/dist/assets/all_css.css +2 -0
  4. package/dist/assets/css/DropdownSelect.css +1 -1
  5. package/dist/assets/css/Flyout.css +1 -1
  6. package/dist/assets/css/Popover.css +1 -1
  7. package/dist/assets/css/Range.css +1 -0
  8. package/dist/assets/css/RangeInput.css +1 -0
  9. package/dist/assets/css/RichInput.css +1 -1
  10. package/dist/assets/css/Select.css +1 -1
  11. package/dist/assets/css/StyledInput.css +1 -1
  12. package/dist/assets/general/global.css +1 -1
  13. package/dist/components/Checkbox/Checkbox.js +23 -23
  14. package/dist/components/DropdownContent/DropdownContent.js +1 -1
  15. package/dist/components/DropdownContent/index.js +1 -1
  16. package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
  17. package/dist/components/DropdownSelect/DropdownSelect.js +1 -1
  18. package/dist/components/Flyout/Flyout.d.ts +7 -3
  19. package/dist/components/Flyout/Flyout.js +61 -48
  20. package/dist/components/Flyout/FlyoutShowcase.d.ts +5 -0
  21. package/dist/components/Flyout/FlyoutShowcase.js +28 -0
  22. package/dist/components/Flyout/index.d.ts +1 -1
  23. package/dist/components/Flyout/index.js +5 -3
  24. package/dist/components/Range/Range.d.ts +4 -0
  25. package/dist/components/Range/Range.js +90 -0
  26. package/dist/components/Range/Range.types.d.ts +9 -0
  27. package/dist/components/Range/Range.types.js +1 -0
  28. package/dist/components/Range/RangeInput.d.ts +13 -0
  29. package/dist/components/Range/RangeInput.js +78 -0
  30. package/dist/components/Range/RangeShowcase.d.ts +2 -0
  31. package/dist/components/Range/RangeShowcase.js +41 -0
  32. package/dist/components/Range/RangeWithInputs.d.ts +8 -0
  33. package/dist/components/Range/RangeWithInputs.js +81 -0
  34. package/dist/components/Range/index.d.ts +6 -0
  35. package/dist/components/Range/index.js +8 -0
  36. package/dist/components/Select/Select.js +3 -3
  37. package/dist/components/Slider/Slider.js +64 -472
  38. package/dist/components/Slider/SliderShowcase.js +6 -4
  39. package/dist/components/Switch/Switch.js +1 -1
  40. package/dist/{index-DWzyrn_L.js → index-3ctv5u9o.js} +1 -1
  41. package/dist/{index-BMU9X4M-.js → index-9LBuZ7x4.js} +7 -7
  42. package/dist/{index-DCuJlMqr.js → index-CfQtbUfi.js} +6 -6
  43. package/dist/index-D5SMGei3.js +427 -0
  44. package/dist/main.d.ts +3 -1
  45. package/dist/main.js +186 -178
  46. package/dist/styles-scss/_ui.scss +20 -17
  47. package/dist/styles-scss/global.scss +2 -0
  48. package/dist/styles-scss/tokens.scss +26 -21
  49. package/package.json +1 -1
@@ -0,0 +1,81 @@
1
+ import { jsxs as x, jsx as s } from "react/jsx-runtime";
2
+ import i from "react";
3
+ import C from "../Flex/Flex.js";
4
+ import R from "./Range.js";
5
+ import M from "./RangeInput.js";
6
+ function _(V) {
7
+ const {
8
+ value: e,
9
+ defaultValue: l,
10
+ onValueChange: m,
11
+ min: c = 0,
12
+ max: o = 100,
13
+ minSign: h,
14
+ maxSign: S,
15
+ disabled: f = !1,
16
+ name: u,
17
+ ...b
18
+ } = V, [t, d] = i.useState(() => e ? e[0] : l ? l[0] : c), [n, p] = i.useState(() => e ? e[1] : l ? l[1] : o), r = i.useCallback((a) => {
19
+ d(a[0]), p(a[1]), m && m(a);
20
+ }, [m]), j = i.useCallback((a) => {
21
+ const g = Math.min(Number(a), n);
22
+ r([g, n]);
23
+ }, [r, n]), v = i.useCallback((a) => {
24
+ const g = Math.min(Number(a), o);
25
+ r([t, g]);
26
+ }, [r, t, o]);
27
+ return i.useEffect(() => {
28
+ e && (d(e[0]), p(e[1]));
29
+ }, [e]), /* @__PURE__ */ x(C, { gap: 2.5, direction: "column", children: [
30
+ u && /* @__PURE__ */ s(
31
+ "input",
32
+ {
33
+ type: "hidden",
34
+ name: u,
35
+ value: [t, n].join(",")
36
+ }
37
+ ),
38
+ /* @__PURE__ */ s(
39
+ R,
40
+ {
41
+ min: c,
42
+ max: o,
43
+ value: [t, n],
44
+ defaultValue: l,
45
+ onValueChange: r,
46
+ disabled: f,
47
+ name: u,
48
+ ...b
49
+ }
50
+ ),
51
+ /* @__PURE__ */ x(C, { gap: 2.5, justifyContent: "space-between", children: [
52
+ /* @__PURE__ */ s(
53
+ M,
54
+ {
55
+ sign: h,
56
+ value: t,
57
+ onChange: j,
58
+ min: c,
59
+ max: n,
60
+ disabled: f,
61
+ id: [u, "min"].filter(Boolean).join("-")
62
+ }
63
+ ),
64
+ /* @__PURE__ */ s(
65
+ M,
66
+ {
67
+ sign: h,
68
+ value: n,
69
+ onChange: v,
70
+ min: t,
71
+ max: o,
72
+ disabled: f,
73
+ id: [u, "max"].filter(Boolean).join("-")
74
+ }
75
+ )
76
+ ] })
77
+ ] });
78
+ }
79
+ export {
80
+ _ as default
81
+ };
@@ -0,0 +1,6 @@
1
+ export { default as Range } from './Range';
2
+ export { default as RangeInput } from './RangeInput';
3
+ export { default as RangeWithInputs } from './RangeWithInputs';
4
+ export type { RangeProps } from './Range.types';
5
+ export type { RangeInputProps } from './RangeInput';
6
+ export type { RangeWithInputsProps } from './RangeWithInputs';
@@ -0,0 +1,8 @@
1
+ import { default as t } from "./Range.js";
2
+ import { default as o } from "./RangeInput.js";
3
+ import { default as n } from "./RangeWithInputs.js";
4
+ export {
5
+ t as Range,
6
+ o as RangeInput,
7
+ n as RangeWithInputs
8
+ };
@@ -3,9 +3,9 @@ import * as l from "react";
3
3
  import q from "react";
4
4
  import { R as ft, r as De } from "../../index-Cl_RnsqN.js";
5
5
  import { c as Ee } from "../../index-rKs9bXHr.js";
6
- import { a as K, P as N, d as Oe, c as mt, u as B, e as P, b as ht } from "../../index-DCuJlMqr.js";
7
- import { u as gt, c as vt } from "../../index-BMU9X4M-.js";
8
- import { c as Le, d as _t, u as Ne, A as St, a as wt, h as xt, b as yt, R as Ct, F as It, D as Tt, C as bt, e as Pt } from "../../Combination-2dfXEDc9.js";
6
+ import { e as K, P as N, u as Oe, c as mt, b as B, a as P, f as ht } from "../../index-CfQtbUfi.js";
7
+ import { u as gt, c as vt } from "../../index-9LBuZ7x4.js";
8
+ import { c as Le, d as _t, u as Ne, A as St, a as wt, h as xt, b as yt, R as Ct, F as It, D as Tt, C as bt, e as Pt } from "../../Combination-CcTTSYNP.js";
9
9
  import { u as Nt } from "../../index-BZPx6jYI.js";
10
10
  import { Icon as Rt } from "../Icon/Icon.js";
11
11
  import { clsx as xe } from "../../utils/clsx.js";
@@ -1,488 +1,80 @@
1
- import { jsx as m, jsxs as K } from "react/jsx-runtime";
2
- import * as u from "react";
3
- import O from "react";
4
- import { c as W } from "../../index-rKs9bXHr.js";
5
- import { d as fe, c as me, e as M, P as k, u as V, f as he } from "../../index-DCuJlMqr.js";
6
- import { c as pe, u as Se } from "../../index-BMU9X4M-.js";
7
- import { u as be } from "../../index-BZPx6jYI.js";
8
- import { clsx as G } from "../../utils/clsx.js";
9
- var q = ["PageUp", "PageDown"], J = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Q = {
10
- "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
11
- "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
12
- "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
13
- "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
14
- }, B = "Slider", [U, ge, _e] = pe(B), [Z, Je] = me(B, [
15
- _e
16
- ]), [ve, T] = Z(B), ee = u.forwardRef(
17
- (e, t) => {
18
- const {
19
- name: n,
20
- min: o = 0,
21
- max: s = 100,
22
- step: c = 1,
23
- orientation: r = "horizontal",
24
- disabled: a = !1,
25
- minStepsBetweenThumbs: l = 0,
26
- defaultValue: h = [o],
27
- value: p,
28
- onValueChange: i = () => {
29
- },
30
- onValueCommit: d = () => {
31
- },
32
- inverted: g = !1,
33
- form: x,
34
- ...S
35
- } = e, b = u.useRef(/* @__PURE__ */ new Set()), f = u.useRef(0), v = r === "horizontal" ? we : xe, [_ = [], I] = fe({
36
- prop: p,
37
- defaultProp: h,
38
- onChange: (w) => {
39
- var D;
40
- (D = [...b.current][f.current]) == null || D.focus(), i(w);
41
- }
42
- }), L = u.useRef(_);
43
- function H(w) {
44
- const R = De(_, w);
45
- A(w, R);
46
- }
47
- function de(w) {
48
- A(w, f.current);
49
- }
50
- function ue() {
51
- const w = L.current[f.current];
52
- _[f.current] !== w && d(_);
53
- }
54
- function A(w, R, { commit: D } = { commit: !1 }) {
55
- const j = Be(c), z = Ie(Math.round((w - o) / c) * c + o, j), N = W(z, [o, s]);
56
- I((E = []) => {
57
- const P = ye(E, N, R);
58
- if (Ve(P, l * c)) {
59
- f.current = P.indexOf(N);
60
- const X = String(P) !== String(E);
61
- return X && D && d(P), X ? P : E;
62
- } else
63
- return E;
64
- });
65
- }
66
- return /* @__PURE__ */ m(
67
- ve,
68
- {
69
- scope: e.__scopeSlider,
70
- name: n,
71
- disabled: a,
72
- min: o,
73
- max: s,
74
- valueIndexToChangeRef: f,
75
- thumbs: b.current,
76
- values: _,
77
- orientation: r,
78
- form: x,
79
- children: /* @__PURE__ */ m(U.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ m(U.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ m(
80
- v,
81
- {
82
- "aria-disabled": a,
83
- "data-disabled": a ? "" : void 0,
84
- ...S,
85
- ref: t,
86
- onPointerDown: M(S.onPointerDown, () => {
87
- a || (L.current = _);
88
- }),
89
- min: o,
90
- max: s,
91
- inverted: g,
92
- onSlideStart: a ? void 0 : H,
93
- onSlideMove: a ? void 0 : de,
94
- onSlideEnd: a ? void 0 : ue,
95
- onHomeKeyDown: () => !a && A(o, 0, { commit: !0 }),
96
- onEndKeyDown: () => !a && A(s, _.length - 1, { commit: !0 }),
97
- onStepKeyDown: ({ event: w, direction: R }) => {
98
- if (!a) {
99
- const z = q.includes(w.key) || w.shiftKey && J.includes(w.key) ? 10 : 1, N = f.current, E = _[N], P = c * z * R;
100
- A(E + P, N, { commit: !0 });
101
- }
102
- }
103
- }
104
- ) }) })
105
- }
106
- );
107
- }
108
- );
109
- ee.displayName = B;
110
- var [te, ne] = Z(B, {
111
- startEdge: "left",
112
- endEdge: "right",
113
- size: "width",
114
- direction: 1
115
- }), we = u.forwardRef(
116
- (e, t) => {
117
- const {
118
- min: n,
119
- max: o,
120
- dir: s,
121
- inverted: c,
122
- onSlideStart: r,
123
- onSlideMove: a,
124
- onSlideEnd: l,
125
- onStepKeyDown: h,
126
- ...p
127
- } = e, [i, d] = u.useState(null), g = V(t, (v) => d(v)), x = u.useRef(void 0), S = Se(s), b = S === "ltr", f = b && !c || !b && c;
128
- function C(v) {
129
- const _ = x.current || i.getBoundingClientRect(), I = [0, _.width], H = $(I, f ? [n, o] : [o, n]);
130
- return x.current = _, H(v - _.left);
131
- }
132
- return /* @__PURE__ */ m(
133
- te,
134
- {
135
- scope: e.__scopeSlider,
136
- startEdge: f ? "left" : "right",
137
- endEdge: f ? "right" : "left",
138
- direction: f ? 1 : -1,
139
- size: "width",
140
- children: /* @__PURE__ */ m(
141
- oe,
142
- {
143
- dir: S,
144
- "data-orientation": "horizontal",
145
- ...p,
146
- ref: g,
147
- style: {
148
- ...p.style,
149
- "--radix-slider-thumb-transform": "translateX(-50%)"
150
- },
151
- onSlideStart: (v) => {
152
- const _ = C(v.clientX);
153
- r == null || r(_);
154
- },
155
- onSlideMove: (v) => {
156
- const _ = C(v.clientX);
157
- a == null || a(_);
158
- },
159
- onSlideEnd: () => {
160
- x.current = void 0, l == null || l();
161
- },
162
- onStepKeyDown: (v) => {
163
- const I = Q[f ? "from-left" : "from-right"].includes(v.key);
164
- h == null || h({ event: v, direction: I ? -1 : 1 });
165
- }
166
- }
167
- )
168
- }
169
- );
170
- }
171
- ), xe = u.forwardRef(
172
- (e, t) => {
173
- const {
174
- min: n,
175
- max: o,
176
- inverted: s,
177
- onSlideStart: c,
178
- onSlideMove: r,
179
- onSlideEnd: a,
180
- onStepKeyDown: l,
181
- ...h
182
- } = e, p = u.useRef(null), i = V(t, p), d = u.useRef(void 0), g = !s;
183
- function x(S) {
184
- const b = d.current || p.current.getBoundingClientRect(), f = [0, b.height], v = $(f, g ? [o, n] : [n, o]);
185
- return d.current = b, v(S - b.top);
186
- }
187
- return /* @__PURE__ */ m(
188
- te,
189
- {
190
- scope: e.__scopeSlider,
191
- startEdge: g ? "bottom" : "top",
192
- endEdge: g ? "top" : "bottom",
193
- size: "height",
194
- direction: g ? 1 : -1,
195
- children: /* @__PURE__ */ m(
196
- oe,
197
- {
198
- "data-orientation": "vertical",
199
- ...h,
200
- ref: i,
201
- style: {
202
- ...h.style,
203
- "--radix-slider-thumb-transform": "translateY(50%)"
204
- },
205
- onSlideStart: (S) => {
206
- const b = x(S.clientY);
207
- c == null || c(b);
208
- },
209
- onSlideMove: (S) => {
210
- const b = x(S.clientY);
211
- r == null || r(b);
212
- },
213
- onSlideEnd: () => {
214
- d.current = void 0, a == null || a();
215
- },
216
- onStepKeyDown: (S) => {
217
- const f = Q[g ? "from-bottom" : "from-top"].includes(S.key);
218
- l == null || l({ event: S, direction: f ? -1 : 1 });
219
- }
220
- }
221
- )
222
- }
223
- );
224
- }
225
- ), oe = u.forwardRef(
226
- (e, t) => {
227
- const {
228
- __scopeSlider: n,
229
- onSlideStart: o,
230
- onSlideMove: s,
231
- onSlideEnd: c,
232
- onHomeKeyDown: r,
233
- onEndKeyDown: a,
234
- onStepKeyDown: l,
235
- ...h
236
- } = e, p = T(B, n);
237
- return /* @__PURE__ */ m(
238
- k.span,
239
- {
240
- ...h,
241
- ref: t,
242
- onKeyDown: M(e.onKeyDown, (i) => {
243
- i.key === "Home" ? (r(i), i.preventDefault()) : i.key === "End" ? (a(i), i.preventDefault()) : q.concat(J).includes(i.key) && (l(i), i.preventDefault());
244
- }),
245
- onPointerDown: M(e.onPointerDown, (i) => {
246
- const d = i.target;
247
- d.setPointerCapture(i.pointerId), i.preventDefault(), p.thumbs.has(d) ? d.focus() : o(i);
248
- }),
249
- onPointerMove: M(e.onPointerMove, (i) => {
250
- i.target.hasPointerCapture(i.pointerId) && s(i);
251
- }),
252
- onPointerUp: M(e.onPointerUp, (i) => {
253
- const d = i.target;
254
- d.hasPointerCapture(i.pointerId) && (d.releasePointerCapture(i.pointerId), c(i));
255
- })
256
- }
257
- );
258
- }
259
- ), re = "SliderTrack", ie = u.forwardRef(
260
- (e, t) => {
261
- const { __scopeSlider: n, ...o } = e, s = T(re, n);
262
- return /* @__PURE__ */ m(
263
- k.span,
264
- {
265
- "data-disabled": s.disabled ? "" : void 0,
266
- "data-orientation": s.orientation,
267
- ...o,
268
- ref: t
269
- }
270
- );
271
- }
272
- );
273
- ie.displayName = re;
274
- var F = "SliderRange", ae = u.forwardRef(
275
- (e, t) => {
276
- const { __scopeSlider: n, ...o } = e, s = T(F, n), c = ne(F, n), r = u.useRef(null), a = V(t, r), l = s.values.length, h = s.values.map(
277
- (d) => le(d, s.min, s.max)
278
- ), p = l > 1 ? Math.min(...h) : 0, i = 100 - Math.max(...h);
279
- return /* @__PURE__ */ m(
280
- k.span,
281
- {
282
- "data-orientation": s.orientation,
283
- "data-disabled": s.disabled ? "" : void 0,
284
- ...o,
285
- ref: a,
286
- style: {
287
- ...e.style,
288
- [c.startEdge]: p + "%",
289
- [c.endEdge]: i + "%"
290
- }
291
- }
292
- );
293
- }
294
- );
295
- ae.displayName = F;
296
- var Y = "SliderThumb", se = u.forwardRef(
297
- (e, t) => {
298
- const n = ge(e.__scopeSlider), [o, s] = u.useState(null), c = V(t, (a) => s(a)), r = u.useMemo(
299
- () => o ? n().findIndex((a) => a.ref.current === o) : -1,
300
- [n, o]
301
- );
302
- return /* @__PURE__ */ m(Re, { ...e, ref: c, index: r });
303
- }
304
- ), Re = u.forwardRef(
305
- (e, t) => {
306
- const { __scopeSlider: n, index: o, name: s, ...c } = e, r = T(Y, n), a = ne(Y, n), [l, h] = u.useState(null), p = V(t, (C) => h(C)), i = l ? r.form || !!l.closest("form") : !0, d = he(l), g = r.values[o], x = g === void 0 ? 0 : le(g, r.min, r.max), S = Ce(o, r.values.length), b = d == null ? void 0 : d[a.size], f = b ? Ee(b, x, a.direction) : 0;
307
- return u.useEffect(() => {
308
- if (l)
309
- return r.thumbs.add(l), () => {
310
- r.thumbs.delete(l);
311
- };
312
- }, [l, r.thumbs]), /* @__PURE__ */ K(
313
- "span",
314
- {
315
- style: {
316
- transform: "var(--radix-slider-thumb-transform)",
317
- position: "absolute",
318
- [a.startEdge]: `calc(${x}% + ${f}px)`
319
- },
320
- children: [
321
- /* @__PURE__ */ m(U.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ m(
322
- k.span,
323
- {
324
- role: "slider",
325
- "aria-label": e["aria-label"] || S,
326
- "aria-valuemin": r.min,
327
- "aria-valuenow": g,
328
- "aria-valuemax": r.max,
329
- "aria-orientation": r.orientation,
330
- "data-orientation": r.orientation,
331
- "data-disabled": r.disabled ? "" : void 0,
332
- tabIndex: r.disabled ? void 0 : 0,
333
- ...c,
334
- ref: p,
335
- style: g === void 0 ? { display: "none" } : e.style,
336
- onFocus: M(e.onFocus, () => {
337
- r.valueIndexToChangeRef.current = o;
338
- })
339
- }
340
- ) }),
341
- i && /* @__PURE__ */ m(
342
- ce,
343
- {
344
- name: s ?? (r.name ? r.name + (r.values.length > 1 ? "[]" : "") : void 0),
345
- form: r.form,
346
- value: g
347
- },
348
- o
349
- )
350
- ]
351
- }
352
- );
353
- }
354
- );
355
- se.displayName = Y;
356
- var Pe = "RadioBubbleInput", ce = u.forwardRef(
357
- ({ __scopeSlider: e, value: t, ...n }, o) => {
358
- const s = u.useRef(null), c = V(s, o), r = be(t);
359
- return u.useEffect(() => {
360
- const a = s.current;
361
- if (!a) return;
362
- const l = window.HTMLInputElement.prototype, p = Object.getOwnPropertyDescriptor(l, "value").set;
363
- if (r !== t && p) {
364
- const i = new Event("input", { bubbles: !0 });
365
- p.call(a, t), a.dispatchEvent(i);
366
- }
367
- }, [r, t]), /* @__PURE__ */ m(
368
- k.input,
369
- {
370
- style: { display: "none" },
371
- ...n,
372
- ref: c,
373
- defaultValue: t
374
- }
375
- );
376
- }
377
- );
378
- ce.displayName = Pe;
379
- function ye(e = [], t, n) {
380
- const o = [...e];
381
- return o[n] = t, o.sort((s, c) => s - c);
382
- }
383
- function le(e, t, n) {
384
- const c = 100 / (n - t) * (e - t);
385
- return W(c, [0, 100]);
386
- }
387
- function Ce(e, t) {
388
- return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
389
- }
390
- function De(e, t) {
391
- if (e.length === 1) return 0;
392
- const n = e.map((s) => Math.abs(s - t)), o = Math.min(...n);
393
- return n.indexOf(o);
394
- }
395
- function Ee(e, t, n) {
396
- const o = e / 2, c = $([0, 50], [0, o]);
397
- return (o - c(t) * n) * n;
398
- }
399
- function Me(e) {
400
- return e.slice(0, -1).map((t, n) => e[n + 1] - t);
401
- }
402
- function Ve(e, t) {
403
- if (t > 0) {
404
- const n = Me(e);
405
- return Math.min(...n) >= t;
406
- }
407
- return !0;
408
- }
409
- function $(e, t) {
410
- return (n) => {
411
- if (e[0] === e[1] || t[0] === t[1]) return t[0];
412
- const o = (t[1] - t[0]) / (e[1] - e[0]);
413
- return t[0] + o * (n - e[0]);
414
- };
415
- }
416
- function Be(e) {
417
- return (String(e).split(".")[1] || "").length;
418
- }
419
- function Ie(e, t) {
420
- const n = Math.pow(10, t);
421
- return Math.round(e * n) / n;
422
- }
423
- var Ae = ee, Ne = ie, ke = ae, Ke = se;
424
- const Te = "cfxui__Slider__container__997ea", Le = "cfxui__Slider__labels__2a966", He = "cfxui__Slider__root__a6c1b", ze = "cfxui__Slider__track__570cb", Oe = "cfxui__Slider__range__5ae17", Ue = "cfxui__Slider__thumb__27d80", Fe = "cfxui__Slider__valueBubble__ebce8", y = {
425
- container: Te,
426
- labels: Le,
427
- root: He,
428
- track: ze,
429
- range: Oe,
430
- thumb: Ue,
431
- valueBubble: Fe
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
+ import { R as C, T as L, a as R, b as y } from "../../index-D5SMGei3.js";
3
+ import i from "react";
4
+ import { clsx as f } from "../../utils/clsx.js";
5
+ const B = "cfxui__Slider__container__997ea", V = "cfxui__Slider__labels__2a966", j = "cfxui__Slider__root__a6c1b", T = "cfxui__Slider__track__570cb", E = "cfxui__Slider__range__5ae17", P = "cfxui__Slider__thumb__27d80", q = "cfxui__Slider__valueBubble__ebce8", a = {
6
+ container: B,
7
+ labels: V,
8
+ root: j,
9
+ track: T,
10
+ range: E,
11
+ thumb: P,
12
+ valueBubble: q
432
13
  };
433
- function Qe(e) {
14
+ function G(h) {
434
15
  const {
435
- value: t,
436
- defaultValue: n,
437
- title: o,
438
- ariaLabel: s,
439
- className: c,
440
- trackClassName: r,
441
- minLabel: a,
442
- maxLabel: l,
443
- min: h = 0,
444
- max: p,
445
- onValueChange: i,
446
- ref: d,
16
+ value: l,
17
+ defaultValue: r,
18
+ title: x,
19
+ ariaLabel: p,
20
+ className: v,
21
+ trackClassName: N,
22
+ minLabel: o,
23
+ maxLabel: _,
24
+ min: u = 0,
25
+ max: d,
26
+ onValueChange: t,
27
+ ref: S,
28
+ name: n,
447
29
  ...g
448
- } = e, [x, S] = O.useState(() => {
449
- if (t)
450
- return t;
451
- if (n)
452
- return n;
453
- }), b = O.useCallback((f) => {
454
- if (i) {
455
- i(f);
30
+ } = h, [c, b] = i.useState(() => {
31
+ if (l)
32
+ return l;
33
+ if (r)
34
+ return r;
35
+ }), k = i.useCallback((m) => {
36
+ if (t) {
37
+ t(m);
456
38
  return;
457
39
  }
458
- S(f);
459
- }, [i]);
460
- return O.useEffect(() => {
461
- t && S(t);
462
- }, [t]), /* @__PURE__ */ K("div", { className: y.container, children: [
463
- /* @__PURE__ */ K(
464
- Ae,
40
+ b(m);
41
+ }, [t]);
42
+ return i.useEffect(() => {
43
+ l && b(l);
44
+ }, [l]), /* @__PURE__ */ s("div", { className: a.container, children: [
45
+ n && /* @__PURE__ */ e(
46
+ "input",
47
+ {
48
+ type: "hidden",
49
+ name: n,
50
+ value: c ? c[0] : ""
51
+ }
52
+ ),
53
+ /* @__PURE__ */ s(
54
+ C,
465
55
  {
466
56
  ...g,
467
- ref: d,
468
- min: h,
469
- max: p,
470
- value: t,
471
- className: G(y.root, c),
472
- onValueChange: b,
57
+ defaultValue: r,
58
+ ref: S,
59
+ min: u,
60
+ max: d,
61
+ value: l,
62
+ className: f(a.root, v),
63
+ onValueChange: k,
64
+ name: n,
473
65
  children: [
474
- /* @__PURE__ */ m(Ne, { className: G(y.track, r), children: /* @__PURE__ */ m(ke, { className: y.range }) }),
475
- /* @__PURE__ */ m(Ke, { className: y.thumb, "aria-label": s, children: /* @__PURE__ */ m("div", { className: y.valueBubble, children: [x, o].join(" ") }) })
66
+ /* @__PURE__ */ e(L, { className: f(a.track, N), children: /* @__PURE__ */ e(R, { className: a.range }) }),
67
+ /* @__PURE__ */ e(y, { className: a.thumb, "aria-label": p, children: /* @__PURE__ */ e("div", { className: a.valueBubble, children: [c, x].join(" ") }) })
476
68
  ]
477
69
  }
478
70
  ),
479
- /* @__PURE__ */ K("div", { className: y.labels, children: [
480
- /* @__PURE__ */ m("span", { children: typeof a < "u" ? a : h }),
481
- /* @__PURE__ */ m("span", { children: typeof l < "u" ? l : p })
71
+ /* @__PURE__ */ s("div", { className: a.labels, children: [
72
+ /* @__PURE__ */ e("span", { children: typeof o < "u" ? o : u }),
73
+ /* @__PURE__ */ e("span", { children: typeof _ < "u" ? _ : d })
482
74
  ] })
483
75
  ] });
484
76
  }
485
77
  export {
486
- Qe as Slider,
487
- Qe as default
78
+ G as Slider,
79
+ G as default
488
80
  };
@@ -4,8 +4,8 @@ import a from "../Flex/Flex.js";
4
4
  import { Text as t } from "../Text/Text.js";
5
5
  import "../../utils/ui/ui.js";
6
6
  import { Slider as l } from "./Slider.js";
7
- const c = "cfxui__SliderShowcase__track__9ceda", o = {
8
- track: c
7
+ const m = "cfxui__SliderShowcase__track__9ceda", o = {
8
+ track: m
9
9
  };
10
10
  function s() {
11
11
  return /* @__PURE__ */ r(a, { gap: "large", vertical: !0, children: [
@@ -26,7 +26,8 @@ function s() {
26
26
  step: 1,
27
27
  ariaLabel: "Volume",
28
28
  className: "",
29
- trackClassName: o.track
29
+ trackClassName: o.track,
30
+ name: "volume"
30
31
  }
31
32
  )
32
33
  }
@@ -49,7 +50,8 @@ function s() {
49
50
  step: 5,
50
51
  ariaLabel: "Custom Slider",
51
52
  className: "custom-slider-class",
52
- title: "Upvotes"
53
+ title: "Upvotes",
54
+ name: "custom-slider"
53
55
  }
54
56
  )
55
57
  }