@spear-ai/spectral 1.4.2 → 1.4.3
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/Accordion.d.ts +7 -7
- package/dist/Accordion.js +53 -51
- package/dist/Alert/AlertBase.js +6 -6
- package/dist/Alert.js +1 -1
- package/dist/Avatar.d.ts +2 -2
- package/dist/Avatar.js +46 -46
- package/dist/Badge.js +3 -3
- package/dist/Button.js +19 -12
- package/dist/ButtonGroup/ButtonGroupButton.d.ts +1 -1
- package/dist/ButtonGroup/ButtonGroupButton.js +10 -10
- package/dist/ButtonGroup.d.ts +8 -5
- package/dist/ButtonGroup.js +22 -14
- package/dist/ButtonIcon.d.ts +1 -1
- package/dist/ButtonIcon.js +5 -5
- package/dist/Card.d.ts +1 -1
- package/dist/Card.js +10 -10
- package/dist/Checkbox/CheckboxBase.d.ts +6 -6
- package/dist/Checkbox/CheckboxBase.js +65 -63
- package/dist/Checkbox.js +16 -14
- package/dist/Dialog/DialogBase.d.ts +37 -25
- package/dist/Dialog/DialogBase.js +130 -104
- package/dist/Dialog.d.ts +8 -8
- package/dist/Dialog.js +46 -36
- package/dist/Drawer.js +17 -17
- package/dist/HoverCard.d.ts +4 -4
- package/dist/HoverCard.js +34 -33
- package/dist/Input.js +58 -58
- package/dist/InputOTP.d.ts +1 -1
- package/dist/InputOTP.js +113 -112
- package/dist/MultiSelect/MultiSelectBase.d.ts +16 -16
- package/dist/MultiSelect/MultiSelectBase.js +236 -177
- package/dist/MultiSelect/MutiSelect.d.ts +6 -4
- package/dist/MultiSelect/MutiSelect.js +13 -12
- package/dist/Popover.js +2 -1
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +18 -17
- package/dist/RadioGroup.js +5 -3
- package/dist/Select.js +70 -51
- package/dist/Slider.js +8 -4
- package/dist/Switch/SwitchBase.d.ts +6 -6
- package/dist/Switch/SwitchBase.js +39 -38
- package/dist/Switch.js +17 -16
- package/dist/Tabs/TabsBase.js +40 -25
- package/dist/Tabs.js +18 -21
- package/dist/Textarea.d.ts +1 -0
- package/dist/Textarea.js +33 -33
- package/dist/Toggle.js +4 -4
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +7 -7
- package/dist/ToggleGroup/ToggleGroupBase.js +64 -64
- package/dist/ToggleGroup.js +19 -17
- package/dist/Tooltip/TooltipBase.d.ts +8 -8
- package/dist/Tooltip/TooltipBase.js +76 -74
- package/dist/Tooltip.d.ts +1 -1
- package/dist/Tooltip.js +12 -11
- package/dist/Tray.d.ts +1 -1
- package/dist/Tray.js +4910 -117
- package/dist/primitives/input.js +4 -4
- package/dist/primitives/select.d.ts +11 -11
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +28 -21
- package/dist/styles/main.css +1 -1
- package/dist/utils/{refs.d.ts → createForwardRef.d.ts} +1 -1
- package/dist/utils/createForwardRef.d.ts.map +1 -0
- package/dist/utils/formFieldUtils.d.ts +22 -18
- package/dist/utils/formFieldUtils.d.ts.map +1 -1
- package/dist/utils/formFieldUtils.js +46 -46
- package/package.json +9 -3
- package/dist/analyzer/list.yml.webp +0 -0
- package/dist/analyzer/network.webp +0 -0
- package/dist/analyzer/sunburst.webp +0 -0
- package/dist/analyzer/visual.webp +0 -0
- package/dist/auth-background.json +0 -90
- package/dist/favicon-invert.svg +0 -5
- package/dist/favicon.svg +0 -5
- package/dist/features/AuthCard/AuthCard.d.ts +0 -3
- package/dist/features/AuthCard/AuthCard.d.ts.map +0 -1
- package/dist/features/AuthCard/AuthToggle.d.ts +0 -9
- package/dist/features/AuthCard/AuthToggle.d.ts.map +0 -1
- package/dist/features/AuthCard/AuthToggle.js +0 -20
- package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts +0 -11
- package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts.map +0 -1
- package/dist/features/AuthCard/ForgotPasswordEmailForm.js +0 -86
- package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts +0 -11
- package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts.map +0 -1
- package/dist/features/AuthCard/ForgotPasswordResetForm.js +0 -21
- package/dist/features/AuthCard/OTPInput.d.ts +0 -12
- package/dist/features/AuthCard/OTPInput.d.ts.map +0 -1
- package/dist/features/AuthCard/OTPInput.js +0 -12
- package/dist/features/AuthCard/PasswordInput.d.ts +0 -13
- package/dist/features/AuthCard/PasswordInput.d.ts.map +0 -1
- package/dist/features/AuthCard/PasswordInput.js +0 -93
- package/dist/features/AuthCard/SignInForm.d.ts +0 -9
- package/dist/features/AuthCard/SignInForm.d.ts.map +0 -1
- package/dist/features/AuthCard/SignInForm.js +0 -86
- package/dist/features/AuthCard/SignUpForm.d.ts +0 -8
- package/dist/features/AuthCard/SignUpForm.d.ts.map +0 -1
- package/dist/features/AuthCard/SignUpForm.js +0 -100
- package/dist/features/AuthCard.js +0 -202
- package/dist/features/ClearDialog/ClearDialog.d.ts +0 -2
- package/dist/features/ClearDialog/ClearDialog.d.ts.map +0 -1
- package/dist/features/ClearDialog.js +0 -31
- package/dist/features/LabelingToolbar/LabelingToolbar.d.ts +0 -8
- package/dist/features/LabelingToolbar/LabelingToolbar.d.ts.map +0 -1
- package/dist/features/LabelingToolbar.js +0 -13
- package/dist/features/LabelingTools/LabelingTools.d.ts +0 -2
- package/dist/features/LabelingTools/LabelingTools.d.ts.map +0 -1
- package/dist/features/LabelingTools.js +0 -134
- package/dist/features/SensorMetadata/SensorMetadata.d.ts +0 -2
- package/dist/features/SensorMetadata/SensorMetadata.d.ts.map +0 -1
- package/dist/features/SensorMetadata.js +0 -117
- package/dist/features/SettingsPopover/SettingsPopover.d.ts +0 -2
- package/dist/features/SettingsPopover/SettingsPopover.d.ts.map +0 -1
- package/dist/features/SettingsPopover.js +0 -204
- package/dist/index-BIpuW_o8.js +0 -146
- package/dist/linear-cursor-small.png +0 -0
- package/dist/loader-circle-CdRVlFhN.js +0 -11
- package/dist/logo/wordmark-dark-side-by-side.svg +0 -6
- package/dist/logo/wordmark-light-side-by-side.svg +0 -6
- package/dist/message-alert-matte-glass-gradient.webp +0 -0
- package/dist/proxy-C9AqCss6.js +0 -4670
- package/dist/speech-bubble-fluid-glass-gradient.webp +0 -0
- package/dist/themes/grayscale-theme.webp +0 -0
- package/dist/themes/green-black-theme.webp +0 -0
- package/dist/themes/reverse-grayscale-theme.webp +0 -0
- package/dist/themes/viridis-theme.webp +0 -0
- package/dist/utils/refs.d.ts.map +0 -1
- package/dist/x-Dl66o_vF.js +0 -14
- /package/dist/utils/{refs.js → createForwardRef.js} +0 -0
|
@@ -1,265 +1,324 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
3
|
+
import { jsxs as o, jsx as r, Fragment as de } from "react/jsx-runtime";
|
|
4
|
+
import "../Icons/AnalyzeIcon.js";
|
|
5
|
+
import "../Icons/AnnotationsIcon.js";
|
|
6
|
+
import "../Icons/ApprovedIcon.js";
|
|
7
|
+
import "../Icons/CalendarIcon.js";
|
|
8
|
+
import "../Icons/CheckCircleIcon.js";
|
|
9
|
+
import "../Icons/CheckSquareIcon.js";
|
|
10
|
+
import { CheckmarkIcon as ce } from "../Icons/CheckmarkIcon.js";
|
|
11
|
+
import { ChevronDownIcon as ue } from "../Icons/ChevronDownIcon.js";
|
|
12
|
+
import "../Icons/ChevronUpIcon.js";
|
|
13
|
+
import "../Icons/ClockIcon.js";
|
|
14
|
+
import "../Icons/CloseCircleIcon.js";
|
|
15
|
+
import { CloseIcon as P } from "../Icons/CloseIcon.js";
|
|
16
|
+
import "../Icons/DashboardIcon.js";
|
|
17
|
+
import "../Icons/DatabaseIcon.js";
|
|
18
|
+
import "../Icons/DeleteIcon.js";
|
|
19
|
+
import "../Icons/DurationIcon.js";
|
|
20
|
+
import "../Icons/EmailIcon.js";
|
|
21
|
+
import "../Icons/EraserIcon.js";
|
|
22
|
+
import "../Icons/ErrorIcon.js";
|
|
23
|
+
import "../Icons/EyeClosedIcon.js";
|
|
24
|
+
import "../Icons/EyeClosedIcon2.js";
|
|
25
|
+
import "../Icons/EyeOpenIcon.js";
|
|
26
|
+
import "../Icons/GoToFirstIcon.js";
|
|
27
|
+
import "../Icons/GoToLastIcon.js";
|
|
28
|
+
import "../Icons/HarmonicCursorsIcon.js";
|
|
29
|
+
import "../Icons/InfoIcon.js";
|
|
30
|
+
import "../Icons/LabelIcon.js";
|
|
31
|
+
import "../Icons/LassoIcon.js";
|
|
32
|
+
import "../Icons/LineToolIcon.js";
|
|
33
|
+
import "../Icons/LineToolIcon2.js";
|
|
34
|
+
import "../Icons/LiveViewIcon.js";
|
|
35
|
+
import { LoaderIcon as pe } from "../Icons/LoaderIcon.js";
|
|
36
|
+
import "../Icons/LocationIcon.js";
|
|
37
|
+
import "../Icons/LogoutIcon.js";
|
|
38
|
+
import "../Icons/MessagesIcon.js";
|
|
39
|
+
import "../Icons/MetadataIcon.js";
|
|
40
|
+
import "../Icons/MinusIcon.js";
|
|
41
|
+
import "../Icons/OntologyIcon.js";
|
|
42
|
+
import "../Icons/PanelIconClose.js";
|
|
43
|
+
import "../Icons/PanelIconOpen.js";
|
|
44
|
+
import "../Icons/PlayIcon.js";
|
|
45
|
+
import "../Icons/PlusIcon.js";
|
|
46
|
+
import "../Icons/ResetIcon.js";
|
|
47
|
+
import "../Icons/ReviewedIcon.js";
|
|
48
|
+
import "../Icons/ScissorsIcon.js";
|
|
49
|
+
import "../Icons/SettingsIcon.js";
|
|
50
|
+
import "../Icons/SortAscendingIcon.js";
|
|
51
|
+
import "../Icons/SortDescendingIcon.js";
|
|
52
|
+
import "../Icons/StackIcon.js";
|
|
53
|
+
import "../Icons/StarIcon.js";
|
|
54
|
+
import "../Icons/TrashIcon.js";
|
|
55
|
+
import "../Icons/UndoIcon.js";
|
|
56
|
+
import "../Icons/UserIcon.js";
|
|
57
|
+
import "../Icons/WarningIcon.js";
|
|
58
|
+
import "../Icons/ZoomAllIcon.js";
|
|
59
|
+
import "../Icons/ZoomXIcon.js";
|
|
60
|
+
import "../Icons/ZoomYIcon.js";
|
|
61
|
+
import { ErrorMessage as me } from "../utils/formFieldUtils.js";
|
|
62
|
+
import { cn as f } from "../utils/twUtils.js";
|
|
63
|
+
import { forwardRef as be, useId as fe, useState as L, useRef as _, useMemo as T, useCallback as b, useEffect as ge } from "react";
|
|
64
|
+
import { c as he } from "../createLucideIcon-B_8CJpcQ.js";
|
|
9
65
|
/**
|
|
10
66
|
* @license lucide-react v0.546.0 - ISC
|
|
11
67
|
*
|
|
12
68
|
* This source code is licensed under the ISC license.
|
|
13
69
|
* See the LICENSE file in the root directory of this source tree.
|
|
14
70
|
*/
|
|
15
|
-
const
|
|
16
|
-
/**
|
|
17
|
-
* @license lucide-react v0.546.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/
|
|
22
|
-
const xe = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], ye = O("chevron-down", xe);
|
|
23
|
-
/**
|
|
24
|
-
* @license lucide-react v0.546.0 - ISC
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the ISC license.
|
|
27
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
28
|
-
*/
|
|
29
|
-
const ve = [
|
|
71
|
+
const xe = [
|
|
30
72
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
31
73
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
32
|
-
],
|
|
74
|
+
], ye = he("search", xe), ve = "h-4 w-4", we = (i) => ({
|
|
33
75
|
error: "border-danger hover:border-danger focus-visible:border-danger focus-visible:ring-danger",
|
|
34
76
|
loading: "cursor-wait border-input-border--disabled",
|
|
35
77
|
disabled: "cursor-not-allowed opacity-50 border-input-border--disabled bg-input-bg--disabled",
|
|
36
78
|
default: ""
|
|
37
|
-
})[
|
|
79
|
+
})[i], Ne = (i, l, d) => f(
|
|
38
80
|
"flex h-12 w-full items-center justify-between rounded-lg border border-input-border bg-input-bg px-4 py-3 text-sm",
|
|
39
81
|
"hover:border-input-border--hover focus:border-input-border--focus focus:outline-none",
|
|
40
82
|
"focus:ring-2 focus:ring-black focus:ring-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2",
|
|
41
83
|
"disabled:cursor-not-allowed disabled:opacity-50 disabled:border-input-border--disabled disabled:bg-input-bg--disabled",
|
|
42
84
|
"transition duration-200 text-input-text",
|
|
43
85
|
l && "border-input-border--focus ring-2 ring-black ring-offset-2",
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
),
|
|
86
|
+
we(i),
|
|
87
|
+
d
|
|
88
|
+
), ke = (i) => f(
|
|
47
89
|
"absolute top-full left-0 right-0 z-50 mt-1 max-h-80 overflow-hidden rounded-lg border border-input-border bg-input-bg shadow-lg",
|
|
48
90
|
"transition-all duration-200 origin-top",
|
|
49
|
-
|
|
50
|
-
),
|
|
51
|
-
const l =
|
|
52
|
-
return
|
|
53
|
-
const
|
|
54
|
-
l.current && !l.current.contains(
|
|
91
|
+
i ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none"
|
|
92
|
+
), Ce = (i) => {
|
|
93
|
+
const l = _(null);
|
|
94
|
+
return ge(() => {
|
|
95
|
+
const d = (n) => {
|
|
96
|
+
l.current && !l.current.contains(n.target) && i();
|
|
55
97
|
};
|
|
56
|
-
return document.addEventListener("mousedown",
|
|
57
|
-
}, [
|
|
58
|
-
},
|
|
59
|
-
const [
|
|
60
|
-
(
|
|
61
|
-
const
|
|
98
|
+
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
99
|
+
}, [i]), l;
|
|
100
|
+
}, Ie = (i, l, d) => {
|
|
101
|
+
const [n, g] = L(-1), I = b(
|
|
102
|
+
(u) => {
|
|
103
|
+
const v = {
|
|
62
104
|
ArrowDown: () => {
|
|
63
|
-
|
|
105
|
+
u.preventDefault(), g((h) => Math.min(h + 1, i.length - 1));
|
|
64
106
|
},
|
|
65
107
|
ArrowUp: () => {
|
|
66
|
-
|
|
108
|
+
u.preventDefault(), g((h) => Math.max(h - 1, -1));
|
|
67
109
|
},
|
|
68
110
|
Enter: () => {
|
|
69
|
-
|
|
111
|
+
u.preventDefault(), n >= 0 && i[n] && l(i[n].value);
|
|
70
112
|
},
|
|
71
113
|
" ": () => {
|
|
72
|
-
|
|
114
|
+
u.preventDefault(), n >= 0 && i[n] && l(i[n].value);
|
|
73
115
|
},
|
|
74
116
|
Escape: () => {
|
|
75
|
-
|
|
117
|
+
u.preventDefault(), d();
|
|
76
118
|
}
|
|
77
|
-
}[
|
|
78
|
-
|
|
119
|
+
}[u.key];
|
|
120
|
+
v && v();
|
|
79
121
|
},
|
|
80
|
-
[
|
|
122
|
+
[i, n, l, d]
|
|
81
123
|
);
|
|
82
|
-
return { focusedIndex:
|
|
83
|
-
},
|
|
124
|
+
return { focusedIndex: n, setFocusedIndex: g, handleKeyDown: I };
|
|
125
|
+
}, Se = be(
|
|
84
126
|
({
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"aria-label":
|
|
107
|
-
"aria-describedby":
|
|
108
|
-
...
|
|
109
|
-
},
|
|
110
|
-
const
|
|
111
|
-
let e =
|
|
112
|
-
return
|
|
113
|
-
}, [
|
|
114
|
-
const e = {},
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
}), { groups: e, ungrouped:
|
|
118
|
-
}, [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
127
|
+
className: i,
|
|
128
|
+
clearAllLabel: l = "Clear all",
|
|
129
|
+
closeOnSelect: d = !1,
|
|
130
|
+
emptyMessage: n = "No options found",
|
|
131
|
+
errorMessage: g,
|
|
132
|
+
id: I,
|
|
133
|
+
label: u,
|
|
134
|
+
loadingMessage: M = "Loading options...",
|
|
135
|
+
maxCount: v = 3,
|
|
136
|
+
name: h,
|
|
137
|
+
onChange: p,
|
|
138
|
+
options: m = [],
|
|
139
|
+
placeholder: $ = "Select options",
|
|
140
|
+
searchPlaceholder: B = "Search options...",
|
|
141
|
+
selectAllLabel: H = "Select all",
|
|
142
|
+
showClearAll: V = !0,
|
|
143
|
+
showSearch: G = !0,
|
|
144
|
+
showSelectAll: U = !0,
|
|
145
|
+
sortAlphabetically: R = !1,
|
|
146
|
+
state: x = "default",
|
|
147
|
+
value: a = [],
|
|
148
|
+
"aria-label": Z,
|
|
149
|
+
"aria-describedby": q,
|
|
150
|
+
...z
|
|
151
|
+
}, J) => {
|
|
152
|
+
const Q = fe(), S = I || `${h}-${Q}`, K = `${S}-error`, [y, k] = L(!1), [D, W] = L(""), X = Ce(() => k(!1)), A = _(null), O = z.disabled || x === "disabled", Y = x === "loading", ee = x === "error", w = T(() => {
|
|
153
|
+
let e = m.filter((s) => s.label.toLowerCase().includes(D.toLowerCase()));
|
|
154
|
+
return R && (e = [...e].sort((s, t) => s.label.localeCompare(t.label))), e;
|
|
155
|
+
}, [m, D, R]), N = T(() => {
|
|
156
|
+
const e = {}, s = [];
|
|
157
|
+
return w.forEach((t) => {
|
|
158
|
+
t.group ? (e[t.group] || (e[t.group] = []), e[t.group].push(t)) : s.push(t);
|
|
159
|
+
}), { groups: e, ungrouped: s, hasGroups: Object.keys(e).length > 0 };
|
|
160
|
+
}, [w]), C = b(
|
|
161
|
+
(e) => {
|
|
162
|
+
if (m.find((c) => c.value === e)?.disabled) return;
|
|
163
|
+
const t = a.includes(e) ? a.filter((c) => c !== e) : [...a, e];
|
|
164
|
+
p(t), d && k(!1);
|
|
165
|
+
},
|
|
166
|
+
[m, a, p, d]
|
|
167
|
+
), { focusedIndex: te, handleKeyDown: re } = Ie(w, C, () => k(!1)), se = b(() => {
|
|
168
|
+
O || k((e) => (e || setTimeout(() => A.current?.focus(), 0), !e));
|
|
169
|
+
}, [O]), ie = b(() => {
|
|
170
|
+
const e = m.filter((t) => !t.disabled).map((t) => t.value), s = e.every((t) => a.includes(t));
|
|
171
|
+
p(s ? [] : e);
|
|
172
|
+
}, [m, a, p]), j = b(() => {
|
|
173
|
+
p([]);
|
|
174
|
+
}, [p]), oe = b((e) => {
|
|
175
|
+
W(e.target.value);
|
|
176
|
+
}, []), le = b(
|
|
177
|
+
(e, s) => {
|
|
178
|
+
s.stopPropagation(), C(e);
|
|
136
179
|
},
|
|
137
|
-
[
|
|
138
|
-
),
|
|
139
|
-
if (
|
|
140
|
-
return /* @__PURE__ */
|
|
141
|
-
const e =
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
-
e.map((
|
|
144
|
-
const c =
|
|
145
|
-
return c ? /* @__PURE__ */
|
|
180
|
+
[C]
|
|
181
|
+
), ne = () => {
|
|
182
|
+
if (a.length === 0)
|
|
183
|
+
return /* @__PURE__ */ r("span", { className: "text-input-text-placeholder", children: $ });
|
|
184
|
+
const e = a.slice(0, v), s = a.length - v;
|
|
185
|
+
return /* @__PURE__ */ o("div", { className: "flex items-center gap-1 flex-wrap", children: [
|
|
186
|
+
e.map((t) => {
|
|
187
|
+
const c = m.find((E) => E.value === t);
|
|
188
|
+
return c ? /* @__PURE__ */ o("span", { className: "inline-flex items-center gap-1 px-2 py-1 bg-input-bg--selected text-input-text rounded-md text-xs", children: [
|
|
146
189
|
c.label,
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
] },
|
|
190
|
+
/* @__PURE__ */ r("button", { "aria-label": `Remove ${c.label}`, className: "hover:text-danger focus:outline-none", "data-testid": "spectral-multiselect-remove-item-button", onClick: (E) => le(t, E), type: "button", children: /* @__PURE__ */ r(P, { size: 12 }) })
|
|
191
|
+
] }, t) : null;
|
|
149
192
|
}),
|
|
150
|
-
|
|
193
|
+
s > 0 && /* @__PURE__ */ o("span", { className: "text-input-text-secondary text-xs", children: [
|
|
151
194
|
"+",
|
|
152
|
-
|
|
195
|
+
s,
|
|
153
196
|
" more"
|
|
154
197
|
] })
|
|
155
198
|
] });
|
|
156
|
-
},
|
|
157
|
-
const
|
|
158
|
-
return /* @__PURE__ */
|
|
199
|
+
}, F = (e, s) => {
|
|
200
|
+
const t = a.includes(e.value);
|
|
201
|
+
return /* @__PURE__ */ o(
|
|
159
202
|
"button",
|
|
160
203
|
{
|
|
161
|
-
|
|
162
|
-
className: p(
|
|
204
|
+
className: f(
|
|
163
205
|
"w-full flex items-center gap-3 px-3 py-2 text-sm text-left hover:bg-input-bg--hover focus:bg-input-bg--hover focus:outline-none",
|
|
164
206
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
165
|
-
|
|
166
|
-
|
|
207
|
+
s === te && "bg-input-bg--hover",
|
|
208
|
+
t && "text-input-text font-medium"
|
|
167
209
|
),
|
|
168
|
-
onClick: () => N(e.value),
|
|
169
210
|
disabled: e.disabled,
|
|
211
|
+
onClick: () => C(e.value),
|
|
212
|
+
type: "button",
|
|
170
213
|
children: [
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-selected-indicator", className: f("flex items-center justify-center w-4 h-4 border border-input-border rounded", t && "bg-primary border-primary"), children: t && /* @__PURE__ */ r(ce, { size: 12 }) }),
|
|
215
|
+
/* @__PURE__ */ r("span", { children: e.label })
|
|
173
216
|
]
|
|
174
217
|
},
|
|
175
218
|
e.value
|
|
176
219
|
);
|
|
177
|
-
},
|
|
220
|
+
}, ae = () => ({
|
|
178
221
|
"--multiselect-border-radius": "0.5rem",
|
|
179
222
|
"--multiselect-trigger-height": "3rem",
|
|
180
223
|
"--multiselect-dropdown-max-height": "20rem"
|
|
181
224
|
});
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
/* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ o("div", { className: "w-full", "data-testid": "spectral-multiselect-root", children: [
|
|
226
|
+
/* @__PURE__ */ o("div", { className: "relative", "data-testid": "spectral-multiselect-wrapper", onKeyDown: y ? re : void 0, ref: X, children: [
|
|
227
|
+
/* @__PURE__ */ o(
|
|
185
228
|
"button",
|
|
186
229
|
{
|
|
187
|
-
|
|
230
|
+
"aria-controls": y ? S : void 0,
|
|
231
|
+
"aria-describedby": f(ee && K, q),
|
|
232
|
+
"aria-expanded": y,
|
|
233
|
+
"aria-label": Z || u,
|
|
234
|
+
className: Ne(x, y, i),
|
|
235
|
+
"data-state": x,
|
|
236
|
+
"data-testid": "spectral-multiselect-trigger",
|
|
237
|
+
disabled: O,
|
|
238
|
+
id: S,
|
|
239
|
+
name: h,
|
|
240
|
+
onClick: se,
|
|
241
|
+
ref: J,
|
|
242
|
+
role: "combobox",
|
|
243
|
+
style: ae(),
|
|
188
244
|
type: "button",
|
|
189
|
-
|
|
190
|
-
name: L,
|
|
191
|
-
className: Ce(u, g, U),
|
|
192
|
-
onClick: le,
|
|
193
|
-
disabled: k,
|
|
194
|
-
"aria-label": X || z,
|
|
195
|
-
"aria-describedby": p(re && M, J),
|
|
196
|
-
"aria-expanded": g,
|
|
197
|
-
"aria-haspopup": "listbox",
|
|
198
|
-
"data-state": u,
|
|
199
|
-
style: ce(),
|
|
200
|
-
..._,
|
|
245
|
+
...z,
|
|
201
246
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
|
|
205
|
-
"
|
|
247
|
+
/* @__PURE__ */ r("div", { className: "flex-1 min-w-0", "data-testid": "spectral-multiselect-selected-items", children: ne() }),
|
|
248
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 ml-2", children: [
|
|
249
|
+
a.length > 0 && /* @__PURE__ */ r(
|
|
250
|
+
"span",
|
|
206
251
|
{
|
|
207
|
-
|
|
252
|
+
"aria-label": "Clear all selections",
|
|
253
|
+
className: "text-input-icon hover:text-input-icon--hover focus:outline-none cursor-pointer",
|
|
254
|
+
"data-testid": "spectral-multiselect-clear-all-button",
|
|
208
255
|
onClick: (e) => {
|
|
209
|
-
e.stopPropagation(),
|
|
256
|
+
e.stopPropagation(), j();
|
|
210
257
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
258
|
+
onKeyDown: (e) => {
|
|
259
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), j());
|
|
260
|
+
},
|
|
261
|
+
tabIndex: 0,
|
|
262
|
+
children: /* @__PURE__ */ r(P, { size: 12 })
|
|
214
263
|
}
|
|
215
264
|
),
|
|
216
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ r(ue, { className: f("text-input-icon transition-transform duration-200", y && "rotate-180"), size: 20 })
|
|
217
266
|
] })
|
|
218
267
|
]
|
|
219
268
|
}
|
|
220
269
|
),
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
-
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ r("div", { className: ke(y), "data-testid": "spectral-multiselect-dropdown", children: /* @__PURE__ */ o("div", { className: "p-1", children: [
|
|
271
|
+
G && /* @__PURE__ */ o("div", { className: "relative mb-2", children: [
|
|
272
|
+
/* @__PURE__ */ r(ye, { className: f(ve, "absolute left-3 top-1/2 -translate-y-1/2 text-input-icon") }),
|
|
273
|
+
/* @__PURE__ */ r(
|
|
225
274
|
"input",
|
|
226
275
|
{
|
|
227
|
-
|
|
228
|
-
type: "text",
|
|
276
|
+
"aria-label": "Search options",
|
|
229
277
|
className: "w-full pl-9 pr-3 py-2 text-sm border border-input-border rounded-md bg-input-bg focus:border-input-border--focus focus:outline-none focus:ring-1 focus:ring-black",
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
278
|
+
"data-testid": "spectral-multiselect-search-input",
|
|
279
|
+
onChange: oe,
|
|
280
|
+
placeholder: B,
|
|
281
|
+
ref: A,
|
|
282
|
+
type: "text",
|
|
283
|
+
value: D
|
|
234
284
|
}
|
|
235
285
|
)
|
|
236
286
|
] }),
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
|
|
240
|
-
] }) :
|
|
241
|
-
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
|
|
287
|
+
/* @__PURE__ */ r("div", { className: "max-h-64 overflow-y-auto", role: "listbox", "aria-multiselectable": "true", children: Y ? /* @__PURE__ */ o("div", { "data-testid": "spectral-multiselect-loading", className: "flex items-center justify-center gap-2 py-6 text-sm text-input-text-secondary", children: [
|
|
288
|
+
/* @__PURE__ */ r(pe, {}),
|
|
289
|
+
M
|
|
290
|
+
] }) : w.length === 0 ? /* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-empty-message", className: "py-6 text-center text-sm text-input-text-secondary", children: n }) : /* @__PURE__ */ o(de, { children: [
|
|
291
|
+
U && /* @__PURE__ */ o("div", { className: "mb-1", children: [
|
|
292
|
+
/* @__PURE__ */ r(
|
|
293
|
+
"button",
|
|
294
|
+
{
|
|
295
|
+
className: "w-full flex items-center gap-3 px-3 py-2 text-sm font-medium text-input-text-secondary hover:bg-input-bg--hover focus:bg-input-bg--hover focus:outline-none",
|
|
296
|
+
"data-testid": "spectral-multiselect-select-all-button",
|
|
297
|
+
onClick: ie,
|
|
298
|
+
type: "button",
|
|
299
|
+
children: H
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" })
|
|
244
303
|
] }),
|
|
245
|
-
|
|
246
|
-
Object.entries(
|
|
247
|
-
(
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
|
|
304
|
+
N.ungrouped.length > 0 && /* @__PURE__ */ r("div", { className: "mb-1", children: N.ungrouped.map((e, s) => F(e, s)) }),
|
|
305
|
+
Object.entries(N.groups).map(([e, s]) => /* @__PURE__ */ o("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
|
|
306
|
+
(N.ungrouped.length > 0 || Object.keys(N.groups).indexOf(e) > 0) && /* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" }),
|
|
307
|
+
/* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-group-name", className: "px-3 py-1 text-xs font-semibold text-input-text-secondary uppercase tracking-wide", children: e }),
|
|
308
|
+
s.map((t, c) => F(t, w.indexOf(t)))
|
|
250
309
|
] }, e)),
|
|
251
|
-
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
310
|
+
V && a.length > 0 && /* @__PURE__ */ o("div", { className: "mt-1", children: [
|
|
311
|
+
/* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" }),
|
|
312
|
+
/* @__PURE__ */ r("button", { className: "w-full flex items-center gap-3 px-3 py-2 text-sm font-medium text-danger hover:bg-danger-50 focus:bg-danger-50 focus:outline-none", "data-testid": "spectral-multiselect-clear-all-button", onClick: j, type: "button", children: l })
|
|
254
313
|
] })
|
|
255
314
|
] }) })
|
|
256
315
|
] }) })
|
|
257
316
|
] }),
|
|
258
|
-
|
|
317
|
+
x === "error" && g && /* @__PURE__ */ r(me, { id: K, dataTestId: "spectral-multiselect-error-message", message: g })
|
|
259
318
|
] });
|
|
260
319
|
}
|
|
261
320
|
);
|
|
262
|
-
|
|
321
|
+
Se.displayName = "MultiSelectBase";
|
|
263
322
|
export {
|
|
264
|
-
|
|
323
|
+
Se as MultiSelectBase
|
|
265
324
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { MultiSelectBaseProps } from './MultiSelectBase';
|
|
2
|
-
export interface MultiSelectProps extends Omit<MultiSelectBaseProps, 'onChange' | 'options'> {
|
|
2
|
+
export interface MultiSelectProps extends Omit<MultiSelectBaseProps, 'onChange' | 'options' | 'value'> {
|
|
3
3
|
onSearchChange?: (search: string) => void;
|
|
4
|
-
onValueChange
|
|
4
|
+
onValueChange?: (value: string[]) => void;
|
|
5
|
+
value?: string[];
|
|
5
6
|
options: Array<{
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
group?: string;
|
|
6
9
|
label: string;
|
|
7
10
|
value: string;
|
|
8
|
-
group?: string;
|
|
9
11
|
}>;
|
|
10
|
-
loading?: boolean;
|
|
11
12
|
emptyText?: string;
|
|
13
|
+
loading?: boolean;
|
|
12
14
|
sortAlphabetically?: boolean;
|
|
13
15
|
}
|
|
14
16
|
export declare const MultiSelect: import('react').ForwardRefExoticComponent<MultiSelectProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { MultiSelectBase as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
value: e.value,
|
|
3
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
4
|
+
import { MultiSelectBase as f } from "./MultiSelectBase.js";
|
|
5
|
+
import { forwardRef as c } from "react";
|
|
6
|
+
const n = c(({ emptyText: l = "No matches found.", loading: t = !1, onValueChange: d, options: s, state: i, value: o = [], ...a }, r) => {
|
|
7
|
+
const m = s.map((e) => ({
|
|
8
|
+
disabled: e.disabled ?? !1,
|
|
10
9
|
group: e.group,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
label: e.label,
|
|
11
|
+
value: e.value
|
|
12
|
+
})), b = t ? "loading" : i;
|
|
13
|
+
return /* @__PURE__ */ u(f, { disabled: a.disabled, "data-disabled": a.disabled, emptyMessage: l, onChange: d ?? (() => {
|
|
14
|
+
}), options: m, ref: r, state: b, value: o, ...a });
|
|
14
15
|
});
|
|
15
|
-
|
|
16
|
+
n.displayName = "MultiSelect";
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
+
n as MultiSelect
|
|
18
19
|
};
|
package/dist/Popover.js
CHANGED
|
@@ -218,11 +218,12 @@ function $(e) {
|
|
|
218
218
|
return e ? "open" : "closed";
|
|
219
219
|
}
|
|
220
220
|
var ce = F, pe = y, ie = D, le = M, ue = T;
|
|
221
|
-
const Re = ({ ...e }) => /* @__PURE__ */ s(ce, { "data-slot": "popover", ...e }), Ae = ({ ...e }) => /* @__PURE__ */ s(ie, { "data-slot": "popover-trigger", ...e }), xe = ({ align: e = "center", className: n, side: r = "bottom", sideOffset: a = 4, width: o = "w-fit", ...t }) => /* @__PURE__ */ s(le, { children: /* @__PURE__ */ s(
|
|
221
|
+
const Re = ({ ...e }) => /* @__PURE__ */ s(ce, { "data-slot": "popover", "data-testid": "spectral-popover", ...e }), Ae = ({ ...e }) => /* @__PURE__ */ s(ie, { "data-slot": "popover-trigger", "data-testid": "spectral-popover-trigger", ...e }), xe = ({ align: e = "center", className: n, side: r = "bottom", sideOffset: a = 4, width: o = "w-fit", ...t }) => /* @__PURE__ */ s(le, { children: /* @__PURE__ */ s(
|
|
222
222
|
ue,
|
|
223
223
|
{
|
|
224
224
|
align: e,
|
|
225
225
|
"data-slot": "popover-content",
|
|
226
|
+
"data-testid": "spectral-popover-content",
|
|
226
227
|
side: r,
|
|
227
228
|
sideOffset: a,
|
|
228
229
|
className: Q(
|