@inkeep/cxkit-primitives 0.5.47 → 0.5.49
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 +200 -208
- package/dist/atoms/dialog.cjs +1 -1
- package/dist/atoms/dialog.js +130 -131
- 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/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
|
|
7
|
-
import { useId as
|
|
8
|
-
import { s as
|
|
9
|
-
import { ASK_AI_TRIGGER_VALUE as
|
|
10
|
-
import { composeEventHandlers as
|
|
11
|
-
import { useShadow as
|
|
12
|
-
const
|
|
13
|
-
const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()),
|
|
14
|
-
label:
|
|
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
|
+
import { useId as F } from "@radix-ui/react-id";
|
|
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
|
+
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
|
-
...
|
|
25
|
-
} = t,
|
|
22
|
+
vimBindings: B = !0,
|
|
23
|
+
defaultSearch: te,
|
|
24
|
+
...N
|
|
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 D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[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
|
-
snapshot: () =>
|
|
51
|
+
snapshot: () => v.current,
|
|
52
52
|
setState: (e, l, o) => {
|
|
53
|
-
if (!Object.is(
|
|
54
|
-
if (
|
|
55
|
-
|
|
53
|
+
if (!Object.is(v.current[e], l)) {
|
|
54
|
+
if (v.current[e] = l, e === "search")
|
|
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
|
-
|
|
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,167 +68,159 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[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 !==
|
|
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
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
|
-
|
|
83
|
+
a.current.delete(e), r.current.delete(e), v.current.filtered.items.delete(e);
|
|
84
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
|
-
label:
|
|
94
|
+
label: h || t["aria-label"] || "",
|
|
95
95
|
getDisablePointerSelection: () => !!s.current.disablePointerSelection,
|
|
96
|
-
listId:
|
|
97
|
-
inputId:
|
|
98
|
-
labelId:
|
|
96
|
+
listId: U,
|
|
97
|
+
inputId: j,
|
|
98
|
+
labelId: $,
|
|
99
99
|
listInnerRef: k
|
|
100
100
|
}),
|
|
101
101
|
[]
|
|
102
102
|
);
|
|
103
|
-
function
|
|
104
|
-
const o = s.current?.filter ??
|
|
105
|
-
return e ? o?.(e,
|
|
103
|
+
function re(e, l) {
|
|
104
|
+
const o = s.current?.filter ?? Le;
|
|
105
|
+
return e ? o?.(e, v.current.search, l) : 0;
|
|
106
106
|
}
|
|
107
107
|
function z() {
|
|
108
|
-
if (!
|
|
108
|
+
if (!v.current.search || // Explicitly false, because true | undefined is the default
|
|
109
109
|
s.current.shouldFilter === !1)
|
|
110
110
|
return;
|
|
111
|
-
const e =
|
|
112
|
-
|
|
113
|
-
const m = i.current.get(
|
|
111
|
+
const e = v.current.filtered.items, l = [];
|
|
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
120
|
const o = k.current;
|
|
121
|
-
V().sort((
|
|
122
|
-
const b =
|
|
123
|
-
return (e.get(
|
|
124
|
-
}).forEach((
|
|
125
|
-
const m =
|
|
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((
|
|
133
|
+
}), l.sort((u, m) => m[1] - u[1]).forEach((u) => {
|
|
134
134
|
const m = k.current?.querySelector(
|
|
135
|
-
`${
|
|
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
|
|
147
|
-
if (!
|
|
146
|
+
function W() {
|
|
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;
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
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 =
|
|
156
|
-
|
|
155
|
+
const o = a.current.get(l)?.value ?? "", u = a.current.get(l)?.keywords ?? [], m = re(o, u);
|
|
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 =
|
|
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;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
v.current.filtered.count = e;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function ne() {
|
|
169
169
|
const e = x();
|
|
170
|
-
e && (e.parentElement?.firstChild === e && e.closest(
|
|
170
|
+
e && (e.parentElement?.firstChild === e && e.closest(T)?.querySelector(_e)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
|
|
171
171
|
}
|
|
172
172
|
function x() {
|
|
173
|
-
return k.current?.querySelector(`${
|
|
173
|
+
return k.current?.querySelector(`${ae}[aria-selected="true"]`);
|
|
174
174
|
}
|
|
175
175
|
function V() {
|
|
176
|
-
return Array.from(k.current?.querySelectorAll(
|
|
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 = x(), o = V(),
|
|
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 = x()?.closest(
|
|
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
|
-
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
|
-
case "Home": {
|
|
227
|
-
e.preventDefault(), Q(0);
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
case "End": {
|
|
231
|
-
e.preventDefault(), ie();
|
|
223
|
+
ie(e);
|
|
232
224
|
break;
|
|
233
225
|
}
|
|
234
226
|
case "Enter":
|
|
@@ -236,7 +228,7 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
|
|
|
236
228
|
e.preventDefault();
|
|
237
229
|
const l = x();
|
|
238
230
|
if (l) {
|
|
239
|
-
const o = new Event(
|
|
231
|
+
const o = new Event(Y);
|
|
240
232
|
l.dispatchEvent(o);
|
|
241
233
|
}
|
|
242
234
|
}
|
|
@@ -250,34 +242,34 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
|
|
|
250
242
|
"label",
|
|
251
243
|
{
|
|
252
244
|
"cmdk-label": "",
|
|
253
|
-
htmlFor:
|
|
254
|
-
id:
|
|
255
|
-
style:
|
|
256
|
-
children:
|
|
245
|
+
htmlFor: q.inputId,
|
|
246
|
+
id: q.labelId,
|
|
247
|
+
style: $e,
|
|
248
|
+
children: h
|
|
257
249
|
}
|
|
258
250
|
),
|
|
259
|
-
|
|
251
|
+
K(t, (e) => /* @__PURE__ */ p(fe.Provider, { value: E, children: /* @__PURE__ */ p(de.Provider, { value: q, children: e }) }))
|
|
260
252
|
]
|
|
261
253
|
}
|
|
262
254
|
);
|
|
263
|
-
}),
|
|
264
|
-
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;
|
|
265
257
|
A(() => {
|
|
266
|
-
if (!
|
|
267
|
-
return f.item(r,
|
|
268
|
-
}, [
|
|
269
|
-
const d =
|
|
270
|
-
(g) =>
|
|
258
|
+
if (!h)
|
|
259
|
+
return f.item(r, a?.id);
|
|
260
|
+
}, [h]);
|
|
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
|
+
(g) => h || f.filter() === !1 ? !0 : g.search ? g.filtered.items.get(r) > 0 : !0
|
|
271
263
|
);
|
|
272
264
|
c.useEffect(() => {
|
|
273
265
|
const g = i.current;
|
|
274
266
|
if (!g || t.disabled) return;
|
|
275
|
-
const G = () =>
|
|
276
|
-
return g.addEventListener(
|
|
267
|
+
const G = () => I("keyboard");
|
|
268
|
+
return g.addEventListener(Y, G), () => g.removeEventListener(Y, G);
|
|
277
269
|
}, [y, t.onSelect, t.disabled]);
|
|
278
|
-
const w =
|
|
270
|
+
const w = le(() => {
|
|
279
271
|
S.setState("value", d.current, !0);
|
|
280
|
-
}, [S, d]),
|
|
272
|
+
}, [S, d]), I = le(
|
|
281
273
|
(g = "click") => {
|
|
282
274
|
w(), s.current.onSelect?.({ value: d.current, trigger: g });
|
|
283
275
|
},
|
|
@@ -286,18 +278,18 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
|
|
|
286
278
|
if (!y) return null;
|
|
287
279
|
const {
|
|
288
280
|
disabled: _,
|
|
289
|
-
value:
|
|
290
|
-
onSelect:
|
|
291
|
-
forceMount:
|
|
292
|
-
keywords:
|
|
293
|
-
onClick:
|
|
294
|
-
|
|
295
|
-
} = t,
|
|
281
|
+
value: B,
|
|
282
|
+
onSelect: te,
|
|
283
|
+
forceMount: N,
|
|
284
|
+
keywords: v,
|
|
285
|
+
onClick: U,
|
|
286
|
+
...$
|
|
287
|
+
} = t, j = ye(() => O([i, n]), [i, n]), k = xe(U, I);
|
|
296
288
|
return /* @__PURE__ */ p(
|
|
297
|
-
|
|
289
|
+
R.div,
|
|
298
290
|
{
|
|
299
|
-
ref:
|
|
300
|
-
|
|
291
|
+
ref: j,
|
|
292
|
+
...$,
|
|
301
293
|
id: r,
|
|
302
294
|
"cmdk-item": "",
|
|
303
295
|
role: "option",
|
|
@@ -311,46 +303,46 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
|
|
|
311
303
|
children: t.children
|
|
312
304
|
}
|
|
313
305
|
);
|
|
314
|
-
}),
|
|
315
|
-
const { heading: r, children: i, forceMount:
|
|
316
|
-
(
|
|
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
|
|
317
309
|
);
|
|
318
|
-
A(() => C.group(s), []),
|
|
319
|
-
const w = c.useMemo(() => ({ id: s, forceMount:
|
|
320
|
-
return /* @__PURE__ */
|
|
321
|
-
|
|
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,
|
|
322
314
|
{
|
|
323
|
-
ref:
|
|
315
|
+
ref: O([h, n]),
|
|
324
316
|
...f,
|
|
325
317
|
"cmdk-group": "",
|
|
326
318
|
role: "presentation",
|
|
327
319
|
hidden: y ? void 0 : !0,
|
|
328
320
|
children: [
|
|
329
321
|
r && /* @__PURE__ */ p("div", { ref: d, "cmdk-group-heading": "", "aria-hidden": !0, id: S, children: r }),
|
|
330
|
-
|
|
322
|
+
K(t, (I) => (
|
|
331
323
|
// biome-ignore lint/a11y/useSemanticElements: <explanation>
|
|
332
|
-
/* @__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 }) })
|
|
333
325
|
))
|
|
334
326
|
]
|
|
335
327
|
}
|
|
336
328
|
);
|
|
337
|
-
}),
|
|
338
|
-
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);
|
|
339
331
|
return !r && !f ? null : /* @__PURE__ */ p(
|
|
340
|
-
|
|
332
|
+
R.div,
|
|
341
333
|
{
|
|
342
|
-
ref:
|
|
334
|
+
ref: O([a, n]),
|
|
343
335
|
...i,
|
|
344
336
|
"cmdk-separator": "",
|
|
345
337
|
role: "separator"
|
|
346
338
|
}
|
|
347
339
|
);
|
|
348
|
-
}),
|
|
349
|
-
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();
|
|
350
342
|
return c.useEffect(() => {
|
|
351
343
|
t.value != null && f.setState("search", t.value);
|
|
352
344
|
}, [t.value]), /* @__PURE__ */ p(
|
|
353
|
-
|
|
345
|
+
R.input,
|
|
354
346
|
{
|
|
355
347
|
ref: n,
|
|
356
348
|
...i,
|
|
@@ -361,18 +353,18 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
|
|
|
361
353
|
"aria-autocomplete": "list",
|
|
362
354
|
role: "combobox",
|
|
363
355
|
"aria-expanded": !0,
|
|
364
|
-
"aria-controls":
|
|
365
|
-
"aria-labelledby":
|
|
366
|
-
id:
|
|
356
|
+
"aria-controls": h.listId,
|
|
357
|
+
"aria-labelledby": h.labelId,
|
|
358
|
+
id: h.inputId,
|
|
367
359
|
type: "text",
|
|
368
|
-
value:
|
|
360
|
+
value: a ? t.value : s,
|
|
369
361
|
onChange: (d) => {
|
|
370
|
-
|
|
362
|
+
a || f.setState("search", d.target.value), r?.(d.target.value);
|
|
371
363
|
}
|
|
372
364
|
}
|
|
373
365
|
);
|
|
374
|
-
}),
|
|
375
|
-
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();
|
|
376
368
|
return c.useEffect(() => {
|
|
377
369
|
if (s.current && f.current) {
|
|
378
370
|
const d = s.current, S = f.current;
|
|
@@ -388,27 +380,27 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
|
|
|
388
380
|
};
|
|
389
381
|
}
|
|
390
382
|
}, []), /* @__PURE__ */ p(
|
|
391
|
-
|
|
383
|
+
R.div,
|
|
392
384
|
{
|
|
393
|
-
ref:
|
|
394
|
-
...
|
|
385
|
+
ref: O([f, n]),
|
|
386
|
+
...a,
|
|
395
387
|
"cmdk-list": "",
|
|
396
388
|
tabIndex: -1,
|
|
397
389
|
"aria-label": i,
|
|
398
|
-
id:
|
|
399
|
-
children:
|
|
390
|
+
id: h.listId,
|
|
391
|
+
children: K(t, (d) => /* @__PURE__ */ p("div", { ref: O([s, h.listInnerRef]), "cmdk-list-sizer": "", children: d }))
|
|
400
392
|
}
|
|
401
393
|
);
|
|
402
|
-
}),
|
|
403
|
-
const { open: r, onOpenChange: i, overlayClassName:
|
|
404
|
-
return /* @__PURE__ */ p(
|
|
405
|
-
/* @__PURE__ */ p(
|
|
406
|
-
/* @__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 }) })
|
|
407
399
|
] }) });
|
|
408
|
-
}), De = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(
|
|
409
|
-
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;
|
|
410
402
|
return /* @__PURE__ */ p(
|
|
411
|
-
|
|
403
|
+
R.div,
|
|
412
404
|
{
|
|
413
405
|
ref: n,
|
|
414
406
|
...f,
|
|
@@ -417,35 +409,35 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
|
|
|
417
409
|
"aria-valuenow": r,
|
|
418
410
|
"aria-valuemin": 0,
|
|
419
411
|
"aria-valuemax": 100,
|
|
420
|
-
"aria-label":
|
|
421
|
-
children:
|
|
412
|
+
"aria-label": a,
|
|
413
|
+
children: K(t, (s) => /* @__PURE__ */ p("div", { "aria-hidden": !0, children: s }))
|
|
422
414
|
}
|
|
423
415
|
);
|
|
424
|
-
}),
|
|
425
|
-
List:
|
|
426
|
-
Item:
|
|
427
|
-
Input:
|
|
428
|
-
Group:
|
|
429
|
-
Separator:
|
|
430
|
-
Dialog:
|
|
416
|
+
}), et = Object.assign(he, {
|
|
417
|
+
List: Fe,
|
|
418
|
+
Item: Me,
|
|
419
|
+
Input: Te,
|
|
420
|
+
Group: Pe,
|
|
421
|
+
Separator: Ve,
|
|
422
|
+
Dialog: Oe,
|
|
431
423
|
Empty: De,
|
|
432
|
-
Loading:
|
|
424
|
+
Loading: Ge
|
|
433
425
|
});
|
|
434
|
-
function
|
|
426
|
+
function Ke(t, n) {
|
|
435
427
|
let r = t.nextElementSibling;
|
|
436
428
|
for (; r; ) {
|
|
437
429
|
if (r.matches(n)) return r;
|
|
438
430
|
r = r.nextElementSibling;
|
|
439
431
|
}
|
|
440
432
|
}
|
|
441
|
-
function
|
|
433
|
+
function Be(t, n) {
|
|
442
434
|
let r = t.previousElementSibling;
|
|
443
435
|
for (; r; ) {
|
|
444
436
|
if (r.matches(n)) return r;
|
|
445
437
|
r = r.previousElementSibling;
|
|
446
438
|
}
|
|
447
439
|
}
|
|
448
|
-
function
|
|
440
|
+
function ve(t) {
|
|
449
441
|
const n = c.useRef(t);
|
|
450
442
|
return A(() => {
|
|
451
443
|
n.current = t;
|
|
@@ -456,7 +448,7 @@ function M(t) {
|
|
|
456
448
|
const n = c.useRef(void 0);
|
|
457
449
|
return n.current === void 0 && (n.current = t()), n;
|
|
458
450
|
}
|
|
459
|
-
function
|
|
451
|
+
function O(t) {
|
|
460
452
|
return (n) => {
|
|
461
453
|
t.forEach((r) => {
|
|
462
454
|
typeof r == "function" ? r(n) : r != null && (r.current = n);
|
|
@@ -464,44 +456,44 @@ function F(t) {
|
|
|
464
456
|
};
|
|
465
457
|
}
|
|
466
458
|
function P(t) {
|
|
467
|
-
const n =
|
|
468
|
-
return
|
|
459
|
+
const n = ee(), r = () => t(n.snapshot());
|
|
460
|
+
return Re.useSyncExternalStore(n.subscribe, r, r);
|
|
469
461
|
}
|
|
470
|
-
function
|
|
471
|
-
const
|
|
462
|
+
function ge(t, n, r, i = []) {
|
|
463
|
+
const a = c.useRef(void 0), f = D();
|
|
472
464
|
return A(() => {
|
|
473
465
|
const s = (() => {
|
|
474
466
|
for (const d of r) {
|
|
475
467
|
if (typeof d == "string")
|
|
476
468
|
return d.trim();
|
|
477
469
|
if (typeof d == "object" && "current" in d)
|
|
478
|
-
return d.current ? d.current.textContent?.trim() :
|
|
470
|
+
return d.current ? d.current.textContent?.trim() : a.current;
|
|
479
471
|
}
|
|
480
|
-
})(),
|
|
481
|
-
f.value(t, s,
|
|
482
|
-
}),
|
|
472
|
+
})(), h = i.map((d) => d.trim());
|
|
473
|
+
f.value(t, s, h), n.current?.setAttribute(L, s), a.current = s;
|
|
474
|
+
}), a;
|
|
483
475
|
}
|
|
484
|
-
const
|
|
476
|
+
const Ne = () => {
|
|
485
477
|
const [t, n] = c.useState(), r = M(() => /* @__PURE__ */ new Map());
|
|
486
478
|
return A(() => {
|
|
487
479
|
r.current.forEach((i) => i()), r.current = /* @__PURE__ */ new Map();
|
|
488
|
-
}, [t]), (i,
|
|
489
|
-
r.current.set(i,
|
|
480
|
+
}, [t]), (i, a) => {
|
|
481
|
+
r.current.set(i, a), n({});
|
|
490
482
|
};
|
|
491
483
|
};
|
|
492
|
-
function
|
|
484
|
+
function Ue(t) {
|
|
493
485
|
const n = t.type;
|
|
494
486
|
return typeof n == "function" ? n(t.props) : "render" in n ? n.render(t.props) : t;
|
|
495
487
|
}
|
|
496
|
-
function
|
|
488
|
+
function K({ asChild: t, children: n }, r) {
|
|
497
489
|
return t && c.isValidElement(n) ? c.cloneElement(
|
|
498
|
-
|
|
490
|
+
Ue(n),
|
|
499
491
|
{ ref: n.ref },
|
|
500
492
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
501
493
|
r(n.props.children)
|
|
502
494
|
) : r(n);
|
|
503
495
|
}
|
|
504
|
-
const
|
|
496
|
+
const $e = {
|
|
505
497
|
position: "absolute",
|
|
506
498
|
width: "1px",
|
|
507
499
|
height: "1px",
|
|
@@ -513,16 +505,16 @@ const Be = {
|
|
|
513
505
|
borderWidth: "0"
|
|
514
506
|
};
|
|
515
507
|
export {
|
|
516
|
-
|
|
517
|
-
|
|
508
|
+
et as Command,
|
|
509
|
+
Oe as CommandDialog,
|
|
518
510
|
De as CommandEmpty,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
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,
|
|
526
518
|
P as useCommandState,
|
|
527
|
-
|
|
519
|
+
ee as useCommandStore
|
|
528
520
|
};
|