@spear-ai/spectral 1.9.0 → 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 -274
- package/dist/DateTimePicker/DateTimeInput.d.ts +5 -3
- package/dist/DateTimePicker/DateTimeInput.js +133 -88
- 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 -23
- 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.d.ts.map +1 -1
- package/dist/primitives/popover.js +34 -25
- 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
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
import "./styles/main.css";
|
|
2
|
+
import { a as e, d as t, l as n, r, t as i } from "./dist-7HRQ5IKN.js";
|
|
3
|
+
import { n as a, t as o } from "./dist-CGzgmYB9.js";
|
|
4
|
+
import { t as s } from "./twUtils-VNWgstKL.js";
|
|
5
|
+
import { Input as c } from "./primitives/input.js";
|
|
6
|
+
import { t as l } from "./dist-D8Wb_MX9.js";
|
|
7
|
+
import { t as u } from "./dist-BK1K0g9W.js";
|
|
8
|
+
import { t as d } from "./dist-s1uWaZYZ.js";
|
|
9
|
+
import * as f from "react";
|
|
10
|
+
import { useCallback as p, useEffect as m, useMemo as h, useState as g } from "react";
|
|
11
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
12
|
+
//#region node_modules/.pnpm/@radix-ui+react-slider@1.3.6_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react_75ed1eb593bd235383d6c38bc5087147/node_modules/@radix-ui/react-slider/dist/index.mjs
|
|
13
|
+
var y = ["PageUp", "PageDown"], b = [
|
|
14
|
+
"ArrowUp",
|
|
15
|
+
"ArrowDown",
|
|
16
|
+
"ArrowLeft",
|
|
17
|
+
"ArrowRight"
|
|
18
|
+
], x = {
|
|
19
|
+
"from-left": [
|
|
20
|
+
"Home",
|
|
21
|
+
"PageDown",
|
|
22
|
+
"ArrowDown",
|
|
23
|
+
"ArrowLeft"
|
|
24
|
+
],
|
|
25
|
+
"from-right": [
|
|
26
|
+
"Home",
|
|
27
|
+
"PageDown",
|
|
28
|
+
"ArrowDown",
|
|
29
|
+
"ArrowRight"
|
|
30
|
+
],
|
|
31
|
+
"from-bottom": [
|
|
32
|
+
"Home",
|
|
33
|
+
"PageDown",
|
|
34
|
+
"ArrowDown",
|
|
35
|
+
"ArrowLeft"
|
|
36
|
+
],
|
|
37
|
+
"from-top": [
|
|
38
|
+
"Home",
|
|
39
|
+
"PageDown",
|
|
40
|
+
"ArrowUp",
|
|
41
|
+
"ArrowLeft"
|
|
42
|
+
]
|
|
43
|
+
}, S = "Slider", [C, w, T] = a(S), [E, D] = t(S, [T]), [O, k] = E(S), A = f.forwardRef((t, n) => {
|
|
44
|
+
let { name: i, min: a = 0, max: o = 100, step: s = 1, orientation: c = "horizontal", disabled: u = !1, minStepsBetweenThumbs: d = 0, defaultValue: p = [a], value: m, onValueChange: h = () => {}, onValueCommit: g = () => {}, inverted: v = !1, form: x, ...S } = t, w = f.useRef(/* @__PURE__ */ new Set()), T = f.useRef(0), E = c === "horizontal" ? N : P, [D = [], k] = r({
|
|
45
|
+
prop: m,
|
|
46
|
+
defaultProp: p,
|
|
47
|
+
onChange: (e) => {
|
|
48
|
+
[...w.current][T.current]?.focus(), h(e);
|
|
49
|
+
}
|
|
50
|
+
}), A = f.useRef(D);
|
|
51
|
+
function j(e) {
|
|
52
|
+
I(e, q(D, e));
|
|
53
|
+
}
|
|
54
|
+
function M(e) {
|
|
55
|
+
I(e, T.current);
|
|
56
|
+
}
|
|
57
|
+
function F() {
|
|
58
|
+
let e = A.current[T.current];
|
|
59
|
+
D[T.current] !== e && g(D);
|
|
60
|
+
}
|
|
61
|
+
function I(e, t, { commit: n } = { commit: !1 }) {
|
|
62
|
+
let r = Q(s), i = l($(Math.round((e - a) / s) * s + a, r), [a, o]);
|
|
63
|
+
k((e = []) => {
|
|
64
|
+
let r = ee(e, i, t);
|
|
65
|
+
if (X(r, d * s)) {
|
|
66
|
+
T.current = r.indexOf(i);
|
|
67
|
+
let t = String(r) !== String(e);
|
|
68
|
+
return t && n && g(r), t ? r : e;
|
|
69
|
+
} else return e;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ _(O, {
|
|
73
|
+
scope: t.__scopeSlider,
|
|
74
|
+
name: i,
|
|
75
|
+
disabled: u,
|
|
76
|
+
min: a,
|
|
77
|
+
max: o,
|
|
78
|
+
valueIndexToChangeRef: T,
|
|
79
|
+
thumbs: w.current,
|
|
80
|
+
values: D,
|
|
81
|
+
orientation: c,
|
|
82
|
+
form: x,
|
|
83
|
+
children: /* @__PURE__ */ _(C.Provider, {
|
|
84
|
+
scope: t.__scopeSlider,
|
|
85
|
+
children: /* @__PURE__ */ _(C.Slot, {
|
|
86
|
+
scope: t.__scopeSlider,
|
|
87
|
+
children: /* @__PURE__ */ _(E, {
|
|
88
|
+
"aria-disabled": u,
|
|
89
|
+
"data-disabled": u ? "" : void 0,
|
|
90
|
+
...S,
|
|
91
|
+
ref: n,
|
|
92
|
+
onPointerDown: e(S.onPointerDown, () => {
|
|
93
|
+
u || (A.current = D);
|
|
94
|
+
}),
|
|
95
|
+
min: a,
|
|
96
|
+
max: o,
|
|
97
|
+
inverted: v,
|
|
98
|
+
onSlideStart: u ? void 0 : j,
|
|
99
|
+
onSlideMove: u ? void 0 : M,
|
|
100
|
+
onSlideEnd: u ? void 0 : F,
|
|
101
|
+
onHomeKeyDown: () => !u && I(a, 0, { commit: !0 }),
|
|
102
|
+
onEndKeyDown: () => !u && I(o, D.length - 1, { commit: !0 }),
|
|
103
|
+
onStepKeyDown: ({ event: e, direction: t }) => {
|
|
104
|
+
if (!u) {
|
|
105
|
+
let n = y.includes(e.key) || e.shiftKey && b.includes(e.key) ? 10 : 1, r = T.current, i = D[r];
|
|
106
|
+
I(i + s * n * t, r, { commit: !0 });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
A.displayName = S;
|
|
115
|
+
var [j, M] = E(S, {
|
|
116
|
+
startEdge: "left",
|
|
117
|
+
endEdge: "right",
|
|
118
|
+
size: "width",
|
|
119
|
+
direction: 1
|
|
120
|
+
}), N = f.forwardRef((e, t) => {
|
|
121
|
+
let { min: r, max: i, dir: a, inverted: s, onSlideStart: c, onSlideMove: l, onSlideEnd: u, onStepKeyDown: d, ...p } = e, [m, h] = f.useState(null), g = n(t, (e) => h(e)), v = f.useRef(void 0), y = o(a), b = y === "ltr", S = b && !s || !b && s;
|
|
122
|
+
function C(e) {
|
|
123
|
+
let t = v.current || m.getBoundingClientRect(), n = Z([0, t.width], S ? [r, i] : [i, r]);
|
|
124
|
+
return v.current = t, n(e - t.left);
|
|
125
|
+
}
|
|
126
|
+
return /* @__PURE__ */ _(j, {
|
|
127
|
+
scope: e.__scopeSlider,
|
|
128
|
+
startEdge: S ? "left" : "right",
|
|
129
|
+
endEdge: S ? "right" : "left",
|
|
130
|
+
direction: S ? 1 : -1,
|
|
131
|
+
size: "width",
|
|
132
|
+
children: /* @__PURE__ */ _(F, {
|
|
133
|
+
dir: y,
|
|
134
|
+
"data-orientation": "horizontal",
|
|
135
|
+
...p,
|
|
136
|
+
ref: g,
|
|
137
|
+
style: {
|
|
138
|
+
...p.style,
|
|
139
|
+
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
140
|
+
},
|
|
141
|
+
onSlideStart: (e) => {
|
|
142
|
+
let t = C(e.clientX);
|
|
143
|
+
c?.(t);
|
|
144
|
+
},
|
|
145
|
+
onSlideMove: (e) => {
|
|
146
|
+
let t = C(e.clientX);
|
|
147
|
+
l?.(t);
|
|
148
|
+
},
|
|
149
|
+
onSlideEnd: () => {
|
|
150
|
+
v.current = void 0, u?.();
|
|
151
|
+
},
|
|
152
|
+
onStepKeyDown: (e) => {
|
|
153
|
+
let t = x[S ? "from-left" : "from-right"].includes(e.key);
|
|
154
|
+
d?.({
|
|
155
|
+
event: e,
|
|
156
|
+
direction: t ? -1 : 1
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
}), P = f.forwardRef((e, t) => {
|
|
162
|
+
let { min: r, max: i, inverted: a, onSlideStart: o, onSlideMove: s, onSlideEnd: c, onStepKeyDown: l, ...u } = e, d = f.useRef(null), p = n(t, d), m = f.useRef(void 0), h = !a;
|
|
163
|
+
function g(e) {
|
|
164
|
+
let t = m.current || d.current.getBoundingClientRect(), n = Z([0, t.height], h ? [i, r] : [r, i]);
|
|
165
|
+
return m.current = t, n(e - t.top);
|
|
166
|
+
}
|
|
167
|
+
return /* @__PURE__ */ _(j, {
|
|
168
|
+
scope: e.__scopeSlider,
|
|
169
|
+
startEdge: h ? "bottom" : "top",
|
|
170
|
+
endEdge: h ? "top" : "bottom",
|
|
171
|
+
size: "height",
|
|
172
|
+
direction: h ? 1 : -1,
|
|
173
|
+
children: /* @__PURE__ */ _(F, {
|
|
174
|
+
"data-orientation": "vertical",
|
|
175
|
+
...u,
|
|
176
|
+
ref: p,
|
|
177
|
+
style: {
|
|
178
|
+
...u.style,
|
|
179
|
+
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
180
|
+
},
|
|
181
|
+
onSlideStart: (e) => {
|
|
182
|
+
let t = g(e.clientY);
|
|
183
|
+
o?.(t);
|
|
184
|
+
},
|
|
185
|
+
onSlideMove: (e) => {
|
|
186
|
+
let t = g(e.clientY);
|
|
187
|
+
s?.(t);
|
|
188
|
+
},
|
|
189
|
+
onSlideEnd: () => {
|
|
190
|
+
m.current = void 0, c?.();
|
|
191
|
+
},
|
|
192
|
+
onStepKeyDown: (e) => {
|
|
193
|
+
let t = x[h ? "from-bottom" : "from-top"].includes(e.key);
|
|
194
|
+
l?.({
|
|
195
|
+
event: e,
|
|
196
|
+
direction: t ? -1 : 1
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
});
|
|
201
|
+
}), F = f.forwardRef((t, n) => {
|
|
202
|
+
let { __scopeSlider: r, onSlideStart: a, onSlideMove: o, onSlideEnd: s, onHomeKeyDown: c, onEndKeyDown: l, onStepKeyDown: u, ...d } = t, f = k(S, r);
|
|
203
|
+
return /* @__PURE__ */ _(i.span, {
|
|
204
|
+
...d,
|
|
205
|
+
ref: n,
|
|
206
|
+
onKeyDown: e(t.onKeyDown, (e) => {
|
|
207
|
+
e.key === "Home" ? (c(e), e.preventDefault()) : e.key === "End" ? (l(e), e.preventDefault()) : y.concat(b).includes(e.key) && (u(e), e.preventDefault());
|
|
208
|
+
}),
|
|
209
|
+
onPointerDown: e(t.onPointerDown, (e) => {
|
|
210
|
+
let t = e.target;
|
|
211
|
+
t.setPointerCapture(e.pointerId), e.preventDefault(), f.thumbs.has(t) ? t.focus() : a(e);
|
|
212
|
+
}),
|
|
213
|
+
onPointerMove: e(t.onPointerMove, (e) => {
|
|
214
|
+
e.target.hasPointerCapture(e.pointerId) && o(e);
|
|
215
|
+
}),
|
|
216
|
+
onPointerUp: e(t.onPointerUp, (e) => {
|
|
217
|
+
let t = e.target;
|
|
218
|
+
t.hasPointerCapture(e.pointerId) && (t.releasePointerCapture(e.pointerId), s(e));
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
}), I = "SliderTrack", L = f.forwardRef((e, t) => {
|
|
222
|
+
let { __scopeSlider: n, ...r } = e, a = k(I, n);
|
|
223
|
+
return /* @__PURE__ */ _(i.span, {
|
|
224
|
+
"data-disabled": a.disabled ? "" : void 0,
|
|
225
|
+
"data-orientation": a.orientation,
|
|
226
|
+
...r,
|
|
227
|
+
ref: t
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
L.displayName = I;
|
|
231
|
+
var R = "SliderRange", z = f.forwardRef((e, t) => {
|
|
232
|
+
let { __scopeSlider: r, ...a } = e, o = k(R, r), s = M(R, r), c = n(t, f.useRef(null)), l = o.values.length, u = o.values.map((e) => G(e, o.min, o.max)), d = l > 1 ? Math.min(...u) : 0, p = 100 - Math.max(...u);
|
|
233
|
+
return /* @__PURE__ */ _(i.span, {
|
|
234
|
+
"data-orientation": o.orientation,
|
|
235
|
+
"data-disabled": o.disabled ? "" : void 0,
|
|
236
|
+
...a,
|
|
237
|
+
ref: c,
|
|
238
|
+
style: {
|
|
239
|
+
...e.style,
|
|
240
|
+
[s.startEdge]: d + "%",
|
|
241
|
+
[s.endEdge]: p + "%"
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
z.displayName = R;
|
|
246
|
+
var B = "SliderThumb", V = f.forwardRef((e, t) => {
|
|
247
|
+
let r = w(e.__scopeSlider), [i, a] = f.useState(null), o = n(t, (e) => a(e)), s = f.useMemo(() => i ? r().findIndex((e) => e.ref.current === i) : -1, [r, i]);
|
|
248
|
+
return /* @__PURE__ */ _(H, {
|
|
249
|
+
...e,
|
|
250
|
+
ref: o,
|
|
251
|
+
index: s
|
|
252
|
+
});
|
|
253
|
+
}), H = f.forwardRef((t, r) => {
|
|
254
|
+
let { __scopeSlider: a, index: o, name: s, ...c } = t, l = k(B, a), d = M(B, a), [p, m] = f.useState(null), h = n(r, (e) => m(e)), g = p ? l.form || !!p.closest("form") : !0, y = u(p), b = l.values[o], x = b === void 0 ? 0 : G(b, l.min, l.max), S = K(o, l.values.length), w = y?.[d.size], T = w ? J(w, x, d.direction) : 0;
|
|
255
|
+
return f.useEffect(() => {
|
|
256
|
+
if (p) return l.thumbs.add(p), () => {
|
|
257
|
+
l.thumbs.delete(p);
|
|
258
|
+
};
|
|
259
|
+
}, [p, l.thumbs]), /* @__PURE__ */ v("span", {
|
|
260
|
+
style: {
|
|
261
|
+
transform: "var(--radix-slider-thumb-transform)",
|
|
262
|
+
position: "absolute",
|
|
263
|
+
[d.startEdge]: `calc(${x}% + ${T}px)`
|
|
264
|
+
},
|
|
265
|
+
children: [/* @__PURE__ */ _(C.ItemSlot, {
|
|
266
|
+
scope: t.__scopeSlider,
|
|
267
|
+
children: /* @__PURE__ */ _(i.span, {
|
|
268
|
+
role: "slider",
|
|
269
|
+
"aria-label": t["aria-label"] || S,
|
|
270
|
+
"aria-valuemin": l.min,
|
|
271
|
+
"aria-valuenow": b,
|
|
272
|
+
"aria-valuemax": l.max,
|
|
273
|
+
"aria-orientation": l.orientation,
|
|
274
|
+
"data-orientation": l.orientation,
|
|
275
|
+
"data-disabled": l.disabled ? "" : void 0,
|
|
276
|
+
tabIndex: l.disabled ? void 0 : 0,
|
|
277
|
+
...c,
|
|
278
|
+
ref: h,
|
|
279
|
+
style: b === void 0 ? { display: "none" } : t.style,
|
|
280
|
+
onFocus: e(t.onFocus, () => {
|
|
281
|
+
l.valueIndexToChangeRef.current = o;
|
|
282
|
+
})
|
|
283
|
+
})
|
|
284
|
+
}), g && /* @__PURE__ */ _(W, {
|
|
285
|
+
name: s ?? (l.name ? l.name + (l.values.length > 1 ? "[]" : "") : void 0),
|
|
286
|
+
form: l.form,
|
|
287
|
+
value: b
|
|
288
|
+
}, o)]
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
V.displayName = B;
|
|
292
|
+
var U = "RadioBubbleInput", W = f.forwardRef(({ __scopeSlider: e, value: t, ...r }, a) => {
|
|
293
|
+
let o = f.useRef(null), s = n(o, a), c = d(t);
|
|
294
|
+
return f.useEffect(() => {
|
|
295
|
+
let e = o.current;
|
|
296
|
+
if (!e) return;
|
|
297
|
+
let n = window.HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(n, "value").set;
|
|
298
|
+
if (c !== t && r) {
|
|
299
|
+
let n = new Event("input", { bubbles: !0 });
|
|
300
|
+
r.call(e, t), e.dispatchEvent(n);
|
|
301
|
+
}
|
|
302
|
+
}, [c, t]), /* @__PURE__ */ _(i.input, {
|
|
303
|
+
style: { display: "none" },
|
|
304
|
+
...r,
|
|
305
|
+
ref: s,
|
|
306
|
+
defaultValue: t
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
W.displayName = U;
|
|
310
|
+
function ee(e = [], t, n) {
|
|
311
|
+
let r = [...e];
|
|
312
|
+
return r[n] = t, r.sort((e, t) => e - t);
|
|
313
|
+
}
|
|
314
|
+
function G(e, t, n) {
|
|
315
|
+
return l(100 / (n - t) * (e - t), [0, 100]);
|
|
316
|
+
}
|
|
317
|
+
function K(e, t) {
|
|
318
|
+
if (t > 2) return `Value ${e + 1} of ${t}`;
|
|
319
|
+
if (t === 2) return ["Minimum", "Maximum"][e];
|
|
320
|
+
}
|
|
321
|
+
function q(e, t) {
|
|
322
|
+
if (e.length === 1) return 0;
|
|
323
|
+
let n = e.map((e) => Math.abs(e - t)), r = Math.min(...n);
|
|
324
|
+
return n.indexOf(r);
|
|
325
|
+
}
|
|
326
|
+
function J(e, t, n) {
|
|
327
|
+
let r = e / 2;
|
|
328
|
+
return (r - Z([0, 50], [0, r])(t) * n) * n;
|
|
329
|
+
}
|
|
330
|
+
function Y(e) {
|
|
331
|
+
return e.slice(0, -1).map((t, n) => e[n + 1] - t);
|
|
332
|
+
}
|
|
333
|
+
function X(e, t) {
|
|
334
|
+
if (t > 0) {
|
|
335
|
+
let n = Y(e);
|
|
336
|
+
return Math.min(...n) >= t;
|
|
337
|
+
}
|
|
338
|
+
return !0;
|
|
339
|
+
}
|
|
340
|
+
function Z(e, t) {
|
|
341
|
+
return (n) => {
|
|
342
|
+
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
343
|
+
let r = (t[1] - t[0]) / (e[1] - e[0]);
|
|
344
|
+
return t[0] + r * (n - e[0]);
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function Q(e) {
|
|
348
|
+
return (String(e).split(".")[1] || "").length;
|
|
349
|
+
}
|
|
350
|
+
function $(e, t) {
|
|
351
|
+
let n = 10 ** t;
|
|
352
|
+
return Math.round(e * n) / n;
|
|
353
|
+
}
|
|
354
|
+
var te = A, ne = L, re = z, ie = V, ae = ({ accessibleName: e, className: t, defaultValue: n, disabled: r, inputPosition: i, label: a, labelPosition: o, max: l = 100, min: u = 0, minStepsBetweenThumbs: d = 1, name: f, onValueChange: y, onValueCommit: b, orientation: x = "horizontal", step: S = 1, value: C }) => {
|
|
355
|
+
let w = C !== void 0, [T, E] = g(h(() => Array.isArray(C) ? C : Array.isArray(n) ? n : [u], [])), D = w ? C : T, [O, k] = g(() => D.map(String));
|
|
356
|
+
m(() => {
|
|
357
|
+
k(D.map(String));
|
|
358
|
+
}, [D]);
|
|
359
|
+
let A = p((e) => {
|
|
360
|
+
w || E(e), y?.(e);
|
|
361
|
+
}, [w, y]), j = p((e, t) => {
|
|
362
|
+
let n = [...O];
|
|
363
|
+
n[e] = t.target.value, k(n);
|
|
364
|
+
}, [O]), M = p((e) => {
|
|
365
|
+
let t = O[e];
|
|
366
|
+
if (t === "") {
|
|
367
|
+
k(D.map(String));
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
let n = parseFloat(t);
|
|
371
|
+
if (isNaN(n)) {
|
|
372
|
+
k(D.map(String));
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
n = Math.max(u, Math.min(l, n));
|
|
376
|
+
let r = [...D];
|
|
377
|
+
if (e === 0 && D.length > 1) {
|
|
378
|
+
let e = D[1] - d * S;
|
|
379
|
+
n = Math.min(n, e);
|
|
380
|
+
} else if (e === 1) {
|
|
381
|
+
let e = D[0] + d * S;
|
|
382
|
+
n = Math.max(n, e);
|
|
383
|
+
}
|
|
384
|
+
r[e] = n, A(r), b?.(r);
|
|
385
|
+
}, [
|
|
386
|
+
O,
|
|
387
|
+
D,
|
|
388
|
+
u,
|
|
389
|
+
l,
|
|
390
|
+
S,
|
|
391
|
+
d,
|
|
392
|
+
A,
|
|
393
|
+
b
|
|
394
|
+
]), N = p((e, t) => {
|
|
395
|
+
t.key === "Enter" && (M(e), t.currentTarget.blur());
|
|
396
|
+
}, [M]), P = x === "vertical", F = o === "both", I = a && (o === "end" || o === "both"), L = i === "start" || i === "both", R = i === "both" && D.length > 1, z = s("text-slider-label text-sm shrink-0 tabular-nums", P ? "text-center" : ""), B = "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";
|
|
397
|
+
return /* @__PURE__ */ v("div", {
|
|
398
|
+
className: s("gap-3 flex items-center", P ? "flex-col" : "w-full", t),
|
|
399
|
+
"data-testid": "spectral-slider-container",
|
|
400
|
+
children: [
|
|
401
|
+
F && /* @__PURE__ */ _("span", {
|
|
402
|
+
className: z,
|
|
403
|
+
"data-slot": "slider-label",
|
|
404
|
+
"data-testid": "spectral-slider-label-start",
|
|
405
|
+
children: a?.({
|
|
406
|
+
values: D,
|
|
407
|
+
min: u,
|
|
408
|
+
max: l,
|
|
409
|
+
position: "start"
|
|
410
|
+
})
|
|
411
|
+
}),
|
|
412
|
+
L && /* @__PURE__ */ _(c, {
|
|
413
|
+
"aria-label": e ? `${e} start value` : "Slider start value",
|
|
414
|
+
className: B,
|
|
415
|
+
"data-slot": "slider-input",
|
|
416
|
+
"data-testid": "spectral-slider-input-start",
|
|
417
|
+
disabled: r,
|
|
418
|
+
max: D.length > 1 ? D[1] - d * S : l,
|
|
419
|
+
min: u,
|
|
420
|
+
onBlur: () => M(0),
|
|
421
|
+
onChange: (e) => j(0, e),
|
|
422
|
+
onKeyDown: (e) => N(0, e),
|
|
423
|
+
step: S,
|
|
424
|
+
type: "number",
|
|
425
|
+
value: O[0] ?? ""
|
|
426
|
+
}),
|
|
427
|
+
/* @__PURE__ */ v(te, {
|
|
428
|
+
"aria-label": e,
|
|
429
|
+
"aria-valuemax": l,
|
|
430
|
+
"aria-valuemin": u,
|
|
431
|
+
"aria-valuenow": D[0],
|
|
432
|
+
className: "data-[orientation=vertical]:min-h-44 relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
433
|
+
"data-slot": "slider",
|
|
434
|
+
"data-testid": "spectral-slider",
|
|
435
|
+
disabled: r,
|
|
436
|
+
max: l,
|
|
437
|
+
min: u,
|
|
438
|
+
minStepsBetweenThumbs: d,
|
|
439
|
+
name: f,
|
|
440
|
+
onValueChange: A,
|
|
441
|
+
onValueCommit: b,
|
|
442
|
+
orientation: x,
|
|
443
|
+
step: S,
|
|
444
|
+
value: D,
|
|
445
|
+
children: [/* @__PURE__ */ _(ne, {
|
|
446
|
+
className: "data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 relative grow overflow-hidden rounded-full bg-slider-track data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full",
|
|
447
|
+
"data-slot": "slider-track",
|
|
448
|
+
"data-testid": "spectral-slider-track",
|
|
449
|
+
children: /* @__PURE__ */ _(re, {
|
|
450
|
+
className: "absolute bg-slider-range data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full",
|
|
451
|
+
"data-slot": "slider-range",
|
|
452
|
+
"data-testid": "spectral-slider-range"
|
|
453
|
+
})
|
|
454
|
+
}), Array.from({ length: D.length }, (e, t) => /* @__PURE__ */ _(ie, {
|
|
455
|
+
className: "size-5 shadow-sm block shrink-0 rounded-full border border-slider-thumb-border bg-slider-thumb-bg ring-slider-thumb-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50",
|
|
456
|
+
"data-slot": "slider-thumb",
|
|
457
|
+
"data-testid": "spectral-slider-thumb"
|
|
458
|
+
}, t))]
|
|
459
|
+
}),
|
|
460
|
+
R && /* @__PURE__ */ _(c, {
|
|
461
|
+
"aria-label": e ? `${e} end value` : "Slider end value",
|
|
462
|
+
className: B,
|
|
463
|
+
"data-slot": "slider-input",
|
|
464
|
+
"data-testid": "spectral-slider-input-end",
|
|
465
|
+
disabled: r,
|
|
466
|
+
max: l,
|
|
467
|
+
min: D[0] + d * S,
|
|
468
|
+
onBlur: () => M(1),
|
|
469
|
+
onChange: (e) => j(1, e),
|
|
470
|
+
onKeyDown: (e) => N(1, e),
|
|
471
|
+
step: S,
|
|
472
|
+
type: "number",
|
|
473
|
+
value: O[1] ?? ""
|
|
474
|
+
}),
|
|
475
|
+
I && /* @__PURE__ */ _("span", {
|
|
476
|
+
className: z,
|
|
477
|
+
"data-slot": "slider-label",
|
|
478
|
+
"data-testid": "spectral-slider-label-end",
|
|
479
|
+
children: a({
|
|
480
|
+
values: D,
|
|
481
|
+
min: u,
|
|
482
|
+
max: l,
|
|
483
|
+
position: "end"
|
|
484
|
+
})
|
|
485
|
+
})
|
|
486
|
+
]
|
|
487
|
+
});
|
|
488
|
+
};
|
|
489
|
+
//#endregion
|
|
490
|
+
export { ae as t };
|