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