asterui 0.12.72 → 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
|
|
2
|
-
import
|
|
3
|
-
import { useConfig as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
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
|
|
9
|
+
return u;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
children:
|
|
13
|
-
items:
|
|
14
|
-
trigger:
|
|
15
|
-
position:
|
|
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:
|
|
20
|
-
arrow:
|
|
21
|
-
mouseEnterDelay:
|
|
22
|
-
mouseLeaveDelay:
|
|
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:
|
|
26
|
-
"data-testid":
|
|
27
|
-
className:
|
|
28
|
-
...
|
|
25
|
+
popupRender: E,
|
|
26
|
+
"data-testid": C,
|
|
27
|
+
className: T = "",
|
|
28
|
+
...F
|
|
29
29
|
}, a) {
|
|
30
|
-
const { componentDisabled:
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
|
|
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
|
-
|
|
40
|
-
if (t && !
|
|
41
|
-
const
|
|
42
|
-
return () => clearTimeout(
|
|
39
|
+
V(() => {
|
|
40
|
+
if (t && !S) {
|
|
41
|
+
const e = setTimeout(() => Z(!1), 300);
|
|
42
|
+
return () => clearTimeout(e);
|
|
43
43
|
}
|
|
44
|
-
}, [
|
|
45
|
-
const
|
|
46
|
-
|
|
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 (
|
|
49
|
-
return document.addEventListener("mousedown",
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
}, [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
}, [
|
|
60
|
-
|
|
61
|
-
}, [
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
66
|
-
top:
|
|
67
|
-
bottom:
|
|
68
|
-
left:
|
|
69
|
-
right:
|
|
70
|
-
},
|
|
65
|
+
const be = {
|
|
66
|
+
top: Me,
|
|
67
|
+
bottom: Ae,
|
|
68
|
+
left: Te,
|
|
69
|
+
right: Re
|
|
70
|
+
}, we = {
|
|
71
71
|
start: "",
|
|
72
|
-
center:
|
|
73
|
-
end:
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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:
|
|
89
|
-
icon:
|
|
90
|
-
disabled:
|
|
91
|
-
children:
|
|
92
|
-
|
|
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:
|
|
95
|
-
disabled:
|
|
96
|
-
danger:
|
|
97
|
-
onClick:
|
|
98
|
-
children:
|
|
87
|
+
icon: P.icon,
|
|
88
|
+
disabled: P.disabled,
|
|
89
|
+
danger: P.danger,
|
|
90
|
+
onClick: P.onClick,
|
|
91
|
+
children: P.label
|
|
99
92
|
},
|
|
100
|
-
|
|
93
|
+
P.key
|
|
101
94
|
))
|
|
102
95
|
},
|
|
103
|
-
|
|
104
|
-
) : /* @__PURE__ */
|
|
105
|
-
|
|
96
|
+
l.key
|
|
97
|
+
) : /* @__PURE__ */ i(
|
|
98
|
+
U,
|
|
106
99
|
{
|
|
107
|
-
icon:
|
|
108
|
-
disabled:
|
|
109
|
-
danger:
|
|
110
|
-
onClick:
|
|
111
|
-
children:
|
|
100
|
+
icon: l.icon,
|
|
101
|
+
disabled: l.disabled,
|
|
102
|
+
danger: l.danger,
|
|
103
|
+
onClick: l.onClick,
|
|
104
|
+
children: l.label
|
|
112
105
|
},
|
|
113
|
-
|
|
106
|
+
l.key
|
|
114
107
|
);
|
|
115
|
-
}) : null }) : null,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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:
|
|
146
|
+
position: b,
|
|
126
147
|
align: o,
|
|
127
|
-
menuId:
|
|
128
|
-
triggerId:
|
|
129
|
-
isOpen:
|
|
130
|
-
setIsOpen:
|
|
131
|
-
focusedIndex:
|
|
132
|
-
setFocusedIndex:
|
|
133
|
-
registerItem:
|
|
134
|
-
itemCount:
|
|
135
|
-
setItemCount:
|
|
136
|
-
disabled:
|
|
137
|
-
arrow:
|
|
138
|
-
closeDropdown:
|
|
139
|
-
getTestId:
|
|
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__ */
|
|
162
|
+
children: /* @__PURE__ */ i(
|
|
142
163
|
"div",
|
|
143
164
|
{
|
|
144
|
-
ref:
|
|
145
|
-
className:
|
|
146
|
-
"data-state":
|
|
147
|
-
"data-testid":
|
|
148
|
-
"aria-disabled":
|
|
149
|
-
onMouseEnter:
|
|
150
|
-
onMouseLeave:
|
|
151
|
-
onContextMenu:
|
|
152
|
-
...
|
|
153
|
-
children:
|
|
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
|
|
160
|
-
const { menuId:
|
|
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
|
-
},
|
|
175
|
-
o(!
|
|
176
|
-
},
|
|
177
|
-
return
|
|
178
|
-
id:
|
|
179
|
-
tabIndex:
|
|
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":
|
|
182
|
-
"aria-controls":
|
|
202
|
+
"aria-expanded": b,
|
|
203
|
+
"aria-controls": m,
|
|
183
204
|
onClick: (t) => {
|
|
184
|
-
|
|
205
|
+
h(), g.onClick?.(t);
|
|
185
206
|
},
|
|
186
207
|
onKeyDown: (t) => {
|
|
187
|
-
|
|
208
|
+
w(t), g.onKeyDown?.(t);
|
|
188
209
|
},
|
|
189
|
-
className: `${g.className || ""} ${
|
|
210
|
+
className: `${g.className || ""} ${c}`.trim()
|
|
190
211
|
});
|
|
191
212
|
}
|
|
192
|
-
function
|
|
193
|
-
const { menuId:
|
|
194
|
-
(
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
}, [t.length,
|
|
199
|
-
|
|
200
|
-
}, [
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
(
|
|
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 (
|
|
226
|
+
switch (n.key) {
|
|
206
227
|
case "ArrowDown":
|
|
207
|
-
|
|
228
|
+
n.preventDefault(), r((s + 1) % x);
|
|
208
229
|
break;
|
|
209
230
|
case "ArrowUp":
|
|
210
|
-
|
|
231
|
+
n.preventDefault(), r((s - 1 + x) % x);
|
|
211
232
|
break;
|
|
212
233
|
case "Home":
|
|
213
|
-
|
|
234
|
+
n.preventDefault(), r(0);
|
|
214
235
|
break;
|
|
215
236
|
case "End":
|
|
216
|
-
|
|
237
|
+
n.preventDefault(), r(x - 1);
|
|
217
238
|
break;
|
|
218
239
|
case "Escape":
|
|
219
|
-
|
|
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
|
-
},
|
|
226
|
-
|
|
227
|
-
|
|
246
|
+
}, C = [
|
|
247
|
+
$e,
|
|
248
|
+
ne,
|
|
228
249
|
"bg-base-100",
|
|
229
250
|
"rounded-box",
|
|
230
251
|
"z-50",
|
|
231
252
|
"shadow",
|
|
232
|
-
|
|
233
|
-
].filter(Boolean).join(" "),
|
|
234
|
-
if (
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
return
|
|
238
|
-
if (
|
|
239
|
-
return
|
|
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
|
|
242
|
-
}), a =
|
|
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
|
-
}[
|
|
271
|
+
}[h || "bottom"]}`,
|
|
251
272
|
"aria-hidden": "true"
|
|
252
273
|
}
|
|
253
274
|
) : null;
|
|
254
|
-
return /* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ K(
|
|
255
276
|
"ul",
|
|
256
277
|
{
|
|
257
278
|
ref: g,
|
|
258
|
-
id:
|
|
279
|
+
id: m,
|
|
259
280
|
role: "menu",
|
|
260
|
-
"aria-labelledby":
|
|
281
|
+
"aria-labelledby": p,
|
|
261
282
|
tabIndex: -1,
|
|
262
|
-
className: `${
|
|
263
|
-
"data-testid":
|
|
264
|
-
onKeyDown:
|
|
283
|
+
className: `${C} ${w ? "relative" : ""}`,
|
|
284
|
+
"data-testid": I("menu"),
|
|
285
|
+
onKeyDown: E,
|
|
265
286
|
children: [
|
|
266
287
|
a,
|
|
267
|
-
|
|
288
|
+
T
|
|
268
289
|
]
|
|
269
290
|
}
|
|
270
291
|
);
|
|
271
292
|
}
|
|
272
|
-
function
|
|
273
|
-
children:
|
|
274
|
-
icon:
|
|
275
|
-
label:
|
|
276
|
-
onClick:
|
|
277
|
-
active:
|
|
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:
|
|
302
|
+
_key: y
|
|
282
303
|
}) {
|
|
283
|
-
const { closeDropdown:
|
|
284
|
-
o || (
|
|
285
|
-
}, t = (
|
|
286
|
-
(
|
|
287
|
-
},
|
|
288
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
299
|
-
|
|
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:
|
|
306
|
-
title:
|
|
307
|
-
icon:
|
|
308
|
-
disabled:
|
|
309
|
-
className:
|
|
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] =
|
|
313
|
-
|
|
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
|
-
},
|
|
337
|
+
}, E = () => {
|
|
317
338
|
setTimeout(() => {
|
|
318
|
-
|
|
339
|
+
h.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])')?.focus();
|
|
319
340
|
}, 0);
|
|
320
|
-
},
|
|
321
|
-
if (!
|
|
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),
|
|
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
|
-
},
|
|
354
|
+
}, T = (a) => {
|
|
334
355
|
switch (a.key) {
|
|
335
356
|
case "ArrowLeft":
|
|
336
357
|
case "Escape":
|
|
337
|
-
a.preventDefault(), a.stopPropagation(), r(!1),
|
|
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
|
|
342
|
-
if (
|
|
343
|
-
const
|
|
344
|
-
|
|
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
|
|
350
|
-
if (
|
|
351
|
-
const
|
|
352
|
-
|
|
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
|
-
},
|
|
357
|
-
return /* @__PURE__ */
|
|
377
|
+
}, F = [p && "disabled", b].filter(Boolean).join(" ");
|
|
378
|
+
return /* @__PURE__ */ i(
|
|
358
379
|
"li",
|
|
359
380
|
{
|
|
360
|
-
ref:
|
|
361
|
-
className:
|
|
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__ */
|
|
367
|
-
/* @__PURE__ */
|
|
387
|
+
children: /* @__PURE__ */ K("details", { open: s, children: [
|
|
388
|
+
/* @__PURE__ */ K(
|
|
368
389
|
"summary",
|
|
369
390
|
{
|
|
370
|
-
ref:
|
|
391
|
+
ref: w,
|
|
371
392
|
role: "menuitem",
|
|
372
|
-
tabIndex:
|
|
373
|
-
"aria-disabled":
|
|
393
|
+
tabIndex: p ? -1 : 0,
|
|
394
|
+
"aria-disabled": p || void 0,
|
|
374
395
|
"aria-haspopup": "menu",
|
|
375
396
|
"aria-expanded": s,
|
|
376
|
-
"aria-controls":
|
|
377
|
-
|
|
397
|
+
"aria-controls": I,
|
|
398
|
+
className: "whitespace-nowrap",
|
|
399
|
+
onKeyDown: C,
|
|
378
400
|
children: [
|
|
379
|
-
|
|
380
|
-
|
|
401
|
+
m && /* @__PURE__ */ i("span", { className: "mr-2 inline-flex items-center", children: m }),
|
|
402
|
+
c
|
|
381
403
|
]
|
|
382
404
|
}
|
|
383
405
|
),
|
|
384
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ i(
|
|
385
407
|
"ul",
|
|
386
408
|
{
|
|
387
|
-
ref:
|
|
388
|
-
id:
|
|
389
|
-
className: `${
|
|
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
|
|
392
|
-
onKeyDown:
|
|
393
|
-
children:
|
|
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
|
|
401
|
-
const
|
|
402
|
-
return /* @__PURE__ */
|
|
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
|
|
405
|
-
Trigger:
|
|
406
|
-
Menu:
|
|
407
|
-
Item:
|
|
408
|
-
SubMenu:
|
|
409
|
-
Divider:
|
|
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
|
-
|
|
434
|
+
Ue as Dropdown
|
|
413
435
|
};
|
|
414
436
|
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sources":["../../src/components/Dropdown.tsx"],"sourcesContent":["import React, { createContext, useContext, useId, useRef, useState, useCallback, useEffect, forwardRef, useImperativeHandle } from 'react'\nimport { useConfig } from '../providers/ConfigProvider'\n\n// DaisyUI classes\nconst dDropdown = 'dropdown'\nconst dDropdownTop = 'dropdown-top'\nconst dDropdownBottom = 'dropdown-bottom'\nconst dDropdownLeft = 'dropdown-left'\nconst dDropdownRight = 'dropdown-right'\nconst dDropdownCenter = 'dropdown-center'\nconst dDropdownEnd = 'dropdown-end'\nconst dDropdownHover = 'dropdown-hover'\nconst dDropdownOpen = 'dropdown-open'\nconst dDropdownContent = 'dropdown-content'\nconst dMenu = 'menu'\n\n// Types for data-driven items prop\nexport type DropdownTriggerType = 'click' | 'hover' | 'contextMenu'\n\nexport interface DropdownMenuItem {\n key: string\n label: React.ReactNode\n icon?: React.ReactNode\n disabled?: boolean\n danger?: boolean\n onClick?: () => void\n children?: DropdownMenuItem[] // For submenus\n}\n\nexport interface DropdownMenuDivider {\n type: 'divider'\n key?: string\n}\n\nexport type DropdownMenuItemType = DropdownMenuItem | DropdownMenuDivider\n\ninterface DropdownContextValue {\n position?: 'top' | 'bottom' | 'left' | 'right'\n align?: 'start' | 'center' | 'end'\n menuId: string\n triggerId: string\n isOpen: boolean\n setIsOpen: (open: boolean) => void\n focusedIndex: number\n setFocusedIndex: (index: number) => void\n registerItem: (index: number, ref: HTMLElement | null, disabled: boolean) => void\n itemCount: number\n setItemCount: (count: number) => void\n disabled: boolean\n arrow: boolean\n closeDropdown: () => void\n getTestId: (suffix: string) => string | undefined\n}\n\nconst DropdownContext = createContext<DropdownContextValue | undefined>(undefined)\n\nfunction useDropdownContext() {\n const context = useContext(DropdownContext)\n if (!context) {\n throw new Error('Dropdown compound components must be used within Dropdown')\n }\n return context\n}\n\nexport interface DropdownProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /** Trigger element and dropdown content (compound pattern) */\n children?: React.ReactNode\n /** Menu items (data-driven pattern) */\n items?: DropdownMenuItemType[]\n /** Trigger mode(s) for dropdown */\n trigger?: DropdownTriggerType[]\n position?: 'top' | 'bottom' | 'left' | 'right'\n align?: 'start' | 'center' | 'end'\n /** Controlled open state */\n open?: boolean\n /** Callback when open state changes */\n onOpenChange?: (open: boolean, info?: { source: 'trigger' | 'menu' }) => void\n /** Disable the dropdown */\n disabled?: boolean\n /** Show arrow pointing to trigger */\n arrow?: boolean | { pointAtCenter?: boolean }\n /** Delay before showing dropdown on hover (seconds) */\n mouseEnterDelay?: number\n /** Delay before hiding dropdown on mouse leave (seconds) */\n mouseLeaveDelay?: number\n /** Container for the dropdown menu */\n getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement\n /** Destroy dropdown when hidden */\n destroyOnHidden?: boolean\n /** Customize popup content */\n popupRender?: (menu: React.ReactNode) => React.ReactNode\n /** Test ID prefix for child elements */\n 'data-testid'?: string\n}\n\nexport interface DropdownTriggerProps {\n children: React.ReactNode\n className?: string\n}\n\nexport interface DropdownMenuProps {\n children?: React.ReactNode\n className?: string\n}\n\nexport interface DropdownItemProps {\n children?: React.ReactNode\n /** Icon to display before label */\n icon?: React.ReactNode\n /** Item label (alternative to children) */\n label?: React.ReactNode\n onClick?: () => void\n active?: boolean\n disabled?: boolean\n danger?: boolean\n className?: string\n /** @internal */\n _index?: number\n /** @internal */\n _key?: string\n}\n\nexport interface DropdownSubMenuProps {\n children: React.ReactNode\n /** Submenu title/label */\n title: React.ReactNode\n /** Icon to display before title */\n icon?: React.ReactNode\n disabled?: boolean\n className?: string\n /** @internal */\n _key?: string\n}\n\nexport interface DropdownDividerProps {\n className?: string\n}\n\nconst DropdownRoot = forwardRef<HTMLDivElement, DropdownProps>(function DropdownRoot(\n {\n children,\n items,\n trigger = ['click'],\n position = 'bottom',\n align = 'start',\n open: controlledOpen,\n onOpenChange,\n disabled,\n arrow = false,\n mouseEnterDelay = 0.15,\n mouseLeaveDelay = 0.1,\n getPopupContainer: _getPopupContainer,\n destroyOnHidden = false,\n popupRender,\n 'data-testid': testId,\n className = '',\n ...rest\n },\n ref\n) {\n const { componentDisabled } = useConfig()\n const effectiveDisabled = disabled ?? componentDisabled ?? false\n\n const menuId = useId()\n const triggerId = useId()\n const [internalOpen, setInternalOpen] = useState(false)\n const [focusedIndex, setFocusedIndex] = useState(-1)\n const [itemCount, setItemCount] = useState(0)\n const [shouldRender, setShouldRender] = useState(!destroyOnHidden)\n const itemRefs = useRef<Map<number, { ref: HTMLElement | null; disabled: boolean }>>(new Map())\n const dropdownRef = useRef<HTMLDivElement>(null)\n const hoverTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const triggers = trigger\n\n // Forward ref\n useImperativeHandle(ref, () => dropdownRef.current!, [])\n\n // Helper for test IDs\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n // Use controlled or uncontrolled open state\n const isControlled = controlledOpen !== undefined\n const isOpen = isControlled ? controlledOpen : internalOpen\n\n const setIsOpen = useCallback((open: boolean, source: 'trigger' | 'menu' = 'trigger') => {\n if (effectiveDisabled) return\n if (!isControlled) {\n setInternalOpen(open)\n }\n if (open) {\n setShouldRender(true)\n }\n onOpenChange?.(open, { source })\n }, [effectiveDisabled, isControlled, onOpenChange])\n\n const closeDropdown = useCallback(() => {\n setIsOpen(false, 'menu')\n setFocusedIndex(-1)\n document.getElementById(triggerId)?.focus()\n }, [setIsOpen, triggerId])\n\n const registerItem = useCallback((index: number, ref: HTMLElement | null, itemDisabled: boolean) => {\n if (ref) {\n itemRefs.current.set(index, { ref, disabled: itemDisabled })\n } else {\n itemRefs.current.delete(index)\n }\n }, [])\n\n // Handle destroyOnHidden\n useEffect(() => {\n if (destroyOnHidden && !isOpen) {\n const timeout = setTimeout(() => setShouldRender(false), 300)\n return () => clearTimeout(timeout)\n }\n }, [isOpen, destroyOnHidden])\n\n // Close dropdown when clicking outside\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false, 'trigger')\n setFocusedIndex(-1)\n }\n }\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }\n }, [isOpen, setIsOpen])\n\n // Hover handlers with delay\n const handleMouseEnter = useCallback(() => {\n if (!triggers.includes('hover')) return\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current)\n }\n hoverTimeoutRef.current = setTimeout(() => {\n setIsOpen(true, 'trigger')\n }, mouseEnterDelay * 1000)\n }, [triggers, mouseEnterDelay, setIsOpen])\n\n const handleMouseLeave = useCallback(() => {\n if (!triggers.includes('hover')) return\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current)\n }\n hoverTimeoutRef.current = setTimeout(() => {\n setIsOpen(false, 'trigger')\n setFocusedIndex(-1)\n }, mouseLeaveDelay * 1000)\n }, [triggers, mouseLeaveDelay, setIsOpen])\n\n // Context menu handler\n const handleContextMenu = useCallback((event: React.MouseEvent) => {\n if (!triggers.includes('contextMenu')) return\n event.preventDefault()\n setIsOpen(true, 'trigger')\n }, [triggers, setIsOpen])\n\n // Cleanup timeout on unmount\n useEffect(() => {\n return () => {\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current)\n }\n }\n }, [])\n\n const positionClasses: Record<string, string> = {\n top: dDropdownTop,\n bottom: dDropdownBottom,\n left: dDropdownLeft,\n right: dDropdownRight,\n }\n\n const alignClasses: Record<string, string> = {\n start: '',\n center: dDropdownCenter,\n end: dDropdownEnd,\n }\n\n const showArrow = typeof arrow === 'boolean' ? arrow : !!arrow\n\n const dropdownClasses = [\n dDropdown,\n positionClasses[position],\n alignClasses[align],\n triggers.includes('hover') && dDropdownHover,\n isOpen && dDropdownOpen,\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // Render items from data-driven prop\n const renderItems = () => {\n if (!items) return null\n return items.map((item, index) => {\n if ('type' in item && item.type === 'divider') {\n return <DropdownDivider key={item.key || `divider-${index}`} />\n }\n const menuItem = item as DropdownMenuItem\n if (menuItem.children && menuItem.children.length > 0) {\n return (\n <DropdownSubMenu\n key={menuItem.key}\n title={menuItem.label}\n icon={menuItem.icon}\n disabled={menuItem.disabled}\n >\n {menuItem.children.map((child) => (\n <DropdownItem\n key={child.key}\n icon={child.icon}\n disabled={child.disabled}\n danger={child.danger}\n onClick={child.onClick}\n >\n {child.label}\n </DropdownItem>\n ))}\n </DropdownSubMenu>\n )\n }\n return (\n <DropdownItem\n key={menuItem.key}\n icon={menuItem.icon}\n disabled={menuItem.disabled}\n danger={menuItem.danger}\n onClick={menuItem.onClick}\n >\n {menuItem.label}\n </DropdownItem>\n )\n })\n }\n\n // Determine content - either compound children or items-generated menu\n const menuContent = items ? (\n (shouldRender || !destroyOnHidden) && (\n <DropdownMenu>{renderItems()}</DropdownMenu>\n )\n ) : null\n\n const content = items ? (\n <>\n {React.Children.toArray(children).find(\n (child) => React.isValidElement(child) && child.type === DropdownTrigger\n )}\n {popupRender ? popupRender(menuContent) : menuContent}\n </>\n ) : (\n children\n )\n\n return (\n <DropdownContext.Provider\n value={{\n position,\n align,\n menuId,\n triggerId,\n isOpen,\n setIsOpen,\n focusedIndex,\n setFocusedIndex,\n registerItem,\n itemCount,\n setItemCount,\n disabled: effectiveDisabled,\n arrow: showArrow,\n closeDropdown,\n getTestId,\n }}\n >\n <div\n ref={dropdownRef}\n className={dropdownClasses}\n data-state={isOpen ? 'open' : 'closed'}\n data-testid={testId}\n aria-disabled={effectiveDisabled || undefined}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onContextMenu={handleContextMenu}\n {...rest}\n >\n {content}\n </div>\n </DropdownContext.Provider>\n )\n})\n\nfunction DropdownTrigger({ children, className = '' }: DropdownTriggerProps) {\n const { menuId, triggerId, isOpen, setIsOpen, setFocusedIndex, itemCount, disabled } = useDropdownContext()\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n switch (event.key) {\n case 'Enter':\n case ' ':\n case 'ArrowDown':\n event.preventDefault()\n setIsOpen(true)\n setFocusedIndex(0)\n break\n case 'ArrowUp':\n event.preventDefault()\n setIsOpen(true)\n setFocusedIndex(itemCount - 1)\n break\n case 'Escape':\n event.preventDefault()\n setIsOpen(false)\n setFocusedIndex(-1)\n break\n }\n }\n\n const handleClick = () => {\n setIsOpen(!isOpen)\n if (!isOpen) {\n setFocusedIndex(0)\n }\n }\n\n // Clone the child element to add event handlers and ARIA attributes\n const child = React.Children.only(children) as React.ReactElement<\n React.HTMLAttributes<HTMLElement> & {\n onClick?: (e: React.MouseEvent) => void\n onKeyDown?: (e: React.KeyboardEvent) => void\n className?: string\n }\n >\n\n const childProps = child.props\n\n return React.cloneElement(child, {\n id: triggerId,\n tabIndex: disabled ? -1 : 0,\n 'aria-haspopup': 'menu' as const,\n 'aria-expanded': isOpen,\n 'aria-controls': menuId,\n onClick: (e: React.MouseEvent) => {\n handleClick()\n childProps.onClick?.(e)\n },\n onKeyDown: (e: React.KeyboardEvent) => {\n handleKeyDown(e)\n childProps.onKeyDown?.(e)\n },\n className: `${childProps.className || ''} ${className}`.trim(),\n })\n}\n\nfunction DropdownMenu({ children, className = '' }: DropdownMenuProps) {\n const { menuId, triggerId, isOpen, setIsOpen, focusedIndex, setFocusedIndex, setItemCount, arrow, position, getTestId } = useDropdownContext()\n const menuRef = useRef<HTMLUListElement>(null)\n\n // Count children and set item count\n const childArray = React.Children.toArray(children).filter(\n (child) => React.isValidElement(child) && (child.type === DropdownItem)\n )\n\n useEffect(() => {\n setItemCount(childArray.length)\n }, [childArray.length, setItemCount])\n\n // Focus management\n useEffect(() => {\n if (isOpen && focusedIndex >= 0 && menuRef.current) {\n const items = menuRef.current.querySelectorAll('[role=\"menuitem\"]:not([aria-disabled=\"true\"])')\n const item = items[focusedIndex] as HTMLElement\n item?.focus()\n }\n }, [isOpen, focusedIndex])\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n const enabledItems = childArray.filter(\n (child) => React.isValidElement(child) && !(child.props as DropdownItemProps).disabled\n )\n const enabledCount = enabledItems.length\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n setFocusedIndex((focusedIndex + 1) % enabledCount)\n break\n case 'ArrowUp':\n event.preventDefault()\n setFocusedIndex((focusedIndex - 1 + enabledCount) % enabledCount)\n break\n case 'Home':\n event.preventDefault()\n setFocusedIndex(0)\n break\n case 'End':\n event.preventDefault()\n setFocusedIndex(enabledCount - 1)\n break\n case 'Escape':\n event.preventDefault()\n setIsOpen(false)\n setFocusedIndex(-1)\n // Return focus to trigger\n document.getElementById(triggerId)?.focus()\n break\n case 'Tab':\n setIsOpen(false)\n setFocusedIndex(-1)\n break\n }\n }\n\n const menuClasses = [\n dDropdownContent,\n dMenu,\n 'bg-base-100',\n 'rounded-box',\n 'z-50',\n 'shadow',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // Clone children to pass index and extract key\n const childrenWithIndex = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n const childKey = child.key != null ? String(child.key) : undefined\n if (child.type === DropdownItem) {\n return React.cloneElement(child as React.ReactElement<any>, { _index: index, _key: childKey })\n }\n if (child.type === DropdownSubMenu) {\n return React.cloneElement(child as React.ReactElement<any>, { _key: childKey })\n }\n }\n return child\n })\n\n // Arrow position classes based on menu position\n const arrowPositionClasses: Record<string, string> = {\n top: 'bottom-0 left-1/2 -translate-x-1/2 translate-y-full border-t-base-100 border-l-transparent border-r-transparent border-b-transparent',\n 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',\n 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',\n 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',\n }\n\n const arrowElement = arrow ? (\n <span\n className={`absolute w-0 h-0 border-8 border-solid ${arrowPositionClasses[position || 'bottom']}`}\n aria-hidden=\"true\"\n />\n ) : null\n\n return (\n <ul\n ref={menuRef}\n id={menuId}\n role=\"menu\"\n aria-labelledby={triggerId}\n tabIndex={-1}\n className={`${menuClasses} ${arrow ? 'relative' : ''}`}\n data-testid={getTestId('menu')}\n onKeyDown={handleKeyDown}\n >\n {arrowElement}\n {childrenWithIndex}\n </ul>\n )\n}\n\nfunction DropdownItem({\n children,\n icon,\n label,\n onClick,\n active = false,\n disabled = false,\n danger = false,\n className = '',\n _key,\n}: DropdownItemProps) {\n const { closeDropdown, getTestId } = useDropdownContext()\n const itemClasses = [active && 'active', disabled && 'disabled', className].filter(Boolean).join(' ')\n\n const handleClick = () => {\n if (!disabled) {\n onClick?.()\n closeDropdown()\n }\n }\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if ((event.key === 'Enter' || event.key === ' ') && !disabled) {\n event.preventDefault()\n handleClick()\n }\n }\n\n const content = label || children\n\n return (\n <li className={itemClasses} role=\"none\" data-key={_key} data-testid={_key ? getTestId(`item-${_key}`) : undefined}>\n <a\n role=\"menuitem\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n className={danger ? 'text-error' : ''}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n {icon && <span className=\"mr-2 inline-flex items-center\">{icon}</span>}\n {content}\n </a>\n </li>\n )\n}\n\nfunction DropdownSubMenu({\n children,\n title,\n icon,\n disabled = false,\n className = '',\n _key,\n}: DropdownSubMenuProps) {\n const [isSubOpen, setIsSubOpen] = useState(false)\n const subMenuRef = useRef<HTMLLIElement>(null)\n const summaryRef = useRef<HTMLElement>(null)\n const subMenuListRef = useRef<HTMLUListElement>(null)\n const subMenuId = useId()\n\n const handleMouseEnter = () => {\n if (!disabled) setIsSubOpen(true)\n }\n\n const handleMouseLeave = () => {\n setIsSubOpen(false)\n }\n\n // Focus first item in submenu\n const focusFirstItem = () => {\n setTimeout(() => {\n const firstItem = subMenuListRef.current?.querySelector('[role=\"menuitem\"]:not([aria-disabled=\"true\"])') as HTMLElement\n firstItem?.focus()\n }, 0)\n }\n\n // Keyboard handler for summary (submenu trigger)\n const handleSummaryKeyDown = (event: React.KeyboardEvent) => {\n if (disabled) return\n\n switch (event.key) {\n case 'ArrowRight':\n case 'Enter':\n case ' ':\n event.preventDefault()\n event.stopPropagation()\n setIsSubOpen(true)\n focusFirstItem()\n break\n case 'ArrowLeft':\n case 'Escape':\n event.preventDefault()\n event.stopPropagation()\n setIsSubOpen(false)\n break\n }\n }\n\n // Keyboard handler for submenu items\n const handleSubMenuKeyDown = (event: React.KeyboardEvent) => {\n switch (event.key) {\n case 'ArrowLeft':\n case 'Escape':\n event.preventDefault()\n event.stopPropagation()\n setIsSubOpen(false)\n summaryRef.current?.focus()\n break\n case 'ArrowDown':\n event.preventDefault()\n event.stopPropagation()\n const items = subMenuListRef.current?.querySelectorAll('[role=\"menuitem\"]:not([aria-disabled=\"true\"])')\n if (items) {\n const currentIndex = Array.from(items).findIndex(item => item === document.activeElement)\n const nextIndex = (currentIndex + 1) % items.length\n ;(items[nextIndex] as HTMLElement)?.focus()\n }\n break\n case 'ArrowUp':\n event.preventDefault()\n event.stopPropagation()\n const itemsUp = subMenuListRef.current?.querySelectorAll('[role=\"menuitem\"]:not([aria-disabled=\"true\"])')\n if (itemsUp) {\n const currentIndexUp = Array.from(itemsUp).findIndex(item => item === document.activeElement)\n const prevIndex = (currentIndexUp - 1 + itemsUp.length) % itemsUp.length\n ;(itemsUp[prevIndex] as HTMLElement)?.focus()\n }\n break\n }\n }\n\n const itemClasses = [disabled && 'disabled', className].filter(Boolean).join(' ')\n\n return (\n <li\n ref={subMenuRef}\n className={itemClasses}\n role=\"none\"\n data-key={_key}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <details open={isSubOpen}>\n <summary\n ref={summaryRef}\n role=\"menuitem\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n aria-haspopup=\"menu\"\n aria-expanded={isSubOpen}\n aria-controls={subMenuId}\n onKeyDown={handleSummaryKeyDown}\n >\n {icon && <span className=\"mr-2 inline-flex items-center\">{icon}</span>}\n {title}\n </summary>\n <ul\n ref={subMenuListRef}\n id={subMenuId}\n className={`${dMenu} bg-base-100 rounded-box z-50 shadow`}\n role=\"menu\"\n aria-label={typeof title === 'string' ? title : undefined}\n onKeyDown={handleSubMenuKeyDown}\n >\n {children}\n </ul>\n </details>\n </li>\n )\n}\n\nfunction DropdownDivider({ className = '' }: DropdownDividerProps) {\n const classes = ['border-base-content/10', className].filter(Boolean).join(' ')\n return (\n <li role=\"separator\" className=\"my-1\">\n <hr className={classes} />\n </li>\n )\n}\n\nexport const Dropdown = Object.assign(DropdownRoot, {\n Trigger: DropdownTrigger,\n Menu: DropdownMenu,\n Item: DropdownItem,\n SubMenu: DropdownSubMenu,\n Divider: DropdownDivider,\n})\n"],"names":["dDropdown","dDropdownTop","dDropdownBottom","dDropdownLeft","dDropdownRight","dDropdownCenter","dDropdownEnd","dDropdownHover","dDropdownOpen","dDropdownContent","dMenu","DropdownContext","createContext","useDropdownContext","context","useContext","DropdownRoot","forwardRef","children","items","trigger","position","align","controlledOpen","onOpenChange","disabled","arrow","mouseEnterDelay","mouseLeaveDelay","_getPopupContainer","destroyOnHidden","popupRender","testId","className","rest","ref","componentDisabled","useConfig","effectiveDisabled","menuId","useId","triggerId","internalOpen","setInternalOpen","useState","focusedIndex","setFocusedIndex","itemCount","setItemCount","shouldRender","setShouldRender","itemRefs","useRef","dropdownRef","hoverTimeoutRef","triggers","useImperativeHandle","getTestId","suffix","isControlled","isOpen","setIsOpen","useCallback","open","source","closeDropdown","registerItem","index","itemDisabled","useEffect","timeout","handleClickOutside","event","handleMouseEnter","handleMouseLeave","handleContextMenu","positionClasses","alignClasses","showArrow","dropdownClasses","menuContent","jsx","DropdownMenu","item","DropdownDivider","menuItem","DropdownSubMenu","child","DropdownItem","content","jsxs","Fragment","React","DropdownTrigger","handleKeyDown","handleClick","childProps","e","menuRef","childArray","enabledCount","menuClasses","childrenWithIndex","childKey","arrowElement","icon","label","onClick","active","danger","_key","itemClasses","title","isSubOpen","setIsSubOpen","subMenuRef","summaryRef","subMenuListRef","subMenuId","focusFirstItem","handleSummaryKeyDown","handleSubMenuKeyDown","nextIndex","itemsUp","prevIndex","classes","Dropdown"],"mappings":";;;AAIA,MAAMA,KAAY,YACZC,KAAe,gBACfC,KAAkB,mBAClBC,KAAgB,iBAChBC,KAAiB,kBACjBC,KAAkB,mBAClBC,KAAe,gBACfC,KAAiB,kBACjBC,KAAgB,iBAChBC,KAAmB,oBACnBC,IAAQ,QAwCRC,IAAkBC,GAAgD,MAAS;AAEjF,SAASC,IAAqB;AAC5B,QAAMC,IAAUC,GAAWJ,CAAe;AAC1C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,2DAA2D;AAE7E,SAAOA;AACT;AA4EA,MAAME,KAAeC,GAA0C,SAC7D;AAAA,EACE,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAU,CAAC,OAAO;AAAA,EAClB,UAAAC,IAAW;AAAA,EACX,OAAAC,IAAQ;AAAA,EACR,MAAMC;AAAA,EACN,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,iBAAAC,IAAkB;AAAA,EAClB,iBAAAC,IAAkB;AAAA,EAClB,mBAAmBC;AAAA,EACnB,iBAAAC,IAAkB;AAAA,EAClB,aAAAC;AAAA,EACA,eAAeC;AAAA,EACf,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GACAC,GACA;AACA,QAAM,EA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AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,SAASkE,EAAgB,EAAE,WAAAnD,IAAY,MAA4B;AACjE,QAAM4F,IAAU,CAAC,0BAA0B5F,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAC9E,SACE,gBAAAgD,EAAC,MAAA,EAAG,MAAK,aAAY,WAAU,QAC7B,UAAA,gBAAAA,EAAC,MAAA,EAAG,WAAW4C,EAAA,CAAS,EAAA,CAC1B;AAEJ;AAEO,MAAMC,KAAW,OAAO,OAAO9G,IAAc;AAAA,EAClD,SAAS6E;AAAA,EACT,MAAMX;AAAA,EACN,MAAMM;AAAA,EACN,SAASF;AAAA,EACT,SAASF;AACX,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sources":["../../src/components/Dropdown.tsx"],"sourcesContent":["import React, { createContext, useContext, useId, useRef, useState, useCallback, useEffect, forwardRef, useImperativeHandle } from 'react'\nimport { useConfig } from '../providers/ConfigProvider'\n\n// DaisyUI classes\nconst dDropdown = 'dropdown'\nconst dDropdownTop = 'dropdown-top'\nconst dDropdownBottom = 'dropdown-bottom'\nconst dDropdownLeft = 'dropdown-left'\nconst dDropdownRight = 'dropdown-right'\nconst dDropdownCenter = 'dropdown-center'\nconst dDropdownEnd = 'dropdown-end'\nconst dDropdownHover = 'dropdown-hover'\nconst dDropdownOpen = 'dropdown-open'\nconst dDropdownContent = 'dropdown-content'\nconst dMenu = 'menu'\n\n// Types for data-driven items prop\nexport type DropdownTriggerType = 'click' | 'hover' | 'contextMenu'\n\nexport interface DropdownMenuItem {\n key: string\n label: React.ReactNode\n icon?: React.ReactNode\n disabled?: boolean\n danger?: boolean\n onClick?: () => void\n children?: DropdownMenuItem[] // For submenus\n}\n\nexport interface DropdownMenuDivider {\n type: 'divider'\n key?: string\n}\n\nexport type DropdownMenuItemType = DropdownMenuItem | DropdownMenuDivider\n\ninterface DropdownContextValue {\n position?: 'top' | 'bottom' | 'left' | 'right'\n align?: 'start' | 'center' | 'end'\n menuId: string\n triggerId: string\n isOpen: boolean\n setIsOpen: (open: boolean) => void\n focusedIndex: number\n setFocusedIndex: (index: number) => void\n registerItem: (index: number, ref: HTMLElement | null, disabled: boolean) => void\n itemCount: number\n setItemCount: (count: number) => void\n disabled: boolean\n arrow: boolean\n closeDropdown: () => void\n getTestId: (suffix: string) => string | undefined\n}\n\nconst DropdownContext = createContext<DropdownContextValue | undefined>(undefined)\n\nfunction useDropdownContext() {\n const context = useContext(DropdownContext)\n if (!context) {\n throw new Error('Dropdown compound components must be used within Dropdown')\n }\n return context\n}\n\nexport interface DropdownProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /** Trigger element and dropdown content (compound pattern) */\n children?: React.ReactNode\n /** Menu items (data-driven pattern) */\n items?: DropdownMenuItemType[]\n /** Trigger mode(s) for dropdown */\n trigger?: DropdownTriggerType[]\n position?: 'top' | 'bottom' | 'left' | 'right'\n align?: 'start' | 'center' | 'end'\n /** Controlled open state */\n open?: boolean\n /** Callback when open state changes */\n onOpenChange?: (open: boolean, info?: { source: 'trigger' | 'menu' }) => void\n /** Disable the dropdown */\n disabled?: boolean\n /** Show arrow pointing to trigger */\n arrow?: boolean | { pointAtCenter?: boolean }\n /** Delay before showing dropdown on hover (seconds) */\n mouseEnterDelay?: number\n /** Delay before hiding dropdown on mouse leave (seconds) */\n mouseLeaveDelay?: number\n /** Container for the dropdown menu */\n getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement\n /** Destroy dropdown when hidden */\n destroyOnHidden?: boolean\n /** Customize popup content */\n popupRender?: (menu: React.ReactNode) => React.ReactNode\n /** Test ID prefix for child elements */\n 'data-testid'?: string\n}\n\nexport interface DropdownTriggerProps {\n children: React.ReactNode\n className?: string\n}\n\nexport interface DropdownMenuProps {\n children?: React.ReactNode\n className?: string\n}\n\nexport interface DropdownItemProps {\n children?: React.ReactNode\n /** Icon to display before label */\n icon?: React.ReactNode\n /** Item label (alternative to children) */\n label?: React.ReactNode\n onClick?: () => void\n active?: boolean\n disabled?: boolean\n danger?: boolean\n className?: string\n /** @internal */\n _index?: number\n /** @internal */\n _key?: string\n}\n\nexport interface DropdownSubMenuProps {\n children: React.ReactNode\n /** Submenu title/label */\n title: React.ReactNode\n /** Icon to display before title */\n icon?: React.ReactNode\n disabled?: boolean\n className?: string\n /** @internal */\n _key?: string\n}\n\nexport interface DropdownDividerProps {\n className?: string\n}\n\nconst DropdownRoot = forwardRef<HTMLDivElement, DropdownProps>(function DropdownRoot(\n {\n children,\n items,\n trigger = ['hover'],\n position = 'bottom',\n align = 'start',\n open: controlledOpen,\n onOpenChange,\n disabled,\n arrow = false,\n mouseEnterDelay = 0.15,\n mouseLeaveDelay = 0.1,\n getPopupContainer: _getPopupContainer,\n destroyOnHidden = false,\n popupRender,\n 'data-testid': testId,\n className = '',\n ...rest\n },\n ref\n) {\n const { componentDisabled } = useConfig()\n const effectiveDisabled = disabled ?? componentDisabled ?? false\n\n const menuId = useId()\n const triggerId = useId()\n const [internalOpen, setInternalOpen] = useState(false)\n const [focusedIndex, setFocusedIndex] = useState(-1)\n const [itemCount, setItemCount] = useState(0)\n const [shouldRender, setShouldRender] = useState(!destroyOnHidden)\n const itemRefs = useRef<Map<number, { ref: HTMLElement | null; disabled: boolean }>>(new Map())\n const dropdownRef = useRef<HTMLDivElement>(null)\n const hoverTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const triggers = trigger\n\n // Forward ref\n useImperativeHandle(ref, () => dropdownRef.current!, [])\n\n // Helper for test IDs\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n // Use controlled or uncontrolled open state\n const isControlled = controlledOpen !== undefined\n const isOpen = isControlled ? controlledOpen : internalOpen\n\n const setIsOpen = useCallback((open: boolean, source: 'trigger' | 'menu' = 'trigger') => {\n if (effectiveDisabled) return\n if (!isControlled) {\n setInternalOpen(open)\n }\n if (open) {\n setShouldRender(true)\n }\n onOpenChange?.(open, { source })\n }, [effectiveDisabled, isControlled, onOpenChange])\n\n const closeDropdown = useCallback(() => {\n setIsOpen(false, 'menu')\n setFocusedIndex(-1)\n document.getElementById(triggerId)?.focus()\n }, [setIsOpen, triggerId])\n\n const registerItem = useCallback((index: number, ref: HTMLElement | null, itemDisabled: boolean) => {\n if (ref) {\n itemRefs.current.set(index, { ref, disabled: itemDisabled })\n } else {\n itemRefs.current.delete(index)\n }\n }, [])\n\n // Handle destroyOnHidden\n useEffect(() => {\n if (destroyOnHidden && !isOpen) {\n const timeout = setTimeout(() => setShouldRender(false), 300)\n return () => clearTimeout(timeout)\n }\n }, [isOpen, destroyOnHidden])\n\n // Close dropdown when clicking outside\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false, 'trigger')\n setFocusedIndex(-1)\n }\n }\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }\n }, [isOpen, setIsOpen])\n\n // Hover handlers with delay\n const handleMouseEnter = useCallback(() => {\n if (!triggers.includes('hover')) return\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current)\n }\n hoverTimeoutRef.current = setTimeout(() => {\n setIsOpen(true, 'trigger')\n }, mouseEnterDelay * 1000)\n }, [triggers, mouseEnterDelay, setIsOpen])\n\n const handleMouseLeave = useCallback(() => {\n if (!triggers.includes('hover')) return\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current)\n }\n hoverTimeoutRef.current = setTimeout(() => {\n setIsOpen(false, 'trigger')\n setFocusedIndex(-1)\n }, mouseLeaveDelay * 1000)\n }, [triggers, mouseLeaveDelay, setIsOpen])\n\n // Context menu handler\n const handleContextMenu = useCallback((event: React.MouseEvent) => {\n if (!triggers.includes('contextMenu')) return\n event.preventDefault()\n setIsOpen(true, 'trigger')\n }, [triggers, setIsOpen])\n\n // Cleanup timeout on unmount\n useEffect(() => {\n return () => {\n if (hoverTimeoutRef.current) {\n clearTimeout(hoverTimeoutRef.current)\n }\n }\n }, [])\n\n const positionClasses: Record<string, string> = {\n top: dDropdownTop,\n bottom: dDropdownBottom,\n left: dDropdownLeft,\n right: dDropdownRight,\n }\n\n const alignClasses: Record<string, string> = {\n start: '',\n center: dDropdownCenter,\n end: dDropdownEnd,\n }\n\n const showArrow = typeof arrow === 'boolean' ? arrow : !!arrow\n\n // Render items from data-driven prop\n const renderItems = () => {\n if (!items) return null\n return items.map((item, index) => {\n if ('type' in item && item.type === 'divider') {\n return <DropdownDivider key={item.key || `divider-${index}`} />\n }\n const menuItem = item as DropdownMenuItem\n if (menuItem.children && menuItem.children.length > 0) {\n return (\n <DropdownSubMenu\n key={menuItem.key}\n title={menuItem.label}\n icon={menuItem.icon}\n disabled={menuItem.disabled}\n >\n {menuItem.children.map((child) => (\n <DropdownItem\n key={child.key}\n icon={child.icon}\n disabled={child.disabled}\n danger={child.danger}\n onClick={child.onClick}\n >\n {child.label}\n </DropdownItem>\n ))}\n </DropdownSubMenu>\n )\n }\n return (\n <DropdownItem\n key={menuItem.key}\n icon={menuItem.icon}\n disabled={menuItem.disabled}\n danger={menuItem.danger}\n onClick={menuItem.onClick}\n >\n {menuItem.label}\n </DropdownItem>\n )\n })\n }\n\n // Determine content - either compound children or items-generated menu\n const menuContent = items ? (\n (shouldRender || !destroyOnHidden) && (\n <DropdownMenu>{renderItems()}</DropdownMenu>\n )\n ) : null\n\n // Auto-detect trigger pattern\n const childArray = React.Children.toArray(children)\n const hasTrigger = childArray.some(\n (child) => React.isValidElement(child) && child.type === DropdownTrigger\n )\n const hasMenu = childArray.some(\n (child) => React.isValidElement(child) && child.type === DropdownMenu\n )\n\n let content: React.ReactNode\n let isAutoTrigger = false\n\n if (items) {\n // Data-driven pattern with items prop\n const triggerChild = childArray.find(\n (child) => React.isValidElement(child) && child.type === DropdownTrigger\n )\n\n // If no explicit Trigger, treat first child as trigger\n if (!triggerChild && childArray[0] && React.isValidElement(childArray[0])) {\n isAutoTrigger = true\n content = (\n <>\n <DropdownTrigger className={className}>{childArray[0]}</DropdownTrigger>\n {popupRender ? popupRender(menuContent) : menuContent}\n </>\n )\n } else {\n content = (\n <>\n {triggerChild}\n {popupRender ? popupRender(menuContent) : menuContent}\n </>\n )\n }\n } else if (!hasTrigger && !hasMenu && childArray.length >= 2) {\n // Auto-pattern: first child is trigger, second child is menu\n const [triggerChild, menuChild, ...rest] = childArray\n isAutoTrigger = true\n content = (\n <>\n {triggerChild && React.isValidElement(triggerChild) && (\n <DropdownTrigger className={className}>{triggerChild}</DropdownTrigger>\n )}\n {menuChild}\n {rest}\n </>\n )\n } else {\n // Standard compound pattern or other cases\n content = children\n }\n\n const dropdownClasses = [\n dDropdown,\n positionClasses[position],\n alignClasses[align],\n triggers.includes('hover') && dDropdownHover,\n isOpen && dDropdownOpen,\n !isAutoTrigger && className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <DropdownContext.Provider\n value={{\n position,\n align,\n menuId,\n triggerId,\n isOpen,\n setIsOpen,\n focusedIndex,\n setFocusedIndex,\n registerItem,\n itemCount,\n setItemCount,\n disabled: effectiveDisabled,\n arrow: showArrow,\n closeDropdown,\n getTestId,\n }}\n >\n <div\n ref={dropdownRef}\n className={dropdownClasses}\n data-state={isOpen ? 'open' : 'closed'}\n data-testid={testId}\n aria-disabled={effectiveDisabled || undefined}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onContextMenu={handleContextMenu}\n {...rest}\n >\n {content}\n </div>\n </DropdownContext.Provider>\n )\n})\n\nfunction DropdownTrigger({ children, className = '' }: DropdownTriggerProps) {\n const { menuId, triggerId, isOpen, setIsOpen, setFocusedIndex, itemCount, disabled } = useDropdownContext()\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n switch (event.key) {\n case 'Enter':\n case ' ':\n case 'ArrowDown':\n event.preventDefault()\n setIsOpen(true)\n setFocusedIndex(0)\n break\n case 'ArrowUp':\n event.preventDefault()\n setIsOpen(true)\n setFocusedIndex(itemCount - 1)\n break\n case 'Escape':\n event.preventDefault()\n setIsOpen(false)\n setFocusedIndex(-1)\n break\n }\n }\n\n const handleClick = () => {\n setIsOpen(!isOpen)\n if (!isOpen) {\n setFocusedIndex(0)\n }\n }\n\n // Clone the child element to add event handlers and ARIA attributes\n const child = React.Children.only(children) as React.ReactElement<\n React.HTMLAttributes<HTMLElement> & {\n onClick?: (e: React.MouseEvent) => void\n onKeyDown?: (e: React.KeyboardEvent) => void\n className?: string\n }\n >\n\n const childProps = child.props\n\n return React.cloneElement(child, {\n id: triggerId,\n tabIndex: disabled ? -1 : 0,\n 'aria-haspopup': 'menu' as const,\n 'aria-expanded': isOpen,\n 'aria-controls': menuId,\n onClick: (e: React.MouseEvent) => {\n handleClick()\n childProps.onClick?.(e)\n },\n onKeyDown: (e: React.KeyboardEvent) => {\n handleKeyDown(e)\n childProps.onKeyDown?.(e)\n },\n className: `${childProps.className || ''} ${className}`.trim(),\n })\n}\n\nfunction DropdownMenu({ children, className = '' }: DropdownMenuProps) {\n const { menuId, triggerId, isOpen, setIsOpen, focusedIndex, setFocusedIndex, setItemCount, arrow, position, getTestId } = useDropdownContext()\n const menuRef = useRef<HTMLUListElement>(null)\n\n // Count children and set item count\n const childArray = React.Children.toArray(children).filter(\n (child) => React.isValidElement(child) && (child.type === DropdownItem)\n )\n\n useEffect(() => {\n setItemCount(childArray.length)\n }, [childArray.length, setItemCount])\n\n // Focus management\n useEffect(() => {\n if (isOpen && focusedIndex >= 0 && menuRef.current) {\n const items = menuRef.current.querySelectorAll('[role=\"menuitem\"]:not([aria-disabled=\"true\"])')\n const item = items[focusedIndex] as HTMLElement\n item?.focus()\n }\n }, [isOpen, focusedIndex])\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n const enabledItems = childArray.filter(\n (child) => React.isValidElement(child) && !(child.props as DropdownItemProps).disabled\n )\n const enabledCount = enabledItems.length\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n setFocusedIndex((focusedIndex + 1) % enabledCount)\n break\n case 'ArrowUp':\n event.preventDefault()\n setFocusedIndex((focusedIndex - 1 + enabledCount) % enabledCount)\n break\n case 'Home':\n event.preventDefault()\n setFocusedIndex(0)\n break\n case 'End':\n event.preventDefault()\n setFocusedIndex(enabledCount - 1)\n break\n case 'Escape':\n event.preventDefault()\n setIsOpen(false)\n setFocusedIndex(-1)\n // Return focus to trigger\n document.getElementById(triggerId)?.focus()\n break\n case 'Tab':\n setIsOpen(false)\n setFocusedIndex(-1)\n break\n }\n }\n\n const menuClasses = [\n dDropdownContent,\n dMenu,\n 'bg-base-100',\n 'rounded-box',\n 'z-50',\n 'shadow',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // Clone children to pass index and extract key\n const childrenWithIndex = React.Children.map(children, (child, index) => {\n if (React.isValidElement(child)) {\n const childKey = child.key != null ? String(child.key) : undefined\n if (child.type === DropdownItem) {\n return React.cloneElement(child as React.ReactElement<any>, { _index: index, _key: childKey })\n }\n if (child.type === DropdownSubMenu) {\n return React.cloneElement(child as React.ReactElement<any>, { _key: childKey })\n }\n }\n return child\n })\n\n // Arrow position classes based on menu position\n const arrowPositionClasses: Record<string, string> = {\n top: 'bottom-0 left-1/2 -translate-x-1/2 translate-y-full border-t-base-100 border-l-transparent border-r-transparent border-b-transparent',\n 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',\n 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',\n 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',\n }\n\n const arrowElement = arrow ? (\n <span\n className={`absolute w-0 h-0 border-8 border-solid ${arrowPositionClasses[position || 'bottom']}`}\n aria-hidden=\"true\"\n />\n ) : null\n\n return (\n <ul\n ref={menuRef}\n id={menuId}\n role=\"menu\"\n aria-labelledby={triggerId}\n tabIndex={-1}\n className={`${menuClasses} ${arrow ? 'relative' : ''}`}\n data-testid={getTestId('menu')}\n onKeyDown={handleKeyDown}\n >\n {arrowElement}\n {childrenWithIndex}\n </ul>\n )\n}\n\nfunction DropdownItem({\n children,\n icon,\n label,\n onClick,\n active = false,\n disabled = false,\n danger = false,\n className = '',\n _key,\n}: DropdownItemProps) {\n const { closeDropdown, getTestId } = useDropdownContext()\n const itemClasses = [active && 'active', disabled && 'disabled', className].filter(Boolean).join(' ')\n\n const handleClick = () => {\n if (!disabled) {\n onClick?.()\n closeDropdown()\n }\n }\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if ((event.key === 'Enter' || event.key === ' ') && !disabled) {\n event.preventDefault()\n handleClick()\n }\n }\n\n const content = label || children\n\n return (\n <li className={itemClasses} role=\"none\" data-key={_key} data-testid={_key ? getTestId(`item-${_key}`) : undefined}>\n <a\n role=\"menuitem\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n className={`whitespace-nowrap ${danger ? 'text-error' : ''}`}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n {icon && <span className=\"mr-2 inline-flex items-center\">{icon}</span>}\n {content}\n </a>\n </li>\n )\n}\n\nfunction DropdownSubMenu({\n children,\n title,\n icon,\n disabled = false,\n className = '',\n _key,\n}: DropdownSubMenuProps) {\n const [isSubOpen, setIsSubOpen] = useState(false)\n const subMenuRef = useRef<HTMLLIElement>(null)\n const summaryRef = useRef<HTMLElement>(null)\n const subMenuListRef = useRef<HTMLUListElement>(null)\n const subMenuId = useId()\n\n const handleMouseEnter = () => {\n if (!disabled) setIsSubOpen(true)\n }\n\n const handleMouseLeave = () => {\n setIsSubOpen(false)\n }\n\n // Focus first item in submenu\n const focusFirstItem = () => {\n setTimeout(() => {\n const firstItem = subMenuListRef.current?.querySelector('[role=\"menuitem\"]:not([aria-disabled=\"true\"])') as HTMLElement\n firstItem?.focus()\n }, 0)\n }\n\n // Keyboard handler for summary (submenu trigger)\n const handleSummaryKeyDown = (event: React.KeyboardEvent) => {\n if (disabled) return\n\n switch (event.key) {\n case 'ArrowRight':\n case 'Enter':\n case ' ':\n event.preventDefault()\n event.stopPropagation()\n setIsSubOpen(true)\n focusFirstItem()\n break\n case 'ArrowLeft':\n case 'Escape':\n event.preventDefault()\n event.stopPropagation()\n setIsSubOpen(false)\n break\n }\n }\n\n // Keyboard handler for submenu items\n const handleSubMenuKeyDown = (event: React.KeyboardEvent) => {\n switch (event.key) {\n case 'ArrowLeft':\n case 'Escape':\n event.preventDefault()\n event.stopPropagation()\n setIsSubOpen(false)\n summaryRef.current?.focus()\n break\n case 'ArrowDown':\n event.preventDefault()\n event.stopPropagation()\n const items = subMenuListRef.current?.querySelectorAll('[role=\"menuitem\"]:not([aria-disabled=\"true\"])')\n if (items) {\n const currentIndex = Array.from(items).findIndex(item => item === document.activeElement)\n const nextIndex = (currentIndex + 1) % items.length\n ;(items[nextIndex] as HTMLElement)?.focus()\n }\n break\n case 'ArrowUp':\n event.preventDefault()\n event.stopPropagation()\n const itemsUp = subMenuListRef.current?.querySelectorAll('[role=\"menuitem\"]:not([aria-disabled=\"true\"])')\n if (itemsUp) {\n const currentIndexUp = Array.from(itemsUp).findIndex(item => item === document.activeElement)\n const prevIndex = (currentIndexUp - 1 + itemsUp.length) % itemsUp.length\n ;(itemsUp[prevIndex] as HTMLElement)?.focus()\n }\n break\n }\n }\n\n const itemClasses = [disabled && 'disabled', className].filter(Boolean).join(' ')\n\n return (\n <li\n ref={subMenuRef}\n className={itemClasses}\n role=\"none\"\n data-key={_key}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <details open={isSubOpen}>\n <summary\n ref={summaryRef}\n role=\"menuitem\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n aria-haspopup=\"menu\"\n aria-expanded={isSubOpen}\n aria-controls={subMenuId}\n className=\"whitespace-nowrap\"\n onKeyDown={handleSummaryKeyDown}\n >\n {icon && <span className=\"mr-2 inline-flex items-center\">{icon}</span>}\n {title}\n </summary>\n <ul\n ref={subMenuListRef}\n id={subMenuId}\n className={`${dMenu} bg-base-100 rounded-box z-50 shadow`}\n role=\"menu\"\n aria-label={typeof title === 'string' ? title : undefined}\n onKeyDown={handleSubMenuKeyDown}\n >\n {children}\n </ul>\n </details>\n </li>\n )\n}\n\nfunction DropdownDivider({ className = '' }: DropdownDividerProps) {\n const classes = ['border-base-content/10', className].filter(Boolean).join(' ')\n return (\n <li role=\"separator\" className=\"my-1\">\n <hr className={classes} />\n </li>\n )\n}\n\nexport const Dropdown = Object.assign(DropdownRoot, {\n Trigger: DropdownTrigger,\n Menu: DropdownMenu,\n Item: DropdownItem,\n SubMenu: DropdownSubMenu,\n Divider: DropdownDivider,\n})\n"],"names":["dDropdown","dDropdownTop","dDropdownBottom","dDropdownLeft","dDropdownRight","dDropdownCenter","dDropdownEnd","dDropdownHover","dDropdownOpen","dDropdownContent","dMenu","DropdownContext","createContext","useDropdownContext","context","useContext","DropdownRoot","forwardRef","children","items","trigger","position","align","controlledOpen","onOpenChange","disabled","arrow","mouseEnterDelay","mouseLeaveDelay","_getPopupContainer","destroyOnHidden","popupRender","testId","className","rest","ref","componentDisabled","useConfig","effectiveDisabled","menuId","useId","triggerId","internalOpen","setInternalOpen","useState","focusedIndex","setFocusedIndex","itemCount","setItemCount","shouldRender","setShouldRender","itemRefs","useRef","dropdownRef","hoverTimeoutRef","triggers","useImperativeHandle","getTestId","suffix","isControlled","isOpen","setIsOpen","useCallback","open","source","closeDropdown","registerItem","index","itemDisabled","useEffect","timeout","handleClickOutside","event","handleMouseEnter","handleMouseLeave","handleContextMenu","positionClasses","alignClasses","showArrow","menuContent","jsx","DropdownMenu","item","DropdownDivider","menuItem","DropdownSubMenu","child","DropdownItem","childArray","React","hasTrigger","DropdownTrigger","hasMenu","content","isAutoTrigger","triggerChild","jsxs","Fragment","menuChild","dropdownClasses","handleKeyDown","handleClick","childProps","e","menuRef","enabledCount","menuClasses","childrenWithIndex","childKey","arrowElement","icon","label","onClick","active","danger","_key","itemClasses","title","isSubOpen","setIsSubOpen","subMenuRef","summaryRef","subMenuListRef","subMenuId","focusFirstItem","handleSummaryKeyDown","handleSubMenuKeyDown","nextIndex","itemsUp","prevIndex","classes","Dropdown"],"mappings":";;;AAIA,MAAMA,KAAY,YACZC,KAAe,gBACfC,KAAkB,mBAClBC,KAAgB,iBAChBC,KAAiB,kBACjBC,KAAkB,mBAClBC,KAAe,gBACfC,KAAiB,kBACjBC,KAAgB,iBAChBC,KAAmB,oBACnBC,KAAQ,QAwCRC,KAAkBC,GAAgD,MAAS;AAEjF,SAASC,IAAqB;AAC5B,QAAMC,IAAUC,GAAWJ,EAAe;AAC1C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,2DAA2D;AAE7E,SAAOA;AACT;AA4EA,MAAME,KAAeC,GAA0C,SAC7D;AAAA,EACE,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAU,CAAC,OAAO;AAAA,EAClB,UAAAC,IAAW;AAAA,EACX,OAAAC,IAAQ;AAAA,EACR,MAAMC;AAAA,EACN,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,iBAAAC,IAAkB;AAAA,EAClB,iBAAAC,IAAkB;AAAA,EAClB,mBAAmBC;AAAA,EACnB,iBAAAC,IAAkB;AAAA,EAClB,aAAAC;AAAA,EACA,eAAeC;AAAA,EACf,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GACAC,GACA;AACA,QAAM,EAAE,mBAAAC,EAAA,IAAsBC,GAAA,GACxBC,IAAoBb,KAAYW,KAAqB,IAErDG,IAASC,EAAA,GACTC,IAAYD,EAAA,GACZ,CAACE,GAAcC,EAAe,IAAIC,EAAS,EAAK,GAChD,CAACC,IAAcC,CAAe,IAAIF,EAAS,EAAE,GAC7C,CAACG,IAAWC,EAAY,IAAIJ,EAAS,CAAC,GACtC,CAACK,IAAcC,CAAe,IAAI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213
213
|
return Oe;
|
|
214
|
-
case "info":
|
|
215
214
|
default:
|
|
216
215
|
return Ee;
|
|
217
216
|
}
|
|
@@ -277,7 +276,6 @@ function y(e) {
|
|
|
277
276
|
)
|
|
278
277
|
}
|
|
279
278
|
);
|
|
280
|
-
case "info":
|
|
281
279
|
default:
|
|
282
280
|
return /* @__PURE__ */ t(
|
|
283
281
|
"svg",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../../src/components/Modal.tsx"],"sourcesContent":["import React, { useEffect, useRef, useId, forwardRef, useImperativeHandle } from 'react'\nimport { createRoot } from 'react-dom/client'\nimport { useConfig } from '../providers/ConfigProvider'\n\n// DaisyUI classes\nconst dModal = 'modal'\nconst dModalTop = 'modal-top'\nconst dModalMiddle = 'modal-middle'\nconst dModalBottom = 'modal-bottom'\nconst dModalStart = 'modal-start'\nconst dModalEnd = 'modal-end'\nconst dModalBox = 'modal-box'\nconst dModalAction = 'modal-action'\nconst dModalBackdrop = 'modal-backdrop'\nconst dBtn = 'btn'\nconst dBtnPrimary = 'btn-primary'\nconst dBtnError = 'btn-error'\nconst dAlert = 'alert'\nconst dAlertInfo = 'alert-info'\nconst dAlertSuccess = 'alert-success'\nconst dAlertWarning = 'alert-warning'\nconst dAlertError = 'alert-error'\n\nexport type ModalPosition = 'top' | 'middle' | 'bottom'\nexport type ModalAlign = 'start' | 'end'\nexport type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nexport type ResponsivePosition = Partial<Record<Breakpoint, ModalPosition>>\n\nexport interface ModalProps extends Omit<React.HTMLAttributes<HTMLDialogElement>, 'title'> {\n children: React.ReactNode\n title?: React.ReactNode\n footer?: React.ReactNode\n open?: boolean\n onOk?: () => void | Promise<void>\n onCancel?: () => void\n okText?: string\n cancelText?: string\n maskClosable?: boolean\n closable?: boolean\n /** Modal position - can be a single value or responsive object */\n position?: ModalPosition | ResponsivePosition\n align?: ModalAlign\n /** Width of the modal box */\n width?: number | string\n /** Center the modal vertically */\n centered?: boolean\n /** Callback when modal is closed */\n onClose?: () => void\n /** Callback after modal close animation completes */\n afterClose?: () => void\n /** Where to place initial focus: 'ok', 'cancel', or 'close' button */\n initialFocus?: 'ok' | 'cancel' | 'close'\n /** Use alertdialog role for urgent messages */\n alertDialog?: boolean\n /** Show loading spinner on OK button */\n confirmLoading?: boolean\n /** Props for the OK button */\n okButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>\n /** Props for the Cancel button */\n cancelButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>\n /** Custom close icon */\n closeIcon?: React.ReactNode\n /** CSS z-index for the modal */\n zIndex?: number\n /** Destroy child components when modal is closed */\n destroyOnClose?: boolean\n /** Test ID prefix for child elements */\n 'data-testid'?: string\n}\n\nexport interface ModalFuncProps {\n title?: React.ReactNode\n content?: React.ReactNode\n onOk?: () => void | Promise<void>\n onCancel?: () => void\n okText?: string\n cancelText?: string\n type?: 'info' | 'success' | 'warning' | 'error'\n}\n\nconst Modal = forwardRef<HTMLDialogElement, ModalProps>(function Modal(\n {\n children,\n title,\n footer,\n open = false,\n onOk,\n onCancel,\n okText,\n cancelText,\n maskClosable = true,\n closable = true,\n position,\n align,\n width,\n centered,\n onClose,\n afterClose,\n initialFocus,\n alertDialog = false,\n confirmLoading,\n okButtonProps,\n cancelButtonProps,\n closeIcon,\n zIndex,\n destroyOnClose = false,\n 'data-testid': testId,\n className = '',\n style,\n ...rest\n },\n ref\n) {\n const { locale } = useConfig()\n const dialogRef = useRef<HTMLDialogElement>(null)\n const okButtonRef = useRef<HTMLButtonElement>(null)\n const cancelButtonRef = useRef<HTMLButtonElement>(null)\n const closeButtonRef = useRef<HTMLButtonElement>(null)\n const previousActiveElement = useRef<HTMLElement | null>(null)\n const [internalLoading, setInternalLoading] = React.useState(false)\n const [shouldRender, setShouldRender] = React.useState(open || !destroyOnClose)\n const titleId = useId()\n const contentId = useId()\n\n // Use external confirmLoading if provided, otherwise internal state\n const loading = confirmLoading ?? internalLoading\n\n // Resolve locale strings\n const resolvedOkText = okText ?? locale.Modal?.okText ?? 'OK'\n const resolvedCancelText = cancelText ?? locale.Modal?.cancelText ?? 'Cancel'\n\n // Forward ref\n useImperativeHandle(ref, () => dialogRef.current!, [])\n\n // Handle close - use onClose if provided, otherwise onCancel\n const closeHandler = onClose || onCancel\n\n useEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return\n\n if (open) {\n setShouldRender(true)\n if (!dialog.open) {\n // Save currently focused element for restoration\n previousActiveElement.current = document.activeElement as HTMLElement\n dialog.showModal()\n\n // Handle custom initial focus placement\n if (initialFocus) {\n setTimeout(() => {\n switch (initialFocus) {\n case 'ok':\n okButtonRef.current?.focus()\n break\n case 'cancel':\n cancelButtonRef.current?.focus()\n break\n case 'close':\n closeButtonRef.current?.focus()\n break\n }\n }, 0)\n }\n }\n } else {\n if (dialog.open) {\n dialog.close()\n // Restore focus to previously focused element\n previousActiveElement.current?.focus()\n // Call afterClose after animation\n if (afterClose) {\n setTimeout(afterClose, 300)\n }\n // Handle destroyOnClose\n if (destroyOnClose) {\n setTimeout(() => setShouldRender(false), 300)\n }\n }\n }\n }, [open, initialFocus, afterClose, destroyOnClose])\n\n useEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return\n\n const onDialogClose = () => {\n closeHandler?.()\n }\n\n dialog.addEventListener('close', onDialogClose)\n return () => {\n dialog.removeEventListener('close', onDialogClose)\n }\n }, [closeHandler])\n\n // Static class mappings for positions (no interpolation per qa.md)\n const positionClasses: Record<ModalPosition, string> = {\n top: dModalTop,\n middle: dModalMiddle,\n bottom: dModalBottom,\n }\n\n // Responsive position class mappings for each breakpoint\n const responsivePositionClasses: Record<Breakpoint, Record<ModalPosition, string>> = {\n base: {\n top: dModalTop,\n middle: dModalMiddle,\n bottom: dModalBottom,\n },\n sm: {\n top: 'sm:modal-top',\n middle: 'sm:modal-middle',\n bottom: 'sm:modal-bottom',\n },\n md: {\n top: 'md:modal-top',\n middle: 'md:modal-middle',\n bottom: 'md:modal-bottom',\n },\n lg: {\n top: 'lg:modal-top',\n middle: 'lg:modal-middle',\n bottom: 'lg:modal-bottom',\n },\n xl: {\n top: 'xl:modal-top',\n middle: 'xl:modal-middle',\n bottom: 'xl:modal-bottom',\n },\n '2xl': {\n top: '2xl:modal-top',\n middle: '2xl:modal-middle',\n bottom: '2xl:modal-bottom',\n },\n }\n\n const alignClasses: Record<ModalAlign, string> = {\n start: dModalStart,\n end: dModalEnd,\n }\n\n // Build position classes - handle both simple and responsive values\n const getPositionClasses = (): string[] => {\n // centered is an alias for position=\"middle\"\n if (centered) {\n return [positionClasses.middle]\n }\n\n if (!position) {\n return []\n }\n\n // Simple string position\n if (typeof position === 'string') {\n return [positionClasses[position]]\n }\n\n // Responsive object position\n const classes: string[] = []\n for (const [breakpoint, pos] of Object.entries(position) as [Breakpoint, ModalPosition][]) {\n if (pos) {\n classes.push(responsivePositionClasses[breakpoint][pos])\n }\n }\n return classes\n }\n\n const classes = [dModal, ...getPositionClasses(), align && alignClasses[align], className]\n .filter(Boolean)\n .join(' ')\n\n const handleOk = async () => {\n if (onOk) {\n if (confirmLoading === undefined) {\n setInternalLoading(true)\n }\n try {\n await onOk()\n if (confirmLoading === undefined) {\n setInternalLoading(false)\n }\n } catch (error) {\n if (confirmLoading === undefined) {\n setInternalLoading(false)\n }\n throw error\n }\n }\n }\n\n const handleBackdropClick = () => {\n if (maskClosable && closeHandler) {\n closeHandler()\n }\n }\n\n // Calculate modal-box style for custom width\n const modalBoxStyle: React.CSSProperties = width\n ? { width: typeof width === 'number' ? `${width}px` : width, maxWidth: '90vw' }\n : {}\n\n // Calculate dialog style for zIndex\n const dialogStyle: React.CSSProperties = {\n ...style,\n ...(zIndex !== undefined ? { zIndex } : {}),\n }\n\n // Render default footer if no custom footer provided and either onOk or onCancel exists\n const shouldRenderDefaultFooter = !footer && (onOk || onCancel)\n const shouldRenderCustomFooter = footer !== null && footer !== undefined\n\n // Helper for test IDs\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n if (!shouldRender) {\n return null\n }\n\n return (\n <dialog\n ref={dialogRef}\n role={alertDialog ? 'alertdialog' : 'dialog'}\n aria-modal=\"true\"\n className={classes}\n style={dialogStyle}\n data-state={open ? 'open' : 'closed'}\n data-testid={testId}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={contentId}\n {...rest}\n >\n <div className={dModalBox} style={modalBoxStyle}>\n {title && (\n <h3 id={titleId} className=\"text-lg font-bold mb-4\" data-testid={getTestId('title')}>\n {title}\n </h3>\n )}\n <div id={contentId} className=\"py-4\" data-testid={getTestId('content')}>\n {children}\n </div>\n {shouldRenderDefaultFooter && (\n <div className={dModalAction}>\n {onCancel && (\n <button\n ref={cancelButtonRef}\n className={dBtn}\n onClick={onCancel}\n data-testid={getTestId('cancel-button')}\n {...cancelButtonProps}\n >\n {resolvedCancelText}\n </button>\n )}\n {onOk && (\n <button\n ref={okButtonRef}\n className={`${dBtn} ${dBtnPrimary} ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading || okButtonProps?.disabled}\n aria-busy={loading || undefined}\n data-testid={getTestId('ok-button')}\n {...okButtonProps}\n >\n {resolvedOkText}\n </button>\n )}\n </div>\n )}\n {shouldRenderCustomFooter && <div className={dModalAction}>{footer}</div>}\n </div>\n {closable && maskClosable && (\n <form method=\"dialog\" className={dModalBackdrop} data-testid={getTestId('backdrop')}>\n <button\n ref={closeButtonRef}\n onClick={handleBackdropClick}\n data-testid={getTestId('close-button')}\n aria-label=\"Close modal\"\n >\n {closeIcon || <span className=\"sr-only\">Close modal</span>}\n </button>\n </form>\n )}\n </dialog>\n )\n})\n\nfunction createModal(config: ModalFuncProps & { showCancel?: boolean }) {\n const div = document.createElement('div')\n document.body.appendChild(div)\n const root = createRoot(div)\n\n const destroy = () => {\n root.unmount()\n if (div.parentNode) {\n div.parentNode.removeChild(div)\n }\n }\n\n const ModalContent = () => {\n const { locale } = useConfig()\n const [open, setOpen] = React.useState(true)\n const [loading, setLoading] = React.useState(false)\n\n const handleClose = () => {\n setOpen(false)\n setTimeout(destroy, 300) // Wait for animation\n }\n\n const handleOk = async () => {\n if (config.onOk) {\n setLoading(true)\n try {\n await config.onOk()\n handleClose()\n } catch (error) {\n setLoading(false)\n }\n } else {\n handleClose()\n }\n }\n\n const handleCancel = () => {\n config.onCancel?.()\n handleClose()\n }\n\n const getAlertClass = () => {\n switch (config.type) {\n case 'success':\n return dAlertSuccess\n case 'warning':\n return dAlertWarning\n case 'error':\n return dAlertError\n case 'info':\n default:\n return dAlertInfo\n }\n }\n\n const getIcon = () => {\n switch (config.type) {\n case 'success':\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"stroke-current shrink-0 h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n )\n case 'warning':\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"stroke-current shrink-0 h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n />\n </svg>\n )\n case 'error':\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"stroke-current shrink-0 h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n )\n case 'info':\n default:\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n className=\"stroke-current shrink-0 w-6 h-6\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n ></path>\n </svg>\n )\n }\n }\n\n // Use alertdialog role for warning/error types\n const isAlert = config.type === 'warning' || config.type === 'error'\n\n // Resolve locale strings\n const resolvedOkText = config.okText ?? locale.Modal?.okText ?? 'OK'\n const resolvedCancelText = config.cancelText ?? locale.Modal?.cancelText ?? 'Cancel'\n\n return (\n <Modal\n open={open}\n onOk={config.showCancel ? undefined : handleOk}\n onCancel={handleCancel}\n alertDialog={isAlert}\n title={\n config.type ? (\n <div className={`${dAlert} ${getAlertClass()}`}>\n {getIcon()}\n <div>{config.title && <h3 className=\"font-bold\">{config.title}</h3>}</div>\n </div>\n ) : (\n config.title\n )\n }\n okText={resolvedOkText}\n cancelText={resolvedCancelText}\n footer={\n config.showCancel ? (\n <>\n <button className={dBtn} onClick={handleCancel}>\n {resolvedCancelText}\n </button>\n <button\n className={`${dBtn} ${config.type === 'error' ? dBtnError : dBtnPrimary} ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading}\n >\n {resolvedOkText}\n </button>\n </>\n ) : (\n <button\n className={`${dBtn} ${config.type === 'error' ? dBtnError : dBtnPrimary} ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading}\n >\n {resolvedOkText}\n </button>\n )\n }\n >\n {config.type && config.content && <div className=\"text-sm\">{config.content}</div>}\n {!config.type && config.content}\n </Modal>\n )\n }\n\n root.render(<ModalContent />)\n\n return {\n destroy,\n }\n}\n\nfunction confirm(config: ModalFuncProps) {\n return createModal({ ...config, showCancel: true })\n}\n\nfunction info(config: ModalFuncProps) {\n return createModal({ ...config, type: 'info', showCancel: false })\n}\n\nfunction success(config: ModalFuncProps) {\n return createModal({ ...config, type: 'success', showCancel: false })\n}\n\nfunction warning(config: ModalFuncProps) {\n return createModal({ ...config, type: 'warning', showCancel: false })\n}\n\nfunction error(config: ModalFuncProps) {\n return createModal({ ...config, type: 'error', showCancel: false })\n}\n\nconst ModalWithStatics = Modal as typeof Modal & {\n confirm: typeof confirm\n info: typeof info\n success: typeof success\n warning: typeof warning\n error: typeof error\n}\n\nModalWithStatics.confirm = confirm\nModalWithStatics.info = info\nModalWithStatics.success = success\nModalWithStatics.warning = warning\nModalWithStatics.error = error\n\nexport { ModalWithStatics as Modal }\n"],"names":["dModal","dModalTop","dModalMiddle","dModalBottom","dModalStart","dModalEnd","dModalBox","dModalAction","dModalBackdrop","dBtn","dBtnPrimary","dBtnError","dAlert","dAlertInfo","dAlertSuccess","dAlertWarning","dAlertError","Modal","forwardRef","children","title","footer","open","onOk","onCancel","okText","cancelText","maskClosable","closable","position","align","width","centered","onClose","afterClose","initialFocus","alertDialog","confirmLoading","okButtonProps","cancelButtonProps","closeIcon","zIndex","destroyOnClose","testId","className","style","rest","ref","locale","useConfig","dialogRef","useRef","okButtonRef","cancelButtonRef","closeButtonRef","previousActiveElement","internalLoading","setInternalLoading","React","shouldRender","setShouldRender","titleId","useId","contentId","loading","resolvedOkText","resolvedCancelText","useImperativeHandle","closeHandler","useEffect","dialog","onDialogClose","positionClasses","responsivePositionClasses","alignClasses","classes","breakpoint","pos","handleOk","error","handleBackdropClick","modalBoxStyle","dialogStyle","shouldRenderDefaultFooter","shouldRenderCustomFooter","getTestId","suffix","jsxs","jsx","createModal","config","div","root","createRoot","destroy","ModalContent","setOpen","setLoading","handleClose","handleCancel","getAlertClass","getIcon","isAlert","Fragment","confirm","info","success","warning","ModalWithStatics"],"mappings":";;;;AAKA,MAAMA,KAAS,SACTC,IAAY,aACZC,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A,SAASgB,GAAQhB,GAAwB;AACvC,SAAOD,EAAY,EAAE,GAAGC,GAAQ,MAAM,WAAW,YAAY,IAAO;AACtE;AAEA,SAASiB,GAAQjB,GAAwB;AACvC,SAAOD,EAAY,EAAE,GAAGC,GAAQ,MAAM,WAAW,YAAY,IAAO;AACtE;AAEA,SAASX,GAAMW,GAAwB;AACrC,SAAOD,EAAY,EAAE,GAAGC,GAAQ,MAAM,SAAS,YAAY,IAAO;AACpE;AAEA,MAAMkB,IAAmB3F;AAQzB2F,EAAiB,UAAUJ;AAC3BI,EAAiB,OAAOH;AACxBG,EAAiB,UAAUF;AAC3BE,EAAiB,UAAUD;AAC3BC,EAAiB,QAAQ7B;"}
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../src/components/Modal.tsx"],"sourcesContent":["import React, { useEffect, useRef, useId, forwardRef, useImperativeHandle } from 'react'\nimport { createRoot } from 'react-dom/client'\nimport { useConfig } from '../providers/ConfigProvider'\n\n// DaisyUI classes\nconst dModal = 'modal'\nconst dModalTop = 'modal-top'\nconst dModalMiddle = 'modal-middle'\nconst dModalBottom = 'modal-bottom'\nconst dModalStart = 'modal-start'\nconst dModalEnd = 'modal-end'\nconst dModalBox = 'modal-box'\nconst dModalAction = 'modal-action'\nconst dModalBackdrop = 'modal-backdrop'\nconst dBtn = 'btn'\nconst dBtnPrimary = 'btn-primary'\nconst dBtnError = 'btn-error'\nconst dAlert = 'alert'\nconst dAlertInfo = 'alert-info'\nconst dAlertSuccess = 'alert-success'\nconst dAlertWarning = 'alert-warning'\nconst dAlertError = 'alert-error'\n\nexport type ModalPosition = 'top' | 'middle' | 'bottom'\nexport type ModalAlign = 'start' | 'end'\nexport type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nexport type ResponsivePosition = Partial<Record<Breakpoint, ModalPosition>>\n\nexport interface ModalProps extends Omit<React.HTMLAttributes<HTMLDialogElement>, 'title'> {\n children: React.ReactNode\n title?: React.ReactNode\n footer?: React.ReactNode\n open?: boolean\n onOk?: () => void | Promise<void>\n onCancel?: () => void\n okText?: string\n cancelText?: string\n maskClosable?: boolean\n closable?: boolean\n /** Modal position - can be a single value or responsive object */\n position?: ModalPosition | ResponsivePosition\n align?: ModalAlign\n /** Width of the modal box */\n width?: number | string\n /** Center the modal vertically */\n centered?: boolean\n /** Callback when modal is closed */\n onClose?: () => void\n /** Callback after modal close animation completes */\n afterClose?: () => void\n /** Where to place initial focus: 'ok', 'cancel', or 'close' button */\n initialFocus?: 'ok' | 'cancel' | 'close'\n /** Use alertdialog role for urgent messages */\n alertDialog?: boolean\n /** Show loading spinner on OK button */\n confirmLoading?: boolean\n /** Props for the OK button */\n okButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>\n /** Props for the Cancel button */\n cancelButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>\n /** Custom close icon */\n closeIcon?: React.ReactNode\n /** CSS z-index for the modal */\n zIndex?: number\n /** Destroy child components when modal is closed */\n destroyOnClose?: boolean\n /** Test ID prefix for child elements */\n 'data-testid'?: string\n}\n\nexport interface ModalFuncProps {\n title?: React.ReactNode\n content?: React.ReactNode\n onOk?: () => void | Promise<void>\n onCancel?: () => void\n okText?: string\n cancelText?: string\n type?: 'info' | 'success' | 'warning' | 'error'\n}\n\nconst Modal = forwardRef<HTMLDialogElement, ModalProps>(function Modal(\n {\n children,\n title,\n footer,\n open = false,\n onOk,\n onCancel,\n okText,\n cancelText,\n maskClosable = true,\n closable = true,\n position,\n align,\n width,\n centered,\n onClose,\n afterClose,\n initialFocus,\n alertDialog = false,\n confirmLoading,\n okButtonProps,\n cancelButtonProps,\n closeIcon,\n zIndex,\n destroyOnClose = false,\n 'data-testid': testId,\n className = '',\n style,\n ...rest\n },\n ref\n) {\n const { locale } = useConfig()\n const dialogRef = useRef<HTMLDialogElement>(null)\n const okButtonRef = useRef<HTMLButtonElement>(null)\n const cancelButtonRef = useRef<HTMLButtonElement>(null)\n const closeButtonRef = useRef<HTMLButtonElement>(null)\n const previousActiveElement = useRef<HTMLElement | null>(null)\n const [internalLoading, setInternalLoading] = React.useState(false)\n const [shouldRender, setShouldRender] = React.useState(open || !destroyOnClose)\n const titleId = useId()\n const contentId = useId()\n\n // Use external confirmLoading if provided, otherwise internal state\n const loading = confirmLoading ?? internalLoading\n\n // Resolve locale strings\n const resolvedOkText = okText ?? locale.Modal?.okText ?? 'OK'\n const resolvedCancelText = cancelText ?? locale.Modal?.cancelText ?? 'Cancel'\n\n // Forward ref\n useImperativeHandle(ref, () => dialogRef.current!, [])\n\n // Handle close - use onClose if provided, otherwise onCancel\n const closeHandler = onClose || onCancel\n\n useEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return\n\n if (open) {\n setShouldRender(true)\n if (!dialog.open) {\n // Save currently focused element for restoration\n previousActiveElement.current = document.activeElement as HTMLElement\n dialog.showModal()\n\n // Handle custom initial focus placement\n if (initialFocus) {\n setTimeout(() => {\n switch (initialFocus) {\n case 'ok':\n okButtonRef.current?.focus()\n break\n case 'cancel':\n cancelButtonRef.current?.focus()\n break\n case 'close':\n closeButtonRef.current?.focus()\n break\n }\n }, 0)\n }\n }\n } else {\n if (dialog.open) {\n dialog.close()\n // Restore focus to previously focused element\n previousActiveElement.current?.focus()\n // Call afterClose after animation\n if (afterClose) {\n setTimeout(afterClose, 300)\n }\n // Handle destroyOnClose\n if (destroyOnClose) {\n setTimeout(() => setShouldRender(false), 300)\n }\n }\n }\n }, [open, initialFocus, afterClose, destroyOnClose])\n\n useEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return\n\n const onDialogClose = () => {\n closeHandler?.()\n }\n\n dialog.addEventListener('close', onDialogClose)\n return () => {\n dialog.removeEventListener('close', onDialogClose)\n }\n }, [closeHandler])\n\n // Static class mappings for positions (no interpolation per qa.md)\n const positionClasses: Record<ModalPosition, string> = {\n top: dModalTop,\n middle: dModalMiddle,\n bottom: dModalBottom,\n }\n\n // Responsive position class mappings for each breakpoint\n const responsivePositionClasses: Record<Breakpoint, Record<ModalPosition, string>> = {\n base: {\n top: dModalTop,\n middle: dModalMiddle,\n bottom: dModalBottom,\n },\n sm: {\n top: 'sm:modal-top',\n middle: 'sm:modal-middle',\n bottom: 'sm:modal-bottom',\n },\n md: {\n top: 'md:modal-top',\n middle: 'md:modal-middle',\n bottom: 'md:modal-bottom',\n },\n lg: {\n top: 'lg:modal-top',\n middle: 'lg:modal-middle',\n bottom: 'lg:modal-bottom',\n },\n xl: {\n top: 'xl:modal-top',\n middle: 'xl:modal-middle',\n bottom: 'xl:modal-bottom',\n },\n '2xl': {\n top: '2xl:modal-top',\n middle: '2xl:modal-middle',\n bottom: '2xl:modal-bottom',\n },\n }\n\n const alignClasses: Record<ModalAlign, string> = {\n start: dModalStart,\n end: dModalEnd,\n }\n\n // Build position classes - handle both simple and responsive values\n const getPositionClasses = (): string[] => {\n // centered is an alias for position=\"middle\"\n if (centered) {\n return [positionClasses.middle]\n }\n\n if (!position) {\n return []\n }\n\n // Simple string position\n if (typeof position === 'string') {\n return [positionClasses[position]]\n }\n\n // Responsive object position\n const classes: string[] = []\n for (const [breakpoint, pos] of Object.entries(position) as [Breakpoint, ModalPosition][]) {\n if (pos) {\n classes.push(responsivePositionClasses[breakpoint][pos])\n }\n }\n return classes\n }\n\n const classes = [dModal, ...getPositionClasses(), align && alignClasses[align], className]\n .filter(Boolean)\n .join(' ')\n\n const handleOk = async () => {\n if (onOk) {\n if (confirmLoading === undefined) {\n setInternalLoading(true)\n }\n try {\n await onOk()\n if (confirmLoading === undefined) {\n setInternalLoading(false)\n }\n } catch (error) {\n if (confirmLoading === undefined) {\n setInternalLoading(false)\n }\n throw error\n }\n }\n }\n\n const handleBackdropClick = () => {\n if (maskClosable && closeHandler) {\n closeHandler()\n }\n }\n\n // Calculate modal-box style for custom width\n const modalBoxStyle: React.CSSProperties = width\n ? { width: typeof width === 'number' ? `${width}px` : width, maxWidth: '90vw' }\n : {}\n\n // Calculate dialog style for zIndex\n const dialogStyle: React.CSSProperties = {\n ...style,\n ...(zIndex !== undefined ? { zIndex } : {}),\n }\n\n // Render default footer if no custom footer provided and either onOk or onCancel exists\n const shouldRenderDefaultFooter = !footer && (onOk || onCancel)\n const shouldRenderCustomFooter = footer !== null && footer !== undefined\n\n // Helper for test IDs\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n if (!shouldRender) {\n return null\n }\n\n return (\n <dialog\n ref={dialogRef}\n role={alertDialog ? 'alertdialog' : 'dialog'}\n aria-modal=\"true\"\n className={classes}\n style={dialogStyle}\n data-state={open ? 'open' : 'closed'}\n data-testid={testId}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={contentId}\n {...rest}\n >\n <div className={dModalBox} style={modalBoxStyle}>\n {title && (\n <h3 id={titleId} className=\"text-lg font-bold mb-4\" data-testid={getTestId('title')}>\n {title}\n </h3>\n )}\n <div id={contentId} className=\"py-4\" data-testid={getTestId('content')}>\n {children}\n </div>\n {shouldRenderDefaultFooter && (\n <div className={dModalAction}>\n {onCancel && (\n <button\n ref={cancelButtonRef}\n className={dBtn}\n onClick={onCancel}\n data-testid={getTestId('cancel-button')}\n {...cancelButtonProps}\n >\n {resolvedCancelText}\n </button>\n )}\n {onOk && (\n <button\n ref={okButtonRef}\n className={`${dBtn} ${dBtnPrimary} ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading || okButtonProps?.disabled}\n aria-busy={loading || undefined}\n data-testid={getTestId('ok-button')}\n {...okButtonProps}\n >\n {resolvedOkText}\n </button>\n )}\n </div>\n )}\n {shouldRenderCustomFooter && <div className={dModalAction}>{footer}</div>}\n </div>\n {closable && maskClosable && (\n <form method=\"dialog\" className={dModalBackdrop} data-testid={getTestId('backdrop')}>\n <button\n ref={closeButtonRef}\n onClick={handleBackdropClick}\n data-testid={getTestId('close-button')}\n aria-label=\"Close modal\"\n >\n {closeIcon || <span className=\"sr-only\">Close modal</span>}\n </button>\n </form>\n )}\n </dialog>\n )\n})\n\nfunction createModal(config: ModalFuncProps & { showCancel?: boolean }) {\n const div = document.createElement('div')\n document.body.appendChild(div)\n const root = createRoot(div)\n\n const destroy = () => {\n root.unmount()\n if (div.parentNode) {\n div.parentNode.removeChild(div)\n }\n }\n\n const ModalContent = () => {\n const { locale } = useConfig()\n const [open, setOpen] = React.useState(true)\n const [loading, setLoading] = React.useState(false)\n\n const handleClose = () => {\n setOpen(false)\n setTimeout(destroy, 300) // Wait for animation\n }\n\n const handleOk = async () => {\n if (config.onOk) {\n setLoading(true)\n try {\n await config.onOk()\n handleClose()\n } catch (error) {\n setLoading(false)\n }\n } else {\n handleClose()\n }\n }\n\n const handleCancel = () => {\n config.onCancel?.()\n handleClose()\n }\n\n const getAlertClass = () => {\n switch (config.type) {\n case 'success':\n return dAlertSuccess\n case 'warning':\n return dAlertWarning\n case 'error':\n return dAlertError\n case 'info':\n default:\n return dAlertInfo\n }\n }\n\n const getIcon = () => {\n switch (config.type) {\n case 'success':\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"stroke-current shrink-0 h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n )\n case 'warning':\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"stroke-current shrink-0 h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n />\n </svg>\n )\n case 'error':\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"stroke-current shrink-0 h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n )\n case 'info':\n default:\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n className=\"stroke-current shrink-0 w-6 h-6\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n ></path>\n </svg>\n )\n }\n }\n\n // Use alertdialog role for warning/error types\n const isAlert = config.type === 'warning' || config.type === 'error'\n\n // Resolve locale strings\n const resolvedOkText = config.okText ?? locale.Modal?.okText ?? 'OK'\n const resolvedCancelText = config.cancelText ?? locale.Modal?.cancelText ?? 'Cancel'\n\n return (\n <Modal\n open={open}\n onOk={config.showCancel ? undefined : handleOk}\n onCancel={handleCancel}\n alertDialog={isAlert}\n title={\n config.type ? (\n <div className={`${dAlert} ${getAlertClass()}`}>\n {getIcon()}\n <div>{config.title && <h3 className=\"font-bold\">{config.title}</h3>}</div>\n </div>\n ) : (\n config.title\n )\n }\n okText={resolvedOkText}\n cancelText={resolvedCancelText}\n footer={\n config.showCancel ? (\n <>\n <button className={dBtn} onClick={handleCancel}>\n {resolvedCancelText}\n </button>\n <button\n className={`${dBtn} ${config.type === 'error' ? dBtnError : dBtnPrimary} ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading}\n >\n {resolvedOkText}\n </button>\n </>\n ) : (\n <button\n className={`${dBtn} ${config.type === 'error' ? dBtnError : dBtnPrimary} ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading}\n >\n {resolvedOkText}\n </button>\n )\n }\n >\n {config.type && config.content && <div className=\"text-sm\">{config.content}</div>}\n {!config.type && config.content}\n </Modal>\n )\n }\n\n root.render(<ModalContent />)\n\n return {\n destroy,\n }\n}\n\nfunction confirm(config: ModalFuncProps) {\n return createModal({ ...config, showCancel: true })\n}\n\nfunction info(config: ModalFuncProps) {\n return createModal({ ...config, type: 'info', showCancel: false })\n}\n\nfunction success(config: ModalFuncProps) {\n return createModal({ ...config, type: 'success', showCancel: false })\n}\n\nfunction warning(config: ModalFuncProps) {\n return createModal({ ...config, type: 'warning', showCancel: false })\n}\n\nfunction error(config: ModalFuncProps) {\n return createModal({ ...config, type: 'error', showCancel: false })\n}\n\nconst ModalWithStatics = Modal as typeof Modal & {\n confirm: typeof confirm\n info: typeof info\n success: typeof success\n warning: typeof warning\n error: typeof error\n}\n\nModalWithStatics.confirm = confirm\nModalWithStatics.info = info\nModalWithStatics.success = success\nModalWithStatics.warning = warning\nModalWithStatics.error = error\n\nexport { ModalWithStatics as Modal }\n"],"names":["dModal","dModalTop","dModalMiddle","dModalBottom","dModalStart","dModalEnd","dModalBox","dModalAction","dModalBackdrop","dBtn","dBtnPrimary","dBtnError","dAlert","dAlertInfo","dAlertSuccess","dAlertWarning","dAlertError","Modal","forwardRef","children","title","footer","open","onOk","onCancel","okText","cancelText","maskClosable","closable","position","align","width","centered","onClose","afterClose","initialFocus","alertDialog","confirmLoading","okButtonProps","cancelButtonProps","closeIcon","zIndex","destroyOnClose","testId","className","style","rest","ref","locale","useConfig","dialogRef","useRef","okButtonRef","cancelButtonRef","closeButtonRef","previousActiveElement","internalLoading","setInternalLoading","React","shouldRender","setShouldRender","titleId","useId","contentId","loading","resolvedOkText","resolvedCancelText","useImperativeHandle","closeHandler","useEffect","dialog","onDialogClose","positionClasses","responsivePositionClasses","alignClasses","classes","breakpoint","pos","handleOk","error","handleBackdropClick","modalBoxStyle","dialogStyle","shouldRenderDefaultFooter","shouldRenderCustomFooter","getTestId","suffix","jsxs","jsx","createModal","config","div","root","createRoot","destroy","ModalContent","setOpen","setLoading","handleClose","handleCancel","getAlertClass","getIcon","isAlert","Fragment","confirm","info","success","warning","ModalWithStatics"],"mappings":";;;;AAKA,MAAMA,KAAS,SACTC,IAAY,aACZC,IAAe,gBACfC,IAAe,gBACfC,KAAc,eACdC,KAAY,aACZC,KAAY,aACZC,KAAe,gBACfC,KAAiB,kBACjBC,IAAO,OACPC,IAAc,eACdC,KAAY,aACZC,KAAS,SACTC,KAAa,cACbC,KAAgB,iBAChBC,KAAgB,iBAChBC,KAAc,eA4DdC,KAAQC,GAA0C,SACtD;AAAA,EACE,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,UAAAC,IAAW;AAAA,EACX,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,gBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,eAAeC;AAAA,EACf,WAAAC,KAAY;AAAA,EACZ,OAAAC;AAAA,EACA,GAAGC;AACL,GACAC,IACA;AACA,QAAM,EAAE,QAAAC,EAAA,IAAWC,GAAA,GACbC,IAAYC,EAA0B,IAAI,GAC1CC,IAAcD,EAA0B,IAAI,GAC5CE,IAAkBF,EAA0B,IAAI,GAChDG,IAAiBH,EAA0B,IAAI,GAC/CI,IAAwBJ,EAA2B,IAAI,GACvD,CAACK,IAAiBC,CAAkB,IAAIC,EAAM,SAAS,EAAK,GAC5D,CAACC,IAAcC,CAAe,IAAIF,EA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AAE,GAAGC,GAAQ,YAAY,IAAM;AACpD;AAEA,SAASe,GAAKf,GAAwB;AACpC,SAAOD,EAAY,EAAE,GAAGC,GAAQ,MAAM,QAAQ,YAAY,IAAO;AACnE;AAEA,SAASgB,GAAQhB,GAAwB;AACvC,SAAOD,EAAY,EAAE,GAAGC,GAAQ,MAAM,WAAW,YAAY,IAAO;AACtE;AAEA,SAASiB,GAAQjB,GAAwB;AACvC,SAAOD,EAAY,EAAE,GAAGC,GAAQ,MAAM,WAAW,YAAY,IAAO;AACtE;AAEA,SAASX,GAAMW,GAAwB;AACrC,SAAOD,EAAY,EAAE,GAAGC,GAAQ,MAAM,SAAS,YAAY,IAAO;AACpE;AAEA,MAAMkB,IAAmB3F;AAQzB2F,EAAiB,UAAUJ;AAC3BI,EAAiB,OAAOH;AACxBG,EAAiB,UAAUF;AAC3BE,EAAiB,UAAUD;AAC3BC,EAAiB,QAAQ7B;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asterui",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.73",
|
|
4
4
|
"description": "React UI component library with DaisyUI",
|
|
5
5
|
"homepage": "https://asterui.com",
|
|
6
6
|
"repository": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@tailwindcss/vite": "^4.1.
|
|
85
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
86
86
|
"@tanstack/react-virtual": "^3.13.13",
|
|
87
87
|
"@tiptap/extension-link": "^2.11.5",
|
|
88
88
|
"@tiptap/extension-placeholder": "^2.11.5",
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
"@types/react-dom": "^19.2.2",
|
|
95
95
|
"@vitejs/plugin-react": "^5.1.1",
|
|
96
96
|
"apexcharts": "^5.3.6",
|
|
97
|
-
"daisyui": "^5.5.
|
|
97
|
+
"daisyui": "^5.5.14",
|
|
98
98
|
"qrcode": "^1.5.4",
|
|
99
99
|
"react": "^19.2.0",
|
|
100
100
|
"react-dom": "^19.2.0",
|
|
101
101
|
"react-hook-form": "^7.66.1",
|
|
102
|
-
"tailwindcss": "^4.1.
|
|
102
|
+
"tailwindcss": "^4.1.18",
|
|
103
103
|
"typescript": "^5.6.3",
|
|
104
104
|
"vite": "^7.2.2",
|
|
105
105
|
"vite-plugin-dts": "^4.5.4"
|