@bioturing/components 0.39.0 → 0.40.1
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/base.d.ts +35 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +47 -1
- package/dist/base.js.map +1 -1
- package/dist/components/base-menu/component.d.ts +1 -1
- package/dist/components/base-menu/index.d.ts +1 -1
- package/dist/components/base-menu/index.d.ts.map +1 -1
- package/dist/components/base-menu/index.js +3 -3
- package/dist/components/base-menu/item.d.ts +1 -1
- package/dist/components/base-menu/item.d.ts.map +1 -1
- package/dist/components/base-menu/item.js +1 -1
- package/dist/components/base-menu/item.js.map +1 -1
- package/dist/components/button/component.d.ts +1 -1
- package/dist/components/button/component.d.ts.map +1 -1
- package/dist/components/button/component.js +18 -17
- package/dist/components/button/component.js.map +1 -1
- package/dist/components/checkbox/component.d.ts.map +1 -1
- package/dist/components/choice-list/component.d.ts +8 -4
- package/dist/components/choice-list/component.d.ts.map +1 -1
- package/dist/components/choice-list/component.js +89 -94
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/color-select/component.js +6 -6
- package/dist/components/combobox/component.js +1 -1
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/command-palette/component.d.ts +6 -0
- package/dist/components/command-palette/component.d.ts.map +1 -1
- package/dist/components/command-palette/component.js +182 -63
- package/dist/components/command-palette/component.js.map +1 -1
- package/dist/components/command-palette/index.d.ts +3 -1
- package/dist/components/command-palette/index.d.ts.map +1 -1
- package/dist/components/command-palette/style.css +1 -1
- package/dist/components/drag-drop/draggable.js +1 -1
- package/dist/components/drag-drop/draggable.js.map +1 -1
- package/dist/components/drag-drop/droppable.js +1 -1
- package/dist/components/drag-drop/droppable.js.map +1 -1
- package/dist/components/drag-drop/types.d.ts +1 -1
- package/dist/components/drag-drop/types.d.ts.map +1 -1
- package/dist/components/drag-drop/value.js +13 -13
- package/dist/components/dropdown-menu/component.d.ts +5 -3
- package/dist/components/dropdown-menu/component.d.ts.map +1 -1
- package/dist/components/dropdown-menu/component.js +185 -159
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/divider.js +6 -6
- package/dist/components/dropdown-menu/divider.js.map +1 -1
- package/dist/components/dropdown-menu/item.d.ts.map +1 -1
- package/dist/components/dropdown-menu/item.js +28 -27
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/dropdown-menu/types.d.ts +2 -2
- package/dist/components/dropdown-menu/types.d.ts.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.js +72 -68
- package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
- package/dist/components/hooks/antd.d.ts.map +1 -1
- package/dist/components/hooks/index.d.ts +1 -0
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/hooks/useBaseUIPlacement.d.ts +64 -0
- package/dist/components/hooks/useBaseUIPlacement.d.ts.map +1 -0
- package/dist/components/hooks/useBaseUIPlacement.js +61 -0
- package/dist/components/hooks/useBaseUIPlacement.js.map +1 -0
- package/dist/components/hooks/useControlledState.d.ts +1 -0
- package/dist/components/hooks/useControlledState.d.ts.map +1 -1
- package/dist/components/hooks/useControlledState.js +16 -16
- package/dist/components/hooks/useControlledState.js.map +1 -1
- package/dist/components/hooks/useTransitionStatus.js +2 -2
- package/dist/components/hooks/useTransitionStatus.js.map +1 -1
- package/dist/components/icon-button/style.css +1 -1
- package/dist/components/nav/index.d.ts.map +1 -1
- package/dist/components/nav/item.d.ts +1 -1
- package/dist/components/nav/item.d.ts.map +1 -1
- package/dist/components/nav/item.js +1 -1
- package/dist/components/nav/item.js.map +1 -1
- package/dist/components/popup-panel/component.d.ts +4 -4
- package/dist/components/popup-panel/component.d.ts.map +1 -1
- package/dist/components/popup-panel/component.js +142 -152
- package/dist/components/popup-panel/component.js.map +1 -1
- package/dist/components/resizable/component.js +1 -1
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/components/scroll-area/component.d.ts +1 -1
- package/dist/components/scroll-area/component.d.ts.map +1 -1
- package/dist/components/scroll-area/component.js +1 -1
- package/dist/components/scroll-area/component.js.map +1 -1
- package/dist/components/select/component.d.ts.map +1 -1
- package/dist/components/select/component.js +153 -138
- package/dist/components/select/component.js.map +1 -1
- package/dist/components/select/item.js +13 -13
- package/dist/components/select-trigger/component.js +19 -19
- package/dist/components/splitter/splitter.d.ts.map +1 -1
- package/dist/components/splitter/splitter.js +53 -51
- package/dist/components/splitter/splitter.js.map +1 -1
- package/dist/components/stack/StackChild.js +2 -2
- package/dist/components/stack/StackChild.js.map +1 -1
- package/dist/components/toast/component.d.ts +1 -1
- package/dist/components/toast/component.d.ts.map +1 -1
- package/dist/components/toast/component.js +1 -1
- package/dist/components/toast/component.js.map +1 -1
- package/dist/components/toast/function.d.ts +2 -2
- package/dist/components/toast/function.d.ts.map +1 -1
- package/dist/components/toast/function.js +1 -1
- package/dist/components/toast/function.js.map +1 -1
- package/dist/components/transition/component.d.ts +1 -1
- package/dist/components/transition/component.d.ts.map +1 -1
- package/dist/components/transition/component.js +2 -2
- package/dist/components/transition/component.js.map +1 -1
- package/dist/components/tree/useTreeCommon.d.ts.map +1 -1
- package/dist/components/utils/WithRenderProp.d.ts +1 -1
- package/dist/components/utils/WithRenderProp.d.ts.map +1 -1
- package/dist/components/utils/WithRenderProp.js +1 -1
- package/dist/components/utils/WithRenderProp.js.map +1 -1
- package/dist/components/utils/index.d.ts +1 -0
- package/dist/components/utils/index.d.ts.map +1 -1
- package/dist/components/utils/renderProp.d.ts +24 -0
- package/dist/components/utils/renderProp.d.ts.map +1 -0
- package/dist/components/utils/renderProp.js +19 -0
- package/dist/components/utils/renderProp.js.map +1 -0
- package/dist/components/vertical-collapsible-panel/component.js +1 -1
- package/dist/components/vertical-collapsible-panel/component.js.map +1 -1
- package/dist/index.js +162 -158
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +14 -14
- package/dist/metadata.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/tailwind.css +125 -1
- package/package.json +4 -4
- package/dist/components/cmdk/command-score.d.ts +0 -2
- package/dist/components/cmdk/command-score.d.ts.map +0 -1
- package/dist/components/cmdk/command-score.js +0 -48
- package/dist/components/cmdk/command-score.js.map +0 -1
- package/dist/components/cmdk/index.d.ts +0 -440
- package/dist/components/cmdk/index.d.ts.map +0 -1
- package/dist/components/cmdk/index.js +0 -595
- package/dist/components/cmdk/index.js.map +0 -1
|
@@ -1,595 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs as Z, jsx as g } from "react/jsx-runtime";
|
|
3
|
-
import s, { useId as M } from "react";
|
|
4
|
-
import { Dialog as F } from "@base-ui-components/react";
|
|
5
|
-
import { commandScore as pe } from "./command-score.js";
|
|
6
|
-
import O from "merge-refs";
|
|
7
|
-
import { WithRenderProp as y } from "../utils/WithRenderProp.js";
|
|
8
|
-
const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', be = '[cmdk-group-heading=""]', le = '[cmdk-item=""]', ie = `${le}:not([aria-disabled="true"])`, Y = "cmdk-item-select", _ = "data-value", Se = (t, n, r) => pe(t, n, r), ue = s.createContext(void 0), B = () => s.useContext(ue), ae = s.createContext(void 0), ee = () => s.useContext(ae), de = s.createContext(void 0), fe = s.forwardRef(
|
|
9
|
-
(t, n) => {
|
|
10
|
-
const r = L(() => ({
|
|
11
|
-
/** Value of the search query. */
|
|
12
|
-
search: "",
|
|
13
|
-
/** Currently selected item value. */
|
|
14
|
-
value: t.value ?? t.defaultValue ?? "",
|
|
15
|
-
/** Currently selected item id. */
|
|
16
|
-
selectedItemId: void 0,
|
|
17
|
-
filtered: {
|
|
18
|
-
/** The count of all visible items. */
|
|
19
|
-
count: 0,
|
|
20
|
-
/** Map from visible item id to its search score. */
|
|
21
|
-
items: /* @__PURE__ */ new Map(),
|
|
22
|
-
/** Set of groups with at least one visible item. */
|
|
23
|
-
groups: /* @__PURE__ */ new Set()
|
|
24
|
-
}
|
|
25
|
-
})), u = L(() => /* @__PURE__ */ new Set()), i = L(() => /* @__PURE__ */ new Map()), a = L(
|
|
26
|
-
() => /* @__PURE__ */ new Map()
|
|
27
|
-
), d = L(() => /* @__PURE__ */ new Set()), m = me(t), {
|
|
28
|
-
label: f,
|
|
29
|
-
children: h,
|
|
30
|
-
value: b,
|
|
31
|
-
onValueChange: I,
|
|
32
|
-
filter: C,
|
|
33
|
-
shouldFilter: E,
|
|
34
|
-
loop: P,
|
|
35
|
-
disablePointerSelection: ve = !1,
|
|
36
|
-
vimBindings: K = !0,
|
|
37
|
-
...N
|
|
38
|
-
} = t, $ = M(), j = M(), p = M(), D = s.useRef(null), R = Le();
|
|
39
|
-
k(() => {
|
|
40
|
-
if (b !== void 0) {
|
|
41
|
-
const e = b.trim();
|
|
42
|
-
r.current.value = e, S.emit();
|
|
43
|
-
}
|
|
44
|
-
}, [b]), k(() => {
|
|
45
|
-
R(6, re);
|
|
46
|
-
}, []);
|
|
47
|
-
const S = s.useMemo(() => ({
|
|
48
|
-
subscribe: (e) => (d.current.add(e), () => d.current.delete(e)),
|
|
49
|
-
snapshot: () => r.current,
|
|
50
|
-
setState: (e, l, o) => {
|
|
51
|
-
if (!Object.is(r.current[e], l)) {
|
|
52
|
-
if (r.current[e] = l, e === "search")
|
|
53
|
-
H(), U(), R(1, z);
|
|
54
|
-
else if (e === "value") {
|
|
55
|
-
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
56
|
-
const c = document.getElementById(p);
|
|
57
|
-
c ? c.focus() : document.getElementById($)?.focus();
|
|
58
|
-
}
|
|
59
|
-
if (R(7, () => {
|
|
60
|
-
r.current.selectedItemId = A()?.id, S.emit();
|
|
61
|
-
}), o || R(5, re), m.current?.value !== void 0) {
|
|
62
|
-
const c = l ?? "";
|
|
63
|
-
m.current.onValueChange?.(c);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
S.emit();
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
emit: () => {
|
|
71
|
-
d.current.forEach((e) => e());
|
|
72
|
-
}
|
|
73
|
-
}), []), q = s.useMemo(
|
|
74
|
-
() => ({
|
|
75
|
-
// Keep id → {value, keywords} mapping up-to-date
|
|
76
|
-
value: (e, l, o) => {
|
|
77
|
-
l !== a.current.get(e)?.value && (a.current.set(e, { value: l, keywords: o }), r.current.filtered.items.set(e, te(l, o)), R(2, () => {
|
|
78
|
-
U(), S.emit();
|
|
79
|
-
}));
|
|
80
|
-
},
|
|
81
|
-
// Track item lifecycle (mount, unmount)
|
|
82
|
-
item: (e, l) => (u.current.add(e), l && (i.current.has(l) ? i.current.get(l).add(e) : i.current.set(l, /* @__PURE__ */ new Set([e]))), R(3, () => {
|
|
83
|
-
H(), U(), r.current.value || z(), S.emit();
|
|
84
|
-
}), () => {
|
|
85
|
-
a.current.delete(e), u.current.delete(e), r.current.filtered.items.delete(e);
|
|
86
|
-
const o = A();
|
|
87
|
-
R(4, () => {
|
|
88
|
-
H(), o?.getAttribute("id") === e && z(), S.emit();
|
|
89
|
-
});
|
|
90
|
-
}),
|
|
91
|
-
// Track group lifecycle (mount, unmount)
|
|
92
|
-
group: (e) => (i.current.has(e) || i.current.set(e, /* @__PURE__ */ new Set()), () => {
|
|
93
|
-
a.current.delete(e), i.current.delete(e);
|
|
94
|
-
}),
|
|
95
|
-
filter: () => m.current.shouldFilter,
|
|
96
|
-
label: f || t["aria-label"],
|
|
97
|
-
getDisablePointerSelection: () => m.current.disablePointerSelection,
|
|
98
|
-
listId: $,
|
|
99
|
-
inputId: p,
|
|
100
|
-
labelId: j,
|
|
101
|
-
listInnerRef: D
|
|
102
|
-
}),
|
|
103
|
-
[]
|
|
104
|
-
);
|
|
105
|
-
function te(e, l) {
|
|
106
|
-
const o = m.current?.filter ?? Se;
|
|
107
|
-
return e ? o(e, r.current.search, l) : 0;
|
|
108
|
-
}
|
|
109
|
-
function U() {
|
|
110
|
-
if (!r.current.search || // Explicitly false, because true | undefined is the default
|
|
111
|
-
m.current.shouldFilter === !1)
|
|
112
|
-
return;
|
|
113
|
-
const e = r.current.filtered.items, l = [];
|
|
114
|
-
r.current.filtered.groups.forEach((c) => {
|
|
115
|
-
const v = i.current.get(c);
|
|
116
|
-
let x = 0;
|
|
117
|
-
v.forEach((Q) => {
|
|
118
|
-
const ge = e.get(Q);
|
|
119
|
-
x = Math.max(ge, x);
|
|
120
|
-
}), l.push([c, x]);
|
|
121
|
-
});
|
|
122
|
-
const o = D.current;
|
|
123
|
-
V().sort((c, v) => {
|
|
124
|
-
const x = c.getAttribute("id"), Q = v.getAttribute("id");
|
|
125
|
-
return (e.get(Q) ?? 0) - (e.get(x) ?? 0);
|
|
126
|
-
}).forEach((c) => {
|
|
127
|
-
const v = c.closest(X);
|
|
128
|
-
v ? v.appendChild(
|
|
129
|
-
c.parentElement === v ? c : c.closest(`${X} > *`)
|
|
130
|
-
) : o.appendChild(
|
|
131
|
-
c.parentElement === o ? c : c.closest(`${X} > *`)
|
|
132
|
-
);
|
|
133
|
-
}), l.sort((c, v) => v[1] - c[1]).forEach((c) => {
|
|
134
|
-
const v = D.current?.querySelector(
|
|
135
|
-
`${T}[${_}="${encodeURIComponent(c[0])}"]`
|
|
136
|
-
);
|
|
137
|
-
v?.parentElement.appendChild(v);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
function z() {
|
|
141
|
-
const l = V().find(
|
|
142
|
-
(o) => o.getAttribute("aria-disabled") !== "true"
|
|
143
|
-
)?.getAttribute(_);
|
|
144
|
-
S.setState("value", l || void 0);
|
|
145
|
-
}
|
|
146
|
-
function H() {
|
|
147
|
-
if (!r.current.search || // Explicitly false, because true | undefined is the default
|
|
148
|
-
m.current.shouldFilter === !1) {
|
|
149
|
-
r.current.filtered.count = u.current.size;
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
r.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
153
|
-
let e = 0;
|
|
154
|
-
for (const l of u.current) {
|
|
155
|
-
const o = a.current.get(l)?.value ?? "", c = a.current.get(l)?.keywords ?? [], v = te(o, c);
|
|
156
|
-
r.current.filtered.items.set(l, v), v > 0 && e++;
|
|
157
|
-
}
|
|
158
|
-
for (const [l, o] of i.current)
|
|
159
|
-
for (const c of o)
|
|
160
|
-
if (r.current.filtered.items.get(c) > 0) {
|
|
161
|
-
r.current.filtered.groups.add(l);
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
r.current.filtered.count = e;
|
|
165
|
-
}
|
|
166
|
-
function re() {
|
|
167
|
-
const e = A();
|
|
168
|
-
e && (e.parentElement?.firstChild === e && e.closest(T)?.querySelector(be)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
|
|
169
|
-
}
|
|
170
|
-
function A() {
|
|
171
|
-
return D.current?.querySelector(
|
|
172
|
-
`${le}[aria-selected="true"]`
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
function V() {
|
|
176
|
-
return Array.from(
|
|
177
|
-
D.current?.querySelectorAll(ie) || []
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
function W(e) {
|
|
181
|
-
const o = V()[e];
|
|
182
|
-
o && S.setState("value", o.getAttribute(_));
|
|
183
|
-
}
|
|
184
|
-
function J(e) {
|
|
185
|
-
const l = A(), o = V(), c = o.findIndex((x) => x === l);
|
|
186
|
-
let v = o[c + e];
|
|
187
|
-
m.current?.loop && (v = c + e < 0 ? o[o.length - 1] : c + e === o.length ? o[0] : o[c + e]), v && S.setState("value", v.getAttribute(_));
|
|
188
|
-
}
|
|
189
|
-
function ne(e) {
|
|
190
|
-
let o = A()?.closest(T), c;
|
|
191
|
-
for (; o && !c; )
|
|
192
|
-
o = e > 0 ? Ae(o, T) : _e(o, T), c = o?.querySelector(ie);
|
|
193
|
-
c ? S.setState("value", c.getAttribute(_)) : J(e);
|
|
194
|
-
}
|
|
195
|
-
const oe = () => W(V().length - 1), ce = (e) => {
|
|
196
|
-
e.preventDefault(), e.metaKey ? oe() : e.altKey ? ne(1) : J(1);
|
|
197
|
-
}, se = (e) => {
|
|
198
|
-
e.preventDefault(), e.metaKey ? W(0) : e.altKey ? ne(-1) : J(-1);
|
|
199
|
-
};
|
|
200
|
-
return /* @__PURE__ */ Z(
|
|
201
|
-
y,
|
|
202
|
-
{
|
|
203
|
-
ref: n,
|
|
204
|
-
tabIndex: -1,
|
|
205
|
-
...N,
|
|
206
|
-
"cmdk-root": "",
|
|
207
|
-
onKeyDown: (e) => {
|
|
208
|
-
N.onKeyDown?.(e);
|
|
209
|
-
const l = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
210
|
-
if (!(e.defaultPrevented || l))
|
|
211
|
-
switch (e.key) {
|
|
212
|
-
case "n":
|
|
213
|
-
case "j": {
|
|
214
|
-
K && e.ctrlKey && ce(e);
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
case "ArrowDown": {
|
|
218
|
-
ce(e);
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
case "p":
|
|
222
|
-
case "k": {
|
|
223
|
-
K && e.ctrlKey && se(e);
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
|
-
case "ArrowUp": {
|
|
227
|
-
se(e);
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
case "Home": {
|
|
231
|
-
e.preventDefault(), W(0);
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
case "End": {
|
|
235
|
-
e.preventDefault(), oe();
|
|
236
|
-
break;
|
|
237
|
-
}
|
|
238
|
-
case "Enter": {
|
|
239
|
-
e.preventDefault();
|
|
240
|
-
const o = A();
|
|
241
|
-
if (o) {
|
|
242
|
-
const c = new Event(Y);
|
|
243
|
-
o.dispatchEvent(c);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ g(
|
|
250
|
-
"label",
|
|
251
|
-
{
|
|
252
|
-
"cmdk-label": "",
|
|
253
|
-
htmlFor: q.inputId,
|
|
254
|
-
id: q.labelId,
|
|
255
|
-
style: Pe,
|
|
256
|
-
children: f
|
|
257
|
-
}
|
|
258
|
-
),
|
|
259
|
-
G(t, (e) => /* @__PURE__ */ g(ae.Provider, { value: S, children: /* @__PURE__ */ g(ue.Provider, { value: q, children: e }) }))
|
|
260
|
-
]
|
|
261
|
-
}
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
), Ee = s.forwardRef(
|
|
265
|
-
(t, n) => {
|
|
266
|
-
const r = M(), u = s.useRef(null), i = s.useContext(de), a = B(), d = me(t), m = d.current?.forceMount ?? i?.forceMount;
|
|
267
|
-
k(() => {
|
|
268
|
-
if (!m)
|
|
269
|
-
return a.item(r, i?.id);
|
|
270
|
-
}, [m]);
|
|
271
|
-
const f = he(
|
|
272
|
-
r,
|
|
273
|
-
u,
|
|
274
|
-
[t.value, t.children, u],
|
|
275
|
-
t.keywords
|
|
276
|
-
), h = ee(), b = w(
|
|
277
|
-
(p) => p.value && p.value === f.current
|
|
278
|
-
), I = w(
|
|
279
|
-
(p) => m || a.filter() === !1 ? !0 : p.search ? p.filtered.items.get(r) > 0 : !0
|
|
280
|
-
);
|
|
281
|
-
s.useEffect(() => {
|
|
282
|
-
const p = u.current;
|
|
283
|
-
if (!(!p || t.disabled))
|
|
284
|
-
return p.addEventListener(Y, C), () => p.removeEventListener(Y, C);
|
|
285
|
-
}, [I, t.onSelect, t.disabled]);
|
|
286
|
-
function C() {
|
|
287
|
-
E(), d.current.onSelect?.(f.current);
|
|
288
|
-
}
|
|
289
|
-
function E() {
|
|
290
|
-
h.setState("value", f.current, !0);
|
|
291
|
-
}
|
|
292
|
-
if (!I) return null;
|
|
293
|
-
const {
|
|
294
|
-
disabled: P,
|
|
295
|
-
value: ve,
|
|
296
|
-
onSelect: K,
|
|
297
|
-
forceMount: N,
|
|
298
|
-
keywords: $,
|
|
299
|
-
...j
|
|
300
|
-
} = t;
|
|
301
|
-
return /* @__PURE__ */ g(
|
|
302
|
-
y,
|
|
303
|
-
{
|
|
304
|
-
ref: O(u, n),
|
|
305
|
-
...j,
|
|
306
|
-
id: r,
|
|
307
|
-
"cmdk-item": "",
|
|
308
|
-
role: "option",
|
|
309
|
-
"aria-disabled": !!P,
|
|
310
|
-
"aria-selected": !!b,
|
|
311
|
-
"data-disabled": !!P,
|
|
312
|
-
"data-selected": !!b,
|
|
313
|
-
onPointerMove: P || a.getDisablePointerSelection() ? void 0 : E,
|
|
314
|
-
onClick: P ? void 0 : C,
|
|
315
|
-
children: t.children
|
|
316
|
-
}
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
), Ce = s.forwardRef(
|
|
320
|
-
(t, n) => {
|
|
321
|
-
const { heading: r, children: u, forceMount: i, ...a } = t, d = M(), m = s.useRef(null), f = s.useRef(null), h = M(), b = B(), I = w(
|
|
322
|
-
(E) => i || b.filter() === !1 ? !0 : E.search ? E.filtered.groups.has(d) : !0
|
|
323
|
-
);
|
|
324
|
-
k(() => b.group(d), []), he(d, m, [t.value, t.heading, f]);
|
|
325
|
-
const C = s.useMemo(
|
|
326
|
-
() => ({ id: d, forceMount: i }),
|
|
327
|
-
[i]
|
|
328
|
-
);
|
|
329
|
-
return /* @__PURE__ */ Z(
|
|
330
|
-
y,
|
|
331
|
-
{
|
|
332
|
-
ref: O(m, n),
|
|
333
|
-
...a,
|
|
334
|
-
"cmdk-group": "",
|
|
335
|
-
role: "presentation",
|
|
336
|
-
hidden: I ? void 0 : !0,
|
|
337
|
-
children: [
|
|
338
|
-
r && /* @__PURE__ */ g(
|
|
339
|
-
"div",
|
|
340
|
-
{
|
|
341
|
-
ref: f,
|
|
342
|
-
"cmdk-group-heading": "",
|
|
343
|
-
"aria-hidden": !0,
|
|
344
|
-
id: h,
|
|
345
|
-
children: r
|
|
346
|
-
}
|
|
347
|
-
),
|
|
348
|
-
G(t, (E) => /* @__PURE__ */ g(
|
|
349
|
-
"div",
|
|
350
|
-
{
|
|
351
|
-
"cmdk-group-items": "",
|
|
352
|
-
role: "group",
|
|
353
|
-
"aria-labelledby": r ? h : void 0,
|
|
354
|
-
children: /* @__PURE__ */ g(de.Provider, { value: C, children: E })
|
|
355
|
-
}
|
|
356
|
-
))
|
|
357
|
-
]
|
|
358
|
-
}
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
), Ie = s.forwardRef(
|
|
362
|
-
(t, n) => {
|
|
363
|
-
const { alwaysRender: r, ...u } = t, i = s.useRef(null), a = w((d) => !d.search);
|
|
364
|
-
return !r && !a ? null : /* @__PURE__ */ g(
|
|
365
|
-
y,
|
|
366
|
-
{
|
|
367
|
-
ref: O(i, n),
|
|
368
|
-
...u,
|
|
369
|
-
"cmdk-separator": "",
|
|
370
|
-
role: "separator"
|
|
371
|
-
}
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
), we = s.forwardRef(
|
|
375
|
-
(t, n) => {
|
|
376
|
-
const { onValueChange: r, ...u } = t, i = t.value != null, a = ee(), d = w((h) => h.search), m = w((h) => h.selectedItemId), f = B();
|
|
377
|
-
return s.useEffect(() => {
|
|
378
|
-
t.value != null && a.setState("search", t.value);
|
|
379
|
-
}, [t.value]), /* @__PURE__ */ g(
|
|
380
|
-
y,
|
|
381
|
-
{
|
|
382
|
-
as: "input",
|
|
383
|
-
ref: n,
|
|
384
|
-
...u,
|
|
385
|
-
"cmdk-input": "",
|
|
386
|
-
autoComplete: "off",
|
|
387
|
-
autoCorrect: "off",
|
|
388
|
-
spellCheck: !1,
|
|
389
|
-
"aria-autocomplete": "list",
|
|
390
|
-
role: "combobox",
|
|
391
|
-
"aria-expanded": !0,
|
|
392
|
-
"aria-controls": f.listId,
|
|
393
|
-
"aria-labelledby": f.labelId,
|
|
394
|
-
"aria-activedescendant": m,
|
|
395
|
-
id: f.inputId,
|
|
396
|
-
type: "text",
|
|
397
|
-
value: i ? t.value : d,
|
|
398
|
-
onChange: (h) => {
|
|
399
|
-
i || a.setState("search", h.target.value), r?.(h.target.value);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
), ye = s.forwardRef(
|
|
405
|
-
(t, n) => {
|
|
406
|
-
const { children: r, label: u = "Suggestions", ...i } = t, a = s.useRef(null), d = s.useRef(null), m = w((h) => h.selectedItemId), f = B();
|
|
407
|
-
return s.useEffect(() => {
|
|
408
|
-
if (d.current && a.current) {
|
|
409
|
-
const h = d.current, b = a.current;
|
|
410
|
-
let I;
|
|
411
|
-
const C = new ResizeObserver(() => {
|
|
412
|
-
I = requestAnimationFrame(() => {
|
|
413
|
-
const E = h.offsetHeight;
|
|
414
|
-
b.style.setProperty(
|
|
415
|
-
"--cmdk-list-height",
|
|
416
|
-
E.toFixed(1) + "px"
|
|
417
|
-
);
|
|
418
|
-
});
|
|
419
|
-
});
|
|
420
|
-
return C.observe(h), () => {
|
|
421
|
-
cancelAnimationFrame(I), C.unobserve(h);
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
}, []), /* @__PURE__ */ g(
|
|
425
|
-
y,
|
|
426
|
-
{
|
|
427
|
-
ref: O(a, n),
|
|
428
|
-
...i,
|
|
429
|
-
"cmdk-list": "",
|
|
430
|
-
role: "listbox",
|
|
431
|
-
tabIndex: -1,
|
|
432
|
-
"aria-activedescendant": m,
|
|
433
|
-
"aria-label": u,
|
|
434
|
-
id: f.listId,
|
|
435
|
-
children: G(t, (h) => /* @__PURE__ */ g(
|
|
436
|
-
"div",
|
|
437
|
-
{
|
|
438
|
-
ref: O(d, f.listInnerRef),
|
|
439
|
-
"cmdk-list-sizer": "",
|
|
440
|
-
children: h
|
|
441
|
-
}
|
|
442
|
-
))
|
|
443
|
-
}
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
), Re = s.forwardRef(
|
|
447
|
-
(t, n) => {
|
|
448
|
-
const {
|
|
449
|
-
open: r,
|
|
450
|
-
onOpenChange: u,
|
|
451
|
-
overlayClassName: i,
|
|
452
|
-
contentClassName: a,
|
|
453
|
-
container: d,
|
|
454
|
-
...m
|
|
455
|
-
} = t;
|
|
456
|
-
return /* @__PURE__ */ g(F.Root, { open: r, onOpenChange: u, children: /* @__PURE__ */ Z(F.Portal, { container: d, children: [
|
|
457
|
-
/* @__PURE__ */ g(F.Backdrop, { "cmdk-overlay": "", className: i }),
|
|
458
|
-
/* @__PURE__ */ g(
|
|
459
|
-
F.Popup,
|
|
460
|
-
{
|
|
461
|
-
"aria-label": t.label,
|
|
462
|
-
"cmdk-dialog": "",
|
|
463
|
-
className: a,
|
|
464
|
-
children: /* @__PURE__ */ g(fe, { ref: n, ...m })
|
|
465
|
-
}
|
|
466
|
-
)
|
|
467
|
-
] }) });
|
|
468
|
-
}
|
|
469
|
-
), xe = s.forwardRef(
|
|
470
|
-
(t, n) => w((u) => u.filtered.count === 0) ? /* @__PURE__ */ g(
|
|
471
|
-
y,
|
|
472
|
-
{
|
|
473
|
-
ref: n,
|
|
474
|
-
...t,
|
|
475
|
-
"cmdk-empty": "",
|
|
476
|
-
role: "presentation"
|
|
477
|
-
}
|
|
478
|
-
) : null
|
|
479
|
-
), ke = s.forwardRef(
|
|
480
|
-
(t, n) => {
|
|
481
|
-
const { progress: r, children: u, label: i = "Loading...", ...a } = t;
|
|
482
|
-
return /* @__PURE__ */ g(
|
|
483
|
-
y,
|
|
484
|
-
{
|
|
485
|
-
ref: n,
|
|
486
|
-
...a,
|
|
487
|
-
"cmdk-loading": "",
|
|
488
|
-
role: "progressbar",
|
|
489
|
-
"aria-valuenow": r,
|
|
490
|
-
"aria-valuemin": 0,
|
|
491
|
-
"aria-valuemax": 100,
|
|
492
|
-
"aria-label": i,
|
|
493
|
-
children: G(t, (d) => /* @__PURE__ */ g("div", { "aria-hidden": !0, children: d }))
|
|
494
|
-
}
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
), Ge = Object.assign(fe, {
|
|
498
|
-
List: ye,
|
|
499
|
-
Item: Ee,
|
|
500
|
-
Input: we,
|
|
501
|
-
Group: Ce,
|
|
502
|
-
Separator: Ie,
|
|
503
|
-
Dialog: Re,
|
|
504
|
-
Empty: xe,
|
|
505
|
-
Loading: ke
|
|
506
|
-
});
|
|
507
|
-
function Ae(t, n) {
|
|
508
|
-
let r = t.nextElementSibling;
|
|
509
|
-
for (; r; ) {
|
|
510
|
-
if (r.matches(n)) return r;
|
|
511
|
-
r = r.nextElementSibling;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
function _e(t, n) {
|
|
515
|
-
let r = t.previousElementSibling;
|
|
516
|
-
for (; r; ) {
|
|
517
|
-
if (r.matches(n)) return r;
|
|
518
|
-
r = r.previousElementSibling;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
function me(t) {
|
|
522
|
-
const n = s.useRef(t);
|
|
523
|
-
return k(() => {
|
|
524
|
-
n.current = t;
|
|
525
|
-
}), n;
|
|
526
|
-
}
|
|
527
|
-
const k = typeof window > "u" ? s.useEffect : s.useLayoutEffect;
|
|
528
|
-
function L(t) {
|
|
529
|
-
const n = s.useRef(void 0);
|
|
530
|
-
return n.current === void 0 && (n.current = t()), n;
|
|
531
|
-
}
|
|
532
|
-
function w(t) {
|
|
533
|
-
const n = ee(), r = () => t(n.snapshot());
|
|
534
|
-
return s.useSyncExternalStore(n.subscribe, r, r);
|
|
535
|
-
}
|
|
536
|
-
function he(t, n, r, u = []) {
|
|
537
|
-
const i = s.useRef(void 0), a = B();
|
|
538
|
-
return k(() => {
|
|
539
|
-
const d = (() => {
|
|
540
|
-
for (const f of r) {
|
|
541
|
-
if (typeof f == "string")
|
|
542
|
-
return f.trim();
|
|
543
|
-
if (typeof f == "object" && "current" in f)
|
|
544
|
-
return f.current ? f.current.textContent?.trim() : i.current;
|
|
545
|
-
}
|
|
546
|
-
})(), m = u.map((f) => f.trim());
|
|
547
|
-
a.value(t, d, m), n.current?.setAttribute(_, d), i.current = d;
|
|
548
|
-
}), i;
|
|
549
|
-
}
|
|
550
|
-
const Le = () => {
|
|
551
|
-
const [t, n] = s.useState(), r = L(() => /* @__PURE__ */ new Map());
|
|
552
|
-
return k(() => {
|
|
553
|
-
r.current.forEach((u) => u()), r.current = /* @__PURE__ */ new Map();
|
|
554
|
-
}, [t]), (u, i) => {
|
|
555
|
-
r.current.set(u, i), n({});
|
|
556
|
-
};
|
|
557
|
-
};
|
|
558
|
-
function Me(t) {
|
|
559
|
-
const n = t.type;
|
|
560
|
-
return typeof n == "function" ? n(t.props) : "render" in n ? n.render(t.props) : t;
|
|
561
|
-
}
|
|
562
|
-
function G({ asChild: t, children: n }, r) {
|
|
563
|
-
return t && s.isValidElement(n) ? s.cloneElement(
|
|
564
|
-
Me(n),
|
|
565
|
-
{ ref: n.ref },
|
|
566
|
-
// @ts-expect-error expect error here
|
|
567
|
-
r(n.props.children)
|
|
568
|
-
) : r(n);
|
|
569
|
-
}
|
|
570
|
-
const Pe = {
|
|
571
|
-
position: "absolute",
|
|
572
|
-
width: "1px",
|
|
573
|
-
height: "1px",
|
|
574
|
-
padding: "0",
|
|
575
|
-
margin: "-1px",
|
|
576
|
-
overflow: "hidden",
|
|
577
|
-
clip: "rect(0, 0, 0, 0)",
|
|
578
|
-
whiteSpace: "nowrap",
|
|
579
|
-
borderWidth: "0"
|
|
580
|
-
};
|
|
581
|
-
export {
|
|
582
|
-
Ge as Command,
|
|
583
|
-
Re as CommandDialog,
|
|
584
|
-
xe as CommandEmpty,
|
|
585
|
-
Ce as CommandGroup,
|
|
586
|
-
we as CommandInput,
|
|
587
|
-
Ee as CommandItem,
|
|
588
|
-
ye as CommandList,
|
|
589
|
-
ke as CommandLoading,
|
|
590
|
-
fe as CommandRoot,
|
|
591
|
-
Ie as CommandSeparator,
|
|
592
|
-
Se as defaultFilter,
|
|
593
|
-
w as useCommandState
|
|
594
|
-
};
|
|
595
|
-
//# sourceMappingURL=index.js.map
|