@konstructio/ui 0.0.12-alpha.2 → 0.0.12-alpha.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.
Files changed (64) hide show
  1. package/dist/{Modal-DZUwNzSW.js → Modal-ByNiP7eb.js} +3 -3
  2. package/dist/components/Alert/Alert.js +1 -1
  3. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  4. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  5. package/dist/components/AlertDialog/components/index.js +1 -1
  6. package/dist/components/Checkbox/Checkbox.js +1 -1
  7. package/dist/components/Command/Command.js +32 -0
  8. package/dist/components/Command/Command.variants.js +97 -0
  9. package/dist/components/Command/components/Command.js +8 -0
  10. package/dist/components/Command/components/CommandEmpty.js +15 -0
  11. package/dist/components/Command/components/CommandGroup.js +19 -0
  12. package/dist/components/Command/components/CommandInput.js +84 -0
  13. package/dist/components/Command/components/CommandItem.js +29 -0
  14. package/dist/components/Command/components/CommandList.js +16 -0
  15. package/dist/components/Command/components/CommandSeparator.js +16 -0
  16. package/dist/components/Command/components/CommandShortcut.js +19 -0
  17. package/dist/components/Command/components/DialogContent.js +31 -0
  18. package/dist/components/Command/components/DialogOverlay.js +19 -0
  19. package/dist/components/Command/components/index.js +20 -0
  20. package/dist/components/Command/contexts/Command.context.js +13 -0
  21. package/dist/components/Command/contexts/Command.provider.js +24 -0
  22. package/dist/components/Command/contexts/index.js +6 -0
  23. package/dist/components/Loading/Loading.js +102 -21
  24. package/dist/components/Loading/Loading.variants.js +13 -14
  25. package/dist/components/Modal/Modal.js +2 -2
  26. package/dist/components/Modal/components/Wrapper/Wrapper.js +2 -2
  27. package/dist/components/Modal/components/index.js +1 -1
  28. package/dist/components/NumberInput/NumberInput.js +1 -1
  29. package/dist/components/Range/Range.js +1 -1
  30. package/dist/components/Slider/Slider.js +1 -1
  31. package/dist/components/Switch/Switch.js +1 -1
  32. package/dist/components/Tag/Tag.js +17 -5
  33. package/dist/components/Tag/Tag.variants.js +11 -1
  34. package/dist/components/TagSelect/TagSelect.js +6 -71
  35. package/dist/components/TagSelect/TagSelect.variants.js +29 -50
  36. package/dist/components/TagSelect/components/Item/Item.js +23 -0
  37. package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
  38. package/dist/components/TagSelect/components/List/List.js +13 -0
  39. package/dist/components/TagSelect/components/List/List.variants.js +37 -0
  40. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
  41. package/dist/components/TagSelect/components/index.js +8 -0
  42. package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
  43. package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
  44. package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
  45. package/dist/components/TagSelect/contexts/index.js +6 -0
  46. package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
  47. package/dist/components/Toast/Toast.js +3 -3
  48. package/dist/components/Typography/Typography.js +23 -22
  49. package/dist/components/Typography/Typography.variants.js +49 -22
  50. package/dist/components/index.js +1 -1
  51. package/dist/{index-C6WtlN_F.js → index-BzaHYXkt.js} +1 -1
  52. package/dist/{index-Z1voPZOH.js → index-CbTU3cnP.js} +1 -1
  53. package/dist/index-CzSBQN5S.js +432 -0
  54. package/dist/index-D7QNmo_D.js +422 -0
  55. package/dist/index-DUA6Y_AE.js +126 -0
  56. package/dist/{index-B33at13_.js → index-D_76wh4w.js} +1 -1
  57. package/dist/index-DyKo5ZJT.js +446 -0
  58. package/dist/index.d.ts +15 -5
  59. package/dist/index.js +1 -1
  60. package/dist/package.json +17 -13
  61. package/dist/styles.css +1 -1
  62. package/package.json +16 -13
  63. package/dist/index-3jTPaVvh.js +0 -551
  64. package/dist/index-BTeAm7mx.js +0 -19133
@@ -0,0 +1,432 @@
1
+ import { u as T, R as Ce, P as Ae, O as Ie, C as Le } from "./index-DyKo5ZJT.js";
2
+ import * as l from "react";
3
+ import be from "react";
4
+ import { P as C } from "./index-D7QNmo_D.js";
5
+ var pe = 1, De = 0.9, $e = 0.8, Me = 0.17, X = 0.1, Q = 0.999, Ve = 0.9999, Te = 0.99, Ke = /[\\\/_+.#"@\[\(\{&]/, qe = /[\\\/_+.#"@\[\(\{&]/g, Pe = /[\s-]/, ye = /[\s-]/g;
6
+ function re(e, n, r, v, u, i, d) {
7
+ if (i === n.length) return u === e.length ? pe : Te;
8
+ var m = `${u},${i}`;
9
+ if (d[m] !== void 0) return d[m];
10
+ for (var g = v.charAt(i), p = r.indexOf(g, u), c = 0, o, S, f, E; p >= 0; ) o = re(e, n, r, v, p + 1, i + 1, d), o > c && (p === u ? o *= pe : Ke.test(e.charAt(p - 1)) ? (o *= $e, f = e.slice(u, p - 1).match(qe), f && u > 0 && (o *= Math.pow(Q, f.length))) : Pe.test(e.charAt(p - 1)) ? (o *= De, E = e.slice(u, p - 1).match(ye), E && u > 0 && (o *= Math.pow(Q, E.length))) : (o *= Me, u > 0 && (o *= Math.pow(Q, p - u))), e.charAt(p) !== n.charAt(i) && (o *= Ve)), (o < X && r.charAt(p - 1) === v.charAt(i + 1) || v.charAt(i + 1) === v.charAt(i) && r.charAt(p - 1) !== v.charAt(i)) && (S = re(e, n, r, v, p + 1, i + 2, d), S * X > o && (o = S * X)), o > c && (c = o), p = r.indexOf(g, p + 1);
11
+ return d[m] = c, c;
12
+ }
13
+ function me(e) {
14
+ return e.toLowerCase().replace(ye, " ");
15
+ }
16
+ function Ue(e, n, r) {
17
+ return e = r && r.length > 0 ? `${e + " " + r.join(" ")}` : e, re(e, n, me(e), me(n), 0, 0, {});
18
+ }
19
+ var H = { exports: {} }, Z = {};
20
+ /**
21
+ * @license React
22
+ * use-sync-external-store-shim.production.js
23
+ *
24
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
25
+ *
26
+ * This source code is licensed under the MIT license found in the
27
+ * LICENSE file in the root directory of this source tree.
28
+ */
29
+ var he;
30
+ function je() {
31
+ if (he) return Z;
32
+ he = 1;
33
+ var e = be;
34
+ function n(o, S) {
35
+ return o === S && (o !== 0 || 1 / o === 1 / S) || o !== o && S !== S;
36
+ }
37
+ var r = typeof Object.is == "function" ? Object.is : n, v = e.useState, u = e.useEffect, i = e.useLayoutEffect, d = e.useDebugValue;
38
+ function m(o, S) {
39
+ var f = S(), E = v({ inst: { value: f, getSnapshot: S } }), w = E[0].inst, _ = E[1];
40
+ return i(
41
+ function() {
42
+ w.value = f, w.getSnapshot = S, g(w) && _({ inst: w });
43
+ },
44
+ [o, f, S]
45
+ ), u(
46
+ function() {
47
+ return g(w) && _({ inst: w }), o(function() {
48
+ g(w) && _({ inst: w });
49
+ });
50
+ },
51
+ [o]
52
+ ), d(f), f;
53
+ }
54
+ function g(o) {
55
+ var S = o.getSnapshot;
56
+ o = o.value;
57
+ try {
58
+ var f = S();
59
+ return !r(o, f);
60
+ } catch {
61
+ return !0;
62
+ }
63
+ }
64
+ function p(o, S) {
65
+ return S();
66
+ }
67
+ var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? p : m;
68
+ return Z.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : c, Z;
69
+ }
70
+ var ee = {};
71
+ /**
72
+ * @license React
73
+ * use-sync-external-store-shim.development.js
74
+ *
75
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
76
+ *
77
+ * This source code is licensed under the MIT license found in the
78
+ * LICENSE file in the root directory of this source tree.
79
+ */
80
+ var ge;
81
+ function Ge() {
82
+ return ge || (ge = 1, process.env.NODE_ENV !== "production" && function() {
83
+ function e(f, E) {
84
+ return f === E && (f !== 0 || 1 / f === 1 / E) || f !== f && E !== E;
85
+ }
86
+ function n(f, E) {
87
+ c || u.startTransition === void 0 || (c = !0, console.error(
88
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
89
+ ));
90
+ var w = E();
91
+ if (!o) {
92
+ var _ = E();
93
+ i(w, _) || (console.error(
94
+ "The result of getSnapshot should be cached to avoid an infinite loop"
95
+ ), o = !0);
96
+ }
97
+ _ = d({
98
+ inst: { value: w, getSnapshot: E }
99
+ });
100
+ var k = _[0].inst, M = _[1];
101
+ return g(
102
+ function() {
103
+ k.value = w, k.getSnapshot = E, r(k) && M({ inst: k });
104
+ },
105
+ [f, w, E]
106
+ ), m(
107
+ function() {
108
+ return r(k) && M({ inst: k }), f(function() {
109
+ r(k) && M({ inst: k });
110
+ });
111
+ },
112
+ [f]
113
+ ), p(w), w;
114
+ }
115
+ function r(f) {
116
+ var E = f.getSnapshot;
117
+ f = f.value;
118
+ try {
119
+ var w = E();
120
+ return !i(f, w);
121
+ } catch {
122
+ return !0;
123
+ }
124
+ }
125
+ function v(f, E) {
126
+ return E();
127
+ }
128
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
129
+ var u = be, i = typeof Object.is == "function" ? Object.is : e, d = u.useState, m = u.useEffect, g = u.useLayoutEffect, p = u.useDebugValue, c = !1, o = !1, S = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? v : n;
130
+ ee.useSyncExternalStore = u.useSyncExternalStore !== void 0 ? u.useSyncExternalStore : S, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
131
+ }()), ee;
132
+ }
133
+ var Se;
134
+ function He() {
135
+ return Se || (Se = 1, process.env.NODE_ENV === "production" ? H.exports = /* @__PURE__ */ je() : H.exports = /* @__PURE__ */ Ge()), H.exports;
136
+ }
137
+ var Be = /* @__PURE__ */ He(), P = '[cmdk-group=""]', te = '[cmdk-group-items=""]', Fe = '[cmdk-group-heading=""]', le = '[cmdk-item=""]', Ee = `${le}:not([aria-disabled="true"])`, ne = "cmdk-item-select", L = "data-value", Ne = (e, n, r) => Ue(e, n, r), we = l.createContext(void 0), j = () => l.useContext(we), xe = l.createContext(void 0), ue = () => l.useContext(xe), _e = l.createContext(void 0), ke = l.forwardRef((e, n) => {
138
+ let r = V(() => {
139
+ var t, s;
140
+ return { search: "", value: (s = (t = e.value) != null ? t : e.defaultValue) != null ? s : "", filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
141
+ }), v = V(() => /* @__PURE__ */ new Set()), u = V(() => /* @__PURE__ */ new Map()), i = V(() => /* @__PURE__ */ new Map()), d = V(() => /* @__PURE__ */ new Set()), m = Oe(e), { label: g, children: p, value: c, onValueChange: o, filter: S, shouldFilter: f, loop: E, disablePointerSelection: w = !1, vimBindings: _ = !0, ...k } = e, M = T(), ae = T(), oe = T(), A = l.useRef(null), x = nt();
142
+ D(() => {
143
+ if (c !== void 0) {
144
+ let t = c.trim();
145
+ r.current.value = t, O.emit();
146
+ }
147
+ }, [c]), D(() => {
148
+ x(6, ce);
149
+ }, []);
150
+ let O = l.useMemo(() => ({ subscribe: (t) => (d.current.add(t), () => d.current.delete(t)), snapshot: () => r.current, setState: (t, s, h) => {
151
+ var a, b, y;
152
+ if (!Object.is(r.current[t], s)) {
153
+ if (r.current[t] = s, t === "search") z(), N(), x(1, W);
154
+ else if (t === "value" && (h || x(5, ce), ((a = m.current) == null ? void 0 : a.value) !== void 0)) {
155
+ let R = s ?? "";
156
+ (y = (b = m.current).onValueChange) == null || y.call(b, R);
157
+ return;
158
+ }
159
+ O.emit();
160
+ }
161
+ }, emit: () => {
162
+ d.current.forEach((t) => t());
163
+ } }), []), F = l.useMemo(() => ({ value: (t, s, h) => {
164
+ var a;
165
+ s !== ((a = i.current.get(t)) == null ? void 0 : a.value) && (i.current.set(t, { value: s, keywords: h }), r.current.filtered.items.set(t, ie(s, h)), x(2, () => {
166
+ N(), O.emit();
167
+ }));
168
+ }, item: (t, s) => (v.current.add(t), s && (u.current.has(s) ? u.current.get(s).add(t) : u.current.set(s, /* @__PURE__ */ new Set([t]))), x(3, () => {
169
+ z(), N(), r.current.value || W(), O.emit();
170
+ }), () => {
171
+ i.current.delete(t), v.current.delete(t), r.current.filtered.items.delete(t);
172
+ let h = K();
173
+ x(4, () => {
174
+ z(), (h == null ? void 0 : h.getAttribute("id")) === t && W(), O.emit();
175
+ });
176
+ }), group: (t) => (u.current.has(t) || u.current.set(t, /* @__PURE__ */ new Set()), () => {
177
+ i.current.delete(t), u.current.delete(t);
178
+ }), filter: () => m.current.shouldFilter, label: g || e["aria-label"], getDisablePointerSelection: () => m.current.disablePointerSelection, listId: M, inputId: oe, labelId: ae, listInnerRef: A }), []);
179
+ function ie(t, s) {
180
+ var h, a;
181
+ let b = (a = (h = m.current) == null ? void 0 : h.filter) != null ? a : Ne;
182
+ return t ? b(t, r.current.search, s) : 0;
183
+ }
184
+ function N() {
185
+ if (!r.current.search || m.current.shouldFilter === !1) return;
186
+ let t = r.current.filtered.items, s = [];
187
+ r.current.filtered.groups.forEach((a) => {
188
+ let b = u.current.get(a), y = 0;
189
+ b.forEach((R) => {
190
+ let I = t.get(R);
191
+ y = Math.max(I, y);
192
+ }), s.push([a, y]);
193
+ });
194
+ let h = A.current;
195
+ q().sort((a, b) => {
196
+ var y, R;
197
+ let I = a.getAttribute("id"), G = b.getAttribute("id");
198
+ return ((y = t.get(G)) != null ? y : 0) - ((R = t.get(I)) != null ? R : 0);
199
+ }).forEach((a) => {
200
+ let b = a.closest(te);
201
+ b ? b.appendChild(a.parentElement === b ? a : a.closest(`${te} > *`)) : h.appendChild(a.parentElement === h ? a : a.closest(`${te} > *`));
202
+ }), s.sort((a, b) => b[1] - a[1]).forEach((a) => {
203
+ var b;
204
+ let y = (b = A.current) == null ? void 0 : b.querySelector(`${P}[${L}="${encodeURIComponent(a[0])}"]`);
205
+ y == null || y.parentElement.appendChild(y);
206
+ });
207
+ }
208
+ function W() {
209
+ let t = q().find((h) => h.getAttribute("aria-disabled") !== "true"), s = t == null ? void 0 : t.getAttribute(L);
210
+ O.setState("value", s || void 0);
211
+ }
212
+ function z() {
213
+ var t, s, h, a;
214
+ if (!r.current.search || m.current.shouldFilter === !1) {
215
+ r.current.filtered.count = v.current.size;
216
+ return;
217
+ }
218
+ r.current.filtered.groups = /* @__PURE__ */ new Set();
219
+ let b = 0;
220
+ for (let y of v.current) {
221
+ let R = (s = (t = i.current.get(y)) == null ? void 0 : t.value) != null ? s : "", I = (a = (h = i.current.get(y)) == null ? void 0 : h.keywords) != null ? a : [], G = ie(R, I);
222
+ r.current.filtered.items.set(y, G), G > 0 && b++;
223
+ }
224
+ for (let [y, R] of u.current) for (let I of R) if (r.current.filtered.items.get(I) > 0) {
225
+ r.current.filtered.groups.add(y);
226
+ break;
227
+ }
228
+ r.current.filtered.count = b;
229
+ }
230
+ function ce() {
231
+ var t, s, h;
232
+ let a = K();
233
+ a && (((t = a.parentElement) == null ? void 0 : t.firstChild) === a && ((h = (s = a.closest(P)) == null ? void 0 : s.querySelector(Fe)) == null || h.scrollIntoView({ block: "nearest" })), a.scrollIntoView({ block: "nearest" }));
234
+ }
235
+ function K() {
236
+ var t;
237
+ return (t = A.current) == null ? void 0 : t.querySelector(`${le}[aria-selected="true"]`);
238
+ }
239
+ function q() {
240
+ var t;
241
+ return Array.from(((t = A.current) == null ? void 0 : t.querySelectorAll(Ee)) || []);
242
+ }
243
+ function Y(t) {
244
+ let s = q()[t];
245
+ s && O.setState("value", s.getAttribute(L));
246
+ }
247
+ function J(t) {
248
+ var s;
249
+ let h = K(), a = q(), b = a.findIndex((R) => R === h), y = a[b + t];
250
+ (s = m.current) != null && s.loop && (y = b + t < 0 ? a[a.length - 1] : b + t === a.length ? a[0] : a[b + t]), y && O.setState("value", y.getAttribute(L));
251
+ }
252
+ function se(t) {
253
+ let s = K(), h = s == null ? void 0 : s.closest(P), a;
254
+ for (; h && !a; ) h = t > 0 ? tt(h, P) : rt(h, P), a = h == null ? void 0 : h.querySelector(Ee);
255
+ a ? O.setState("value", a.getAttribute(L)) : J(t);
256
+ }
257
+ let de = () => Y(q().length - 1), fe = (t) => {
258
+ t.preventDefault(), t.metaKey ? de() : t.altKey ? se(1) : J(1);
259
+ }, ve = (t) => {
260
+ t.preventDefault(), t.metaKey ? Y(0) : t.altKey ? se(-1) : J(-1);
261
+ };
262
+ return l.createElement(C.div, { ref: n, tabIndex: -1, ...k, "cmdk-root": "", onKeyDown: (t) => {
263
+ var s;
264
+ if ((s = k.onKeyDown) == null || s.call(k, t), !t.defaultPrevented) switch (t.key) {
265
+ case "n":
266
+ case "j": {
267
+ _ && t.ctrlKey && fe(t);
268
+ break;
269
+ }
270
+ case "ArrowDown": {
271
+ fe(t);
272
+ break;
273
+ }
274
+ case "p":
275
+ case "k": {
276
+ _ && t.ctrlKey && ve(t);
277
+ break;
278
+ }
279
+ case "ArrowUp": {
280
+ ve(t);
281
+ break;
282
+ }
283
+ case "Home": {
284
+ t.preventDefault(), Y(0);
285
+ break;
286
+ }
287
+ case "End": {
288
+ t.preventDefault(), de();
289
+ break;
290
+ }
291
+ case "Enter":
292
+ if (!t.nativeEvent.isComposing && t.keyCode !== 229) {
293
+ t.preventDefault();
294
+ let h = K();
295
+ if (h) {
296
+ let a = new Event(ne);
297
+ h.dispatchEvent(a);
298
+ }
299
+ }
300
+ }
301
+ } }, l.createElement("label", { "cmdk-label": "", htmlFor: F.inputId, id: F.labelId, style: ut }, g), B(e, (t) => l.createElement(xe.Provider, { value: O }, l.createElement(we.Provider, { value: F }, t))));
302
+ }), We = l.forwardRef((e, n) => {
303
+ var r, v;
304
+ let u = T(), i = l.useRef(null), d = l.useContext(_e), m = j(), g = Oe(e), p = (v = (r = g.current) == null ? void 0 : r.forceMount) != null ? v : d == null ? void 0 : d.forceMount;
305
+ D(() => {
306
+ if (!p) return m.item(u, d == null ? void 0 : d.id);
307
+ }, [p]);
308
+ let c = Re(u, i, [e.value, e.children, i], e.keywords), o = ue(), S = $((x) => x.value && x.value === c.current), f = $((x) => p || m.filter() === !1 ? !0 : x.search ? x.filtered.items.get(u) > 0 : !0);
309
+ l.useEffect(() => {
310
+ let x = i.current;
311
+ if (!(!x || e.disabled)) return x.addEventListener(ne, E), () => x.removeEventListener(ne, E);
312
+ }, [f, e.onSelect, e.disabled]);
313
+ function E() {
314
+ var x, O;
315
+ w(), (O = (x = g.current).onSelect) == null || O.call(x, c.current);
316
+ }
317
+ function w() {
318
+ o.setState("value", c.current, !0);
319
+ }
320
+ if (!f) return null;
321
+ let { disabled: _, value: k, onSelect: M, forceMount: ae, keywords: oe, ...A } = e;
322
+ return l.createElement(C.div, { ref: U([i, n]), ...A, id: u, "cmdk-item": "", role: "option", "aria-disabled": !!_, "aria-selected": !!S, "data-disabled": !!_, "data-selected": !!S, onPointerMove: _ || m.getDisablePointerSelection() ? void 0 : w, onClick: _ ? void 0 : E }, e.children);
323
+ }), ze = l.forwardRef((e, n) => {
324
+ let { heading: r, children: v, forceMount: u, ...i } = e, d = T(), m = l.useRef(null), g = l.useRef(null), p = T(), c = j(), o = $((f) => u || c.filter() === !1 ? !0 : f.search ? f.filtered.groups.has(d) : !0);
325
+ D(() => c.group(d), []), Re(d, m, [e.value, e.heading, g]);
326
+ let S = l.useMemo(() => ({ id: d, forceMount: u }), [u]);
327
+ return l.createElement(C.div, { ref: U([m, n]), ...i, "cmdk-group": "", role: "presentation", hidden: o ? void 0 : !0 }, r && l.createElement("div", { ref: g, "cmdk-group-heading": "", "aria-hidden": !0, id: p }, r), B(e, (f) => l.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? p : void 0 }, l.createElement(_e.Provider, { value: S }, f))));
328
+ }), Ye = l.forwardRef((e, n) => {
329
+ let { alwaysRender: r, ...v } = e, u = l.useRef(null), i = $((d) => !d.search);
330
+ return !r && !i ? null : l.createElement(C.div, { ref: U([u, n]), ...v, "cmdk-separator": "", role: "separator" });
331
+ }), Je = l.forwardRef((e, n) => {
332
+ let { onValueChange: r, ...v } = e, u = e.value != null, i = ue(), d = $((c) => c.search), m = $((c) => c.value), g = j(), p = l.useMemo(() => {
333
+ var c;
334
+ let o = (c = g.listInnerRef.current) == null ? void 0 : c.querySelector(`${le}[${L}="${encodeURIComponent(m)}"]`);
335
+ return o == null ? void 0 : o.getAttribute("id");
336
+ }, []);
337
+ return l.useEffect(() => {
338
+ e.value != null && i.setState("search", e.value);
339
+ }, [e.value]), l.createElement(C.input, { ref: n, ...v, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": g.listId, "aria-labelledby": g.labelId, "aria-activedescendant": p, id: g.inputId, type: "text", value: u ? e.value : d, onChange: (c) => {
340
+ u || i.setState("search", c.target.value), r == null || r(c.target.value);
341
+ } });
342
+ }), Xe = l.forwardRef((e, n) => {
343
+ let { children: r, label: v = "Suggestions", ...u } = e, i = l.useRef(null), d = l.useRef(null), m = j();
344
+ return l.useEffect(() => {
345
+ if (d.current && i.current) {
346
+ let g = d.current, p = i.current, c, o = new ResizeObserver(() => {
347
+ c = requestAnimationFrame(() => {
348
+ let S = g.offsetHeight;
349
+ p.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
350
+ });
351
+ });
352
+ return o.observe(g), () => {
353
+ cancelAnimationFrame(c), o.unobserve(g);
354
+ };
355
+ }
356
+ }, []), l.createElement(C.div, { ref: U([i, n]), ...u, "cmdk-list": "", role: "listbox", "aria-label": v, id: m.listId }, B(e, (g) => l.createElement("div", { ref: U([d, m.listInnerRef]), "cmdk-list-sizer": "" }, g)));
357
+ }), Qe = l.forwardRef((e, n) => {
358
+ let { open: r, onOpenChange: v, overlayClassName: u, contentClassName: i, container: d, ...m } = e;
359
+ return l.createElement(Ce, { open: r, onOpenChange: v }, l.createElement(Ae, { container: d }, l.createElement(Ie, { "cmdk-overlay": "", className: u }), l.createElement(Le, { "aria-label": e.label, "cmdk-dialog": "", className: i }, l.createElement(ke, { ref: n, ...m }))));
360
+ }), Ze = l.forwardRef((e, n) => $((r) => r.filtered.count === 0) ? l.createElement(C.div, { ref: n, ...e, "cmdk-empty": "", role: "presentation" }) : null), et = l.forwardRef((e, n) => {
361
+ let { progress: r, children: v, label: u = "Loading...", ...i } = e;
362
+ return l.createElement(C.div, { ref: n, ...i, "cmdk-loading": "", role: "progressbar", "aria-valuenow": r, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": u }, B(e, (d) => l.createElement("div", { "aria-hidden": !0 }, d)));
363
+ }), ct = Object.assign(ke, { List: Xe, Item: We, Input: Je, Group: ze, Separator: Ye, Dialog: Qe, Empty: Ze, Loading: et });
364
+ function tt(e, n) {
365
+ let r = e.nextElementSibling;
366
+ for (; r; ) {
367
+ if (r.matches(n)) return r;
368
+ r = r.nextElementSibling;
369
+ }
370
+ }
371
+ function rt(e, n) {
372
+ let r = e.previousElementSibling;
373
+ for (; r; ) {
374
+ if (r.matches(n)) return r;
375
+ r = r.previousElementSibling;
376
+ }
377
+ }
378
+ function Oe(e) {
379
+ let n = l.useRef(e);
380
+ return D(() => {
381
+ n.current = e;
382
+ }), n;
383
+ }
384
+ var D = typeof window > "u" ? l.useEffect : l.useLayoutEffect;
385
+ function V(e) {
386
+ let n = l.useRef();
387
+ return n.current === void 0 && (n.current = e()), n;
388
+ }
389
+ function U(e) {
390
+ return (n) => {
391
+ e.forEach((r) => {
392
+ typeof r == "function" ? r(n) : r != null && (r.current = n);
393
+ });
394
+ };
395
+ }
396
+ function $(e) {
397
+ let n = ue(), r = () => e(n.snapshot());
398
+ return Be.useSyncExternalStore(n.subscribe, r, r);
399
+ }
400
+ function Re(e, n, r, v = []) {
401
+ let u = l.useRef(), i = j();
402
+ return D(() => {
403
+ var d;
404
+ let m = (() => {
405
+ var p;
406
+ for (let c of r) {
407
+ if (typeof c == "string") return c.trim();
408
+ if (typeof c == "object" && "current" in c) return c.current ? (p = c.current.textContent) == null ? void 0 : p.trim() : u.current;
409
+ }
410
+ })(), g = v.map((p) => p.trim());
411
+ i.value(e, m, g), (d = n.current) == null || d.setAttribute(L, m), u.current = m;
412
+ }), u;
413
+ }
414
+ var nt = () => {
415
+ let [e, n] = l.useState(), r = V(() => /* @__PURE__ */ new Map());
416
+ return D(() => {
417
+ r.current.forEach((v) => v()), r.current = /* @__PURE__ */ new Map();
418
+ }, [e]), (v, u) => {
419
+ r.current.set(v, u), n({});
420
+ };
421
+ };
422
+ function lt(e) {
423
+ let n = e.type;
424
+ return typeof n == "function" ? n(e.props) : "render" in n ? n.render(e.props) : e;
425
+ }
426
+ function B({ asChild: e, children: n }, r) {
427
+ return e && l.isValidElement(n) ? l.cloneElement(lt(n), { ref: n.ref }, r(n.props.children)) : r(n);
428
+ }
429
+ var ut = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
430
+ export {
431
+ ct as V
432
+ };