tailwind-ux-kit 1.0.39 → 1.0.41
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 +127 -109
- package/lib/tailwind-ux-kit.umd.js +6 -6
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as m, jsx as g } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import I, { forwardRef as J, useState as E, useRef as T, useMemo as _, useCallback as L, useEffect as M, createContext as Q, useContext as V } from "react";
|
|
4
4
|
const le = J((e, n) => {
|
|
5
5
|
const {
|
|
6
6
|
label: t,
|
|
@@ -17,34 +17,34 @@ const le = J((e, n) => {
|
|
|
17
17
|
isValid: c,
|
|
18
18
|
isInvalid: b,
|
|
19
19
|
feedback: x,
|
|
20
|
-
feedbackType:
|
|
21
|
-
...
|
|
22
|
-
} = e, [
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
},
|
|
20
|
+
feedbackType: y = "invalid",
|
|
21
|
+
...h
|
|
22
|
+
} = e, [S, O] = E("default"), $ = (C) => {
|
|
23
|
+
const k = C.target.value, P = (p == null ? void 0 : p(k)) ?? "default";
|
|
24
|
+
O(P), d == null || d(C, P), i == null || i(C);
|
|
25
|
+
}, w = {
|
|
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",
|
|
29
29
|
lg: "text-lg px-5 py-3"
|
|
30
|
-
},
|
|
30
|
+
}, v = {
|
|
31
31
|
flat: "rounded-none",
|
|
32
32
|
rounded: "rounded-sm",
|
|
33
33
|
pill: "rounded-full"
|
|
34
|
-
},
|
|
34
|
+
}, j = {
|
|
35
35
|
filled: "rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",
|
|
36
36
|
outlined: "rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",
|
|
37
37
|
standard: "px-0 py-2.5 bg-transparent border-0 border-b-2"
|
|
38
|
-
},
|
|
38
|
+
}, z = {
|
|
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
|
-
}, F = (
|
|
43
|
-
if (
|
|
42
|
+
}, F = (C, k, P) => {
|
|
43
|
+
if (P)
|
|
44
44
|
return "border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";
|
|
45
|
-
if (
|
|
45
|
+
if (k)
|
|
46
46
|
return "border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";
|
|
47
|
-
switch (
|
|
47
|
+
switch (C) {
|
|
48
48
|
case "error":
|
|
49
49
|
return "border-red-500 bg-red-50 focus:ring-red-500";
|
|
50
50
|
case "warning":
|
|
@@ -54,13 +54,13 @@ const le = J((e, n) => {
|
|
|
54
54
|
default:
|
|
55
55
|
return "border-gray-300 focus:ring-blue-500";
|
|
56
56
|
}
|
|
57
|
-
}, Z =
|
|
58
|
-
return /* @__PURE__ */ m("div", { className: `w-full relative ${
|
|
59
|
-
!
|
|
57
|
+
}, Z = w[s] || w.md, G = v[f] || v.flat, H = F(S, c, b), W = o === "start" || o === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", K = u && (o === "start" || o === "left") ? "ps-10" : u ? "pe-10" : "", A = r ?? `input-${(t == null ? void 0 : t.toLowerCase().replace(/\s+/g, "-")) || Math.random().toString(36).slice(2)}`, N = !!l;
|
|
58
|
+
return /* @__PURE__ */ m("div", { className: `w-full relative ${N ? "z-0" : ""}`, children: [
|
|
59
|
+
!N && t && /* @__PURE__ */ g(
|
|
60
60
|
"label",
|
|
61
61
|
{
|
|
62
|
-
htmlFor:
|
|
63
|
-
className: `block mb-1
|
|
62
|
+
htmlFor: A,
|
|
63
|
+
className: `block mb-1 text-sm ${c ? "text-green-700 dark:text-green-500" : b ? "text-red-700 dark:text-red-500" : "text-gray-700"}`,
|
|
64
64
|
children: t
|
|
65
65
|
}
|
|
66
66
|
),
|
|
@@ -75,22 +75,22 @@ const le = J((e, n) => {
|
|
|
75
75
|
/* @__PURE__ */ g(
|
|
76
76
|
"input",
|
|
77
77
|
{
|
|
78
|
-
...
|
|
79
|
-
id:
|
|
78
|
+
...h,
|
|
79
|
+
id: A,
|
|
80
80
|
ref: n,
|
|
81
|
-
placeholder:
|
|
82
|
-
onChange:
|
|
81
|
+
placeholder: N ? " " : h.placeholder,
|
|
82
|
+
onChange: $,
|
|
83
83
|
className: `border peer w-full block font-normal appearance-none focus:outline-none focus:ring-0 transition text-gray-900 placeholder-gray-600 border-gray-400
|
|
84
84
|
${Z}
|
|
85
|
-
${
|
|
86
|
-
${
|
|
85
|
+
${N && l && j[l]}
|
|
86
|
+
${K} ${G} ${H} ${a}`
|
|
87
87
|
}
|
|
88
88
|
),
|
|
89
|
-
|
|
89
|
+
N && t && l && /* @__PURE__ */ g(
|
|
90
90
|
"label",
|
|
91
91
|
{
|
|
92
|
-
htmlFor:
|
|
93
|
-
className: `ms-1 ${
|
|
92
|
+
htmlFor: A,
|
|
93
|
+
className: `ms-1 ${z[l]} ${a}`,
|
|
94
94
|
children: t
|
|
95
95
|
}
|
|
96
96
|
)
|
|
@@ -98,7 +98,7 @@ const le = J((e, n) => {
|
|
|
98
98
|
x && /* @__PURE__ */ g(
|
|
99
99
|
"p",
|
|
100
100
|
{
|
|
101
|
-
className: `mt-1 text-xs ${
|
|
101
|
+
className: `mt-1 text-xs ${y === "invalid" ? "text-red-600 dark:text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
102
102
|
children: x
|
|
103
103
|
}
|
|
104
104
|
)
|
|
@@ -121,22 +121,22 @@ const ie = J((e, n) => {
|
|
|
121
121
|
isValid: c,
|
|
122
122
|
isInvalid: b,
|
|
123
123
|
feedback: x,
|
|
124
|
-
feedbackType:
|
|
125
|
-
children:
|
|
126
|
-
|
|
127
|
-
} = e, [
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
},
|
|
124
|
+
feedbackType: y = "invalid",
|
|
125
|
+
children: h,
|
|
126
|
+
...S
|
|
127
|
+
} = e, [O, $] = E("default"), w = (k) => {
|
|
128
|
+
const P = k.target.value, D = (p == null ? void 0 : p(P)) ?? "default";
|
|
129
|
+
$(D), d == null || d(k, D), i == null || i(k);
|
|
130
|
+
}, v = {
|
|
131
131
|
xs: "text-xs px-2 py-1",
|
|
132
132
|
sm: "text-sm px-3 py-1.5",
|
|
133
133
|
md: "text-sm px-3 py-3",
|
|
134
134
|
lg: "text-lg px-5 py-3"
|
|
135
|
-
},
|
|
135
|
+
}, j = {
|
|
136
136
|
flat: "rounded-none",
|
|
137
137
|
rounded: "rounded-sm",
|
|
138
138
|
pill: "rounded-full"
|
|
139
|
-
},
|
|
139
|
+
}, z = {
|
|
140
140
|
filled: "rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",
|
|
141
141
|
outlined: "rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",
|
|
142
142
|
standard: "px-0 py-2.5 bg-transparent border-0 border-b-2"
|
|
@@ -144,12 +144,12 @@ const ie = J((e, n) => {
|
|
|
144
144
|
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",
|
|
145
145
|
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",
|
|
146
146
|
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"
|
|
147
|
-
}, Z = (
|
|
148
|
-
if (
|
|
147
|
+
}, Z = (k, P, D) => {
|
|
148
|
+
if (D)
|
|
149
149
|
return "border-red-500 bg-red-50 text-red-900 focus:ring-red-500 focus:border-red-500";
|
|
150
|
-
if (
|
|
150
|
+
if (P)
|
|
151
151
|
return "border-green-500 bg-green-50 text-green-900 focus:ring-green-500 focus:border-green-500";
|
|
152
|
-
switch (
|
|
152
|
+
switch (k) {
|
|
153
153
|
case "error":
|
|
154
154
|
return "border-red-500 bg-red-50 focus:ring-red-500";
|
|
155
155
|
case "warning":
|
|
@@ -159,13 +159,13 @@ const ie = J((e, n) => {
|
|
|
159
159
|
default:
|
|
160
160
|
return "border-gray-300 focus:ring-blue-500";
|
|
161
161
|
}
|
|
162
|
-
}, G =
|
|
163
|
-
return /* @__PURE__ */ m("div", { className: `w-full relative ${
|
|
164
|
-
!
|
|
162
|
+
}, G = v[s] || v.md, H = j[f] || j.flat, W = Z(O, c, b), K = o === "start" || o === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", A = u && (o === "start" || o === "left") ? "ps-10" : u ? "pe-10" : "", N = r ?? `select-${(t == null ? void 0 : t.toLowerCase().replace(/\s+/g, "-")) || Math.random().toString(36).slice(2)}`, C = !!l;
|
|
163
|
+
return /* @__PURE__ */ m("div", { className: `w-full relative ${C ? "z-0" : ""}`, children: [
|
|
164
|
+
!C && t && /* @__PURE__ */ g(
|
|
165
165
|
"label",
|
|
166
166
|
{
|
|
167
|
-
htmlFor:
|
|
168
|
-
className: `block mb-1
|
|
167
|
+
htmlFor: N,
|
|
168
|
+
className: `block mb-1 text-sm ${c ? "text-green-700" : b ? "text-red-700" : "text-gray-700"}`,
|
|
169
169
|
children: t
|
|
170
170
|
}
|
|
171
171
|
),
|
|
@@ -173,28 +173,28 @@ const ie = J((e, n) => {
|
|
|
173
173
|
u && /* @__PURE__ */ g(
|
|
174
174
|
"div",
|
|
175
175
|
{
|
|
176
|
-
className: `absolute inset-y-0 flex items-center ${
|
|
176
|
+
className: `absolute inset-y-0 flex items-center ${K}`,
|
|
177
177
|
children: /* @__PURE__ */ g("span", { className: "text-gray-500", children: u })
|
|
178
178
|
}
|
|
179
179
|
),
|
|
180
180
|
/* @__PURE__ */ g(
|
|
181
181
|
"select",
|
|
182
182
|
{
|
|
183
|
-
|
|
184
|
-
id:
|
|
183
|
+
...S,
|
|
184
|
+
id: N,
|
|
185
185
|
ref: n,
|
|
186
|
-
onChange:
|
|
186
|
+
onChange: w,
|
|
187
187
|
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
|
|
188
188
|
${G}
|
|
189
|
-
${
|
|
190
|
-
${
|
|
191
|
-
children:
|
|
189
|
+
${C && l && z[l]}
|
|
190
|
+
${A} ${H} ${W} ${a}`,
|
|
191
|
+
children: h
|
|
192
192
|
}
|
|
193
193
|
),
|
|
194
|
-
|
|
194
|
+
C && t && l && /* @__PURE__ */ g(
|
|
195
195
|
"label",
|
|
196
196
|
{
|
|
197
|
-
htmlFor:
|
|
197
|
+
htmlFor: N,
|
|
198
198
|
className: `ms-1 ${F[l]} ${a}`,
|
|
199
199
|
children: t
|
|
200
200
|
}
|
|
@@ -203,7 +203,7 @@ const ie = J((e, n) => {
|
|
|
203
203
|
x && /* @__PURE__ */ g(
|
|
204
204
|
"p",
|
|
205
205
|
{
|
|
206
|
-
className: `mt-1 text-xs ${
|
|
206
|
+
className: `mt-1 text-xs ${y === "invalid" ? "text-red-600" : "text-green-600"}`,
|
|
207
207
|
children: x
|
|
208
208
|
}
|
|
209
209
|
)
|
|
@@ -294,7 +294,7 @@ const ce = {
|
|
|
294
294
|
children: n,
|
|
295
295
|
position: t = "right"
|
|
296
296
|
}) => {
|
|
297
|
-
const [r, s] =
|
|
297
|
+
const [r, s] = E(!1), [f, p] = E(!1), d = T(null), a = T(null), u = _(() => {
|
|
298
298
|
switch (t) {
|
|
299
299
|
case "left":
|
|
300
300
|
return "left-0";
|
|
@@ -304,23 +304,23 @@ const ce = {
|
|
|
304
304
|
default:
|
|
305
305
|
return "right-0";
|
|
306
306
|
}
|
|
307
|
-
}, [t]), o =
|
|
307
|
+
}, [t]), o = L((c) => {
|
|
308
308
|
const b = c.target;
|
|
309
309
|
d.current && !d.current.contains(b) && a.current && !a.current.contains(b) && s(!1);
|
|
310
|
-
}, []), l =
|
|
310
|
+
}, []), l = L(() => {
|
|
311
311
|
if (!a.current || !d.current) return;
|
|
312
|
-
const c = a.current.getBoundingClientRect(), b = d.current.getBoundingClientRect(), x = window.innerHeight - c.bottom,
|
|
312
|
+
const c = a.current.getBoundingClientRect(), b = d.current.getBoundingClientRect(), x = window.innerHeight - c.bottom, y = c.top;
|
|
313
313
|
p(
|
|
314
|
-
x < b.height &&
|
|
314
|
+
x < b.height && y > b.height
|
|
315
315
|
);
|
|
316
316
|
}, []);
|
|
317
|
-
|
|
317
|
+
M(() => {
|
|
318
318
|
if (r)
|
|
319
319
|
return l(), window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), () => {
|
|
320
320
|
window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
|
|
321
321
|
};
|
|
322
|
-
}, [r, l]),
|
|
323
|
-
const i =
|
|
322
|
+
}, [r, l]), M(() => (document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o)), [o]);
|
|
323
|
+
const i = L(() => s((c) => !c), []);
|
|
324
324
|
return /* @__PURE__ */ m("div", { className: "relative flex items-center", children: [
|
|
325
325
|
/* @__PURE__ */ g("button", { ref: a, onClick: i, children: e }),
|
|
326
326
|
r && /* @__PURE__ */ g(
|
|
@@ -342,8 +342,8 @@ const ce = {
|
|
|
342
342
|
tooltipClass: s = "",
|
|
343
343
|
tooltipStyle: f = {}
|
|
344
344
|
}) => {
|
|
345
|
-
const p =
|
|
346
|
-
|
|
345
|
+
const p = T(null), d = T(null);
|
|
346
|
+
M(() => {
|
|
347
347
|
const u = p.current, o = d.current;
|
|
348
348
|
if (!u || !o) return;
|
|
349
349
|
const l = () => {
|
|
@@ -487,7 +487,7 @@ var ee = {
|
|
|
487
487
|
className: void 0,
|
|
488
488
|
style: void 0,
|
|
489
489
|
attr: void 0
|
|
490
|
-
},
|
|
490
|
+
}, X = I.createContext && /* @__PURE__ */ I.createContext(ee), be = ["attr", "size", "title"];
|
|
491
491
|
function xe(e, n) {
|
|
492
492
|
if (e == null) return {};
|
|
493
493
|
var t = me(e, n), r, s;
|
|
@@ -508,17 +508,17 @@ function me(e, n) {
|
|
|
508
508
|
}
|
|
509
509
|
return t;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
return
|
|
511
|
+
function R() {
|
|
512
|
+
return R = Object.assign ? Object.assign.bind() : function(e) {
|
|
513
513
|
for (var n = 1; n < arguments.length; n++) {
|
|
514
514
|
var t = arguments[n];
|
|
515
515
|
for (var r in t)
|
|
516
516
|
Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
|
|
517
517
|
}
|
|
518
518
|
return e;
|
|
519
|
-
},
|
|
519
|
+
}, R.apply(this, arguments);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function Y(e, n) {
|
|
522
522
|
var t = Object.keys(e);
|
|
523
523
|
if (Object.getOwnPropertySymbols) {
|
|
524
524
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -528,12 +528,12 @@ function q(e, n) {
|
|
|
528
528
|
}
|
|
529
529
|
return t;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function B(e) {
|
|
532
532
|
for (var n = 1; n < arguments.length; n++) {
|
|
533
533
|
var t = arguments[n] != null ? arguments[n] : {};
|
|
534
|
-
n % 2 ?
|
|
534
|
+
n % 2 ? Y(Object(t), !0).forEach(function(r) {
|
|
535
535
|
he(e, r, t[r]);
|
|
536
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) :
|
|
536
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Y(Object(t)).forEach(function(r) {
|
|
537
537
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
538
538
|
});
|
|
539
539
|
}
|
|
@@ -557,13 +557,13 @@ function we(e, n) {
|
|
|
557
557
|
return (n === "string" ? String : Number)(e);
|
|
558
558
|
}
|
|
559
559
|
function te(e) {
|
|
560
|
-
return e && e.map((n, t) => /* @__PURE__ */
|
|
560
|
+
return e && e.map((n, t) => /* @__PURE__ */ I.createElement(n.tag, B({
|
|
561
561
|
key: t
|
|
562
562
|
}, n.attr), te(n.child)));
|
|
563
563
|
}
|
|
564
564
|
function re(e) {
|
|
565
|
-
return (n) => /* @__PURE__ */
|
|
566
|
-
attr:
|
|
565
|
+
return (n) => /* @__PURE__ */ I.createElement(ve, R({
|
|
566
|
+
attr: B({}, e.attr)
|
|
567
567
|
}, n), te(e.child));
|
|
568
568
|
}
|
|
569
569
|
function ve(e) {
|
|
@@ -573,21 +573,21 @@ function ve(e) {
|
|
|
573
573
|
size: s,
|
|
574
574
|
title: f
|
|
575
575
|
} = e, p = xe(e, be), d = s || t.size || "1em", a;
|
|
576
|
-
return t.className && (a = t.className), e.className && (a = (a ? a + " " : "") + e.className), /* @__PURE__ */
|
|
576
|
+
return t.className && (a = t.className), e.className && (a = (a ? a + " " : "") + e.className), /* @__PURE__ */ I.createElement("svg", R({
|
|
577
577
|
stroke: "currentColor",
|
|
578
578
|
fill: "currentColor",
|
|
579
579
|
strokeWidth: "0"
|
|
580
580
|
}, t.attr, r, p, {
|
|
581
581
|
className: a,
|
|
582
|
-
style:
|
|
582
|
+
style: B(B({
|
|
583
583
|
color: e.color || t.color
|
|
584
584
|
}, t.style), e.style),
|
|
585
585
|
height: d,
|
|
586
586
|
width: d,
|
|
587
587
|
xmlns: "http://www.w3.org/2000/svg"
|
|
588
|
-
}), f && /* @__PURE__ */
|
|
588
|
+
}), f && /* @__PURE__ */ I.createElement("title", null, f), e.children);
|
|
589
589
|
};
|
|
590
|
-
return
|
|
590
|
+
return X !== void 0 ? /* @__PURE__ */ I.createElement(X.Consumer, null, (t) => n(t)) : n(ee);
|
|
591
591
|
}
|
|
592
592
|
function Ce(e) {
|
|
593
593
|
return re({ 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: [] }] })(e);
|
|
@@ -602,7 +602,7 @@ const Ae = ({
|
|
|
602
602
|
renderTitle: p,
|
|
603
603
|
renderContent: d
|
|
604
604
|
}) => {
|
|
605
|
-
const [a, u] =
|
|
605
|
+
const [a, u] = E(/* @__PURE__ */ new Set()), o = _(() => s ? new Set(s) : a, [s, a]), l = L(
|
|
606
606
|
(i) => {
|
|
607
607
|
const c = new Set(o);
|
|
608
608
|
c.has(i) ? c.delete(i) : (n || c.clear(), c.add(i)), s && f ? f(Array.from(c)) : u(c);
|
|
@@ -666,17 +666,35 @@ function Me({
|
|
|
666
666
|
onClose: p,
|
|
667
667
|
disableEscapeClose: d = !1
|
|
668
668
|
}) {
|
|
669
|
-
const a = ae(), u = oe(), o = !r && !!a && !!u, [l, i] =
|
|
669
|
+
const a = ae(), u = oe(), o = !r && !!a && !!u, [l, i] = E(!1), c = o ? a.isOpen(e) : l, b = o ? a.getModalData(e) : null, x = L(() => {
|
|
670
670
|
o ? u.closeModal(e) : i(!1), p == null || p();
|
|
671
671
|
}, [o, u, e, p]);
|
|
672
|
-
return
|
|
673
|
-
const
|
|
674
|
-
|
|
672
|
+
return M(() => {
|
|
673
|
+
const y = (h) => {
|
|
674
|
+
if (h.key === "Escape" && !d && x(), h.key === "Tab") {
|
|
675
|
+
const S = document.getElementById(e);
|
|
676
|
+
if (!S) return;
|
|
677
|
+
const O = [
|
|
678
|
+
"a[href]",
|
|
679
|
+
"button:not([disabled])",
|
|
680
|
+
"textarea:not([disabled])",
|
|
681
|
+
"input:not([disabled])",
|
|
682
|
+
"select:not([disabled])",
|
|
683
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
684
|
+
], $ = S.querySelectorAll(
|
|
685
|
+
O.join(", ")
|
|
686
|
+
), w = Array.from($).filter(
|
|
687
|
+
(z) => z.offsetParent !== null
|
|
688
|
+
);
|
|
689
|
+
if (w.length === 0) return;
|
|
690
|
+
const v = w[0], j = w[w.length - 1];
|
|
691
|
+
h.shiftKey ? document.activeElement === v && (h.preventDefault(), j.focus()) : document.activeElement === j && (h.preventDefault(), v.focus());
|
|
692
|
+
}
|
|
675
693
|
};
|
|
676
|
-
return c ? (document.body.style.overflow = "hidden", window.addEventListener("keydown",
|
|
677
|
-
document.body.style.overflow = "", window.removeEventListener("keydown",
|
|
694
|
+
return c ? (document.body.style.overflow = "hidden", window.addEventListener("keydown", y)) : document.body.style.overflow = "", () => {
|
|
695
|
+
document.body.style.overflow = "", window.removeEventListener("keydown", y);
|
|
678
696
|
};
|
|
679
|
-
}, [c, d, x]), c ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ m(
|
|
697
|
+
}, [c, d, x, e]), c ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ m(
|
|
680
698
|
"div",
|
|
681
699
|
{
|
|
682
700
|
className: `bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${f}`,
|
|
@@ -701,20 +719,20 @@ function Me({
|
|
|
701
719
|
function De({
|
|
702
720
|
children: e
|
|
703
721
|
}) {
|
|
704
|
-
const [n, t] =
|
|
722
|
+
const [n, t] = E({}), [r, s] = E({}), f = L((l, i) => {
|
|
705
723
|
t((c) => ({ ...c, [l]: !0 })), i && s((c) => ({ ...c, [l]: i }));
|
|
706
|
-
}, []), p =
|
|
724
|
+
}, []), p = L((l) => {
|
|
707
725
|
t((i) => ({ ...i, [l]: !1 })), s((i) => {
|
|
708
726
|
const c = { ...i };
|
|
709
727
|
return delete c[l], c;
|
|
710
728
|
});
|
|
711
|
-
}, []), d =
|
|
729
|
+
}, []), d = L((l) => !!n[l], [n]), a = L(
|
|
712
730
|
(l) => r[l],
|
|
713
731
|
[r]
|
|
714
|
-
), u =
|
|
732
|
+
), u = _(
|
|
715
733
|
() => ({ openModal: f, closeModal: p }),
|
|
716
734
|
[f, p]
|
|
717
|
-
), o =
|
|
735
|
+
), o = _(
|
|
718
736
|
() => ({ isOpen: d, getModalData: a }),
|
|
719
737
|
[d, a]
|
|
720
738
|
);
|
|
@@ -729,18 +747,18 @@ function Te(e) {
|
|
|
729
747
|
data: s(e)
|
|
730
748
|
};
|
|
731
749
|
}
|
|
732
|
-
let
|
|
750
|
+
let U = null, q = {};
|
|
733
751
|
function Se(e) {
|
|
734
|
-
|
|
752
|
+
U = e;
|
|
735
753
|
}
|
|
736
754
|
function _e(e) {
|
|
737
|
-
|
|
755
|
+
q = { ...q, ...e };
|
|
738
756
|
}
|
|
739
757
|
function Ne() {
|
|
740
|
-
return
|
|
758
|
+
return q;
|
|
741
759
|
}
|
|
742
760
|
function Re(e, n, t = 3e3, r) {
|
|
743
|
-
|
|
761
|
+
U ? U(e, n, t, r) : console.warn("Toast system is not mounted");
|
|
744
762
|
}
|
|
745
763
|
function ke(e) {
|
|
746
764
|
return re({ 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);
|
|
@@ -749,8 +767,8 @@ const Le = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
749
767
|
const n = Math.random() * 16 | 0;
|
|
750
768
|
return (e === "x" ? n : n & 3 | 8).toString(16);
|
|
751
769
|
}), Be = () => {
|
|
752
|
-
const [e, n] =
|
|
753
|
-
|
|
770
|
+
const [e, n] = E([]);
|
|
771
|
+
M(() => {
|
|
754
772
|
Se((r, s, f, p) => {
|
|
755
773
|
const d = Le();
|
|
756
774
|
n((a) => [...a, { id: d, type: r, message: s, config: p }]), setTimeout(() => {
|
|
@@ -760,8 +778,8 @@ const Le = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
760
778
|
}, []);
|
|
761
779
|
const t = Ne();
|
|
762
780
|
return /* @__PURE__ */ g("div", { className: "fixed top-5 right-5 z-[9999] flex flex-col gap-2", children: e.map((r) => {
|
|
763
|
-
var a, u, o, l, i, c, b, x, h,
|
|
764
|
-
const s = ((a = r.config) == null ? void 0 : a.icon) || ((u = t.icons) == null ? void 0 : u[r.type]) ||
|
|
781
|
+
var a, u, o, l, i, c, b, x, y, h, S, O, $;
|
|
782
|
+
const s = ((a = r.config) == null ? void 0 : a.icon) || ((u = t.icons) == null ? void 0 : u[r.type]) || Ee(r.type), f = ((o = r.config) == null ? void 0 : o.bgColor) || ((i = (l = t.colors) == null ? void 0 : l[r.type]) == null ? void 0 : i.bg) || "bg-white dark:bg-gray-800", p = ((c = r.config) == null ? void 0 : c.textColor) || ((x = (b = t.colors) == null ? void 0 : b[r.type]) == null ? void 0 : x.text) || "text-gray-700 dark:text-gray-300", d = ((y = r.config) == null ? void 0 : y.iconContainerClass) || "w-8 h-8 mr-3 text-xl flex items-center justify-center";
|
|
765
783
|
return /* @__PURE__ */ m(
|
|
766
784
|
"div",
|
|
767
785
|
{
|
|
@@ -769,14 +787,14 @@ const Le = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
769
787
|
children: [
|
|
770
788
|
/* @__PURE__ */ g("div", { className: d, children: s }),
|
|
771
789
|
/* @__PURE__ */ m("div", { className: "flex-1 me-3", children: [
|
|
772
|
-
((
|
|
773
|
-
((
|
|
774
|
-
!((
|
|
790
|
+
((h = r.config) == null ? void 0 : h.title) && /* @__PURE__ */ g("div", { className: "font-semibold text-black", children: r.config.title }),
|
|
791
|
+
((S = r.config) == null ? void 0 : S.description) && /* @__PURE__ */ g("div", { className: "text-sm text-gray-500", children: r.config.description }),
|
|
792
|
+
!((O = r.config) != null && O.title) && !(($ = r.config) != null && $.description) && /* @__PURE__ */ g("div", { className: "text-sm", children: r.message })
|
|
775
793
|
] }),
|
|
776
794
|
/* @__PURE__ */ g(
|
|
777
795
|
"button",
|
|
778
796
|
{
|
|
779
|
-
onClick: () => n((
|
|
797
|
+
onClick: () => n((w) => w.filter((v) => v.id !== r.id)),
|
|
780
798
|
className: "ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white",
|
|
781
799
|
"aria-label": "Close",
|
|
782
800
|
children: /* @__PURE__ */ g(ke, { size: 18 })
|
|
@@ -788,7 +806,7 @@ const Le = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
788
806
|
);
|
|
789
807
|
}) });
|
|
790
808
|
};
|
|
791
|
-
function
|
|
809
|
+
function Ee(e) {
|
|
792
810
|
switch (e) {
|
|
793
811
|
case "success":
|
|
794
812
|
return "✅";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(x,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):(x=typeof globalThis<"u"?globalThis:x||self,o(x.TailwindUiKit={},x.jsxRuntime,x.React))})(this,function(x,o,s){"use strict";"use client";const
|
|
1
|
+
(function(x,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):(x=typeof globalThis<"u"?globalThis:x||self,o(x.TailwindUiKit={},x.jsxRuntime,x.React))})(this,function(x,o,s){"use strict";"use client";const U=s.forwardRef((e,n)=>{const{label:t,id:r,inputSize:l="md",shape:b="rounded",validate:p,onValidatedChange:f,className:i="",icon:g,iconPosition:a="left",floatingLabelStyle:c,onChange:d,isValid:u,isInvalid:h,feedback:y,feedbackType:w="invalid",...m}=e,[N,L]=s.useState("default"),O=S=>{const E=S.target.value,$=(p==null?void 0:p(E))??"default";L($),f==null||f(S,$),d==null||d(S)},v={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"},C={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},j={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"},P={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"},F=(S,E,$)=>{if($)return"border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";if(E)return"border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";switch(S){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"}},Z=v[l]||v.md,G=C[b]||C.flat,q=F(N,u,h),H=a==="start"||a==="left"?"left-0 ps-3.5":"right-0 pe-3.5",K=g&&(a==="start"||a==="left")?"ps-10":g?"pe-10":"",M=r??`input-${(t==null?void 0:t.toLowerCase().replace(/\s+/g,"-"))||Math.random().toString(36).slice(2)}`,k=!!c;return o.jsxs("div",{className:`w-full relative ${k?"z-0":""}`,children:[!k&&t&&o.jsx("label",{htmlFor:M,className:`block mb-1 text-sm ${u?"text-green-700 dark:text-green-500":h?"text-red-700 dark:text-red-500":"text-gray-700"}`,children:t}),o.jsxs("div",{className:"relative w-full",children:[g&&o.jsx("div",{className:`absolute inset-y-0 flex items-center ${H}`,children:o.jsx("span",{className:"text-gray-500",children:g})}),o.jsx("input",{...m,id:M,ref:n,placeholder:k?" ":m.placeholder,onChange:O,className:`border peer w-full block font-normal appearance-none focus:outline-none focus:ring-0 transition text-gray-900 placeholder-gray-600 border-gray-400
|
|
2
2
|
${Z}
|
|
3
|
-
${
|
|
4
|
-
${
|
|
3
|
+
${k&&c&&j[c]}
|
|
4
|
+
${K} ${G} ${q} ${i}`}),k&&t&&c&&o.jsx("label",{htmlFor:M,className:`ms-1 ${P[c]} ${i}`,children:t})]}),y&&o.jsx("p",{className:`mt-1 text-xs ${w==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,children:y})]})});U.displayName="Input";const W=s.forwardRef((e,n)=>{const{label:t,id:r,inputSize:l="md",shape:b="rounded",validate:p,onValidatedChange:f,className:i="",icon:g,iconPosition:a="left",floatingLabelStyle:c,onChange:d,isValid:u,isInvalid:h,feedback:y,feedbackType:w="invalid",children:m,...N}=e,[L,O]=s.useState("default"),v=E=>{const $=E.target.value,A=(p==null?void 0:p($))??"default";O(A),f==null||f(E,A),d==null||d(E)},C={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"},j={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full"},P={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"},F={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"},Z=(E,$,A)=>{if(A)return"border-red-500 bg-red-50 text-red-900 focus:ring-red-500 focus:border-red-500";if($)return"border-green-500 bg-green-50 text-green-900 focus:ring-green-500 focus:border-green-500";switch(E){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"}},G=C[l]||C.md,q=j[b]||j.flat,H=Z(L,u,h),K=a==="start"||a==="left"?"left-0 ps-3.5":"right-0 pe-3.5",M=g&&(a==="start"||a==="left")?"ps-10":g?"pe-10":"",k=r??`select-${(t==null?void 0:t.toLowerCase().replace(/\s+/g,"-"))||Math.random().toString(36).slice(2)}`,S=!!c;return o.jsxs("div",{className:`w-full relative ${S?"z-0":""}`,children:[!S&&t&&o.jsx("label",{htmlFor:k,className:`block mb-1 text-sm ${u?"text-green-700":h?"text-red-700":"text-gray-700"}`,children:t}),o.jsxs("div",{className:"relative w-full",children:[g&&o.jsx("div",{className:`absolute inset-y-0 flex items-center ${K}`,children:o.jsx("span",{className:"text-gray-500",children:g})}),o.jsx("select",{...N,id:k,ref:n,onChange:v,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
|
|
5
5
|
${G}
|
|
6
|
-
${
|
|
7
|
-
${
|
|
6
|
+
${S&&c&&P[c]}
|
|
7
|
+
${M} ${q} ${H} ${i}`,children:m}),S&&t&&c&&o.jsx("label",{htmlFor:k,className:`ms-1 ${F[c]} ${i}`,children:t})]}),y&&o.jsx("p",{className:`mt-1 text-xs ${w==="invalid"?"text-red-600":"text-green-600"}`,children:y})]})});W.displayName="Select";const te={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"},re={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"},ne={flat:"shadow-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},oe=({children:e,variant:n="primary",size:t="md",type:r="button",shape:l="rounded",className:b="",isLoading:p=!1,disabled:f=!1,...i})=>{const g=f||p,a=["inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",te[n],re[t],ne[l],l==="flat"?"shadow-none":"shadow-sm",g?"opacity-50 cursor-not-allowed pointer-events-none":"",b].filter(Boolean).join(" ");return o.jsxs("button",{type:r,className:a,disabled:g,...i,children:[p&&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]})},se=({label:e,children:n,position:t="right"})=>{const[r,l]=s.useState(!1),[b,p]=s.useState(!1),f=s.useRef(null),i=s.useRef(null),g=s.useMemo(()=>{switch(t){case"left":return"left-0";case"center":return"left-1/2 transform -translate-x-1/2";case"right":default:return"right-0"}},[t]),a=s.useCallback(u=>{const h=u.target;f.current&&!f.current.contains(h)&&i.current&&!i.current.contains(h)&&l(!1)},[]),c=s.useCallback(()=>{if(!i.current||!f.current)return;const u=i.current.getBoundingClientRect(),h=f.current.getBoundingClientRect(),y=window.innerHeight-u.bottom,w=u.top;p(y<h.height&&w>h.height)},[]);s.useEffect(()=>{if(r)return c(),window.addEventListener("resize",c),window.addEventListener("scroll",c,!0),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c,!0)}},[r,c]),s.useEffect(()=>(document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)),[a]);const d=s.useCallback(()=>l(u=>!u),[]);return o.jsxs("div",{className:"relative flex items-center",children:[o.jsx("button",{ref:i,onClick:d,children:e}),r&&o.jsx("div",{ref:f,className:`absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
|
|
8
8
|
${b?"bottom-full mb-2":"top-full mt-2"}
|
|
9
|
-
${f}`,children:n})]})},ae=({children:e,content:n,position:t="top",className:r="",tooltipClass:l="",tooltipStyle:b={}})=>{const p=s.useRef(null),g=s.useRef(null);s.useEffect(()=>{const f=p.current,a=g.current;if(!f||!a)return;const c=()=>{a.style.opacity="1",a.style.visibility="visible"},d=()=>{a.style.opacity="0",a.style.visibility="hidden"};return f.addEventListener("mouseenter",c),f.addEventListener("mouseleave",d),()=>{f.removeEventListener("mouseenter",c),f.removeEventListener("mouseleave",d)}},[]);const i=f=>{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(f){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 o.jsxs("div",{ref:p,className:`relative inline-block ${r}`,children:[e,o.jsx("div",{ref:g,role:"tooltip",className:l,style:{...i(t),...b},children:n})]})},le={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"},ie={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"},ce={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},de=({label:e,variant:n="primary",size:t="sm",shape:r="rounded",icon:l,dismissible:b,onDismiss:p,className:g="",...i})=>{const f=!e&&!!l,a=`inline-flex items-center font-medium ${le[n]||""} ${ie[t]||""} ${ce[r]||""} ${f?"justify-center p-2 w-8 h-8":""} `+g;return o.jsxs("span",{className:a.trim(),...i,children:[l&&o.jsx("span",{className:e?"mr-1":"",children:l}),e,b&&o.jsx("button",{type:"button",onClick:p,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})};var X={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Y=s.createContext&&s.createContext(X),ue=["attr","size","title"];function ge(e,n){if(e==null)return{};var t=fe(e,n),r,l;if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(l=0;l<b.length;l++)r=b[l],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}function fe(e,n){if(e==null)return{};var t={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(n.indexOf(r)>=0)continue;t[r]=e[r]}return t}function P(){return P=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},P.apply(this,arguments)}function J(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),t.push.apply(t,r)}return t}function M(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?J(Object(t),!0).forEach(function(r){pe(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function pe(e,n,t){return n=be(n),n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function be(e){var n=xe(e,"string");return typeof n=="symbol"?n:n+""}function xe(e,n){if(typeof e!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var r=t.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Q(e){return e&&e.map((n,t)=>s.createElement(n.tag,M({key:t},n.attr),Q(n.child)))}function V(e){return n=>s.createElement(he,P({attr:M({},e.attr)},n),Q(e.child))}function he(e){var n=t=>{var{attr:r,size:l,title:b}=e,p=ge(e,ue),g=l||t.size||"1em",i;return t.className&&(i=t.className),e.className&&(i=(i?i+" ":"")+e.className),s.createElement("svg",P({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,p,{className:i,style:M(M({color:e.color||t.color},t.style),e.style),height:g,width:g,xmlns:"http://www.w3.org/2000/svg"}),b&&s.createElement("title",null,b),e.children)};return Y!==void 0?s.createElement(Y.Consumer,null,t=>n(t)):n(X)}function ye(e){return V({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:[]}]})(e)}const me=({items:e,allowMultipleOpen:n=!1,className:t="",tileClasses:r="",open:l,onChange:b,renderTitle:p,renderContent:g})=>{const[i,f]=s.useState(new Set),a=s.useMemo(()=>l?new Set(l):i,[l,i]),c=s.useCallback(d=>{const u=new Set(a);u.has(d)?u.delete(d):(n||u.clear(),u.add(d)),l&&b?b(Array.from(u)):f(u)},[a,l,b,n]);return o.jsx("div",{className:"accordion",role:"region","aria-multiselectable":n,children:e.map(d=>{const u=a.has(d.id),h=`accordion-heading-${d.id}`,y=`accordion-panel-${d.id}`;return o.jsxs("div",{className:`accordion-item border rounded border-gray-300 dark:border-gray-700 ${t}`,children:[o.jsxs("button",{id:h,type:"button","aria-expanded":u,"aria-controls":y,onClick:()=>c(d.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 ${r}`,children:[p?p(d,u):d.title,o.jsx(ye,{})]}),o.jsx("div",{id:y,role:"region","aria-labelledby":h,hidden:!u,className:"p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400",children:g?g(d,u):d.content})]},d.id)})})},R=s.createContext(null),z=()=>s.useContext(R),ee=s.createContext(null),A=()=>s.useContext(ee);function we({id:e,title:n,children:t,standalone:r=!1,showFloatingClose:l=!1,containerClasses:b="",onClose:p,disableEscapeClose:g=!1}){const i=A(),f=z(),a=!r&&!!i&&!!f,[c,d]=s.useState(!1),u=a?i.isOpen(e):c,h=a?i.getModalData(e):null,y=s.useCallback(()=>{a?f.closeModal(e):d(!1),p==null||p()},[a,f,e,p]);return s.useEffect(()=>{const m=v=>{v.key==="Escape"&&!g&&y()};return u?(document.body.style.overflow="hidden",window.addEventListener("keydown",m)):document.body.style.overflow="",()=>{document.body.style.overflow="",window.removeEventListener("keydown",m)}},[u,g,y]),u?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-4 transform transition-all duration-300 scale-100 ${b}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),l&&o.jsx("button",{onClick:y,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:"✕"})]}),o.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof t=="function"?t({modalData:h}):t})]})}):null}function ve({children:e}){const[n,t]=s.useState({}),[r,l]=s.useState({}),b=s.useCallback((c,d)=>{t(u=>({...u,[c]:!0})),d&&l(u=>({...u,[c]:d}))},[]),p=s.useCallback(c=>{t(d=>({...d,[c]:!1})),l(d=>{const u={...d};return delete u[c],u})},[]),g=s.useCallback(c=>!!n[c],[n]),i=s.useCallback(c=>r[c],[r]),f=s.useMemo(()=>({openModal:b,closeModal:p}),[b,p]),a=s.useMemo(()=>({isOpen:g,getModalData:i}),[g,i]);return o.jsx(R.Provider,{value:f,children:o.jsx(ee.Provider,{value:a,children:e})})}function Ce(e){const{openModal:n,closeModal:t}=z(),{isOpen:r,getModalData:l}=A();return{open:b=>n(e,b),close:()=>t(e),isOpen:r(e),data:l(e)}}let D=null,_={};function Se(e){D=e}function Ne(e){_={..._,...e}}function ke(){return _}function Le(e,n,t=3e3,r){D?D(e,n,t,r):console.warn("Toast system is not mounted")}function Oe(e){return V({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 $e=()=>"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)}),Ee=()=>{const[e,n]=s.useState([]);s.useEffect(()=>{Se((r,l,b,p)=>{const g=$e();n(i=>[...i,{id:g,type:r,message:l,config:p}]),setTimeout(()=>{n(i=>i.filter(f=>f.id!==g))},b)})},[]);const t=ke();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(r=>{var i,f,a,c,d,u,h,y,m,v,L,O,$;const l=((i=r.config)==null?void 0:i.icon)||((f=t.icons)==null?void 0:f[r.type])||je(r.type),b=((a=r.config)==null?void 0:a.bgColor)||((d=(c=t.colors)==null?void 0:c[r.type])==null?void 0:d.bg)||"bg-white dark:bg-gray-800",p=((u=r.config)==null?void 0:u.textColor)||((y=(h=t.colors)==null?void 0:h[r.type])==null?void 0:y.text)||"text-gray-700 dark:text-gray-300",g=((m=r.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 ${b} ${p}`,children:[o.jsx("div",{className:g,children:l}),o.jsxs("div",{className:"flex-1 me-3",children:[((v=r.config)==null?void 0:v.title)&&o.jsx("div",{className:"font-semibold text-black",children:r.config.title}),((L=r.config)==null?void 0:L.description)&&o.jsx("div",{className:"text-sm text-gray-500",children:r.config.description}),!((O=r.config)!=null&&O.title)&&!(($=r.config)!=null&&$.description)&&o.jsx("div",{className:"text-sm",children:r.message})]}),o.jsx("button",{onClick:()=>n(E=>E.filter(k=>k.id!==r.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(Oe,{size:18})})]},r.id)})})};function je(e){switch(e){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}x.Accordion=me,x.Badge=de,x.Button=oe,x.Dropdown=se,x.Input=q,x.Modal=we,x.ModalProvider=ve,x.Select=K,x.Toast=Ee,x.Tooltip=ae,x.setToastDefaults=Ne,x.showToast=Le,x.useModalActions=z,x.useModalInstance=Ce,x.useModalState=A,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
${g}`,children:n})]})},ae=({children:e,content:n,position:t="top",className:r="",tooltipClass:l="",tooltipStyle:b={}})=>{const p=s.useRef(null),f=s.useRef(null);s.useEffect(()=>{const g=p.current,a=f.current;if(!g||!a)return;const c=()=>{a.style.opacity="1",a.style.visibility="visible"},d=()=>{a.style.opacity="0",a.style.visibility="hidden"};return g.addEventListener("mouseenter",c),g.addEventListener("mouseleave",d),()=>{g.removeEventListener("mouseenter",c),g.removeEventListener("mouseleave",d)}},[]);const i=g=>{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(g){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 o.jsxs("div",{ref:p,className:`relative inline-block ${r}`,children:[e,o.jsx("div",{ref:f,role:"tooltip",className:l,style:{...i(t),...b},children:n})]})},le={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"},ie={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"},ce={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},de=({label:e,variant:n="primary",size:t="sm",shape:r="rounded",icon:l,dismissible:b,onDismiss:p,className:f="",...i})=>{const g=!e&&!!l,a=`inline-flex items-center font-medium ${le[n]||""} ${ie[t]||""} ${ce[r]||""} ${g?"justify-center p-2 w-8 h-8":""} `+f;return o.jsxs("span",{className:a.trim(),...i,children:[l&&o.jsx("span",{className:e?"mr-1":"",children:l}),e,b&&o.jsx("button",{type:"button",onClick:p,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})};var X={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Y=s.createContext&&s.createContext(X),ue=["attr","size","title"];function fe(e,n){if(e==null)return{};var t=ge(e,n),r,l;if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(l=0;l<b.length;l++)r=b[l],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}function ge(e,n){if(e==null)return{};var t={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(n.indexOf(r)>=0)continue;t[r]=e[r]}return t}function I(){return I=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},I.apply(this,arguments)}function J(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),t.push.apply(t,r)}return t}function T(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?J(Object(t),!0).forEach(function(r){pe(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function pe(e,n,t){return n=be(n),n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function be(e){var n=xe(e,"string");return typeof n=="symbol"?n:n+""}function xe(e,n){if(typeof e!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var r=t.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Q(e){return e&&e.map((n,t)=>s.createElement(n.tag,T({key:t},n.attr),Q(n.child)))}function V(e){return n=>s.createElement(he,I({attr:T({},e.attr)},n),Q(e.child))}function he(e){var n=t=>{var{attr:r,size:l,title:b}=e,p=fe(e,ue),f=l||t.size||"1em",i;return t.className&&(i=t.className),e.className&&(i=(i?i+" ":"")+e.className),s.createElement("svg",I({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,p,{className:i,style:T(T({color:e.color||t.color},t.style),e.style),height:f,width:f,xmlns:"http://www.w3.org/2000/svg"}),b&&s.createElement("title",null,b),e.children)};return Y!==void 0?s.createElement(Y.Consumer,null,t=>n(t)):n(X)}function ye(e){return V({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:[]}]})(e)}const me=({items:e,allowMultipleOpen:n=!1,className:t="",tileClasses:r="",open:l,onChange:b,renderTitle:p,renderContent:f})=>{const[i,g]=s.useState(new Set),a=s.useMemo(()=>l?new Set(l):i,[l,i]),c=s.useCallback(d=>{const u=new Set(a);u.has(d)?u.delete(d):(n||u.clear(),u.add(d)),l&&b?b(Array.from(u)):g(u)},[a,l,b,n]);return o.jsx("div",{className:"accordion",role:"region","aria-multiselectable":n,children:e.map(d=>{const u=a.has(d.id),h=`accordion-heading-${d.id}`,y=`accordion-panel-${d.id}`;return o.jsxs("div",{className:`accordion-item border rounded border-gray-300 dark:border-gray-700 ${t}`,children:[o.jsxs("button",{id:h,type:"button","aria-expanded":u,"aria-controls":y,onClick:()=>c(d.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 ${r}`,children:[p?p(d,u):d.title,o.jsx(ye,{})]}),o.jsx("div",{id:y,role:"region","aria-labelledby":h,hidden:!u,className:"p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400",children:f?f(d,u):d.content})]},d.id)})})},R=s.createContext(null),z=()=>s.useContext(R),ee=s.createContext(null),D=()=>s.useContext(ee);function we({id:e,title:n,children:t,standalone:r=!1,showFloatingClose:l=!1,containerClasses:b="",onClose:p,disableEscapeClose:f=!1}){const i=D(),g=z(),a=!r&&!!i&&!!g,[c,d]=s.useState(!1),u=a?i.isOpen(e):c,h=a?i.getModalData(e):null,y=s.useCallback(()=>{a?g.closeModal(e):d(!1),p==null||p()},[a,g,e,p]);return s.useEffect(()=>{const w=m=>{if(m.key==="Escape"&&!f&&y(),m.key==="Tab"){const N=document.getElementById(e);if(!N)return;const L=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'],O=N.querySelectorAll(L.join(", ")),v=Array.from(O).filter(P=>P.offsetParent!==null);if(v.length===0)return;const C=v[0],j=v[v.length-1];m.shiftKey?document.activeElement===C&&(m.preventDefault(),j.focus()):document.activeElement===j&&(m.preventDefault(),C.focus())}};return u?(document.body.style.overflow="hidden",window.addEventListener("keydown",w)):document.body.style.overflow="",()=>{document.body.style.overflow="",window.removeEventListener("keydown",w)}},[u,f,y,e]),u?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-4 transform transition-all duration-300 scale-100 ${b}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),l&&o.jsx("button",{onClick:y,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:"✕"})]}),o.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof t=="function"?t({modalData:h}):t})]})}):null}function ve({children:e}){const[n,t]=s.useState({}),[r,l]=s.useState({}),b=s.useCallback((c,d)=>{t(u=>({...u,[c]:!0})),d&&l(u=>({...u,[c]:d}))},[]),p=s.useCallback(c=>{t(d=>({...d,[c]:!1})),l(d=>{const u={...d};return delete u[c],u})},[]),f=s.useCallback(c=>!!n[c],[n]),i=s.useCallback(c=>r[c],[r]),g=s.useMemo(()=>({openModal:b,closeModal:p}),[b,p]),a=s.useMemo(()=>({isOpen:f,getModalData:i}),[f,i]);return o.jsx(R.Provider,{value:g,children:o.jsx(ee.Provider,{value:a,children:e})})}function Ce(e){const{openModal:n,closeModal:t}=z(),{isOpen:r,getModalData:l}=D();return{open:b=>n(e,b),close:()=>t(e),isOpen:r(e),data:l(e)}}let _=null,B={};function Se(e){_=e}function Ne(e){B={...B,...e}}function ke(){return B}function Ee(e,n,t=3e3,r){_?_(e,n,t,r):console.warn("Toast system is not mounted")}function Le(e){return V({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 Oe=()=>"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)}),$e=()=>{const[e,n]=s.useState([]);s.useEffect(()=>{Se((r,l,b,p)=>{const f=Oe();n(i=>[...i,{id:f,type:r,message:l,config:p}]),setTimeout(()=>{n(i=>i.filter(g=>g.id!==f))},b)})},[]);const t=ke();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(r=>{var i,g,a,c,d,u,h,y,w,m,N,L,O;const l=((i=r.config)==null?void 0:i.icon)||((g=t.icons)==null?void 0:g[r.type])||je(r.type),b=((a=r.config)==null?void 0:a.bgColor)||((d=(c=t.colors)==null?void 0:c[r.type])==null?void 0:d.bg)||"bg-white dark:bg-gray-800",p=((u=r.config)==null?void 0:u.textColor)||((y=(h=t.colors)==null?void 0:h[r.type])==null?void 0:y.text)||"text-gray-700 dark:text-gray-300",f=((w=r.config)==null?void 0:w.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 ${b} ${p}`,children:[o.jsx("div",{className:f,children:l}),o.jsxs("div",{className:"flex-1 me-3",children:[((m=r.config)==null?void 0:m.title)&&o.jsx("div",{className:"font-semibold text-black",children:r.config.title}),((N=r.config)==null?void 0:N.description)&&o.jsx("div",{className:"text-sm text-gray-500",children:r.config.description}),!((L=r.config)!=null&&L.title)&&!((O=r.config)!=null&&O.description)&&o.jsx("div",{className:"text-sm",children:r.message})]}),o.jsx("button",{onClick:()=>n(v=>v.filter(C=>C.id!==r.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(Le,{size:18})})]},r.id)})})};function je(e){switch(e){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}x.Accordion=me,x.Badge=de,x.Button=oe,x.Dropdown=se,x.Input=U,x.Modal=we,x.ModalProvider=ve,x.Select=W,x.Toast=$e,x.Tooltip=ae,x.setToastDefaults=Ne,x.showToast=Ee,x.useModalActions=z,x.useModalInstance=Ce,x.useModalState=D,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|