tailwind-ux-kit 1.0.16 → 1.0.17
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/index.d.ts +1 -0
- package/lib/tailwind-ux-kit.es.js +210 -164
- package/lib/tailwind-ux-kit.umd.js +5 -3
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as Input } from './components/Input';
|
|
2
2
|
export { default as Button } from './components/Button';
|
|
3
|
+
export { default as Dropdown } from './components/Dropdown';
|
|
3
4
|
export { default as Modal } from './components/modal/Modal';
|
|
4
5
|
export { default as ModalProvider } from './components/modal/ModalProvider';
|
|
5
6
|
export * from './components/modal/ModalContext';
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { jsxs as x, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import h, { forwardRef as X, useState as w, useRef as D, useMemo as Y, useCallback as v, useEffect as z, createContext as ee, useContext as te } from "react";
|
|
4
|
+
const re = X((e, n) => {
|
|
5
5
|
const {
|
|
6
6
|
label: r,
|
|
7
7
|
id: t,
|
|
8
|
-
inputSize:
|
|
8
|
+
inputSize: s = "md",
|
|
9
9
|
shape: c = "rounded",
|
|
10
|
-
validate:
|
|
10
|
+
validate: a,
|
|
11
11
|
onValidatedChange: o,
|
|
12
|
-
className:
|
|
12
|
+
className: l = "",
|
|
13
13
|
icon: d,
|
|
14
|
-
iconPosition:
|
|
15
|
-
floatingLabelStyle:
|
|
16
|
-
onChange:
|
|
17
|
-
isValid:
|
|
18
|
-
isInvalid:
|
|
19
|
-
feedback:
|
|
20
|
-
feedbackType:
|
|
21
|
-
...
|
|
22
|
-
} = e, [
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
},
|
|
14
|
+
iconPosition: f = "left",
|
|
15
|
+
floatingLabelStyle: u,
|
|
16
|
+
onChange: p,
|
|
17
|
+
isValid: g,
|
|
18
|
+
isInvalid: b,
|
|
19
|
+
feedback: m,
|
|
20
|
+
feedbackType: y = "invalid",
|
|
21
|
+
...C
|
|
22
|
+
} = e, [S, j] = w("default"), P = (N) => {
|
|
23
|
+
const _ = N.target.value, k = (a == null ? void 0 : a(_)) ?? "default";
|
|
24
|
+
j(k), o == null || o(N, k), p == null || p(N);
|
|
25
|
+
}, L = {
|
|
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
|
+
}, E = {
|
|
31
31
|
flat: "rounded-none",
|
|
32
32
|
rounded: "rounded-md",
|
|
33
33
|
pill: "rounded-full"
|
|
34
|
-
},
|
|
34
|
+
}, H = {
|
|
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"
|
|
@@ -39,12 +39,12 @@ const ee = V((e, n) => {
|
|
|
39
39
|
filled: "absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",
|
|
40
40
|
outlined: "absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",
|
|
41
41
|
standard: "absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"
|
|
42
|
-
},
|
|
42
|
+
}, K = (N, _, k) => {
|
|
43
43
|
if (k)
|
|
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 (_)
|
|
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 (N) {
|
|
48
48
|
case "error":
|
|
49
49
|
return "border-red-500 bg-red-50 focus:ring-red-500";
|
|
50
50
|
case "warning":
|
|
@@ -54,57 +54,57 @@ const ee = V((e, n) => {
|
|
|
54
54
|
default:
|
|
55
55
|
return "border-gray-300 focus:ring-blue-500";
|
|
56
56
|
}
|
|
57
|
-
},
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
!
|
|
57
|
+
}, U = L[s] || L.md, q = E[c] || E.flat, J = K(S, g, b), Q = f === "start" || f === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", V = d && (f === "start" || f === "left") ? "ps-10" : d ? "pe-10" : "", T = t ?? `input-${(r == null ? void 0 : r.toLowerCase().replace(/\s+/g, "-")) || Math.random().toString(36).slice(2)}`, O = !!u;
|
|
58
|
+
return /* @__PURE__ */ x("div", { className: `w-full relative ${O ? "z-0" : ""}`, children: [
|
|
59
|
+
!O && r && /* @__PURE__ */ i(
|
|
60
60
|
"label",
|
|
61
61
|
{
|
|
62
|
-
htmlFor:
|
|
63
|
-
className: `block mb-1 font-light text-sm ${
|
|
62
|
+
htmlFor: T,
|
|
63
|
+
className: `block mb-1 font-light text-sm ${g ? "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
|
-
d && /* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ x("div", { className: "relative w-full", children: [
|
|
68
|
+
d && /* @__PURE__ */ i(
|
|
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__ */ i("span", { className: "text-gray-500", children: d })
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ i(
|
|
76
76
|
"input",
|
|
77
77
|
{
|
|
78
|
-
...
|
|
79
|
-
id:
|
|
78
|
+
...C,
|
|
79
|
+
id: T,
|
|
80
80
|
ref: n,
|
|
81
|
-
placeholder:
|
|
82
|
-
onChange:
|
|
81
|
+
placeholder: O ? " " : C.placeholder,
|
|
82
|
+
onChange: P,
|
|
83
83
|
className: `border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
|
|
84
|
-
${
|
|
85
|
-
${
|
|
84
|
+
${O && u ? H[u] : U}
|
|
85
|
+
${V} ${q} ${J} ${l}`
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
|
-
|
|
88
|
+
O && r && u && /* @__PURE__ */ i(
|
|
89
89
|
"label",
|
|
90
90
|
{
|
|
91
|
-
htmlFor:
|
|
92
|
-
className: `ms-1 ${W[
|
|
91
|
+
htmlFor: T,
|
|
92
|
+
className: `ms-1 ${W[u]} ${l}`,
|
|
93
93
|
children: r
|
|
94
94
|
}
|
|
95
95
|
)
|
|
96
96
|
] }),
|
|
97
|
-
|
|
97
|
+
m && /* @__PURE__ */ i(
|
|
98
98
|
"p",
|
|
99
99
|
{
|
|
100
|
-
className: `mt-1 text-xs ${
|
|
101
|
-
children:
|
|
100
|
+
className: `mt-1 text-xs ${y === "invalid" ? "text-red-600 dark:text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
101
|
+
children: m
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
] });
|
|
105
105
|
});
|
|
106
|
-
|
|
107
|
-
const
|
|
106
|
+
re.displayName = "Input";
|
|
107
|
+
const ne = {
|
|
108
108
|
primary: "bg-blue-600 text-white hover:bg-blue-700",
|
|
109
109
|
secondary: "bg-gray-600 text-white hover:bg-gray-700",
|
|
110
110
|
success: "bg-green-600 text-white hover:bg-green-700",
|
|
@@ -122,39 +122,39 @@ const te = {
|
|
|
122
122
|
"outline-info": "border border-cyan-600 text-cyan-600 hover:bg-cyan-50",
|
|
123
123
|
"outline-dark": "border border-gray-900 text-gray-900 hover:bg-gray-100",
|
|
124
124
|
"outline-light": "border border-gray-100 text-gray-500 hover:bg-gray-200"
|
|
125
|
-
},
|
|
125
|
+
}, oe = {
|
|
126
126
|
xs: "px-3 py-2 text-xs",
|
|
127
127
|
sm: "px-3 py-2 text-sm",
|
|
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
|
+
}, le = {
|
|
132
132
|
flat: "shadow-none",
|
|
133
133
|
rounded: "rounded-md",
|
|
134
134
|
pill: "rounded-full",
|
|
135
135
|
circle: "rounded-full w-10 h-10 p-0 flex items-center justify-center"
|
|
136
|
-
},
|
|
136
|
+
}, Ce = ({
|
|
137
137
|
children: e,
|
|
138
138
|
variant: n = "primary",
|
|
139
139
|
size: r = "md",
|
|
140
140
|
type: t = "button",
|
|
141
|
-
shape:
|
|
141
|
+
shape: s = "rounded",
|
|
142
142
|
className: c = "",
|
|
143
|
-
isLoading:
|
|
143
|
+
isLoading: a = !1,
|
|
144
144
|
disabled: o = !1,
|
|
145
|
-
...
|
|
145
|
+
...l
|
|
146
146
|
}) => {
|
|
147
|
-
const d = o ||
|
|
147
|
+
const d = o || a, f = [
|
|
148
148
|
"inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
ne[n],
|
|
150
|
+
oe[r],
|
|
151
|
+
le[s],
|
|
152
|
+
s === "flat" ? "shadow-none" : "shadow-sm",
|
|
153
153
|
d ? "opacity-50 cursor-not-allowed pointer-events-none" : "",
|
|
154
154
|
c
|
|
155
155
|
].filter(Boolean).join(" ");
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
|
|
156
|
+
return /* @__PURE__ */ x("button", { type: t, className: f, disabled: d, ...l, children: [
|
|
157
|
+
a && /* @__PURE__ */ x(
|
|
158
158
|
"svg",
|
|
159
159
|
{
|
|
160
160
|
"aria-hidden": "true",
|
|
@@ -164,14 +164,14 @@ const te = {
|
|
|
164
164
|
fill: "none",
|
|
165
165
|
xmlns: "http://www.w3.org/2000/svg",
|
|
166
166
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ i(
|
|
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__ */ i(
|
|
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,87 +183,132 @@ const te = {
|
|
|
183
183
|
),
|
|
184
184
|
e
|
|
185
185
|
] });
|
|
186
|
-
},
|
|
187
|
-
|
|
186
|
+
}, Oe = ({
|
|
187
|
+
label: e,
|
|
188
|
+
children: n,
|
|
189
|
+
position: r = "right"
|
|
190
|
+
}) => {
|
|
191
|
+
const [t, s] = w(!1), [c, a] = w(!1), o = D(null), l = D(null), d = Y(() => {
|
|
192
|
+
switch (r) {
|
|
193
|
+
case "left":
|
|
194
|
+
return "left-0";
|
|
195
|
+
case "center":
|
|
196
|
+
return "left-1/2 transform -translate-x-1/2";
|
|
197
|
+
case "right":
|
|
198
|
+
default:
|
|
199
|
+
return "right-0";
|
|
200
|
+
}
|
|
201
|
+
}, [r]), f = v((g) => {
|
|
202
|
+
const b = g.target;
|
|
203
|
+
o.current && !o.current.contains(b) && l.current && !l.current.contains(b) && s(!1);
|
|
204
|
+
}, []), u = v(() => {
|
|
205
|
+
if (!l.current || !o.current) return;
|
|
206
|
+
const g = l.current.getBoundingClientRect(), b = o.current.getBoundingClientRect(), m = window.innerHeight - g.bottom, y = g.top;
|
|
207
|
+
a(
|
|
208
|
+
m < b.height && y > b.height
|
|
209
|
+
);
|
|
210
|
+
}, []);
|
|
211
|
+
z(() => {
|
|
212
|
+
if (t)
|
|
213
|
+
return u(), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), () => {
|
|
214
|
+
window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0);
|
|
215
|
+
};
|
|
216
|
+
}, [t, u]), z(() => (document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f)), [f]);
|
|
217
|
+
const p = v(() => s((g) => !g), []);
|
|
218
|
+
return /* @__PURE__ */ x("div", { className: "relative flex items-center", children: [
|
|
219
|
+
/* @__PURE__ */ i("button", { ref: l, onClick: p, children: e }),
|
|
220
|
+
t && /* @__PURE__ */ i(
|
|
221
|
+
"div",
|
|
222
|
+
{
|
|
223
|
+
ref: o,
|
|
224
|
+
className: `absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
|
|
225
|
+
${c ? "bottom-full mb-2" : "top-full mt-2"}
|
|
226
|
+
${d}`,
|
|
227
|
+
children: n
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
] });
|
|
231
|
+
}, F = ee(null), se = () => {
|
|
232
|
+
const e = te(F);
|
|
188
233
|
return e || (console.warn(
|
|
189
234
|
"⚠️ useModal() called outside of ModalProvider. Falling back to standalone modal usage."
|
|
190
235
|
), null);
|
|
191
236
|
};
|
|
192
|
-
function
|
|
237
|
+
function Ne({
|
|
193
238
|
id: e,
|
|
194
239
|
title: n,
|
|
195
240
|
children: r,
|
|
196
241
|
standalone: t = !1,
|
|
197
|
-
showFloatingClose:
|
|
242
|
+
showFloatingClose: s = !1,
|
|
198
243
|
containerClasses: c = "",
|
|
199
|
-
onClose:
|
|
244
|
+
onClose: a
|
|
200
245
|
}) {
|
|
201
|
-
const o =
|
|
202
|
-
d ? o.closeModal(e) :
|
|
246
|
+
const o = se(), l = o && typeof o.openModal == "function", d = !t && l, [f, u] = w(!1), p = d ? o.isOpen(e) : f, g = () => {
|
|
247
|
+
d ? o.closeModal(e) : u(!1), a && a();
|
|
203
248
|
};
|
|
204
|
-
return
|
|
249
|
+
return z(() => (p ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
205
250
|
document.body.style.overflow = "";
|
|
206
|
-
}), [
|
|
251
|
+
}), [p]), p ? /* @__PURE__ */ i("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ x(
|
|
207
252
|
"div",
|
|
208
253
|
{
|
|
209
254
|
className: `bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${c}`,
|
|
210
255
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
n && /* @__PURE__ */
|
|
213
|
-
|
|
256
|
+
/* @__PURE__ */ x("div", { className: "flex justify-between items-center relative", children: [
|
|
257
|
+
n && /* @__PURE__ */ i("h2", { className: "text-lg font-semibold", children: n }),
|
|
258
|
+
s && /* @__PURE__ */ i(
|
|
214
259
|
"button",
|
|
215
260
|
{
|
|
216
|
-
onClick: () =>
|
|
261
|
+
onClick: () => g(),
|
|
217
262
|
className: "text-gray-500 hover:text-gray-700 absolute top-2 right-3",
|
|
218
263
|
"aria-label": "Close modal",
|
|
219
264
|
children: "✕"
|
|
220
265
|
}
|
|
221
266
|
)
|
|
222
267
|
] }),
|
|
223
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ i("div", { className: "text-sm text-gray-700", children: r })
|
|
224
269
|
]
|
|
225
270
|
}
|
|
226
271
|
) }) : null;
|
|
227
272
|
}
|
|
228
|
-
function
|
|
229
|
-
const [n, r] =
|
|
230
|
-
r((o) => ({ ...o, [
|
|
231
|
-
}, []),
|
|
232
|
-
r((o) => ({ ...o, [
|
|
233
|
-
}, []), c =
|
|
234
|
-
return /* @__PURE__ */
|
|
273
|
+
function Se({ children: e }) {
|
|
274
|
+
const [n, r] = w({}), t = v((a) => {
|
|
275
|
+
r((o) => ({ ...o, [a]: !0 }));
|
|
276
|
+
}, []), s = v((a) => {
|
|
277
|
+
r((o) => ({ ...o, [a]: !1 }));
|
|
278
|
+
}, []), c = v((a) => !!n[a], [n]);
|
|
279
|
+
return /* @__PURE__ */ i(F.Provider, { value: { openModal: t, closeModal: s, isOpen: c }, children: e });
|
|
235
280
|
}
|
|
236
|
-
let
|
|
237
|
-
function
|
|
238
|
-
|
|
281
|
+
let I = null, R = {};
|
|
282
|
+
function ae(e) {
|
|
283
|
+
I = e;
|
|
239
284
|
}
|
|
240
|
-
function
|
|
241
|
-
|
|
285
|
+
function je(e) {
|
|
286
|
+
R = { ...R, ...e };
|
|
242
287
|
}
|
|
243
|
-
function
|
|
244
|
-
return
|
|
288
|
+
function ie() {
|
|
289
|
+
return R;
|
|
245
290
|
}
|
|
246
|
-
function
|
|
247
|
-
|
|
291
|
+
function Pe(e, n, r = 3e3, t) {
|
|
292
|
+
I ? I(e, n, r, t) : console.warn("Toast system is not mounted");
|
|
248
293
|
}
|
|
249
|
-
var
|
|
294
|
+
var Z = {
|
|
250
295
|
color: void 0,
|
|
251
296
|
size: void 0,
|
|
252
297
|
className: void 0,
|
|
253
298
|
style: void 0,
|
|
254
299
|
attr: void 0
|
|
255
|
-
},
|
|
256
|
-
function
|
|
300
|
+
}, A = h.createContext && /* @__PURE__ */ h.createContext(Z), ce = ["attr", "size", "title"];
|
|
301
|
+
function de(e, n) {
|
|
257
302
|
if (e == null) return {};
|
|
258
|
-
var r =
|
|
303
|
+
var r = ue(e, n), t, s;
|
|
259
304
|
if (Object.getOwnPropertySymbols) {
|
|
260
305
|
var c = Object.getOwnPropertySymbols(e);
|
|
261
|
-
for (
|
|
262
|
-
t = c[
|
|
306
|
+
for (s = 0; s < c.length; s++)
|
|
307
|
+
t = c[s], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]);
|
|
263
308
|
}
|
|
264
309
|
return r;
|
|
265
310
|
}
|
|
266
|
-
function
|
|
311
|
+
function ue(e, n) {
|
|
267
312
|
if (e == null) return {};
|
|
268
313
|
var r = {};
|
|
269
314
|
for (var t in e)
|
|
@@ -273,45 +318,45 @@ function ce(e, n) {
|
|
|
273
318
|
}
|
|
274
319
|
return r;
|
|
275
320
|
}
|
|
276
|
-
function
|
|
277
|
-
return
|
|
321
|
+
function M() {
|
|
322
|
+
return M = Object.assign ? Object.assign.bind() : function(e) {
|
|
278
323
|
for (var n = 1; n < arguments.length; n++) {
|
|
279
324
|
var r = arguments[n];
|
|
280
325
|
for (var t in r)
|
|
281
326
|
Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]);
|
|
282
327
|
}
|
|
283
328
|
return e;
|
|
284
|
-
},
|
|
329
|
+
}, M.apply(this, arguments);
|
|
285
330
|
}
|
|
286
|
-
function
|
|
331
|
+
function B(e, n) {
|
|
287
332
|
var r = Object.keys(e);
|
|
288
333
|
if (Object.getOwnPropertySymbols) {
|
|
289
334
|
var t = Object.getOwnPropertySymbols(e);
|
|
290
|
-
n && (t = t.filter(function(
|
|
291
|
-
return Object.getOwnPropertyDescriptor(e,
|
|
335
|
+
n && (t = t.filter(function(s) {
|
|
336
|
+
return Object.getOwnPropertyDescriptor(e, s).enumerable;
|
|
292
337
|
})), r.push.apply(r, t);
|
|
293
338
|
}
|
|
294
339
|
return r;
|
|
295
340
|
}
|
|
296
|
-
function
|
|
341
|
+
function $(e) {
|
|
297
342
|
for (var n = 1; n < arguments.length; n++) {
|
|
298
343
|
var r = arguments[n] != null ? arguments[n] : {};
|
|
299
|
-
n % 2 ?
|
|
300
|
-
|
|
301
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
344
|
+
n % 2 ? B(Object(r), !0).forEach(function(t) {
|
|
345
|
+
fe(e, t, r[t]);
|
|
346
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : B(Object(r)).forEach(function(t) {
|
|
302
347
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
303
348
|
});
|
|
304
349
|
}
|
|
305
350
|
return e;
|
|
306
351
|
}
|
|
307
|
-
function
|
|
308
|
-
return n =
|
|
352
|
+
function fe(e, n, r) {
|
|
353
|
+
return n = ge(n), n in e ? Object.defineProperty(e, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = r, e;
|
|
309
354
|
}
|
|
310
|
-
function
|
|
311
|
-
var n =
|
|
355
|
+
function ge(e) {
|
|
356
|
+
var n = pe(e, "string");
|
|
312
357
|
return typeof n == "symbol" ? n : n + "";
|
|
313
358
|
}
|
|
314
|
-
function
|
|
359
|
+
function pe(e, n) {
|
|
315
360
|
if (typeof e != "object" || !e) return e;
|
|
316
361
|
var r = e[Symbol.toPrimitive];
|
|
317
362
|
if (r !== void 0) {
|
|
@@ -321,77 +366,77 @@ function fe(e, n) {
|
|
|
321
366
|
}
|
|
322
367
|
return (n === "string" ? String : Number)(e);
|
|
323
368
|
}
|
|
324
|
-
function
|
|
325
|
-
return e && e.map((n, r) => /* @__PURE__ */
|
|
369
|
+
function G(e) {
|
|
370
|
+
return e && e.map((n, r) => /* @__PURE__ */ h.createElement(n.tag, $({
|
|
326
371
|
key: r
|
|
327
|
-
}, n.attr),
|
|
372
|
+
}, n.attr), G(n.child)));
|
|
328
373
|
}
|
|
329
|
-
function
|
|
330
|
-
return (n) => /* @__PURE__ */
|
|
331
|
-
attr:
|
|
332
|
-
}, n),
|
|
374
|
+
function be(e) {
|
|
375
|
+
return (n) => /* @__PURE__ */ h.createElement(xe, M({
|
|
376
|
+
attr: $({}, e.attr)
|
|
377
|
+
}, n), G(e.child));
|
|
333
378
|
}
|
|
334
|
-
function
|
|
379
|
+
function xe(e) {
|
|
335
380
|
var n = (r) => {
|
|
336
381
|
var {
|
|
337
382
|
attr: t,
|
|
338
|
-
size:
|
|
383
|
+
size: s,
|
|
339
384
|
title: c
|
|
340
|
-
} = e,
|
|
341
|
-
return r.className && (
|
|
385
|
+
} = e, a = de(e, ce), o = s || r.size || "1em", l;
|
|
386
|
+
return r.className && (l = r.className), e.className && (l = (l ? l + " " : "") + e.className), /* @__PURE__ */ h.createElement("svg", M({
|
|
342
387
|
stroke: "currentColor",
|
|
343
388
|
fill: "currentColor",
|
|
344
389
|
strokeWidth: "0"
|
|
345
|
-
}, r.attr, t,
|
|
346
|
-
className:
|
|
347
|
-
style:
|
|
390
|
+
}, r.attr, t, a, {
|
|
391
|
+
className: l,
|
|
392
|
+
style: $($({
|
|
348
393
|
color: e.color || r.color
|
|
349
394
|
}, r.style), e.style),
|
|
350
395
|
height: o,
|
|
351
396
|
width: o,
|
|
352
397
|
xmlns: "http://www.w3.org/2000/svg"
|
|
353
|
-
}), c && /* @__PURE__ */
|
|
398
|
+
}), c && /* @__PURE__ */ h.createElement("title", null, c), e.children);
|
|
354
399
|
};
|
|
355
|
-
return
|
|
400
|
+
return A !== void 0 ? /* @__PURE__ */ h.createElement(A.Consumer, null, (r) => n(r)) : n(Z);
|
|
356
401
|
}
|
|
357
|
-
function
|
|
358
|
-
return
|
|
402
|
+
function me(e) {
|
|
403
|
+
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);
|
|
359
404
|
}
|
|
360
|
-
const
|
|
405
|
+
const he = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
361
406
|
const n = Math.random() * 16 | 0;
|
|
362
407
|
return (e === "x" ? n : n & 3 | 8).toString(16);
|
|
363
|
-
}),
|
|
364
|
-
const [e, n] =
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const o =
|
|
368
|
-
n((
|
|
369
|
-
n((
|
|
408
|
+
}), Le = () => {
|
|
409
|
+
const [e, n] = w([]);
|
|
410
|
+
z(() => {
|
|
411
|
+
ae((t, s, c, a) => {
|
|
412
|
+
const o = he();
|
|
413
|
+
n((l) => [...l, { id: o, type: t, message: s, config: a }]), setTimeout(() => {
|
|
414
|
+
n((l) => l.filter((d) => d.id !== o));
|
|
370
415
|
}, c);
|
|
371
416
|
});
|
|
372
417
|
}, []);
|
|
373
|
-
const r =
|
|
374
|
-
return /* @__PURE__ */
|
|
375
|
-
var
|
|
376
|
-
const
|
|
377
|
-
return /* @__PURE__ */
|
|
418
|
+
const r = ie();
|
|
419
|
+
return /* @__PURE__ */ i("div", { className: "fixed top-5 right-5 z-[9999] flex flex-col gap-2", children: e.map((t) => {
|
|
420
|
+
var l, d, f, u, p, g, b, m, y, C, S, j, P;
|
|
421
|
+
const s = ((l = t.config) == null ? void 0 : l.icon) || ((d = r.icons) == null ? void 0 : d[t.type]) || ye(t.type), c = ((f = t.config) == null ? void 0 : f.bgColor) || ((p = (u = r.colors) == null ? void 0 : u[t.type]) == null ? void 0 : p.bg) || "bg-white dark:bg-gray-800", a = ((g = t.config) == null ? void 0 : g.textColor) || ((m = (b = r.colors) == null ? void 0 : b[t.type]) == null ? void 0 : m.text) || "text-gray-700 dark:text-gray-300", o = ((y = t.config) == null ? void 0 : y.iconContainerClass) || "w-8 h-8 mr-3 text-xl flex items-center justify-center";
|
|
422
|
+
return /* @__PURE__ */ x(
|
|
378
423
|
"div",
|
|
379
424
|
{
|
|
380
|
-
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${c} ${
|
|
425
|
+
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${c} ${a}`,
|
|
381
426
|
children: [
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
((
|
|
385
|
-
((
|
|
386
|
-
!((
|
|
427
|
+
/* @__PURE__ */ i("div", { className: o, children: s }),
|
|
428
|
+
/* @__PURE__ */ x("div", { className: "flex-1 me-3", children: [
|
|
429
|
+
((C = t.config) == null ? void 0 : C.title) && /* @__PURE__ */ i("div", { className: "font-semibold text-black", children: t.config.title }),
|
|
430
|
+
((S = t.config) == null ? void 0 : S.description) && /* @__PURE__ */ i("div", { className: "text-sm text-gray-500", children: t.config.description }),
|
|
431
|
+
!((j = t.config) != null && j.title) && !((P = t.config) != null && P.description) && /* @__PURE__ */ i("div", { className: "text-sm", children: t.message })
|
|
387
432
|
] }),
|
|
388
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ i(
|
|
389
434
|
"button",
|
|
390
435
|
{
|
|
391
|
-
onClick: () => n((
|
|
436
|
+
onClick: () => n((L) => L.filter((E) => E.id !== t.id)),
|
|
392
437
|
className: "ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white",
|
|
393
438
|
"aria-label": "Close",
|
|
394
|
-
children: /* @__PURE__ */
|
|
439
|
+
children: /* @__PURE__ */ i(me, { size: 18 })
|
|
395
440
|
}
|
|
396
441
|
)
|
|
397
442
|
]
|
|
@@ -400,7 +445,7 @@ const xe = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
400
445
|
);
|
|
401
446
|
}) });
|
|
402
447
|
};
|
|
403
|
-
function
|
|
448
|
+
function ye(e) {
|
|
404
449
|
switch (e) {
|
|
405
450
|
case "success":
|
|
406
451
|
return "✅";
|
|
@@ -413,13 +458,14 @@ function me(e) {
|
|
|
413
458
|
}
|
|
414
459
|
}
|
|
415
460
|
export {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
Se as
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
461
|
+
Ce as Button,
|
|
462
|
+
Oe as Dropdown,
|
|
463
|
+
re as Input,
|
|
464
|
+
Ne as Modal,
|
|
465
|
+
F as ModalContext,
|
|
466
|
+
Se as ModalProvider,
|
|
467
|
+
Le as Toast,
|
|
468
|
+
je as setToastDefaults,
|
|
469
|
+
Pe as showToast,
|
|
470
|
+
se as useModal
|
|
425
471
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
(function(u,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):(u=typeof globalThis<"u"?globalThis:u||self,o(u.TailwindUiKit={},u.jsxRuntime,u.React))})(this,function(u,o,
|
|
2
|
-
${
|
|
3
|
-
${he} ${be} ${pe} ${c}`}),v&&r&&b&&o.jsx("label",{htmlFor:z,className:`ms-1 ${ue[b]} ${c}`,children:r})]}),y&&o.jsx("p",{className:`mt-1 text-xs ${N==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,children:y})]})});_.displayName="Input";const G={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"},W={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"},q={flat:"shadow-none",rounded:"rounded-md",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},H=({children:e,variant:n="primary",size:r="md",type:t="button",shape:s="rounded",className:d="",isLoading:a=!1,disabled:l=!1,...c})=>{const f=l||a,g=["inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",G[n],W[r],q[s],s==="flat"?"shadow-none":"shadow-sm",f?"opacity-50 cursor-not-allowed pointer-events-none":"",d].filter(Boolean).join(" ");return o.jsxs("button",{type:t,className:g,disabled:f,...c,children:[a&&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]})},E=i.createContext(null),D=()=>{const e=i.useContext(E);return e||(console.warn("⚠️ useModal() called outside of ModalProvider. Falling back to standalone modal usage."),null)};function K({id:e,title:n,children:r,standalone:t=!1,showFloatingClose:s=!1,containerClasses:d="",onClose:a}){const l=D(),c=l&&typeof l.openModal=="function",f=!t&&c,[g,b]=i.useState(!1),p=f?l.isOpen(e):g,x=()=>{f?l.closeModal(e):b(!1),a&&a()};return i.useEffect(()=>(p?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[p]),p?o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",children:o.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${d}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),s&&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 U({children:e}){const[n,r]=i.useState({}),t=i.useCallback(a=>{r(l=>({...l,[a]:!0}))},[]),s=i.useCallback(a=>{r(l=>({...l,[a]:!1}))},[]),d=i.useCallback(a=>!!n[a],[n]);return o.jsx(E.Provider,{value:{openModal:t,closeModal:s,isOpen:d},children:e})}let L=null,$={};function J(e){L=e}function Q(e){$={...$,...e}}function V(){return $}function X(e,n,r=3e3,t){L?L(e,n,r,t):console.warn("Toast system is not mounted")}var A={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},B=i.createContext&&i.createContext(A),Y=["attr","size","title"];function R(e,n){if(e==null)return{};var r=ee(e,n),t,s;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);for(s=0;s<d.length;s++)t=d[s],!(n.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function ee(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 C(){return C=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},C.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(s){return Object.getOwnPropertyDescriptor(e,s).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){te(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 te(e,n,r){return n=re(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function re(e){var n=ne(e,"string");return typeof n=="symbol"?n:n+""}function ne(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)=>i.createElement(n.tag,O({key:r},n.attr),Z(n.child)))}function oe(e){return n=>i.createElement(le,C({attr:O({},e.attr)},n),Z(e.child))}function le(e){var n=r=>{var{attr:t,size:s,title:d}=e,a=R(e,Y),l=s||r.size||"1em",c;return r.className&&(c=r.className),e.className&&(c=(c?c+" ":"")+e.className),i.createElement("svg",C({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,t,a,{className:c,style:O(O({color:e.color||r.color},r.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),d&&i.createElement("title",null,d),e.children)};return B!==void 0?i.createElement(B.Consumer,null,r=>n(r)):n(A)}function se(e){return oe({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 ae=()=>"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)}),ie=()=>{const[e,n]=i.useState([]);i.useEffect(()=>{J((t,s,d,a)=>{const l=ae();n(c=>[...c,{id:l,type:t,message:s,config:a}]),setTimeout(()=>{n(c=>c.filter(f=>f.id!==l))},d)})},[]);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 c,f,g,b,p,x,h,y,N,m,S,j,P;const s=((c=t.config)==null?void 0:c.icon)||((f=r.icons)==null?void 0:f[t.type])||ce(t.type),d=((g=t.config)==null?void 0:g.bgColor)||((p=(b=r.colors)==null?void 0:b[t.type])==null?void 0:p.bg)||"bg-white dark:bg-gray-800",a=((x=t.config)==null?void 0:x.textColor)||((y=(h=r.colors)==null?void 0:h[t.type])==null?void 0:y.text)||"text-gray-700 dark:text-gray-300",l=((N=t.config)==null?void 0:N.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 ${d} ${a}`,children:[o.jsx("div",{className:l,children:s}),o.jsxs("div",{className:"flex-1 me-3",children:[((m=t.config)==null?void 0:m.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)&&!((P=t.config)!=null&&P.description)&&o.jsx("div",{className:"text-sm",children:t.message})]}),o.jsx("button",{onClick:()=>n(k=>k.filter(M=>M.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(se,{size:18})})]},t.id)})})};function ce(e){switch(e){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}u.Button=H,u.Input=_,u.Modal=K,u.ModalContext=E,u.ModalProvider=U,u.Toast=ie,u.setToastDefaults=Q,u.showToast=X,u.useModal=D,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(u,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):(u=typeof globalThis<"u"?globalThis:u||self,o(u.TailwindUiKit={},u.jsxRuntime,u.React))})(this,function(u,o,s){"use strict";"use client";const I=s.forwardRef((e,n)=>{const{label:r,id:t,inputSize:i="md",shape:d="rounded",validate:c,onValidatedChange:l,className:a="",icon:f,iconPosition:b="left",floatingLabelStyle:g,onChange:x,isValid:p,isInvalid:h,feedback:m,feedbackType:y="invalid",...v}=e,[S,j]=s.useState("default"),P=C=>{const D=C.target.value,L=(c==null?void 0:c(D))??"default";j(L),l==null||l(C,L),x==null||x(C)},k={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"},E={flat:"rounded-none",rounded:"rounded-md",pill:"rounded-full"},ue={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"},fe={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"},ge=(C,D,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(D)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=k[i]||k.md,pe=E[d]||E.flat,xe=ge(S,p,h),he=b==="start"||b==="left"?"left-0 ps-3.5":"right-0 pe-3.5",me=f&&(b==="start"||b==="left")?"ps-10":f?"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 ${p?"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:[f&&o.jsx("div",{className:`absolute inset-y-0 flex items-center ${he}`,children:o.jsx("span",{className:"text-gray-500",children:f})}),o.jsx("input",{...v,id:$,ref:n,placeholder:w?" ":v.placeholder,onChange:P,className:`border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
|
|
2
|
+
${w&&g?ue[g]:be}
|
|
3
|
+
${me} ${pe} ${xe} ${a}`}),w&&r&&g&&o.jsx("label",{htmlFor:$,className:`ms-1 ${fe[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})]})});I.displayName="Input";const G={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"},H={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"},W={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:i="rounded",className:d="",isLoading:c=!1,disabled:l=!1,...a})=>{const f=l||c,b=["inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",G[n],H[r],W[i],i==="flat"?"shadow-none":"shadow-sm",f?"opacity-50 cursor-not-allowed pointer-events-none":"",d].filter(Boolean).join(" ");return o.jsxs("button",{type:t,className:b,disabled:f,...a,children:[c&&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,i]=s.useState(!1),[d,c]=s.useState(!1),l=s.useRef(null),a=s.useRef(null),f=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]),b=s.useCallback(p=>{const h=p.target;l.current&&!l.current.contains(h)&&a.current&&!a.current.contains(h)&&i(!1)},[]),g=s.useCallback(()=>{if(!a.current||!l.current)return;const p=a.current.getBoundingClientRect(),h=l.current.getBoundingClientRect(),m=window.innerHeight-p.bottom,y=p.top;c(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",b),()=>document.removeEventListener("mousedown",b)),[b]);const x=s.useCallback(()=>i(p=>!p),[]);return o.jsxs("div",{className:"relative flex items-center",children:[o.jsx("button",{ref:a,onClick:x,children:e}),t&&o.jsx("div",{ref:l,className:`absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
|
|
4
|
+
${d?"bottom-full mb-2":"top-full mt-2"}
|
|
5
|
+
${f}`,children:n})]})},M=s.createContext(null),_=()=>{const e=s.useContext(M);return e||(console.warn("⚠️ useModal() called outside of ModalProvider. Falling back to standalone modal usage."),null)};function U({id:e,title:n,children:r,standalone:t=!1,showFloatingClose:i=!1,containerClasses:d="",onClose:c}){const l=_(),a=l&&typeof l.openModal=="function",f=!t&&a,[b,g]=s.useState(!1),x=f?l.isOpen(e):b,p=()=>{f?l.closeModal(e):g(!1),c&&c()};return s.useEffect(()=>(x?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[x]),x?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 ${d}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),i&&o.jsx("button",{onClick:()=>p(),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 J({children:e}){const[n,r]=s.useState({}),t=s.useCallback(c=>{r(l=>({...l,[c]:!0}))},[]),i=s.useCallback(c=>{r(l=>({...l,[c]:!1}))},[]),d=s.useCallback(c=>!!n[c],[n]);return o.jsx(M.Provider,{value:{openModal:t,closeModal:i,isOpen:d},children:e})}let T=null,z={};function Q(e){T=e}function V(e){z={...z,...e}}function X(){return z}function Y(e,n,r=3e3,t){T?T(e,n,r,t):console.warn("Toast system is not mounted")}var A={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},B=s.createContext&&s.createContext(A),R=["attr","size","title"];function ee(e,n){if(e==null)return{};var r=te(e,n),t,i;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);for(i=0;i<d.length;i++)t=d[i],!(n.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function te(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 O(){return O=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},O.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(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,t)}return r}function N(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){re(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 re(e,n,r){return n=ne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ne(e){var n=oe(e,"string");return typeof n=="symbol"?n:n+""}function oe(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,N({key:r},n.attr),Z(n.child)))}function se(e){return n=>s.createElement(le,O({attr:N({},e.attr)},n),Z(e.child))}function le(e){var n=r=>{var{attr:t,size:i,title:d}=e,c=ee(e,R),l=i||r.size||"1em",a;return r.className&&(a=r.className),e.className&&(a=(a?a+" ":"")+e.className),s.createElement("svg",O({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,t,c,{className:a,style:N(N({color:e.color||r.color},r.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),d&&s.createElement("title",null,d),e.children)};return B!==void 0?s.createElement(B.Consumer,null,r=>n(r)):n(A)}function ae(e){return se({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 ie=()=>"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)}),ce=()=>{const[e,n]=s.useState([]);s.useEffect(()=>{Q((t,i,d,c)=>{const l=ie();n(a=>[...a,{id:l,type:t,message:i,config:c}]),setTimeout(()=>{n(a=>a.filter(f=>f.id!==l))},d)})},[]);const r=X();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(t=>{var a,f,b,g,x,p,h,m,y,v,S,j,P;const i=((a=t.config)==null?void 0:a.icon)||((f=r.icons)==null?void 0:f[t.type])||de(t.type),d=((b=t.config)==null?void 0:b.bgColor)||((x=(g=r.colors)==null?void 0:g[t.type])==null?void 0:x.bg)||"bg-white dark:bg-gray-800",c=((p=t.config)==null?void 0:p.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 ${d} ${c}`,children:[o.jsx("div",{className:l,children:i}),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)&&!((P=t.config)!=null&&P.description)&&o.jsx("div",{className:"text-sm",children:t.message})]}),o.jsx("button",{onClick:()=>n(k=>k.filter(E=>E.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(ae,{size:18})})]},t.id)})})};function de(e){switch(e){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}u.Button=q,u.Dropdown=K,u.Input=I,u.Modal=U,u.ModalContext=M,u.ModalProvider=J,u.Toast=ce,u.setToastDefaults=V,u.showToast=Y,u.useModal=_,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|