asterui 0.12.59 → 0.12.61
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/Cascader.js +147 -146
- package/dist/components/Cascader.js.map +1 -1
- package/dist/components/ContextMenu.js +90 -89
- package/dist/components/ContextMenu.js.map +1 -1
- package/dist/components/Drawer.js +66 -65
- package/dist/components/Drawer.js.map +1 -1
- package/dist/components/Dropdown.js +174 -173
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/Mention.js +66 -65
- package/dist/components/Mention.js.map +1 -1
- package/dist/components/Tour.js +83 -82
- package/dist/components/Tour.js.map +1 -1
- package/dist/components/Transfer.js +107 -103
- package/dist/components/Transfer.js.map +1 -1
- package/dist/components/TreeSelect.js +245 -244
- package/dist/components/TreeSelect.js.map +1 -1
- package/dist/providers/ConfigProvider.d.ts +8 -0
- package/dist/providers/ConfigProvider.js +31 -27
- package/dist/providers/ConfigProvider.js.map +1 -1
- package/package.json +5 -3
|
@@ -1,162 +1,163 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { jsx as d, jsxs as j, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
+
import x, { forwardRef as he, useId as V, useState as $, useRef as N, useImperativeHandle as De, useCallback as K, useEffect as L, createContext as ye, useContext as Ie } from "react";
|
|
3
|
+
import { useConfig as xe } from "../providers/ConfigProvider.js";
|
|
4
|
+
const Ce = "dropdown", ke = "dropdown-top", ve = "dropdown-bottom", Ee = "dropdown-left", Me = "dropdown-right", Ae = "dropdown-center", Te = "dropdown-end", Re = "dropdown-hover", Ne = "dropdown-open", Se = "dropdown-content", J = "menu", Q = ye(void 0);
|
|
4
5
|
function z() {
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
6
|
+
const i = Ie(Q);
|
|
7
|
+
if (!i)
|
|
7
8
|
throw new Error("Dropdown compound components must be used within Dropdown");
|
|
8
|
-
return
|
|
9
|
+
return i;
|
|
9
10
|
}
|
|
10
|
-
const
|
|
11
|
+
const Ke = he(function({
|
|
11
12
|
children: l,
|
|
12
13
|
items: f,
|
|
13
|
-
trigger:
|
|
14
|
+
trigger: u = ["click"],
|
|
14
15
|
position: m = "bottom",
|
|
15
16
|
align: o = "start",
|
|
16
17
|
open: s,
|
|
17
18
|
onOpenChange: r,
|
|
18
|
-
disabled:
|
|
19
|
+
disabled: h,
|
|
19
20
|
arrow: b = !1,
|
|
20
21
|
mouseEnterDelay: w = 0.15,
|
|
21
22
|
mouseLeaveDelay: D = 0.1,
|
|
22
|
-
getPopupContainer:
|
|
23
|
+
getPopupContainer: g,
|
|
23
24
|
destroyOnHidden: t = !1,
|
|
24
|
-
popupRender:
|
|
25
|
+
popupRender: k,
|
|
25
26
|
"data-testid": y,
|
|
26
|
-
className:
|
|
27
|
+
className: P = "",
|
|
27
28
|
...O
|
|
28
29
|
}, a) {
|
|
29
|
-
const e = V(),
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
}, [
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
M ?
|
|
30
|
+
const { componentDisabled: e, getPopupContainer: C } = xe(), p = h ?? e ?? !1, v = V(), A = V(), [ee, ne] = $(!1), [te, U] = $(-1), [re, oe] = $(0), [se, W] = $(!t), _ = N(/* @__PURE__ */ new Map()), F = N(null), E = N(null), T = u;
|
|
31
|
+
De(a, () => F.current, []);
|
|
32
|
+
const ae = (n) => y ? `${y}-${n}` : void 0, q = s !== void 0, R = q ? s : ee, I = K((n, M = "trigger") => {
|
|
33
|
+
p || (q || ne(n), n && W(!0), r?.(n, { source: M }));
|
|
34
|
+
}, [p, q, r]), le = K(() => {
|
|
35
|
+
I(!1, "menu"), U(-1), document.getElementById(A)?.focus();
|
|
36
|
+
}, [I, A]), ce = K((n, M, c) => {
|
|
37
|
+
M ? _.current.set(n, { ref: M, disabled: c }) : _.current.delete(n);
|
|
37
38
|
}, []);
|
|
38
39
|
L(() => {
|
|
39
|
-
if (t && !
|
|
40
|
-
const n = setTimeout(() =>
|
|
40
|
+
if (t && !R) {
|
|
41
|
+
const n = setTimeout(() => W(!1), 300);
|
|
41
42
|
return () => clearTimeout(n);
|
|
42
43
|
}
|
|
43
|
-
}, [
|
|
44
|
+
}, [R, t]), L(() => {
|
|
44
45
|
const n = (M) => {
|
|
45
|
-
F.current && !F.current.contains(M.target) && (
|
|
46
|
+
F.current && !F.current.contains(M.target) && (I(!1, "trigger"), U(-1));
|
|
46
47
|
};
|
|
47
|
-
if (
|
|
48
|
+
if (R)
|
|
48
49
|
return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
49
|
-
}, [
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
}, [R, I]);
|
|
51
|
+
const de = K(() => {
|
|
52
|
+
T.includes("hover") && (E.current && clearTimeout(E.current), E.current = setTimeout(() => {
|
|
53
|
+
I(!0, "trigger");
|
|
53
54
|
}, w * 1e3));
|
|
54
|
-
}, [
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
}, [T, w, I]), ie = K(() => {
|
|
56
|
+
T.includes("hover") && (E.current && clearTimeout(E.current), E.current = setTimeout(() => {
|
|
57
|
+
I(!1, "trigger"), U(-1);
|
|
57
58
|
}, D * 1e3));
|
|
58
|
-
}, [
|
|
59
|
-
|
|
60
|
-
}, [
|
|
59
|
+
}, [T, D, I]), ue = K((n) => {
|
|
60
|
+
T.includes("contextMenu") && (n.preventDefault(), I(!0, "trigger"));
|
|
61
|
+
}, [T, I]);
|
|
61
62
|
L(() => () => {
|
|
62
63
|
E.current && clearTimeout(E.current);
|
|
63
64
|
}, []);
|
|
64
|
-
const
|
|
65
|
-
top:
|
|
66
|
-
bottom:
|
|
67
|
-
left:
|
|
68
|
-
right:
|
|
69
|
-
},
|
|
65
|
+
const pe = {
|
|
66
|
+
top: ke,
|
|
67
|
+
bottom: ve,
|
|
68
|
+
left: Ee,
|
|
69
|
+
right: Me
|
|
70
|
+
}, fe = {
|
|
70
71
|
start: "",
|
|
71
|
-
center:
|
|
72
|
-
end:
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
].filter(Boolean).join(" "), H = f ? (
|
|
72
|
+
center: Ae,
|
|
73
|
+
end: Te
|
|
74
|
+
}, me = typeof b == "boolean" ? b : !!b, be = [
|
|
75
|
+
Ce,
|
|
76
|
+
pe[m],
|
|
77
|
+
fe[o],
|
|
78
|
+
T.includes("hover") && Re,
|
|
79
|
+
R && Ne,
|
|
80
|
+
P
|
|
81
|
+
].filter(Boolean).join(" "), H = f ? (se || !t) && /* @__PURE__ */ d(Y, { children: f ? f.map((n, M) => {
|
|
81
82
|
if ("type" in n && n.type === "divider")
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
const
|
|
84
|
-
return
|
|
85
|
-
|
|
83
|
+
return /* @__PURE__ */ d(Z, {}, n.key || `divider-${M}`);
|
|
84
|
+
const c = n;
|
|
85
|
+
return c.children && c.children.length > 0 ? /* @__PURE__ */ d(
|
|
86
|
+
G,
|
|
86
87
|
{
|
|
87
|
-
title:
|
|
88
|
-
icon:
|
|
89
|
-
disabled:
|
|
90
|
-
children:
|
|
88
|
+
title: c.label,
|
|
89
|
+
icon: c.icon,
|
|
90
|
+
disabled: c.disabled,
|
|
91
|
+
children: c.children.map((S) => /* @__PURE__ */ d(
|
|
91
92
|
B,
|
|
92
93
|
{
|
|
93
|
-
icon:
|
|
94
|
-
disabled:
|
|
95
|
-
danger:
|
|
96
|
-
onClick:
|
|
97
|
-
children:
|
|
94
|
+
icon: S.icon,
|
|
95
|
+
disabled: S.disabled,
|
|
96
|
+
danger: S.danger,
|
|
97
|
+
onClick: S.onClick,
|
|
98
|
+
children: S.label
|
|
98
99
|
},
|
|
99
|
-
|
|
100
|
+
S.key
|
|
100
101
|
))
|
|
101
102
|
},
|
|
102
|
-
|
|
103
|
-
) : /* @__PURE__ */
|
|
103
|
+
c.key
|
|
104
|
+
) : /* @__PURE__ */ d(
|
|
104
105
|
B,
|
|
105
106
|
{
|
|
106
|
-
icon:
|
|
107
|
-
disabled:
|
|
108
|
-
danger:
|
|
109
|
-
onClick:
|
|
110
|
-
children:
|
|
107
|
+
icon: c.icon,
|
|
108
|
+
disabled: c.disabled,
|
|
109
|
+
danger: c.danger,
|
|
110
|
+
onClick: c.onClick,
|
|
111
|
+
children: c.label
|
|
111
112
|
},
|
|
112
|
-
|
|
113
|
+
c.key
|
|
113
114
|
);
|
|
114
|
-
}) : null }) : null,
|
|
115
|
-
|
|
116
|
-
(n) =>
|
|
115
|
+
}) : null }) : null, we = f ? /* @__PURE__ */ j(ge, { children: [
|
|
116
|
+
x.Children.toArray(l).find(
|
|
117
|
+
(n) => x.isValidElement(n) && n.type === X
|
|
117
118
|
),
|
|
118
|
-
|
|
119
|
+
k ? k(H) : H
|
|
119
120
|
] }) : l;
|
|
120
|
-
return /* @__PURE__ */
|
|
121
|
+
return /* @__PURE__ */ d(
|
|
121
122
|
Q.Provider,
|
|
122
123
|
{
|
|
123
124
|
value: {
|
|
124
125
|
position: m,
|
|
125
126
|
align: o,
|
|
126
|
-
menuId:
|
|
127
|
-
triggerId:
|
|
128
|
-
isOpen:
|
|
129
|
-
setIsOpen:
|
|
130
|
-
focusedIndex:
|
|
127
|
+
menuId: v,
|
|
128
|
+
triggerId: A,
|
|
129
|
+
isOpen: R,
|
|
130
|
+
setIsOpen: I,
|
|
131
|
+
focusedIndex: te,
|
|
131
132
|
setFocusedIndex: U,
|
|
132
|
-
registerItem:
|
|
133
|
-
itemCount:
|
|
134
|
-
setItemCount:
|
|
135
|
-
disabled:
|
|
136
|
-
arrow:
|
|
137
|
-
closeDropdown:
|
|
138
|
-
getTestId:
|
|
133
|
+
registerItem: ce,
|
|
134
|
+
itemCount: re,
|
|
135
|
+
setItemCount: oe,
|
|
136
|
+
disabled: p,
|
|
137
|
+
arrow: me,
|
|
138
|
+
closeDropdown: le,
|
|
139
|
+
getTestId: ae
|
|
139
140
|
},
|
|
140
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ d(
|
|
141
142
|
"div",
|
|
142
143
|
{
|
|
143
144
|
ref: F,
|
|
144
|
-
className:
|
|
145
|
-
"data-state":
|
|
145
|
+
className: be,
|
|
146
|
+
"data-state": R ? "open" : "closed",
|
|
146
147
|
"data-testid": y,
|
|
147
|
-
"aria-disabled":
|
|
148
|
-
onMouseEnter:
|
|
149
|
-
onMouseLeave:
|
|
150
|
-
onContextMenu:
|
|
148
|
+
"aria-disabled": p || void 0,
|
|
149
|
+
onMouseEnter: de,
|
|
150
|
+
onMouseLeave: ie,
|
|
151
|
+
onContextMenu: ue,
|
|
151
152
|
...O,
|
|
152
|
-
children:
|
|
153
|
+
children: we
|
|
153
154
|
}
|
|
154
155
|
)
|
|
155
156
|
}
|
|
156
157
|
);
|
|
157
158
|
});
|
|
158
|
-
function X({ children:
|
|
159
|
-
const { menuId: f, triggerId:
|
|
159
|
+
function X({ children: i, className: l = "" }) {
|
|
160
|
+
const { menuId: f, triggerId: u, isOpen: m, setIsOpen: o, setFocusedIndex: s, itemCount: r, disabled: h } = z(), b = (t) => {
|
|
160
161
|
switch (t.key) {
|
|
161
162
|
case "Enter":
|
|
162
163
|
case " ":
|
|
@@ -172,73 +173,73 @@ function X({ children: u, className: l = "" }) {
|
|
|
172
173
|
}
|
|
173
174
|
}, w = () => {
|
|
174
175
|
o(!m), m || s(0);
|
|
175
|
-
}, D =
|
|
176
|
-
return
|
|
177
|
-
id:
|
|
178
|
-
tabIndex:
|
|
176
|
+
}, D = x.Children.only(i), g = D.props;
|
|
177
|
+
return x.cloneElement(D, {
|
|
178
|
+
id: u,
|
|
179
|
+
tabIndex: h ? -1 : 0,
|
|
179
180
|
"aria-haspopup": "menu",
|
|
180
181
|
"aria-expanded": m,
|
|
181
182
|
"aria-controls": f,
|
|
182
183
|
onClick: (t) => {
|
|
183
|
-
w(),
|
|
184
|
+
w(), g.onClick?.(t);
|
|
184
185
|
},
|
|
185
186
|
onKeyDown: (t) => {
|
|
186
|
-
b(t),
|
|
187
|
+
b(t), g.onKeyDown?.(t);
|
|
187
188
|
},
|
|
188
|
-
className: `${
|
|
189
|
+
className: `${g.className || ""} ${l}`.trim()
|
|
189
190
|
});
|
|
190
191
|
}
|
|
191
|
-
function Y({ children:
|
|
192
|
-
const { menuId: f, triggerId:
|
|
193
|
-
(e) =>
|
|
192
|
+
function Y({ children: i, className: l = "" }) {
|
|
193
|
+
const { menuId: f, triggerId: u, isOpen: m, setIsOpen: o, focusedIndex: s, setFocusedIndex: r, setItemCount: h, arrow: b, position: w, getTestId: D } = z(), g = N(null), t = x.Children.toArray(i).filter(
|
|
194
|
+
(e) => x.isValidElement(e) && e.type === B
|
|
194
195
|
);
|
|
195
196
|
L(() => {
|
|
196
|
-
|
|
197
|
-
}, [t.length,
|
|
198
|
-
m && s >= 0 &&
|
|
197
|
+
h(t.length);
|
|
198
|
+
}, [t.length, h]), L(() => {
|
|
199
|
+
m && s >= 0 && g.current && g.current.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')[s]?.focus();
|
|
199
200
|
}, [m, s]);
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
(v) =>
|
|
201
|
+
const k = (e) => {
|
|
202
|
+
const p = t.filter(
|
|
203
|
+
(v) => x.isValidElement(v) && !v.props.disabled
|
|
203
204
|
).length;
|
|
204
205
|
switch (e.key) {
|
|
205
206
|
case "ArrowDown":
|
|
206
|
-
e.preventDefault(), r((s + 1) %
|
|
207
|
+
e.preventDefault(), r((s + 1) % p);
|
|
207
208
|
break;
|
|
208
209
|
case "ArrowUp":
|
|
209
|
-
e.preventDefault(), r((s - 1 +
|
|
210
|
+
e.preventDefault(), r((s - 1 + p) % p);
|
|
210
211
|
break;
|
|
211
212
|
case "Home":
|
|
212
213
|
e.preventDefault(), r(0);
|
|
213
214
|
break;
|
|
214
215
|
case "End":
|
|
215
|
-
e.preventDefault(), r(
|
|
216
|
+
e.preventDefault(), r(p - 1);
|
|
216
217
|
break;
|
|
217
218
|
case "Escape":
|
|
218
|
-
e.preventDefault(), o(!1), r(-1), document.getElementById(
|
|
219
|
+
e.preventDefault(), o(!1), r(-1), document.getElementById(u)?.focus();
|
|
219
220
|
break;
|
|
220
221
|
case "Tab":
|
|
221
222
|
o(!1), r(-1);
|
|
222
223
|
break;
|
|
223
224
|
}
|
|
224
225
|
}, y = [
|
|
225
|
-
|
|
226
|
+
Se,
|
|
226
227
|
J,
|
|
227
228
|
"bg-base-100",
|
|
228
229
|
"rounded-box",
|
|
229
230
|
"z-50",
|
|
230
231
|
"shadow",
|
|
231
232
|
l
|
|
232
|
-
].filter(Boolean).join(" "),
|
|
233
|
-
if (
|
|
234
|
-
const
|
|
233
|
+
].filter(Boolean).join(" "), P = x.Children.map(i, (e, C) => {
|
|
234
|
+
if (x.isValidElement(e)) {
|
|
235
|
+
const p = e.key != null ? String(e.key) : void 0;
|
|
235
236
|
if (e.type === B)
|
|
236
|
-
return
|
|
237
|
-
if (e.type ===
|
|
238
|
-
return
|
|
237
|
+
return x.cloneElement(e, { _index: C, _key: p });
|
|
238
|
+
if (e.type === G)
|
|
239
|
+
return x.cloneElement(e, { _key: p });
|
|
239
240
|
}
|
|
240
241
|
return e;
|
|
241
|
-
}), a = b ? /* @__PURE__ */
|
|
242
|
+
}), a = b ? /* @__PURE__ */ d(
|
|
242
243
|
"span",
|
|
243
244
|
{
|
|
244
245
|
className: `absolute w-0 h-0 border-8 border-solid ${{
|
|
@@ -253,83 +254,83 @@ function Y({ children: u, className: l = "" }) {
|
|
|
253
254
|
return /* @__PURE__ */ j(
|
|
254
255
|
"ul",
|
|
255
256
|
{
|
|
256
|
-
ref:
|
|
257
|
+
ref: g,
|
|
257
258
|
id: f,
|
|
258
259
|
role: "menu",
|
|
259
|
-
"aria-labelledby":
|
|
260
|
+
"aria-labelledby": u,
|
|
260
261
|
tabIndex: -1,
|
|
261
262
|
className: `${y} ${b ? "relative" : ""}`,
|
|
262
263
|
"data-testid": D("menu"),
|
|
263
|
-
onKeyDown:
|
|
264
|
+
onKeyDown: k,
|
|
264
265
|
children: [
|
|
265
266
|
a,
|
|
266
|
-
|
|
267
|
+
P
|
|
267
268
|
]
|
|
268
269
|
}
|
|
269
270
|
);
|
|
270
271
|
}
|
|
271
272
|
function B({
|
|
272
|
-
children:
|
|
273
|
+
children: i,
|
|
273
274
|
icon: l,
|
|
274
275
|
label: f,
|
|
275
|
-
onClick:
|
|
276
|
+
onClick: u,
|
|
276
277
|
active: m = !1,
|
|
277
278
|
disabled: o = !1,
|
|
278
279
|
danger: s = !1,
|
|
279
280
|
className: r = "",
|
|
280
|
-
_key:
|
|
281
|
+
_key: h
|
|
281
282
|
}) {
|
|
282
|
-
const { closeDropdown: b, getTestId: w } = z(), D = [m && "active", o && "disabled", r].filter(Boolean).join(" "),
|
|
283
|
-
o || (
|
|
283
|
+
const { closeDropdown: b, getTestId: w } = z(), D = [m && "active", o && "disabled", r].filter(Boolean).join(" "), g = () => {
|
|
284
|
+
o || (u?.(), b());
|
|
284
285
|
}, t = (y) => {
|
|
285
|
-
(y.key === "Enter" || y.key === " ") && !o && (y.preventDefault(),
|
|
286
|
-
},
|
|
287
|
-
return /* @__PURE__ */
|
|
286
|
+
(y.key === "Enter" || y.key === " ") && !o && (y.preventDefault(), g());
|
|
287
|
+
}, k = f || i;
|
|
288
|
+
return /* @__PURE__ */ d("li", { className: D, role: "none", "data-key": h, "data-testid": h ? w(`item-${h}`) : void 0, children: /* @__PURE__ */ j(
|
|
288
289
|
"a",
|
|
289
290
|
{
|
|
290
291
|
role: "menuitem",
|
|
291
292
|
tabIndex: o ? -1 : 0,
|
|
292
293
|
"aria-disabled": o || void 0,
|
|
293
294
|
className: s ? "text-error" : "",
|
|
294
|
-
onClick:
|
|
295
|
+
onClick: g,
|
|
295
296
|
onKeyDown: t,
|
|
296
297
|
children: [
|
|
297
|
-
l && /* @__PURE__ */
|
|
298
|
-
|
|
298
|
+
l && /* @__PURE__ */ d("span", { className: "mr-2 inline-flex items-center", children: l }),
|
|
299
|
+
k
|
|
299
300
|
]
|
|
300
301
|
}
|
|
301
302
|
) });
|
|
302
303
|
}
|
|
303
|
-
function
|
|
304
|
-
children:
|
|
304
|
+
function G({
|
|
305
|
+
children: i,
|
|
305
306
|
title: l,
|
|
306
307
|
icon: f,
|
|
307
|
-
disabled:
|
|
308
|
+
disabled: u = !1,
|
|
308
309
|
className: m = "",
|
|
309
310
|
_key: o
|
|
310
311
|
}) {
|
|
311
|
-
const [s, r] = $(!1),
|
|
312
|
-
|
|
312
|
+
const [s, r] = $(!1), h = N(null), b = N(null), w = N(null), D = V(), g = () => {
|
|
313
|
+
u || r(!0);
|
|
313
314
|
}, t = () => {
|
|
314
315
|
r(!1);
|
|
315
|
-
},
|
|
316
|
+
}, k = () => {
|
|
316
317
|
setTimeout(() => {
|
|
317
318
|
w.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])')?.focus();
|
|
318
319
|
}, 0);
|
|
319
320
|
}, y = (a) => {
|
|
320
|
-
if (!
|
|
321
|
+
if (!u)
|
|
321
322
|
switch (a.key) {
|
|
322
323
|
case "ArrowRight":
|
|
323
324
|
case "Enter":
|
|
324
325
|
case " ":
|
|
325
|
-
a.preventDefault(), a.stopPropagation(), r(!0),
|
|
326
|
+
a.preventDefault(), a.stopPropagation(), r(!0), k();
|
|
326
327
|
break;
|
|
327
328
|
case "ArrowLeft":
|
|
328
329
|
case "Escape":
|
|
329
330
|
a.preventDefault(), a.stopPropagation(), r(!1);
|
|
330
331
|
break;
|
|
331
332
|
}
|
|
332
|
-
},
|
|
333
|
+
}, P = (a) => {
|
|
333
334
|
switch (a.key) {
|
|
334
335
|
case "ArrowLeft":
|
|
335
336
|
case "Escape":
|
|
@@ -339,28 +340,28 @@ function W({
|
|
|
339
340
|
a.preventDefault(), a.stopPropagation();
|
|
340
341
|
const e = w.current?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])');
|
|
341
342
|
if (e) {
|
|
342
|
-
const v = (Array.from(e).findIndex((
|
|
343
|
+
const v = (Array.from(e).findIndex((A) => A === document.activeElement) + 1) % e.length;
|
|
343
344
|
e[v]?.focus();
|
|
344
345
|
}
|
|
345
346
|
break;
|
|
346
347
|
case "ArrowUp":
|
|
347
348
|
a.preventDefault(), a.stopPropagation();
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
const v = (Array.from(
|
|
351
|
-
|
|
349
|
+
const C = w.current?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])');
|
|
350
|
+
if (C) {
|
|
351
|
+
const v = (Array.from(C).findIndex((A) => A === document.activeElement) - 1 + C.length) % C.length;
|
|
352
|
+
C[v]?.focus();
|
|
352
353
|
}
|
|
353
354
|
break;
|
|
354
355
|
}
|
|
355
|
-
}, O = [
|
|
356
|
-
return /* @__PURE__ */
|
|
356
|
+
}, O = [u && "disabled", m].filter(Boolean).join(" ");
|
|
357
|
+
return /* @__PURE__ */ d(
|
|
357
358
|
"li",
|
|
358
359
|
{
|
|
359
|
-
ref:
|
|
360
|
+
ref: h,
|
|
360
361
|
className: O,
|
|
361
362
|
role: "none",
|
|
362
363
|
"data-key": o,
|
|
363
|
-
onMouseEnter:
|
|
364
|
+
onMouseEnter: g,
|
|
364
365
|
onMouseLeave: t,
|
|
365
366
|
children: /* @__PURE__ */ j("details", { open: s, children: [
|
|
366
367
|
/* @__PURE__ */ j(
|
|
@@ -368,19 +369,19 @@ function W({
|
|
|
368
369
|
{
|
|
369
370
|
ref: b,
|
|
370
371
|
role: "menuitem",
|
|
371
|
-
tabIndex:
|
|
372
|
-
"aria-disabled":
|
|
372
|
+
tabIndex: u ? -1 : 0,
|
|
373
|
+
"aria-disabled": u || void 0,
|
|
373
374
|
"aria-haspopup": "menu",
|
|
374
375
|
"aria-expanded": s,
|
|
375
376
|
"aria-controls": D,
|
|
376
377
|
onKeyDown: y,
|
|
377
378
|
children: [
|
|
378
|
-
f && /* @__PURE__ */
|
|
379
|
+
f && /* @__PURE__ */ d("span", { className: "mr-2 inline-flex items-center", children: f }),
|
|
379
380
|
l
|
|
380
381
|
]
|
|
381
382
|
}
|
|
382
383
|
),
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ d(
|
|
384
385
|
"ul",
|
|
385
386
|
{
|
|
386
387
|
ref: w,
|
|
@@ -388,26 +389,26 @@ function W({
|
|
|
388
389
|
className: `${J} bg-base-100 rounded-box z-50 shadow`,
|
|
389
390
|
role: "menu",
|
|
390
391
|
"aria-label": typeof l == "string" ? l : void 0,
|
|
391
|
-
onKeyDown:
|
|
392
|
-
children:
|
|
392
|
+
onKeyDown: P,
|
|
393
|
+
children: i
|
|
393
394
|
}
|
|
394
395
|
)
|
|
395
396
|
] })
|
|
396
397
|
}
|
|
397
398
|
);
|
|
398
399
|
}
|
|
399
|
-
function Z({ className:
|
|
400
|
-
const l = ["border-base-content/10",
|
|
401
|
-
return /* @__PURE__ */
|
|
400
|
+
function Z({ className: i = "" }) {
|
|
401
|
+
const l = ["border-base-content/10", i].filter(Boolean).join(" ");
|
|
402
|
+
return /* @__PURE__ */ d("li", { role: "separator", className: "my-1", children: /* @__PURE__ */ d("hr", { className: l }) });
|
|
402
403
|
}
|
|
403
|
-
const
|
|
404
|
+
const Be = Object.assign(Ke, {
|
|
404
405
|
Trigger: X,
|
|
405
406
|
Menu: Y,
|
|
406
407
|
Item: B,
|
|
407
|
-
SubMenu:
|
|
408
|
+
SubMenu: G,
|
|
408
409
|
Divider: Z
|
|
409
410
|
});
|
|
410
411
|
export {
|
|
411
|
-
|
|
412
|
+
Be as Dropdown
|
|
412
413
|
};
|
|
413
414
|
//# sourceMappingURL=Dropdown.js.map
|