@adamosuiteservices/ui 2.11.21 → 2.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{button-BzVY7053.js → button-CMWUcYpz.js} +54 -54
- package/dist/button-CmLeuaI0.cjs +75 -0
- package/dist/button-group.cjs +6 -6
- package/dist/button-group.js +20 -20
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/{calendar-IAVS_7up.cjs → calendar-DUvRetFW.cjs} +1 -1
- package/dist/{calendar-BIttOd3g.js → calendar-yJWQTCer.js} +1 -1
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{combobox-DI-WK3Ng.js → combobox-BvjehNR7.js} +89 -86
- package/dist/combobox-CDXlen0X.cjs +40 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/input-otp/index.d.ts +1 -0
- package/dist/components/ui/input-otp/input-otp.d.ts +11 -0
- package/dist/context-menu.cjs +38 -36
- package/dist/context-menu.js +54 -52
- package/dist/date-picker-selector.cjs +1 -1
- package/dist/date-picker-selector.js +4 -4
- package/dist/dropdown-menu.cjs +48 -52
- package/dist/dropdown-menu.js +164 -168
- package/dist/{input-DFvZLcgm.js → input-BCiOr4Fy.js} +7 -6
- package/dist/{input-CWDpI1Ua.cjs → input-Bz5k4w94.cjs} +7 -6
- package/dist/input-group.cjs +5 -5
- package/dist/input-group.js +10 -10
- package/dist/input-otp.cjs +68 -0
- package/dist/input-otp.js +384 -0
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/pagination.cjs +2 -2
- package/dist/pagination.js +4 -3
- package/dist/select.cjs +22 -20
- package/dist/select.js +112 -111
- package/dist/sidebar.cjs +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/ui/button-group.md +986 -984
- package/docs/components/ui/button.md +1156 -1137
- package/docs/components/ui/combobox.md +33 -2
- package/docs/components/ui/command.md +484 -454
- package/docs/components/ui/context-menu.md +574 -540
- package/docs/components/ui/dropdown-menu.md +743 -709
- package/docs/components/ui/input.md +362 -362
- package/docs/components/ui/select.md +357 -352
- package/package.json +8 -3
- package/dist/button-B_VHdPPV.cjs +0 -76
- package/dist/combobox-DplJzBX6.cjs +0 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as p } from "./jsx-runtime-BzflLqGi.js";
|
|
3
|
-
import { B as je } from "./button-
|
|
3
|
+
import { B as je } from "./button-CMWUcYpz.js";
|
|
4
4
|
import { C as Ce } from "./checkbox-B-Lu1-qJ.js";
|
|
5
5
|
import { I as ee } from "./icon-DKAhvlX_.js";
|
|
6
6
|
import { c as M } from "./index-CRiPKpXj.js";
|
|
@@ -8,28 +8,28 @@ import * as a from "react";
|
|
|
8
8
|
import { useRef as Re, useState as pe } from "react";
|
|
9
9
|
import { R as Ae, P as Ne, O as $e, a as Me } from "./index-BIydBVaH.js";
|
|
10
10
|
import { P as F } from "./index-BMWt1NBG.js";
|
|
11
|
-
import { u as
|
|
11
|
+
import { u as _ } from "./index-Cv867SGx.js";
|
|
12
12
|
import { c as te } from "./index-DLcqcWxM.js";
|
|
13
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,
|
|
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
15
|
function se(e, n, r, h, o, c, m) {
|
|
16
16
|
if (c === n.length) return o === e.length ? he : Te;
|
|
17
17
|
var s = `${o},${c}`;
|
|
18
18
|
if (m[s] !== void 0) return m[s];
|
|
19
|
-
for (var b = h.charAt(c),
|
|
19
|
+
for (var b = h.charAt(c), d = r.indexOf(b, o), g = 0, u, E, S, R; d >= 0; ) u = se(e, n, r, h, d + 1, c + 1, m), u > g && (d === o ? u *= he : qe.test(e.charAt(d - 1)) ? (u *= Oe, S = e.slice(o, d - 1).match(ze), S && o > 0 && (u *= Math.pow(ue, S.length))) : Be.test(e.charAt(d - 1)) ? (u *= Fe, R = e.slice(o, d - 1).match(be), R && o > 0 && (u *= Math.pow(ue, R.length))) : (u *= Ve, o > 0 && (u *= Math.pow(ue, d - o))), e.charAt(d) !== n.charAt(c) && (u *= Ke)), (u < ie && r.charAt(d - 1) === h.charAt(c + 1) || h.charAt(c + 1) === h.charAt(c) && r.charAt(d - 1) !== h.charAt(c)) && (E = se(e, n, r, h, d + 1, c + 2, m), E * ie > u && (u = E * ie)), u > g && (g = u), d = r.indexOf(b, d + 1);
|
|
20
20
|
return m[s] = g, g;
|
|
21
21
|
}
|
|
22
22
|
function ve(e) {
|
|
23
23
|
return e.toLowerCase().replace(be, " ");
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function _e(e, n, r) {
|
|
26
26
|
return e = r && r.length > 0 ? `${e + " " + r.join(" ")}` : e, se(e, n, ve(e), ve(n), 0, 0, {});
|
|
27
27
|
}
|
|
28
|
-
var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]',
|
|
28
|
+
var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', We = '[cmdk-group-heading=""]', xe = '[cmdk-item=""]', ge = `${xe}:not([aria-disabled="true"])`, me = "cmdk-item-select", z = "data-value", Ge = (e, n, r) => _e(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
29
|
let r = B(() => {
|
|
30
|
-
var t,
|
|
31
|
-
return { search: "", value: (
|
|
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:
|
|
30
|
+
var t, i;
|
|
31
|
+
return { search: "", value: (i = (t = e.value) != null ? t : e.defaultValue) != null ? i : "", 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: d, value: g, onValueChange: u, filter: E, shouldFilter: S, loop: R, disablePointerSelection: G = !1, vimBindings: L = !0, ...y } = e, ne = _(), A = _(), T = _(), N = a.useRef(null), k = nt();
|
|
33
33
|
K(() => {
|
|
34
34
|
if (g !== void 0) {
|
|
35
35
|
let t = g.trim();
|
|
@@ -38,10 +38,10 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
38
38
|
}, [g]), K(() => {
|
|
39
39
|
k(6, X);
|
|
40
40
|
}, []);
|
|
41
|
-
let I = a.useMemo(() => ({ subscribe: (t) => (m.current.add(t), () => m.current.delete(t)), snapshot: () => r.current, setState: (t,
|
|
41
|
+
let I = a.useMemo(() => ({ subscribe: (t) => (m.current.add(t), () => m.current.delete(t)), snapshot: () => r.current, setState: (t, i, v) => {
|
|
42
42
|
var l, x, w, C;
|
|
43
|
-
if (!Object.is(r.current[t],
|
|
44
|
-
if (r.current[t] =
|
|
43
|
+
if (!Object.is(r.current[t], i)) {
|
|
44
|
+
if (r.current[t] = i, t === "search") J(), q(), k(1, O);
|
|
45
45
|
else if (t === "value") {
|
|
46
46
|
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
47
47
|
let j = document.getElementById(T);
|
|
@@ -51,7 +51,7 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
51
51
|
var j;
|
|
52
52
|
r.current.selectedItemId = (j = P()) == null ? void 0 : j.id, I.emit();
|
|
53
53
|
}), v || k(5, X), ((x = s.current) == null ? void 0 : x.value) !== void 0) {
|
|
54
|
-
let j =
|
|
54
|
+
let j = i ?? "";
|
|
55
55
|
(C = (w = s.current).onValueChange) == null || C.call(w, j);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
@@ -60,12 +60,12 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
60
60
|
}
|
|
61
61
|
}, emit: () => {
|
|
62
62
|
m.current.forEach((t) => t());
|
|
63
|
-
} }), []),
|
|
63
|
+
} }), []), U = a.useMemo(() => ({ value: (t, i, v) => {
|
|
64
64
|
var l;
|
|
65
|
-
|
|
65
|
+
i !== ((l = c.current.get(t)) == null ? void 0 : l.value) && (c.current.set(t, { value: i, keywords: v }), r.current.filtered.items.set(t, H(i, v)), k(2, () => {
|
|
66
66
|
q(), I.emit();
|
|
67
67
|
}));
|
|
68
|
-
}, item: (t,
|
|
68
|
+
}, item: (t, i) => (h.current.add(t), i && (o.current.has(i) ? o.current.get(i).add(t) : o.current.set(i, /* @__PURE__ */ new Set([t]))), k(3, () => {
|
|
69
69
|
J(), q(), r.current.value || O(), I.emit();
|
|
70
70
|
}), () => {
|
|
71
71
|
c.current.delete(t), h.current.delete(t), r.current.filtered.items.delete(t);
|
|
@@ -76,20 +76,20 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
76
76
|
}), group: (t) => (o.current.has(t) || o.current.set(t, /* @__PURE__ */ new Set()), () => {
|
|
77
77
|
c.current.delete(t), o.current.delete(t);
|
|
78
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,
|
|
79
|
+
function H(t, i) {
|
|
80
80
|
var v, l;
|
|
81
|
-
let x = (l = (v = s.current) == null ? void 0 : v.filter) != null ? l :
|
|
82
|
-
return t ? x(t, r.current.search,
|
|
81
|
+
let x = (l = (v = s.current) == null ? void 0 : v.filter) != null ? l : Ge;
|
|
82
|
+
return t ? x(t, r.current.search, i) : 0;
|
|
83
83
|
}
|
|
84
84
|
function q() {
|
|
85
85
|
if (!r.current.search || s.current.shouldFilter === !1) return;
|
|
86
|
-
let t = r.current.filtered.items,
|
|
86
|
+
let t = r.current.filtered.items, i = [];
|
|
87
87
|
r.current.filtered.groups.forEach((l) => {
|
|
88
88
|
let x = o.current.get(l), w = 0;
|
|
89
89
|
x.forEach((C) => {
|
|
90
90
|
let j = t.get(C);
|
|
91
91
|
w = Math.max(j, w);
|
|
92
|
-
}),
|
|
92
|
+
}), i.push([l, w]);
|
|
93
93
|
});
|
|
94
94
|
let v = N.current;
|
|
95
95
|
V().sort((l, x) => {
|
|
@@ -99,18 +99,18 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
99
99
|
}).forEach((l) => {
|
|
100
100
|
let x = l.closest(ce);
|
|
101
101
|
x ? x.appendChild(l.parentElement === x ? l : l.closest(`${ce} > *`)) : v.appendChild(l.parentElement === v ? l : l.closest(`${ce} > *`));
|
|
102
|
-
}),
|
|
102
|
+
}), i.sort((l, x) => x[1] - l[1]).forEach((l) => {
|
|
103
103
|
var x;
|
|
104
104
|
let w = (x = N.current) == null ? void 0 : x.querySelector(`${Z}[${z}="${encodeURIComponent(l[0])}"]`);
|
|
105
105
|
w?.parentElement.appendChild(w);
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
function O() {
|
|
109
|
-
let t = V().find((v) => v.getAttribute("aria-disabled") !== "true"),
|
|
110
|
-
I.setState("value",
|
|
109
|
+
let t = V().find((v) => v.getAttribute("aria-disabled") !== "true"), i = t?.getAttribute(z);
|
|
110
|
+
I.setState("value", i || void 0);
|
|
111
111
|
}
|
|
112
112
|
function J() {
|
|
113
|
-
var t,
|
|
113
|
+
var t, i, v, l;
|
|
114
114
|
if (!r.current.search || s.current.shouldFilter === !1) {
|
|
115
115
|
r.current.filtered.count = h.current.size;
|
|
116
116
|
return;
|
|
@@ -118,7 +118,7 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
118
118
|
r.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
119
119
|
let x = 0;
|
|
120
120
|
for (let w of h.current) {
|
|
121
|
-
let C = (
|
|
121
|
+
let C = (i = (t = c.current.get(w)) == null ? void 0 : t.value) != null ? i : "", j = (l = (v = c.current.get(w)) == null ? void 0 : v.keywords) != null ? l : [], oe = H(C, j);
|
|
122
122
|
r.current.filtered.items.set(w, oe), oe > 0 && x++;
|
|
123
123
|
}
|
|
124
124
|
for (let [w, C] of o.current) for (let j of C) if (r.current.filtered.items.get(j) > 0) {
|
|
@@ -128,9 +128,9 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
128
128
|
r.current.filtered.count = x;
|
|
129
129
|
}
|
|
130
130
|
function X() {
|
|
131
|
-
var t,
|
|
131
|
+
var t, i, v;
|
|
132
132
|
let l = P();
|
|
133
|
-
l && (((t = l.parentElement) == null ? void 0 : t.firstChild) === l && ((v = (
|
|
133
|
+
l && (((t = l.parentElement) == null ? void 0 : t.firstChild) === l && ((v = (i = l.closest(Z)) == null ? void 0 : i.querySelector(We)) == null || v.scrollIntoView({ block: "nearest" })), l.scrollIntoView({ block: "nearest" }));
|
|
134
134
|
}
|
|
135
135
|
function P() {
|
|
136
136
|
var t;
|
|
@@ -141,16 +141,16 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
141
141
|
return Array.from(((t = N.current) == null ? void 0 : t.querySelectorAll(ge)) || []);
|
|
142
142
|
}
|
|
143
143
|
function Y(t) {
|
|
144
|
-
let
|
|
145
|
-
|
|
144
|
+
let i = V()[t];
|
|
145
|
+
i && I.setState("value", i.getAttribute(z));
|
|
146
146
|
}
|
|
147
147
|
function Q(t) {
|
|
148
|
-
var
|
|
148
|
+
var i;
|
|
149
149
|
let v = P(), l = V(), x = l.findIndex((C) => C === v), w = l[x + t];
|
|
150
|
-
(
|
|
150
|
+
(i = s.current) != null && i.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
151
|
}
|
|
152
152
|
function ae(t) {
|
|
153
|
-
let
|
|
153
|
+
let i = P(), v = i?.closest(Z), l;
|
|
154
154
|
for (; v && !l; ) v = t > 0 ? tt(v, Z) : rt(v, Z), l = v?.querySelector(ge);
|
|
155
155
|
l ? I.setState("value", l.getAttribute(z)) : Q(t);
|
|
156
156
|
}
|
|
@@ -160,8 +160,8 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
160
160
|
t.preventDefault(), t.metaKey ? Y(0) : t.altKey ? ae(-1) : Q(-1);
|
|
161
161
|
};
|
|
162
162
|
return a.createElement(F.div, { ref: n, tabIndex: -1, ...y, "cmdk-root": "", onKeyDown: (t) => {
|
|
163
|
-
var
|
|
164
|
-
(
|
|
163
|
+
var i;
|
|
164
|
+
(i = y.onKeyDown) == null || i.call(y, t);
|
|
165
165
|
let v = t.nativeEvent.isComposing || t.keyCode === 229;
|
|
166
166
|
if (!(t.defaultPrevented || v)) switch (t.key) {
|
|
167
167
|
case "n":
|
|
@@ -199,65 +199,65 @@ var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', Ge = '[cmdk-group-headi
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
} }, a.createElement("label", { "cmdk-label": "", htmlFor:
|
|
203
|
-
}),
|
|
202
|
+
} }, a.createElement("label", { "cmdk-label": "", htmlFor: U.inputId, id: U.labelId, style: lt }, b), de(e, (t) => a.createElement(ke.Provider, { value: I }, a.createElement(ye.Provider, { value: U }, t))));
|
|
203
|
+
}), Ue = a.forwardRef((e, n) => {
|
|
204
204
|
var r, h;
|
|
205
|
-
let o =
|
|
205
|
+
let o = _(), c = a.useRef(null), m = a.useContext(we), s = re(), b = Ie(e), d = (h = (r = b.current) == null ? void 0 : r.forceMount) != null ? h : m?.forceMount;
|
|
206
206
|
K(() => {
|
|
207
|
-
if (!
|
|
208
|
-
}, [
|
|
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) =>
|
|
207
|
+
if (!d) return s.item(o, m?.id);
|
|
208
|
+
}, [d]);
|
|
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) => d || s.filter() === !1 ? !0 : k.search ? k.filtered.items.get(o) > 0 : !0);
|
|
210
210
|
a.useEffect(() => {
|
|
211
211
|
let k = c.current;
|
|
212
212
|
if (!(!k || e.disabled)) return k.addEventListener(me, R), () => k.removeEventListener(me, R);
|
|
213
213
|
}, [S, e.onSelect, e.disabled]);
|
|
214
214
|
function R() {
|
|
215
215
|
var k, I;
|
|
216
|
-
|
|
216
|
+
G(), (I = (k = b.current).onSelect) == null || I.call(k, g.current);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function G() {
|
|
219
219
|
u.setState("value", g.current, !0);
|
|
220
220
|
}
|
|
221
221
|
if (!S) return null;
|
|
222
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 :
|
|
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 : G, onClick: L ? void 0 : R }, e.children);
|
|
224
224
|
}), He = a.forwardRef((e, n) => {
|
|
225
|
-
let { heading: r, children: h, forceMount: o, ...c } = e, m =
|
|
225
|
+
let { heading: r, children: h, forceMount: o, ...c } = e, m = _(), s = a.useRef(null), b = a.useRef(null), d = _(), g = re(), u = D((S) => o || g.filter() === !1 ? !0 : S.search ? S.filtered.groups.has(m) : !0);
|
|
226
226
|
K(() => g.group(m), []), Ee(m, s, [e.value, e.heading, b]);
|
|
227
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:
|
|
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: d }, r), de(e, (S) => a.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? d : void 0 }, a.createElement(we.Provider, { value: E }, S))));
|
|
229
229
|
}), Je = a.forwardRef((e, n) => {
|
|
230
230
|
let { alwaysRender: r, ...h } = e, o = a.useRef(null), c = D((m) => !m.search);
|
|
231
231
|
return !r && !c ? null : a.createElement(F.div, { ref: te(o, n), ...h, "cmdk-separator": "", role: "separator" });
|
|
232
232
|
}), Xe = a.forwardRef((e, n) => {
|
|
233
|
-
let { onValueChange: r, ...h } = e, o = e.value != null, c = fe(), m = D((
|
|
233
|
+
let { onValueChange: r, ...h } = e, o = e.value != null, c = fe(), m = D((d) => d.search), s = D((d) => d.selectedItemId), b = re();
|
|
234
234
|
return a.useEffect(() => {
|
|
235
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: (
|
|
237
|
-
o || c.setState("search",
|
|
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: (d) => {
|
|
237
|
+
o || c.setState("search", d.target.value), r?.(d.target.value);
|
|
238
238
|
} });
|
|
239
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((
|
|
240
|
+
let { children: r, label: h = "Suggestions", ...o } = e, c = a.useRef(null), m = a.useRef(null), s = D((d) => d.selectedItemId), b = re();
|
|
241
241
|
return a.useEffect(() => {
|
|
242
242
|
if (m.current && c.current) {
|
|
243
|
-
let
|
|
243
|
+
let d = m.current, g = c.current, u, E = new ResizeObserver(() => {
|
|
244
244
|
u = requestAnimationFrame(() => {
|
|
245
|
-
let S =
|
|
245
|
+
let S = d.offsetHeight;
|
|
246
246
|
g.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
|
|
247
247
|
});
|
|
248
248
|
});
|
|
249
|
-
return E.observe(
|
|
250
|
-
cancelAnimationFrame(u), E.unobserve(
|
|
249
|
+
return E.observe(d), () => {
|
|
250
|
+
cancelAnimationFrame(u), E.unobserve(d);
|
|
251
251
|
};
|
|
252
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 },
|
|
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 }, de(e, (d) => a.createElement("div", { ref: te(m, b.listInnerRef), "cmdk-list-sizer": "" }, d)));
|
|
254
254
|
}), Qe = a.forwardRef((e, n) => {
|
|
255
255
|
let { open: r, onOpenChange: h, overlayClassName: o, contentClassName: c, container: m, ...s } = e;
|
|
256
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
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
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 },
|
|
260
|
-
}),
|
|
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 }, de(e, (m) => a.createElement("div", { "aria-hidden": !0 }, m)));
|
|
260
|
+
}), W = Object.assign(Se, { List: Ye, Item: Ue, Input: Xe, Group: He, Separator: Je, Dialog: Qe, Empty: Ze, Loading: et });
|
|
261
261
|
function tt(e, n) {
|
|
262
262
|
let r = e.nextElementSibling;
|
|
263
263
|
for (; r; ) {
|
|
@@ -292,12 +292,12 @@ function Ee(e, n, r, h = []) {
|
|
|
292
292
|
return K(() => {
|
|
293
293
|
var m;
|
|
294
294
|
let s = (() => {
|
|
295
|
-
var
|
|
295
|
+
var d;
|
|
296
296
|
for (let g of r) {
|
|
297
297
|
if (typeof g == "string") return g.trim();
|
|
298
|
-
if (typeof g == "object" && "current" in g) return g.current ? (
|
|
298
|
+
if (typeof g == "object" && "current" in g) return g.current ? (d = g.current.textContent) == null ? void 0 : d.trim() : o.current;
|
|
299
299
|
}
|
|
300
|
-
})(), b = h.map((
|
|
300
|
+
})(), b = h.map((d) => d.trim());
|
|
301
301
|
c.value(e, s, b), (m = n.current) == null || m.setAttribute(z, s), o.current = s;
|
|
302
302
|
}), o;
|
|
303
303
|
}
|
|
@@ -313,7 +313,7 @@ function at(e) {
|
|
|
313
313
|
let n = e.type;
|
|
314
314
|
return typeof n == "function" ? n(e.props) : "render" in n ? n.render(e.props) : e;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function de({ asChild: e, children: n }, r) {
|
|
317
317
|
return e && a.isValidElement(n) ? a.cloneElement(at(n), { ref: n.ref }, r(n.props.children)) : r(n);
|
|
318
318
|
}
|
|
319
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" };
|
|
@@ -322,7 +322,7 @@ function ot({
|
|
|
322
322
|
...n
|
|
323
323
|
}) {
|
|
324
324
|
return /* @__PURE__ */ p.jsx(
|
|
325
|
-
|
|
325
|
+
W,
|
|
326
326
|
{
|
|
327
327
|
"data-slot": "command",
|
|
328
328
|
className: M(
|
|
@@ -336,7 +336,7 @@ function ot({
|
|
|
336
336
|
}
|
|
337
337
|
);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function dt({
|
|
340
340
|
className: e,
|
|
341
341
|
...n
|
|
342
342
|
}) {
|
|
@@ -345,14 +345,15 @@ function it({
|
|
|
345
345
|
{
|
|
346
346
|
"data-slot": "command-input-wrapper",
|
|
347
347
|
className: `
|
|
348
|
-
adm:flex adm:h-
|
|
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
|
|
349
350
|
adm:*:data-[slot=icon]:shrink-0 adm:*:data-[slot=icon]:text-lg
|
|
350
351
|
adm:*:data-[slot=icon]:opacity-50
|
|
351
352
|
`,
|
|
352
353
|
children: [
|
|
353
354
|
/* @__PURE__ */ p.jsx(ee, { symbol: "search" }),
|
|
354
355
|
/* @__PURE__ */ p.jsx(
|
|
355
|
-
|
|
356
|
+
W.Input,
|
|
356
357
|
{
|
|
357
358
|
"data-slot": "command-input",
|
|
358
359
|
className: M(
|
|
@@ -371,12 +372,12 @@ function it({
|
|
|
371
372
|
}
|
|
372
373
|
);
|
|
373
374
|
}
|
|
374
|
-
function
|
|
375
|
+
function it({
|
|
375
376
|
className: e,
|
|
376
377
|
...n
|
|
377
378
|
}) {
|
|
378
379
|
return /* @__PURE__ */ p.jsx(
|
|
379
|
-
|
|
380
|
+
W.List,
|
|
380
381
|
{
|
|
381
382
|
"data-slot": "command-list",
|
|
382
383
|
className: M(
|
|
@@ -395,7 +396,7 @@ function ut({
|
|
|
395
396
|
...n
|
|
396
397
|
}) {
|
|
397
398
|
return /* @__PURE__ */ p.jsx(
|
|
398
|
-
|
|
399
|
+
W.Empty,
|
|
399
400
|
{
|
|
400
401
|
"data-slot": "command-empty",
|
|
401
402
|
className: M("adm:py-6 adm:text-center adm:text-sm", e),
|
|
@@ -408,17 +409,19 @@ function ct({
|
|
|
408
409
|
...n
|
|
409
410
|
}) {
|
|
410
411
|
return /* @__PURE__ */ p.jsx(
|
|
411
|
-
|
|
412
|
+
W.Group,
|
|
412
413
|
{
|
|
413
414
|
"data-slot": "command-group",
|
|
414
415
|
className: M(
|
|
415
416
|
`
|
|
416
|
-
adm:overflow-hidden adm:
|
|
417
|
+
adm:overflow-hidden adm:text-foreground
|
|
417
418
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:px-2
|
|
418
419
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:py-1.5
|
|
419
420
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-xs
|
|
420
421
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:font-medium
|
|
421
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
|
|
422
425
|
`,
|
|
423
426
|
e
|
|
424
427
|
),
|
|
@@ -431,13 +434,13 @@ function st({
|
|
|
431
434
|
...n
|
|
432
435
|
}) {
|
|
433
436
|
return /* @__PURE__ */ p.jsx(
|
|
434
|
-
|
|
437
|
+
W.Item,
|
|
435
438
|
{
|
|
436
439
|
"data-slot": "command-item",
|
|
437
440
|
className: M(
|
|
438
441
|
`
|
|
439
|
-
adm:relative adm:flex adm:cursor-default adm:items-center
|
|
440
|
-
adm:
|
|
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
|
|
441
444
|
adm:select-none
|
|
442
445
|
adm:data-[disabled=true]:pointer-events-none
|
|
443
446
|
adm:data-[disabled=true]:opacity-50
|
|
@@ -463,25 +466,25 @@ function St({
|
|
|
463
466
|
options: m,
|
|
464
467
|
classNames: s,
|
|
465
468
|
selectedFeedback: b = "checkbox",
|
|
466
|
-
alwaysShowPlaceholder:
|
|
469
|
+
alwaysShowPlaceholder: d = !1,
|
|
467
470
|
valuePosition: g = "right",
|
|
468
471
|
renders: u
|
|
469
472
|
}) {
|
|
470
|
-
const E = Re(null), [S, R] = pe(!1), [
|
|
473
|
+
const E = Re(null), [S, R] = pe(!1), [G, L] = pe(n ? [] : ""), y = h !== void 0 ? h : G, A = { ...{
|
|
471
474
|
placeholder: "Select options...",
|
|
472
475
|
searchPlaceholder: "Search options...",
|
|
473
476
|
noItemsFound: "No options found.",
|
|
474
477
|
multipleSelected: (f) => `${f} options selected`
|
|
475
478
|
}, ...c }, T = (f) => {
|
|
476
479
|
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,
|
|
480
|
+
}, 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, U = (f) => {
|
|
478
481
|
if (n) {
|
|
479
|
-
const $ = Array.isArray(y) ? y : [], t = $.includes(f) ? $.filter((
|
|
482
|
+
const $ = Array.isArray(y) ? y : [], t = $.includes(f) ? $.filter((i) => i !== f) : [...$, f];
|
|
480
483
|
T(t);
|
|
481
484
|
} else
|
|
482
485
|
T(f === y ? "" : f), R(!1);
|
|
483
486
|
}, H = (f) => {
|
|
484
|
-
const $ = I(f), t = m.find((
|
|
487
|
+
const $ = I(f), t = m.find((i) => i.value === f);
|
|
485
488
|
return u?.selectedFeedback ? u.selectedFeedback({
|
|
486
489
|
option: t,
|
|
487
490
|
isSelected: $,
|
|
@@ -493,7 +496,7 @@ function St({
|
|
|
493
496
|
adm:absolute adm:right-2 adm:flex adm:size-3.5 adm:items-center
|
|
494
497
|
adm:justify-center
|
|
495
498
|
`, s?.check),
|
|
496
|
-
children: $ && /* @__PURE__ */ p.jsx(ee, { symbol: "check" })
|
|
499
|
+
children: $ && /* @__PURE__ */ p.jsx(ee, { symbol: "check", className: "adm:text-lg" })
|
|
497
500
|
}
|
|
498
501
|
) : /* @__PURE__ */ p.jsx(
|
|
499
502
|
Ce,
|
|
@@ -508,7 +511,7 @@ function St({
|
|
|
508
511
|
}) : /* @__PURE__ */ p.jsx("span", { className: "adm:opacity-70", children: A.placeholder }), O = () => u?.displayValue ? u.displayValue({
|
|
509
512
|
text: N() ?? null,
|
|
510
513
|
value: y
|
|
511
|
-
}) : /* @__PURE__ */ p.jsx("span", { children: N() }), J = () =>
|
|
514
|
+
}) : /* @__PURE__ */ p.jsx("span", { children: N() }), J = () => d ? /* @__PURE__ */ p.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
|
|
512
515
|
r && /* @__PURE__ */ p.jsx(ee, { symbol: r, className: "adm:opacity-50" }),
|
|
513
516
|
q(),
|
|
514
517
|
k() && g === "left" && O()
|
|
@@ -517,7 +520,7 @@ function St({
|
|
|
517
520
|
k() ? O() : q()
|
|
518
521
|
] }), X = () => u?.triggerIcon ? u.triggerIcon({
|
|
519
522
|
open: S
|
|
520
|
-
}) : /* @__PURE__ */ p.jsx(ee, { symbol: "expand_more", className: "adm:opacity-50" }), P = () =>
|
|
523
|
+
}) : /* @__PURE__ */ p.jsx(ee, { symbol: "expand_more", className: "adm:opacity-50" }), P = () => d && k() && g === "right" ? /* @__PURE__ */ p.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
|
|
521
524
|
O(),
|
|
522
525
|
X()
|
|
523
526
|
] }) : /* @__PURE__ */ p.jsx("span", { className: "adm:flex adm:items-center adm:gap-2", children: X() }), V = () => u?.trigger ? u.trigger({
|
|
@@ -534,7 +537,7 @@ function St({
|
|
|
534
537
|
variant: "outline",
|
|
535
538
|
role: "combobox",
|
|
536
539
|
"aria-expanded": S,
|
|
537
|
-
className: M("adm:justify-between adm:font-normal", s?.trigger),
|
|
540
|
+
className: M("adm:justify-between adm:rounded-md adm:font-normal", s?.trigger),
|
|
538
541
|
children: [
|
|
539
542
|
J(),
|
|
540
543
|
P()
|
|
@@ -543,7 +546,7 @@ function St({
|
|
|
543
546
|
), Y = () => e ? u?.searchInput ? u.searchInput({
|
|
544
547
|
placeholder: A.searchPlaceholder || ""
|
|
545
548
|
}) : /* @__PURE__ */ p.jsx(
|
|
546
|
-
|
|
549
|
+
dt,
|
|
547
550
|
{
|
|
548
551
|
placeholder: A.searchPlaceholder,
|
|
549
552
|
className: s?.input
|
|
@@ -560,11 +563,11 @@ function St({
|
|
|
560
563
|
st,
|
|
561
564
|
{
|
|
562
565
|
value: f.value,
|
|
563
|
-
onSelect:
|
|
566
|
+
onSelect: U,
|
|
564
567
|
disabled: f.disabled,
|
|
565
568
|
className: M(
|
|
566
569
|
s?.item,
|
|
567
|
-
b === "check" && "adm:pr-
|
|
570
|
+
b === "check" && "adm:pr-10"
|
|
568
571
|
),
|
|
569
572
|
children: [
|
|
570
573
|
b === "checkbox" && H(f.value),
|
|
@@ -584,7 +587,7 @@ function St({
|
|
|
584
587
|
style: { minWidth: E.current?.offsetWidth },
|
|
585
588
|
children: /* @__PURE__ */ p.jsxs(ot, { className: s?.command, children: [
|
|
586
589
|
Y(),
|
|
587
|
-
/* @__PURE__ */ p.jsxs(
|
|
590
|
+
/* @__PURE__ */ p.jsxs(it, { className: s?.list, children: [
|
|
588
591
|
/* @__PURE__ */ p.jsx(ut, { className: s?.empty, children: Q() }),
|
|
589
592
|
/* @__PURE__ */ p.jsx(ct, { className: s?.group, children: m.map((f) => le(f)) })
|
|
590
593
|
] })
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";"use strict";const x=require("./jsx-runtime-BB_1_6y_.cjs"),Ce=require("./button-CmLeuaI0.cjs"),Ae=require("./checkbox-DHFt3l5c.cjs"),ee=require("./icon-DPMQJBkA.cjs"),q=require("./index-DoxiiusW.cjs"),ue=require("react"),ie=require("./index-Ca99LLZF.cjs"),L=require("./index-CocSS1YK.cjs"),B=require("./index-WIv2ndLu.cjs"),te=require("./index-_XxjJPRD.cjs"),de=require("./popover-cGp_rNLg.cjs");function Ne(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=Ne(ue);var ve=1,Pe=.9,qe=.8,Me=.17,ce=.1,me=.999,$e=.9999,De=.99,Le=/[\\\/_+.#"@\[\(\{&]/,Oe=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ye=/[\s-]/g;function pe(e,n,r,p,o,d,m){if(d===n.length)return o===e.length?ve:De;var c=`${o},${d}`;if(m[c]!==void 0)return m[c];for(var g=p.charAt(d),i=r.indexOf(g,o),v=0,s,I,R,C;i>=0;)s=pe(e,n,r,p,i+1,d+1,m),s>v&&(i===o?s*=ve:Le.test(e.charAt(i-1))?(s*=qe,R=e.slice(o,i-1).match(Oe),R&&o>0&&(s*=Math.pow(me,R.length))):Fe.test(e.charAt(i-1))?(s*=Pe,C=e.slice(o,i-1).match(ye),C&&o>0&&(s*=Math.pow(me,C.length))):(s*=Me,o>0&&(s*=Math.pow(me,i-o))),e.charAt(i)!==n.charAt(d)&&(s*=$e)),(s<ce&&r.charAt(i-1)===p.charAt(d+1)||p.charAt(d+1)===p.charAt(d)&&r.charAt(i-1)!==p.charAt(d))&&(I=pe(e,n,r,p,i+1,d+2,m),I*ce>s&&(s=I*ce)),s>v&&(v=s),i=r.indexOf(g,i+1);return m[c]=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",_="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=z(()=>{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=z(()=>new Set),o=z(()=>new Map),d=z(()=>new Map),m=z(()=>new Set),c=we(e),{label:g,children:i,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(),N=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=c.current)==null?void 0:b.value)!==void 0){let w=u??"";(S=(E=c.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=d.current.get(t))==null?void 0:l.value)&&(d.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&&(o.current.has(u)?o.current.get(u).add(t):o.current.set(u,new Set([t]))),j(3,()=>{J(),K(),r.current.value||O(),k.emit()}),()=>{d.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=>(o.current.has(t)||o.current.set(t,new Set),()=>{d.current.delete(t),o.current.delete(t)}),filter:()=>c.current.shouldFilter,label:g||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:ne,inputId:V,labelId:A,listInnerRef:N}),[]);function H(t,u){var h,l;let b=(l=(h=c.current)==null?void 0:h.filter)!=null?l:Ke;return t?b(t,r.current.search,u):0}function K(){if(!r.current.search||c.current.shouldFilter===!1)return;let t=r.current.filtered.items,u=[];r.current.filtered.groups.forEach(l=>{let b=o.current.get(l),E=0;b.forEach(S=>{let w=t.get(S);E=Math.max(w,E)}),u.push([l,E])});let h=N.current;F().sort((l,b)=>{var E,S;let w=l.getAttribute("id"),oe=b.getAttribute("id");return((E=t.get(oe))!=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=N.current)==null?void 0:b.querySelector(`${Z}[${_}="${encodeURIComponent(l[0])}"]`);E?.parentElement.appendChild(E)})}function O(){let t=F().find(h=>h.getAttribute("aria-disabled")!=="true"),u=t?.getAttribute(_);k.setState("value",u||void 0)}function J(){var t,u,h,l;if(!r.current.search||c.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=d.current.get(E))==null?void 0:t.value)!=null?u:"",w=(l=(h=d.current.get(E))==null?void 0:h.keywords)!=null?l:[],oe=H(S,w);r.current.filtered.items.set(E,oe),oe>0&&b++}for(let[E,S]of o.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=N.current)==null?void 0:t.querySelector(`${je}[aria-selected="true"]`)}function F(){var t;return Array.from(((t=N.current)==null?void 0:t.querySelectorAll(be))||[])}function Y(t){let u=F()[t];u&&k.setState("value",u.getAttribute(_))}function Q(t){var u;let h=$(),l=F(),b=l.findIndex(S=>S===h),E=l[b+t];(u=c.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(_))}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(_)):Q(t)}let le=()=>Y(F().length-1),f=t=>{t.preventDefault(),t.metaKey?le():t.altKey?ae(1):Q(1)},P=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&&P(t);break}case"ArrowUp":{P(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))))}),_e=a.forwardRef((e,n)=>{var r,p;let o=B.useId(),d=a.useRef(null),m=a.useContext(ke),c=re(),g=we(e),i=(p=(r=g.current)==null?void 0:r.forceMount)!=null?p:m?.forceMount;T(()=>{if(!i)return c.item(o,m?.id)},[i]);let v=Se(o,d,[e.value,e.children,d],e.keywords),s=he(),I=D(j=>j.value&&j.value===v.current),R=D(j=>i||c.filter()===!1?!0:j.search?j.filtered.items.get(o)>0:!0);a.useEffect(()=>{let j=d.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,...N}=e;return a.createElement(L.Primitive.div,{ref:te.composeRefs(d,n),...N,id:o,"cmdk-item":"",role:"option","aria-disabled":!!M,"aria-selected":!!I,"data-disabled":!!M,"data-selected":!!I,onPointerMove:M||c.getDisablePointerSelection()?void 0:G,onClick:M?void 0:C},e.children)}),ze=a.forwardRef((e,n)=>{let{heading:r,children:p,forceMount:o,...d}=e,m=B.useId(),c=a.useRef(null),g=a.useRef(null),i=B.useId(),v=re(),s=D(R=>o||v.filter()===!1?!0:R.search?R.filtered.groups.has(m):!0);T(()=>v.group(m),[]),Se(m,c,[e.value,e.heading,g]);let I=a.useMemo(()=>({id:m,forceMount:o}),[o]);return a.createElement(L.Primitive.div,{ref:te.composeRefs(c,n),...d,"cmdk-group":"",role:"presentation",hidden:s?void 0:!0},r&&a.createElement("div",{ref:g,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),se(e,R=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},a.createElement(ke.Provider,{value:I},R))))}),Be=a.forwardRef((e,n)=>{let{alwaysRender:r,...p}=e,o=a.useRef(null),d=D(m=>!m.search);return!r&&!d?null:a.createElement(L.Primitive.div,{ref:te.composeRefs(o,n),...p,"cmdk-separator":"",role:"separator"})}),We=a.forwardRef((e,n)=>{let{onValueChange:r,...p}=e,o=e.value!=null,d=he(),m=D(i=>i.search),c=D(i=>i.selectedItemId),g=re();return a.useEffect(()=>{e.value!=null&&d.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":c,id:g.inputId,type:"text",value:o?e.value:m,onChange:i=>{o||d.setState("search",i.target.value),r?.(i.target.value)}})}),Ge=a.forwardRef((e,n)=>{let{children:r,label:p="Suggestions",...o}=e,d=a.useRef(null),m=a.useRef(null),c=D(i=>i.selectedItemId),g=re();return a.useEffect(()=>{if(m.current&&d.current){let i=m.current,v=d.current,s,I=new ResizeObserver(()=>{s=requestAnimationFrame(()=>{let R=i.offsetHeight;v.style.setProperty("--cmdk-list-height",R.toFixed(1)+"px")})});return I.observe(i),()=>{cancelAnimationFrame(s),I.unobserve(i)}}},[]),a.createElement(L.Primitive.div,{ref:te.composeRefs(d,n),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":p,id:g.listId},se(e,i=>a.createElement("div",{ref:te.composeRefs(m,g.listInnerRef),"cmdk-list-sizer":""},i)))}),Ue=a.forwardRef((e,n)=>{let{open:r,onOpenChange:p,overlayClassName:o,contentClassName:d,container:m,...c}=e;return a.createElement(ie.Root,{open:r,onOpenChange:p},a.createElement(ie.Portal,{container:m},a.createElement(ie.Overlay,{"cmdk-overlay":"",className:o}),a.createElement(ie.Content,{"aria-label":e.label,"cmdk-dialog":"",className:d},a.createElement(Ie,{ref:n,...c}))))}),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:o="Loading...",...d}=e;return a.createElement(L.Primitive.div,{ref:n,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},se(e,m=>a.createElement("div",{"aria-hidden":!0},m)))}),W=Object.assign(Ie,{List:Ge,Item:_e,Input:We,Group:ze,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 z(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 o=a.useRef(),d=re();return T(()=>{var m;let c=(()=>{var i;for(let v of r){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(i=v.current.textContent)==null?void 0:i.trim():o.current}})(),g=p.map(i=>i.trim());d.value(e,c,g),(m=n.current)==null||m.setAttribute(_,c),o.current=c}),o}var Qe=()=>{let[e,n]=a.useState(),r=z(()=>new Map);return T(()=>{r.current.forEach(p=>p()),r.current=new Map},[e]),(p,o)=>{r.current.set(p,o),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-10 adm:items-center adm:gap-2
|
|
6
|
+
adm:rounded-t-[calc(var(--radius)-1px)] adm:border-b adm:px-3
|
|
7
|
+
adm:*:data-[slot=icon]:shrink-0 adm:*:data-[slot=icon]:text-lg
|
|
8
|
+
adm:*:data-[slot=icon]:opacity-50
|
|
9
|
+
`,children:[x.jsxRuntimeExports.jsx(ee.Icon,{symbol:"search"}),x.jsxRuntimeExports.jsx(W.Input,{"data-slot":"command-input",className:q.cn(`
|
|
10
|
+
adm:flex adm:h-10 adm:w-full adm:rounded-md adm:bg-transparent
|
|
11
|
+
adm:py-3 adm:text-sm adm:outline-hidden
|
|
12
|
+
adm:placeholder:text-muted-foreground
|
|
13
|
+
adm:disabled:cursor-not-allowed adm:disabled:opacity-50
|
|
14
|
+
`,e),...n})]})}function nt({className:e,...n}){return x.jsxRuntimeExports.jsx(W.List,{"data-slot":"command-list",className:q.cn(`
|
|
15
|
+
adm:max-h-[300px] adm:scroll-py-1 adm:overflow-x-hidden
|
|
16
|
+
adm:overflow-y-auto
|
|
17
|
+
`,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(`
|
|
18
|
+
adm:overflow-hidden adm:text-foreground
|
|
19
|
+
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:px-2
|
|
20
|
+
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:py-1.5
|
|
21
|
+
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-xs
|
|
22
|
+
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:font-medium
|
|
23
|
+
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-muted-foreground
|
|
24
|
+
adm:[&_[data-slot=command-item]:last-of-type]:rounded-b-[calc(var(--radius)-1px)]
|
|
25
|
+
adm:[&_[data-slot=command-item]:last-of-type]:border-b-0
|
|
26
|
+
`,e),...n})}function ot({className:e,...n}){return x.jsxRuntimeExports.jsx(W.Item,{"data-slot":"command-item",className:q.cn(`
|
|
27
|
+
adm:relative adm:flex adm:h-10 adm:cursor-default adm:items-center
|
|
28
|
+
adm:gap-2 adm:border-b adm:px-3 adm:text-sm adm:outline-hidden
|
|
29
|
+
adm:select-none
|
|
30
|
+
adm:data-[disabled=true]:pointer-events-none
|
|
31
|
+
adm:data-[disabled=true]:opacity-50
|
|
32
|
+
adm:data-[selected=true]:bg-accent
|
|
33
|
+
adm:data-[selected=true]:text-accent-foreground
|
|
34
|
+
adm:[&_svg]:pointer-events-none adm:[&_svg]:shrink-0
|
|
35
|
+
adm:[&_svg:not([class*=size-])]:size-4
|
|
36
|
+
adm:[&_svg:not([class*=text-])]:text-muted-foreground
|
|
37
|
+
`,e),...n})}function it({searchable:e,multiple:n,icon:r,value:p,onValueChange:o,labels:d,options:m,classNames:c,selectedFeedback:g="checkbox",alwaysShowPlaceholder:i=!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`},...d},V=f=>{o?o(f):M(f)},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,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 P=Array.isArray(y)?y:[],t=P.includes(f)?P.filter(u=>u!==f):[...P,f];V(t)}else V(f===y?"":f),C(!1)},H=f=>{const P=k(f),t=m.find(u=>u.value===f);return s?.selectedFeedback?s.selectedFeedback({option:t,isSelected:P,type:g}):g==="check"?x.jsxRuntimeExports.jsx("span",{className:q.cn(`
|
|
38
|
+
adm:absolute adm:right-2 adm:flex adm:size-3.5 adm:items-center
|
|
39
|
+
adm:justify-center
|
|
40
|
+
`,c?.check),children:P&&x.jsxRuntimeExports.jsx(ee.Icon,{symbol:"check",className:"adm:text-lg"})}):x.jsxRuntimeExports.jsx(Ae.Checkbox,{checked:P,className:c?.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:N()??null,value:y}):x.jsxRuntimeExports.jsx("span",{children:N()}),J=()=>i?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"}),$=()=>i&&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:N()||"",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:rounded-md adm:font-normal",c?.trigger),children:[J(),$()]}),Y=()=>e?s?.searchInput?s.searchInput({placeholder:A.searchPlaceholder||""}):x.jsxRuntimeExports.jsx(rt,{placeholder:A.searchPlaceholder,className:c?.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(ot,{value:f.value,onSelect:U,disabled:f.disabled,className:q.cn(c?.item,g==="check"&&"adm:pr-10"),children:[g==="checkbox"&&H(f.value),ae(f),g==="check"&&H(f.value)]},f.value);return x.jsxRuntimeExports.jsxs(de.Popover,{open:R,onOpenChange:C,children:[x.jsxRuntimeExports.jsx(de.PopoverTrigger,{asChild:!0,children:F()}),x.jsxRuntimeExports.jsx(de.PopoverContent,{align:"start",className:q.cn("adm:p-0",c?.popover),style:{minWidth:I.current?.offsetWidth},children:x.jsxRuntimeExports.jsxs(tt,{className:c?.command,children:[Y(),x.jsxRuntimeExports.jsxs(nt,{className:c?.list,children:[x.jsxRuntimeExports.jsx(at,{className:c?.empty,children:Q()}),x.jsxRuntimeExports.jsx(lt,{className:c?.group,children:m.map(f=>le(f))})]})]})})]})}exports.Combobox=it;
|
package/dist/combobox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./combobox-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./combobox-CDXlen0X.cjs");exports.Combobox=o.Combobox;
|
package/dist/combobox.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "default" | "success" | "success-medium" | "warning" | "warning-medium" | "destructive" | "destructive-medium" | "outline" | "secondary" | "ghost" | "ghost-neutral" | null | undefined;
|
|
4
|
+
variant?: "link" | "default" | "success" | "success-medium" | "warning" | "warning-medium" | "destructive" | "destructive-medium" | "outline" | "secondary" | "ghost" | "ghost-neutral" | "link-neutral" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './input-otp';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OTPInput } from 'input-otp';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare function InputOTP({ className, containerClassName, ...props }: React.ComponentProps<typeof OTPInput> & {
|
|
4
|
+
containerClassName?: string;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function InputOTPSlot({ index, className, ...props }: React.ComponentProps<"div"> & {
|
|
8
|
+
index: number;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function InputOTPSeparator({ ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|