laif-ds 0.2.9 → 0.2.10
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/_virtual/index3.js +5 -5
- package/dist/_virtual/index5.js +5 -5
- package/dist/components/ui/file-preview.js +130 -112
- package/dist/components/ui/file-uploader.js +25 -25
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/package.json +1 -1
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDefaultExportFromCjs as
|
|
3
|
-
import { __require as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
2
|
+
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as t } from "../node_modules/eventemitter3/index2.js";
|
|
4
|
+
var r = t();
|
|
5
|
+
const m = /* @__PURE__ */ e(r);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
m as default
|
|
8
8
|
};
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDefaultExportFromCjs as
|
|
3
|
-
import { __require as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
2
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
|
|
4
|
+
var t = e();
|
|
5
|
+
const a = /* @__PURE__ */ r(t);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
a as default
|
|
8
8
|
};
|
|
@@ -1,108 +1,126 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import { motion as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { Tooltip as C, TooltipTrigger as
|
|
8
|
-
import { Command as
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { cn as
|
|
11
|
-
import
|
|
2
|
+
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
3
|
+
import p, { useEffect as T } from "react";
|
|
4
|
+
import { motion as h } from "framer-motion";
|
|
5
|
+
import { Button as P } from "../../dist/components/ui/button.js";
|
|
6
|
+
import { Icon as x } from "../../dist/components/ui/icon.js";
|
|
7
|
+
import { Tooltip as C, TooltipTrigger as k, TooltipContent as U } from "../../dist/components/ui/tooltip.js";
|
|
8
|
+
import { Command as R, CommandGroup as L, CommandItem as b } from "../../dist/components/ui/command.js";
|
|
9
|
+
import { Popover as z, PopoverTrigger as S, PopoverContent as E } from "../../dist/components/ui/popover.js";
|
|
10
|
+
import { cn as v } from "../../dist/lib/utils.js";
|
|
11
|
+
import g from "../../node_modules/lucide-react/dist/esm/icons/x.js";
|
|
12
12
|
import I from "../../node_modules/lucide-react/dist/esm/icons/file.js";
|
|
13
|
-
const
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
13
|
+
const y = ({ url: e, onPreview: r, onDownload: n, onRemove: s }) => /* @__PURE__ */ o(z, { children: [
|
|
14
|
+
/* @__PURE__ */ t(S, { asChild: !0, children: /* @__PURE__ */ t(P, { variant: "ghost", size: "icon", children: /* @__PURE__ */ t(x, { name: "Menu", size: "sm" }) }) }),
|
|
15
|
+
/* @__PURE__ */ t(E, { className: "w-42 p-0", align: "end", children: /* @__PURE__ */ t(R, { children: /* @__PURE__ */ o(L, { children: [
|
|
16
|
+
r && /* @__PURE__ */ o(b, { onSelect: () => r(e), children: [
|
|
17
|
+
/* @__PURE__ */ t(x, { name: "Presentation", size: "sm" }),
|
|
18
|
+
/* @__PURE__ */ t("span", { children: "Anteprima" })
|
|
19
19
|
] }),
|
|
20
|
-
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
20
|
+
n && /* @__PURE__ */ o(b, { onSelect: () => n(e), children: [
|
|
21
|
+
/* @__PURE__ */ t(x, { name: "Download", size: "sm" }),
|
|
22
|
+
/* @__PURE__ */ t("span", { children: "Download" })
|
|
23
23
|
] }),
|
|
24
|
-
s && /* @__PURE__ */
|
|
25
|
-
|
|
24
|
+
s && /* @__PURE__ */ o(
|
|
25
|
+
b,
|
|
26
26
|
{
|
|
27
27
|
onSelect: () => s(e),
|
|
28
28
|
className: "text-red-500",
|
|
29
29
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ t(x, { name: "Trash", className: "text-red-500", size: "sm" }),
|
|
31
|
+
/* @__PURE__ */ t("span", { children: "Elimina" })
|
|
32
32
|
]
|
|
33
33
|
}
|
|
34
34
|
)
|
|
35
35
|
] }) }) })
|
|
36
36
|
] });
|
|
37
|
-
function
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
37
|
+
function w({ text: e }) {
|
|
38
|
+
return /* @__PURE__ */ o(C, { children: [
|
|
39
|
+
/* @__PURE__ */ t(k, { "data-slot": "tooltip-trigger", className: "w-full min-w-0", children: /* @__PURE__ */ t("span", { className: "block w-full truncate text-d-secondary-foreground", children: e }) }),
|
|
40
|
+
/* @__PURE__ */ t(U, { children: /* @__PURE__ */ t("span", { children: e }) })
|
|
41
41
|
] });
|
|
42
42
|
}
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
43
|
+
const u = (e) => "type" in e && typeof e.type == "string" && e instanceof File, $ = (e) => {
|
|
44
|
+
if (u(e) || e.type)
|
|
45
45
|
return e.type;
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
const r = (i) => {
|
|
47
|
+
if (!i) return "";
|
|
48
|
+
const m = i.split(/[?#]/)[0].split("/").pop() || "", d = m.lastIndexOf(".");
|
|
49
|
+
return d >= 0 ? m.substring(d + 1).toLowerCase() : "";
|
|
50
|
+
}, n = r(e.name || ""), s = "url" in e ? r(e.url || "") : "", a = n || s;
|
|
51
|
+
if (a && (/* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg", "tiff"])).has(a))
|
|
52
|
+
return `image/${a === "jpg" ? "jpeg" : a}`;
|
|
53
|
+
if (a === "txt" || a === "md")
|
|
54
|
+
return "text/plain";
|
|
55
|
+
const l = {
|
|
56
|
+
pdf: "application/pdf",
|
|
57
|
+
csv: "text/csv",
|
|
58
|
+
doc: "application/msword",
|
|
59
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
60
|
+
xls: "application/vnd.ms-excel",
|
|
61
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
62
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
63
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
64
|
+
};
|
|
65
|
+
return a && l[a] ? l[a] : "application/octet-stream";
|
|
66
|
+
}, O = p.forwardRef(
|
|
67
|
+
(e, r) => {
|
|
68
|
+
const n = $(e.file);
|
|
69
|
+
return n.startsWith("image/") ? /* @__PURE__ */ t(N, { ...e, ref: r }) : n.startsWith("text/") || e.file.name.endsWith(".txt") || e.file.name.endsWith(".md") ? /* @__PURE__ */ t(F, { ...e, ref: r }) : /* @__PURE__ */ t(j, { ...e, ref: r });
|
|
52
70
|
}
|
|
53
71
|
);
|
|
54
|
-
|
|
55
|
-
const
|
|
72
|
+
O.displayName = "FilePreview";
|
|
73
|
+
const N = p.forwardRef(
|
|
56
74
|
({
|
|
57
75
|
file: e,
|
|
58
|
-
onRemove:
|
|
59
|
-
onPreview:
|
|
76
|
+
onRemove: r,
|
|
77
|
+
onPreview: n,
|
|
60
78
|
onDownload: s,
|
|
61
|
-
showActionMenu:
|
|
62
|
-
className:
|
|
63
|
-
},
|
|
64
|
-
const
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
|
|
79
|
+
showActionMenu: a = !1,
|
|
80
|
+
className: c
|
|
81
|
+
}, l) => {
|
|
82
|
+
const i = u(e) ? URL.createObjectURL(e) : e.url;
|
|
83
|
+
return /* @__PURE__ */ o(
|
|
84
|
+
h.div,
|
|
67
85
|
{
|
|
68
|
-
ref:
|
|
69
|
-
className:
|
|
86
|
+
ref: l,
|
|
87
|
+
className: v(
|
|
70
88
|
"border-d-border relative flex max-w-[200px] rounded-md border p-1.5 pr-2 text-xs",
|
|
71
|
-
|
|
89
|
+
c
|
|
72
90
|
),
|
|
73
91
|
layout: !0,
|
|
74
92
|
initial: { opacity: 0, y: "100%" },
|
|
75
93
|
animate: { opacity: 1, y: 0 },
|
|
76
94
|
exit: { opacity: 0, y: "100%" },
|
|
77
95
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ o("div", { className: "flex w-full min-w-0 items-center space-x-2", children: [
|
|
97
|
+
/* @__PURE__ */ t(
|
|
80
98
|
"img",
|
|
81
99
|
{
|
|
82
100
|
alt: `Attachment ${e.name}`,
|
|
83
101
|
className: "bg-d-secondary border-d-border grid h-10 w-10 shrink-0 place-items-center rounded-sm border object-cover",
|
|
84
|
-
src:
|
|
102
|
+
src: i
|
|
85
103
|
}
|
|
86
104
|
),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
|
|
89
|
-
|
|
105
|
+
/* @__PURE__ */ t(w, { text: e.name }),
|
|
106
|
+
a && /* @__PURE__ */ t(
|
|
107
|
+
y,
|
|
90
108
|
{
|
|
91
|
-
url:
|
|
92
|
-
onPreview:
|
|
109
|
+
url: i,
|
|
110
|
+
onPreview: n,
|
|
93
111
|
onDownload: s,
|
|
94
|
-
onRemove:
|
|
112
|
+
onRemove: r
|
|
95
113
|
}
|
|
96
114
|
)
|
|
97
115
|
] }),
|
|
98
|
-
!
|
|
116
|
+
!a && r ? /* @__PURE__ */ t(
|
|
99
117
|
"button",
|
|
100
118
|
{
|
|
101
119
|
className: "bg-d-background border-d-border absolute -top-2 -right-2 flex h-4 w-4 items-center justify-center rounded-full border",
|
|
102
120
|
type: "button",
|
|
103
|
-
onClick: () =>
|
|
121
|
+
onClick: () => r(i),
|
|
104
122
|
"aria-label": "Remove attachment",
|
|
105
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ t(g, { className: "h-2.5 w-2.5" })
|
|
106
124
|
}
|
|
107
125
|
) : null
|
|
108
126
|
]
|
|
@@ -110,51 +128,51 @@ const v = c.forwardRef(
|
|
|
110
128
|
);
|
|
111
129
|
}
|
|
112
130
|
);
|
|
113
|
-
|
|
114
|
-
const F =
|
|
115
|
-
({ file: e, onRemove:
|
|
116
|
-
const [
|
|
117
|
-
return
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
typeof
|
|
131
|
+
N.displayName = "ImageFilePreview";
|
|
132
|
+
const F = p.forwardRef(
|
|
133
|
+
({ file: e, onRemove: r, onPreview: n, onDownload: s, showActionMenu: a = !1 }, c) => {
|
|
134
|
+
const [l, i] = p.useState(""), f = u(e) ? URL.createObjectURL(e) : e.url;
|
|
135
|
+
return T(() => {
|
|
136
|
+
if (u(e)) {
|
|
137
|
+
const m = new FileReader();
|
|
138
|
+
m.onload = (d) => {
|
|
139
|
+
d.target?.result && i(
|
|
140
|
+
typeof d.target.result == "string" ? d.target.result.slice(0, 100) : ""
|
|
123
141
|
);
|
|
124
|
-
},
|
|
142
|
+
}, m.readAsText(e);
|
|
125
143
|
} else
|
|
126
|
-
|
|
127
|
-
}, [e]), /* @__PURE__ */
|
|
128
|
-
|
|
144
|
+
i("Anteprima non disponibile");
|
|
145
|
+
}, [e]), /* @__PURE__ */ o(
|
|
146
|
+
h.div,
|
|
129
147
|
{
|
|
130
|
-
ref:
|
|
148
|
+
ref: c,
|
|
131
149
|
className: "border-d-border relative flex max-w-[200px] rounded-md border p-1.5 pr-2 text-xs",
|
|
132
150
|
layout: !0,
|
|
133
151
|
initial: { opacity: 0, y: "100%" },
|
|
134
152
|
animate: { opacity: 1, y: 0 },
|
|
135
153
|
exit: { opacity: 0, y: "100%" },
|
|
136
154
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
141
|
-
|
|
155
|
+
/* @__PURE__ */ o("div", { className: "flex w-full min-w-0 items-center space-x-2", children: [
|
|
156
|
+
/* @__PURE__ */ t("div", { className: "bg-d-secondary border-d-border grid h-10 w-10 shrink-0 place-items-center rounded rounded-sm border p-1 text-[8px]", children: l }),
|
|
157
|
+
/* @__PURE__ */ t(w, { text: e.name }),
|
|
158
|
+
a && /* @__PURE__ */ t(
|
|
159
|
+
y,
|
|
142
160
|
{
|
|
143
|
-
url:
|
|
144
|
-
onPreview:
|
|
161
|
+
url: f,
|
|
162
|
+
onPreview: n,
|
|
145
163
|
onDownload: s,
|
|
146
|
-
onRemove:
|
|
164
|
+
onRemove: r
|
|
147
165
|
}
|
|
148
166
|
)
|
|
149
167
|
] }),
|
|
150
|
-
!
|
|
168
|
+
!a && r ? /* @__PURE__ */ t(
|
|
151
169
|
"button",
|
|
152
170
|
{
|
|
153
171
|
className: "bg-d-background border-d-border absolute -top-2 -right-2 flex h-4 w-4 items-center justify-center rounded-full border",
|
|
154
172
|
type: "button",
|
|
155
|
-
onClick: () =>
|
|
173
|
+
onClick: () => r(f),
|
|
156
174
|
"aria-label": "Remove attachment",
|
|
157
|
-
children: /* @__PURE__ */
|
|
175
|
+
children: /* @__PURE__ */ t(g, { className: "h-2.5 w-2.5" })
|
|
158
176
|
}
|
|
159
177
|
) : null
|
|
160
178
|
]
|
|
@@ -163,50 +181,50 @@ const F = c.forwardRef(
|
|
|
163
181
|
}
|
|
164
182
|
);
|
|
165
183
|
F.displayName = "TextFilePreview";
|
|
166
|
-
const
|
|
184
|
+
const j = p.forwardRef(
|
|
167
185
|
({
|
|
168
186
|
file: e,
|
|
169
|
-
onRemove:
|
|
170
|
-
onPreview:
|
|
187
|
+
onRemove: r,
|
|
188
|
+
onPreview: n,
|
|
171
189
|
onDownload: s,
|
|
172
|
-
showActionMenu:
|
|
173
|
-
className:
|
|
174
|
-
},
|
|
175
|
-
const
|
|
176
|
-
return /* @__PURE__ */
|
|
177
|
-
|
|
190
|
+
showActionMenu: a = !1,
|
|
191
|
+
className: c
|
|
192
|
+
}, l) => {
|
|
193
|
+
const i = u(e) ? URL.createObjectURL(e) : e.url;
|
|
194
|
+
return /* @__PURE__ */ o(
|
|
195
|
+
h.div,
|
|
178
196
|
{
|
|
179
|
-
ref:
|
|
180
|
-
className:
|
|
197
|
+
ref: l,
|
|
198
|
+
className: v(
|
|
181
199
|
"border-d-border relative flex max-w-[200px] rounded-md border p-1.5 pr-2 text-xs",
|
|
182
|
-
|
|
200
|
+
c
|
|
183
201
|
),
|
|
184
202
|
layout: !0,
|
|
185
203
|
initial: { opacity: 0, y: "100%" },
|
|
186
204
|
animate: { opacity: 1, y: 0 },
|
|
187
205
|
exit: { opacity: 0, y: "100%" },
|
|
188
206
|
children: [
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
|
|
193
|
-
|
|
207
|
+
/* @__PURE__ */ o("div", { className: "flex w-full min-w-0 cursor-pointer items-center space-x-2", children: [
|
|
208
|
+
/* @__PURE__ */ t("div", { className: "bg-d-secondary border-d-border grid h-10 w-10 shrink-0 place-items-center rounded-sm border", children: /* @__PURE__ */ t(I, { className: "h-5 w-5" }) }),
|
|
209
|
+
/* @__PURE__ */ t(w, { text: e.name }),
|
|
210
|
+
a && /* @__PURE__ */ t(
|
|
211
|
+
y,
|
|
194
212
|
{
|
|
195
|
-
url:
|
|
196
|
-
onPreview:
|
|
213
|
+
url: i,
|
|
214
|
+
onPreview: n,
|
|
197
215
|
onDownload: s,
|
|
198
|
-
onRemove:
|
|
216
|
+
onRemove: r
|
|
199
217
|
}
|
|
200
218
|
)
|
|
201
219
|
] }),
|
|
202
|
-
!
|
|
220
|
+
!a && r ? /* @__PURE__ */ t(
|
|
203
221
|
"button",
|
|
204
222
|
{
|
|
205
223
|
className: "bg-d-background border-d-border absolute -top-2 -right-2 flex h-4 w-4 items-center justify-center rounded-full border",
|
|
206
224
|
type: "button",
|
|
207
|
-
onClick: () =>
|
|
225
|
+
onClick: () => r(i),
|
|
208
226
|
"aria-label": "Remove attachment",
|
|
209
|
-
children: /* @__PURE__ */
|
|
227
|
+
children: /* @__PURE__ */ t(g, { className: "h-2.5 w-2.5" })
|
|
210
228
|
}
|
|
211
229
|
) : null
|
|
212
230
|
]
|
|
@@ -214,8 +232,8 @@ const T = c.forwardRef(
|
|
|
214
232
|
);
|
|
215
233
|
}
|
|
216
234
|
);
|
|
217
|
-
|
|
235
|
+
j.displayName = "GenericFilePreview";
|
|
218
236
|
export {
|
|
219
|
-
|
|
220
|
-
|
|
237
|
+
O as FilePreview,
|
|
238
|
+
w as default
|
|
221
239
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as I, jsx as r, Fragment as L } from "react/jsx-runtime";
|
|
3
3
|
import c from "react";
|
|
4
4
|
import { FilePreview as C } from "./file-preview.js";
|
|
5
5
|
import { Card as A, CardHeader as S, CardTitle as B, CardContent as P } from "./card.js";
|
|
@@ -22,28 +22,28 @@ const H = {
|
|
|
22
22
|
image: "image/*",
|
|
23
23
|
video: "video/*",
|
|
24
24
|
audio: "audio/*"
|
|
25
|
-
}, $ = (
|
|
26
|
-
accept:
|
|
25
|
+
}, $ = (p) => Math.ceil(p / (1024 * 1024)), Q = ({
|
|
26
|
+
accept: p,
|
|
27
27
|
extensions: y = ["pdf", "image", "video", "audio"],
|
|
28
28
|
multiple: d = !1,
|
|
29
29
|
onUpload: v,
|
|
30
30
|
description: b = "Trascina un file o clicca per selezionare",
|
|
31
|
-
formatDescription:
|
|
31
|
+
formatDescription: N = "Formato accettato: PDF, Immagini, Video, Audio",
|
|
32
32
|
selectedLabel: m = "File selezionati",
|
|
33
33
|
maxTotalSize: n,
|
|
34
34
|
maxFiles: g
|
|
35
35
|
}) => {
|
|
36
|
-
const f =
|
|
36
|
+
const f = p ?? y.map((e) => H[e]).join(","), [o, x] = c.useState([]), [w, D] = c.useState(""), a = (e) => {
|
|
37
37
|
const i = Array.from(e).filter(
|
|
38
38
|
(s) => f.split(",").some((t) => (t = t.trim(), s.type.startsWith(t.replace("/*", "")) || s.name.toLowerCase().endsWith(t.replace("*", ""))))
|
|
39
39
|
);
|
|
40
40
|
let l = [];
|
|
41
|
-
const
|
|
41
|
+
const u = [];
|
|
42
42
|
if (d) {
|
|
43
43
|
let s = i;
|
|
44
44
|
if (typeof g == "number") {
|
|
45
45
|
const t = Math.max(g - o.length, 0);
|
|
46
|
-
t < i.length && (s = i.slice(0, t),
|
|
46
|
+
t < i.length && (s = i.slice(0, t), u.push(`Max ${g} file`));
|
|
47
47
|
}
|
|
48
48
|
if (typeof n == "number") {
|
|
49
49
|
const t = n;
|
|
@@ -51,7 +51,7 @@ const H = {
|
|
|
51
51
|
const j = [];
|
|
52
52
|
let z = !1;
|
|
53
53
|
for (const h of s)
|
|
54
|
-
M + (h.size || 0) <= t ? (j.push(h), M += h.size || 0) : z || (
|
|
54
|
+
M + (h.size || 0) <= t ? (j.push(h), M += h.size || 0) : z || (u.push(`Max ${$(t)} MB`), z = !0);
|
|
55
55
|
s = j;
|
|
56
56
|
}
|
|
57
57
|
l = [...o, ...s];
|
|
@@ -59,20 +59,20 @@ const H = {
|
|
|
59
59
|
const s = i[0] ? [i[0]] : [];
|
|
60
60
|
if (typeof n == "number" && s[0]) {
|
|
61
61
|
const t = n;
|
|
62
|
-
(s[0].size || 0) > t ? (
|
|
62
|
+
(s[0].size || 0) > t ? (u.push(`Max ${$(t)} MB`), l = o) : l = s;
|
|
63
63
|
} else
|
|
64
64
|
l = s;
|
|
65
65
|
}
|
|
66
|
-
x(l),
|
|
66
|
+
x(l), D(u.join(" • ")), v?.(l);
|
|
67
67
|
}, R = (e) => {
|
|
68
|
-
e.target.files &&
|
|
68
|
+
e.target.files && a(e.target.files), e.target.value = "";
|
|
69
69
|
}, k = (e) => {
|
|
70
|
-
e.preventDefault(),
|
|
70
|
+
e.preventDefault(), a(e.dataTransfer.files);
|
|
71
71
|
}, F = (e) => {
|
|
72
|
-
const i = o.filter((l,
|
|
73
|
-
x(i),
|
|
72
|
+
const i = o.filter((l, u) => u !== e);
|
|
73
|
+
x(i), D(""), v?.(i);
|
|
74
74
|
};
|
|
75
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ I("div", { className: "mx-auto w-full space-y-4", children: [
|
|
76
76
|
(d || o.length === 0) && /* @__PURE__ */ r(
|
|
77
77
|
K,
|
|
78
78
|
{
|
|
@@ -81,11 +81,11 @@ const H = {
|
|
|
81
81
|
onDrop: k,
|
|
82
82
|
onChange: R,
|
|
83
83
|
description: b,
|
|
84
|
-
formatDescription:
|
|
84
|
+
formatDescription: N,
|
|
85
85
|
errorCaption: w
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
|
-
o.length > 0 && /* @__PURE__ */ r(L, { children: /* @__PURE__ */
|
|
88
|
+
o.length > 0 && /* @__PURE__ */ r(L, { children: /* @__PURE__ */ I(A, { size: "sm", className: "shadow-none", children: [
|
|
89
89
|
/* @__PURE__ */ r(S, { children: /* @__PURE__ */ r(B, { children: m }) }),
|
|
90
90
|
/* @__PURE__ */ r(P, { children: d ? /* @__PURE__ */ r("div", { className: "flex flex-nowrap gap-2 overflow-x-auto py-2", children: o.map((e, i) => /* @__PURE__ */ r(
|
|
91
91
|
C,
|
|
@@ -98,16 +98,16 @@ const H = {
|
|
|
98
98
|
] }) })
|
|
99
99
|
] });
|
|
100
100
|
}, K = ({
|
|
101
|
-
accept:
|
|
101
|
+
accept: p,
|
|
102
102
|
multiple: y,
|
|
103
103
|
onDrop: d,
|
|
104
104
|
onChange: v,
|
|
105
105
|
description: b,
|
|
106
|
-
formatDescription:
|
|
106
|
+
formatDescription: N,
|
|
107
107
|
errorCaption: m
|
|
108
108
|
}) => {
|
|
109
|
-
const n = c.useRef(null), [g, f] = c.useState(!1), o = c.useId(), x = c.useId(), w = c.useId();
|
|
110
|
-
return /* @__PURE__ */
|
|
109
|
+
const n = c.useRef(null), [g, f] = c.useState(!1), o = c.useId(), x = c.useId(), w = c.useId(), D = c.useId();
|
|
110
|
+
return /* @__PURE__ */ I(
|
|
111
111
|
"div",
|
|
112
112
|
{
|
|
113
113
|
role: "button",
|
|
@@ -135,14 +135,14 @@ const H = {
|
|
|
135
135
|
className: "text-d-muted-foreground h-10 w-10"
|
|
136
136
|
}
|
|
137
137
|
),
|
|
138
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ I("div", { className: "max-w-xs text-center", children: [
|
|
139
139
|
/* @__PURE__ */ r("p", { id: o, className: "text-d-muted-foreground text-sm font-medium", children: b }),
|
|
140
140
|
/* @__PURE__ */ r(
|
|
141
141
|
"p",
|
|
142
142
|
{
|
|
143
143
|
id: x,
|
|
144
144
|
className: "text-d-muted-foreground text-muted-foreground mt-1 text-xs",
|
|
145
|
-
children:
|
|
145
|
+
children: N
|
|
146
146
|
}
|
|
147
147
|
),
|
|
148
148
|
m ? /* @__PURE__ */ r("p", { id: w, className: "mt-2 text-xs font-medium text-red-600", children: m }) : null
|
|
@@ -151,10 +151,10 @@ const H = {
|
|
|
151
151
|
W,
|
|
152
152
|
{
|
|
153
153
|
ref: n,
|
|
154
|
-
id:
|
|
154
|
+
id: D,
|
|
155
155
|
type: "file",
|
|
156
156
|
className: "hidden",
|
|
157
|
-
accept:
|
|
157
|
+
accept: p,
|
|
158
158
|
multiple: y,
|
|
159
159
|
onChange: v
|
|
160
160
|
}
|
|
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
|
|
|
3
3
|
import { ok as u } from "../../devlop/lib/default.js";
|
|
4
4
|
import { svg as m, html as C } from "../../property-information/index.js";
|
|
5
5
|
import { stringify as N } from "../../space-separated-tokens/index.js";
|
|
6
|
-
import S from "../../../_virtual/
|
|
6
|
+
import S from "../../../_virtual/index5.js";
|
|
7
7
|
import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
|
|
8
8
|
import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
|
|
9
9
|
import { VFileMessage as h } from "../../vfile-message/lib/index.js";
|