@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.
- package/dist/index.css +1 -1
- package/dist/shared/ui/MciModal/MciModal.js +107 -59
- package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +23 -21
- package/dist/shared/ui/mciButton/MciButton.js +47 -32
- package/dist/shared/ui/mciCheck/MciCheck.js +116 -92
- package/dist/shared/ui/mciCollapse/MciCollapse.js +86 -54
- package/dist/shared/ui/mciDrawer/MciDrawer.js +70 -52
- package/dist/shared/ui/mciInput/MciInput.js +143 -130
- package/dist/shared/ui/mciInput/mci-input.utils.js +10 -10
- package/dist/shared/ui/mciPagination/MciPagination.js +85 -63
- package/dist/shared/ui/mciPhone/MciPhone.js +59 -54
- package/dist/shared/ui/mciPhone/mci-phone.utils.js +10 -10
- package/dist/shared/ui/mciPicker/MciPicker.js +349 -181
- package/dist/shared/ui/mciSelect/MciSelect.js +150 -131
- package/dist/shared/ui/mciSelect/mci-select.utils.js +12 -12
- package/dist/shared/ui/mciSkeleton/MciSkeleton.js +16 -14
- package/dist/shared/ui/mciTable/MciTable.js +165 -126
- package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +125 -104
- package/dist/shared/ui/mciTabs/MciTabs.js +52 -45
- package/dist/shared/ui/mciTag/MciTag.js +27 -18
- package/dist/shared/ui/mciTextarea/MciTextarea.js +47 -35
- package/dist/shared/ui/mciToast/MciToast.js +118 -72
- package/dist/shared/ui/mciToast/mci-toast.utils.js +40 -12
- package/dist/shared/ui/mciToggle/MciToggle.js +58 -36
- package/dist/shared/ui/mciTooltip/MciTooltip.js +2 -2
- package/dist/shared/ui/mciUpload/MciUpload.js +172 -149
- package/dist/types/shared/types/mci-table.types.d.ts +2 -0
- package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -0
- package/dist/types/shared/types/ui/button.types.d.ts +3 -7
- package/dist/types/shared/types/ui/check.types.d.ts +4 -9
- package/dist/types/shared/types/ui/collapse.types.d.ts +1 -0
- package/dist/types/shared/types/ui/drawer.types.d.ts +1 -0
- package/dist/types/shared/types/ui/input.types.d.ts +4 -15
- package/dist/types/shared/types/ui/modal.types.d.ts +1 -0
- package/dist/types/shared/types/ui/pagination.types.d.ts +1 -0
- package/dist/types/shared/types/ui/phone.types.d.ts +1 -0
- package/dist/types/shared/types/ui/picker.types.d.ts +1 -0
- package/dist/types/shared/types/ui/select.types.d.ts +1 -0
- package/dist/types/shared/types/ui/skeleton.types.d.ts +1 -0
- package/dist/types/shared/types/ui/tabs.types.d.ts +1 -0
- package/dist/types/shared/types/ui/tag.types.d.ts +1 -0
- package/dist/types/shared/types/ui/textarea.types.d.ts +3 -7
- package/dist/types/shared/types/ui/toast.types.d.ts +1 -0
- package/dist/types/shared/types/ui/toggle.types.d.ts +3 -2
- package/dist/types/shared/types/ui/upload.types.d.ts +1 -0
- package/dist/types/shared/ui/MciModal/MciModal.d.ts +1 -1
- package/dist/types/shared/ui/mciBreadcrumb/MciBreadcrumb.d.ts +1 -1
- package/dist/types/shared/ui/mciButton/MciButton.d.ts +1 -1
- package/dist/types/shared/ui/mciCollapse/MciCollapse.d.ts +1 -1
- package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
- package/dist/types/shared/ui/mciInput/MciInput.d.ts +13 -2
- package/dist/types/shared/ui/mciInput/mci-input.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciPagination/MciPagination.d.ts +1 -1
- package/dist/types/shared/ui/mciPhone/mci-phone.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciSelect/mci-select.utils.d.ts +2 -2
- package/dist/types/shared/ui/mciSkeleton/MciSkeleton.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +4 -2
- package/dist/types/shared/ui/mciTabs/MciTabs.d.ts +1 -1
- package/dist/types/shared/ui/mciTag/MciTag.d.ts +1 -1
- package/dist/types/shared/ui/mciTextarea/MciTextarea.d.ts +7 -2
- package/dist/types/shared/ui/mciToast/mci-toast.utils.d.ts +32 -4
- package/dist/types/shared/ui/mciToggle/MciToggle.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as s, jsx as t, Fragment as
|
|
2
|
-
import { Upload as
|
|
3
|
-
import
|
|
4
|
-
import { useState as
|
|
5
|
-
import { uploadLanguages as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { buildSecureAccept as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as s, jsx as t, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { Upload as le, File as se, Star2 as oe, Eye as ne } from "@solar-icons/react";
|
|
3
|
+
import ae from "../../../assets/icons/close.svg.js";
|
|
4
|
+
import { useState as T, useRef as H, useMemo as P, useCallback as c, useEffect as ie } from "react";
|
|
5
|
+
import { uploadLanguages as ce } from "../../lib/uploadLanguage.js";
|
|
6
|
+
import { cn as o } from "../../lib/utils.js";
|
|
7
|
+
import { buildSecureAccept as de, getAllowedFormatsHint as ue, validateFileSize as pe, validateFileType as me, createPreview as be, getFileIcon as ge, formatFileSize as he } from "./mci-upload.utils.js";
|
|
8
|
+
const fe = {
|
|
9
9
|
blue: {
|
|
10
10
|
dropBorder: "border-blue-200 hover:border-blue-300",
|
|
11
11
|
dropBg: "bg-blue-50/40 hover:bg-blue-50/60",
|
|
@@ -13,7 +13,6 @@ const be = {
|
|
|
13
13
|
iconWrap: "text-blue-600",
|
|
14
14
|
title: "text-blue-600",
|
|
15
15
|
hint: "text-slate-500",
|
|
16
|
-
progress: "bg-blue-600/30",
|
|
17
16
|
progressFill: "bg-blue-600",
|
|
18
17
|
fileIconImg: "bg-blue-50 text-blue-600",
|
|
19
18
|
fileIconDoc: "bg-green-50 text-green-600"
|
|
@@ -25,204 +24,227 @@ const be = {
|
|
|
25
24
|
iconWrap: "text-yellow-700",
|
|
26
25
|
title: "text-yellow-700",
|
|
27
26
|
hint: "text-slate-500",
|
|
28
|
-
progress: "bg-yellow-600/25",
|
|
29
27
|
progressFill: "bg-yellow-600",
|
|
30
28
|
fileIconImg: "bg-blue-50 text-blue-600",
|
|
31
29
|
fileIconDoc: "bg-green-50 text-green-600"
|
|
32
30
|
}
|
|
33
|
-
},
|
|
34
|
-
|
|
31
|
+
}, xe = {
|
|
32
|
+
blue: {
|
|
33
|
+
dropBorder: "border-blue-800 hover:border-blue-700",
|
|
34
|
+
dropBg: "bg-blue-950/40 hover:bg-blue-950/60",
|
|
35
|
+
dropActive: "border-blue-500 bg-blue-950/60",
|
|
36
|
+
iconWrap: "text-blue-400",
|
|
37
|
+
title: "text-blue-400",
|
|
38
|
+
hint: "text-slate-400",
|
|
39
|
+
progressFill: "bg-blue-500",
|
|
40
|
+
fileIconImg: "bg-blue-950 text-blue-400",
|
|
41
|
+
fileIconDoc: "bg-green-950 text-green-400"
|
|
42
|
+
},
|
|
43
|
+
yellow: {
|
|
44
|
+
dropBorder: "border-yellow-800 hover:border-yellow-700",
|
|
45
|
+
dropBg: "bg-yellow-950/40 hover:bg-yellow-950/60",
|
|
46
|
+
dropActive: "border-yellow-600 bg-yellow-950/60",
|
|
47
|
+
iconWrap: "text-yellow-400",
|
|
48
|
+
title: "text-yellow-400",
|
|
49
|
+
hint: "text-slate-400",
|
|
50
|
+
progressFill: "bg-yellow-500",
|
|
51
|
+
fileIconImg: "bg-blue-950 text-blue-400",
|
|
52
|
+
fileIconDoc: "bg-green-950 text-green-400"
|
|
53
|
+
}
|
|
54
|
+
}, je = ({
|
|
55
|
+
multiple: y = !1,
|
|
35
56
|
accept: h = "*/*",
|
|
36
|
-
maxSize:
|
|
37
|
-
maxFiles:
|
|
38
|
-
disabled:
|
|
39
|
-
label:
|
|
40
|
-
required:
|
|
41
|
-
error:
|
|
42
|
-
className:
|
|
43
|
-
onFilesChange:
|
|
44
|
-
onUpload:
|
|
45
|
-
showPreview:
|
|
46
|
-
locale:
|
|
47
|
-
showFileTypeIcon:
|
|
48
|
-
variant:
|
|
49
|
-
customValidator:
|
|
57
|
+
maxSize: N = 10,
|
|
58
|
+
maxFiles: D = 5,
|
|
59
|
+
disabled: u = !1,
|
|
60
|
+
label: W,
|
|
61
|
+
required: z = !1,
|
|
62
|
+
error: F,
|
|
63
|
+
className: I,
|
|
64
|
+
onFilesChange: f,
|
|
65
|
+
onUpload: w,
|
|
66
|
+
showPreview: _ = !0,
|
|
67
|
+
locale: q = "uz",
|
|
68
|
+
showFileTypeIcon: K = !0,
|
|
69
|
+
variant: R = "yellow",
|
|
70
|
+
customValidator: U,
|
|
71
|
+
darkMode: i = !1
|
|
50
72
|
}) => {
|
|
51
|
-
const [m,
|
|
73
|
+
const [m, x] = T([]), [$, L] = T(!1), [O, S] = T(!1), A = H(null), n = ce[q], p = P(() => i ? xe[R] : fe[R], [R, i]), G = P(() => de(h), [h]), J = P(() => ue(h), [h]), v = H(/* @__PURE__ */ new Map()), j = c((e) => {
|
|
52
74
|
const l = v.current.get(e);
|
|
53
75
|
l && (URL.revokeObjectURL(l), v.current.delete(e));
|
|
54
|
-
}, []),
|
|
76
|
+
}, []), B = c(() => {
|
|
55
77
|
for (const e of v.current.values())
|
|
56
78
|
URL.revokeObjectURL(e);
|
|
57
79
|
v.current.clear();
|
|
58
80
|
}, []);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, [
|
|
62
|
-
const
|
|
81
|
+
ie(() => () => {
|
|
82
|
+
B();
|
|
83
|
+
}, [B]);
|
|
84
|
+
const Q = c((e) => {
|
|
63
85
|
let l = v.current.get(e.id);
|
|
64
|
-
l || (l = URL.createObjectURL(e.file), v.current.set(e.id, l), setTimeout(() =>
|
|
65
|
-
}, [
|
|
86
|
+
l || (l = URL.createObjectURL(e.file), v.current.set(e.id, l), setTimeout(() => j(e.id), 5 * 6e4)), window.open(l, "_blank", "noopener,noreferrer");
|
|
87
|
+
}, [j]), E = c(
|
|
66
88
|
async (e) => {
|
|
67
|
-
const l = Array.from(e),
|
|
89
|
+
const l = Array.from(e), d = [];
|
|
68
90
|
for (const r of l) {
|
|
69
|
-
if (m.length +
|
|
70
|
-
alert(
|
|
91
|
+
if (m.length + d.length >= D) {
|
|
92
|
+
alert(n.maxFilesError(D));
|
|
71
93
|
break;
|
|
72
94
|
}
|
|
73
|
-
if (!
|
|
74
|
-
alert(
|
|
95
|
+
if (!pe(r, N)) {
|
|
96
|
+
alert(n.fileSizeError(r.name, N));
|
|
75
97
|
continue;
|
|
76
98
|
}
|
|
77
|
-
const
|
|
78
|
-
if (!
|
|
79
|
-
|
|
99
|
+
const a = me(r, h);
|
|
100
|
+
if (!a.isValid) {
|
|
101
|
+
a.reason === "blocked" ? alert(n.blockedFileTypeError(r.name)) : alert(n.fileTypeError(r.name));
|
|
80
102
|
continue;
|
|
81
103
|
}
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
alert(
|
|
104
|
+
if (U) {
|
|
105
|
+
const k = U(r);
|
|
106
|
+
if (k) {
|
|
107
|
+
alert(k);
|
|
86
108
|
continue;
|
|
87
109
|
}
|
|
88
110
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
111
|
+
const b = await be(r), g = w ? "uploading" : "success", re = w ? 0 : 100;
|
|
112
|
+
d.push({
|
|
91
113
|
id: Math.random().toString(36).substr(2, 9),
|
|
92
114
|
file: r,
|
|
93
|
-
preview:
|
|
94
|
-
progress:
|
|
115
|
+
preview: b,
|
|
116
|
+
progress: re,
|
|
95
117
|
status: g
|
|
96
118
|
});
|
|
97
119
|
}
|
|
98
|
-
if (
|
|
99
|
-
const r =
|
|
100
|
-
if (
|
|
101
|
-
|
|
120
|
+
if (d.length > 0) {
|
|
121
|
+
const r = y ? [...m, ...d] : d;
|
|
122
|
+
if (x(r), f?.(r.map((a) => a.file)), w) {
|
|
123
|
+
S(!0);
|
|
102
124
|
try {
|
|
103
|
-
const
|
|
104
|
-
...
|
|
125
|
+
const a = r.map((b, g) => ({
|
|
126
|
+
...b,
|
|
105
127
|
progress: Math.min(100, (g + 1) / r.length * 100)
|
|
106
128
|
}));
|
|
107
|
-
|
|
108
|
-
(
|
|
129
|
+
x(a), await w(a), x(
|
|
130
|
+
(b) => b.map((g) => ({
|
|
109
131
|
...g,
|
|
110
132
|
status: "success",
|
|
111
133
|
progress: 100
|
|
112
134
|
}))
|
|
113
135
|
);
|
|
114
|
-
} catch (
|
|
115
|
-
|
|
116
|
-
(
|
|
136
|
+
} catch (a) {
|
|
137
|
+
x(
|
|
138
|
+
(b) => b.map((g) => ({
|
|
117
139
|
...g,
|
|
118
140
|
status: "error",
|
|
119
|
-
error:
|
|
141
|
+
error: a instanceof Error ? a.message : n.uploadFailed
|
|
120
142
|
}))
|
|
121
143
|
);
|
|
122
144
|
} finally {
|
|
123
|
-
|
|
145
|
+
S(!1);
|
|
124
146
|
}
|
|
125
147
|
}
|
|
126
148
|
}
|
|
127
149
|
},
|
|
128
150
|
[
|
|
129
151
|
m,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
152
|
+
D,
|
|
153
|
+
U,
|
|
154
|
+
n,
|
|
133
155
|
h,
|
|
156
|
+
N,
|
|
134
157
|
y,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
x
|
|
158
|
+
f,
|
|
159
|
+
w
|
|
138
160
|
]
|
|
139
|
-
),
|
|
161
|
+
), V = c(
|
|
140
162
|
(e) => {
|
|
141
|
-
e.preventDefault(),
|
|
163
|
+
e.preventDefault(), u || L(!0);
|
|
142
164
|
},
|
|
143
|
-
[
|
|
144
|
-
),
|
|
145
|
-
e.preventDefault(),
|
|
146
|
-
}, []),
|
|
165
|
+
[u]
|
|
166
|
+
), X = c((e) => {
|
|
167
|
+
e.preventDefault(), L(!1);
|
|
168
|
+
}, []), Y = c(
|
|
147
169
|
(e) => {
|
|
148
|
-
if (e.preventDefault(),
|
|
170
|
+
if (e.preventDefault(), L(!1), u) return;
|
|
149
171
|
const l = e.dataTransfer.files;
|
|
150
|
-
l.length > 0 &&
|
|
172
|
+
l.length > 0 && E(l);
|
|
151
173
|
},
|
|
152
|
-
[
|
|
153
|
-
),
|
|
174
|
+
[u, E]
|
|
175
|
+
), Z = c(
|
|
154
176
|
(e) => {
|
|
155
177
|
const l = e.target.files;
|
|
156
|
-
l && l.length > 0 && (
|
|
178
|
+
l && l.length > 0 && (E(l), A.current && (A.current.value = ""));
|
|
157
179
|
},
|
|
158
|
-
[
|
|
159
|
-
),
|
|
180
|
+
[E]
|
|
181
|
+
), M = c(
|
|
160
182
|
(e) => {
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
return
|
|
183
|
+
j(e), x((l) => {
|
|
184
|
+
const d = l.filter((r) => r.id !== e);
|
|
185
|
+
return f?.(d.map((r) => r.file)), d;
|
|
164
186
|
});
|
|
165
187
|
},
|
|
166
|
-
[
|
|
167
|
-
),
|
|
168
|
-
|
|
169
|
-
}, [
|
|
170
|
-
|
|
188
|
+
[f, j]
|
|
189
|
+
), ee = c(() => {
|
|
190
|
+
B(), x([]), f?.([]);
|
|
191
|
+
}, [f, B]), te = c(() => {
|
|
192
|
+
A.current?.click();
|
|
171
193
|
}, []);
|
|
172
|
-
return /* @__PURE__ */ s("div", { className:
|
|
173
|
-
|
|
194
|
+
return /* @__PURE__ */ s("div", { className: o("w-full", I), children: [
|
|
195
|
+
W && /* @__PURE__ */ s(
|
|
174
196
|
"label",
|
|
175
197
|
{
|
|
176
|
-
className:
|
|
198
|
+
className: o(
|
|
177
199
|
"mb-2 block text-base font-medium",
|
|
178
|
-
|
|
200
|
+
F ? "text-red-600" : i ? "text-slate-300" : "text-slate-700"
|
|
179
201
|
),
|
|
180
202
|
children: [
|
|
181
|
-
|
|
182
|
-
|
|
203
|
+
W,
|
|
204
|
+
z && /* @__PURE__ */ t("span", { className: "ml-1 text-extra-small text-red-600", children: "*" })
|
|
183
205
|
]
|
|
184
206
|
}
|
|
185
207
|
),
|
|
186
208
|
/* @__PURE__ */ s(
|
|
187
209
|
"div",
|
|
188
210
|
{
|
|
189
|
-
className:
|
|
211
|
+
className: o(
|
|
190
212
|
"group relative flex min-h-[180px] w-full cursor-pointer items-center justify-center rounded-2xl border border-dashed p-6 text-center transition-all duration-300",
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
$ &&
|
|
194
|
-
|
|
195
|
-
|
|
213
|
+
p.dropBorder,
|
|
214
|
+
p.dropBg,
|
|
215
|
+
$ && p.dropActive,
|
|
216
|
+
u && "cursor-not-allowed opacity-60",
|
|
217
|
+
F && (i ? "border-red-500 bg-red-950/30" : "border-red-600 bg-red-50/30")
|
|
196
218
|
),
|
|
197
|
-
onDragOver:
|
|
198
|
-
onDragLeave:
|
|
199
|
-
onDrop:
|
|
200
|
-
onClick:
|
|
219
|
+
onDragOver: V,
|
|
220
|
+
onDragLeave: X,
|
|
221
|
+
onDrop: Y,
|
|
222
|
+
onClick: te,
|
|
201
223
|
children: [
|
|
202
224
|
/* @__PURE__ */ t(
|
|
203
225
|
"input",
|
|
204
226
|
{
|
|
205
|
-
ref:
|
|
227
|
+
ref: A,
|
|
206
228
|
type: "file",
|
|
207
|
-
multiple:
|
|
229
|
+
multiple: y,
|
|
208
230
|
accept: G,
|
|
209
|
-
onChange:
|
|
210
|
-
disabled:
|
|
231
|
+
onChange: Z,
|
|
232
|
+
disabled: u,
|
|
211
233
|
className: "hidden"
|
|
212
234
|
}
|
|
213
235
|
),
|
|
214
236
|
/* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-3", children: [
|
|
215
|
-
/* @__PURE__ */ t("div", { className:
|
|
216
|
-
/* @__PURE__ */ t("p", { className:
|
|
217
|
-
/* @__PURE__ */ t("p", { className:
|
|
237
|
+
/* @__PURE__ */ t("div", { className: o("flex h-12 w-12 items-center justify-center rounded-xl", p.iconWrap), children: /* @__PURE__ */ t(le, { size: 20 }) }),
|
|
238
|
+
/* @__PURE__ */ t("p", { className: o("text-base font-medium", p.title), children: n.dropHereTitle }),
|
|
239
|
+
/* @__PURE__ */ t("p", { className: o("text-sm font-normal", p.hint), children: n.fileRequirements(y, D, N, J) })
|
|
218
240
|
] })
|
|
219
241
|
]
|
|
220
242
|
}
|
|
221
243
|
),
|
|
222
244
|
m.length > 0 && /* @__PURE__ */ s("div", { className: "mt-4 space-y-3", children: [
|
|
223
245
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
224
|
-
/* @__PURE__ */ s("span", { className: "text-sm font-medium text-slate-700", children: [
|
|
225
|
-
|
|
246
|
+
/* @__PURE__ */ s("span", { className: o("text-sm font-medium", i ? "text-slate-300" : "text-slate-700"), children: [
|
|
247
|
+
n.selectedFiles,
|
|
226
248
|
" (",
|
|
227
249
|
m.length,
|
|
228
250
|
")"
|
|
@@ -231,63 +253,64 @@ const be = {
|
|
|
231
253
|
"button",
|
|
232
254
|
{
|
|
233
255
|
type: "button",
|
|
234
|
-
onClick:
|
|
235
|
-
disabled:
|
|
256
|
+
onClick: ee,
|
|
257
|
+
disabled: u || O,
|
|
236
258
|
className: "text-sm font-medium text-red-600 disabled:opacity-50",
|
|
237
|
-
children:
|
|
259
|
+
children: n.clearAll
|
|
238
260
|
}
|
|
239
261
|
)
|
|
240
262
|
] }),
|
|
241
263
|
/* @__PURE__ */ t("div", { className: "space-y-3", children: m.map((e) => {
|
|
242
|
-
const
|
|
264
|
+
const d = !!e.preview ? p.fileIconImg : p.fileIconDoc, r = u || O || e.status === "uploading";
|
|
243
265
|
return /* @__PURE__ */ s(
|
|
244
266
|
"div",
|
|
245
267
|
{
|
|
246
|
-
className:
|
|
247
|
-
"flex items-center justify-between rounded-2xl border
|
|
248
|
-
|
|
268
|
+
className: o(
|
|
269
|
+
"flex items-center justify-between rounded-2xl border p-4",
|
|
270
|
+
i ? "border-neutral-700" : "border-slate-200",
|
|
271
|
+
e.status === "error" && (i ? "border-red-500" : "border-red-600")
|
|
249
272
|
),
|
|
250
273
|
children: [
|
|
251
274
|
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-4", children: [
|
|
252
275
|
/* @__PURE__ */ t(
|
|
253
276
|
"div",
|
|
254
277
|
{
|
|
255
|
-
className:
|
|
278
|
+
className: o(
|
|
256
279
|
"flex h-14 w-14 items-center justify-center rounded-2xl",
|
|
257
|
-
|
|
280
|
+
d
|
|
258
281
|
),
|
|
259
|
-
children:
|
|
282
|
+
children: _ && e.preview ? /* @__PURE__ */ t(
|
|
260
283
|
"img",
|
|
261
284
|
{
|
|
262
285
|
src: e.preview,
|
|
263
286
|
alt: e.file.name,
|
|
264
287
|
className: "h-10 w-10 rounded-xl object-cover"
|
|
265
288
|
}
|
|
266
|
-
) :
|
|
289
|
+
) : K ? ge(e.file) : /* @__PURE__ */ t(se, { className: "h-6 w-6 text-slate-500" })
|
|
267
290
|
}
|
|
268
291
|
),
|
|
269
292
|
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
270
|
-
/* @__PURE__ */ t("p", { className: "truncate text-lg font-semibold text-primary", children: e.file.name }),
|
|
271
|
-
/* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-2 text-sm text-slate-500", children: [
|
|
293
|
+
/* @__PURE__ */ t("p", { className: o("truncate text-lg font-semibold", i ? "text-slate-100" : "text-primary"), children: e.file.name }),
|
|
294
|
+
/* @__PURE__ */ s("div", { className: o("mt-1 flex flex-wrap items-center gap-2 text-sm", i ? "text-slate-400" : "text-slate-500"), children: [
|
|
272
295
|
/* @__PURE__ */ t("span", { children: he(e.file.size) }),
|
|
273
|
-
e.status === "uploading" && /* @__PURE__ */ s(
|
|
296
|
+
e.status === "uploading" && /* @__PURE__ */ s(C, { children: [
|
|
274
297
|
/* @__PURE__ */ t("span", { children: "•" }),
|
|
275
298
|
/* @__PURE__ */ s("span", { className: "inline-flex items-center", children: [
|
|
276
|
-
/* @__PURE__ */ t(
|
|
277
|
-
|
|
299
|
+
/* @__PURE__ */ t(oe, { className: "mr-1 h-5 w-5 animate-spin" }),
|
|
300
|
+
n.uploading
|
|
278
301
|
] })
|
|
279
302
|
] }),
|
|
280
|
-
e.status === "success" && /* @__PURE__ */ s(
|
|
303
|
+
e.status === "success" && /* @__PURE__ */ s(C, { children: [
|
|
281
304
|
/* @__PURE__ */ t("span", { children: "•" }),
|
|
282
|
-
/* @__PURE__ */ t("span", { className: "font-normal text-green-600", children:
|
|
305
|
+
/* @__PURE__ */ t("span", { className: "font-normal text-green-600", children: n.success })
|
|
283
306
|
] })
|
|
284
307
|
] }),
|
|
285
|
-
e.status === "uploading" && /* @__PURE__ */ t("div", { className:
|
|
308
|
+
e.status === "uploading" && /* @__PURE__ */ t("div", { className: o("mt-2 h-1.5 w-full rounded-full", i ? "bg-neutral-700" : "bg-slate-200"), children: /* @__PURE__ */ t(
|
|
286
309
|
"div",
|
|
287
310
|
{
|
|
288
|
-
className:
|
|
311
|
+
className: o(
|
|
289
312
|
"h-1.5 rounded-full transition-all duration-300",
|
|
290
|
-
|
|
313
|
+
p.progressFill
|
|
291
314
|
),
|
|
292
315
|
style: { width: `${e.progress}%` }
|
|
293
316
|
}
|
|
@@ -300,26 +323,26 @@ const be = {
|
|
|
300
323
|
"button",
|
|
301
324
|
{
|
|
302
325
|
type: "button",
|
|
303
|
-
onClick: (
|
|
304
|
-
|
|
326
|
+
onClick: (a) => {
|
|
327
|
+
a.stopPropagation(), r || Q(e);
|
|
305
328
|
},
|
|
306
329
|
disabled: r,
|
|
307
|
-
className: "rounded-xl p-2 hover:
|
|
308
|
-
title:
|
|
309
|
-
children: /* @__PURE__ */ t(
|
|
330
|
+
className: o("rounded-xl p-2 hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", i ? "hover:bg-neutral-800" : "hover:bg-slate-100"),
|
|
331
|
+
title: n.preview,
|
|
332
|
+
children: /* @__PURE__ */ t(ne, { size: 20, className: "text-slate-400" })
|
|
310
333
|
}
|
|
311
334
|
),
|
|
312
335
|
/* @__PURE__ */ t(
|
|
313
336
|
"button",
|
|
314
337
|
{
|
|
315
338
|
type: "button",
|
|
316
|
-
onClick: (
|
|
317
|
-
|
|
339
|
+
onClick: (a) => {
|
|
340
|
+
a.stopPropagation(), M(e.id);
|
|
318
341
|
},
|
|
319
|
-
disabled:
|
|
320
|
-
className: "rounded-xl p-2 text-slate-
|
|
321
|
-
title:
|
|
322
|
-
children: /* @__PURE__ */ t(
|
|
342
|
+
disabled: u || O,
|
|
343
|
+
className: o("rounded-xl p-2 disabled:opacity-50 hover:cursor-pointer", i ? "text-slate-400 hover:bg-neutral-800" : "text-slate-base hover:bg-slate-100"),
|
|
344
|
+
title: n.remove,
|
|
345
|
+
children: /* @__PURE__ */ t(ae, { className: "h-6 w-6" })
|
|
323
346
|
}
|
|
324
347
|
)
|
|
325
348
|
] })
|
|
@@ -329,9 +352,9 @@ const be = {
|
|
|
329
352
|
);
|
|
330
353
|
}) })
|
|
331
354
|
] }),
|
|
332
|
-
|
|
355
|
+
F && /* @__PURE__ */ t("p", { className: "mt-2 text-sm font-normal text-red-600", children: F })
|
|
333
356
|
] });
|
|
334
357
|
};
|
|
335
358
|
export {
|
|
336
|
-
|
|
359
|
+
je as default
|
|
337
360
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export type Align = 'left' | 'center' | 'right';
|
|
3
3
|
export type ColumnKey<T> = Extract<keyof T, string>;
|
|
4
|
+
export type MciTablePanelLocale = 'ru' | 'uz';
|
|
4
5
|
export type MciTableColumn<T> = {
|
|
5
6
|
key: ColumnKey<T>;
|
|
6
7
|
title: string;
|
|
@@ -38,6 +39,7 @@ export interface MciTableProps<T extends Record<string, unknown>> {
|
|
|
38
39
|
loading?: boolean;
|
|
39
40
|
skeletonRows?: number;
|
|
40
41
|
noDataText?: string;
|
|
42
|
+
darkMode?: boolean;
|
|
41
43
|
sort?: MciTableSort<T> | null;
|
|
42
44
|
onSortChange?: (sort: MciTableSort<T> | null) => void;
|
|
43
45
|
className?: string;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export type ButtonProps = {
|
|
3
|
-
children?: ReactNode;
|
|
1
|
+
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> & {
|
|
4
3
|
text?: string;
|
|
5
4
|
icon?: ReactNode;
|
|
6
5
|
iconPosition?: 'left' | 'right';
|
|
7
6
|
size?: 'sm' | 'md' | 'base';
|
|
8
7
|
variant?: 'primary' | 'secondary' | 'outline' | 'danger' | 'tertiary';
|
|
9
8
|
color?: 'blue' | 'yellow';
|
|
9
|
+
darkMode?: boolean;
|
|
10
10
|
loading?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
onClick?: () => void;
|
|
13
|
-
className?: string;
|
|
14
|
-
type?: 'button' | 'submit' | 'reset';
|
|
15
11
|
};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type MciCheckProps = {
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
export type MciCheckProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'className'> & {
|
|
3
3
|
type?: 'checkbox' | 'radio';
|
|
4
4
|
label?: string;
|
|
5
5
|
supportText?: string;
|
|
6
|
-
checked?: boolean;
|
|
7
|
-
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
8
6
|
error?: string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
className?: string;
|
|
12
7
|
variant?: 'blue' | 'yellow';
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
darkMode?: boolean;
|
|
9
|
+
className?: string;
|
|
15
10
|
};
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type InputProps = {
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' | 'className'> & {
|
|
3
3
|
label?: string;
|
|
4
|
-
placeholder?: string;
|
|
5
4
|
type?: 'text' | 'email' | 'password' | 'number' | 'tel';
|
|
6
5
|
icon?: ReactNode;
|
|
7
6
|
rightIcon?: ReactNode;
|
|
8
7
|
iconPosition?: 'left' | 'right';
|
|
9
8
|
size?: 'sm' | 'md' | 'base';
|
|
9
|
+
darkMode?: boolean;
|
|
10
10
|
error?: string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
value?: string;
|
|
14
|
-
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
15
|
-
onFocus?: () => void;
|
|
16
|
-
onBlur?: () => void;
|
|
17
|
-
className?: string;
|
|
18
|
-
name?: string;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
maxLength?: number;
|
|
21
11
|
onClear?: () => void;
|
|
22
12
|
showClearButton?: boolean;
|
|
23
|
-
|
|
24
|
-
autoComplete?: string;
|
|
13
|
+
className?: string;
|
|
25
14
|
};
|