gasp-components 1.0.21 → 1.0.22
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,67 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Typography as
|
|
3
|
-
import
|
|
4
|
-
import { useState as
|
|
5
|
-
import { FormattedNumberParts as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { D as
|
|
9
|
-
const
|
|
10
|
-
multiple:
|
|
1
|
+
import { jsxs as n, jsx as t, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { Typography as h } from "antd";
|
|
3
|
+
import O from "classnames";
|
|
4
|
+
import { useState as A, useRef as k, useEffect as v } from "react";
|
|
5
|
+
import { FormattedNumberParts as F } from "react-intl";
|
|
6
|
+
import w from "../../icons/file-icon/index.js";
|
|
7
|
+
import B from "../../icons/upload-icon/index.js";
|
|
8
|
+
import { D as j, U as L } from "../../UploadOutlined-9WKjHsqa.js";
|
|
9
|
+
const I = ({
|
|
10
|
+
multiple: m = !1,
|
|
11
11
|
onChange: c,
|
|
12
|
-
value:
|
|
13
|
-
placeholder:
|
|
12
|
+
value: p,
|
|
13
|
+
placeholder: u,
|
|
14
|
+
beforeUpload: x
|
|
14
15
|
}) => {
|
|
15
|
-
const [
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const [s, i] = A([]), d = k(null), b = (e) => {
|
|
17
|
+
var r;
|
|
18
|
+
const a = () => {
|
|
19
|
+
var l;
|
|
20
|
+
(l = e.target.files) != null && l.length && i(m ? [
|
|
21
|
+
...s,
|
|
22
|
+
...Array.from(Array(e.target.files.length)).map(
|
|
23
|
+
(o, g) => {
|
|
24
|
+
var f;
|
|
25
|
+
return (f = e.target.files) == null ? void 0 : f.item(g);
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
] : Array.from(Array(e.target.files.length)).map(
|
|
29
|
+
(o, g) => {
|
|
30
|
+
var f;
|
|
31
|
+
return (f = e.target.files) == null ? void 0 : f.item(g);
|
|
23
32
|
}
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
33
|
+
));
|
|
34
|
+
};
|
|
35
|
+
if (e.target.files && x)
|
|
36
|
+
for (let l = 0; l < (((r = e.target.files) == null ? void 0 : r.length) || 0); l++)
|
|
37
|
+
x(e.target.files[l]) && a();
|
|
38
|
+
else
|
|
39
|
+
a();
|
|
40
|
+
}, D = (e) => {
|
|
32
41
|
e.stopPropagation(), e.preventDefault(), e.currentTarget.classList.add("!border-dodgerBlue");
|
|
33
|
-
},
|
|
42
|
+
}, N = (e) => {
|
|
34
43
|
e.stopPropagation(), e.preventDefault(), e.currentTarget.classList.remove("!border-dodgerBlue");
|
|
35
|
-
},
|
|
36
|
-
var
|
|
37
|
-
e.preventDefault(), (
|
|
38
|
-
...
|
|
44
|
+
}, T = (e) => {
|
|
45
|
+
var a;
|
|
46
|
+
e.preventDefault(), (a = e.dataTransfer.files) != null && a.length && i(m ? [
|
|
47
|
+
...s,
|
|
39
48
|
...Array.from(Array(e.dataTransfer.files.length)).map(
|
|
40
|
-
(r,
|
|
41
|
-
var
|
|
42
|
-
return (
|
|
49
|
+
(r, l) => {
|
|
50
|
+
var o;
|
|
51
|
+
return (o = e.dataTransfer.files) == null ? void 0 : o.item(l);
|
|
43
52
|
}
|
|
44
53
|
)
|
|
45
54
|
] : Array.from(Array(e.dataTransfer.files.length)).map(
|
|
46
|
-
(r,
|
|
47
|
-
var
|
|
48
|
-
return (
|
|
55
|
+
(r, l) => {
|
|
56
|
+
var o;
|
|
57
|
+
return (o = e.dataTransfer.files) == null ? void 0 : o.item(l);
|
|
49
58
|
}
|
|
50
59
|
));
|
|
51
|
-
},
|
|
60
|
+
}, _ = (e, a) => {
|
|
52
61
|
e.stopPropagation();
|
|
53
62
|
const r = [
|
|
54
|
-
...
|
|
55
|
-
...
|
|
63
|
+
...s.slice(0, a),
|
|
64
|
+
...s.slice(a + 1)
|
|
56
65
|
];
|
|
57
|
-
|
|
66
|
+
i(r), c && c(r.length === 0 ? null : r), d.current && (d.current.value = "");
|
|
58
67
|
};
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
-
}, [
|
|
62
|
-
|
|
63
|
-
}, [
|
|
64
|
-
|
|
68
|
+
return v(() => {
|
|
69
|
+
p && p.length > 0 && i(p);
|
|
70
|
+
}, [p]), v(() => {
|
|
71
|
+
s.length > 0 && c && c(s);
|
|
72
|
+
}, [s, c]), /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-4", children: [
|
|
73
|
+
s.map((e, a) => /* @__PURE__ */ n(
|
|
65
74
|
"div",
|
|
66
75
|
{
|
|
67
76
|
className: "relative group basis-full max-h-48 flex items-center gap-x-3 py-12 pe-2 ps-4 bg-lightBlue rounded-2xl hover:cursor-pointer",
|
|
@@ -71,34 +80,34 @@ const C = ({
|
|
|
71
80
|
return (r = d.current) == null ? void 0 : r.click();
|
|
72
81
|
},
|
|
73
82
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ t(
|
|
75
84
|
"div",
|
|
76
85
|
{
|
|
77
86
|
className: "absolute opacity-0 group-hover:opacity-100 transition-opacity -left-2 -top-2 flex items-center justify-center text-ghostWhite bg-coral rounded-full w-6 h-6",
|
|
78
|
-
onClick: (r) =>
|
|
79
|
-
children: /* @__PURE__ */
|
|
87
|
+
onClick: (r) => _(r, a),
|
|
88
|
+
children: /* @__PURE__ */ t(j, { size: 4 })
|
|
80
89
|
}
|
|
81
90
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ t(L, { className: "flex-1 text-slateGray" }),
|
|
92
|
+
/* @__PURE__ */ n("div", { className: "flex flex-col items-end gap-y-1", children: [
|
|
93
|
+
/* @__PURE__ */ t(h.Text, { className: "text-xs font-semibold text-ellipsis overflow-hidden whitespace-nowrap", children: e.name }),
|
|
94
|
+
/* @__PURE__ */ t(h.Text, { className: "text-xs", children: /* @__PURE__ */ t(F, { value: e.size, children: (r) => /* @__PURE__ */ n(y, { children: [
|
|
86
95
|
r[0].value,
|
|
87
96
|
" Kb"
|
|
88
97
|
] }) }) })
|
|
89
98
|
] }),
|
|
90
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ t(w, {})
|
|
91
100
|
]
|
|
92
101
|
},
|
|
93
102
|
e.name
|
|
94
103
|
)),
|
|
95
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ n(
|
|
96
105
|
"div",
|
|
97
106
|
{
|
|
98
|
-
className:
|
|
107
|
+
className: O(
|
|
99
108
|
"basis-full max-h-48 flex flex-col items-center justify-center py-12 bg-ghostWhite rounded-2xl border-dashed border border-gainsboro hover:border-dodgerBlue hover:cursor-pointer transition-colors duration-200",
|
|
100
109
|
{
|
|
101
|
-
hidden: !
|
|
110
|
+
hidden: !m && s.length > 0
|
|
102
111
|
}
|
|
103
112
|
),
|
|
104
113
|
role: "button",
|
|
@@ -106,23 +115,23 @@ const C = ({
|
|
|
106
115
|
var e;
|
|
107
116
|
return (e = d.current) == null ? void 0 : e.click();
|
|
108
117
|
},
|
|
109
|
-
onDragOver:
|
|
110
|
-
onDragLeave:
|
|
111
|
-
onDrop:
|
|
118
|
+
onDragOver: D,
|
|
119
|
+
onDragLeave: N,
|
|
120
|
+
onDrop: T,
|
|
112
121
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ t(
|
|
114
123
|
"input",
|
|
115
124
|
{
|
|
116
125
|
ref: d,
|
|
117
126
|
type: "file",
|
|
118
|
-
multiple:
|
|
127
|
+
multiple: m,
|
|
119
128
|
className: "!hidden",
|
|
120
|
-
onChange:
|
|
129
|
+
onChange: b
|
|
121
130
|
}
|
|
122
131
|
),
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ t(B, {}),
|
|
133
|
+
/* @__PURE__ */ t(h.Text, { className: "mt-3 font-normal", children: u || /* @__PURE__ */ n(y, { children: [
|
|
134
|
+
/* @__PURE__ */ t("span", { className: "text-dodgerBlue", children: "click_here_to" }),
|
|
126
135
|
" ",
|
|
127
136
|
"upload_file_or_drag_and_drop"
|
|
128
137
|
] }) })
|
|
@@ -132,5 +141,5 @@ const C = ({
|
|
|
132
141
|
] });
|
|
133
142
|
};
|
|
134
143
|
export {
|
|
135
|
-
|
|
144
|
+
I as Dragger
|
|
136
145
|
};
|