asterui 0.12.55 → 0.12.57

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