@spear-ai/spectral 1.9.1 → 1.10.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/README.md +6 -5
- package/dist/.js +112 -239
- package/dist/Accordion-CDXdSAST.js +363 -0
- package/dist/Accordion.js +3 -498
- package/dist/Alert/AlertBase.js +69 -152
- package/dist/Alert.js +58 -106
- package/dist/AnimatePresence-D-9jXfgI.js +178 -0
- package/dist/App.js +6 -6
- package/dist/Avatar.js +83 -65
- package/dist/Badge.d.ts +1 -3
- package/dist/Badge.js +21 -25
- package/dist/Button.js +102 -178
- package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
- package/dist/ButtonGroup.js +55 -59
- package/dist/ButtonIcon.js +58 -134
- package/dist/Calendar-s4lyijkn.js +3109 -0
- package/dist/Checkbox/CheckboxBase.js +94 -126
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.js +40 -105
- package/dist/Combobox/ComboboxBase.js +2 -79
- package/dist/Combobox.js +106 -172
- package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
- package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
- package/dist/ControlGroup/ControlGroupSelect.js +85 -101
- package/dist/ControlGroup.js +45 -48
- package/dist/DataCard/Card.js +37 -12
- package/dist/DataCard.d.ts +1 -1
- package/dist/DataCard.js +36 -16
- package/dist/DateTimePicker/Calendar.js +2 -2967
- package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
- package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -275
- package/dist/DateTimePicker/DateTimeInput.d.ts +1 -1
- package/dist/DateTimePicker/DateTimeInput.js +133 -141
- package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
- package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
- package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
- package/dist/DateTimePicker/TimePicker.d.ts +1 -1
- package/dist/DateTimePicker/TimePicker.js +76 -60
- package/dist/DateTimePicker.d.ts +2 -2
- package/dist/DateTimePicker.js +87 -205
- package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
- package/dist/Dialog.js +74 -74
- package/dist/Drawer.js +67 -37
- package/dist/HoverCard-CYDsIiVK.js +201 -0
- package/dist/HoverCard.d.ts +1 -1
- package/dist/HoverCard.js +2 -218
- package/dist/Icons/AnalyzeIcon.js +50 -57
- package/dist/Icons/AnnotationsIcon.js +20 -15
- package/dist/Icons/ApprovedIcon.js +26 -18
- package/dist/Icons/ArrowDownIcon.js +20 -6
- package/dist/Icons/ArrowUpIcon.js +20 -6
- package/dist/Icons/BoxToolIcon.js +17 -12
- package/dist/Icons/CalendarIcon.js +43 -20
- package/dist/Icons/CheckCircleIcon.js +26 -10
- package/dist/Icons/CheckSquareIcon.js +26 -10
- package/dist/Icons/CheckmarkIcon.js +22 -9
- package/dist/Icons/ChevronDownIcon.js +22 -9
- package/dist/Icons/ChevronUpIcon.js +22 -9
- package/dist/Icons/ClockIcon.js +26 -18
- package/dist/Icons/CloseCircleIcon.js +26 -10
- package/dist/Icons/CloseIcon.js +18 -9
- package/dist/Icons/DashboardIcon.js +36 -10
- package/dist/Icons/DatabaseIcon.js +36 -19
- package/dist/Icons/DeleteIcon.js +36 -19
- package/dist/Icons/DurationIcon.js +57 -22
- package/dist/Icons/EditIcon.js +26 -27
- package/dist/Icons/EmailIcon.js +26 -10
- package/dist/Icons/EraserIcon.js +41 -25
- package/dist/Icons/ErrorIcon.js +27 -11
- package/dist/Icons/EyeClosedIcon.js +29 -13
- package/dist/Icons/EyeClosedIcon2.js +27 -11
- package/dist/Icons/EyeOpenIcon.js +22 -9
- package/dist/Icons/FileDownloadIcon.js +43 -20
- package/dist/Icons/GoToFirstIcon.js +26 -9
- package/dist/Icons/GoToLastIcon.js +26 -9
- package/dist/Icons/HarmonicCursorsIcon.js +23 -9
- package/dist/Icons/IconBase.d.ts +3 -3
- package/dist/Icons/IconBase.js +49 -66
- package/dist/Icons/InfoIcon.js +36 -10
- package/dist/Icons/KeyboardIcon.js +26 -27
- package/dist/Icons/LabelIcon.js +19 -14
- package/dist/Icons/LassoIcon.js +36 -28
- package/dist/Icons/LineToolIcon.js +48 -39
- package/dist/Icons/LiveViewIcon.js +50 -12
- package/dist/Icons/LoaderIcon.js +67 -27
- package/dist/Icons/LocationIcon.js +26 -27
- package/dist/Icons/LogoutIcon.js +20 -15
- package/dist/Icons/MeasureIcon.js +78 -25
- package/dist/Icons/MessagesIcon.js +33 -18
- package/dist/Icons/MetadataIcon.js +20 -15
- package/dist/Icons/MinusIcon.d.ts +1 -1
- package/dist/Icons/MinusIcon.js +18 -6
- package/dist/Icons/OntologyIcon.js +87 -71
- package/dist/Icons/PanelIconClose.js +28 -10
- package/dist/Icons/PanelIconOpen.js +28 -10
- package/dist/Icons/PlayIcon.js +20 -6
- package/dist/Icons/PlusIcon.js +20 -14
- package/dist/Icons/PolygonIcon.js +50 -39
- package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
- package/dist/Icons/ProgressCheckIcon.js +58 -0
- package/dist/Icons/ResetIcon.js +17 -12
- package/dist/Icons/ReviewedIcon.js +36 -19
- package/dist/Icons/ScissorsIcon.js +22 -17
- package/dist/Icons/SearchIcon.js +26 -9
- package/dist/Icons/SettingsIcon.js +26 -27
- package/dist/Icons/SortAscendingIcon.js +50 -12
- package/dist/Icons/SortAtoZIcon.js +50 -12
- package/dist/Icons/SortDescendingIcon.js +50 -12
- package/dist/Icons/SortZtoAIcon.js +50 -12
- package/dist/Icons/StackIcon.js +26 -9
- package/dist/Icons/StarIcon.js +20 -6
- package/dist/Icons/TrashIcon.js +17 -12
- package/dist/Icons/UndoIcon.js +20 -15
- package/dist/Icons/User2Icon.js +26 -10
- package/dist/Icons/UserIcon.js +19 -14
- package/dist/Icons/WarningIcon.js +19 -14
- package/dist/Icons/ZoomAllIcon.js +71 -15
- package/dist/Icons/ZoomXIcon.js +36 -10
- package/dist/Icons/ZoomYIcon.js +36 -10
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Icons.js +68 -136
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
- package/dist/IconsAnimated.js +3 -6
- package/dist/Input/InputUtils.js +51 -52
- package/dist/Input.js +132 -185
- package/dist/InputOTP-XUWW9xcI.js +461 -0
- package/dist/InputOTP.js +2 -382
- package/dist/Kbd.d.ts +1 -1
- package/dist/Kbd.js +182 -86
- package/dist/Label.js +12 -14
- package/dist/MultiSelect/MultiSelectBase.js +331 -403
- package/dist/MultiSelect.d.ts +1 -1
- package/dist/MultiSelect.js +23 -23
- package/dist/Popover.js +28 -32
- package/dist/RadioButton.d.ts +17 -0
- package/dist/RadioButton.js +33 -0
- package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
- package/dist/RadioButtonGroup.d.ts +1 -1
- package/dist/RadioButtonGroup.js +11 -8
- package/dist/RadioGroup-w_q6RGEK.js +447 -0
- package/dist/RadioGroup.js +2 -505
- package/dist/Select.js +163 -186
- package/dist/Separator.js +16 -19
- package/dist/Skeleton.js +10 -6
- package/dist/Slider-BzzZT3Zm.js +490 -0
- package/dist/Slider.js +2 -562
- package/dist/SpectralProvider.js +8 -5
- package/dist/Switch/SwitchBase.js +91 -95
- package/dist/Switch-CVzRJ-0n.js +126 -0
- package/dist/Switch.d.ts +1 -1
- package/dist/Switch.js +2 -134
- package/dist/Tabs/TabsBase.js +242 -250
- package/dist/Tabs/tabsUtils.js +65 -73
- package/dist/Tabs.d.ts +1 -1
- package/dist/Tabs.js +73 -103
- package/dist/Textarea/TextareaUtils.js +35 -46
- package/dist/Textarea.js +83 -160
- package/dist/Toast-9zqXxKKO.js +711 -0
- package/dist/Toast.js +2 -885
- package/dist/Toggle/ToggleBase.js +46 -56
- package/dist/Toggle.d.ts +1 -1
- package/dist/Toggle.js +52 -62
- package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
- package/dist/ToggleGroup.d.ts +1 -1
- package/dist/ToggleGroup.js +52 -63
- package/dist/Tooltip-D1K8kY1y.js +389 -0
- package/dist/Tooltip.js +2 -365
- package/dist/Tray.js +174 -217
- package/dist/chunk-h9knIhTc.js +20 -0
- package/dist/clsx-jM1GlMvB.js +16 -0
- package/dist/dist-3Af8168y.js +913 -0
- package/dist/dist-7HRQ5IKN.js +249 -0
- package/dist/dist-B2k1iWFp.js +129 -0
- package/dist/dist-B4FgboI8.js +122 -0
- package/dist/dist-B4g6zpUF.js +33 -0
- package/dist/dist-B9tup-4O.js +216 -0
- package/dist/dist-BK1K0g9W.js +29 -0
- package/dist/dist-Bfjk-jx9.js +28 -0
- package/dist/dist-Bft31cJh.js +65 -0
- package/dist/dist-BtdmHAzK.js +190 -0
- package/dist/dist-C0Hifjgh.js +1287 -0
- package/dist/dist-CGzgmYB9.js +68 -0
- package/dist/dist-ClmepHp4.js +10 -0
- package/dist/dist-D8Wb_MX9.js +6 -0
- package/dist/dist-Dtvmk11N.js +12 -0
- package/dist/dist-fW81qjVl.js +677 -0
- package/dist/dist-s1uWaZYZ.js +11 -0
- package/dist/es2015-YHaMV-St.js +701 -0
- package/dist/hooks/useAccordionAutoScroll.js +66 -67
- package/dist/hooks/useControllableState.js +14 -13
- package/dist/hooks/useTheme.js +21 -17
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/main.js +18954 -27224
- package/dist/primitives/button.js +39 -41
- package/dist/primitives/input-group.js +57 -73
- package/dist/primitives/input.js +11 -20
- package/dist/primitives/popover.js +34 -28
- package/dist/primitives/select.js +70 -138
- package/dist/primitives/slot.js +32 -31
- package/dist/primitives/textarea.js +10 -16
- package/dist/proxy-Dn10Pl_g.js +4920 -0
- package/dist/styles/main.css +2 -1
- package/dist/styles/spectral.css +1 -1
- package/dist/twUtils-VNWgstKL.js +1673 -0
- package/dist/use-animation-CBUDycyW.js +57 -0
- package/dist/utils/constants.js +4 -4
- package/dist/utils/formFieldUtils.js +136 -148
- package/dist/utils/sharedUtils.js +26 -7
- package/dist/utils/twUtils.js +2 -2919
- package/package.json +24 -28
- package/dist/ComboboxBase-CxNxYtdT.js +0 -408
- package/dist/clsx-OuTLNxxd.js +0 -16
- package/dist/index-0ioNhtNM.js +0 -10
- package/dist/index-6oYKCvIn.js +0 -677
- package/dist/index-BFOf48AQ.js +0 -69
- package/dist/index-BZPx6jYI.js +0 -8
- package/dist/index-BlHU_t18.js +0 -142
- package/dist/index-Bm1RbF6w.js +0 -1037
- package/dist/index-Bv2OIg5P.js +0 -225
- package/dist/index-CKEI0pDv.js +0 -56
- package/dist/index-CM_hWgfC.js +0 -32
- package/dist/index-C_YVr64u.js +0 -1538
- package/dist/index-Cl8VeY0o.js +0 -149
- package/dist/index-CwSyIPrv.js +0 -13
- package/dist/index-D29mdTf5.js +0 -34
- package/dist/index-DEYs15GP.js +0 -66
- package/dist/index-Dc0No4pV.js +0 -233
- package/dist/index-T6XEa11q.js +0 -822
- package/dist/index-pBCLb6Gr.js +0 -240
- package/dist/index-psiVrsnE.js +0 -27
- package/dist/index-rKs9bXHr.js +0 -6
- package/dist/proxy-CO_-Vget.js +0 -4975
- package/dist/use-animation-DhEPRwZ3.js +0 -62
package/dist/Slider.js
CHANGED
|
@@ -1,562 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { jsx as m, jsxs as X } from "react/jsx-runtime";
|
|
4
|
-
import { Input as Q } from "./primitives/input.js";
|
|
5
|
-
import * as p from "react";
|
|
6
|
-
import { useMemo as Se, useState as Z, useEffect as ge, useCallback as U } from "react";
|
|
7
|
-
import { c as te } from "./index-rKs9bXHr.js";
|
|
8
|
-
import { e as ve, c as N, P as L, u as T, a as be } from "./index-Dc0No4pV.js";
|
|
9
|
-
import { c as we, u as ye } from "./index-CKEI0pDv.js";
|
|
10
|
-
import { u as xe } from "./index-BZPx6jYI.js";
|
|
11
|
-
import { u as Re } from "./index-psiVrsnE.js";
|
|
12
|
-
import { cn as ee } from "./utils/twUtils.js";
|
|
13
|
-
var ne = ["PageUp", "PageDown"], re = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], oe = {
|
|
14
|
-
"from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
15
|
-
"from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
|
|
16
|
-
"from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
17
|
-
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
18
|
-
}, z = "Slider", [G, De, Ee] = we(z), [ae] = be(z, [
|
|
19
|
-
Ee
|
|
20
|
-
]), [Pe, $] = ae(z), ie = p.forwardRef(
|
|
21
|
-
(e, t) => {
|
|
22
|
-
const {
|
|
23
|
-
name: r,
|
|
24
|
-
min: n = 0,
|
|
25
|
-
max: s = 100,
|
|
26
|
-
step: c = 1,
|
|
27
|
-
orientation: o = "horizontal",
|
|
28
|
-
disabled: a = !1,
|
|
29
|
-
minStepsBetweenThumbs: d = 0,
|
|
30
|
-
defaultValue: h = [n],
|
|
31
|
-
value: w,
|
|
32
|
-
onValueChange: i = () => {
|
|
33
|
-
},
|
|
34
|
-
onValueCommit: f = () => {
|
|
35
|
-
},
|
|
36
|
-
inverted: y = !1,
|
|
37
|
-
form: b,
|
|
38
|
-
...S
|
|
39
|
-
} = e, g = p.useRef(/* @__PURE__ */ new Set()), v = p.useRef(0), R = o === "horizontal" ? Ce : Me, [l = [], D] = ve({
|
|
40
|
-
prop: w,
|
|
41
|
-
defaultProp: h,
|
|
42
|
-
onChange: (x) => {
|
|
43
|
-
[...g.current][v.current]?.focus(), i(x);
|
|
44
|
-
}
|
|
45
|
-
}), I = p.useRef(l);
|
|
46
|
-
function k(x) {
|
|
47
|
-
const C = ke(l, x);
|
|
48
|
-
A(x, C);
|
|
49
|
-
}
|
|
50
|
-
function O(x) {
|
|
51
|
-
A(x, v.current);
|
|
52
|
-
}
|
|
53
|
-
function V() {
|
|
54
|
-
const x = I.current[v.current];
|
|
55
|
-
l[v.current] !== x && f(l);
|
|
56
|
-
}
|
|
57
|
-
function A(x, C, { commit: B } = { commit: !1 }) {
|
|
58
|
-
const F = ze(c), H = Be(Math.round((x - n) / c) * c + n, F), K = te(H, [n, s]);
|
|
59
|
-
D((M = []) => {
|
|
60
|
-
const u = Ae(M, K, C);
|
|
61
|
-
if (Te(u, d * c)) {
|
|
62
|
-
v.current = u.indexOf(K);
|
|
63
|
-
const E = String(u) !== String(M);
|
|
64
|
-
return E && B && f(u), E ? u : M;
|
|
65
|
-
} else
|
|
66
|
-
return M;
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return /* @__PURE__ */ m(
|
|
70
|
-
Pe,
|
|
71
|
-
{
|
|
72
|
-
scope: e.__scopeSlider,
|
|
73
|
-
name: r,
|
|
74
|
-
disabled: a,
|
|
75
|
-
min: n,
|
|
76
|
-
max: s,
|
|
77
|
-
valueIndexToChangeRef: v,
|
|
78
|
-
thumbs: g.current,
|
|
79
|
-
values: l,
|
|
80
|
-
orientation: o,
|
|
81
|
-
form: b,
|
|
82
|
-
children: /* @__PURE__ */ m(G.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ m(G.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ m(
|
|
83
|
-
R,
|
|
84
|
-
{
|
|
85
|
-
"aria-disabled": a,
|
|
86
|
-
"data-disabled": a ? "" : void 0,
|
|
87
|
-
...S,
|
|
88
|
-
ref: t,
|
|
89
|
-
onPointerDown: N(S.onPointerDown, () => {
|
|
90
|
-
a || (I.current = l);
|
|
91
|
-
}),
|
|
92
|
-
min: n,
|
|
93
|
-
max: s,
|
|
94
|
-
inverted: y,
|
|
95
|
-
onSlideStart: a ? void 0 : k,
|
|
96
|
-
onSlideMove: a ? void 0 : O,
|
|
97
|
-
onSlideEnd: a ? void 0 : V,
|
|
98
|
-
onHomeKeyDown: () => !a && A(n, 0, { commit: !0 }),
|
|
99
|
-
onEndKeyDown: () => !a && A(s, l.length - 1, { commit: !0 }),
|
|
100
|
-
onStepKeyDown: ({ event: x, direction: C }) => {
|
|
101
|
-
if (!a) {
|
|
102
|
-
const H = ne.includes(x.key) || x.shiftKey && re.includes(x.key) ? 10 : 1, K = v.current, M = l[K], u = c * H * C;
|
|
103
|
-
A(M + u, K, { commit: !0 });
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
) }) })
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
ie.displayName = z;
|
|
113
|
-
var [se, le] = ae(z, {
|
|
114
|
-
startEdge: "left",
|
|
115
|
-
endEdge: "right",
|
|
116
|
-
size: "width",
|
|
117
|
-
direction: 1
|
|
118
|
-
}), Ce = p.forwardRef(
|
|
119
|
-
(e, t) => {
|
|
120
|
-
const {
|
|
121
|
-
min: r,
|
|
122
|
-
max: n,
|
|
123
|
-
dir: s,
|
|
124
|
-
inverted: c,
|
|
125
|
-
onSlideStart: o,
|
|
126
|
-
onSlideMove: a,
|
|
127
|
-
onSlideEnd: d,
|
|
128
|
-
onStepKeyDown: h,
|
|
129
|
-
...w
|
|
130
|
-
} = e, [i, f] = p.useState(null), y = T(t, (R) => f(R)), b = p.useRef(void 0), S = ye(s), g = S === "ltr", v = g && !c || !g && c;
|
|
131
|
-
function _(R) {
|
|
132
|
-
const l = b.current || i.getBoundingClientRect(), D = [0, l.width], k = J(D, v ? [r, n] : [n, r]);
|
|
133
|
-
return b.current = l, k(R - l.left);
|
|
134
|
-
}
|
|
135
|
-
return /* @__PURE__ */ m(
|
|
136
|
-
se,
|
|
137
|
-
{
|
|
138
|
-
scope: e.__scopeSlider,
|
|
139
|
-
startEdge: v ? "left" : "right",
|
|
140
|
-
endEdge: v ? "right" : "left",
|
|
141
|
-
direction: v ? 1 : -1,
|
|
142
|
-
size: "width",
|
|
143
|
-
children: /* @__PURE__ */ m(
|
|
144
|
-
ce,
|
|
145
|
-
{
|
|
146
|
-
dir: S,
|
|
147
|
-
"data-orientation": "horizontal",
|
|
148
|
-
...w,
|
|
149
|
-
ref: y,
|
|
150
|
-
style: {
|
|
151
|
-
...w.style,
|
|
152
|
-
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
153
|
-
},
|
|
154
|
-
onSlideStart: (R) => {
|
|
155
|
-
const l = _(R.clientX);
|
|
156
|
-
o?.(l);
|
|
157
|
-
},
|
|
158
|
-
onSlideMove: (R) => {
|
|
159
|
-
const l = _(R.clientX);
|
|
160
|
-
a?.(l);
|
|
161
|
-
},
|
|
162
|
-
onSlideEnd: () => {
|
|
163
|
-
b.current = void 0, d?.();
|
|
164
|
-
},
|
|
165
|
-
onStepKeyDown: (R) => {
|
|
166
|
-
const D = oe[v ? "from-left" : "from-right"].includes(R.key);
|
|
167
|
-
h?.({ event: R, direction: D ? -1 : 1 });
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
)
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
), Me = p.forwardRef(
|
|
175
|
-
(e, t) => {
|
|
176
|
-
const {
|
|
177
|
-
min: r,
|
|
178
|
-
max: n,
|
|
179
|
-
inverted: s,
|
|
180
|
-
onSlideStart: c,
|
|
181
|
-
onSlideMove: o,
|
|
182
|
-
onSlideEnd: a,
|
|
183
|
-
onStepKeyDown: d,
|
|
184
|
-
...h
|
|
185
|
-
} = e, w = p.useRef(null), i = T(t, w), f = p.useRef(void 0), y = !s;
|
|
186
|
-
function b(S) {
|
|
187
|
-
const g = f.current || w.current.getBoundingClientRect(), v = [0, g.height], R = J(v, y ? [n, r] : [r, n]);
|
|
188
|
-
return f.current = g, R(S - g.top);
|
|
189
|
-
}
|
|
190
|
-
return /* @__PURE__ */ m(
|
|
191
|
-
se,
|
|
192
|
-
{
|
|
193
|
-
scope: e.__scopeSlider,
|
|
194
|
-
startEdge: y ? "bottom" : "top",
|
|
195
|
-
endEdge: y ? "top" : "bottom",
|
|
196
|
-
size: "height",
|
|
197
|
-
direction: y ? 1 : -1,
|
|
198
|
-
children: /* @__PURE__ */ m(
|
|
199
|
-
ce,
|
|
200
|
-
{
|
|
201
|
-
"data-orientation": "vertical",
|
|
202
|
-
...h,
|
|
203
|
-
ref: i,
|
|
204
|
-
style: {
|
|
205
|
-
...h.style,
|
|
206
|
-
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
207
|
-
},
|
|
208
|
-
onSlideStart: (S) => {
|
|
209
|
-
const g = b(S.clientY);
|
|
210
|
-
c?.(g);
|
|
211
|
-
},
|
|
212
|
-
onSlideMove: (S) => {
|
|
213
|
-
const g = b(S.clientY);
|
|
214
|
-
o?.(g);
|
|
215
|
-
},
|
|
216
|
-
onSlideEnd: () => {
|
|
217
|
-
f.current = void 0, a?.();
|
|
218
|
-
},
|
|
219
|
-
onStepKeyDown: (S) => {
|
|
220
|
-
const v = oe[y ? "from-bottom" : "from-top"].includes(S.key);
|
|
221
|
-
d?.({ event: S, direction: v ? -1 : 1 });
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
), ce = p.forwardRef(
|
|
229
|
-
(e, t) => {
|
|
230
|
-
const {
|
|
231
|
-
__scopeSlider: r,
|
|
232
|
-
onSlideStart: n,
|
|
233
|
-
onSlideMove: s,
|
|
234
|
-
onSlideEnd: c,
|
|
235
|
-
onHomeKeyDown: o,
|
|
236
|
-
onEndKeyDown: a,
|
|
237
|
-
onStepKeyDown: d,
|
|
238
|
-
...h
|
|
239
|
-
} = e, w = $(z, r);
|
|
240
|
-
return /* @__PURE__ */ m(
|
|
241
|
-
L.span,
|
|
242
|
-
{
|
|
243
|
-
...h,
|
|
244
|
-
ref: t,
|
|
245
|
-
onKeyDown: N(e.onKeyDown, (i) => {
|
|
246
|
-
i.key === "Home" ? (o(i), i.preventDefault()) : i.key === "End" ? (a(i), i.preventDefault()) : ne.concat(re).includes(i.key) && (d(i), i.preventDefault());
|
|
247
|
-
}),
|
|
248
|
-
onPointerDown: N(e.onPointerDown, (i) => {
|
|
249
|
-
const f = i.target;
|
|
250
|
-
f.setPointerCapture(i.pointerId), i.preventDefault(), w.thumbs.has(f) ? f.focus() : n(i);
|
|
251
|
-
}),
|
|
252
|
-
onPointerMove: N(e.onPointerMove, (i) => {
|
|
253
|
-
i.target.hasPointerCapture(i.pointerId) && s(i);
|
|
254
|
-
}),
|
|
255
|
-
onPointerUp: N(e.onPointerUp, (i) => {
|
|
256
|
-
const f = i.target;
|
|
257
|
-
f.hasPointerCapture(i.pointerId) && (f.releasePointerCapture(i.pointerId), c(i));
|
|
258
|
-
})
|
|
259
|
-
}
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
), de = "SliderTrack", ue = p.forwardRef(
|
|
263
|
-
(e, t) => {
|
|
264
|
-
const { __scopeSlider: r, ...n } = e, s = $(de, r);
|
|
265
|
-
return /* @__PURE__ */ m(
|
|
266
|
-
L.span,
|
|
267
|
-
{
|
|
268
|
-
"data-disabled": s.disabled ? "" : void 0,
|
|
269
|
-
"data-orientation": s.orientation,
|
|
270
|
-
...n,
|
|
271
|
-
ref: t
|
|
272
|
-
}
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
);
|
|
276
|
-
ue.displayName = de;
|
|
277
|
-
var W = "SliderRange", fe = p.forwardRef(
|
|
278
|
-
(e, t) => {
|
|
279
|
-
const { __scopeSlider: r, ...n } = e, s = $(W, r), c = le(W, r), o = p.useRef(null), a = T(t, o), d = s.values.length, h = s.values.map(
|
|
280
|
-
(f) => he(f, s.min, s.max)
|
|
281
|
-
), w = d > 1 ? Math.min(...h) : 0, i = 100 - Math.max(...h);
|
|
282
|
-
return /* @__PURE__ */ m(
|
|
283
|
-
L.span,
|
|
284
|
-
{
|
|
285
|
-
"data-orientation": s.orientation,
|
|
286
|
-
"data-disabled": s.disabled ? "" : void 0,
|
|
287
|
-
...n,
|
|
288
|
-
ref: a,
|
|
289
|
-
style: {
|
|
290
|
-
...e.style,
|
|
291
|
-
[c.startEdge]: w + "%",
|
|
292
|
-
[c.endEdge]: i + "%"
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
);
|
|
298
|
-
fe.displayName = W;
|
|
299
|
-
var q = "SliderThumb", me = p.forwardRef(
|
|
300
|
-
(e, t) => {
|
|
301
|
-
const r = De(e.__scopeSlider), [n, s] = p.useState(null), c = T(t, (a) => s(a)), o = p.useMemo(
|
|
302
|
-
() => n ? r().findIndex((a) => a.ref.current === n) : -1,
|
|
303
|
-
[r, n]
|
|
304
|
-
);
|
|
305
|
-
return /* @__PURE__ */ m(_e, { ...e, ref: c, index: o });
|
|
306
|
-
}
|
|
307
|
-
), _e = p.forwardRef(
|
|
308
|
-
(e, t) => {
|
|
309
|
-
const { __scopeSlider: r, index: n, name: s, ...c } = e, o = $(q, r), a = le(q, r), [d, h] = p.useState(null), w = T(t, (_) => h(_)), i = d ? o.form || !!d.closest("form") : !0, f = Re(d), y = o.values[n], b = y === void 0 ? 0 : he(y, o.min, o.max), S = Ke(n, o.values.length), g = f?.[a.size], v = g ? Ve(g, b, a.direction) : 0;
|
|
310
|
-
return p.useEffect(() => {
|
|
311
|
-
if (d)
|
|
312
|
-
return o.thumbs.add(d), () => {
|
|
313
|
-
o.thumbs.delete(d);
|
|
314
|
-
};
|
|
315
|
-
}, [d, o.thumbs]), /* @__PURE__ */ X(
|
|
316
|
-
"span",
|
|
317
|
-
{
|
|
318
|
-
style: {
|
|
319
|
-
transform: "var(--radix-slider-thumb-transform)",
|
|
320
|
-
position: "absolute",
|
|
321
|
-
[a.startEdge]: `calc(${b}% + ${v}px)`
|
|
322
|
-
},
|
|
323
|
-
children: [
|
|
324
|
-
/* @__PURE__ */ m(G.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ m(
|
|
325
|
-
L.span,
|
|
326
|
-
{
|
|
327
|
-
role: "slider",
|
|
328
|
-
"aria-label": e["aria-label"] || S,
|
|
329
|
-
"aria-valuemin": o.min,
|
|
330
|
-
"aria-valuenow": y,
|
|
331
|
-
"aria-valuemax": o.max,
|
|
332
|
-
"aria-orientation": o.orientation,
|
|
333
|
-
"data-orientation": o.orientation,
|
|
334
|
-
"data-disabled": o.disabled ? "" : void 0,
|
|
335
|
-
tabIndex: o.disabled ? void 0 : 0,
|
|
336
|
-
...c,
|
|
337
|
-
ref: w,
|
|
338
|
-
style: y === void 0 ? { display: "none" } : e.style,
|
|
339
|
-
onFocus: N(e.onFocus, () => {
|
|
340
|
-
o.valueIndexToChangeRef.current = n;
|
|
341
|
-
})
|
|
342
|
-
}
|
|
343
|
-
) }),
|
|
344
|
-
i && /* @__PURE__ */ m(
|
|
345
|
-
pe,
|
|
346
|
-
{
|
|
347
|
-
name: s ?? (o.name ? o.name + (o.values.length > 1 ? "[]" : "") : void 0),
|
|
348
|
-
form: o.form,
|
|
349
|
-
value: y
|
|
350
|
-
},
|
|
351
|
-
n
|
|
352
|
-
)
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
);
|
|
358
|
-
me.displayName = q;
|
|
359
|
-
var Ie = "RadioBubbleInput", pe = p.forwardRef(
|
|
360
|
-
({ __scopeSlider: e, value: t, ...r }, n) => {
|
|
361
|
-
const s = p.useRef(null), c = T(s, n), o = xe(t);
|
|
362
|
-
return p.useEffect(() => {
|
|
363
|
-
const a = s.current;
|
|
364
|
-
if (!a) return;
|
|
365
|
-
const d = window.HTMLInputElement.prototype, w = Object.getOwnPropertyDescriptor(d, "value").set;
|
|
366
|
-
if (o !== t && w) {
|
|
367
|
-
const i = new Event("input", { bubbles: !0 });
|
|
368
|
-
w.call(a, t), a.dispatchEvent(i);
|
|
369
|
-
}
|
|
370
|
-
}, [o, t]), /* @__PURE__ */ m(
|
|
371
|
-
L.input,
|
|
372
|
-
{
|
|
373
|
-
style: { display: "none" },
|
|
374
|
-
...r,
|
|
375
|
-
ref: c,
|
|
376
|
-
defaultValue: t
|
|
377
|
-
}
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
);
|
|
381
|
-
pe.displayName = Ie;
|
|
382
|
-
function Ae(e = [], t, r) {
|
|
383
|
-
const n = [...e];
|
|
384
|
-
return n[r] = t, n.sort((s, c) => s - c);
|
|
385
|
-
}
|
|
386
|
-
function he(e, t, r) {
|
|
387
|
-
const c = 100 / (r - t) * (e - t);
|
|
388
|
-
return te(c, [0, 100]);
|
|
389
|
-
}
|
|
390
|
-
function Ke(e, t) {
|
|
391
|
-
return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
|
|
392
|
-
}
|
|
393
|
-
function ke(e, t) {
|
|
394
|
-
if (e.length === 1) return 0;
|
|
395
|
-
const r = e.map((s) => Math.abs(s - t)), n = Math.min(...r);
|
|
396
|
-
return r.indexOf(n);
|
|
397
|
-
}
|
|
398
|
-
function Ve(e, t, r) {
|
|
399
|
-
const n = e / 2, c = J([0, 50], [0, n]);
|
|
400
|
-
return (n - c(t) * r) * r;
|
|
401
|
-
}
|
|
402
|
-
function Ne(e) {
|
|
403
|
-
return e.slice(0, -1).map((t, r) => e[r + 1] - t);
|
|
404
|
-
}
|
|
405
|
-
function Te(e, t) {
|
|
406
|
-
if (t > 0) {
|
|
407
|
-
const r = Ne(e);
|
|
408
|
-
return Math.min(...r) >= t;
|
|
409
|
-
}
|
|
410
|
-
return !0;
|
|
411
|
-
}
|
|
412
|
-
function J(e, t) {
|
|
413
|
-
return (r) => {
|
|
414
|
-
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
415
|
-
const n = (t[1] - t[0]) / (e[1] - e[0]);
|
|
416
|
-
return t[0] + n * (r - e[0]);
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
function ze(e) {
|
|
420
|
-
return (String(e).split(".")[1] || "").length;
|
|
421
|
-
}
|
|
422
|
-
function Be(e, t) {
|
|
423
|
-
const r = Math.pow(10, t);
|
|
424
|
-
return Math.round(e * r) / r;
|
|
425
|
-
}
|
|
426
|
-
var He = ie, Le = ue, Oe = fe, Fe = me;
|
|
427
|
-
const Qe = ({ accessibleName: e, className: t, defaultValue: r, disabled: n, inputPosition: s, label: c, labelPosition: o, max: a = 100, min: d = 0, minStepsBetweenThumbs: h = 1, name: w, onValueChange: i, onValueCommit: f, orientation: y = "horizontal", step: b = 1, value: S }) => {
|
|
428
|
-
const g = S !== void 0, v = Se(
|
|
429
|
-
() => Array.isArray(S) ? S : Array.isArray(r) ? r : [d],
|
|
430
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
431
|
-
[]
|
|
432
|
-
), [_, R] = Z(v), l = g ? S : _, [D, I] = Z(() => l.map(String));
|
|
433
|
-
ge(() => {
|
|
434
|
-
I(l.map(String));
|
|
435
|
-
}, [l]);
|
|
436
|
-
const k = U(
|
|
437
|
-
(u) => {
|
|
438
|
-
g || R(u), i?.(u);
|
|
439
|
-
},
|
|
440
|
-
[g, i]
|
|
441
|
-
), O = U(
|
|
442
|
-
(u, E) => {
|
|
443
|
-
const P = [...D];
|
|
444
|
-
P[u] = E.target.value, I(P);
|
|
445
|
-
},
|
|
446
|
-
[D]
|
|
447
|
-
), V = U(
|
|
448
|
-
(u) => {
|
|
449
|
-
const E = D[u];
|
|
450
|
-
if (E === "") {
|
|
451
|
-
I(l.map(String));
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
let P = parseFloat(E);
|
|
455
|
-
if (isNaN(P)) {
|
|
456
|
-
I(l.map(String));
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
P = Math.max(d, Math.min(a, P));
|
|
460
|
-
const Y = [...l];
|
|
461
|
-
if (u === 0 && l.length > 1) {
|
|
462
|
-
const j = l[1] - h * b;
|
|
463
|
-
P = Math.min(P, j);
|
|
464
|
-
} else if (u === 1) {
|
|
465
|
-
const j = l[0] + h * b;
|
|
466
|
-
P = Math.max(P, j);
|
|
467
|
-
}
|
|
468
|
-
Y[u] = P, k(Y), f?.(Y);
|
|
469
|
-
},
|
|
470
|
-
[D, l, d, a, b, h, k, f]
|
|
471
|
-
), A = U(
|
|
472
|
-
(u, E) => {
|
|
473
|
-
E.key === "Enter" && (V(u), E.currentTarget.blur());
|
|
474
|
-
},
|
|
475
|
-
[V]
|
|
476
|
-
), x = y === "vertical", C = o === "both", B = c && (o === "end" || o === "both"), F = s === "start" || s === "both", H = s === "both" && l.length > 1, K = ee("text-slider-label text-sm tabular-nums shrink-0", x ? "text-center" : ""), M = "w-10 h-fit px-1 shrink-0 text-center text-sm tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none";
|
|
477
|
-
return /* @__PURE__ */ X("div", { className: ee("flex items-center gap-3", x ? "flex-col" : "w-full", t), "data-testid": "spectral-slider-container", children: [
|
|
478
|
-
C && /* @__PURE__ */ m("span", { className: K, "data-slot": "slider-label", "data-testid": "spectral-slider-label-start", children: c?.({ values: l, min: d, max: a, position: "start" }) }),
|
|
479
|
-
F && /* @__PURE__ */ m(
|
|
480
|
-
Q,
|
|
481
|
-
{
|
|
482
|
-
"aria-label": e ? `${e} start value` : "Slider start value",
|
|
483
|
-
className: M,
|
|
484
|
-
"data-slot": "slider-input",
|
|
485
|
-
"data-testid": "spectral-slider-input-start",
|
|
486
|
-
disabled: n,
|
|
487
|
-
max: l.length > 1 ? l[1] - h * b : a,
|
|
488
|
-
min: d,
|
|
489
|
-
onBlur: () => V(0),
|
|
490
|
-
onChange: (u) => O(0, u),
|
|
491
|
-
onKeyDown: (u) => A(0, u),
|
|
492
|
-
step: b,
|
|
493
|
-
type: "number",
|
|
494
|
-
value: D[0] ?? ""
|
|
495
|
-
}
|
|
496
|
-
),
|
|
497
|
-
/* @__PURE__ */ X(
|
|
498
|
-
He,
|
|
499
|
-
{
|
|
500
|
-
"aria-label": e,
|
|
501
|
-
"aria-valuemax": a,
|
|
502
|
-
"aria-valuemin": d,
|
|
503
|
-
"aria-valuenow": l[0],
|
|
504
|
-
className: "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",
|
|
505
|
-
"data-slot": "slider",
|
|
506
|
-
"data-testid": "spectral-slider",
|
|
507
|
-
disabled: n,
|
|
508
|
-
max: a,
|
|
509
|
-
min: d,
|
|
510
|
-
minStepsBetweenThumbs: h,
|
|
511
|
-
name: w,
|
|
512
|
-
onValueChange: k,
|
|
513
|
-
onValueCommit: f,
|
|
514
|
-
orientation: y,
|
|
515
|
-
step: b,
|
|
516
|
-
value: l,
|
|
517
|
-
children: [
|
|
518
|
-
/* @__PURE__ */ m(
|
|
519
|
-
Le,
|
|
520
|
-
{
|
|
521
|
-
className: "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",
|
|
522
|
-
"data-slot": "slider-track",
|
|
523
|
-
"data-testid": "spectral-slider-track",
|
|
524
|
-
children: /* @__PURE__ */ m(Oe, { className: "bg-slider-range absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full", "data-slot": "slider-range", "data-testid": "spectral-slider-range" })
|
|
525
|
-
}
|
|
526
|
-
),
|
|
527
|
-
Array.from({ length: l.length }, (u, E) => /* @__PURE__ */ m(
|
|
528
|
-
Fe,
|
|
529
|
-
{
|
|
530
|
-
className: "border-slider-thumb-border bg-slider-thumb-bg ring-slider-thumb-ring/50 block size-5 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50",
|
|
531
|
-
"data-slot": "slider-thumb",
|
|
532
|
-
"data-testid": "spectral-slider-thumb"
|
|
533
|
-
},
|
|
534
|
-
E
|
|
535
|
-
))
|
|
536
|
-
]
|
|
537
|
-
}
|
|
538
|
-
),
|
|
539
|
-
H && /* @__PURE__ */ m(
|
|
540
|
-
Q,
|
|
541
|
-
{
|
|
542
|
-
"aria-label": e ? `${e} end value` : "Slider end value",
|
|
543
|
-
className: M,
|
|
544
|
-
"data-slot": "slider-input",
|
|
545
|
-
"data-testid": "spectral-slider-input-end",
|
|
546
|
-
disabled: n,
|
|
547
|
-
max: a,
|
|
548
|
-
min: l[0] + h * b,
|
|
549
|
-
onBlur: () => V(1),
|
|
550
|
-
onChange: (u) => O(1, u),
|
|
551
|
-
onKeyDown: (u) => A(1, u),
|
|
552
|
-
step: b,
|
|
553
|
-
type: "number",
|
|
554
|
-
value: D[1] ?? ""
|
|
555
|
-
}
|
|
556
|
-
),
|
|
557
|
-
B && /* @__PURE__ */ m("span", { className: K, "data-slot": "slider-label", "data-testid": "spectral-slider-label-end", children: c({ values: l, min: d, max: a, position: "end" }) })
|
|
558
|
-
] });
|
|
559
|
-
};
|
|
560
|
-
export {
|
|
561
|
-
Qe as Slider
|
|
562
|
-
};
|
|
1
|
+
import { t as e } from "./Slider-BzzZT3Zm.js";
|
|
2
|
+
export { e as Slider };
|
package/dist/SpectralProvider.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
|
-
import { jsx as t, Fragment as a } from "react/jsx-runtime";
|
|
3
2
|
import "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
3
|
+
import { Fragment as e, jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/SpectralProvider/SpectralProvider.tsx
|
|
5
|
+
var n = ({ children: n, className: r = "", isolated: i = !0 }) => i ? /* @__PURE__ */ t("div", {
|
|
6
|
+
className: `spectral-root ${r}`,
|
|
7
|
+
children: n
|
|
8
|
+
}) : /* @__PURE__ */ t(e, { children: n });
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as SpectralProvider };
|