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