tailwind-ux-kit 1.0.71 → 1.0.72
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/tailwind-ux-kit.es.js +72 -71
- package/lib/tailwind-ux-kit.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as C, jsx as l } from "react/jsx-runtime";
|
|
3
|
-
import I, { forwardRef as Y, useState as z, useMemo as P, useId as
|
|
3
|
+
import I, { forwardRef as Y, useState as z, useMemo as P, useId as se, useRef as B, useCallback as j, useEffect as T, createContext as J, useContext as Q } from "react";
|
|
4
4
|
const K = {
|
|
5
5
|
xs: "text-xs px-2 py-1",
|
|
6
6
|
sm: "text-sm px-3 py-1.5",
|
|
@@ -37,13 +37,13 @@ const K = {
|
|
|
37
37
|
const {
|
|
38
38
|
label: r,
|
|
39
39
|
id: t,
|
|
40
|
-
inputSize:
|
|
40
|
+
inputSize: s = "md",
|
|
41
41
|
shape: d = "rounded",
|
|
42
42
|
validate: u,
|
|
43
43
|
onValidatedChange: f,
|
|
44
44
|
className: i = "",
|
|
45
45
|
icon: a,
|
|
46
|
-
iconPosition:
|
|
46
|
+
iconPosition: o = "left",
|
|
47
47
|
floatingLabelStyle: c,
|
|
48
48
|
onChange: p,
|
|
49
49
|
isValid: b,
|
|
@@ -58,10 +58,10 @@ const K = {
|
|
|
58
58
|
v(D), f == null || f(A, D), p == null || p(A);
|
|
59
59
|
},
|
|
60
60
|
[u, f, p]
|
|
61
|
-
), x = P(() => t || (typeof r == "string" ? `input-${r.toLowerCase().replace(/\s+/g, "-")}` : `input-${Math.random().toString(36).slice(2)}`), [t, r]), w = !!c, E = K[
|
|
61
|
+
), x = P(() => t || (typeof r == "string" ? `input-${r.toLowerCase().replace(/\s+/g, "-")}` : `input-${Math.random().toString(36).slice(2)}`), [t, r]), w = !!c, E = K[s] || K.md, h = U[d] || U.flat, L = P(
|
|
62
62
|
() => ie(S, b, g),
|
|
63
63
|
[S, b, g]
|
|
64
|
-
), O = P(() =>
|
|
64
|
+
), O = P(() => o === "start" || o === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", [o]), _ = P(() => a ? o === "start" || o === "left" ? "ps-10" : "pe-10" : "", [a, o]);
|
|
65
65
|
return /* @__PURE__ */ C(
|
|
66
66
|
"div",
|
|
67
67
|
{
|
|
@@ -157,13 +157,13 @@ const de = {
|
|
|
157
157
|
const {
|
|
158
158
|
label: r,
|
|
159
159
|
id: t,
|
|
160
|
-
inputSize:
|
|
160
|
+
inputSize: s = "md",
|
|
161
161
|
shape: d = "rounded",
|
|
162
162
|
validate: u,
|
|
163
163
|
onValidatedChange: f,
|
|
164
164
|
className: i = "",
|
|
165
165
|
icon: a,
|
|
166
|
-
iconPosition:
|
|
166
|
+
iconPosition: o = "left",
|
|
167
167
|
floatingLabelStyle: c,
|
|
168
168
|
onChange: p,
|
|
169
169
|
isValid: b,
|
|
@@ -172,10 +172,10 @@ const de = {
|
|
|
172
172
|
feedbackType: k = "invalid",
|
|
173
173
|
children: y,
|
|
174
174
|
...N
|
|
175
|
-
} = e, [S, v] = z("default"), $ =
|
|
175
|
+
} = e, [S, v] = z("default"), $ = se(), x = P(() => t || (typeof r == "string" ? `select-${r.toLowerCase().replace(/\s+/g, "-")}` : $), [t, r, $]), w = (M) => {
|
|
176
176
|
const D = M.target.value, G = (u == null ? void 0 : u(D)) ?? "default";
|
|
177
177
|
v(G), f == null || f(M, G), p == null || p(M);
|
|
178
|
-
}, E = !!c, h = de[
|
|
178
|
+
}, E = !!c, h = de[s], L = ue[d], O = ge(S, b, g);
|
|
179
179
|
return /* @__PURE__ */ C("div", { className: `w-full relative ${E ? "z-0" : ""}`, children: [
|
|
180
180
|
!E && r && /* @__PURE__ */ l(
|
|
181
181
|
"label",
|
|
@@ -189,7 +189,7 @@ const de = {
|
|
|
189
189
|
a && /* @__PURE__ */ l(
|
|
190
190
|
"div",
|
|
191
191
|
{
|
|
192
|
-
className: `absolute inset-y-0 flex items-center ${
|
|
192
|
+
className: `absolute inset-y-0 flex items-center ${o === "start" || o === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5"}`,
|
|
193
193
|
children: /* @__PURE__ */ l("span", { className: "text-gray-500", children: a })
|
|
194
194
|
}
|
|
195
195
|
),
|
|
@@ -201,7 +201,7 @@ const de = {
|
|
|
201
201
|
ref: n,
|
|
202
202
|
onChange: w,
|
|
203
203
|
className: `border peer w-full block font-normal appearance-none focus:outline-none focus:ring-0 transition text-gray-600 placeholder-[#798ba5] border-gray-400
|
|
204
|
-
${h} ${a && (
|
|
204
|
+
${h} ${a && (o === "start" || o === "left") ? "ps-10" : a ? "pe-10" : ""}
|
|
205
205
|
${E && c && fe[c]}
|
|
206
206
|
${L} ${O} ${i}`,
|
|
207
207
|
children: y
|
|
@@ -268,22 +268,22 @@ const me = {
|
|
|
268
268
|
variant: n = "primary",
|
|
269
269
|
size: r = "md",
|
|
270
270
|
type: t = "button",
|
|
271
|
-
shape:
|
|
271
|
+
shape: s = "rounded",
|
|
272
272
|
className: d = "",
|
|
273
273
|
isLoading: u = !1,
|
|
274
274
|
disabled: f = !1,
|
|
275
275
|
...i
|
|
276
276
|
}) => {
|
|
277
|
-
const a = f || u,
|
|
277
|
+
const a = f || u, o = [
|
|
278
278
|
"inline-flex items-center justify-center font-normal transition duration-150",
|
|
279
279
|
me[n],
|
|
280
280
|
xe[r],
|
|
281
|
-
he[
|
|
282
|
-
|
|
281
|
+
he[s],
|
|
282
|
+
s === "flat" ? "shadow-none" : "shadow-sm",
|
|
283
283
|
a ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
|
284
284
|
d
|
|
285
285
|
].filter(Boolean).join(" ");
|
|
286
|
-
return /* @__PURE__ */ C("button", { type: t, className:
|
|
286
|
+
return /* @__PURE__ */ C("button", { type: t, className: o, disabled: a, ...i, children: [
|
|
287
287
|
u && /* @__PURE__ */ C(
|
|
288
288
|
"svg",
|
|
289
289
|
{
|
|
@@ -323,11 +323,11 @@ var V = {
|
|
|
323
323
|
}, q = I.createContext && /* @__PURE__ */ I.createContext(V), ye = ["attr", "size", "title"];
|
|
324
324
|
function we(e, n) {
|
|
325
325
|
if (e == null) return {};
|
|
326
|
-
var r = ve(e, n), t,
|
|
326
|
+
var r = ve(e, n), t, s;
|
|
327
327
|
if (Object.getOwnPropertySymbols) {
|
|
328
328
|
var d = Object.getOwnPropertySymbols(e);
|
|
329
|
-
for (
|
|
330
|
-
t = d[
|
|
329
|
+
for (s = 0; s < d.length; s++)
|
|
330
|
+
t = d[s], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]);
|
|
331
331
|
}
|
|
332
332
|
return r;
|
|
333
333
|
}
|
|
@@ -355,8 +355,8 @@ function X(e, n) {
|
|
|
355
355
|
var r = Object.keys(e);
|
|
356
356
|
if (Object.getOwnPropertySymbols) {
|
|
357
357
|
var t = Object.getOwnPropertySymbols(e);
|
|
358
|
-
n && (t = t.filter(function(
|
|
359
|
-
return Object.getOwnPropertyDescriptor(e,
|
|
358
|
+
n && (t = t.filter(function(s) {
|
|
359
|
+
return Object.getOwnPropertyDescriptor(e, s).enumerable;
|
|
360
360
|
})), r.push.apply(r, t);
|
|
361
361
|
}
|
|
362
362
|
return r;
|
|
@@ -403,9 +403,9 @@ function Se(e) {
|
|
|
403
403
|
var n = (r) => {
|
|
404
404
|
var {
|
|
405
405
|
attr: t,
|
|
406
|
-
size:
|
|
406
|
+
size: s,
|
|
407
407
|
title: d
|
|
408
|
-
} = e, u = we(e, ye), f =
|
|
408
|
+
} = e, u = we(e, ye), f = s || r.size || "1em", i;
|
|
409
409
|
return r.className && (i = r.className), e.className && (i = (i ? i + " " : "") + e.className), /* @__PURE__ */ I.createElement("svg", F({
|
|
410
410
|
stroke: "currentColor",
|
|
411
411
|
fill: "currentColor",
|
|
@@ -466,18 +466,18 @@ const Ee = {
|
|
|
466
466
|
boxSize: n = "md",
|
|
467
467
|
shape: r = "rounded",
|
|
468
468
|
variant: t = "success",
|
|
469
|
-
onSelectionChange:
|
|
469
|
+
onSelectionChange: s,
|
|
470
470
|
disabled: d = !1,
|
|
471
471
|
className: u = "",
|
|
472
472
|
id: f,
|
|
473
473
|
value: i,
|
|
474
474
|
icon: a,
|
|
475
|
-
children:
|
|
475
|
+
children: o,
|
|
476
476
|
checked: c,
|
|
477
477
|
...p
|
|
478
478
|
}, b) => {
|
|
479
479
|
const g = (h) => {
|
|
480
|
-
!d &&
|
|
480
|
+
!d && s && s(h.target.checked), p.onChange && p.onChange(h);
|
|
481
481
|
}, m = "mr-2 border flex items-center justify-center transition-all", k = Ee[n], y = Le[r], N = Oe[t] ?? "", S = t.startsWith("outline"), v = t.startsWith("soft"), w = `${m} ${k} ${y} ${N} ${c && (S || v || t === "link") ? "peer-checked:bg-current peer-checked:text-white" : c ? "peer-checked:bg-current" : ""}`, E = {
|
|
482
482
|
xs: "w-2 h-2",
|
|
483
483
|
sm: "w-2.5 h-2.5",
|
|
@@ -504,7 +504,7 @@ const Ee = {
|
|
|
504
504
|
}
|
|
505
505
|
),
|
|
506
506
|
/* @__PURE__ */ l("span", { className: w.trim(), children: (c || p.defaultChecked) && (a ?? /* @__PURE__ */ l($e, { className: `${E[n]}` })) }),
|
|
507
|
-
e ||
|
|
507
|
+
e || o ? /* @__PURE__ */ l("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-300", children: e ?? o }) : null
|
|
508
508
|
]
|
|
509
509
|
}
|
|
510
510
|
);
|
|
@@ -516,13 +516,13 @@ const We = ({
|
|
|
516
516
|
header: n,
|
|
517
517
|
items: r = [],
|
|
518
518
|
onSelect: t,
|
|
519
|
-
renderItem:
|
|
519
|
+
renderItem: s,
|
|
520
520
|
position: d = "right",
|
|
521
521
|
className: u = "",
|
|
522
522
|
menuClassName: f = "",
|
|
523
523
|
width: i = "w-48",
|
|
524
524
|
closeOnSelect: a = !1,
|
|
525
|
-
transition:
|
|
525
|
+
transition: o = !0,
|
|
526
526
|
ariaLabel: c = "Dropdown menu",
|
|
527
527
|
...p
|
|
528
528
|
}) => {
|
|
@@ -551,15 +551,16 @@ const We = ({
|
|
|
551
551
|
m ? "bottom-full mb-2" : "top-full mt-2",
|
|
552
552
|
S,
|
|
553
553
|
i,
|
|
554
|
-
|
|
554
|
+
o && "transition-all duration-200 ease-out",
|
|
555
555
|
f
|
|
556
556
|
].filter(Boolean).join(" "),
|
|
557
|
-
[m, S, i,
|
|
557
|
+
[m, S, i, o, f]
|
|
558
558
|
);
|
|
559
559
|
return /* @__PURE__ */ C("div", { className: `relative inline-block ${u}`, ...p, children: [
|
|
560
560
|
/* @__PURE__ */ l(
|
|
561
561
|
"button",
|
|
562
562
|
{
|
|
563
|
+
type: "button",
|
|
563
564
|
ref: N,
|
|
564
565
|
onClick: x,
|
|
565
566
|
"aria-expanded": b,
|
|
@@ -574,7 +575,7 @@ const We = ({
|
|
|
574
575
|
const O = () => {
|
|
575
576
|
t && t(h), a && w();
|
|
576
577
|
};
|
|
577
|
-
return /* @__PURE__ */ l("div", { children:
|
|
578
|
+
return /* @__PURE__ */ l("div", { children: s ? s(h, O) : /* @__PURE__ */ l(
|
|
578
579
|
"div",
|
|
579
580
|
{
|
|
580
581
|
onClick: O,
|
|
@@ -591,24 +592,24 @@ const We = ({
|
|
|
591
592
|
content: n,
|
|
592
593
|
position: r = "top",
|
|
593
594
|
className: t = "",
|
|
594
|
-
tooltipClass:
|
|
595
|
+
tooltipClass: s = "",
|
|
595
596
|
tooltipStyle: d = {}
|
|
596
597
|
}) => {
|
|
597
598
|
const u = B(null), f = B(null);
|
|
598
599
|
T(() => {
|
|
599
|
-
const a = u.current,
|
|
600
|
-
if (!a || !
|
|
600
|
+
const a = u.current, o = f.current;
|
|
601
|
+
if (!a || !o) return;
|
|
601
602
|
const c = () => {
|
|
602
|
-
|
|
603
|
+
o.style.opacity = "1", o.style.visibility = "visible";
|
|
603
604
|
}, p = () => {
|
|
604
|
-
|
|
605
|
+
o.style.opacity = "0", o.style.visibility = "hidden";
|
|
605
606
|
};
|
|
606
607
|
return a.addEventListener("mouseenter", c), a.addEventListener("mouseleave", p), () => {
|
|
607
608
|
a.removeEventListener("mouseenter", c), a.removeEventListener("mouseleave", p);
|
|
608
609
|
};
|
|
609
610
|
}, []);
|
|
610
611
|
const i = (a) => {
|
|
611
|
-
const
|
|
612
|
+
const o = {
|
|
612
613
|
position: "absolute",
|
|
613
614
|
opacity: 0,
|
|
614
615
|
visibility: "hidden",
|
|
@@ -628,7 +629,7 @@ const We = ({
|
|
|
628
629
|
switch (a) {
|
|
629
630
|
case "top":
|
|
630
631
|
return {
|
|
631
|
-
...
|
|
632
|
+
...o,
|
|
632
633
|
bottom: "100%",
|
|
633
634
|
left: "50%",
|
|
634
635
|
transform: "translateX(-50%)",
|
|
@@ -636,7 +637,7 @@ const We = ({
|
|
|
636
637
|
};
|
|
637
638
|
case "bottom":
|
|
638
639
|
return {
|
|
639
|
-
...
|
|
640
|
+
...o,
|
|
640
641
|
top: "100%",
|
|
641
642
|
left: "50%",
|
|
642
643
|
transform: "translateX(-50%)",
|
|
@@ -644,7 +645,7 @@ const We = ({
|
|
|
644
645
|
};
|
|
645
646
|
case "left":
|
|
646
647
|
return {
|
|
647
|
-
...
|
|
648
|
+
...o,
|
|
648
649
|
right: "100%",
|
|
649
650
|
top: "50%",
|
|
650
651
|
transform: "translateY(-50%)",
|
|
@@ -652,14 +653,14 @@ const We = ({
|
|
|
652
653
|
};
|
|
653
654
|
case "right":
|
|
654
655
|
return {
|
|
655
|
-
...
|
|
656
|
+
...o,
|
|
656
657
|
left: "100%",
|
|
657
658
|
top: "50%",
|
|
658
659
|
transform: "translateY(-50%)",
|
|
659
660
|
marginLeft: "8px"
|
|
660
661
|
};
|
|
661
662
|
default:
|
|
662
|
-
return
|
|
663
|
+
return o;
|
|
663
664
|
}
|
|
664
665
|
};
|
|
665
666
|
return /* @__PURE__ */ C("div", { ref: u, className: `relative inline-block ${t}`, children: [
|
|
@@ -669,7 +670,7 @@ const We = ({
|
|
|
669
670
|
{
|
|
670
671
|
ref: f,
|
|
671
672
|
role: "tooltip",
|
|
672
|
-
className:
|
|
673
|
+
className: s,
|
|
673
674
|
style: {
|
|
674
675
|
...i(r),
|
|
675
676
|
...d
|
|
@@ -712,15 +713,15 @@ const We = ({
|
|
|
712
713
|
variant: n = "primary",
|
|
713
714
|
size: r = "sm",
|
|
714
715
|
shape: t = "rounded",
|
|
715
|
-
icon:
|
|
716
|
+
icon: s,
|
|
716
717
|
dismissible: d,
|
|
717
718
|
onDismiss: u,
|
|
718
719
|
className: f = "",
|
|
719
720
|
...i
|
|
720
721
|
}) => {
|
|
721
|
-
const a = !e && !!
|
|
722
|
-
return /* @__PURE__ */ C("span", { className:
|
|
723
|
-
|
|
722
|
+
const a = !e && !!s, o = `inline-flex items-center font-medium ${je[n] || ""} ${Ie[r] || ""} ${ze[t] || ""} ${a ? "justify-center p-2 w-8 h-8" : ""} ` + f;
|
|
723
|
+
return /* @__PURE__ */ C("span", { className: o.trim(), ...i, children: [
|
|
724
|
+
s && /* @__PURE__ */ l("span", { className: e ? "mr-1" : "", children: s }),
|
|
724
725
|
e,
|
|
725
726
|
d && /* @__PURE__ */ l(
|
|
726
727
|
"button",
|
|
@@ -741,19 +742,19 @@ const Ke = ({
|
|
|
741
742
|
allowMultipleOpen: n = !1,
|
|
742
743
|
className: r = "",
|
|
743
744
|
tileClasses: t = "",
|
|
744
|
-
open:
|
|
745
|
+
open: s,
|
|
745
746
|
onChange: d,
|
|
746
747
|
renderTitle: u,
|
|
747
748
|
renderContent: f,
|
|
748
749
|
showArrowIcon: i = !0,
|
|
749
750
|
panelClasses: a = ""
|
|
750
751
|
}) => {
|
|
751
|
-
const [
|
|
752
|
+
const [o, c] = z(/* @__PURE__ */ new Set()), p = P(() => s ? new Set(s) : o, [s, o]), b = j(
|
|
752
753
|
(g) => {
|
|
753
754
|
const m = new Set(p);
|
|
754
|
-
m.has(g) ? m.delete(g) : (n || m.clear(), m.add(g)),
|
|
755
|
+
m.has(g) ? m.delete(g) : (n || m.clear(), m.add(g)), s && d ? d(Array.from(m)) : c(m);
|
|
755
756
|
},
|
|
756
|
-
[p,
|
|
757
|
+
[p, s, d, n]
|
|
757
758
|
);
|
|
758
759
|
return /* @__PURE__ */ l(
|
|
759
760
|
"div",
|
|
@@ -808,20 +809,20 @@ const Ke = ({
|
|
|
808
809
|
"useModalActions must be used within a ModalActionProvider"
|
|
809
810
|
);
|
|
810
811
|
return e;
|
|
811
|
-
}, ne = J(null),
|
|
812
|
+
}, ne = J(null), oe = () => Q(ne);
|
|
812
813
|
function Ue({
|
|
813
814
|
id: e,
|
|
814
815
|
title: n,
|
|
815
816
|
children: r,
|
|
816
817
|
standalone: t = !1,
|
|
817
|
-
showFloatingClose:
|
|
818
|
+
showFloatingClose: s = !1,
|
|
818
819
|
containerClasses: d = "",
|
|
819
820
|
onClose: u,
|
|
820
821
|
disableEscapeClose: f = !1
|
|
821
822
|
}) {
|
|
822
|
-
const i =
|
|
823
|
-
|
|
824
|
-
}, [
|
|
823
|
+
const i = oe(), a = re(), o = !t && !!i && !!a, [c, p] = z(!1), b = o ? i.isOpen(e) : c, g = o ? i.getModalData(e) : null, m = j(() => {
|
|
824
|
+
o ? a.closeModal(e) : p(!1), u == null || u();
|
|
825
|
+
}, [o, a, e, u]);
|
|
825
826
|
return T(() => {
|
|
826
827
|
const k = document.activeElement;
|
|
827
828
|
console.log(e);
|
|
@@ -868,7 +869,7 @@ function Ue({
|
|
|
868
869
|
children: [
|
|
869
870
|
/* @__PURE__ */ C("div", { className: "flex justify-between items-center relative", children: [
|
|
870
871
|
n && /* @__PURE__ */ l("h2", { className: "text-lg font-semibold", children: n }),
|
|
871
|
-
|
|
872
|
+
s && /* @__PURE__ */ l(
|
|
872
873
|
"button",
|
|
873
874
|
{
|
|
874
875
|
onClick: m,
|
|
@@ -888,10 +889,10 @@ function Ue({
|
|
|
888
889
|
function qe({
|
|
889
890
|
children: e
|
|
890
891
|
}) {
|
|
891
|
-
const [n, r] = z({}), [t,
|
|
892
|
-
r((b) => ({ ...b, [c]: !0 })), p &&
|
|
892
|
+
const [n, r] = z({}), [t, s] = z({}), d = j((c, p) => {
|
|
893
|
+
r((b) => ({ ...b, [c]: !0 })), p && s((b) => ({ ...b, [c]: p }));
|
|
893
894
|
}, []), u = j((c) => {
|
|
894
|
-
r((p) => ({ ...p, [c]: !1 })),
|
|
895
|
+
r((p) => ({ ...p, [c]: !1 })), s((p) => {
|
|
895
896
|
const b = { ...p };
|
|
896
897
|
return delete b[c], b;
|
|
897
898
|
});
|
|
@@ -901,19 +902,19 @@ function qe({
|
|
|
901
902
|
), a = P(
|
|
902
903
|
() => ({ openModal: d, closeModal: u }),
|
|
903
904
|
[d, u]
|
|
904
|
-
),
|
|
905
|
+
), o = P(
|
|
905
906
|
() => ({ isOpen: f, getModalData: i }),
|
|
906
907
|
[f, i]
|
|
907
908
|
);
|
|
908
|
-
return /* @__PURE__ */ l(te.Provider, { value: a, children: /* @__PURE__ */ l(ne.Provider, { value:
|
|
909
|
+
return /* @__PURE__ */ l(te.Provider, { value: a, children: /* @__PURE__ */ l(ne.Provider, { value: o, children: e }) });
|
|
909
910
|
}
|
|
910
911
|
function Xe(e) {
|
|
911
|
-
const { openModal: n, closeModal: r } = re(), { isOpen: t, getModalData:
|
|
912
|
+
const { openModal: n, closeModal: r } = re(), { isOpen: t, getModalData: s } = oe();
|
|
912
913
|
return {
|
|
913
914
|
open: (d) => n(e, d),
|
|
914
915
|
close: () => r(e),
|
|
915
916
|
isOpen: t(e),
|
|
916
|
-
data:
|
|
917
|
+
data: s(e)
|
|
917
918
|
};
|
|
918
919
|
}
|
|
919
920
|
let H = null, W = {};
|
|
@@ -938,23 +939,23 @@ const _e = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
938
939
|
}), Qe = () => {
|
|
939
940
|
const [e, n] = z([]);
|
|
940
941
|
T(() => {
|
|
941
|
-
Me((t,
|
|
942
|
+
Me((t, s, d, u) => {
|
|
942
943
|
const f = _e();
|
|
943
|
-
n((i) => [...i, { id: f, type: t, message:
|
|
944
|
+
n((i) => [...i, { id: f, type: t, message: s, config: u }]), setTimeout(() => {
|
|
944
945
|
n((i) => i.filter((a) => a.id !== f));
|
|
945
946
|
}, d);
|
|
946
947
|
});
|
|
947
948
|
}, []);
|
|
948
949
|
const r = De();
|
|
949
950
|
return /* @__PURE__ */ l("div", { className: "fixed top-5 right-5 z-[9999] flex flex-col gap-2", children: e.map((t) => {
|
|
950
|
-
var i, a,
|
|
951
|
-
const
|
|
951
|
+
var i, a, o, c, p, b, g, m, k, y, N, S, v;
|
|
952
|
+
const s = ((i = t.config) == null ? void 0 : i.icon) || ((a = r.icons) == null ? void 0 : a[t.type]) || Be(t.type), d = ((o = t.config) == null ? void 0 : o.bgColor) || ((p = (c = r.colors) == null ? void 0 : c[t.type]) == null ? void 0 : p.bg) || "bg-white dark:bg-gray-800", u = ((b = t.config) == null ? void 0 : b.textColor) || ((m = (g = r.colors) == null ? void 0 : g[t.type]) == null ? void 0 : m.text) || "text-gray-700 dark:text-gray-300", f = ((k = t.config) == null ? void 0 : k.iconContainerClass) || "w-8 h-8 mr-3 text-xl flex items-center justify-center";
|
|
952
953
|
return /* @__PURE__ */ C(
|
|
953
954
|
"div",
|
|
954
955
|
{
|
|
955
956
|
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${d} ${u}`,
|
|
956
957
|
children: [
|
|
957
|
-
/* @__PURE__ */ l("div", { className: f, children:
|
|
958
|
+
/* @__PURE__ */ l("div", { className: f, children: s }),
|
|
958
959
|
/* @__PURE__ */ C("div", { className: "flex-1 me-3", children: [
|
|
959
960
|
((y = t.config) == null ? void 0 : y.title) && /* @__PURE__ */ l("div", { className: "font-semibold text-black", children: t.config.title }),
|
|
960
961
|
((N = t.config) == null ? void 0 : N.description) && /* @__PURE__ */ l("div", { className: "text-sm text-gray-500", children: t.config.description }),
|
|
@@ -1003,5 +1004,5 @@ export {
|
|
|
1003
1004
|
Je as showToast,
|
|
1004
1005
|
re as useModalActions,
|
|
1005
1006
|
Xe as useModalInstance,
|
|
1006
|
-
|
|
1007
|
+
oe as useModalState
|
|
1007
1008
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
${z} ${k} ${O} ${i}`}),x&&e&&d&&l.jsx("label",{htmlFor:y,className:`ms-1 ${er[d]} ${i}`,children:e})]}),p&&l.jsx("p",{className:`mt-1 text-xs ${m==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,role:m==="invalid"?"alert":void 0,children:p})]})});q.displayName="Input";const lr={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"},nr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},ar={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"},cr={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"},sr=(r,t,e)=>{if(e)return"border-red-500 bg-red-50 text-red-900 focus:ring-red-500 focus:border-red-500";if(t)return"border-green-500 bg-green-50 text-green-900 focus:ring-green-500 focus:border-green-500";const o="focus:ring focus:border";switch(r){case"error":return`${o}-red-500 border-red-500 bg-red-50`;case"warning":return`${o}-yellow-500 border-yellow-500 bg-yellow-50`;case"success":return`${o}-green-500 border-green-500 bg-green-50`;default:return"border-gray-300 focus:ring-blue-500"}},K=n.forwardRef((r,t)=>{const{label:e,id:o,inputSize:c="md",shape:h="rounded",validate:u,onValidatedChange:b,className:i="",icon:s,iconPosition:a="left",floatingLabelStyle:d,onChange:f,isValid:v,isInvalid:g,feedback:p,feedbackType:S="invalid",children:m,...N}=r,[$,C]=n.useState("default"),E=n.useId(),y=n.useMemo(()=>o||(typeof e=="string"?`select-${e.toLowerCase().replace(/\s+/g,"-")}`:E),[o,e,E]),x=P=>{const I=P.target.value,rr=(u==null?void 0:u(I))??"default";C(rr),b==null||b(P,rr),f==null||f(P)},L=!!d,k=lr[c],O=nr[h],M=sr($,v,g),z=s&&(a==="start"||a==="left")?"ps-10":s?"pe-10":"",j=a==="start"||a==="left"?"left-0 ps-3.5":"right-0 pe-3.5";return l.jsxs("div",{className:`w-full relative ${L?"z-0":""}`,children:[!L&&e&&l.jsx("label",{htmlFor:y,className:`block mb-1 text-sm ${v?"text-green-700":g?"text-red-700":"text-gray-700"}`,children:e}),l.jsxs("div",{className:"relative w-full",children:[s&&l.jsx("div",{className:`absolute inset-y-0 flex items-center ${j}`,children:l.jsx("span",{className:"text-gray-500",children:s})}),l.jsx("select",{...N,id:y,ref:t,onChange:x,className:`border peer w-full block font-normal appearance-none focus:outline-none focus:ring-0 transition text-gray-600 placeholder-[#798ba5] border-gray-400
|
|
6
6
|
${k} ${z}
|
|
7
7
|
${L&&d&&ar[d]}
|
|
8
|
-
${O} ${M} ${i}`,children:m}),L&&e&&d&&l.jsx("label",{htmlFor:y,className:`ms-1 ${cr[d]} ${i}`,children:e})]}),p&&l.jsx("p",{className:`mt-1 text-xs ${S==="invalid"?"text-red-600":"text-green-600"}`,children:p})]})});K.displayName="Select";const ir={primary:"btn-primary",secondary:"btn-secondary",success:"btn-success",danger:"btn-danger",warning:"btn-warning",info:"btn-info",dark:"btn-dark",light:"btn-light",link:"btn-link","outline-primary":"btn-outline-primary","outline-secondary":"btn-outline-secondary","outline-success":"btn-outline-success","outline-danger":"btn-outline-danger","outline-warning":"btn-outline-warning","outline-info":"btn-outline-info","outline-dark":"btn-outline-dark","outline-light":"btn-outline-light","soft-primary":"btn-soft-primary","soft-secondary":"btn-soft-secondary","soft-success":"btn-soft-success","soft-danger":"btn-soft-danger","soft-warning":"btn-soft-warning","soft-info":"btn-soft-info","soft-dark":"btn-soft-dark","soft-light":"btn-soft-light"},dr={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"},hr={flat:"shadow-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},ur=({children:r,variant:t="primary",size:e="md",type:o="button",shape:c="rounded",className:h="",isLoading:u=!1,disabled:b=!1,...i})=>{const s=b||u,a=["inline-flex items-center justify-center font-normal transition duration-150",ir[t],dr[e],hr[c],c==="flat"?"shadow-none":"shadow-sm",s?"opacity-50 cursor-not-allowed":"cursor-pointer",h].filter(Boolean).join(" ");return l.jsxs("button",{type:o,className:a,disabled:s,...i,children:[u&&l.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:[l.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"}),l.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"})]}),r]})};var U={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},X=n.createContext&&n.createContext(U),br=["attr","size","title"];function fr(r,t){if(r==null)return{};var e=gr(r,t),o,c;if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(r);for(c=0;c<h.length;c++)o=h[c],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(r,o)&&(e[o]=r[o])}return e}function gr(r,t){if(r==null)return{};var e={};for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o)){if(t.indexOf(o)>=0)continue;e[o]=r[o]}return e}function T(){return T=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},T.apply(this,arguments)}function Y(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);t&&(o=o.filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable})),e.push.apply(e,o)}return e}function A(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Y(Object(e),!0).forEach(function(o){vr(r,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):Y(Object(e)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o))})}return r}function vr(r,t,e){return t=pr(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function pr(r){var t=yr(r,"string");return typeof t=="symbol"?t:t+""}function yr(r,t){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var o=e.call(r,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function J(r){return r&&r.map((t,e)=>n.createElement(t.tag,A({key:e},t.attr),J(t.child)))}function D(r){return t=>n.createElement(wr,T({attr:A({},r.attr)},t),J(r.child))}function wr(r){var t=e=>{var{attr:o,size:c,title:h}=r,u=fr(r,br),b=c||e.size||"1em",i;return e.className&&(i=e.className),r.className&&(i=(i?i+" ":"")+r.className),n.createElement("svg",T({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,o,u,{className:i,style:A(A({color:r.color||e.color},e.style),r.style),height:b,width:b,xmlns:"http://www.w3.org/2000/svg"}),h&&n.createElement("title",null,h),r.children)};return X!==void 0?n.createElement(X.Consumer,null,e=>t(e)):t(U)}function kr(r){return D({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(r)}const mr={xs:"w-3 h-3 text-[10px]",sm:"w-4 h-4 text-xs",md:"w-5 h-5 text-sm",lg:"w-6 h-6 text-base"},xr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},Cr={primary:"primary",secondary:"secondary",success:"success",danger:"danger",warning:"warning",info:"info",dark:"dark",light:"light",link:"link","outline-primary":"outline-primary","outline-secondary":"outline-secondary","outline-success":"outline-success","outline-danger":"outline-danger","outline-warning":"outline-warning","outline-info":"outline-info","outline-dark":"outline-dark","outline-light":"outline-light","soft-primary":"soft-primary","soft-secondary":"soft-secondary","soft-success":"soft-success","soft-danger":"soft-danger","soft-warning":"soft-warning","soft-info":"soft-info","soft-dark":"soft-dark","soft-light":"soft-light"},Q=n.forwardRef(({label:r,boxSize:t="md",shape:e="rounded",variant:o="success",onSelectionChange:c,disabled:h=!1,className:u="",id:b,value:i,icon:s,children:a,checked:d,...f},v)=>{const g=k=>{!h&&c&&c(k.target.checked),f.onChange&&f.onChange(k)},p="mr-2 border flex items-center justify-center transition-all",S=mr[t],m=xr[e],N=Cr[o]??"",$=o.startsWith("outline"),C=o.startsWith("soft"),x=`${p} ${S} ${m} ${N} ${d&&($||C||o==="link")?"peer-checked:bg-current peer-checked:text-white":d?"peer-checked:bg-current":""}`,L={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};return l.jsxs("label",{className:`flex items-center ${h?"opacity-50 cursor-not-allowed":"cursor-pointer"} me-4 ${u}`,children:[l.jsx("input",{type:"checkbox",className:"peer hidden",checked:d,onChange:g,disabled:h,id:b,value:i,ref:v,...f}),l.jsx("span",{className:x.trim(),children:(d||f.defaultChecked)&&(s??l.jsx(kr,{className:`${L[t]}`}))}),r||a?l.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-300",children:r??a}):null]})});Q.displayName="Checkbox";const Sr=({label:r,header:t,items:e=[],onSelect:o,renderItem:c,position:h="right",className:u="",menuClassName:b="",width:i="w-48",closeOnSelect:s=!1,transition:a=!0,ariaLabel:d="Dropdown menu",...f})=>{const[v,g]=n.useState(!1),[p,S]=n.useState(!1),m=n.useRef(null),N=n.useRef(null),$=n.useMemo(()=>({left:"left-0",center:"left-1/2 transform -translate-x-1/2",right:"right-0"})[h],[h]),C=n.useCallback(()=>{const k=N.current,O=m.current;if(!k||!O)return;const{top:M,bottom:z}=k.getBoundingClientRect(),j=O.offsetHeight,P=window.innerHeight-z,I=M;S(P<j&&I>j)},[]),E=n.useCallback(k=>{var O,M;!((O=m.current)!=null&&O.contains(k.target))&&!((M=N.current)!=null&&M.contains(k.target))&&g(!1)},[]),y=n.useCallback(()=>g(k=>!k),[]),x=n.useCallback(()=>g(!1),[]);n.useEffect(()=>{if(v)return C(),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[v,C]),n.useEffect(()=>(document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)),[E]);const L=n.useMemo(()=>["absolute z-50 bg-white rounded shadow-lg overflow-hidden w-auto",p?"bottom-full mb-2":"top-full mt-2",$,i,a&&"transition-all duration-200 ease-out",b].filter(Boolean).join(" "),[p,$,i,a,b]);return l.jsxs("div",{className:`relative inline-block ${u}`,...f,children:[l.jsx("button",{ref:N,onClick:y,"aria-expanded":v,"aria-label":d,className:"focus:outline-none",children:r}),v&&l.jsxs("div",{ref:m,role:"menu",className:L,children:[t&&t,e.map((k,O)=>{const M=()=>{o&&o(k),s&&x()};return l.jsx("div",{children:c?c(k,M):l.jsx("div",{onClick:M,className:"px-4 py-2 text-sm text-gray-800 hover:bg-gray-100 cursor-pointer",role:"menuitem",children:k.label})},O)})]})]})},Nr=({children:r,content:t,position:e="top",className:o="",tooltipClass:c="",tooltipStyle:h={}})=>{const u=n.useRef(null),b=n.useRef(null);n.useEffect(()=>{const s=u.current,a=b.current;if(!s||!a)return;const d=()=>{a.style.opacity="1",a.style.visibility="visible"},f=()=>{a.style.opacity="0",a.style.visibility="hidden"};return s.addEventListener("mouseenter",d),s.addEventListener("mouseleave",f),()=>{s.removeEventListener("mouseenter",d),s.removeEventListener("mouseleave",f)}},[]);const i=s=>{const a={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(s){case"top":return{...a,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...a,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...a,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...a,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return a}};return l.jsxs("div",{ref:u,className:`relative inline-block ${o}`,children:[r,l.jsx("div",{ref:b,role:"tooltip",className:c,style:{...i(e),...h},children:t})]})},$r={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"},Er={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"},Lr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},Or=({label:r,variant:t="primary",size:e="sm",shape:o="rounded",icon:c,dismissible:h,onDismiss:u,className:b="",...i})=>{const s=!r&&!!c,a=`inline-flex items-center font-medium ${$r[t]||""} ${Er[e]||""} ${Lr[o]||""} ${s?"justify-center p-2 w-8 h-8":""} `+b;return l.jsxs("span",{className:a.trim(),...i,children:[c&&l.jsx("span",{className:r?"mr-1":"",children:c}),r,h&&l.jsx("button",{type:"button",onClick:u,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})};function Mr(r){return D({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(r)}const jr=({items:r,allowMultipleOpen:t=!1,className:e="",tileClasses:o="",open:c,onChange:h,renderTitle:u,renderContent:b,showArrowIcon:i=!0,panelClasses:s=""})=>{const[a,d]=n.useState(new Set),f=n.useMemo(()=>c?new Set(c):a,[c,a]),v=n.useCallback(g=>{const p=new Set(f);p.has(g)?p.delete(g):(t||p.clear(),p.add(g)),c&&h?h(Array.from(p)):d(p)},[f,c,h,t]);return l.jsx("div",{className:"accordion",role:"region","aria-multiselectable":t,children:r.map(g=>{const p=f.has(g.id),S=`accordion-heading-${g.id}`,m=`accordion-panel-${g.id}`;return l.jsxs("div",{className:`accordion-item border rounded border-gray-300 dark:border-gray-700 ${e}`,children:[l.jsxs("button",{id:S,type:"button","aria-expanded":p,"aria-controls":m,onClick:()=>v(g.id),className:`flex justify-between items-center w-full p-1.5 text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none gap-3 ${o}`,children:[u?u(g,p):g.title,i?l.jsx(Mr,{}):null]}),l.jsx("div",{id:m,role:"region","aria-labelledby":S,hidden:!p,className:`p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 ${s}`,children:b?b(g,p):g.content})]},g.id)})})},V=n.createContext(null),_=()=>{const r=n.useContext(V);if(!r)throw new Error("useModalActions must be used within a ModalActionProvider");return r},R=n.createContext(null),B=()=>n.useContext(R);function Pr({id:r,title:t,children:e,standalone:o=!1,showFloatingClose:c=!1,containerClasses:h="",onClose:u,disableEscapeClose:b=!1}){const i=B(),s=_(),a=!o&&!!i&&!!s,[d,f]=n.useState(!1),v=a?i.isOpen(r):d,g=a?i.getModalData(r):null,p=n.useCallback(()=>{a?s.closeModal(r):f(!1),u==null||u()},[a,s,r,u]);return n.useEffect(()=>{const S=document.activeElement;console.log(r);const m=document.getElementById(r);console.log("modalEl=",m);const N=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'],$=()=>{if(!m)return[];const y=m.querySelectorAll(N.join(","));return Array.from(y).filter(x=>x.offsetParent!==null)},C=y=>{if(y.key==="Tab"){const x=$();if(x.length===0)return;const L=x[0],k=x[x.length-1];y.shiftKey?document.activeElement===L&&(y.preventDefault(),k.focus()):document.activeElement===k&&(y.preventDefault(),L.focus())}},E=y=>{y.key==="Escape"&&!b&&p(),C(y)};return v&&(document.body.style.overflow="hidden",setTimeout(()=>{const y=$();y.length&&y[0].focus()},0),window.addEventListener("keydown",E)),()=>{document.body.style.overflow="",S&&S.focus(),window.removeEventListener("keydown",E)}},[v,b,p,r]),v?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",id:r,children:l.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${h}`,children:[l.jsxs("div",{className:"flex justify-between items-center relative",children:[t&&l.jsx("h2",{className:"text-lg font-semibold",children:t}),c&&l.jsx("button",{onClick:p,className:"text-gray-500 hover:text-black absolute top-2 right-3 hover:bg-gray-200 rounded-full aspect-square w-8","aria-label":"Close modal",children:"✕"})]}),l.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof e=="function"?e({modalData:g}):e})]})}):null}function Ir({children:r}){const[t,e]=n.useState({}),[o,c]=n.useState({}),h=n.useCallback((d,f)=>{e(v=>({...v,[d]:!0})),f&&c(v=>({...v,[d]:f}))},[]),u=n.useCallback(d=>{e(f=>({...f,[d]:!1})),c(f=>{const v={...f};return delete v[d],v})},[]),b=n.useCallback(d=>!!t[d],[t]),i=n.useCallback(d=>o[d],[o]),s=n.useMemo(()=>({openModal:h,closeModal:u}),[h,u]),a=n.useMemo(()=>({isOpen:b,getModalData:i}),[b,i]);return l.jsx(V.Provider,{value:s,children:l.jsx(R.Provider,{value:a,children:r})})}function zr(r){const{openModal:t,closeModal:e}=_(),{isOpen:o,getModalData:c}=B();return{open:h=>t(r,h),close:()=>e(r),isOpen:o(r),data:c(r)}}let F=null,H={};function Tr(r){F=r}function Ar(r){H={...H,...r}}function Dr(){return H}function _r(r,t,e=3e3,o){F?F(r,t,e,o):console.warn("Toast system is not mounted")}function Br(r){return D({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:[]}]})(r)}const Fr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)}),Hr=()=>{const[r,t]=n.useState([]);n.useEffect(()=>{Tr((o,c,h,u)=>{const b=Fr();t(i=>[...i,{id:b,type:o,message:c,config:u}]),setTimeout(()=>{t(i=>i.filter(s=>s.id!==b))},h)})},[]);const e=Dr();return l.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:r.map(o=>{var i,s,a,d,f,v,g,p,S,m,N,$,C;const c=((i=o.config)==null?void 0:i.icon)||((s=e.icons)==null?void 0:s[o.type])||Wr(o.type),h=((a=o.config)==null?void 0:a.bgColor)||((f=(d=e.colors)==null?void 0:d[o.type])==null?void 0:f.bg)||"bg-white dark:bg-gray-800",u=((v=o.config)==null?void 0:v.textColor)||((p=(g=e.colors)==null?void 0:g[o.type])==null?void 0:p.text)||"text-gray-700 dark:text-gray-300",b=((S=o.config)==null?void 0:S.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return l.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${h} ${u}`,children:[l.jsx("div",{className:b,children:c}),l.jsxs("div",{className:"flex-1 me-3",children:[((m=o.config)==null?void 0:m.title)&&l.jsx("div",{className:"font-semibold text-black",children:o.config.title}),((N=o.config)==null?void 0:N.description)&&l.jsx("div",{className:"text-sm text-gray-500",children:o.config.description}),!(($=o.config)!=null&&$.title)&&!((C=o.config)!=null&&C.description)&&l.jsx("div",{className:"text-sm",children:o.message})]}),l.jsx("button",{onClick:()=>t(E=>E.filter(y=>y.id!==o.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:l.jsx(Br,{size:18})})]},o.id)})})};function Wr(r){switch(r){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}w.Accordion=jr,w.Badge=Or,w.Button=ur,w.Checkbox=Q,w.Dropdown=Sr,w.Input=q,w.Modal=Pr,w.ModalProvider=Ir,w.Select=K,w.Toast=Hr,w.Tooltip=Nr,w.setToastDefaults=Ar,w.showToast=_r,w.useModalActions=_,w.useModalInstance=zr,w.useModalState=B,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
|
8
|
+
${O} ${M} ${i}`,children:m}),L&&e&&d&&l.jsx("label",{htmlFor:y,className:`ms-1 ${cr[d]} ${i}`,children:e})]}),p&&l.jsx("p",{className:`mt-1 text-xs ${S==="invalid"?"text-red-600":"text-green-600"}`,children:p})]})});K.displayName="Select";const ir={primary:"btn-primary",secondary:"btn-secondary",success:"btn-success",danger:"btn-danger",warning:"btn-warning",info:"btn-info",dark:"btn-dark",light:"btn-light",link:"btn-link","outline-primary":"btn-outline-primary","outline-secondary":"btn-outline-secondary","outline-success":"btn-outline-success","outline-danger":"btn-outline-danger","outline-warning":"btn-outline-warning","outline-info":"btn-outline-info","outline-dark":"btn-outline-dark","outline-light":"btn-outline-light","soft-primary":"btn-soft-primary","soft-secondary":"btn-soft-secondary","soft-success":"btn-soft-success","soft-danger":"btn-soft-danger","soft-warning":"btn-soft-warning","soft-info":"btn-soft-info","soft-dark":"btn-soft-dark","soft-light":"btn-soft-light"},dr={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"},hr={flat:"shadow-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},ur=({children:r,variant:t="primary",size:e="md",type:o="button",shape:c="rounded",className:h="",isLoading:u=!1,disabled:b=!1,...i})=>{const s=b||u,a=["inline-flex items-center justify-center font-normal transition duration-150",ir[t],dr[e],hr[c],c==="flat"?"shadow-none":"shadow-sm",s?"opacity-50 cursor-not-allowed":"cursor-pointer",h].filter(Boolean).join(" ");return l.jsxs("button",{type:o,className:a,disabled:s,...i,children:[u&&l.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:[l.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"}),l.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"})]}),r]})};var U={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},X=n.createContext&&n.createContext(U),br=["attr","size","title"];function fr(r,t){if(r==null)return{};var e=gr(r,t),o,c;if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(r);for(c=0;c<h.length;c++)o=h[c],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(r,o)&&(e[o]=r[o])}return e}function gr(r,t){if(r==null)return{};var e={};for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o)){if(t.indexOf(o)>=0)continue;e[o]=r[o]}return e}function T(){return T=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},T.apply(this,arguments)}function Y(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);t&&(o=o.filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable})),e.push.apply(e,o)}return e}function A(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Y(Object(e),!0).forEach(function(o){vr(r,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):Y(Object(e)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o))})}return r}function vr(r,t,e){return t=pr(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function pr(r){var t=yr(r,"string");return typeof t=="symbol"?t:t+""}function yr(r,t){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var o=e.call(r,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function J(r){return r&&r.map((t,e)=>n.createElement(t.tag,A({key:e},t.attr),J(t.child)))}function D(r){return t=>n.createElement(wr,T({attr:A({},r.attr)},t),J(r.child))}function wr(r){var t=e=>{var{attr:o,size:c,title:h}=r,u=fr(r,br),b=c||e.size||"1em",i;return e.className&&(i=e.className),r.className&&(i=(i?i+" ":"")+r.className),n.createElement("svg",T({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,o,u,{className:i,style:A(A({color:r.color||e.color},e.style),r.style),height:b,width:b,xmlns:"http://www.w3.org/2000/svg"}),h&&n.createElement("title",null,h),r.children)};return X!==void 0?n.createElement(X.Consumer,null,e=>t(e)):t(U)}function kr(r){return D({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(r)}const mr={xs:"w-3 h-3 text-[10px]",sm:"w-4 h-4 text-xs",md:"w-5 h-5 text-sm",lg:"w-6 h-6 text-base"},xr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},Cr={primary:"primary",secondary:"secondary",success:"success",danger:"danger",warning:"warning",info:"info",dark:"dark",light:"light",link:"link","outline-primary":"outline-primary","outline-secondary":"outline-secondary","outline-success":"outline-success","outline-danger":"outline-danger","outline-warning":"outline-warning","outline-info":"outline-info","outline-dark":"outline-dark","outline-light":"outline-light","soft-primary":"soft-primary","soft-secondary":"soft-secondary","soft-success":"soft-success","soft-danger":"soft-danger","soft-warning":"soft-warning","soft-info":"soft-info","soft-dark":"soft-dark","soft-light":"soft-light"},Q=n.forwardRef(({label:r,boxSize:t="md",shape:e="rounded",variant:o="success",onSelectionChange:c,disabled:h=!1,className:u="",id:b,value:i,icon:s,children:a,checked:d,...f},v)=>{const g=k=>{!h&&c&&c(k.target.checked),f.onChange&&f.onChange(k)},p="mr-2 border flex items-center justify-center transition-all",S=mr[t],m=xr[e],N=Cr[o]??"",$=o.startsWith("outline"),C=o.startsWith("soft"),x=`${p} ${S} ${m} ${N} ${d&&($||C||o==="link")?"peer-checked:bg-current peer-checked:text-white":d?"peer-checked:bg-current":""}`,L={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};return l.jsxs("label",{className:`flex items-center ${h?"opacity-50 cursor-not-allowed":"cursor-pointer"} me-4 ${u}`,children:[l.jsx("input",{type:"checkbox",className:"peer hidden",checked:d,onChange:g,disabled:h,id:b,value:i,ref:v,...f}),l.jsx("span",{className:x.trim(),children:(d||f.defaultChecked)&&(s??l.jsx(kr,{className:`${L[t]}`}))}),r||a?l.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-300",children:r??a}):null]})});Q.displayName="Checkbox";const Sr=({label:r,header:t,items:e=[],onSelect:o,renderItem:c,position:h="right",className:u="",menuClassName:b="",width:i="w-48",closeOnSelect:s=!1,transition:a=!0,ariaLabel:d="Dropdown menu",...f})=>{const[v,g]=n.useState(!1),[p,S]=n.useState(!1),m=n.useRef(null),N=n.useRef(null),$=n.useMemo(()=>({left:"left-0",center:"left-1/2 transform -translate-x-1/2",right:"right-0"})[h],[h]),C=n.useCallback(()=>{const k=N.current,O=m.current;if(!k||!O)return;const{top:M,bottom:z}=k.getBoundingClientRect(),j=O.offsetHeight,P=window.innerHeight-z,I=M;S(P<j&&I>j)},[]),E=n.useCallback(k=>{var O,M;!((O=m.current)!=null&&O.contains(k.target))&&!((M=N.current)!=null&&M.contains(k.target))&&g(!1)},[]),y=n.useCallback(()=>g(k=>!k),[]),x=n.useCallback(()=>g(!1),[]);n.useEffect(()=>{if(v)return C(),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[v,C]),n.useEffect(()=>(document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)),[E]);const L=n.useMemo(()=>["absolute z-50 bg-white rounded shadow-lg overflow-hidden w-auto",p?"bottom-full mb-2":"top-full mt-2",$,i,a&&"transition-all duration-200 ease-out",b].filter(Boolean).join(" "),[p,$,i,a,b]);return l.jsxs("div",{className:`relative inline-block ${u}`,...f,children:[l.jsx("button",{type:"button",ref:N,onClick:y,"aria-expanded":v,"aria-label":d,className:"focus:outline-none",children:r}),v&&l.jsxs("div",{ref:m,role:"menu",className:L,children:[t&&t,e.map((k,O)=>{const M=()=>{o&&o(k),s&&x()};return l.jsx("div",{children:c?c(k,M):l.jsx("div",{onClick:M,className:"px-4 py-2 text-sm text-gray-800 hover:bg-gray-100 cursor-pointer",role:"menuitem",children:k.label})},O)})]})]})},Nr=({children:r,content:t,position:e="top",className:o="",tooltipClass:c="",tooltipStyle:h={}})=>{const u=n.useRef(null),b=n.useRef(null);n.useEffect(()=>{const s=u.current,a=b.current;if(!s||!a)return;const d=()=>{a.style.opacity="1",a.style.visibility="visible"},f=()=>{a.style.opacity="0",a.style.visibility="hidden"};return s.addEventListener("mouseenter",d),s.addEventListener("mouseleave",f),()=>{s.removeEventListener("mouseenter",d),s.removeEventListener("mouseleave",f)}},[]);const i=s=>{const a={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(s){case"top":return{...a,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...a,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...a,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...a,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return a}};return l.jsxs("div",{ref:u,className:`relative inline-block ${o}`,children:[r,l.jsx("div",{ref:b,role:"tooltip",className:c,style:{...i(e),...h},children:t})]})},$r={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"},Er={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"},Lr={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},Or=({label:r,variant:t="primary",size:e="sm",shape:o="rounded",icon:c,dismissible:h,onDismiss:u,className:b="",...i})=>{const s=!r&&!!c,a=`inline-flex items-center font-medium ${$r[t]||""} ${Er[e]||""} ${Lr[o]||""} ${s?"justify-center p-2 w-8 h-8":""} `+b;return l.jsxs("span",{className:a.trim(),...i,children:[c&&l.jsx("span",{className:r?"mr-1":"",children:c}),r,h&&l.jsx("button",{type:"button",onClick:u,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})};function Mr(r){return D({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(r)}const jr=({items:r,allowMultipleOpen:t=!1,className:e="",tileClasses:o="",open:c,onChange:h,renderTitle:u,renderContent:b,showArrowIcon:i=!0,panelClasses:s=""})=>{const[a,d]=n.useState(new Set),f=n.useMemo(()=>c?new Set(c):a,[c,a]),v=n.useCallback(g=>{const p=new Set(f);p.has(g)?p.delete(g):(t||p.clear(),p.add(g)),c&&h?h(Array.from(p)):d(p)},[f,c,h,t]);return l.jsx("div",{className:"accordion",role:"region","aria-multiselectable":t,children:r.map(g=>{const p=f.has(g.id),S=`accordion-heading-${g.id}`,m=`accordion-panel-${g.id}`;return l.jsxs("div",{className:`accordion-item border rounded border-gray-300 dark:border-gray-700 ${e}`,children:[l.jsxs("button",{id:S,type:"button","aria-expanded":p,"aria-controls":m,onClick:()=>v(g.id),className:`flex justify-between items-center w-full p-1.5 text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none gap-3 ${o}`,children:[u?u(g,p):g.title,i?l.jsx(Mr,{}):null]}),l.jsx("div",{id:m,role:"region","aria-labelledby":S,hidden:!p,className:`p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 ${s}`,children:b?b(g,p):g.content})]},g.id)})})},V=n.createContext(null),_=()=>{const r=n.useContext(V);if(!r)throw new Error("useModalActions must be used within a ModalActionProvider");return r},R=n.createContext(null),B=()=>n.useContext(R);function Pr({id:r,title:t,children:e,standalone:o=!1,showFloatingClose:c=!1,containerClasses:h="",onClose:u,disableEscapeClose:b=!1}){const i=B(),s=_(),a=!o&&!!i&&!!s,[d,f]=n.useState(!1),v=a?i.isOpen(r):d,g=a?i.getModalData(r):null,p=n.useCallback(()=>{a?s.closeModal(r):f(!1),u==null||u()},[a,s,r,u]);return n.useEffect(()=>{const S=document.activeElement;console.log(r);const m=document.getElementById(r);console.log("modalEl=",m);const N=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'],$=()=>{if(!m)return[];const y=m.querySelectorAll(N.join(","));return Array.from(y).filter(x=>x.offsetParent!==null)},C=y=>{if(y.key==="Tab"){const x=$();if(x.length===0)return;const L=x[0],k=x[x.length-1];y.shiftKey?document.activeElement===L&&(y.preventDefault(),k.focus()):document.activeElement===k&&(y.preventDefault(),L.focus())}},E=y=>{y.key==="Escape"&&!b&&p(),C(y)};return v&&(document.body.style.overflow="hidden",setTimeout(()=>{const y=$();y.length&&y[0].focus()},0),window.addEventListener("keydown",E)),()=>{document.body.style.overflow="",S&&S.focus(),window.removeEventListener("keydown",E)}},[v,b,p,r]),v?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",id:r,children:l.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${h}`,children:[l.jsxs("div",{className:"flex justify-between items-center relative",children:[t&&l.jsx("h2",{className:"text-lg font-semibold",children:t}),c&&l.jsx("button",{onClick:p,className:"text-gray-500 hover:text-black absolute top-2 right-3 hover:bg-gray-200 rounded-full aspect-square w-8","aria-label":"Close modal",children:"✕"})]}),l.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof e=="function"?e({modalData:g}):e})]})}):null}function Ir({children:r}){const[t,e]=n.useState({}),[o,c]=n.useState({}),h=n.useCallback((d,f)=>{e(v=>({...v,[d]:!0})),f&&c(v=>({...v,[d]:f}))},[]),u=n.useCallback(d=>{e(f=>({...f,[d]:!1})),c(f=>{const v={...f};return delete v[d],v})},[]),b=n.useCallback(d=>!!t[d],[t]),i=n.useCallback(d=>o[d],[o]),s=n.useMemo(()=>({openModal:h,closeModal:u}),[h,u]),a=n.useMemo(()=>({isOpen:b,getModalData:i}),[b,i]);return l.jsx(V.Provider,{value:s,children:l.jsx(R.Provider,{value:a,children:r})})}function zr(r){const{openModal:t,closeModal:e}=_(),{isOpen:o,getModalData:c}=B();return{open:h=>t(r,h),close:()=>e(r),isOpen:o(r),data:c(r)}}let F=null,H={};function Tr(r){F=r}function Ar(r){H={...H,...r}}function Dr(){return H}function _r(r,t,e=3e3,o){F?F(r,t,e,o):console.warn("Toast system is not mounted")}function Br(r){return D({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:[]}]})(r)}const Fr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)}),Hr=()=>{const[r,t]=n.useState([]);n.useEffect(()=>{Tr((o,c,h,u)=>{const b=Fr();t(i=>[...i,{id:b,type:o,message:c,config:u}]),setTimeout(()=>{t(i=>i.filter(s=>s.id!==b))},h)})},[]);const e=Dr();return l.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:r.map(o=>{var i,s,a,d,f,v,g,p,S,m,N,$,C;const c=((i=o.config)==null?void 0:i.icon)||((s=e.icons)==null?void 0:s[o.type])||Wr(o.type),h=((a=o.config)==null?void 0:a.bgColor)||((f=(d=e.colors)==null?void 0:d[o.type])==null?void 0:f.bg)||"bg-white dark:bg-gray-800",u=((v=o.config)==null?void 0:v.textColor)||((p=(g=e.colors)==null?void 0:g[o.type])==null?void 0:p.text)||"text-gray-700 dark:text-gray-300",b=((S=o.config)==null?void 0:S.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return l.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${h} ${u}`,children:[l.jsx("div",{className:b,children:c}),l.jsxs("div",{className:"flex-1 me-3",children:[((m=o.config)==null?void 0:m.title)&&l.jsx("div",{className:"font-semibold text-black",children:o.config.title}),((N=o.config)==null?void 0:N.description)&&l.jsx("div",{className:"text-sm text-gray-500",children:o.config.description}),!(($=o.config)!=null&&$.title)&&!((C=o.config)!=null&&C.description)&&l.jsx("div",{className:"text-sm",children:o.message})]}),l.jsx("button",{onClick:()=>t(E=>E.filter(y=>y.id!==o.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:l.jsx(Br,{size:18})})]},o.id)})})};function Wr(r){switch(r){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}w.Accordion=jr,w.Badge=Or,w.Button=ur,w.Checkbox=Q,w.Dropdown=Sr,w.Input=q,w.Modal=Pr,w.ModalProvider=Ir,w.Select=K,w.Toast=Hr,w.Tooltip=Nr,w.setToastDefaults=Ar,w.showToast=_r,w.useModalActions=_,w.useModalInstance=zr,w.useModalState=B,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|