@mci-ui/mci-ui 0.0.84 → 0.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/assets/icons/check.svg.js +5 -0
  2. package/dist/assets/icons/close.svg.js +5 -0
  3. package/dist/assets/icons/loaderIcon.svg.js +5 -0
  4. package/dist/index.js +53 -0
  5. package/dist/shared/lib/hooks/useTableColumnSettings.js +132 -0
  6. package/dist/shared/lib/locales.js +101 -0
  7. package/dist/shared/lib/uploadLanguage.js +80 -0
  8. package/dist/shared/lib/utils.js +20 -0
  9. package/dist/shared/ui/MciModal/MciModal.js +97 -0
  10. package/dist/shared/ui/mciAccordion/MciAccordion.js +74 -0
  11. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +39 -0
  12. package/dist/shared/ui/mciButton/MciButton.js +63 -0
  13. package/dist/shared/ui/mciCheck/MciCheck.js +170 -0
  14. package/dist/shared/ui/mciCollapse/MciCollapse.js +60 -0
  15. package/dist/shared/ui/mciDrawer/MciDrawer.js +108 -0
  16. package/dist/shared/ui/mciIdentityInput/MciIdentityInput.js +30 -0
  17. package/dist/shared/ui/mciIdentityInput/mci-identity-input.utils.js +32 -0
  18. package/dist/shared/ui/mciInput/MciInput.js +225 -0
  19. package/dist/shared/ui/mciInput/mci-input.utils.js +49 -0
  20. package/dist/shared/ui/mciLoader/MciLoader.js +38 -0
  21. package/dist/shared/ui/mciPagination/MciPagination.js +135 -0
  22. package/dist/shared/ui/mciPagination/mci-pagination.utils.js +12 -0
  23. package/dist/shared/ui/mciPhone/MciPhone.js +83 -0
  24. package/dist/shared/ui/mciPhone/mci-phone.utils.js +47 -0
  25. package/dist/shared/ui/mciPicker/MciPicker.js +256 -0
  26. package/dist/shared/ui/mciPicker/mci-picker.utils.js +62 -0
  27. package/dist/shared/ui/mciSelect/MciSelect.js +226 -0
  28. package/dist/shared/ui/mciSelect/mci-select.utils.js +52 -0
  29. package/dist/shared/ui/mciSkeleton/MciSkeleton.js +29 -0
  30. package/dist/shared/ui/mciTable/MciTable.js +153 -0
  31. package/dist/shared/ui/mciTable/MciTableClamp2.js +7 -0
  32. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +184 -0
  33. package/dist/shared/ui/mciTable/mci-table.utils.js +14 -0
  34. package/dist/shared/ui/mciTabs/MciTabs.js +131 -0
  35. package/dist/shared/ui/mciTag/MciTag.js +46 -0
  36. package/dist/shared/ui/mciTextarea/MciTextarea.js +56 -0
  37. package/dist/shared/ui/mciToast/MciToast.js +106 -0
  38. package/dist/shared/ui/mciToast/mci-toast.utils.js +47 -0
  39. package/dist/shared/ui/mciToggle/MciToggle.js +77 -0
  40. package/dist/shared/ui/mciTooltip/MciTooltip.js +52 -0
  41. package/dist/shared/ui/mciUpload/MciUpload.js +337 -0
  42. package/dist/shared/ui/mciUpload/mci-upload.utils.js +186 -0
  43. package/package.json +15 -12
  44. package/dist/index.es.js +0 -3387
  45. package/dist/index.umd.js +0 -2
@@ -0,0 +1,52 @@
1
+ import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ const i = {
4
+ top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
5
+ bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
6
+ left: "right-full top-1/2 -translate-y-1/2 mr-2",
7
+ right: "left-full top-1/2 -translate-y-1/2 ml-2"
8
+ }, p = {
9
+ top: "left-1/2 -translate-x-1/2 top-full",
10
+ bottom: "left-1/2 -translate-x-1/2 bottom-full",
11
+ left: "top-1/2 -translate-y-1/2 left-full",
12
+ right: "top-1/2 -translate-y-1/2 right-full"
13
+ };
14
+ function m({
15
+ content: a,
16
+ children: o,
17
+ position: t = "top",
18
+ delay: r = 200,
19
+ className: s
20
+ }) {
21
+ return /* @__PURE__ */ l("div", { className: "group relative inline-block", children: [
22
+ o,
23
+ /* @__PURE__ */ l(
24
+ "div",
25
+ {
26
+ className: e(
27
+ "absolute z-50 rounded-md bg-slate-400 px-2 py-1 text-xs whitespace-nowrap text-white shadow-md",
28
+ "scale-95 opacity-0 transition-all group-hover:scale-100 group-hover:opacity-100",
29
+ "duration-200 ease-out group-hover:delay-200",
30
+ i[t],
31
+ s
32
+ ),
33
+ style: { transitionDelay: `${r}ms` },
34
+ children: [
35
+ a,
36
+ /* @__PURE__ */ n(
37
+ "span",
38
+ {
39
+ className: e(
40
+ "absolute h-2 w-2 rotate-45 bg-slate-400",
41
+ p[t]
42
+ )
43
+ }
44
+ )
45
+ ]
46
+ }
47
+ )
48
+ ] });
49
+ }
50
+ export {
51
+ m as default
52
+ };
@@ -0,0 +1,337 @@
1
+ import { jsxs as s, jsx as t, Fragment as S } from "react/jsx-runtime";
2
+ import { Upload as re, File as le, Star2 as se, Eye as ae } from "@solar-icons/react";
3
+ import ne from "../../../assets/icons/close.svg.js";
4
+ import { useState as L, useRef as C, useMemo as B, useCallback as o, useEffect as oe } from "react";
5
+ import { uploadLanguages as ie } from "../../lib/uploadLanguage.js";
6
+ import { cn as c } from "../../lib/utils.js";
7
+ import { buildSecureAccept as ce, getAllowedFormatsHint as de, validateFileSize as ue, validateFileType as me, createPreview as pe, getFileIcon as ge, formatFileSize as he } from "./mci-upload.utils.js";
8
+ const be = {
9
+ blue: {
10
+ dropBorder: "border-blue-200 hover:border-blue-300",
11
+ dropBg: "bg-blue-50/40 hover:bg-blue-50/60",
12
+ dropActive: "border-blue-600 bg-blue-50",
13
+ iconWrap: "text-blue-600",
14
+ title: "text-blue-600",
15
+ hint: "text-slate-500",
16
+ progress: "bg-blue-600/30",
17
+ progressFill: "bg-blue-600",
18
+ fileIconImg: "bg-blue-50 text-blue-600",
19
+ fileIconDoc: "bg-green-50 text-green-600"
20
+ },
21
+ yellow: {
22
+ dropBorder: "border-yellow-200 hover:border-yellow-300",
23
+ dropBg: "bg-yellow-50/40 hover:bg-yellow-50/60",
24
+ dropActive: "border-yellow-500 bg-yellow-50",
25
+ iconWrap: "text-yellow-700",
26
+ title: "text-yellow-700",
27
+ hint: "text-slate-500",
28
+ progress: "bg-yellow-600/25",
29
+ progressFill: "bg-yellow-600",
30
+ fileIconImg: "bg-blue-50 text-blue-600",
31
+ fileIconDoc: "bg-green-50 text-green-600"
32
+ }
33
+ }, De = ({
34
+ multiple: w = !1,
35
+ accept: h = "*/*",
36
+ maxSize: y = 10,
37
+ maxFiles: N = 5,
38
+ disabled: d = !1,
39
+ label: O,
40
+ required: W = !1,
41
+ error: k,
42
+ className: z,
43
+ onFilesChange: b,
44
+ onUpload: x,
45
+ showPreview: H = !0,
46
+ locale: _ = "uz",
47
+ showFileTypeIcon: q = !0,
48
+ variant: T = "yellow",
49
+ customValidator: R
50
+ }) => {
51
+ const [m, f] = L([]), [$, U] = L(!1), [E, P] = L(!1), D = C(null), a = ie[_], u = B(() => be[T], [T]), G = B(() => ce(h), [h]), J = B(() => de(h), [h]), v = C(/* @__PURE__ */ new Map()), F = o((e) => {
52
+ const l = v.current.get(e);
53
+ l && (URL.revokeObjectURL(l), v.current.delete(e));
54
+ }, []), j = o(() => {
55
+ for (const e of v.current.values())
56
+ URL.revokeObjectURL(e);
57
+ v.current.clear();
58
+ }, []);
59
+ oe(() => () => {
60
+ j();
61
+ }, [j]);
62
+ const K = o((e) => {
63
+ let l = v.current.get(e.id);
64
+ l || (l = URL.createObjectURL(e.file), v.current.set(e.id, l), setTimeout(() => F(e.id), 5 * 6e4)), window.open(l, "_blank", "noopener,noreferrer");
65
+ }, [F]), A = o(
66
+ async (e) => {
67
+ const l = Array.from(e), i = [];
68
+ for (const r of l) {
69
+ if (m.length + i.length >= N) {
70
+ alert(a.maxFilesError(N));
71
+ break;
72
+ }
73
+ if (!ue(r, y)) {
74
+ alert(a.fileSizeError(r.name, y));
75
+ continue;
76
+ }
77
+ const n = me(r, h);
78
+ if (!n.isValid) {
79
+ n.reason === "blocked" ? alert(a.blockedFileTypeError(r.name)) : alert(a.fileTypeError(r.name));
80
+ continue;
81
+ }
82
+ if (R) {
83
+ const M = R(r);
84
+ if (M) {
85
+ alert(M);
86
+ continue;
87
+ }
88
+ }
89
+ const p = await pe(r), g = x ? "uploading" : "success", te = x ? 0 : 100;
90
+ i.push({
91
+ id: Math.random().toString(36).substr(2, 9),
92
+ file: r,
93
+ preview: p,
94
+ progress: te,
95
+ status: g
96
+ });
97
+ }
98
+ if (i.length > 0) {
99
+ const r = w ? [...m, ...i] : i;
100
+ if (f(r), b?.(r.map((n) => n.file)), x) {
101
+ P(!0);
102
+ try {
103
+ const n = r.map((p, g) => ({
104
+ ...p,
105
+ progress: Math.min(100, (g + 1) / r.length * 100)
106
+ }));
107
+ f(n), await x(n), f(
108
+ (p) => p.map((g) => ({
109
+ ...g,
110
+ status: "success",
111
+ progress: 100
112
+ }))
113
+ );
114
+ } catch (n) {
115
+ f(
116
+ (p) => p.map((g) => ({
117
+ ...g,
118
+ status: "error",
119
+ error: n instanceof Error ? n.message : a.uploadFailed
120
+ }))
121
+ );
122
+ } finally {
123
+ P(!1);
124
+ }
125
+ }
126
+ }
127
+ },
128
+ [
129
+ m,
130
+ N,
131
+ R,
132
+ a,
133
+ h,
134
+ y,
135
+ w,
136
+ b,
137
+ x
138
+ ]
139
+ ), Q = o(
140
+ (e) => {
141
+ e.preventDefault(), d || U(!0);
142
+ },
143
+ [d]
144
+ ), V = o((e) => {
145
+ e.preventDefault(), U(!1);
146
+ }, []), X = o(
147
+ (e) => {
148
+ if (e.preventDefault(), U(!1), d) return;
149
+ const l = e.dataTransfer.files;
150
+ l.length > 0 && A(l);
151
+ },
152
+ [d, A]
153
+ ), Y = o(
154
+ (e) => {
155
+ const l = e.target.files;
156
+ l && l.length > 0 && (A(l), D.current && (D.current.value = ""));
157
+ },
158
+ [A]
159
+ ), Z = o(
160
+ (e) => {
161
+ F(e), f((l) => {
162
+ const i = l.filter((r) => r.id !== e);
163
+ return b?.(i.map((r) => r.file)), i;
164
+ });
165
+ },
166
+ [b, F]
167
+ ), I = o(() => {
168
+ j(), f([]), b?.([]);
169
+ }, [b, j]), ee = o(() => {
170
+ D.current?.click();
171
+ }, []);
172
+ return /* @__PURE__ */ s("div", { className: c("w-full", z), children: [
173
+ O && /* @__PURE__ */ s(
174
+ "label",
175
+ {
176
+ className: c(
177
+ "mb-2 block text-base font-medium",
178
+ k ? "text-red-600" : "text-slate-700"
179
+ ),
180
+ children: [
181
+ O,
182
+ W && /* @__PURE__ */ t("span", { className: "ml-1 text-extra-small text-red-600", children: "*" })
183
+ ]
184
+ }
185
+ ),
186
+ /* @__PURE__ */ s(
187
+ "div",
188
+ {
189
+ className: c(
190
+ "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
+ u.dropBorder,
192
+ u.dropBg,
193
+ $ && u.dropActive,
194
+ d && "cursor-not-allowed opacity-60",
195
+ k && "border-red-600 bg-red-50/30"
196
+ ),
197
+ onDragOver: Q,
198
+ onDragLeave: V,
199
+ onDrop: X,
200
+ onClick: ee,
201
+ children: [
202
+ /* @__PURE__ */ t(
203
+ "input",
204
+ {
205
+ ref: D,
206
+ type: "file",
207
+ multiple: w,
208
+ accept: G,
209
+ onChange: Y,
210
+ disabled: d,
211
+ className: "hidden"
212
+ }
213
+ ),
214
+ /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-3", children: [
215
+ /* @__PURE__ */ t("div", { className: c("flex h-12 w-12 items-center justify-center rounded-xl", u.iconWrap), children: /* @__PURE__ */ t(re, { size: 20 }) }),
216
+ /* @__PURE__ */ t("p", { className: c("text-base font-medium", u.title), children: a.dropHereTitle }),
217
+ /* @__PURE__ */ t("p", { className: c("text-sm font-normal", u.hint), children: a.fileRequirements(w, N, y, J) })
218
+ ] })
219
+ ]
220
+ }
221
+ ),
222
+ m.length > 0 && /* @__PURE__ */ s("div", { className: "mt-4 space-y-3", children: [
223
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
224
+ /* @__PURE__ */ s("span", { className: "text-sm font-medium text-slate-700", children: [
225
+ a.selectedFiles,
226
+ " (",
227
+ m.length,
228
+ ")"
229
+ ] }),
230
+ m.length > 1 && /* @__PURE__ */ t(
231
+ "button",
232
+ {
233
+ type: "button",
234
+ onClick: I,
235
+ disabled: d || E,
236
+ className: "text-sm font-medium text-red-600 disabled:opacity-50",
237
+ children: a.clearAll
238
+ }
239
+ )
240
+ ] }),
241
+ /* @__PURE__ */ t("div", { className: "space-y-3", children: m.map((e) => {
242
+ const i = !!e.preview ? u.fileIconImg : u.fileIconDoc, r = d || E || e.status === "uploading";
243
+ return /* @__PURE__ */ s(
244
+ "div",
245
+ {
246
+ className: c(
247
+ "flex items-center justify-between rounded-2xl border border-slate-200 p-4",
248
+ e.status === "error" && "border-red-600"
249
+ ),
250
+ children: [
251
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-4", children: [
252
+ /* @__PURE__ */ t(
253
+ "div",
254
+ {
255
+ className: c(
256
+ "flex h-14 w-14 items-center justify-center rounded-2xl",
257
+ i
258
+ ),
259
+ children: H && e.preview ? /* @__PURE__ */ t(
260
+ "img",
261
+ {
262
+ src: e.preview,
263
+ alt: e.file.name,
264
+ className: "h-10 w-10 rounded-xl object-cover"
265
+ }
266
+ ) : q ? ge(e.file) : /* @__PURE__ */ t(le, { className: "h-6 w-6 text-slate-500" })
267
+ }
268
+ ),
269
+ /* @__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: [
272
+ /* @__PURE__ */ t("span", { children: he(e.file.size) }),
273
+ e.status === "uploading" && /* @__PURE__ */ s(S, { children: [
274
+ /* @__PURE__ */ t("span", { children: "•" }),
275
+ /* @__PURE__ */ s("span", { className: "inline-flex items-center", children: [
276
+ /* @__PURE__ */ t(se, { className: "mr-1 h-5 w-5 animate-spin" }),
277
+ a.uploading
278
+ ] })
279
+ ] }),
280
+ e.status === "success" && /* @__PURE__ */ s(S, { children: [
281
+ /* @__PURE__ */ t("span", { children: "•" }),
282
+ /* @__PURE__ */ t("span", { className: "font-normal text-green-600", children: a.success })
283
+ ] })
284
+ ] }),
285
+ e.status === "uploading" && /* @__PURE__ */ t("div", { className: c("mt-2 h-1.5 w-full rounded-full bg-slate-200"), children: /* @__PURE__ */ t(
286
+ "div",
287
+ {
288
+ className: c(
289
+ "h-1.5 rounded-full transition-all duration-300",
290
+ u.progressFill
291
+ ),
292
+ style: { width: `${e.progress}%` }
293
+ }
294
+ ) }),
295
+ e.status === "error" && e.error && /* @__PURE__ */ t("p", { className: "mt-2 text-sm font-normal text-red-600", children: e.error })
296
+ ] })
297
+ ] }),
298
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
299
+ /* @__PURE__ */ t(
300
+ "button",
301
+ {
302
+ type: "button",
303
+ onClick: (n) => {
304
+ n.stopPropagation(), r || K(e);
305
+ },
306
+ disabled: r,
307
+ className: "rounded-xl p-2 hover:bg-slate-100 hover:cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",
308
+ title: a.preview,
309
+ children: /* @__PURE__ */ t(ae, { size: 20, className: "text-slate-400" })
310
+ }
311
+ ),
312
+ /* @__PURE__ */ t(
313
+ "button",
314
+ {
315
+ type: "button",
316
+ onClick: (n) => {
317
+ n.stopPropagation(), Z(e.id);
318
+ },
319
+ disabled: d || E,
320
+ className: "rounded-xl p-2 text-slate-base hover:bg-slate-100 disabled:opacity-50 hover:cursor-pointer",
321
+ title: a.remove,
322
+ children: /* @__PURE__ */ t(ne, { className: "h-6 w-6" })
323
+ }
324
+ )
325
+ ] })
326
+ ]
327
+ },
328
+ e.id
329
+ );
330
+ }) })
331
+ ] }),
332
+ k && /* @__PURE__ */ t("p", { className: "mt-2 text-sm font-normal text-red-600", children: k })
333
+ ] });
334
+ };
335
+ export {
336
+ De as default
337
+ };
@@ -0,0 +1,186 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { FileText as c, File as m, MusicNote as f, VideoFramePlayHorizontal as u, Gallery as x } from "@solar-icons/react";
3
+ const l = [
4
+ "pdf",
5
+ "doc",
6
+ "docx",
7
+ "xls",
8
+ "xlsx",
9
+ "ppt",
10
+ "pptx",
11
+ "txt",
12
+ "jpg",
13
+ "jpeg",
14
+ "png",
15
+ "bmp",
16
+ "tiff"
17
+ ], h = [
18
+ "zip",
19
+ "rar",
20
+ "7z",
21
+ "tar",
22
+ "gz",
23
+ "bz2",
24
+ "xz",
25
+ "tgz",
26
+ "tbz2",
27
+ "txz",
28
+ "iso",
29
+ "cab",
30
+ "arj",
31
+ "lz",
32
+ "lzh",
33
+ "z",
34
+ "exe",
35
+ "bat",
36
+ "cmd",
37
+ "com",
38
+ "msi",
39
+ "scr",
40
+ "pif",
41
+ "js",
42
+ "mjs",
43
+ "cjs",
44
+ "jse",
45
+ "vbs",
46
+ "vbe",
47
+ "wsf",
48
+ "wsh",
49
+ "ps1",
50
+ "psm1",
51
+ "sh",
52
+ "bash",
53
+ "zsh",
54
+ "ksh",
55
+ "csh",
56
+ "fish"
57
+ ], r = new Set(l), p = new Set(h), g = l.map((e) => `.${e}`).join(","), w = {
58
+ "image/*": ["jpg", "jpeg", "png", "bmp", "tiff"],
59
+ "text/*": ["txt"]
60
+ }, E = {
61
+ "application/pdf": ["pdf"],
62
+ "application/msword": ["doc"],
63
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ["docx"],
64
+ "application/vnd.ms-excel": ["xls"],
65
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"],
66
+ "application/vnd.ms-powerpoint": ["ppt"],
67
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": ["pptx"],
68
+ "text/plain": ["txt"],
69
+ "image/jpg": ["jpg"],
70
+ "image/jpeg": ["jpg", "jpeg"],
71
+ "image/png": ["png"],
72
+ "image/bmp": ["bmp"],
73
+ "image/tiff": ["tiff"]
74
+ }, S = /* @__PURE__ */ new Set([
75
+ "application/zip",
76
+ "application/x-zip-compressed",
77
+ "application/x-rar-compressed",
78
+ "application/vnd.rar",
79
+ "application/x-7z-compressed",
80
+ "application/x-msdownload",
81
+ "application/x-msdos-program",
82
+ "application/x-executable",
83
+ "application/x-bat",
84
+ "application/x-msi",
85
+ "application/javascript",
86
+ "text/javascript",
87
+ "application/x-javascript",
88
+ "application/x-sh",
89
+ "application/x-csh",
90
+ "text/x-shellscript",
91
+ "application/x-powershell"
92
+ ]);
93
+ function z(e) {
94
+ const t = e.trim().toLowerCase(), n = t.lastIndexOf(".");
95
+ return n <= 0 || n === t.length - 1 ? "" : t.slice(n + 1);
96
+ }
97
+ function j(e) {
98
+ return e.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
99
+ }
100
+ function d(e) {
101
+ if (!e || e === "*/*") return null;
102
+ const t = j(e), n = /* @__PURE__ */ new Set();
103
+ for (const i of t)
104
+ if (i !== "*/*") {
105
+ if (i.endsWith("/*")) {
106
+ const s = w[i];
107
+ if (!s) continue;
108
+ for (const o of s)
109
+ r.has(o) && !p.has(o) && n.add(o);
110
+ continue;
111
+ }
112
+ if (i.startsWith(".")) {
113
+ const s = i.slice(1);
114
+ r.has(s) && !p.has(s) && n.add(s);
115
+ continue;
116
+ }
117
+ if (i.includes("/")) {
118
+ const s = E[i];
119
+ if (!s) continue;
120
+ for (const o of s)
121
+ r.has(o) && !p.has(o) && n.add(o);
122
+ continue;
123
+ }
124
+ r.has(i) && !p.has(i) && n.add(i);
125
+ }
126
+ return n.size > 0 ? n : null;
127
+ }
128
+ function T(e) {
129
+ const t = d(e);
130
+ return t ? Array.from(t).map((n) => `.${n}`).join(",") : g;
131
+ }
132
+ function b(e) {
133
+ const t = d(e);
134
+ return t ? Array.from(t).join(", ") : l.join(", ");
135
+ }
136
+ function v(e) {
137
+ switch (e.type.split("/")[0]) {
138
+ case "image":
139
+ return /* @__PURE__ */ a(x, { className: "h-5 w-5 text-blue-500" });
140
+ case "video":
141
+ return /* @__PURE__ */ a(u, { className: "h-5 w-5 text-purple-500" });
142
+ case "audio":
143
+ return /* @__PURE__ */ a(f, { className: "h-5 w-5 text-green-500" });
144
+ default:
145
+ return e.type.includes("pdf") ? /* @__PURE__ */ a(c, { className: "h-5 w-5 text-red-500" }) : e.type.includes("word") || e.type.includes("document") ? /* @__PURE__ */ a(c, { className: "h-5 w-5 text-blue-600" }) : e.type.includes("excel") || e.type.includes("spreadsheet") ? /* @__PURE__ */ a(c, { className: "h-5 w-5 text-green-600" }) : /* @__PURE__ */ a(m, { className: "h-5 w-5 text-gray-500" });
146
+ }
147
+ }
148
+ function _(e) {
149
+ if (e === 0) return "0 Bytes";
150
+ const t = 1024, n = ["Bytes", "KB", "MB", "GB"], i = Math.floor(Math.log(e) / Math.log(t));
151
+ return parseFloat((e / Math.pow(t, i)).toFixed(2)) + " " + n[i];
152
+ }
153
+ function F(e, t) {
154
+ const n = t * 1024 * 1024;
155
+ return e.size <= n;
156
+ }
157
+ function O(e, t) {
158
+ const n = z(e.name), i = e.type.trim().toLowerCase();
159
+ if (i && S.has(i))
160
+ return { isValid: !1, reason: "blocked" };
161
+ if (!n) return { isValid: !1, reason: "not-allowed" };
162
+ if (p.has(n)) return { isValid: !1, reason: "blocked" };
163
+ if (!r.has(n)) return { isValid: !1, reason: "not-allowed" };
164
+ const s = d(t);
165
+ return s && !s.has(n) ? { isValid: !1, reason: "not-allowed" } : { isValid: !0 };
166
+ }
167
+ function A(e) {
168
+ return new Promise((t) => {
169
+ if (e.type.startsWith("image/")) {
170
+ const n = new FileReader();
171
+ n.onload = (i) => t(i.target?.result ?? ""), n.readAsDataURL(e);
172
+ } else
173
+ t("");
174
+ });
175
+ }
176
+ export {
177
+ h as BLOCKED_EXTENSIONS,
178
+ l as SECURE_ALLOWED_EXTENSIONS,
179
+ T as buildSecureAccept,
180
+ A as createPreview,
181
+ _ as formatFileSize,
182
+ b as getAllowedFormatsHint,
183
+ v as getFileIcon,
184
+ F as validateFileSize,
185
+ O as validateFileType
186
+ };
package/package.json CHANGED
@@ -1,23 +1,21 @@
1
1
  {
2
2
  "name": "@mci-ui/mci-ui",
3
3
  "private": false,
4
- "version": "0.0.84",
4
+ "version": "0.0.85",
5
5
  "type": "module",
6
- "main": "./dist/index.umd.js",
7
- "module": "./dist/index.es.js",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
8
  "types": "./dist/types/index.d.ts",
9
9
  "style": "./dist/index.css",
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./dist/types/index.d.ts",
13
- "import": "./dist/index.es.js",
14
- "require": "./dist/index.umd.js"
13
+ "import": "./dist/index.js"
15
14
  },
16
15
  "./style.css": "./dist/index.css"
17
16
  },
18
17
  "sideEffects": [
19
- "./dist/index.css",
20
- "./style.css"
18
+ "**/*.css"
21
19
  ],
22
20
  "files": [
23
21
  "dist"
@@ -33,7 +31,10 @@
33
31
  "preview": "vite preview",
34
32
  "format": "prettier --write ."
35
33
  },
36
- "dependencies": {},
34
+ "dependencies": {
35
+ "clsx": "^2.1.1",
36
+ "tailwind-merge": "^3.4.0"
37
+ },
37
38
  "devDependencies": {
38
39
  "@eslint/js": "^9.39.1",
39
40
  "@solar-icons/react": "^1.0.1",
@@ -62,10 +63,12 @@
62
63
  },
63
64
  "peerDependencies": {
64
65
  "react": ">=19",
65
- "react-dom": ">=19",
66
- "@solar-icons/react": "^1.0.1",
67
- "clsx": "^2.1.1",
68
- "tailwind-merge": "^3.4.0"
66
+ "react-dom": ">=19"
67
+ },
68
+ "peerDependenciesMeta": {
69
+ "@solar-icons/react": {
70
+ "optional": true
71
+ }
69
72
  },
70
73
  "description": "Minimal UI component library built with React and Tailwind CSS.",
71
74
  "keywords": [