@inkeep/cxkit-primitives 0.5.12 → 0.5.14

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 (41) hide show
  1. package/dist/_virtual/index.cjs +1 -0
  2. package/dist/_virtual/index.js +4 -0
  3. package/dist/_virtual/use-sync-external-store-shim.development.cjs +1 -0
  4. package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
  5. package/dist/_virtual/use-sync-external-store-shim.production.cjs +1 -0
  6. package/dist/_virtual/use-sync-external-store-shim.production.js +5 -0
  7. package/dist/atoms/cmdk/command-score.cjs +1 -0
  8. package/dist/atoms/cmdk/command-score.d.cts +1 -0
  9. package/dist/atoms/cmdk/command-score.d.ts +1 -0
  10. package/dist/atoms/cmdk/command-score.js +46 -0
  11. package/dist/atoms/cmdk/index.cjs +1 -0
  12. package/dist/atoms/cmdk/index.d.cts +426 -0
  13. package/dist/atoms/cmdk/index.d.ts +426 -0
  14. package/dist/atoms/cmdk/index.js +510 -0
  15. package/dist/atoms/dialog.cjs +1 -0
  16. package/dist/atoms/dialog.d.cts +29 -2
  17. package/dist/atoms/dialog.d.ts +29 -2
  18. package/dist/atoms/dialog.js +216 -0
  19. package/dist/components/embedded-chat.cjs +3 -3
  20. package/dist/components/embedded-chat.d.cts +1 -1
  21. package/dist/components/embedded-chat.d.ts +1 -1
  22. package/dist/components/embedded-chat.js +1015 -1015
  23. package/dist/components/embedded-search/use-inkeep-search.cjs +1 -1
  24. package/dist/components/embedded-search/use-inkeep-search.js +1 -3
  25. package/dist/components/embedded-search.cjs +1 -1
  26. package/dist/components/embedded-search.d.cts +42 -55
  27. package/dist/components/embedded-search.d.ts +42 -55
  28. package/dist/components/embedded-search.js +289 -242
  29. package/dist/components/modal.cjs +1 -1
  30. package/dist/components/modal.d.cts +1 -1
  31. package/dist/components/modal.d.ts +1 -1
  32. package/dist/components/modal.js +26 -26
  33. package/dist/node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +9 -0
  34. package/dist/node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +68 -0
  35. package/dist/node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +9 -0
  36. package/dist/node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +56 -0
  37. package/dist/node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs +1 -0
  38. package/dist/node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js +8 -0
  39. package/dist/providers/base-events-provider.cjs +1 -1
  40. package/dist/providers/base-events-provider.js +1 -1
  41. package/package.json +11 -6
@@ -0,0 +1,510 @@
1
+ import { jsxs as Y, jsx as h } from "react/jsx-runtime";
2
+ import * as G from "@radix-ui/react-dialog";
3
+ import * as c from "react";
4
+ import { commandScore as be } from "./command-score.js";
5
+ import { Primitive as I } from "@radix-ui/react-primitive";
6
+ import { useId as T } from "@radix-ui/react-id";
7
+ import { s as Se } from "../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
8
+ import { ASK_AI_TRIGGER_VALUE as Ee } from "../../components/embedded-search.js";
9
+ import { useShadow as Ce } from "../shadow/context.js";
10
+ const D = '[cmdk-group=""]', Q = '[cmdk-group-items=""]', we = '[cmdk-group-heading=""]', le = '[cmdk-item=""]', ie = `${le}:not([aria-disabled="true"])`, X = "cmdk-item-select", _ = "data-value", Re = (r, n, t) => be(r, n, t ?? []), ue = c.createContext(void 0), O = () => c.useContext(ue), ae = c.createContext(void 0), Z = () => c.useContext(ae), de = c.createContext(void 0), fe = c.forwardRef((r, n) => {
11
+ const t = L(() => ({
12
+ /** Value of the search query. */
13
+ search: "",
14
+ /** Currently selected item value. */
15
+ value: r.value ?? r.defaultValue ?? "",
16
+ /** Currently selected item id. */
17
+ selectedItemId: void 0,
18
+ filtered: {
19
+ /** The count of all visible items. */
20
+ count: 0,
21
+ /** Map from visible item id to its search score. */
22
+ items: /* @__PURE__ */ new Map(),
23
+ /** Set of groups with at least one visible item. */
24
+ groups: /* @__PURE__ */ new Set()
25
+ }
26
+ })), a = L(() => /* @__PURE__ */ new Set()), s = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), m = me(r), {
27
+ label: u,
28
+ children: y,
29
+ value: p,
30
+ onValueChange: C,
31
+ filter: w,
32
+ shouldFilter: E,
33
+ loop: A,
34
+ disablePointerSelection: he = !1,
35
+ vimBindings: B = !0,
36
+ ...N
37
+ } = r, ee = T(), U = T(), b = T(), P = c.useRef(null), R = De();
38
+ k(() => {
39
+ if (p !== void 0) {
40
+ const e = p.trim();
41
+ t.current.value = e, S.emit();
42
+ }
43
+ }, [p]), k(() => {
44
+ R(6, re);
45
+ }, []);
46
+ const ge = Ce(), S = c.useMemo(() => ({
47
+ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
48
+ snapshot: () => t.current,
49
+ setState: (e, i, o) => {
50
+ if (!Object.is(t.current[e], i)) {
51
+ if (t.current[e] = i, e === "search")
52
+ z(), j(), R(1, q);
53
+ else if (e === "value" && (ge?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input") || R(1, () => {
54
+ x()?.focus();
55
+ }), R(7, () => {
56
+ t.current.selectedItemId = x()?.id, S.emit();
57
+ }), o || R(5, re), m.current?.value !== void 0)) {
58
+ const g = i ?? "";
59
+ m.current.onValueChange?.(g);
60
+ return;
61
+ }
62
+ S.emit();
63
+ }
64
+ },
65
+ emit: () => {
66
+ f.current.forEach((e) => e());
67
+ }
68
+ }), []), $ = c.useMemo(
69
+ () => ({
70
+ // Keep id → {value, keywords} mapping up-to-date
71
+ value: (e, i, o) => {
72
+ i !== d.current.get(e)?.value && (d.current.set(e, { value: i, keywords: o }), t.current.filtered.items.set(e, te(i, o)), R(2, () => {
73
+ j(), S.emit();
74
+ }));
75
+ },
76
+ // Track item lifecycle (mount, unmount)
77
+ item: (e, i) => (a.current.add(e), i && (s.current.has(i) ? s.current?.get(i)?.add(e) : s.current.set(i, /* @__PURE__ */ new Set([e]))), R(3, () => {
78
+ z(), j(), t.current.value || q(), S.emit();
79
+ }), () => {
80
+ d.current.delete(e), a.current.delete(e), t.current.filtered.items.delete(e);
81
+ const o = x();
82
+ R(4, () => {
83
+ z(), o?.getAttribute("id") === e && q(), S.emit();
84
+ });
85
+ }),
86
+ // Track group lifecycle (mount, unmount)
87
+ group: (e) => (s.current.has(e) || s.current.set(e, /* @__PURE__ */ new Set()), () => {
88
+ d.current.delete(e), s.current.delete(e);
89
+ }),
90
+ filter: () => !!m.current.shouldFilter,
91
+ label: u || r["aria-label"] || "",
92
+ getDisablePointerSelection: () => !!m.current.disablePointerSelection,
93
+ listId: ee,
94
+ inputId: b,
95
+ labelId: U,
96
+ listInnerRef: P
97
+ }),
98
+ []
99
+ );
100
+ function te(e, i) {
101
+ const o = m.current?.filter ?? Re;
102
+ return e ? o?.(e, t.current.search, i) : 0;
103
+ }
104
+ function j() {
105
+ if (!t.current.search || // Explicitly false, because true | undefined is the default
106
+ m.current.shouldFilter === !1)
107
+ return;
108
+ const e = t.current.filtered.items, i = [];
109
+ t.current.filtered.groups.forEach((l) => {
110
+ const v = s.current.get(l);
111
+ let g = 0;
112
+ v.forEach((J) => {
113
+ const pe = e.get(J);
114
+ g = Math.max(pe, g);
115
+ }), i.push([l, g]);
116
+ });
117
+ const o = P.current;
118
+ V().sort((l, v) => {
119
+ const g = l.getAttribute("id"), J = v.getAttribute("id");
120
+ return (e.get(J) ?? 0) - (e.get(g) ?? 0);
121
+ }).forEach((l) => {
122
+ const v = l.closest(Q);
123
+ if (v) {
124
+ const g = l.parentElement === v ? l : l.closest(`${Q} > *`);
125
+ g && v.appendChild(g);
126
+ } else {
127
+ const g = l.parentElement === o ? l : l.closest(`${Q} > *`);
128
+ g && o?.appendChild(g);
129
+ }
130
+ }), i.sort((l, v) => v[1] - l[1]).forEach((l) => {
131
+ const v = P.current?.querySelector(
132
+ `${D}[${_}="${encodeURIComponent(l[0])}"]`
133
+ );
134
+ v?.parentElement?.appendChild(v);
135
+ });
136
+ }
137
+ function q() {
138
+ const i = V().find(
139
+ (o) => o.getAttribute("aria-disabled") !== "true" && o.getAttribute("data-value") !== Ee
140
+ )?.getAttribute(_);
141
+ S.setState("value", i || void 0);
142
+ }
143
+ function z() {
144
+ if (!t.current.search || // Explicitly false, because true | undefined is the default
145
+ m.current.shouldFilter === !1) {
146
+ t.current.filtered.count = a.current.size;
147
+ return;
148
+ }
149
+ t.current.filtered.groups = /* @__PURE__ */ new Set();
150
+ let e = 0;
151
+ for (const i of a.current) {
152
+ const o = d.current.get(i)?.value ?? "", l = d.current.get(i)?.keywords ?? [], v = te(o, l);
153
+ t.current.filtered.items.set(i, v), v > 0 && e++;
154
+ }
155
+ for (const [i, o] of s.current)
156
+ for (const l of o) {
157
+ const v = t.current.filtered.items.get(l);
158
+ if (v && v > 0) {
159
+ t.current.filtered.groups.add(i);
160
+ break;
161
+ }
162
+ }
163
+ t.current.filtered.count = e;
164
+ }
165
+ function re() {
166
+ const e = x();
167
+ e && (e.parentElement?.firstChild === e && e.closest(D)?.querySelector(we)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
168
+ }
169
+ function x() {
170
+ return P.current?.querySelector(`${le}[aria-selected="true"]`);
171
+ }
172
+ function V() {
173
+ return Array.from(P.current?.querySelectorAll(ie) || []);
174
+ }
175
+ function H(e) {
176
+ const o = V()[e];
177
+ o && S.setState("value", o.getAttribute(_));
178
+ }
179
+ function W(e) {
180
+ const i = x(), o = V(), l = o.findIndex((g) => g === i);
181
+ let v = o[l + e];
182
+ m.current?.loop && (v = l + e < 0 ? o[o.length - 1] : l + e === o.length ? o[0] : o[l + e]), v && S.setState("value", v.getAttribute(_));
183
+ }
184
+ function ne(e) {
185
+ let o = x()?.closest(D), l;
186
+ for (; o && !l; )
187
+ o = e > 0 ? Pe(o, D) : Ve(o, D), l = o?.querySelector(ie);
188
+ l ? S.setState("value", l.getAttribute(_)) : W(e);
189
+ }
190
+ const oe = () => H(V().length - 1), ce = (e) => {
191
+ e.preventDefault(), e.metaKey ? oe() : e.altKey ? ne(1) : W(1);
192
+ }, se = (e) => {
193
+ e.preventDefault(), e.metaKey ? H(0) : e.altKey ? ne(-1) : W(-1);
194
+ };
195
+ return /* @__PURE__ */ Y(
196
+ I.div,
197
+ {
198
+ ref: n,
199
+ tabIndex: -1,
200
+ ...N,
201
+ "cmdk-root": "",
202
+ onKeyDown: (e) => {
203
+ if (N.onKeyDown?.(e), !e.defaultPrevented)
204
+ switch (e.key) {
205
+ case "n":
206
+ case "j": {
207
+ B && e.ctrlKey && ce(e);
208
+ break;
209
+ }
210
+ case "ArrowDown": {
211
+ ce(e);
212
+ break;
213
+ }
214
+ case "p":
215
+ case "k": {
216
+ B && e.ctrlKey && se(e);
217
+ break;
218
+ }
219
+ case "ArrowUp": {
220
+ se(e);
221
+ break;
222
+ }
223
+ case "Home": {
224
+ e.preventDefault(), H(0);
225
+ break;
226
+ }
227
+ case "End": {
228
+ e.preventDefault(), oe();
229
+ break;
230
+ }
231
+ case "Enter":
232
+ if (!e.nativeEvent.isComposing && e.keyCode !== 229) {
233
+ e.preventDefault();
234
+ const i = x();
235
+ if (i) {
236
+ const o = new Event(X);
237
+ i.dispatchEvent(o);
238
+ }
239
+ }
240
+ }
241
+ },
242
+ children: [
243
+ /* @__PURE__ */ h(
244
+ "label",
245
+ {
246
+ "cmdk-label": "",
247
+ htmlFor: $.inputId,
248
+ id: $.labelId,
249
+ style: Fe,
250
+ children: u
251
+ }
252
+ ),
253
+ K(r, (e) => /* @__PURE__ */ h(ae.Provider, { value: S, children: /* @__PURE__ */ h(ue.Provider, { value: $, children: e }) }))
254
+ ]
255
+ }
256
+ );
257
+ }), Ie = c.forwardRef((r, n) => {
258
+ const { id: t } = r, a = c.useRef(null), s = c.useContext(de), d = O(), f = me(r), m = f.current?.forceMount ?? s?.forceMount;
259
+ k(() => {
260
+ if (!m)
261
+ return d.item(t, s?.id);
262
+ }, [m]);
263
+ const u = ve(t, a, [r.value, r.children, a], r.keywords), y = Z(), p = M((b) => b.value && b.value === u.current), C = M(
264
+ (b) => m || d.filter() === !1 ? !0 : b.search ? b.filtered.items.get(t) > 0 : !0
265
+ );
266
+ c.useEffect(() => {
267
+ const b = a.current;
268
+ if (!(!b || r.disabled))
269
+ return b.addEventListener(X, w), () => b.removeEventListener(X, w);
270
+ }, [C, r.onSelect, r.disabled]);
271
+ function w() {
272
+ E(), f.current.onSelect?.(u.current);
273
+ }
274
+ function E() {
275
+ y.setState("value", u.current, !0);
276
+ }
277
+ if (!C) return null;
278
+ const { disabled: A, value: he, onSelect: B, forceMount: N, keywords: ee, ...U } = r;
279
+ return /* @__PURE__ */ h(
280
+ I.div,
281
+ {
282
+ ref: F([a, n]),
283
+ ...U,
284
+ id: t,
285
+ "cmdk-item": "",
286
+ role: "option",
287
+ "aria-disabled": !!A,
288
+ "aria-selected": !!p,
289
+ "data-disabled": !!A,
290
+ "data-selected": !!p,
291
+ onPointerMove: A || d.getDisablePointerSelection() ? void 0 : E,
292
+ onClick: A ? void 0 : w,
293
+ onFocus: A ? void 0 : E,
294
+ children: r.children
295
+ }
296
+ );
297
+ }), ye = c.forwardRef((r, n) => {
298
+ const { heading: t, children: a, forceMount: s, ...d } = r, f = T(), m = c.useRef(null), u = c.useRef(null), y = T(), p = O(), C = M(
299
+ (E) => s || p.filter() === !1 ? !0 : E.search ? E.filtered.groups.has(f) : !0
300
+ );
301
+ k(() => p.group(f), []), ve(f, m, [r.value, r.heading, u]);
302
+ const w = c.useMemo(() => ({ id: f, forceMount: s }), [s]);
303
+ return /* @__PURE__ */ Y(
304
+ I.div,
305
+ {
306
+ ref: F([m, n]),
307
+ ...d,
308
+ "cmdk-group": "",
309
+ role: "presentation",
310
+ hidden: C ? void 0 : !0,
311
+ children: [
312
+ t && /* @__PURE__ */ h("div", { ref: u, "cmdk-group-heading": "", "aria-hidden": !0, id: y, children: t }),
313
+ K(r, (E) => (
314
+ // biome-ignore lint/a11y/useSemanticElements: <explanation>
315
+ /* @__PURE__ */ h("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": t ? y : void 0, children: /* @__PURE__ */ h(de.Provider, { value: w, children: E }) })
316
+ ))
317
+ ]
318
+ }
319
+ );
320
+ }), xe = c.forwardRef((r, n) => {
321
+ const { alwaysRender: t, ...a } = r, s = c.useRef(null), d = M((f) => !f.search);
322
+ return !t && !d ? null : /* @__PURE__ */ h(
323
+ I.div,
324
+ {
325
+ ref: F([s, n]),
326
+ ...a,
327
+ "cmdk-separator": "",
328
+ role: "separator"
329
+ }
330
+ );
331
+ }), ke = c.forwardRef((r, n) => {
332
+ const { onValueChange: t, ...a } = r, s = r.value != null, d = Z(), f = M((u) => u.search), m = O();
333
+ return c.useEffect(() => {
334
+ r.value != null && d.setState("search", r.value);
335
+ }, [r.value]), /* @__PURE__ */ h(
336
+ I.input,
337
+ {
338
+ ref: n,
339
+ ...a,
340
+ "cmdk-input": "",
341
+ autoComplete: "off",
342
+ autoCorrect: "off",
343
+ spellCheck: !1,
344
+ "aria-autocomplete": "list",
345
+ role: "combobox",
346
+ "aria-expanded": !0,
347
+ "aria-controls": m.listId,
348
+ "aria-labelledby": m.labelId,
349
+ id: m.inputId,
350
+ type: "text",
351
+ value: s ? r.value : f,
352
+ onChange: (u) => {
353
+ s || d.setState("search", u.target.value), t?.(u.target.value);
354
+ }
355
+ }
356
+ );
357
+ }), Ae = c.forwardRef((r, n) => {
358
+ const { children: t, label: a = "Suggestions", ...s } = r, d = c.useRef(null), f = c.useRef(null), m = O();
359
+ return c.useEffect(() => {
360
+ if (f.current && d.current) {
361
+ const u = f.current, y = d.current;
362
+ let p;
363
+ const C = new ResizeObserver(() => {
364
+ p = requestAnimationFrame(() => {
365
+ const w = u.offsetHeight;
366
+ y.style.setProperty("--cmdk-list-height", w.toFixed(1) + "px");
367
+ });
368
+ });
369
+ return C.observe(u), () => {
370
+ cancelAnimationFrame(p), C.unobserve(u);
371
+ };
372
+ }
373
+ }, []), /* @__PURE__ */ h(
374
+ I.div,
375
+ {
376
+ ref: F([d, n]),
377
+ ...s,
378
+ "cmdk-list": "",
379
+ tabIndex: -1,
380
+ "aria-label": a,
381
+ id: m.listId,
382
+ children: K(r, (u) => /* @__PURE__ */ h("div", { ref: F([f, m.listInnerRef]), "cmdk-list-sizer": "", children: u }))
383
+ }
384
+ );
385
+ }), _e = c.forwardRef((r, n) => {
386
+ const { open: t, onOpenChange: a, overlayClassName: s, contentClassName: d, container: f, ...m } = r;
387
+ return /* @__PURE__ */ h(G.Root, { open: t, onOpenChange: a, children: /* @__PURE__ */ Y(G.Portal, { container: f, children: [
388
+ /* @__PURE__ */ h(G.Overlay, { "cmdk-overlay": "", className: s }),
389
+ /* @__PURE__ */ h(G.Content, { "aria-label": r.label, "cmdk-dialog": "", className: d, children: /* @__PURE__ */ h(fe, { ref: n, ...m }) })
390
+ ] }) });
391
+ }), Le = c.forwardRef((r, n) => M((a) => a.filtered.count === 0) ? /* @__PURE__ */ h(I.div, { ref: n, ...r, "cmdk-empty": "", role: "presentation" }) : null), Me = c.forwardRef((r, n) => {
392
+ const { progress: t, children: a, label: s = "Loading...", ...d } = r;
393
+ return /* @__PURE__ */ h(
394
+ I.div,
395
+ {
396
+ ref: n,
397
+ ...d,
398
+ "cmdk-loading": "",
399
+ role: "progressbar",
400
+ "aria-valuenow": t,
401
+ "aria-valuemin": 0,
402
+ "aria-valuemax": 100,
403
+ "aria-label": s,
404
+ children: K(r, (f) => /* @__PURE__ */ h("div", { "aria-hidden": !0, children: f }))
405
+ }
406
+ );
407
+ }), je = Object.assign(fe, {
408
+ List: Ae,
409
+ Item: Ie,
410
+ Input: ke,
411
+ Group: ye,
412
+ Separator: xe,
413
+ Dialog: _e,
414
+ Empty: Le,
415
+ Loading: Me
416
+ });
417
+ function Pe(r, n) {
418
+ let t = r.nextElementSibling;
419
+ for (; t; ) {
420
+ if (t.matches(n)) return t;
421
+ t = t.nextElementSibling;
422
+ }
423
+ }
424
+ function Ve(r, n) {
425
+ let t = r.previousElementSibling;
426
+ for (; t; ) {
427
+ if (t.matches(n)) return t;
428
+ t = t.previousElementSibling;
429
+ }
430
+ }
431
+ function me(r) {
432
+ const n = c.useRef(r);
433
+ return k(() => {
434
+ n.current = r;
435
+ }), n;
436
+ }
437
+ const k = typeof window > "u" ? c.useEffect : c.useLayoutEffect;
438
+ function L(r) {
439
+ const n = c.useRef(void 0);
440
+ return n.current === void 0 && (n.current = r()), n;
441
+ }
442
+ function F(r) {
443
+ return (n) => {
444
+ r.forEach((t) => {
445
+ typeof t == "function" ? t(n) : t != null && (t.current = n);
446
+ });
447
+ };
448
+ }
449
+ function M(r) {
450
+ const n = Z(), t = () => r(n.snapshot());
451
+ return Se.useSyncExternalStore(n.subscribe, t, t);
452
+ }
453
+ function ve(r, n, t, a = []) {
454
+ const s = c.useRef(void 0), d = O();
455
+ return k(() => {
456
+ const f = (() => {
457
+ for (const u of t) {
458
+ if (typeof u == "string")
459
+ return u.trim();
460
+ if (typeof u == "object" && "current" in u)
461
+ return u.current ? u.current.textContent?.trim() : s.current;
462
+ }
463
+ })(), m = a.map((u) => u.trim());
464
+ d.value(r, f, m), n.current?.setAttribute(_, f), s.current = f;
465
+ }), s;
466
+ }
467
+ const De = () => {
468
+ const [r, n] = c.useState(), t = L(() => /* @__PURE__ */ new Map());
469
+ return k(() => {
470
+ t.current.forEach((a) => a()), t.current = /* @__PURE__ */ new Map();
471
+ }, [r]), (a, s) => {
472
+ t.current.set(a, s), n({});
473
+ };
474
+ };
475
+ function Te(r) {
476
+ const n = r.type;
477
+ return typeof n == "function" ? n(r.props) : "render" in n ? n.render(r.props) : r;
478
+ }
479
+ function K({ asChild: r, children: n }, t) {
480
+ return r && c.isValidElement(n) ? c.cloneElement(
481
+ Te(n),
482
+ { ref: n.ref },
483
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
484
+ t(n.props.children)
485
+ ) : t(n);
486
+ }
487
+ const Fe = {
488
+ position: "absolute",
489
+ width: "1px",
490
+ height: "1px",
491
+ padding: "0",
492
+ margin: "-1px",
493
+ overflow: "hidden",
494
+ clip: "rect(0, 0, 0, 0)",
495
+ whiteSpace: "nowrap",
496
+ borderWidth: "0"
497
+ };
498
+ export {
499
+ je as Command,
500
+ _e as CommandDialog,
501
+ Le as CommandEmpty,
502
+ ke as CommandInput,
503
+ Ie as CommandItem,
504
+ Ae as CommandList,
505
+ Me as CommandLoading,
506
+ fe as CommandRoot,
507
+ xe as CommandSeparator,
508
+ Re as defaultFilter,
509
+ M as useCommandState
510
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),k=require("react"),f=require("@radix-ui/primitive"),O=require("@radix-ui/react-compose-refs"),L=require("@radix-ui/react-context"),m=require("@radix-ui/react-id"),H=require("@radix-ui/react-use-controllable-state"),G=require("@radix-ui/react-dismissable-layer"),U=require("@radix-ui/react-focus-scope");require("@radix-ui/react-portal");const I=require("@radix-ui/react-presence"),g=require("@radix-ui/react-primitive"),z=require("@radix-ui/react-focus-guards"),K=require("react-remove-scroll"),V=require("aria-hidden"),Y=require("@radix-ui/react-slot");function Z(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(s,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return s.default=e,Object.freeze(s)}const i=Z(k),P="Dialog",[j,B]=L.createContextScope(P),[J,l]=j(P),_=e=>{const{__scopeDialog:s,children:o,open:r,defaultOpen:n,onOpenChange:t,modal:u=!0}=e,a=i.useRef(null),p=i.useRef(null),[C=!1,R]=H.useControllableState({prop:r,defaultProp:n,onChange:t});return c.jsx(J,{scope:s,triggerRef:a,contentRef:p,contentId:m.useId(),titleId:m.useId(),descriptionId:m.useId(),open:C,onOpenChange:R,onOpenToggle:i.useCallback(()=>R(w=>!w),[R]),modal:u,children:o})};_.displayName=P;const h="DialogTrigger",T=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(h,o),t=O.useComposedRefs(s,n.triggerRef);return c.jsx(g.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":b(n.open),...r,ref:t,onClick:f.composeEventHandlers(e.onClick,n.onOpenToggle)})});T.displayName=h;const Q="DialogPortal",[se,N]=j(Q,{forceMount:void 0}),D="DialogOverlay",x=i.forwardRef((e,s)=>{const o=N(D,e.__scopeDialog),{forceMount:r=o.forceMount,...n}=e,t=l(D,e.__scopeDialog);return t.modal?c.jsx(I.Presence,{present:r||t.open,children:c.jsx(W,{...n,ref:s})}):null});x.displayName=D;const W=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(D,o);return c.jsx(K.RemoveScroll,{as:Y.Slot,allowPinchZoom:!0,shards:[n.contentRef],children:c.jsx(g.Primitive.div,{"data-state":b(n.open),...r,ref:s,style:{pointerEvents:"auto",...r.style}})})}),d="DialogContent",v=i.forwardRef((e,s)=>{const o=N(d,e.__scopeDialog),{forceMount:r=o.forceMount,...n}=e,t=l(d,e.__scopeDialog);return c.jsx(I.Presence,{present:r||t.open,children:t.modal?c.jsx(X,{...n,ref:s}):c.jsx($,{...n,ref:s})})});v.displayName=d;const X=i.forwardRef((e,s)=>{const o=l(d,e.__scopeDialog),r=i.useRef(null),n=O.useComposedRefs(s,o.contentRef,r);return i.useEffect(()=>{const t=r.current;if(t)return V.hideOthers(t)},[]),c.jsx(A,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:f.composeEventHandlers(e.onCloseAutoFocus,t=>{t.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:f.composeEventHandlers(e.onPointerDownOutside,t=>{const u=t.detail.originalEvent,a=u.button===0&&u.ctrlKey===!0;(u.button===2||a)&&t.preventDefault()}),onFocusOutside:f.composeEventHandlers(e.onFocusOutside,t=>t.preventDefault())})}),$=i.forwardRef((e,s)=>{const o=l(d,e.__scopeDialog),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(A,{...e,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||o.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const u=t.target;o.triggerRef.current?.contains(u)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&n.current&&t.preventDefault()}})}),A=i.forwardRef((e,s)=>{const{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:t,...u}=e,a=l(d,o),p=i.useRef(null),C=O.useComposedRefs(s,p);return z.useFocusGuards(),c.jsx(c.Fragment,{children:c.jsx(U.FocusScope,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:t,children:c.jsx(G.DismissableLayer,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":b(a.open),...u,ref:C,onDismiss:()=>a.onOpenChange(!1)})})})}),F="DialogTitle",y=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(F,o);return c.jsx(g.Primitive.h2,{id:n.titleId,...r,ref:s})});y.displayName=F;const M="DialogDescription",S=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(M,o);return c.jsx(g.Primitive.p,{id:n.descriptionId,...r,ref:s})});S.displayName=M;const q="DialogClose",E=i.forwardRef((e,s)=>{const{__scopeDialog:o,...r}=e,n=l(q,o);return c.jsx(g.Primitive.button,{type:"button",...r,ref:s,onClick:f.composeEventHandlers(e.onClick,()=>n.onOpenChange(!1))})});E.displayName=q;function b(e){return e?"open":"closed"}const ee=_,te=x,oe=v,ne=y,re=E;exports.Close=re;exports.Content=oe;exports.Dialog=_;exports.DialogClose=E;exports.DialogContent=v;exports.DialogDescription=S;exports.DialogOverlay=x;exports.DialogTitle=y;exports.DialogTrigger=T;exports.Overlay=te;exports.Root=ee;exports.Title=ne;exports.createDialogScope=B;
@@ -1,5 +1,6 @@
1
1
  import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
2
2
  import { FocusScope } from '@radix-ui/react-focus-scope';
3
+ import { Portal as PortalPrimitive } from '@radix-ui/react-portal';
3
4
  import { Primitive } from '@radix-ui/react-primitive';
4
5
  import { CreateScope } from '@radix-ui/react-context';
5
6
  import * as React from 'react';
@@ -16,12 +17,37 @@ type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.butt
16
17
  interface DialogTriggerProps extends PrimitiveButtonProps {
17
18
  }
18
19
  declare const DialogTrigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
20
+ type PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;
21
+ interface DialogPortalProps {
22
+ children?: React.ReactNode;
23
+ /**
24
+ * Specify a container element to portal the content into.
25
+ */
26
+ container?: PortalProps['container'];
27
+ /**
28
+ * Used to force mounting when more control is needed. Useful when
29
+ * controlling animation with React animation libraries.
30
+ */
31
+ forceMount?: true;
32
+ }
33
+ declare const DialogPortal: React.FC<DialogPortalProps>;
19
34
  interface DialogOverlayProps extends DialogOverlayImplProps {
35
+ /**
36
+ * Used to force mounting when more control is needed. Useful when
37
+ * controlling animation with React animation libraries.
38
+ */
39
+ forceMount?: true;
20
40
  }
41
+ declare const DialogOverlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
21
42
  type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
22
43
  interface DialogOverlayImplProps extends PrimitiveDivProps {
23
44
  }
24
45
  interface DialogContentProps extends DialogContentTypeProps {
46
+ /**
47
+ * Used to force mounting when more control is needed. Useful when
48
+ * controlling animation with React animation libraries.
49
+ */
50
+ forceMount?: true;
25
51
  }
26
52
  declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
27
53
  interface DialogContentTypeProps extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
@@ -59,10 +85,11 @@ interface DialogCloseProps extends PrimitiveButtonProps {
59
85
  declare const DialogClose: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
60
86
  declare const Root: React.FC<DialogProps>;
61
87
  declare const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
88
+ declare const Portal: React.FC<DialogPortalProps>;
62
89
  declare const Overlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
63
90
  declare const Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
64
91
  declare const Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
65
92
  declare const Description: React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
66
93
  declare const Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
67
- export { createDialogScope, Dialog, DialogTrigger, DialogContent, DialogTitle, DialogDescription, DialogClose, Root, Trigger, Overlay, Content, Title, Description, Close, };
68
- export type { DialogProps, DialogTriggerProps, DialogOverlayProps, DialogContentProps, DialogTitleProps, DialogDescriptionProps, DialogCloseProps, };
94
+ export { createDialogScope, Dialog, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, Root, Trigger, Portal, Overlay, Content, Title, Description, Close, };
95
+ export type { DialogProps, DialogTriggerProps, DialogPortalProps, DialogOverlayProps, DialogContentProps, DialogTitleProps, DialogDescriptionProps, DialogCloseProps, };
@@ -1,5 +1,6 @@
1
1
  import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
2
2
  import { FocusScope } from '@radix-ui/react-focus-scope';
3
+ import { Portal as PortalPrimitive } from '@radix-ui/react-portal';
3
4
  import { Primitive } from '@radix-ui/react-primitive';
4
5
  import { CreateScope } from '@radix-ui/react-context';
5
6
  import * as React from 'react';
@@ -16,12 +17,37 @@ type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.butt
16
17
  interface DialogTriggerProps extends PrimitiveButtonProps {
17
18
  }
18
19
  declare const DialogTrigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
20
+ type PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;
21
+ interface DialogPortalProps {
22
+ children?: React.ReactNode;
23
+ /**
24
+ * Specify a container element to portal the content into.
25
+ */
26
+ container?: PortalProps['container'];
27
+ /**
28
+ * Used to force mounting when more control is needed. Useful when
29
+ * controlling animation with React animation libraries.
30
+ */
31
+ forceMount?: true;
32
+ }
33
+ declare const DialogPortal: React.FC<DialogPortalProps>;
19
34
  interface DialogOverlayProps extends DialogOverlayImplProps {
35
+ /**
36
+ * Used to force mounting when more control is needed. Useful when
37
+ * controlling animation with React animation libraries.
38
+ */
39
+ forceMount?: true;
20
40
  }
41
+ declare const DialogOverlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
21
42
  type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
22
43
  interface DialogOverlayImplProps extends PrimitiveDivProps {
23
44
  }
24
45
  interface DialogContentProps extends DialogContentTypeProps {
46
+ /**
47
+ * Used to force mounting when more control is needed. Useful when
48
+ * controlling animation with React animation libraries.
49
+ */
50
+ forceMount?: true;
25
51
  }
26
52
  declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
27
53
  interface DialogContentTypeProps extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
@@ -59,10 +85,11 @@ interface DialogCloseProps extends PrimitiveButtonProps {
59
85
  declare const DialogClose: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
60
86
  declare const Root: React.FC<DialogProps>;
61
87
  declare const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
88
+ declare const Portal: React.FC<DialogPortalProps>;
62
89
  declare const Overlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
63
90
  declare const Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
64
91
  declare const Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
65
92
  declare const Description: React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
66
93
  declare const Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
67
- export { createDialogScope, Dialog, DialogTrigger, DialogContent, DialogTitle, DialogDescription, DialogClose, Root, Trigger, Overlay, Content, Title, Description, Close, };
68
- export type { DialogProps, DialogTriggerProps, DialogOverlayProps, DialogContentProps, DialogTitleProps, DialogDescriptionProps, DialogCloseProps, };
94
+ export { createDialogScope, Dialog, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, Root, Trigger, Portal, Overlay, Content, Title, Description, Close, };
95
+ export type { DialogProps, DialogTriggerProps, DialogPortalProps, DialogOverlayProps, DialogContentProps, DialogTitleProps, DialogDescriptionProps, DialogCloseProps, };