@cfx-dev/ui-components 4.2.3 → 4.2.5
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.
- package/dist/assets/all_css.css +1 -0
- package/dist/assets/css/Slider.css +1 -1
- package/dist/assets/css/SliderShowcase.css +1 -0
- package/dist/components/DropdownSelect/DropdownSelect.js +795 -1033
- package/dist/components/Layout/Flex/Flex.d.ts +2 -1
- package/dist/components/Layout/Flex/Flex.js +36 -32
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Slider/Slider.d.ts +3 -2
- package/dist/components/Slider/Slider.js +202 -277
- package/dist/components/Slider/SliderShowcase.js +18 -19
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/index-AweK2ufS.js +171 -0
- package/dist/{index-DBus3GoO.js → index-Bz27DCHt.js} +2 -2
- package/dist/main.d.ts +2 -1
- package/package.json +1 -1
- package/dist/index-CjTSD6zB.js +0 -161
|
@@ -1,120 +1,40 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as u, Fragment as me, jsxs as k } from "react/jsx-runtime";
|
|
2
2
|
import * as c from "react";
|
|
3
|
-
import
|
|
3
|
+
import L from "react";
|
|
4
4
|
import { c as Z } from "../../index-rKs9bXHr.js";
|
|
5
|
-
import {
|
|
6
|
-
import { u as ge } from "../../index-
|
|
7
|
-
import { u as
|
|
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 {
|
|
10
|
-
|
|
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((
|
|
95
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
17
|
+
return /* @__PURE__ */ u(F, { ...r, ref: t, children: n });
|
|
98
18
|
});
|
|
99
|
-
|
|
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 =
|
|
23
|
+
const o = Pe(n);
|
|
104
24
|
return c.cloneElement(n, {
|
|
105
|
-
...
|
|
25
|
+
...Re(r, n.props),
|
|
106
26
|
// @ts-ignore
|
|
107
|
-
ref: t ?
|
|
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
|
|
33
|
+
var we = ({ children: e }) => /* @__PURE__ */ u(me, { children: e });
|
|
114
34
|
function ye(e) {
|
|
115
|
-
return c.isValidElement(e) && e.type ===
|
|
35
|
+
return c.isValidElement(e) && e.type === we;
|
|
116
36
|
}
|
|
117
|
-
function
|
|
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
|
|
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
|
|
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
|
-
],
|
|
69
|
+
], K = xe.reduce((e, t) => {
|
|
150
70
|
const n = c.forwardRef((r, o) => {
|
|
151
|
-
const { asChild: s, ...i } = r, a = s ?
|
|
152
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */
|
|
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
|
-
}, {}),
|
|
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", [
|
|
161
|
-
|
|
162
|
-
]), [
|
|
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:
|
|
91
|
+
minStepsBetweenThumbs: d = 0,
|
|
172
92
|
defaultValue: m = [r],
|
|
173
|
-
value:
|
|
93
|
+
value: v,
|
|
174
94
|
onValueChange: l = () => {
|
|
175
95
|
},
|
|
176
|
-
onValueCommit:
|
|
96
|
+
onValueCommit: f = () => {
|
|
177
97
|
},
|
|
178
|
-
inverted:
|
|
98
|
+
inverted: g = !1,
|
|
179
99
|
form: _,
|
|
180
100
|
...S
|
|
181
|
-
} = e,
|
|
182
|
-
prop:
|
|
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: (
|
|
185
|
-
var
|
|
186
|
-
(
|
|
104
|
+
onChange: (y) => {
|
|
105
|
+
var E;
|
|
106
|
+
(E = [...p.current][h.current]) == null || E.focus(), l(y);
|
|
187
107
|
}
|
|
188
|
-
}),
|
|
189
|
-
function
|
|
190
|
-
const R =
|
|
191
|
-
N(
|
|
108
|
+
}), H = c.useRef(b);
|
|
109
|
+
function O(y) {
|
|
110
|
+
const R = ke(b, y);
|
|
111
|
+
N(y, R);
|
|
192
112
|
}
|
|
193
|
-
function
|
|
194
|
-
N(
|
|
113
|
+
function ue(y) {
|
|
114
|
+
N(y, h.current);
|
|
195
115
|
}
|
|
196
|
-
function
|
|
197
|
-
const
|
|
198
|
-
|
|
116
|
+
function fe() {
|
|
117
|
+
const y = H.current[h.current];
|
|
118
|
+
b[h.current] !== y && f(b);
|
|
199
119
|
}
|
|
200
|
-
function N(
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
205
|
-
h.current =
|
|
206
|
-
const X = String(
|
|
207
|
-
return X &&
|
|
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
|
|
129
|
+
return D;
|
|
210
130
|
});
|
|
211
131
|
}
|
|
212
|
-
return /* @__PURE__ */
|
|
213
|
-
|
|
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:
|
|
222
|
-
values:
|
|
141
|
+
thumbs: p.current,
|
|
142
|
+
values: b,
|
|
223
143
|
orientation: i,
|
|
224
144
|
form: _,
|
|
225
|
-
children: /* @__PURE__ */
|
|
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 || (
|
|
153
|
+
a || (H.current = b);
|
|
234
154
|
}),
|
|
235
155
|
min: r,
|
|
236
156
|
max: o,
|
|
237
|
-
inverted:
|
|
238
|
-
onSlideStart: a ? void 0 :
|
|
239
|
-
onSlideMove: a ? void 0 :
|
|
240
|
-
onSlideEnd: a ? void 0 :
|
|
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,
|
|
243
|
-
onStepKeyDown: ({ event:
|
|
162
|
+
onEndKeyDown: () => !a && N(o, b.length - 1, { commit: !0 }),
|
|
163
|
+
onStepKeyDown: ({ event: y, direction: R }) => {
|
|
244
164
|
if (!a) {
|
|
245
|
-
const
|
|
246
|
-
N(
|
|
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
|
-
|
|
256
|
-
var [
|
|
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
|
-
}),
|
|
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:
|
|
190
|
+
onSlideEnd: d,
|
|
271
191
|
onStepKeyDown: m,
|
|
272
|
-
...
|
|
273
|
-
} = e, [l,
|
|
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
|
|
276
|
-
return _.current =
|
|
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__ */
|
|
279
|
-
|
|
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__ */
|
|
287
|
-
|
|
206
|
+
children: /* @__PURE__ */ u(
|
|
207
|
+
ie,
|
|
288
208
|
{
|
|
289
209
|
dir: S,
|
|
290
210
|
"data-orientation": "horizontal",
|
|
291
|
-
...
|
|
292
|
-
ref:
|
|
211
|
+
...v,
|
|
212
|
+
ref: g,
|
|
293
213
|
style: {
|
|
294
|
-
...
|
|
214
|
+
...v.style,
|
|
295
215
|
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
296
216
|
},
|
|
297
217
|
onSlideStart: (w) => {
|
|
298
|
-
const
|
|
299
|
-
i == null || i(
|
|
218
|
+
const b = C(w.clientX);
|
|
219
|
+
i == null || i(b);
|
|
300
220
|
},
|
|
301
221
|
onSlideMove: (w) => {
|
|
302
|
-
const
|
|
303
|
-
a == null || a(
|
|
222
|
+
const b = C(w.clientX);
|
|
223
|
+
a == null || a(b);
|
|
304
224
|
},
|
|
305
225
|
onSlideEnd: () => {
|
|
306
|
-
_.current = void 0,
|
|
226
|
+
_.current = void 0, d == null || d();
|
|
307
227
|
},
|
|
308
228
|
onStepKeyDown: (w) => {
|
|
309
|
-
const
|
|
310
|
-
m == null || m({ event: w, direction:
|
|
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
|
-
),
|
|
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:
|
|
246
|
+
onStepKeyDown: d,
|
|
327
247
|
...m
|
|
328
|
-
} = e,
|
|
248
|
+
} = e, v = c.useRef(null), l = I(t, v), f = c.useRef(void 0), g = !o;
|
|
329
249
|
function _(S) {
|
|
330
|
-
const
|
|
331
|
-
return
|
|
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__ */
|
|
334
|
-
|
|
253
|
+
return /* @__PURE__ */ u(
|
|
254
|
+
re,
|
|
335
255
|
{
|
|
336
256
|
scope: e.__scopeSlider,
|
|
337
|
-
startEdge:
|
|
338
|
-
endEdge:
|
|
257
|
+
startEdge: g ? "bottom" : "top",
|
|
258
|
+
endEdge: g ? "top" : "bottom",
|
|
339
259
|
size: "height",
|
|
340
|
-
direction:
|
|
341
|
-
children: /* @__PURE__ */
|
|
342
|
-
|
|
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
|
|
353
|
-
s == null || s(
|
|
272
|
+
const p = _(S.clientY);
|
|
273
|
+
s == null || s(p);
|
|
354
274
|
},
|
|
355
275
|
onSlideMove: (S) => {
|
|
356
|
-
const
|
|
357
|
-
i == null || i(
|
|
276
|
+
const p = _(S.clientY);
|
|
277
|
+
i == null || i(p);
|
|
358
278
|
},
|
|
359
279
|
onSlideEnd: () => {
|
|
360
|
-
|
|
280
|
+
f.current = void 0, a == null || a();
|
|
361
281
|
},
|
|
362
282
|
onStepKeyDown: (S) => {
|
|
363
|
-
const h =
|
|
364
|
-
|
|
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
|
-
),
|
|
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:
|
|
300
|
+
onStepKeyDown: d,
|
|
381
301
|
...m
|
|
382
|
-
} = e,
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
|
|
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()) :
|
|
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
|
|
393
|
-
|
|
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
|
|
400
|
-
|
|
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
|
-
),
|
|
325
|
+
), se = "SliderTrack", ae = c.forwardRef(
|
|
406
326
|
(e, t) => {
|
|
407
|
-
const { __scopeSlider: n, ...r } = e, o =
|
|
408
|
-
return /* @__PURE__ */
|
|
409
|
-
|
|
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
|
-
|
|
420
|
-
var
|
|
339
|
+
ae.displayName = se;
|
|
340
|
+
var W = "SliderRange", le = c.forwardRef(
|
|
421
341
|
(e, t) => {
|
|
422
|
-
const { __scopeSlider: n, ...r } = e, o =
|
|
423
|
-
(
|
|
424
|
-
),
|
|
425
|
-
return /* @__PURE__ */
|
|
426
|
-
|
|
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]:
|
|
354
|
+
[s.startEdge]: v + "%",
|
|
435
355
|
[s.endEdge]: l + "%"
|
|
436
356
|
}
|
|
437
357
|
}
|
|
438
358
|
);
|
|
439
359
|
}
|
|
440
360
|
);
|
|
441
|
-
le.displayName =
|
|
442
|
-
var
|
|
361
|
+
le.displayName = W;
|
|
362
|
+
var U = "SliderThumb", ce = c.forwardRef(
|
|
443
363
|
(e, t) => {
|
|
444
|
-
const n =
|
|
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__ */
|
|
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 =
|
|
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 (
|
|
455
|
-
return i.thumbs.add(
|
|
456
|
-
i.thumbs.delete(
|
|
374
|
+
if (d)
|
|
375
|
+
return i.thumbs.add(d), () => {
|
|
376
|
+
i.thumbs.delete(d);
|
|
457
377
|
};
|
|
458
|
-
}, [
|
|
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__ */
|
|
468
|
-
|
|
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":
|
|
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:
|
|
481
|
-
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__ */
|
|
488
|
-
|
|
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:
|
|
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
|
-
|
|
502
|
-
var
|
|
503
|
-
const { value: t, ...n } = e, r = c.useRef(null), o =
|
|
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,
|
|
506
|
-
if (o !== t &&
|
|
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
|
-
|
|
428
|
+
d.call(s, t), s.dispatchEvent(m);
|
|
509
429
|
}
|
|
510
|
-
}, [o, t]), /* @__PURE__ */
|
|
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
|
|
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
|
|
529
|
-
const r = e / 2, s =
|
|
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
|
|
452
|
+
function Te(e) {
|
|
533
453
|
return e.slice(0, -1).map((t, n) => e[n + 1] - t);
|
|
534
454
|
}
|
|
535
|
-
function
|
|
455
|
+
function He(e, t) {
|
|
536
456
|
if (t > 0) {
|
|
537
|
-
const n =
|
|
457
|
+
const n = Te(e);
|
|
538
458
|
return Math.min(...n) >= t;
|
|
539
459
|
}
|
|
540
460
|
return !0;
|
|
541
461
|
}
|
|
542
|
-
function
|
|
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
|
|
469
|
+
function Oe(e) {
|
|
550
470
|
return (String(e).split(".")[1] || "").length;
|
|
551
471
|
}
|
|
552
|
-
function
|
|
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
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
},
|
|
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
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
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 [
|
|
499
|
+
const [g, _] = L.useState(() => {
|
|
577
500
|
if (t)
|
|
578
501
|
return t;
|
|
579
502
|
if (n)
|
|
580
503
|
return n;
|
|
581
|
-
}),
|
|
582
|
-
|
|
583
|
-
}, [
|
|
584
|
-
return
|
|
585
|
-
t &&
|
|
586
|
-
}, [t]), /* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
|
|
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
|
-
...
|
|
513
|
+
...f,
|
|
514
|
+
min: m,
|
|
515
|
+
max: v,
|
|
591
516
|
value: t,
|
|
592
|
-
className:
|
|
593
|
-
onValueChange:
|
|
517
|
+
className: G(x.root, s),
|
|
518
|
+
onValueChange: S,
|
|
594
519
|
children: [
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
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__ */
|
|
601
|
-
/* @__PURE__ */
|
|
602
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
608
|
-
|
|
532
|
+
lt as Slider,
|
|
533
|
+
lt as default
|
|
609
534
|
};
|