@spear-ai/spectral 1.8.8 → 1.9.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/dist/.js +214 -210
- package/dist/Accordion.js +4 -4
- package/dist/Combobox/ComboboxBase.d.ts +8 -0
- package/dist/Combobox/ComboboxBase.js +80 -0
- package/dist/Combobox.d.ts +20 -0
- package/dist/Combobox.js +175 -0
- package/dist/ComboboxBase-CxNxYtdT.js +408 -0
- package/dist/ControlGroup/ControlGroupSelect.d.ts +33 -0
- package/dist/ControlGroup/ControlGroupSelect.js +104 -0
- package/dist/ControlGroup.d.ts +24 -0
- package/dist/ControlGroup.js +51 -0
- package/dist/Dialog.js +2 -2
- package/dist/Drawer.js +1 -1
- package/dist/HoverCard.js +4 -4
- package/dist/MultiSelect/MultiSelectBase.js +128 -126
- package/dist/Popover.js +1 -1
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +194 -204
- package/dist/Select.js +1 -1
- package/dist/Slider.js +3 -3
- package/dist/Tooltip.js +6 -6
- package/dist/Tray.d.ts +3 -1
- package/dist/Tray.js +36 -32
- package/dist/{Combination-CQ5bXZqE.js → index-6oYKCvIn.js} +179 -178
- package/dist/{index-CtqlhLRO.js → index-BFOf48AQ.js} +1 -1
- package/dist/{index-BJ6qs9i5.js → index-BlHU_t18.js} +7 -7
- package/dist/{index-D2Qxe4uK.js → index-Bm1RbF6w.js} +1 -1
- package/dist/{index-CXltlPV-.js → index-Bv2OIg5P.js} +6 -6
- package/dist/{index-Cgdmxb3F.js → index-CKEI0pDv.js} +1 -1
- package/dist/{index-CDkQCeZY.js → index-CM_hWgfC.js} +1 -1
- package/dist/{index-CJKg3MVV.js → index-C_YVr64u.js} +2 -2
- package/dist/{index-obMGvcdD.js → index-CwSyIPrv.js} +1 -1
- package/dist/{index-9OmOYyjJ.js → index-Dc0No4pV.js} +2 -1
- package/dist/{index-DqvTB1Bv.js → index-T6XEa11q.js} +7 -7
- package/dist/{index-CmWCa9Ae.js → index-pBCLb6Gr.js} +5 -5
- package/dist/{index-WBfSMXvE.js → index-psiVrsnE.js} +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.d.ts.map +1 -1
- package/dist/primitives/button.js +4 -4
- package/dist/{InputGroup.d.ts → primitives/input-group.d.ts} +10 -7
- package/dist/primitives/input-group.d.ts.map +1 -0
- package/dist/primitives/input-group.js +74 -0
- package/dist/primitives/input.d.ts +6 -1
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/popover.d.ts +10 -0
- package/dist/primitives/popover.d.ts.map +1 -0
- package/dist/primitives/popover.js +26 -0
- package/dist/primitives/select.js +2 -2
- package/dist/styles/spectral.css +2 -2
- package/package.json +1 -1
- package/dist/InputGroup.js +0 -84
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsxs as
|
|
3
|
+
import { jsxs as c, jsx as s, Fragment as ce } from "react/jsx-runtime";
|
|
4
4
|
import "../Icons/AnalyzeIcon.js";
|
|
5
5
|
import "../Icons/AnnotationsIcon.js";
|
|
6
6
|
import "../Icons/ApprovedIcon.js";
|
|
@@ -15,7 +15,7 @@ import { ChevronDownIcon as ue } from "../Icons/ChevronDownIcon.js";
|
|
|
15
15
|
import "../Icons/ChevronUpIcon.js";
|
|
16
16
|
import "../Icons/ClockIcon.js";
|
|
17
17
|
import "../Icons/CloseCircleIcon.js";
|
|
18
|
-
import { CloseIcon as
|
|
18
|
+
import { CloseIcon as W } from "../Icons/CloseIcon.js";
|
|
19
19
|
import "../Icons/DashboardIcon.js";
|
|
20
20
|
import "../Icons/DatabaseIcon.js";
|
|
21
21
|
import "../Icons/DeleteIcon.js";
|
|
@@ -69,7 +69,7 @@ import "../Icons/WarningIcon.js";
|
|
|
69
69
|
import "../Icons/ZoomAllIcon.js";
|
|
70
70
|
import "../Icons/ZoomXIcon.js";
|
|
71
71
|
import "../Icons/ZoomYIcon.js";
|
|
72
|
-
import { R as be, T as ge, P as he, C as xe } from "../index-
|
|
72
|
+
import { R as be, T as ge, P as he, C as xe } from "../index-Bv2OIg5P.js";
|
|
73
73
|
import { ErrorMessage as ye } from "../utils/formFieldUtils.js";
|
|
74
74
|
import { cn as y } from "../utils/twUtils.js";
|
|
75
75
|
import { useId as ve, useState as V, useRef as we, useMemo as v, useCallback as w, useEffect as Ne } from "react";
|
|
@@ -87,7 +87,7 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
87
87
|
g && "border-input-border--focus",
|
|
88
88
|
Ce(b),
|
|
89
89
|
m
|
|
90
|
-
),
|
|
90
|
+
), De = () => y(
|
|
91
91
|
"z-50 max-h-80 overflow-hidden rounded-lg border border-input-border bg-input-bg shadow-lg",
|
|
92
92
|
"motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out",
|
|
93
93
|
"motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0",
|
|
@@ -95,33 +95,33 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
95
95
|
"motion-safe:data-[side=bottom]:slide-in-from-top-2",
|
|
96
96
|
"motion-safe:data-[side=top]:slide-in-from-bottom-2",
|
|
97
97
|
"origin-(--radix-popover-content-transform-origin)"
|
|
98
|
-
),
|
|
99
|
-
const [t,
|
|
98
|
+
), Oe = (b, g, m, C, N, S, F, j, E) => {
|
|
99
|
+
const [t, d] = V(-1), r = v(() => {
|
|
100
100
|
const o = [];
|
|
101
|
-
return
|
|
101
|
+
return F && o.push({ type: "search" }), j && o.push({ type: "select-all" }), b.forEach((p, f) => {
|
|
102
102
|
p.disabled || o.push({ type: "option", index: f, value: p.value });
|
|
103
103
|
}), o;
|
|
104
|
-
}, [b,
|
|
104
|
+
}, [b, F, j, E]), x = w(
|
|
105
105
|
(o) => {
|
|
106
106
|
if (o < 0 || o >= r.length) return;
|
|
107
|
-
r[o].type === "search" &&
|
|
107
|
+
r[o].type === "search" && S.current?.focus();
|
|
108
108
|
},
|
|
109
|
-
[r,
|
|
110
|
-
),
|
|
109
|
+
[r, S]
|
|
110
|
+
), M = w(
|
|
111
111
|
(o) => {
|
|
112
112
|
const p = t >= 0 && t < r.length ? r[t] : null;
|
|
113
113
|
if (o.key === " " && p?.type === "search" || o.key === "Enter" && p?.type === "search")
|
|
114
114
|
return;
|
|
115
|
-
const
|
|
115
|
+
const n = {
|
|
116
116
|
ArrowDown: () => {
|
|
117
117
|
o.preventDefault();
|
|
118
118
|
const l = Math.min(t + 1, r.length - 1);
|
|
119
|
-
|
|
119
|
+
d(l), x(l);
|
|
120
120
|
},
|
|
121
121
|
ArrowUp: () => {
|
|
122
122
|
o.preventDefault();
|
|
123
123
|
const l = Math.max(t - 1, 0);
|
|
124
|
-
|
|
124
|
+
d(l), x(l);
|
|
125
125
|
},
|
|
126
126
|
Tab: () => {
|
|
127
127
|
if (o.shiftKey)
|
|
@@ -130,107 +130,107 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
130
130
|
else {
|
|
131
131
|
o.preventDefault();
|
|
132
132
|
const l = t - 1;
|
|
133
|
-
|
|
133
|
+
d(l), x(l);
|
|
134
134
|
}
|
|
135
135
|
else if (t >= r.length - 1)
|
|
136
136
|
m();
|
|
137
137
|
else {
|
|
138
138
|
o.preventDefault();
|
|
139
139
|
const l = t + 1;
|
|
140
|
-
|
|
140
|
+
d(l), x(l);
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
143
|
Enter: () => {
|
|
144
144
|
if (o.preventDefault(), t >= 0 && t < r.length) {
|
|
145
145
|
const l = r[t];
|
|
146
|
-
l.type === "select-all" ? N() : l.type === "clear-all" ? g() : l.type === "option" &&
|
|
146
|
+
l.type === "select-all" ? N() : l.type === "clear-all" ? g() : l.type === "option" && C(l.value);
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
149
|
" ": () => {
|
|
150
150
|
if (o.preventDefault(), t >= 0 && t < r.length) {
|
|
151
151
|
const l = r[t];
|
|
152
|
-
l.type === "select-all" ? N() : l.type === "clear-all" ? g() : l.type === "option" &&
|
|
152
|
+
l.type === "select-all" ? N() : l.type === "clear-all" ? g() : l.type === "option" && C(l.value);
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
Escape: () => {
|
|
156
156
|
o.preventDefault(), m();
|
|
157
157
|
}
|
|
158
158
|
}[o.key];
|
|
159
|
-
|
|
159
|
+
n && n();
|
|
160
160
|
},
|
|
161
|
-
[r, t,
|
|
162
|
-
),
|
|
161
|
+
[r, t, C, N, g, m, x]
|
|
162
|
+
), P = w(
|
|
163
163
|
(o) => {
|
|
164
164
|
if (t < 0 || t >= r.length) return !1;
|
|
165
165
|
const p = r[t];
|
|
166
166
|
return p.type === "option" && p.index === o;
|
|
167
167
|
},
|
|
168
168
|
[t, r]
|
|
169
|
-
),
|
|
169
|
+
), K = v(() => t < 0 || t >= r.length ? !1 : r[t].type === "search", [t, r]), L = v(() => t < 0 || t >= r.length ? !1 : r[t].type === "select-all", [t, r]), k = v(() => t < 0 || t >= r.length ? !1 : r[t].type === "clear-all", [t, r]);
|
|
170
170
|
return {
|
|
171
171
|
focusedIndex: t,
|
|
172
|
-
setFocusedIndex:
|
|
173
|
-
handleKeyDown:
|
|
174
|
-
getOptionFocusIndex:
|
|
175
|
-
isSearchFocused:
|
|
176
|
-
isSelectAllFocused:
|
|
177
|
-
isClearAllFocused:
|
|
172
|
+
setFocusedIndex: d,
|
|
173
|
+
handleKeyDown: M,
|
|
174
|
+
getOptionFocusIndex: P,
|
|
175
|
+
isSearchFocused: K,
|
|
176
|
+
isSelectAllFocused: L,
|
|
177
|
+
isClearAllFocused: k
|
|
178
178
|
};
|
|
179
179
|
}, Se = ({
|
|
180
180
|
className: b,
|
|
181
181
|
clearAllLabel: g = "Clear all",
|
|
182
182
|
closeOnSelect: m = !1,
|
|
183
|
-
emptyMessage:
|
|
183
|
+
emptyMessage: C = "No options found",
|
|
184
184
|
errorMessage: N,
|
|
185
|
-
id:
|
|
186
|
-
label:
|
|
187
|
-
loadingMessage:
|
|
188
|
-
maxCount:
|
|
185
|
+
id: S,
|
|
186
|
+
label: F,
|
|
187
|
+
loadingMessage: j = "Loading options…",
|
|
188
|
+
maxCount: E = 3,
|
|
189
189
|
name: t,
|
|
190
|
-
onChange:
|
|
190
|
+
onChange: d,
|
|
191
191
|
options: r = [],
|
|
192
192
|
placeholder: x = "Select options",
|
|
193
|
-
ref:
|
|
194
|
-
searchPlaceholder:
|
|
195
|
-
selectAllLabel:
|
|
196
|
-
showClearAll:
|
|
197
|
-
showSearch:
|
|
193
|
+
ref: M,
|
|
194
|
+
searchPlaceholder: P = "Search options…",
|
|
195
|
+
selectAllLabel: K = "Select all",
|
|
196
|
+
showClearAll: L = !0,
|
|
197
|
+
showSearch: k = !0,
|
|
198
198
|
showSelectAll: o = !0,
|
|
199
199
|
sortAlphabetically: p = !1,
|
|
200
200
|
state: f = "default",
|
|
201
|
-
value:
|
|
201
|
+
value: n = [],
|
|
202
202
|
"aria-label": l,
|
|
203
|
-
"aria-describedby":
|
|
203
|
+
"aria-describedby": X,
|
|
204
204
|
...H
|
|
205
205
|
}) => {
|
|
206
|
-
const
|
|
207
|
-
let e = r.filter((
|
|
208
|
-
return p && (e = [...e].sort((
|
|
209
|
-
}, [r,
|
|
210
|
-
const e = {},
|
|
211
|
-
return
|
|
212
|
-
i.group ? (e[i.group] || (e[i.group] = []), e[i.group].push(i)) :
|
|
213
|
-
}), { groups: e, ungrouped:
|
|
214
|
-
}, [
|
|
206
|
+
const Y = ve(), z = S ?? `${t}-${Y}`, _ = `${z}-listbox`, G = `${z}-error`, [h, T] = V(!1), [$, ee] = V(""), B = we(null), U = H.disabled ?? f === "disabled", te = f === "loading", re = f === "error", D = v(() => {
|
|
207
|
+
let e = r.filter((a) => a.label.toLowerCase().includes($.toLowerCase()));
|
|
208
|
+
return p && (e = [...e].sort((a, i) => a.label.localeCompare(i.label))), e;
|
|
209
|
+
}, [r, $, p]), O = v(() => {
|
|
210
|
+
const e = {}, a = [];
|
|
211
|
+
return D.forEach((i) => {
|
|
212
|
+
i.group ? (e[i.group] || (e[i.group] = []), e[i.group].push(i)) : a.push(i);
|
|
213
|
+
}), { groups: e, ungrouped: a, hasGroups: Object.keys(e).length > 0 };
|
|
214
|
+
}, [D]), R = w(
|
|
215
215
|
(e) => {
|
|
216
216
|
if (r.find((u) => u.value === e)?.disabled) return;
|
|
217
|
-
const i =
|
|
218
|
-
|
|
217
|
+
const i = n.includes(e) ? n.filter((u) => u !== e) : [...n, e];
|
|
218
|
+
d(i), m && T(!1);
|
|
219
219
|
},
|
|
220
|
-
[r,
|
|
221
|
-
),
|
|
222
|
-
const e = r.filter((i) => !i.disabled).map((i) => i.value),
|
|
223
|
-
|
|
224
|
-
}, [r,
|
|
225
|
-
|
|
226
|
-
}, [
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
() =>
|
|
230
|
-
$,
|
|
231
|
-
U,
|
|
220
|
+
[r, n, d, m]
|
|
221
|
+
), Z = w(() => {
|
|
222
|
+
const e = r.filter((i) => !i.disabled).map((i) => i.value), a = e.every((i) => n.includes(i));
|
|
223
|
+
d(a ? [] : e);
|
|
224
|
+
}, [r, n, d]), q = w(() => {
|
|
225
|
+
d([]);
|
|
226
|
+
}, [d]), J = v(() => r.filter((e) => !e.disabled).map((e) => e.value), [r]), ie = J.length > 0 && J.every((e) => n.includes(e)), { getOptionFocusIndex: se, handleKeyDown: oe, isSelectAllFocused: le, setFocusedIndex: A } = Oe(
|
|
227
|
+
D,
|
|
228
|
+
q,
|
|
229
|
+
() => T(!1),
|
|
232
230
|
R,
|
|
233
|
-
|
|
231
|
+
Z,
|
|
232
|
+
B,
|
|
233
|
+
k,
|
|
234
234
|
o,
|
|
235
235
|
!1
|
|
236
236
|
// No separate clear-all button in dropdown
|
|
@@ -238,41 +238,44 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
238
238
|
Ne(() => {
|
|
239
239
|
A(h ? 0 : -1);
|
|
240
240
|
}, [h, A]);
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
}, []),
|
|
244
|
-
if (
|
|
241
|
+
const ae = w((e) => {
|
|
242
|
+
ee(e.target.value);
|
|
243
|
+
}, []), ne = () => {
|
|
244
|
+
if (n.length === 0)
|
|
245
245
|
return /* @__PURE__ */ s("span", { className: "text-input-text-placeholder flex min-h-8 items-center", children: x });
|
|
246
|
-
const e =
|
|
247
|
-
return /* @__PURE__ */
|
|
246
|
+
const e = n.slice(0, E), a = n.length - E;
|
|
247
|
+
return /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-1 overflow-hidden", children: [
|
|
248
248
|
e.map((i) => {
|
|
249
|
-
const u = r.find((
|
|
250
|
-
return u ? /* @__PURE__ */
|
|
249
|
+
const u = r.find((I) => I.value === i);
|
|
250
|
+
return u ? /* @__PURE__ */ c("span", { className: "bg-input-bg--selected text-input-text inline-flex max-w-48 items-center gap-1 rounded-md px-2 py-1 text-xs", children: [
|
|
251
251
|
/* @__PURE__ */ s("span", { className: "truncate", children: u.label }),
|
|
252
252
|
/* @__PURE__ */ s(
|
|
253
253
|
"button",
|
|
254
254
|
{
|
|
255
|
-
"aria-label":
|
|
256
|
-
className: "hover:text-danger
|
|
255
|
+
"aria-label": `Remove ${u.label}`,
|
|
256
|
+
className: "hover:text-danger cursor-pointer rounded-sm",
|
|
257
257
|
"data-testid": "spectral-multiselect-remove-item-button",
|
|
258
|
-
onClick: (
|
|
259
|
-
|
|
258
|
+
onClick: (I) => {
|
|
259
|
+
I.preventDefault(), I.stopPropagation(), R(i);
|
|
260
|
+
},
|
|
261
|
+
onPointerDown: (I) => {
|
|
262
|
+
I.stopPropagation();
|
|
260
263
|
},
|
|
261
264
|
type: "button",
|
|
262
|
-
children: /* @__PURE__ */ s(
|
|
265
|
+
children: /* @__PURE__ */ s(W, { size: 12 })
|
|
263
266
|
}
|
|
264
267
|
)
|
|
265
268
|
] }, i) : null;
|
|
266
269
|
}),
|
|
267
|
-
|
|
270
|
+
a > 0 && /* @__PURE__ */ c("span", { className: "text-input-text-secondary flex items-center py-1 text-xs", children: [
|
|
268
271
|
"+",
|
|
269
|
-
|
|
272
|
+
a,
|
|
270
273
|
" more"
|
|
271
274
|
] })
|
|
272
275
|
] });
|
|
273
|
-
},
|
|
274
|
-
const i =
|
|
275
|
-
return /* @__PURE__ */
|
|
276
|
+
}, Q = (e, a) => {
|
|
277
|
+
const i = n.includes(e.value), u = se(a);
|
|
278
|
+
return /* @__PURE__ */ c(
|
|
276
279
|
"button",
|
|
277
280
|
{
|
|
278
281
|
className: y(
|
|
@@ -281,7 +284,7 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
281
284
|
i && "text-input-text font-medium"
|
|
282
285
|
),
|
|
283
286
|
disabled: e.disabled,
|
|
284
|
-
onClick: () =>
|
|
287
|
+
onClick: () => R(e.value),
|
|
285
288
|
type: "button",
|
|
286
289
|
children: [
|
|
287
290
|
/* @__PURE__ */ s("div", { "data-testid": "spectral-multiselect-selected-indicator", className: y("border-input-border flex h-4 w-4 items-center justify-center rounded border", i && "bg-primary border-primary"), children: i && /* @__PURE__ */ s(pe, { size: 12 }) }),
|
|
@@ -295,63 +298,62 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
295
298
|
"--multiselect-trigger-height": "3rem",
|
|
296
299
|
"--multiselect-dropdown-max-height": "20rem"
|
|
297
300
|
});
|
|
298
|
-
return /* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */ s(be, { open: h, onOpenChange:
|
|
300
|
-
/* @__PURE__ */ s(ge, { asChild: !0, children: /* @__PURE__ */
|
|
301
|
+
return /* @__PURE__ */ c("div", { className: "w-full", "data-testid": "spectral-multiselect-root", children: [
|
|
302
|
+
/* @__PURE__ */ s(be, { open: h, onOpenChange: T, children: /* @__PURE__ */ c("div", { className: "relative", "data-testid": "spectral-multiselect-wrapper", onKeyDown: h ? oe : void 0, role: "none", children: [
|
|
303
|
+
/* @__PURE__ */ s(ge, { asChild: !0, children: /* @__PURE__ */ c(
|
|
301
304
|
"button",
|
|
302
305
|
{
|
|
303
306
|
"aria-controls": h ? _ : void 0,
|
|
304
|
-
"aria-describedby": [re ? G : null,
|
|
307
|
+
"aria-describedby": [re ? G : null, X].filter(Boolean).join(" ") || void 0,
|
|
305
308
|
"aria-expanded": h,
|
|
306
|
-
"aria-label": l ??
|
|
309
|
+
"aria-label": l ?? F,
|
|
307
310
|
className: ke(f, h, b),
|
|
308
311
|
"data-state": f,
|
|
309
312
|
"data-testid": "spectral-multiselect-trigger",
|
|
310
|
-
disabled:
|
|
311
|
-
id:
|
|
313
|
+
disabled: U,
|
|
314
|
+
id: z,
|
|
312
315
|
name: t,
|
|
313
|
-
ref:
|
|
316
|
+
ref: M,
|
|
314
317
|
role: "combobox",
|
|
315
318
|
style: de(),
|
|
316
319
|
type: "button",
|
|
317
320
|
...H,
|
|
318
321
|
children: [
|
|
319
|
-
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1 overflow-hidden", "data-testid": "spectral-multiselect-selected-items", children:
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
P && a.length > 0 && /* @__PURE__ */ s(
|
|
322
|
-
"button",
|
|
323
|
-
{
|
|
324
|
-
"aria-label": "Clear all selections",
|
|
325
|
-
className: "text-input-icon hover:text-input-icon--hover focus-visible:ring-accent cursor-pointer rounded-sm focus-visible:ring-2 focus-visible:ring-offset-1",
|
|
326
|
-
"data-testid": "spectral-multiselect-clear-all-button",
|
|
327
|
-
onClick: (e) => {
|
|
328
|
-
e.stopPropagation(), Z();
|
|
329
|
-
},
|
|
330
|
-
type: "button",
|
|
331
|
-
children: /* @__PURE__ */ s(Q, { size: 12 })
|
|
332
|
-
}
|
|
333
|
-
),
|
|
334
|
-
/* @__PURE__ */ s(ue, { className: y("text-input-icon transition-transform duration-200", h && "rotate-180"), size: 20 })
|
|
335
|
-
] })
|
|
322
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1 overflow-hidden", "data-testid": "spectral-multiselect-selected-items", children: ne() }),
|
|
323
|
+
/* @__PURE__ */ s("div", { className: "ml-2 flex shrink-0 items-center gap-2", children: /* @__PURE__ */ s(ue, { className: y("text-input-icon transition-transform duration-200", h && "rotate-180"), size: 20 }) })
|
|
336
324
|
]
|
|
337
325
|
}
|
|
338
326
|
) }),
|
|
327
|
+
L && n.length > 0 && /* @__PURE__ */ s(
|
|
328
|
+
"button",
|
|
329
|
+
{
|
|
330
|
+
"aria-label": "Clear all selections",
|
|
331
|
+
className: "text-input-icon hover:text-input-icon--hover focus-visible:ring-accent absolute top-1/2 right-10 z-10 -translate-y-1/2 cursor-pointer rounded-sm focus-visible:ring-2 focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50",
|
|
332
|
+
"data-testid": "spectral-multiselect-clear-all-button",
|
|
333
|
+
disabled: U,
|
|
334
|
+
onClick: (e) => {
|
|
335
|
+
e.stopPropagation(), q(), document.getElementById(z)?.focus();
|
|
336
|
+
},
|
|
337
|
+
type: "button",
|
|
338
|
+
children: /* @__PURE__ */ s(W, { size: 12 })
|
|
339
|
+
}
|
|
340
|
+
),
|
|
339
341
|
/* @__PURE__ */ s(he, { children: /* @__PURE__ */ s(
|
|
340
342
|
xe,
|
|
341
343
|
{
|
|
342
344
|
align: "start",
|
|
343
345
|
avoidCollisions: !0,
|
|
344
|
-
className:
|
|
346
|
+
className: De(),
|
|
345
347
|
collisionPadding: 10,
|
|
346
348
|
"data-testid": "spectral-multiselect-dropdown",
|
|
347
349
|
onOpenAutoFocus: (e) => {
|
|
348
|
-
e.preventDefault(),
|
|
350
|
+
e.preventDefault(), k && B.current?.focus();
|
|
349
351
|
},
|
|
350
352
|
side: "bottom",
|
|
351
353
|
sideOffset: 4,
|
|
352
354
|
style: { width: "var(--radix-popover-trigger-width)" },
|
|
353
|
-
children: /* @__PURE__ */
|
|
354
|
-
|
|
355
|
+
children: /* @__PURE__ */ c("div", { className: "p-1", children: [
|
|
356
|
+
k && /* @__PURE__ */ c("div", { className: "relative mb-2", children: [
|
|
355
357
|
/* @__PURE__ */ s(fe, { className: y(Ie, "text-input-icon absolute top-1/2 left-3 -translate-y-1/2") }),
|
|
356
358
|
/* @__PURE__ */ s(
|
|
357
359
|
"input",
|
|
@@ -359,36 +361,36 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
359
361
|
"aria-label": "Search options",
|
|
360
362
|
className: "border-input-border bg-input-bg focus-visible:border-input-border--focus w-full rounded-md border py-2 pr-3 pl-9 text-sm focus-visible:ring-1 focus-visible:ring-black focus-visible:outline-none",
|
|
361
363
|
"data-testid": "spectral-multiselect-search-input",
|
|
362
|
-
onChange:
|
|
363
|
-
placeholder:
|
|
364
|
-
ref:
|
|
364
|
+
onChange: ae,
|
|
365
|
+
placeholder: P,
|
|
366
|
+
ref: B,
|
|
365
367
|
type: "text",
|
|
366
|
-
value:
|
|
368
|
+
value: $
|
|
367
369
|
}
|
|
368
370
|
)
|
|
369
371
|
] }),
|
|
370
|
-
/* @__PURE__ */ s("div", { className: "max-h-64 overflow-y-auto", id: _, role: "listbox", "aria-multiselectable": "true", children: te ? /* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ s("div", { className: "max-h-64 overflow-y-auto", id: _, role: "listbox", "aria-multiselectable": "true", children: te ? /* @__PURE__ */ c("div", { "data-testid": "spectral-multiselect-loading", className: "text-input-text-secondary flex items-center justify-center gap-2 py-6 text-sm", children: [
|
|
371
373
|
/* @__PURE__ */ s(me, {}),
|
|
372
|
-
|
|
373
|
-
] }) :
|
|
374
|
-
o && /* @__PURE__ */
|
|
374
|
+
j
|
|
375
|
+
] }) : D.length === 0 ? /* @__PURE__ */ s("div", { "data-testid": "spectral-multiselect-empty-message", className: "text-input-text-secondary py-6 text-center text-sm", children: C }) : /* @__PURE__ */ c(ce, { children: [
|
|
376
|
+
o && /* @__PURE__ */ c("div", { className: "mb-1", children: [
|
|
375
377
|
/* @__PURE__ */ s(
|
|
376
378
|
"button",
|
|
377
379
|
{
|
|
378
380
|
className: y("text-input-text-secondary hover:bg-input-bg--hover flex w-full items-center gap-3 px-3 py-2 text-sm font-medium focus:outline-none", le && "bg-input-bg--hover"),
|
|
379
381
|
"data-testid": "spectral-multiselect-select-all-button",
|
|
380
|
-
onClick:
|
|
382
|
+
onClick: Z,
|
|
381
383
|
type: "button",
|
|
382
|
-
children: ie ? g :
|
|
384
|
+
children: ie ? g : K
|
|
383
385
|
}
|
|
384
386
|
),
|
|
385
387
|
/* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" })
|
|
386
388
|
] }),
|
|
387
|
-
O.ungrouped.length > 0 && /* @__PURE__ */ s("div", { className: "mb-1", children: O.ungrouped.map((e,
|
|
388
|
-
Object.entries(O.groups).map(([e,
|
|
389
|
+
O.ungrouped.length > 0 && /* @__PURE__ */ s("div", { className: "mb-1", children: O.ungrouped.map((e, a) => Q(e, a)) }),
|
|
390
|
+
Object.entries(O.groups).map(([e, a]) => /* @__PURE__ */ c("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
|
|
389
391
|
(O.ungrouped.length > 0 || Object.keys(O.groups).indexOf(e) > 0) && /* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" }),
|
|
390
392
|
/* @__PURE__ */ s("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 }),
|
|
391
|
-
|
|
393
|
+
a.map((i, u) => Q(i, D.indexOf(i)))
|
|
392
394
|
] }, e))
|
|
393
395
|
] }) })
|
|
394
396
|
] })
|
package/dist/Popover.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { R as p, P as d, C as m, T as f, A as l } from "./index-
|
|
3
|
+
import { R as p, P as d, C as m, T as f, A as l } from "./index-Bv2OIg5P.js";
|
|
4
4
|
import { cn as c } from "./utils/twUtils.js";
|
|
5
5
|
import "react";
|
|
6
6
|
const x = ({ ...o }) => /* @__PURE__ */ t(p, { "data-slot": "popover", "data-testid": "spectral-popover", ...o }), b = ({ ...o }) => /* @__PURE__ */ t(f, { "data-slot": "popover-trigger", "data-testid": "spectral-popover-trigger", ...o }), P = ({ align: o = "center", className: a, collisionPadding: r = 8, side: n = "bottom", sideOffset: i = 4, width: e = "w-fit", ...s }) => /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(
|
package/dist/RadioGroup.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface RadioGroupItemProps extends ComponentProps<typeof RadioGroupPri
|
|
|
21
21
|
value: string;
|
|
22
22
|
}
|
|
23
23
|
declare const RadioGroup: {
|
|
24
|
-
(
|
|
24
|
+
(allProps: RadioGroupProps & {
|
|
25
25
|
ref?: Ref<ComponentRef<typeof RadioGroupPrimitive.Root>>;
|
|
26
26
|
}): ReactElement;
|
|
27
27
|
displayName: string;
|