laif-ds 0.2.53 → 0.2.55
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/index4.js +5 -5
- package/dist/_virtual/index5.js +4 -4
- package/dist/components/ui/app-select.js +59 -57
- package/dist/components/ui/app-tooltip.js +123 -0
- package/dist/components/ui/async-select.js +65 -73
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.js +136 -69
- package/dist/components/ui/date-picker.js +15 -15
- package/dist/components/ui/file-preview.js +233 -286
- package/dist/index.d.ts +54 -1
- package/dist/index.js +41 -39
- package/dist/lib/design-tokens.js +5 -0
- 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/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { Calendar as
|
|
3
|
+
import { Calendar as T } from "./calendar.js";
|
|
4
4
|
import { Icon as E } from "./icon.js";
|
|
5
5
|
import { Label as L } from "./label.js";
|
|
6
6
|
import { Popover as q, PopoverTrigger as A, PopoverContent as B } from "./popover.js";
|
|
@@ -17,7 +17,7 @@ function v({
|
|
|
17
17
|
placeholder: I = "Seleziona data",
|
|
18
18
|
dateFormat: a = "dd/MM/yyyy",
|
|
19
19
|
className: M,
|
|
20
|
-
disabled:
|
|
20
|
+
disabled: s = !1,
|
|
21
21
|
size: m = "default",
|
|
22
22
|
firstDate: l,
|
|
23
23
|
lastDate: u,
|
|
@@ -30,21 +30,21 @@ function v({
|
|
|
30
30
|
}) {
|
|
31
31
|
const [r, y] = c.useState(e), [O, C] = c.useState(
|
|
32
32
|
g
|
|
33
|
-
), [S, R] = c.useState(!1),
|
|
34
|
-
y(
|
|
33
|
+
), [S, R] = c.useState(!1), w = (n) => {
|
|
34
|
+
y(n), n && C(n), p && p(n);
|
|
35
35
|
};
|
|
36
36
|
let i = [];
|
|
37
37
|
l && i.push({ before: l }), u && i.push({ after: u }), h?.length && i.push(
|
|
38
|
-
(
|
|
39
|
-
(
|
|
38
|
+
(n) => !h.some(
|
|
39
|
+
(z) => H(z, n)
|
|
40
40
|
)
|
|
41
|
-
),
|
|
41
|
+
), s && (i = [!0]), F(() => {
|
|
42
42
|
y(r), C(r || g);
|
|
43
43
|
}, [r]);
|
|
44
44
|
const b = c.useId();
|
|
45
45
|
return /* @__PURE__ */ f("div", { className: P("flex flex-col gap-1.5", k), children: [
|
|
46
46
|
x && /* @__PURE__ */ t(L, { htmlFor: b, children: x }),
|
|
47
|
-
/* @__PURE__ */ f(q, { open:
|
|
47
|
+
/* @__PURE__ */ f(q, { open: s ? !1 : S, onOpenChange: R, children: [
|
|
48
48
|
/* @__PURE__ */ t(A, { asChild: !0, children: /* @__PURE__ */ f(
|
|
49
49
|
"div",
|
|
50
50
|
{
|
|
@@ -59,16 +59,16 @@ function v({
|
|
|
59
59
|
S && o.activeRing,
|
|
60
60
|
"hover:border-d-ring cursor-pointer transition-colors",
|
|
61
61
|
!r && "text-d-muted-foreground",
|
|
62
|
-
|
|
62
|
+
s && "cursor-not-allowed opacity-50",
|
|
63
63
|
m === "default" && o.sizes.default,
|
|
64
64
|
m === "sm" && o.sizes.sm,
|
|
65
65
|
m === "lg" && o.sizes.lg,
|
|
66
66
|
M
|
|
67
67
|
),
|
|
68
|
-
"aria-disabled":
|
|
68
|
+
"aria-disabled": s,
|
|
69
69
|
role: "button",
|
|
70
|
-
tabIndex:
|
|
71
|
-
onClick:
|
|
70
|
+
tabIndex: s ? -1 : 0,
|
|
71
|
+
onClick: s ? void 0 : () => {
|
|
72
72
|
},
|
|
73
73
|
children: [
|
|
74
74
|
/* @__PURE__ */ t(
|
|
@@ -86,13 +86,13 @@ function v({
|
|
|
86
86
|
]
|
|
87
87
|
}
|
|
88
88
|
) }),
|
|
89
|
-
/* @__PURE__ */ t(B, { className: "w-auto p-0", children: /* @__PURE__ */ t(
|
|
90
|
-
|
|
89
|
+
/* @__PURE__ */ t(B, { className: "w-auto p-0 shadow", children: /* @__PURE__ */ t(
|
|
90
|
+
T,
|
|
91
91
|
{
|
|
92
92
|
...j || {
|
|
93
93
|
mode: "single",
|
|
94
94
|
selected: r,
|
|
95
|
-
onSelect:
|
|
95
|
+
onSelect: w
|
|
96
96
|
},
|
|
97
97
|
autoFocus: !0,
|
|
98
98
|
disabled: i,
|
|
@@ -1,316 +1,263 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { getExt as
|
|
4
|
-
import { motion as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { cn as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
case "mkv":
|
|
66
|
-
case "webm":
|
|
67
|
-
return { icon: P, colorClass: "text-rose-600" };
|
|
68
|
-
case "js":
|
|
69
|
-
case "ts":
|
|
70
|
-
case "jsx":
|
|
71
|
-
case "tsx":
|
|
72
|
-
case "json":
|
|
73
|
-
case "xml":
|
|
74
|
-
case "yml":
|
|
75
|
-
case "yaml":
|
|
76
|
-
case "html":
|
|
77
|
-
case "css":
|
|
78
|
-
case "scss":
|
|
79
|
-
return { icon: _, colorClass: "text-indigo-600" };
|
|
80
|
-
default:
|
|
81
|
-
return { icon: X, colorClass: "text-d-secondary-foreground" };
|
|
82
|
-
}
|
|
83
|
-
}, L = (e) => {
|
|
2
|
+
import { jsx as i, jsxs as a, Fragment as g } from "react/jsx-runtime";
|
|
3
|
+
import { getExt as h, imageExts as P } from "../../lib/file-preview.js";
|
|
4
|
+
import { motion as k } from "framer-motion";
|
|
5
|
+
import c, { useEffect as j } from "react";
|
|
6
|
+
import { AppTextTooltip as z } from "./app-tooltip.js";
|
|
7
|
+
import { Button as L } from "./button.js";
|
|
8
|
+
import { Command as A, CommandGroup as T, CommandItem as B } from "./command.js";
|
|
9
|
+
import { Icon as p } from "./icon.js";
|
|
10
|
+
import { Popover as I, PopoverTrigger as U, PopoverContent as E } from "./popover.js";
|
|
11
|
+
import { cn as b } from "../../lib/utils.js";
|
|
12
|
+
import l from "../../node_modules/lucide-react/dist/esm/icons/file-text.js";
|
|
13
|
+
import F from "../../node_modules/lucide-react/dist/esm/icons/file-audio.js";
|
|
14
|
+
import N from "../../node_modules/lucide-react/dist/esm/icons/file-video.js";
|
|
15
|
+
import S from "../../node_modules/lucide-react/dist/esm/icons/file.js";
|
|
16
|
+
import O from "../../node_modules/lucide-react/dist/esm/icons/file-spreadsheet.js";
|
|
17
|
+
import R from "../../node_modules/lucide-react/dist/esm/icons/file-archive.js";
|
|
18
|
+
import $ from "../../node_modules/lucide-react/dist/esm/icons/file-code.js";
|
|
19
|
+
const u = (e) => "type" in e && typeof e.type == "string" && e instanceof File, d = (e) => e.name || "url" in e && e.url || "", v = (e) => {
|
|
20
|
+
if (u(e)) return e.type || "";
|
|
21
|
+
const t = e.type;
|
|
22
|
+
return typeof t == "string" ? t : "";
|
|
23
|
+
}, W = (e, t) => {
|
|
24
|
+
const o = {
|
|
25
|
+
pdf: { icon: l, colorClass: "text-red-600" },
|
|
26
|
+
doc: { icon: l, colorClass: "text-blue-600" },
|
|
27
|
+
docx: { icon: l, colorClass: "text-blue-600" },
|
|
28
|
+
ppt: { icon: l, colorClass: "text-orange-600" },
|
|
29
|
+
pptx: { icon: l, colorClass: "text-orange-600" },
|
|
30
|
+
txt: { icon: l, colorClass: "text-gray-600" },
|
|
31
|
+
md: { icon: l, colorClass: "text-gray-600" }
|
|
32
|
+
}, r = (s, n) => s.forEach((m) => o[m] = n);
|
|
33
|
+
return r(["xls", "xlsx", "csv"], {
|
|
34
|
+
icon: O,
|
|
35
|
+
colorClass: "text-green-600"
|
|
36
|
+
}), r(["zip", "rar", "7z", "tar", "gz", "tgz"], {
|
|
37
|
+
icon: R,
|
|
38
|
+
colorClass: "text-amber-600"
|
|
39
|
+
}), r(["mp3", "wav", "ogg", "flac", "m4a"], {
|
|
40
|
+
icon: F,
|
|
41
|
+
colorClass: "text-violet-600"
|
|
42
|
+
}), r(["mp4", "mov", "avi", "mkv", "webm"], {
|
|
43
|
+
icon: N,
|
|
44
|
+
colorClass: "text-rose-600"
|
|
45
|
+
}), r(
|
|
46
|
+
[
|
|
47
|
+
"js",
|
|
48
|
+
"ts",
|
|
49
|
+
"jsx",
|
|
50
|
+
"tsx",
|
|
51
|
+
"json",
|
|
52
|
+
"xml",
|
|
53
|
+
"yml",
|
|
54
|
+
"yaml",
|
|
55
|
+
"html",
|
|
56
|
+
"css",
|
|
57
|
+
"scss"
|
|
58
|
+
],
|
|
59
|
+
{
|
|
60
|
+
icon: $,
|
|
61
|
+
colorClass: "text-indigo-600"
|
|
62
|
+
}
|
|
63
|
+
), e && o[e] ? o[e] : t?.startsWith("audio/") ? { icon: F, colorClass: "text-violet-600" } : t?.startsWith("video/") ? { icon: N, colorClass: "text-rose-600" } : t?.startsWith("text/") ? { icon: l, colorClass: "text-gray-600" } : { icon: S, colorClass: "text-d-secondary-foreground" };
|
|
64
|
+
}, _ = (e) => {
|
|
84
65
|
if (!Number.isFinite(e) || e < 0) return "";
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return `${
|
|
91
|
-
},
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
66
|
+
if (e === 0) return "0B";
|
|
67
|
+
const t = ["B", "KB", "MB", "GB", "TB"], o = Math.min(
|
|
68
|
+
Math.floor(Math.log(e) / Math.log(1024)),
|
|
69
|
+
t.length - 1
|
|
70
|
+
), r = e / 1024 ** o, s = o > 0 && r < 100 ? 2 : 0;
|
|
71
|
+
return `${r.toFixed(s)}${t[o]}`;
|
|
72
|
+
}, G = (e) => {
|
|
73
|
+
const t = u(e) ? _(e.size) : "", o = V(e);
|
|
74
|
+
return { sizeLabel: t, formatLabel: o };
|
|
75
|
+
}, D = (e, t) => e && t ? `${e} · ${t}` : e || t || null, K = {
|
|
76
|
+
layout: !0,
|
|
77
|
+
initial: { opacity: 0, y: "100%" },
|
|
78
|
+
animate: { opacity: 1, y: 0 },
|
|
79
|
+
exit: { opacity: 0, y: "100%" }
|
|
80
|
+
}, y = ({
|
|
81
|
+
sizeLabel: e,
|
|
82
|
+
formatLabel: t
|
|
83
|
+
}) => {
|
|
84
|
+
const o = D(e, t);
|
|
85
|
+
return o ? /* @__PURE__ */ i("div", { className: "text-d-secondary-foreground/70 text-xs", children: o }) : null;
|
|
86
|
+
}, V = (e) => {
|
|
87
|
+
const t = h(d(e));
|
|
88
|
+
if (t) return t.toUpperCase();
|
|
89
|
+
const o = v(e);
|
|
90
|
+
if (!o) return "";
|
|
91
|
+
if (o === "application/pdf") return "PDF";
|
|
92
|
+
const [r, s] = o.split("/");
|
|
93
|
+
return r === "image" ? s?.toUpperCase() || "IMAGE" : r === "audio" || r === "video" || r === "text" ? r.toUpperCase() : /(officedocument|msword|ms-excel|ms-powerpoint)/.test(o) ? "OFFICE" : "";
|
|
94
|
+
}, X = ({
|
|
97
95
|
url: e,
|
|
98
|
-
onPreview:
|
|
99
|
-
onDownload:
|
|
100
|
-
onRemove:
|
|
101
|
-
}) => /* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
96
|
+
onPreview: t,
|
|
97
|
+
onDownload: o,
|
|
98
|
+
onRemove: r
|
|
99
|
+
}) => /* @__PURE__ */ a(I, { children: [
|
|
100
|
+
/* @__PURE__ */ i(U, { asChild: !0, children: /* @__PURE__ */ i(L, { variant: "ghost", size: "icon", children: /* @__PURE__ */ i(p, { name: "Menu", size: "sm" }) }) }),
|
|
101
|
+
/* @__PURE__ */ i(E, { className: "w-42 p-0", align: "end", children: /* @__PURE__ */ i(A, { children: /* @__PURE__ */ i(T, { children: [
|
|
102
|
+
{
|
|
103
|
+
key: "preview",
|
|
104
|
+
cond: !!t,
|
|
105
|
+
icon: "Presentation",
|
|
106
|
+
label: "Anteprima",
|
|
107
|
+
onSelect: t
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: "download",
|
|
111
|
+
cond: !!o,
|
|
112
|
+
icon: "Download",
|
|
113
|
+
label: "Download",
|
|
114
|
+
onSelect: o
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: "remove",
|
|
118
|
+
cond: !!r,
|
|
119
|
+
icon: "Trash",
|
|
120
|
+
label: "Elimina",
|
|
121
|
+
onSelect: r,
|
|
122
|
+
danger: !0
|
|
123
|
+
}
|
|
124
|
+
].map(
|
|
125
|
+
(n) => n.cond && /* @__PURE__ */ a(
|
|
126
|
+
B,
|
|
114
127
|
{
|
|
115
|
-
onSelect: () =>
|
|
116
|
-
className: "text-
|
|
128
|
+
onSelect: () => n.onSelect?.(e),
|
|
129
|
+
className: n.danger ? "text-d-destructive" : void 0,
|
|
117
130
|
children: [
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
|
|
131
|
+
/* @__PURE__ */ i(
|
|
132
|
+
p,
|
|
133
|
+
{
|
|
134
|
+
name: n.icon,
|
|
135
|
+
size: "sm",
|
|
136
|
+
className: n.danger ? "text-d-destructive" : void 0
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ i("span", { children: n.label })
|
|
120
140
|
]
|
|
121
|
-
}
|
|
141
|
+
},
|
|
142
|
+
n.key
|
|
122
143
|
)
|
|
123
|
-
|
|
124
|
-
] })
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */ t(V, { children: /* @__PURE__ */ t("span", { children: e }) })
|
|
129
|
-
] });
|
|
130
|
-
}
|
|
131
|
-
const be = f.forwardRef(
|
|
132
|
-
(e, r) => {
|
|
133
|
-
const s = T(e.file), a = C(s), n = U(e.file), m = a === "csv" || n === "text/csv";
|
|
134
|
-
return n && n.startsWith("image/") || a && W.has(a) ? /* @__PURE__ */ t(J, { ...e, ref: r }) : !m && (a === "txt" || a === "md" || n && n.startsWith("text/")) ? /* @__PURE__ */ t(Q, { ...e, ref: r }) : /* @__PURE__ */ t(Y, { ...e, ref: r });
|
|
144
|
+
) }) }) })
|
|
145
|
+
] }), xe = c.forwardRef(
|
|
146
|
+
(e, t) => {
|
|
147
|
+
const o = d(e.file), r = h(o), s = v(e.file), n = r === "csv" || s === "text/csv";
|
|
148
|
+
return s && s.startsWith("image/") || r && P.has(r) ? /* @__PURE__ */ i(q, { ...e, ref: t }) : !n && (r === "txt" || r === "md" || s && s.startsWith("text/")) ? /* @__PURE__ */ i(H, { ...e, ref: t }) : /* @__PURE__ */ i(J, { ...e, ref: t });
|
|
135
149
|
}
|
|
136
|
-
),
|
|
150
|
+
), C = c.forwardRef(
|
|
137
151
|
({
|
|
138
152
|
file: e,
|
|
139
|
-
onRemove:
|
|
140
|
-
onPreview:
|
|
141
|
-
onDownload:
|
|
142
|
-
showActionMenu:
|
|
143
|
-
className:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
153
|
+
onRemove: t,
|
|
154
|
+
onPreview: o,
|
|
155
|
+
onDownload: r,
|
|
156
|
+
showActionMenu: s = !1,
|
|
157
|
+
className: n,
|
|
158
|
+
defaultClassName: m,
|
|
159
|
+
children: w
|
|
160
|
+
}, f) => {
|
|
161
|
+
const x = u(e) ? URL.createObjectURL(e) : e.url, M = G(e);
|
|
162
|
+
return /* @__PURE__ */ a(
|
|
163
|
+
k.div,
|
|
148
164
|
{
|
|
149
|
-
ref:
|
|
150
|
-
className:
|
|
151
|
-
"border-d-border relative flex
|
|
152
|
-
m
|
|
165
|
+
ref: f,
|
|
166
|
+
className: b(
|
|
167
|
+
"border-d-border relative flex items-center rounded-md border text-xs",
|
|
168
|
+
m,
|
|
169
|
+
n
|
|
153
170
|
),
|
|
154
|
-
|
|
155
|
-
initial: { opacity: 0, y: "100%" },
|
|
156
|
-
animate: { opacity: 1, y: 0 },
|
|
157
|
-
exit: { opacity: 0, y: "100%" },
|
|
171
|
+
...K,
|
|
158
172
|
children: [
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
alt: `Attachment ${e.name}`,
|
|
164
|
-
className: "bg-d-secondary border-d-border grid h-10 w-10 shrink-0 place-items-center rounded-sm border object-cover",
|
|
165
|
-
src: i
|
|
166
|
-
}
|
|
167
|
-
),
|
|
168
|
-
/* @__PURE__ */ o("div", { className: "min-w-0", children: [
|
|
169
|
-
/* @__PURE__ */ t(I, { text: e.name }),
|
|
170
|
-
(l || c) && /* @__PURE__ */ o("div", { className: "text-d-secondary-foreground/70 mt-0.5 text-[10px] leading-3", children: [
|
|
171
|
-
l,
|
|
172
|
-
c ? l ? ` · ${c}` : c : ""
|
|
173
|
-
] })
|
|
174
|
-
] }),
|
|
175
|
-
n && /* @__PURE__ */ t(
|
|
176
|
-
k,
|
|
173
|
+
/* @__PURE__ */ a("div", { className: "flex w-full min-w-0 items-center gap-2", children: [
|
|
174
|
+
w(x, M),
|
|
175
|
+
s && /* @__PURE__ */ i(
|
|
176
|
+
X,
|
|
177
177
|
{
|
|
178
|
-
url:
|
|
179
|
-
onPreview:
|
|
180
|
-
onDownload:
|
|
181
|
-
onRemove:
|
|
178
|
+
url: x,
|
|
179
|
+
onPreview: o,
|
|
180
|
+
onDownload: r,
|
|
181
|
+
onRemove: t
|
|
182
182
|
}
|
|
183
183
|
)
|
|
184
184
|
] }),
|
|
185
|
-
!
|
|
186
|
-
|
|
185
|
+
!s && t ? /* @__PURE__ */ i(
|
|
186
|
+
L,
|
|
187
187
|
{
|
|
188
|
-
className: "bg-d-background
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
children: /* @__PURE__ */
|
|
188
|
+
className: "bg-d-background hover:bg-d-background absolute -top-2 -right-2 flex !size-3.5 rounded-full text-xs",
|
|
189
|
+
variant: "outline",
|
|
190
|
+
size: "icon",
|
|
191
|
+
onClick: () => t(x),
|
|
192
|
+
children: /* @__PURE__ */ i(p, { name: "X", className: "h-2.5 max-w-2.5" })
|
|
193
193
|
}
|
|
194
194
|
) : null
|
|
195
195
|
]
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
|
-
),
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (d(e)) {
|
|
203
|
-
const b = new FileReader();
|
|
204
|
-
b.onload = (x) => {
|
|
205
|
-
x.target?.result && i(
|
|
206
|
-
typeof x.target.result == "string" ? x.target.result.slice(0, 100) : ""
|
|
207
|
-
);
|
|
208
|
-
}, b.readAsText(e);
|
|
209
|
-
} else
|
|
210
|
-
i("Anteprima non disponibile");
|
|
211
|
-
}, [e]), /* @__PURE__ */ o(
|
|
212
|
-
F.div,
|
|
199
|
+
), q = c.forwardRef((e, t) => /* @__PURE__ */ i(C, { ...e, ref: t, defaultClassName: "gap-2 p-1.5 pr-2", children: (o, r) => /* @__PURE__ */ a(g, { children: [
|
|
200
|
+
/* @__PURE__ */ i(
|
|
201
|
+
"img",
|
|
213
202
|
{
|
|
214
|
-
|
|
215
|
-
className:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
exit: { opacity: 0, y: "100%" },
|
|
220
|
-
children: [
|
|
221
|
-
/* @__PURE__ */ o("div", { className: "flex w-full min-w-0 items-center space-x-2", children: [
|
|
222
|
-
/* @__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: p }),
|
|
223
|
-
/* @__PURE__ */ o("div", { className: "min-w-0", children: [
|
|
224
|
-
/* @__PURE__ */ t(I, { text: e.name }),
|
|
225
|
-
(c || u) && /* @__PURE__ */ o("div", { className: "text-d-secondary-foreground/70 mt-0.5 text-[10px] leading-3", children: [
|
|
226
|
-
c,
|
|
227
|
-
u ? c ? ` · ${u}` : u : ""
|
|
228
|
-
] })
|
|
229
|
-
] }),
|
|
230
|
-
n && /* @__PURE__ */ t(
|
|
231
|
-
k,
|
|
232
|
-
{
|
|
233
|
-
url: l,
|
|
234
|
-
onPreview: s,
|
|
235
|
-
onDownload: a,
|
|
236
|
-
onRemove: r
|
|
237
|
-
}
|
|
238
|
-
)
|
|
239
|
-
] }),
|
|
240
|
-
!n && r ? /* @__PURE__ */ t(
|
|
241
|
-
"button",
|
|
242
|
-
{
|
|
243
|
-
className: "bg-d-background border-d-border absolute -top-2 -right-2 flex h-4 w-4 items-center justify-center rounded-full border",
|
|
244
|
-
type: "button",
|
|
245
|
-
onClick: () => r(l),
|
|
246
|
-
"aria-label": "Remove attachment",
|
|
247
|
-
children: /* @__PURE__ */ t(z, { className: "h-2.5 w-2.5" })
|
|
248
|
-
}
|
|
249
|
-
) : null
|
|
250
|
-
]
|
|
203
|
+
alt: `Attachment ${d(e.file)}`,
|
|
204
|
+
className: b(
|
|
205
|
+
"bg-d-secondary border-d-border h-10 w-10 shrink-0 rounded-sm border object-cover"
|
|
206
|
+
),
|
|
207
|
+
src: o
|
|
251
208
|
}
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
onPreview: s,
|
|
258
|
-
onDownload: a,
|
|
259
|
-
showActionMenu: n = !1,
|
|
260
|
-
className: m
|
|
261
|
-
}, p) => {
|
|
262
|
-
const i = d(e) ? URL.createObjectURL(e) : e.url, l = T(e), c = C(l), u = U(e), { icon: b, colorClass: x } = H(c, u), w = d(e) ? L(e.size) : "", g = j(e);
|
|
263
|
-
return /* @__PURE__ */ o(
|
|
264
|
-
F.div,
|
|
209
|
+
),
|
|
210
|
+
/* @__PURE__ */ a("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
211
|
+
/* @__PURE__ */ i(z, { text: d(e.file) }),
|
|
212
|
+
/* @__PURE__ */ i(
|
|
213
|
+
y,
|
|
265
214
|
{
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
"border-d-border relative flex max-w-[200px] rounded-md border p-1.5 pr-2 text-xs",
|
|
269
|
-
m
|
|
270
|
-
),
|
|
271
|
-
layout: !0,
|
|
272
|
-
initial: { opacity: 0, y: "100%" },
|
|
273
|
-
animate: { opacity: 1, y: 0 },
|
|
274
|
-
exit: { opacity: 0, y: "100%" },
|
|
275
|
-
children: [
|
|
276
|
-
/* @__PURE__ */ o("div", { className: "flex w-full min-w-0 cursor-pointer items-center space-x-2", children: [
|
|
277
|
-
/* @__PURE__ */ t("div", { className: "bg-d-secondary grid h-10 w-10 shrink-0 place-items-center rounded-sm", children: /* @__PURE__ */ t(b, { className: N("h-5 w-5", x) }) }),
|
|
278
|
-
/* @__PURE__ */ o("div", { className: "min-w-0", children: [
|
|
279
|
-
/* @__PURE__ */ t(I, { text: e.name }),
|
|
280
|
-
(w || g) && /* @__PURE__ */ o("div", { className: "text-d-secondary-foreground/70 mt-0.5 text-[10px] leading-3", children: [
|
|
281
|
-
w,
|
|
282
|
-
g ? w ? ` · ${g}` : g : ""
|
|
283
|
-
] })
|
|
284
|
-
] }),
|
|
285
|
-
n && /* @__PURE__ */ t(
|
|
286
|
-
k,
|
|
287
|
-
{
|
|
288
|
-
url: i,
|
|
289
|
-
onPreview: s,
|
|
290
|
-
onDownload: a,
|
|
291
|
-
onRemove: r
|
|
292
|
-
}
|
|
293
|
-
)
|
|
294
|
-
] }),
|
|
295
|
-
!n && r ? /* @__PURE__ */ t(
|
|
296
|
-
"button",
|
|
297
|
-
{
|
|
298
|
-
className: "bg-d-background border-d-border absolute -top-2 -right-2 flex h-4 w-4 items-center justify-center rounded-full border",
|
|
299
|
-
type: "button",
|
|
300
|
-
onClick: () => r(i),
|
|
301
|
-
"aria-label": "Remove attachment",
|
|
302
|
-
children: /* @__PURE__ */ t(z, { className: "h-2.5 w-2.5" })
|
|
303
|
-
}
|
|
304
|
-
) : null
|
|
305
|
-
]
|
|
215
|
+
sizeLabel: r.sizeLabel,
|
|
216
|
+
formatLabel: r.formatLabel
|
|
306
217
|
}
|
|
307
|
-
)
|
|
308
|
-
}
|
|
309
|
-
)
|
|
218
|
+
)
|
|
219
|
+
] })
|
|
220
|
+
] }) })), H = c.forwardRef((e, t) => {
|
|
221
|
+
const [o, r] = c.useState("");
|
|
222
|
+
return j(() => {
|
|
223
|
+
if (u(e.file)) {
|
|
224
|
+
const s = new FileReader();
|
|
225
|
+
s.onload = (n) => {
|
|
226
|
+
n.target?.result && r(
|
|
227
|
+
typeof n.target.result == "string" ? n.target.result.slice(0, 100) : ""
|
|
228
|
+
);
|
|
229
|
+
}, s.readAsText(e.file);
|
|
230
|
+
} else
|
|
231
|
+
r("Anteprima non disponibile");
|
|
232
|
+
}, [e.file]), /* @__PURE__ */ i(C, { ...e, ref: t, defaultClassName: "gap-2 p-1.5 pr-2", children: (s, n) => /* @__PURE__ */ a(g, { children: [
|
|
233
|
+
/* @__PURE__ */ i("div", { className: "bg-d-secondary border-d-border flex h-10 w-10 shrink-0 items-center justify-center rounded-sm border p-1 text-[8px]", children: o }),
|
|
234
|
+
/* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ i(
|
|
235
|
+
y,
|
|
236
|
+
{
|
|
237
|
+
sizeLabel: n.sizeLabel,
|
|
238
|
+
formatLabel: n.formatLabel
|
|
239
|
+
}
|
|
240
|
+
) })
|
|
241
|
+
] }) });
|
|
242
|
+
}), J = c.forwardRef((e, t) => {
|
|
243
|
+
const o = d(e.file), r = h(o), s = v(e.file), { icon: n, colorClass: m } = W(r, s);
|
|
244
|
+
return /* @__PURE__ */ i(C, { ...e, ref: t, defaultClassName: "gap-2 p-1.5 pr-2", children: (w, f) => /* @__PURE__ */ a(g, { children: [
|
|
245
|
+
/* @__PURE__ */ i("div", { className: "bg-d-secondary flex h-10 w-10 shrink-0 items-center justify-center rounded-sm", children: /* @__PURE__ */ i(n, { className: b("h-5 w-5", m) }) }),
|
|
246
|
+
/* @__PURE__ */ a("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
247
|
+
/* @__PURE__ */ i(z, { text: o }),
|
|
248
|
+
/* @__PURE__ */ i(
|
|
249
|
+
y,
|
|
250
|
+
{
|
|
251
|
+
sizeLabel: f.sizeLabel,
|
|
252
|
+
formatLabel: f.formatLabel
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] })
|
|
256
|
+
] }) });
|
|
257
|
+
});
|
|
310
258
|
export {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
I as default
|
|
259
|
+
xe as FilePreview,
|
|
260
|
+
J as GenericFilePreview,
|
|
261
|
+
q as ImageFilePreview,
|
|
262
|
+
H as TextFilePreview
|
|
316
263
|
};
|