ics-ui-kit 0.1.6 → 0.1.7
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/components/file-upload/FileUpload.d.ts +1 -0
- package/dist/components/file-upload/FileUpload.stories.d.ts +1 -0
- package/dist/components/file-upload/components/file-upload-compact-input-zone/FileUploadCompactInputZone.d.ts +1 -1
- package/dist/components/file-upload/components/file-upload-input-zone/FileUploadInputZone.d.ts +1 -1
- package/dist/components/file-upload/components/file-upload-item/FileUploadItem.d.ts +2 -0
- package/dist/components/file-upload/components/file-upload-item/FileUploadItem.stories.d.ts +1 -0
- package/dist/components/file-upload/components/file-upload-item-compact/FileUploadItemCompact.d.ts +2 -0
- package/dist/components/file-upload/components/file-upload-item-compact/FileUploadItemCompact.stories.d.ts +1 -0
- package/dist/components/file-upload/file-upload-compact/FileUploadCompact.d.ts +1 -0
- package/dist/components/file-upload/file-upload-compact/FileUploadCompact.stories.d.ts +1 -0
- package/dist/components/file-upload.js +194 -185
- package/dist/components/file-upload.js.map +1 -1
- package/dist/components/resizable/components/ResizableCornerIcon.d.ts +3 -0
- package/dist/components/resizable/components/ResizableCornerIcon.stories.d.ts +7 -0
- package/dist/components/resizable/index.d.ts +1 -0
- package/dist/components/resizable.js +255 -232
- package/dist/components/resizable.js.map +1 -1
- package/dist/formatBytes-C4QXq5lC.js +9 -0
- package/dist/formatBytes-C4QXq5lC.js.map +1 -0
- package/dist/hooks/use-file-upload.js +1 -1
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils.js +4 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles-scoped.css +8 -2
- package/dist/styles.css +8 -2
- package/dist/useFileUpload-Bnl3P8mP.js +193 -0
- package/dist/useFileUpload-Bnl3P8mP.js.map +1 -0
- package/package.json +1 -1
- package/tailwind.preset.js +2 -2
- package/dist/useFileUpload-iDag0iqM.js +0 -197
- package/dist/useFileUpload-iDag0iqM.js.map +0 -1
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
1
|
+
import { jsx as a, jsxs as m, Fragment as Y } from "react/jsx-runtime";
|
|
2
2
|
import { I as C } from "../IconButton-DwkpNgn3.js";
|
|
3
|
-
import { f as
|
|
4
|
-
import U, { useMemo as V, useCallback as
|
|
5
|
-
import { T as
|
|
3
|
+
import { f as S } from "../formatBytes-C4QXq5lC.js";
|
|
4
|
+
import U, { useMemo as V, useCallback as R } from "react";
|
|
5
|
+
import { T as b } from "../index-BVqs-uqP.js";
|
|
6
6
|
import { F as q } from "../FeatureIcon-BGE0Orkc.js";
|
|
7
|
-
import { c as
|
|
8
|
-
import { I as
|
|
7
|
+
import { c as F } from "../createLucideIcon-DwBrHnj9.js";
|
|
8
|
+
import { I as ee } from "../image-BqL5JP90.js";
|
|
9
9
|
import { T as B } from "../TextOverflowTooltip-DlUgic5y.js";
|
|
10
10
|
import { D as Z } from "../download-BHsj218e.js";
|
|
11
11
|
import { X as L } from "../x-tDTt7hTQ.js";
|
|
12
|
-
import { A as
|
|
13
|
-
import { C as
|
|
14
|
-
import { B as
|
|
12
|
+
import { A as ae, b as te, a as re } from "../AlertIcon-5B6AgZpe.js";
|
|
13
|
+
import { C as oe } from "../circle-alert-CVIokIC7.js";
|
|
14
|
+
import { B as ie } from "../Button-Dg89xRSi.js";
|
|
15
15
|
import { I as se } from "../Icon-DH3ev9GK.js";
|
|
16
|
+
import { u as E } from "../useFileUpload-Bnl3P8mP.js";
|
|
16
17
|
/**
|
|
17
18
|
* @license lucide-react v0.460.0 - ISC
|
|
18
19
|
*
|
|
19
20
|
* This source code is licensed under the ISC license.
|
|
20
21
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
22
|
*/
|
|
22
|
-
const
|
|
23
|
+
const ne = F("FileArchive", [
|
|
23
24
|
["path", { d: "M10 12v-1", key: "v7bkov" }],
|
|
24
25
|
["path", { d: "M10 18v-2", key: "1cjy8d" }],
|
|
25
26
|
["path", { d: "M10 7V6", key: "dljcrl" }],
|
|
@@ -36,7 +37,7 @@ const ie = v("FileArchive", [
|
|
|
36
37
|
* This source code is licensed under the ISC license.
|
|
37
38
|
* See the LICENSE file in the root directory of this source tree.
|
|
38
39
|
*/
|
|
39
|
-
const le =
|
|
40
|
+
const le = F("FileSpreadsheet", [
|
|
40
41
|
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
41
42
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
42
43
|
["path", { d: "M8 13h2", key: "yr2amv" }],
|
|
@@ -50,7 +51,7 @@ const le = v("FileSpreadsheet", [
|
|
|
50
51
|
* This source code is licensed under the ISC license.
|
|
51
52
|
* See the LICENSE file in the root directory of this source tree.
|
|
52
53
|
*/
|
|
53
|
-
const
|
|
54
|
+
const de = F("FileText", [
|
|
54
55
|
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
55
56
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
56
57
|
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
@@ -63,7 +64,7 @@ const ne = v("FileText", [
|
|
|
63
64
|
* This source code is licensed under the ISC license.
|
|
64
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
65
66
|
*/
|
|
66
|
-
const
|
|
67
|
+
const ce = F("File", [
|
|
67
68
|
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
68
69
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }]
|
|
69
70
|
]);
|
|
@@ -73,7 +74,7 @@ const de = v("File", [
|
|
|
73
74
|
* This source code is licensed under the ISC license.
|
|
74
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
75
76
|
*/
|
|
76
|
-
const
|
|
77
|
+
const pe = F("Headphones", [
|
|
77
78
|
[
|
|
78
79
|
"path",
|
|
79
80
|
{
|
|
@@ -88,7 +89,7 @@ const ce = v("Headphones", [
|
|
|
88
89
|
* This source code is licensed under the ISC license.
|
|
89
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
90
91
|
*/
|
|
91
|
-
const
|
|
92
|
+
const O = F("Upload", [
|
|
92
93
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
93
94
|
["polyline", { points: "17 8 12 3 7 8", key: "t8dd8p" }],
|
|
94
95
|
["line", { x1: "12", x2: "12", y1: "3", y2: "15", key: "widbto" }]
|
|
@@ -99,7 +100,7 @@ const E = v("Upload", [
|
|
|
99
100
|
* This source code is licensed under the ISC license.
|
|
100
101
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
102
|
*/
|
|
102
|
-
const
|
|
103
|
+
const me = F("Video", [
|
|
103
104
|
[
|
|
104
105
|
"path",
|
|
105
106
|
{
|
|
@@ -108,35 +109,35 @@ const pe = v("Video", [
|
|
|
108
109
|
}
|
|
109
110
|
],
|
|
110
111
|
["rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", key: "158x01" }]
|
|
111
|
-
]),
|
|
112
|
+
]), _ = (r) => {
|
|
112
113
|
const e = r.type, t = r.name;
|
|
113
|
-
return e.includes("pdf") || t.endsWith(".pdf") || e.includes("word") || t.endsWith(".doc") || t.endsWith(".docx") ?
|
|
114
|
-
},
|
|
114
|
+
return e.includes("pdf") || t.endsWith(".pdf") || e.includes("word") || t.endsWith(".doc") || t.endsWith(".docx") ? de : e.includes("zip") || e.includes("archive") || t.endsWith(".zip") || t.endsWith(".rar") ? ne : e.includes("excel") || t.endsWith(".xls") || t.endsWith(".xlsx") ? le : e.includes("video/") ? me : e.includes("audio/") ? pe : e.startsWith("image/") ? ee : ce;
|
|
115
|
+
}, he = b({
|
|
115
116
|
base: "rounded-md text-muted ring-0"
|
|
116
|
-
}),
|
|
117
|
-
const e =
|
|
118
|
-
return /* @__PURE__ */ a(q, { icon: e, size: "lg", className:
|
|
119
|
-
},
|
|
117
|
+
}), fe = ({ file: r }) => {
|
|
118
|
+
const e = _(r);
|
|
119
|
+
return /* @__PURE__ */ a(q, { icon: e, size: "lg", className: he() });
|
|
120
|
+
}, ue = b({
|
|
120
121
|
slots: {
|
|
121
122
|
wrapper: "box-border flex h-16 justify-between gap-2 rounded-xl border border-secondary-border bg-background p-3 pe-3",
|
|
122
123
|
infoWrapper: "flex min-w-0 flex-1 items-center gap-2.5",
|
|
123
124
|
textWrapper: "flex min-w-0 flex-col gap-0.5",
|
|
124
125
|
title: "truncate text-sm font-medium",
|
|
125
|
-
description: "text-xs text-muted",
|
|
126
|
+
description: "text-xs tabular-nums text-muted",
|
|
126
127
|
actionWrapper: "-me-3 -mt-3 flex h-8 items-center -space-x-1.5"
|
|
127
128
|
}
|
|
128
|
-
}),
|
|
129
|
-
({ onClear: r, onDownload: e, file: t, className: i, ...
|
|
130
|
-
const
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */ a(
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */ a(B, { className:
|
|
136
|
-
/* @__PURE__ */ a("p", { className:
|
|
129
|
+
}), X = U.forwardRef(
|
|
130
|
+
({ onClear: r, onDownload: e, file: t, className: i, renderDescription: s, ...d }, c) => {
|
|
131
|
+
const o = ue();
|
|
132
|
+
return /* @__PURE__ */ m("div", { className: o.wrapper({ className: i }), ref: c, ...d, children: [
|
|
133
|
+
/* @__PURE__ */ m("div", { className: o.infoWrapper(), children: [
|
|
134
|
+
/* @__PURE__ */ a(fe, { file: t }),
|
|
135
|
+
/* @__PURE__ */ m("div", { className: o.textWrapper(), children: [
|
|
136
|
+
/* @__PURE__ */ a(B, { className: o.title(), children: t.name }),
|
|
137
|
+
/* @__PURE__ */ a("p", { className: o.description(), children: s?.(t) ?? S(t.size) })
|
|
137
138
|
] })
|
|
138
139
|
] }),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ m("div", { className: o.actionWrapper(), children: [
|
|
140
141
|
e && /* @__PURE__ */ a(
|
|
141
142
|
C,
|
|
142
143
|
{
|
|
@@ -165,21 +166,21 @@ const pe = v("Video", [
|
|
|
165
166
|
] });
|
|
166
167
|
}
|
|
167
168
|
);
|
|
168
|
-
|
|
169
|
-
const
|
|
169
|
+
X.displayName = "FileUploadItem";
|
|
170
|
+
const H = U.forwardRef(({ error: r, ...e }, t) => {
|
|
170
171
|
const i = Array.isArray(r) ? r.join(`
|
|
171
172
|
`) : r;
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */ a(
|
|
174
|
-
/* @__PURE__ */ a(
|
|
173
|
+
return /* @__PURE__ */ m(ae, { status: "error", focus: "medium", ...e, ref: t, children: [
|
|
174
|
+
/* @__PURE__ */ a(te, { icon: oe }),
|
|
175
|
+
/* @__PURE__ */ a(re, { className: "whitespace-pre-line", children: i })
|
|
175
176
|
] });
|
|
176
177
|
});
|
|
177
|
-
|
|
178
|
-
const
|
|
178
|
+
H.displayName = "FileUploadError";
|
|
179
|
+
const ye = b({
|
|
179
180
|
base: "shrink-0 bg-status-neutral-fg"
|
|
180
|
-
}),
|
|
181
|
-
|
|
182
|
-
const
|
|
181
|
+
}), j = ({ icon: r, className: e, ...t }) => /* @__PURE__ */ a(q, { size: "xl", icon: r, className: ye({ className: e }), ...t });
|
|
182
|
+
j.displayName = "FileUploadDropAreaIcon";
|
|
183
|
+
const be = b({
|
|
183
184
|
slots: {
|
|
184
185
|
wrapper: [
|
|
185
186
|
"has-[:disabled]:pointer-events-none has-[:disabled]:opacity-50",
|
|
@@ -192,7 +193,7 @@ const ye = y({
|
|
|
192
193
|
icon: "mb-3 size-11",
|
|
193
194
|
description: "flex flex-wrap justify-center gap-1 text-xs text-muted"
|
|
194
195
|
}
|
|
195
|
-
}),
|
|
196
|
+
}), $ = U.forwardRef(
|
|
196
197
|
({
|
|
197
198
|
className: r,
|
|
198
199
|
title: e = "Click to upload or drop your files here ",
|
|
@@ -202,20 +203,20 @@ Infinity files
|
|
|
202
203
|
∙
|
|
203
204
|
Infinity size`,
|
|
204
205
|
icon: i,
|
|
205
|
-
children:
|
|
206
|
-
...
|
|
207
|
-
},
|
|
208
|
-
const o =
|
|
209
|
-
return /* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */ a(
|
|
206
|
+
children: s,
|
|
207
|
+
...d
|
|
208
|
+
}, c) => {
|
|
209
|
+
const o = be();
|
|
210
|
+
return /* @__PURE__ */ m("div", { role: "button", className: o.wrapper({ className: r }), ref: c, ...d, children: [
|
|
211
|
+
/* @__PURE__ */ a(j, { icon: i || O, className: o.icon() }),
|
|
211
212
|
/* @__PURE__ */ a("p", { className: o.title(), children: e }),
|
|
212
213
|
t && /* @__PURE__ */ a("p", { className: o.description(), children: t }),
|
|
213
|
-
|
|
214
|
+
s
|
|
214
215
|
] });
|
|
215
216
|
}
|
|
216
217
|
);
|
|
217
|
-
|
|
218
|
-
const
|
|
218
|
+
$.displayName = "FileUploadDropArea";
|
|
219
|
+
const xe = b({
|
|
219
220
|
slots: {
|
|
220
221
|
wrapper: [
|
|
221
222
|
"has-[:disabled]:pointer-events-none has-[:disabled]:opacity-50",
|
|
@@ -228,99 +229,103 @@ const be = y({
|
|
|
228
229
|
title: "text-sm font-medium text-primary-accent",
|
|
229
230
|
description: "ml-1.5 flex flex-wrap justify-center gap-1.5 text-xs text-muted"
|
|
230
231
|
}
|
|
231
|
-
}),
|
|
232
|
-
({ className: r, title: e = "Upload files", description: t = "Drag & drop or click to browse", icon: i, children:
|
|
233
|
-
const o =
|
|
234
|
-
return /* @__PURE__ */
|
|
235
|
-
/* @__PURE__ */ a(
|
|
236
|
-
/* @__PURE__ */
|
|
232
|
+
}), G = U.forwardRef(
|
|
233
|
+
({ className: r, title: e = "Upload files", description: t = "Drag & drop or click to browse", icon: i, children: s, ...d }, c) => {
|
|
234
|
+
const o = xe();
|
|
235
|
+
return /* @__PURE__ */ m("div", { role: "button", className: o.wrapper({ className: r }), ref: c, ...d, children: [
|
|
236
|
+
/* @__PURE__ */ a(j, { icon: i || O, className: o.icon(), size: "sm" }),
|
|
237
|
+
/* @__PURE__ */ m("div", { className: "flex items-baseline", children: [
|
|
237
238
|
/* @__PURE__ */ a("p", { className: o.title(), children: e }),
|
|
238
|
-
t && /* @__PURE__ */
|
|
239
|
+
t && /* @__PURE__ */ m(Y, { children: [
|
|
239
240
|
/* @__PURE__ */ a("span", { className: "ml-1.5 text-muted", children: "∙" }),
|
|
240
241
|
/* @__PURE__ */ a("p", { className: o.description(), children: t })
|
|
241
242
|
] }),
|
|
242
|
-
|
|
243
|
+
s
|
|
243
244
|
] })
|
|
244
245
|
] });
|
|
245
246
|
}
|
|
246
247
|
);
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
const
|
|
248
|
+
G.displayName = "FileUploadInlineDropArea";
|
|
249
|
+
const J = ({ children: r = "Remove all files", ...e }) => /* @__PURE__ */ a(ie, { size: "sm", variant: "outline", type: "button", ...e, children: r });
|
|
250
|
+
J.displayName = "FileUploadClearButton";
|
|
251
|
+
const K = ({
|
|
251
252
|
isDragging: r,
|
|
252
253
|
getInputProps: e,
|
|
253
254
|
openFileDialog: t,
|
|
254
255
|
handleDragEnter: i,
|
|
255
|
-
handleDragLeave:
|
|
256
|
-
handleDragOver:
|
|
257
|
-
handleDrop:
|
|
258
|
-
|
|
256
|
+
handleDragLeave: s,
|
|
257
|
+
handleDragOver: d,
|
|
258
|
+
handleDrop: c,
|
|
259
|
+
title: o,
|
|
260
|
+
description: p
|
|
259
261
|
}) => /* @__PURE__ */ a(
|
|
260
|
-
|
|
262
|
+
$,
|
|
261
263
|
{
|
|
262
264
|
onClick: t,
|
|
263
265
|
onDragEnter: i,
|
|
264
|
-
onDragLeave:
|
|
265
|
-
onDragOver:
|
|
266
|
-
onDrop:
|
|
266
|
+
onDragLeave: s,
|
|
267
|
+
onDragOver: d,
|
|
268
|
+
onDrop: c,
|
|
267
269
|
"data-dragging": r || void 0,
|
|
268
|
-
|
|
270
|
+
title: o,
|
|
271
|
+
description: p,
|
|
269
272
|
children: /* @__PURE__ */ a("input", { className: "sr-only", "aria-label": "Upload files", ...e() })
|
|
270
273
|
}
|
|
271
274
|
);
|
|
272
|
-
|
|
273
|
-
const
|
|
275
|
+
K.displayName = "FileUploadInputZone";
|
|
276
|
+
const P = ({
|
|
274
277
|
isDragging: r,
|
|
275
278
|
getInputProps: e,
|
|
276
279
|
openFileDialog: t,
|
|
277
280
|
handleDragEnter: i,
|
|
278
|
-
handleDragLeave:
|
|
279
|
-
handleDragOver:
|
|
280
|
-
handleDrop:
|
|
281
|
-
|
|
281
|
+
handleDragLeave: s,
|
|
282
|
+
handleDragOver: d,
|
|
283
|
+
handleDrop: c,
|
|
284
|
+
title: o,
|
|
285
|
+
description: p
|
|
282
286
|
}) => /* @__PURE__ */ a(
|
|
283
|
-
|
|
287
|
+
G,
|
|
284
288
|
{
|
|
285
289
|
onClick: t,
|
|
286
290
|
onDragEnter: i,
|
|
287
|
-
onDragLeave:
|
|
288
|
-
onDragOver:
|
|
289
|
-
onDrop:
|
|
291
|
+
onDragLeave: s,
|
|
292
|
+
onDragOver: d,
|
|
293
|
+
onDrop: c,
|
|
290
294
|
"data-dragging": r || void 0,
|
|
291
|
-
|
|
295
|
+
title: o,
|
|
296
|
+
description: p,
|
|
292
297
|
children: /* @__PURE__ */ a("input", { className: "sr-only", "aria-label": "Upload files", ...e() })
|
|
293
298
|
}
|
|
294
299
|
);
|
|
295
|
-
|
|
296
|
-
const
|
|
300
|
+
P.displayName = "FileUploadCompactInputZone";
|
|
301
|
+
const ge = b({
|
|
297
302
|
slots: {
|
|
298
303
|
wrapper: "box-border flex h-10 items-center gap-2 rounded-lg border border-secondary-border bg-background p-2.5 pr-1",
|
|
299
304
|
icon: "text-muted",
|
|
300
305
|
infoWrapper: "flex w-full items-center overflow-hidden",
|
|
301
306
|
textWrapper: "flex w-full items-center justify-between",
|
|
302
307
|
title: "truncate text-sm font-medium",
|
|
303
|
-
description: "text-sm text-muted",
|
|
308
|
+
description: "text-sm tabular-nums text-muted",
|
|
304
309
|
actionWrapper: "ml-auto flex items-center -space-x-1.5"
|
|
305
310
|
}
|
|
306
|
-
}),
|
|
307
|
-
({ onClear: r, file: e, className: t, renderIcon: i, onDownload:
|
|
308
|
-
const
|
|
309
|
-
return /* @__PURE__ */ a("div", { className: "relative", children: /* @__PURE__ */
|
|
310
|
-
i ?? /* @__PURE__ */ a("div", { className: "size-5", children: /* @__PURE__ */ a(se, { icon:
|
|
311
|
-
/* @__PURE__ */ a("div", { className:
|
|
312
|
-
/* @__PURE__ */ a(B, { className:
|
|
313
|
-
/* @__PURE__ */ a("p", { className:
|
|
311
|
+
}), Q = U.forwardRef(
|
|
312
|
+
({ onClear: r, file: e, className: t, renderIcon: i, onDownload: s, renderDescription: d, ...c }, o) => {
|
|
313
|
+
const p = ge(), k = _(e);
|
|
314
|
+
return /* @__PURE__ */ a("div", { className: "relative", children: /* @__PURE__ */ m("div", { className: p.wrapper({ className: t }), ref: o, ...c, children: [
|
|
315
|
+
i ?? /* @__PURE__ */ a("div", { className: "size-5", children: /* @__PURE__ */ a(se, { icon: k, size: "lg", className: p.icon() }) }),
|
|
316
|
+
/* @__PURE__ */ a("div", { className: p.infoWrapper(), children: /* @__PURE__ */ m("div", { className: p.textWrapper(), children: [
|
|
317
|
+
/* @__PURE__ */ a(B, { className: p.title(), children: e.name }),
|
|
318
|
+
/* @__PURE__ */ a("p", { className: p.description(), children: d?.(e) ?? S(e.size) })
|
|
314
319
|
] }) }),
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
|
|
320
|
+
/* @__PURE__ */ m("div", { className: p.actionWrapper(), children: [
|
|
321
|
+
s && /* @__PURE__ */ a(
|
|
317
322
|
C,
|
|
318
323
|
{
|
|
319
324
|
variant: "text",
|
|
320
325
|
size: "sm",
|
|
321
326
|
type: "button",
|
|
322
327
|
icon: Z,
|
|
323
|
-
onClick: () =>
|
|
328
|
+
onClick: () => s(e),
|
|
324
329
|
"aria-label": "Download file",
|
|
325
330
|
iconClassName: "size-4"
|
|
326
331
|
}
|
|
@@ -341,144 +346,148 @@ const xe = y({
|
|
|
341
346
|
] }) });
|
|
342
347
|
}
|
|
343
348
|
);
|
|
344
|
-
|
|
345
|
-
const
|
|
349
|
+
Q.displayName = "FileUploadItemCompact";
|
|
350
|
+
const ve = b({
|
|
346
351
|
base: "flex flex-col gap-3"
|
|
347
|
-
}),
|
|
352
|
+
}), Fe = (r) => {
|
|
348
353
|
const {
|
|
349
354
|
files: e,
|
|
350
355
|
onRemove: t,
|
|
351
356
|
onAdd: i,
|
|
352
|
-
onClear:
|
|
353
|
-
onDownload:
|
|
354
|
-
initialFiles:
|
|
357
|
+
onClear: s,
|
|
358
|
+
onDownload: d,
|
|
359
|
+
initialFiles: c,
|
|
355
360
|
onChange: o,
|
|
356
|
-
className:
|
|
357
|
-
title:
|
|
361
|
+
className: p,
|
|
362
|
+
title: k,
|
|
358
363
|
description: w,
|
|
359
364
|
helpText: z,
|
|
360
365
|
removeBtnText: D,
|
|
361
366
|
errorMessages: A,
|
|
362
|
-
multiple:
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
367
|
+
multiple: M = !0,
|
|
368
|
+
renderItemDescription: N,
|
|
369
|
+
...W
|
|
370
|
+
} = r, [{ files: x, isDragging: I, errors: g }, v] = E({
|
|
371
|
+
...W,
|
|
372
|
+
initialFiles: c,
|
|
373
|
+
multiple: M,
|
|
368
374
|
errorMessages: A,
|
|
369
|
-
onFilesChange: (
|
|
370
|
-
const
|
|
371
|
-
o?.(
|
|
375
|
+
onFilesChange: (l) => {
|
|
376
|
+
const y = l.map((f) => f.file);
|
|
377
|
+
o?.(y);
|
|
372
378
|
},
|
|
373
|
-
onFilesAdded: (
|
|
374
|
-
const
|
|
375
|
-
i?.(
|
|
379
|
+
onFilesAdded: (l) => {
|
|
380
|
+
const y = l.map((f) => f.file);
|
|
381
|
+
i?.(y);
|
|
376
382
|
}
|
|
377
|
-
}), n = V(() => e ||
|
|
378
|
-
|
|
379
|
-
}, [
|
|
380
|
-
(
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
+
}), n = V(() => e || x.map((l) => l.file), [e, x]), h = R(() => {
|
|
384
|
+
v.clearFiles(), s?.();
|
|
385
|
+
}, [v, s]), u = R(
|
|
386
|
+
(l, y) => {
|
|
387
|
+
const f = x.find((T) => T.file.name === l.name && T.file.size === l.size)?.id;
|
|
388
|
+
f && v.removeFile(f), t?.(l, y);
|
|
383
389
|
},
|
|
384
|
-
[
|
|
390
|
+
[x, v, t]
|
|
385
391
|
);
|
|
386
|
-
return /* @__PURE__ */
|
|
392
|
+
return /* @__PURE__ */ m("div", { className: ve({ className: p }), children: [
|
|
387
393
|
/* @__PURE__ */ a(
|
|
388
|
-
|
|
394
|
+
K,
|
|
389
395
|
{
|
|
390
|
-
...
|
|
391
|
-
isDragging:
|
|
392
|
-
title:
|
|
396
|
+
...v,
|
|
397
|
+
isDragging: I,
|
|
398
|
+
title: k,
|
|
393
399
|
description: w,
|
|
394
400
|
helpText: z
|
|
395
401
|
}
|
|
396
402
|
),
|
|
397
|
-
|
|
398
|
-
n.length > 0 && /* @__PURE__ */
|
|
399
|
-
n.map((
|
|
400
|
-
|
|
403
|
+
g.length > 0 && /* @__PURE__ */ a(H, { error: g }),
|
|
404
|
+
n.length > 0 && /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
405
|
+
n.map((l, y) => /* @__PURE__ */ a(
|
|
406
|
+
X,
|
|
401
407
|
{
|
|
402
|
-
file:
|
|
403
|
-
onClear: () =>
|
|
404
|
-
onDownload:
|
|
408
|
+
file: l,
|
|
409
|
+
onClear: () => u(l, y),
|
|
410
|
+
onDownload: d,
|
|
411
|
+
renderDescription: N
|
|
405
412
|
},
|
|
406
|
-
|
|
413
|
+
y
|
|
407
414
|
)),
|
|
408
|
-
n.length > 1 && /* @__PURE__ */ a(
|
|
415
|
+
n.length > 1 && /* @__PURE__ */ a(J, { onClick: h, children: D })
|
|
409
416
|
] })
|
|
410
417
|
] });
|
|
411
418
|
};
|
|
412
|
-
|
|
413
|
-
const
|
|
419
|
+
Fe.displayName = "FileUpload";
|
|
420
|
+
const Ne = b({
|
|
414
421
|
base: "box-border flex flex-col gap-2"
|
|
415
|
-
}),
|
|
422
|
+
}), ke = (r) => {
|
|
416
423
|
const {
|
|
417
424
|
files: e,
|
|
418
425
|
onRemove: t,
|
|
419
426
|
onDownload: i,
|
|
420
|
-
onAdd:
|
|
421
|
-
initialFiles:
|
|
422
|
-
onChange:
|
|
427
|
+
onAdd: s,
|
|
428
|
+
initialFiles: d,
|
|
429
|
+
onChange: c,
|
|
423
430
|
className: o,
|
|
424
|
-
title:
|
|
425
|
-
description:
|
|
431
|
+
title: p,
|
|
432
|
+
description: k,
|
|
426
433
|
multiple: w = !0,
|
|
427
434
|
errorMessages: z,
|
|
428
435
|
renderFileIcon: D,
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
436
|
+
renderItemDescription: A,
|
|
437
|
+
...M
|
|
438
|
+
} = r, [{ files: N, isDragging: W, errors: x }, I] = E({
|
|
439
|
+
...M,
|
|
440
|
+
initialFiles: d,
|
|
433
441
|
multiple: w,
|
|
434
442
|
errorMessages: z,
|
|
435
443
|
onFilesChange: (n) => {
|
|
436
|
-
const
|
|
437
|
-
|
|
444
|
+
const h = n.map((u) => u.file);
|
|
445
|
+
c?.(h);
|
|
438
446
|
},
|
|
439
447
|
onFilesAdded: (n) => {
|
|
440
|
-
const
|
|
441
|
-
|
|
448
|
+
const h = n.map((u) => u.file);
|
|
449
|
+
s?.(h);
|
|
442
450
|
}
|
|
443
|
-
}),
|
|
444
|
-
(n,
|
|
445
|
-
const
|
|
446
|
-
|
|
451
|
+
}), g = V(() => e || N.map((n) => n.file), [e, N]), v = R(
|
|
452
|
+
(n, h) => {
|
|
453
|
+
const u = N.find((l) => l.file.name === n.name && l.file.size === n.size)?.id;
|
|
454
|
+
u && I.removeFile(u), t?.(n, h);
|
|
447
455
|
},
|
|
448
|
-
[
|
|
456
|
+
[N, I, t]
|
|
449
457
|
);
|
|
450
|
-
return /* @__PURE__ */
|
|
451
|
-
/* @__PURE__ */ a(
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
const
|
|
455
|
-
let
|
|
456
|
-
return
|
|
457
|
-
|
|
458
|
+
return /* @__PURE__ */ m("div", { className: Ne({ className: o }), children: [
|
|
459
|
+
/* @__PURE__ */ a(P, { ...I, isDragging: W, title: p, description: k }),
|
|
460
|
+
x.length > 0 && /* @__PURE__ */ a(H, { error: x }),
|
|
461
|
+
g.length > 0 && /* @__PURE__ */ a("div", { children: g.map((n, h) => {
|
|
462
|
+
const u = h === 0, l = g.length === 1, y = h === g.length - 1;
|
|
463
|
+
let f = "";
|
|
464
|
+
return l ? f = "" : u ? f = "border-b-0 rounded-b-none" : y ? f = "rounded-t-none" : f = "border-b-0 rounded-none", /* @__PURE__ */ a(
|
|
465
|
+
Q,
|
|
458
466
|
{
|
|
459
467
|
file: n,
|
|
460
|
-
onClear: () =>
|
|
461
|
-
className:
|
|
468
|
+
onClear: () => v(n, h),
|
|
469
|
+
className: f,
|
|
462
470
|
renderIcon: D?.(n),
|
|
471
|
+
renderDescription: A,
|
|
463
472
|
onDownload: i
|
|
464
473
|
},
|
|
465
|
-
|
|
474
|
+
h
|
|
466
475
|
);
|
|
467
476
|
}) })
|
|
468
477
|
] });
|
|
469
478
|
};
|
|
470
|
-
|
|
479
|
+
ke.displayName = "FileUploadCompact";
|
|
471
480
|
export {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
481
|
+
Fe as FileUpload,
|
|
482
|
+
J as FileUploadClearButton,
|
|
483
|
+
ke as FileUploadCompact,
|
|
484
|
+
P as FileUploadCompactInputZone,
|
|
485
|
+
$ as FileUploadDropArea,
|
|
486
|
+
H as FileUploadError,
|
|
487
|
+
fe as FileUploadIcon,
|
|
488
|
+
G as FileUploadInlineDropArea,
|
|
489
|
+
K as FileUploadInputZone,
|
|
490
|
+
X as FileUploadItem,
|
|
491
|
+
Q as FileUploadItemCompact
|
|
483
492
|
};
|
|
484
493
|
//# sourceMappingURL=file-upload.js.map
|