alif-ui 1.15.0 → 1.15.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploader.d.ts","sourceRoot":"","sources":["../../../src/lib/components/FileUploader/FileUploader.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAQzD,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"FileUploader.d.ts","sourceRoot":"","sources":["../../../src/lib/components/FileUploader/FileUploader.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAQzD,eAAO,MAAM,YAAY,gHA0KxB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
1
|
+
import { jsx as l, jsxs as u, Fragment as q } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as G, useState as F, useRef as J, useImperativeHandle as K } from "react";
|
|
3
|
-
import { classNames as
|
|
3
|
+
import { classNames as m } from "../../utils/class-names.js";
|
|
4
4
|
import { isValidFileCount as Q, ERROR_TEXT as g, isValidFileSize as W, isValidFileType as Y } from "./FileUploader.utils.js";
|
|
5
5
|
import { useLocale as Z } from "../../providers/hooks/useLocale/useLocale.js";
|
|
6
6
|
import { OutlineSystemUploadCloud as $ } from "../../icons/components/OutlineSystemUploadCloud.js";
|
|
@@ -37,7 +37,7 @@ const te = "_root_1vel9_1", re = "_uploader_1vel9_27", oe = "_error_1vel9_38", l
|
|
|
37
37
|
}, j) => {
|
|
38
38
|
const { locale: c } = Z(), [w, d] = F(!1), [p, n] = F(""), f = J(null);
|
|
39
39
|
K(j, () => f.current);
|
|
40
|
-
const a = L === "mobile", x = E || p || S, A =
|
|
40
|
+
const a = L === "mobile", x = E || p || S, A = m(
|
|
41
41
|
t.uploader,
|
|
42
42
|
w && !o && t.dragOver,
|
|
43
43
|
(R || p) && t.error,
|
|
@@ -49,7 +49,7 @@ const te = "_root_1vel9_1", re = "_uploader_1vel9_27", oe = "_error_1vel9_38", l
|
|
|
49
49
|
if (e.preventDefault(), e.stopPropagation(), o) return;
|
|
50
50
|
d(!1);
|
|
51
51
|
const r = e.dataTransfer.files;
|
|
52
|
-
r &&
|
|
52
|
+
r && y(r);
|
|
53
53
|
}, H = (e) => {
|
|
54
54
|
e.preventDefault(), d(!0);
|
|
55
55
|
}, P = () => {
|
|
@@ -57,26 +57,26 @@ const te = "_root_1vel9_1", re = "_uploader_1vel9_27", oe = "_error_1vel9_38", l
|
|
|
57
57
|
}, X = (e) => {
|
|
58
58
|
if (o) return;
|
|
59
59
|
const r = e.target.files;
|
|
60
|
-
r && (
|
|
61
|
-
},
|
|
60
|
+
r && (y(r), e.target.value = "");
|
|
61
|
+
}, y = (e) => {
|
|
62
62
|
const r = _.length + e.length;
|
|
63
63
|
if (!Q(r, b)) {
|
|
64
64
|
n(g.maxCountText[c](b));
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
const s = Array.from(e).filter((i) => {
|
|
68
|
-
const
|
|
68
|
+
const D = W(i, h), T = Y(
|
|
69
69
|
i,
|
|
70
70
|
M,
|
|
71
71
|
z
|
|
72
72
|
);
|
|
73
|
-
return
|
|
73
|
+
return D || n(
|
|
74
74
|
g.maxFileSizeText[c](i.name, h)
|
|
75
|
-
),
|
|
75
|
+
), T || n(g.extText[c](i.name)), D && T;
|
|
76
76
|
});
|
|
77
77
|
s.length && U(s);
|
|
78
78
|
};
|
|
79
|
-
return /* @__PURE__ */ l("div", { className:
|
|
79
|
+
return /* @__PURE__ */ l("div", { className: m(t.root, I), style: { width: N }, children: /* @__PURE__ */ u(
|
|
80
80
|
"div",
|
|
81
81
|
{
|
|
82
82
|
className: a ? "" : A,
|
|
@@ -100,8 +100,8 @@ const te = "_root_1vel9_1", re = "_uploader_1vel9_27", oe = "_error_1vel9_38", l
|
|
|
100
100
|
disabled: o
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
!a && /* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ u("div", { className: t.text, children: [
|
|
104
|
+
!a && /* @__PURE__ */ u(q, { children: [
|
|
105
105
|
/* @__PURE__ */ l($, {}),
|
|
106
106
|
/* @__PURE__ */ l(
|
|
107
107
|
O,
|
|
@@ -118,7 +118,7 @@ const te = "_root_1vel9_1", re = "_uploader_1vel9_27", oe = "_error_1vel9_38", l
|
|
|
118
118
|
{
|
|
119
119
|
category: "body",
|
|
120
120
|
proportions: "m",
|
|
121
|
-
className:
|
|
121
|
+
className: m(
|
|
122
122
|
t.labelDescription,
|
|
123
123
|
p && t.error,
|
|
124
124
|
o && t.disabled
|
|
@@ -133,6 +133,7 @@ const te = "_root_1vel9_1", re = "_uploader_1vel9_27", oe = "_error_1vel9_38", l
|
|
|
133
133
|
variant: "outline",
|
|
134
134
|
className: a ? t.btnMobile : "",
|
|
135
135
|
disabled: o,
|
|
136
|
+
type: "button",
|
|
136
137
|
children: k
|
|
137
138
|
}
|
|
138
139
|
)
|