@spear-ai/spectral 1.0.0 → 1.0.1
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/Button.d.ts +2 -24
- package/dist/Button.js +72 -52
- package/dist/Card.d.ts +2 -13
- package/dist/Card.js +17 -23
- package/dist/Drawer.d.ts +2 -14
- package/dist/Drawer.js +2149 -28
- package/dist/Skeleton.d.ts +2 -6
- package/dist/Skeleton.js +5 -10
- package/dist/Slider.d.ts +2 -21
- package/dist/Slider.js +534 -50
- package/dist/assets/spectral.css +1 -0
- package/dist/components/Button/Button.d.ts +20 -0
- package/dist/components/Card/Card.d.ts +9 -0
- package/dist/components/Drawer/Drawer.d.ts +10 -0
- package/dist/components/Skeleton/Skeleton.d.ts +3 -0
- package/dist/components/Slider/Slider.d.ts +18 -0
- package/dist/hooks/useAccordionAutoScroll.d.ts +8 -0
- package/dist/hooks/useOutsideClick.d.ts +7 -0
- package/dist/hooks/useTheme.d.ts +7 -0
- package/dist/index-C-ErIYr7.js +225 -0
- package/dist/index.d.ts +11 -75
- package/dist/index.js +28 -272
- package/dist/loader-circle-Btf6jOd5.js +101 -0
- package/dist/primitives/button.d.ts +10 -0
- package/dist/primitives/input.d.ts +3 -0
- package/dist/primitives/tooltip.d.ts +7 -0
- package/dist/twUtils-B9ArqCOv.js +2747 -0
- package/dist/utils/twUtils.d.ts +3 -0
- package/package.json +5 -23
- package/dist/Card.css +0 -4
- package/dist/chunk-ZLENOYB4.js +0 -12
- package/dist/index.css +0 -189
package/dist/Skeleton.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function Skeleton({ className, ...props }: ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
|
|
5
|
-
|
|
6
|
-
export { Skeleton };
|
|
1
|
+
export * from './components/Skeleton/Skeleton'
|
|
2
|
+
export {}
|
package/dist/Skeleton.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
cn
|
|
4
|
-
} from "./chunk-ZLENOYB4.js";
|
|
5
|
-
|
|
6
|
-
// src/components/Skeleton/Skeleton.tsx
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as n } from "./twUtils-B9ArqCOv.js";
|
|
7
3
|
import "react";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return /* @__PURE__ */ jsx("div", { "data-slot": "skeleton", className: cn("bg-accent animate-pulse rounded-md", className), ...props });
|
|
4
|
+
function s({ className: t, ...e }) {
|
|
5
|
+
return /* @__PURE__ */ o("div", { "data-slot": "skeleton", className: n("bg-accent animate-pulse rounded-md", t), ...e });
|
|
11
6
|
}
|
|
12
7
|
export {
|
|
13
|
-
Skeleton
|
|
8
|
+
s as Skeleton
|
|
14
9
|
};
|
package/dist/Slider.d.ts
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ComponentProps } from 'react';
|
|
4
|
-
|
|
5
|
-
type SliderProps = ComponentProps<typeof SliderPrimitive.Root> & {
|
|
6
|
-
className?: string;
|
|
7
|
-
defaultValue?: number[];
|
|
8
|
-
value?: number[];
|
|
9
|
-
min?: number;
|
|
10
|
-
max?: number;
|
|
11
|
-
step?: number;
|
|
12
|
-
minStepsBetweenThumbs?: number;
|
|
13
|
-
onValueChange?: (value: number[]) => void;
|
|
14
|
-
orientation?: 'horizontal' | 'vertical';
|
|
15
|
-
onValueCommit?: (value: number[]) => void;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
name?: string;
|
|
18
|
-
};
|
|
19
|
-
declare function Slider({ className, defaultValue, value, min, max, step, minStepsBetweenThumbs, onValueChange, orientation, onValueCommit, disabled, name, ...props }: SliderProps): react_jsx_runtime.JSX.Element;
|
|
20
|
-
|
|
21
|
-
export { Slider, type SliderProps };
|
|
1
|
+
export * from './components/Slider/Slider'
|
|
2
|
+
export {}
|
package/dist/Slider.js
CHANGED
|
@@ -1,79 +1,563 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
} from "./
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsx as b, jsxs as X } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import _ from "react";
|
|
4
|
+
import { u as me, b as G, a as E, e as j, g as Se, c as A, P as B } from "./index-C-ErIYr7.js";
|
|
5
|
+
import { c as H } from "./twUtils-B9ArqCOv.js";
|
|
6
|
+
function q(e, [t, o]) {
|
|
7
|
+
return Math.min(o, Math.max(t, e));
|
|
8
|
+
}
|
|
9
|
+
var he = d.createContext(void 0);
|
|
10
|
+
function pe(e) {
|
|
11
|
+
const t = d.useContext(he);
|
|
12
|
+
return e || t || "ltr";
|
|
13
|
+
}
|
|
14
|
+
function ge(e) {
|
|
15
|
+
const t = d.useRef({ value: e, previous: e });
|
|
16
|
+
return d.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
17
|
+
}
|
|
18
|
+
function ve(e) {
|
|
19
|
+
const [t, o] = d.useState(void 0);
|
|
20
|
+
return me(() => {
|
|
21
|
+
if (e) {
|
|
22
|
+
o({ width: e.offsetWidth, height: e.offsetHeight });
|
|
23
|
+
const n = new ResizeObserver((i) => {
|
|
24
|
+
if (!Array.isArray(i) || !i.length)
|
|
25
|
+
return;
|
|
26
|
+
const c = i[0];
|
|
27
|
+
let r, s;
|
|
28
|
+
if ("borderBoxSize" in c) {
|
|
29
|
+
const u = c.borderBoxSize, g = Array.isArray(u) ? u[0] : u;
|
|
30
|
+
r = g.inlineSize, s = g.blockSize;
|
|
31
|
+
} else
|
|
32
|
+
r = e.offsetWidth, s = e.offsetHeight;
|
|
33
|
+
o({ width: r, height: s });
|
|
34
|
+
});
|
|
35
|
+
return n.observe(e, { box: "border-box" }), () => n.unobserve(e);
|
|
36
|
+
} else
|
|
37
|
+
o(void 0);
|
|
38
|
+
}, [e]), t;
|
|
39
|
+
}
|
|
40
|
+
function be(e) {
|
|
41
|
+
const t = e + "CollectionProvider", [o, n] = G(t), [i, c] = o(
|
|
42
|
+
t,
|
|
43
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
44
|
+
), r = (f) => {
|
|
45
|
+
const { scope: l, children: m } = f, R = _.useRef(null), p = _.useRef(/* @__PURE__ */ new Map()).current;
|
|
46
|
+
return /* @__PURE__ */ b(i, { scope: l, itemMap: p, collectionRef: R, children: m });
|
|
47
|
+
};
|
|
48
|
+
r.displayName = t;
|
|
49
|
+
const s = e + "CollectionSlot", u = j(s), g = _.forwardRef(
|
|
50
|
+
(f, l) => {
|
|
51
|
+
const { scope: m, children: R } = f, p = c(s, m), S = E(l, p.collectionRef);
|
|
52
|
+
return /* @__PURE__ */ b(u, { ref: S, children: R });
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
g.displayName = s;
|
|
56
|
+
const v = e + "CollectionItemSlot", a = "data-radix-collection-item", h = j(v), w = _.forwardRef(
|
|
57
|
+
(f, l) => {
|
|
58
|
+
const { scope: m, children: R, ...p } = f, S = _.useRef(null), C = E(l, S), P = c(v, m);
|
|
59
|
+
return _.useEffect(() => (P.itemMap.set(S, { ref: S, ...p }), () => void P.itemMap.delete(S))), /* @__PURE__ */ b(h, { [a]: "", ref: C, children: R });
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
w.displayName = v;
|
|
63
|
+
function x(f) {
|
|
64
|
+
const l = c(e + "CollectionConsumer", f);
|
|
65
|
+
return _.useCallback(() => {
|
|
66
|
+
const R = l.collectionRef.current;
|
|
67
|
+
if (!R) return [];
|
|
68
|
+
const p = Array.from(R.querySelectorAll(`[${a}]`));
|
|
69
|
+
return Array.from(l.itemMap.values()).sort(
|
|
70
|
+
(P, T) => p.indexOf(P.ref.current) - p.indexOf(T.ref.current)
|
|
71
|
+
);
|
|
72
|
+
}, [l.collectionRef, l.itemMap]);
|
|
73
|
+
}
|
|
74
|
+
return [
|
|
75
|
+
{ Provider: r, Slot: g, ItemSlot: w },
|
|
76
|
+
x,
|
|
77
|
+
n
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
var J = ["PageUp", "PageDown"], Q = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Z = {
|
|
81
|
+
"from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
82
|
+
"from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
|
|
83
|
+
"from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
84
|
+
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
85
|
+
}, z = "Slider", [L, we, Re] = be(z), [ee, Fe] = G(z, [
|
|
86
|
+
Re
|
|
87
|
+
]), [xe, k] = ee(z), te = d.forwardRef(
|
|
88
|
+
(e, t) => {
|
|
89
|
+
const {
|
|
90
|
+
name: o,
|
|
91
|
+
min: n = 0,
|
|
92
|
+
max: i = 100,
|
|
93
|
+
step: c = 1,
|
|
94
|
+
orientation: r = "horizontal",
|
|
95
|
+
disabled: s = !1,
|
|
96
|
+
minStepsBetweenThumbs: u = 0,
|
|
97
|
+
defaultValue: g = [n],
|
|
98
|
+
value: v,
|
|
99
|
+
onValueChange: a = () => {
|
|
100
|
+
},
|
|
101
|
+
onValueCommit: h = () => {
|
|
102
|
+
},
|
|
103
|
+
inverted: w = !1,
|
|
104
|
+
form: x,
|
|
105
|
+
...f
|
|
106
|
+
} = e, l = d.useRef(/* @__PURE__ */ new Set()), m = d.useRef(0), p = r === "horizontal" ? ye : Ce, [S = [], C] = Se({
|
|
107
|
+
prop: v,
|
|
108
|
+
defaultProp: g,
|
|
109
|
+
onChange: (y) => {
|
|
110
|
+
[...l.current][m.current]?.focus(), a(y);
|
|
111
|
+
}
|
|
112
|
+
}), P = d.useRef(S);
|
|
113
|
+
function T(y) {
|
|
114
|
+
const M = _e(S, y);
|
|
115
|
+
N(y, M);
|
|
116
|
+
}
|
|
117
|
+
function ue(y) {
|
|
118
|
+
N(y, m.current);
|
|
119
|
+
}
|
|
120
|
+
function fe() {
|
|
121
|
+
const y = P.current[m.current];
|
|
122
|
+
S[m.current] !== y && h(S);
|
|
123
|
+
}
|
|
124
|
+
function N(y, M, { commit: V } = { commit: !1 }) {
|
|
125
|
+
const $ = Te(c), O = Ne(Math.round((y - n) / c) * c + n, $), K = q(O, [n, i]);
|
|
126
|
+
C((I = []) => {
|
|
127
|
+
const D = Me(I, K, M);
|
|
128
|
+
if (ze(D, u * c)) {
|
|
129
|
+
m.current = D.indexOf(K);
|
|
130
|
+
const W = String(D) !== String(I);
|
|
131
|
+
return W && V && h(D), W ? D : I;
|
|
132
|
+
} else
|
|
133
|
+
return I;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return /* @__PURE__ */ b(
|
|
137
|
+
xe,
|
|
138
|
+
{
|
|
139
|
+
scope: e.__scopeSlider,
|
|
140
|
+
name: o,
|
|
141
|
+
disabled: s,
|
|
142
|
+
min: n,
|
|
143
|
+
max: i,
|
|
144
|
+
valueIndexToChangeRef: m,
|
|
145
|
+
thumbs: l.current,
|
|
146
|
+
values: S,
|
|
147
|
+
orientation: r,
|
|
148
|
+
form: x,
|
|
149
|
+
children: /* @__PURE__ */ b(L.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ b(L.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ b(
|
|
150
|
+
p,
|
|
151
|
+
{
|
|
152
|
+
"aria-disabled": s,
|
|
153
|
+
"data-disabled": s ? "" : void 0,
|
|
154
|
+
...f,
|
|
155
|
+
ref: t,
|
|
156
|
+
onPointerDown: A(f.onPointerDown, () => {
|
|
157
|
+
s || (P.current = S);
|
|
158
|
+
}),
|
|
159
|
+
min: n,
|
|
160
|
+
max: i,
|
|
161
|
+
inverted: w,
|
|
162
|
+
onSlideStart: s ? void 0 : T,
|
|
163
|
+
onSlideMove: s ? void 0 : ue,
|
|
164
|
+
onSlideEnd: s ? void 0 : fe,
|
|
165
|
+
onHomeKeyDown: () => !s && N(n, 0, { commit: !0 }),
|
|
166
|
+
onEndKeyDown: () => !s && N(i, S.length - 1, { commit: !0 }),
|
|
167
|
+
onStepKeyDown: ({ event: y, direction: M }) => {
|
|
168
|
+
if (!s) {
|
|
169
|
+
const O = J.includes(y.key) || y.shiftKey && Q.includes(y.key) ? 10 : 1, K = m.current, I = S[K], D = c * O * M;
|
|
170
|
+
N(I + D, K, { commit: !0 });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
) }) })
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
te.displayName = z;
|
|
180
|
+
var [oe, ne] = ee(z, {
|
|
181
|
+
startEdge: "left",
|
|
182
|
+
endEdge: "right",
|
|
183
|
+
size: "width",
|
|
184
|
+
direction: 1
|
|
185
|
+
}), ye = d.forwardRef(
|
|
186
|
+
(e, t) => {
|
|
187
|
+
const {
|
|
188
|
+
min: o,
|
|
189
|
+
max: n,
|
|
190
|
+
dir: i,
|
|
191
|
+
inverted: c,
|
|
192
|
+
onSlideStart: r,
|
|
193
|
+
onSlideMove: s,
|
|
194
|
+
onSlideEnd: u,
|
|
195
|
+
onStepKeyDown: g,
|
|
196
|
+
...v
|
|
197
|
+
} = e, [a, h] = d.useState(null), w = E(t, (p) => h(p)), x = d.useRef(void 0), f = pe(i), l = f === "ltr", m = l && !c || !l && c;
|
|
198
|
+
function R(p) {
|
|
199
|
+
const S = x.current || a.getBoundingClientRect(), C = [0, S.width], T = Y(C, m ? [o, n] : [n, o]);
|
|
200
|
+
return x.current = S, T(p - S.left);
|
|
201
|
+
}
|
|
202
|
+
return /* @__PURE__ */ b(
|
|
203
|
+
oe,
|
|
204
|
+
{
|
|
205
|
+
scope: e.__scopeSlider,
|
|
206
|
+
startEdge: m ? "left" : "right",
|
|
207
|
+
endEdge: m ? "right" : "left",
|
|
208
|
+
direction: m ? 1 : -1,
|
|
209
|
+
size: "width",
|
|
210
|
+
children: /* @__PURE__ */ b(
|
|
211
|
+
re,
|
|
212
|
+
{
|
|
213
|
+
dir: f,
|
|
214
|
+
"data-orientation": "horizontal",
|
|
215
|
+
...v,
|
|
216
|
+
ref: w,
|
|
217
|
+
style: {
|
|
218
|
+
...v.style,
|
|
219
|
+
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
220
|
+
},
|
|
221
|
+
onSlideStart: (p) => {
|
|
222
|
+
const S = R(p.clientX);
|
|
223
|
+
r?.(S);
|
|
224
|
+
},
|
|
225
|
+
onSlideMove: (p) => {
|
|
226
|
+
const S = R(p.clientX);
|
|
227
|
+
s?.(S);
|
|
228
|
+
},
|
|
229
|
+
onSlideEnd: () => {
|
|
230
|
+
x.current = void 0, u?.();
|
|
231
|
+
},
|
|
232
|
+
onStepKeyDown: (p) => {
|
|
233
|
+
const C = Z[m ? "from-left" : "from-right"].includes(p.key);
|
|
234
|
+
g?.({ event: p, direction: C ? -1 : 1 });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
), Ce = d.forwardRef(
|
|
242
|
+
(e, t) => {
|
|
243
|
+
const {
|
|
244
|
+
min: o,
|
|
245
|
+
max: n,
|
|
246
|
+
inverted: i,
|
|
247
|
+
onSlideStart: c,
|
|
248
|
+
onSlideMove: r,
|
|
249
|
+
onSlideEnd: s,
|
|
250
|
+
onStepKeyDown: u,
|
|
251
|
+
...g
|
|
252
|
+
} = e, v = d.useRef(null), a = E(t, v), h = d.useRef(void 0), w = !i;
|
|
253
|
+
function x(f) {
|
|
254
|
+
const l = h.current || v.current.getBoundingClientRect(), m = [0, l.height], p = Y(m, w ? [n, o] : [o, n]);
|
|
255
|
+
return h.current = l, p(f - l.top);
|
|
256
|
+
}
|
|
257
|
+
return /* @__PURE__ */ b(
|
|
258
|
+
oe,
|
|
259
|
+
{
|
|
260
|
+
scope: e.__scopeSlider,
|
|
261
|
+
startEdge: w ? "bottom" : "top",
|
|
262
|
+
endEdge: w ? "top" : "bottom",
|
|
263
|
+
size: "height",
|
|
264
|
+
direction: w ? 1 : -1,
|
|
265
|
+
children: /* @__PURE__ */ b(
|
|
266
|
+
re,
|
|
267
|
+
{
|
|
268
|
+
"data-orientation": "vertical",
|
|
269
|
+
...g,
|
|
270
|
+
ref: a,
|
|
271
|
+
style: {
|
|
272
|
+
...g.style,
|
|
273
|
+
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
274
|
+
},
|
|
275
|
+
onSlideStart: (f) => {
|
|
276
|
+
const l = x(f.clientY);
|
|
277
|
+
c?.(l);
|
|
278
|
+
},
|
|
279
|
+
onSlideMove: (f) => {
|
|
280
|
+
const l = x(f.clientY);
|
|
281
|
+
r?.(l);
|
|
282
|
+
},
|
|
283
|
+
onSlideEnd: () => {
|
|
284
|
+
h.current = void 0, s?.();
|
|
285
|
+
},
|
|
286
|
+
onStepKeyDown: (f) => {
|
|
287
|
+
const m = Z[w ? "from-bottom" : "from-top"].includes(f.key);
|
|
288
|
+
u?.({ event: f, direction: m ? -1 : 1 });
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
), re = d.forwardRef(
|
|
296
|
+
(e, t) => {
|
|
297
|
+
const {
|
|
298
|
+
__scopeSlider: o,
|
|
299
|
+
onSlideStart: n,
|
|
300
|
+
onSlideMove: i,
|
|
301
|
+
onSlideEnd: c,
|
|
302
|
+
onHomeKeyDown: r,
|
|
303
|
+
onEndKeyDown: s,
|
|
304
|
+
onStepKeyDown: u,
|
|
305
|
+
...g
|
|
306
|
+
} = e, v = k(z, o);
|
|
307
|
+
return /* @__PURE__ */ b(
|
|
308
|
+
B.span,
|
|
309
|
+
{
|
|
310
|
+
...g,
|
|
311
|
+
ref: t,
|
|
312
|
+
onKeyDown: A(e.onKeyDown, (a) => {
|
|
313
|
+
a.key === "Home" ? (r(a), a.preventDefault()) : a.key === "End" ? (s(a), a.preventDefault()) : J.concat(Q).includes(a.key) && (u(a), a.preventDefault());
|
|
314
|
+
}),
|
|
315
|
+
onPointerDown: A(e.onPointerDown, (a) => {
|
|
316
|
+
const h = a.target;
|
|
317
|
+
h.setPointerCapture(a.pointerId), a.preventDefault(), v.thumbs.has(h) ? h.focus() : n(a);
|
|
318
|
+
}),
|
|
319
|
+
onPointerMove: A(e.onPointerMove, (a) => {
|
|
320
|
+
a.target.hasPointerCapture(a.pointerId) && i(a);
|
|
321
|
+
}),
|
|
322
|
+
onPointerUp: A(e.onPointerUp, (a) => {
|
|
323
|
+
const h = a.target;
|
|
324
|
+
h.hasPointerCapture(a.pointerId) && (h.releasePointerCapture(a.pointerId), c(a));
|
|
325
|
+
})
|
|
326
|
+
}
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
), ie = "SliderTrack", se = d.forwardRef(
|
|
330
|
+
(e, t) => {
|
|
331
|
+
const { __scopeSlider: o, ...n } = e, i = k(ie, o);
|
|
332
|
+
return /* @__PURE__ */ b(
|
|
333
|
+
B.span,
|
|
334
|
+
{
|
|
335
|
+
"data-disabled": i.disabled ? "" : void 0,
|
|
336
|
+
"data-orientation": i.orientation,
|
|
337
|
+
...n,
|
|
338
|
+
ref: t
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
se.displayName = ie;
|
|
344
|
+
var U = "SliderRange", ae = d.forwardRef(
|
|
345
|
+
(e, t) => {
|
|
346
|
+
const { __scopeSlider: o, ...n } = e, i = k(U, o), c = ne(U, o), r = d.useRef(null), s = E(t, r), u = i.values.length, g = i.values.map(
|
|
347
|
+
(h) => de(h, i.min, i.max)
|
|
348
|
+
), v = u > 1 ? Math.min(...g) : 0, a = 100 - Math.max(...g);
|
|
349
|
+
return /* @__PURE__ */ b(
|
|
350
|
+
B.span,
|
|
351
|
+
{
|
|
352
|
+
"data-orientation": i.orientation,
|
|
353
|
+
"data-disabled": i.disabled ? "" : void 0,
|
|
354
|
+
...n,
|
|
355
|
+
ref: s,
|
|
356
|
+
style: {
|
|
357
|
+
...e.style,
|
|
358
|
+
[c.startEdge]: v + "%",
|
|
359
|
+
[c.endEdge]: a + "%"
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
ae.displayName = U;
|
|
366
|
+
var F = "SliderThumb", ce = d.forwardRef(
|
|
367
|
+
(e, t) => {
|
|
368
|
+
const o = we(e.__scopeSlider), [n, i] = d.useState(null), c = E(t, (s) => i(s)), r = d.useMemo(
|
|
369
|
+
() => n ? o().findIndex((s) => s.ref.current === n) : -1,
|
|
370
|
+
[o, n]
|
|
371
|
+
);
|
|
372
|
+
return /* @__PURE__ */ b(Pe, { ...e, ref: c, index: r });
|
|
373
|
+
}
|
|
374
|
+
), Pe = d.forwardRef(
|
|
375
|
+
(e, t) => {
|
|
376
|
+
const { __scopeSlider: o, index: n, name: i, ...c } = e, r = k(F, o), s = ne(F, o), [u, g] = d.useState(null), v = E(t, (R) => g(R)), a = u ? r.form || !!u.closest("form") : !0, h = ve(u), w = r.values[n], x = w === void 0 ? 0 : de(w, r.min, r.max), f = De(n, r.values.length), l = h?.[s.size], m = l ? Ie(l, x, s.direction) : 0;
|
|
377
|
+
return d.useEffect(() => {
|
|
378
|
+
if (u)
|
|
379
|
+
return r.thumbs.add(u), () => {
|
|
380
|
+
r.thumbs.delete(u);
|
|
381
|
+
};
|
|
382
|
+
}, [u, r.thumbs]), /* @__PURE__ */ X(
|
|
383
|
+
"span",
|
|
384
|
+
{
|
|
385
|
+
style: {
|
|
386
|
+
transform: "var(--radix-slider-thumb-transform)",
|
|
387
|
+
position: "absolute",
|
|
388
|
+
[s.startEdge]: `calc(${x}% + ${m}px)`
|
|
389
|
+
},
|
|
390
|
+
children: [
|
|
391
|
+
/* @__PURE__ */ b(L.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ b(
|
|
392
|
+
B.span,
|
|
393
|
+
{
|
|
394
|
+
role: "slider",
|
|
395
|
+
"aria-label": e["aria-label"] || f,
|
|
396
|
+
"aria-valuemin": r.min,
|
|
397
|
+
"aria-valuenow": w,
|
|
398
|
+
"aria-valuemax": r.max,
|
|
399
|
+
"aria-orientation": r.orientation,
|
|
400
|
+
"data-orientation": r.orientation,
|
|
401
|
+
"data-disabled": r.disabled ? "" : void 0,
|
|
402
|
+
tabIndex: r.disabled ? void 0 : 0,
|
|
403
|
+
...c,
|
|
404
|
+
ref: v,
|
|
405
|
+
style: w === void 0 ? { display: "none" } : e.style,
|
|
406
|
+
onFocus: A(e.onFocus, () => {
|
|
407
|
+
r.valueIndexToChangeRef.current = n;
|
|
408
|
+
})
|
|
409
|
+
}
|
|
410
|
+
) }),
|
|
411
|
+
a && /* @__PURE__ */ b(
|
|
412
|
+
le,
|
|
413
|
+
{
|
|
414
|
+
name: i ?? (r.name ? r.name + (r.values.length > 1 ? "[]" : "") : void 0),
|
|
415
|
+
form: r.form,
|
|
416
|
+
value: w
|
|
417
|
+
},
|
|
418
|
+
n
|
|
419
|
+
)
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
ce.displayName = F;
|
|
426
|
+
var Ee = "RadioBubbleInput", le = d.forwardRef(
|
|
427
|
+
({ __scopeSlider: e, value: t, ...o }, n) => {
|
|
428
|
+
const i = d.useRef(null), c = E(i, n), r = ge(t);
|
|
429
|
+
return d.useEffect(() => {
|
|
430
|
+
const s = i.current;
|
|
431
|
+
if (!s) return;
|
|
432
|
+
const u = window.HTMLInputElement.prototype, v = Object.getOwnPropertyDescriptor(u, "value").set;
|
|
433
|
+
if (r !== t && v) {
|
|
434
|
+
const a = new Event("input", { bubbles: !0 });
|
|
435
|
+
v.call(s, t), s.dispatchEvent(a);
|
|
436
|
+
}
|
|
437
|
+
}, [r, t]), /* @__PURE__ */ b(
|
|
438
|
+
B.input,
|
|
439
|
+
{
|
|
440
|
+
style: { display: "none" },
|
|
441
|
+
...o,
|
|
442
|
+
ref: c,
|
|
443
|
+
defaultValue: t
|
|
444
|
+
}
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
le.displayName = Ee;
|
|
449
|
+
function Me(e = [], t, o) {
|
|
450
|
+
const n = [...e];
|
|
451
|
+
return n[o] = t, n.sort((i, c) => i - c);
|
|
452
|
+
}
|
|
453
|
+
function de(e, t, o) {
|
|
454
|
+
const c = 100 / (o - t) * (e - t);
|
|
455
|
+
return q(c, [0, 100]);
|
|
456
|
+
}
|
|
457
|
+
function De(e, t) {
|
|
458
|
+
return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
|
|
459
|
+
}
|
|
460
|
+
function _e(e, t) {
|
|
461
|
+
if (e.length === 1) return 0;
|
|
462
|
+
const o = e.map((i) => Math.abs(i - t)), n = Math.min(...o);
|
|
463
|
+
return o.indexOf(n);
|
|
464
|
+
}
|
|
465
|
+
function Ie(e, t, o) {
|
|
466
|
+
const n = e / 2, c = Y([0, 50], [0, n]);
|
|
467
|
+
return (n - c(t) * o) * o;
|
|
468
|
+
}
|
|
469
|
+
function Ae(e) {
|
|
470
|
+
return e.slice(0, -1).map((t, o) => e[o + 1] - t);
|
|
471
|
+
}
|
|
472
|
+
function ze(e, t) {
|
|
473
|
+
if (t > 0) {
|
|
474
|
+
const o = Ae(e);
|
|
475
|
+
return Math.min(...o) >= t;
|
|
476
|
+
}
|
|
477
|
+
return !0;
|
|
478
|
+
}
|
|
479
|
+
function Y(e, t) {
|
|
480
|
+
return (o) => {
|
|
481
|
+
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
482
|
+
const n = (t[1] - t[0]) / (e[1] - e[0]);
|
|
483
|
+
return t[0] + n * (o - e[0]);
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function Te(e) {
|
|
487
|
+
return (String(e).split(".")[1] || "").length;
|
|
488
|
+
}
|
|
489
|
+
function Ne(e, t) {
|
|
490
|
+
const o = Math.pow(10, t);
|
|
491
|
+
return Math.round(e * o) / o;
|
|
492
|
+
}
|
|
493
|
+
var Ke = te, Be = se, ke = ae, Ve = ce;
|
|
494
|
+
function Ye({
|
|
495
|
+
className: e,
|
|
496
|
+
defaultValue: t,
|
|
497
|
+
value: o,
|
|
498
|
+
min: n = 0,
|
|
499
|
+
max: i = 100,
|
|
500
|
+
step: c = 1,
|
|
501
|
+
minStepsBetweenThumbs: r = 1,
|
|
502
|
+
onValueChange: s,
|
|
503
|
+
orientation: u = "horizontal",
|
|
504
|
+
onValueCommit: g,
|
|
505
|
+
disabled: v,
|
|
506
|
+
name: a,
|
|
507
|
+
...h
|
|
24
508
|
}) {
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
509
|
+
const w = o || t || [n];
|
|
510
|
+
return /* @__PURE__ */ X(
|
|
511
|
+
Ke,
|
|
28
512
|
{
|
|
29
513
|
"data-slot": "slider",
|
|
30
|
-
defaultValue,
|
|
31
|
-
value,
|
|
32
|
-
min,
|
|
33
|
-
max,
|
|
34
|
-
step,
|
|
35
|
-
minStepsBetweenThumbs,
|
|
36
|
-
onValueChange,
|
|
37
|
-
orientation,
|
|
38
|
-
onValueCommit,
|
|
39
|
-
disabled,
|
|
40
|
-
name,
|
|
41
|
-
className:
|
|
514
|
+
defaultValue: t,
|
|
515
|
+
value: o,
|
|
516
|
+
min: n,
|
|
517
|
+
max: i,
|
|
518
|
+
step: c,
|
|
519
|
+
minStepsBetweenThumbs: r,
|
|
520
|
+
onValueChange: s,
|
|
521
|
+
orientation: u,
|
|
522
|
+
onValueCommit: g,
|
|
523
|
+
disabled: v,
|
|
524
|
+
name: a,
|
|
525
|
+
className: H(
|
|
42
526
|
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
43
|
-
|
|
527
|
+
e
|
|
44
528
|
),
|
|
45
|
-
...
|
|
529
|
+
...h,
|
|
46
530
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
531
|
+
/* @__PURE__ */ b(
|
|
532
|
+
Be,
|
|
49
533
|
{
|
|
50
534
|
"data-slot": "slider-track",
|
|
51
|
-
className:
|
|
535
|
+
className: H(
|
|
52
536
|
"bg-slider-track relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
53
537
|
),
|
|
54
|
-
children: /* @__PURE__ */
|
|
55
|
-
|
|
538
|
+
children: /* @__PURE__ */ b(
|
|
539
|
+
ke,
|
|
56
540
|
{
|
|
57
541
|
"data-slot": "slider-range",
|
|
58
|
-
className:
|
|
542
|
+
className: H(
|
|
59
543
|
"bg-slider-range absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
60
544
|
)
|
|
61
545
|
}
|
|
62
546
|
)
|
|
63
547
|
}
|
|
64
548
|
),
|
|
65
|
-
Array.from({ length:
|
|
66
|
-
|
|
549
|
+
Array.from({ length: w.length }, (x, f) => /* @__PURE__ */ b(
|
|
550
|
+
Ve,
|
|
67
551
|
{
|
|
68
552
|
"data-slot": "slider-thumb",
|
|
69
553
|
className: "border-slider-thumb-border bg-slider-thumb-bg ring-slider-thumb-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
70
554
|
},
|
|
71
|
-
|
|
555
|
+
f
|
|
72
556
|
))
|
|
73
557
|
]
|
|
74
558
|
}
|
|
75
559
|
);
|
|
76
560
|
}
|
|
77
561
|
export {
|
|
78
|
-
Slider
|
|
562
|
+
Ye as Slider
|
|
79
563
|
};
|