@mci-ui/mci-ui 0.0.86 → 0.0.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared/ui/MciModal/MciModal.js +107 -59
  3. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +23 -21
  4. package/dist/shared/ui/mciButton/MciButton.js +47 -32
  5. package/dist/shared/ui/mciCheck/MciCheck.js +116 -92
  6. package/dist/shared/ui/mciCollapse/MciCollapse.js +86 -54
  7. package/dist/shared/ui/mciDrawer/MciDrawer.js +70 -52
  8. package/dist/shared/ui/mciInput/MciInput.js +143 -130
  9. package/dist/shared/ui/mciInput/mci-input.utils.js +10 -10
  10. package/dist/shared/ui/mciPagination/MciPagination.js +85 -63
  11. package/dist/shared/ui/mciPhone/MciPhone.js +59 -54
  12. package/dist/shared/ui/mciPhone/mci-phone.utils.js +10 -10
  13. package/dist/shared/ui/mciPicker/MciPicker.js +349 -181
  14. package/dist/shared/ui/mciSelect/MciSelect.js +150 -131
  15. package/dist/shared/ui/mciSelect/mci-select.utils.js +12 -12
  16. package/dist/shared/ui/mciSkeleton/MciSkeleton.js +16 -14
  17. package/dist/shared/ui/mciTable/MciTable.js +165 -126
  18. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +113 -106
  19. package/dist/shared/ui/mciTabs/MciTabs.js +52 -45
  20. package/dist/shared/ui/mciTag/MciTag.js +27 -18
  21. package/dist/shared/ui/mciTextarea/MciTextarea.js +47 -35
  22. package/dist/shared/ui/mciToast/MciToast.js +118 -72
  23. package/dist/shared/ui/mciToast/mci-toast.utils.js +40 -12
  24. package/dist/shared/ui/mciToggle/MciToggle.js +58 -36
  25. package/dist/shared/ui/mciTooltip/MciTooltip.js +2 -2
  26. package/dist/shared/ui/mciUpload/MciUpload.js +172 -149
  27. package/dist/types/shared/types/mci-table.types.d.ts +1 -0
  28. package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -0
  29. package/dist/types/shared/types/ui/button.types.d.ts +3 -7
  30. package/dist/types/shared/types/ui/check.types.d.ts +4 -9
  31. package/dist/types/shared/types/ui/collapse.types.d.ts +1 -0
  32. package/dist/types/shared/types/ui/drawer.types.d.ts +1 -0
  33. package/dist/types/shared/types/ui/input.types.d.ts +4 -15
  34. package/dist/types/shared/types/ui/modal.types.d.ts +1 -0
  35. package/dist/types/shared/types/ui/pagination.types.d.ts +1 -0
  36. package/dist/types/shared/types/ui/phone.types.d.ts +1 -0
  37. package/dist/types/shared/types/ui/picker.types.d.ts +1 -0
  38. package/dist/types/shared/types/ui/select.types.d.ts +1 -0
  39. package/dist/types/shared/types/ui/skeleton.types.d.ts +1 -0
  40. package/dist/types/shared/types/ui/tabs.types.d.ts +1 -0
  41. package/dist/types/shared/types/ui/tag.types.d.ts +1 -0
  42. package/dist/types/shared/types/ui/textarea.types.d.ts +3 -7
  43. package/dist/types/shared/types/ui/toast.types.d.ts +1 -0
  44. package/dist/types/shared/types/ui/toggle.types.d.ts +3 -2
  45. package/dist/types/shared/types/ui/upload.types.d.ts +1 -0
  46. package/dist/types/shared/ui/MciModal/MciModal.d.ts +1 -1
  47. package/dist/types/shared/ui/mciBreadcrumb/MciBreadcrumb.d.ts +1 -1
  48. package/dist/types/shared/ui/mciButton/MciButton.d.ts +1 -1
  49. package/dist/types/shared/ui/mciCollapse/MciCollapse.d.ts +1 -1
  50. package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
  51. package/dist/types/shared/ui/mciInput/MciInput.d.ts +13 -2
  52. package/dist/types/shared/ui/mciInput/mci-input.utils.d.ts +2 -2
  53. package/dist/types/shared/ui/mciPagination/MciPagination.d.ts +1 -1
  54. package/dist/types/shared/ui/mciPhone/mci-phone.utils.d.ts +2 -2
  55. package/dist/types/shared/ui/mciSelect/mci-select.utils.d.ts +2 -2
  56. package/dist/types/shared/ui/mciSkeleton/MciSkeleton.d.ts +1 -1
  57. package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
  58. package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +2 -1
  59. package/dist/types/shared/ui/mciTabs/MciTabs.d.ts +1 -1
  60. package/dist/types/shared/ui/mciTag/MciTag.d.ts +1 -1
  61. package/dist/types/shared/ui/mciTextarea/MciTextarea.d.ts +7 -2
  62. package/dist/types/shared/ui/mciToast/mci-toast.utils.d.ts +32 -4
  63. package/dist/types/shared/ui/mciToggle/MciToggle.d.ts +1 -1
  64. package/package.json +1 -1
@@ -1,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,190 +1,197 @@
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";
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";
5
5
  /* empty css */
6
- import H from "../mciCheck/MciCheck.js";
7
- const J = {
6
+ import J from "../mciCheck/MciCheck.js";
7
+ const U = {
8
8
  ru: {
9
9
  title: "Настройки",
10
10
  close: "Закрыть",
11
11
  activeColumns: "Активные колонки",
12
- minColumns: (i) => `Минимум ${i} колонок`,
12
+ minColumns: (c) => `Минимум ${c} колонок`,
13
13
  drag: "Перетащить"
14
14
  },
15
15
  uz: {
16
16
  title: "Sozlamalar",
17
17
  close: "Yopish",
18
18
  activeColumns: "Aktiv ustunlar",
19
- minColumns: (i) => `Kamida ${i} ta ustun`,
19
+ minColumns: (c) => `Kamida ${c} ta ustun`,
20
20
  drag: "Sudrash"
21
21
  }
22
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"
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
33
34
  }) {
34
- const S = G(null), { handleClick: v } = q(S, D), d = J[F];
35
- K(() => {
36
- if (i)
35
+ const I = K(null), { handleClick: v } = H(I, C), m = U[Q];
36
+ _(() => {
37
+ if (c)
37
38
  return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
38
- }, [i, v]);
39
- const x = j(() => new Set(w), [w]), I = j(() => {
39
+ }, [c, v]);
40
+ const w = F(() => new Set(y), [y]), O = F(() => {
40
41
  let e = 0;
41
- for (const t of s) x.has(t.key) || e++;
42
+ for (const t of i) w.has(t.key) || e++;
42
43
  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;
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;
47
48
  },
48
49
  []
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);
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);
56
57
  },
57
58
  []
58
- ), $ = b(
59
+ ), B = d(
59
60
  (e, t) => {
60
61
  e.preventDefault();
61
- const r = k ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
62
- if (!Number.isFinite(r) || r < 0) {
63
- g();
62
+ const a = A ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
63
+ if (!Number.isFinite(a) || a < 0) {
64
+ h();
64
65
  return;
65
66
  }
66
- const a = s[r], c = s[t];
67
- if (!a || !c) {
68
- g();
67
+ const n = i[a], b = i[t];
68
+ if (!n || !b) {
69
+ h();
69
70
  return;
70
71
  }
71
- const l = z(r, t, m);
72
- l !== r && (p ? p(a.key, c.key, m) : y(r, l)), g();
72
+ const o = P(a, t, f);
73
+ o !== a && (x ? x(n.key, b.key, f) : k(a, o)), h();
73
74
  },
74
- [s, z, k, m, y, p, g]
75
- ), B = b(
75
+ [i, P, A, f, k, x, h]
76
+ ), G = d(
76
77
  (e, t) => {
77
- t || C(e);
78
+ t || T(e);
78
79
  },
79
- [C]
80
+ [T]
80
81
  );
81
- return i ? /* @__PURE__ */ u(
82
+ return c ? /* @__PURE__ */ g(
82
83
  "div",
83
84
  {
84
- ref: S,
85
- className: f(
85
+ ref: I,
86
+ className: s(
86
87
  "absolute right-0 top-full z-50 mt-2 w-[320px]",
87
- "rounded-2xl p-4 bg-white",
88
- "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"
89
90
  ),
90
91
  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(
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(
94
95
  "button",
95
96
  {
96
97
  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,
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,
100
104
  children: "✕"
101
105
  }
102
106
  )
103
107
  ] }),
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,
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,
107
111
  ": ",
108
- I,
112
+ O,
109
113
  "/",
110
- s.length
114
+ i.length
111
115
  ] }),
112
- /* @__PURE__ */ n(
116
+ /* @__PURE__ */ l(
113
117
  "div",
114
118
  {
115
- className: f(
119
+ className: s(
116
120
  "max-h-[275px] overflow-auto",
117
121
  "[&::-webkit-scrollbar]:w-1.5",
118
122
  "[&::-webkit-scrollbar-track]:bg-transparent",
119
- "[&::-webkit-scrollbar-thumb]:bg-slate-200",
123
+ r ? "[&::-webkit-scrollbar-thumb]:bg-neutral-200" : "[&::-webkit-scrollbar-thumb]:bg-slate-200",
120
124
  "[&::-webkit-scrollbar-thumb]:rounded-full",
121
- "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
125
+ r ? "hover:[&::-webkit-scrollbar-thumb]:bg-neutral-100" : "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
122
126
  ),
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
+ 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(
127
131
  "div",
128
132
  {
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"
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"
132
137
  )
133
138
  }
134
139
  ),
135
- /* @__PURE__ */ u(
140
+ /* @__PURE__ */ g(
136
141
  "div",
137
142
  {
138
143
  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);
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);
145
150
  },
146
- onDrop: (o) => $(o, t),
147
- onDragEnd: g,
148
- className: f(
151
+ onDrop: (u) => B(u, t),
152
+ onDragEnd: h,
153
+ className: s(
149
154
  "group flex items-center py-2 px-1 gap-4",
150
155
  "rounded-md box-border overflow-visible",
151
156
  "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"
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")
155
160
  ),
156
161
  children: [
157
- /* @__PURE__ */ n(
162
+ /* @__PURE__ */ l(
158
163
  "button",
159
164
  {
160
165
  type: "button",
161
- className: f(
162
- "shrink-0 text-slate-400",
166
+ className: s(
167
+ "shrink-0",
168
+ r ? "text-neutral-100" : "text-slate-400",
163
169
  "cursor-grab active:cursor-grabbing",
164
- "rounded-lg p-1 hover:bg-slate-100",
165
- 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"
166
172
  ),
167
- "aria-label": d.drag,
168
- children: /* @__PURE__ */ n(_, { weight: "Linear", size: 20 })
173
+ "aria-label": m.drag,
174
+ children: /* @__PURE__ */ l(q, { weight: "Linear", size: 20 })
169
175
  }
170
176
  ),
171
- /* @__PURE__ */ n("div", { className: "shrink-0", children: /* @__PURE__ */ n(
172
- H,
177
+ /* @__PURE__ */ l("div", { className: "shrink-0", children: /* @__PURE__ */ l(
178
+ J,
173
179
  {
174
- checked: r,
175
- disabled: a,
176
- onChange: () => B(e.key, a),
177
- variant: "blue"
180
+ checked: a,
181
+ disabled: n,
182
+ onChange: () => G(e.key, n),
183
+ variant: "blue",
184
+ darkMode: r
178
185
  }
179
186
  ) }),
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) })
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) })
183
190
  ] })
184
191
  ]
185
192
  }
186
193
  ),
187
- 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") })
188
195
  ] }, e.key);
189
196
  })
190
197
  }
@@ -194,5 +201,5 @@ function ee({
194
201
  ) : null;
195
202
  }
196
203
  export {
197
- ee as default
204
+ te as default
198
205
  };