@mci-ui/mci-ui 0.0.83 → 0.0.85

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 (49) 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.css +1 -1
  5. package/dist/index.js +53 -0
  6. package/dist/shared/lib/hooks/useTableColumnSettings.js +132 -0
  7. package/dist/shared/lib/locales.js +101 -0
  8. package/dist/shared/lib/uploadLanguage.js +80 -0
  9. package/dist/shared/lib/utils.js +20 -0
  10. package/dist/shared/ui/MciModal/MciModal.js +97 -0
  11. package/dist/shared/ui/mciAccordion/MciAccordion.js +74 -0
  12. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +39 -0
  13. package/dist/shared/ui/mciButton/MciButton.js +63 -0
  14. package/dist/shared/ui/mciCheck/MciCheck.js +170 -0
  15. package/dist/shared/ui/mciCollapse/MciCollapse.js +60 -0
  16. package/dist/shared/ui/mciDrawer/MciDrawer.js +108 -0
  17. package/dist/shared/ui/mciIdentityInput/MciIdentityInput.js +30 -0
  18. package/dist/shared/ui/mciIdentityInput/mci-identity-input.utils.js +32 -0
  19. package/dist/shared/ui/mciInput/MciInput.js +225 -0
  20. package/dist/shared/ui/mciInput/mci-input.utils.js +49 -0
  21. package/dist/shared/ui/mciLoader/MciLoader.js +38 -0
  22. package/dist/shared/ui/mciPagination/MciPagination.js +135 -0
  23. package/dist/shared/ui/mciPagination/mci-pagination.utils.js +12 -0
  24. package/dist/shared/ui/mciPhone/MciPhone.js +83 -0
  25. package/dist/shared/ui/mciPhone/mci-phone.utils.js +47 -0
  26. package/dist/shared/ui/mciPicker/MciPicker.js +256 -0
  27. package/dist/shared/ui/mciPicker/mci-picker.utils.js +62 -0
  28. package/dist/shared/ui/mciSelect/MciSelect.js +226 -0
  29. package/dist/shared/ui/mciSelect/mci-select.utils.js +52 -0
  30. package/dist/shared/ui/mciSkeleton/MciSkeleton.js +29 -0
  31. package/dist/shared/ui/mciTable/MciTable.js +153 -0
  32. package/dist/shared/ui/mciTable/MciTableClamp2.js +7 -0
  33. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +184 -0
  34. package/dist/shared/ui/mciTable/mci-table.utils.js +14 -0
  35. package/dist/shared/ui/mciTabs/MciTabs.js +131 -0
  36. package/dist/shared/ui/mciTag/MciTag.js +46 -0
  37. package/dist/shared/ui/mciTextarea/MciTextarea.js +56 -0
  38. package/dist/shared/ui/mciToast/MciToast.js +106 -0
  39. package/dist/shared/ui/mciToast/mci-toast.utils.js +47 -0
  40. package/dist/shared/ui/mciToggle/MciToggle.js +77 -0
  41. package/dist/shared/ui/mciTooltip/MciTooltip.js +52 -0
  42. package/dist/shared/ui/mciUpload/MciUpload.js +337 -0
  43. package/dist/shared/ui/mciUpload/mci-upload.utils.js +186 -0
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/types/shared/types/ui/accordion.types.d.ts +7 -0
  46. package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +22 -0
  47. package/package.json +15 -12
  48. package/dist/index.es.js +0 -3319
  49. package/dist/index.umd.js +0 -2
@@ -0,0 +1,153 @@
1
+ import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
+ import { ConfoundedSquare as E, SortVertical as G, SortFromTopToBottom as I, SortFromBottomToTop as W } from "@solar-icons/react";
3
+ import { useState as _, useMemo as k, useEffect as H, useCallback as J } from "react";
4
+ import { cn as h } from "../../lib/utils.js";
5
+ /* empty css */
6
+ import T from "../mciCheck/MciCheck.js";
7
+ import z from "../mciSkeleton/MciSkeleton.js";
8
+ import K from "./MciTableClamp2.js";
9
+ import { sortRows as O, normalizeColWidth as Q } from "./mci-table.utils.js";
10
+ function le({
11
+ columns: m,
12
+ data: y = [],
13
+ loading: b = !1,
14
+ skeletonRows: A = 5,
15
+ noDataText: M = "",
16
+ sort: a,
17
+ onSortChange: v,
18
+ className: B,
19
+ headerClassName: N,
20
+ bodyClassName: w,
21
+ rowKey: f = "id",
22
+ rowSelection: l
23
+ }) {
24
+ const [D, C] = _(null), n = a ?? D, u = k(() => Array.isArray(y) ? y : [], [y]), R = k(() => O(u, n, !!a), [u, n, a]);
25
+ H(() => {
26
+ a !== void 0 && C(null);
27
+ }, [a]);
28
+ const o = k(
29
+ () => b ? [] : a ? u : R,
30
+ [b, a, u, R]
31
+ ), L = J(
32
+ (e) => {
33
+ if (!e.sortable) return;
34
+ let s = null;
35
+ n?.key !== e.key ? s = { key: e.key, direction: "asc" } : n.direction === "asc" && (s = { key: e.key, direction: "desc" }), a !== void 0 ? v?.(s) : C(s);
36
+ },
37
+ [n, a, v]
38
+ ), P = (e) => {
39
+ if (!l) return;
40
+ const { onChange: s, getCheckboxProps: c } = l;
41
+ if (e.target.checked) {
42
+ const i = o.filter((d) => !c?.(d)?.disabled).map((d) => d[f]);
43
+ s(i);
44
+ } else
45
+ s([]);
46
+ }, F = (e, s) => {
47
+ if (!l) return;
48
+ const { selectedRowKeys: c, onChange: g } = l, p = e[f], i = s ? [...c, p] : c.filter((d) => d !== p);
49
+ g(i);
50
+ }, V = k(() => {
51
+ if (!l || o.length === 0) return !1;
52
+ const e = o.filter((s) => !l.getCheckboxProps?.(s)?.disabled);
53
+ return e.length === 0 ? !1 : e.every(
54
+ (s) => l.selectedRowKeys.includes(s[f])
55
+ );
56
+ }, [l, o, f]), q = (e) => e.sortable ? !n || n.key !== e.key ? /* @__PURE__ */ t(G, { weight: "Linear", size: 20, className: "text-slate-base shrink-0" }) : n.direction === "asc" ? /* @__PURE__ */ t(I, { weight: "Linear", size: 20, className: "text-slate-base shrink-0" }) : /* @__PURE__ */ t(W, { weight: "Linear", size: 20, className: "text-slate-base shrink-0" }) : null, j = () => /* @__PURE__ */ r("colgroup", { children: [
57
+ l && /* @__PURE__ */ t("col", { style: { width: 48 } }),
58
+ m.map((e) => /* @__PURE__ */ t("col", { style: { width: Q(e.width) ?? "auto" } }, e.key))
59
+ ] });
60
+ return /* @__PURE__ */ t(
61
+ "div",
62
+ {
63
+ className: h(
64
+ "w-full overflow-x-auto pb-0.5",
65
+ "[&::-webkit-scrollbar]:h-1",
66
+ "[&::-webkit-scrollbar-track]:bg-transparent",
67
+ "[&::-webkit-scrollbar-thumb]:bg-slate-200",
68
+ "[&::-webkit-scrollbar-thumb]:rounded-full",
69
+ "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300",
70
+ B
71
+ ),
72
+ children: /* @__PURE__ */ r("div", { className: "inline-block min-w-full align-middle", children: [
73
+ /* @__PURE__ */ t("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-slate-100", children: /* @__PURE__ */ r("table", { className: "w-full table-fixed", children: [
74
+ j(),
75
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ r("tr", { children: [
76
+ l && /* @__PURE__ */ t("th", { className: h("w-12 px-4 py-3", N), children: /* @__PURE__ */ t("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ t(
77
+ T,
78
+ {
79
+ checked: V,
80
+ onChange: P,
81
+ variant: "yellow",
82
+ disabled: b || o.length === 0
83
+ }
84
+ ) }) }),
85
+ m.map((e) => /* @__PURE__ */ t(
86
+ "th",
87
+ {
88
+ onClick: () => L(e),
89
+ className: h(
90
+ "px-4 py-3 text-left text-sm font-medium text-slate-700 transition-colors",
91
+ "whitespace-nowrap overflow-hidden text-ellipsis",
92
+ e.align === "center" && "text-center",
93
+ e.align === "right" && "text-right",
94
+ e.sortable && "cursor-pointer hover:bg-slate-200",
95
+ N
96
+ ),
97
+ children: /* @__PURE__ */ r("div", { className: h("flex items-center gap-2 min-w-0", e.align === "right" && "justify-end"), children: [
98
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", title: e.title, children: e.title }),
99
+ q(e)
100
+ ] })
101
+ },
102
+ e.key
103
+ ))
104
+ ] }) })
105
+ ] }) }),
106
+ /* @__PURE__ */ t("div", { className: "rounded-xl border border-t-0 border-slate-200 bg-white overflow-hidden", children: /* @__PURE__ */ r("table", { className: "w-full table-fixed", children: [
107
+ j(),
108
+ /* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-200", children: b ? Array.from({ length: A }).map((e, s) => /* @__PURE__ */ r("tr", { children: [
109
+ l && /* @__PURE__ */ t("td", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ t(z, { height: 20, width: 20, variant: "rounded" }) }),
110
+ m.map((c) => /* @__PURE__ */ t("td", { className: "px-4 py-3", children: /* @__PURE__ */ t(z, { height: 30, variant: "rounded" }) }, c.key))
111
+ ] }, s)) : o.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: m.length + (l ? 1 : 0), className: "py-20", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center", children: [
112
+ /* @__PURE__ */ t("div", { className: "relative mb-4", children: /* @__PURE__ */ t(E, { weight: "Bold", size: 64, className: "animate-float text-slate-400" }) }),
113
+ /* @__PURE__ */ t("p", { className: "text-sm font-medium text-slate-400", children: M })
114
+ ] }) }) }) : o.map((e, s) => {
115
+ const c = e[f], g = l?.selectedRowKeys.includes(c), p = l?.getCheckboxProps?.(e)?.disabled;
116
+ return /* @__PURE__ */ r("tr", { className: "group transition-colors hover:bg-slate-50", children: [
117
+ l && /* @__PURE__ */ t("td", { className: h("w-12 px-4 py-3 align-top", w), children: /* @__PURE__ */ t("div", { className: "flex items-center justify-center pt-1", children: /* @__PURE__ */ t(
118
+ T,
119
+ {
120
+ checked: g,
121
+ disabled: p,
122
+ variant: "yellow",
123
+ onChange: (i) => F(e, i.target.checked)
124
+ }
125
+ ) }) }),
126
+ m.map((i) => {
127
+ const d = e[i.key], x = i.render ? i.render(d, e) : String(d ?? "-");
128
+ return /* @__PURE__ */ t(
129
+ "td",
130
+ {
131
+ className: h(
132
+ "align-top px-4 py-3 text-sm font-normal text-black",
133
+ "min-w-0 whitespace-normal",
134
+ i.align === "center" && "text-center",
135
+ i.align === "right" && "text-right",
136
+ w,
137
+ i.className
138
+ ),
139
+ children: /* @__PURE__ */ t(K, { title: typeof x == "string" ? x : void 0, children: x })
140
+ },
141
+ i.key
142
+ );
143
+ })
144
+ ] }, s);
145
+ }) })
146
+ ] }) })
147
+ ] })
148
+ }
149
+ );
150
+ }
151
+ export {
152
+ le as default
153
+ };
@@ -0,0 +1,7 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ function l({ children: t, title: a }) {
3
+ return /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("div", { className: "clamp-2 break-words", title: a ?? (typeof t == "string" ? t : void 0), children: t }) });
4
+ }
5
+ export {
6
+ l as default
7
+ };
@@ -0,0 +1,184 @@
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import { useRef as G, useEffect as Y, useMemo as z, useState as f, useCallback as g } from "react";
3
+ import { TransferVertical as q } from "@solar-icons/react";
4
+ import { useClickOutside as H, cn as b } from "../../lib/utils.js";
5
+ /* empty css */
6
+ import J from "../mciCheck/MciCheck.js";
7
+ function Z({
8
+ open: m,
9
+ onClose: w,
10
+ columns: s,
11
+ hidden: A,
12
+ onToggle: N,
13
+ onMove: y,
14
+ onMoveByKey: h,
15
+ minVisible: C = 5
16
+ }) {
17
+ const T = G(null), { handleClick: p } = H(T, w);
18
+ Y(() => {
19
+ if (m)
20
+ return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
21
+ }, [m, p]);
22
+ const x = z(() => new Set(A), [A]), I = z(() => {
23
+ let e = 0;
24
+ for (const t of s) x.has(t.key) || e++;
25
+ return e;
26
+ }, [s, x]), [v, S] = f(null), [O, k] = f(null), [F, E] = f(null), [u, D] = f("before"), L = g(
27
+ (e, t, r) => {
28
+ let a = r === "after" ? t + 1 : t;
29
+ return e < a && (a -= 1), a;
30
+ },
31
+ []
32
+ ), d = g(() => {
33
+ S(null), E(null), k(null), D("before");
34
+ }, []), R = g(
35
+ (e, t, r) => {
36
+ S(t), E(String(r)), k(null), D("before"), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(t));
37
+ const a = new Image();
38
+ a.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", e.dataTransfer.setDragImage(a, 0, 0);
39
+ },
40
+ []
41
+ ), Q = g(
42
+ (e, t) => {
43
+ e.preventDefault();
44
+ const r = v ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
45
+ if (!Number.isFinite(r) || r < 0) {
46
+ d();
47
+ return;
48
+ }
49
+ const a = s[r], c = s[t];
50
+ if (!a || !c) {
51
+ d();
52
+ return;
53
+ }
54
+ const l = L(r, t, u);
55
+ l !== r && (h ? h(a.key, c.key, u) : y(r, l)), d();
56
+ },
57
+ [s, L, v, u, y, h, d]
58
+ ), B = g(
59
+ (e, t) => {
60
+ t || N(e);
61
+ },
62
+ [N]
63
+ );
64
+ return m ? /* @__PURE__ */ i(
65
+ "div",
66
+ {
67
+ ref: T,
68
+ className: b(
69
+ "absolute right-0 top-full z-50 mt-2 w-[320px]",
70
+ "rounded-2xl p-4 bg-white",
71
+ "border border-slate-200"
72
+ ),
73
+ children: [
74
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-4", children: [
75
+ /* @__PURE__ */ n("h4", { className: "text-slate-600 text-large font-normal", children: "Settings" }),
76
+ /* @__PURE__ */ n(
77
+ "button",
78
+ {
79
+ type: "button",
80
+ onClick: w,
81
+ className: "rounded-lg px-2 py-1 text-slate-500 hover:bg-slate-100",
82
+ "aria-label": "Close",
83
+ children: "✕"
84
+ }
85
+ )
86
+ ] }),
87
+ /* @__PURE__ */ n("div", { className: "my-4 h-px bg-slate-100" }),
88
+ /* @__PURE__ */ i("p", { className: "mb-3 text-xs text-slate-500", children: [
89
+ "Active columns: ",
90
+ I,
91
+ "/",
92
+ s.length
93
+ ] }),
94
+ /* @__PURE__ */ n(
95
+ "div",
96
+ {
97
+ className: b(
98
+ "max-h-[275px] overflow-auto",
99
+ "[&::-webkit-scrollbar]:w-1.5",
100
+ "[&::-webkit-scrollbar-track]:bg-transparent",
101
+ "[&::-webkit-scrollbar-thumb]:bg-slate-200",
102
+ "[&::-webkit-scrollbar-thumb]:rounded-full",
103
+ "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
104
+ ),
105
+ children: s.map((e, t) => {
106
+ const r = !x.has(e.key), a = r && I <= C, c = O === t, l = F === e.key;
107
+ return /* @__PURE__ */ i("div", { className: "relative", children: [
108
+ c && !l && /* @__PURE__ */ n(
109
+ "div",
110
+ {
111
+ className: b(
112
+ "pointer-events-none absolute left-2 right-2 z-10 h-0.5 rounded-full bg-blue-300",
113
+ u === "before" ? "top-0" : "bottom-0"
114
+ )
115
+ }
116
+ ),
117
+ /* @__PURE__ */ i(
118
+ "div",
119
+ {
120
+ draggable: !0,
121
+ onDragStart: (o) => R(o, t, e.key),
122
+ onDragOver: (o) => {
123
+ if (v == null) return;
124
+ o.preventDefault(), o.dataTransfer.dropEffect = "move";
125
+ const P = o.currentTarget.getBoundingClientRect(), j = o.clientY - P.top > P.height / 2 ? "after" : "before";
126
+ O !== t && k(t), u !== j && D(j);
127
+ },
128
+ onDrop: (o) => Q(o, t),
129
+ onDragEnd: d,
130
+ className: b(
131
+ "group flex items-center py-2 px-1 gap-4",
132
+ "rounded-md box-border overflow-visible",
133
+ "transition-[background,transform] duration-150",
134
+ !l && !c && "hover:bg-slate-50",
135
+ c && !l && "bg-slate-50",
136
+ l && "bg-slate-50 opacity-100 scale-[0.99] cursor-grabbing"
137
+ ),
138
+ children: [
139
+ /* @__PURE__ */ n(
140
+ "button",
141
+ {
142
+ type: "button",
143
+ className: b(
144
+ "shrink-0 text-slate-400",
145
+ "cursor-grab active:cursor-grabbing",
146
+ "rounded-lg p-1 hover:bg-slate-100",
147
+ l && "cursor-grabbing"
148
+ ),
149
+ "aria-label": "Drag",
150
+ children: /* @__PURE__ */ n(q, { weight: "Linear", size: 20 })
151
+ }
152
+ ),
153
+ /* @__PURE__ */ n("div", { className: "shrink-0", children: /* @__PURE__ */ n(
154
+ J,
155
+ {
156
+ checked: r,
157
+ disabled: a,
158
+ onChange: () => B(e.key, a),
159
+ variant: "blue"
160
+ }
161
+ ) }),
162
+ /* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
163
+ /* @__PURE__ */ n("h4", { className: "truncate text-slate-700 text-base font-medium", title: e.title, children: e.title }),
164
+ a && /* @__PURE__ */ i("p", { className: "text-xs text-slate-400 mt-0.5", children: [
165
+ "Минимум ",
166
+ C,
167
+ " колонок"
168
+ ] })
169
+ ] })
170
+ ]
171
+ }
172
+ ),
173
+ t !== s.length - 1 && /* @__PURE__ */ n("div", { className: "mx-2 h-px bg-slate-100" })
174
+ ] }, e.key);
175
+ })
176
+ }
177
+ )
178
+ ]
179
+ }
180
+ ) : null;
181
+ }
182
+ export {
183
+ Z as default
184
+ };
@@ -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
+ };