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