@mci-ui/mci-ui 0.0.84 → 0.0.86

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 (47) hide show
  1. package/dist/assets/icons/check.svg.js +5 -0
  2. package/dist/assets/icons/close.svg.js +5 -0
  3. package/dist/assets/icons/loaderIcon.svg.js +5 -0
  4. package/dist/index.js +53 -0
  5. package/dist/shared/lib/hooks/useTableColumnSettings.js +132 -0
  6. package/dist/shared/lib/locales.js +101 -0
  7. package/dist/shared/lib/uploadLanguage.js +80 -0
  8. package/dist/shared/lib/utils.js +20 -0
  9. package/dist/shared/ui/MciModal/MciModal.js +97 -0
  10. package/dist/shared/ui/mciAccordion/MciAccordion.js +74 -0
  11. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +39 -0
  12. package/dist/shared/ui/mciButton/MciButton.js +63 -0
  13. package/dist/shared/ui/mciCheck/MciCheck.js +170 -0
  14. package/dist/shared/ui/mciCollapse/MciCollapse.js +60 -0
  15. package/dist/shared/ui/mciDrawer/MciDrawer.js +108 -0
  16. package/dist/shared/ui/mciIdentityInput/MciIdentityInput.js +30 -0
  17. package/dist/shared/ui/mciIdentityInput/mci-identity-input.utils.js +32 -0
  18. package/dist/shared/ui/mciInput/MciInput.js +225 -0
  19. package/dist/shared/ui/mciInput/mci-input.utils.js +49 -0
  20. package/dist/shared/ui/mciLoader/MciLoader.js +38 -0
  21. package/dist/shared/ui/mciPagination/MciPagination.js +135 -0
  22. package/dist/shared/ui/mciPagination/mci-pagination.utils.js +12 -0
  23. package/dist/shared/ui/mciPhone/MciPhone.js +83 -0
  24. package/dist/shared/ui/mciPhone/mci-phone.utils.js +47 -0
  25. package/dist/shared/ui/mciPicker/MciPicker.js +256 -0
  26. package/dist/shared/ui/mciPicker/mci-picker.utils.js +62 -0
  27. package/dist/shared/ui/mciSelect/MciSelect.js +226 -0
  28. package/dist/shared/ui/mciSelect/mci-select.utils.js +52 -0
  29. package/dist/shared/ui/mciSkeleton/MciSkeleton.js +29 -0
  30. package/dist/shared/ui/mciTable/MciTable.js +153 -0
  31. package/dist/shared/ui/mciTable/MciTableClamp2.js +7 -0
  32. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +198 -0
  33. package/dist/shared/ui/mciTable/mci-table.utils.js +14 -0
  34. package/dist/shared/ui/mciTabs/MciTabs.js +131 -0
  35. package/dist/shared/ui/mciTag/MciTag.js +46 -0
  36. package/dist/shared/ui/mciTextarea/MciTextarea.js +56 -0
  37. package/dist/shared/ui/mciToast/MciToast.js +106 -0
  38. package/dist/shared/ui/mciToast/mci-toast.utils.js +47 -0
  39. package/dist/shared/ui/mciToggle/MciToggle.js +77 -0
  40. package/dist/shared/ui/mciTooltip/MciTooltip.js +52 -0
  41. package/dist/shared/ui/mciUpload/MciUpload.js +337 -0
  42. package/dist/shared/ui/mciUpload/mci-upload.utils.js +186 -0
  43. package/dist/types/shared/types/mci-table.types.d.ts +1 -0
  44. package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
  45. package/package.json +15 -12
  46. package/dist/index.es.js +0 -3387
  47. package/dist/index.umd.js +0 -2
@@ -0,0 +1,198 @@
1
+ import { jsxs as u, jsx as n } from "react/jsx-runtime";
2
+ import { useRef as G, useEffect as K, useMemo as j, useState as h, useCallback as b } from "react";
3
+ import { TransferVertical as _ } from "@solar-icons/react";
4
+ import { useClickOutside as q, cn as f } from "../../lib/utils.js";
5
+ /* empty css */
6
+ import H from "../mciCheck/MciCheck.js";
7
+ const J = {
8
+ ru: {
9
+ title: "Настройки",
10
+ close: "Закрыть",
11
+ activeColumns: "Активные колонки",
12
+ minColumns: (i) => `Минимум ${i} колонок`,
13
+ drag: "Перетащить"
14
+ },
15
+ uz: {
16
+ title: "Sozlamalar",
17
+ close: "Yopish",
18
+ activeColumns: "Aktiv ustunlar",
19
+ minColumns: (i) => `Kamida ${i} ta ustun`,
20
+ drag: "Sudrash"
21
+ }
22
+ };
23
+ function ee({
24
+ open: i,
25
+ onClose: D,
26
+ columns: s,
27
+ hidden: w,
28
+ onToggle: C,
29
+ onMove: y,
30
+ onMoveByKey: p,
31
+ minVisible: T = 5,
32
+ locale: F = "ru"
33
+ }) {
34
+ const S = G(null), { handleClick: v } = q(S, D), d = J[F];
35
+ K(() => {
36
+ if (i)
37
+ return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
38
+ }, [i, v]);
39
+ const x = j(() => new Set(w), [w]), I = j(() => {
40
+ let e = 0;
41
+ for (const t of s) x.has(t.key) || e++;
42
+ return e;
43
+ }, [s, x]), [k, O] = h(null), [E, A] = h(null), [Q, L] = h(null), [m, N] = h("before"), z = b(
44
+ (e, t, r) => {
45
+ let a = r === "after" ? t + 1 : t;
46
+ return e < a && (a -= 1), a;
47
+ },
48
+ []
49
+ ), g = b(() => {
50
+ O(null), L(null), A(null), N("before");
51
+ }, []), Y = b(
52
+ (e, t, r) => {
53
+ O(t), L(String(r)), A(null), N("before"), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(t));
54
+ const a = new Image();
55
+ a.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", e.dataTransfer.setDragImage(a, 0, 0);
56
+ },
57
+ []
58
+ ), $ = b(
59
+ (e, t) => {
60
+ e.preventDefault();
61
+ const r = k ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
62
+ if (!Number.isFinite(r) || r < 0) {
63
+ g();
64
+ return;
65
+ }
66
+ const a = s[r], c = s[t];
67
+ if (!a || !c) {
68
+ g();
69
+ return;
70
+ }
71
+ const l = z(r, t, m);
72
+ l !== r && (p ? p(a.key, c.key, m) : y(r, l)), g();
73
+ },
74
+ [s, z, k, m, y, p, g]
75
+ ), B = b(
76
+ (e, t) => {
77
+ t || C(e);
78
+ },
79
+ [C]
80
+ );
81
+ return i ? /* @__PURE__ */ u(
82
+ "div",
83
+ {
84
+ ref: S,
85
+ className: f(
86
+ "absolute right-0 top-full z-50 mt-2 w-[320px]",
87
+ "rounded-2xl p-4 bg-white",
88
+ "border border-slate-200"
89
+ ),
90
+ children: [
91
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-4", children: [
92
+ /* @__PURE__ */ n("h4", { className: "text-slate-600 text-large font-normal", children: d.title }),
93
+ /* @__PURE__ */ n(
94
+ "button",
95
+ {
96
+ type: "button",
97
+ onClick: D,
98
+ className: "rounded-lg px-2 py-1 text-slate-500 hover:bg-slate-100",
99
+ "aria-label": d.close,
100
+ children: "✕"
101
+ }
102
+ )
103
+ ] }),
104
+ /* @__PURE__ */ n("div", { className: "my-4 h-px bg-slate-100" }),
105
+ /* @__PURE__ */ u("p", { className: "mb-3 text-xs text-slate-500", children: [
106
+ d.activeColumns,
107
+ ": ",
108
+ I,
109
+ "/",
110
+ s.length
111
+ ] }),
112
+ /* @__PURE__ */ n(
113
+ "div",
114
+ {
115
+ className: f(
116
+ "max-h-[275px] overflow-auto",
117
+ "[&::-webkit-scrollbar]:w-1.5",
118
+ "[&::-webkit-scrollbar-track]:bg-transparent",
119
+ "[&::-webkit-scrollbar-thumb]:bg-slate-200",
120
+ "[&::-webkit-scrollbar-thumb]:rounded-full",
121
+ "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
122
+ ),
123
+ children: s.map((e, t) => {
124
+ const r = !x.has(e.key), a = r && I <= T, c = E === t, l = Q === e.key;
125
+ return /* @__PURE__ */ u("div", { className: "relative", children: [
126
+ c && !l && /* @__PURE__ */ n(
127
+ "div",
128
+ {
129
+ className: f(
130
+ "pointer-events-none absolute left-2 right-2 z-10 h-0.5 rounded-full bg-blue-300",
131
+ m === "before" ? "top-0" : "bottom-0"
132
+ )
133
+ }
134
+ ),
135
+ /* @__PURE__ */ u(
136
+ "div",
137
+ {
138
+ draggable: !0,
139
+ onDragStart: (o) => Y(o, t, e.key),
140
+ onDragOver: (o) => {
141
+ if (k == null) return;
142
+ o.preventDefault(), o.dataTransfer.dropEffect = "move";
143
+ const P = o.currentTarget.getBoundingClientRect(), R = o.clientY - P.top > P.height / 2 ? "after" : "before";
144
+ E !== t && A(t), m !== R && N(R);
145
+ },
146
+ onDrop: (o) => $(o, t),
147
+ onDragEnd: g,
148
+ className: f(
149
+ "group flex items-center py-2 px-1 gap-4",
150
+ "rounded-md box-border overflow-visible",
151
+ "transition-[background,transform] duration-150",
152
+ !l && !c && "hover:bg-slate-50",
153
+ c && !l && "bg-slate-50",
154
+ l && "bg-slate-50 opacity-100 scale-[0.99] cursor-grabbing"
155
+ ),
156
+ children: [
157
+ /* @__PURE__ */ n(
158
+ "button",
159
+ {
160
+ type: "button",
161
+ className: f(
162
+ "shrink-0 text-slate-400",
163
+ "cursor-grab active:cursor-grabbing",
164
+ "rounded-lg p-1 hover:bg-slate-100",
165
+ l && "cursor-grabbing"
166
+ ),
167
+ "aria-label": d.drag,
168
+ children: /* @__PURE__ */ n(_, { weight: "Linear", size: 20 })
169
+ }
170
+ ),
171
+ /* @__PURE__ */ n("div", { className: "shrink-0", children: /* @__PURE__ */ n(
172
+ H,
173
+ {
174
+ checked: r,
175
+ disabled: a,
176
+ onChange: () => B(e.key, a),
177
+ variant: "blue"
178
+ }
179
+ ) }),
180
+ /* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
181
+ /* @__PURE__ */ n("h4", { className: "truncate text-slate-700 text-base font-medium", title: e.title, children: e.title }),
182
+ a && /* @__PURE__ */ n("p", { className: "text-xs text-slate-400 mt-0.5", children: d.minColumns(T) })
183
+ ] })
184
+ ]
185
+ }
186
+ ),
187
+ t !== s.length - 1 && /* @__PURE__ */ n("div", { className: "mx-2 h-px bg-slate-100" })
188
+ ] }, e.key);
189
+ })
190
+ }
191
+ )
192
+ ]
193
+ }
194
+ ) : null;
195
+ }
196
+ export {
197
+ ee as default
198
+ };
@@ -0,0 +1,14 @@
1
+ function i(n) {
2
+ if (n != null)
3
+ return typeof n == "number" ? `${n}px` : n;
4
+ }
5
+ function o(n, r, f) {
6
+ return !r || f ? n : [...n].sort((l, t) => {
7
+ const u = l[r.key], e = t[r.key];
8
+ return u == null ? 1 : e == null ? -1 : u < e ? r.direction === "asc" ? -1 : 1 : u > e ? r.direction === "asc" ? 1 : -1 : 0;
9
+ });
10
+ }
11
+ export {
12
+ i as normalizeColWidth,
13
+ o as sortRows
14
+ };
@@ -0,0 +1,131 @@
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";
3
+ import { cn as t } from "../../lib/utils.js";
4
+ const I = {
5
+ top: "flex-col",
6
+ bottom: "flex-col-reverse",
7
+ left: "flex-row",
8
+ right: "flex-row-reverse"
9
+ }, L = {
10
+ top: "flex-row",
11
+ bottom: "flex-row",
12
+ left: "flex-col",
13
+ right: "flex-col"
14
+ }, j = {
15
+ top: "mt-4",
16
+ bottom: "mb-4",
17
+ left: "ml-4",
18
+ right: "mr-4"
19
+ };
20
+ function _({
21
+ tabs: i,
22
+ defaultTab: h,
23
+ position: n = "top",
24
+ className: p,
25
+ tabListClassName: v,
26
+ contentClassName: N,
27
+ extra: u,
28
+ onChange: S
29
+ }) {
30
+ const [s, g] = x(h || i[0]?.id), [y, E] = x({}), a = b([]), o = C(() => {
31
+ 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;
35
+ E({
36
+ left: `${c}px`,
37
+ top: `${m}px`,
38
+ width: `${T}px`,
39
+ height: `${A}px`,
40
+ transition: "all 0.35s cubic-bezier(0.25, 1, 0.5, 1)"
41
+ });
42
+ }
43
+ });
44
+ }, [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);
47
+ }, [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(
51
+ "div",
52
+ {
53
+ className: t(
54
+ "flex w-full gap-4",
55
+ r ? "flex-col items-start" : "flex-row flex-wrap items-center"
56
+ ),
57
+ children: [
58
+ /* @__PURE__ */ l(
59
+ "div",
60
+ {
61
+ className: t(
62
+ "flex-1",
63
+ r ? "w-full" : "min-w-[520px]"
64
+ ),
65
+ children: /* @__PURE__ */ d(
66
+ "div",
67
+ {
68
+ 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
74
+ ),
75
+ children: [
76
+ /* @__PURE__ */ l(
77
+ "div",
78
+ {
79
+ className: t("absolute rounded-lg bg-white", r ? "w-full" : "h-full"),
80
+ style: y
81
+ }
82
+ ),
83
+ i?.map((e, f) => {
84
+ const c = s === e.id;
85
+ return /* @__PURE__ */ d(
86
+ "button",
87
+ {
88
+ ref: (m) => {
89
+ a.current[f] = m;
90
+ },
91
+ onClick: () => {
92
+ e?.disabled || (g(e?.id), S?.(e?.id));
93
+ },
94
+ disabled: e?.disabled,
95
+ 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"
99
+ ),
100
+ children: [
101
+ e?.icon && /* @__PURE__ */ l("span", { className: t("shrink-0 transition-transform duration-200", c && "scale-110"), children: e?.icon }),
102
+ /* @__PURE__ */ l("span", { className: "relative z-10 truncate", title: e?.label, children: e?.label })
103
+ ]
104
+ },
105
+ e?.id
106
+ );
107
+ })
108
+ ]
109
+ }
110
+ )
111
+ }
112
+ ),
113
+ u && /* @__PURE__ */ l(
114
+ "div",
115
+ {
116
+ className: t(
117
+ "shrink-0 ml-auto",
118
+ r ? "w-full" : "max-w-full"
119
+ ),
120
+ children: /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center justify-end gap-2", children: u })
121
+ }
122
+ )
123
+ ]
124
+ }
125
+ ),
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) })
127
+ ] });
128
+ }
129
+ export {
130
+ _ as default
131
+ };
@@ -0,0 +1,46 @@
1
+ import { jsxs as x, jsx as s } from "react/jsx-runtime";
2
+ import { cn as a } from "../../lib/utils.js";
3
+ const c = {
4
+ sm: "px-2 py-0.5",
5
+ md: "px-2 py-1",
6
+ lg: "px-3 py-2"
7
+ }, n = {
8
+ sm: "w-3 h-3",
9
+ md: "w-3 h-3",
10
+ lg: "w-3 h-3"
11
+ }, p = {
12
+ success: "bg-green-50 text-green-600",
13
+ warning: "bg-orange-50 text-orange-600",
14
+ error: "bg-red-50 text-red-600",
15
+ gray: "bg-slate-200 text-slate-700",
16
+ blue: "bg-blue-50 text-blue-600"
17
+ };
18
+ function i({
19
+ children: l,
20
+ variant: g = "success",
21
+ size: t = "lg",
22
+ icon: e,
23
+ iconPosition: r = "left",
24
+ className: m
25
+ }) {
26
+ return /* @__PURE__ */ x(
27
+ "span",
28
+ {
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],
33
+ e && "gap-[2px]",
34
+ m
35
+ ),
36
+ 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 })
40
+ ]
41
+ }
42
+ );
43
+ }
44
+ export {
45
+ i as default
46
+ };
@@ -0,0 +1,56 @@
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(
5
+ ({
6
+ label: s,
7
+ placeholder: r,
8
+ value: o = "",
9
+ onChange: d,
10
+ required: n = !1,
11
+ 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(
20
+ "label",
21
+ {
22
+ className: a(
23
+ "mb-2 block text-base font-medium",
24
+ e ? "text-red-600" : "text-slate-700"
25
+ ),
26
+ children: [
27
+ s,
28
+ n && /* @__PURE__ */ t("span", { className: "ml-1 text-red-600", children: "*" })
29
+ ]
30
+ }
31
+ ),
32
+ /* @__PURE__ */ t(
33
+ "textarea",
34
+ {
35
+ ref: c,
36
+ name: b,
37
+ rows: u,
38
+ value: o,
39
+ onChange: (x) => d?.(x.target.value),
40
+ 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
46
+ )
47
+ }
48
+ ),
49
+ e && /* @__PURE__ */ t("p", { className: "mt-2 animate-[slideDown_0.3s_ease-out] text-sm font-normal text-red-600", children: e })
50
+ ] });
51
+ }
52
+ );
53
+ w.displayName = "MciTextarea";
54
+ export {
55
+ w as default
56
+ };
@@ -0,0 +1,106 @@
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)) })
12
+ );
13
+ };
14
+ function F({
15
+ title: e,
16
+ description: n,
17
+ type: t = "info",
18
+ duration: i = 3e3,
19
+ action: o,
20
+ onClose: r
21
+ }) {
22
+ const [y, u] = w(100);
23
+ return C(() => {
24
+ if (i === 1 / 0) {
25
+ u(100);
26
+ return;
27
+ }
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(
36
+ "div",
37
+ {
38
+ className: c(
39
+ "relative w-[300px] max-w-full overflow-hidden shadow-md rounded-lg",
40
+ "animate-in fade-in slide-in-from-top-2 duration-300",
41
+ l.bg[t]
42
+ ),
43
+ children: [
44
+ /* @__PURE__ */ s(
45
+ "div",
46
+ {
47
+ className: c("absolute bottom-0 left-0 h-1", l.line[t]),
48
+ style: {
49
+ width: `${y}%`,
50
+ transition: "none"
51
+ }
52
+ }
53
+ ),
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 }) })
60
+ ] }),
61
+ /* @__PURE__ */ s(
62
+ "button",
63
+ {
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" })
67
+ }
68
+ )
69
+ ] }) })
70
+ ]
71
+ }
72
+ );
73
+ }
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 })
103
+ };
104
+ export {
105
+ P as default
106
+ };
@@ -0,0 +1,47 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Refresh as n, InfoCircle as r, DangerCircle as o, CloseCircle as a, CheckCircle as i } from "@solar-icons/react";
3
+ const l = {
4
+ success: /* @__PURE__ */ t(i, { weight: "Bold", className: "w-5 h-5" }),
5
+ error: /* @__PURE__ */ t(a, { weight: "Bold", className: "w-5 h-5" }),
6
+ warning: /* @__PURE__ */ t(o, { weight: "Bold", className: "w-5 h-5" }),
7
+ info: /* @__PURE__ */ t(r, { weight: "Bold", className: "w-5 h-5" }),
8
+ loading: /* @__PURE__ */ t(n, { weight: "Bold", className: "w-5 h-5 animate-spin" })
9
+ }, c = {
10
+ bg: {
11
+ success: "bg-green-50",
12
+ error: "bg-red-50",
13
+ warning: "bg-orange-50",
14
+ info: "bg-blue-50",
15
+ loading: "bg-slate-50"
16
+ },
17
+ line: {
18
+ success: "bg-green-600",
19
+ error: "bg-red-600",
20
+ warning: "bg-orange-600",
21
+ info: "bg-blue-600",
22
+ loading: "bg-slate-600"
23
+ },
24
+ text: {
25
+ success: "text-green-600",
26
+ error: "text-red-600",
27
+ warning: "text-orange-600",
28
+ info: "text-blue-600",
29
+ loading: "text-slate-600"
30
+ },
31
+ action: {
32
+ success: "text-green-600",
33
+ error: "text-red-600",
34
+ warning: "text-orange-600",
35
+ info: "text-blue-600",
36
+ loading: "text-slate-600"
37
+ }
38
+ };
39
+ function d() {
40
+ let e = document.getElementById("mci-toast-container");
41
+ return e || (e = document.createElement("div"), e.id = "mci-toast-container", e.className = "fixed top-4 right-4 z-[9999] flex flex-col gap-3 pointer-events-none", document.body.appendChild(e)), e;
42
+ }
43
+ export {
44
+ l as TOAST_ICONS,
45
+ c as TOAST_STYLES,
46
+ d as getOrCreateToastContainer
47
+ };
@@ -0,0 +1,77 @@
1
+ import { jsxs as c, jsx as l } from "react/jsx-runtime";
2
+ import { cn as t } from "../../lib/utils.js";
3
+ const r = {
4
+ blue: {
5
+ active: "bg-blue-600",
6
+ hover: "hover:bg-blue-600",
7
+ focus: "focus:shadow-blue"
8
+ },
9
+ yellow: {
10
+ active: "bg-yellow-500",
11
+ hover: "hover:bg-yellow-500",
12
+ focus: "focus:ring-2 focus:ring-yellow-200"
13
+ }
14
+ };
15
+ function d({
16
+ checked: o = !1,
17
+ onChange: i,
18
+ disabled: e = !1,
19
+ variant: s = "yellow",
20
+ label: n,
21
+ supportText: a,
22
+ className: u
23
+ }) {
24
+ const f = () => {
25
+ e || i?.(!o);
26
+ };
27
+ return /* @__PURE__ */ c(
28
+ "div",
29
+ {
30
+ className: t(
31
+ "flex items-start gap-3 select-none",
32
+ u
33
+ ),
34
+ children: [
35
+ /* @__PURE__ */ l(
36
+ "button",
37
+ {
38
+ type: "button",
39
+ disabled: e,
40
+ className: t(
41
+ "relative h-6 w-11 rounded-xl transition-all duration-300 outline-none cursor-pointer",
42
+ o ? r[s].active : "bg-slate-200",
43
+ !e && r[s].hover,
44
+ !e && r[s].focus,
45
+ e && "bg-slate-100 cursor-not-allowed"
46
+ ),
47
+ onClick: f,
48
+ children: /* @__PURE__ */ l(
49
+ "span",
50
+ {
51
+ className: t(
52
+ "absolute top-1/2 left-0.5 h-5 w-5 -translate-y-1/2 rounded-full transition-all duration-300 bg-white",
53
+ o && "translate-x-5"
54
+ )
55
+ }
56
+ )
57
+ }
58
+ ),
59
+ (n || a) && /* @__PURE__ */ c("div", { className: "flex flex-col leading-tight", children: [
60
+ n && /* @__PURE__ */ l(
61
+ "span",
62
+ {
63
+ className: t(
64
+ "text-base font-medium text-black"
65
+ ),
66
+ children: n
67
+ }
68
+ ),
69
+ a && /* @__PURE__ */ l("span", { className: "text-sm font-normal text-slate-500", children: a })
70
+ ] })
71
+ ]
72
+ }
73
+ );
74
+ }
75
+ export {
76
+ d as default
77
+ };