@adamosuiteservices/ui 2.15.1 → 2.16.0
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/combobox-BalI1GHE.cjs +40 -0
- package/dist/combobox-CtSJw4m1.js +614 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/components/ui/combobox/combobox.d.ts +5 -1
- package/dist/date-picker-selector.cjs +1 -1
- package/dist/date-picker-selector.js +1 -1
- package/docs/components/ui/combobox.md +98 -3
- package/package.json +1 -1
- package/dist/combobox-DGuQtXjP.js +0 -608
- package/dist/combobox-hTCtPMUL.cjs +0 -40
|
@@ -1,608 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { j as p } from "./jsx-runtime-BzflLqGi.js";
|
|
3
|
-
import { B as je } from "./button-B0lWuG-D.js";
|
|
4
|
-
import { C as Ce } from "./checkbox-B-Lu1-qJ.js";
|
|
5
|
-
import { I as Q } from "./icon-DKAhvlX_.js";
|
|
6
|
-
import { c as N } from "./index-CRiPKpXj.js";
|
|
7
|
-
import * as l from "react";
|
|
8
|
-
import { useRef as Re, useState as pe } from "react";
|
|
9
|
-
import { R as Ae, P as Ne, O as $e, a as Me } from "./index-BIydBVaH.js";
|
|
10
|
-
import { P } from "./index-BMWt1NBG.js";
|
|
11
|
-
import { u as W } from "./index-Cv867SGx.js";
|
|
12
|
-
import { c as Z } from "./index-DLcqcWxM.js";
|
|
13
|
-
import { P as Le, a as Pe, b as De } from "./popover-DcQ18EVl.js";
|
|
14
|
-
var he = 1, Fe = 0.9, Oe = 0.8, Ve = 0.17, ie = 0.1, ue = 0.999, Ke = 0.9999, Te = 0.99, qe = /[\\\/_+.#"@\[\(\{&]/, ze = /[\\\/_+.#"@\[\(\{&]/g, Be = /[\s-]/, be = /[\s-]/g;
|
|
15
|
-
function se(e, a, r, h, d, c, f) {
|
|
16
|
-
if (c === a.length) return d === e.length ? he : Te;
|
|
17
|
-
var m = `${d},${c}`;
|
|
18
|
-
if (f[m] !== void 0) return f[m];
|
|
19
|
-
for (var x = h.charAt(c), i = r.indexOf(x, d), b = 0, u, w, I, R; i >= 0; ) u = se(e, a, r, h, i + 1, c + 1, f), u > b && (i === d ? u *= he : qe.test(e.charAt(i - 1)) ? (u *= Oe, I = e.slice(d, i - 1).match(ze), I && d > 0 && (u *= Math.pow(ue, I.length))) : Be.test(e.charAt(i - 1)) ? (u *= Fe, R = e.slice(d, i - 1).match(be), R && d > 0 && (u *= Math.pow(ue, R.length))) : (u *= Ve, d > 0 && (u *= Math.pow(ue, i - d))), e.charAt(i) !== a.charAt(c) && (u *= Ke)), (u < ie && r.charAt(i - 1) === h.charAt(c + 1) || h.charAt(c + 1) === h.charAt(c) && r.charAt(i - 1) !== h.charAt(c)) && (w = se(e, a, r, h, i + 1, c + 2, f), w * ie > u && (u = w * ie)), u > b && (b = u), i = r.indexOf(x, i + 1);
|
|
20
|
-
return f[m] = b, b;
|
|
21
|
-
}
|
|
22
|
-
function ve(e) {
|
|
23
|
-
return e.toLowerCase().replace(be, " ");
|
|
24
|
-
}
|
|
25
|
-
function _e(e, a, r) {
|
|
26
|
-
return e = r && r.length > 0 ? `${e + " " + r.join(" ")}` : e, se(e, a, ve(e), ve(a), 0, 0, {});
|
|
27
|
-
}
|
|
28
|
-
var Y = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', We = '[cmdk-group-heading=""]', xe = '[cmdk-item=""]', ge = `${xe}:not([aria-disabled="true"])`, me = "cmdk-item-select", B = "data-value", Ge = (e, a, r) => _e(e, a, r), ye = l.createContext(void 0), ee = () => l.useContext(ye), ke = l.createContext(void 0), fe = () => l.useContext(ke), we = l.createContext(void 0), Se = l.forwardRef((e, a) => {
|
|
29
|
-
let r = _(() => {
|
|
30
|
-
var t, n;
|
|
31
|
-
return { search: "", value: (n = (t = e.value) != null ? t : e.defaultValue) != null ? n : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
|
|
32
|
-
}), h = _(() => /* @__PURE__ */ new Set()), d = _(() => /* @__PURE__ */ new Map()), c = _(() => /* @__PURE__ */ new Map()), f = _(() => /* @__PURE__ */ new Set()), m = Ie(e), { label: x, children: i, value: b, onValueChange: u, filter: w, shouldFilter: I, loop: R, disablePointerSelection: K = !1, vimBindings: C = !0, ...D } = e, U = W(), te = W(), y = W(), $ = l.useRef(null), g = nt();
|
|
33
|
-
V(() => {
|
|
34
|
-
if (b !== void 0) {
|
|
35
|
-
let t = b.trim();
|
|
36
|
-
r.current.value = t, S.emit();
|
|
37
|
-
}
|
|
38
|
-
}, [b]), V(() => {
|
|
39
|
-
g(6, J);
|
|
40
|
-
}, []);
|
|
41
|
-
let S = l.useMemo(() => ({ subscribe: (t) => (f.current.add(t), () => f.current.delete(t)), snapshot: () => r.current, setState: (t, n, s) => {
|
|
42
|
-
var o, v, k, j;
|
|
43
|
-
if (!Object.is(r.current[t], n)) {
|
|
44
|
-
if (r.current[t] = n, t === "search") q(), T(), g(1, H);
|
|
45
|
-
else if (t === "value") {
|
|
46
|
-
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
47
|
-
let E = document.getElementById(y);
|
|
48
|
-
E ? E.focus() : (o = document.getElementById(U)) == null || o.focus();
|
|
49
|
-
}
|
|
50
|
-
if (g(7, () => {
|
|
51
|
-
var E;
|
|
52
|
-
r.current.selectedItemId = (E = A()) == null ? void 0 : E.id, S.emit();
|
|
53
|
-
}), s || g(5, J), ((v = m.current) == null ? void 0 : v.value) !== void 0) {
|
|
54
|
-
let E = n ?? "";
|
|
55
|
-
(j = (k = m.current).onValueChange) == null || j.call(k, E);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
S.emit();
|
|
60
|
-
}
|
|
61
|
-
}, emit: () => {
|
|
62
|
-
f.current.forEach((t) => t());
|
|
63
|
-
} }), []), F = l.useMemo(() => ({ value: (t, n, s) => {
|
|
64
|
-
var o;
|
|
65
|
-
n !== ((o = c.current.get(t)) == null ? void 0 : o.value) && (c.current.set(t, { value: n, keywords: s }), r.current.filtered.items.set(t, M(n, s)), g(2, () => {
|
|
66
|
-
T(), S.emit();
|
|
67
|
-
}));
|
|
68
|
-
}, item: (t, n) => (h.current.add(t), n && (d.current.has(n) ? d.current.get(n).add(t) : d.current.set(n, /* @__PURE__ */ new Set([t]))), g(3, () => {
|
|
69
|
-
q(), T(), r.current.value || H(), S.emit();
|
|
70
|
-
}), () => {
|
|
71
|
-
c.current.delete(t), h.current.delete(t), r.current.filtered.items.delete(t);
|
|
72
|
-
let s = A();
|
|
73
|
-
g(4, () => {
|
|
74
|
-
q(), s?.getAttribute("id") === t && H(), S.emit();
|
|
75
|
-
});
|
|
76
|
-
}), group: (t) => (d.current.has(t) || d.current.set(t, /* @__PURE__ */ new Set()), () => {
|
|
77
|
-
c.current.delete(t), d.current.delete(t);
|
|
78
|
-
}), filter: () => m.current.shouldFilter, label: x || e["aria-label"], getDisablePointerSelection: () => m.current.disablePointerSelection, listId: U, inputId: y, labelId: te, listInnerRef: $ }), []);
|
|
79
|
-
function M(t, n) {
|
|
80
|
-
var s, o;
|
|
81
|
-
let v = (o = (s = m.current) == null ? void 0 : s.filter) != null ? o : Ge;
|
|
82
|
-
return t ? v(t, r.current.search, n) : 0;
|
|
83
|
-
}
|
|
84
|
-
function T() {
|
|
85
|
-
if (!r.current.search || m.current.shouldFilter === !1) return;
|
|
86
|
-
let t = r.current.filtered.items, n = [];
|
|
87
|
-
r.current.filtered.groups.forEach((o) => {
|
|
88
|
-
let v = d.current.get(o), k = 0;
|
|
89
|
-
v.forEach((j) => {
|
|
90
|
-
let E = t.get(j);
|
|
91
|
-
k = Math.max(E, k);
|
|
92
|
-
}), n.push([o, k]);
|
|
93
|
-
});
|
|
94
|
-
let s = $.current;
|
|
95
|
-
O().sort((o, v) => {
|
|
96
|
-
var k, j;
|
|
97
|
-
let E = o.getAttribute("id"), oe = v.getAttribute("id");
|
|
98
|
-
return ((k = t.get(oe)) != null ? k : 0) - ((j = t.get(E)) != null ? j : 0);
|
|
99
|
-
}).forEach((o) => {
|
|
100
|
-
let v = o.closest(ce);
|
|
101
|
-
v ? v.appendChild(o.parentElement === v ? o : o.closest(`${ce} > *`)) : s.appendChild(o.parentElement === s ? o : o.closest(`${ce} > *`));
|
|
102
|
-
}), n.sort((o, v) => v[1] - o[1]).forEach((o) => {
|
|
103
|
-
var v;
|
|
104
|
-
let k = (v = $.current) == null ? void 0 : v.querySelector(`${Y}[${B}="${encodeURIComponent(o[0])}"]`);
|
|
105
|
-
k?.parentElement.appendChild(k);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function H() {
|
|
109
|
-
let t = O().find((s) => s.getAttribute("aria-disabled") !== "true"), n = t?.getAttribute(B);
|
|
110
|
-
S.setState("value", n || void 0);
|
|
111
|
-
}
|
|
112
|
-
function q() {
|
|
113
|
-
var t, n, s, o;
|
|
114
|
-
if (!r.current.search || m.current.shouldFilter === !1) {
|
|
115
|
-
r.current.filtered.count = h.current.size;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
r.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
119
|
-
let v = 0;
|
|
120
|
-
for (let k of h.current) {
|
|
121
|
-
let j = (n = (t = c.current.get(k)) == null ? void 0 : t.value) != null ? n : "", E = (o = (s = c.current.get(k)) == null ? void 0 : s.keywords) != null ? o : [], oe = M(j, E);
|
|
122
|
-
r.current.filtered.items.set(k, oe), oe > 0 && v++;
|
|
123
|
-
}
|
|
124
|
-
for (let [k, j] of d.current) for (let E of j) if (r.current.filtered.items.get(E) > 0) {
|
|
125
|
-
r.current.filtered.groups.add(k);
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
r.current.filtered.count = v;
|
|
129
|
-
}
|
|
130
|
-
function J() {
|
|
131
|
-
var t, n, s;
|
|
132
|
-
let o = A();
|
|
133
|
-
o && (((t = o.parentElement) == null ? void 0 : t.firstChild) === o && ((s = (n = o.closest(Y)) == null ? void 0 : n.querySelector(We)) == null || s.scrollIntoView({ block: "nearest" })), o.scrollIntoView({ block: "nearest" }));
|
|
134
|
-
}
|
|
135
|
-
function A() {
|
|
136
|
-
var t;
|
|
137
|
-
return (t = $.current) == null ? void 0 : t.querySelector(`${xe}[aria-selected="true"]`);
|
|
138
|
-
}
|
|
139
|
-
function O() {
|
|
140
|
-
var t;
|
|
141
|
-
return Array.from(((t = $.current) == null ? void 0 : t.querySelectorAll(ge)) || []);
|
|
142
|
-
}
|
|
143
|
-
function z(t) {
|
|
144
|
-
let n = O()[t];
|
|
145
|
-
n && S.setState("value", n.getAttribute(B));
|
|
146
|
-
}
|
|
147
|
-
function X(t) {
|
|
148
|
-
var n;
|
|
149
|
-
let s = A(), o = O(), v = o.findIndex((j) => j === s), k = o[v + t];
|
|
150
|
-
(n = m.current) != null && n.loop && (k = v + t < 0 ? o[o.length - 1] : v + t === o.length ? o[0] : o[v + t]), k && S.setState("value", k.getAttribute(B));
|
|
151
|
-
}
|
|
152
|
-
function re(t) {
|
|
153
|
-
let n = A(), s = n?.closest(Y), o;
|
|
154
|
-
for (; s && !o; ) s = t > 0 ? tt(s, Y) : rt(s, Y), o = s?.querySelector(ge);
|
|
155
|
-
o ? S.setState("value", o.getAttribute(B)) : X(t);
|
|
156
|
-
}
|
|
157
|
-
let ne = () => z(O().length - 1), ae = (t) => {
|
|
158
|
-
t.preventDefault(), t.metaKey ? ne() : t.altKey ? re(1) : X(1);
|
|
159
|
-
}, le = (t) => {
|
|
160
|
-
t.preventDefault(), t.metaKey ? z(0) : t.altKey ? re(-1) : X(-1);
|
|
161
|
-
};
|
|
162
|
-
return l.createElement(P.div, { ref: a, tabIndex: -1, ...D, "cmdk-root": "", onKeyDown: (t) => {
|
|
163
|
-
var n;
|
|
164
|
-
(n = D.onKeyDown) == null || n.call(D, t);
|
|
165
|
-
let s = t.nativeEvent.isComposing || t.keyCode === 229;
|
|
166
|
-
if (!(t.defaultPrevented || s)) switch (t.key) {
|
|
167
|
-
case "n":
|
|
168
|
-
case "j": {
|
|
169
|
-
C && t.ctrlKey && ae(t);
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
case "ArrowDown": {
|
|
173
|
-
ae(t);
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
case "p":
|
|
177
|
-
case "k": {
|
|
178
|
-
C && t.ctrlKey && le(t);
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
case "ArrowUp": {
|
|
182
|
-
le(t);
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
case "Home": {
|
|
186
|
-
t.preventDefault(), z(0);
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
case "End": {
|
|
190
|
-
t.preventDefault(), ne();
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
case "Enter": {
|
|
194
|
-
t.preventDefault();
|
|
195
|
-
let o = A();
|
|
196
|
-
if (o) {
|
|
197
|
-
let v = new Event(me);
|
|
198
|
-
o.dispatchEvent(v);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
} }, l.createElement("label", { "cmdk-label": "", htmlFor: F.inputId, id: F.labelId, style: lt }, x), de(e, (t) => l.createElement(ke.Provider, { value: S }, l.createElement(ye.Provider, { value: F }, t))));
|
|
203
|
-
}), Ue = l.forwardRef((e, a) => {
|
|
204
|
-
var r, h;
|
|
205
|
-
let d = W(), c = l.useRef(null), f = l.useContext(we), m = ee(), x = Ie(e), i = (h = (r = x.current) == null ? void 0 : r.forceMount) != null ? h : f?.forceMount;
|
|
206
|
-
V(() => {
|
|
207
|
-
if (!i) return m.item(d, f?.id);
|
|
208
|
-
}, [i]);
|
|
209
|
-
let b = Ee(d, c, [e.value, e.children, c], e.keywords), u = fe(), w = L((g) => g.value && g.value === b.current), I = L((g) => i || m.filter() === !1 ? !0 : g.search ? g.filtered.items.get(d) > 0 : !0);
|
|
210
|
-
l.useEffect(() => {
|
|
211
|
-
let g = c.current;
|
|
212
|
-
if (!(!g || e.disabled)) return g.addEventListener(me, R), () => g.removeEventListener(me, R);
|
|
213
|
-
}, [I, e.onSelect, e.disabled]);
|
|
214
|
-
function R() {
|
|
215
|
-
var g, S;
|
|
216
|
-
K(), (S = (g = x.current).onSelect) == null || S.call(g, b.current);
|
|
217
|
-
}
|
|
218
|
-
function K() {
|
|
219
|
-
u.setState("value", b.current, !0);
|
|
220
|
-
}
|
|
221
|
-
if (!I) return null;
|
|
222
|
-
let { disabled: C, value: D, onSelect: U, forceMount: te, keywords: y, ...$ } = e;
|
|
223
|
-
return l.createElement(P.div, { ref: Z(c, a), ...$, id: d, "cmdk-item": "", role: "option", "aria-disabled": !!C, "aria-selected": !!w, "data-disabled": !!C, "data-selected": !!w, onPointerMove: C || m.getDisablePointerSelection() ? void 0 : K, onClick: C ? void 0 : R }, e.children);
|
|
224
|
-
}), He = l.forwardRef((e, a) => {
|
|
225
|
-
let { heading: r, children: h, forceMount: d, ...c } = e, f = W(), m = l.useRef(null), x = l.useRef(null), i = W(), b = ee(), u = L((I) => d || b.filter() === !1 ? !0 : I.search ? I.filtered.groups.has(f) : !0);
|
|
226
|
-
V(() => b.group(f), []), Ee(f, m, [e.value, e.heading, x]);
|
|
227
|
-
let w = l.useMemo(() => ({ id: f, forceMount: d }), [d]);
|
|
228
|
-
return l.createElement(P.div, { ref: Z(m, a), ...c, "cmdk-group": "", role: "presentation", hidden: u ? void 0 : !0 }, r && l.createElement("div", { ref: x, "cmdk-group-heading": "", "aria-hidden": !0, id: i }, r), de(e, (I) => l.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? i : void 0 }, l.createElement(we.Provider, { value: w }, I))));
|
|
229
|
-
}), Je = l.forwardRef((e, a) => {
|
|
230
|
-
let { alwaysRender: r, ...h } = e, d = l.useRef(null), c = L((f) => !f.search);
|
|
231
|
-
return !r && !c ? null : l.createElement(P.div, { ref: Z(d, a), ...h, "cmdk-separator": "", role: "separator" });
|
|
232
|
-
}), Xe = l.forwardRef((e, a) => {
|
|
233
|
-
let { onValueChange: r, ...h } = e, d = e.value != null, c = fe(), f = L((i) => i.search), m = L((i) => i.selectedItemId), x = ee();
|
|
234
|
-
return l.useEffect(() => {
|
|
235
|
-
e.value != null && c.setState("search", e.value);
|
|
236
|
-
}, [e.value]), l.createElement(P.input, { ref: a, ...h, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": x.listId, "aria-labelledby": x.labelId, "aria-activedescendant": m, id: x.inputId, type: "text", value: d ? e.value : f, onChange: (i) => {
|
|
237
|
-
d || c.setState("search", i.target.value), r?.(i.target.value);
|
|
238
|
-
} });
|
|
239
|
-
}), Ye = l.forwardRef((e, a) => {
|
|
240
|
-
let { children: r, label: h = "Suggestions", ...d } = e, c = l.useRef(null), f = l.useRef(null), m = L((i) => i.selectedItemId), x = ee();
|
|
241
|
-
return l.useEffect(() => {
|
|
242
|
-
if (f.current && c.current) {
|
|
243
|
-
let i = f.current, b = c.current, u, w = new ResizeObserver(() => {
|
|
244
|
-
u = requestAnimationFrame(() => {
|
|
245
|
-
let I = i.offsetHeight;
|
|
246
|
-
b.style.setProperty("--cmdk-list-height", I.toFixed(1) + "px");
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
return w.observe(i), () => {
|
|
250
|
-
cancelAnimationFrame(u), w.unobserve(i);
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
}, []), l.createElement(P.div, { ref: Z(c, a), ...d, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": m, "aria-label": h, id: x.listId }, de(e, (i) => l.createElement("div", { ref: Z(f, x.listInnerRef), "cmdk-list-sizer": "" }, i)));
|
|
254
|
-
}), Qe = l.forwardRef((e, a) => {
|
|
255
|
-
let { open: r, onOpenChange: h, overlayClassName: d, contentClassName: c, container: f, ...m } = e;
|
|
256
|
-
return l.createElement(Ae, { open: r, onOpenChange: h }, l.createElement(Ne, { container: f }, l.createElement($e, { "cmdk-overlay": "", className: d }), l.createElement(Me, { "aria-label": e.label, "cmdk-dialog": "", className: c }, l.createElement(Se, { ref: a, ...m }))));
|
|
257
|
-
}), Ze = l.forwardRef((e, a) => L((r) => r.filtered.count === 0) ? l.createElement(P.div, { ref: a, ...e, "cmdk-empty": "", role: "presentation" }) : null), et = l.forwardRef((e, a) => {
|
|
258
|
-
let { progress: r, children: h, label: d = "Loading...", ...c } = e;
|
|
259
|
-
return l.createElement(P.div, { ref: a, ...c, "cmdk-loading": "", role: "progressbar", "aria-valuenow": r, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": d }, de(e, (f) => l.createElement("div", { "aria-hidden": !0 }, f)));
|
|
260
|
-
}), G = Object.assign(Se, { List: Ye, Item: Ue, Input: Xe, Group: He, Separator: Je, Dialog: Qe, Empty: Ze, Loading: et });
|
|
261
|
-
function tt(e, a) {
|
|
262
|
-
let r = e.nextElementSibling;
|
|
263
|
-
for (; r; ) {
|
|
264
|
-
if (r.matches(a)) return r;
|
|
265
|
-
r = r.nextElementSibling;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
function rt(e, a) {
|
|
269
|
-
let r = e.previousElementSibling;
|
|
270
|
-
for (; r; ) {
|
|
271
|
-
if (r.matches(a)) return r;
|
|
272
|
-
r = r.previousElementSibling;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function Ie(e) {
|
|
276
|
-
let a = l.useRef(e);
|
|
277
|
-
return V(() => {
|
|
278
|
-
a.current = e;
|
|
279
|
-
}), a;
|
|
280
|
-
}
|
|
281
|
-
var V = typeof window > "u" ? l.useEffect : l.useLayoutEffect;
|
|
282
|
-
function _(e) {
|
|
283
|
-
let a = l.useRef();
|
|
284
|
-
return a.current === void 0 && (a.current = e()), a;
|
|
285
|
-
}
|
|
286
|
-
function L(e) {
|
|
287
|
-
let a = fe(), r = () => e(a.snapshot());
|
|
288
|
-
return l.useSyncExternalStore(a.subscribe, r, r);
|
|
289
|
-
}
|
|
290
|
-
function Ee(e, a, r, h = []) {
|
|
291
|
-
let d = l.useRef(), c = ee();
|
|
292
|
-
return V(() => {
|
|
293
|
-
var f;
|
|
294
|
-
let m = (() => {
|
|
295
|
-
var i;
|
|
296
|
-
for (let b of r) {
|
|
297
|
-
if (typeof b == "string") return b.trim();
|
|
298
|
-
if (typeof b == "object" && "current" in b) return b.current ? (i = b.current.textContent) == null ? void 0 : i.trim() : d.current;
|
|
299
|
-
}
|
|
300
|
-
})(), x = h.map((i) => i.trim());
|
|
301
|
-
c.value(e, m, x), (f = a.current) == null || f.setAttribute(B, m), d.current = m;
|
|
302
|
-
}), d;
|
|
303
|
-
}
|
|
304
|
-
var nt = () => {
|
|
305
|
-
let [e, a] = l.useState(), r = _(() => /* @__PURE__ */ new Map());
|
|
306
|
-
return V(() => {
|
|
307
|
-
r.current.forEach((h) => h()), r.current = /* @__PURE__ */ new Map();
|
|
308
|
-
}, [e]), (h, d) => {
|
|
309
|
-
r.current.set(h, d), a({});
|
|
310
|
-
};
|
|
311
|
-
};
|
|
312
|
-
function at(e) {
|
|
313
|
-
let a = e.type;
|
|
314
|
-
return typeof a == "function" ? a(e.props) : "render" in a ? a.render(e.props) : e;
|
|
315
|
-
}
|
|
316
|
-
function de({ asChild: e, children: a }, r) {
|
|
317
|
-
return e && l.isValidElement(a) ? l.cloneElement(at(a), { ref: a.ref }, r(a.props.children)) : r(a);
|
|
318
|
-
}
|
|
319
|
-
var lt = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
|
|
320
|
-
function ot({
|
|
321
|
-
className: e,
|
|
322
|
-
...a
|
|
323
|
-
}) {
|
|
324
|
-
return /* @__PURE__ */ p.jsx(
|
|
325
|
-
G,
|
|
326
|
-
{
|
|
327
|
-
"data-slot": "command",
|
|
328
|
-
className: N(
|
|
329
|
-
`
|
|
330
|
-
adm:flex adm:h-full adm:w-full adm:flex-col adm:overflow-hidden
|
|
331
|
-
adm:rounded-md adm:bg-popover adm:text-popover-foreground
|
|
332
|
-
`,
|
|
333
|
-
e
|
|
334
|
-
),
|
|
335
|
-
...a
|
|
336
|
-
}
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
function dt({
|
|
340
|
-
className: e,
|
|
341
|
-
...a
|
|
342
|
-
}) {
|
|
343
|
-
return /* @__PURE__ */ p.jsxs(
|
|
344
|
-
"div",
|
|
345
|
-
{
|
|
346
|
-
"data-slot": "command-input-wrapper",
|
|
347
|
-
className: `
|
|
348
|
-
adm:flex adm:h-10 adm:items-center adm:gap-2
|
|
349
|
-
adm:rounded-t-[calc(var(--radius)-1px)] adm:border-b adm:px-3
|
|
350
|
-
adm:*:data-[slot=icon]:shrink-0 adm:*:data-[slot=icon]:text-lg
|
|
351
|
-
adm:*:data-[slot=icon]:opacity-50
|
|
352
|
-
`,
|
|
353
|
-
children: [
|
|
354
|
-
/* @__PURE__ */ p.jsx(Q, { symbol: "search" }),
|
|
355
|
-
/* @__PURE__ */ p.jsx(
|
|
356
|
-
G.Input,
|
|
357
|
-
{
|
|
358
|
-
"data-slot": "command-input",
|
|
359
|
-
className: N(
|
|
360
|
-
`
|
|
361
|
-
adm:flex adm:h-10 adm:w-full adm:rounded-md adm:bg-transparent
|
|
362
|
-
adm:py-3 adm:text-sm adm:outline-hidden
|
|
363
|
-
adm:placeholder:text-muted-foreground
|
|
364
|
-
adm:disabled:cursor-not-allowed adm:disabled:opacity-50
|
|
365
|
-
`,
|
|
366
|
-
e
|
|
367
|
-
),
|
|
368
|
-
...a
|
|
369
|
-
}
|
|
370
|
-
)
|
|
371
|
-
]
|
|
372
|
-
}
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
function it({
|
|
376
|
-
className: e,
|
|
377
|
-
...a
|
|
378
|
-
}) {
|
|
379
|
-
return /* @__PURE__ */ p.jsx(
|
|
380
|
-
G.List,
|
|
381
|
-
{
|
|
382
|
-
"data-slot": "command-list",
|
|
383
|
-
className: N(
|
|
384
|
-
`
|
|
385
|
-
adm:max-h-[300px] adm:scroll-py-1 adm:overflow-x-hidden
|
|
386
|
-
adm:overflow-y-auto
|
|
387
|
-
`,
|
|
388
|
-
e
|
|
389
|
-
),
|
|
390
|
-
...a
|
|
391
|
-
}
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
function ut({
|
|
395
|
-
className: e,
|
|
396
|
-
...a
|
|
397
|
-
}) {
|
|
398
|
-
return /* @__PURE__ */ p.jsx(
|
|
399
|
-
G.Empty,
|
|
400
|
-
{
|
|
401
|
-
"data-slot": "command-empty",
|
|
402
|
-
className: N("adm:py-6 adm:text-center adm:text-sm", e),
|
|
403
|
-
...a
|
|
404
|
-
}
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
|
-
function ct({
|
|
408
|
-
className: e,
|
|
409
|
-
...a
|
|
410
|
-
}) {
|
|
411
|
-
return /* @__PURE__ */ p.jsx(
|
|
412
|
-
G.Group,
|
|
413
|
-
{
|
|
414
|
-
"data-slot": "command-group",
|
|
415
|
-
className: N(
|
|
416
|
-
`
|
|
417
|
-
adm:overflow-hidden adm:text-foreground
|
|
418
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:px-2
|
|
419
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:py-1.5
|
|
420
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-xs
|
|
421
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:font-medium
|
|
422
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-muted-foreground
|
|
423
|
-
adm:[&_[data-slot=command-item]:last-of-type]:rounded-b-[calc(var(--radius)-1px)]
|
|
424
|
-
adm:[&_[data-slot=command-item]:last-of-type]:border-b-0
|
|
425
|
-
`,
|
|
426
|
-
e
|
|
427
|
-
),
|
|
428
|
-
...a
|
|
429
|
-
}
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
function st({
|
|
433
|
-
className: e,
|
|
434
|
-
...a
|
|
435
|
-
}) {
|
|
436
|
-
return /* @__PURE__ */ p.jsx(
|
|
437
|
-
G.Item,
|
|
438
|
-
{
|
|
439
|
-
"data-slot": "command-item",
|
|
440
|
-
className: N(
|
|
441
|
-
`
|
|
442
|
-
adm:relative adm:flex adm:h-10 adm:cursor-default adm:items-center
|
|
443
|
-
adm:gap-2 adm:border-b adm:px-3 adm:text-sm adm:outline-hidden
|
|
444
|
-
adm:select-none
|
|
445
|
-
adm:data-[disabled=true]:pointer-events-none
|
|
446
|
-
adm:data-[disabled=true]:opacity-50
|
|
447
|
-
adm:data-[selected=true]:bg-accent
|
|
448
|
-
adm:data-[selected=true]:text-accent-foreground
|
|
449
|
-
adm:[&_svg]:pointer-events-none adm:[&_svg]:shrink-0
|
|
450
|
-
adm:[&_svg:not([class*=size-])]:size-4
|
|
451
|
-
adm:[&_svg:not([class*=text-])]:text-muted-foreground
|
|
452
|
-
`,
|
|
453
|
-
e
|
|
454
|
-
),
|
|
455
|
-
...a
|
|
456
|
-
}
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
function St({
|
|
460
|
-
searchable: e,
|
|
461
|
-
multiple: a,
|
|
462
|
-
icon: r,
|
|
463
|
-
value: h,
|
|
464
|
-
onValueChange: d,
|
|
465
|
-
labels: c,
|
|
466
|
-
options: f,
|
|
467
|
-
classNames: m,
|
|
468
|
-
selectedFeedback: x = "checkbox",
|
|
469
|
-
alwaysShowPlaceholder: i = !1,
|
|
470
|
-
valuePosition: b = "right",
|
|
471
|
-
renders: u,
|
|
472
|
-
ref: w,
|
|
473
|
-
"aria-invalid": I,
|
|
474
|
-
disabled: R
|
|
475
|
-
}) {
|
|
476
|
-
const K = Re(null), [C, D] = pe(!1), [U, te] = pe(a ? [] : ""), y = h !== void 0 ? h : U, g = { ...{
|
|
477
|
-
placeholder: "Select options...",
|
|
478
|
-
searchPlaceholder: "Search options...",
|
|
479
|
-
noItemsFound: "No options found.",
|
|
480
|
-
multipleSelected: (n) => `${n} options selected`
|
|
481
|
-
}, ...c }, S = (n) => {
|
|
482
|
-
d ? d(n) : te(n);
|
|
483
|
-
}, F = () => a && Array.isArray(y) ? y.length === 0 ? null : y.length === 1 ? f.find((n) => n.value === y[0])?.label : g.multipleSelected?.(y.length) || `${y.length} options selected` : !a && typeof y == "string" && y ? f.find((n) => n.value === y)?.label : null, M = () => a && Array.isArray(y) ? y.length > 0 : typeof y == "string" && y !== "", T = (n) => a && Array.isArray(y) ? y.includes(n) : y === n, H = (n) => {
|
|
484
|
-
if (a) {
|
|
485
|
-
const s = Array.isArray(y) ? y : [], o = s.includes(n) ? s.filter((v) => v !== n) : [...s, n];
|
|
486
|
-
S(o);
|
|
487
|
-
} else
|
|
488
|
-
S(n === y ? "" : n), D(!1);
|
|
489
|
-
}, q = (n) => {
|
|
490
|
-
const s = T(n), o = f.find((v) => v.value === n);
|
|
491
|
-
return u?.selectedFeedback ? u.selectedFeedback({
|
|
492
|
-
option: o,
|
|
493
|
-
isSelected: s,
|
|
494
|
-
type: x
|
|
495
|
-
}) : x === "check" ? /* @__PURE__ */ p.jsx(
|
|
496
|
-
"span",
|
|
497
|
-
{
|
|
498
|
-
className: N(`
|
|
499
|
-
adm:absolute adm:right-2 adm:flex adm:size-3.5 adm:items-center
|
|
500
|
-
adm:justify-center
|
|
501
|
-
`, m?.check),
|
|
502
|
-
children: s && /* @__PURE__ */ p.jsx(Q, { symbol: "check", className: "adm:text-lg" })
|
|
503
|
-
}
|
|
504
|
-
) : /* @__PURE__ */ p.jsx(
|
|
505
|
-
Ce,
|
|
506
|
-
{
|
|
507
|
-
checked: s,
|
|
508
|
-
className: m?.checkbox
|
|
509
|
-
}
|
|
510
|
-
);
|
|
511
|
-
}, J = () => u?.placeholder ? u.placeholder({
|
|
512
|
-
text: g.placeholder || "",
|
|
513
|
-
hasValue: M()
|
|
514
|
-
}) : /* @__PURE__ */ p.jsx("span", { className: "adm:opacity-70", children: g.placeholder }), A = () => u?.displayValue ? u.displayValue({
|
|
515
|
-
text: F() ?? null,
|
|
516
|
-
value: y
|
|
517
|
-
}) : /* @__PURE__ */ p.jsx("span", { children: F() }), O = () => i ? /* @__PURE__ */ p.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
|
|
518
|
-
r && /* @__PURE__ */ p.jsx(Q, { symbol: r, className: "adm:opacity-50" }),
|
|
519
|
-
J(),
|
|
520
|
-
M() && b === "left" && A()
|
|
521
|
-
] }) : /* @__PURE__ */ p.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
|
|
522
|
-
r && /* @__PURE__ */ p.jsx(Q, { symbol: r, className: "adm:opacity-50" }),
|
|
523
|
-
M() ? A() : J()
|
|
524
|
-
] }), z = () => u?.triggerIcon ? u.triggerIcon({
|
|
525
|
-
open: C
|
|
526
|
-
}) : /* @__PURE__ */ p.jsx(Q, { symbol: "expand_more", className: "adm:opacity-50" }), X = () => i && M() && b === "right" ? /* @__PURE__ */ p.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
|
|
527
|
-
A(),
|
|
528
|
-
z()
|
|
529
|
-
] }) : /* @__PURE__ */ p.jsx("span", { className: "adm:flex adm:items-center adm:gap-2", children: z() }), re = () => u?.trigger ? u.trigger({
|
|
530
|
-
open: C,
|
|
531
|
-
value: y,
|
|
532
|
-
displayText: F() || "",
|
|
533
|
-
placeholder: g.placeholder || "",
|
|
534
|
-
hasValue: M(),
|
|
535
|
-
icon: r
|
|
536
|
-
}) : /* @__PURE__ */ p.jsxs(
|
|
537
|
-
je,
|
|
538
|
-
{
|
|
539
|
-
ref: (n) => {
|
|
540
|
-
K.current = n, w && (typeof w == "function" ? w(n) : w.current = n);
|
|
541
|
-
},
|
|
542
|
-
variant: "outline",
|
|
543
|
-
role: "combobox",
|
|
544
|
-
"aria-expanded": C,
|
|
545
|
-
"aria-invalid": I,
|
|
546
|
-
disabled: R,
|
|
547
|
-
className: N("adm:justify-between adm:rounded-md adm:font-normal", m?.trigger),
|
|
548
|
-
children: [
|
|
549
|
-
O(),
|
|
550
|
-
X()
|
|
551
|
-
]
|
|
552
|
-
}
|
|
553
|
-
), ne = () => e ? u?.searchInput ? u.searchInput({
|
|
554
|
-
placeholder: g.searchPlaceholder || ""
|
|
555
|
-
}) : /* @__PURE__ */ p.jsx(
|
|
556
|
-
dt,
|
|
557
|
-
{
|
|
558
|
-
placeholder: g.searchPlaceholder,
|
|
559
|
-
className: m?.input
|
|
560
|
-
}
|
|
561
|
-
) : null, ae = () => u?.empty ? u.empty({
|
|
562
|
-
text: g.noItemsFound || ""
|
|
563
|
-
}) : /* @__PURE__ */ p.jsx(p.Fragment, { children: g.noItemsFound }), le = (n) => u?.optionLabel ? u.optionLabel({
|
|
564
|
-
option: n
|
|
565
|
-
}) : /* @__PURE__ */ p.jsx(p.Fragment, { children: n.label }), t = (n) => u?.option ? /* @__PURE__ */ p.jsx("div", { children: u.option({
|
|
566
|
-
option: n,
|
|
567
|
-
isSelected: T(n.value),
|
|
568
|
-
selectedFeedback: x
|
|
569
|
-
}) }, n.value) : /* @__PURE__ */ p.jsxs(
|
|
570
|
-
st,
|
|
571
|
-
{
|
|
572
|
-
value: n.value,
|
|
573
|
-
onSelect: H,
|
|
574
|
-
disabled: n.disabled,
|
|
575
|
-
className: N(
|
|
576
|
-
m?.item,
|
|
577
|
-
x === "check" && "adm:pr-10"
|
|
578
|
-
),
|
|
579
|
-
children: [
|
|
580
|
-
x === "checkbox" && q(n.value),
|
|
581
|
-
le(n),
|
|
582
|
-
x === "check" && q(n.value)
|
|
583
|
-
]
|
|
584
|
-
},
|
|
585
|
-
n.value
|
|
586
|
-
);
|
|
587
|
-
return /* @__PURE__ */ p.jsxs(Le, { open: C, onOpenChange: D, children: [
|
|
588
|
-
/* @__PURE__ */ p.jsx(Pe, { asChild: !0, children: re() }),
|
|
589
|
-
/* @__PURE__ */ p.jsx(
|
|
590
|
-
De,
|
|
591
|
-
{
|
|
592
|
-
align: "start",
|
|
593
|
-
className: N("adm:p-0", m?.popover),
|
|
594
|
-
style: { minWidth: K.current?.offsetWidth },
|
|
595
|
-
children: /* @__PURE__ */ p.jsxs(ot, { className: m?.command, children: [
|
|
596
|
-
ne(),
|
|
597
|
-
/* @__PURE__ */ p.jsxs(it, { className: m?.list, children: [
|
|
598
|
-
/* @__PURE__ */ p.jsx(ut, { className: m?.empty, children: ae() }),
|
|
599
|
-
/* @__PURE__ */ p.jsx(ct, { className: m?.group, children: f.map((n) => t(n)) })
|
|
600
|
-
] })
|
|
601
|
-
] })
|
|
602
|
-
}
|
|
603
|
-
)
|
|
604
|
-
] });
|
|
605
|
-
}
|
|
606
|
-
export {
|
|
607
|
-
St as C
|
|
608
|
-
};
|