@mci-ui/mci-ui 0.0.86 → 0.0.87
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/dist/index.css +1 -1
- package/dist/shared/ui/MciModal/MciModal.js +107 -59
- package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +23 -21
- package/dist/shared/ui/mciButton/MciButton.js +47 -32
- package/dist/shared/ui/mciCheck/MciCheck.js +116 -92
- package/dist/shared/ui/mciCollapse/MciCollapse.js +86 -54
- package/dist/shared/ui/mciDrawer/MciDrawer.js +70 -52
- package/dist/shared/ui/mciInput/MciInput.js +143 -130
- package/dist/shared/ui/mciInput/mci-input.utils.js +10 -10
- package/dist/shared/ui/mciPagination/MciPagination.js +85 -63
- package/dist/shared/ui/mciPhone/MciPhone.js +59 -54
- package/dist/shared/ui/mciPhone/mci-phone.utils.js +10 -10
- package/dist/shared/ui/mciPicker/MciPicker.js +349 -181
- package/dist/shared/ui/mciSelect/MciSelect.js +150 -131
- package/dist/shared/ui/mciSelect/mci-select.utils.js +12 -12
- package/dist/shared/ui/mciSkeleton/MciSkeleton.js +16 -14
- package/dist/shared/ui/mciTable/MciTable.js +165 -126
- package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +113 -106
- package/dist/shared/ui/mciTabs/MciTabs.js +52 -45
- package/dist/shared/ui/mciTag/MciTag.js +27 -18
- package/dist/shared/ui/mciTextarea/MciTextarea.js +47 -35
- package/dist/shared/ui/mciToast/MciToast.js +118 -72
- package/dist/shared/ui/mciToast/mci-toast.utils.js +40 -12
- package/dist/shared/ui/mciToggle/MciToggle.js +58 -36
- package/dist/shared/ui/mciTooltip/MciTooltip.js +2 -2
- package/dist/shared/ui/mciUpload/MciUpload.js +172 -149
- package/dist/types/shared/types/mci-table.types.d.ts +1 -0
- package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -0
- package/dist/types/shared/types/ui/button.types.d.ts +3 -7
- package/dist/types/shared/types/ui/check.types.d.ts +4 -9
- package/dist/types/shared/types/ui/collapse.types.d.ts +1 -0
- package/dist/types/shared/types/ui/drawer.types.d.ts +1 -0
- package/dist/types/shared/types/ui/input.types.d.ts +4 -15
- package/dist/types/shared/types/ui/modal.types.d.ts +1 -0
- package/dist/types/shared/types/ui/pagination.types.d.ts +1 -0
- package/dist/types/shared/types/ui/phone.types.d.ts +1 -0
- package/dist/types/shared/types/ui/picker.types.d.ts +1 -0
- package/dist/types/shared/types/ui/select.types.d.ts +1 -0
- package/dist/types/shared/types/ui/skeleton.types.d.ts +1 -0
- package/dist/types/shared/types/ui/tabs.types.d.ts +1 -0
- package/dist/types/shared/types/ui/tag.types.d.ts +1 -0
- package/dist/types/shared/types/ui/textarea.types.d.ts +3 -7
- package/dist/types/shared/types/ui/toast.types.d.ts +1 -0
- package/dist/types/shared/types/ui/toggle.types.d.ts +3 -2
- package/dist/types/shared/types/ui/upload.types.d.ts +1 -0
- package/dist/types/shared/ui/MciModal/MciModal.d.ts +1 -1
- package/dist/types/shared/ui/mciBreadcrumb/MciBreadcrumb.d.ts +1 -1
- package/dist/types/shared/ui/mciButton/MciButton.d.ts +1 -1
- package/dist/types/shared/ui/mciCollapse/MciCollapse.d.ts +1 -1
- package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
- package/dist/types/shared/ui/mciInput/MciInput.d.ts +13 -2
- package/dist/types/shared/ui/mciInput/mci-input.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciPagination/MciPagination.d.ts +1 -1
- package/dist/types/shared/ui/mciPhone/mci-phone.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciSelect/mci-select.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciSkeleton/MciSkeleton.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +2 -1
- package/dist/types/shared/ui/mciTabs/MciTabs.d.ts +1 -1
- package/dist/types/shared/ui/mciTag/MciTag.d.ts +1 -1
- package/dist/types/shared/ui/mciTextarea/MciTextarea.d.ts +7 -2
- package/dist/types/shared/ui/mciToast/mci-toast.utils.d.ts +32 -4
- package/dist/types/shared/ui/mciToggle/MciToggle.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as u, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as C, useCallback as I, useEffect as h } from "react";
|
|
3
3
|
import { cn as t } from "../../lib/utils.js";
|
|
4
|
-
const
|
|
4
|
+
const L = {
|
|
5
5
|
top: "flex-col",
|
|
6
6
|
bottom: "flex-col-reverse",
|
|
7
7
|
left: "flex-row",
|
|
8
8
|
right: "flex-row-reverse"
|
|
9
|
-
},
|
|
9
|
+
}, j = {
|
|
10
10
|
top: "flex-row",
|
|
11
11
|
bottom: "flex-row",
|
|
12
12
|
left: "flex-col",
|
|
13
13
|
right: "flex-col"
|
|
14
|
-
},
|
|
14
|
+
}, z = {
|
|
15
15
|
top: "mt-4",
|
|
16
16
|
bottom: "mb-4",
|
|
17
17
|
left: "ml-4",
|
|
18
18
|
right: "mr-4"
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function k({
|
|
21
21
|
tabs: i,
|
|
22
|
-
defaultTab:
|
|
23
|
-
position:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
defaultTab: p,
|
|
23
|
+
position: r = "top",
|
|
24
|
+
darkMode: a = !1,
|
|
25
|
+
className: v,
|
|
26
|
+
tabListClassName: N,
|
|
27
|
+
contentClassName: g,
|
|
28
|
+
extra: x,
|
|
28
29
|
onChange: S
|
|
29
30
|
}) {
|
|
30
|
-
const [s,
|
|
31
|
+
const [s, b] = w(p || i[0]?.id), [y, E] = w({}), f = C([]), c = I(() => {
|
|
31
32
|
requestAnimationFrame(() => {
|
|
32
|
-
const e = i.findIndex((
|
|
33
|
-
if (
|
|
34
|
-
const { offsetLeft:
|
|
33
|
+
const e = i.findIndex((o) => o?.id === s), d = f.current[e];
|
|
34
|
+
if (d) {
|
|
35
|
+
const { offsetLeft: o, offsetTop: m, offsetWidth: T, offsetHeight: A } = d;
|
|
35
36
|
E({
|
|
36
|
-
left: `${
|
|
37
|
+
left: `${o}px`,
|
|
37
38
|
top: `${m}px`,
|
|
38
39
|
width: `${T}px`,
|
|
39
40
|
height: `${A}px`,
|
|
@@ -42,17 +43,17 @@ function _({
|
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
45
|
}, [s, i]);
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
h(() => (c(), window.addEventListener("resize", c), "fonts" in document && document.fonts.ready.then(c), () => window.removeEventListener("resize", c)), [r, c]), h(() => {
|
|
47
|
+
f.current = f.current.slice(0, i.length);
|
|
47
48
|
}, [i]);
|
|
48
|
-
const
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
49
|
+
const n = r === "left" || r === "right";
|
|
50
|
+
return /* @__PURE__ */ u("div", { className: t("flex w-full", L[r], v), children: [
|
|
51
|
+
/* @__PURE__ */ u(
|
|
51
52
|
"div",
|
|
52
53
|
{
|
|
53
54
|
className: t(
|
|
54
55
|
"flex w-full gap-4",
|
|
55
|
-
|
|
56
|
+
n ? "flex-col items-start" : "flex-row flex-wrap items-center"
|
|
56
57
|
),
|
|
57
58
|
children: [
|
|
58
59
|
/* @__PURE__ */ l(
|
|
@@ -60,45 +61,51 @@ function _({
|
|
|
60
61
|
{
|
|
61
62
|
className: t(
|
|
62
63
|
"flex-1",
|
|
63
|
-
|
|
64
|
+
n ? "w-full" : "min-w-[520px]"
|
|
64
65
|
),
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ u(
|
|
66
67
|
"div",
|
|
67
68
|
{
|
|
68
69
|
className: t(
|
|
69
|
-
"relative flex rounded-xl
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
"relative flex rounded-xl p-1",
|
|
71
|
+
a ? "bg-neutral-300" : "bg-slate-100",
|
|
72
|
+
j[r],
|
|
73
|
+
!n && "w-full overflow-hidden",
|
|
74
|
+
n ? "min-w-48" : "",
|
|
75
|
+
N
|
|
74
76
|
),
|
|
75
77
|
children: [
|
|
76
78
|
/* @__PURE__ */ l(
|
|
77
79
|
"div",
|
|
78
80
|
{
|
|
79
|
-
className: t(
|
|
81
|
+
className: t(
|
|
82
|
+
"absolute rounded-lg",
|
|
83
|
+
a ? "bg-black" : "bg-white",
|
|
84
|
+
n ? "w-full" : "h-full"
|
|
85
|
+
),
|
|
80
86
|
style: y
|
|
81
87
|
}
|
|
82
88
|
),
|
|
83
|
-
i?.map((e,
|
|
84
|
-
const
|
|
85
|
-
return /* @__PURE__ */
|
|
89
|
+
i?.map((e, d) => {
|
|
90
|
+
const o = s === e.id;
|
|
91
|
+
return /* @__PURE__ */ u(
|
|
86
92
|
"button",
|
|
87
93
|
{
|
|
88
94
|
ref: (m) => {
|
|
89
|
-
|
|
95
|
+
f.current[d] = m;
|
|
90
96
|
},
|
|
91
97
|
onClick: () => {
|
|
92
|
-
e?.disabled || (
|
|
98
|
+
e?.disabled || (b(e?.id), S?.(e?.id));
|
|
93
99
|
},
|
|
94
100
|
disabled: e?.disabled,
|
|
95
101
|
className: t(
|
|
96
|
-
"relative z-10 flex items-center justify-center whitespace-nowrap px-3 py-2 text-base font-normal
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
"relative z-10 flex items-center justify-center whitespace-nowrap px-3 py-2 text-base font-normal transition-colors duration-300 hover:cursor-pointer",
|
|
103
|
+
a ? "text-white" : "text-black",
|
|
104
|
+
e?.disabled && (a ? "cursor-not-allowed text-neutral-100/50 opacity-60" : "cursor-not-allowed opacity-50"),
|
|
105
|
+
n ? "w-full justify-start" : "flex-1 min-w-0"
|
|
99
106
|
),
|
|
100
107
|
children: [
|
|
101
|
-
e?.icon && /* @__PURE__ */ l("span", { className: t("shrink-0 transition-transform duration-200",
|
|
108
|
+
e?.icon && /* @__PURE__ */ l("span", { className: t("shrink-0 transition-transform duration-200", o && "scale-110"), children: e?.icon }),
|
|
102
109
|
/* @__PURE__ */ l("span", { className: "relative z-10 truncate", title: e?.label, children: e?.label })
|
|
103
110
|
]
|
|
104
111
|
},
|
|
@@ -110,22 +117,22 @@ function _({
|
|
|
110
117
|
)
|
|
111
118
|
}
|
|
112
119
|
),
|
|
113
|
-
|
|
120
|
+
x && /* @__PURE__ */ l(
|
|
114
121
|
"div",
|
|
115
122
|
{
|
|
116
123
|
className: t(
|
|
117
124
|
"shrink-0 ml-auto",
|
|
118
|
-
|
|
125
|
+
n ? "w-full" : "max-w-full"
|
|
119
126
|
),
|
|
120
|
-
children: /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center justify-end gap-2", children:
|
|
127
|
+
children: /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center justify-end gap-2", children: x })
|
|
121
128
|
}
|
|
122
129
|
)
|
|
123
130
|
]
|
|
124
131
|
}
|
|
125
132
|
),
|
|
126
|
-
/* @__PURE__ */ l("div", { className: t("w-full flex-1 overflow-hidden",
|
|
133
|
+
/* @__PURE__ */ l("div", { className: t("w-full flex-1 overflow-hidden", z[r], g), children: /* @__PURE__ */ l("div", { className: "animate-fade-in w-full", style: { animationDuration: "0.35s" }, children: i?.find((e) => e.id === s)?.content }, s) })
|
|
127
134
|
] });
|
|
128
135
|
}
|
|
129
136
|
export {
|
|
130
|
-
|
|
137
|
+
k as default
|
|
131
138
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as m, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { cn as s } from "../../lib/utils.js";
|
|
3
|
+
const d = {
|
|
4
4
|
sm: "px-2 py-0.5",
|
|
5
5
|
md: "px-2 py-1",
|
|
6
6
|
lg: "px-3 py-2"
|
|
@@ -8,35 +8,44 @@ const c = {
|
|
|
8
8
|
sm: "w-3 h-3",
|
|
9
9
|
md: "w-3 h-3",
|
|
10
10
|
lg: "w-3 h-3"
|
|
11
|
-
},
|
|
11
|
+
}, b = {
|
|
12
12
|
success: "bg-green-50 text-green-600",
|
|
13
|
-
warning: "bg-
|
|
13
|
+
warning: "bg-yellow-50 text-yellow-600",
|
|
14
14
|
error: "bg-red-50 text-red-600",
|
|
15
15
|
gray: "bg-slate-200 text-slate-700",
|
|
16
16
|
blue: "bg-blue-50 text-blue-600"
|
|
17
|
+
}, p = {
|
|
18
|
+
success: "bg-green-950 text-green-400",
|
|
19
|
+
warning: "bg-yellow-900 text-yellow-400",
|
|
20
|
+
error: "bg-red-950 text-red-400",
|
|
21
|
+
gray: "bg-neutral-200 text-neutral-50",
|
|
22
|
+
blue: "bg-blue-900 text-blue-400"
|
|
17
23
|
};
|
|
18
24
|
function i({
|
|
19
|
-
children:
|
|
20
|
-
variant:
|
|
25
|
+
children: g,
|
|
26
|
+
variant: r = "success",
|
|
21
27
|
size: t = "lg",
|
|
28
|
+
darkMode: x = !1,
|
|
22
29
|
icon: e,
|
|
23
|
-
iconPosition:
|
|
24
|
-
|
|
30
|
+
iconPosition: a = "left",
|
|
31
|
+
rounded: u = !1,
|
|
32
|
+
className: c
|
|
25
33
|
}) {
|
|
26
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ m(
|
|
27
35
|
"span",
|
|
28
36
|
{
|
|
29
|
-
className:
|
|
30
|
-
"inline-flex animate-[fadeIn_0.3s_ease-out] items-center
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
className: s(
|
|
38
|
+
"inline-flex animate-[fadeIn_0.3s_ease-out] items-center text-extra-small font-medium",
|
|
39
|
+
u ? "rounded-full" : "rounded-lg",
|
|
40
|
+
d[t],
|
|
41
|
+
x ? p[r] : b[r],
|
|
33
42
|
e && "gap-[2px]",
|
|
34
|
-
|
|
43
|
+
c
|
|
35
44
|
),
|
|
36
45
|
children: [
|
|
37
|
-
e &&
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
e &&
|
|
46
|
+
e && a === "left" && /* @__PURE__ */ l("span", { className: `flex items-center ${s(n[t])}`, children: e }),
|
|
47
|
+
/* @__PURE__ */ l("span", { children: g }),
|
|
48
|
+
e && a === "right" && /* @__PURE__ */ l("span", { className: `flex items-center ${s(n[t])}`, children: e })
|
|
40
49
|
]
|
|
41
50
|
}
|
|
42
51
|
);
|
|
@@ -1,56 +1,68 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as w, useMemo as _ } from "react";
|
|
3
|
+
import { cn as r } from "../../lib/utils.js";
|
|
4
|
+
const g = w(
|
|
5
5
|
({
|
|
6
|
-
label:
|
|
7
|
-
placeholder:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
label: l,
|
|
7
|
+
placeholder: o,
|
|
8
|
+
darkMode: e = !1,
|
|
9
|
+
value: d = "",
|
|
10
|
+
onChange: n,
|
|
11
|
+
required: u = !1,
|
|
11
12
|
disabled: i = !1,
|
|
12
|
-
error:
|
|
13
|
-
className:
|
|
14
|
-
rows:
|
|
15
|
-
name:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
error: t,
|
|
14
|
+
className: b,
|
|
15
|
+
rows: c = 4,
|
|
16
|
+
name: f,
|
|
17
|
+
...x
|
|
18
|
+
}, m) => {
|
|
19
|
+
const h = _(() => e ? t ? "border-red-500 hover:border-red-500 focus:border-red-500 focus:shadow-[0_0_0_2px_rgba(231,0,11,0.25)]" : "border-neutral-200 hover:border-neutral-100 focus:border-blue-500 focus:shadow-[0_0_0_2px_var(--opacity-25,rgba(21,93,252,0.25))]" : t ? "border-red-600 focus:border-red-600 shadow-red" : "border-slate-200 hover:border-slate-400 focus:shadow-blue focus:border-blue-600", [e, t]);
|
|
20
|
+
return /* @__PURE__ */ s("div", { className: r("relative w-full", b), children: [
|
|
21
|
+
l && /* @__PURE__ */ s(
|
|
20
22
|
"label",
|
|
21
23
|
{
|
|
22
|
-
className:
|
|
24
|
+
className: r(
|
|
23
25
|
"mb-2 block text-base font-medium",
|
|
24
|
-
e ? "text-red-600" : "text-slate-700"
|
|
26
|
+
t ? e ? "text-red-500" : "text-red-600" : e ? "text-neutral-50" : "text-slate-700"
|
|
25
27
|
),
|
|
26
28
|
children: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
l,
|
|
30
|
+
u && /* @__PURE__ */ a("span", { className: "ml-1 text-red-600", children: "*" })
|
|
29
31
|
]
|
|
30
32
|
}
|
|
31
33
|
),
|
|
32
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ a(
|
|
33
35
|
"textarea",
|
|
34
36
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
...x,
|
|
38
|
+
ref: m,
|
|
39
|
+
name: f,
|
|
40
|
+
rows: c,
|
|
41
|
+
value: d,
|
|
42
|
+
onChange: (p) => n?.(p.target.value),
|
|
40
43
|
disabled: i,
|
|
41
|
-
placeholder:
|
|
42
|
-
className:
|
|
43
|
-
"w-full resize-none rounded-xl border
|
|
44
|
-
"p-3 disabled:cursor-not-allowed disabled:border-slate-200 disabled:bg-slate-100 disabled:text-slate-400",
|
|
45
|
-
|
|
44
|
+
placeholder: o,
|
|
45
|
+
className: r(
|
|
46
|
+
"w-full resize-none rounded-xl border text-base font-normal transition-all duration-300 ease-in-out outline-none",
|
|
47
|
+
e ? "p-3 text-neutral-50 placeholder:text-neutral-100 focus:text-white disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-300 disabled:text-neutral-100/50 disabled:placeholder:text-neutral-100/50" : "bg-white p-3 disabled:cursor-not-allowed disabled:border-slate-200 disabled:bg-slate-100 disabled:text-slate-400",
|
|
48
|
+
h
|
|
46
49
|
)
|
|
47
50
|
}
|
|
48
51
|
),
|
|
49
|
-
|
|
52
|
+
t && /* @__PURE__ */ a(
|
|
53
|
+
"p",
|
|
54
|
+
{
|
|
55
|
+
className: r(
|
|
56
|
+
"mt-2 animate-[slideDown_0.3s_ease-out] text-sm font-normal",
|
|
57
|
+
e ? "text-red-500" : "text-red-600"
|
|
58
|
+
),
|
|
59
|
+
children: t
|
|
60
|
+
}
|
|
61
|
+
)
|
|
50
62
|
] });
|
|
51
63
|
}
|
|
52
64
|
);
|
|
53
|
-
|
|
65
|
+
g.displayName = "MciTextarea";
|
|
54
66
|
export {
|
|
55
|
-
|
|
67
|
+
g as default
|
|
56
68
|
};
|
|
@@ -1,69 +1,105 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { TOAST_STYLES as
|
|
7
|
-
const O =
|
|
8
|
-
let p = null,
|
|
9
|
-
const
|
|
10
|
-
p || (p =
|
|
11
|
-
/* @__PURE__ */ s("div", { className: "flex flex-col gap-3", children:
|
|
1
|
+
import { jsx as s, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useEffect as C } from "react";
|
|
3
|
+
import { createRoot as I } from "react-dom/client";
|
|
4
|
+
import S from "../../../assets/icons/close.svg.js";
|
|
5
|
+
import { cn as a } from "../../lib/utils.js";
|
|
6
|
+
import { TOAST_STYLES as r, TOAST_ICONS as A, getOrCreateToastContainer as D } from "./mci-toast.utils.js";
|
|
7
|
+
const O = D();
|
|
8
|
+
let p = null, F = 0;
|
|
9
|
+
const m = [], N = () => {
|
|
10
|
+
p || (p = I(O)), p.render(
|
|
11
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-3", children: m.map(({ id: e, element: t }) => /* @__PURE__ */ s("div", { className: "pointer-events-auto", children: t }, e)) })
|
|
12
12
|
);
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function j({
|
|
15
15
|
title: e,
|
|
16
|
-
description:
|
|
17
|
-
type:
|
|
18
|
-
duration:
|
|
19
|
-
action:
|
|
20
|
-
|
|
16
|
+
description: t,
|
|
17
|
+
type: n = "info",
|
|
18
|
+
duration: o = 3e3,
|
|
19
|
+
action: c,
|
|
20
|
+
darkMode: i = !1,
|
|
21
|
+
onClose: d
|
|
21
22
|
}) {
|
|
22
|
-
const [
|
|
23
|
+
const [T, h] = b(100);
|
|
23
24
|
return C(() => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
25
|
+
if (o === 1 / 0) {
|
|
26
|
+
h(100);
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
|
-
let
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
return () => cancelAnimationFrame(
|
|
35
|
-
}, [
|
|
29
|
+
let f = null;
|
|
30
|
+
const x = (g) => {
|
|
31
|
+
f || (f = g);
|
|
32
|
+
const y = g - f, v = Math.max(0, (o - y) / o * 100);
|
|
33
|
+
h(v), v > 0 ? requestAnimationFrame(x) : d?.();
|
|
34
|
+
}, w = requestAnimationFrame(x);
|
|
35
|
+
return () => cancelAnimationFrame(w);
|
|
36
|
+
}, [o, d]), /* @__PURE__ */ u(
|
|
36
37
|
"div",
|
|
37
38
|
{
|
|
38
|
-
className:
|
|
39
|
-
"relative w-[300px] max-w-full overflow-hidden shadow-md
|
|
39
|
+
className: a(
|
|
40
|
+
"relative w-[300px] max-w-full overflow-hidden rounded-lg shadow-md",
|
|
40
41
|
"animate-in fade-in slide-in-from-top-2 duration-300",
|
|
41
|
-
|
|
42
|
+
i ? r.bgDark[n] : r.bg[n]
|
|
42
43
|
),
|
|
43
44
|
children: [
|
|
44
45
|
/* @__PURE__ */ s(
|
|
45
46
|
"div",
|
|
46
47
|
{
|
|
47
|
-
className:
|
|
48
|
+
className: a(
|
|
49
|
+
"absolute bottom-0 left-0 h-1",
|
|
50
|
+
i ? r.lineDark[n] : r.line[n]
|
|
51
|
+
),
|
|
48
52
|
style: {
|
|
49
|
-
width: `${
|
|
53
|
+
width: `${T}%`,
|
|
50
54
|
transition: "none"
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
),
|
|
54
|
-
/* @__PURE__ */ s("div", { className: "p-4", children: /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */ s(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
/* @__PURE__ */ s("div", { className: "p-4", children: /* @__PURE__ */ u("div", { className: "flex items-start gap-2", children: [
|
|
59
|
+
/* @__PURE__ */ s(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: a(
|
|
63
|
+
"shrink-0",
|
|
64
|
+
i ? r.textDark[n] : r.text[n]
|
|
65
|
+
),
|
|
66
|
+
children: A[n]
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
|
|
70
|
+
/* @__PURE__ */ s(
|
|
71
|
+
"h4",
|
|
72
|
+
{
|
|
73
|
+
className: a(
|
|
74
|
+
"mb-1 text-base font-medium",
|
|
75
|
+
i && r.textDark[n]
|
|
76
|
+
),
|
|
77
|
+
children: e
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
t && /* @__PURE__ */ s("p", { className: a("text-sm", i ? "text-slate-400" : "text-[#82828C]"), children: t }),
|
|
81
|
+
c && /* @__PURE__ */ s("div", { className: "mt-3", children: /* @__PURE__ */ s(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: a(
|
|
85
|
+
"text-sm font-medium underline",
|
|
86
|
+
i ? r.actionDark[n] : r.action[n]
|
|
87
|
+
),
|
|
88
|
+
children: c
|
|
89
|
+
}
|
|
90
|
+
) })
|
|
60
91
|
] }),
|
|
61
92
|
/* @__PURE__ */ s(
|
|
62
93
|
"button",
|
|
63
94
|
{
|
|
64
|
-
onClick:
|
|
65
|
-
className: "
|
|
66
|
-
children: /* @__PURE__ */ s(
|
|
95
|
+
onClick: d,
|
|
96
|
+
className: "shrink-0 cursor-pointer rounded-full transition active:animate-spin",
|
|
97
|
+
children: /* @__PURE__ */ s(
|
|
98
|
+
S,
|
|
99
|
+
{
|
|
100
|
+
className: a("h-6 w-6", i ? "text-slate-400" : "text-slate-base")
|
|
101
|
+
}
|
|
102
|
+
)
|
|
67
103
|
}
|
|
68
104
|
)
|
|
69
105
|
] }) })
|
|
@@ -71,36 +107,46 @@ function F({
|
|
|
71
107
|
}
|
|
72
108
|
);
|
|
73
109
|
}
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
success: (e,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
type: "
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
const l = (e) => {
|
|
111
|
+
const t = F++, n = () => {
|
|
112
|
+
const c = m.findIndex((i) => i?.id === t);
|
|
113
|
+
c !== -1 && (m.splice(c, 1), N());
|
|
114
|
+
}, o = /* @__PURE__ */ s(j, { ...e, onClose: n });
|
|
115
|
+
return m.push({ id: t, element: o }), N(), e.duration !== 1 / 0 && setTimeout(n, (e.duration || 3e3) + 300), { close: n };
|
|
116
|
+
}, R = {
|
|
117
|
+
success: (e, t, n) => l(
|
|
118
|
+
typeof e == "string" ? { title: e, description: t, type: "success", action: n } : {
|
|
119
|
+
...e,
|
|
120
|
+
type: "success"
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
error: (e, t, n) => l(
|
|
124
|
+
typeof e == "string" ? { title: e, description: t, type: "error", action: n } : {
|
|
125
|
+
...e,
|
|
126
|
+
type: "error"
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
warning: (e, t, n) => l(
|
|
130
|
+
typeof e == "string" ? { title: e, description: t, type: "warning", action: n } : {
|
|
131
|
+
...e,
|
|
132
|
+
type: "warning"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
info: (e, t, n) => l(
|
|
136
|
+
typeof e == "string" ? { title: e, description: t, type: "info", action: n } : {
|
|
137
|
+
...e,
|
|
138
|
+
type: "info"
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
loading: (e, t) => l(
|
|
142
|
+
typeof e == "string" ? {
|
|
143
|
+
title: e,
|
|
144
|
+
description: t,
|
|
145
|
+
type: "loading",
|
|
146
|
+
duration: 1 / 0
|
|
147
|
+
} : { ...e, type: "loading", duration: 1 / 0 }
|
|
148
|
+
)
|
|
103
149
|
};
|
|
104
150
|
export {
|
|
105
|
-
|
|
151
|
+
R as default
|
|
106
152
|
};
|