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