@mci-ui/mci-ui 0.0.88 → 0.0.89

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 (29) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared/ui/MciModal/MciModal.js +30 -28
  3. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +45 -25
  4. package/dist/shared/ui/mciButton/MciButton.js +39 -31
  5. package/dist/shared/ui/mciCheck/MciCheck.js +86 -76
  6. package/dist/shared/ui/mciDrawer/MciDrawer.js +78 -59
  7. package/dist/shared/ui/mciInput/MciInput.js +39 -40
  8. package/dist/shared/ui/mciLoader/MciLoader.js +14 -14
  9. package/dist/shared/ui/mciPagination/MciPagination.js +28 -18
  10. package/dist/shared/ui/mciPicker/MciPicker.js +53 -53
  11. package/dist/shared/ui/mciSelect/MciSelect.js +42 -41
  12. package/dist/shared/ui/mciTable/MciTable.js +97 -90
  13. package/dist/shared/ui/mciTable/MciTableClamp2.js +4 -3
  14. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +100 -79
  15. package/dist/shared/ui/mciToggle/MciToggle.js +51 -43
  16. package/dist/shared/ui/mciUpload/MciUpload.js +129 -107
  17. package/dist/types/shared/types/mci-table.types.d.ts +2 -0
  18. package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -1
  19. package/dist/types/shared/types/ui/button.types.d.ts +1 -1
  20. package/dist/types/shared/types/ui/check.types.d.ts +1 -1
  21. package/dist/types/shared/types/ui/drawer.types.d.ts +1 -0
  22. package/dist/types/shared/types/ui/loader.types.d.ts +1 -1
  23. package/dist/types/shared/types/ui/pagination.types.d.ts +1 -1
  24. package/dist/types/shared/types/ui/toggle.types.d.ts +1 -1
  25. package/dist/types/shared/types/ui/upload.types.d.ts +1 -1
  26. package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
  27. package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
  28. package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
  29. package/package.json +1 -1
@@ -1,122 +1,142 @@
1
- import { jsxs as g, jsx as l } from "react/jsx-runtime";
2
- import { useRef as K, useEffect as _, useMemo as F, useState as p, useCallback as d } from "react";
3
- import { TransferVertical as q } from "@solar-icons/react";
4
- import { useClickOutside as H, cn as s } from "../../lib/utils.js";
1
+ import { jsxs as g, jsx as s } from "react/jsx-runtime";
2
+ import { useRef as K, useEffect as q, useMemo as Y, useState as p, useCallback as h } from "react";
3
+ import { TransferVertical as J } from "@solar-icons/react";
4
+ import { useClickOutside as U, cn as l } from "../../lib/utils.js";
5
5
  /* empty css */
6
- import J from "../mciCheck/MciCheck.js";
7
- const U = {
6
+ import V from "../mciCheck/MciCheck.js";
7
+ const W = {
8
8
  ru: {
9
9
  title: "Настройки",
10
10
  close: "Закрыть",
11
11
  activeColumns: "Активные колонки",
12
- minColumns: (c) => `Минимум ${c} колонок`,
12
+ minColumns: (u) => `Минимум ${u} колонок`,
13
13
  drag: "Перетащить"
14
14
  },
15
15
  uz: {
16
16
  title: "Sozlamalar",
17
17
  close: "Yopish",
18
18
  activeColumns: "Aktiv ustunlar",
19
- minColumns: (c) => `Kamida ${c} ta ustun`,
19
+ minColumns: (u) => `Kamida ${u} ta ustun`,
20
20
  drag: "Sudrash"
21
21
  }
22
+ }, X = {
23
+ blue: {
24
+ dropIndicator: "bg-blue-300",
25
+ darkDropIndicator: "bg-blue-500",
26
+ close: "hover:bg-blue-50 hover:text-blue-600 focus-visible:ring-2 focus-visible:ring-[rgba(21,93,252,0.25)]",
27
+ darkClose: "hover:bg-blue-500/20 hover:text-blue-400 focus-visible:ring-2 focus-visible:ring-[rgba(21,93,252,0.25)]"
28
+ },
29
+ yellow: {
30
+ dropIndicator: "bg-yellow-400",
31
+ darkDropIndicator: "bg-yellow-500",
32
+ close: "hover:bg-yellow-50 hover:text-yellow-600 focus-visible:ring-2 focus-visible:ring-yellow-200",
33
+ darkClose: "hover:bg-yellow-500/20 hover:text-yellow-300 focus-visible:ring-2 focus-visible:ring-yellow-300/40"
34
+ },
35
+ orange: {
36
+ dropIndicator: "bg-orange-400",
37
+ darkDropIndicator: "bg-orange-600",
38
+ close: "hover:bg-orange-50 hover:text-orange-600 focus-visible:ring-2 focus-visible:ring-[rgba(227,98,12,0.25)]",
39
+ darkClose: "hover:bg-orange-600/20 hover:text-orange-400 focus-visible:ring-2 focus-visible:ring-[rgba(227,98,12,0.25)]"
40
+ }
22
41
  };
23
- function te({
24
- open: c,
25
- onClose: C,
42
+ function ae({
43
+ open: u,
44
+ onClose: N,
26
45
  columns: i,
27
- hidden: y,
28
- onToggle: T,
29
- onMove: k,
46
+ hidden: k,
47
+ onToggle: I,
48
+ onMove: T,
30
49
  onMoveByKey: x,
31
50
  minVisible: S = 5,
32
- locale: Q = "ru",
33
- darkMode: r = !1
51
+ locale: _ = "ru",
52
+ darkMode: r = !1,
53
+ variant: E = "orange"
34
54
  }) {
35
- const I = K(null), { handleClick: v } = H(I, C), m = U[Q];
36
- _(() => {
37
- if (c)
38
- return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
39
- }, [c, v]);
40
- const w = F(() => new Set(y), [y]), O = F(() => {
55
+ const L = K(null), { handleClick: w } = U(L, N), f = W[_], v = X[E];
56
+ q(() => {
57
+ if (u)
58
+ return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
59
+ }, [u, w]);
60
+ const D = Y(() => new Set(k), [k]), O = Y(() => {
41
61
  let e = 0;
42
- for (const t of i) w.has(t.key) || e++;
62
+ for (const t of i) D.has(t.key) || e++;
43
63
  return e;
44
- }, [i, w]), [A, E] = p(null), [L, N] = p(null), [Y, z] = p(null), [f, D] = p("before"), P = d(
64
+ }, [i, D]), [y, P] = p(null), [z, A] = p(null), [$, R] = p(null), [m, C] = p("before"), j = h(
45
65
  (e, t, a) => {
46
66
  let n = a === "after" ? t + 1 : t;
47
67
  return e < n && (n -= 1), n;
48
68
  },
49
69
  []
50
- ), h = d(() => {
51
- E(null), z(null), N(null), D("before");
52
- }, []), $ = d(
70
+ ), d = h(() => {
71
+ P(null), R(null), A(null), C("before");
72
+ }, []), B = h(
53
73
  (e, t, a) => {
54
- E(t), z(String(a)), N(null), D("before"), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(t));
74
+ P(t), R(String(a)), A(null), C("before"), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(t));
55
75
  const n = new Image();
56
76
  n.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", e.dataTransfer.setDragImage(n, 0, 0);
57
77
  },
58
78
  []
59
- ), B = d(
79
+ ), G = h(
60
80
  (e, t) => {
61
81
  e.preventDefault();
62
- const a = A ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
82
+ const a = y ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
63
83
  if (!Number.isFinite(a) || a < 0) {
64
- h();
84
+ d();
65
85
  return;
66
86
  }
67
87
  const n = i[a], b = i[t];
68
88
  if (!n || !b) {
69
- h();
89
+ d();
70
90
  return;
71
91
  }
72
- const o = P(a, t, f);
73
- o !== a && (x ? x(n.key, b.key, f) : k(a, o)), h();
92
+ const o = j(a, t, m);
93
+ o !== a && (x ? x(n.key, b.key, m) : T(a, o)), d();
74
94
  },
75
- [i, P, A, f, k, x, h]
76
- ), G = d(
95
+ [i, j, y, m, T, x, d]
96
+ ), H = h(
77
97
  (e, t) => {
78
- t || T(e);
98
+ t || I(e);
79
99
  },
80
- [T]
100
+ [I]
81
101
  );
82
- return c ? /* @__PURE__ */ g(
102
+ return u ? /* @__PURE__ */ g(
83
103
  "div",
84
104
  {
85
- ref: I,
86
- className: s(
105
+ ref: L,
106
+ className: l(
87
107
  "absolute right-0 top-full z-50 mt-2 w-[320px]",
88
108
  "rounded-2xl p-4",
89
109
  r ? "border border-neutral-200 bg-[#22242A] shadow-xl" : "border border-slate-200 bg-white"
90
110
  ),
91
111
  children: [
92
112
  /* @__PURE__ */ g("div", { className: "flex items-center justify-between gap-4", children: [
93
- /* @__PURE__ */ l("h4", { className: s("text-large font-normal", r ? "text-neutral-50" : "text-slate-600"), children: m.title }),
94
- /* @__PURE__ */ l(
113
+ /* @__PURE__ */ s("h4", { className: l("text-large font-normal", r ? "text-neutral-50" : "text-slate-600"), children: f.title }),
114
+ /* @__PURE__ */ s(
95
115
  "button",
96
116
  {
97
117
  type: "button",
98
- onClick: C,
99
- className: s(
100
- "rounded-lg px-2 py-1",
101
- r ? "text-neutral-100 hover:bg-neutral-300" : "text-slate-500 hover:bg-slate-100"
118
+ onClick: N,
119
+ className: l(
120
+ "cursor-pointer rounded-lg px-2 py-1",
121
+ r ? l("text-neutral-100 hover:bg-neutral-300", v.darkClose) : l("text-slate-500 hover:bg-slate-100", v.close)
102
122
  ),
103
- "aria-label": m.close,
123
+ "aria-label": f.close,
104
124
  children: "✕"
105
125
  }
106
126
  )
107
127
  ] }),
108
- /* @__PURE__ */ l("div", { className: s("my-4 h-px", r ? "bg-neutral-200" : "bg-slate-100") }),
109
- /* @__PURE__ */ g("p", { className: s("mb-3 text-xs", r ? "text-neutral-100" : "text-slate-500"), children: [
110
- m.activeColumns,
128
+ /* @__PURE__ */ s("div", { className: l("my-4 h-px", r ? "bg-neutral-200" : "bg-slate-100") }),
129
+ /* @__PURE__ */ g("p", { className: l("mb-3 text-xs", r ? "text-neutral-100" : "text-slate-500"), children: [
130
+ f.activeColumns,
111
131
  ": ",
112
132
  O,
113
133
  "/",
114
134
  i.length
115
135
  ] }),
116
- /* @__PURE__ */ l(
136
+ /* @__PURE__ */ s(
117
137
  "div",
118
138
  {
119
- className: s(
139
+ className: l(
120
140
  "max-h-[275px] overflow-auto",
121
141
  "[&::-webkit-scrollbar]:w-1.5",
122
142
  "[&::-webkit-scrollbar-track]:bg-transparent",
@@ -125,15 +145,15 @@ function te({
125
145
  r ? "hover:[&::-webkit-scrollbar-thumb]:bg-neutral-100" : "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
126
146
  ),
127
147
  children: i.map((e, t) => {
128
- const a = !w.has(e.key), n = a && O <= S, b = L === t, o = Y === e.key;
148
+ const a = !D.has(e.key), n = a && O <= S, b = z === t, o = $ === e.key;
129
149
  return /* @__PURE__ */ g("div", { className: "relative", children: [
130
- b && !o && /* @__PURE__ */ l(
150
+ b && !o && /* @__PURE__ */ s(
131
151
  "div",
132
152
  {
133
- className: s(
153
+ className: l(
134
154
  "pointer-events-none absolute left-2 right-2 z-10 h-0.5 rounded-full",
135
- r ? "bg-blue-500" : "bg-blue-300",
136
- f === "before" ? "top-0" : "bottom-0"
155
+ r ? v.darkDropIndicator : v.dropIndicator,
156
+ m === "before" ? "top-0" : "bottom-0"
137
157
  )
138
158
  }
139
159
  ),
@@ -141,57 +161,58 @@ function te({
141
161
  "div",
142
162
  {
143
163
  draggable: !0,
144
- onDragStart: (u) => $(u, t, e.key),
145
- onDragOver: (u) => {
146
- if (A == null) return;
147
- u.preventDefault(), u.dataTransfer.dropEffect = "move";
148
- const R = u.currentTarget.getBoundingClientRect(), j = u.clientY - R.top > R.height / 2 ? "after" : "before";
149
- L !== t && N(t), f !== j && D(j);
164
+ onDragStart: (c) => B(c, t, e.key),
165
+ onDragOver: (c) => {
166
+ if (y == null) return;
167
+ c.preventDefault(), c.dataTransfer.dropEffect = "move";
168
+ const F = c.currentTarget.getBoundingClientRect(), Q = c.clientY - F.top > F.height / 2 ? "after" : "before";
169
+ z !== t && A(t), m !== Q && C(Q);
150
170
  },
151
- onDrop: (u) => B(u, t),
152
- onDragEnd: h,
153
- className: s(
171
+ onDrop: (c) => G(c, t),
172
+ onDragEnd: d,
173
+ className: l(
154
174
  "group flex items-center py-2 px-1 gap-4",
155
175
  "rounded-md box-border overflow-visible",
156
176
  "transition-[background,transform] duration-150",
177
+ !o && "cursor-grab",
157
178
  !o && !b && (r ? "hover:bg-neutral-300/60" : "hover:bg-slate-50"),
158
179
  b && !o && (r ? "bg-neutral-300/60" : "bg-slate-50"),
159
180
  o && (r ? "bg-neutral-300 opacity-100 scale-[0.99] cursor-grabbing" : "bg-slate-50 opacity-100 scale-[0.99] cursor-grabbing")
160
181
  ),
161
182
  children: [
162
- /* @__PURE__ */ l(
183
+ /* @__PURE__ */ s(
163
184
  "button",
164
185
  {
165
186
  type: "button",
166
- className: s(
187
+ className: l(
167
188
  "shrink-0",
168
189
  r ? "text-neutral-100" : "text-slate-400",
169
190
  "cursor-grab active:cursor-grabbing",
170
191
  r ? "rounded-lg p-1 hover:bg-neutral-200" : "rounded-lg p-1 hover:bg-slate-100",
171
192
  o && "cursor-grabbing"
172
193
  ),
173
- "aria-label": m.drag,
174
- children: /* @__PURE__ */ l(q, { weight: "Linear", size: 20 })
194
+ "aria-label": f.drag,
195
+ children: /* @__PURE__ */ s(J, { weight: "Linear", size: 20 })
175
196
  }
176
197
  ),
177
- /* @__PURE__ */ l("div", { className: "shrink-0", children: /* @__PURE__ */ l(
178
- J,
198
+ /* @__PURE__ */ s("div", { className: "shrink-0", children: /* @__PURE__ */ s(
199
+ V,
179
200
  {
180
201
  checked: a,
181
202
  disabled: n,
182
- onChange: () => G(e.key, n),
183
- variant: "blue",
203
+ onChange: () => H(e.key, n),
204
+ variant: E,
184
205
  darkMode: r
185
206
  }
186
207
  ) }),
187
208
  /* @__PURE__ */ g("div", { className: "min-w-0 flex-1", children: [
188
- /* @__PURE__ */ l("h4", { className: s("truncate text-base font-medium", r ? "text-neutral-50" : "text-slate-700"), title: e.title, children: e.title }),
189
- n && /* @__PURE__ */ l("p", { className: s("mt-0.5 text-xs", r ? "text-neutral-100" : "text-slate-400"), children: m.minColumns(S) })
209
+ /* @__PURE__ */ s("h4", { className: l("truncate text-base font-medium", r ? "text-neutral-50" : "text-slate-700"), title: e.title, children: e.title }),
210
+ n && /* @__PURE__ */ s("p", { className: l("mt-0.5 text-xs", r ? "text-neutral-100" : "text-slate-400"), children: f.minColumns(S) })
190
211
  ] })
191
212
  ]
192
213
  }
193
214
  ),
194
- t !== i.length - 1 && /* @__PURE__ */ l("div", { className: s("mx-2 h-px", r ? "bg-neutral-200" : "bg-slate-100") })
215
+ t !== i.length - 1 && /* @__PURE__ */ s("div", { className: l("mx-2 h-px", r ? "bg-neutral-200" : "bg-slate-100") })
195
216
  ] }, e.key);
196
217
  })
197
218
  }
@@ -201,5 +222,5 @@ function te({
201
222
  ) : null;
202
223
  }
203
224
  export {
204
- te as default
225
+ ae as default
205
226
  };
@@ -1,5 +1,5 @@
1
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
- import { cn as n } from "../../lib/utils.js";
1
+ import { jsxs as u, jsx as a } from "react/jsx-runtime";
2
+ import { cn as r } from "../../lib/utils.js";
3
3
  const b = {
4
4
  blue: {
5
5
  active: "bg-blue-600",
@@ -14,79 +14,87 @@ const b = {
14
14
  focus: "focus:ring-2 focus:ring-yellow-200",
15
15
  darkActive: "bg-yellow-500",
16
16
  darkHover: "hover:bg-yellow-500"
17
+ },
18
+ orange: {
19
+ active: "bg-orange-600",
20
+ hover: "hover:bg-orange-600",
21
+ focus: "focus:ring-2 focus:ring-[rgba(227,98,12,0.25)]",
22
+ darkActive: "bg-orange-600",
23
+ darkHover: "hover:bg-orange-600"
17
24
  }
18
25
  };
19
26
  function m({
20
- checked: l = !1,
21
- onChange: i,
22
- disabled: t = !1,
23
- variant: s = "yellow",
24
- darkMode: e = !1,
25
- label: a,
26
- supportText: u,
27
- className: g,
28
- ...f
27
+ checked: o = !1,
28
+ onChange: c,
29
+ disabled: e = !1,
30
+ variant: n = "orange",
31
+ darkMode: t = !1,
32
+ label: s,
33
+ supportText: g,
34
+ className: i,
35
+ ...v
29
36
  }) {
30
- const v = () => {
31
- t || i?.(!l);
32
- }, o = b[s];
33
- return /* @__PURE__ */ c(
37
+ const f = () => {
38
+ e || c?.(!o);
39
+ }, l = b[n];
40
+ return /* @__PURE__ */ u(
34
41
  "div",
35
42
  {
36
- className: n(
43
+ className: r(
37
44
  "flex items-start gap-3 select-none",
38
- g
45
+ i
39
46
  ),
40
47
  children: [
41
- /* @__PURE__ */ r(
48
+ /* @__PURE__ */ a(
42
49
  "button",
43
50
  {
44
- ...f,
51
+ ...v,
45
52
  type: "button",
46
- disabled: t,
47
- onClick: v,
48
- className: n(
53
+ disabled: e,
54
+ onClick: f,
55
+ className: r(
49
56
  "relative h-6 w-11 rounded-xl transition-all duration-300 outline-none",
50
- t ? "cursor-not-allowed" : "cursor-pointer",
51
- l ? e ? o.darkActive : o.active : e ? "bg-neutral-200" : "bg-slate-200",
52
- !t && l && (e ? o.darkHover : o.hover),
53
- !t && !l && (e ? "hover:bg-neutral-100" : "hover:bg-slate-300"),
54
- !t && o.focus,
55
- e && !t && s === "blue" && "focus-visible:shadow-[0_0_0_2px_var(--opacity-25,rgba(21,93,252,0.25))]",
56
- e && !t && s === "yellow" && "focus-visible:ring-2 focus-visible:ring-yellow-300/40",
57
- t && (e ? "bg-neutral-200/60" : "bg-slate-100")
57
+ e ? "cursor-not-allowed" : "cursor-pointer",
58
+ o ? t ? l.darkActive : l.active : t ? "bg-neutral-200" : "bg-slate-200",
59
+ !e && o && (t ? l.darkHover : l.hover),
60
+ !e && !o && (t ? "hover:bg-neutral-100" : "hover:bg-slate-300"),
61
+ !e && l.focus,
62
+ t && !e && n === "blue" && "focus-visible:shadow-[0_0_0_2px_var(--opacity-25,rgba(21,93,252,0.25))]",
63
+ t && !e && n === "yellow" && "focus-visible:ring-2 focus-visible:ring-yellow-300/40",
64
+ t && !e && n === "orange" && "focus-visible:ring-2 focus-visible:ring-[rgba(227,98,12,0.25)]",
65
+ e && (t ? "bg-neutral-200/60" : "bg-slate-100")
58
66
  ),
59
- children: /* @__PURE__ */ r(
67
+ children: /* @__PURE__ */ a(
60
68
  "span",
61
69
  {
62
- className: n(
70
+ className: r(
63
71
  "absolute top-1/2 left-0.5 h-5 w-5 -translate-y-1/2 rounded-full transition-all duration-300",
64
- e ? "bg-black" : "bg-white",
65
- l && "translate-x-5"
72
+ t ? "bg-black" : "bg-white",
73
+ o && "translate-x-5"
66
74
  )
67
75
  }
68
76
  )
69
77
  }
70
78
  ),
71
- (a || u) && /* @__PURE__ */ c("div", { className: "flex flex-col leading-tight", children: [
72
- a && /* @__PURE__ */ r(
79
+ (s || g) && /* @__PURE__ */ u("div", { className: "flex flex-col leading-tight", children: [
80
+ s && /* @__PURE__ */ a(
73
81
  "span",
74
82
  {
75
- className: n(
83
+ className: r(
76
84
  "text-base font-medium",
77
- e ? t ? "text-neutral-50/50" : "text-neutral-50" : t ? "text-slate-400" : "text-black"
85
+ t ? e ? "text-neutral-50/50" : "text-neutral-50" : e ? "text-slate-400" : "text-black"
78
86
  ),
79
- children: a
87
+ children: s
80
88
  }
81
89
  ),
82
- u && /* @__PURE__ */ r(
90
+ g && /* @__PURE__ */ a(
83
91
  "span",
84
92
  {
85
- className: n(
93
+ className: r(
86
94
  "text-sm font-normal",
87
- e ? t ? "text-neutral-100/50" : "text-neutral-100" : t ? "text-slate-400" : "text-slate-500"
95
+ t ? e ? "text-neutral-100/50" : "text-neutral-100" : e ? "text-slate-400" : "text-slate-500"
88
96
  ),
89
- children: u
97
+ children: g
90
98
  }
91
99
  )
92
100
  ] })