asterui 0.12.71 → 0.12.73

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