@purpurds/slider 6.0.1 → 6.1.0
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/LICENSE.txt +14 -50
- package/dist/slider.cjs.js +2 -2
- package/dist/slider.cjs.js.map +1 -1
- package/dist/slider.es.js +604 -695
- package/dist/slider.es.js.map +1 -1
- package/package.json +3 -3
package/dist/slider.es.js
CHANGED
|
@@ -1,252 +1,197 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { jsx as b, Fragment as be, jsxs as Z } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import E, { forwardRef as ye, useId as ve } from "react";
|
|
3
4
|
import "react-dom";
|
|
4
|
-
function
|
|
5
|
-
return y = Object.assign ? Object.assign.bind() : function(e) {
|
|
6
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
7
|
-
var n = arguments[t];
|
|
8
|
-
for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
9
|
-
}
|
|
10
|
-
return e;
|
|
11
|
-
}, y.apply(null, arguments);
|
|
12
|
-
}
|
|
13
|
-
function le(e, [t, n]) {
|
|
5
|
+
function J(e, [t, n]) {
|
|
14
6
|
return Math.min(n, Math.max(t, e));
|
|
15
7
|
}
|
|
16
|
-
function
|
|
17
|
-
return function(
|
|
18
|
-
if (e == null || e(
|
|
8
|
+
function I(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
9
|
+
return function(s) {
|
|
10
|
+
if (e == null || e(s), n === !1 || !s.defaultPrevented)
|
|
11
|
+
return t == null ? void 0 : t(s);
|
|
19
12
|
};
|
|
20
13
|
}
|
|
21
|
-
function
|
|
22
|
-
typeof e == "function"
|
|
14
|
+
function q(e, t) {
|
|
15
|
+
if (typeof e == "function")
|
|
16
|
+
return e(t);
|
|
17
|
+
e != null && (e.current = t);
|
|
23
18
|
}
|
|
24
|
-
function
|
|
25
|
-
return (t) =>
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
function Q(...e) {
|
|
20
|
+
return (t) => {
|
|
21
|
+
let n = !1;
|
|
22
|
+
const o = e.map((s) => {
|
|
23
|
+
const r = q(s, t);
|
|
24
|
+
return !n && typeof r == "function" && (n = !0), r;
|
|
25
|
+
});
|
|
26
|
+
if (n)
|
|
27
|
+
return () => {
|
|
28
|
+
for (let s = 0; s < o.length; s++) {
|
|
29
|
+
const r = o[s];
|
|
30
|
+
typeof r == "function" ? r() : q(e[s], null);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
28
34
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
35
|
+
function D(...e) {
|
|
36
|
+
return a.useCallback(Q(...e), e);
|
|
31
37
|
}
|
|
32
|
-
function
|
|
38
|
+
function ee(e, t = []) {
|
|
33
39
|
let n = [];
|
|
34
|
-
function r
|
|
35
|
-
const c =
|
|
36
|
-
n = [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
function m(s, d) {
|
|
50
|
-
const S = (d == null ? void 0 : d[e][l]) || c, f = ae(S);
|
|
51
|
-
if (f) return f;
|
|
52
|
-
if (a !== void 0) return a;
|
|
53
|
-
throw new Error(`\`${s}\` must be used within \`${o}\``);
|
|
40
|
+
function o(r, i) {
|
|
41
|
+
const c = a.createContext(i), u = n.length;
|
|
42
|
+
n = [...n, i];
|
|
43
|
+
const d = (l) => {
|
|
44
|
+
var p;
|
|
45
|
+
const { scope: f, children: g, ...m } = l, h = ((p = f == null ? void 0 : f[e]) == null ? void 0 : p[u]) || c, S = a.useMemo(() => m, Object.values(m));
|
|
46
|
+
return /* @__PURE__ */ b(h.Provider, { value: S, children: g });
|
|
47
|
+
};
|
|
48
|
+
d.displayName = r + "Provider";
|
|
49
|
+
function v(l, f) {
|
|
50
|
+
var h;
|
|
51
|
+
const g = ((h = f == null ? void 0 : f[e]) == null ? void 0 : h[u]) || c, m = a.useContext(g);
|
|
52
|
+
if (m) return m;
|
|
53
|
+
if (i !== void 0) return i;
|
|
54
|
+
throw new Error(`\`${l}\` must be used within \`${r}\``);
|
|
54
55
|
}
|
|
55
|
-
return
|
|
56
|
-
u,
|
|
57
|
-
m
|
|
58
|
-
];
|
|
56
|
+
return [d, v];
|
|
59
57
|
}
|
|
60
|
-
const
|
|
61
|
-
const
|
|
58
|
+
const s = () => {
|
|
59
|
+
const r = n.map((i) => a.createContext(i));
|
|
62
60
|
return function(c) {
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
() => ({
|
|
66
|
-
|
|
67
|
-
...c,
|
|
68
|
-
[e]: l
|
|
69
|
-
}
|
|
70
|
-
}),
|
|
71
|
-
[
|
|
72
|
-
c,
|
|
73
|
-
l
|
|
74
|
-
]
|
|
61
|
+
const u = (c == null ? void 0 : c[e]) || r;
|
|
62
|
+
return a.useMemo(
|
|
63
|
+
() => ({ [`__scope${e}`]: { ...c, [e]: u } }),
|
|
64
|
+
[c, u]
|
|
75
65
|
);
|
|
76
66
|
};
|
|
77
67
|
};
|
|
78
|
-
return
|
|
79
|
-
r,
|
|
80
|
-
Ae(i, ...t)
|
|
81
|
-
];
|
|
68
|
+
return s.scopeName = e, [o, we(s, ...t)];
|
|
82
69
|
}
|
|
83
|
-
function
|
|
70
|
+
function we(...e) {
|
|
84
71
|
const t = e[0];
|
|
85
72
|
if (e.length === 1) return t;
|
|
86
73
|
const n = () => {
|
|
87
|
-
const
|
|
88
|
-
(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const s = l(o)[`__scope${u}`];
|
|
96
|
-
return {
|
|
97
|
-
...c,
|
|
98
|
-
...s
|
|
99
|
-
};
|
|
74
|
+
const o = e.map((s) => ({
|
|
75
|
+
useScope: s(),
|
|
76
|
+
scopeName: s.scopeName
|
|
77
|
+
}));
|
|
78
|
+
return function(r) {
|
|
79
|
+
const i = o.reduce((c, { useScope: u, scopeName: d }) => {
|
|
80
|
+
const l = u(r)[`__scope${d}`];
|
|
81
|
+
return { ...c, ...l };
|
|
100
82
|
}, {});
|
|
101
|
-
return
|
|
102
|
-
() => ({
|
|
103
|
-
[`__scope${t.scopeName}`]: a
|
|
104
|
-
}),
|
|
105
|
-
[
|
|
106
|
-
a
|
|
107
|
-
]
|
|
108
|
-
);
|
|
83
|
+
return a.useMemo(() => ({ [`__scope${t.scopeName}`]: i }), [i]);
|
|
109
84
|
};
|
|
110
85
|
};
|
|
111
86
|
return n.scopeName = t.scopeName, n;
|
|
112
87
|
}
|
|
113
|
-
function
|
|
114
|
-
const t =
|
|
115
|
-
return
|
|
88
|
+
function te(e) {
|
|
89
|
+
const t = a.useRef(e);
|
|
90
|
+
return a.useEffect(() => {
|
|
116
91
|
t.current = e;
|
|
117
|
-
}),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
92
|
+
}), a.useMemo(() => (...n) => {
|
|
93
|
+
var o;
|
|
94
|
+
return (o = t.current) == null ? void 0 : o.call(t, ...n);
|
|
95
|
+
}, []);
|
|
96
|
+
}
|
|
97
|
+
function Ce({
|
|
98
|
+
prop: e,
|
|
99
|
+
defaultProp: t,
|
|
100
|
+
onChange: n = () => {
|
|
101
|
+
}
|
|
102
|
+
}) {
|
|
103
|
+
const [o, s] = _e({ defaultProp: t, onChange: n }), r = e !== void 0, i = r ? e : o, c = te(n), u = a.useCallback(
|
|
104
|
+
(d) => {
|
|
105
|
+
if (r) {
|
|
106
|
+
const l = typeof d == "function" ? d(e) : d;
|
|
107
|
+
l !== e && c(l);
|
|
108
|
+
} else
|
|
109
|
+
s(d);
|
|
121
110
|
},
|
|
122
|
-
[]
|
|
111
|
+
[r, e, s, c]
|
|
123
112
|
);
|
|
113
|
+
return [i, u];
|
|
124
114
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
s !== e && c(s);
|
|
134
|
-
} else i(u);
|
|
135
|
-
}, [
|
|
136
|
-
o,
|
|
137
|
-
e,
|
|
138
|
-
i,
|
|
139
|
-
c
|
|
140
|
-
]);
|
|
141
|
-
return [
|
|
142
|
-
a,
|
|
143
|
-
l
|
|
144
|
-
];
|
|
115
|
+
function _e({
|
|
116
|
+
defaultProp: e,
|
|
117
|
+
onChange: t
|
|
118
|
+
}) {
|
|
119
|
+
const n = a.useState(e), [o] = n, s = a.useRef(o), r = te(t);
|
|
120
|
+
return a.useEffect(() => {
|
|
121
|
+
s.current !== o && (r(o), s.current = o);
|
|
122
|
+
}, [o, s, r]), n;
|
|
145
123
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
i.current !== r && (o(r), i.current = r);
|
|
150
|
-
}, [
|
|
151
|
-
r,
|
|
152
|
-
i,
|
|
153
|
-
o
|
|
154
|
-
]), n;
|
|
155
|
-
}
|
|
156
|
-
const Oe = /* @__PURE__ */ q(void 0);
|
|
157
|
-
function Te(e) {
|
|
158
|
-
const t = ae(Oe);
|
|
124
|
+
var Re = a.createContext(void 0);
|
|
125
|
+
function xe(e) {
|
|
126
|
+
const t = a.useContext(Re);
|
|
159
127
|
return e || t || "ltr";
|
|
160
128
|
}
|
|
161
|
-
function
|
|
162
|
-
const t =
|
|
163
|
-
|
|
164
|
-
previous: e
|
|
165
|
-
});
|
|
166
|
-
return O(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [
|
|
167
|
-
e
|
|
168
|
-
]);
|
|
129
|
+
function Pe(e) {
|
|
130
|
+
const t = a.useRef({ value: e, previous: e });
|
|
131
|
+
return a.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
169
132
|
}
|
|
170
|
-
|
|
133
|
+
var Ee = globalThis != null && globalThis.document ? a.useLayoutEffect : () => {
|
|
171
134
|
};
|
|
172
|
-
function
|
|
173
|
-
const [t, n] =
|
|
174
|
-
return
|
|
135
|
+
function De(e) {
|
|
136
|
+
const [t, n] = a.useState(void 0);
|
|
137
|
+
return Ee(() => {
|
|
175
138
|
if (e) {
|
|
176
|
-
n({
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const l = o.borderBoxSize, u = Array.isArray(l) ? l[0] : l;
|
|
186
|
-
a = u.inlineSize, c = u.blockSize;
|
|
139
|
+
n({ width: e.offsetWidth, height: e.offsetHeight });
|
|
140
|
+
const o = new ResizeObserver((s) => {
|
|
141
|
+
if (!Array.isArray(s) || !s.length)
|
|
142
|
+
return;
|
|
143
|
+
const r = s[0];
|
|
144
|
+
let i, c;
|
|
145
|
+
if ("borderBoxSize" in r) {
|
|
146
|
+
const u = r.borderBoxSize, d = Array.isArray(u) ? u[0] : u;
|
|
147
|
+
i = d.inlineSize, c = d.blockSize;
|
|
187
148
|
} else
|
|
188
|
-
|
|
189
|
-
n({
|
|
190
|
-
width: a,
|
|
191
|
-
height: c
|
|
192
|
-
});
|
|
149
|
+
i = e.offsetWidth, c = e.offsetHeight;
|
|
150
|
+
n({ width: i, height: c });
|
|
193
151
|
});
|
|
194
|
-
return
|
|
195
|
-
box: "border-box"
|
|
196
|
-
}), () => r.unobserve(e);
|
|
152
|
+
return o.observe(e, { box: "border-box" }), () => o.unobserve(e);
|
|
197
153
|
} else
|
|
198
154
|
n(void 0);
|
|
199
|
-
}, [
|
|
200
|
-
e
|
|
201
|
-
]), t;
|
|
155
|
+
}, [e]), t;
|
|
202
156
|
}
|
|
203
|
-
|
|
204
|
-
const { children: n, ...
|
|
205
|
-
if (
|
|
206
|
-
const
|
|
207
|
-
return /* @__PURE__ */ b(
|
|
208
|
-
ref: t
|
|
209
|
-
}), /* @__PURE__ */ F(a) ? /* @__PURE__ */ se(a, void 0, c) : null);
|
|
157
|
+
var z = a.forwardRef((e, t) => {
|
|
158
|
+
const { children: n, ...o } = e, s = a.Children.toArray(n), r = s.find(Ae);
|
|
159
|
+
if (r) {
|
|
160
|
+
const i = r.props.children, c = s.map((u) => u === r ? a.Children.count(i) > 1 ? a.Children.only(null) : a.isValidElement(i) ? i.props.children : null : u);
|
|
161
|
+
return /* @__PURE__ */ b(F, { ...o, ref: t, children: a.isValidElement(i) ? a.cloneElement(i, void 0, c) : null });
|
|
210
162
|
}
|
|
211
|
-
return /* @__PURE__ */ b(
|
|
212
|
-
ref: t
|
|
213
|
-
}), n);
|
|
163
|
+
return /* @__PURE__ */ b(F, { ...o, ref: t, children: n });
|
|
214
164
|
});
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const { children: n, ...
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
ref
|
|
221
|
-
}
|
|
165
|
+
z.displayName = "Slot";
|
|
166
|
+
var F = a.forwardRef((e, t) => {
|
|
167
|
+
const { children: n, ...o } = e;
|
|
168
|
+
if (a.isValidElement(n)) {
|
|
169
|
+
const s = Ne(n), r = Ie(o, n.props);
|
|
170
|
+
return n.type !== a.Fragment && (r.ref = t ? Q(t, s) : s), a.cloneElement(n, r);
|
|
171
|
+
}
|
|
172
|
+
return a.Children.count(n) > 1 ? a.Children.only(null) : null;
|
|
222
173
|
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
function
|
|
226
|
-
return
|
|
174
|
+
F.displayName = "SlotClone";
|
|
175
|
+
var Me = ({ children: e }) => /* @__PURE__ */ b(be, { children: e });
|
|
176
|
+
function Ae(e) {
|
|
177
|
+
return a.isValidElement(e) && e.type === Me;
|
|
227
178
|
}
|
|
228
|
-
function
|
|
229
|
-
const n = {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
o(...c), i(...c);
|
|
236
|
-
} : i && (n[r] = i) : r === "style" ? n[r] = {
|
|
237
|
-
...i,
|
|
238
|
-
...o
|
|
239
|
-
} : r === "className" && (n[r] = [
|
|
240
|
-
i,
|
|
241
|
-
o
|
|
242
|
-
].filter(Boolean).join(" "));
|
|
179
|
+
function Ie(e, t) {
|
|
180
|
+
const n = { ...t };
|
|
181
|
+
for (const o in t) {
|
|
182
|
+
const s = e[o], r = t[o];
|
|
183
|
+
/^on[A-Z]/.test(o) ? s && r ? n[o] = (...c) => {
|
|
184
|
+
r(...c), s(...c);
|
|
185
|
+
} : s && (n[o] = s) : o === "style" ? n[o] = { ...s, ...r } : o === "className" && (n[o] = [s, r].filter(Boolean).join(" "));
|
|
243
186
|
}
|
|
244
|
-
return {
|
|
245
|
-
...e,
|
|
246
|
-
...n
|
|
247
|
-
};
|
|
187
|
+
return { ...e, ...n };
|
|
248
188
|
}
|
|
249
|
-
|
|
189
|
+
function Ne(e) {
|
|
190
|
+
var o, s;
|
|
191
|
+
let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
192
|
+
return n ? e.ref : (t = (s = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : s.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
193
|
+
}
|
|
194
|
+
var Oe = [
|
|
250
195
|
"a",
|
|
251
196
|
"button",
|
|
252
197
|
"div",
|
|
@@ -263,495 +208,459 @@ const He = [
|
|
|
263
208
|
"span",
|
|
264
209
|
"svg",
|
|
265
210
|
"ul"
|
|
266
|
-
],
|
|
267
|
-
const n =
|
|
268
|
-
const { asChild:
|
|
269
|
-
return
|
|
270
|
-
window[Symbol.for("radix-ui")] = !0;
|
|
271
|
-
}, []), /* @__PURE__ */ b(c, y({}, a, {
|
|
272
|
-
ref: i
|
|
273
|
-
}));
|
|
211
|
+
], B = Oe.reduce((e, t) => {
|
|
212
|
+
const n = a.forwardRef((o, s) => {
|
|
213
|
+
const { asChild: r, ...i } = o, c = r ? z : t;
|
|
214
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ b(c, { ...i, ref: s });
|
|
274
215
|
});
|
|
275
|
-
return n.displayName = `Primitive.${t}`, {
|
|
276
|
-
...e,
|
|
277
|
-
[t]: n
|
|
278
|
-
};
|
|
216
|
+
return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
|
|
279
217
|
}, {});
|
|
280
|
-
function
|
|
281
|
-
const t = e + "CollectionProvider", [n,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const p = f.collectionRef.current;
|
|
312
|
-
if (!p) return [];
|
|
313
|
-
const v = Array.from(p.querySelectorAll(`[${m}]`));
|
|
314
|
-
return Array.from(f.itemMap.values()).sort(
|
|
315
|
-
(g, R) => v.indexOf(g.ref.current) - v.indexOf(R.ref.current)
|
|
218
|
+
function Te(e) {
|
|
219
|
+
const t = e + "CollectionProvider", [n, o] = ee(t), [s, r] = n(
|
|
220
|
+
t,
|
|
221
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
222
|
+
), i = (g) => {
|
|
223
|
+
const { scope: m, children: h } = g, S = E.useRef(null), p = E.useRef(/* @__PURE__ */ new Map()).current;
|
|
224
|
+
return /* @__PURE__ */ b(s, { scope: m, itemMap: p, collectionRef: S, children: h });
|
|
225
|
+
};
|
|
226
|
+
i.displayName = t;
|
|
227
|
+
const c = e + "CollectionSlot", u = E.forwardRef(
|
|
228
|
+
(g, m) => {
|
|
229
|
+
const { scope: h, children: S } = g, p = r(c, h), C = D(m, p.collectionRef);
|
|
230
|
+
return /* @__PURE__ */ b(z, { ref: C, children: S });
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
u.displayName = c;
|
|
234
|
+
const d = e + "CollectionItemSlot", v = "data-radix-collection-item", l = E.forwardRef(
|
|
235
|
+
(g, m) => {
|
|
236
|
+
const { scope: h, children: S, ...p } = g, C = E.useRef(null), w = D(m, C), y = r(d, h);
|
|
237
|
+
return E.useEffect(() => (y.itemMap.set(C, { ref: C, ...p }), () => void y.itemMap.delete(C))), /* @__PURE__ */ b(z, { [v]: "", ref: w, children: S });
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
l.displayName = d;
|
|
241
|
+
function f(g) {
|
|
242
|
+
const m = r(e + "CollectionConsumer", g);
|
|
243
|
+
return E.useCallback(() => {
|
|
244
|
+
const S = m.collectionRef.current;
|
|
245
|
+
if (!S) return [];
|
|
246
|
+
const p = Array.from(S.querySelectorAll(`[${v}]`));
|
|
247
|
+
return Array.from(m.itemMap.values()).sort(
|
|
248
|
+
(y, R) => p.indexOf(y.ref.current) - p.indexOf(R.ref.current)
|
|
316
249
|
);
|
|
317
|
-
}, [
|
|
318
|
-
f.collectionRef,
|
|
319
|
-
f.itemMap
|
|
320
|
-
]);
|
|
250
|
+
}, [m.collectionRef, m.itemMap]);
|
|
321
251
|
}
|
|
322
252
|
return [
|
|
323
|
-
{
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
ItemSlot: s
|
|
327
|
-
},
|
|
328
|
-
d,
|
|
329
|
-
r
|
|
253
|
+
{ Provider: i, Slot: u, ItemSlot: l },
|
|
254
|
+
f,
|
|
255
|
+
o
|
|
330
256
|
];
|
|
331
257
|
}
|
|
332
|
-
|
|
333
|
-
"
|
|
334
|
-
"PageDown"
|
|
335
|
-
|
|
336
|
-
"ArrowUp",
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
]
|
|
365
|
-
}, z = "Slider", [J, Fe, Ue] = je(z), [Se, wt] = de(z, [
|
|
366
|
-
Ue
|
|
367
|
-
]), [Ye, W] = Se(z), We = /* @__PURE__ */ P((e, t) => {
|
|
368
|
-
const { name: n, min: r = 0, max: i = 100, step: o = 1, orientation: a = "horizontal", disabled: c = !1, minStepsBetweenThumbs: l = 0, defaultValue: u = [
|
|
369
|
-
r
|
|
370
|
-
], value: m, onValueChange: s = () => {
|
|
371
|
-
}, onValueCommit: d = () => {
|
|
372
|
-
}, inverted: S = !1, ...f } = e, [$, p] = T(null), v = M(
|
|
373
|
-
t,
|
|
374
|
-
(x) => p(x)
|
|
375
|
-
), _ = E(/* @__PURE__ */ new Set()), h = E(0), g = a === "horizontal", R = $ ? !!$.closest("form") : !0, ee = g ? Xe : Ge, [w = [], _e] = Ie({
|
|
376
|
-
prop: m,
|
|
377
|
-
defaultProp: u,
|
|
378
|
-
onChange: (x) => {
|
|
379
|
-
var C;
|
|
380
|
-
(C = [
|
|
381
|
-
..._.current
|
|
382
|
-
][h.current]) === null || C === void 0 || C.focus(), s(x);
|
|
383
|
-
}
|
|
384
|
-
}), te = E(w);
|
|
385
|
-
function ye(x) {
|
|
386
|
-
const C = rt(w, x);
|
|
387
|
-
K(x, C);
|
|
388
|
-
}
|
|
389
|
-
function we(x) {
|
|
390
|
-
K(x, h.current);
|
|
391
|
-
}
|
|
392
|
-
function Ce() {
|
|
393
|
-
const x = te.current[h.current];
|
|
394
|
-
w[h.current] !== x && d(w);
|
|
395
|
-
}
|
|
396
|
-
function K(x, C, { commit: L } = {
|
|
397
|
-
commit: !1
|
|
398
|
-
}) {
|
|
399
|
-
const ne = st(o), X = lt(Math.round((x - r) / o) * o + r, ne), V = le(X, [
|
|
400
|
-
r,
|
|
401
|
-
i
|
|
402
|
-
]);
|
|
403
|
-
_e((I = []) => {
|
|
404
|
-
const A = nt(I, V, C);
|
|
405
|
-
if (at(A, l * o)) {
|
|
406
|
-
h.current = A.indexOf(V);
|
|
407
|
-
const oe = String(A) !== String(I);
|
|
408
|
-
return oe && L && d(A), oe ? A : I;
|
|
409
|
-
} else return I;
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
return /* @__PURE__ */ b(Ye, {
|
|
413
|
-
scope: e.__scopeSlider,
|
|
414
|
-
disabled: c,
|
|
415
|
-
min: r,
|
|
416
|
-
max: i,
|
|
417
|
-
valueIndexToChangeRef: h,
|
|
418
|
-
thumbs: _.current,
|
|
419
|
-
values: w,
|
|
420
|
-
orientation: a
|
|
421
|
-
}, /* @__PURE__ */ b(J.Provider, {
|
|
422
|
-
scope: e.__scopeSlider
|
|
423
|
-
}, /* @__PURE__ */ b(J.Slot, {
|
|
424
|
-
scope: e.__scopeSlider
|
|
425
|
-
}, /* @__PURE__ */ b(ee, y({
|
|
426
|
-
"aria-disabled": c,
|
|
427
|
-
"data-disabled": c ? "" : void 0
|
|
428
|
-
}, f, {
|
|
429
|
-
ref: v,
|
|
430
|
-
onPointerDown: N(f.onPointerDown, () => {
|
|
431
|
-
c || (te.current = w);
|
|
432
|
-
}),
|
|
433
|
-
min: r,
|
|
434
|
-
max: i,
|
|
435
|
-
inverted: S,
|
|
436
|
-
onSlideStart: c ? void 0 : ye,
|
|
437
|
-
onSlideMove: c ? void 0 : we,
|
|
438
|
-
onSlideEnd: c ? void 0 : Ce,
|
|
439
|
-
onHomeKeyDown: () => !c && K(r, 0, {
|
|
440
|
-
commit: !0
|
|
441
|
-
}),
|
|
442
|
-
onEndKeyDown: () => !c && K(i, w.length - 1, {
|
|
443
|
-
commit: !0
|
|
444
|
-
}),
|
|
445
|
-
onStepKeyDown: ({ event: x, direction: C }) => {
|
|
446
|
-
if (!c) {
|
|
447
|
-
const X = pe.includes(x.key) || x.shiftKey && $e.includes(x.key) ? 10 : 1, V = h.current, I = w[V], A = o * X * C;
|
|
448
|
-
K(I + A, V, {
|
|
449
|
-
commit: !0
|
|
450
|
-
});
|
|
258
|
+
var ne = ["PageUp", "PageDown"], re = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], oe = {
|
|
259
|
+
"from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
260
|
+
"from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
|
|
261
|
+
"from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
262
|
+
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
263
|
+
}, N = "Slider", [H, Ve, ke] = Te(N), [se, ut] = ee(N, [
|
|
264
|
+
ke
|
|
265
|
+
]), [ze, K] = se(N), ie = a.forwardRef(
|
|
266
|
+
(e, t) => {
|
|
267
|
+
const {
|
|
268
|
+
name: n,
|
|
269
|
+
min: o = 0,
|
|
270
|
+
max: s = 100,
|
|
271
|
+
step: r = 1,
|
|
272
|
+
orientation: i = "horizontal",
|
|
273
|
+
disabled: c = !1,
|
|
274
|
+
minStepsBetweenThumbs: u = 0,
|
|
275
|
+
defaultValue: d = [o],
|
|
276
|
+
value: v,
|
|
277
|
+
onValueChange: l = () => {
|
|
278
|
+
},
|
|
279
|
+
onValueCommit: f = () => {
|
|
280
|
+
},
|
|
281
|
+
inverted: g = !1,
|
|
282
|
+
form: m,
|
|
283
|
+
...h
|
|
284
|
+
} = e, S = a.useRef(/* @__PURE__ */ new Set()), p = a.useRef(0), w = i === "horizontal" ? Be : Ke, [y = [], R] = Ce({
|
|
285
|
+
prop: v,
|
|
286
|
+
defaultProp: d,
|
|
287
|
+
onChange: (_) => {
|
|
288
|
+
var M;
|
|
289
|
+
(M = [...S.current][p.current]) == null || M.focus(), l(_);
|
|
451
290
|
}
|
|
291
|
+
}), L = a.useRef(y);
|
|
292
|
+
function $(_) {
|
|
293
|
+
const x = He(y, _);
|
|
294
|
+
O(_, x);
|
|
295
|
+
}
|
|
296
|
+
function Se(_) {
|
|
297
|
+
O(_, p.current);
|
|
298
|
+
}
|
|
299
|
+
function ge() {
|
|
300
|
+
const _ = L.current[p.current];
|
|
301
|
+
y[p.current] !== _ && f(y);
|
|
302
|
+
}
|
|
303
|
+
function O(_, x, { commit: M } = { commit: !1 }) {
|
|
304
|
+
const X = Xe(r), j = Ge(Math.round((_ - o) / r) * r + o, X), T = J(j, [o, s]);
|
|
305
|
+
R((A = []) => {
|
|
306
|
+
const P = je(A, T, x);
|
|
307
|
+
if (Ye(P, u * r)) {
|
|
308
|
+
p.current = P.indexOf(T);
|
|
309
|
+
const G = String(P) !== String(A);
|
|
310
|
+
return G && M && f(P), G ? P : A;
|
|
311
|
+
} else
|
|
312
|
+
return A;
|
|
313
|
+
});
|
|
452
314
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
315
|
+
return /* @__PURE__ */ b(
|
|
316
|
+
ze,
|
|
317
|
+
{
|
|
318
|
+
scope: e.__scopeSlider,
|
|
319
|
+
name: n,
|
|
320
|
+
disabled: c,
|
|
321
|
+
min: o,
|
|
322
|
+
max: s,
|
|
323
|
+
valueIndexToChangeRef: p,
|
|
324
|
+
thumbs: S.current,
|
|
325
|
+
values: y,
|
|
326
|
+
orientation: i,
|
|
327
|
+
form: m,
|
|
328
|
+
children: /* @__PURE__ */ b(H.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ b(H.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ b(
|
|
329
|
+
w,
|
|
330
|
+
{
|
|
331
|
+
"aria-disabled": c,
|
|
332
|
+
"data-disabled": c ? "" : void 0,
|
|
333
|
+
...h,
|
|
334
|
+
ref: t,
|
|
335
|
+
onPointerDown: I(h.onPointerDown, () => {
|
|
336
|
+
c || (L.current = y);
|
|
337
|
+
}),
|
|
338
|
+
min: o,
|
|
339
|
+
max: s,
|
|
340
|
+
inverted: g,
|
|
341
|
+
onSlideStart: c ? void 0 : $,
|
|
342
|
+
onSlideMove: c ? void 0 : Se,
|
|
343
|
+
onSlideEnd: c ? void 0 : ge,
|
|
344
|
+
onHomeKeyDown: () => !c && O(o, 0, { commit: !0 }),
|
|
345
|
+
onEndKeyDown: () => !c && O(s, y.length - 1, { commit: !0 }),
|
|
346
|
+
onStepKeyDown: ({ event: _, direction: x }) => {
|
|
347
|
+
if (!c) {
|
|
348
|
+
const j = ne.includes(_.key) || _.shiftKey && re.includes(_.key) ? 10 : 1, T = p.current, A = y[T], P = r * j * x;
|
|
349
|
+
O(A + P, T, { commit: !0 });
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
) }) })
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
ie.displayName = N;
|
|
359
|
+
var [ce, ae] = se(N, {
|
|
461
360
|
startEdge: "left",
|
|
462
361
|
endEdge: "right",
|
|
463
362
|
size: "width",
|
|
464
363
|
direction: 1
|
|
465
|
-
}),
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
]
|
|
478
|
-
|
|
479
|
-
n
|
|
480
|
-
|
|
481
|
-
return f.current = g, w(h - g.left);
|
|
482
|
-
}
|
|
483
|
-
return /* @__PURE__ */ b(he, {
|
|
484
|
-
scope: e.__scopeSlider,
|
|
485
|
-
startEdge: v ? "left" : "right",
|
|
486
|
-
endEdge: v ? "right" : "left",
|
|
487
|
-
direction: v ? 1 : -1,
|
|
488
|
-
size: "width"
|
|
489
|
-
}, /* @__PURE__ */ b(ve, y({
|
|
490
|
-
dir: $,
|
|
491
|
-
"data-orientation": "horizontal"
|
|
492
|
-
}, m, {
|
|
493
|
-
ref: S,
|
|
494
|
-
style: {
|
|
495
|
-
...m.style,
|
|
496
|
-
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
497
|
-
},
|
|
498
|
-
onSlideStart: (h) => {
|
|
499
|
-
const g = _(h.clientX);
|
|
500
|
-
a == null || a(g);
|
|
501
|
-
},
|
|
502
|
-
onSlideMove: (h) => {
|
|
503
|
-
const g = _(h.clientX);
|
|
504
|
-
c == null || c(g);
|
|
505
|
-
},
|
|
506
|
-
onSlideEnd: () => {
|
|
507
|
-
f.current = void 0, l == null || l();
|
|
508
|
-
},
|
|
509
|
-
onStepKeyDown: (h) => {
|
|
510
|
-
const R = me[v ? "from-left" : "from-right"].includes(h.key);
|
|
511
|
-
u == null || u({
|
|
512
|
-
event: h,
|
|
513
|
-
direction: R ? -1 : 1
|
|
514
|
-
});
|
|
364
|
+
}), Be = a.forwardRef(
|
|
365
|
+
(e, t) => {
|
|
366
|
+
const {
|
|
367
|
+
min: n,
|
|
368
|
+
max: o,
|
|
369
|
+
dir: s,
|
|
370
|
+
inverted: r,
|
|
371
|
+
onSlideStart: i,
|
|
372
|
+
onSlideMove: c,
|
|
373
|
+
onSlideEnd: u,
|
|
374
|
+
onStepKeyDown: d,
|
|
375
|
+
...v
|
|
376
|
+
} = e, [l, f] = a.useState(null), g = D(t, (w) => f(w)), m = a.useRef(void 0), h = xe(s), S = h === "ltr", p = S && !r || !S && r;
|
|
377
|
+
function C(w) {
|
|
378
|
+
const y = m.current || l.getBoundingClientRect(), R = [0, y.width], $ = Y(R, p ? [n, o] : [o, n]);
|
|
379
|
+
return m.current = y, $(w - y.left);
|
|
515
380
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
381
|
+
return /* @__PURE__ */ b(
|
|
382
|
+
ce,
|
|
383
|
+
{
|
|
384
|
+
scope: e.__scopeSlider,
|
|
385
|
+
startEdge: p ? "left" : "right",
|
|
386
|
+
endEdge: p ? "right" : "left",
|
|
387
|
+
direction: p ? 1 : -1,
|
|
388
|
+
size: "width",
|
|
389
|
+
children: /* @__PURE__ */ b(
|
|
390
|
+
le,
|
|
391
|
+
{
|
|
392
|
+
dir: h,
|
|
393
|
+
"data-orientation": "horizontal",
|
|
394
|
+
...v,
|
|
395
|
+
ref: g,
|
|
396
|
+
style: {
|
|
397
|
+
...v.style,
|
|
398
|
+
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
399
|
+
},
|
|
400
|
+
onSlideStart: (w) => {
|
|
401
|
+
const y = C(w.clientX);
|
|
402
|
+
i == null || i(y);
|
|
403
|
+
},
|
|
404
|
+
onSlideMove: (w) => {
|
|
405
|
+
const y = C(w.clientX);
|
|
406
|
+
c == null || c(y);
|
|
407
|
+
},
|
|
408
|
+
onSlideEnd: () => {
|
|
409
|
+
m.current = void 0, u == null || u();
|
|
410
|
+
},
|
|
411
|
+
onStepKeyDown: (w) => {
|
|
412
|
+
const R = oe[p ? "from-left" : "from-right"].includes(w.key);
|
|
413
|
+
d == null || d({ event: w, direction: R ? -1 : 1 });
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
);
|
|
531
419
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
const p = f($.clientY);
|
|
548
|
-
o == null || o(p);
|
|
549
|
-
},
|
|
550
|
-
onSlideMove: ($) => {
|
|
551
|
-
const p = f($.clientY);
|
|
552
|
-
a == null || a(p);
|
|
553
|
-
},
|
|
554
|
-
onSlideEnd: () => {
|
|
555
|
-
d.current = void 0, c == null || c();
|
|
556
|
-
},
|
|
557
|
-
onStepKeyDown: ($) => {
|
|
558
|
-
const v = me[S ? "from-bottom" : "from-top"].includes($.key);
|
|
559
|
-
l == null || l({
|
|
560
|
-
event: $,
|
|
561
|
-
direction: v ? -1 : 1
|
|
562
|
-
});
|
|
420
|
+
), Ke = a.forwardRef(
|
|
421
|
+
(e, t) => {
|
|
422
|
+
const {
|
|
423
|
+
min: n,
|
|
424
|
+
max: o,
|
|
425
|
+
inverted: s,
|
|
426
|
+
onSlideStart: r,
|
|
427
|
+
onSlideMove: i,
|
|
428
|
+
onSlideEnd: c,
|
|
429
|
+
onStepKeyDown: u,
|
|
430
|
+
...d
|
|
431
|
+
} = e, v = a.useRef(null), l = D(t, v), f = a.useRef(void 0), g = !s;
|
|
432
|
+
function m(h) {
|
|
433
|
+
const S = f.current || v.current.getBoundingClientRect(), p = [0, S.height], w = Y(p, g ? [o, n] : [n, o]);
|
|
434
|
+
return f.current = S, w(h - S.top);
|
|
563
435
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
i
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
436
|
+
return /* @__PURE__ */ b(
|
|
437
|
+
ce,
|
|
438
|
+
{
|
|
439
|
+
scope: e.__scopeSlider,
|
|
440
|
+
startEdge: g ? "bottom" : "top",
|
|
441
|
+
endEdge: g ? "top" : "bottom",
|
|
442
|
+
size: "height",
|
|
443
|
+
direction: g ? 1 : -1,
|
|
444
|
+
children: /* @__PURE__ */ b(
|
|
445
|
+
le,
|
|
446
|
+
{
|
|
447
|
+
"data-orientation": "vertical",
|
|
448
|
+
...d,
|
|
449
|
+
ref: l,
|
|
450
|
+
style: {
|
|
451
|
+
...d.style,
|
|
452
|
+
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
453
|
+
},
|
|
454
|
+
onSlideStart: (h) => {
|
|
455
|
+
const S = m(h.clientY);
|
|
456
|
+
r == null || r(S);
|
|
457
|
+
},
|
|
458
|
+
onSlideMove: (h) => {
|
|
459
|
+
const S = m(h.clientY);
|
|
460
|
+
i == null || i(S);
|
|
461
|
+
},
|
|
462
|
+
onSlideEnd: () => {
|
|
463
|
+
f.current = void 0, c == null || c();
|
|
464
|
+
},
|
|
465
|
+
onStepKeyDown: (h) => {
|
|
466
|
+
const p = oe[g ? "from-bottom" : "from-top"].includes(h.key);
|
|
467
|
+
u == null || u({ event: h, direction: p ? -1 : 1 });
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
)
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
), le = a.forwardRef(
|
|
475
|
+
(e, t) => {
|
|
476
|
+
const {
|
|
477
|
+
__scopeSlider: n,
|
|
478
|
+
onSlideStart: o,
|
|
479
|
+
onSlideMove: s,
|
|
480
|
+
onSlideEnd: r,
|
|
481
|
+
onHomeKeyDown: i,
|
|
482
|
+
onEndKeyDown: c,
|
|
483
|
+
onStepKeyDown: u,
|
|
484
|
+
...d
|
|
485
|
+
} = e, v = K(N, n);
|
|
486
|
+
return /* @__PURE__ */ b(
|
|
487
|
+
B.span,
|
|
488
|
+
{
|
|
489
|
+
...d,
|
|
490
|
+
ref: t,
|
|
491
|
+
onKeyDown: I(e.onKeyDown, (l) => {
|
|
492
|
+
l.key === "Home" ? (i(l), l.preventDefault()) : l.key === "End" ? (c(l), l.preventDefault()) : ne.concat(re).includes(l.key) && (u(l), l.preventDefault());
|
|
493
|
+
}),
|
|
494
|
+
onPointerDown: I(e.onPointerDown, (l) => {
|
|
495
|
+
const f = l.target;
|
|
496
|
+
f.setPointerCapture(l.pointerId), l.preventDefault(), v.thumbs.has(f) ? f.focus() : o(l);
|
|
497
|
+
}),
|
|
498
|
+
onPointerMove: I(e.onPointerMove, (l) => {
|
|
499
|
+
l.target.hasPointerCapture(l.pointerId) && s(l);
|
|
500
|
+
}),
|
|
501
|
+
onPointerUp: I(e.onPointerUp, (l) => {
|
|
502
|
+
const f = l.target;
|
|
503
|
+
f.hasPointerCapture(l.pointerId) && (f.releasePointerCapture(l.pointerId), r(l));
|
|
504
|
+
})
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
), ue = "SliderTrack", de = a.forwardRef(
|
|
509
|
+
(e, t) => {
|
|
510
|
+
const { __scopeSlider: n, ...o } = e, s = K(ue, n);
|
|
511
|
+
return /* @__PURE__ */ b(
|
|
512
|
+
B.span,
|
|
513
|
+
{
|
|
514
|
+
"data-disabled": s.disabled ? "" : void 0,
|
|
515
|
+
"data-orientation": s.orientation,
|
|
516
|
+
...o,
|
|
517
|
+
ref: t
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
de.displayName = ue;
|
|
523
|
+
var W = "SliderRange", fe = a.forwardRef(
|
|
524
|
+
(e, t) => {
|
|
525
|
+
const { __scopeSlider: n, ...o } = e, s = K(W, n), r = ae(W, n), i = a.useRef(null), c = D(t, i), u = s.values.length, d = s.values.map(
|
|
526
|
+
(f) => me(f, s.min, s.max)
|
|
527
|
+
), v = u > 1 ? Math.min(...d) : 0, l = 100 - Math.max(...d);
|
|
528
|
+
return /* @__PURE__ */ b(
|
|
529
|
+
B.span,
|
|
530
|
+
{
|
|
531
|
+
"data-orientation": s.orientation,
|
|
532
|
+
"data-disabled": s.disabled ? "" : void 0,
|
|
533
|
+
...o,
|
|
534
|
+
ref: c,
|
|
535
|
+
style: {
|
|
536
|
+
...e.style,
|
|
537
|
+
[r.startEdge]: v + "%",
|
|
538
|
+
[r.endEdge]: l + "%"
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
fe.displayName = W;
|
|
545
|
+
var U = "SliderThumb", pe = a.forwardRef(
|
|
546
|
+
(e, t) => {
|
|
547
|
+
const n = Ve(e.__scopeSlider), [o, s] = a.useState(null), r = D(t, (c) => s(c)), i = a.useMemo(
|
|
548
|
+
() => o ? n().findIndex((c) => c.ref.current === o) : -1,
|
|
549
|
+
[n, o]
|
|
550
|
+
);
|
|
551
|
+
return /* @__PURE__ */ b(Le, { ...e, ref: r, index: i });
|
|
552
|
+
}
|
|
553
|
+
), Le = a.forwardRef(
|
|
554
|
+
(e, t) => {
|
|
555
|
+
const { __scopeSlider: n, index: o, name: s, ...r } = e, i = K(U, n), c = ae(U, n), [u, d] = a.useState(null), v = D(t, (C) => d(C)), l = u ? i.form || !!u.closest("form") : !0, f = De(u), g = i.values[o], m = g === void 0 ? 0 : me(g, i.min, i.max), h = Fe(o, i.values.length), S = f == null ? void 0 : f[c.size], p = S ? We(S, m, c.direction) : 0;
|
|
556
|
+
return a.useEffect(() => {
|
|
557
|
+
if (u)
|
|
558
|
+
return i.thumbs.add(u), () => {
|
|
559
|
+
i.thumbs.delete(u);
|
|
560
|
+
};
|
|
561
|
+
}, [u, i.thumbs]), /* @__PURE__ */ Z(
|
|
562
|
+
"span",
|
|
563
|
+
{
|
|
564
|
+
style: {
|
|
565
|
+
transform: "var(--radix-slider-thumb-transform)",
|
|
566
|
+
position: "absolute",
|
|
567
|
+
[c.startEdge]: `calc(${m}% + ${p}px)`
|
|
568
|
+
},
|
|
569
|
+
children: [
|
|
570
|
+
/* @__PURE__ */ b(H.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ b(
|
|
571
|
+
B.span,
|
|
572
|
+
{
|
|
573
|
+
role: "slider",
|
|
574
|
+
"aria-label": e["aria-label"] || h,
|
|
575
|
+
"aria-valuemin": i.min,
|
|
576
|
+
"aria-valuenow": g,
|
|
577
|
+
"aria-valuemax": i.max,
|
|
578
|
+
"aria-orientation": i.orientation,
|
|
579
|
+
"data-orientation": i.orientation,
|
|
580
|
+
"data-disabled": i.disabled ? "" : void 0,
|
|
581
|
+
tabIndex: i.disabled ? void 0 : 0,
|
|
582
|
+
...r,
|
|
583
|
+
ref: v,
|
|
584
|
+
style: g === void 0 ? { display: "none" } : e.style,
|
|
585
|
+
onFocus: I(e.onFocus, () => {
|
|
586
|
+
i.valueIndexToChangeRef.current = o;
|
|
587
|
+
})
|
|
588
|
+
}
|
|
589
|
+
) }),
|
|
590
|
+
l && /* @__PURE__ */ b(
|
|
591
|
+
$e,
|
|
592
|
+
{
|
|
593
|
+
name: s ?? (i.name ? i.name + (i.values.length > 1 ? "[]" : "") : void 0),
|
|
594
|
+
form: i.form,
|
|
595
|
+
value: g
|
|
596
|
+
},
|
|
597
|
+
o
|
|
598
|
+
)
|
|
599
|
+
]
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
);
|
|
604
|
+
pe.displayName = U;
|
|
605
|
+
var $e = (e) => {
|
|
606
|
+
const { value: t, ...n } = e, o = a.useRef(null), s = Pe(t);
|
|
607
|
+
return a.useEffect(() => {
|
|
608
|
+
const r = o.current, i = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(i, "value").set;
|
|
609
|
+
if (s !== t && u) {
|
|
610
|
+
const d = new Event("input", { bubbles: !0 });
|
|
611
|
+
u.call(r, t), r.dispatchEvent(d);
|
|
680
612
|
}
|
|
681
|
-
}, n,
|
|
682
|
-
ref: r,
|
|
683
|
-
defaultValue: t
|
|
684
|
-
}));
|
|
613
|
+
}, [s, t]), /* @__PURE__ */ b("input", { style: { display: "none" }, ...n, ref: o, defaultValue: t });
|
|
685
614
|
};
|
|
686
|
-
function
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
];
|
|
690
|
-
return r[n] = t, r.sort(
|
|
691
|
-
(i, o) => i - o
|
|
692
|
-
);
|
|
615
|
+
function je(e = [], t, n) {
|
|
616
|
+
const o = [...e];
|
|
617
|
+
return o[n] = t, o.sort((s, r) => s - r);
|
|
693
618
|
}
|
|
694
|
-
function
|
|
695
|
-
const
|
|
696
|
-
return
|
|
697
|
-
0,
|
|
698
|
-
100
|
|
699
|
-
]);
|
|
619
|
+
function me(e, t, n) {
|
|
620
|
+
const r = 100 / (n - t) * (e - t);
|
|
621
|
+
return J(r, [0, 100]);
|
|
700
622
|
}
|
|
701
|
-
function
|
|
702
|
-
return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? [
|
|
703
|
-
"Minimum",
|
|
704
|
-
"Maximum"
|
|
705
|
-
][e] : void 0;
|
|
623
|
+
function Fe(e, t) {
|
|
624
|
+
return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
|
|
706
625
|
}
|
|
707
|
-
function
|
|
626
|
+
function He(e, t) {
|
|
708
627
|
if (e.length === 1) return 0;
|
|
709
|
-
const n = e.map(
|
|
710
|
-
|
|
711
|
-
), r = Math.min(...n);
|
|
712
|
-
return n.indexOf(r);
|
|
628
|
+
const n = e.map((s) => Math.abs(s - t)), o = Math.min(...n);
|
|
629
|
+
return n.indexOf(o);
|
|
713
630
|
}
|
|
714
|
-
function
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
50
|
|
718
|
-
], [
|
|
719
|
-
0,
|
|
720
|
-
r
|
|
721
|
-
]);
|
|
722
|
-
return (r - o(t) * n) * n;
|
|
631
|
+
function We(e, t, n) {
|
|
632
|
+
const o = e / 2, r = Y([0, 50], [0, o]);
|
|
633
|
+
return (o - r(t) * n) * n;
|
|
723
634
|
}
|
|
724
|
-
function
|
|
725
|
-
return e.slice(0, -1).map(
|
|
726
|
-
(t, n) => e[n + 1] - t
|
|
727
|
-
);
|
|
635
|
+
function Ue(e) {
|
|
636
|
+
return e.slice(0, -1).map((t, n) => e[n + 1] - t);
|
|
728
637
|
}
|
|
729
|
-
function
|
|
638
|
+
function Ye(e, t) {
|
|
730
639
|
if (t > 0) {
|
|
731
|
-
const n =
|
|
640
|
+
const n = Ue(e);
|
|
732
641
|
return Math.min(...n) >= t;
|
|
733
642
|
}
|
|
734
643
|
return !0;
|
|
735
644
|
}
|
|
736
|
-
function
|
|
645
|
+
function Y(e, t) {
|
|
737
646
|
return (n) => {
|
|
738
647
|
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
739
|
-
const
|
|
740
|
-
return t[0] +
|
|
648
|
+
const o = (t[1] - t[0]) / (e[1] - e[0]);
|
|
649
|
+
return t[0] + o * (n - e[0]);
|
|
741
650
|
};
|
|
742
651
|
}
|
|
743
|
-
function
|
|
652
|
+
function Xe(e) {
|
|
744
653
|
return (String(e).split(".")[1] || "").length;
|
|
745
654
|
}
|
|
746
|
-
function
|
|
655
|
+
function Ge(e, t) {
|
|
747
656
|
const n = Math.pow(10, t);
|
|
748
657
|
return Math.round(e * n) / n;
|
|
749
658
|
}
|
|
750
|
-
|
|
751
|
-
function
|
|
659
|
+
var qe = ie, Ze = de, Je = fe, Qe = pe;
|
|
660
|
+
function et(e) {
|
|
752
661
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
753
662
|
}
|
|
754
|
-
var
|
|
663
|
+
var he = { exports: {} };
|
|
755
664
|
/*!
|
|
756
665
|
Copyright (c) 2018 Jed Watson.
|
|
757
666
|
Licensed under the MIT License (MIT), see
|
|
@@ -761,75 +670,75 @@ var ge = { exports: {} };
|
|
|
761
670
|
(function() {
|
|
762
671
|
var t = {}.hasOwnProperty;
|
|
763
672
|
function n() {
|
|
764
|
-
for (var
|
|
765
|
-
var c = arguments[
|
|
766
|
-
c && (
|
|
673
|
+
for (var r = "", i = 0; i < arguments.length; i++) {
|
|
674
|
+
var c = arguments[i];
|
|
675
|
+
c && (r = s(r, o.call(this, c)));
|
|
767
676
|
}
|
|
768
|
-
return
|
|
677
|
+
return r;
|
|
769
678
|
}
|
|
770
|
-
function r
|
|
771
|
-
if (typeof
|
|
772
|
-
return this && this[
|
|
773
|
-
if (typeof
|
|
679
|
+
function o(r) {
|
|
680
|
+
if (typeof r == "string" || typeof r == "number")
|
|
681
|
+
return this && this[r] || r;
|
|
682
|
+
if (typeof r != "object")
|
|
774
683
|
return "";
|
|
775
|
-
if (Array.isArray(
|
|
776
|
-
return n.apply(this,
|
|
777
|
-
if (
|
|
778
|
-
return
|
|
779
|
-
var
|
|
780
|
-
for (var c in
|
|
781
|
-
t.call(
|
|
782
|
-
return
|
|
684
|
+
if (Array.isArray(r))
|
|
685
|
+
return n.apply(this, r);
|
|
686
|
+
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
687
|
+
return r.toString();
|
|
688
|
+
var i = "";
|
|
689
|
+
for (var c in r)
|
|
690
|
+
t.call(r, c) && r[c] && (i = s(i, this && this[c] || c));
|
|
691
|
+
return i;
|
|
783
692
|
}
|
|
784
|
-
function
|
|
785
|
-
return
|
|
693
|
+
function s(r, i) {
|
|
694
|
+
return i ? r ? r + " " + i : r + i : r;
|
|
786
695
|
}
|
|
787
696
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
788
697
|
})();
|
|
789
|
-
})(
|
|
790
|
-
var
|
|
791
|
-
const
|
|
698
|
+
})(he);
|
|
699
|
+
var tt = he.exports;
|
|
700
|
+
const nt = /* @__PURE__ */ et(tt), rt = {
|
|
792
701
|
"purpur-slider": "_purpur-slider_14tuk_1",
|
|
793
702
|
"purpur-slider__track": "_purpur-slider__track_14tuk_17",
|
|
794
703
|
"purpur-slider__range": "_purpur-slider__range_14tuk_17",
|
|
795
704
|
"purpur-slider__thumb": "_purpur-slider__thumb_14tuk_43"
|
|
796
|
-
},
|
|
705
|
+
}, V = nt.bind(rt), dt = ["horizontal", "vertical"], k = "purpur-slider", ot = (e) => String(e), st = ({
|
|
797
706
|
"aria-label": e,
|
|
798
707
|
"aria-valuetext": t,
|
|
799
708
|
className: n,
|
|
800
|
-
defaultValue:
|
|
801
|
-
id:
|
|
802
|
-
value:
|
|
803
|
-
...
|
|
709
|
+
defaultValue: o,
|
|
710
|
+
id: s,
|
|
711
|
+
value: r,
|
|
712
|
+
...i
|
|
804
713
|
}, c) => {
|
|
805
|
-
const
|
|
806
|
-
return /* @__PURE__ */
|
|
807
|
-
|
|
714
|
+
const u = ve(), d = r || o;
|
|
715
|
+
return /* @__PURE__ */ Z(
|
|
716
|
+
qe,
|
|
808
717
|
{
|
|
809
|
-
...
|
|
810
|
-
id:
|
|
718
|
+
...i,
|
|
719
|
+
id: s || u,
|
|
811
720
|
ref: c,
|
|
812
|
-
className:
|
|
813
|
-
value:
|
|
814
|
-
defaultValue:
|
|
721
|
+
className: V(k, n),
|
|
722
|
+
value: r,
|
|
723
|
+
defaultValue: o,
|
|
815
724
|
children: [
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
|
|
818
|
-
|
|
725
|
+
/* @__PURE__ */ b(Ze, { className: V(`${k}__track`), children: /* @__PURE__ */ b(Je, { className: V(`${k}__range`) }) }),
|
|
726
|
+
d == null ? void 0 : d.map((v, l) => /* @__PURE__ */ b(
|
|
727
|
+
Qe,
|
|
819
728
|
{
|
|
820
|
-
className:
|
|
729
|
+
className: V(`${k}__thumb`),
|
|
821
730
|
"aria-label": e,
|
|
822
731
|
"aria-valuetext": t
|
|
823
732
|
},
|
|
824
|
-
|
|
733
|
+
ot(l)
|
|
825
734
|
))
|
|
826
735
|
]
|
|
827
736
|
}
|
|
828
737
|
);
|
|
829
|
-
},
|
|
830
|
-
|
|
738
|
+
}, it = ye(st);
|
|
739
|
+
it.displayName = "Slider";
|
|
831
740
|
export {
|
|
832
|
-
|
|
833
|
-
|
|
741
|
+
dt as SLIDER_ORIENTATION,
|
|
742
|
+
it as Slider
|
|
834
743
|
};
|
|
835
744
|
//# sourceMappingURL=slider.es.js.map
|