tailwind-ux-kit 1.0.18 → 1.0.19
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/lib/components/Badge.d.ts +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/tailwind-ux-kit.es.js +200 -145
- package/lib/tailwind-ux-kit.umd.js +4 -4
- package/lib/types/BadgeTypes.d.ts +12 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as Input } from './components/Input';
|
|
|
2
2
|
export { default as Button } from './components/Button';
|
|
3
3
|
export { default as Dropdown } from './components/Dropdown';
|
|
4
4
|
export { default as Tooltip } from './components/ToolTip';
|
|
5
|
+
export { default as Badge } from './components/Badge';
|
|
5
6
|
export { default as Modal } from './components/modal/Modal';
|
|
6
7
|
export { default as ModalProvider } from './components/modal/ModalProvider';
|
|
7
8
|
export * from './components/modal/ModalContext';
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import h, { forwardRef as Q, useState as
|
|
2
|
+
import { jsxs as x, jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import h, { forwardRef as Q, useState as v, useRef as z, useMemo as V, useCallback as w, useEffect as k, createContext as ee, useContext as te } from "react";
|
|
4
4
|
const re = Q((e, n) => {
|
|
5
5
|
const {
|
|
6
6
|
label: r,
|
|
7
7
|
id: t,
|
|
8
|
-
inputSize:
|
|
8
|
+
inputSize: s = "md",
|
|
9
9
|
shape: u = "rounded",
|
|
10
10
|
validate: i,
|
|
11
11
|
onValidatedChange: o,
|
|
12
|
-
className:
|
|
12
|
+
className: l = "",
|
|
13
13
|
icon: c,
|
|
14
|
-
iconPosition:
|
|
15
|
-
floatingLabelStyle:
|
|
16
|
-
onChange:
|
|
14
|
+
iconPosition: a = "left",
|
|
15
|
+
floatingLabelStyle: g,
|
|
16
|
+
onChange: f,
|
|
17
17
|
isValid: p,
|
|
18
18
|
isInvalid: b,
|
|
19
|
-
feedback:
|
|
19
|
+
feedback: m,
|
|
20
20
|
feedbackType: y = "invalid",
|
|
21
21
|
...C
|
|
22
|
-
} = e, [
|
|
23
|
-
const I = O.target.value,
|
|
24
|
-
|
|
25
|
-
},
|
|
22
|
+
} = e, [S, j] = v("default"), L = (O) => {
|
|
23
|
+
const I = O.target.value, $ = (i == null ? void 0 : i(I)) ?? "default";
|
|
24
|
+
j($), o == null || o(O, $), f == null || f(O);
|
|
25
|
+
}, P = {
|
|
26
26
|
xs: "text-xs px-2 py-1",
|
|
27
27
|
sm: "text-sm px-3 py-1.5",
|
|
28
28
|
md: "text-sm px-3 py-3",
|
|
@@ -39,8 +39,8 @@ const re = Q((e, n) => {
|
|
|
39
39
|
filled: "absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",
|
|
40
40
|
outlined: "absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",
|
|
41
41
|
standard: "absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"
|
|
42
|
-
}, X = (O, I,
|
|
43
|
-
if (
|
|
42
|
+
}, X = (O, I, $) => {
|
|
43
|
+
if ($)
|
|
44
44
|
return "border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";
|
|
45
45
|
if (I)
|
|
46
46
|
return "border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";
|
|
@@ -54,8 +54,8 @@ const re = Q((e, n) => {
|
|
|
54
54
|
default:
|
|
55
55
|
return "border-gray-300 focus:ring-blue-500";
|
|
56
56
|
}
|
|
57
|
-
}, Y =
|
|
58
|
-
return /* @__PURE__ */
|
|
57
|
+
}, Y = P[s] || P.md, K = E[u] || E.flat, U = X(S, p, b), q = a === "start" || a === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", J = c && (a === "start" || a === "left") ? "ps-10" : c ? "pe-10" : "", T = t ?? `input-${(r == null ? void 0 : r.toLowerCase().replace(/\s+/g, "-")) || Math.random().toString(36).slice(2)}`, N = !!g;
|
|
58
|
+
return /* @__PURE__ */ x("div", { className: `w-full relative ${N ? "z-0" : ""}`, children: [
|
|
59
59
|
!N && r && /* @__PURE__ */ d(
|
|
60
60
|
"label",
|
|
61
61
|
{
|
|
@@ -64,7 +64,7 @@ const re = Q((e, n) => {
|
|
|
64
64
|
children: r
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ x("div", { className: "relative w-full", children: [
|
|
68
68
|
c && /* @__PURE__ */ d(
|
|
69
69
|
"div",
|
|
70
70
|
{
|
|
@@ -79,26 +79,26 @@ const re = Q((e, n) => {
|
|
|
79
79
|
id: T,
|
|
80
80
|
ref: n,
|
|
81
81
|
placeholder: N ? " " : C.placeholder,
|
|
82
|
-
onChange:
|
|
82
|
+
onChange: L,
|
|
83
83
|
className: `border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
|
|
84
|
-
${N &&
|
|
85
|
-
${J} ${K} ${U} ${
|
|
84
|
+
${N && g ? G[g] : Y}
|
|
85
|
+
${J} ${K} ${U} ${l}`
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
|
-
N && r &&
|
|
88
|
+
N && r && g && /* @__PURE__ */ d(
|
|
89
89
|
"label",
|
|
90
90
|
{
|
|
91
91
|
htmlFor: T,
|
|
92
|
-
className: `ms-1 ${H[
|
|
92
|
+
className: `ms-1 ${H[g]} ${l}`,
|
|
93
93
|
children: r
|
|
94
94
|
}
|
|
95
95
|
)
|
|
96
96
|
] }),
|
|
97
|
-
|
|
97
|
+
m && /* @__PURE__ */ d(
|
|
98
98
|
"p",
|
|
99
99
|
{
|
|
100
100
|
className: `mt-1 text-xs ${y === "invalid" ? "text-red-600 dark:text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
101
|
-
children:
|
|
101
|
+
children: m
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
] });
|
|
@@ -133,28 +133,28 @@ const ne = {
|
|
|
133
133
|
rounded: "rounded-md",
|
|
134
134
|
pill: "rounded-full",
|
|
135
135
|
circle: "rounded-full w-10 h-10 p-0 flex items-center justify-center"
|
|
136
|
-
},
|
|
136
|
+
}, ke = ({
|
|
137
137
|
children: e,
|
|
138
138
|
variant: n = "primary",
|
|
139
139
|
size: r = "md",
|
|
140
140
|
type: t = "button",
|
|
141
|
-
shape:
|
|
141
|
+
shape: s = "rounded",
|
|
142
142
|
className: u = "",
|
|
143
143
|
isLoading: i = !1,
|
|
144
144
|
disabled: o = !1,
|
|
145
|
-
...
|
|
145
|
+
...l
|
|
146
146
|
}) => {
|
|
147
|
-
const c = o || i,
|
|
147
|
+
const c = o || i, a = [
|
|
148
148
|
"inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",
|
|
149
149
|
ne[n],
|
|
150
150
|
oe[r],
|
|
151
|
-
se[
|
|
152
|
-
|
|
151
|
+
se[s],
|
|
152
|
+
s === "flat" ? "shadow-none" : "shadow-sm",
|
|
153
153
|
c ? "opacity-50 cursor-not-allowed pointer-events-none" : "",
|
|
154
154
|
u
|
|
155
155
|
].filter(Boolean).join(" ");
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
i && /* @__PURE__ */
|
|
156
|
+
return /* @__PURE__ */ x("button", { type: t, className: a, disabled: c, ...l, children: [
|
|
157
|
+
i && /* @__PURE__ */ x(
|
|
158
158
|
"svg",
|
|
159
159
|
{
|
|
160
160
|
"aria-hidden": "true",
|
|
@@ -183,12 +183,12 @@ const ne = {
|
|
|
183
183
|
),
|
|
184
184
|
e
|
|
185
185
|
] });
|
|
186
|
-
},
|
|
186
|
+
}, Se = ({
|
|
187
187
|
label: e,
|
|
188
188
|
children: n,
|
|
189
189
|
position: r = "right"
|
|
190
190
|
}) => {
|
|
191
|
-
const [t,
|
|
191
|
+
const [t, s] = v(!1), [u, i] = v(!1), o = z(null), l = z(null), c = V(() => {
|
|
192
192
|
switch (r) {
|
|
193
193
|
case "left":
|
|
194
194
|
return "left-0";
|
|
@@ -198,25 +198,25 @@ const ne = {
|
|
|
198
198
|
default:
|
|
199
199
|
return "right-0";
|
|
200
200
|
}
|
|
201
|
-
}, [r]),
|
|
201
|
+
}, [r]), a = w((p) => {
|
|
202
202
|
const b = p.target;
|
|
203
|
-
o.current && !o.current.contains(b) &&
|
|
204
|
-
}, []),
|
|
205
|
-
if (!
|
|
206
|
-
const p =
|
|
203
|
+
o.current && !o.current.contains(b) && l.current && !l.current.contains(b) && s(!1);
|
|
204
|
+
}, []), g = w(() => {
|
|
205
|
+
if (!l.current || !o.current) return;
|
|
206
|
+
const p = l.current.getBoundingClientRect(), b = o.current.getBoundingClientRect(), m = window.innerHeight - p.bottom, y = p.top;
|
|
207
207
|
i(
|
|
208
|
-
|
|
208
|
+
m < b.height && y > b.height
|
|
209
209
|
);
|
|
210
210
|
}, []);
|
|
211
|
-
|
|
211
|
+
k(() => {
|
|
212
212
|
if (t)
|
|
213
|
-
return
|
|
214
|
-
window.removeEventListener("resize",
|
|
213
|
+
return g(), window.addEventListener("resize", g), window.addEventListener("scroll", g, !0), () => {
|
|
214
|
+
window.removeEventListener("resize", g), window.removeEventListener("scroll", g, !0);
|
|
215
215
|
};
|
|
216
|
-
}, [t,
|
|
217
|
-
const
|
|
218
|
-
return /* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */ d("button", { ref:
|
|
216
|
+
}, [t, g]), k(() => (document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a)), [a]);
|
|
217
|
+
const f = w(() => s((p) => !p), []);
|
|
218
|
+
return /* @__PURE__ */ x("div", { className: "relative flex items-center", children: [
|
|
219
|
+
/* @__PURE__ */ d("button", { ref: l, onClick: f, children: e }),
|
|
220
220
|
t && /* @__PURE__ */ d(
|
|
221
221
|
"div",
|
|
222
222
|
{
|
|
@@ -228,29 +228,29 @@ const ne = {
|
|
|
228
228
|
}
|
|
229
229
|
)
|
|
230
230
|
] });
|
|
231
|
-
},
|
|
231
|
+
}, je = ({
|
|
232
232
|
children: e,
|
|
233
233
|
content: n,
|
|
234
234
|
position: r = "top",
|
|
235
235
|
className: t = "",
|
|
236
|
-
tooltipClass:
|
|
236
|
+
tooltipClass: s = "",
|
|
237
237
|
tooltipStyle: u = {}
|
|
238
238
|
}) => {
|
|
239
|
-
const i =
|
|
240
|
-
|
|
241
|
-
const c = i.current,
|
|
242
|
-
if (!c || !
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
},
|
|
246
|
-
|
|
239
|
+
const i = z(null), o = z(null);
|
|
240
|
+
k(() => {
|
|
241
|
+
const c = i.current, a = o.current;
|
|
242
|
+
if (!c || !a) return;
|
|
243
|
+
const g = () => {
|
|
244
|
+
a.style.opacity = "1", a.style.visibility = "visible";
|
|
245
|
+
}, f = () => {
|
|
246
|
+
a.style.opacity = "0", a.style.visibility = "hidden";
|
|
247
247
|
};
|
|
248
|
-
return c.addEventListener("mouseenter",
|
|
249
|
-
c.removeEventListener("mouseenter",
|
|
248
|
+
return c.addEventListener("mouseenter", g), c.addEventListener("mouseleave", f), () => {
|
|
249
|
+
c.removeEventListener("mouseenter", g), c.removeEventListener("mouseleave", f);
|
|
250
250
|
};
|
|
251
251
|
}, []);
|
|
252
|
-
const
|
|
253
|
-
const
|
|
252
|
+
const l = (c) => {
|
|
253
|
+
const a = {
|
|
254
254
|
position: "absolute",
|
|
255
255
|
opacity: 0,
|
|
256
256
|
visibility: "hidden",
|
|
@@ -270,7 +270,7 @@ const ne = {
|
|
|
270
270
|
switch (c) {
|
|
271
271
|
case "top":
|
|
272
272
|
return {
|
|
273
|
-
...
|
|
273
|
+
...a,
|
|
274
274
|
bottom: "100%",
|
|
275
275
|
left: "50%",
|
|
276
276
|
transform: "translateX(-50%)",
|
|
@@ -278,7 +278,7 @@ const ne = {
|
|
|
278
278
|
};
|
|
279
279
|
case "bottom":
|
|
280
280
|
return {
|
|
281
|
-
...
|
|
281
|
+
...a,
|
|
282
282
|
top: "100%",
|
|
283
283
|
left: "50%",
|
|
284
284
|
transform: "translateX(-50%)",
|
|
@@ -286,7 +286,7 @@ const ne = {
|
|
|
286
286
|
};
|
|
287
287
|
case "left":
|
|
288
288
|
return {
|
|
289
|
-
...
|
|
289
|
+
...a,
|
|
290
290
|
right: "100%",
|
|
291
291
|
top: "50%",
|
|
292
292
|
transform: "translateY(-50%)",
|
|
@@ -294,60 +294,114 @@ const ne = {
|
|
|
294
294
|
};
|
|
295
295
|
case "right":
|
|
296
296
|
return {
|
|
297
|
-
...
|
|
297
|
+
...a,
|
|
298
298
|
left: "100%",
|
|
299
299
|
top: "50%",
|
|
300
300
|
transform: "translateY(-50%)",
|
|
301
301
|
marginLeft: "8px"
|
|
302
302
|
};
|
|
303
303
|
default:
|
|
304
|
-
return
|
|
304
|
+
return a;
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
|
-
return /* @__PURE__ */
|
|
307
|
+
return /* @__PURE__ */ x("div", { ref: i, className: `relative inline-block ${t}`, children: [
|
|
308
308
|
e,
|
|
309
309
|
/* @__PURE__ */ d(
|
|
310
310
|
"div",
|
|
311
311
|
{
|
|
312
312
|
ref: o,
|
|
313
313
|
role: "tooltip",
|
|
314
|
-
className:
|
|
314
|
+
className: s,
|
|
315
315
|
style: {
|
|
316
|
-
...
|
|
316
|
+
...l(r),
|
|
317
317
|
...u
|
|
318
318
|
},
|
|
319
319
|
children: n
|
|
320
320
|
}
|
|
321
321
|
)
|
|
322
322
|
] });
|
|
323
|
-
},
|
|
323
|
+
}, le = {
|
|
324
|
+
primary: "bg-blue-500 text-white",
|
|
325
|
+
secondary: "bg-gray-500 text-white",
|
|
326
|
+
success: "bg-green-500 text-white",
|
|
327
|
+
danger: "bg-red-500 text-white",
|
|
328
|
+
warning: "bg-yellow-400 text-black",
|
|
329
|
+
info: "bg-cyan-500 text-white",
|
|
330
|
+
dark: "bg-black text-white",
|
|
331
|
+
light: "bg-gray-100 text-gray-800",
|
|
332
|
+
link: "bg-transparent text-blue-500 underline",
|
|
333
|
+
"outline-primary": "border border-blue-500 text-blue-500 bg-transparent",
|
|
334
|
+
"outline-secondary": "border border-gray-500 text-gray-500 bg-transparent",
|
|
335
|
+
"outline-success": "border border-green-500 text-green-500 bg-transparent",
|
|
336
|
+
"outline-danger": "border border-red-500 text-red-500 bg-transparent",
|
|
337
|
+
"outline-warning": "border border-yellow-400 text-yellow-500 bg-transparent",
|
|
338
|
+
"outline-info": "border border-cyan-500 text-cyan-500 bg-transparent",
|
|
339
|
+
"outline-dark": "border border-black text-black bg-transparent",
|
|
340
|
+
"outline-light": "border border-gray-100 text-gray-800 bg-transparent"
|
|
341
|
+
}, ae = {
|
|
342
|
+
xs: "text-xs px-2 py-0.5",
|
|
343
|
+
sm: "text-sm px-2.5 py-0.5",
|
|
344
|
+
md: "text-base px-3 py-1",
|
|
345
|
+
lg: "text-lg px-3.5 py-1.5",
|
|
346
|
+
xl: "text-xl px-4 py-2"
|
|
347
|
+
}, ie = {
|
|
348
|
+
flat: "rounded-none",
|
|
349
|
+
rounded: "rounded-sm",
|
|
350
|
+
pill: "rounded-full",
|
|
351
|
+
circle: "rounded-full p-2 w-8 h-8 justify-center"
|
|
352
|
+
}, Le = ({
|
|
353
|
+
label: e,
|
|
354
|
+
variant: n = "primary",
|
|
355
|
+
size: r = "sm",
|
|
356
|
+
shape: t = "rounded",
|
|
357
|
+
icon: s,
|
|
358
|
+
dismissible: u,
|
|
359
|
+
onDismiss: i,
|
|
360
|
+
className: o = "",
|
|
361
|
+
...l
|
|
362
|
+
}) => {
|
|
363
|
+
const c = !e && !!s, a = `inline-flex items-center font-medium ${le[n] || ""} ${ae[r] || ""} ${ie[t] || ""} ${c ? "justify-center p-2 w-8 h-8" : ""} ` + o;
|
|
364
|
+
return /* @__PURE__ */ x("span", { className: a.trim(), ...l, children: [
|
|
365
|
+
s && /* @__PURE__ */ d("span", { className: e ? "mr-1" : "", children: s }),
|
|
366
|
+
e,
|
|
367
|
+
u && /* @__PURE__ */ d(
|
|
368
|
+
"button",
|
|
369
|
+
{
|
|
370
|
+
type: "button",
|
|
371
|
+
onClick: i,
|
|
372
|
+
className: "ml-2 text-xs font-bold leading-none focus:outline-none",
|
|
373
|
+
children: "×"
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
] });
|
|
377
|
+
}, F = ee(null), ce = () => {
|
|
324
378
|
const e = te(F);
|
|
325
379
|
return e || (console.warn(
|
|
326
380
|
"⚠️ useModal() called outside of ModalProvider. Falling back to standalone modal usage."
|
|
327
381
|
), null);
|
|
328
382
|
};
|
|
329
|
-
function
|
|
383
|
+
function Pe({
|
|
330
384
|
id: e,
|
|
331
385
|
title: n,
|
|
332
386
|
children: r,
|
|
333
387
|
standalone: t = !1,
|
|
334
|
-
showFloatingClose:
|
|
388
|
+
showFloatingClose: s = !1,
|
|
335
389
|
containerClasses: u = "",
|
|
336
390
|
onClose: i
|
|
337
391
|
}) {
|
|
338
|
-
const o =
|
|
339
|
-
c ? o.closeModal(e) :
|
|
392
|
+
const o = ce(), l = o && typeof o.openModal == "function", c = !t && l, [a, g] = v(!1), f = c ? o.isOpen(e) : a, p = () => {
|
|
393
|
+
c ? o.closeModal(e) : g(!1), i && i();
|
|
340
394
|
};
|
|
341
|
-
return
|
|
395
|
+
return k(() => (f ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
342
396
|
document.body.style.overflow = "";
|
|
343
|
-
}), [
|
|
397
|
+
}), [f]), f ? /* @__PURE__ */ d("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ x(
|
|
344
398
|
"div",
|
|
345
399
|
{
|
|
346
400
|
className: `bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${u}`,
|
|
347
401
|
children: [
|
|
348
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ x("div", { className: "flex justify-between items-center relative", children: [
|
|
349
403
|
n && /* @__PURE__ */ d("h2", { className: "text-lg font-semibold", children: n }),
|
|
350
|
-
|
|
404
|
+
s && /* @__PURE__ */ d(
|
|
351
405
|
"button",
|
|
352
406
|
{
|
|
353
407
|
onClick: () => p(),
|
|
@@ -362,25 +416,25 @@ function Se({
|
|
|
362
416
|
}
|
|
363
417
|
) }) : null;
|
|
364
418
|
}
|
|
365
|
-
function
|
|
366
|
-
const [n, r] =
|
|
419
|
+
function Ee({ children: e }) {
|
|
420
|
+
const [n, r] = v({}), t = w((i) => {
|
|
367
421
|
r((o) => ({ ...o, [i]: !0 }));
|
|
368
|
-
}, []),
|
|
422
|
+
}, []), s = w((i) => {
|
|
369
423
|
r((o) => ({ ...o, [i]: !1 }));
|
|
370
|
-
}, []), u =
|
|
371
|
-
return /* @__PURE__ */ d(F.Provider, { value: { openModal: t, closeModal:
|
|
424
|
+
}, []), u = w((i) => !!n[i], [n]);
|
|
425
|
+
return /* @__PURE__ */ d(F.Provider, { value: { openModal: t, closeModal: s, isOpen: u }, children: e });
|
|
372
426
|
}
|
|
373
|
-
let _ = null,
|
|
374
|
-
function
|
|
427
|
+
let _ = null, B = {};
|
|
428
|
+
function de(e) {
|
|
375
429
|
_ = e;
|
|
376
430
|
}
|
|
377
|
-
function
|
|
378
|
-
|
|
431
|
+
function $e(e) {
|
|
432
|
+
B = { ...B, ...e };
|
|
379
433
|
}
|
|
380
|
-
function
|
|
381
|
-
return
|
|
434
|
+
function ue() {
|
|
435
|
+
return B;
|
|
382
436
|
}
|
|
383
|
-
function
|
|
437
|
+
function ze(e, n, r = 3e3, t) {
|
|
384
438
|
_ ? _(e, n, r, t) : console.warn("Toast system is not mounted");
|
|
385
439
|
}
|
|
386
440
|
var Z = {
|
|
@@ -389,18 +443,18 @@ var Z = {
|
|
|
389
443
|
className: void 0,
|
|
390
444
|
style: void 0,
|
|
391
445
|
attr: void 0
|
|
392
|
-
},
|
|
393
|
-
function
|
|
446
|
+
}, D = h.createContext && /* @__PURE__ */ h.createContext(Z), ge = ["attr", "size", "title"];
|
|
447
|
+
function fe(e, n) {
|
|
394
448
|
if (e == null) return {};
|
|
395
|
-
var r =
|
|
449
|
+
var r = pe(e, n), t, s;
|
|
396
450
|
if (Object.getOwnPropertySymbols) {
|
|
397
451
|
var u = Object.getOwnPropertySymbols(e);
|
|
398
|
-
for (
|
|
399
|
-
t = u[
|
|
452
|
+
for (s = 0; s < u.length; s++)
|
|
453
|
+
t = u[s], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]);
|
|
400
454
|
}
|
|
401
455
|
return r;
|
|
402
456
|
}
|
|
403
|
-
function
|
|
457
|
+
function pe(e, n) {
|
|
404
458
|
if (e == null) return {};
|
|
405
459
|
var r = {};
|
|
406
460
|
for (var t in e)
|
|
@@ -410,22 +464,22 @@ function ue(e, n) {
|
|
|
410
464
|
}
|
|
411
465
|
return r;
|
|
412
466
|
}
|
|
413
|
-
function
|
|
414
|
-
return
|
|
467
|
+
function M() {
|
|
468
|
+
return M = Object.assign ? Object.assign.bind() : function(e) {
|
|
415
469
|
for (var n = 1; n < arguments.length; n++) {
|
|
416
470
|
var r = arguments[n];
|
|
417
471
|
for (var t in r)
|
|
418
472
|
Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]);
|
|
419
473
|
}
|
|
420
474
|
return e;
|
|
421
|
-
},
|
|
475
|
+
}, M.apply(this, arguments);
|
|
422
476
|
}
|
|
423
477
|
function A(e, n) {
|
|
424
478
|
var r = Object.keys(e);
|
|
425
479
|
if (Object.getOwnPropertySymbols) {
|
|
426
480
|
var t = Object.getOwnPropertySymbols(e);
|
|
427
|
-
n && (t = t.filter(function(
|
|
428
|
-
return Object.getOwnPropertyDescriptor(e,
|
|
481
|
+
n && (t = t.filter(function(s) {
|
|
482
|
+
return Object.getOwnPropertyDescriptor(e, s).enumerable;
|
|
429
483
|
})), r.push.apply(r, t);
|
|
430
484
|
}
|
|
431
485
|
return r;
|
|
@@ -434,21 +488,21 @@ function R(e) {
|
|
|
434
488
|
for (var n = 1; n < arguments.length; n++) {
|
|
435
489
|
var r = arguments[n] != null ? arguments[n] : {};
|
|
436
490
|
n % 2 ? A(Object(r), !0).forEach(function(t) {
|
|
437
|
-
|
|
491
|
+
be(e, t, r[t]);
|
|
438
492
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : A(Object(r)).forEach(function(t) {
|
|
439
493
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
440
494
|
});
|
|
441
495
|
}
|
|
442
496
|
return e;
|
|
443
497
|
}
|
|
444
|
-
function
|
|
445
|
-
return n =
|
|
498
|
+
function be(e, n, r) {
|
|
499
|
+
return n = xe(n), n in e ? Object.defineProperty(e, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = r, e;
|
|
446
500
|
}
|
|
447
|
-
function
|
|
448
|
-
var n =
|
|
501
|
+
function xe(e) {
|
|
502
|
+
var n = me(e, "string");
|
|
449
503
|
return typeof n == "symbol" ? n : n + "";
|
|
450
504
|
}
|
|
451
|
-
function
|
|
505
|
+
function me(e, n) {
|
|
452
506
|
if (typeof e != "object" || !e) return e;
|
|
453
507
|
var r = e[Symbol.toPrimitive];
|
|
454
508
|
if (r !== void 0) {
|
|
@@ -463,24 +517,24 @@ function W(e) {
|
|
|
463
517
|
key: r
|
|
464
518
|
}, n.attr), W(n.child)));
|
|
465
519
|
}
|
|
466
|
-
function
|
|
467
|
-
return (n) => /* @__PURE__ */ h.createElement(
|
|
520
|
+
function he(e) {
|
|
521
|
+
return (n) => /* @__PURE__ */ h.createElement(ye, M({
|
|
468
522
|
attr: R({}, e.attr)
|
|
469
523
|
}, n), W(e.child));
|
|
470
524
|
}
|
|
471
|
-
function
|
|
525
|
+
function ye(e) {
|
|
472
526
|
var n = (r) => {
|
|
473
527
|
var {
|
|
474
528
|
attr: t,
|
|
475
|
-
size:
|
|
529
|
+
size: s,
|
|
476
530
|
title: u
|
|
477
|
-
} = e, i =
|
|
478
|
-
return r.className && (
|
|
531
|
+
} = e, i = fe(e, ge), o = s || r.size || "1em", l;
|
|
532
|
+
return r.className && (l = r.className), e.className && (l = (l ? l + " " : "") + e.className), /* @__PURE__ */ h.createElement("svg", M({
|
|
479
533
|
stroke: "currentColor",
|
|
480
534
|
fill: "currentColor",
|
|
481
535
|
strokeWidth: "0"
|
|
482
536
|
}, r.attr, t, i, {
|
|
483
|
-
className:
|
|
537
|
+
className: l,
|
|
484
538
|
style: R(R({
|
|
485
539
|
color: e.color || r.color
|
|
486
540
|
}, r.style), e.style),
|
|
@@ -489,46 +543,46 @@ function me(e) {
|
|
|
489
543
|
xmlns: "http://www.w3.org/2000/svg"
|
|
490
544
|
}), u && /* @__PURE__ */ h.createElement("title", null, u), e.children);
|
|
491
545
|
};
|
|
492
|
-
return
|
|
546
|
+
return D !== void 0 ? /* @__PURE__ */ h.createElement(D.Consumer, null, (r) => n(r)) : n(Z);
|
|
493
547
|
}
|
|
494
|
-
function
|
|
495
|
-
return
|
|
548
|
+
function we(e) {
|
|
549
|
+
return he({ attr: { viewBox: "0 0 15 15", fill: "none" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor" }, child: [] }] })(e);
|
|
496
550
|
}
|
|
497
|
-
const
|
|
551
|
+
const ve = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
498
552
|
const n = Math.random() * 16 | 0;
|
|
499
553
|
return (e === "x" ? n : n & 3 | 8).toString(16);
|
|
500
|
-
}),
|
|
501
|
-
const [e, n] =
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const o =
|
|
505
|
-
n((
|
|
506
|
-
n((
|
|
554
|
+
}), Me = () => {
|
|
555
|
+
const [e, n] = v([]);
|
|
556
|
+
k(() => {
|
|
557
|
+
de((t, s, u, i) => {
|
|
558
|
+
const o = ve();
|
|
559
|
+
n((l) => [...l, { id: o, type: t, message: s, config: i }]), setTimeout(() => {
|
|
560
|
+
n((l) => l.filter((c) => c.id !== o));
|
|
507
561
|
}, u);
|
|
508
562
|
});
|
|
509
563
|
}, []);
|
|
510
|
-
const r =
|
|
564
|
+
const r = ue();
|
|
511
565
|
return /* @__PURE__ */ d("div", { className: "fixed top-5 right-5 z-[9999] flex flex-col gap-2", children: e.map((t) => {
|
|
512
|
-
var
|
|
513
|
-
const
|
|
514
|
-
return /* @__PURE__ */
|
|
566
|
+
var l, c, a, g, f, p, b, m, y, C, S, j, L;
|
|
567
|
+
const s = ((l = t.config) == null ? void 0 : l.icon) || ((c = r.icons) == null ? void 0 : c[t.type]) || Ce(t.type), u = ((a = t.config) == null ? void 0 : a.bgColor) || ((f = (g = r.colors) == null ? void 0 : g[t.type]) == null ? void 0 : f.bg) || "bg-white dark:bg-gray-800", i = ((p = t.config) == null ? void 0 : p.textColor) || ((m = (b = r.colors) == null ? void 0 : b[t.type]) == null ? void 0 : m.text) || "text-gray-700 dark:text-gray-300", o = ((y = t.config) == null ? void 0 : y.iconContainerClass) || "w-8 h-8 mr-3 text-xl flex items-center justify-center";
|
|
568
|
+
return /* @__PURE__ */ x(
|
|
515
569
|
"div",
|
|
516
570
|
{
|
|
517
571
|
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${u} ${i}`,
|
|
518
572
|
children: [
|
|
519
|
-
/* @__PURE__ */ d("div", { className: o, children:
|
|
520
|
-
/* @__PURE__ */
|
|
573
|
+
/* @__PURE__ */ d("div", { className: o, children: s }),
|
|
574
|
+
/* @__PURE__ */ x("div", { className: "flex-1 me-3", children: [
|
|
521
575
|
((C = t.config) == null ? void 0 : C.title) && /* @__PURE__ */ d("div", { className: "font-semibold text-black", children: t.config.title }),
|
|
522
|
-
((
|
|
523
|
-
!((
|
|
576
|
+
((S = t.config) == null ? void 0 : S.description) && /* @__PURE__ */ d("div", { className: "text-sm text-gray-500", children: t.config.description }),
|
|
577
|
+
!((j = t.config) != null && j.title) && !((L = t.config) != null && L.description) && /* @__PURE__ */ d("div", { className: "text-sm", children: t.message })
|
|
524
578
|
] }),
|
|
525
579
|
/* @__PURE__ */ d(
|
|
526
580
|
"button",
|
|
527
581
|
{
|
|
528
|
-
onClick: () => n((
|
|
582
|
+
onClick: () => n((P) => P.filter((E) => E.id !== t.id)),
|
|
529
583
|
className: "ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white",
|
|
530
584
|
"aria-label": "Close",
|
|
531
|
-
children: /* @__PURE__ */ d(
|
|
585
|
+
children: /* @__PURE__ */ d(we, { size: 18 })
|
|
532
586
|
}
|
|
533
587
|
)
|
|
534
588
|
]
|
|
@@ -537,7 +591,7 @@ const he = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
537
591
|
);
|
|
538
592
|
}) });
|
|
539
593
|
};
|
|
540
|
-
function
|
|
594
|
+
function Ce(e) {
|
|
541
595
|
switch (e) {
|
|
542
596
|
case "success":
|
|
543
597
|
return "✅";
|
|
@@ -550,15 +604,16 @@ function ye(e) {
|
|
|
550
604
|
}
|
|
551
605
|
}
|
|
552
606
|
export {
|
|
553
|
-
|
|
554
|
-
|
|
607
|
+
Le as Badge,
|
|
608
|
+
ke as Button,
|
|
609
|
+
Se as Dropdown,
|
|
555
610
|
re as Input,
|
|
556
|
-
|
|
611
|
+
Pe as Modal,
|
|
557
612
|
F as ModalContext,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
613
|
+
Ee as ModalProvider,
|
|
614
|
+
Me as Toast,
|
|
615
|
+
je as Tooltip,
|
|
616
|
+
$e as setToastDefaults,
|
|
617
|
+
ze as showToast,
|
|
618
|
+
ce as useModal
|
|
564
619
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
${
|
|
3
|
-
${
|
|
1
|
+
(function(b,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],o):(b=typeof globalThis<"u"?globalThis:b||self,o(b.TailwindUiKit={},b.jsxRuntime,b.React))})(this,function(b,o,l){"use strict";"use client";const B=l.forwardRef((e,n)=>{const{label:r,id:t,inputSize:a="md",shape:f="rounded",validate:d,onValidatedChange:s,className:i="",icon:u,iconPosition:c="left",floatingLabelStyle:g,onChange:p,isValid:x,isInvalid:h,feedback:y,feedbackType:m="invalid",...w}=e,[k,S]=l.useState("default"),j=C=>{const I=C.target.value,L=(d==null?void 0:d(I))??"default";S(L),s==null||s(C,L),p==null||p(C)},E={xs:"text-xs px-2 py-1",sm:"text-sm px-3 py-1.5",md:"text-sm px-3 py-3",lg:"text-lg px-5 py-3"},P={flat:"rounded-none",rounded:"rounded-md",pill:"rounded-full"},xe={filled:"rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",outlined:"rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",standard:"px-0 py-2.5 bg-transparent border-0 border-b-2"},he={filled:"absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",outlined:"absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",standard:"absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"},ye=(C,I,L)=>{if(L)return"border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";if(I)return"border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";switch(C){case"error":return"border-red-500 bg-red-50 focus:ring-red-500";case"warning":return"border-yellow-500 bg-yellow-50 focus:ring-yellow-500";case"success":return"border-green-500 bg-green-50 focus:ring-green-500";default:return"border-gray-300 focus:ring-blue-500"}},me=E[a]||E.md,we=P[f]||P.flat,ve=ye(k,x,h),Ce=c==="start"||c==="left"?"left-0 ps-3.5":"right-0 pe-3.5",Ne=u&&(c==="start"||c==="left")?"ps-10":u?"pe-10":"",z=t??`input-${(r==null?void 0:r.toLowerCase().replace(/\s+/g,"-"))||Math.random().toString(36).slice(2)}`,v=!!g;return o.jsxs("div",{className:`w-full relative ${v?"z-0":""}`,children:[!v&&r&&o.jsx("label",{htmlFor:z,className:`block mb-1 font-light text-sm ${x?"text-green-700 dark:text-green-500":h?"text-red-700 dark:text-red-500":"text-gray-700"}`,children:r}),o.jsxs("div",{className:"relative w-full",children:[u&&o.jsx("div",{className:`absolute inset-y-0 flex items-center ${Ce}`,children:o.jsx("span",{className:"text-gray-500",children:u})}),o.jsx("input",{...w,id:z,ref:n,placeholder:v?" ":w.placeholder,onChange:j,className:`border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
|
|
2
|
+
${v&&g?xe[g]:me}
|
|
3
|
+
${Ne} ${we} ${ve} ${i}`}),v&&r&&g&&o.jsx("label",{htmlFor:z,className:`ms-1 ${he[g]} ${i}`,children:r})]}),y&&o.jsx("p",{className:`mt-1 text-xs ${m==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,children:y})]})});B.displayName="Input";const W={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-600 text-white hover:bg-gray-700",success:"bg-green-600 text-white hover:bg-green-700",danger:"bg-red-600 text-white hover:bg-red-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-cyan-600 text-white hover:bg-cyan-700",dark:"bg-gray-900 text-white hover:bg-black",light:"bg-gray-100 text-black hover:bg-gray-200",link:"bg-transparent text-blue-600 hover:underline [&&]:p-0 [&&]:shadow-none","outline-primary":"border border-blue-600 text-blue-600 hover:bg-blue-50","outline-secondary":"border border-gray-600 text-gray-600 hover:bg-gray-50","outline-success":"border border-green-600 text-green-600 hover:bg-green-50","outline-danger":"border border-red-600 text-red-600 hover:bg-red-50","outline-warning":"border border-yellow-500 text-yellow-600 hover:bg-yellow-50","outline-info":"border border-cyan-600 text-cyan-600 hover:bg-cyan-50","outline-dark":"border border-gray-900 text-gray-900 hover:bg-gray-100","outline-light":"border border-gray-100 text-gray-500 hover:bg-gray-200"},G={xs:"px-3 py-2 text-xs",sm:"px-3 py-2 text-sm",md:"px-5 py-2.5 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-3.5 text-base"},H={flat:"shadow-none",rounded:"rounded-md",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},q=({children:e,variant:n="primary",size:r="md",type:t="button",shape:a="rounded",className:f="",isLoading:d=!1,disabled:s=!1,...i})=>{const u=s||d,c=["inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",W[n],G[r],H[a],a==="flat"?"shadow-none":"shadow-sm",u?"opacity-50 cursor-not-allowed pointer-events-none":"",f].filter(Boolean).join(" ");return o.jsxs("button",{type:t,className:c,disabled:u,...i,children:[d&&o.jsxs("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"#1C64F2"})]}),e]})},K=({label:e,children:n,position:r="right"})=>{const[t,a]=l.useState(!1),[f,d]=l.useState(!1),s=l.useRef(null),i=l.useRef(null),u=l.useMemo(()=>{switch(r){case"left":return"left-0";case"center":return"left-1/2 transform -translate-x-1/2";case"right":default:return"right-0"}},[r]),c=l.useCallback(x=>{const h=x.target;s.current&&!s.current.contains(h)&&i.current&&!i.current.contains(h)&&a(!1)},[]),g=l.useCallback(()=>{if(!i.current||!s.current)return;const x=i.current.getBoundingClientRect(),h=s.current.getBoundingClientRect(),y=window.innerHeight-x.bottom,m=x.top;d(y<h.height&&m>h.height)},[]);l.useEffect(()=>{if(t)return g(),window.addEventListener("resize",g),window.addEventListener("scroll",g,!0),()=>{window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0)}},[t,g]),l.useEffect(()=>(document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)),[c]);const p=l.useCallback(()=>a(x=>!x),[]);return o.jsxs("div",{className:"relative flex items-center",children:[o.jsx("button",{ref:i,onClick:p,children:e}),t&&o.jsx("div",{ref:s,className:`absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
|
|
4
4
|
${f?"bottom-full mb-2":"top-full mt-2"}
|
|
5
|
-
${u}`,children:n})]})},U=({children:e,content:n,position:r="top",className:t="",tooltipClass:
|
|
5
|
+
${u}`,children:n})]})},U=({children:e,content:n,position:r="top",className:t="",tooltipClass:a="",tooltipStyle:f={}})=>{const d=l.useRef(null),s=l.useRef(null);l.useEffect(()=>{const u=d.current,c=s.current;if(!u||!c)return;const g=()=>{c.style.opacity="1",c.style.visibility="visible"},p=()=>{c.style.opacity="0",c.style.visibility="hidden"};return u.addEventListener("mouseenter",g),u.addEventListener("mouseleave",p),()=>{u.removeEventListener("mouseenter",g),u.removeEventListener("mouseleave",p)}},[]);const i=u=>{const c={position:"absolute",opacity:0,visibility:"hidden",transition:"opacity 0.2s ease",maxWidth:"240px",whiteSpace:"normal",wordBreak:"break-word",padding:"8px 12px",fontSize:"0.875rem",backgroundColor:"black",color:"white",borderRadius:"4px",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,width:"max-content"};switch(u){case"top":return{...c,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...c,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...c,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...c,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return c}};return o.jsxs("div",{ref:d,className:`relative inline-block ${t}`,children:[e,o.jsx("div",{ref:s,role:"tooltip",className:a,style:{...i(r),...f},children:n})]})},X={primary:"bg-blue-500 text-white",secondary:"bg-gray-500 text-white",success:"bg-green-500 text-white",danger:"bg-red-500 text-white",warning:"bg-yellow-400 text-black",info:"bg-cyan-500 text-white",dark:"bg-black text-white",light:"bg-gray-100 text-gray-800",link:"bg-transparent text-blue-500 underline","outline-primary":"border border-blue-500 text-blue-500 bg-transparent","outline-secondary":"border border-gray-500 text-gray-500 bg-transparent","outline-success":"border border-green-500 text-green-500 bg-transparent","outline-danger":"border border-red-500 text-red-500 bg-transparent","outline-warning":"border border-yellow-400 text-yellow-500 bg-transparent","outline-info":"border border-cyan-500 text-cyan-500 bg-transparent","outline-dark":"border border-black text-black bg-transparent","outline-light":"border border-gray-100 text-gray-800 bg-transparent"},Y={xs:"text-xs px-2 py-0.5",sm:"text-sm px-2.5 py-0.5",md:"text-base px-3 py-1",lg:"text-lg px-3.5 py-1.5",xl:"text-xl px-4 py-2"},J={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},Q=({label:e,variant:n="primary",size:r="sm",shape:t="rounded",icon:a,dismissible:f,onDismiss:d,className:s="",...i})=>{const u=!e&&!!a,c=`inline-flex items-center font-medium ${X[n]||""} ${Y[r]||""} ${J[t]||""} ${u?"justify-center p-2 w-8 h-8":""} `+s;return o.jsxs("span",{className:c.trim(),...i,children:[a&&o.jsx("span",{className:e?"mr-1":"",children:a}),e,f&&o.jsx("button",{type:"button",onClick:d,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})},T=l.createContext(null),D=()=>{const e=l.useContext(T);return e||(console.warn("⚠️ useModal() called outside of ModalProvider. Falling back to standalone modal usage."),null)};function V({id:e,title:n,children:r,standalone:t=!1,showFloatingClose:a=!1,containerClasses:f="",onClose:d}){const s=D(),i=s&&typeof s.openModal=="function",u=!t&&i,[c,g]=l.useState(!1),p=u?s.isOpen(e):c,x=()=>{u?s.closeModal(e):g(!1),d&&d()};return l.useEffect(()=>(p?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[p]),p?o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",children:o.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${f}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),a&&o.jsx("button",{onClick:()=>x(),className:"text-gray-500 hover:text-gray-700 absolute top-2 right-3","aria-label":"Close modal",children:"✕"})]}),o.jsx("div",{className:"text-sm text-gray-700",children:r})]})}):null}function R({children:e}){const[n,r]=l.useState({}),t=l.useCallback(d=>{r(s=>({...s,[d]:!0}))},[]),a=l.useCallback(d=>{r(s=>({...s,[d]:!1}))},[]),f=l.useCallback(d=>!!n[d],[n]);return o.jsx(T.Provider,{value:{openModal:t,closeModal:a,isOpen:f},children:e})}let $=null,M={};function ee(e){$=e}function te(e){M={...M,...e}}function re(){return M}function ne(e,n,r=3e3,t){$?$(e,n,r,t):console.warn("Toast system is not mounted")}var _={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},A=l.createContext&&l.createContext(_),oe=["attr","size","title"];function se(e,n){if(e==null)return{};var r=le(e,n),t,a;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(a=0;a<f.length;a++)t=f[a],!(n.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function le(e,n){if(e==null)return{};var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(n.indexOf(t)>=0)continue;r[t]=e[t]}return r}function N(){return N=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},N.apply(this,arguments)}function F(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,t)}return r}function O(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?F(Object(r),!0).forEach(function(t){ae(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ae(e,n,r){return n=ie(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ie(e){var n=ce(e,"string");return typeof n=="symbol"?n:n+""}function ce(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var t=r.call(e,n);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Z(e){return e&&e.map((n,r)=>l.createElement(n.tag,O({key:r},n.attr),Z(n.child)))}function de(e){return n=>l.createElement(ue,N({attr:O({},e.attr)},n),Z(e.child))}function ue(e){var n=r=>{var{attr:t,size:a,title:f}=e,d=se(e,oe),s=a||r.size||"1em",i;return r.className&&(i=r.className),e.className&&(i=(i?i+" ":"")+e.className),l.createElement("svg",N({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,t,d,{className:i,style:O(O({color:e.color||r.color},r.style),e.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),f&&l.createElement("title",null,f),e.children)};return A!==void 0?l.createElement(A.Consumer,null,r=>n(r)):n(_)}function fe(e){return de({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(e)}const ge=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),be=()=>{const[e,n]=l.useState([]);l.useEffect(()=>{ee((t,a,f,d)=>{const s=ge();n(i=>[...i,{id:s,type:t,message:a,config:d}]),setTimeout(()=>{n(i=>i.filter(u=>u.id!==s))},f)})},[]);const r=re();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(t=>{var i,u,c,g,p,x,h,y,m,w,k,S,j;const a=((i=t.config)==null?void 0:i.icon)||((u=r.icons)==null?void 0:u[t.type])||pe(t.type),f=((c=t.config)==null?void 0:c.bgColor)||((p=(g=r.colors)==null?void 0:g[t.type])==null?void 0:p.bg)||"bg-white dark:bg-gray-800",d=((x=t.config)==null?void 0:x.textColor)||((y=(h=r.colors)==null?void 0:h[t.type])==null?void 0:y.text)||"text-gray-700 dark:text-gray-300",s=((m=t.config)==null?void 0:m.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return o.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${f} ${d}`,children:[o.jsx("div",{className:s,children:a}),o.jsxs("div",{className:"flex-1 me-3",children:[((w=t.config)==null?void 0:w.title)&&o.jsx("div",{className:"font-semibold text-black",children:t.config.title}),((k=t.config)==null?void 0:k.description)&&o.jsx("div",{className:"text-sm text-gray-500",children:t.config.description}),!((S=t.config)!=null&&S.title)&&!((j=t.config)!=null&&j.description)&&o.jsx("div",{className:"text-sm",children:t.message})]}),o.jsx("button",{onClick:()=>n(E=>E.filter(P=>P.id!==t.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:o.jsx(fe,{size:18})})]},t.id)})})};function pe(e){switch(e){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}b.Badge=Q,b.Button=q,b.Dropdown=K,b.Input=B,b.Modal=V,b.ModalContext=T,b.ModalProvider=R,b.Toast=be,b.Tooltip=U,b.setToastDefaults=te,b.showToast=ne,b.useModal=D,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Variant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "dark" | "light" | "link" | "outline-primary" | "outline-secondary" | "outline-success" | "outline-danger" | "outline-warning" | "outline-info" | "outline-dark" | "outline-light";
|
|
2
|
+
export type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
3
|
+
export type Shape = "flat" | "rounded" | "pill" | "circle";
|
|
4
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
label?: string;
|
|
6
|
+
variant?: Variant;
|
|
7
|
+
size?: Size;
|
|
8
|
+
shape?: Shape;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
dismissible?: boolean;
|
|
11
|
+
onDismiss?: () => void;
|
|
12
|
+
}
|