tailwind-ux-kit 1.0.91 → 1.0.96
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/Dropdown.d.ts +2 -1
- package/lib/tailwind-ux-kit.es.js +318 -305
- package/lib/tailwind-ux-kit.umd.js +12 -12
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { jsxs as k, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import T, { forwardRef as ae, useState as M, useMemo as z, useId as be, useRef as K, useCallback as A, useEffect as R, createContext as le, useContext as ie } from "react";
|
|
4
|
+
const ee = {
|
|
5
5
|
xs: "text-xs px-2 py-1",
|
|
6
6
|
sm: "text-sm px-3 py-1.5",
|
|
7
7
|
md: "text-sm px-3 py-3",
|
|
8
8
|
lg: "text-lg px-5 py-3"
|
|
9
|
-
},
|
|
9
|
+
}, te = {
|
|
10
10
|
flat: "rounded-none",
|
|
11
11
|
rounded: "rounded-sm",
|
|
12
12
|
pill: "rounded-full"
|
|
@@ -33,96 +33,96 @@ const V = {
|
|
|
33
33
|
default:
|
|
34
34
|
return "border-gray-300 focus:ring-blue-500";
|
|
35
35
|
}
|
|
36
|
-
}, ye =
|
|
36
|
+
}, ye = ae((e, n) => {
|
|
37
37
|
const {
|
|
38
38
|
label: t,
|
|
39
39
|
id: r,
|
|
40
40
|
inputSize: s = "md",
|
|
41
41
|
shape: c = "rounded",
|
|
42
42
|
validate: p,
|
|
43
|
-
onValidatedChange:
|
|
43
|
+
onValidatedChange: u,
|
|
44
44
|
className: d = "",
|
|
45
45
|
icon: a,
|
|
46
46
|
iconPosition: o = "left",
|
|
47
47
|
floatingLabelStyle: l,
|
|
48
|
-
onChange:
|
|
49
|
-
isValid:
|
|
50
|
-
isInvalid:
|
|
51
|
-
feedback:
|
|
52
|
-
iconClasses:
|
|
53
|
-
feedbackType:
|
|
48
|
+
onChange: f,
|
|
49
|
+
isValid: x,
|
|
50
|
+
isInvalid: g,
|
|
51
|
+
feedback: b,
|
|
52
|
+
iconClasses: $,
|
|
53
|
+
feedbackType: S = "invalid",
|
|
54
54
|
labelClasses: N = "",
|
|
55
|
-
inputType:
|
|
56
|
-
inputPattern:
|
|
57
|
-
...
|
|
58
|
-
} = e, [
|
|
59
|
-
(
|
|
60
|
-
const
|
|
61
|
-
|
|
55
|
+
inputType: h = "",
|
|
56
|
+
inputPattern: v,
|
|
57
|
+
...m
|
|
58
|
+
} = e, [y, D] = M("default"), E = T.useCallback(
|
|
59
|
+
(j) => {
|
|
60
|
+
const O = j.target.value, Z = (p == null ? void 0 : p(O)) ?? "default";
|
|
61
|
+
D(Z), u == null || u(j, Z), f == null || f(j);
|
|
62
62
|
},
|
|
63
|
-
[p,
|
|
64
|
-
),
|
|
65
|
-
() => he(
|
|
66
|
-
[
|
|
67
|
-
),
|
|
63
|
+
[p, u, f]
|
|
64
|
+
), w = z(() => r || (typeof t == "string" ? `input-${t.toLowerCase().replace(/\s+/g, "-")}` : `input-${Math.random().toString(36).slice(2)}`), [r, t]), L = !!l, C = ee[s] || ee.md, P = te[c] || te.flat, I = z(
|
|
65
|
+
() => he(y, x, g),
|
|
66
|
+
[y, x, g]
|
|
67
|
+
), B = z(() => o === "start" || o === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", [o]), _ = z(() => a ? o === "start" || o === "left" ? "ps-10" : "pe-10" : "", [a, o]), F = (j) => {
|
|
68
68
|
var H;
|
|
69
|
-
const
|
|
70
|
-
!(
|
|
71
|
-
const W = /^\d$/,
|
|
72
|
-
switch (
|
|
69
|
+
const O = j.key;
|
|
70
|
+
!(j.ctrlKey || j.metaKey || O.length !== 1 || ["Backspace", "ArrowLeft", "ArrowRight", "Delete", "Tab"].includes(O)) && (() => {
|
|
71
|
+
const W = /^\d$/, Y = /^[a-zA-Z]$/;
|
|
72
|
+
switch (h) {
|
|
73
73
|
case "numeric":
|
|
74
74
|
case "number":
|
|
75
75
|
case "integer":
|
|
76
|
-
return !W.test(
|
|
76
|
+
return !W.test(O);
|
|
77
77
|
case "decimal":
|
|
78
|
-
return !W.test(
|
|
78
|
+
return !W.test(O) && O !== "." && O !== "Backspace" && O !== "Tab";
|
|
79
79
|
case "alphabetic":
|
|
80
|
-
return !
|
|
80
|
+
return !Y.test(O);
|
|
81
81
|
case "custom":
|
|
82
|
-
return
|
|
82
|
+
return v ? !v.test(O) : !1;
|
|
83
83
|
default:
|
|
84
84
|
return !1;
|
|
85
85
|
}
|
|
86
|
-
})() &&
|
|
87
|
-
},
|
|
88
|
-
var
|
|
89
|
-
const
|
|
86
|
+
})() && j.preventDefault(), (H = m.onKeyDown) == null || H.call(m, j);
|
|
87
|
+
}, U = (j) => {
|
|
88
|
+
var X;
|
|
89
|
+
const O = j.clipboardData.getData("Text");
|
|
90
90
|
(() => {
|
|
91
|
-
const H = /^\d+$/, W = /^\d*\.?\d*$/,
|
|
92
|
-
switch (
|
|
91
|
+
const H = /^\d+$/, W = /^\d*\.?\d*$/, Y = /^[a-zA-Z]+$/;
|
|
92
|
+
switch (h) {
|
|
93
93
|
case "numeric":
|
|
94
94
|
case "number":
|
|
95
95
|
case "integer":
|
|
96
|
-
return !H.test(
|
|
96
|
+
return !H.test(O);
|
|
97
97
|
case "decimal":
|
|
98
|
-
return !W.test(
|
|
98
|
+
return !W.test(O);
|
|
99
99
|
case "alphabetic":
|
|
100
|
-
return !
|
|
100
|
+
return !Y.test(O);
|
|
101
101
|
case "custom":
|
|
102
|
-
return
|
|
102
|
+
return v ? !v.test(O) : !1;
|
|
103
103
|
default:
|
|
104
104
|
return !1;
|
|
105
105
|
}
|
|
106
|
-
})() &&
|
|
106
|
+
})() && j.preventDefault(), (X = m.onPaste) == null || X.call(m, j);
|
|
107
107
|
};
|
|
108
|
-
return /* @__PURE__ */
|
|
108
|
+
return /* @__PURE__ */ k(
|
|
109
109
|
"div",
|
|
110
110
|
{
|
|
111
|
-
className: `w-full relative ${
|
|
111
|
+
className: `w-full relative ${L ? "z-0" : ""} tailwind-ux-input`,
|
|
112
112
|
children: [
|
|
113
|
-
!
|
|
113
|
+
!L && t && /* @__PURE__ */ i(
|
|
114
114
|
"label",
|
|
115
115
|
{
|
|
116
|
-
htmlFor:
|
|
117
|
-
className: `block mb-1 text-sm ${
|
|
116
|
+
htmlFor: w,
|
|
117
|
+
className: `block mb-1 text-sm ${x ? "text-green-700 dark:text-green-500" : g ? "text-red-700 dark:text-red-500" : "text-gray-700"} ${N}`,
|
|
118
118
|
children: t
|
|
119
119
|
}
|
|
120
120
|
),
|
|
121
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ k("div", { className: "relative w-full", children: [
|
|
122
122
|
a && /* @__PURE__ */ i(
|
|
123
123
|
"div",
|
|
124
124
|
{
|
|
125
|
-
className: `absolute inset-y-0 flex items-center ${
|
|
125
|
+
className: `absolute inset-y-0 flex items-center ${B} ${$}`,
|
|
126
126
|
"aria-hidden": "true",
|
|
127
127
|
children: a
|
|
128
128
|
}
|
|
@@ -130,34 +130,34 @@ const V = {
|
|
|
130
130
|
/* @__PURE__ */ i(
|
|
131
131
|
"input",
|
|
132
132
|
{
|
|
133
|
-
...
|
|
134
|
-
id:
|
|
133
|
+
...m,
|
|
134
|
+
id: w,
|
|
135
135
|
ref: n,
|
|
136
|
-
placeholder:
|
|
137
|
-
onChange:
|
|
138
|
-
onKeyDown:
|
|
139
|
-
onPaste:
|
|
136
|
+
placeholder: L ? " " : m.placeholder,
|
|
137
|
+
onChange: E,
|
|
138
|
+
onKeyDown: F,
|
|
139
|
+
onPaste: U,
|
|
140
140
|
className: `border peer w-full block font-normal appearance-none focus:outline-none focus:ring-0 transition text-gray-900 placeholder-gray-600 border-gray-400
|
|
141
|
-
${
|
|
142
|
-
${
|
|
143
|
-
${_} ${
|
|
141
|
+
${C}
|
|
142
|
+
${L && l && me[l]}
|
|
143
|
+
${_} ${P} ${I} ${d}`
|
|
144
144
|
}
|
|
145
145
|
),
|
|
146
|
-
|
|
146
|
+
L && t && l && /* @__PURE__ */ i(
|
|
147
147
|
"label",
|
|
148
148
|
{
|
|
149
|
-
htmlFor:
|
|
149
|
+
htmlFor: w,
|
|
150
150
|
className: `ms-1 ${xe[l]} ${d}`,
|
|
151
151
|
children: t
|
|
152
152
|
}
|
|
153
153
|
)
|
|
154
154
|
] }),
|
|
155
|
-
|
|
155
|
+
b && /* @__PURE__ */ i(
|
|
156
156
|
"p",
|
|
157
157
|
{
|
|
158
|
-
className: `mt-1 text-xs ${
|
|
159
|
-
role:
|
|
160
|
-
children:
|
|
158
|
+
className: `mt-1 text-xs ${S === "invalid" ? "text-red-600 dark:text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
159
|
+
role: S === "invalid" ? "alert" : void 0,
|
|
160
|
+
children: b
|
|
161
161
|
}
|
|
162
162
|
)
|
|
163
163
|
]
|
|
@@ -198,39 +198,39 @@ const we = {
|
|
|
198
198
|
default:
|
|
199
199
|
return "border-gray-300 focus:ring-blue-500";
|
|
200
200
|
}
|
|
201
|
-
}, Se =
|
|
201
|
+
}, Se = ae((e, n) => {
|
|
202
202
|
const {
|
|
203
203
|
label: t,
|
|
204
204
|
id: r,
|
|
205
205
|
inputSize: s = "md",
|
|
206
206
|
shape: c = "rounded",
|
|
207
207
|
validate: p,
|
|
208
|
-
onValidatedChange:
|
|
208
|
+
onValidatedChange: u,
|
|
209
209
|
className: d = "",
|
|
210
210
|
icon: a,
|
|
211
211
|
iconPosition: o = "left",
|
|
212
212
|
floatingLabelStyle: l,
|
|
213
|
-
onChange:
|
|
214
|
-
isValid:
|
|
215
|
-
isInvalid:
|
|
216
|
-
feedback:
|
|
217
|
-
feedbackType:
|
|
218
|
-
children:
|
|
213
|
+
onChange: f,
|
|
214
|
+
isValid: x,
|
|
215
|
+
isInvalid: g,
|
|
216
|
+
feedback: b,
|
|
217
|
+
feedbackType: $ = "invalid",
|
|
218
|
+
children: S,
|
|
219
219
|
...N
|
|
220
|
-
} = e, [
|
|
221
|
-
const _ =
|
|
222
|
-
|
|
223
|
-
},
|
|
224
|
-
return /* @__PURE__ */
|
|
225
|
-
!
|
|
220
|
+
} = e, [h, v] = M("default"), m = be(), y = z(() => r || (typeof t == "string" ? `select-${t.toLowerCase().replace(/\s+/g, "-")}` : m), [r, t, m]), D = (B) => {
|
|
221
|
+
const _ = B.target.value, F = (p == null ? void 0 : p(_)) ?? "default";
|
|
222
|
+
v(F), u == null || u(B, F), f == null || f(B);
|
|
223
|
+
}, E = !!l, w = we[s], L = ve[c], C = ke(h, x, g);
|
|
224
|
+
return /* @__PURE__ */ k("div", { className: `w-full relative ${E ? "z-0" : ""}`, children: [
|
|
225
|
+
!E && t && /* @__PURE__ */ i(
|
|
226
226
|
"label",
|
|
227
227
|
{
|
|
228
|
-
htmlFor:
|
|
229
|
-
className: `block mb-1 text-sm ${
|
|
228
|
+
htmlFor: y,
|
|
229
|
+
className: `block mb-1 text-sm ${x ? "text-green-700" : g ? "text-red-700" : "text-gray-700"}`,
|
|
230
230
|
children: t
|
|
231
231
|
}
|
|
232
232
|
),
|
|
233
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ k("div", { className: "relative w-full", children: [
|
|
234
234
|
a && /* @__PURE__ */ i(
|
|
235
235
|
"div",
|
|
236
236
|
{
|
|
@@ -242,30 +242,30 @@ const we = {
|
|
|
242
242
|
"select",
|
|
243
243
|
{
|
|
244
244
|
...N,
|
|
245
|
-
id:
|
|
245
|
+
id: y,
|
|
246
246
|
ref: n,
|
|
247
|
-
onChange:
|
|
247
|
+
onChange: D,
|
|
248
248
|
className: `border peer w-full block font-normal appearance-none focus:outline-none focus:ring-0 transition text-gray-600 placeholder-[#798ba5] border-gray-400
|
|
249
|
-
${
|
|
250
|
-
${
|
|
251
|
-
${
|
|
252
|
-
children:
|
|
249
|
+
${w} ${a && (o === "start" || o === "left") ? "ps-10" : a ? "pe-10" : ""}
|
|
250
|
+
${E && l && Ce[l]}
|
|
251
|
+
${L} ${C} ${d}`,
|
|
252
|
+
children: S
|
|
253
253
|
}
|
|
254
254
|
),
|
|
255
|
-
|
|
255
|
+
E && t && l && /* @__PURE__ */ i(
|
|
256
256
|
"label",
|
|
257
257
|
{
|
|
258
|
-
htmlFor:
|
|
258
|
+
htmlFor: y,
|
|
259
259
|
className: `ms-1 ${$e[l]} ${d}`,
|
|
260
260
|
children: t
|
|
261
261
|
}
|
|
262
262
|
)
|
|
263
263
|
] }),
|
|
264
|
-
|
|
264
|
+
b && /* @__PURE__ */ i(
|
|
265
265
|
"p",
|
|
266
266
|
{
|
|
267
|
-
className: `mt-1 text-xs ${
|
|
268
|
-
children:
|
|
267
|
+
className: `mt-1 text-xs ${$ === "invalid" ? "text-red-600" : "text-green-600"}`,
|
|
268
|
+
children: b
|
|
269
269
|
}
|
|
270
270
|
)
|
|
271
271
|
] });
|
|
@@ -297,13 +297,13 @@ const Ne = {
|
|
|
297
297
|
"soft-info": "btn-soft-info",
|
|
298
298
|
"soft-dark": "btn-soft-dark",
|
|
299
299
|
"soft-light": "btn-soft-light"
|
|
300
|
-
},
|
|
300
|
+
}, Ee = {
|
|
301
301
|
xs: "px-3 py-2 text-xs",
|
|
302
302
|
sm: "px-3 py-2 text-sm",
|
|
303
303
|
md: "px-5 py-2.5 text-sm",
|
|
304
304
|
lg: "px-5 py-3 text-base",
|
|
305
305
|
xl: "px-6 py-3.5 text-base"
|
|
306
|
-
},
|
|
306
|
+
}, Le = {
|
|
307
307
|
flat: "shadow-none",
|
|
308
308
|
rounded: "rounded-sm",
|
|
309
309
|
pill: "rounded-full",
|
|
@@ -316,20 +316,20 @@ const Ne = {
|
|
|
316
316
|
shape: s = "rounded",
|
|
317
317
|
className: c = "",
|
|
318
318
|
isLoading: p = !1,
|
|
319
|
-
disabled:
|
|
319
|
+
disabled: u = !1,
|
|
320
320
|
...d
|
|
321
321
|
}) => {
|
|
322
|
-
const a =
|
|
322
|
+
const a = u || p, o = [
|
|
323
323
|
"inline-flex items-center justify-center font-normal transition duration-150",
|
|
324
324
|
Ne[n],
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
Ee[t],
|
|
326
|
+
Le[s],
|
|
327
327
|
s === "flat" ? "shadow-none" : "shadow-sm",
|
|
328
328
|
a ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
|
329
329
|
c
|
|
330
330
|
].filter(Boolean).join(" ");
|
|
331
|
-
return /* @__PURE__ */
|
|
332
|
-
p && /* @__PURE__ */
|
|
331
|
+
return /* @__PURE__ */ k("button", { type: r, className: o, disabled: a, ...d, children: [
|
|
332
|
+
p && /* @__PURE__ */ k(
|
|
333
333
|
"svg",
|
|
334
334
|
{
|
|
335
335
|
"aria-hidden": "true",
|
|
@@ -359,16 +359,16 @@ const Ne = {
|
|
|
359
359
|
e
|
|
360
360
|
] });
|
|
361
361
|
};
|
|
362
|
-
var
|
|
362
|
+
var ce = {
|
|
363
363
|
color: void 0,
|
|
364
364
|
size: void 0,
|
|
365
365
|
className: void 0,
|
|
366
366
|
style: void 0,
|
|
367
367
|
attr: void 0
|
|
368
|
-
},
|
|
368
|
+
}, ne = T.createContext && /* @__PURE__ */ T.createContext(ce), Oe = ["attr", "size", "title"];
|
|
369
369
|
function Pe(e, n) {
|
|
370
370
|
if (e == null) return {};
|
|
371
|
-
var t =
|
|
371
|
+
var t = De(e, n), r, s;
|
|
372
372
|
if (Object.getOwnPropertySymbols) {
|
|
373
373
|
var c = Object.getOwnPropertySymbols(e);
|
|
374
374
|
for (s = 0; s < c.length; s++)
|
|
@@ -376,7 +376,7 @@ function Pe(e, n) {
|
|
|
376
376
|
}
|
|
377
377
|
return t;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function De(e, n) {
|
|
380
380
|
if (e == null) return {};
|
|
381
381
|
var t = {};
|
|
382
382
|
for (var r in e)
|
|
@@ -396,7 +396,7 @@ function G() {
|
|
|
396
396
|
return e;
|
|
397
397
|
}, G.apply(this, arguments);
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function re(e, n) {
|
|
400
400
|
var t = Object.keys(e);
|
|
401
401
|
if (Object.getOwnPropertySymbols) {
|
|
402
402
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -409,18 +409,18 @@ function ne(e, n) {
|
|
|
409
409
|
function q(e) {
|
|
410
410
|
for (var n = 1; n < arguments.length; n++) {
|
|
411
411
|
var t = arguments[n] != null ? arguments[n] : {};
|
|
412
|
-
n % 2 ?
|
|
413
|
-
|
|
414
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) :
|
|
412
|
+
n % 2 ? re(Object(t), !0).forEach(function(r) {
|
|
413
|
+
Ie(e, r, t[r]);
|
|
414
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : re(Object(t)).forEach(function(r) {
|
|
415
415
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
return e;
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
return n =
|
|
420
|
+
function Ie(e, n, t) {
|
|
421
|
+
return n = je(n), n in e ? Object.defineProperty(e, n, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = t, e;
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function je(e) {
|
|
424
424
|
var n = ze(e, "string");
|
|
425
425
|
return typeof n == "symbol" ? n : n + "";
|
|
426
426
|
}
|
|
@@ -434,15 +434,15 @@ function ze(e, n) {
|
|
|
434
434
|
}
|
|
435
435
|
return (n === "string" ? String : Number)(e);
|
|
436
436
|
}
|
|
437
|
-
function
|
|
438
|
-
return e && e.map((n, t) => /* @__PURE__ */
|
|
437
|
+
function de(e) {
|
|
438
|
+
return e && e.map((n, t) => /* @__PURE__ */ T.createElement(n.tag, q({
|
|
439
439
|
key: t
|
|
440
|
-
}, n.attr),
|
|
440
|
+
}, n.attr), de(n.child)));
|
|
441
441
|
}
|
|
442
|
-
function
|
|
443
|
-
return (n) => /* @__PURE__ */
|
|
442
|
+
function V(e) {
|
|
443
|
+
return (n) => /* @__PURE__ */ T.createElement(Ae, G({
|
|
444
444
|
attr: q({}, e.attr)
|
|
445
|
-
}, n),
|
|
445
|
+
}, n), de(e.child));
|
|
446
446
|
}
|
|
447
447
|
function Ae(e) {
|
|
448
448
|
var n = (t) => {
|
|
@@ -450,8 +450,8 @@ function Ae(e) {
|
|
|
450
450
|
attr: r,
|
|
451
451
|
size: s,
|
|
452
452
|
title: c
|
|
453
|
-
} = e, p = Pe(e, Oe),
|
|
454
|
-
return t.className && (d = t.className), e.className && (d = (d ? d + " " : "") + e.className), /* @__PURE__ */
|
|
453
|
+
} = e, p = Pe(e, Oe), u = s || t.size || "1em", d;
|
|
454
|
+
return t.className && (d = t.className), e.className && (d = (d ? d + " " : "") + e.className), /* @__PURE__ */ T.createElement("svg", G({
|
|
455
455
|
stroke: "currentColor",
|
|
456
456
|
fill: "currentColor",
|
|
457
457
|
strokeWidth: "0"
|
|
@@ -460,26 +460,26 @@ function Ae(e) {
|
|
|
460
460
|
style: q(q({
|
|
461
461
|
color: e.color || t.color
|
|
462
462
|
}, t.style), e.style),
|
|
463
|
-
height:
|
|
464
|
-
width:
|
|
463
|
+
height: u,
|
|
464
|
+
width: u,
|
|
465
465
|
xmlns: "http://www.w3.org/2000/svg"
|
|
466
|
-
}), c && /* @__PURE__ */
|
|
466
|
+
}), c && /* @__PURE__ */ T.createElement("title", null, c), e.children);
|
|
467
467
|
};
|
|
468
|
-
return
|
|
468
|
+
return ne !== void 0 ? /* @__PURE__ */ T.createElement(ne.Consumer, null, (t) => n(t)) : n(ce);
|
|
469
469
|
}
|
|
470
470
|
function Me(e) {
|
|
471
|
-
return
|
|
471
|
+
return V({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z" }, child: [] }] })(e);
|
|
472
472
|
}
|
|
473
473
|
const Te = {
|
|
474
474
|
xs: "w-3 h-3 text-[10px]",
|
|
475
475
|
sm: "w-4 h-4 text-xs",
|
|
476
476
|
md: "w-5 h-5 text-sm",
|
|
477
477
|
lg: "w-6 h-6 text-base"
|
|
478
|
-
},
|
|
478
|
+
}, Re = {
|
|
479
479
|
flat: "rounded-none",
|
|
480
480
|
rounded: "rounded-sm",
|
|
481
481
|
pill: "rounded-full"
|
|
482
|
-
},
|
|
482
|
+
}, Be = {
|
|
483
483
|
primary: "primary",
|
|
484
484
|
secondary: "secondary",
|
|
485
485
|
success: "success",
|
|
@@ -505,7 +505,7 @@ const Te = {
|
|
|
505
505
|
"soft-info": "soft-info",
|
|
506
506
|
"soft-dark": "soft-dark",
|
|
507
507
|
"soft-light": "soft-light"
|
|
508
|
-
}, _e =
|
|
508
|
+
}, _e = T.forwardRef(
|
|
509
509
|
({
|
|
510
510
|
label: e,
|
|
511
511
|
boxSize: n = "md",
|
|
@@ -514,22 +514,22 @@ const Te = {
|
|
|
514
514
|
onSelectionChange: s,
|
|
515
515
|
disabled: c = !1,
|
|
516
516
|
className: p = "",
|
|
517
|
-
id:
|
|
517
|
+
id: u,
|
|
518
518
|
value: d,
|
|
519
519
|
icon: a,
|
|
520
520
|
children: o,
|
|
521
521
|
checked: l,
|
|
522
|
-
...
|
|
523
|
-
},
|
|
524
|
-
const
|
|
525
|
-
!c && s && s(
|
|
526
|
-
},
|
|
522
|
+
...f
|
|
523
|
+
}, x) => {
|
|
524
|
+
const g = (w) => {
|
|
525
|
+
!c && s && s(w.target.checked), f.onChange && f.onChange(w);
|
|
526
|
+
}, b = "mr-2 border flex items-center justify-center transition-all", $ = Te[n], S = Re[t], N = Be[r] ?? "", h = r.startsWith("outline"), v = r.startsWith("soft"), D = `${b} ${$} ${S} ${N} ${l && (h || v || r === "link") ? "peer-checked:bg-current peer-checked:text-white" : l ? "peer-checked:bg-current" : ""}`, E = {
|
|
527
527
|
xs: "w-2 h-2",
|
|
528
528
|
sm: "w-2.5 h-2.5",
|
|
529
529
|
md: "w-3 h-3",
|
|
530
530
|
lg: "w-3.5 h-3.5"
|
|
531
531
|
};
|
|
532
|
-
return /* @__PURE__ */
|
|
532
|
+
return /* @__PURE__ */ k(
|
|
533
533
|
"label",
|
|
534
534
|
{
|
|
535
535
|
className: `flex items-center ${c ? "opacity-50 cursor-not-allowed" : "cursor-pointer"} me-4 ${p}`,
|
|
@@ -540,15 +540,15 @@ const Te = {
|
|
|
540
540
|
type: "checkbox",
|
|
541
541
|
className: "peer hidden",
|
|
542
542
|
checked: l,
|
|
543
|
-
onChange:
|
|
543
|
+
onChange: g,
|
|
544
544
|
disabled: c,
|
|
545
|
-
id:
|
|
545
|
+
id: u,
|
|
546
546
|
value: d,
|
|
547
|
-
ref:
|
|
548
|
-
...
|
|
547
|
+
ref: x,
|
|
548
|
+
...f
|
|
549
549
|
}
|
|
550
550
|
),
|
|
551
|
-
/* @__PURE__ */ i("span", { className:
|
|
551
|
+
/* @__PURE__ */ i("span", { className: D.trim(), children: (l || f.defaultChecked) && (a ?? /* @__PURE__ */ i(Me, { className: `${E[n]}` })) }),
|
|
552
552
|
e || o ? /* @__PURE__ */ i("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-300", children: e ?? o }) : null
|
|
553
553
|
]
|
|
554
554
|
}
|
|
@@ -564,71 +564,84 @@ const Ve = ({
|
|
|
564
564
|
renderItem: s,
|
|
565
565
|
position: c = "right",
|
|
566
566
|
className: p = "",
|
|
567
|
-
menuClassName:
|
|
567
|
+
menuClassName: u = "",
|
|
568
568
|
width: d = "w-48",
|
|
569
569
|
closeOnSelect: a = !1,
|
|
570
570
|
transition: o = !0,
|
|
571
571
|
ariaLabel: l = "Dropdown menu",
|
|
572
|
-
|
|
572
|
+
forceCloseDropdown: f,
|
|
573
|
+
...x
|
|
573
574
|
}) => {
|
|
574
|
-
const [g, b] =
|
|
575
|
+
const [g, b] = M(!1), [$, S] = M(!1), N = K(null), h = K(null), v = z(() => ({
|
|
575
576
|
left: "left-0",
|
|
576
577
|
center: "left-1/2 transform -translate-x-1/2",
|
|
577
578
|
right: "right-0"
|
|
578
|
-
})[c], [c]),
|
|
579
|
-
const
|
|
580
|
-
if (!
|
|
581
|
-
const { top:
|
|
582
|
-
|
|
583
|
-
}, []),
|
|
584
|
-
var
|
|
585
|
-
!((
|
|
586
|
-
}, []),
|
|
587
|
-
|
|
579
|
+
})[c], [c]), m = A(() => {
|
|
580
|
+
const C = h.current, P = N.current;
|
|
581
|
+
if (!C || !P) return;
|
|
582
|
+
const { top: I, bottom: B } = C.getBoundingClientRect(), _ = P.offsetHeight, F = window.innerHeight - B, U = I;
|
|
583
|
+
S(F < _ && U > _);
|
|
584
|
+
}, []), y = A((C) => {
|
|
585
|
+
var P, I;
|
|
586
|
+
!((P = N.current) != null && P.contains(C.target)) && !((I = h.current) != null && I.contains(C.target)) && b(!1);
|
|
587
|
+
}, []), D = A(() => b((C) => !C), []), E = A(() => b(!1), []);
|
|
588
|
+
R(() => {
|
|
588
589
|
if (g)
|
|
589
|
-
return
|
|
590
|
-
window.removeEventListener("resize",
|
|
590
|
+
return m(), window.addEventListener("resize", m), window.addEventListener("scroll", m, !0), () => {
|
|
591
|
+
window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0);
|
|
591
592
|
};
|
|
592
|
-
}, [g,
|
|
593
|
-
const
|
|
593
|
+
}, [g, m]);
|
|
594
|
+
const w = K(g);
|
|
595
|
+
R(() => {
|
|
596
|
+
w.current = g;
|
|
597
|
+
}, [g]), R(() => {
|
|
598
|
+
const C = (P) => {
|
|
599
|
+
var I;
|
|
600
|
+
P.key === "Escape" && w.current && (b(!1), (I = h.current) == null || I.focus());
|
|
601
|
+
};
|
|
602
|
+
return document.addEventListener("keydown", C), () => {
|
|
603
|
+
document.removeEventListener("keydown", C);
|
|
604
|
+
};
|
|
605
|
+
}, []), R(() => (document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y)), [y]);
|
|
606
|
+
const L = z(
|
|
594
607
|
() => [
|
|
595
608
|
"absolute z-50 bg-white rounded shadow-lg overflow-hidden w-auto",
|
|
596
|
-
|
|
597
|
-
|
|
609
|
+
$ ? "bottom-full mb-2" : "top-full mt-2",
|
|
610
|
+
v,
|
|
598
611
|
d,
|
|
599
612
|
o && "transition-all duration-200 ease-out",
|
|
600
|
-
|
|
613
|
+
u
|
|
601
614
|
].filter(Boolean).join(" "),
|
|
602
|
-
[
|
|
615
|
+
[$, v, d, o, u]
|
|
603
616
|
);
|
|
604
|
-
return /* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ k("div", { className: `relative inline-block ${p}`, ...x, children: [
|
|
605
618
|
/* @__PURE__ */ i(
|
|
606
619
|
"button",
|
|
607
620
|
{
|
|
608
621
|
type: "button",
|
|
609
|
-
ref:
|
|
610
|
-
onClick:
|
|
622
|
+
ref: h,
|
|
623
|
+
onClick: D,
|
|
611
624
|
"aria-expanded": g,
|
|
612
625
|
"aria-label": l,
|
|
613
626
|
className: "focus:outline-none",
|
|
614
627
|
children: e
|
|
615
628
|
}
|
|
616
629
|
),
|
|
617
|
-
g && /* @__PURE__ */
|
|
630
|
+
g && /* @__PURE__ */ k("div", { ref: N, role: "menu", className: L, children: [
|
|
618
631
|
n && n,
|
|
619
|
-
t.map((
|
|
620
|
-
const
|
|
621
|
-
r && r(
|
|
632
|
+
t.map((C, P) => {
|
|
633
|
+
const I = () => {
|
|
634
|
+
r && r(C), a && E();
|
|
622
635
|
};
|
|
623
|
-
return /* @__PURE__ */ i("div", { children: s ? s(
|
|
636
|
+
return /* @__PURE__ */ i("div", { children: s ? s(C, I) : /* @__PURE__ */ i(
|
|
624
637
|
"div",
|
|
625
638
|
{
|
|
626
|
-
onClick:
|
|
639
|
+
onClick: I,
|
|
627
640
|
className: "px-4 py-2 text-sm text-gray-800 hover:bg-gray-100 cursor-pointer",
|
|
628
641
|
role: "menuitem",
|
|
629
|
-
children:
|
|
642
|
+
children: C.label
|
|
630
643
|
}
|
|
631
|
-
) },
|
|
644
|
+
) }, P);
|
|
632
645
|
})
|
|
633
646
|
] })
|
|
634
647
|
] });
|
|
@@ -640,17 +653,17 @@ const Ve = ({
|
|
|
640
653
|
tooltipClass: s = "",
|
|
641
654
|
tooltipStyle: c = {}
|
|
642
655
|
}) => {
|
|
643
|
-
const p =
|
|
644
|
-
|
|
645
|
-
const a = p.current, o =
|
|
656
|
+
const p = K(null), u = K(null);
|
|
657
|
+
R(() => {
|
|
658
|
+
const a = p.current, o = u.current;
|
|
646
659
|
if (!a || !o) return;
|
|
647
660
|
const l = () => {
|
|
648
661
|
o.style.opacity = "1", o.style.visibility = "visible";
|
|
649
|
-
},
|
|
662
|
+
}, f = () => {
|
|
650
663
|
o.style.opacity = "0", o.style.visibility = "hidden";
|
|
651
664
|
};
|
|
652
|
-
return a.addEventListener("mouseenter", l), a.addEventListener("mouseleave",
|
|
653
|
-
a.removeEventListener("mouseenter", l), a.removeEventListener("mouseleave",
|
|
665
|
+
return a.addEventListener("mouseenter", l), a.addEventListener("mouseleave", f), () => {
|
|
666
|
+
a.removeEventListener("mouseenter", l), a.removeEventListener("mouseleave", f);
|
|
654
667
|
};
|
|
655
668
|
}, []);
|
|
656
669
|
const d = (a) => {
|
|
@@ -708,12 +721,12 @@ const Ve = ({
|
|
|
708
721
|
return o;
|
|
709
722
|
}
|
|
710
723
|
};
|
|
711
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ k("div", { ref: p, className: `relative inline-block ${r}`, children: [
|
|
712
725
|
e,
|
|
713
726
|
/* @__PURE__ */ i(
|
|
714
727
|
"div",
|
|
715
728
|
{
|
|
716
|
-
ref:
|
|
729
|
+
ref: u,
|
|
717
730
|
role: "tooltip",
|
|
718
731
|
className: s,
|
|
719
732
|
style: {
|
|
@@ -761,11 +774,11 @@ const Ve = ({
|
|
|
761
774
|
icon: s,
|
|
762
775
|
dismissible: c,
|
|
763
776
|
onDismiss: p,
|
|
764
|
-
className:
|
|
777
|
+
className: u = "",
|
|
765
778
|
...d
|
|
766
779
|
}) => {
|
|
767
|
-
const a = !e && !!s, o = `inline-flex items-center font-medium ${Fe[n] || ""} ${Ke[t] || ""} ${Ze[r] || ""} ${a ? "justify-center p-2 w-8 h-8" : ""} ` +
|
|
768
|
-
return /* @__PURE__ */
|
|
780
|
+
const a = !e && !!s, o = `inline-flex items-center font-medium ${Fe[n] || ""} ${Ke[t] || ""} ${Ze[r] || ""} ${a ? "justify-center p-2 w-8 h-8" : ""} ` + u;
|
|
781
|
+
return /* @__PURE__ */ k("span", { className: o.trim(), ...d, children: [
|
|
769
782
|
s && /* @__PURE__ */ i("span", { className: e ? "mr-1" : "", children: s }),
|
|
770
783
|
e,
|
|
771
784
|
c && /* @__PURE__ */ i(
|
|
@@ -778,11 +791,11 @@ const Ve = ({
|
|
|
778
791
|
}
|
|
779
792
|
)
|
|
780
793
|
] });
|
|
781
|
-
},
|
|
794
|
+
}, se = {
|
|
782
795
|
rounded: "rounded-md",
|
|
783
796
|
pill: "rounded-full",
|
|
784
797
|
flat: "rounded-none"
|
|
785
|
-
},
|
|
798
|
+
}, oe = {
|
|
786
799
|
xs: {
|
|
787
800
|
button: "px-2 py-1 text-xs"
|
|
788
801
|
},
|
|
@@ -807,30 +820,30 @@ function nt({
|
|
|
807
820
|
disabled: s = !1,
|
|
808
821
|
shape: c = "rounded",
|
|
809
822
|
variant: p = "primary",
|
|
810
|
-
size:
|
|
823
|
+
size: u = "md",
|
|
811
824
|
className: d = "",
|
|
812
825
|
classNames: a = {},
|
|
813
826
|
id: o,
|
|
814
827
|
name: l,
|
|
815
|
-
renderOption:
|
|
828
|
+
renderOption: f
|
|
816
829
|
}) {
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
if (!
|
|
820
|
-
const
|
|
821
|
-
if (
|
|
822
|
-
const
|
|
823
|
-
if (
|
|
824
|
-
const { offsetLeft:
|
|
825
|
-
|
|
826
|
-
transform: `translateX(${
|
|
827
|
-
width:
|
|
828
|
-
height:
|
|
830
|
+
const x = se[c] || se.rounded, g = oe[u] || oe.md, b = K(null), [$, S] = M({});
|
|
831
|
+
R(() => {
|
|
832
|
+
if (!b.current) return;
|
|
833
|
+
const h = e.findIndex((y) => y.value === n);
|
|
834
|
+
if (h === -1) return;
|
|
835
|
+
const m = b.current.querySelectorAll("button")[h];
|
|
836
|
+
if (m) {
|
|
837
|
+
const { offsetLeft: y, offsetWidth: D, offsetHeight: E } = m;
|
|
838
|
+
S({
|
|
839
|
+
transform: `translateX(${y}px)`,
|
|
840
|
+
width: D,
|
|
841
|
+
height: E
|
|
829
842
|
});
|
|
830
843
|
}
|
|
831
|
-
}, [n, e,
|
|
844
|
+
}, [n, e, u]);
|
|
832
845
|
const N = `toggler-${p}`;
|
|
833
|
-
return /* @__PURE__ */
|
|
846
|
+
return /* @__PURE__ */ k(
|
|
834
847
|
"div",
|
|
835
848
|
{
|
|
836
849
|
className: `flex flex-col gap-2 w-fit ${d} ${a.root ?? ""}`,
|
|
@@ -843,49 +856,49 @@ function nt({
|
|
|
843
856
|
children: r
|
|
844
857
|
}
|
|
845
858
|
),
|
|
846
|
-
/* @__PURE__ */
|
|
859
|
+
/* @__PURE__ */ k(
|
|
847
860
|
"div",
|
|
848
861
|
{
|
|
849
|
-
ref:
|
|
862
|
+
ref: b,
|
|
850
863
|
role: "radiogroup",
|
|
851
864
|
"aria-disabled": s,
|
|
852
|
-
className: `relative inline-flex overflow-hidden border border-gray-300 bg-gray-100 ${
|
|
865
|
+
className: `relative inline-flex overflow-hidden border border-gray-300 bg-gray-100 ${x} ${s ? "opacity-50 cursor-not-allowed" : ""} ${a.group ?? ""}`,
|
|
853
866
|
children: [
|
|
854
867
|
/* @__PURE__ */ i(
|
|
855
868
|
"div",
|
|
856
869
|
{
|
|
857
|
-
className: `absolute top-0 left-0 transition-transform duration-300 ease-in-out ${
|
|
870
|
+
className: `absolute top-0 left-0 transition-transform duration-300 ease-in-out ${x} ${N}`,
|
|
858
871
|
style: {
|
|
859
|
-
|
|
872
|
+
...$,
|
|
860
873
|
zIndex: 0
|
|
861
874
|
},
|
|
862
875
|
"aria-hidden": "true"
|
|
863
876
|
}
|
|
864
877
|
),
|
|
865
|
-
e.map((
|
|
866
|
-
const
|
|
878
|
+
e.map((h) => {
|
|
879
|
+
const v = n === h.value, m = s || h.disabled;
|
|
867
880
|
return /* @__PURE__ */ i(
|
|
868
881
|
"button",
|
|
869
882
|
{
|
|
870
883
|
role: "radio",
|
|
871
884
|
name: l,
|
|
872
|
-
"aria-checked":
|
|
873
|
-
disabled:
|
|
874
|
-
onClick: () => !
|
|
875
|
-
onKeyDown: (
|
|
876
|
-
(
|
|
885
|
+
"aria-checked": v,
|
|
886
|
+
disabled: m,
|
|
887
|
+
onClick: () => !m && t(h.value),
|
|
888
|
+
onKeyDown: (y) => {
|
|
889
|
+
(y.key === "Enter" || y.key === " ") && !m && (y.preventDefault(), t(h.value));
|
|
877
890
|
},
|
|
878
891
|
className: `
|
|
879
892
|
relative z-10
|
|
880
893
|
transition-colors duration-200 focus:outline-none
|
|
881
|
-
${
|
|
882
|
-
${
|
|
894
|
+
${g.button}
|
|
895
|
+
${v ? `text-white toggler-text-${p}` : "text-gray-700 hover:bg-gray-200"}
|
|
883
896
|
${a.option ?? ""}
|
|
884
|
-
${
|
|
897
|
+
${v ? a.selectedOption ?? "" : ""}
|
|
885
898
|
`,
|
|
886
|
-
children:
|
|
899
|
+
children: f ? f(h, v) : h.label
|
|
887
900
|
},
|
|
888
|
-
String(
|
|
901
|
+
String(h.value)
|
|
889
902
|
);
|
|
890
903
|
})
|
|
891
904
|
]
|
|
@@ -896,7 +909,7 @@ function nt({
|
|
|
896
909
|
);
|
|
897
910
|
}
|
|
898
911
|
function He(e) {
|
|
899
|
-
return
|
|
912
|
+
return V({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z" }, child: [] }] })(e);
|
|
900
913
|
}
|
|
901
914
|
const rt = ({
|
|
902
915
|
items: e,
|
|
@@ -906,16 +919,16 @@ const rt = ({
|
|
|
906
919
|
open: s,
|
|
907
920
|
onChange: c,
|
|
908
921
|
renderTitle: p,
|
|
909
|
-
renderContent:
|
|
922
|
+
renderContent: u,
|
|
910
923
|
showArrowIcon: d = !0,
|
|
911
924
|
panelClasses: a = ""
|
|
912
925
|
}) => {
|
|
913
|
-
const [o, l] =
|
|
914
|
-
(
|
|
915
|
-
const
|
|
916
|
-
|
|
926
|
+
const [o, l] = M(/* @__PURE__ */ new Set()), f = z(() => s ? new Set(s) : o, [s, o]), x = A(
|
|
927
|
+
(g) => {
|
|
928
|
+
const b = new Set(f);
|
|
929
|
+
b.has(g) ? b.delete(g) : (n || b.clear(), b.add(g)), s && c ? c(Array.from(b)) : l(b);
|
|
917
930
|
},
|
|
918
|
-
[
|
|
931
|
+
[f, s, c, n]
|
|
919
932
|
);
|
|
920
933
|
return /* @__PURE__ */ i(
|
|
921
934
|
"div",
|
|
@@ -923,24 +936,24 @@ const rt = ({
|
|
|
923
936
|
className: "accordion",
|
|
924
937
|
role: "region",
|
|
925
938
|
"aria-multiselectable": n,
|
|
926
|
-
children: e.map((
|
|
927
|
-
const
|
|
928
|
-
return /* @__PURE__ */
|
|
939
|
+
children: e.map((g) => {
|
|
940
|
+
const b = f.has(g.id), $ = `accordion-heading-${g.id}`, S = `accordion-panel-${g.id}`;
|
|
941
|
+
return /* @__PURE__ */ k(
|
|
929
942
|
"div",
|
|
930
943
|
{
|
|
931
944
|
className: `accordion-item border rounded border-gray-300 dark:border-gray-700 ${t}`,
|
|
932
945
|
children: [
|
|
933
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ k(
|
|
934
947
|
"button",
|
|
935
948
|
{
|
|
936
|
-
id:
|
|
949
|
+
id: $,
|
|
937
950
|
type: "button",
|
|
938
|
-
"aria-expanded":
|
|
939
|
-
"aria-controls":
|
|
940
|
-
onClick: () => g
|
|
951
|
+
"aria-expanded": b,
|
|
952
|
+
"aria-controls": S,
|
|
953
|
+
onClick: () => x(g.id),
|
|
941
954
|
className: `flex justify-between items-center w-full p-1.5 text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none gap-3 ${r}`,
|
|
942
955
|
children: [
|
|
943
|
-
p ? p(
|
|
956
|
+
p ? p(g, b) : g.title,
|
|
944
957
|
d ? /* @__PURE__ */ i(He, {}) : null
|
|
945
958
|
]
|
|
946
959
|
}
|
|
@@ -948,29 +961,29 @@ const rt = ({
|
|
|
948
961
|
/* @__PURE__ */ i(
|
|
949
962
|
"div",
|
|
950
963
|
{
|
|
951
|
-
id:
|
|
964
|
+
id: S,
|
|
952
965
|
role: "region",
|
|
953
|
-
"aria-labelledby":
|
|
954
|
-
hidden: !
|
|
966
|
+
"aria-labelledby": $,
|
|
967
|
+
hidden: !b,
|
|
955
968
|
className: `p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 ${a}`,
|
|
956
|
-
children:
|
|
969
|
+
children: u ? u(g, b) : g.content
|
|
957
970
|
}
|
|
958
971
|
)
|
|
959
972
|
]
|
|
960
973
|
},
|
|
961
|
-
|
|
974
|
+
g.id
|
|
962
975
|
);
|
|
963
976
|
})
|
|
964
977
|
}
|
|
965
978
|
);
|
|
966
|
-
},
|
|
967
|
-
const e =
|
|
979
|
+
}, ue = le(null), fe = () => {
|
|
980
|
+
const e = ie(ue);
|
|
968
981
|
if (!e)
|
|
969
982
|
throw new Error(
|
|
970
983
|
"useModalActions must be used within a ModalActionProvider"
|
|
971
984
|
);
|
|
972
985
|
return e;
|
|
973
|
-
},
|
|
986
|
+
}, pe = le(null), ge = () => ie(pe);
|
|
974
987
|
function st({
|
|
975
988
|
id: e,
|
|
976
989
|
title: n,
|
|
@@ -979,55 +992,55 @@ function st({
|
|
|
979
992
|
showFloatingClose: s = !1,
|
|
980
993
|
containerClasses: c = "",
|
|
981
994
|
headerClasses: p = "",
|
|
982
|
-
bodyClasses:
|
|
995
|
+
bodyClasses: u = "",
|
|
983
996
|
onClose: d,
|
|
984
997
|
disableEscapeClose: a = !1,
|
|
985
998
|
closeBtnStyle: o
|
|
986
999
|
}) {
|
|
987
|
-
const l =
|
|
988
|
-
|
|
989
|
-
}, [
|
|
990
|
-
return
|
|
991
|
-
const
|
|
1000
|
+
const l = ge(), f = fe(), x = !r && !!l && !!f, [g, b] = M(!1), $ = x ? l.isOpen(e) : g, S = x ? l.getModalData(e) : null, N = A(() => {
|
|
1001
|
+
x ? f.closeModal(e) : b(!1), d == null || d();
|
|
1002
|
+
}, [x, f, e, d]);
|
|
1003
|
+
return R(() => {
|
|
1004
|
+
const h = document.activeElement, v = document.getElementById(e), m = [
|
|
992
1005
|
"a[href]",
|
|
993
1006
|
"button:not([disabled])",
|
|
994
1007
|
"textarea:not([disabled])",
|
|
995
1008
|
"input:not([disabled])",
|
|
996
1009
|
"select:not([disabled])",
|
|
997
1010
|
'[tabindex]:not([tabindex="-1"])'
|
|
998
|
-
],
|
|
999
|
-
if (!
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1011
|
+
], y = () => {
|
|
1012
|
+
if (!v) return [];
|
|
1013
|
+
const w = v.querySelectorAll(
|
|
1014
|
+
m.join(",")
|
|
1002
1015
|
);
|
|
1003
|
-
return Array.from(
|
|
1004
|
-
},
|
|
1005
|
-
if (
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1016
|
+
return Array.from(w).filter((L) => L.offsetParent !== null);
|
|
1017
|
+
}, D = (w) => {
|
|
1018
|
+
if (w.key === "Tab") {
|
|
1019
|
+
const L = y();
|
|
1020
|
+
if (L.length === 0) return;
|
|
1021
|
+
const C = L[0], P = L[L.length - 1];
|
|
1022
|
+
w.shiftKey ? document.activeElement === C && (w.preventDefault(), P.focus()) : document.activeElement === P && (w.preventDefault(), C.focus());
|
|
1010
1023
|
}
|
|
1011
|
-
},
|
|
1012
|
-
|
|
1024
|
+
}, E = (w) => {
|
|
1025
|
+
w.key === "Escape" && !a && N(), D(w);
|
|
1013
1026
|
};
|
|
1014
|
-
return
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1017
|
-
}, 0), window.addEventListener("keydown",
|
|
1018
|
-
document.body.style.overflow = "",
|
|
1027
|
+
return $ && (document.body.style.overflow = "hidden", setTimeout(() => {
|
|
1028
|
+
const w = y();
|
|
1029
|
+
w.length && w[0].focus();
|
|
1030
|
+
}, 0), window.addEventListener("keydown", E)), () => {
|
|
1031
|
+
document.body.style.overflow = "", h && h.focus(), window.removeEventListener("keydown", E);
|
|
1019
1032
|
};
|
|
1020
|
-
}, [
|
|
1033
|
+
}, [$, a, N, e]), $ ? /* @__PURE__ */ i(
|
|
1021
1034
|
"div",
|
|
1022
1035
|
{
|
|
1023
1036
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",
|
|
1024
1037
|
id: e,
|
|
1025
|
-
children: /* @__PURE__ */
|
|
1038
|
+
children: /* @__PURE__ */ k(
|
|
1026
1039
|
"div",
|
|
1027
1040
|
{
|
|
1028
1041
|
className: `bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${c}`,
|
|
1029
1042
|
children: [
|
|
1030
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ k(
|
|
1031
1044
|
"div",
|
|
1032
1045
|
{
|
|
1033
1046
|
className: `flex justify-between items-center relative ${p}`,
|
|
@@ -1045,7 +1058,7 @@ function st({
|
|
|
1045
1058
|
]
|
|
1046
1059
|
}
|
|
1047
1060
|
),
|
|
1048
|
-
/* @__PURE__ */ i("div", { className:
|
|
1061
|
+
/* @__PURE__ */ i("div", { className: u, children: typeof t == "function" ? t({ modalData: S }) : t })
|
|
1049
1062
|
]
|
|
1050
1063
|
}
|
|
1051
1064
|
)
|
|
@@ -1055,27 +1068,27 @@ function st({
|
|
|
1055
1068
|
function ot({
|
|
1056
1069
|
children: e
|
|
1057
1070
|
}) {
|
|
1058
|
-
const [n, t] =
|
|
1059
|
-
t((
|
|
1060
|
-
}, []), p =
|
|
1061
|
-
t((
|
|
1062
|
-
const
|
|
1063
|
-
return delete
|
|
1071
|
+
const [n, t] = M({}), [r, s] = M({}), c = A((l, f) => {
|
|
1072
|
+
t((x) => ({ ...x, [l]: !0 })), f && s((x) => ({ ...x, [l]: f }));
|
|
1073
|
+
}, []), p = A((l) => {
|
|
1074
|
+
t((f) => ({ ...f, [l]: !1 })), s((f) => {
|
|
1075
|
+
const x = { ...f };
|
|
1076
|
+
return delete x[l], x;
|
|
1064
1077
|
});
|
|
1065
|
-
}, []),
|
|
1078
|
+
}, []), u = A((l) => !!n[l], [n]), d = A(
|
|
1066
1079
|
(l) => r[l],
|
|
1067
1080
|
[r]
|
|
1068
|
-
), a =
|
|
1081
|
+
), a = z(
|
|
1069
1082
|
() => ({ openModal: c, closeModal: p }),
|
|
1070
1083
|
[c, p]
|
|
1071
|
-
), o =
|
|
1072
|
-
() => ({ isOpen:
|
|
1073
|
-
[
|
|
1084
|
+
), o = z(
|
|
1085
|
+
() => ({ isOpen: u, getModalData: d }),
|
|
1086
|
+
[u, d]
|
|
1074
1087
|
);
|
|
1075
|
-
return /* @__PURE__ */ i(
|
|
1088
|
+
return /* @__PURE__ */ i(ue.Provider, { value: a, children: /* @__PURE__ */ i(pe.Provider, { value: o, children: e }) });
|
|
1076
1089
|
}
|
|
1077
1090
|
function at(e) {
|
|
1078
|
-
const { openModal: n, closeModal: t } =
|
|
1091
|
+
const { openModal: n, closeModal: t } = fe(), { isOpen: r, getModalData: s } = ge();
|
|
1079
1092
|
return {
|
|
1080
1093
|
open: (c) => n(e, c),
|
|
1081
1094
|
close: () => t(e),
|
|
@@ -1083,31 +1096,31 @@ function at(e) {
|
|
|
1083
1096
|
data: s(e)
|
|
1084
1097
|
};
|
|
1085
1098
|
}
|
|
1086
|
-
let
|
|
1099
|
+
let J = null, Q = {};
|
|
1087
1100
|
function We(e) {
|
|
1088
|
-
|
|
1101
|
+
J = e;
|
|
1089
1102
|
}
|
|
1090
1103
|
function lt(e) {
|
|
1091
|
-
|
|
1104
|
+
Q = { ...Q, ...e };
|
|
1092
1105
|
}
|
|
1093
1106
|
function Ge() {
|
|
1094
|
-
return
|
|
1107
|
+
return Q;
|
|
1095
1108
|
}
|
|
1096
1109
|
function it(e, n, t = 3e3, r) {
|
|
1097
|
-
|
|
1110
|
+
J ? J(e, n, t, r) : console.warn("Toast system is not mounted");
|
|
1098
1111
|
}
|
|
1099
1112
|
function qe(e) {
|
|
1100
|
-
return
|
|
1113
|
+
return V({ attr: { viewBox: "0 0 15 15", fill: "none" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor" }, child: [] }] })(e);
|
|
1101
1114
|
}
|
|
1102
1115
|
const Ue = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
1103
1116
|
const n = Math.random() * 16 | 0;
|
|
1104
1117
|
return (e === "x" ? n : n & 3 | 8).toString(16);
|
|
1105
1118
|
}), ct = ({ containerStyle: e = "" }) => {
|
|
1106
|
-
const [n, t] =
|
|
1107
|
-
|
|
1108
|
-
We((s, c, p,
|
|
1119
|
+
const [n, t] = M([]);
|
|
1120
|
+
R(() => {
|
|
1121
|
+
We((s, c, p, u) => {
|
|
1109
1122
|
const d = Ue();
|
|
1110
|
-
t((a) => [...a, { id: d, type: s, message: c, config:
|
|
1123
|
+
t((a) => [...a, { id: d, type: s, message: c, config: u }]), setTimeout(() => {
|
|
1111
1124
|
t((a) => a.filter((o) => o.id !== d));
|
|
1112
1125
|
}, p);
|
|
1113
1126
|
});
|
|
@@ -1118,26 +1131,26 @@ const Ue = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
1118
1131
|
{
|
|
1119
1132
|
className: `fixed top-5 right-5 z-9999 flex flex-col gap-2 ${e}`,
|
|
1120
1133
|
children: n.map((s) => {
|
|
1121
|
-
var a, o, l,
|
|
1122
|
-
const c = ((a = s.config) == null ? void 0 : a.icon) || ((o = r.icons) == null ? void 0 : o[s.type]) || Xe(s.type), p = ((l = s.config) == null ? void 0 : l.bgColor) || ((
|
|
1123
|
-
return /* @__PURE__ */
|
|
1134
|
+
var a, o, l, f, x, g, b, $, S, N, h, v, m, y;
|
|
1135
|
+
const c = ((a = s.config) == null ? void 0 : a.icon) || ((o = r.icons) == null ? void 0 : o[s.type]) || Xe(s.type), p = ((l = s.config) == null ? void 0 : l.bgColor) || ((x = (f = r.colors) == null ? void 0 : f[s.type]) == null ? void 0 : x.bg) || "bg-white dark:bg-gray-800", u = ((g = s.config) == null ? void 0 : g.textColor) || (($ = (b = r.colors) == null ? void 0 : b[s.type]) == null ? void 0 : $.text) || "text-gray-700 dark:text-gray-300", d = `w-8 h-8 mr-3 text-xl flex items-center justify-center ${(S = s.config) == null ? void 0 : S.iconContainerClass}`;
|
|
1136
|
+
return /* @__PURE__ */ k(
|
|
1124
1137
|
"div",
|
|
1125
1138
|
{
|
|
1126
|
-
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${p} ${
|
|
1139
|
+
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${p} ${u} ${(N = s.config) == null ? void 0 : N.containerBody}`,
|
|
1127
1140
|
children: [
|
|
1128
1141
|
c && /* @__PURE__ */ i("div", { className: d, children: c }),
|
|
1129
|
-
/* @__PURE__ */
|
|
1130
|
-
((
|
|
1142
|
+
/* @__PURE__ */ k("div", { className: "flex-1", children: [
|
|
1143
|
+
((h = s.config) == null ? void 0 : h.title) && /* @__PURE__ */ i(
|
|
1131
1144
|
"div",
|
|
1132
1145
|
{
|
|
1133
|
-
className: `font-semibold text-black ${(
|
|
1146
|
+
className: `font-semibold text-black ${(v = s.config) == null ? void 0 : v.titleClass}`,
|
|
1134
1147
|
children: s.config.title
|
|
1135
1148
|
}
|
|
1136
1149
|
),
|
|
1137
|
-
((
|
|
1150
|
+
((m = s.config) == null ? void 0 : m.description) && /* @__PURE__ */ i(
|
|
1138
1151
|
"div",
|
|
1139
1152
|
{
|
|
1140
|
-
className: `text-sm text-gray-500 ${(
|
|
1153
|
+
className: `text-sm text-gray-500 ${(y = s.config) == null ? void 0 : y.subTitleClass}`,
|
|
1141
1154
|
children: s.config.description
|
|
1142
1155
|
}
|
|
1143
1156
|
)
|
|
@@ -1145,7 +1158,7 @@ const Ue = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
1145
1158
|
/* @__PURE__ */ i(
|
|
1146
1159
|
"button",
|
|
1147
1160
|
{
|
|
1148
|
-
onClick: () => t((
|
|
1161
|
+
onClick: () => t((D) => D.filter((E) => E.id !== s.id)),
|
|
1149
1162
|
className: "ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white",
|
|
1150
1163
|
"aria-label": "Close",
|
|
1151
1164
|
children: /* @__PURE__ */ i(qe, { size: 18 })
|
|
@@ -1186,7 +1199,7 @@ export {
|
|
|
1186
1199
|
et as Tooltip,
|
|
1187
1200
|
lt as setToastDefaults,
|
|
1188
1201
|
it as showToast,
|
|
1189
|
-
|
|
1202
|
+
fe as useModalActions,
|
|
1190
1203
|
at as useModalInstance,
|
|
1191
|
-
|
|
1204
|
+
ge as useModalState
|
|
1192
1205
|
};
|