@cfx-dev/ui-components 4.2.8 → 4.2.9
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/components/DropdownSelect/DropdownSelect.js +1040 -802
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Slider/Slider.js +374 -294
- package/dist/index-CjTSD6zB.js +161 -0
- package/dist/{index-Bz27DCHt.js → index-DBus3GoO.js} +2 -2
- package/dist/main.d.ts +2 -1
- package/package.json +1 -1
- package/dist/index-AweK2ufS.js +0 -171
|
@@ -1,55 +1,135 @@
|
|
|
1
|
-
import { jsx as
|
|
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
|
|
5
|
-
import {
|
|
6
|
-
import { u as
|
|
7
|
-
import { u as ve } from "../../index-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
20
|
-
var
|
|
21
|
-
const { children:
|
|
22
|
-
if (c.isValidElement(
|
|
23
|
-
const o =
|
|
24
|
-
return c.cloneElement(
|
|
25
|
-
...
|
|
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 ?
|
|
107
|
+
ref: t ? J(t, o) : o
|
|
28
108
|
});
|
|
29
109
|
}
|
|
30
|
-
return c.Children.count(
|
|
110
|
+
return c.Children.count(n) > 1 ? c.Children.only(null) : null;
|
|
31
111
|
});
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
function
|
|
35
|
-
return c.isValidElement(e) && e.type ===
|
|
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
|
|
38
|
-
const
|
|
39
|
-
for (const
|
|
40
|
-
const o = e[
|
|
41
|
-
/^on[A-Z]/.test(
|
|
42
|
-
|
|
43
|
-
} : o && (r
|
|
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, ...
|
|
125
|
+
return { ...e, ...n };
|
|
46
126
|
}
|
|
47
|
-
function
|
|
48
|
-
var
|
|
49
|
-
let t = (
|
|
50
|
-
return
|
|
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
|
|
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 =
|
|
70
|
-
const
|
|
71
|
-
const { asChild:
|
|
72
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */
|
|
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
|
|
75
|
-
}, {}),
|
|
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
|
-
},
|
|
81
|
-
|
|
82
|
-
]), [
|
|
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:
|
|
86
|
-
min:
|
|
165
|
+
name: n,
|
|
166
|
+
min: r = 0,
|
|
87
167
|
max: o = 100,
|
|
88
|
-
step:
|
|
168
|
+
step: s = 1,
|
|
89
169
|
orientation: i = "horizontal",
|
|
90
|
-
disabled:
|
|
170
|
+
disabled: a = !1,
|
|
91
171
|
minStepsBetweenThumbs: u = 0,
|
|
92
|
-
defaultValue:
|
|
93
|
-
value:
|
|
172
|
+
defaultValue: m = [r],
|
|
173
|
+
value: b,
|
|
94
174
|
onValueChange: l = () => {
|
|
95
175
|
},
|
|
96
|
-
onValueCommit:
|
|
176
|
+
onValueCommit: d = () => {
|
|
97
177
|
},
|
|
98
|
-
inverted:
|
|
99
|
-
form:
|
|
100
|
-
...
|
|
101
|
-
} = e,
|
|
102
|
-
prop:
|
|
103
|
-
defaultProp:
|
|
104
|
-
onChange: (
|
|
105
|
-
var
|
|
106
|
-
(
|
|
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
|
-
}),
|
|
109
|
-
function
|
|
110
|
-
const
|
|
111
|
-
A(
|
|
188
|
+
}), L = c.useRef(_);
|
|
189
|
+
function z(x) {
|
|
190
|
+
const P = Te(_, x);
|
|
191
|
+
A(x, P);
|
|
112
192
|
}
|
|
113
|
-
function
|
|
114
|
-
A(
|
|
193
|
+
function me(x) {
|
|
194
|
+
A(x, p.current);
|
|
115
195
|
}
|
|
116
|
-
function
|
|
117
|
-
const
|
|
118
|
-
|
|
196
|
+
function pe() {
|
|
197
|
+
const x = L.current[p.current];
|
|
198
|
+
_[p.current] !== x && d(_);
|
|
119
199
|
}
|
|
120
|
-
function A(
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
const X = String(
|
|
127
|
-
return X &&
|
|
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
|
|
209
|
+
return E;
|
|
130
210
|
});
|
|
131
211
|
}
|
|
132
|
-
return /* @__PURE__ */
|
|
133
|
-
|
|
212
|
+
return /* @__PURE__ */ f(
|
|
213
|
+
Me,
|
|
134
214
|
{
|
|
135
215
|
scope: e.__scopeSlider,
|
|
136
|
-
name:
|
|
137
|
-
disabled:
|
|
138
|
-
min:
|
|
216
|
+
name: n,
|
|
217
|
+
disabled: a,
|
|
218
|
+
min: r,
|
|
139
219
|
max: o,
|
|
140
|
-
valueIndexToChangeRef:
|
|
141
|
-
thumbs:
|
|
142
|
-
values:
|
|
220
|
+
valueIndexToChangeRef: p,
|
|
221
|
+
thumbs: g.current,
|
|
222
|
+
values: _,
|
|
143
223
|
orientation: i,
|
|
144
|
-
form:
|
|
145
|
-
children: /* @__PURE__ */
|
|
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":
|
|
149
|
-
"data-disabled":
|
|
150
|
-
...
|
|
228
|
+
"aria-disabled": a,
|
|
229
|
+
"data-disabled": a ? "" : void 0,
|
|
230
|
+
...S,
|
|
151
231
|
ref: t,
|
|
152
|
-
onPointerDown: V(
|
|
153
|
-
|
|
232
|
+
onPointerDown: V(S.onPointerDown, () => {
|
|
233
|
+
a || (L.current = _);
|
|
154
234
|
}),
|
|
155
|
-
min:
|
|
235
|
+
min: r,
|
|
156
236
|
max: o,
|
|
157
|
-
inverted:
|
|
158
|
-
onSlideStart:
|
|
159
|
-
onSlideMove:
|
|
160
|
-
onSlideEnd:
|
|
161
|
-
onHomeKeyDown: () => !
|
|
162
|
-
onEndKeyDown: () => !
|
|
163
|
-
onStepKeyDown: ({ event:
|
|
164
|
-
if (!
|
|
165
|
-
const
|
|
166
|
-
A(
|
|
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
|
-
|
|
176
|
-
var [
|
|
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
|
-
}),
|
|
261
|
+
}), Ne = c.forwardRef(
|
|
182
262
|
(e, t) => {
|
|
183
263
|
const {
|
|
184
|
-
min:
|
|
185
|
-
max:
|
|
264
|
+
min: n,
|
|
265
|
+
max: r,
|
|
186
266
|
dir: o,
|
|
187
|
-
inverted:
|
|
267
|
+
inverted: s,
|
|
188
268
|
onSlideStart: i,
|
|
189
|
-
onSlideMove:
|
|
269
|
+
onSlideMove: a,
|
|
190
270
|
onSlideEnd: u,
|
|
191
|
-
onStepKeyDown:
|
|
192
|
-
...
|
|
193
|
-
} = e, [l,
|
|
194
|
-
function
|
|
195
|
-
const
|
|
196
|
-
return
|
|
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__ */
|
|
199
|
-
|
|
278
|
+
return /* @__PURE__ */ f(
|
|
279
|
+
ie,
|
|
200
280
|
{
|
|
201
281
|
scope: e.__scopeSlider,
|
|
202
|
-
startEdge:
|
|
203
|
-
endEdge:
|
|
204
|
-
direction:
|
|
282
|
+
startEdge: p ? "left" : "right",
|
|
283
|
+
endEdge: p ? "right" : "left",
|
|
284
|
+
direction: p ? 1 : -1,
|
|
205
285
|
size: "width",
|
|
206
|
-
children: /* @__PURE__ */
|
|
207
|
-
|
|
286
|
+
children: /* @__PURE__ */ f(
|
|
287
|
+
ae,
|
|
208
288
|
{
|
|
209
|
-
dir:
|
|
289
|
+
dir: S,
|
|
210
290
|
"data-orientation": "horizontal",
|
|
211
|
-
...
|
|
212
|
-
ref:
|
|
291
|
+
...b,
|
|
292
|
+
ref: h,
|
|
213
293
|
style: {
|
|
214
|
-
...
|
|
294
|
+
...b.style,
|
|
215
295
|
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
216
296
|
},
|
|
217
|
-
onSlideStart: (
|
|
218
|
-
const
|
|
219
|
-
i == null || i(
|
|
297
|
+
onSlideStart: (w) => {
|
|
298
|
+
const _ = y(w.clientX);
|
|
299
|
+
i == null || i(_);
|
|
220
300
|
},
|
|
221
|
-
onSlideMove: (
|
|
222
|
-
const
|
|
223
|
-
|
|
301
|
+
onSlideMove: (w) => {
|
|
302
|
+
const _ = y(w.clientX);
|
|
303
|
+
a == null || a(_);
|
|
224
304
|
},
|
|
225
305
|
onSlideEnd: () => {
|
|
226
|
-
|
|
306
|
+
v.current = void 0, u == null || u();
|
|
227
307
|
},
|
|
228
|
-
onStepKeyDown: (
|
|
229
|
-
const
|
|
230
|
-
|
|
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
|
-
),
|
|
317
|
+
), Ae = c.forwardRef(
|
|
238
318
|
(e, t) => {
|
|
239
319
|
const {
|
|
240
|
-
min:
|
|
241
|
-
max:
|
|
320
|
+
min: n,
|
|
321
|
+
max: r,
|
|
242
322
|
inverted: o,
|
|
243
|
-
onSlideStart:
|
|
323
|
+
onSlideStart: s,
|
|
244
324
|
onSlideMove: i,
|
|
245
|
-
onSlideEnd:
|
|
325
|
+
onSlideEnd: a,
|
|
246
326
|
onStepKeyDown: u,
|
|
247
|
-
...
|
|
248
|
-
} = e,
|
|
249
|
-
function
|
|
250
|
-
const
|
|
251
|
-
return
|
|
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__ */
|
|
254
|
-
|
|
333
|
+
return /* @__PURE__ */ f(
|
|
334
|
+
ie,
|
|
255
335
|
{
|
|
256
336
|
scope: e.__scopeSlider,
|
|
257
|
-
startEdge:
|
|
258
|
-
endEdge:
|
|
337
|
+
startEdge: h ? "bottom" : "top",
|
|
338
|
+
endEdge: h ? "top" : "bottom",
|
|
259
339
|
size: "height",
|
|
260
|
-
direction:
|
|
261
|
-
children: /* @__PURE__ */
|
|
262
|
-
|
|
340
|
+
direction: h ? 1 : -1,
|
|
341
|
+
children: /* @__PURE__ */ f(
|
|
342
|
+
ae,
|
|
263
343
|
{
|
|
264
344
|
"data-orientation": "vertical",
|
|
265
|
-
...
|
|
345
|
+
...m,
|
|
266
346
|
ref: l,
|
|
267
347
|
style: {
|
|
268
|
-
...
|
|
348
|
+
...m.style,
|
|
269
349
|
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
270
350
|
},
|
|
271
|
-
onSlideStart: (
|
|
272
|
-
const
|
|
273
|
-
|
|
351
|
+
onSlideStart: (S) => {
|
|
352
|
+
const g = v(S.clientY);
|
|
353
|
+
s == null || s(g);
|
|
274
354
|
},
|
|
275
|
-
onSlideMove: (
|
|
276
|
-
const
|
|
277
|
-
i == null || i(
|
|
355
|
+
onSlideMove: (S) => {
|
|
356
|
+
const g = v(S.clientY);
|
|
357
|
+
i == null || i(g);
|
|
278
358
|
},
|
|
279
359
|
onSlideEnd: () => {
|
|
280
|
-
|
|
360
|
+
d.current = void 0, a == null || a();
|
|
281
361
|
},
|
|
282
|
-
onStepKeyDown: (
|
|
283
|
-
const
|
|
284
|
-
u == null || u({ event:
|
|
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
|
-
),
|
|
371
|
+
), ae = c.forwardRef(
|
|
292
372
|
(e, t) => {
|
|
293
373
|
const {
|
|
294
|
-
__scopeSlider:
|
|
295
|
-
onSlideStart:
|
|
374
|
+
__scopeSlider: n,
|
|
375
|
+
onSlideStart: r,
|
|
296
376
|
onSlideMove: o,
|
|
297
|
-
onSlideEnd:
|
|
377
|
+
onSlideEnd: s,
|
|
298
378
|
onHomeKeyDown: i,
|
|
299
|
-
onEndKeyDown:
|
|
379
|
+
onEndKeyDown: a,
|
|
300
380
|
onStepKeyDown: u,
|
|
301
|
-
...
|
|
302
|
-
} = e,
|
|
303
|
-
return /* @__PURE__ */
|
|
381
|
+
...m
|
|
382
|
+
} = e, b = O(M, n);
|
|
383
|
+
return /* @__PURE__ */ f(
|
|
304
384
|
T.span,
|
|
305
385
|
{
|
|
306
|
-
...
|
|
386
|
+
...m,
|
|
307
387
|
ref: t,
|
|
308
388
|
onKeyDown: V(e.onKeyDown, (l) => {
|
|
309
|
-
l.key === "Home" ? (i(l), l.preventDefault()) : l.key === "End" ? (
|
|
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
|
|
313
|
-
|
|
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
|
|
320
|
-
|
|
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
|
-
),
|
|
405
|
+
), ce = "SliderTrack", le = c.forwardRef(
|
|
326
406
|
(e, t) => {
|
|
327
|
-
const { __scopeSlider:
|
|
328
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
413
|
+
...r,
|
|
334
414
|
ref: t
|
|
335
415
|
}
|
|
336
416
|
);
|
|
337
417
|
}
|
|
338
418
|
);
|
|
339
|
-
|
|
340
|
-
var
|
|
419
|
+
le.displayName = ce;
|
|
420
|
+
var H = "SliderRange", ue = c.forwardRef(
|
|
341
421
|
(e, t) => {
|
|
342
|
-
const { __scopeSlider:
|
|
343
|
-
(
|
|
344
|
-
),
|
|
345
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
351
|
-
ref:
|
|
430
|
+
...r,
|
|
431
|
+
ref: a,
|
|
352
432
|
style: {
|
|
353
433
|
...e.style,
|
|
354
|
-
[
|
|
355
|
-
[
|
|
434
|
+
[s.startEdge]: b + "%",
|
|
435
|
+
[s.endEdge]: l + "%"
|
|
356
436
|
}
|
|
357
437
|
}
|
|
358
438
|
);
|
|
359
439
|
}
|
|
360
440
|
);
|
|
361
|
-
|
|
362
|
-
var
|
|
441
|
+
ue.displayName = H;
|
|
442
|
+
var W = "SliderThumb", de = c.forwardRef(
|
|
363
443
|
(e, t) => {
|
|
364
|
-
const
|
|
365
|
-
() =>
|
|
366
|
-
[
|
|
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__ */
|
|
448
|
+
return /* @__PURE__ */ f(ke, { ...e, ref: s, index: i });
|
|
369
449
|
}
|
|
370
|
-
),
|
|
450
|
+
), ke = c.forwardRef(
|
|
371
451
|
(e, t) => {
|
|
372
|
-
const { __scopeSlider:
|
|
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
|
-
[
|
|
464
|
+
[a.startEdge]: `calc(${v}% + ${p}px)`
|
|
385
465
|
},
|
|
386
466
|
children: [
|
|
387
|
-
/* @__PURE__ */
|
|
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"] ||
|
|
471
|
+
"aria-label": e["aria-label"] || S,
|
|
392
472
|
"aria-valuemin": i.min,
|
|
393
|
-
"aria-valuenow":
|
|
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
|
-
...
|
|
400
|
-
ref:
|
|
401
|
-
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 =
|
|
483
|
+
i.valueIndexToChangeRef.current = r;
|
|
404
484
|
})
|
|
405
485
|
}
|
|
406
486
|
) }),
|
|
407
|
-
l && /* @__PURE__ */
|
|
408
|
-
|
|
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:
|
|
492
|
+
value: h
|
|
413
493
|
},
|
|
414
|
-
|
|
494
|
+
r
|
|
415
495
|
)
|
|
416
496
|
]
|
|
417
497
|
}
|
|
418
498
|
);
|
|
419
499
|
}
|
|
420
500
|
);
|
|
421
|
-
|
|
422
|
-
var
|
|
423
|
-
const { value: 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
|
|
505
|
+
const s = r.current, i = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(i, "value").set;
|
|
426
506
|
if (o !== t && u) {
|
|
427
|
-
const
|
|
428
|
-
u.call(
|
|
507
|
+
const m = new Event("input", { bubbles: !0 });
|
|
508
|
+
u.call(s, t), s.dispatchEvent(m);
|
|
429
509
|
}
|
|
430
|
-
}, [o, t]), /* @__PURE__ */
|
|
510
|
+
}, [o, t]), /* @__PURE__ */ f("input", { style: { display: "none" }, ...n, ref: r, defaultValue: t });
|
|
431
511
|
};
|
|
432
|
-
function
|
|
433
|
-
const
|
|
434
|
-
return n
|
|
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
|
|
437
|
-
const
|
|
438
|
-
return
|
|
516
|
+
function fe(e, t, n) {
|
|
517
|
+
const s = 100 / (n - t) * (e - t);
|
|
518
|
+
return q(s, [0, 100]);
|
|
439
519
|
}
|
|
440
|
-
function
|
|
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
|
|
523
|
+
function Te(e, t) {
|
|
444
524
|
if (e.length === 1) return 0;
|
|
445
|
-
const
|
|
446
|
-
return
|
|
525
|
+
const n = e.map((o) => Math.abs(o - t)), r = Math.min(...n);
|
|
526
|
+
return n.indexOf(r);
|
|
447
527
|
}
|
|
448
|
-
function
|
|
449
|
-
const
|
|
450
|
-
return (
|
|
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
|
|
453
|
-
return e.slice(0, -1).map((t,
|
|
532
|
+
function Le(e) {
|
|
533
|
+
return e.slice(0, -1).map((t, n) => e[n + 1] - t);
|
|
454
534
|
}
|
|
455
|
-
function
|
|
535
|
+
function ze(e, t) {
|
|
456
536
|
if (t > 0) {
|
|
457
|
-
const
|
|
458
|
-
return Math.min(...
|
|
537
|
+
const n = Le(e);
|
|
538
|
+
return Math.min(...n) >= t;
|
|
459
539
|
}
|
|
460
540
|
return !0;
|
|
461
541
|
}
|
|
462
|
-
function
|
|
463
|
-
return (
|
|
542
|
+
function U(e, t) {
|
|
543
|
+
return (n) => {
|
|
464
544
|
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
465
|
-
const
|
|
466
|
-
return t[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
|
|
549
|
+
function $e(e) {
|
|
470
550
|
return (String(e).split(".")[1] || "").length;
|
|
471
551
|
}
|
|
472
|
-
function
|
|
473
|
-
const
|
|
474
|
-
return Math.round(e *
|
|
552
|
+
function je(e, t) {
|
|
553
|
+
const n = Math.pow(10, t);
|
|
554
|
+
return Math.round(e * n) / n;
|
|
475
555
|
}
|
|
476
|
-
var
|
|
477
|
-
const
|
|
478
|
-
container:
|
|
479
|
-
labels:
|
|
480
|
-
root:
|
|
481
|
-
track:
|
|
482
|
-
range:
|
|
483
|
-
thumb:
|
|
484
|
-
valueBubble:
|
|
485
|
-
},
|
|
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:
|
|
567
|
+
value: r,
|
|
488
568
|
defaultValue: o,
|
|
489
|
-
title:
|
|
569
|
+
title: s,
|
|
490
570
|
ariaLabel: i,
|
|
491
|
-
className:
|
|
571
|
+
className: a,
|
|
492
572
|
trackClassName: u,
|
|
493
|
-
minLabel:
|
|
494
|
-
maxLabel:
|
|
573
|
+
minLabel: m,
|
|
574
|
+
maxLabel: b,
|
|
495
575
|
min: l = 0,
|
|
496
|
-
max:
|
|
497
|
-
onValueChange:
|
|
498
|
-
...
|
|
499
|
-
} = t, [
|
|
500
|
-
if (
|
|
501
|
-
return
|
|
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
|
-
}),
|
|
505
|
-
if (
|
|
506
|
-
|
|
584
|
+
}), p = I.useCallback((y) => {
|
|
585
|
+
if (h) {
|
|
586
|
+
h(y);
|
|
507
587
|
return;
|
|
508
588
|
}
|
|
509
|
-
|
|
510
|
-
}, [
|
|
589
|
+
g(y);
|
|
590
|
+
}, [h]);
|
|
511
591
|
return I.useEffect(() => {
|
|
512
|
-
|
|
513
|
-
}, [
|
|
592
|
+
r && g(r);
|
|
593
|
+
}, [r]), /* @__PURE__ */ K("div", { className: R.container, children: [
|
|
514
594
|
/* @__PURE__ */ K(
|
|
515
|
-
|
|
595
|
+
Fe,
|
|
516
596
|
{
|
|
517
|
-
...
|
|
518
|
-
ref:
|
|
597
|
+
...v,
|
|
598
|
+
ref: n,
|
|
519
599
|
min: l,
|
|
520
|
-
max:
|
|
521
|
-
value:
|
|
522
|
-
className: G(
|
|
523
|
-
onValueChange:
|
|
600
|
+
max: d,
|
|
601
|
+
value: r,
|
|
602
|
+
className: G(R.root, a),
|
|
603
|
+
onValueChange: p,
|
|
524
604
|
children: [
|
|
525
|
-
/* @__PURE__ */
|
|
526
|
-
/* @__PURE__ */
|
|
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:
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
538
|
-
|
|
617
|
+
ut as Slider,
|
|
618
|
+
ut as default
|
|
539
619
|
};
|