@inkeep/cxkit-primitives 0.5.44 → 0.5.46
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/atoms/cmdk/index.cjs +1 -1
- package/dist/atoms/cmdk/index.js +193 -184
- package/dist/components/embedded-chat/use-chat-action.cjs +1 -1
- package/dist/components/embedded-chat/use-chat-action.js +5 -5
- package/dist/components/embedded-chat.cjs +5 -5
- package/dist/components/embedded-chat.js +1004 -986
- package/dist/hooks/use-debounce.cjs +1 -0
- package/dist/hooks/use-debounce.js +16 -0
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/providers/base-events-provider.cjs +1 -1
- package/dist/providers/base-events-provider.js +22 -18
- package/dist/providers/chat-events-provider.cjs +1 -1
- package/dist/providers/chat-events-provider.js +46 -55
- package/dist/providers/hover-popover-provider.cjs +1 -0
- package/dist/providers/hover-popover-provider.js +13 -0
- package/package.json +4 -4
package/dist/atoms/cmdk/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as te, jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import * as K from "@radix-ui/react-dialog";
|
|
3
3
|
import * as c from "react";
|
|
4
|
-
import { useCallback as
|
|
4
|
+
import { useCallback as ue, useMemo as Ee } from "react";
|
|
5
5
|
import { commandScore as Ce } from "./command-score.js";
|
|
6
|
-
import { Primitive as
|
|
7
|
-
import { useId as
|
|
6
|
+
import { Primitive as I } from "@radix-ui/react-primitive";
|
|
7
|
+
import { useId as T } from "@radix-ui/react-id";
|
|
8
8
|
import { s as we } from "../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
|
|
9
9
|
import { ASK_AI_TRIGGER_VALUE as ye } from "../../constants/search.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import { composeEventHandlers as Re } from "../../utils/compose-event-handlers.js";
|
|
11
|
+
import { useShadow as Ie } from "../shadow/context.js";
|
|
12
|
+
const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-heading=""]', fe = '[cmdk-item=""]', de = `${fe}:not([aria-disabled="true"])`, ee = "cmdk-item-select", L = "data-value", xe = (t, n, r) => Ce(t, n, r ?? []), me = c.createContext(void 0), O = () => c.useContext(me), ve = c.createContext(void 0), re = () => c.useContext(ve), he = c.createContext(void 0), ge = c.forwardRef((t, n) => {
|
|
13
|
+
const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()), u = M(() => /* @__PURE__ */ new Map()), f = M(() => /* @__PURE__ */ new Set()), s = pe(t), {
|
|
13
14
|
label: v,
|
|
14
15
|
children: d,
|
|
15
16
|
value: S,
|
|
@@ -17,13 +18,13 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
17
18
|
filter: y,
|
|
18
19
|
shouldFilter: w,
|
|
19
20
|
loop: R,
|
|
20
|
-
disablePointerSelection:
|
|
21
|
+
disablePointerSelection: _ = !1,
|
|
21
22
|
vimBindings: N = !0,
|
|
22
|
-
defaultSearch:
|
|
23
|
+
defaultSearch: ne,
|
|
23
24
|
...U
|
|
24
|
-
} = t, h =
|
|
25
|
+
} = t, h = M(() => ({
|
|
25
26
|
/** Value of the search query. */
|
|
26
|
-
search:
|
|
27
|
+
search: ne ?? "",
|
|
27
28
|
/** Currently selected item value. */
|
|
28
29
|
value: t.value ?? t.defaultValue ?? "",
|
|
29
30
|
/** Currently selected item id. */
|
|
@@ -36,29 +37,29 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
36
37
|
/** Set of groups with at least one visible item. */
|
|
37
38
|
groups: /* @__PURE__ */ new Set()
|
|
38
39
|
}
|
|
39
|
-
})), $ =
|
|
40
|
-
|
|
40
|
+
})), $ = T(), j = T(), q = T(), k = c.useRef(null), g = Ge();
|
|
41
|
+
A(() => {
|
|
41
42
|
if (S !== void 0) {
|
|
42
43
|
const e = S.trim();
|
|
43
44
|
h.current.value = e, E.emit();
|
|
44
45
|
}
|
|
45
|
-
}, [S]),
|
|
46
|
-
|
|
46
|
+
}, [S]), A(() => {
|
|
47
|
+
g(6, ce);
|
|
47
48
|
}, []);
|
|
48
|
-
const
|
|
49
|
+
const G = Ie(), E = c.useMemo(() => ({
|
|
49
50
|
subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
|
|
50
51
|
snapshot: () => h.current,
|
|
51
52
|
setState: (e, l, o) => {
|
|
52
53
|
if (!Object.is(h.current[e], l)) {
|
|
53
54
|
if (h.current[e] = l, e === "search")
|
|
54
|
-
|
|
55
|
-
else if (e === "value" && (
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
h.current.selectedItemId =
|
|
59
|
-
}), o ||
|
|
60
|
-
const
|
|
61
|
-
s.current.onValueChange?.(
|
|
55
|
+
J(), z(), g(1, W);
|
|
56
|
+
else if (e === "value" && (G?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input") || g(1, () => {
|
|
57
|
+
x()?.focus();
|
|
58
|
+
}), g(7, () => {
|
|
59
|
+
h.current.selectedItemId = x()?.id, E.emit();
|
|
60
|
+
}), o || g(5, ce), s.current?.value !== void 0)) {
|
|
61
|
+
const b = l ?? "";
|
|
62
|
+
s.current.onValueChange?.(b);
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
65
|
E.emit();
|
|
@@ -67,22 +68,22 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
67
68
|
emit: () => {
|
|
68
69
|
f.current.forEach((e) => e());
|
|
69
70
|
}
|
|
70
|
-
}), []),
|
|
71
|
+
}), []), H = c.useMemo(
|
|
71
72
|
() => ({
|
|
72
73
|
// Keep id → {value, keywords} mapping up-to-date
|
|
73
74
|
value: (e, l, o) => {
|
|
74
|
-
l !== u.current.get(e)?.value && (u.current.set(e, { value: l, keywords: o }), h.current.filtered.items.set(e,
|
|
75
|
+
l !== u.current.get(e)?.value && (u.current.set(e, { value: l, keywords: o }), h.current.filtered.items.set(e, oe(l, o)), g(2, () => {
|
|
75
76
|
z(), E.emit();
|
|
76
77
|
}));
|
|
77
78
|
},
|
|
78
79
|
// Track item lifecycle (mount, unmount)
|
|
79
|
-
item: (e, l) => (r.current.add(e), l && (i.current.has(l) ? i.current?.get(l)?.add(e) : i.current.set(l, /* @__PURE__ */ new Set([e]))),
|
|
80
|
-
|
|
80
|
+
item: (e, l) => (r.current.add(e), l && (i.current.has(l) ? i.current?.get(l)?.add(e) : i.current.set(l, /* @__PURE__ */ new Set([e]))), g(3, () => {
|
|
81
|
+
J(), z(), h.current.value || W(), E.emit();
|
|
81
82
|
}), () => {
|
|
82
83
|
u.current.delete(e), r.current.delete(e), h.current.filtered.items.delete(e);
|
|
83
|
-
const o =
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
const o = x();
|
|
85
|
+
g(4, () => {
|
|
86
|
+
J(), o?.getAttribute("id") === e && W(), E.emit();
|
|
86
87
|
});
|
|
87
88
|
}),
|
|
88
89
|
// Track group lifecycle (mount, unmount)
|
|
@@ -93,13 +94,13 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
93
94
|
label: v || t["aria-label"] || "",
|
|
94
95
|
getDisablePointerSelection: () => !!s.current.disablePointerSelection,
|
|
95
96
|
listId: $,
|
|
96
|
-
inputId:
|
|
97
|
+
inputId: q,
|
|
97
98
|
labelId: j,
|
|
98
|
-
listInnerRef:
|
|
99
|
+
listInnerRef: k
|
|
99
100
|
}),
|
|
100
101
|
[]
|
|
101
102
|
);
|
|
102
|
-
function
|
|
103
|
+
function oe(e, l) {
|
|
103
104
|
const o = s.current?.filter ?? xe;
|
|
104
105
|
return e ? o?.(e, h.current.search, l) : 0;
|
|
105
106
|
}
|
|
@@ -110,39 +111,39 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
110
111
|
const e = h.current.filtered.items, l = [];
|
|
111
112
|
h.current.filtered.groups.forEach((a) => {
|
|
112
113
|
const m = i.current.get(a);
|
|
113
|
-
let
|
|
114
|
-
m.forEach((
|
|
115
|
-
const Se = e.get(
|
|
116
|
-
|
|
117
|
-
}), l.push([a,
|
|
114
|
+
let b = 0;
|
|
115
|
+
m.forEach((Y) => {
|
|
116
|
+
const Se = e.get(Y);
|
|
117
|
+
b = Math.max(Se, b);
|
|
118
|
+
}), l.push([a, b]);
|
|
118
119
|
});
|
|
119
|
-
const o =
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
return (e.get(
|
|
120
|
+
const o = k.current;
|
|
121
|
+
V().sort((a, m) => {
|
|
122
|
+
const b = a.getAttribute("id"), Y = m.getAttribute("id");
|
|
123
|
+
return (e.get(Y) ?? 0) - (e.get(b) ?? 0);
|
|
123
124
|
}).forEach((a) => {
|
|
124
|
-
const m = a.closest(
|
|
125
|
+
const m = a.closest(Z);
|
|
125
126
|
if (m) {
|
|
126
|
-
const
|
|
127
|
-
|
|
127
|
+
const b = a.parentElement === m ? a : a.closest(`${Z} > *`);
|
|
128
|
+
b && m.appendChild(b);
|
|
128
129
|
} else {
|
|
129
|
-
const
|
|
130
|
-
|
|
130
|
+
const b = a.parentElement === o ? a : a.closest(`${Z} > *`);
|
|
131
|
+
b && o?.appendChild(b);
|
|
131
132
|
}
|
|
132
133
|
}), l.sort((a, m) => m[1] - a[1]).forEach((a) => {
|
|
133
|
-
const m =
|
|
134
|
-
`${
|
|
134
|
+
const m = k.current?.querySelector(
|
|
135
|
+
`${D}[${L}="${encodeURIComponent(a[0])}"]`
|
|
135
136
|
);
|
|
136
137
|
m?.parentElement?.appendChild(m);
|
|
137
138
|
});
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
-
const l =
|
|
140
|
+
function W() {
|
|
141
|
+
const l = V().find(
|
|
141
142
|
(o) => o.getAttribute("aria-disabled") !== "true" && o.getAttribute("data-value") !== ye
|
|
142
|
-
)?.getAttribute(
|
|
143
|
+
)?.getAttribute(L);
|
|
143
144
|
E.setState("value", l || void 0);
|
|
144
145
|
}
|
|
145
|
-
function
|
|
146
|
+
function J() {
|
|
146
147
|
if (!h.current.search || // Explicitly false, because true | undefined is the default
|
|
147
148
|
s.current.shouldFilter === !1) {
|
|
148
149
|
h.current.filtered.count = r.current.size;
|
|
@@ -151,7 +152,7 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
151
152
|
h.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
152
153
|
let e = 0;
|
|
153
154
|
for (const l of r.current) {
|
|
154
|
-
const o = u.current.get(l)?.value ?? "", a = u.current.get(l)?.keywords ?? [], m =
|
|
155
|
+
const o = u.current.get(l)?.value ?? "", a = u.current.get(l)?.keywords ?? [], m = oe(o, a);
|
|
155
156
|
h.current.filtered.items.set(l, m), m > 0 && e++;
|
|
156
157
|
}
|
|
157
158
|
for (const [l, o] of i.current)
|
|
@@ -164,38 +165,38 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
164
165
|
}
|
|
165
166
|
h.current.filtered.count = e;
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
-
const e =
|
|
169
|
-
e && (e.parentElement?.firstChild === e && e.closest(
|
|
170
|
-
}
|
|
171
|
-
function A() {
|
|
172
|
-
return I.current?.querySelector(`${de}[aria-selected="true"]`);
|
|
168
|
+
function ce() {
|
|
169
|
+
const e = x();
|
|
170
|
+
e && (e.parentElement?.firstChild === e && e.closest(D)?.querySelector(ke)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
|
|
173
171
|
}
|
|
174
|
-
function
|
|
175
|
-
return
|
|
172
|
+
function x() {
|
|
173
|
+
return k.current?.querySelector(`${fe}[aria-selected="true"]`);
|
|
176
174
|
}
|
|
177
|
-
function
|
|
178
|
-
|
|
179
|
-
o && E.setState("value", o.getAttribute(M));
|
|
175
|
+
function V() {
|
|
176
|
+
return Array.from(k.current?.querySelectorAll(de) || []);
|
|
180
177
|
}
|
|
181
178
|
function Q(e) {
|
|
182
|
-
const
|
|
179
|
+
const o = V()[e];
|
|
180
|
+
o && E.setState("value", o.getAttribute(L));
|
|
181
|
+
}
|
|
182
|
+
function X(e) {
|
|
183
|
+
const l = x(), o = V(), a = o.findIndex((b) => b === l);
|
|
183
184
|
let m = o[a + e];
|
|
184
|
-
s.current?.loop && (m = a + e < 0 ? o[o.length - 1] : a + e === o.length ? o[0] : o[a + e]), m && E.setState("value", m.getAttribute(
|
|
185
|
+
s.current?.loop && (m = a + e < 0 ? o[o.length - 1] : a + e === o.length ? o[0] : o[a + e]), m && E.setState("value", m.getAttribute(L));
|
|
185
186
|
}
|
|
186
|
-
function
|
|
187
|
-
let o =
|
|
187
|
+
function se(e) {
|
|
188
|
+
let o = x()?.closest(D), a;
|
|
188
189
|
for (; o && !a; )
|
|
189
|
-
o = e > 0 ?
|
|
190
|
-
a ? E.setState("value", a.getAttribute(
|
|
190
|
+
o = e > 0 ? Fe(o, D) : Oe(o, D), a = o?.querySelector(de);
|
|
191
|
+
a ? E.setState("value", a.getAttribute(L)) : X(e);
|
|
191
192
|
}
|
|
192
|
-
const
|
|
193
|
-
e.preventDefault(), e.metaKey ?
|
|
194
|
-
},
|
|
195
|
-
e.preventDefault(), e.metaKey ?
|
|
193
|
+
const ie = () => Q(V().length - 1), le = (e) => {
|
|
194
|
+
e.preventDefault(), e.metaKey ? ie() : e.altKey ? se(1) : X(1);
|
|
195
|
+
}, ae = (e) => {
|
|
196
|
+
e.preventDefault(), e.metaKey ? Q(0) : e.altKey ? se(-1) : X(-1);
|
|
196
197
|
};
|
|
197
|
-
return /* @__PURE__ */
|
|
198
|
-
|
|
198
|
+
return /* @__PURE__ */ te(
|
|
199
|
+
I.div,
|
|
199
200
|
{
|
|
200
201
|
ref: n,
|
|
201
202
|
tabIndex: -1,
|
|
@@ -206,36 +207,36 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
206
207
|
switch (e.key) {
|
|
207
208
|
case "n":
|
|
208
209
|
case "j": {
|
|
209
|
-
N && e.ctrlKey &&
|
|
210
|
+
N && e.ctrlKey && le(e);
|
|
210
211
|
break;
|
|
211
212
|
}
|
|
212
213
|
case "ArrowDown": {
|
|
213
|
-
|
|
214
|
+
le(e);
|
|
214
215
|
break;
|
|
215
216
|
}
|
|
216
217
|
case "p":
|
|
217
218
|
case "k": {
|
|
218
|
-
N && e.ctrlKey &&
|
|
219
|
+
N && e.ctrlKey && ae(e);
|
|
219
220
|
break;
|
|
220
221
|
}
|
|
221
222
|
case "ArrowUp": {
|
|
222
|
-
|
|
223
|
+
ae(e);
|
|
223
224
|
break;
|
|
224
225
|
}
|
|
225
226
|
case "Home": {
|
|
226
|
-
e.preventDefault(),
|
|
227
|
+
e.preventDefault(), Q(0);
|
|
227
228
|
break;
|
|
228
229
|
}
|
|
229
230
|
case "End": {
|
|
230
|
-
e.preventDefault(),
|
|
231
|
+
e.preventDefault(), ie();
|
|
231
232
|
break;
|
|
232
233
|
}
|
|
233
234
|
case "Enter":
|
|
234
235
|
if (!e.nativeEvent.isComposing && e.keyCode !== 229) {
|
|
235
236
|
e.preventDefault();
|
|
236
|
-
const l =
|
|
237
|
+
const l = x();
|
|
237
238
|
if (l) {
|
|
238
|
-
const o = new Event(
|
|
239
|
+
const o = new Event(ee);
|
|
239
240
|
l.dispatchEvent(o);
|
|
240
241
|
}
|
|
241
242
|
}
|
|
@@ -245,103 +246,111 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
245
246
|
display: "contents"
|
|
246
247
|
},
|
|
247
248
|
children: [
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ p(
|
|
249
250
|
"label",
|
|
250
251
|
{
|
|
251
252
|
"cmdk-label": "",
|
|
252
|
-
htmlFor:
|
|
253
|
-
id:
|
|
254
|
-
style:
|
|
253
|
+
htmlFor: H.inputId,
|
|
254
|
+
id: H.labelId,
|
|
255
|
+
style: Be,
|
|
255
256
|
children: v
|
|
256
257
|
}
|
|
257
258
|
),
|
|
258
|
-
B(t, (e) => /* @__PURE__ */
|
|
259
|
+
B(t, (e) => /* @__PURE__ */ p(ve.Provider, { value: E, children: /* @__PURE__ */ p(me.Provider, { value: H, children: e }) }))
|
|
259
260
|
]
|
|
260
261
|
}
|
|
261
262
|
);
|
|
262
|
-
}),
|
|
263
|
-
const { id: r } = t, i = c.useRef(null), u = c.useContext(
|
|
264
|
-
|
|
263
|
+
}), Ae = c.forwardRef((t, n) => {
|
|
264
|
+
const { id: r } = t, i = c.useRef(null), u = c.useContext(he), f = O(), s = pe(t), v = s.current?.forceMount ?? u?.forceMount;
|
|
265
|
+
A(() => {
|
|
265
266
|
if (!v)
|
|
266
267
|
return f.item(r, u?.id);
|
|
267
268
|
}, [v]);
|
|
268
|
-
const d =
|
|
269
|
-
(
|
|
269
|
+
const d = be(r, i, [t.value, t.children, i], t.keywords), S = re(), C = P((g) => g.value && g.value === d.current), y = P(
|
|
270
|
+
(g) => v || f.filter() === !1 ? !0 : g.search ? g.filtered.items.get(r) > 0 : !0
|
|
270
271
|
);
|
|
271
272
|
c.useEffect(() => {
|
|
272
|
-
const
|
|
273
|
-
if (!
|
|
274
|
-
const
|
|
275
|
-
return
|
|
273
|
+
const g = i.current;
|
|
274
|
+
if (!g || t.disabled) return;
|
|
275
|
+
const G = () => R("keyboard");
|
|
276
|
+
return g.addEventListener(ee, G), () => g.removeEventListener(ee, G);
|
|
276
277
|
}, [y, t.onSelect, t.disabled]);
|
|
277
|
-
const w =
|
|
278
|
+
const w = ue(() => {
|
|
278
279
|
S.setState("value", d.current, !0);
|
|
279
|
-
}, [S, d]), R =
|
|
280
|
-
(
|
|
281
|
-
w(), s.current.onSelect?.({ value: d.current, trigger:
|
|
280
|
+
}, [S, d]), R = ue(
|
|
281
|
+
(g = "click") => {
|
|
282
|
+
w(), s.current.onSelect?.({ value: d.current, trigger: g });
|
|
282
283
|
},
|
|
283
284
|
[w, s, d]
|
|
284
285
|
);
|
|
285
286
|
if (!y) return null;
|
|
286
|
-
const {
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
const {
|
|
288
|
+
disabled: _,
|
|
289
|
+
value: N,
|
|
290
|
+
onSelect: ne,
|
|
291
|
+
forceMount: U,
|
|
292
|
+
keywords: h,
|
|
293
|
+
onClick: $,
|
|
294
|
+
...j
|
|
295
|
+
} = t, q = Ee(() => F([i, n]), [i, n]), k = Re($, R);
|
|
296
|
+
return /* @__PURE__ */ p(
|
|
297
|
+
I.div,
|
|
289
298
|
{
|
|
290
|
-
ref:
|
|
291
|
-
|
|
299
|
+
ref: q,
|
|
300
|
+
...j,
|
|
292
301
|
id: r,
|
|
293
302
|
"cmdk-item": "",
|
|
294
303
|
role: "option",
|
|
295
|
-
"aria-disabled": !!
|
|
304
|
+
"aria-disabled": !!_,
|
|
296
305
|
"aria-selected": !!C,
|
|
297
|
-
"data-disabled": !!
|
|
306
|
+
"data-disabled": !!_,
|
|
298
307
|
"data-selected": !!C,
|
|
299
|
-
onPointerMove:
|
|
300
|
-
onClick:
|
|
301
|
-
onFocus:
|
|
308
|
+
onPointerMove: _ || f.getDisablePointerSelection() ? void 0 : w,
|
|
309
|
+
onClick: _ ? void 0 : k,
|
|
310
|
+
onFocus: _ ? void 0 : w,
|
|
302
311
|
children: t.children
|
|
303
312
|
}
|
|
304
313
|
);
|
|
305
|
-
}),
|
|
306
|
-
const { heading: r, children: i, forceMount: u, ...f } = t, s =
|
|
314
|
+
}), _e = c.forwardRef((t, n) => {
|
|
315
|
+
const { heading: r, children: i, forceMount: u, ...f } = t, s = T(), v = c.useRef(null), d = c.useRef(null), S = T(), C = O(), y = P(
|
|
307
316
|
(R) => u || C.filter() === !1 ? !0 : R.search ? R.filtered.groups.has(s) : !0
|
|
308
317
|
);
|
|
309
|
-
|
|
318
|
+
A(() => C.group(s), []), be(s, v, [t.value, t.heading, d]);
|
|
310
319
|
const w = c.useMemo(() => ({ id: s, forceMount: u }), [u]);
|
|
311
|
-
return /* @__PURE__ */
|
|
312
|
-
|
|
320
|
+
return /* @__PURE__ */ te(
|
|
321
|
+
I.div,
|
|
313
322
|
{
|
|
314
|
-
ref:
|
|
323
|
+
ref: F([v, n]),
|
|
315
324
|
...f,
|
|
316
325
|
"cmdk-group": "",
|
|
317
326
|
role: "presentation",
|
|
318
327
|
hidden: y ? void 0 : !0,
|
|
319
328
|
children: [
|
|
320
|
-
r && /* @__PURE__ */
|
|
329
|
+
r && /* @__PURE__ */ p("div", { ref: d, "cmdk-group-heading": "", "aria-hidden": !0, id: S, children: r }),
|
|
321
330
|
B(t, (R) => (
|
|
322
331
|
// biome-ignore lint/a11y/useSemanticElements: <explanation>
|
|
323
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ p("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? S : void 0, children: /* @__PURE__ */ p(he.Provider, { value: w, children: R }) })
|
|
324
333
|
))
|
|
325
334
|
]
|
|
326
335
|
}
|
|
327
336
|
);
|
|
328
|
-
}),
|
|
329
|
-
const { alwaysRender: r, ...i } = t, u = c.useRef(null), f =
|
|
330
|
-
return !r && !f ? null : /* @__PURE__ */
|
|
331
|
-
|
|
337
|
+
}), Le = c.forwardRef((t, n) => {
|
|
338
|
+
const { alwaysRender: r, ...i } = t, u = c.useRef(null), f = P((s) => !s.search);
|
|
339
|
+
return !r && !f ? null : /* @__PURE__ */ p(
|
|
340
|
+
I.div,
|
|
332
341
|
{
|
|
333
|
-
ref:
|
|
342
|
+
ref: F([u, n]),
|
|
334
343
|
...i,
|
|
335
344
|
"cmdk-separator": "",
|
|
336
345
|
role: "separator"
|
|
337
346
|
}
|
|
338
347
|
);
|
|
339
|
-
}),
|
|
340
|
-
const { onValueChange: r, ...i } = t, u = t.value != null, f =
|
|
348
|
+
}), Me = c.forwardRef((t, n) => {
|
|
349
|
+
const { onValueChange: r, ...i } = t, u = t.value != null, f = re(), s = P((d) => d.search), v = O();
|
|
341
350
|
return c.useEffect(() => {
|
|
342
351
|
t.value != null && f.setState("search", t.value);
|
|
343
|
-
}, [t.value]), /* @__PURE__ */
|
|
344
|
-
|
|
352
|
+
}, [t.value]), /* @__PURE__ */ p(
|
|
353
|
+
I.input,
|
|
345
354
|
{
|
|
346
355
|
ref: n,
|
|
347
356
|
...i,
|
|
@@ -362,8 +371,8 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
362
371
|
}
|
|
363
372
|
}
|
|
364
373
|
);
|
|
365
|
-
}),
|
|
366
|
-
const { children: r, label: i = "Suggestions", ...u } = t, f = c.useRef(null), s = c.useRef(null), v =
|
|
374
|
+
}), Pe = c.forwardRef((t, n) => {
|
|
375
|
+
const { children: r, label: i = "Suggestions", ...u } = t, f = c.useRef(null), s = c.useRef(null), v = O();
|
|
367
376
|
return c.useEffect(() => {
|
|
368
377
|
if (s.current && f.current) {
|
|
369
378
|
const d = s.current, S = f.current;
|
|
@@ -378,28 +387,28 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
378
387
|
cancelAnimationFrame(C), y.unobserve(d);
|
|
379
388
|
};
|
|
380
389
|
}
|
|
381
|
-
}, []), /* @__PURE__ */
|
|
382
|
-
|
|
390
|
+
}, []), /* @__PURE__ */ p(
|
|
391
|
+
I.div,
|
|
383
392
|
{
|
|
384
|
-
ref:
|
|
393
|
+
ref: F([f, n]),
|
|
385
394
|
...u,
|
|
386
395
|
"cmdk-list": "",
|
|
387
396
|
tabIndex: -1,
|
|
388
397
|
"aria-label": i,
|
|
389
398
|
id: v.listId,
|
|
390
|
-
children: B(t, (d) => /* @__PURE__ */
|
|
399
|
+
children: B(t, (d) => /* @__PURE__ */ p("div", { ref: F([s, v.listInnerRef]), "cmdk-list-sizer": "", children: d }))
|
|
391
400
|
}
|
|
392
401
|
);
|
|
393
|
-
}),
|
|
402
|
+
}), Ve = c.forwardRef((t, n) => {
|
|
394
403
|
const { open: r, onOpenChange: i, overlayClassName: u, contentClassName: f, container: s, ...v } = t;
|
|
395
|
-
return /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
404
|
+
return /* @__PURE__ */ p(K.Root, { open: r, onOpenChange: i, children: /* @__PURE__ */ te(K.Portal, { container: s, children: [
|
|
405
|
+
/* @__PURE__ */ p(K.Overlay, { "cmdk-overlay": "", className: u }),
|
|
406
|
+
/* @__PURE__ */ p(K.Content, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ p(ge, { ref: n, ...v }) })
|
|
398
407
|
] }) });
|
|
399
|
-
}),
|
|
408
|
+
}), De = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(I.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), Te = c.forwardRef((t, n) => {
|
|
400
409
|
const { progress: r, children: i, label: u = "Loading...", ...f } = t;
|
|
401
|
-
return /* @__PURE__ */
|
|
402
|
-
|
|
410
|
+
return /* @__PURE__ */ p(
|
|
411
|
+
I.div,
|
|
403
412
|
{
|
|
404
413
|
ref: n,
|
|
405
414
|
...f,
|
|
@@ -409,58 +418,58 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
|
|
|
409
418
|
"aria-valuemin": 0,
|
|
410
419
|
"aria-valuemax": 100,
|
|
411
420
|
"aria-label": u,
|
|
412
|
-
children: B(t, (s) => /* @__PURE__ */
|
|
421
|
+
children: B(t, (s) => /* @__PURE__ */ p("div", { "aria-hidden": !0, children: s }))
|
|
413
422
|
}
|
|
414
423
|
);
|
|
415
|
-
}),
|
|
416
|
-
List:
|
|
417
|
-
Item:
|
|
418
|
-
Input:
|
|
419
|
-
Group:
|
|
420
|
-
Separator:
|
|
421
|
-
Dialog:
|
|
422
|
-
Empty:
|
|
423
|
-
Loading:
|
|
424
|
+
}), Qe = Object.assign(ge, {
|
|
425
|
+
List: Pe,
|
|
426
|
+
Item: Ae,
|
|
427
|
+
Input: Me,
|
|
428
|
+
Group: _e,
|
|
429
|
+
Separator: Le,
|
|
430
|
+
Dialog: Ve,
|
|
431
|
+
Empty: De,
|
|
432
|
+
Loading: Te
|
|
424
433
|
});
|
|
425
|
-
function
|
|
434
|
+
function Fe(t, n) {
|
|
426
435
|
let r = t.nextElementSibling;
|
|
427
436
|
for (; r; ) {
|
|
428
437
|
if (r.matches(n)) return r;
|
|
429
438
|
r = r.nextElementSibling;
|
|
430
439
|
}
|
|
431
440
|
}
|
|
432
|
-
function
|
|
441
|
+
function Oe(t, n) {
|
|
433
442
|
let r = t.previousElementSibling;
|
|
434
443
|
for (; r; ) {
|
|
435
444
|
if (r.matches(n)) return r;
|
|
436
445
|
r = r.previousElementSibling;
|
|
437
446
|
}
|
|
438
447
|
}
|
|
439
|
-
function
|
|
448
|
+
function pe(t) {
|
|
440
449
|
const n = c.useRef(t);
|
|
441
|
-
return
|
|
450
|
+
return A(() => {
|
|
442
451
|
n.current = t;
|
|
443
452
|
}), n;
|
|
444
453
|
}
|
|
445
|
-
const
|
|
446
|
-
function
|
|
454
|
+
const A = typeof window > "u" ? c.useEffect : c.useLayoutEffect;
|
|
455
|
+
function M(t) {
|
|
447
456
|
const n = c.useRef(void 0);
|
|
448
457
|
return n.current === void 0 && (n.current = t()), n;
|
|
449
458
|
}
|
|
450
|
-
function
|
|
459
|
+
function F(t) {
|
|
451
460
|
return (n) => {
|
|
452
461
|
t.forEach((r) => {
|
|
453
462
|
typeof r == "function" ? r(n) : r != null && (r.current = n);
|
|
454
463
|
});
|
|
455
464
|
};
|
|
456
465
|
}
|
|
457
|
-
function
|
|
458
|
-
const n =
|
|
466
|
+
function P(t) {
|
|
467
|
+
const n = re(), r = () => t(n.snapshot());
|
|
459
468
|
return we.useSyncExternalStore(n.subscribe, r, r);
|
|
460
469
|
}
|
|
461
|
-
function
|
|
462
|
-
const u = c.useRef(void 0), f =
|
|
463
|
-
return
|
|
470
|
+
function be(t, n, r, i = []) {
|
|
471
|
+
const u = c.useRef(void 0), f = O();
|
|
472
|
+
return A(() => {
|
|
464
473
|
const s = (() => {
|
|
465
474
|
for (const d of r) {
|
|
466
475
|
if (typeof d == "string")
|
|
@@ -469,30 +478,30 @@ function pe(t, n, r, i = []) {
|
|
|
469
478
|
return d.current ? d.current.textContent?.trim() : u.current;
|
|
470
479
|
}
|
|
471
480
|
})(), v = i.map((d) => d.trim());
|
|
472
|
-
f.value(t, s, v), n.current?.setAttribute(
|
|
481
|
+
f.value(t, s, v), n.current?.setAttribute(L, s), u.current = s;
|
|
473
482
|
}), u;
|
|
474
483
|
}
|
|
475
|
-
const
|
|
476
|
-
const [t, n] = c.useState(), r =
|
|
477
|
-
return
|
|
484
|
+
const Ge = () => {
|
|
485
|
+
const [t, n] = c.useState(), r = M(() => /* @__PURE__ */ new Map());
|
|
486
|
+
return A(() => {
|
|
478
487
|
r.current.forEach((i) => i()), r.current = /* @__PURE__ */ new Map();
|
|
479
488
|
}, [t]), (i, u) => {
|
|
480
489
|
r.current.set(i, u), n({});
|
|
481
490
|
};
|
|
482
491
|
};
|
|
483
|
-
function
|
|
492
|
+
function Ke(t) {
|
|
484
493
|
const n = t.type;
|
|
485
494
|
return typeof n == "function" ? n(t.props) : "render" in n ? n.render(t.props) : t;
|
|
486
495
|
}
|
|
487
496
|
function B({ asChild: t, children: n }, r) {
|
|
488
497
|
return t && c.isValidElement(n) ? c.cloneElement(
|
|
489
|
-
|
|
498
|
+
Ke(n),
|
|
490
499
|
{ ref: n.ref },
|
|
491
500
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
492
501
|
r(n.props.children)
|
|
493
502
|
) : r(n);
|
|
494
503
|
}
|
|
495
|
-
const
|
|
504
|
+
const Be = {
|
|
496
505
|
position: "absolute",
|
|
497
506
|
width: "1px",
|
|
498
507
|
height: "1px",
|
|
@@ -504,16 +513,16 @@ const Ke = {
|
|
|
504
513
|
borderWidth: "0"
|
|
505
514
|
};
|
|
506
515
|
export {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
+
Qe as Command,
|
|
517
|
+
Ve as CommandDialog,
|
|
518
|
+
De as CommandEmpty,
|
|
519
|
+
Me as CommandInput,
|
|
520
|
+
Ae as CommandItem,
|
|
521
|
+
Pe as CommandList,
|
|
522
|
+
Te as CommandLoading,
|
|
523
|
+
ge as CommandRoot,
|
|
524
|
+
Le as CommandSeparator,
|
|
516
525
|
xe as defaultFilter,
|
|
517
|
-
|
|
518
|
-
|
|
526
|
+
P as useCommandState,
|
|
527
|
+
re as useCommandStore
|
|
519
528
|
};
|