@spear-ai/spectral 1.4.25 → 1.4.27
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 +28 -9
- package/dist/Accordion.js +203 -183
- package/dist/Alert/AlertBase.d.ts +24 -16
- package/dist/Alert/AlertBase.js +33 -18
- package/dist/Alert.js +1 -1
- package/dist/Avatar.js +11 -11
- package/dist/Button.d.ts +7 -2
- package/dist/Button.js +25 -12
- package/dist/ButtonIcon.d.ts +7 -2
- package/dist/ButtonIcon.js +25 -16
- package/dist/Card.js +1 -1
- package/dist/Checkbox/CheckboxBase.d.ts +13 -13
- package/dist/Checkbox/CheckboxBase.js +128 -125
- package/dist/Checkbox.d.ts +7 -2
- package/dist/Checkbox.js +29 -22
- package/dist/DataCard.js +3 -3
- package/dist/Dialog.js +2 -2
- package/dist/Drawer.js +2 -2
- package/dist/HoverCard.js +1 -1
- package/dist/Icons/AnalyzeIcon.d.ts +3 -1
- package/dist/Icons/AnalyzeIcon.js +3 -6
- package/dist/Icons/AnnotationsIcon.d.ts +3 -1
- package/dist/Icons/AnnotationsIcon.js +3 -6
- package/dist/Icons/ApprovedIcon.d.ts +3 -1
- package/dist/Icons/ApprovedIcon.js +3 -6
- package/dist/Icons/ArrowDownIcon.d.ts +3 -1
- package/dist/Icons/ArrowDownIcon.js +3 -6
- package/dist/Icons/ArrowUpIcon.d.ts +3 -1
- package/dist/Icons/ArrowUpIcon.js +4 -7
- package/dist/Icons/CalendarIcon.d.ts +3 -1
- package/dist/Icons/CalendarIcon.js +9 -12
- package/dist/Icons/CheckCircleIcon.d.ts +3 -1
- package/dist/Icons/CheckCircleIcon.js +2 -5
- package/dist/Icons/CheckSquareIcon.d.ts +3 -1
- package/dist/Icons/CheckSquareIcon.js +4 -7
- package/dist/Icons/CheckmarkIcon.d.ts +3 -1
- package/dist/Icons/CheckmarkIcon.js +5 -8
- package/dist/Icons/ChevronDownIcon.d.ts +3 -1
- package/dist/Icons/ChevronDownIcon.js +5 -8
- package/dist/Icons/ChevronUpIcon.d.ts +3 -1
- package/dist/Icons/ChevronUpIcon.js +5 -8
- package/dist/Icons/ClockIcon.d.ts +3 -1
- package/dist/Icons/ClockIcon.js +5 -8
- package/dist/Icons/CloseCircleIcon.d.ts +3 -1
- package/dist/Icons/CloseCircleIcon.js +4 -7
- package/dist/Icons/CloseIcon.d.ts +3 -1
- package/dist/Icons/CloseIcon.js +5 -8
- package/dist/Icons/DashboardIcon.d.ts +3 -1
- package/dist/Icons/DashboardIcon.js +3 -6
- package/dist/Icons/DatabaseIcon.d.ts +3 -1
- package/dist/Icons/DatabaseIcon.js +4 -7
- package/dist/Icons/DeleteIcon.d.ts +3 -1
- package/dist/Icons/DeleteIcon.js +4 -7
- package/dist/Icons/DurationIcon.d.ts +3 -1
- package/dist/Icons/DurationIcon.js +3 -6
- package/dist/Icons/EditIcon.d.ts +3 -1
- package/dist/Icons/EditIcon.js +3 -6
- package/dist/Icons/EmailIcon.d.ts +3 -1
- package/dist/Icons/EmailIcon.js +4 -7
- package/dist/Icons/EraserIcon.d.ts +3 -1
- package/dist/Icons/EraserIcon.js +9 -10
- package/dist/Icons/ErrorIcon.d.ts +3 -1
- package/dist/Icons/ErrorIcon.js +4 -7
- package/dist/Icons/EyeClosedIcon.d.ts +3 -1
- package/dist/Icons/EyeClosedIcon.js +4 -7
- package/dist/Icons/EyeClosedIcon2.d.ts +3 -1
- package/dist/Icons/EyeClosedIcon2.js +3 -6
- package/dist/Icons/EyeOpenIcon.d.ts +3 -1
- package/dist/Icons/EyeOpenIcon.js +6 -9
- package/dist/Icons/GoToFirstIcon.d.ts +3 -1
- package/dist/Icons/GoToFirstIcon.js +4 -7
- package/dist/Icons/GoToLastIcon.d.ts +3 -1
- package/dist/Icons/GoToLastIcon.js +4 -7
- package/dist/Icons/HarmonicCursorsIcon.d.ts +3 -1
- package/dist/Icons/HarmonicCursorsIcon.js +4 -7
- package/dist/Icons/IconBase.d.ts +4 -2
- package/dist/Icons/IconBase.js +17 -8
- package/dist/Icons/InfoIcon.d.ts +3 -1
- package/dist/Icons/InfoIcon.js +4 -7
- package/dist/Icons/LabelIcon.d.ts +3 -1
- package/dist/Icons/LabelIcon.js +3 -6
- package/dist/Icons/LassoIcon.d.ts +3 -1
- package/dist/Icons/LassoIcon.js +5 -8
- package/dist/Icons/LineToolIcon.d.ts +3 -1
- package/dist/Icons/LineToolIcon.js +3 -6
- package/dist/Icons/LineToolIcon2.d.ts +3 -1
- package/dist/Icons/LineToolIcon2.js +3 -6
- package/dist/Icons/LiveViewIcon.d.ts +3 -1
- package/dist/Icons/LiveViewIcon.js +2 -5
- package/dist/Icons/LoaderIcon.d.ts +3 -1
- package/dist/Icons/LoaderIcon.js +6 -7
- package/dist/Icons/LocationIcon.d.ts +3 -1
- package/dist/Icons/LocationIcon.js +3 -6
- package/dist/Icons/LogoutIcon.d.ts +3 -1
- package/dist/Icons/LogoutIcon.js +4 -7
- package/dist/Icons/MessagesIcon.d.ts +3 -1
- package/dist/Icons/MessagesIcon.js +5 -8
- package/dist/Icons/MetadataIcon.d.ts +3 -1
- package/dist/Icons/MetadataIcon.js +4 -7
- package/dist/Icons/MinusIcon.d.ts +3 -1
- package/dist/Icons/MinusIcon.js +3 -6
- package/dist/Icons/OntologyIcon.d.ts +3 -1
- package/dist/Icons/OntologyIcon.js +2 -5
- package/dist/Icons/PanelIconClose.d.ts +3 -1
- package/dist/Icons/PanelIconClose.js +4 -7
- package/dist/Icons/PanelIconOpen.d.ts +3 -1
- package/dist/Icons/PanelIconOpen.js +8 -11
- package/dist/Icons/PlayIcon.d.ts +3 -1
- package/dist/Icons/PlayIcon.js +3 -6
- package/dist/Icons/PlusIcon.d.ts +3 -1
- package/dist/Icons/PlusIcon.js +4 -7
- package/dist/Icons/ResetIcon.d.ts +3 -1
- package/dist/Icons/ResetIcon.js +4 -7
- package/dist/Icons/ReviewedIcon.d.ts +3 -1
- package/dist/Icons/ReviewedIcon.js +3 -6
- package/dist/Icons/ScissorsIcon.d.ts +3 -1
- package/dist/Icons/ScissorsIcon.js +6 -9
- package/dist/Icons/SettingsIcon.d.ts +3 -1
- package/dist/Icons/SettingsIcon.js +3 -6
- package/dist/Icons/SortAscendingIcon.d.ts +3 -1
- package/dist/Icons/SortAscendingIcon.js +3 -6
- package/dist/Icons/SortAtoZIcon.d.ts +3 -1
- package/dist/Icons/SortAtoZIcon.js +3 -6
- package/dist/Icons/SortDescendingIcon.d.ts +3 -1
- package/dist/Icons/SortDescendingIcon.js +3 -6
- package/dist/Icons/SortZtoAIcon.d.ts +3 -1
- package/dist/Icons/SortZtoAIcon.js +3 -6
- package/dist/Icons/StackIcon.d.ts +3 -1
- package/dist/Icons/StackIcon.js +4 -7
- package/dist/Icons/StarIcon.d.ts +3 -1
- package/dist/Icons/StarIcon.js +3 -6
- package/dist/Icons/TrashIcon.d.ts +3 -1
- package/dist/Icons/TrashIcon.js +3 -6
- package/dist/Icons/UndoIcon.d.ts +3 -1
- package/dist/Icons/UndoIcon.js +4 -7
- package/dist/Icons/UserIcon.d.ts +3 -1
- package/dist/Icons/UserIcon.js +3 -6
- package/dist/Icons/WarningIcon.d.ts +3 -1
- package/dist/Icons/WarningIcon.js +5 -8
- package/dist/Icons/ZoomAllIcon.d.ts +3 -1
- package/dist/Icons/ZoomAllIcon.js +3 -6
- package/dist/Icons/ZoomXIcon.d.ts +3 -1
- package/dist/Icons/ZoomXIcon.js +4 -7
- package/dist/Icons/ZoomYIcon.d.ts +3 -1
- package/dist/Icons/ZoomYIcon.js +4 -7
- package/dist/Input/InputUtils.d.ts +4 -4
- package/dist/Input/InputUtils.js +1 -1
- package/dist/Input.d.ts +7 -17
- package/dist/Input.js +105 -101
- package/dist/InputOTP.d.ts +27 -7
- package/dist/InputOTP.js +171 -146
- package/dist/Label.d.ts +7 -2
- package/dist/Label.js +12 -9
- package/dist/MultiSelect/MultiSelectBase.d.ts +7 -2
- package/dist/MultiSelect/MultiSelectBase.js +212 -213
- package/dist/{MultiSelect/MutiSelect.d.ts → MultiSelect.d.ts} +8 -2
- package/dist/MultiSelect.js +27 -0
- package/dist/Popover.js +1 -1
- package/dist/RadioButtonGroup.js +1 -1
- package/dist/RadioGroup.d.ts +20 -14
- package/dist/RadioGroup.js +177 -148
- package/dist/Select.d.ts +7 -2
- package/dist/Select.js +108 -109
- package/dist/Separator.d.ts +8 -8
- package/dist/Separator.js +14 -15
- package/dist/Switch/SwitchBase.d.ts +13 -11
- package/dist/Switch/SwitchBase.js +84 -61
- package/dist/Switch.d.ts +11 -4
- package/dist/Switch.js +19 -20
- package/dist/Tabs/TabsBase.d.ts +16 -6
- package/dist/Tabs/TabsBase.js +133 -96
- package/dist/Tabs/tabsUtils.d.ts +6 -2
- package/dist/Tabs/tabsUtils.js +5 -2
- package/dist/Tabs.js +18 -18
- package/dist/Textarea.d.ts +7 -2
- package/dist/Textarea.js +78 -61
- package/dist/Toggle/ToggleBase.d.ts +4 -8
- package/dist/Toggle/ToggleBase.js +29 -16
- package/dist/Toggle.d.ts +4 -2
- package/dist/Toggle.js +23 -13
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +4 -7
- package/dist/ToggleGroup/ToggleGroupBase.js +82 -73
- package/dist/ToggleGroup.d.ts +7 -2
- package/dist/ToggleGroup.js +31 -19
- package/dist/Tray.d.ts +47 -15
- package/dist/Tray.js +98 -60
- package/dist/hooks/useAccordionAutoScroll.d.ts +1 -1
- package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
- package/dist/hooks/useAccordionAutoScroll.js +35 -34
- package/dist/{index-BSCg4Mei.js → index-B0Kp8R0j.js} +3 -3
- package/dist/{index-jgQ7sgLl.js → index-D4jMMaAi.js} +5 -5
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +1 -4
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +4 -11
- package/dist/primitives/slot.d.ts +11 -4
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +32 -28
- package/dist/primitives/textarea.d.ts.map +1 -1
- package/dist/primitives/textarea.js +1 -3
- package/dist/utils/formFieldUtils.js +2 -2
- package/package.json +1 -1
- package/dist/MultiSelect/MutiSelect.js +0 -19
|
@@ -14,7 +14,7 @@ import { ChevronDownIcon as ue } from "../Icons/ChevronDownIcon.js";
|
|
|
14
14
|
import "../Icons/ChevronUpIcon.js";
|
|
15
15
|
import "../Icons/ClockIcon.js";
|
|
16
16
|
import "../Icons/CloseCircleIcon.js";
|
|
17
|
-
import { CloseIcon as
|
|
17
|
+
import { CloseIcon as T } from "../Icons/CloseIcon.js";
|
|
18
18
|
import "../Icons/DashboardIcon.js";
|
|
19
19
|
import "../Icons/DatabaseIcon.js";
|
|
20
20
|
import "../Icons/DeleteIcon.js";
|
|
@@ -64,260 +64,259 @@ import "../Icons/ZoomAllIcon.js";
|
|
|
64
64
|
import "../Icons/ZoomXIcon.js";
|
|
65
65
|
import "../Icons/ZoomYIcon.js";
|
|
66
66
|
import { ErrorMessage as me } from "../utils/formFieldUtils.js";
|
|
67
|
-
import { cn as
|
|
68
|
-
import {
|
|
69
|
-
import { c as
|
|
70
|
-
const
|
|
67
|
+
import { cn as x } from "../utils/twUtils.js";
|
|
68
|
+
import { useId as be, useState as L, useRef as $, useMemo as _, useCallback as b, useEffect as fe } from "react";
|
|
69
|
+
import { c as ge } from "../createLucideIcon-D4r5Phnh.js";
|
|
70
|
+
const he = [
|
|
71
71
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
72
72
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
73
|
-
],
|
|
73
|
+
], xe = ge("search", he), ye = "h-4 w-4", ve = (s) => ({
|
|
74
74
|
error: "border-danger hover:border-danger focus-visible:border-danger focus-visible:ring-danger",
|
|
75
75
|
loading: "cursor-wait border-input-border--disabled",
|
|
76
76
|
disabled: "cursor-not-allowed opacity-50 border-input-border--disabled bg-input-bg--disabled",
|
|
77
77
|
default: ""
|
|
78
|
-
})[s],
|
|
78
|
+
})[s], we = (s, n, d) => x(
|
|
79
79
|
"flex h-12 w-full items-center justify-between rounded-lg border border-input-border bg-input-bg px-4 py-3 text-sm",
|
|
80
80
|
"hover:border-input-border--hover focus:border-input-border--focus focus:outline-none",
|
|
81
81
|
"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",
|
|
82
82
|
"disabled:cursor-not-allowed disabled:opacity-50 disabled:border-input-border--disabled disabled:bg-input-bg--disabled",
|
|
83
83
|
"transition duration-200 text-input-text",
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
n && "border-input-border--focus ring-2 ring-black ring-offset-2",
|
|
85
|
+
ve(s),
|
|
86
86
|
d
|
|
87
|
-
),
|
|
87
|
+
), Ne = (s) => x(
|
|
88
88
|
"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",
|
|
89
89
|
"transition-all duration-200 origin-top",
|
|
90
90
|
s ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none"
|
|
91
|
-
),
|
|
92
|
-
const
|
|
93
|
-
return
|
|
94
|
-
const d = (
|
|
95
|
-
|
|
91
|
+
), ke = (s) => {
|
|
92
|
+
const n = $(null);
|
|
93
|
+
return fe(() => {
|
|
94
|
+
const d = (l) => {
|
|
95
|
+
n.current && !n.current.contains(l.target) && s();
|
|
96
96
|
};
|
|
97
97
|
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
98
|
-
}, [s]),
|
|
99
|
-
},
|
|
100
|
-
const [
|
|
98
|
+
}, [s]), n;
|
|
99
|
+
}, Ce = (s, n, d) => {
|
|
100
|
+
const [l, y] = L(-1), N = b(
|
|
101
101
|
(u) => {
|
|
102
|
-
const
|
|
102
|
+
const k = {
|
|
103
103
|
ArrowDown: () => {
|
|
104
|
-
u.preventDefault(),
|
|
104
|
+
u.preventDefault(), y((f) => Math.min(f + 1, s.length - 1));
|
|
105
105
|
},
|
|
106
106
|
ArrowUp: () => {
|
|
107
|
-
u.preventDefault(),
|
|
107
|
+
u.preventDefault(), y((f) => Math.max(f - 1, -1));
|
|
108
108
|
},
|
|
109
109
|
Enter: () => {
|
|
110
|
-
u.preventDefault(),
|
|
110
|
+
u.preventDefault(), l >= 0 && s[l] && n(s[l].value);
|
|
111
111
|
},
|
|
112
112
|
" ": () => {
|
|
113
|
-
u.preventDefault(),
|
|
113
|
+
u.preventDefault(), l >= 0 && s[l] && n(s[l].value);
|
|
114
114
|
},
|
|
115
115
|
Escape: () => {
|
|
116
116
|
u.preventDefault(), d();
|
|
117
117
|
}
|
|
118
118
|
}[u.key];
|
|
119
|
-
|
|
119
|
+
k && k();
|
|
120
120
|
},
|
|
121
|
-
[s,
|
|
121
|
+
[s, l, n, d]
|
|
122
122
|
);
|
|
123
|
-
return { focusedIndex:
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
123
|
+
return { focusedIndex: l, setFocusedIndex: y, handleKeyDown: N };
|
|
124
|
+
}, Ie = ({
|
|
125
|
+
ref: s,
|
|
126
|
+
className: n,
|
|
127
|
+
clearAllLabel: d = "Clear all",
|
|
128
|
+
closeOnSelect: l = !1,
|
|
129
|
+
emptyMessage: y = "No options found",
|
|
130
|
+
errorMessage: N,
|
|
131
|
+
id: u,
|
|
132
|
+
label: M,
|
|
133
|
+
loadingMessage: k = "Loading options...",
|
|
134
|
+
maxCount: f = 3,
|
|
135
|
+
name: z,
|
|
136
|
+
onChange: p,
|
|
137
|
+
options: m = [],
|
|
138
|
+
placeholder: B = "Select options",
|
|
139
|
+
searchPlaceholder: H = "Search options...",
|
|
140
|
+
selectAllLabel: V = "Select all",
|
|
141
|
+
showClearAll: G = !0,
|
|
142
|
+
showSearch: U = !0,
|
|
143
|
+
showSelectAll: Z = !0,
|
|
144
|
+
sortAlphabetically: K = !1,
|
|
145
|
+
state: g = "default",
|
|
146
|
+
value: a = [],
|
|
147
|
+
"aria-label": q,
|
|
148
|
+
"aria-describedby": J,
|
|
149
|
+
...R
|
|
150
|
+
}) => {
|
|
151
|
+
const Q = be(), S = u || `${z}-${Q}`, A = `${S}-error`, [h, C] = L(!1), [D, W] = L(""), X = ke(() => C(!1)), F = $(null), O = R.disabled || g === "disabled", Y = g === "loading", ee = g === "error", v = _(() => {
|
|
152
|
+
let e = m.filter((i) => i.label.toLowerCase().includes(D.toLowerCase()));
|
|
153
|
+
return K && (e = [...e].sort((i, t) => i.label.localeCompare(t.label))), e;
|
|
154
|
+
}, [m, D, K]), w = _(() => {
|
|
155
|
+
const e = {}, i = [];
|
|
156
|
+
return v.forEach((t) => {
|
|
157
|
+
t.group ? (e[t.group] || (e[t.group] = []), e[t.group].push(t)) : i.push(t);
|
|
158
|
+
}), { groups: e, ungrouped: i, hasGroups: Object.keys(e).length > 0 };
|
|
159
|
+
}, [v]), I = b(
|
|
160
|
+
(e) => {
|
|
161
|
+
if (m.find((c) => c.value === e)?.disabled) return;
|
|
162
|
+
const t = a.includes(e) ? a.filter((c) => c !== e) : [...a, e];
|
|
163
|
+
p(t), l && C(!1);
|
|
164
|
+
},
|
|
165
|
+
[m, a, p, l]
|
|
166
|
+
), { focusedIndex: te, handleKeyDown: re } = Ce(v, I, () => C(!1)), ie = b(() => {
|
|
167
|
+
O || C((e) => (e || setTimeout(() => F.current?.focus(), 0), !e));
|
|
168
|
+
}, [O]), se = b(() => {
|
|
169
|
+
const e = m.filter((t) => !t.disabled).map((t) => t.value), i = e.every((t) => a.includes(t));
|
|
170
|
+
p(i ? [] : e);
|
|
171
|
+
}, [m, a, p]), j = b(() => {
|
|
172
|
+
p([]);
|
|
173
|
+
}, [p]), oe = b((e) => {
|
|
174
|
+
W(e.target.value);
|
|
175
|
+
}, []), le = b(
|
|
176
|
+
(e, i) => {
|
|
177
|
+
i.stopPropagation(), I(e);
|
|
178
|
+
},
|
|
179
|
+
[I]
|
|
180
|
+
), ne = () => {
|
|
181
|
+
if (a.length === 0)
|
|
182
|
+
return /* @__PURE__ */ r("span", { className: "text-input-text-placeholder", children: B });
|
|
183
|
+
const e = a.slice(0, f), i = a.length - f;
|
|
184
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
185
|
+
e.map((t) => {
|
|
186
|
+
const c = m.find((E) => E.value === t);
|
|
187
|
+
return c ? /* @__PURE__ */ o("span", { className: "bg-input-bg--selected text-input-text inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs", children: [
|
|
188
|
+
c.label,
|
|
189
|
+
/* @__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(T, { size: 12 }) })
|
|
190
|
+
] }, t) : null;
|
|
191
|
+
}),
|
|
192
|
+
i > 0 && /* @__PURE__ */ o("span", { className: "text-input-text-secondary text-xs", children: [
|
|
193
|
+
"+",
|
|
194
|
+
i,
|
|
195
|
+
" more"
|
|
196
|
+
] })
|
|
197
|
+
] });
|
|
198
|
+
}, P = (e, i) => {
|
|
199
|
+
const t = a.includes(e.value);
|
|
200
|
+
return /* @__PURE__ */ o(
|
|
201
|
+
"button",
|
|
202
|
+
{
|
|
203
|
+
className: x(
|
|
204
|
+
"hover:bg-input-bg--hover focus:bg-input-bg--hover flex w-full items-center gap-3 px-3 py-2 text-left text-sm focus:outline-none",
|
|
205
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
206
|
+
i === te && "bg-input-bg--hover",
|
|
207
|
+
t && "text-input-text font-medium"
|
|
208
|
+
),
|
|
209
|
+
disabled: e.disabled,
|
|
210
|
+
onClick: () => I(e.value),
|
|
211
|
+
type: "button",
|
|
212
|
+
children: [
|
|
213
|
+
/* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-selected-indicator", className: x("border-input-border flex h-4 w-4 items-center justify-center rounded border", t && "bg-primary border-primary"), children: t && /* @__PURE__ */ r(ce, { size: 12 }) }),
|
|
214
|
+
/* @__PURE__ */ r("span", { children: e.label })
|
|
215
|
+
]
|
|
178
216
|
},
|
|
179
|
-
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
/* @__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 }) })
|
|
190
|
-
] }, t) : null;
|
|
191
|
-
}),
|
|
192
|
-
i > 0 && /* @__PURE__ */ o("span", { className: "text-input-text-secondary text-xs", children: [
|
|
193
|
-
"+",
|
|
194
|
-
i,
|
|
195
|
-
" more"
|
|
196
|
-
] })
|
|
197
|
-
] });
|
|
198
|
-
}, F = (e, i) => {
|
|
199
|
-
const t = a.includes(e.value);
|
|
200
|
-
return /* @__PURE__ */ o(
|
|
217
|
+
e.value
|
|
218
|
+
);
|
|
219
|
+
}, ae = () => ({
|
|
220
|
+
"--multiselect-border-radius": "0.5rem",
|
|
221
|
+
"--multiselect-trigger-height": "3rem",
|
|
222
|
+
"--multiselect-dropdown-max-height": "20rem"
|
|
223
|
+
});
|
|
224
|
+
return /* @__PURE__ */ o("div", { className: "w-full", "data-testid": "spectral-multiselect-root", children: [
|
|
225
|
+
/* @__PURE__ */ o("div", { className: "relative", "data-testid": "spectral-multiselect-wrapper", onKeyDown: h ? re : void 0, ref: X, children: [
|
|
226
|
+
/* @__PURE__ */ o(
|
|
201
227
|
"button",
|
|
202
228
|
{
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
229
|
+
"aria-controls": h ? S : void 0,
|
|
230
|
+
"aria-describedby": [ee ? A : null, J].filter(Boolean).join(" ") || void 0,
|
|
231
|
+
"aria-expanded": h,
|
|
232
|
+
"aria-label": q || M,
|
|
233
|
+
className: we(g, h, n),
|
|
234
|
+
"data-state": g,
|
|
235
|
+
"data-testid": "spectral-multiselect-trigger",
|
|
236
|
+
disabled: O,
|
|
237
|
+
id: S,
|
|
238
|
+
name: z,
|
|
239
|
+
onClick: ie,
|
|
240
|
+
ref: s,
|
|
241
|
+
role: "combobox",
|
|
242
|
+
style: ae(),
|
|
211
243
|
type: "button",
|
|
244
|
+
...R,
|
|
212
245
|
children: [
|
|
213
|
-
/* @__PURE__ */ r("div", {
|
|
214
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1", "data-testid": "spectral-multiselect-selected-items", children: ne() }),
|
|
247
|
+
/* @__PURE__ */ o("div", { className: "ml-2 flex items-center gap-2", children: [
|
|
248
|
+
a.length > 0 && /* @__PURE__ */ r(
|
|
249
|
+
"span",
|
|
250
|
+
{
|
|
251
|
+
"aria-label": "Clear all selections",
|
|
252
|
+
className: "text-input-icon hover:text-input-icon--hover cursor-pointer focus:outline-none",
|
|
253
|
+
"data-testid": "spectral-multiselect-clear-all-button",
|
|
254
|
+
onClick: (e) => {
|
|
255
|
+
e.stopPropagation(), j();
|
|
256
|
+
},
|
|
257
|
+
onKeyDown: (e) => {
|
|
258
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), j());
|
|
259
|
+
},
|
|
260
|
+
tabIndex: 0,
|
|
261
|
+
children: /* @__PURE__ */ r(T, { size: 12 })
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ r(ue, { className: x("text-input-icon transition-transform duration-200", h && "rotate-180"), size: 20 })
|
|
265
|
+
] })
|
|
215
266
|
]
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
ref: J,
|
|
241
|
-
role: "combobox",
|
|
242
|
-
style: ae(),
|
|
243
|
-
type: "button",
|
|
244
|
-
...z,
|
|
245
|
-
children: [
|
|
246
|
-
/* @__PURE__ */ r("div", { className: "flex-1 min-w-0", "data-testid": "spectral-multiselect-selected-items", children: ne() }),
|
|
247
|
-
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 ml-2", children: [
|
|
248
|
-
a.length > 0 && /* @__PURE__ */ r(
|
|
249
|
-
"span",
|
|
250
|
-
{
|
|
251
|
-
"aria-label": "Clear all selections",
|
|
252
|
-
className: "text-input-icon hover:text-input-icon--hover focus:outline-none cursor-pointer",
|
|
253
|
-
"data-testid": "spectral-multiselect-clear-all-button",
|
|
254
|
-
onClick: (e) => {
|
|
255
|
-
e.stopPropagation(), j();
|
|
256
|
-
},
|
|
257
|
-
onKeyDown: (e) => {
|
|
258
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), j());
|
|
259
|
-
},
|
|
260
|
-
tabIndex: 0,
|
|
261
|
-
children: /* @__PURE__ */ r(P, { size: 12 })
|
|
262
|
-
}
|
|
263
|
-
),
|
|
264
|
-
/* @__PURE__ */ r(ue, { className: f("text-input-icon transition-transform duration-200", y && "rotate-180"), size: 20 })
|
|
265
|
-
] })
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
/* @__PURE__ */ r("div", { className: ke(y), "data-testid": "spectral-multiselect-dropdown", children: /* @__PURE__ */ o("div", { className: "p-1", children: [
|
|
270
|
-
G && /* @__PURE__ */ o("div", { className: "relative mb-2", children: [
|
|
271
|
-
/* @__PURE__ */ r(ye, { className: f(ve, "absolute left-3 top-1/2 -translate-y-1/2 text-input-icon") }),
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
/* @__PURE__ */ r("div", { className: Ne(h), "data-testid": "spectral-multiselect-dropdown", children: /* @__PURE__ */ o("div", { className: "p-1", children: [
|
|
270
|
+
U && /* @__PURE__ */ o("div", { className: "relative mb-2", children: [
|
|
271
|
+
/* @__PURE__ */ r(xe, { className: x(ye, "text-input-icon absolute top-1/2 left-3 -translate-y-1/2") }),
|
|
272
|
+
/* @__PURE__ */ r(
|
|
273
|
+
"input",
|
|
274
|
+
{
|
|
275
|
+
"aria-label": "Search options",
|
|
276
|
+
className: "border-input-border bg-input-bg focus:border-input-border--focus w-full rounded-md border py-2 pr-3 pl-9 text-sm focus:ring-1 focus:ring-black focus:outline-none",
|
|
277
|
+
"data-testid": "spectral-multiselect-search-input",
|
|
278
|
+
onChange: oe,
|
|
279
|
+
placeholder: H,
|
|
280
|
+
ref: F,
|
|
281
|
+
type: "text",
|
|
282
|
+
value: D
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] }),
|
|
286
|
+
/* @__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: "text-input-text-secondary flex items-center justify-center gap-2 py-6 text-sm", children: [
|
|
287
|
+
/* @__PURE__ */ r(pe, {}),
|
|
288
|
+
k
|
|
289
|
+
] }) : v.length === 0 ? /* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-empty-message", className: "text-input-text-secondary py-6 text-center text-sm", children: y }) : /* @__PURE__ */ o(de, { children: [
|
|
290
|
+
Z && /* @__PURE__ */ o("div", { className: "mb-1", children: [
|
|
272
291
|
/* @__PURE__ */ r(
|
|
273
|
-
"
|
|
292
|
+
"button",
|
|
274
293
|
{
|
|
275
|
-
"
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
ref: A,
|
|
281
|
-
type: "text",
|
|
282
|
-
value: D
|
|
294
|
+
className: "text-input-text-secondary hover:bg-input-bg--hover focus:bg-input-bg--hover flex w-full items-center gap-3 px-3 py-2 text-sm font-medium focus:outline-none",
|
|
295
|
+
"data-testid": "spectral-multiselect-select-all-button",
|
|
296
|
+
onClick: se,
|
|
297
|
+
type: "button",
|
|
298
|
+
children: V
|
|
283
299
|
}
|
|
284
|
-
)
|
|
300
|
+
),
|
|
301
|
+
/* @__PURE__ */ r("div", { className: "bg-input-border mx-3 my-1 h-px" })
|
|
285
302
|
] }),
|
|
286
|
-
/* @__PURE__ */ r("div", { className: "
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
onClick: se,
|
|
297
|
-
type: "button",
|
|
298
|
-
children: H
|
|
299
|
-
}
|
|
300
|
-
),
|
|
301
|
-
/* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" })
|
|
302
|
-
] }),
|
|
303
|
-
N.ungrouped.length > 0 && /* @__PURE__ */ r("div", { className: "mb-1", children: N.ungrouped.map((e, i) => F(e, i)) }),
|
|
304
|
-
Object.entries(N.groups).map(([e, i]) => /* @__PURE__ */ o("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
|
|
305
|
-
(N.ungrouped.length > 0 || Object.keys(N.groups).indexOf(e) > 0) && /* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" }),
|
|
306
|
-
/* @__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 }),
|
|
307
|
-
i.map((t, c) => F(t, w.indexOf(t)))
|
|
308
|
-
] }, e)),
|
|
309
|
-
V && a.length > 0 && /* @__PURE__ */ o("div", { className: "mt-1", children: [
|
|
310
|
-
/* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" }),
|
|
311
|
-
/* @__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 })
|
|
312
|
-
] })
|
|
313
|
-
] }) })
|
|
303
|
+
w.ungrouped.length > 0 && /* @__PURE__ */ r("div", { className: "mb-1", children: w.ungrouped.map((e, i) => P(e, i)) }),
|
|
304
|
+
Object.entries(w.groups).map(([e, i]) => /* @__PURE__ */ o("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
|
|
305
|
+
(w.ungrouped.length > 0 || Object.keys(w.groups).indexOf(e) > 0) && /* @__PURE__ */ r("div", { className: "bg-input-border mx-3 my-1 h-px" }),
|
|
306
|
+
/* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-group-name", className: "text-input-text-secondary px-3 py-1 text-xs font-semibold tracking-wide uppercase", children: e }),
|
|
307
|
+
i.map((t, c) => P(t, v.indexOf(t)))
|
|
308
|
+
] }, e)),
|
|
309
|
+
G && a.length > 0 && /* @__PURE__ */ o("div", { className: "mt-1", children: [
|
|
310
|
+
/* @__PURE__ */ r("div", { className: "bg-input-border mx-3 my-1 h-px" }),
|
|
311
|
+
/* @__PURE__ */ r("button", { className: "text-danger hover:bg-danger-50 focus:bg-danger-50 flex w-full items-center gap-3 px-3 py-2 text-sm font-medium focus:outline-none", "data-testid": "spectral-multiselect-clear-all-button", onClick: j, type: "button", children: d })
|
|
312
|
+
] })
|
|
314
313
|
] }) })
|
|
315
|
-
] })
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
314
|
+
] }) })
|
|
315
|
+
] }),
|
|
316
|
+
g === "error" && N && /* @__PURE__ */ r(me, { id: A, dataTestId: "spectral-multiselect-error-message", message: N })
|
|
317
|
+
] });
|
|
318
|
+
};
|
|
319
|
+
Ie.displayName = "MultiSelectBase";
|
|
321
320
|
export {
|
|
322
|
-
|
|
321
|
+
Ie as MultiSelectBase
|
|
323
322
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MultiSelectBaseProps } from './MultiSelectBase';
|
|
2
|
+
import { Ref } from 'react';
|
|
2
3
|
export interface MultiSelectProps extends Omit<MultiSelectBaseProps, 'onChange' | 'options' | 'value'> {
|
|
3
4
|
onSearchChange?: (search: string) => void;
|
|
4
5
|
onValueChange?: (value: string[]) => void;
|
|
@@ -13,5 +14,10 @@ export interface MultiSelectProps extends Omit<MultiSelectBaseProps, 'onChange'
|
|
|
13
14
|
loading?: boolean;
|
|
14
15
|
sortAlphabetically?: boolean;
|
|
15
16
|
}
|
|
16
|
-
export declare const MultiSelect:
|
|
17
|
-
|
|
17
|
+
export declare const MultiSelect: {
|
|
18
|
+
({ ref, emptyText, loading, onValueChange, options, state, value, ...props }: MultiSelectProps & {
|
|
19
|
+
ref?: Ref<HTMLButtonElement>;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=MultiSelect.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "./styles/main.css";
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import { MultiSelectBase as c } from "./MultiSelect/MultiSelectBase.js";
|
|
4
|
+
import "react";
|
|
5
|
+
const n = ({
|
|
6
|
+
ref: l,
|
|
7
|
+
emptyText: t = "No matches found.",
|
|
8
|
+
loading: s = !1,
|
|
9
|
+
onValueChange: d,
|
|
10
|
+
options: i,
|
|
11
|
+
state: o,
|
|
12
|
+
value: b = [],
|
|
13
|
+
...a
|
|
14
|
+
}) => {
|
|
15
|
+
const m = i.map((e) => ({
|
|
16
|
+
disabled: e.disabled ?? !1,
|
|
17
|
+
group: e.group,
|
|
18
|
+
label: e.label,
|
|
19
|
+
value: e.value
|
|
20
|
+
})), r = s ? "loading" : o;
|
|
21
|
+
return /* @__PURE__ */ u(c, { disabled: a.disabled, "data-disabled": a.disabled, emptyMessage: t, onChange: d ?? (() => {
|
|
22
|
+
}), options: m, ref: l, state: r, value: b, ...a });
|
|
23
|
+
};
|
|
24
|
+
n.displayName = "MultiSelect";
|
|
25
|
+
export {
|
|
26
|
+
n as MultiSelect
|
|
27
|
+
};
|
package/dist/Popover.js
CHANGED
|
@@ -231,7 +231,7 @@ const Re = ({ ...e }) => /* @__PURE__ */ s(ce, { "data-slot": "popover", "data-t
|
|
|
231
231
|
"data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2",
|
|
232
232
|
"data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 h-fit",
|
|
233
233
|
"max-h-[var(--radix-popover-content-max-height)] origin-[--radix-popover-content-transform-origin] rounded-lg border-none p-4",
|
|
234
|
-
"
|
|
234
|
+
"w-[var(--popover-width)] shadow-md outline-none",
|
|
235
235
|
n
|
|
236
236
|
),
|
|
237
237
|
style: {
|
package/dist/RadioButtonGroup.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
3
3
|
import { RadioButtonGroupItem as n, RadioButtonGroupBase as u } from "./RadioButtonGroup/RadioButtonGroupBase.js";
|
|
4
4
|
import { cn as m } from "./utils/twUtils.js";
|
|
5
5
|
import "react";
|
|
6
|
-
const s = ({ className: t, children: o, ...r }) => /* @__PURE__ */ e(u, { className: m("flex h-fit w-fit items-center whitespace-nowrap
|
|
6
|
+
const s = ({ className: t, children: o, ...r }) => /* @__PURE__ */ e(u, { className: m("flex h-fit w-fit items-center rounded-md whitespace-nowrap [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md", t), ...r, children: o }), f = n;
|
|
7
7
|
export {
|
|
8
8
|
s as RadioButtonGroup,
|
|
9
9
|
f as RadioButtonGroupItem
|
package/dist/RadioGroup.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Label } from '../Label/Label';
|
|
2
|
+
import { ComponentPropsWithoutRef, ComponentRef, ReactElement, ReactNode, Ref } from 'react';
|
|
2
3
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
3
4
|
type RadioGroupVariant = 'default' | 'tiles' | 'unstyled';
|
|
4
5
|
export type RadioGroupProps = Omit<ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>, 'onChange' | 'disabled'> & {
|
|
@@ -19,18 +20,23 @@ export interface RadioGroupItemProps extends ComponentPropsWithoutRef<typeof Rad
|
|
|
19
20
|
value: string;
|
|
20
21
|
description?: string | ReactNode;
|
|
21
22
|
}
|
|
22
|
-
declare const RadioGroup:
|
|
23
|
-
onValueChange
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
declare const RadioGroupLabel:
|
|
23
|
+
declare const RadioGroup: {
|
|
24
|
+
({ ref, className, itemClassName, onValueChange, orientation, disabled, selected, variant, ...props }: RadioGroupProps & {
|
|
25
|
+
ref?: Ref<ComponentRef<typeof RadioGroupPrimitive.Root>>;
|
|
26
|
+
}): ReactElement;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
declare const RadioGroupItem: {
|
|
30
|
+
({ ref, className, children, value, description, disabled, ...props }: RadioGroupItemProps & {
|
|
31
|
+
ref?: Ref<ComponentRef<typeof RadioGroupPrimitive.Item>>;
|
|
32
|
+
}): ReactElement;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
declare const RadioGroupLabel: {
|
|
36
|
+
({ ref, className, ...props }: ComponentPropsWithoutRef<typeof Label> & {
|
|
37
|
+
ref?: Ref<ComponentRef<typeof Label>>;
|
|
38
|
+
}): ReactElement;
|
|
39
|
+
displayName: string;
|
|
40
|
+
};
|
|
35
41
|
export { RadioGroup, RadioGroupItem, RadioGroupLabel };
|
|
36
42
|
//# sourceMappingURL=RadioGroup.d.ts.map
|