tailwind-ux-kit 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/ToolTip.d.ts +12 -0
- package/lib/index.d.ts +1 -0
- package/lib/tailwind-ux-kit.es.js +253 -160
- package/lib/tailwind-ux-kit.umd.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React, ReactNode, CSSProperties } from 'react';
|
|
2
|
+
type TooltipPosition = "top" | "bottom" | "left" | "right";
|
|
3
|
+
interface TooltipProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
position?: TooltipPosition;
|
|
7
|
+
className?: string;
|
|
8
|
+
tooltipClass?: string;
|
|
9
|
+
tooltipStyle?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
12
|
+
export default Tooltip;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Input } from './components/Input';
|
|
2
2
|
export { default as Button } from './components/Button';
|
|
3
3
|
export { default as Dropdown } from './components/Dropdown';
|
|
4
|
+
export { default as Tooltip } from './components/ToolTip';
|
|
4
5
|
export { default as Modal } from './components/modal/Modal';
|
|
5
6
|
export { default as ModalProvider } from './components/modal/ModalProvider';
|
|
6
7
|
export * from './components/modal/ModalContext';
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import h, { forwardRef as
|
|
4
|
-
const re =
|
|
2
|
+
import { jsxs as m, jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import h, { forwardRef as Q, useState as w, useRef as M, useMemo as V, useCallback as v, useEffect as S, createContext as ee, useContext as te } from "react";
|
|
4
|
+
const re = Q((e, n) => {
|
|
5
5
|
const {
|
|
6
6
|
label: r,
|
|
7
7
|
id: t,
|
|
8
|
-
inputSize:
|
|
9
|
-
shape:
|
|
10
|
-
validate:
|
|
8
|
+
inputSize: a = "md",
|
|
9
|
+
shape: u = "rounded",
|
|
10
|
+
validate: i,
|
|
11
11
|
onValidatedChange: o,
|
|
12
|
-
className:
|
|
13
|
-
icon:
|
|
14
|
-
iconPosition:
|
|
15
|
-
floatingLabelStyle:
|
|
16
|
-
onChange:
|
|
17
|
-
isValid:
|
|
12
|
+
className: s = "",
|
|
13
|
+
icon: c,
|
|
14
|
+
iconPosition: l = "left",
|
|
15
|
+
floatingLabelStyle: f,
|
|
16
|
+
onChange: g,
|
|
17
|
+
isValid: p,
|
|
18
18
|
isInvalid: b,
|
|
19
|
-
feedback:
|
|
19
|
+
feedback: x,
|
|
20
20
|
feedbackType: y = "invalid",
|
|
21
21
|
...C
|
|
22
|
-
} = e, [
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
},
|
|
22
|
+
} = e, [L, P] = w("default"), j = (O) => {
|
|
23
|
+
const I = O.target.value, z = (i == null ? void 0 : i(I)) ?? "default";
|
|
24
|
+
P(z), o == null || o(O, z), g == null || g(O);
|
|
25
|
+
}, k = {
|
|
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",
|
|
@@ -31,20 +31,20 @@ const re = X((e, n) => {
|
|
|
31
31
|
flat: "rounded-none",
|
|
32
32
|
rounded: "rounded-md",
|
|
33
33
|
pill: "rounded-full"
|
|
34
|
-
},
|
|
34
|
+
}, G = {
|
|
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
|
+
}, H = {
|
|
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
|
-
},
|
|
43
|
-
if (
|
|
42
|
+
}, X = (O, I, z) => {
|
|
43
|
+
if (z)
|
|
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 (I)
|
|
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 (O) {
|
|
48
48
|
case "error":
|
|
49
49
|
return "border-red-500 bg-red-50 focus:ring-red-500";
|
|
50
50
|
case "warning":
|
|
@@ -54,51 +54,51 @@ const re = X((e, n) => {
|
|
|
54
54
|
default:
|
|
55
55
|
return "border-gray-300 focus:ring-blue-500";
|
|
56
56
|
}
|
|
57
|
-
},
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
!
|
|
57
|
+
}, Y = k[a] || k.md, K = E[u] || E.flat, U = X(L, p, b), q = l === "start" || l === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", J = c && (l === "start" || l === "left") ? "ps-10" : c ? "pe-10" : "", T = t ?? `input-${(r == null ? void 0 : r.toLowerCase().replace(/\s+/g, "-")) || Math.random().toString(36).slice(2)}`, N = !!f;
|
|
58
|
+
return /* @__PURE__ */ m("div", { className: `w-full relative ${N ? "z-0" : ""}`, children: [
|
|
59
|
+
!N && r && /* @__PURE__ */ d(
|
|
60
60
|
"label",
|
|
61
61
|
{
|
|
62
62
|
htmlFor: T,
|
|
63
|
-
className: `block mb-1 font-light text-sm ${
|
|
63
|
+
className: `block mb-1 font-light text-sm ${p ? "text-green-700 dark:text-green-500" : b ? "text-red-700 dark:text-red-500" : "text-gray-700"}`,
|
|
64
64
|
children: r
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
67
|
+
/* @__PURE__ */ m("div", { className: "relative w-full", children: [
|
|
68
|
+
c && /* @__PURE__ */ d(
|
|
69
69
|
"div",
|
|
70
70
|
{
|
|
71
|
-
className: `absolute inset-y-0 flex items-center ${
|
|
72
|
-
children: /* @__PURE__ */
|
|
71
|
+
className: `absolute inset-y-0 flex items-center ${q}`,
|
|
72
|
+
children: /* @__PURE__ */ d("span", { className: "text-gray-500", children: c })
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ d(
|
|
76
76
|
"input",
|
|
77
77
|
{
|
|
78
78
|
...C,
|
|
79
79
|
id: T,
|
|
80
80
|
ref: n,
|
|
81
|
-
placeholder:
|
|
82
|
-
onChange:
|
|
81
|
+
placeholder: N ? " " : C.placeholder,
|
|
82
|
+
onChange: j,
|
|
83
83
|
className: `border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
|
|
84
|
-
${
|
|
85
|
-
${
|
|
84
|
+
${N && f ? G[f] : Y}
|
|
85
|
+
${J} ${K} ${U} ${s}`
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
|
-
|
|
88
|
+
N && r && f && /* @__PURE__ */ d(
|
|
89
89
|
"label",
|
|
90
90
|
{
|
|
91
91
|
htmlFor: T,
|
|
92
|
-
className: `ms-1 ${
|
|
92
|
+
className: `ms-1 ${H[f]} ${s}`,
|
|
93
93
|
children: r
|
|
94
94
|
}
|
|
95
95
|
)
|
|
96
96
|
] }),
|
|
97
|
-
|
|
97
|
+
x && /* @__PURE__ */ d(
|
|
98
98
|
"p",
|
|
99
99
|
{
|
|
100
100
|
className: `mt-1 text-xs ${y === "invalid" ? "text-red-600 dark:text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
101
|
-
children:
|
|
101
|
+
children: x
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
] });
|
|
@@ -128,7 +128,7 @@ const ne = {
|
|
|
128
128
|
md: "px-5 py-2.5 text-sm",
|
|
129
129
|
lg: "px-5 py-3 text-base",
|
|
130
130
|
xl: "px-6 py-3.5 text-base"
|
|
131
|
-
},
|
|
131
|
+
}, se = {
|
|
132
132
|
flat: "shadow-none",
|
|
133
133
|
rounded: "rounded-md",
|
|
134
134
|
pill: "rounded-full",
|
|
@@ -138,23 +138,23 @@ const ne = {
|
|
|
138
138
|
variant: n = "primary",
|
|
139
139
|
size: r = "md",
|
|
140
140
|
type: t = "button",
|
|
141
|
-
shape:
|
|
142
|
-
className:
|
|
143
|
-
isLoading:
|
|
141
|
+
shape: a = "rounded",
|
|
142
|
+
className: u = "",
|
|
143
|
+
isLoading: i = !1,
|
|
144
144
|
disabled: o = !1,
|
|
145
|
-
...
|
|
145
|
+
...s
|
|
146
146
|
}) => {
|
|
147
|
-
const
|
|
147
|
+
const c = o || i, l = [
|
|
148
148
|
"inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",
|
|
149
149
|
ne[n],
|
|
150
150
|
oe[r],
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
se[a],
|
|
152
|
+
a === "flat" ? "shadow-none" : "shadow-sm",
|
|
153
|
+
c ? "opacity-50 cursor-not-allowed pointer-events-none" : "",
|
|
154
|
+
u
|
|
155
155
|
].filter(Boolean).join(" ");
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
|
|
156
|
+
return /* @__PURE__ */ m("button", { type: t, className: l, disabled: c, ...s, children: [
|
|
157
|
+
i && /* @__PURE__ */ m(
|
|
158
158
|
"svg",
|
|
159
159
|
{
|
|
160
160
|
"aria-hidden": "true",
|
|
@@ -164,14 +164,14 @@ const ne = {
|
|
|
164
164
|
fill: "none",
|
|
165
165
|
xmlns: "http://www.w3.org/2000/svg",
|
|
166
166
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ d(
|
|
168
168
|
"path",
|
|
169
169
|
{
|
|
170
170
|
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",
|
|
171
171
|
fill: "currentColor"
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ d(
|
|
175
175
|
"path",
|
|
176
176
|
{
|
|
177
177
|
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",
|
|
@@ -183,12 +183,12 @@ const ne = {
|
|
|
183
183
|
),
|
|
184
184
|
e
|
|
185
185
|
] });
|
|
186
|
-
},
|
|
186
|
+
}, Ne = ({
|
|
187
187
|
label: e,
|
|
188
188
|
children: n,
|
|
189
189
|
position: r = "right"
|
|
190
190
|
}) => {
|
|
191
|
-
const [t,
|
|
191
|
+
const [t, a] = w(!1), [u, i] = w(!1), o = M(null), s = M(null), c = V(() => {
|
|
192
192
|
switch (r) {
|
|
193
193
|
case "left":
|
|
194
194
|
return "left-0";
|
|
@@ -198,98 +198,190 @@ const ne = {
|
|
|
198
198
|
default:
|
|
199
199
|
return "right-0";
|
|
200
200
|
}
|
|
201
|
-
}, [r]),
|
|
202
|
-
const b =
|
|
203
|
-
o.current && !o.current.contains(b) &&
|
|
204
|
-
}, []),
|
|
205
|
-
if (!
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
201
|
+
}, [r]), l = v((p) => {
|
|
202
|
+
const b = p.target;
|
|
203
|
+
o.current && !o.current.contains(b) && s.current && !s.current.contains(b) && a(!1);
|
|
204
|
+
}, []), f = v(() => {
|
|
205
|
+
if (!s.current || !o.current) return;
|
|
206
|
+
const p = s.current.getBoundingClientRect(), b = o.current.getBoundingClientRect(), x = window.innerHeight - p.bottom, y = p.top;
|
|
207
|
+
i(
|
|
208
|
+
x < b.height && y > b.height
|
|
209
209
|
);
|
|
210
210
|
}, []);
|
|
211
|
-
|
|
211
|
+
S(() => {
|
|
212
212
|
if (t)
|
|
213
|
-
return
|
|
214
|
-
window.removeEventListener("resize",
|
|
213
|
+
return f(), window.addEventListener("resize", f), window.addEventListener("scroll", f, !0), () => {
|
|
214
|
+
window.removeEventListener("resize", f), window.removeEventListener("scroll", f, !0);
|
|
215
215
|
};
|
|
216
|
-
}, [t,
|
|
217
|
-
const
|
|
218
|
-
return /* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
t && /* @__PURE__ */
|
|
216
|
+
}, [t, f]), S(() => (document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l)), [l]);
|
|
217
|
+
const g = v(() => a((p) => !p), []);
|
|
218
|
+
return /* @__PURE__ */ m("div", { className: "relative flex items-center", children: [
|
|
219
|
+
/* @__PURE__ */ d("button", { ref: s, onClick: g, children: e }),
|
|
220
|
+
t && /* @__PURE__ */ d(
|
|
221
221
|
"div",
|
|
222
222
|
{
|
|
223
223
|
ref: o,
|
|
224
224
|
className: `absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
|
|
225
|
-
${
|
|
226
|
-
${
|
|
225
|
+
${u ? "bottom-full mb-2" : "top-full mt-2"}
|
|
226
|
+
${c}`,
|
|
227
227
|
children: n
|
|
228
228
|
}
|
|
229
229
|
)
|
|
230
230
|
] });
|
|
231
|
-
},
|
|
231
|
+
}, Oe = ({
|
|
232
|
+
children: e,
|
|
233
|
+
content: n,
|
|
234
|
+
position: r = "top",
|
|
235
|
+
className: t = "",
|
|
236
|
+
tooltipClass: a = "",
|
|
237
|
+
tooltipStyle: u = {}
|
|
238
|
+
}) => {
|
|
239
|
+
const i = M(null), o = M(null);
|
|
240
|
+
S(() => {
|
|
241
|
+
const c = i.current, l = o.current;
|
|
242
|
+
if (!c || !l) return;
|
|
243
|
+
const f = () => {
|
|
244
|
+
l.style.opacity = "1", l.style.visibility = "visible";
|
|
245
|
+
}, g = () => {
|
|
246
|
+
l.style.opacity = "0", l.style.visibility = "hidden";
|
|
247
|
+
};
|
|
248
|
+
return c.addEventListener("mouseenter", f), c.addEventListener("mouseleave", g), () => {
|
|
249
|
+
c.removeEventListener("mouseenter", f), c.removeEventListener("mouseleave", g);
|
|
250
|
+
};
|
|
251
|
+
}, []);
|
|
252
|
+
const s = (c) => {
|
|
253
|
+
const l = {
|
|
254
|
+
position: "absolute",
|
|
255
|
+
opacity: 0,
|
|
256
|
+
visibility: "hidden",
|
|
257
|
+
transition: "opacity 0.2s ease",
|
|
258
|
+
maxWidth: "240px",
|
|
259
|
+
whiteSpace: "normal",
|
|
260
|
+
wordBreak: "break-word",
|
|
261
|
+
padding: "8px 12px",
|
|
262
|
+
fontSize: "0.875rem",
|
|
263
|
+
backgroundColor: "black",
|
|
264
|
+
color: "white",
|
|
265
|
+
borderRadius: "4px",
|
|
266
|
+
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.15)",
|
|
267
|
+
zIndex: 9999,
|
|
268
|
+
width: "max-content"
|
|
269
|
+
};
|
|
270
|
+
switch (c) {
|
|
271
|
+
case "top":
|
|
272
|
+
return {
|
|
273
|
+
...l,
|
|
274
|
+
bottom: "100%",
|
|
275
|
+
left: "50%",
|
|
276
|
+
transform: "translateX(-50%)",
|
|
277
|
+
marginBottom: "8px"
|
|
278
|
+
};
|
|
279
|
+
case "bottom":
|
|
280
|
+
return {
|
|
281
|
+
...l,
|
|
282
|
+
top: "100%",
|
|
283
|
+
left: "50%",
|
|
284
|
+
transform: "translateX(-50%)",
|
|
285
|
+
marginTop: "8px"
|
|
286
|
+
};
|
|
287
|
+
case "left":
|
|
288
|
+
return {
|
|
289
|
+
...l,
|
|
290
|
+
right: "100%",
|
|
291
|
+
top: "50%",
|
|
292
|
+
transform: "translateY(-50%)",
|
|
293
|
+
marginRight: "8px"
|
|
294
|
+
};
|
|
295
|
+
case "right":
|
|
296
|
+
return {
|
|
297
|
+
...l,
|
|
298
|
+
left: "100%",
|
|
299
|
+
top: "50%",
|
|
300
|
+
transform: "translateY(-50%)",
|
|
301
|
+
marginLeft: "8px"
|
|
302
|
+
};
|
|
303
|
+
default:
|
|
304
|
+
return l;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
return /* @__PURE__ */ m("div", { ref: i, className: `relative inline-block ${t}`, children: [
|
|
308
|
+
e,
|
|
309
|
+
/* @__PURE__ */ d(
|
|
310
|
+
"div",
|
|
311
|
+
{
|
|
312
|
+
ref: o,
|
|
313
|
+
role: "tooltip",
|
|
314
|
+
className: a,
|
|
315
|
+
style: {
|
|
316
|
+
...s(r),
|
|
317
|
+
...u
|
|
318
|
+
},
|
|
319
|
+
children: n
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
] });
|
|
323
|
+
}, F = ee(null), le = () => {
|
|
232
324
|
const e = te(F);
|
|
233
325
|
return e || (console.warn(
|
|
234
326
|
"⚠️ useModal() called outside of ModalProvider. Falling back to standalone modal usage."
|
|
235
327
|
), null);
|
|
236
328
|
};
|
|
237
|
-
function
|
|
329
|
+
function Se({
|
|
238
330
|
id: e,
|
|
239
331
|
title: n,
|
|
240
332
|
children: r,
|
|
241
333
|
standalone: t = !1,
|
|
242
|
-
showFloatingClose:
|
|
243
|
-
containerClasses:
|
|
244
|
-
onClose:
|
|
334
|
+
showFloatingClose: a = !1,
|
|
335
|
+
containerClasses: u = "",
|
|
336
|
+
onClose: i
|
|
245
337
|
}) {
|
|
246
|
-
const o =
|
|
247
|
-
|
|
338
|
+
const o = le(), s = o && typeof o.openModal == "function", c = !t && s, [l, f] = w(!1), g = c ? o.isOpen(e) : l, p = () => {
|
|
339
|
+
c ? o.closeModal(e) : f(!1), i && i();
|
|
248
340
|
};
|
|
249
|
-
return
|
|
341
|
+
return S(() => (g ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
250
342
|
document.body.style.overflow = "";
|
|
251
|
-
}), [
|
|
343
|
+
}), [g]), g ? /* @__PURE__ */ d("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ m(
|
|
252
344
|
"div",
|
|
253
345
|
{
|
|
254
|
-
className: `bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${
|
|
346
|
+
className: `bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${u}`,
|
|
255
347
|
children: [
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
n && /* @__PURE__ */
|
|
258
|
-
|
|
348
|
+
/* @__PURE__ */ m("div", { className: "flex justify-between items-center relative", children: [
|
|
349
|
+
n && /* @__PURE__ */ d("h2", { className: "text-lg font-semibold", children: n }),
|
|
350
|
+
a && /* @__PURE__ */ d(
|
|
259
351
|
"button",
|
|
260
352
|
{
|
|
261
|
-
onClick: () =>
|
|
353
|
+
onClick: () => p(),
|
|
262
354
|
className: "text-gray-500 hover:text-gray-700 absolute top-2 right-3",
|
|
263
355
|
"aria-label": "Close modal",
|
|
264
356
|
children: "✕"
|
|
265
357
|
}
|
|
266
358
|
)
|
|
267
359
|
] }),
|
|
268
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ d("div", { className: "text-sm text-gray-700", children: r })
|
|
269
361
|
]
|
|
270
362
|
}
|
|
271
363
|
) }) : null;
|
|
272
364
|
}
|
|
273
|
-
function
|
|
274
|
-
const [n, r] = w({}), t = v((
|
|
275
|
-
r((o) => ({ ...o, [
|
|
276
|
-
}, []),
|
|
277
|
-
r((o) => ({ ...o, [
|
|
278
|
-
}, []),
|
|
279
|
-
return /* @__PURE__ */
|
|
365
|
+
function Le({ children: e }) {
|
|
366
|
+
const [n, r] = w({}), t = v((i) => {
|
|
367
|
+
r((o) => ({ ...o, [i]: !0 }));
|
|
368
|
+
}, []), a = v((i) => {
|
|
369
|
+
r((o) => ({ ...o, [i]: !1 }));
|
|
370
|
+
}, []), u = v((i) => !!n[i], [n]);
|
|
371
|
+
return /* @__PURE__ */ d(F.Provider, { value: { openModal: t, closeModal: a, isOpen: u }, children: e });
|
|
280
372
|
}
|
|
281
|
-
let
|
|
373
|
+
let _ = null, D = {};
|
|
282
374
|
function ae(e) {
|
|
283
|
-
|
|
375
|
+
_ = e;
|
|
284
376
|
}
|
|
285
|
-
function
|
|
286
|
-
|
|
377
|
+
function Pe(e) {
|
|
378
|
+
D = { ...D, ...e };
|
|
287
379
|
}
|
|
288
380
|
function ie() {
|
|
289
|
-
return
|
|
381
|
+
return D;
|
|
290
382
|
}
|
|
291
|
-
function
|
|
292
|
-
|
|
383
|
+
function je(e, n, r = 3e3, t) {
|
|
384
|
+
_ ? _(e, n, r, t) : console.warn("Toast system is not mounted");
|
|
293
385
|
}
|
|
294
386
|
var Z = {
|
|
295
387
|
color: void 0,
|
|
@@ -297,14 +389,14 @@ var Z = {
|
|
|
297
389
|
className: void 0,
|
|
298
390
|
style: void 0,
|
|
299
391
|
attr: void 0
|
|
300
|
-
},
|
|
392
|
+
}, B = h.createContext && /* @__PURE__ */ h.createContext(Z), ce = ["attr", "size", "title"];
|
|
301
393
|
function de(e, n) {
|
|
302
394
|
if (e == null) return {};
|
|
303
|
-
var r = ue(e, n), t,
|
|
395
|
+
var r = ue(e, n), t, a;
|
|
304
396
|
if (Object.getOwnPropertySymbols) {
|
|
305
|
-
var
|
|
306
|
-
for (
|
|
307
|
-
t =
|
|
397
|
+
var u = Object.getOwnPropertySymbols(e);
|
|
398
|
+
for (a = 0; a < u.length; a++)
|
|
399
|
+
t = u[a], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]);
|
|
308
400
|
}
|
|
309
401
|
return r;
|
|
310
402
|
}
|
|
@@ -318,32 +410,32 @@ function ue(e, n) {
|
|
|
318
410
|
}
|
|
319
411
|
return r;
|
|
320
412
|
}
|
|
321
|
-
function
|
|
322
|
-
return
|
|
413
|
+
function $() {
|
|
414
|
+
return $ = Object.assign ? Object.assign.bind() : function(e) {
|
|
323
415
|
for (var n = 1; n < arguments.length; n++) {
|
|
324
416
|
var r = arguments[n];
|
|
325
417
|
for (var t in r)
|
|
326
418
|
Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]);
|
|
327
419
|
}
|
|
328
420
|
return e;
|
|
329
|
-
},
|
|
421
|
+
}, $.apply(this, arguments);
|
|
330
422
|
}
|
|
331
|
-
function
|
|
423
|
+
function A(e, n) {
|
|
332
424
|
var r = Object.keys(e);
|
|
333
425
|
if (Object.getOwnPropertySymbols) {
|
|
334
426
|
var t = Object.getOwnPropertySymbols(e);
|
|
335
|
-
n && (t = t.filter(function(
|
|
336
|
-
return Object.getOwnPropertyDescriptor(e,
|
|
427
|
+
n && (t = t.filter(function(a) {
|
|
428
|
+
return Object.getOwnPropertyDescriptor(e, a).enumerable;
|
|
337
429
|
})), r.push.apply(r, t);
|
|
338
430
|
}
|
|
339
431
|
return r;
|
|
340
432
|
}
|
|
341
|
-
function
|
|
433
|
+
function R(e) {
|
|
342
434
|
for (var n = 1; n < arguments.length; n++) {
|
|
343
435
|
var r = arguments[n] != null ? arguments[n] : {};
|
|
344
|
-
n % 2 ?
|
|
436
|
+
n % 2 ? A(Object(r), !0).forEach(function(t) {
|
|
345
437
|
fe(e, t, r[t]);
|
|
346
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
438
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : A(Object(r)).forEach(function(t) {
|
|
347
439
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
348
440
|
});
|
|
349
441
|
}
|
|
@@ -366,77 +458,77 @@ function pe(e, n) {
|
|
|
366
458
|
}
|
|
367
459
|
return (n === "string" ? String : Number)(e);
|
|
368
460
|
}
|
|
369
|
-
function
|
|
370
|
-
return e && e.map((n, r) => /* @__PURE__ */ h.createElement(n.tag,
|
|
461
|
+
function W(e) {
|
|
462
|
+
return e && e.map((n, r) => /* @__PURE__ */ h.createElement(n.tag, R({
|
|
371
463
|
key: r
|
|
372
|
-
}, n.attr),
|
|
464
|
+
}, n.attr), W(n.child)));
|
|
373
465
|
}
|
|
374
466
|
function be(e) {
|
|
375
|
-
return (n) => /* @__PURE__ */ h.createElement(
|
|
376
|
-
attr:
|
|
377
|
-
}, n),
|
|
467
|
+
return (n) => /* @__PURE__ */ h.createElement(me, $({
|
|
468
|
+
attr: R({}, e.attr)
|
|
469
|
+
}, n), W(e.child));
|
|
378
470
|
}
|
|
379
|
-
function
|
|
471
|
+
function me(e) {
|
|
380
472
|
var n = (r) => {
|
|
381
473
|
var {
|
|
382
474
|
attr: t,
|
|
383
|
-
size:
|
|
384
|
-
title:
|
|
385
|
-
} = e,
|
|
386
|
-
return r.className && (
|
|
475
|
+
size: a,
|
|
476
|
+
title: u
|
|
477
|
+
} = e, i = de(e, ce), o = a || r.size || "1em", s;
|
|
478
|
+
return r.className && (s = r.className), e.className && (s = (s ? s + " " : "") + e.className), /* @__PURE__ */ h.createElement("svg", $({
|
|
387
479
|
stroke: "currentColor",
|
|
388
480
|
fill: "currentColor",
|
|
389
481
|
strokeWidth: "0"
|
|
390
|
-
}, r.attr, t,
|
|
391
|
-
className:
|
|
392
|
-
style:
|
|
482
|
+
}, r.attr, t, i, {
|
|
483
|
+
className: s,
|
|
484
|
+
style: R(R({
|
|
393
485
|
color: e.color || r.color
|
|
394
486
|
}, r.style), e.style),
|
|
395
487
|
height: o,
|
|
396
488
|
width: o,
|
|
397
489
|
xmlns: "http://www.w3.org/2000/svg"
|
|
398
|
-
}),
|
|
490
|
+
}), u && /* @__PURE__ */ h.createElement("title", null, u), e.children);
|
|
399
491
|
};
|
|
400
|
-
return
|
|
492
|
+
return B !== void 0 ? /* @__PURE__ */ h.createElement(B.Consumer, null, (r) => n(r)) : n(Z);
|
|
401
493
|
}
|
|
402
|
-
function
|
|
494
|
+
function xe(e) {
|
|
403
495
|
return be({ 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);
|
|
404
496
|
}
|
|
405
497
|
const he = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
406
498
|
const n = Math.random() * 16 | 0;
|
|
407
499
|
return (e === "x" ? n : n & 3 | 8).toString(16);
|
|
408
|
-
}),
|
|
500
|
+
}), ke = () => {
|
|
409
501
|
const [e, n] = w([]);
|
|
410
|
-
|
|
411
|
-
ae((t,
|
|
502
|
+
S(() => {
|
|
503
|
+
ae((t, a, u, i) => {
|
|
412
504
|
const o = he();
|
|
413
|
-
n((
|
|
414
|
-
n((
|
|
415
|
-
},
|
|
505
|
+
n((s) => [...s, { id: o, type: t, message: a, config: i }]), setTimeout(() => {
|
|
506
|
+
n((s) => s.filter((c) => c.id !== o));
|
|
507
|
+
}, u);
|
|
416
508
|
});
|
|
417
509
|
}, []);
|
|
418
510
|
const r = ie();
|
|
419
|
-
return /* @__PURE__ */
|
|
420
|
-
var
|
|
421
|
-
const
|
|
422
|
-
return /* @__PURE__ */
|
|
511
|
+
return /* @__PURE__ */ d("div", { className: "fixed top-5 right-5 z-[9999] flex flex-col gap-2", children: e.map((t) => {
|
|
512
|
+
var s, c, l, f, g, p, b, x, y, C, L, P, j;
|
|
513
|
+
const a = ((s = t.config) == null ? void 0 : s.icon) || ((c = r.icons) == null ? void 0 : c[t.type]) || ye(t.type), u = ((l = t.config) == null ? void 0 : l.bgColor) || ((g = (f = r.colors) == null ? void 0 : f[t.type]) == null ? void 0 : g.bg) || "bg-white dark:bg-gray-800", i = ((p = t.config) == null ? void 0 : p.textColor) || ((x = (b = r.colors) == null ? void 0 : b[t.type]) == null ? void 0 : x.text) || "text-gray-700 dark:text-gray-300", o = ((y = t.config) == null ? void 0 : y.iconContainerClass) || "w-8 h-8 mr-3 text-xl flex items-center justify-center";
|
|
514
|
+
return /* @__PURE__ */ m(
|
|
423
515
|
"div",
|
|
424
516
|
{
|
|
425
|
-
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${
|
|
517
|
+
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${u} ${i}`,
|
|
426
518
|
children: [
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
((C = t.config) == null ? void 0 : C.title) && /* @__PURE__ */
|
|
430
|
-
((
|
|
431
|
-
!((
|
|
519
|
+
/* @__PURE__ */ d("div", { className: o, children: a }),
|
|
520
|
+
/* @__PURE__ */ m("div", { className: "flex-1 me-3", children: [
|
|
521
|
+
((C = t.config) == null ? void 0 : C.title) && /* @__PURE__ */ d("div", { className: "font-semibold text-black", children: t.config.title }),
|
|
522
|
+
((L = t.config) == null ? void 0 : L.description) && /* @__PURE__ */ d("div", { className: "text-sm text-gray-500", children: t.config.description }),
|
|
523
|
+
!((P = t.config) != null && P.title) && !((j = t.config) != null && j.description) && /* @__PURE__ */ d("div", { className: "text-sm", children: t.message })
|
|
432
524
|
] }),
|
|
433
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ d(
|
|
434
526
|
"button",
|
|
435
527
|
{
|
|
436
|
-
onClick: () => n((
|
|
528
|
+
onClick: () => n((k) => k.filter((E) => E.id !== t.id)),
|
|
437
529
|
className: "ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white",
|
|
438
530
|
"aria-label": "Close",
|
|
439
|
-
children: /* @__PURE__ */
|
|
531
|
+
children: /* @__PURE__ */ d(xe, { size: 18 })
|
|
440
532
|
}
|
|
441
533
|
)
|
|
442
534
|
]
|
|
@@ -459,13 +551,14 @@ function ye(e) {
|
|
|
459
551
|
}
|
|
460
552
|
export {
|
|
461
553
|
Ce as Button,
|
|
462
|
-
|
|
554
|
+
Ne as Dropdown,
|
|
463
555
|
re as Input,
|
|
464
|
-
|
|
556
|
+
Se as Modal,
|
|
465
557
|
F as ModalContext,
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
Pe as
|
|
470
|
-
|
|
558
|
+
Le as ModalProvider,
|
|
559
|
+
ke as Toast,
|
|
560
|
+
Oe as Tooltip,
|
|
561
|
+
Pe as setToastDefaults,
|
|
562
|
+
je as showToast,
|
|
563
|
+
le as useModal
|
|
471
564
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
${w&&g?
|
|
3
|
-
${
|
|
4
|
-
${
|
|
5
|
-
${f}`,children:n})]})},
|
|
1
|
+
(function(p,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):(p=typeof globalThis<"u"?globalThis:p||self,o(p.TailwindUiKit={},p.jsxRuntime,p.React))})(this,function(p,o,s){"use strict";"use client";const D=s.forwardRef((e,n)=>{const{label:r,id:t,inputSize:c="md",shape:f="rounded",validate:d,onValidatedChange:l,className:a="",icon:u,iconPosition:i="left",floatingLabelStyle:g,onChange:b,isValid:x,isInvalid:h,feedback:m,feedbackType:y="invalid",...v}=e,[S,j]=s.useState("default"),k=C=>{const I=C.target.value,L=(d==null?void 0:d(I))??"default";j(L),l==null||l(C,L),b==null||b(C)},E={xs:"text-xs px-2 py-1",sm:"text-sm px-3 py-1.5",md:"text-sm px-3 py-3",lg:"text-lg px-5 py-3"},P={flat:"rounded-none",rounded:"rounded-md",pill:"rounded-full"},fe={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"},ge={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"},pe=(C,I,L)=>{if(L)return"border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";if(I)return"border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";switch(C){case"error":return"border-red-500 bg-red-50 focus:ring-red-500";case"warning":return"border-yellow-500 bg-yellow-50 focus:ring-yellow-500";case"success":return"border-green-500 bg-green-50 focus:ring-green-500";default:return"border-gray-300 focus:ring-blue-500"}},be=E[c]||E.md,xe=P[f]||P.flat,he=pe(S,x,h),me=i==="start"||i==="left"?"left-0 ps-3.5":"right-0 pe-3.5",ye=u&&(i==="start"||i==="left")?"ps-10":u?"pe-10":"",$=t??`input-${(r==null?void 0:r.toLowerCase().replace(/\s+/g,"-"))||Math.random().toString(36).slice(2)}`,w=!!g;return o.jsxs("div",{className:`w-full relative ${w?"z-0":""}`,children:[!w&&r&&o.jsx("label",{htmlFor:$,className:`block mb-1 font-light text-sm ${x?"text-green-700 dark:text-green-500":h?"text-red-700 dark:text-red-500":"text-gray-700"}`,children:r}),o.jsxs("div",{className:"relative w-full",children:[u&&o.jsx("div",{className:`absolute inset-y-0 flex items-center ${me}`,children:o.jsx("span",{className:"text-gray-500",children:u})}),o.jsx("input",{...v,id:$,ref:n,placeholder:w?" ":v.placeholder,onChange:k,className:`border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
|
|
2
|
+
${w&&g?fe[g]:be}
|
|
3
|
+
${ye} ${xe} ${he} ${a}`}),w&&r&&g&&o.jsx("label",{htmlFor:$,className:`ms-1 ${ge[g]} ${a}`,children:r})]}),m&&o.jsx("p",{className:`mt-1 text-xs ${y==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,children:m})]})});D.displayName="Input";const W={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-600 text-white hover:bg-gray-700",success:"bg-green-600 text-white hover:bg-green-700",danger:"bg-red-600 text-white hover:bg-red-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-cyan-600 text-white hover:bg-cyan-700",dark:"bg-gray-900 text-white hover:bg-black",light:"bg-gray-100 text-black hover:bg-gray-200",link:"bg-transparent text-blue-600 hover:underline [&&]:p-0 [&&]:shadow-none","outline-primary":"border border-blue-600 text-blue-600 hover:bg-blue-50","outline-secondary":"border border-gray-600 text-gray-600 hover:bg-gray-50","outline-success":"border border-green-600 text-green-600 hover:bg-green-50","outline-danger":"border border-red-600 text-red-600 hover:bg-red-50","outline-warning":"border border-yellow-500 text-yellow-600 hover:bg-yellow-50","outline-info":"border border-cyan-600 text-cyan-600 hover:bg-cyan-50","outline-dark":"border border-gray-900 text-gray-900 hover:bg-gray-100","outline-light":"border border-gray-100 text-gray-500 hover:bg-gray-200"},G={xs:"px-3 py-2 text-xs",sm:"px-3 py-2 text-sm",md:"px-5 py-2.5 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-3.5 text-base"},H={flat:"shadow-none",rounded:"rounded-md",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},q=({children:e,variant:n="primary",size:r="md",type:t="button",shape:c="rounded",className:f="",isLoading:d=!1,disabled:l=!1,...a})=>{const u=l||d,i=["inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",W[n],G[r],H[c],c==="flat"?"shadow-none":"shadow-sm",u?"opacity-50 cursor-not-allowed pointer-events-none":"",f].filter(Boolean).join(" ");return o.jsxs("button",{type:t,className:i,disabled:u,...a,children:[d&&o.jsxs("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"#1C64F2"})]}),e]})},K=({label:e,children:n,position:r="right"})=>{const[t,c]=s.useState(!1),[f,d]=s.useState(!1),l=s.useRef(null),a=s.useRef(null),u=s.useMemo(()=>{switch(r){case"left":return"left-0";case"center":return"left-1/2 transform -translate-x-1/2";case"right":default:return"right-0"}},[r]),i=s.useCallback(x=>{const h=x.target;l.current&&!l.current.contains(h)&&a.current&&!a.current.contains(h)&&c(!1)},[]),g=s.useCallback(()=>{if(!a.current||!l.current)return;const x=a.current.getBoundingClientRect(),h=l.current.getBoundingClientRect(),m=window.innerHeight-x.bottom,y=x.top;d(m<h.height&&y>h.height)},[]);s.useEffect(()=>{if(t)return g(),window.addEventListener("resize",g),window.addEventListener("scroll",g,!0),()=>{window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0)}},[t,g]),s.useEffect(()=>(document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)),[i]);const b=s.useCallback(()=>c(x=>!x),[]);return o.jsxs("div",{className:"relative flex items-center",children:[o.jsx("button",{ref:a,onClick:b,children:e}),t&&o.jsx("div",{ref:l,className:`absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
|
|
4
|
+
${f?"bottom-full mb-2":"top-full mt-2"}
|
|
5
|
+
${u}`,children:n})]})},U=({children:e,content:n,position:r="top",className:t="",tooltipClass:c="",tooltipStyle:f={}})=>{const d=s.useRef(null),l=s.useRef(null);s.useEffect(()=>{const u=d.current,i=l.current;if(!u||!i)return;const g=()=>{i.style.opacity="1",i.style.visibility="visible"},b=()=>{i.style.opacity="0",i.style.visibility="hidden"};return u.addEventListener("mouseenter",g),u.addEventListener("mouseleave",b),()=>{u.removeEventListener("mouseenter",g),u.removeEventListener("mouseleave",b)}},[]);const a=u=>{const i={position:"absolute",opacity:0,visibility:"hidden",transition:"opacity 0.2s ease",maxWidth:"240px",whiteSpace:"normal",wordBreak:"break-word",padding:"8px 12px",fontSize:"0.875rem",backgroundColor:"black",color:"white",borderRadius:"4px",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,width:"max-content"};switch(u){case"top":return{...i,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...i,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...i,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...i,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return i}};return o.jsxs("div",{ref:d,className:`relative inline-block ${t}`,children:[e,o.jsx("div",{ref:l,role:"tooltip",className:c,style:{...a(r),...f},children:n})]})},T=s.createContext(null),_=()=>{const e=s.useContext(T);return e||(console.warn("⚠️ useModal() called outside of ModalProvider. Falling back to standalone modal usage."),null)};function X({id:e,title:n,children:r,standalone:t=!1,showFloatingClose:c=!1,containerClasses:f="",onClose:d}){const l=_(),a=l&&typeof l.openModal=="function",u=!t&&a,[i,g]=s.useState(!1),b=u?l.isOpen(e):i,x=()=>{u?l.closeModal(e):g(!1),d&&d()};return s.useEffect(()=>(b?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[b]),b?o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",children:o.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${f}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),c&&o.jsx("button",{onClick:()=>x(),className:"text-gray-500 hover:text-gray-700 absolute top-2 right-3","aria-label":"Close modal",children:"✕"})]}),o.jsx("div",{className:"text-sm text-gray-700",children:r})]})}):null}function Y({children:e}){const[n,r]=s.useState({}),t=s.useCallback(d=>{r(l=>({...l,[d]:!0}))},[]),c=s.useCallback(d=>{r(l=>({...l,[d]:!1}))},[]),f=s.useCallback(d=>!!n[d],[n]);return o.jsx(T.Provider,{value:{openModal:t,closeModal:c,isOpen:f},children:e})}let M=null,z={};function J(e){M=e}function Q(e){z={...z,...e}}function V(){return z}function R(e,n,r=3e3,t){M?M(e,n,r,t):console.warn("Toast system is not mounted")}var B={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},A=s.createContext&&s.createContext(B),ee=["attr","size","title"];function te(e,n){if(e==null)return{};var r=re(e,n),t,c;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(c=0;c<f.length;c++)t=f[c],!(n.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function re(e,n){if(e==null)return{};var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(n.indexOf(t)>=0)continue;r[t]=e[t]}return r}function N(){return N=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},N.apply(this,arguments)}function F(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),r.push.apply(r,t)}return r}function O(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?F(Object(r),!0).forEach(function(t){ne(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ne(e,n,r){return n=oe(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function oe(e){var n=se(e,"string");return typeof n=="symbol"?n:n+""}function se(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var t=r.call(e,n);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Z(e){return e&&e.map((n,r)=>s.createElement(n.tag,O({key:r},n.attr),Z(n.child)))}function le(e){return n=>s.createElement(ae,N({attr:O({},e.attr)},n),Z(e.child))}function ae(e){var n=r=>{var{attr:t,size:c,title:f}=e,d=te(e,ee),l=c||r.size||"1em",a;return r.className&&(a=r.className),e.className&&(a=(a?a+" ":"")+e.className),s.createElement("svg",N({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,t,d,{className:a,style:O(O({color:e.color||r.color},r.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),f&&s.createElement("title",null,f),e.children)};return A!==void 0?s.createElement(A.Consumer,null,r=>n(r)):n(B)}function ie(e){return le({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 ce=()=>"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)}),de=()=>{const[e,n]=s.useState([]);s.useEffect(()=>{J((t,c,f,d)=>{const l=ce();n(a=>[...a,{id:l,type:t,message:c,config:d}]),setTimeout(()=>{n(a=>a.filter(u=>u.id!==l))},f)})},[]);const r=V();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(t=>{var a,u,i,g,b,x,h,m,y,v,S,j,k;const c=((a=t.config)==null?void 0:a.icon)||((u=r.icons)==null?void 0:u[t.type])||ue(t.type),f=((i=t.config)==null?void 0:i.bgColor)||((b=(g=r.colors)==null?void 0:g[t.type])==null?void 0:b.bg)||"bg-white dark:bg-gray-800",d=((x=t.config)==null?void 0:x.textColor)||((m=(h=r.colors)==null?void 0:h[t.type])==null?void 0:m.text)||"text-gray-700 dark:text-gray-300",l=((y=t.config)==null?void 0:y.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return o.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${f} ${d}`,children:[o.jsx("div",{className:l,children:c}),o.jsxs("div",{className:"flex-1 me-3",children:[((v=t.config)==null?void 0:v.title)&&o.jsx("div",{className:"font-semibold text-black",children:t.config.title}),((S=t.config)==null?void 0:S.description)&&o.jsx("div",{className:"text-sm text-gray-500",children:t.config.description}),!((j=t.config)!=null&&j.title)&&!((k=t.config)!=null&&k.description)&&o.jsx("div",{className:"text-sm",children:t.message})]}),o.jsx("button",{onClick:()=>n(E=>E.filter(P=>P.id!==t.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:o.jsx(ie,{size:18})})]},t.id)})})};function ue(e){switch(e){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}p.Button=q,p.Dropdown=K,p.Input=D,p.Modal=X,p.ModalContext=T,p.ModalProvider=Y,p.Toast=de,p.Tooltip=U,p.setToastDefaults=Q,p.showToast=R,p.useModal=_,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|