asterui 0.12.13 → 0.12.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button.d.ts +4 -0
- package/dist/components/Drawer.d.ts +47 -6
- package/dist/components/Dropdown.d.ts +65 -9
- package/dist/components/Input.d.ts +15 -1
- package/dist/components/Modal.d.ts +5 -1
- package/dist/components/Navbar.d.ts +15 -1
- package/dist/components/SidebarDrawer.d.ts +21 -0
- package/dist/components/Tabs.d.ts +30 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +169 -167
- package/dist/index.js.map +1 -1
- package/dist/index100.js +44 -11
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +10 -12
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +14 -7
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +7 -12
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +11 -29
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +29 -16
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +21 -0
- package/dist/index106.js.map +1 -0
- package/dist/index21.js +1 -1
- package/dist/index26.js +171 -40
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +41 -17
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +17 -33
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +33 -52
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +50 -61
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +60 -181
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +184 -18
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +15 -217
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +216 -1083
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +1086 -16
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +16 -121
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +119 -37
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +34 -208
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +390 -89
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +93 -158
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +211 -135
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +146 -15
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +15 -17
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +17 -21
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +18 -134
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +134 -10
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +13 -35
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +35 -34
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +34 -81
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +71 -166
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +167 -144
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +152 -11
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +10 -20
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +22 -14
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +14 -7
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +6 -310
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +334 -17
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +47 -122
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +120 -108
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +107 -167
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +167 -29
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +30 -120
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +116 -80
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +85 -19
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +19 -73
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +71 -54
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +56 -44
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +42 -49
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +52 -62
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +56 -101
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +107 -41
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +41 -68
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +66 -19
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +18 -55
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +55 -251
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +254 -22
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +22 -31
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +30 -93
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +89 -324
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +323 -50
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +79 -39
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +40 -23
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +21 -93
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +87 -148
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +147 -152
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +159 -63
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +65 -35
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +35 -234
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +231 -31
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +69 -44
- package/dist/index9.js.map +1 -1
- package/dist/index90.js +34 -210
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +195 -198
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +159 -241
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +283 -166
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +173 -253
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +258 -14
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +12 -31
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +32 -5
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +5 -13
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +11 -43
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
package/dist/index57.js
CHANGED
|
@@ -1,20 +1,337 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsxs as m, jsx as t, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import M, { useRef as f, useId as I, useEffect as S } from "react";
|
|
3
|
+
import { createRoot as X } from "react-dom/client";
|
|
4
|
+
function u({
|
|
5
|
+
children: e,
|
|
6
|
+
title: r,
|
|
7
|
+
footer: s,
|
|
8
|
+
open: l = !1,
|
|
9
|
+
onOk: a,
|
|
10
|
+
onCancel: d,
|
|
11
|
+
okText: y = "OK",
|
|
12
|
+
cancelText: c = "Cancel",
|
|
13
|
+
maskClosable: h = !0,
|
|
14
|
+
closable: p = !0,
|
|
15
|
+
position: n,
|
|
16
|
+
align: b,
|
|
17
|
+
width: i,
|
|
18
|
+
centered: C,
|
|
19
|
+
onClose: g,
|
|
20
|
+
initialFocus: k,
|
|
21
|
+
alertDialog: A = !1,
|
|
22
|
+
className: D = "",
|
|
23
|
+
...K
|
|
24
|
+
}) {
|
|
25
|
+
const N = f(null), R = f(null), T = f(null), j = f(null), O = f(null), [L, B] = M.useState(!1), $ = I(), E = I(), v = g || d;
|
|
26
|
+
S(() => {
|
|
27
|
+
const o = N.current;
|
|
28
|
+
o && (l ? o.open || (O.current = document.activeElement, o.showModal(), k && setTimeout(() => {
|
|
29
|
+
switch (k) {
|
|
30
|
+
case "ok":
|
|
31
|
+
R.current?.focus();
|
|
32
|
+
break;
|
|
33
|
+
case "cancel":
|
|
34
|
+
T.current?.focus();
|
|
35
|
+
break;
|
|
36
|
+
case "close":
|
|
37
|
+
j.current?.focus();
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}, 0)) : o.open && (o.close(), O.current?.focus()));
|
|
41
|
+
}, [l, k]), S(() => {
|
|
42
|
+
const o = N.current;
|
|
43
|
+
if (!o) return;
|
|
44
|
+
const x = () => {
|
|
45
|
+
v?.();
|
|
46
|
+
};
|
|
47
|
+
return o.addEventListener("close", x), () => {
|
|
48
|
+
o.removeEventListener("close", x);
|
|
49
|
+
};
|
|
50
|
+
}, [v]);
|
|
51
|
+
const W = {
|
|
52
|
+
top: "modal-top",
|
|
53
|
+
middle: "modal-middle",
|
|
54
|
+
bottom: "modal-bottom"
|
|
55
|
+
}, P = {
|
|
56
|
+
base: {
|
|
57
|
+
top: "modal-top",
|
|
58
|
+
middle: "modal-middle",
|
|
59
|
+
bottom: "modal-bottom"
|
|
60
|
+
},
|
|
61
|
+
sm: {
|
|
62
|
+
top: "sm:modal-top",
|
|
63
|
+
middle: "sm:modal-middle",
|
|
64
|
+
bottom: "sm:modal-bottom"
|
|
65
|
+
},
|
|
66
|
+
md: {
|
|
67
|
+
top: "md:modal-top",
|
|
68
|
+
middle: "md:modal-middle",
|
|
69
|
+
bottom: "md:modal-bottom"
|
|
70
|
+
},
|
|
71
|
+
lg: {
|
|
72
|
+
top: "lg:modal-top",
|
|
73
|
+
middle: "lg:modal-middle",
|
|
74
|
+
bottom: "lg:modal-bottom"
|
|
75
|
+
},
|
|
76
|
+
xl: {
|
|
77
|
+
top: "xl:modal-top",
|
|
78
|
+
middle: "xl:modal-middle",
|
|
79
|
+
bottom: "xl:modal-bottom"
|
|
80
|
+
},
|
|
81
|
+
"2xl": {
|
|
82
|
+
top: "2xl:modal-top",
|
|
83
|
+
middle: "2xl:modal-middle",
|
|
84
|
+
bottom: "2xl:modal-bottom"
|
|
85
|
+
}
|
|
86
|
+
}, F = {
|
|
87
|
+
start: "modal-start",
|
|
88
|
+
end: "modal-end"
|
|
89
|
+
}, H = [
|
|
90
|
+
"modal",
|
|
91
|
+
...(() => {
|
|
92
|
+
if (C)
|
|
93
|
+
return [W.middle];
|
|
94
|
+
if (!n)
|
|
95
|
+
return [];
|
|
96
|
+
if (typeof n == "string")
|
|
97
|
+
return [W[n]];
|
|
98
|
+
const o = [];
|
|
99
|
+
for (const [x, z] of Object.entries(n))
|
|
100
|
+
z && o.push(P[x][z]);
|
|
101
|
+
return o;
|
|
102
|
+
})(),
|
|
103
|
+
b && F[b],
|
|
104
|
+
D
|
|
105
|
+
].filter(Boolean).join(" "), q = async () => {
|
|
106
|
+
if (a) {
|
|
107
|
+
B(!0);
|
|
108
|
+
try {
|
|
109
|
+
await a(), B(!1);
|
|
110
|
+
} catch (o) {
|
|
111
|
+
throw B(!1), o;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, G = () => {
|
|
115
|
+
h && v && v();
|
|
116
|
+
}, J = i ? { width: typeof i == "number" ? `${i}px` : i, maxWidth: "90vw" } : {}, Q = !s && (a || d), U = s != null;
|
|
117
|
+
return /* @__PURE__ */ m(
|
|
118
|
+
"dialog",
|
|
119
|
+
{
|
|
120
|
+
ref: N,
|
|
121
|
+
role: A ? "alertdialog" : "dialog",
|
|
122
|
+
"aria-modal": "true",
|
|
123
|
+
className: H,
|
|
124
|
+
"data-state": l ? "open" : "closed",
|
|
125
|
+
"aria-labelledby": r ? $ : void 0,
|
|
126
|
+
"aria-describedby": E,
|
|
127
|
+
...K,
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ m("div", { className: "modal-box", style: J, children: [
|
|
130
|
+
r && /* @__PURE__ */ t("h3", { id: $, className: "text-lg font-bold mb-4", children: r }),
|
|
131
|
+
/* @__PURE__ */ t("div", { id: E, className: "py-4", children: e }),
|
|
132
|
+
Q && /* @__PURE__ */ m("div", { className: "modal-action", children: [
|
|
133
|
+
d && /* @__PURE__ */ t("button", { ref: T, className: "btn", onClick: d, children: c }),
|
|
134
|
+
a && /* @__PURE__ */ t(
|
|
135
|
+
"button",
|
|
136
|
+
{
|
|
137
|
+
ref: R,
|
|
138
|
+
className: `btn btn-primary ${L ? "loading" : ""}`,
|
|
139
|
+
onClick: q,
|
|
140
|
+
disabled: L,
|
|
141
|
+
"aria-busy": L || void 0,
|
|
142
|
+
children: y
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] }),
|
|
146
|
+
U && /* @__PURE__ */ t("div", { className: "modal-action", children: s })
|
|
147
|
+
] }),
|
|
148
|
+
p && h && /* @__PURE__ */ t("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ t("button", { ref: j, onClick: G, children: /* @__PURE__ */ t("span", { className: "sr-only", children: "Close modal" }) }) })
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function w(e) {
|
|
154
|
+
const r = document.createElement("div");
|
|
155
|
+
document.body.appendChild(r);
|
|
156
|
+
const s = X(r), l = () => {
|
|
157
|
+
s.unmount(), r.parentNode && r.parentNode.removeChild(r);
|
|
158
|
+
}, a = () => {
|
|
159
|
+
const [d, y] = M.useState(!0), [c, h] = M.useState(!1), p = () => {
|
|
160
|
+
y(!1), setTimeout(l, 300);
|
|
161
|
+
}, n = async () => {
|
|
162
|
+
if (e.onOk) {
|
|
163
|
+
h(!0);
|
|
164
|
+
try {
|
|
165
|
+
await e.onOk(), p();
|
|
166
|
+
} catch {
|
|
167
|
+
h(!1);
|
|
168
|
+
}
|
|
169
|
+
} else
|
|
170
|
+
p();
|
|
171
|
+
}, b = () => {
|
|
172
|
+
e.onCancel?.(), p();
|
|
173
|
+
}, i = () => {
|
|
174
|
+
switch (e.type) {
|
|
175
|
+
case "success":
|
|
176
|
+
return "alert-success";
|
|
177
|
+
case "warning":
|
|
178
|
+
return "alert-warning";
|
|
179
|
+
case "error":
|
|
180
|
+
return "alert-error";
|
|
181
|
+
case "info":
|
|
182
|
+
default:
|
|
183
|
+
return "alert-info";
|
|
184
|
+
}
|
|
185
|
+
}, C = () => {
|
|
186
|
+
switch (e.type) {
|
|
187
|
+
case "success":
|
|
188
|
+
return /* @__PURE__ */ t(
|
|
189
|
+
"svg",
|
|
190
|
+
{
|
|
191
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
192
|
+
className: "stroke-current shrink-0 h-6 w-6",
|
|
193
|
+
fill: "none",
|
|
194
|
+
viewBox: "0 0 24 24",
|
|
195
|
+
"aria-hidden": "true",
|
|
196
|
+
children: /* @__PURE__ */ t(
|
|
197
|
+
"path",
|
|
198
|
+
{
|
|
199
|
+
strokeLinecap: "round",
|
|
200
|
+
strokeLinejoin: "round",
|
|
201
|
+
strokeWidth: "2",
|
|
202
|
+
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
case "warning":
|
|
208
|
+
return /* @__PURE__ */ t(
|
|
209
|
+
"svg",
|
|
210
|
+
{
|
|
211
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
212
|
+
className: "stroke-current shrink-0 h-6 w-6",
|
|
213
|
+
fill: "none",
|
|
214
|
+
viewBox: "0 0 24 24",
|
|
215
|
+
"aria-hidden": "true",
|
|
216
|
+
children: /* @__PURE__ */ t(
|
|
217
|
+
"path",
|
|
218
|
+
{
|
|
219
|
+
strokeLinecap: "round",
|
|
220
|
+
strokeLinejoin: "round",
|
|
221
|
+
strokeWidth: "2",
|
|
222
|
+
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"
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
case "error":
|
|
228
|
+
return /* @__PURE__ */ t(
|
|
229
|
+
"svg",
|
|
230
|
+
{
|
|
231
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
232
|
+
className: "stroke-current shrink-0 h-6 w-6",
|
|
233
|
+
fill: "none",
|
|
234
|
+
viewBox: "0 0 24 24",
|
|
235
|
+
"aria-hidden": "true",
|
|
236
|
+
children: /* @__PURE__ */ t(
|
|
237
|
+
"path",
|
|
238
|
+
{
|
|
239
|
+
strokeLinecap: "round",
|
|
240
|
+
strokeLinejoin: "round",
|
|
241
|
+
strokeWidth: "2",
|
|
242
|
+
d: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
case "info":
|
|
248
|
+
default:
|
|
249
|
+
return /* @__PURE__ */ t(
|
|
250
|
+
"svg",
|
|
251
|
+
{
|
|
252
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
253
|
+
fill: "none",
|
|
254
|
+
viewBox: "0 0 24 24",
|
|
255
|
+
className: "stroke-current shrink-0 w-6 h-6",
|
|
256
|
+
"aria-hidden": "true",
|
|
257
|
+
children: /* @__PURE__ */ t(
|
|
258
|
+
"path",
|
|
259
|
+
{
|
|
260
|
+
strokeLinecap: "round",
|
|
261
|
+
strokeLinejoin: "round",
|
|
262
|
+
strokeWidth: "2",
|
|
263
|
+
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
}, g = e.type === "warning" || e.type === "error";
|
|
270
|
+
return /* @__PURE__ */ m(
|
|
271
|
+
u,
|
|
272
|
+
{
|
|
273
|
+
open: d,
|
|
274
|
+
onOk: e.showCancel ? void 0 : n,
|
|
275
|
+
onCancel: b,
|
|
276
|
+
alertDialog: g,
|
|
277
|
+
title: e.type ? /* @__PURE__ */ m("div", { className: `alert ${i()}`, children: [
|
|
278
|
+
C(),
|
|
279
|
+
/* @__PURE__ */ t("div", { children: e.title && /* @__PURE__ */ t("h3", { className: "font-bold", children: e.title }) })
|
|
280
|
+
] }) : e.title,
|
|
281
|
+
okText: e.okText,
|
|
282
|
+
cancelText: e.cancelText,
|
|
283
|
+
footer: e.showCancel ? /* @__PURE__ */ m(V, { children: [
|
|
284
|
+
/* @__PURE__ */ t("button", { className: "btn", onClick: b, children: e.cancelText || "Cancel" }),
|
|
285
|
+
/* @__PURE__ */ t(
|
|
286
|
+
"button",
|
|
287
|
+
{
|
|
288
|
+
className: `btn ${e.type === "error" ? "btn-error" : "btn-primary"} ${c ? "loading" : ""}`,
|
|
289
|
+
onClick: n,
|
|
290
|
+
disabled: c,
|
|
291
|
+
children: e.okText || "OK"
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
] }) : /* @__PURE__ */ t(
|
|
295
|
+
"button",
|
|
296
|
+
{
|
|
297
|
+
className: `btn ${e.type === "error" ? "btn-error" : "btn-primary"} ${c ? "loading" : ""}`,
|
|
298
|
+
onClick: n,
|
|
299
|
+
disabled: c,
|
|
300
|
+
children: e.okText || "OK"
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
children: [
|
|
304
|
+
e.type && e.content && /* @__PURE__ */ t("div", { className: "text-sm", children: e.content }),
|
|
305
|
+
!e.type && e.content
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
};
|
|
310
|
+
return s.render(/* @__PURE__ */ t(a, {})), {
|
|
311
|
+
destroy: l
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function Y(e) {
|
|
315
|
+
return w({ ...e, showCancel: !0 });
|
|
316
|
+
}
|
|
317
|
+
function Z(e) {
|
|
318
|
+
return w({ ...e, type: "info", showCancel: !1 });
|
|
319
|
+
}
|
|
320
|
+
function _(e) {
|
|
321
|
+
return w({ ...e, type: "success", showCancel: !1 });
|
|
322
|
+
}
|
|
323
|
+
function ee(e) {
|
|
324
|
+
return w({ ...e, type: "warning", showCancel: !1 });
|
|
325
|
+
}
|
|
326
|
+
function te(e) {
|
|
327
|
+
return w({ ...e, type: "error", showCancel: !1 });
|
|
328
|
+
}
|
|
329
|
+
u.confirm = Y;
|
|
330
|
+
u.info = Z;
|
|
331
|
+
u.success = _;
|
|
332
|
+
u.warning = ee;
|
|
333
|
+
u.error = te;
|
|
17
334
|
export {
|
|
18
|
-
|
|
335
|
+
u as Modal
|
|
19
336
|
};
|
|
20
337
|
//# sourceMappingURL=index57.js.map
|
package/dist/index57.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index57.js","sources":["../src/components/Navbar.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface NavbarProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode\n start?: React.ReactNode\n center?: React.ReactNode\n end?: React.ReactNode\n}\n\nexport const Navbar: React.FC<NavbarProps> = ({\n children,\n start,\n center,\n end,\n className = '',\n ...rest\n}) => {\n const navbarClasses = ['navbar bg-base-100', className]\n .filter(Boolean)\n .join(' ')\n\n if (children) {\n return <div className={navbarClasses} {...rest}>{children}</div>\n }\n\n return (\n <div className={navbarClasses} {...rest}>\n {start && <div className=\"navbar-start\">{start}</div>}\n {center && <div className=\"navbar-center\">{center}</div>}\n {end && <div className=\"navbar-end\">{end}</div>}\n </div>\n )\n}\n"],"names":["Navbar","children","start","center","end","className","rest","navbarClasses","jsxs","jsx"],"mappings":";AASO,MAAMA,IAAgC,CAAC;AAAA,EAC5C,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAgB,CAAC,sBAAsBF,CAAS,EACnD,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SAAIJ,sBACM,OAAA,EAAI,WAAWM,GAAgB,GAAGD,GAAO,UAAAL,GAAS,IAI1D,gBAAAO,EAAC,OAAA,EAAI,WAAWD,GAAgB,GAAGD,GAChC,UAAA;AAAA,IAAAJ,KAAS,gBAAAO,EAAC,OAAA,EAAI,WAAU,gBAAgB,UAAAP,GAAM;AAAA,IAC9CC,KAAU,gBAAAM,EAAC,OAAA,EAAI,WAAU,iBAAiB,UAAAN,GAAO;AAAA,IACjDC,KAAO,gBAAAK,EAAC,OAAA,EAAI,WAAU,cAAc,UAAAL,EAAA,CAAI;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index57.js","sources":["../src/components/Modal.tsx"],"sourcesContent":["import React, { useEffect, useRef, useId } from 'react'\nimport { createRoot } from 'react-dom/client'\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 /** 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}\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\nexport function Modal({\n children,\n title,\n footer,\n open = false,\n onOk,\n onCancel,\n okText = 'OK',\n cancelText = 'Cancel',\n maskClosable = true,\n closable = true,\n position,\n align,\n width,\n centered,\n onClose,\n initialFocus,\n alertDialog = false,\n className = '',\n ...rest\n}: ModalProps) {\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 [loading, setLoading] = React.useState(false)\n const titleId = useId()\n const contentId = useId()\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 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 }\n }\n }, [open, initialFocus])\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: 'modal-top',\n middle: 'modal-middle',\n bottom: 'modal-bottom',\n }\n\n // Responsive position class mappings for each breakpoint\n const responsivePositionClasses: Record<Breakpoint, Record<ModalPosition, string>> = {\n base: {\n top: 'modal-top',\n middle: 'modal-middle',\n bottom: 'modal-bottom',\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: 'modal-start',\n end: 'modal-end',\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 = [\n 'modal',\n ...getPositionClasses(),\n align && alignClasses[align],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const handleOk = async () => {\n if (onOk) {\n setLoading(true)\n try {\n await onOk()\n setLoading(false)\n } catch (error) {\n setLoading(false)\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 // 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 return (\n <dialog\n ref={dialogRef}\n role={alertDialog ? 'alertdialog' : 'dialog'}\n aria-modal=\"true\"\n className={classes}\n data-state={open ? 'open' : 'closed'}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={contentId}\n {...rest}\n >\n <div className=\"modal-box\" style={modalBoxStyle}>\n {title && (\n <h3 id={titleId} className=\"text-lg font-bold mb-4\">\n {title}\n </h3>\n )}\n <div id={contentId} className=\"py-4\">\n {children}\n </div>\n {shouldRenderDefaultFooter && (\n <div className=\"modal-action\">\n {onCancel && (\n <button ref={cancelButtonRef} className=\"btn\" onClick={onCancel}>\n {cancelText}\n </button>\n )}\n {onOk && (\n <button\n ref={okButtonRef}\n className={`btn btn-primary ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading}\n aria-busy={loading || undefined}\n >\n {okText}\n </button>\n )}\n </div>\n )}\n {shouldRenderCustomFooter && <div className=\"modal-action\">{footer}</div>}\n </div>\n {closable && maskClosable && (\n <form method=\"dialog\" className=\"modal-backdrop\">\n <button ref={closeButtonRef} onClick={handleBackdropClick}>\n <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 [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 'alert-success'\n case 'warning':\n return 'alert-warning'\n case 'error':\n return 'alert-error'\n case 'info':\n default:\n return 'alert-info'\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 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={`alert ${getAlertClass()}`}>\n {getIcon()}\n <div>\n {config.title && <h3 className=\"font-bold\">{config.title}</h3>}\n </div>\n </div>\n ) : (\n config.title\n )\n }\n okText={config.okText}\n cancelText={config.cancelText}\n footer={\n config.showCancel ? (\n <>\n <button className=\"btn\" onClick={handleCancel}>\n {config.cancelText || 'Cancel'}\n </button>\n <button\n className={`btn ${config.type === 'error' ? 'btn-error' : 'btn-primary'} ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading}\n >\n {config.okText || 'OK'}\n </button>\n </>\n ) : (\n <button\n className={`btn ${config.type === 'error' ? 'btn-error' : 'btn-primary'} ${loading ? 'loading' : ''}`}\n onClick={handleOk}\n disabled={loading}\n >\n {config.okText || 'OK'}\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\nModal.confirm = confirm\nModal.info = info\nModal.success = success\nModal.warning = warning\nModal.error = error\n"],"names":["Modal","children","title","footer","open","onOk","onCancel","okText","cancelText","maskClosable","closable","position","align","width","centered","onClose","initialFocus","alertDialog","className","rest","dialogRef","useRef","okButtonRef","cancelButtonRef","closeButtonRef","previousActiveElement","loading","setLoading","React","titleId","useId","contentId","closeHandler","useEffect","dialog","onDialogClose","positionClasses","responsivePositionClasses","alignClasses","classes","breakpoint","pos","handleOk","error","handleBackdropClick","modalBoxStyle","shouldRenderDefaultFooter","shouldRenderCustomFooter","jsxs","jsx","createModal","config","div","root","createRoot","destroy","ModalContent","setOpen","handleClose","handleCancel","getAlertClass","getIcon","isAlert","Fragment","confirm","info","success","warning"],"mappings":";;;AA6CO,SAASA,EAAM;AAAA,EACpB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,YAAAC,IAAa;AAAA,EACb,cAAAC,IAAe;AAAA,EACf,UAAAC,IAAW;AAAA,EACX,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAAe;AACb,QAAMC,IAAYC,EAA0B,IAAI,GAC1CC,IAAcD,EAA0B,IAAI,GAC5CE,IAAkBF,EAA0B,IAAI,GAChDG,IAAiBH,EAA0B,IAAI,GAC/CI,IAAwBJ,EAA2B,IAAI,GACvD,CAACK,GAASC,CAAU,IAAIC,EAAM,SAAS,EAAK,GAC5CC,IAAUC,EAAA,GACVC,IAAYD,EAAA,GAGZE,IAAejB,KAAWT;AAEhC,EAAA2B,EAAU,MAAM;AACd,UAAMC,IAASd,EAAU;AACzB,IAAKc,MAED9B,IACG8B,EAAO,SAEVT,EAAsB,UAAU,SAAS,eACzCS,EAAO,UAAA,GAGHlB,KACF,WAAW,MAAM;AACf,cAAQA,GAAA;AAAA,QACN,KAAK;AACH,UAAAM,EAAY,SAAS,MAAA;AACrB;AAAA,QACF,KAAK;AACH,UAAAC,EAAgB,SAAS,MAAA;AACzB;AAAA,QACF,KAAK;AACH,UAAAC,EAAe,SAAS,MAAA;AACxB;AAAA,MAAA;AAAA,IAEN,GAAG,CAAC,KAIJU,EAAO,SACTA,EAAO,MAAA,GAEPT,EAAsB,SAAS,MAAA;AAAA,EAGrC,GA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ChBlE,EAAM,UAAUmE;AAChBnE,EAAM,QAAQ2C;"}
|
package/dist/index58.js
CHANGED
|
@@ -1,125 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return this.open({ ...t, type: "error" });
|
|
48
|
-
}
|
|
49
|
-
info(t) {
|
|
50
|
-
return this.open({ ...t, type: "info" });
|
|
51
|
-
}
|
|
52
|
-
warning(t) {
|
|
53
|
-
return this.open({ ...t, type: "warning" });
|
|
54
|
-
}
|
|
55
|
-
destroy() {
|
|
56
|
-
this.notifications = [], this.emit();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function f({ manager: e }) {
|
|
60
|
-
const [, t] = u({});
|
|
61
|
-
p(() => e.subscribe(() => {
|
|
62
|
-
t({});
|
|
63
|
-
}), [e]);
|
|
64
|
-
const o = e.getNotifications(), s = {
|
|
65
|
-
topLeft: [],
|
|
66
|
-
topRight: [],
|
|
67
|
-
bottomLeft: [],
|
|
68
|
-
bottomRight: []
|
|
69
|
-
};
|
|
70
|
-
o.forEach((n) => {
|
|
71
|
-
s[n.placement].push(n);
|
|
72
|
-
});
|
|
73
|
-
const r = {
|
|
74
|
-
topRight: "toast toast-top toast-end",
|
|
75
|
-
topLeft: "toast toast-top toast-start",
|
|
76
|
-
bottomRight: "toast toast-bottom toast-end",
|
|
77
|
-
bottomLeft: "toast toast-bottom toast-start"
|
|
78
|
-
};
|
|
79
|
-
return /* @__PURE__ */ i(h, { children: Object.entries(s).map(([n, c]) => c.length === 0 ? null : /* @__PURE__ */ i("div", { className: r[n], children: c.map((a) => /* @__PURE__ */ i(
|
|
80
|
-
b,
|
|
81
|
-
{
|
|
82
|
-
notification: a,
|
|
83
|
-
onClose: () => e.close(a.id)
|
|
84
|
-
},
|
|
85
|
-
a.id
|
|
86
|
-
)) }, n)) });
|
|
87
|
-
}
|
|
88
|
-
function b({ notification: e, onClose: t }) {
|
|
89
|
-
const o = {
|
|
90
|
-
success: "alert-success",
|
|
91
|
-
error: "alert-error",
|
|
92
|
-
info: "alert-info",
|
|
93
|
-
warning: "alert-warning"
|
|
94
|
-
}, s = () => {
|
|
95
|
-
e.onClick && e.onClick();
|
|
96
|
-
};
|
|
97
|
-
return /* @__PURE__ */ l(
|
|
98
|
-
"div",
|
|
99
|
-
{
|
|
100
|
-
className: `alert ${o[e.type]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px]`,
|
|
101
|
-
onClick: s,
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ l("div", { className: "flex-1", children: [
|
|
104
|
-
e.message && /* @__PURE__ */ i("div", { className: "font-bold", children: e.message }),
|
|
105
|
-
e.description && /* @__PURE__ */ i("div", { className: "text-sm", children: e.description })
|
|
106
|
-
] }),
|
|
107
|
-
e.closable && /* @__PURE__ */ i(
|
|
108
|
-
"button",
|
|
109
|
-
{
|
|
110
|
-
className: "btn btn-sm btn-ghost btn-circle",
|
|
111
|
-
onClick: (r) => {
|
|
112
|
-
r.stopPropagation(), t();
|
|
113
|
-
},
|
|
114
|
-
children: "✕"
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
const y = new m();
|
|
1
|
+
import { jsx as a, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
const u = {
|
|
3
|
+
base: "bg-base-100",
|
|
4
|
+
neutral: "bg-neutral text-neutral-content",
|
|
5
|
+
primary: "bg-primary text-primary-content",
|
|
6
|
+
secondary: "bg-secondary text-secondary-content",
|
|
7
|
+
accent: "bg-accent text-accent-content"
|
|
8
|
+
}, v = {
|
|
9
|
+
none: "",
|
|
10
|
+
sm: "shadow-sm",
|
|
11
|
+
md: "shadow-md",
|
|
12
|
+
lg: "shadow-lg",
|
|
13
|
+
xl: "shadow-xl"
|
|
14
|
+
}, x = {
|
|
15
|
+
none: "",
|
|
16
|
+
sm: "rounded-sm",
|
|
17
|
+
md: "rounded-md",
|
|
18
|
+
lg: "rounded-lg",
|
|
19
|
+
xl: "rounded-xl",
|
|
20
|
+
full: "rounded-full"
|
|
21
|
+
}, h = ({
|
|
22
|
+
children: n,
|
|
23
|
+
start: e,
|
|
24
|
+
center: s,
|
|
25
|
+
end: o,
|
|
26
|
+
color: l = "base",
|
|
27
|
+
sticky: d = !1,
|
|
28
|
+
shadow: c = "none",
|
|
29
|
+
rounded: m = "none",
|
|
30
|
+
className: b = "",
|
|
31
|
+
...r
|
|
32
|
+
}) => {
|
|
33
|
+
const t = [
|
|
34
|
+
"navbar",
|
|
35
|
+
u[l],
|
|
36
|
+
d && "sticky top-0 z-50",
|
|
37
|
+
v[c],
|
|
38
|
+
x[m],
|
|
39
|
+
b
|
|
40
|
+
].filter(Boolean).join(" ");
|
|
41
|
+
return n ? /* @__PURE__ */ a("nav", { className: t, ...r, children: n }) : /* @__PURE__ */ i("nav", { className: t, ...r, children: [
|
|
42
|
+
e && /* @__PURE__ */ a("div", { className: "navbar-start", children: e }),
|
|
43
|
+
s && /* @__PURE__ */ a("div", { className: "navbar-center", children: s }),
|
|
44
|
+
o && /* @__PURE__ */ a("div", { className: "navbar-end", children: o })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
122
47
|
export {
|
|
123
|
-
|
|
48
|
+
h as Navbar
|
|
124
49
|
};
|
|
125
50
|
//# sourceMappingURL=index58.js.map
|
package/dist/index58.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index58.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index58.js","sources":["../src/components/Navbar.tsx"],"sourcesContent":["import React from 'react'\n\nexport type NavbarColor = 'base' | 'neutral' | 'primary' | 'secondary' | 'accent'\nexport type NavbarShadow = 'none' | 'sm' | 'md' | 'lg' | 'xl'\nexport type NavbarRounded = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'\n\nexport interface NavbarProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'> {\n children?: React.ReactNode\n /** Content for the start section of the navbar (typically logo/brand) */\n start?: React.ReactNode\n /** Content for the center section of the navbar */\n center?: React.ReactNode\n /** Content for the end section of the navbar (typically actions/menu) */\n end?: React.ReactNode\n /** Background color variant */\n color?: NavbarColor\n /** Make navbar sticky at the top */\n sticky?: boolean\n /** Shadow depth */\n shadow?: NavbarShadow\n /** Border radius */\n rounded?: NavbarRounded\n}\n\nconst colorClasses: Record<NavbarColor, string> = {\n base: 'bg-base-100',\n neutral: 'bg-neutral text-neutral-content',\n primary: 'bg-primary text-primary-content',\n secondary: 'bg-secondary text-secondary-content',\n accent: 'bg-accent text-accent-content',\n}\n\nconst shadowClasses: Record<NavbarShadow, string> = {\n none: '',\n sm: 'shadow-sm',\n md: 'shadow-md',\n lg: 'shadow-lg',\n xl: 'shadow-xl',\n}\n\nconst roundedClasses: Record<NavbarRounded, string> = {\n none: '',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n full: 'rounded-full',\n}\n\nexport const Navbar: React.FC<NavbarProps> = ({\n children,\n start,\n center,\n end,\n color = 'base',\n sticky = false,\n shadow = 'none',\n rounded = 'none',\n className = '',\n ...rest\n}) => {\n const navbarClasses = [\n 'navbar',\n colorClasses[color],\n sticky && 'sticky top-0 z-50',\n shadowClasses[shadow],\n roundedClasses[rounded],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n if (children) {\n return <nav className={navbarClasses} {...rest}>{children}</nav>\n }\n\n return (\n <nav className={navbarClasses} {...rest}>\n {start && <div className=\"navbar-start\">{start}</div>}\n {center && <div className=\"navbar-center\">{center}</div>}\n {end && <div className=\"navbar-end\">{end}</div>}\n </nav>\n )\n}\n"],"names":["colorClasses","shadowClasses","roundedClasses","Navbar","children","start","center","end","color","sticky","shadow","rounded","className","rest","navbarClasses","jsxs","jsx"],"mappings":";AAwBA,MAAMA,IAA4C;AAAA,EAChD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AACV,GAEMC,IAA8C;AAAA,EAClD,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAAgD;AAAA,EACpD,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR,GAEaC,IAAgC,CAAC;AAAA,EAC5C,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAgB;AAAA,IACpB;AAAA,IACAd,EAAaQ,CAAK;AAAA,IAClBC,KAAU;AAAA,IACVR,EAAcS,CAAM;AAAA,IACpBR,EAAeS,CAAO;AAAA,IACtBC;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SAAIR,s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