@mci-ui/mci-ui 0.0.85 → 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 +125 -104
  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 +2 -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 +4 -2
  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,153 +1,192 @@
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";
1
+ import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
+ import { ConfoundedSquare as I, SortVertical as W, SortFromTopToBottom as _, SortFromBottomToTop as H } from "@solar-icons/react";
3
+ import { useState as J, useMemo as x, useEffect as K, useCallback as O } from "react";
4
+ import { cn as a } from "../../lib/utils.js";
5
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
6
+ import z from "../mciCheck/MciCheck.js";
7
+ import A from "../mciSkeleton/MciSkeleton.js";
8
+ import Q from "./MciTableClamp2.js";
9
+ import { sortRows as U, normalizeColWidth as X } from "./mci-table.utils.js";
10
+ function re({
11
+ columns: b,
12
+ data: v = [],
13
+ loading: p = !1,
14
+ skeletonRows: B = 5,
15
+ noDataText: D = "",
16
+ sort: n,
17
+ onSortChange: N,
18
+ className: L,
19
+ headerClassName: w,
20
+ bodyClassName: C,
21
+ darkMode: r = !1,
22
+ rowKey: u = "id",
23
+ rowSelection: s
23
24
  }) {
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(
25
+ const [P, R] = J(null), d = n ?? P, g = x(() => Array.isArray(v) ? v : [], [v]), j = x(() => U(g, d, !!n), [g, d, n]);
26
+ K(() => {
27
+ n !== void 0 && R(null);
28
+ }, [n]);
29
+ const m = x(
30
+ () => p ? [] : n ? g : j,
31
+ [p, n, g, j]
32
+ ), F = O(
32
33
  (e) => {
33
34
  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);
35
+ let l = null;
36
+ d?.key !== e.key ? l = { key: e.key, direction: "asc" } : d.direction === "asc" && (l = { key: e.key, direction: "desc" }), n !== void 0 ? N?.(l) : R(l);
36
37
  },
37
- [n, a, v]
38
- ), P = (e) => {
39
- if (!l) return;
40
- const { onChange: s, getCheckboxProps: c } = l;
38
+ [d, n, N]
39
+ ), V = (e) => {
40
+ if (!s) return;
41
+ const { onChange: l, getCheckboxProps: o } = s;
41
42
  if (e.target.checked) {
42
- const i = o.filter((d) => !c?.(d)?.disabled).map((d) => d[f]);
43
- s(i);
43
+ const i = m.filter((h) => !o?.(h)?.disabled).map((h) => h[u]);
44
+ l(i);
44
45
  } 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);
46
+ l([]);
47
+ }, q = (e, l) => {
48
+ if (!s) return;
49
+ const { selectedRowKeys: o, onChange: y } = s, f = e[u], i = l ? [...o, f] : o.filter((h) => h !== f);
50
+ y(i);
51
+ }, E = x(() => {
52
+ if (!s || m.length === 0) return !1;
53
+ const e = m.filter((l) => !s.getCheckboxProps?.(l)?.disabled);
53
54
  return e.length === 0 ? !1 : e.every(
54
- (s) => l.selectedRowKeys.includes(s[f])
55
+ (l) => s.selectedRowKeys.includes(l[u])
55
56
  );
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))
57
+ }, [s, m, u]), G = (e) => {
58
+ const l = a(r ? "text-neutral-100" : "text-slate-base", "shrink-0");
59
+ return e.sortable ? !d || d.key !== e.key ? /* @__PURE__ */ t(W, { weight: "Linear", size: 20, className: l }) : d.direction === "asc" ? /* @__PURE__ */ t(_, { weight: "Linear", size: 20, className: l }) : /* @__PURE__ */ t(H, { weight: "Linear", size: 20, className: l }) : null;
60
+ }, T = () => /* @__PURE__ */ c("colgroup", { children: [
61
+ s && /* @__PURE__ */ t("col", { style: { width: 48 } }),
62
+ b.map((e) => /* @__PURE__ */ t("col", { style: { width: X(e.width) ?? "auto" } }, e.key))
59
63
  ] });
60
64
  return /* @__PURE__ */ t(
61
65
  "div",
62
66
  {
63
- className: h(
67
+ className: a(
64
68
  "w-full overflow-x-auto pb-0.5",
65
69
  "[&::-webkit-scrollbar]:h-1",
66
70
  "[&::-webkit-scrollbar-track]:bg-transparent",
67
- "[&::-webkit-scrollbar-thumb]:bg-slate-200",
71
+ r ? "[&::-webkit-scrollbar-thumb]:bg-neutral-200" : "[&::-webkit-scrollbar-thumb]:bg-slate-200",
68
72
  "[&::-webkit-scrollbar-thumb]:rounded-full",
69
- "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300",
70
- B
73
+ r ? "hover:[&::-webkit-scrollbar-thumb]:bg-neutral-100" : "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300",
74
+ L
71
75
  ),
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",
76
+ children: /* @__PURE__ */ c("div", { className: "inline-block min-w-full align-middle", children: [
77
+ /* @__PURE__ */ t(
78
+ "div",
79
+ {
80
+ className: a(
81
+ "overflow-hidden rounded-xl border",
82
+ r ? "border-neutral-200 bg-neutral-300" : "border-slate-200 bg-slate-100"
83
+ ),
84
+ children: /* @__PURE__ */ c("table", { className: "w-full table-fixed", children: [
85
+ T(),
86
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { children: [
87
+ s && /* @__PURE__ */ t("th", { className: a("w-12 px-4 py-3", w), children: /* @__PURE__ */ t("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ t(
88
+ z,
130
89
  {
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
90
+ checked: E,
91
+ onChange: V,
92
+ variant: "yellow",
93
+ darkMode: r,
94
+ disabled: p || m.length === 0
95
+ }
96
+ ) }) }),
97
+ b.map((e) => /* @__PURE__ */ t(
98
+ "th",
99
+ {
100
+ onClick: () => F(e),
101
+ className: a(
102
+ "px-4 py-3 text-left text-sm font-medium transition-colors",
103
+ r ? "text-neutral-50" : "text-slate-700",
104
+ "whitespace-nowrap overflow-hidden text-ellipsis",
105
+ e.align === "center" && "text-center",
106
+ e.align === "right" && "text-right",
107
+ e.sortable && (r ? "cursor-pointer hover:bg-neutral-200" : "cursor-pointer hover:bg-slate-200"),
108
+ w
138
109
  ),
139
- children: /* @__PURE__ */ t(K, { title: typeof x == "string" ? x : void 0, children: x })
110
+ children: /* @__PURE__ */ c(
111
+ "div",
112
+ {
113
+ className: a("flex items-center gap-2 min-w-0", e.align === "right" && "justify-end"),
114
+ children: [
115
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", title: e.title, children: e.title }),
116
+ G(e)
117
+ ]
118
+ }
119
+ )
140
120
  },
141
- i.key
142
- );
143
- })
144
- ] }, s);
145
- }) })
146
- ] }) })
121
+ e.key
122
+ ))
123
+ ] }) })
124
+ ] })
125
+ }
126
+ ),
127
+ /* @__PURE__ */ t(
128
+ "div",
129
+ {
130
+ className: a(
131
+ "overflow-hidden rounded-xl border border-t-0",
132
+ r ? "border-neutral-200 bg-transparent" : "border-slate-200 bg-white"
133
+ ),
134
+ children: /* @__PURE__ */ c("table", { className: "w-full table-fixed", children: [
135
+ T(),
136
+ /* @__PURE__ */ t("tbody", { className: a("divide-y", r ? "divide-neutral-200" : "divide-slate-200"), children: p ? Array.from({ length: B }).map((e, l) => /* @__PURE__ */ c("tr", { children: [
137
+ s && /* @__PURE__ */ t("td", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ t(A, { height: 20, width: 20, variant: "rounded" }) }),
138
+ b.map((o) => /* @__PURE__ */ t("td", { className: "px-4 py-3", children: /* @__PURE__ */ t(A, { height: 30, variant: "rounded" }) }, o.key))
139
+ ] }, l)) : m.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: b.length + (s ? 1 : 0), className: "py-20", children: /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center", children: [
140
+ /* @__PURE__ */ t("div", { className: "relative mb-4", children: /* @__PURE__ */ t(
141
+ I,
142
+ {
143
+ weight: "Bold",
144
+ size: 64,
145
+ className: a("animate-float", r ? "text-neutral-100" : "text-slate-400")
146
+ }
147
+ ) }),
148
+ /* @__PURE__ */ t("p", { className: a("text-sm font-medium", r ? "text-neutral-100" : "text-slate-400"), children: D })
149
+ ] }) }) }) : m.map((e, l) => {
150
+ const o = e[u], y = s?.selectedRowKeys.includes(o), f = s?.getCheckboxProps?.(e)?.disabled;
151
+ return /* @__PURE__ */ c("tr", { className: a("group transition-colors", r ? "hover:bg-neutral-100/35" : "hover:bg-slate-50"), children: [
152
+ s && /* @__PURE__ */ t("td", { className: a("w-12 px-4 py-3 align-top", C), children: /* @__PURE__ */ t("div", { className: "flex items-center justify-center pt-1", children: /* @__PURE__ */ t(
153
+ z,
154
+ {
155
+ checked: y,
156
+ disabled: f,
157
+ variant: "yellow",
158
+ darkMode: r,
159
+ onChange: (i) => q(e, i.target.checked)
160
+ }
161
+ ) }) }),
162
+ b.map((i) => {
163
+ const h = e[i.key], k = i.render ? i.render(h, e) : String(h ?? "-");
164
+ return /* @__PURE__ */ t(
165
+ "td",
166
+ {
167
+ className: a(
168
+ "align-top px-4 py-3 text-sm font-normal",
169
+ r ? "text-neutral-50" : "text-black",
170
+ "min-w-0 whitespace-normal",
171
+ i.align === "center" && "text-center",
172
+ i.align === "right" && "text-right",
173
+ C,
174
+ i.className
175
+ ),
176
+ children: /* @__PURE__ */ t(Q, { title: typeof k == "string" ? k : void 0, children: k })
177
+ },
178
+ i.key
179
+ );
180
+ })
181
+ ] }, l);
182
+ }) })
183
+ ] })
184
+ }
185
+ )
147
186
  ] })
148
187
  }
149
188
  );
150
189
  }
151
190
  export {
152
- le as default
191
+ re as default
153
192
  };
@@ -1,176 +1,197 @@
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";
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
3
  import { TransferVertical as q } from "@solar-icons/react";
4
- import { useClickOutside as H, cn as b } from "../../lib/utils.js";
4
+ import { useClickOutside as H, cn as s } from "../../lib/utils.js";
5
5
  /* empty css */
6
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
7
+ const U = {
8
+ ru: {
9
+ title: "Настройки",
10
+ close: "Закрыть",
11
+ activeColumns: "Активные колонки",
12
+ minColumns: (c) => `Минимум ${c} колонок`,
13
+ drag: "Перетащить"
14
+ },
15
+ uz: {
16
+ title: "Sozlamalar",
17
+ close: "Yopish",
18
+ activeColumns: "Aktiv ustunlar",
19
+ minColumns: (c) => `Kamida ${c} ta ustun`,
20
+ drag: "Sudrash"
21
+ }
22
+ };
23
+ function te({
24
+ open: c,
25
+ onClose: C,
26
+ columns: i,
27
+ hidden: y,
28
+ onToggle: T,
29
+ onMove: k,
30
+ onMoveByKey: x,
31
+ minVisible: S = 5,
32
+ locale: Q = "ru",
33
+ darkMode: r = !1
16
34
  }) {
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(() => {
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(() => {
23
41
  let e = 0;
24
- for (const t of s) x.has(t.key) || e++;
42
+ for (const t of i) w.has(t.key) || e++;
25
43
  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;
44
+ }, [i, w]), [A, E] = p(null), [L, N] = p(null), [Y, z] = p(null), [f, D] = p("before"), P = d(
45
+ (e, t, a) => {
46
+ let n = a === "after" ? t + 1 : t;
47
+ return e < n && (n -= 1), n;
30
48
  },
31
49
  []
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);
50
+ ), h = d(() => {
51
+ E(null), z(null), N(null), D("before");
52
+ }, []), $ = d(
53
+ (e, t, a) => {
54
+ E(t), z(String(a)), N(null), D("before"), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(t));
55
+ const n = new Image();
56
+ n.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", e.dataTransfer.setDragImage(n, 0, 0);
39
57
  },
40
58
  []
41
- ), Q = g(
59
+ ), B = d(
42
60
  (e, t) => {
43
61
  e.preventDefault();
44
- const r = v ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
45
- if (!Number.isFinite(r) || r < 0) {
46
- d();
62
+ const a = A ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
63
+ if (!Number.isFinite(a) || a < 0) {
64
+ h();
47
65
  return;
48
66
  }
49
- const a = s[r], c = s[t];
50
- if (!a || !c) {
51
- d();
67
+ const n = i[a], b = i[t];
68
+ if (!n || !b) {
69
+ h();
52
70
  return;
53
71
  }
54
- const l = L(r, t, u);
55
- l !== r && (h ? h(a.key, c.key, u) : y(r, l)), d();
72
+ const o = P(a, t, f);
73
+ o !== a && (x ? x(n.key, b.key, f) : k(a, o)), h();
56
74
  },
57
- [s, L, v, u, y, h, d]
58
- ), B = g(
75
+ [i, P, A, f, k, x, h]
76
+ ), G = d(
59
77
  (e, t) => {
60
- t || N(e);
78
+ t || T(e);
61
79
  },
62
- [N]
80
+ [T]
63
81
  );
64
- return m ? /* @__PURE__ */ i(
82
+ return c ? /* @__PURE__ */ g(
65
83
  "div",
66
84
  {
67
- ref: T,
68
- className: b(
85
+ ref: I,
86
+ className: s(
69
87
  "absolute right-0 top-full z-50 mt-2 w-[320px]",
70
- "rounded-2xl p-4 bg-white",
71
- "border border-slate-200"
88
+ "rounded-2xl p-4",
89
+ r ? "border border-neutral-200 bg-[#22242A] shadow-xl" : "border border-slate-200 bg-white"
72
90
  ),
73
91
  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(
92
+ /* @__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(
77
95
  "button",
78
96
  {
79
97
  type: "button",
80
- onClick: w,
81
- className: "rounded-lg px-2 py-1 text-slate-500 hover:bg-slate-100",
82
- "aria-label": "Close",
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"
102
+ ),
103
+ "aria-label": m.close,
83
104
  children: "✕"
84
105
  }
85
106
  )
86
107
  ] }),
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,
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,
111
+ ": ",
112
+ O,
91
113
  "/",
92
- s.length
114
+ i.length
93
115
  ] }),
94
- /* @__PURE__ */ n(
116
+ /* @__PURE__ */ l(
95
117
  "div",
96
118
  {
97
- className: b(
119
+ className: s(
98
120
  "max-h-[275px] overflow-auto",
99
121
  "[&::-webkit-scrollbar]:w-1.5",
100
122
  "[&::-webkit-scrollbar-track]:bg-transparent",
101
- "[&::-webkit-scrollbar-thumb]:bg-slate-200",
123
+ r ? "[&::-webkit-scrollbar-thumb]:bg-neutral-200" : "[&::-webkit-scrollbar-thumb]:bg-slate-200",
102
124
  "[&::-webkit-scrollbar-thumb]:rounded-full",
103
- "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
125
+ r ? "hover:[&::-webkit-scrollbar-thumb]:bg-neutral-100" : "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
104
126
  ),
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(
127
+ children: i.map((e, t) => {
128
+ const a = !w.has(e.key), n = a && O <= S, b = L === t, o = Y === e.key;
129
+ return /* @__PURE__ */ g("div", { className: "relative", children: [
130
+ b && !o && /* @__PURE__ */ l(
109
131
  "div",
110
132
  {
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"
133
+ className: s(
134
+ "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"
114
137
  )
115
138
  }
116
139
  ),
117
- /* @__PURE__ */ i(
140
+ /* @__PURE__ */ g(
118
141
  "div",
119
142
  {
120
143
  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);
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);
127
150
  },
128
- onDrop: (o) => Q(o, t),
129
- onDragEnd: d,
130
- className: b(
151
+ onDrop: (u) => B(u, t),
152
+ onDragEnd: h,
153
+ className: s(
131
154
  "group flex items-center py-2 px-1 gap-4",
132
155
  "rounded-md box-border overflow-visible",
133
156
  "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"
157
+ !o && !b && (r ? "hover:bg-neutral-300/60" : "hover:bg-slate-50"),
158
+ b && !o && (r ? "bg-neutral-300/60" : "bg-slate-50"),
159
+ o && (r ? "bg-neutral-300 opacity-100 scale-[0.99] cursor-grabbing" : "bg-slate-50 opacity-100 scale-[0.99] cursor-grabbing")
137
160
  ),
138
161
  children: [
139
- /* @__PURE__ */ n(
162
+ /* @__PURE__ */ l(
140
163
  "button",
141
164
  {
142
165
  type: "button",
143
- className: b(
144
- "shrink-0 text-slate-400",
166
+ className: s(
167
+ "shrink-0",
168
+ r ? "text-neutral-100" : "text-slate-400",
145
169
  "cursor-grab active:cursor-grabbing",
146
- "rounded-lg p-1 hover:bg-slate-100",
147
- l && "cursor-grabbing"
170
+ r ? "rounded-lg p-1 hover:bg-neutral-200" : "rounded-lg p-1 hover:bg-slate-100",
171
+ o && "cursor-grabbing"
148
172
  ),
149
- "aria-label": "Drag",
150
- children: /* @__PURE__ */ n(q, { weight: "Linear", size: 20 })
173
+ "aria-label": m.drag,
174
+ children: /* @__PURE__ */ l(q, { weight: "Linear", size: 20 })
151
175
  }
152
176
  ),
153
- /* @__PURE__ */ n("div", { className: "shrink-0", children: /* @__PURE__ */ n(
177
+ /* @__PURE__ */ l("div", { className: "shrink-0", children: /* @__PURE__ */ l(
154
178
  J,
155
179
  {
156
- checked: r,
157
- disabled: a,
158
- onChange: () => B(e.key, a),
159
- variant: "blue"
180
+ checked: a,
181
+ disabled: n,
182
+ onChange: () => G(e.key, n),
183
+ variant: "blue",
184
+ darkMode: r
160
185
  }
161
186
  ) }),
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
- ] })
187
+ /* @__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) })
169
190
  ] })
170
191
  ]
171
192
  }
172
193
  ),
173
- t !== s.length - 1 && /* @__PURE__ */ n("div", { className: "mx-2 h-px bg-slate-100" })
194
+ t !== i.length - 1 && /* @__PURE__ */ l("div", { className: s("mx-2 h-px", r ? "bg-neutral-200" : "bg-slate-100") })
174
195
  ] }, e.key);
175
196
  })
176
197
  }
@@ -180,5 +201,5 @@ function Z({
180
201
  ) : null;
181
202
  }
182
203
  export {
183
- Z as default
204
+ te as default
184
205
  };