@spear-ai/spectral 1.12.0 → 1.12.2
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 +8 -8
- package/dist/{es2015-YHaMV-St.js → Combination-9q50p_Vu.js} +251 -254
- package/dist/Combobox/ComboboxBase.js +492 -3
- package/dist/Combobox-Ch5Rxk5v.js +6360 -0
- package/dist/Combobox.js +3 -137
- package/dist/DateTimePicker/Calendar.js +1 -1
- package/dist/DateTimePicker/DateTimeDisplayInput.js +1 -1
- package/dist/DateTimePicker/DateTimeInput.js +1 -1
- package/dist/DateTimePicker/DateTimeUtils.js +1 -1
- package/dist/DateTimePicker/TimePicker.js +1 -1
- package/dist/DateTimePicker.js +2 -2
- package/dist/Dialog.js +2 -2
- package/dist/Drawer.js +1 -1
- package/dist/DropdownMenu.js +241 -241
- package/dist/{HoverCard-DERasp0v.js → HoverCard-BGpW6LnA.js} +2 -2
- package/dist/HoverCard.js +1 -1
- package/dist/MultiSelect/MultiSelectBase.js +1 -1
- package/dist/Popover.js +1 -1
- package/dist/{RadioGroup-DqKggFnI.js → RadioGroup-CfjhpW5o.js} +3 -3
- package/dist/RadioGroup.js +1 -1
- package/dist/Select.js +55 -55
- package/dist/{Slider-CfUFkWU4.js → Slider-mODhqkCs.js} +3 -3
- package/dist/Slider.js +1 -1
- package/dist/{Tooltip-BR0tdif4.js → Tooltip-DH_BzFye.js} +3 -3
- package/dist/Tooltip.js +1 -1
- package/dist/Tray.js +1 -1
- package/dist/{dist-DcUGLq_y.js → dist-BMu6Dgh_.js} +1 -1
- package/dist/{dist-fW81qjVl.js → dist-C9fJjxxB.js} +41 -41
- package/dist/{dist-C0Hifjgh.js → dist-Cv8I-d2q.js} +2 -2
- package/dist/{dist-B9tup-4O.js → dist-D6QANKSj.js} +5 -5
- package/dist/{dist-3Af8168y.js → dist-Tbzy5UFA.js} +1 -1
- package/dist/{dist-B2k1iWFp.js → dist-jQ7HawWM.js} +1 -1
- package/dist/{dist-BtdmHAzK.js → dist-nYKAWiy4.js} +6 -6
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/select.js +32 -32
- package/dist/styles/spectral.css +1 -1
- package/package.json +4 -2
- package/dist/ComboboxBase-BzDGK36x.js +0 -491
- /package/dist/{Calendar-Cnh_PTbQ.js → Calendar-2UVWeLYp.js} +0 -0
- /package/dist/{DateTimeUtils-BJUAMuot.js → DateTimeUtils-DrR2JWoU.js} +0 -0
- /package/dist/{dist-Bfjk-jx9.js → dist-ChNh3U3S.js} +0 -0
- /package/dist/{dist-D8Wb_MX9.js → dist-DDjUcieO.js} +0 -0
- /package/dist/{dist-s1uWaZYZ.js → dist-DFT13f_s.js} +0 -0
- /package/dist/{dist-ClmepHp4.js → dist-DIt8FP2G.js} +0 -0
- /package/dist/{dist-BK1K0g9W.js → dist-K0_i37VL.js} +0 -0
|
@@ -1,3 +1,492 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import "../styles/main.css";
|
|
3
|
+
import { CheckmarkIcon as e } from "../Icons/CheckmarkIcon.js";
|
|
4
|
+
import { SearchIcon as t } from "../Icons/SearchIcon.js";
|
|
5
|
+
import { c as n, t as r } from "../dist-7HRQ5IKN.js";
|
|
6
|
+
import { t as i } from "../dist-Dtvmk11N.js";
|
|
7
|
+
import { t as a } from "../twUtils-D_qzdiwM.js";
|
|
8
|
+
import { InputGroup as o, InputGroupAddon as s } from "../primitives/input-group.js";
|
|
9
|
+
import { a as c, i as l, n as u, o as d } from "../dist-D6QANKSj.js";
|
|
10
|
+
import * as f from "react";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
//#region node_modules/.pnpm/cmdk@1.1.1_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react@19.2.14_react-dom_c7cada531f0aaf30a175ae441f7fe8bc/node_modules/cmdk/dist/chunk-NZJY6EH4.mjs
|
|
13
|
+
var h = 1, g = .9, _ = .8, v = .17, y = .1, b = .999, x = .9999, S = .99, C = /[\\\/_+.#"@\[\(\{&]/, w = /[\\\/_+.#"@\[\(\{&]/g, T = /[\s-]/, E = /[\s-]/g;
|
|
14
|
+
function D(e, t, n, r, i, a, o) {
|
|
15
|
+
if (a === t.length) return i === e.length ? h : S;
|
|
16
|
+
var s = `${i},${a}`;
|
|
17
|
+
if (o[s] !== void 0) return o[s];
|
|
18
|
+
for (var c = r.charAt(a), l = n.indexOf(c, i), u = 0, d, f, p, m; l >= 0;) d = D(e, t, n, r, l + 1, a + 1, o), d > u && (l === i ? d *= h : C.test(e.charAt(l - 1)) ? (d *= _, p = e.slice(i, l - 1).match(w), p && i > 0 && (d *= b ** +p.length)) : T.test(e.charAt(l - 1)) ? (d *= g, m = e.slice(i, l - 1).match(E), m && i > 0 && (d *= b ** +m.length)) : (d *= v, i > 0 && (d *= b ** +(l - i))), e.charAt(l) !== t.charAt(a) && (d *= x)), (d < y && n.charAt(l - 1) === r.charAt(a + 1) || r.charAt(a + 1) === r.charAt(a) && n.charAt(l - 1) !== r.charAt(a)) && (f = D(e, t, n, r, l + 1, a + 2, o), f * y > d && (d = f * y)), d > u && (u = d), l = n.indexOf(c, l + 1);
|
|
19
|
+
return o[s] = u, u;
|
|
20
|
+
}
|
|
21
|
+
function O(e) {
|
|
22
|
+
return e.toLowerCase().replace(E, " ");
|
|
23
|
+
}
|
|
24
|
+
function k(e, t, n) {
|
|
25
|
+
return e = n && n.length > 0 ? `${e + " " + n.join(" ")}` : e, D(e, t, O(e), O(t), 0, 0, {});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region node_modules/.pnpm/cmdk@1.1.1_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react@19.2.14_react-dom_c7cada531f0aaf30a175ae441f7fe8bc/node_modules/cmdk/dist/index.mjs
|
|
29
|
+
var A = "[cmdk-group=\"\"]", j = "[cmdk-group-items=\"\"]", ee = "[cmdk-group-heading=\"\"]", M = "[cmdk-item=\"\"]", te = `${M}:not([aria-disabled="true"])`, N = "cmdk-item-select", P = "data-value", ne = (e, t, n) => k(e, t, n), F = f.createContext(void 0), I = () => f.useContext(F), L = f.createContext(void 0), R = () => f.useContext(L), z = f.createContext(void 0), B = f.forwardRef((e, t) => {
|
|
30
|
+
let n = Z(() => ({
|
|
31
|
+
search: "",
|
|
32
|
+
value: e.value ?? e.defaultValue ?? "",
|
|
33
|
+
selectedItemId: void 0,
|
|
34
|
+
filtered: {
|
|
35
|
+
count: 0,
|
|
36
|
+
items: /* @__PURE__ */ new Map(),
|
|
37
|
+
groups: /* @__PURE__ */ new Set()
|
|
38
|
+
}
|
|
39
|
+
})), a = Z(() => /* @__PURE__ */ new Set()), o = Z(() => /* @__PURE__ */ new Map()), s = Z(() => /* @__PURE__ */ new Map()), c = Z(() => /* @__PURE__ */ new Set()), l = Y(e), { label: u, children: d, value: p, onValueChange: m, filter: h, shouldFilter: g, loop: _, disablePointerSelection: v = !1, vimBindings: y = !0, ...b } = e, x = i(), S = i(), C = i(), w = f.useRef(null), T = se();
|
|
40
|
+
X(() => {
|
|
41
|
+
if (p !== void 0) {
|
|
42
|
+
let e = p.trim();
|
|
43
|
+
n.current.value = e, E.emit();
|
|
44
|
+
}
|
|
45
|
+
}, [p]), X(() => {
|
|
46
|
+
T(6, z);
|
|
47
|
+
}, []);
|
|
48
|
+
let E = f.useMemo(() => ({
|
|
49
|
+
subscribe: (e) => (c.current.add(e), () => c.current.delete(e)),
|
|
50
|
+
snapshot: () => n.current,
|
|
51
|
+
setState: (e, t, r) => {
|
|
52
|
+
var i, a, o;
|
|
53
|
+
if (!Object.is(n.current[e], t)) {
|
|
54
|
+
if (n.current[e] = t, e === "search") R(), k(), T(1, I);
|
|
55
|
+
else if (e === "value") {
|
|
56
|
+
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
57
|
+
let e = document.getElementById(C);
|
|
58
|
+
e ? e.focus() : (i = document.getElementById(x)) == null || i.focus();
|
|
59
|
+
}
|
|
60
|
+
if (T(7, () => {
|
|
61
|
+
n.current.selectedItemId = B()?.id, E.emit();
|
|
62
|
+
}), r || T(5, z), l.current?.value !== void 0) {
|
|
63
|
+
let e = t ?? "";
|
|
64
|
+
(o = (a = l.current).onValueChange) == null || o.call(a, e);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
E.emit();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
emit: () => {
|
|
72
|
+
c.current.forEach((e) => e());
|
|
73
|
+
}
|
|
74
|
+
}), []), D = f.useMemo(() => ({
|
|
75
|
+
value: (e, t, r) => {
|
|
76
|
+
t !== s.current.get(e)?.value && (s.current.set(e, {
|
|
77
|
+
value: t,
|
|
78
|
+
keywords: r
|
|
79
|
+
}), n.current.filtered.items.set(e, O(t, r)), T(2, () => {
|
|
80
|
+
k(), E.emit();
|
|
81
|
+
}));
|
|
82
|
+
},
|
|
83
|
+
item: (e, t) => (a.current.add(e), t && (o.current.has(t) ? o.current.get(t).add(e) : o.current.set(t, new Set([e]))), T(3, () => {
|
|
84
|
+
R(), k(), n.current.value || I(), E.emit();
|
|
85
|
+
}), () => {
|
|
86
|
+
s.current.delete(e), a.current.delete(e), n.current.filtered.items.delete(e);
|
|
87
|
+
let t = B();
|
|
88
|
+
T(4, () => {
|
|
89
|
+
R(), t?.getAttribute("id") === e && I(), E.emit();
|
|
90
|
+
});
|
|
91
|
+
}),
|
|
92
|
+
group: (e) => (o.current.has(e) || o.current.set(e, /* @__PURE__ */ new Set()), () => {
|
|
93
|
+
s.current.delete(e), o.current.delete(e);
|
|
94
|
+
}),
|
|
95
|
+
filter: () => l.current.shouldFilter,
|
|
96
|
+
label: u || e["aria-label"],
|
|
97
|
+
getDisablePointerSelection: () => l.current.disablePointerSelection,
|
|
98
|
+
listId: x,
|
|
99
|
+
inputId: C,
|
|
100
|
+
labelId: S,
|
|
101
|
+
listInnerRef: w
|
|
102
|
+
}), []);
|
|
103
|
+
function O(e, t) {
|
|
104
|
+
let r = l.current?.filter ?? ne;
|
|
105
|
+
return e ? r(e, n.current.search, t) : 0;
|
|
106
|
+
}
|
|
107
|
+
function k() {
|
|
108
|
+
if (!n.current.search || l.current.shouldFilter === !1) return;
|
|
109
|
+
let e = n.current.filtered.items, t = [];
|
|
110
|
+
n.current.filtered.groups.forEach((n) => {
|
|
111
|
+
let r = o.current.get(n), i = 0;
|
|
112
|
+
r.forEach((t) => {
|
|
113
|
+
let n = e.get(t);
|
|
114
|
+
i = Math.max(n, i);
|
|
115
|
+
}), t.push([n, i]);
|
|
116
|
+
});
|
|
117
|
+
let r = w.current;
|
|
118
|
+
V().sort((t, n) => {
|
|
119
|
+
let r = t.getAttribute("id"), i = n.getAttribute("id");
|
|
120
|
+
return (e.get(i) ?? 0) - (e.get(r) ?? 0);
|
|
121
|
+
}).forEach((e) => {
|
|
122
|
+
let t = e.closest(j);
|
|
123
|
+
t ? t.appendChild(e.parentElement === t ? e : e.closest(`${j} > *`)) : r.appendChild(e.parentElement === r ? e : e.closest(`${j} > *`));
|
|
124
|
+
}), t.sort((e, t) => t[1] - e[1]).forEach((e) => {
|
|
125
|
+
let t = w.current?.querySelector(`${A}[${P}="${encodeURIComponent(e[0])}"]`);
|
|
126
|
+
t?.parentElement.appendChild(t);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function I() {
|
|
130
|
+
let e = V().find((e) => e.getAttribute("aria-disabled") !== "true")?.getAttribute(P);
|
|
131
|
+
E.setState("value", e || void 0);
|
|
132
|
+
}
|
|
133
|
+
function R() {
|
|
134
|
+
if (!n.current.search || l.current.shouldFilter === !1) {
|
|
135
|
+
n.current.filtered.count = a.current.size;
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
n.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
139
|
+
let e = 0;
|
|
140
|
+
for (let t of a.current) {
|
|
141
|
+
let r = O(s.current.get(t)?.value ?? "", s.current.get(t)?.keywords ?? []);
|
|
142
|
+
n.current.filtered.items.set(t, r), r > 0 && e++;
|
|
143
|
+
}
|
|
144
|
+
for (let [e, t] of o.current) for (let r of t) if (n.current.filtered.items.get(r) > 0) {
|
|
145
|
+
n.current.filtered.groups.add(e);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
n.current.filtered.count = e;
|
|
149
|
+
}
|
|
150
|
+
function z() {
|
|
151
|
+
var e;
|
|
152
|
+
let t = B();
|
|
153
|
+
t && (t.parentElement?.firstChild === t && ((e = t.closest(A)?.querySelector(ee)) == null || e.scrollIntoView({ block: "nearest" })), t.scrollIntoView({ block: "nearest" }));
|
|
154
|
+
}
|
|
155
|
+
function B() {
|
|
156
|
+
return w.current?.querySelector(`${M}[aria-selected="true"]`);
|
|
157
|
+
}
|
|
158
|
+
function V() {
|
|
159
|
+
return Array.from(w.current?.querySelectorAll(te) || []);
|
|
160
|
+
}
|
|
161
|
+
function H(e) {
|
|
162
|
+
let t = V()[e];
|
|
163
|
+
t && E.setState("value", t.getAttribute(P));
|
|
164
|
+
}
|
|
165
|
+
function U(e) {
|
|
166
|
+
var t;
|
|
167
|
+
let n = B(), r = V(), i = r.findIndex((e) => e === n), a = r[i + e];
|
|
168
|
+
(t = l.current) != null && t.loop && (a = i + e < 0 ? r[r.length - 1] : i + e === r.length ? r[0] : r[i + e]), a && E.setState("value", a.getAttribute(P));
|
|
169
|
+
}
|
|
170
|
+
function W(e) {
|
|
171
|
+
let t = B()?.closest(A), n;
|
|
172
|
+
for (; t && !n;) t = e > 0 ? ie(t, A) : ae(t, A), n = t?.querySelector(te);
|
|
173
|
+
n ? E.setState("value", n.getAttribute(P)) : U(e);
|
|
174
|
+
}
|
|
175
|
+
let G = () => H(V().length - 1), K = (e) => {
|
|
176
|
+
e.preventDefault(), e.metaKey ? G() : e.altKey ? W(1) : U(1);
|
|
177
|
+
}, q = (e) => {
|
|
178
|
+
e.preventDefault(), e.metaKey ? H(0) : e.altKey ? W(-1) : U(-1);
|
|
179
|
+
};
|
|
180
|
+
return f.createElement(r.div, {
|
|
181
|
+
ref: t,
|
|
182
|
+
tabIndex: -1,
|
|
183
|
+
...b,
|
|
184
|
+
"cmdk-root": "",
|
|
185
|
+
onKeyDown: (e) => {
|
|
186
|
+
var t;
|
|
187
|
+
(t = b.onKeyDown) == null || t.call(b, e);
|
|
188
|
+
let n = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
189
|
+
if (!(e.defaultPrevented || n)) switch (e.key) {
|
|
190
|
+
case "n":
|
|
191
|
+
case "j":
|
|
192
|
+
y && e.ctrlKey && K(e);
|
|
193
|
+
break;
|
|
194
|
+
case "ArrowDown":
|
|
195
|
+
K(e);
|
|
196
|
+
break;
|
|
197
|
+
case "p":
|
|
198
|
+
case "k":
|
|
199
|
+
y && e.ctrlKey && q(e);
|
|
200
|
+
break;
|
|
201
|
+
case "ArrowUp":
|
|
202
|
+
q(e);
|
|
203
|
+
break;
|
|
204
|
+
case "Home":
|
|
205
|
+
e.preventDefault(), H(0);
|
|
206
|
+
break;
|
|
207
|
+
case "End":
|
|
208
|
+
e.preventDefault(), G();
|
|
209
|
+
break;
|
|
210
|
+
case "Enter": {
|
|
211
|
+
e.preventDefault();
|
|
212
|
+
let t = B();
|
|
213
|
+
if (t) {
|
|
214
|
+
let e = new Event(N);
|
|
215
|
+
t.dispatchEvent(e);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}, f.createElement("label", {
|
|
221
|
+
"cmdk-label": "",
|
|
222
|
+
htmlFor: D.inputId,
|
|
223
|
+
id: D.labelId,
|
|
224
|
+
style: le
|
|
225
|
+
}, u), $(e, (e) => f.createElement(L.Provider, { value: E }, f.createElement(F.Provider, { value: D }, e))));
|
|
226
|
+
}), V = f.forwardRef((e, t) => {
|
|
227
|
+
let a = i(), o = f.useRef(null), s = f.useContext(z), c = I(), l = Y(e), u = l.current?.forceMount ?? s?.forceMount;
|
|
228
|
+
X(() => {
|
|
229
|
+
if (!u) return c.item(a, s?.id);
|
|
230
|
+
}, [u]);
|
|
231
|
+
let d = oe(a, o, [
|
|
232
|
+
e.value,
|
|
233
|
+
e.children,
|
|
234
|
+
o
|
|
235
|
+
], e.keywords), p = R(), m = Q((e) => e.value && e.value === d.current), h = Q((e) => u || c.filter() === !1 ? !0 : e.search ? e.filtered.items.get(a) > 0 : !0);
|
|
236
|
+
f.useEffect(() => {
|
|
237
|
+
let t = o.current;
|
|
238
|
+
if (!(!t || e.disabled)) return t.addEventListener(N, g), () => t.removeEventListener(N, g);
|
|
239
|
+
}, [
|
|
240
|
+
h,
|
|
241
|
+
e.onSelect,
|
|
242
|
+
e.disabled
|
|
243
|
+
]);
|
|
244
|
+
function g() {
|
|
245
|
+
var e, t;
|
|
246
|
+
_(), (t = (e = l.current).onSelect) == null || t.call(e, d.current);
|
|
247
|
+
}
|
|
248
|
+
function _() {
|
|
249
|
+
p.setState("value", d.current, !0);
|
|
250
|
+
}
|
|
251
|
+
if (!h) return null;
|
|
252
|
+
let { disabled: v, value: y, onSelect: b, forceMount: x, keywords: S, ...C } = e;
|
|
253
|
+
return f.createElement(r.div, {
|
|
254
|
+
ref: n(o, t),
|
|
255
|
+
...C,
|
|
256
|
+
id: a,
|
|
257
|
+
"cmdk-item": "",
|
|
258
|
+
role: "option",
|
|
259
|
+
"aria-disabled": !!v,
|
|
260
|
+
"aria-selected": !!m,
|
|
261
|
+
"data-disabled": !!v,
|
|
262
|
+
"data-selected": !!m,
|
|
263
|
+
onPointerMove: v || c.getDisablePointerSelection() ? void 0 : _,
|
|
264
|
+
onClick: v ? void 0 : g
|
|
265
|
+
}, e.children);
|
|
266
|
+
}), H = f.forwardRef((e, t) => {
|
|
267
|
+
let { heading: a, children: o, forceMount: s, ...c } = e, l = i(), u = f.useRef(null), d = f.useRef(null), p = i(), m = I(), h = Q((e) => s || m.filter() === !1 ? !0 : e.search ? e.filtered.groups.has(l) : !0);
|
|
268
|
+
X(() => m.group(l), []), oe(l, u, [
|
|
269
|
+
e.value,
|
|
270
|
+
e.heading,
|
|
271
|
+
d
|
|
272
|
+
]);
|
|
273
|
+
let g = f.useMemo(() => ({
|
|
274
|
+
id: l,
|
|
275
|
+
forceMount: s
|
|
276
|
+
}), [s]);
|
|
277
|
+
return f.createElement(r.div, {
|
|
278
|
+
ref: n(u, t),
|
|
279
|
+
...c,
|
|
280
|
+
"cmdk-group": "",
|
|
281
|
+
role: "presentation",
|
|
282
|
+
hidden: h ? void 0 : !0
|
|
283
|
+
}, a && f.createElement("div", {
|
|
284
|
+
ref: d,
|
|
285
|
+
"cmdk-group-heading": "",
|
|
286
|
+
"aria-hidden": !0,
|
|
287
|
+
id: p
|
|
288
|
+
}, a), $(e, (e) => f.createElement("div", {
|
|
289
|
+
"cmdk-group-items": "",
|
|
290
|
+
role: "group",
|
|
291
|
+
"aria-labelledby": a ? p : void 0
|
|
292
|
+
}, f.createElement(z.Provider, { value: g }, e))));
|
|
293
|
+
}), U = f.forwardRef((e, t) => {
|
|
294
|
+
let { alwaysRender: i, ...a } = e, o = f.useRef(null), s = Q((e) => !e.search);
|
|
295
|
+
return !i && !s ? null : f.createElement(r.div, {
|
|
296
|
+
ref: n(o, t),
|
|
297
|
+
...a,
|
|
298
|
+
"cmdk-separator": "",
|
|
299
|
+
role: "separator"
|
|
300
|
+
});
|
|
301
|
+
}), W = f.forwardRef((e, t) => {
|
|
302
|
+
let { onValueChange: n, ...i } = e, a = e.value != null, o = R(), s = Q((e) => e.search), c = Q((e) => e.selectedItemId), l = I();
|
|
303
|
+
return f.useEffect(() => {
|
|
304
|
+
e.value != null && o.setState("search", e.value);
|
|
305
|
+
}, [e.value]), f.createElement(r.input, {
|
|
306
|
+
ref: t,
|
|
307
|
+
...i,
|
|
308
|
+
"cmdk-input": "",
|
|
309
|
+
autoComplete: "off",
|
|
310
|
+
autoCorrect: "off",
|
|
311
|
+
spellCheck: !1,
|
|
312
|
+
"aria-autocomplete": "list",
|
|
313
|
+
role: "combobox",
|
|
314
|
+
"aria-expanded": !0,
|
|
315
|
+
"aria-controls": l.listId,
|
|
316
|
+
"aria-labelledby": l.labelId,
|
|
317
|
+
"aria-activedescendant": c,
|
|
318
|
+
id: l.inputId,
|
|
319
|
+
type: "text",
|
|
320
|
+
value: a ? e.value : s,
|
|
321
|
+
onChange: (e) => {
|
|
322
|
+
a || o.setState("search", e.target.value), n?.(e.target.value);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}), G = f.forwardRef((e, t) => {
|
|
326
|
+
let { children: i, label: a = "Suggestions", ...o } = e, s = f.useRef(null), c = f.useRef(null), l = Q((e) => e.selectedItemId), u = I();
|
|
327
|
+
return f.useEffect(() => {
|
|
328
|
+
if (c.current && s.current) {
|
|
329
|
+
let e = c.current, t = s.current, n, r = new ResizeObserver(() => {
|
|
330
|
+
n = requestAnimationFrame(() => {
|
|
331
|
+
let n = e.offsetHeight;
|
|
332
|
+
t.style.setProperty("--cmdk-list-height", n.toFixed(1) + "px");
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
return r.observe(e), () => {
|
|
336
|
+
cancelAnimationFrame(n), r.unobserve(e);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}, []), f.createElement(r.div, {
|
|
340
|
+
ref: n(s, t),
|
|
341
|
+
...o,
|
|
342
|
+
"cmdk-list": "",
|
|
343
|
+
role: "listbox",
|
|
344
|
+
tabIndex: -1,
|
|
345
|
+
"aria-activedescendant": l,
|
|
346
|
+
"aria-label": a,
|
|
347
|
+
id: u.listId
|
|
348
|
+
}, $(e, (e) => f.createElement("div", {
|
|
349
|
+
ref: n(c, u.listInnerRef),
|
|
350
|
+
"cmdk-list-sizer": ""
|
|
351
|
+
}, e)));
|
|
352
|
+
}), K = f.forwardRef((e, t) => {
|
|
353
|
+
let { open: n, onOpenChange: r, overlayClassName: i, contentClassName: a, container: o, ...s } = e;
|
|
354
|
+
return f.createElement(d, {
|
|
355
|
+
open: n,
|
|
356
|
+
onOpenChange: r
|
|
357
|
+
}, f.createElement(c, { container: o }, f.createElement(l, {
|
|
358
|
+
"cmdk-overlay": "",
|
|
359
|
+
className: i
|
|
360
|
+
}), f.createElement(u, {
|
|
361
|
+
"aria-label": e.label,
|
|
362
|
+
"cmdk-dialog": "",
|
|
363
|
+
className: a
|
|
364
|
+
}, f.createElement(B, {
|
|
365
|
+
ref: t,
|
|
366
|
+
...s
|
|
367
|
+
}))));
|
|
368
|
+
}), q = f.forwardRef((e, t) => Q((e) => e.filtered.count === 0) ? f.createElement(r.div, {
|
|
369
|
+
ref: t,
|
|
370
|
+
...e,
|
|
371
|
+
"cmdk-empty": "",
|
|
372
|
+
role: "presentation"
|
|
373
|
+
}) : null), re = f.forwardRef((e, t) => {
|
|
374
|
+
let { progress: n, children: i, label: a = "Loading...", ...o } = e;
|
|
375
|
+
return f.createElement(r.div, {
|
|
376
|
+
ref: t,
|
|
377
|
+
...o,
|
|
378
|
+
"cmdk-loading": "",
|
|
379
|
+
role: "progressbar",
|
|
380
|
+
"aria-valuenow": n,
|
|
381
|
+
"aria-valuemin": 0,
|
|
382
|
+
"aria-valuemax": 100,
|
|
383
|
+
"aria-label": a
|
|
384
|
+
}, $(e, (e) => f.createElement("div", { "aria-hidden": !0 }, e)));
|
|
385
|
+
}), J = Object.assign(B, {
|
|
386
|
+
List: G,
|
|
387
|
+
Item: V,
|
|
388
|
+
Input: W,
|
|
389
|
+
Group: H,
|
|
390
|
+
Separator: U,
|
|
391
|
+
Dialog: K,
|
|
392
|
+
Empty: q,
|
|
393
|
+
Loading: re
|
|
394
|
+
});
|
|
395
|
+
function ie(e, t) {
|
|
396
|
+
let n = e.nextElementSibling;
|
|
397
|
+
for (; n;) {
|
|
398
|
+
if (n.matches(t)) return n;
|
|
399
|
+
n = n.nextElementSibling;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function ae(e, t) {
|
|
403
|
+
let n = e.previousElementSibling;
|
|
404
|
+
for (; n;) {
|
|
405
|
+
if (n.matches(t)) return n;
|
|
406
|
+
n = n.previousElementSibling;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function Y(e) {
|
|
410
|
+
let t = f.useRef(e);
|
|
411
|
+
return X(() => {
|
|
412
|
+
t.current = e;
|
|
413
|
+
}), t;
|
|
414
|
+
}
|
|
415
|
+
var X = typeof window > "u" ? f.useEffect : f.useLayoutEffect;
|
|
416
|
+
function Z(e) {
|
|
417
|
+
let t = f.useRef();
|
|
418
|
+
return t.current === void 0 && (t.current = e()), t;
|
|
419
|
+
}
|
|
420
|
+
function Q(e) {
|
|
421
|
+
let t = R(), n = () => e(t.snapshot());
|
|
422
|
+
return f.useSyncExternalStore(t.subscribe, n, n);
|
|
423
|
+
}
|
|
424
|
+
function oe(e, t, n, r = []) {
|
|
425
|
+
let i = f.useRef(), a = I();
|
|
426
|
+
return X(() => {
|
|
427
|
+
var o;
|
|
428
|
+
let s = (() => {
|
|
429
|
+
for (let e of n) {
|
|
430
|
+
if (typeof e == "string") return e.trim();
|
|
431
|
+
if (typeof e == "object" && "current" in e) return e.current ? e.current.textContent?.trim() : i.current;
|
|
432
|
+
}
|
|
433
|
+
})(), c = r.map((e) => e.trim());
|
|
434
|
+
a.value(e, s, c), (o = t.current) == null || o.setAttribute(P, s), i.current = s;
|
|
435
|
+
}), i;
|
|
436
|
+
}
|
|
437
|
+
var se = () => {
|
|
438
|
+
let [e, t] = f.useState(), n = Z(() => /* @__PURE__ */ new Map());
|
|
439
|
+
return X(() => {
|
|
440
|
+
n.current.forEach((e) => e()), n.current = /* @__PURE__ */ new Map();
|
|
441
|
+
}, [e]), (e, r) => {
|
|
442
|
+
n.current.set(e, r), t({});
|
|
443
|
+
};
|
|
444
|
+
};
|
|
445
|
+
function ce(e) {
|
|
446
|
+
let t = e.type;
|
|
447
|
+
return typeof t == "function" ? t(e.props) : "render" in t ? t.render(e.props) : e;
|
|
448
|
+
}
|
|
449
|
+
function $({ asChild: e, children: t }, n) {
|
|
450
|
+
return e && f.isValidElement(t) ? f.cloneElement(ce(t), { ref: t.ref }, n(t.props.children)) : n(t);
|
|
451
|
+
}
|
|
452
|
+
var le = {
|
|
453
|
+
position: "absolute",
|
|
454
|
+
width: "1px",
|
|
455
|
+
height: "1px",
|
|
456
|
+
padding: "0",
|
|
457
|
+
margin: "-1px",
|
|
458
|
+
overflow: "hidden",
|
|
459
|
+
clip: "rect(0, 0, 0, 0)",
|
|
460
|
+
whiteSpace: "nowrap",
|
|
461
|
+
borderWidth: "0"
|
|
462
|
+
}, ue = ({ className: e, ...t }) => /* @__PURE__ */ p(J, {
|
|
463
|
+
"data-slot": "command",
|
|
464
|
+
className: a("rounded-xl! p-1 flex size-full flex-col overflow-hidden text-input-text", e),
|
|
465
|
+
...t
|
|
466
|
+
}), de = ({ className: e, ...n }) => /* @__PURE__ */ p("div", {
|
|
467
|
+
"data-slot": "command-input-wrapper",
|
|
468
|
+
className: "pb-0",
|
|
469
|
+
children: /* @__PURE__ */ m(o, {
|
|
470
|
+
className: "h-8! rounded-lg! *:data-[slot=input-group-addon]:pl-2! border-input-border bg-input-bg shadow-none! focus-visible:outline-0",
|
|
471
|
+
children: [/* @__PURE__ */ p(J.Input, {
|
|
472
|
+
"data-slot": "input-group-control",
|
|
473
|
+
className: a("text-sm w-full outline-hidden disabled:cursor-not-allowed disabled:opacity-50", e),
|
|
474
|
+
...n
|
|
475
|
+
}), /* @__PURE__ */ p(s, { children: /* @__PURE__ */ p(t, { className: "size-4 shrink-0 opacity-50" }) })]
|
|
476
|
+
})
|
|
477
|
+
}), fe = ({ className: e, ...t }) => /* @__PURE__ */ p(J.List, {
|
|
478
|
+
"data-slot": "command-list",
|
|
479
|
+
className: a("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", e),
|
|
480
|
+
...t
|
|
481
|
+
}), pe = ({ className: e, ...t }) => /* @__PURE__ */ p(J.Empty, {
|
|
482
|
+
"data-slot": "command-empty",
|
|
483
|
+
className: a("py-6 text-base text-center text-text-secondary", e),
|
|
484
|
+
...t
|
|
485
|
+
}), me = ({ className: t, children: n, ...r }) => /* @__PURE__ */ m(J.Item, {
|
|
486
|
+
"data-slot": "command-item",
|
|
487
|
+
className: a("group/command-item text-base in-data-[slot=dialog-content]:rounded-lg! relative flex text-input-text outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0", t),
|
|
488
|
+
...r,
|
|
489
|
+
children: [n, /* @__PURE__ */ p(e, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })]
|
|
490
|
+
});
|
|
491
|
+
//#endregion
|
|
492
|
+
export { ue as ComboboxBase, pe as CommandEmpty, de as CommandInput, me as CommandItem, fe as CommandList };
|