@oneplatformdev/ui 0.1.99-beta.271 → 0.1.99-beta.273
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/Dropzone/Dropzone.d.ts.map +1 -1
- package/Dropzone/Dropzone.js +214 -163
- package/Dropzone/Dropzone.js.map +1 -1
- package/Dropzone/Dropzone.stories.js +103 -65
- package/Dropzone/Dropzone.stories.js.map +1 -1
- package/Dropzone/Dropzone.types.d.ts.map +1 -1
- package/Dropzone/Dropzone.types.js +2 -1
- package/Dropzone/Dropzone.types.js.map +1 -1
- package/Dropzone/DropzoneSinglePickPreview.js +63 -60
- package/Dropzone/DropzoneSinglePickPreview.js.map +1 -1
- package/Dropzone/DropzoneUtils.d.ts +1 -0
- package/Dropzone/DropzoneUtils.d.ts.map +1 -1
- package/Dropzone/DropzoneUtils.js +17 -6
- package/Dropzone/DropzoneUtils.js.map +1 -1
- package/Dropzone/icons/file-csv.svg.js +5 -0
- package/Dropzone/icons/file-csv.svg.js.map +1 -0
- package/Dropzone/icons/file-doc.svg.js +5 -0
- package/Dropzone/icons/file-doc.svg.js.map +1 -0
- package/Dropzone/icons/file-docx.svg.js +5 -0
- package/Dropzone/icons/file-docx.svg.js.map +1 -0
- package/Dropzone/icons/file-jpg.svg.js +5 -0
- package/Dropzone/icons/file-jpg.svg.js.map +1 -0
- package/Dropzone/icons/file-pdf.svg.js +5 -0
- package/Dropzone/icons/file-pdf.svg.js.map +1 -0
- package/Dropzone/icons/file-png.svg.js +5 -0
- package/Dropzone/icons/file-png.svg.js.map +1 -0
- package/Dropzone/icons/file-ppt.svg.js +5 -0
- package/Dropzone/icons/file-ppt.svg.js.map +1 -0
- package/Dropzone/icons/file-pptx.svg.js +5 -0
- package/Dropzone/icons/file-pptx.svg.js.map +1 -0
- package/Dropzone/icons/file-rar.svg.js +5 -0
- package/Dropzone/icons/file-rar.svg.js.map +1 -0
- package/Dropzone/icons/file-svg.svg.js +5 -0
- package/Dropzone/icons/file-svg.svg.js.map +1 -0
- package/Dropzone/icons/file-webp.svg.js +5 -0
- package/Dropzone/icons/file-webp.svg.js.map +1 -0
- package/Dropzone/icons/file-xls.svg.js +5 -0
- package/Dropzone/icons/file-xls.svg.js.map +1 -0
- package/Dropzone/icons/file-xlsx.svg.js +5 -0
- package/Dropzone/icons/file-xlsx.svg.js.map +1 -0
- package/Dropzone/icons/file-zip.svg.js +5 -0
- package/Dropzone/icons/file-zip.svg.js.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropzone.d.ts","sourceRoot":"","sources":["../../src/Dropzone/Dropzone.tsx"],"names":[],"mappings":"AAQA,OAAO,EAEL,eAAe,EACf,aAAa,EAEd,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Dropzone.d.ts","sourceRoot":"","sources":["../../src/Dropzone/Dropzone.tsx"],"names":[],"mappings":"AAQA,OAAO,EAEL,eAAe,EACf,aAAa,EAEd,MAAM,kBAAkB,CAAC;AAkF1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ,2GA0bpB,CAAC"}
|
package/Dropzone/Dropzone.js
CHANGED
|
@@ -1,26 +1,63 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
-
import { X as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useDropzone as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Card as
|
|
7
|
-
import { DEFAULT_FILE_TYPES as
|
|
8
|
-
import { FilePreview as
|
|
9
|
-
import { DropzoneSinglePickPreview as
|
|
10
|
-
import { isFile as v, extractName as
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import { X as k, UploadIcon as Fe, FileTextIcon as Z, InfoIcon as ve } from "lucide-react";
|
|
3
|
+
import { forwardRef as ye, useState as G, useEffect as Ie, useImperativeHandle as be } from "react";
|
|
4
|
+
import { useDropzone as Ce } from "react-dropzone";
|
|
5
|
+
import { cn as p } from "@oneplatformdev/utils";
|
|
6
|
+
import { Card as ze } from "../Card/Card.js";
|
|
7
|
+
import { DEFAULT_FILE_TYPES as Ee } from "./Dropzone.types.js";
|
|
8
|
+
import { FilePreview as De } from "./DropzoneFilePreview.js";
|
|
9
|
+
import { DropzoneSinglePickPreview as je } from "./DropzoneSinglePickPreview.js";
|
|
10
|
+
import { isFile as v, isVideoUrl as Me, extractName as Se } from "./DropzoneUtils.js";
|
|
11
|
+
import Be from "./icons/file-csv.svg.js";
|
|
12
|
+
import ke from "./icons/file-doc.svg.js";
|
|
13
|
+
import Re from "./icons/file-docx.svg.js";
|
|
14
|
+
import K from "./icons/file-jpg.svg.js";
|
|
15
|
+
import Ae from "./icons/file-pdf.svg.js";
|
|
16
|
+
import We from "./icons/file-png.svg.js";
|
|
17
|
+
import _e from "./icons/file-ppt.svg.js";
|
|
18
|
+
import Pe from "./icons/file-pptx.svg.js";
|
|
19
|
+
import Te from "./icons/file-rar.svg.js";
|
|
20
|
+
import Xe from "./icons/file-svg.svg.js";
|
|
21
|
+
import $e from "./icons/file-webp.svg.js";
|
|
22
|
+
import Le from "./icons/file-xls.svg.js";
|
|
23
|
+
import Oe from "./icons/file-xlsx.svg.js";
|
|
24
|
+
import qe from "./icons/file-zip.svg.js";
|
|
25
|
+
import { Button as He } from "../Button/Button.js";
|
|
26
|
+
const Q = (r = 0) => `${(r / (1024 * 1024)).toFixed(0)} MB`, Je = {
|
|
27
|
+
csv: Be,
|
|
28
|
+
doc: ke,
|
|
29
|
+
docx: Re,
|
|
30
|
+
jpg: K,
|
|
31
|
+
jpeg: K,
|
|
32
|
+
pdf: Ae,
|
|
33
|
+
png: We,
|
|
34
|
+
ppt: _e,
|
|
35
|
+
pptx: Pe,
|
|
36
|
+
rar: Te,
|
|
37
|
+
svg: Xe,
|
|
38
|
+
webp: $e,
|
|
39
|
+
xls: Le,
|
|
40
|
+
xlsx: Oe,
|
|
41
|
+
zip: qe
|
|
42
|
+
}, Ye = (r) => {
|
|
43
|
+
if (!r) return "";
|
|
44
|
+
const s = r.toLowerCase().split(".");
|
|
45
|
+
return s.length > 1 ? s[s.length - 1] : "";
|
|
46
|
+
}, Ze = (r) => {
|
|
47
|
+
const s = Ye(r);
|
|
48
|
+
return Je[s] ?? null;
|
|
49
|
+
}, Ge = (r, s) => {
|
|
50
|
+
if (r === s) return !0;
|
|
51
|
+
if (r.length !== s.length) return !1;
|
|
52
|
+
for (let x = 0; x < r.length; x++) {
|
|
53
|
+
const a = r[x], m = s[x];
|
|
54
|
+
if (a !== m) {
|
|
55
|
+
if (typeof a == "string" && typeof m == "string") {
|
|
56
|
+
if (a !== m) return !1;
|
|
20
57
|
continue;
|
|
21
58
|
}
|
|
22
|
-
if (v(
|
|
23
|
-
if (
|
|
59
|
+
if (v(a) && v(m)) {
|
|
60
|
+
if (a.name !== m.name || a.size !== m.size || a.type !== m.type || a.lastModified !== m.lastModified)
|
|
24
61
|
return !1;
|
|
25
62
|
continue;
|
|
26
63
|
}
|
|
@@ -28,113 +65,113 @@ const K = (f = 0) => `${(f / (1024 * 1024)).toFixed(0)} MB`, Me = (f, u) => {
|
|
|
28
65
|
}
|
|
29
66
|
}
|
|
30
67
|
return !0;
|
|
31
|
-
},
|
|
68
|
+
}, Ke = ye(
|
|
32
69
|
({
|
|
33
|
-
acceptTypes:
|
|
34
|
-
maxSizeMB:
|
|
35
|
-
maxFiles:
|
|
36
|
-
onErrors:
|
|
37
|
-
hideErrors:
|
|
38
|
-
disabled:
|
|
39
|
-
classNames:
|
|
40
|
-
value:
|
|
41
|
-
onChangeValue:
|
|
42
|
-
className:
|
|
70
|
+
acceptTypes: r = Ee,
|
|
71
|
+
maxSizeMB: s,
|
|
72
|
+
maxFiles: x = 1,
|
|
73
|
+
onErrors: a,
|
|
74
|
+
hideErrors: m = !1,
|
|
75
|
+
disabled: d = !1,
|
|
76
|
+
classNames: y,
|
|
77
|
+
value: w,
|
|
78
|
+
onChangeValue: R,
|
|
79
|
+
className: U,
|
|
43
80
|
labelDropzonePrompt: C = "Drop files here or click to select",
|
|
44
|
-
labelDropzoneSubPrompt:
|
|
45
|
-
labelOrClickToSelect:
|
|
46
|
-
labelSelectedFiles:
|
|
47
|
-
labelUploadErrors:
|
|
48
|
-
labelFileTooLarge:
|
|
49
|
-
labelInvalidFileType:
|
|
50
|
-
labelVideoUploaded:
|
|
51
|
-
labelVideoReplace:
|
|
81
|
+
labelDropzoneSubPrompt: V = "",
|
|
82
|
+
labelOrClickToSelect: ee = "Upload file",
|
|
83
|
+
labelSelectedFiles: te = "Selected Files",
|
|
84
|
+
labelUploadErrors: le = "Upload Errors",
|
|
85
|
+
labelFileTooLarge: A = "File is too large",
|
|
86
|
+
labelInvalidFileType: W = "Invalid file type",
|
|
87
|
+
labelVideoUploaded: ie = "Uploaded",
|
|
88
|
+
labelVideoReplace: re = "Replace",
|
|
52
89
|
singlePick: n = !1,
|
|
53
|
-
labelDropzoneClassname:
|
|
54
|
-
labelDropzoneSubClassname:
|
|
55
|
-
isUploading:
|
|
56
|
-
uploadProgress:
|
|
57
|
-
uploadLoadedBytes:
|
|
58
|
-
uploadTotalBytes:
|
|
59
|
-
onCancelUpload:
|
|
60
|
-
labelUploadingTitle:
|
|
61
|
-
labelUploadingHint:
|
|
62
|
-
labelUploadingActionCancel:
|
|
63
|
-
persistentDropzone:
|
|
64
|
-
previewVariant:
|
|
90
|
+
labelDropzoneClassname: ne,
|
|
91
|
+
labelDropzoneSubClassname: oe,
|
|
92
|
+
isUploading: f = !1,
|
|
93
|
+
uploadProgress: _ = 0,
|
|
94
|
+
uploadLoadedBytes: se = 0,
|
|
95
|
+
uploadTotalBytes: ce = 0,
|
|
96
|
+
onCancelUpload: P,
|
|
97
|
+
labelUploadingTitle: ae = "Uploading video...",
|
|
98
|
+
labelUploadingHint: me = "Please do not close this page",
|
|
99
|
+
labelUploadingActionCancel: de = "Cancel",
|
|
100
|
+
persistentDropzone: T = !1,
|
|
101
|
+
previewVariant: N = "default",
|
|
65
102
|
...z
|
|
66
|
-
},
|
|
67
|
-
const [i,
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
103
|
+
}, fe) => {
|
|
104
|
+
const [i, I] = G(w ?? []), [h, X] = G([]), g = i[0], E = h[0]?.file, pe = !!E?.type?.includes("image"), D = n && i.length > 0 && v(g), xe = D && g.type.includes("image"), $ = D && g.type.includes("video") || n && i.length > 0 && typeof g == "string" && Me(g), L = D && !xe && !$, O = n && !i.length && !!E && !pe, u = L ? g : E, b = Ze(u?.name), j = n && $, he = j, M = n && i.length > 0, ue = (t, c) => {
|
|
105
|
+
X(c), a?.(c);
|
|
106
|
+
const o = n ? t.slice(0, 1) : [...i, ...t].slice(0, x);
|
|
107
|
+
I(o), R?.(o);
|
|
71
108
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, [i,
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
109
|
+
Ie(() => {
|
|
110
|
+
w && !Ge(i, w) && I(w);
|
|
111
|
+
}, [i, w]);
|
|
112
|
+
const S = (t, c) => {
|
|
113
|
+
if (d) return;
|
|
77
114
|
t.stopPropagation();
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
}, { getRootProps:
|
|
81
|
-
onDrop:
|
|
82
|
-
accept:
|
|
83
|
-
maxSize:
|
|
84
|
-
maxFiles: n ? 1 :
|
|
85
|
-
disabled:
|
|
115
|
+
const o = i.filter((F, B) => B !== c);
|
|
116
|
+
I(o), R?.(o);
|
|
117
|
+
}, { getRootProps: ge, getInputProps: we, isDragActive: Ne, open: q } = Ce({
|
|
118
|
+
onDrop: ue,
|
|
119
|
+
accept: r.reduce((t, c) => (t[c] = [], t), {}),
|
|
120
|
+
maxSize: s * 1024 * 1024,
|
|
121
|
+
maxFiles: n ? 1 : x,
|
|
122
|
+
disabled: d || f,
|
|
86
123
|
noClick: !0
|
|
87
124
|
});
|
|
88
|
-
|
|
89
|
-
setItems:
|
|
125
|
+
be(fe, () => ({
|
|
126
|
+
setItems: I
|
|
90
127
|
}), []);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
128
|
+
const H = !f && !n && T && i.length > 0, J = !f && !n && i.length > 0 && /* @__PURE__ */ l("div", { className: p("w-full mt-2", y?.previewWrapper), children: [
|
|
129
|
+
N === "default" && /* @__PURE__ */ l("pre", { className: "font-semibold text-gray-600", children: [
|
|
130
|
+
te,
|
|
94
131
|
":"
|
|
95
132
|
] }),
|
|
96
133
|
/* @__PURE__ */ e(
|
|
97
134
|
"ul",
|
|
98
135
|
{
|
|
99
|
-
className:
|
|
136
|
+
className: p(
|
|
100
137
|
"mt-2 text-sm text-gray-500 flex flex-wrap items-start",
|
|
101
|
-
|
|
138
|
+
N === "image-grid" ? "gap-2 justify-start" : "gap-4 justify-center"
|
|
102
139
|
),
|
|
103
|
-
children: i.map((t,
|
|
104
|
-
const
|
|
140
|
+
children: i.map((t, c) => {
|
|
141
|
+
const o = v(t) ? t.name : Se(t), F = v(t) ? (t.size / (1024 * 1024)).toFixed(2) + " MB" : "";
|
|
105
142
|
return /* @__PURE__ */ l(
|
|
106
143
|
"li",
|
|
107
144
|
{
|
|
108
|
-
className:
|
|
145
|
+
className: p(
|
|
109
146
|
"relative",
|
|
110
|
-
|
|
147
|
+
N === "image-grid" ? "w-[75px] h-[75px]" : "flex flex-col items-center gap-2"
|
|
111
148
|
),
|
|
112
149
|
children: [
|
|
113
150
|
/* @__PURE__ */ l("div", { className: "relative w-full h-full", children: [
|
|
114
|
-
/* @__PURE__ */ e(
|
|
151
|
+
/* @__PURE__ */ e(De, { item: t, styles: y }),
|
|
115
152
|
/* @__PURE__ */ e(
|
|
116
153
|
"div",
|
|
117
154
|
{
|
|
118
|
-
className:
|
|
155
|
+
className: p(
|
|
119
156
|
"absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm",
|
|
120
|
-
|
|
157
|
+
N === "image-grid" && "top-1 right-1 bg-white/90 rounded-full p-0.5"
|
|
121
158
|
),
|
|
122
|
-
onClick: (
|
|
123
|
-
children: /* @__PURE__ */ e(
|
|
159
|
+
onClick: (B) => S(B, c),
|
|
160
|
+
children: /* @__PURE__ */ e(k, { size: 16, strokeWidth: 1, color: "black" })
|
|
124
161
|
}
|
|
125
162
|
)
|
|
126
163
|
] }),
|
|
127
|
-
|
|
128
|
-
/* @__PURE__ */ e("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children:
|
|
129
|
-
|
|
164
|
+
N === "default" && /* @__PURE__ */ l("span", { className: "inline-flex flex-col items-center", children: [
|
|
165
|
+
/* @__PURE__ */ e("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children: o }),
|
|
166
|
+
F && /* @__PURE__ */ l("span", { children: [
|
|
130
167
|
"(",
|
|
131
|
-
|
|
168
|
+
F,
|
|
132
169
|
")"
|
|
133
170
|
] })
|
|
134
171
|
] })
|
|
135
172
|
]
|
|
136
173
|
},
|
|
137
|
-
|
|
174
|
+
c
|
|
138
175
|
);
|
|
139
176
|
})
|
|
140
177
|
}
|
|
@@ -142,35 +179,35 @@ const K = (f = 0) => `${(f / (1024 * 1024)).toFixed(0)} MB`, Me = (f, u) => {
|
|
|
142
179
|
] });
|
|
143
180
|
return /* @__PURE__ */ l("div", { className: "w-full", children: [
|
|
144
181
|
/* @__PURE__ */ l(
|
|
145
|
-
|
|
182
|
+
ze,
|
|
146
183
|
{
|
|
147
184
|
...z,
|
|
148
|
-
...
|
|
185
|
+
...ge({
|
|
149
186
|
onClick: (t) => {
|
|
150
|
-
if (!(
|
|
151
|
-
if (
|
|
187
|
+
if (!(d || f)) {
|
|
188
|
+
if (he) {
|
|
152
189
|
z.onClick?.(t);
|
|
153
190
|
return;
|
|
154
191
|
}
|
|
155
|
-
|
|
192
|
+
q(), z.onClick?.(t);
|
|
156
193
|
}
|
|
157
194
|
}
|
|
158
195
|
}),
|
|
159
|
-
className:
|
|
196
|
+
className: p(
|
|
160
197
|
"w-full text-center flex flex-col items-center justify-center gap-6 cursor-pointer",
|
|
161
|
-
!
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
198
|
+
!M && "border border-dashed border-[#9368FF80] rounded-[8px] bg-[#FCFCFC] p-4",
|
|
199
|
+
M && "min-h-0 border-0 bg-transparent p-0",
|
|
200
|
+
d && "border-[#E4E4E7] pointer-events-none",
|
|
201
|
+
h.length > 0 && !M && "border-red-500",
|
|
202
|
+
Ne && "bg-gray-100",
|
|
166
203
|
n && "shadow-none!",
|
|
167
|
-
n && i.length > 0 && !
|
|
168
|
-
|
|
169
|
-
|
|
204
|
+
n && i.length > 0 && !j && "p-0! shadow-none!",
|
|
205
|
+
j && "h-auto! max-h-none! min-h-0! p-2!",
|
|
206
|
+
U
|
|
170
207
|
),
|
|
171
208
|
children: [
|
|
172
|
-
/* @__PURE__ */ e("input", { ...
|
|
173
|
-
|
|
209
|
+
/* @__PURE__ */ e("input", { ...we() }),
|
|
210
|
+
f && /* @__PURE__ */ l(
|
|
174
211
|
"div",
|
|
175
212
|
{
|
|
176
213
|
className: "w-full h-full min-h-46 rounded-lg border border-[#E4E4E7] bg-[#FCFCFC] flex flex-col items-center justify-center gap-4 p-4",
|
|
@@ -179,56 +216,56 @@ const K = (f = 0) => `${(f / (1024 * 1024)).toFixed(0)} MB`, Me = (f, u) => {
|
|
|
179
216
|
/* @__PURE__ */ l("div", { className: "relative h-24 w-24", children: [
|
|
180
217
|
/* @__PURE__ */ e("svg", { className: "h-24 w-24", viewBox: "0 0 100 100", children: /* @__PURE__ */ e("circle", { cx: "50", cy: "50", r: "42", stroke: "#E6E1F5", strokeWidth: "8", fill: "none" }) }),
|
|
181
218
|
/* @__PURE__ */ l("span", { className: "absolute inset-0 flex items-center justify-center text-lg font-semibold text-foreground", children: [
|
|
182
|
-
Math.max(0, Math.min(100, Math.round(
|
|
219
|
+
Math.max(0, Math.min(100, Math.round(_))),
|
|
183
220
|
"%"
|
|
184
221
|
] })
|
|
185
222
|
] }),
|
|
186
223
|
/* @__PURE__ */ l("div", { className: "text-center", children: [
|
|
187
|
-
/* @__PURE__ */ e("p", { className: "text-xl font-semibold text-foreground", children:
|
|
224
|
+
/* @__PURE__ */ e("p", { className: "text-xl font-semibold text-foreground", children: ae }),
|
|
188
225
|
/* @__PURE__ */ l("p", { className: "text-sm text-[#666A78]", children: [
|
|
189
|
-
|
|
226
|
+
Q(se),
|
|
190
227
|
" of ",
|
|
191
|
-
|
|
228
|
+
Q(ce)
|
|
192
229
|
] }),
|
|
193
|
-
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-[#666A78]", children:
|
|
230
|
+
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-[#666A78]", children: me })
|
|
194
231
|
] }),
|
|
195
232
|
/* @__PURE__ */ e("div", { className: "w-full max-w-[520px] h-2 rounded-full bg-[#E6E1F5] overflow-hidden", children: /* @__PURE__ */ e(
|
|
196
233
|
"div",
|
|
197
234
|
{
|
|
198
235
|
className: "h-full bg-[#9368FF] transition-[width] duration-150 ease-linear",
|
|
199
|
-
style: { width: `${Math.max(0, Math.min(100,
|
|
236
|
+
style: { width: `${Math.max(0, Math.min(100, _))}%` }
|
|
200
237
|
}
|
|
201
238
|
) }),
|
|
202
|
-
|
|
239
|
+
P && /* @__PURE__ */ e(
|
|
203
240
|
"button",
|
|
204
241
|
{
|
|
205
242
|
type: "button",
|
|
206
243
|
className: "mt-1 h-10 min-w-36 rounded-md border border-[#E4E4E7] bg-white px-6 text-base font-medium text-foreground cursor-pointer",
|
|
207
244
|
onClick: (t) => {
|
|
208
|
-
t.stopPropagation(),
|
|
245
|
+
t.stopPropagation(), P();
|
|
209
246
|
},
|
|
210
|
-
children:
|
|
247
|
+
children: de
|
|
211
248
|
}
|
|
212
249
|
)
|
|
213
250
|
]
|
|
214
251
|
}
|
|
215
252
|
),
|
|
216
|
-
!
|
|
253
|
+
!f && (i.length === 0 || !n && T) && h.length === 0 && /* @__PURE__ */ l(
|
|
217
254
|
"div",
|
|
218
255
|
{
|
|
219
|
-
className:
|
|
256
|
+
className: p(
|
|
220
257
|
"flex flex-col items-center gap-2 w-full",
|
|
221
|
-
|
|
258
|
+
y?.idleWrapper
|
|
222
259
|
),
|
|
223
260
|
children: [
|
|
224
|
-
/* @__PURE__ */ e("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(
|
|
225
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-1 w-full", children: !
|
|
261
|
+
/* @__PURE__ */ e("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#9368FF1F]", children: /* @__PURE__ */ e(Fe, { className: "size-6 text-[#9368FF]" }) }),
|
|
262
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-1 w-full", children: !d && /* @__PURE__ */ l(Y, { children: [
|
|
226
263
|
/* @__PURE__ */ e(
|
|
227
264
|
"span",
|
|
228
265
|
{
|
|
229
|
-
className:
|
|
266
|
+
className: p(
|
|
230
267
|
"font-semibold text-[14px] leading-[125%] text-[#06080D] text-center w-full whitespace-pre-line",
|
|
231
|
-
|
|
268
|
+
ne
|
|
232
269
|
),
|
|
233
270
|
children: C
|
|
234
271
|
}
|
|
@@ -236,43 +273,43 @@ const K = (f = 0) => `${(f / (1024 * 1024)).toFixed(0)} MB`, Me = (f, u) => {
|
|
|
236
273
|
/* @__PURE__ */ e(
|
|
237
274
|
"span",
|
|
238
275
|
{
|
|
239
|
-
className:
|
|
276
|
+
className: p(
|
|
240
277
|
"font-medium text-[12px] leading-[120%] text-[#666A78] text-center w-full whitespace-pre-line",
|
|
241
|
-
|
|
278
|
+
oe
|
|
242
279
|
),
|
|
243
|
-
children:
|
|
280
|
+
children: V
|
|
244
281
|
}
|
|
245
282
|
)
|
|
246
283
|
] }) }),
|
|
247
|
-
!
|
|
248
|
-
|
|
284
|
+
!d && /* @__PURE__ */ e(
|
|
285
|
+
He,
|
|
249
286
|
{
|
|
250
287
|
type: "button",
|
|
251
288
|
size: "md",
|
|
252
|
-
children:
|
|
289
|
+
children: ee
|
|
253
290
|
}
|
|
254
291
|
)
|
|
255
292
|
]
|
|
256
293
|
}
|
|
257
294
|
),
|
|
258
|
-
!
|
|
295
|
+
!f && h.length > 0 && !O && /* @__PURE__ */ l("div", { className: p("w-full mt-4", y?.errorWrapper), children: [
|
|
259
296
|
/* @__PURE__ */ l("span", { className: "font-semibold text-red-500", children: [
|
|
260
|
-
|
|
297
|
+
le,
|
|
261
298
|
":"
|
|
262
299
|
] }),
|
|
263
|
-
/* @__PURE__ */ e("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children:
|
|
300
|
+
/* @__PURE__ */ e("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children: h.map((t, c) => /* @__PURE__ */ l("li", { children: [
|
|
264
301
|
t.file.name,
|
|
265
302
|
" (",
|
|
266
303
|
(t.file.size / (1024 * 1024)).toFixed(2),
|
|
267
304
|
" MB)",
|
|
268
|
-
!
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
] },
|
|
273
|
-
] },
|
|
305
|
+
!m && /* @__PURE__ */ e("ul", { className: "ml-4 list-disc list-inside", children: t.errors.map((o, F) => /* @__PURE__ */ l("li", { children: [
|
|
306
|
+
o.code === "file-too-large" && A,
|
|
307
|
+
o.code === "file-invalid-type" && W,
|
|
308
|
+
o.code !== "file-too-large" && o.code !== "file-invalid-type" && o.message
|
|
309
|
+
] }, F)) })
|
|
310
|
+
] }, c)) })
|
|
274
311
|
] }),
|
|
275
|
-
!
|
|
312
|
+
!f && !!(n && i.length) && /* @__PURE__ */ e(Y, { children: L ? /* @__PURE__ */ l(
|
|
276
313
|
"div",
|
|
277
314
|
{
|
|
278
315
|
className: "w-full max-w-[502px] flex flex-col items-center gap-4",
|
|
@@ -280,36 +317,43 @@ const K = (f = 0) => `${(f / (1024 * 1024)).toFixed(0)} MB`, Me = (f, u) => {
|
|
|
280
317
|
children: [
|
|
281
318
|
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children: C }),
|
|
282
319
|
/* @__PURE__ */ l("div", { className: "w-full min-h-[72px] rounded-[8px] bg-[#F5F5F5] p-4 flex items-center gap-4", children: [
|
|
283
|
-
|
|
320
|
+
b ? /* @__PURE__ */ e(
|
|
321
|
+
"img",
|
|
322
|
+
{
|
|
323
|
+
src: b,
|
|
324
|
+
alt: "",
|
|
325
|
+
className: "size-10 shrink-0"
|
|
326
|
+
}
|
|
327
|
+
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(Z, { size: 20 }) }),
|
|
284
328
|
/* @__PURE__ */ l("div", { className: "flex flex-col items-start text-left gap-1 min-w-0 flex-1", children: [
|
|
285
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children:
|
|
286
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children:
|
|
329
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children: u?.name }),
|
|
330
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children: u ? `${(u.size / (1024 * 1024)).toFixed(0)} MB` : "" })
|
|
287
331
|
] }),
|
|
288
|
-
!
|
|
332
|
+
!d && /* @__PURE__ */ e(
|
|
289
333
|
"div",
|
|
290
334
|
{
|
|
291
335
|
className: "size-6 flex items-center justify-center cursor-pointer",
|
|
292
|
-
onClick: (t) =>
|
|
293
|
-
children: /* @__PURE__ */ e(
|
|
336
|
+
onClick: (t) => S(t, 0),
|
|
337
|
+
children: /* @__PURE__ */ e(k, { size: 24, color: "#06080D" })
|
|
294
338
|
}
|
|
295
339
|
)
|
|
296
340
|
] })
|
|
297
341
|
]
|
|
298
342
|
}
|
|
299
343
|
) : /* @__PURE__ */ e(
|
|
300
|
-
|
|
344
|
+
je,
|
|
301
345
|
{
|
|
302
346
|
item: i[0],
|
|
303
|
-
onRemoveClick: (t) =>
|
|
347
|
+
onRemoveClick: (t) => S(t, 0),
|
|
304
348
|
onReplaceClick: (t) => {
|
|
305
|
-
t.stopPropagation(), !
|
|
349
|
+
t.stopPropagation(), !d && q();
|
|
306
350
|
},
|
|
307
|
-
labelUploaded:
|
|
308
|
-
labelReplace:
|
|
309
|
-
disabled:
|
|
351
|
+
labelUploaded: ie,
|
|
352
|
+
labelReplace: re,
|
|
353
|
+
disabled: d
|
|
310
354
|
}
|
|
311
355
|
) }),
|
|
312
|
-
!
|
|
356
|
+
!f && O && /* @__PURE__ */ l(
|
|
313
357
|
"div",
|
|
314
358
|
{
|
|
315
359
|
className: "w-full max-w-[502px] flex flex-col items-center gap-4",
|
|
@@ -317,39 +361,46 @@ const K = (f = 0) => `${(f / (1024 * 1024)).toFixed(0)} MB`, Me = (f, u) => {
|
|
|
317
361
|
children: [
|
|
318
362
|
/* @__PURE__ */ e("p", { className: "w-full text-center text-[16px] leading-[130%] font-semibold text-[#06080D]", children: C }),
|
|
319
363
|
/* @__PURE__ */ l("div", { className: "w-full min-h-[72px] rounded-[8px] bg-[#F5F5F5] p-4 flex items-center gap-4", children: [
|
|
320
|
-
|
|
364
|
+
b ? /* @__PURE__ */ e(
|
|
365
|
+
"img",
|
|
366
|
+
{
|
|
367
|
+
src: b,
|
|
368
|
+
alt: "",
|
|
369
|
+
className: "size-10 shrink-0"
|
|
370
|
+
}
|
|
371
|
+
) : /* @__PURE__ */ e("div", { className: "size-10 rounded-[8px] bg-[#DC2626] text-white flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(Z, { size: 20 }) }),
|
|
321
372
|
/* @__PURE__ */ l("div", { className: "flex flex-col items-start text-left gap-1 min-w-0 flex-1", children: [
|
|
322
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children:
|
|
323
|
-
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children:
|
|
373
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[14px] font-semibold leading-[125%] text-[#06080D] truncate", children: u?.name }),
|
|
374
|
+
/* @__PURE__ */ e("span", { className: "w-full text-[12px] font-medium leading-[120%] text-[#666A78]", children: u ? `${(u.size / (1024 * 1024)).toFixed(0)} MB` : "" })
|
|
324
375
|
] }),
|
|
325
|
-
!
|
|
376
|
+
!d && /* @__PURE__ */ e(
|
|
326
377
|
"div",
|
|
327
378
|
{
|
|
328
379
|
className: "size-6 flex items-center justify-center cursor-pointer",
|
|
329
380
|
onClick: (t) => {
|
|
330
|
-
t.stopPropagation(),
|
|
381
|
+
t.stopPropagation(), X([]);
|
|
331
382
|
},
|
|
332
|
-
children: /* @__PURE__ */ e(
|
|
383
|
+
children: /* @__PURE__ */ e(k, { size: 24, color: "#06080D" })
|
|
333
384
|
}
|
|
334
385
|
)
|
|
335
386
|
] }),
|
|
336
387
|
/* @__PURE__ */ l("div", { className: "w-full bg-[#DC26260F] p-4 flex items-start gap-4", children: [
|
|
337
|
-
/* @__PURE__ */ e(
|
|
338
|
-
/* @__PURE__ */ e("p", { className: "text-[12px] leading-[120%] font-medium text-[#DC2626] text-left", children:
|
|
388
|
+
/* @__PURE__ */ e(ve, { size: 20, color: "#DC2626" }),
|
|
389
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] leading-[120%] font-medium text-[#DC2626] text-left", children: h[0]?.errors?.[0]?.code === "file-too-large" ? A : h[0]?.errors?.[0]?.message || W })
|
|
339
390
|
] })
|
|
340
391
|
]
|
|
341
392
|
}
|
|
342
393
|
),
|
|
343
|
-
!
|
|
394
|
+
!H && J
|
|
344
395
|
]
|
|
345
396
|
}
|
|
346
397
|
),
|
|
347
|
-
|
|
398
|
+
H && /* @__PURE__ */ e("div", { className: "w-full", children: J })
|
|
348
399
|
] });
|
|
349
400
|
}
|
|
350
401
|
);
|
|
351
|
-
|
|
402
|
+
Ke.displayName = "Dropzone";
|
|
352
403
|
export {
|
|
353
|
-
|
|
404
|
+
Ke as Dropzone
|
|
354
405
|
};
|
|
355
406
|
//# sourceMappingURL=Dropzone.js.map
|