asterui 0.12.61 → 0.12.63
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/components/Affix.d.ts +2 -0
- package/dist/components/Affix.js.map +1 -1
- package/dist/components/Alert.d.ts +2 -0
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/Anchor.d.ts +2 -0
- package/dist/components/Anchor.js +79 -75
- package/dist/components/Anchor.js.map +1 -1
- package/dist/components/Autocomplete.d.ts +1 -0
- package/dist/components/Autocomplete.js +115 -110
- package/dist/components/Autocomplete.js.map +1 -1
- package/dist/components/Avatar.d.ts +4 -0
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Breadcrumb.d.ts +4 -2
- package/dist/components/Breadcrumb.js +54 -29
- package/dist/components/Breadcrumb.js.map +1 -1
- package/dist/components/Browser.d.ts +2 -0
- package/dist/components/Browser.js.map +1 -1
- package/dist/components/Button.d.ts +5 -1
- package/dist/components/Button.js +117 -107
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Chart.d.ts +1 -0
- package/dist/components/Chart.js +31 -30
- package/dist/components/Chart.js.map +1 -1
- package/dist/components/Chat.d.ts +1 -0
- package/dist/components/Chat.js +39 -28
- package/dist/components/Chat.js.map +1 -1
- package/dist/components/Code.d.ts +2 -0
- package/dist/components/Code.js.map +1 -1
- package/dist/components/Command.d.ts +5 -2
- package/dist/components/Command.js +262 -233
- package/dist/components/Command.js.map +1 -1
- package/dist/components/Container.d.ts +2 -0
- package/dist/components/Container.js.map +1 -1
- package/dist/components/ContextMenu.d.ts +4 -0
- package/dist/components/ContextMenu.js +157 -122
- package/dist/components/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton.d.ts +2 -0
- package/dist/components/CopyButton.js +9 -8
- package/dist/components/CopyButton.js.map +1 -1
- package/dist/components/Countdown.d.ts +3 -3
- package/dist/components/Countdown.js +49 -47
- package/dist/components/Countdown.js.map +1 -1
- package/dist/components/Diff.d.ts +3 -3
- package/dist/components/Diff.js +14 -10
- package/dist/components/Diff.js.map +1 -1
- package/dist/components/Divider.d.ts +2 -0
- package/dist/components/Divider.js.map +1 -1
- package/dist/components/Dock.d.ts +6 -0
- package/dist/components/Dock.js +75 -38
- package/dist/components/Dock.js.map +1 -1
- package/dist/components/Dropdown.js +110 -110
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/Fieldset.d.ts +2 -0
- package/dist/components/Fieldset.js.map +1 -1
- package/dist/components/FileInput.d.ts +1 -0
- package/dist/components/FileInput.js +26 -26
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Filter.d.ts +1 -0
- package/dist/components/Filter.js +43 -40
- package/dist/components/Filter.js.map +1 -1
- package/dist/components/Flex.d.ts +1 -0
- package/dist/components/Flex.js +43 -42
- package/dist/components/Flex.js.map +1 -1
- package/dist/components/FloatButton.d.ts +9 -0
- package/dist/components/FloatButton.js +211 -136
- package/dist/components/FloatButton.js.map +1 -1
- package/dist/components/Footer.d.ts +2 -0
- package/dist/components/Footer.js.map +1 -1
- package/dist/components/Grid.d.ts +4 -0
- package/dist/components/Grid.js.map +1 -1
- package/dist/components/Hero.d.ts +2 -0
- package/dist/components/Hero.js.map +1 -1
- package/dist/components/HoverGallery.d.ts +3 -3
- package/dist/components/HoverGallery.js +12 -10
- package/dist/components/HoverGallery.js.map +1 -1
- package/dist/components/Input.d.ts +1 -0
- package/dist/components/Input.js +201 -184
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Join.d.ts +2 -0
- package/dist/components/Join.js.map +1 -1
- package/dist/components/Kbd.d.ts +2 -0
- package/dist/components/Kbd.js.map +1 -1
- package/dist/components/Loading.d.ts +3 -0
- package/dist/components/Loading.js +58 -35
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/Mask.d.ts +2 -2
- package/dist/components/Mask.js.map +1 -1
- package/dist/components/Masonry.d.ts +1 -0
- package/dist/components/Masonry.js +45 -42
- package/dist/components/Masonry.js.map +1 -1
- package/dist/components/Mention.d.ts +1 -0
- package/dist/components/Mention.js +95 -91
- package/dist/components/Mention.js.map +1 -1
- package/dist/components/MonthCalendar.d.ts +1 -0
- package/dist/components/MonthCalendar.js +104 -97
- package/dist/components/MonthCalendar.js.map +1 -1
- package/dist/components/Navbar.d.ts +2 -0
- package/dist/components/Navbar.js.map +1 -1
- package/dist/components/Notification.js +32 -18
- package/dist/components/Notification.js.map +1 -1
- package/dist/components/Phone.d.ts +3 -2
- package/dist/components/Phone.js +10 -8
- package/dist/components/Phone.js.map +1 -1
- package/dist/components/Popconfirm.js +110 -92
- package/dist/components/Popconfirm.js.map +1 -1
- package/dist/components/Popover.d.ts +2 -0
- package/dist/components/Popover.js.map +1 -1
- package/dist/components/Progress.d.ts +2 -0
- package/dist/components/Progress.js.map +1 -1
- package/dist/components/QRCode.d.ts +1 -0
- package/dist/components/QRCode.js +84 -55
- package/dist/components/QRCode.js.map +1 -1
- package/dist/components/RadialProgress.d.ts +1 -0
- package/dist/components/RadialProgress.js +19 -17
- package/dist/components/RadialProgress.js.map +1 -1
- package/dist/components/Radio.d.ts +6 -3
- package/dist/components/Radio.js +9 -9
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/Range.d.ts +1 -0
- package/dist/components/Range.js +45 -43
- package/dist/components/Range.js.map +1 -1
- package/dist/components/Rating.d.ts +4 -2
- package/dist/components/Rating.js +83 -79
- package/dist/components/Rating.js.map +1 -1
- package/dist/components/Responsive.d.ts +4 -2
- package/dist/components/Responsive.js +10 -9
- package/dist/components/Responsive.js.map +1 -1
- package/dist/components/Result.d.ts +1 -0
- package/dist/components/Result.js +24 -22
- package/dist/components/Result.js.map +1 -1
- package/dist/components/Select.d.ts +1 -0
- package/dist/components/Select.js +72 -62
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Skeleton.d.ts +2 -0
- package/dist/components/Skeleton.js.map +1 -1
- package/dist/components/Space.d.ts +2 -0
- package/dist/components/Space.js.map +1 -1
- package/dist/components/Splitter.d.ts +2 -0
- package/dist/components/Splitter.js +137 -131
- package/dist/components/Splitter.js.map +1 -1
- package/dist/components/Stat.d.ts +4 -2
- package/dist/components/Stat.js +19 -18
- package/dist/components/Stat.js.map +1 -1
- package/dist/components/Status.d.ts +3 -3
- package/dist/components/Status.js +27 -25
- package/dist/components/Status.js.map +1 -1
- package/dist/components/Steps.d.ts +4 -2
- package/dist/components/Steps.js +56 -52
- package/dist/components/Steps.js.map +1 -1
- package/dist/components/TextRotate.d.ts +1 -0
- package/dist/components/TextRotate.js +14 -12
- package/dist/components/TextRotate.js.map +1 -1
- package/dist/components/Textarea.d.ts +1 -0
- package/dist/components/Textarea.js +31 -30
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/ThemeController.d.ts +6 -3
- package/dist/components/ThemeController.js +101 -92
- package/dist/components/ThemeController.js.map +1 -1
- package/dist/components/Toggle.d.ts +2 -0
- package/dist/components/Toggle.js.map +1 -1
- package/dist/components/Tooltip.d.ts +2 -0
- package/dist/components/Tooltip.js +38 -32
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/Typography.d.ts +10 -5
- package/dist/components/Typography.js +84 -81
- package/dist/components/Typography.js.map +1 -1
- package/dist/components/VirtualList.d.ts +2 -1
- package/dist/components/VirtualList.js +40 -36
- package/dist/components/VirtualList.js.map +1 -1
- package/dist/components/Watermark.d.ts +1 -0
- package/dist/components/Watermark.js +74 -71
- package/dist/components/Watermark.js.map +1 -1
- package/dist/components/WeekCalendar.d.ts +1 -0
- package/dist/components/WeekCalendar.js +91 -76
- package/dist/components/WeekCalendar.js.map +1 -1
- package/dist/components/Window.d.ts +3 -2
- package/dist/components/Window.js +9 -7
- package/dist/components/Window.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,219 +1,223 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const r =
|
|
1
|
+
import { jsx as n, jsxs as f, Fragment as re } from "react/jsx-runtime";
|
|
2
|
+
import X, { forwardRef as he, useRef as W, useId as ae, useState as O, useCallback as V, useMemo as ne, useEffect as j, createContext as ge, useContext as be } from "react";
|
|
3
|
+
const xe = "modal", ye = "modal-box", Z = "kbd", _ = "kbd-xs", se = ge(null);
|
|
4
|
+
function D() {
|
|
5
|
+
const r = be(se);
|
|
6
6
|
if (!r)
|
|
7
7
|
throw new Error("Command compound components must be used within a Command");
|
|
8
8
|
return r;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
return r.toLowerCase().includes(
|
|
13
|
-
},
|
|
10
|
+
const ve = (r, c, a = []) => {
|
|
11
|
+
const i = c.toLowerCase();
|
|
12
|
+
return r.toLowerCase().includes(i) ? !0 : a.some((p) => p.toLowerCase().includes(i));
|
|
13
|
+
}, oe = he(
|
|
14
14
|
({
|
|
15
15
|
children: r,
|
|
16
16
|
open: c,
|
|
17
|
-
onOpenChange:
|
|
18
|
-
defaultOpen:
|
|
19
|
-
items:
|
|
20
|
-
filter: p =
|
|
21
|
-
loop:
|
|
17
|
+
onOpenChange: a,
|
|
18
|
+
defaultOpen: i = !1,
|
|
19
|
+
items: d,
|
|
20
|
+
filter: p = ve,
|
|
21
|
+
loop: b = !0,
|
|
22
22
|
shortcut: x = ["k"],
|
|
23
23
|
placeholder: I = "Type a command or search...",
|
|
24
|
-
emptyMessage:
|
|
25
|
-
className:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
emptyMessage: L = "No results found.",
|
|
25
|
+
className: C = "",
|
|
26
|
+
"data-testid": N,
|
|
27
|
+
...J
|
|
28
|
+
}, M) => {
|
|
29
|
+
const h = W(null), A = W(null), B = W(null), Q = W(null), P = ae(), [q, T] = O(i), R = c !== void 0, $ = R ? c : q, u = V(
|
|
29
30
|
(e) => {
|
|
30
|
-
|
|
31
|
+
R || T(e), a?.(e);
|
|
31
32
|
},
|
|
32
|
-
[
|
|
33
|
-
), [
|
|
34
|
-
|
|
35
|
-
}, []),
|
|
36
|
-
|
|
37
|
-
}, [
|
|
38
|
-
(e, t,
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
return
|
|
33
|
+
[R, a]
|
|
34
|
+
), [v, S] = O(""), [y, k] = O(0), [z, ee] = O(/* @__PURE__ */ new Map()), [w, Y] = O(["root"]), te = w[w.length - 1], ie = V((e) => {
|
|
35
|
+
Y((t) => [...t, e]), S(""), k(0);
|
|
36
|
+
}, []), K = V(() => {
|
|
37
|
+
w.length > 1 && (Y((e) => e.slice(0, -1)), S(""), k(0));
|
|
38
|
+
}, [w.length]), de = V(
|
|
39
|
+
(e, t, o, l, m) => {
|
|
40
|
+
ee((s) => {
|
|
41
|
+
const F = new Map(s);
|
|
42
|
+
return F.set(e, { id: e, value: t, keywords: o, disabled: l, onSelect: m }), F;
|
|
42
43
|
});
|
|
43
44
|
},
|
|
44
45
|
[]
|
|
45
|
-
),
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
return
|
|
46
|
+
), ce = V((e) => {
|
|
47
|
+
ee((t) => {
|
|
48
|
+
const o = new Map(t);
|
|
49
|
+
return o.delete(e), o;
|
|
49
50
|
});
|
|
50
|
-
}, []),
|
|
51
|
-
if (!
|
|
52
|
-
const
|
|
53
|
-
return p(
|
|
51
|
+
}, []), H = ne(() => d ? d.filter((t) => {
|
|
52
|
+
if (!v) return !0;
|
|
53
|
+
const o = typeof t.label == "string" ? t.label : "";
|
|
54
|
+
return p(o, v, t.keywords);
|
|
54
55
|
}).map((t) => ({
|
|
55
56
|
id: t.key,
|
|
56
57
|
value: typeof t.label == "string" ? t.label : t.key,
|
|
57
58
|
keywords: t.keywords || [],
|
|
58
59
|
disabled: t.disabled || !1
|
|
59
|
-
})) : Array.from(
|
|
60
|
-
() =>
|
|
61
|
-
[
|
|
62
|
-
),
|
|
60
|
+
})) : Array.from(z.values()).filter((t) => v ? p(t.value, v, t.keywords) : !0), [d, z, v, p]), E = ne(
|
|
61
|
+
() => H.filter((e) => !e.disabled),
|
|
62
|
+
[H]
|
|
63
|
+
), G = V(
|
|
63
64
|
(e) => {
|
|
64
|
-
if (
|
|
65
|
-
const t =
|
|
66
|
-
t && !t.disabled && (t.onSelect?.(),
|
|
65
|
+
if (d) {
|
|
66
|
+
const t = d.find((o) => o.key === e);
|
|
67
|
+
t && !t.disabled && (t.onSelect?.(), u(!1));
|
|
67
68
|
} else {
|
|
68
|
-
const t =
|
|
69
|
-
t && !t.disabled && (t.onSelect?.(),
|
|
69
|
+
const t = z.get(e);
|
|
70
|
+
t && !t.disabled && (t.onSelect?.(), u(!1));
|
|
70
71
|
}
|
|
71
72
|
},
|
|
72
|
-
[
|
|
73
|
+
[d, z, u]
|
|
73
74
|
);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, [
|
|
77
|
-
const e =
|
|
78
|
-
e && (
|
|
79
|
-
}, [
|
|
80
|
-
const e =
|
|
75
|
+
j(() => {
|
|
76
|
+
$ && (S(""), k(0), Y(["root"]));
|
|
77
|
+
}, [$]), j(() => {
|
|
78
|
+
const e = h.current;
|
|
79
|
+
e && ($ ? e.open || (Q.current = document.activeElement, e.showModal(), setTimeout(() => A.current?.focus(), 0)) : e.open && (e.close(), Q.current?.focus()));
|
|
80
|
+
}, [$]), j(() => {
|
|
81
|
+
const e = h.current;
|
|
81
82
|
if (!e) return;
|
|
82
83
|
const t = () => {
|
|
83
|
-
|
|
84
|
+
u(!1);
|
|
84
85
|
};
|
|
85
86
|
return e.addEventListener("close", t), () => e.removeEventListener("close", t);
|
|
86
|
-
}, [
|
|
87
|
+
}, [u]), j(() => {
|
|
87
88
|
const e = (t) => {
|
|
88
|
-
const
|
|
89
|
-
(t.metaKey || t.ctrlKey) && t.key.toLowerCase() ===
|
|
89
|
+
const o = x[0]?.toLowerCase();
|
|
90
|
+
(t.metaKey || t.ctrlKey) && t.key.toLowerCase() === o && (t.preventDefault(), u(!$));
|
|
90
91
|
};
|
|
91
92
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
92
|
-
}, [x,
|
|
93
|
-
const
|
|
93
|
+
}, [x, $, u]);
|
|
94
|
+
const ue = V(
|
|
94
95
|
(e) => {
|
|
95
96
|
switch (e.key) {
|
|
96
97
|
case "ArrowDown": {
|
|
97
|
-
if (e.preventDefault(),
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
return
|
|
98
|
+
if (e.preventDefault(), E.length === 0) return;
|
|
99
|
+
k((t) => {
|
|
100
|
+
const o = t + 1;
|
|
101
|
+
return o >= E.length ? b ? 0 : t : o;
|
|
101
102
|
});
|
|
102
103
|
break;
|
|
103
104
|
}
|
|
104
105
|
case "ArrowUp": {
|
|
105
|
-
if (e.preventDefault(),
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
return
|
|
106
|
+
if (e.preventDefault(), E.length === 0) return;
|
|
107
|
+
k((t) => {
|
|
108
|
+
const o = t - 1;
|
|
109
|
+
return o < 0 ? b ? E.length - 1 : 0 : o;
|
|
109
110
|
});
|
|
110
111
|
break;
|
|
111
112
|
}
|
|
112
113
|
case "Enter": {
|
|
113
114
|
e.preventDefault();
|
|
114
|
-
const t =
|
|
115
|
-
t &&
|
|
115
|
+
const t = E[y];
|
|
116
|
+
t && G(t.id);
|
|
116
117
|
break;
|
|
117
118
|
}
|
|
118
119
|
case "Escape": {
|
|
119
|
-
e.preventDefault(),
|
|
120
|
+
e.preventDefault(), w.length > 1 ? K() : u(!1);
|
|
120
121
|
break;
|
|
121
122
|
}
|
|
122
123
|
case "Backspace": {
|
|
123
|
-
|
|
124
|
+
v === "" && w.length > 1 && (e.preventDefault(), K());
|
|
124
125
|
break;
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
},
|
|
128
|
-
[
|
|
129
|
+
[E, y, b, G, w, K, v, u]
|
|
129
130
|
);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}, [
|
|
133
|
-
const
|
|
134
|
-
e.target ===
|
|
135
|
-
},
|
|
136
|
-
searchValue:
|
|
137
|
-
setSearchValue:
|
|
138
|
-
highlightedIndex:
|
|
139
|
-
setHighlightedIndex:
|
|
140
|
-
registerItem: (e, t,
|
|
141
|
-
unregisterItem:
|
|
142
|
-
filteredItems:
|
|
143
|
-
selectItem:
|
|
144
|
-
loop:
|
|
145
|
-
baseId:
|
|
146
|
-
currentPage:
|
|
147
|
-
setPage:
|
|
148
|
-
goBack:
|
|
149
|
-
pageStack:
|
|
150
|
-
|
|
151
|
-
|
|
131
|
+
j(() => {
|
|
132
|
+
y >= 0 && B.current && B.current.querySelectorAll("[data-command-item]")[y]?.scrollIntoView({ block: "nearest" });
|
|
133
|
+
}, [y]);
|
|
134
|
+
const pe = (e) => {
|
|
135
|
+
e.target === h.current && u(!1);
|
|
136
|
+
}, g = (e) => N ? `${N}-${e}` : void 0, me = {
|
|
137
|
+
searchValue: v,
|
|
138
|
+
setSearchValue: S,
|
|
139
|
+
highlightedIndex: y,
|
|
140
|
+
setHighlightedIndex: k,
|
|
141
|
+
registerItem: (e, t, o, l) => de(e, t, o, l),
|
|
142
|
+
unregisterItem: ce,
|
|
143
|
+
filteredItems: H,
|
|
144
|
+
selectItem: G,
|
|
145
|
+
loop: b,
|
|
146
|
+
baseId: P,
|
|
147
|
+
currentPage: te,
|
|
148
|
+
setPage: ie,
|
|
149
|
+
goBack: K,
|
|
150
|
+
pageStack: w,
|
|
151
|
+
getTestId: g
|
|
152
|
+
}, fe = () => {
|
|
153
|
+
if (!d) return null;
|
|
152
154
|
const e = /* @__PURE__ */ new Map(), t = [];
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
if (
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
158
|
-
|
|
155
|
+
H.forEach((l) => {
|
|
156
|
+
const m = d.find((s) => s.key === l.id);
|
|
157
|
+
if (m)
|
|
158
|
+
if (m.group) {
|
|
159
|
+
const s = e.get(m.group) || [];
|
|
160
|
+
s.push(m), e.set(m.group, s);
|
|
159
161
|
} else
|
|
160
|
-
t.push(
|
|
162
|
+
t.push(m);
|
|
161
163
|
});
|
|
162
|
-
let
|
|
163
|
-
return /* @__PURE__ */
|
|
164
|
-
Array.from(e.entries()).map(([
|
|
165
|
-
/* @__PURE__ */ n("div", { className: "px-3 py-2 text-xs font-semibold text-base-content/60 uppercase tracking-wider", children:
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
return /* @__PURE__ */
|
|
164
|
+
let o = 0;
|
|
165
|
+
return /* @__PURE__ */ f(re, { children: [
|
|
166
|
+
Array.from(e.entries()).map(([l, m]) => /* @__PURE__ */ f("div", { role: "group", "aria-label": l, "data-testid": g(`group-${l}`), children: [
|
|
167
|
+
/* @__PURE__ */ n("div", { className: "px-3 py-2 text-xs font-semibold text-base-content/60 uppercase tracking-wider", children: l }),
|
|
168
|
+
m.map((s) => {
|
|
169
|
+
const F = o++, U = F === y;
|
|
170
|
+
return /* @__PURE__ */ f(
|
|
169
171
|
"div",
|
|
170
172
|
{
|
|
171
173
|
role: "option",
|
|
172
|
-
"aria-selected":
|
|
173
|
-
"aria-disabled":
|
|
174
|
+
"aria-selected": U,
|
|
175
|
+
"aria-disabled": s.disabled,
|
|
174
176
|
"data-command-item": !0,
|
|
175
|
-
"data-highlighted":
|
|
177
|
+
"data-highlighted": U,
|
|
176
178
|
className: [
|
|
177
179
|
"px-3 py-2 cursor-pointer flex items-center gap-3",
|
|
178
|
-
|
|
179
|
-
!
|
|
180
|
-
|
|
180
|
+
U && "bg-primary text-primary-content",
|
|
181
|
+
!U && "hover:bg-base-200",
|
|
182
|
+
s.disabled && "opacity-50 cursor-not-allowed"
|
|
181
183
|
].filter(Boolean).join(" "),
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
"data-testid": g(`item-${s.key}`),
|
|
185
|
+
onClick: () => !s.disabled && G(s.key),
|
|
186
|
+
onMouseEnter: () => !s.disabled && k(F),
|
|
184
187
|
children: [
|
|
185
|
-
|
|
186
|
-
/* @__PURE__ */ n("span", { children:
|
|
188
|
+
s.icon && /* @__PURE__ */ n("span", { className: "w-5 h-5", children: s.icon }),
|
|
189
|
+
/* @__PURE__ */ n("span", { children: s.label })
|
|
187
190
|
]
|
|
188
191
|
},
|
|
189
|
-
|
|
192
|
+
s.key
|
|
190
193
|
);
|
|
191
194
|
})
|
|
192
|
-
] },
|
|
193
|
-
t.length > 0 && /* @__PURE__ */ n("div", { role: "group", children: t.map((
|
|
194
|
-
const
|
|
195
|
-
return /* @__PURE__ */
|
|
195
|
+
] }, l)),
|
|
196
|
+
t.length > 0 && /* @__PURE__ */ n("div", { role: "group", "data-testid": g("group-ungrouped"), children: t.map((l) => {
|
|
197
|
+
const m = o++, s = m === y;
|
|
198
|
+
return /* @__PURE__ */ f(
|
|
196
199
|
"div",
|
|
197
200
|
{
|
|
198
201
|
role: "option",
|
|
199
|
-
"aria-selected":
|
|
200
|
-
"aria-disabled":
|
|
202
|
+
"aria-selected": s,
|
|
203
|
+
"aria-disabled": l.disabled,
|
|
201
204
|
"data-command-item": !0,
|
|
202
|
-
"data-highlighted":
|
|
205
|
+
"data-highlighted": s,
|
|
203
206
|
className: [
|
|
204
207
|
"px-3 py-2 cursor-pointer flex items-center gap-3",
|
|
205
|
-
|
|
206
|
-
!
|
|
207
|
-
|
|
208
|
+
s && "bg-primary text-primary-content",
|
|
209
|
+
!s && "hover:bg-base-200",
|
|
210
|
+
l.disabled && "opacity-50 cursor-not-allowed"
|
|
208
211
|
].filter(Boolean).join(" "),
|
|
209
|
-
|
|
210
|
-
|
|
212
|
+
"data-testid": g(`item-${l.key}`),
|
|
213
|
+
onClick: () => !l.disabled && G(l.key),
|
|
214
|
+
onMouseEnter: () => !l.disabled && k(m),
|
|
211
215
|
children: [
|
|
212
|
-
|
|
213
|
-
/* @__PURE__ */ n("span", { children:
|
|
216
|
+
l.icon && /* @__PURE__ */ n("span", { className: "w-5 h-5", children: l.icon }),
|
|
217
|
+
/* @__PURE__ */ n("span", { children: l.label })
|
|
214
218
|
]
|
|
215
219
|
},
|
|
216
|
-
|
|
220
|
+
l.key
|
|
217
221
|
);
|
|
218
222
|
}) })
|
|
219
223
|
] });
|
|
@@ -222,32 +226,35 @@ const xe = (r, c, s = []) => {
|
|
|
222
226
|
"dialog",
|
|
223
227
|
{
|
|
224
228
|
ref: (e) => {
|
|
225
|
-
|
|
229
|
+
h.current = e, typeof M == "function" ? M(e) : M && (M.current = e);
|
|
226
230
|
},
|
|
227
|
-
className: `${
|
|
228
|
-
onClick:
|
|
229
|
-
|
|
231
|
+
className: `${xe} ${C}`,
|
|
232
|
+
onClick: pe,
|
|
233
|
+
"data-testid": N,
|
|
234
|
+
...J,
|
|
230
235
|
children: /* @__PURE__ */ n(
|
|
231
236
|
"div",
|
|
232
237
|
{
|
|
233
|
-
className: `${
|
|
238
|
+
className: `${ye} p-0 max-w-lg w-full overflow-hidden`,
|
|
234
239
|
role: "dialog",
|
|
235
240
|
"aria-modal": "true",
|
|
236
241
|
"aria-label": "Command palette",
|
|
237
|
-
|
|
238
|
-
|
|
242
|
+
"data-testid": g("dialog"),
|
|
243
|
+
children: /* @__PURE__ */ f(se.Provider, { value: me, children: [
|
|
244
|
+
w.length > 1 && /* @__PURE__ */ f("div", { className: "px-3 py-2 border-b border-base-content/10 flex items-center gap-2 text-sm", children: [
|
|
239
245
|
/* @__PURE__ */ n(
|
|
240
246
|
"button",
|
|
241
247
|
{
|
|
242
|
-
onClick:
|
|
248
|
+
onClick: K,
|
|
243
249
|
className: "hover:bg-base-200 rounded p-1",
|
|
244
250
|
"aria-label": "Go back",
|
|
251
|
+
"data-testid": g("back"),
|
|
245
252
|
children: /* @__PURE__ */ n("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
|
|
246
253
|
}
|
|
247
254
|
),
|
|
248
|
-
/* @__PURE__ */ n("span", { className: "text-base-content/60", children:
|
|
255
|
+
/* @__PURE__ */ n("span", { className: "text-base-content/60", children: te })
|
|
249
256
|
] }),
|
|
250
|
-
/* @__PURE__ */ n("div", { className: "px-3 py-3 border-b border-base-content/10", children: /* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ n("div", { className: "px-3 py-3 border-b border-base-content/10", children: /* @__PURE__ */ f("div", { className: "flex items-center gap-3", children: [
|
|
251
258
|
/* @__PURE__ */ n(
|
|
252
259
|
"svg",
|
|
253
260
|
{
|
|
@@ -269,46 +276,55 @@ const xe = (r, c, s = []) => {
|
|
|
269
276
|
/* @__PURE__ */ n(
|
|
270
277
|
"input",
|
|
271
278
|
{
|
|
272
|
-
ref:
|
|
279
|
+
ref: A,
|
|
273
280
|
type: "text",
|
|
274
281
|
className: "flex-1 bg-transparent border-none outline-none text-base placeholder:text-base-content/50",
|
|
275
282
|
placeholder: I,
|
|
276
|
-
value:
|
|
283
|
+
value: v,
|
|
277
284
|
onChange: (e) => {
|
|
278
|
-
|
|
285
|
+
S(e.target.value), k(0);
|
|
279
286
|
},
|
|
280
|
-
onKeyDown:
|
|
287
|
+
onKeyDown: ue,
|
|
281
288
|
role: "combobox",
|
|
282
289
|
"aria-expanded": "true",
|
|
283
|
-
"aria-controls": `${
|
|
284
|
-
"aria-activedescendant":
|
|
290
|
+
"aria-controls": `${P}-listbox`,
|
|
291
|
+
"aria-activedescendant": E[y] ? `${P}-item-${E[y].id}` : void 0,
|
|
292
|
+
"data-testid": g("input")
|
|
285
293
|
}
|
|
286
294
|
)
|
|
287
295
|
] }) }),
|
|
288
296
|
/* @__PURE__ */ n(
|
|
289
297
|
"div",
|
|
290
298
|
{
|
|
291
|
-
ref:
|
|
299
|
+
ref: B,
|
|
292
300
|
className: "max-h-80 overflow-y-auto py-2",
|
|
293
301
|
role: "listbox",
|
|
294
|
-
id: `${
|
|
295
|
-
|
|
302
|
+
id: `${P}-listbox`,
|
|
303
|
+
"data-testid": g("list"),
|
|
304
|
+
children: d ? H.length > 0 ? fe() : /* @__PURE__ */ n("div", { className: "px-3 py-8 text-center text-base-content/60", "data-testid": g("empty"), children: L }) : r
|
|
296
305
|
}
|
|
297
306
|
),
|
|
298
|
-
/* @__PURE__ */ n(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
"
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
307
|
+
/* @__PURE__ */ n(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
className: "px-3 py-2 border-t border-base-content/10 flex items-center justify-between text-xs text-base-content/50",
|
|
311
|
+
"data-testid": g("footer"),
|
|
312
|
+
children: /* @__PURE__ */ f("div", { className: "flex items-center gap-4", children: [
|
|
313
|
+
/* @__PURE__ */ f("span", { className: "flex items-center gap-1", children: [
|
|
314
|
+
/* @__PURE__ */ n("kbd", { className: `${Z} ${_}`, children: "↑↓" }),
|
|
315
|
+
" navigate"
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ f("span", { className: "flex items-center gap-1", children: [
|
|
318
|
+
/* @__PURE__ */ n("kbd", { className: `${Z} ${_}`, children: "↵" }),
|
|
319
|
+
" select"
|
|
320
|
+
] }),
|
|
321
|
+
/* @__PURE__ */ f("span", { className: "flex items-center gap-1", children: [
|
|
322
|
+
/* @__PURE__ */ n("kbd", { className: `${Z} ${_}`, children: "esc" }),
|
|
323
|
+
" close"
|
|
324
|
+
] })
|
|
325
|
+
] })
|
|
326
|
+
}
|
|
327
|
+
)
|
|
312
328
|
] })
|
|
313
329
|
}
|
|
314
330
|
)
|
|
@@ -316,78 +332,90 @@ const xe = (r, c, s = []) => {
|
|
|
316
332
|
);
|
|
317
333
|
}
|
|
318
334
|
);
|
|
319
|
-
|
|
320
|
-
function
|
|
321
|
-
const { searchValue:
|
|
335
|
+
oe.displayName = "Command";
|
|
336
|
+
function ke({ placeholder: r, value: c, onValueChange: a, "data-testid": i, ...d }) {
|
|
337
|
+
const { searchValue: p, setSearchValue: b, getTestId: x } = D();
|
|
322
338
|
return /* @__PURE__ */ n(
|
|
323
339
|
"input",
|
|
324
340
|
{
|
|
325
341
|
type: "text",
|
|
326
342
|
className: "flex-1 bg-transparent border-none outline-none text-base placeholder:text-base-content/50",
|
|
327
343
|
placeholder: r,
|
|
328
|
-
value: c !== void 0 ? c :
|
|
329
|
-
onChange: (
|
|
330
|
-
const
|
|
331
|
-
|
|
344
|
+
value: c !== void 0 ? c : p,
|
|
345
|
+
onChange: (C) => {
|
|
346
|
+
const N = C.target.value;
|
|
347
|
+
a ? a(N) : b(N);
|
|
332
348
|
},
|
|
349
|
+
"data-testid": i ?? x?.("input"),
|
|
333
350
|
...d
|
|
334
351
|
}
|
|
335
352
|
);
|
|
336
353
|
}
|
|
337
|
-
function
|
|
338
|
-
const { baseId: c, currentPage:
|
|
339
|
-
return /* @__PURE__ */ n("div", { role: "listbox", id: `${c}-listbox`, className: "py-2", children: d });
|
|
354
|
+
function we({ children: r }) {
|
|
355
|
+
const { baseId: c, currentPage: a, getTestId: i } = D(), d = X.Children.toArray(r).filter((p) => X.isValidElement(p) ? p.type === le ? p.props.id === a : a === "root" : !1);
|
|
356
|
+
return /* @__PURE__ */ n("div", { role: "listbox", id: `${c}-listbox`, className: "py-2", "data-testid": i?.("list"), children: d });
|
|
340
357
|
}
|
|
341
|
-
function
|
|
342
|
-
const { searchValue:
|
|
343
|
-
if (!
|
|
344
|
-
const
|
|
345
|
-
return
|
|
358
|
+
function Ie({ heading: r, children: c }) {
|
|
359
|
+
const { searchValue: a, filteredItems: i, getTestId: d } = D(), b = X.Children.toArray(c).some((x) => {
|
|
360
|
+
if (!X.isValidElement(x)) return !1;
|
|
361
|
+
const I = x.props, L = I.value || "";
|
|
362
|
+
return a ? i.some((C) => C.value === L || C.id === I.value) : !0;
|
|
346
363
|
});
|
|
347
|
-
return
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
364
|
+
return a && !b ? null : /* @__PURE__ */ f(
|
|
365
|
+
"div",
|
|
366
|
+
{
|
|
367
|
+
role: "group",
|
|
368
|
+
"aria-label": typeof r == "string" ? r : void 0,
|
|
369
|
+
"data-testid": d?.(`group-${typeof r == "string" ? r : "group"}`),
|
|
370
|
+
children: [
|
|
371
|
+
r && /* @__PURE__ */ n("div", { className: "px-3 py-2 text-xs font-semibold text-base-content/60 uppercase tracking-wider", children: r }),
|
|
372
|
+
c
|
|
373
|
+
]
|
|
374
|
+
}
|
|
375
|
+
);
|
|
351
376
|
}
|
|
352
|
-
function
|
|
377
|
+
function Ce({
|
|
353
378
|
children: r,
|
|
354
379
|
value: c,
|
|
355
|
-
onSelect:
|
|
356
|
-
disabled:
|
|
357
|
-
keywords:
|
|
358
|
-
icon: p
|
|
380
|
+
onSelect: a,
|
|
381
|
+
disabled: i = !1,
|
|
382
|
+
keywords: d = [],
|
|
383
|
+
icon: p,
|
|
384
|
+
"data-testid": b
|
|
359
385
|
}) {
|
|
360
386
|
const {
|
|
361
|
-
registerItem:
|
|
362
|
-
unregisterItem:
|
|
363
|
-
filteredItems:
|
|
364
|
-
highlightedIndex:
|
|
365
|
-
setHighlightedIndex:
|
|
366
|
-
baseId:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
387
|
+
registerItem: x,
|
|
388
|
+
unregisterItem: I,
|
|
389
|
+
filteredItems: L,
|
|
390
|
+
highlightedIndex: C,
|
|
391
|
+
setHighlightedIndex: N,
|
|
392
|
+
baseId: J,
|
|
393
|
+
getTestId: M
|
|
394
|
+
} = D(), h = ae(), A = c || (typeof r == "string" ? r : "");
|
|
395
|
+
j(() => (x(h, A, d, i), () => I(h)), [h, A, d, i, x, I]);
|
|
396
|
+
const B = W(a);
|
|
397
|
+
if (B.current = a, !L.some((u) => u.id === h)) return null;
|
|
398
|
+
const q = L.filter((u) => !u.disabled).findIndex((u) => u.id === h), T = q === C, R = b ?? M?.(`item-${A || h}`), $ = () => {
|
|
399
|
+
!i && a && a();
|
|
373
400
|
};
|
|
374
|
-
return /* @__PURE__ */
|
|
401
|
+
return /* @__PURE__ */ f(
|
|
375
402
|
"div",
|
|
376
403
|
{
|
|
377
|
-
id: `${
|
|
404
|
+
id: `${J}-item-${h}`,
|
|
378
405
|
role: "option",
|
|
379
|
-
"aria-selected":
|
|
380
|
-
"aria-disabled":
|
|
406
|
+
"aria-selected": T,
|
|
407
|
+
"aria-disabled": i,
|
|
381
408
|
"data-command-item": !0,
|
|
382
|
-
"data-highlighted":
|
|
409
|
+
"data-highlighted": T,
|
|
410
|
+
"data-testid": R,
|
|
383
411
|
className: [
|
|
384
412
|
"px-3 py-2 cursor-pointer flex items-center gap-3",
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
413
|
+
T && "bg-primary text-primary-content",
|
|
414
|
+
!T && "hover:bg-base-200",
|
|
415
|
+
i && "opacity-50 cursor-not-allowed"
|
|
388
416
|
].filter(Boolean).join(" "),
|
|
389
|
-
onClick:
|
|
390
|
-
onMouseEnter: () => !
|
|
417
|
+
onClick: $,
|
|
418
|
+
onMouseEnter: () => !i && N(q),
|
|
391
419
|
children: [
|
|
392
420
|
p && /* @__PURE__ */ n("span", { className: "w-5 h-5", children: p }),
|
|
393
421
|
/* @__PURE__ */ n("span", { children: r })
|
|
@@ -395,28 +423,29 @@ function we({
|
|
|
395
423
|
}
|
|
396
424
|
);
|
|
397
425
|
}
|
|
398
|
-
function
|
|
399
|
-
const { filteredItems: c, searchValue:
|
|
400
|
-
return c.length > 0 || !
|
|
426
|
+
function Ne({ children: r = "No results found." }) {
|
|
427
|
+
const { filteredItems: c, searchValue: a, getTestId: i } = D();
|
|
428
|
+
return c.length > 0 || !a ? null : /* @__PURE__ */ n("div", { className: "px-3 py-8 text-center text-base-content/60", "data-testid": i?.("empty"), children: r });
|
|
401
429
|
}
|
|
402
|
-
function
|
|
403
|
-
const { currentPage:
|
|
404
|
-
return
|
|
430
|
+
function le({ id: r, children: c }) {
|
|
431
|
+
const { currentPage: a } = D();
|
|
432
|
+
return a !== r ? null : /* @__PURE__ */ n(re, { children: c });
|
|
405
433
|
}
|
|
406
|
-
function
|
|
407
|
-
|
|
434
|
+
function $e() {
|
|
435
|
+
const { getTestId: r } = D();
|
|
436
|
+
return /* @__PURE__ */ n("div", { className: "my-2 border-t border-base-content/10", role: "separator", "data-testid": r?.("separator") });
|
|
408
437
|
}
|
|
409
|
-
const
|
|
410
|
-
Input:
|
|
411
|
-
List:
|
|
412
|
-
Group:
|
|
413
|
-
Item:
|
|
414
|
-
Empty:
|
|
415
|
-
Page:
|
|
416
|
-
Separator:
|
|
438
|
+
const Ve = Object.assign(oe, {
|
|
439
|
+
Input: ke,
|
|
440
|
+
List: we,
|
|
441
|
+
Group: Ie,
|
|
442
|
+
Item: Ce,
|
|
443
|
+
Empty: Ne,
|
|
444
|
+
Page: le,
|
|
445
|
+
Separator: $e
|
|
417
446
|
});
|
|
418
447
|
export {
|
|
419
|
-
|
|
420
|
-
|
|
448
|
+
Ve as Command,
|
|
449
|
+
Ve as default
|
|
421
450
|
};
|
|
422
451
|
//# sourceMappingURL=Command.js.map
|