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