laif-ds 0.2.13 → 0.2.15
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/index4.js +5 -5
- package/dist/_virtual/index5.js +5 -5
- package/dist/components/ui/app-select.js +61 -57
- package/dist/components/ui/carousel.js +4 -4
- package/dist/components/ui/chart.js +4 -4
- package/dist/components/ui/file-previewer.js +170 -0
- package/dist/components/ui/navigation-menu.js +7 -7
- package/dist/components/ui/textarea.js +24 -15
- package/dist/index.d.ts +30 -2
- package/dist/index.js +128 -124
- package/dist/lib/file-preview.js +33 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.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
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDefaultExportFromCjs as
|
|
3
|
-
import { __require as
|
|
4
|
-
var t =
|
|
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
|
};
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDefaultExportFromCjs as
|
|
3
|
-
import { __require as
|
|
4
|
-
var t =
|
|
5
|
-
const
|
|
2
|
+
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as r } from "../node_modules/extend/index.js";
|
|
4
|
+
var t = r();
|
|
5
|
+
const x = /* @__PURE__ */ e(t);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
x as default
|
|
8
8
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as o, jsx as
|
|
3
|
-
import { Badge as
|
|
4
|
-
import { Command as
|
|
2
|
+
import { jsxs as o, jsx as l, Fragment as te } from "react/jsx-runtime";
|
|
3
|
+
import { Badge as le } from "./badge.js";
|
|
4
|
+
import { Command as ne, CommandInput as re, CommandList as ae, CommandEmpty as se, CommandGroup as k, CommandItem as D } from "./command.js";
|
|
5
5
|
import { Label as oe } from "./label.js";
|
|
6
6
|
import { cn as g } from "../../lib/utils.js";
|
|
7
7
|
import * as s from "react";
|
|
8
8
|
import { Checkbox as ie } from "./checkbox.js";
|
|
9
9
|
import { Icon as j } from "./icon.js";
|
|
10
|
-
import { Popover as
|
|
10
|
+
import { Popover as ce, PopoverTrigger as de, PopoverContent as ue } from "./popover.js";
|
|
11
11
|
import me from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
|
|
12
12
|
const fe = {
|
|
13
13
|
sm: "min-h-8 h-8 text-xs py-1.5",
|
|
@@ -22,7 +22,7 @@ function Se(B) {
|
|
|
22
22
|
const {
|
|
23
23
|
multiple: a = !1,
|
|
24
24
|
options: f,
|
|
25
|
-
value:
|
|
25
|
+
value: S,
|
|
26
26
|
defaultValue: A,
|
|
27
27
|
onValueChange: R,
|
|
28
28
|
onClear: b,
|
|
@@ -32,108 +32,112 @@ function Se(B) {
|
|
|
32
32
|
addItemPlaceholder: T = "Aggiungi",
|
|
33
33
|
itemCountMessage: W = (e) => `${e} elementi selezionati`,
|
|
34
34
|
maxSelectedMessage: X = (e) => `Puoi selezionare fino a ${e} elementi`,
|
|
35
|
-
label:
|
|
35
|
+
label: P,
|
|
36
36
|
className: $ = "",
|
|
37
37
|
wrpClassName: q = "",
|
|
38
|
-
searchable:
|
|
38
|
+
searchable: V = !1,
|
|
39
39
|
creatable: G = !1,
|
|
40
40
|
groupBy: v = "group",
|
|
41
41
|
maxSelected: i,
|
|
42
42
|
showChipsInsteadOfCount: H = !1,
|
|
43
43
|
disabled: x,
|
|
44
|
-
size:
|
|
45
|
-
} = B, [C, w] = s.useState(!1), [d, y] = s.useState(""), c = s.useRef(null), [J, K] = s.useState(0), [Q,
|
|
44
|
+
size: z = "default"
|
|
45
|
+
} = B, [C, w] = s.useState(!1), [d, y] = s.useState(""), c = s.useRef(null), [J, K] = s.useState(0), [Q, N] = s.useState(null);
|
|
46
46
|
s.useEffect(() => {
|
|
47
47
|
if (c.current) {
|
|
48
48
|
const e = c.current.closest(
|
|
49
49
|
'[data-slot="drawer-content"]'
|
|
50
50
|
);
|
|
51
|
-
e &&
|
|
52
|
-
const
|
|
51
|
+
e && N(e);
|
|
52
|
+
const n = c.current.closest(
|
|
53
53
|
'[data-slot="sheet-content"]'
|
|
54
54
|
);
|
|
55
|
-
|
|
55
|
+
n && N(n);
|
|
56
|
+
const t = c.current.closest(
|
|
57
|
+
'[data-slot="dialog-content"]'
|
|
58
|
+
);
|
|
59
|
+
t && N(t);
|
|
56
60
|
}
|
|
57
61
|
}, []);
|
|
58
|
-
const O =
|
|
62
|
+
const O = S !== void 0, [U, Y] = s.useState(A), u = O ? S : U, m = (e) => {
|
|
59
63
|
O || Y(e), R?.(e);
|
|
60
|
-
},
|
|
61
|
-
const e = f.filter((
|
|
64
|
+
}, r = s.useMemo(() => a ? Array.isArray(u) ? u : [] : u != null ? [u] : [], [u, a]), p = s.useMemo(() => {
|
|
65
|
+
const e = f.filter((n) => r.includes(n.value));
|
|
62
66
|
if (a) {
|
|
63
|
-
const
|
|
64
|
-
return [...e, ...
|
|
65
|
-
} else if (
|
|
66
|
-
return [{ value:
|
|
67
|
+
const n = r.filter((t) => !e.find((h) => h.value === t)).map((t) => ({ value: t, label: t }));
|
|
68
|
+
return [...e, ...n];
|
|
69
|
+
} else if (r.length && !e.length)
|
|
70
|
+
return [{ value: r[0], label: r[0] }];
|
|
67
71
|
return e;
|
|
68
|
-
}, [f,
|
|
72
|
+
}, [f, r, a]), I = (e) => {
|
|
69
73
|
if (!e.disabled)
|
|
70
74
|
if (a) {
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
75
|
+
const n = r.includes(e.value);
|
|
76
|
+
if (!n && i !== void 0 && r.length >= i)
|
|
73
77
|
return;
|
|
74
78
|
m(
|
|
75
|
-
|
|
79
|
+
n ? r.filter((t) => t !== e.value) : [...r, e.value]
|
|
76
80
|
);
|
|
77
81
|
} else
|
|
78
82
|
m(e.value), w(!1);
|
|
79
83
|
}, Z = s.useCallback(() => {
|
|
80
84
|
m([]), y(""), b && b();
|
|
81
85
|
}, [m, b]), _ = s.useMemo(() => v ? f.reduce(
|
|
82
|
-
(e,
|
|
83
|
-
const
|
|
84
|
-
return e[
|
|
86
|
+
(e, n) => {
|
|
87
|
+
const t = n[v] || "";
|
|
88
|
+
return e[t] = e[t] || [], e[t].push(n), e;
|
|
85
89
|
},
|
|
86
90
|
{}
|
|
87
91
|
) : { "": f }, [f, v]);
|
|
88
92
|
return s.useEffect(() => {
|
|
89
93
|
C && c.current && K(c.current.getBoundingClientRect().width);
|
|
90
94
|
}, [C]), /* @__PURE__ */ o("div", { className: g("flex flex-col gap-2", q), children: [
|
|
91
|
-
|
|
95
|
+
P && /* @__PURE__ */ l(oe, { children: P }),
|
|
92
96
|
/* @__PURE__ */ o(
|
|
93
|
-
|
|
97
|
+
ce,
|
|
94
98
|
{
|
|
95
99
|
open: x ? !1 : C,
|
|
96
100
|
onOpenChange: (e) => !x && w(e),
|
|
97
101
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ l(de, { asChild: !0, children: /* @__PURE__ */ o(
|
|
99
103
|
"div",
|
|
100
104
|
{
|
|
101
105
|
ref: c,
|
|
102
106
|
className: g(
|
|
103
107
|
"bg-d-input border-d-border/50 focus-within:ring-d-ring flex min-h-10 w-full min-w-[100px] items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm focus-within:ring-1",
|
|
104
|
-
fe[
|
|
108
|
+
fe[z],
|
|
105
109
|
x && "cursor-not-allowed opacity-50",
|
|
106
110
|
$
|
|
107
111
|
),
|
|
108
112
|
children: [
|
|
109
|
-
p.length === 0 ? /* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
|
|
113
|
+
p.length === 0 ? /* @__PURE__ */ l("span", { className: "text-d-muted-foreground", children: E }) : a ? /* @__PURE__ */ o("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
|
|
114
|
+
/* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: H ? /* @__PURE__ */ l(te, { children: p.map((e) => /* @__PURE__ */ o(
|
|
115
|
+
le,
|
|
112
116
|
{
|
|
113
117
|
variant: "secondary",
|
|
114
118
|
className: "hover:bg-d-secondary/100 bg-d-secondary/50 border-d-border flex cursor-pointer items-center gap-1 border",
|
|
115
|
-
onClick: (
|
|
116
|
-
|
|
119
|
+
onClick: (n) => {
|
|
120
|
+
n.stopPropagation(), I(e);
|
|
117
121
|
},
|
|
118
122
|
children: [
|
|
119
123
|
e.label,
|
|
120
|
-
!e.fixed && /* @__PURE__ */
|
|
124
|
+
!e.fixed && /* @__PURE__ */ l(j, { name: "X", size: "xs" })
|
|
121
125
|
]
|
|
122
126
|
},
|
|
123
127
|
e.value
|
|
124
|
-
)) }) : /* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
128
|
+
)) }) : /* @__PURE__ */ l("div", { children: W(p.length) }) }),
|
|
129
|
+
/* @__PURE__ */ l(
|
|
126
130
|
"div",
|
|
127
131
|
{
|
|
128
132
|
className: g(
|
|
129
133
|
"border-d-input bg-d-accent flex aspect-square cursor-pointer items-center rounded-full p-1",
|
|
130
|
-
he[
|
|
134
|
+
he[z]
|
|
131
135
|
),
|
|
132
136
|
onClick: (e) => {
|
|
133
137
|
e.stopPropagation(), e.preventDefault(), Z();
|
|
134
138
|
},
|
|
135
139
|
onMouseDown: (e) => e.preventDefault(),
|
|
136
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ l(
|
|
137
141
|
j,
|
|
138
142
|
{
|
|
139
143
|
name: "X",
|
|
@@ -143,12 +147,12 @@ function Se(B) {
|
|
|
143
147
|
)
|
|
144
148
|
}
|
|
145
149
|
)
|
|
146
|
-
] }) : /* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
150
|
+
] }) : /* @__PURE__ */ l("span", { children: p[0]?.label }),
|
|
151
|
+
/* @__PURE__ */ l(me, { className: "h-4 w-4 opacity-50" })
|
|
148
152
|
]
|
|
149
153
|
}
|
|
150
154
|
) }),
|
|
151
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ l(
|
|
152
156
|
ue,
|
|
153
157
|
{
|
|
154
158
|
className: "p-0",
|
|
@@ -156,9 +160,9 @@ function Se(B) {
|
|
|
156
160
|
align: "start",
|
|
157
161
|
sideOffset: 4,
|
|
158
162
|
container: Q,
|
|
159
|
-
children: /* @__PURE__ */ o(
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
children: /* @__PURE__ */ o(ne, { shouldFilter: !!V, className: "w-full", children: [
|
|
164
|
+
V && /* @__PURE__ */ l("div", { className: "border-d-border border-b p-0.5", children: /* @__PURE__ */ l(
|
|
165
|
+
re,
|
|
162
166
|
{
|
|
163
167
|
placeholder: L,
|
|
164
168
|
value: d,
|
|
@@ -166,13 +170,13 @@ function Se(B) {
|
|
|
166
170
|
}
|
|
167
171
|
) }),
|
|
168
172
|
/* @__PURE__ */ o(ae, { className: "max-h-60 overflow-auto overscroll-contain", children: [
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
G && d && /* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ l(se, { children: F }),
|
|
174
|
+
G && d && /* @__PURE__ */ l(k, { children: /* @__PURE__ */ l(
|
|
171
175
|
D,
|
|
172
176
|
{
|
|
173
177
|
className: "cursor-pointer",
|
|
174
178
|
onSelect: () => {
|
|
175
|
-
d && (m(a ? [...
|
|
179
|
+
d && (m(a ? [...r, d] : d), y(""), !a && w(!1));
|
|
176
180
|
},
|
|
177
181
|
children: /* @__PURE__ */ o("div", { className: "text-d-foreground text-xs", children: [
|
|
178
182
|
T,
|
|
@@ -182,13 +186,13 @@ function Se(B) {
|
|
|
182
186
|
] })
|
|
183
187
|
}
|
|
184
188
|
) }),
|
|
185
|
-
Object.entries(_).map(([e,
|
|
186
|
-
const h =
|
|
189
|
+
Object.entries(_).map(([e, n]) => /* @__PURE__ */ l(k, { heading: e || void 0, children: n.map((t) => {
|
|
190
|
+
const h = r.includes(t.value), ee = a && i !== void 0 && !h && r.length >= i, M = t.disabled || ee;
|
|
187
191
|
return /* @__PURE__ */ o(
|
|
188
192
|
D,
|
|
189
193
|
{
|
|
190
|
-
value: typeof
|
|
191
|
-
onSelect: () => !M && I(
|
|
194
|
+
value: typeof t.label == "string" ? t.label : String(t.value),
|
|
195
|
+
onSelect: () => !M && I(t),
|
|
192
196
|
className: g(
|
|
193
197
|
"cursor-pointer",
|
|
194
198
|
M && "cursor-not-allowed opacity-50",
|
|
@@ -196,15 +200,15 @@ function Se(B) {
|
|
|
196
200
|
// highlight single select
|
|
197
201
|
),
|
|
198
202
|
children: [
|
|
199
|
-
a && /* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */
|
|
203
|
+
a && /* @__PURE__ */ l(ie, { checked: h, className: "mr-1" }),
|
|
204
|
+
/* @__PURE__ */ l("span", { children: t.label })
|
|
201
205
|
]
|
|
202
206
|
},
|
|
203
|
-
|
|
207
|
+
t.value
|
|
204
208
|
);
|
|
205
209
|
}) }, e))
|
|
206
210
|
] }),
|
|
207
|
-
a && i !== void 0 &&
|
|
211
|
+
a && i !== void 0 && r.length >= i && /* @__PURE__ */ l("div", { className: "border-d-border text-d-muted-foreground border-t px-2 py-1 text-xs", children: X(i) })
|
|
208
212
|
] })
|
|
209
213
|
}
|
|
210
214
|
)
|
|
@@ -4,8 +4,8 @@ import * as l from "react";
|
|
|
4
4
|
import k from "../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
|
|
5
5
|
import { cn as d } from "../../lib/utils.js";
|
|
6
6
|
import { Button as v } from "./button.js";
|
|
7
|
-
import z from "../../node_modules/lucide-react/dist/esm/icons/arrow-
|
|
8
|
-
import g from "../../node_modules/lucide-react/dist/esm/icons/arrow-
|
|
7
|
+
import z from "../../node_modules/lucide-react/dist/esm/icons/arrow-right.js";
|
|
8
|
+
import g from "../../node_modules/lucide-react/dist/esm/icons/arrow-left.js";
|
|
9
9
|
const p = l.createContext(null);
|
|
10
10
|
function m() {
|
|
11
11
|
const o = l.useContext(p);
|
|
@@ -136,7 +136,7 @@ function q({
|
|
|
136
136
|
onClick: i,
|
|
137
137
|
...s,
|
|
138
138
|
children: [
|
|
139
|
-
/* @__PURE__ */ a(
|
|
139
|
+
/* @__PURE__ */ a(g, {}),
|
|
140
140
|
/* @__PURE__ */ a("span", { className: "sr-only", children: "Previous slide" })
|
|
141
141
|
]
|
|
142
142
|
}
|
|
@@ -164,7 +164,7 @@ function F({
|
|
|
164
164
|
onClick: i,
|
|
165
165
|
...s,
|
|
166
166
|
children: [
|
|
167
|
-
/* @__PURE__ */ a(
|
|
167
|
+
/* @__PURE__ */ a(z, {}),
|
|
168
168
|
/* @__PURE__ */ a("span", { className: "sr-only", children: "Next slide" })
|
|
169
169
|
]
|
|
170
170
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as s, jsxs as f, Fragment as L } from "react/jsx-runtime";
|
|
3
3
|
import * as p from "react";
|
|
4
4
|
import { cn as l } from "../../lib/utils.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Legend as T } from "../../node_modules/recharts/es6/component/Legend.js";
|
|
6
|
+
import { Tooltip as I } from "../../node_modules/recharts/es6/component/Tooltip.js";
|
|
7
7
|
import { ResponsiveContainer as K } from "../../node_modules/recharts/es6/component/ResponsiveContainer.js";
|
|
8
8
|
const P = { light: "", dark: ".dark" }, N = p.createContext(null);
|
|
9
9
|
function j() {
|
|
@@ -60,7 +60,7 @@ ${t.map(([d, o]) => {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
) : null;
|
|
63
|
-
}, z =
|
|
63
|
+
}, z = I;
|
|
64
64
|
function A({
|
|
65
65
|
active: c,
|
|
66
66
|
payload: e,
|
|
@@ -155,7 +155,7 @@ function A({
|
|
|
155
155
|
}
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
|
-
const B =
|
|
158
|
+
const B = T;
|
|
159
159
|
function D({
|
|
160
160
|
className: c,
|
|
161
161
|
hideIcon: e = !1,
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t, jsxs as T } from "react/jsx-runtime";
|
|
3
|
+
import { createAsk as j } from "../../node_modules/use-ask/dist/index.js";
|
|
4
|
+
import { Dialog as U, DialogContent as O, DialogHeader as E, DialogTitle as L, DialogDescription as k } from "./dialog.js";
|
|
5
|
+
import { Icon as C } from "./icon.js";
|
|
6
|
+
import { getExt as M, guessKind as S, isHttpUrl as A, getOfficeEmbedUrl as z } from "../../lib/file-preview.js";
|
|
7
|
+
import { cn as H } from "../../lib/utils.js";
|
|
8
|
+
import { useRef as q, useState as x, useEffect as N, useMemo as g } from "react";
|
|
9
|
+
const [R, B] = j({});
|
|
10
|
+
function D(r) {
|
|
11
|
+
return typeof r == "string" ? { url: r } : r instanceof File ? { file: r, filename: r.name, mimeType: r.type } : typeof r == "function" ? { loader: r } : r && typeof r.then == "function" ? { loader: r } : r || {};
|
|
12
|
+
}
|
|
13
|
+
async function _(r) {
|
|
14
|
+
return R.ask(D(r));
|
|
15
|
+
}
|
|
16
|
+
function $(r) {
|
|
17
|
+
return R.safeAsk(D(r));
|
|
18
|
+
}
|
|
19
|
+
function I(r, s, a) {
|
|
20
|
+
const n = q(null), [d, u] = x(!1), [v, m] = x(null), [y, c] = x(null), [e, p] = x({});
|
|
21
|
+
N(() => {
|
|
22
|
+
if (!s) {
|
|
23
|
+
p({}), u(!1), m(null);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const i = r || {};
|
|
27
|
+
p({
|
|
28
|
+
url: i.url,
|
|
29
|
+
file: i.file,
|
|
30
|
+
filename: i.filename,
|
|
31
|
+
mimeType: i.mimeType,
|
|
32
|
+
title: i.title
|
|
33
|
+
});
|
|
34
|
+
const o = i.loader;
|
|
35
|
+
if (!o) return;
|
|
36
|
+
let f = !1;
|
|
37
|
+
return u(!0), m(null), (async () => {
|
|
38
|
+
try {
|
|
39
|
+
const l = typeof o == "function" ? await o() : await o;
|
|
40
|
+
if (f) return;
|
|
41
|
+
typeof l == "string" ? p((h) => ({ ...h, url: l })) : l instanceof File ? p((h) => ({
|
|
42
|
+
...h,
|
|
43
|
+
file: l,
|
|
44
|
+
filename: l.name,
|
|
45
|
+
mimeType: l.type
|
|
46
|
+
})) : l && typeof l == "object" && p((h) => ({ ...h, ...l }));
|
|
47
|
+
} catch (l) {
|
|
48
|
+
f || m(l?.message || "Errore durante il caricamento della preview");
|
|
49
|
+
} finally {
|
|
50
|
+
f || u(!1);
|
|
51
|
+
}
|
|
52
|
+
})(), () => {
|
|
53
|
+
f = !0;
|
|
54
|
+
};
|
|
55
|
+
}, [s, a, r]), N(() => {
|
|
56
|
+
if (e.file) {
|
|
57
|
+
const i = URL.createObjectURL(e.file);
|
|
58
|
+
return n.current = i, () => {
|
|
59
|
+
n.current && (URL.revokeObjectURL(n.current), n.current = null);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}, [e.file]);
|
|
63
|
+
const F = g(
|
|
64
|
+
() => e.file ? n.current || void 0 : e.url,
|
|
65
|
+
[e.file, e.url]
|
|
66
|
+
), w = g(
|
|
67
|
+
() => e.filename || e.file?.name || M(e.url || "") || "document",
|
|
68
|
+
[e.filename, e.file, e.url]
|
|
69
|
+
), b = g(
|
|
70
|
+
() => S({
|
|
71
|
+
mimeType: e.mimeType,
|
|
72
|
+
filename: w,
|
|
73
|
+
url: e.url
|
|
74
|
+
}),
|
|
75
|
+
[e.mimeType, w, e.url]
|
|
76
|
+
);
|
|
77
|
+
N(() => {
|
|
78
|
+
if (c(null), b === "text")
|
|
79
|
+
if (e.file) {
|
|
80
|
+
const i = new FileReader();
|
|
81
|
+
i.onload = (o) => {
|
|
82
|
+
if (typeof o.target?.result == "string") {
|
|
83
|
+
const f = o.target.result.length > 2e5 ? o.target.result.slice(0, 2e5) + `
|
|
84
|
+
…` : o.target.result;
|
|
85
|
+
c(f);
|
|
86
|
+
}
|
|
87
|
+
}, i.readAsText(e.file);
|
|
88
|
+
} else e.url && A(e.url) ? fetch(e.url).then((i) => i.text()).then(
|
|
89
|
+
(i) => c(i.length > 2e5 ? i.slice(0, 2e5) + `
|
|
90
|
+
…` : i)
|
|
91
|
+
).catch(() => c("Anteprima non disponibile")) : c("Anteprima non disponibile");
|
|
92
|
+
}, [b, e.file, e.url, a]);
|
|
93
|
+
const P = g(
|
|
94
|
+
() => /* @__PURE__ */ T("span", { className: "flex items-center gap-2", children: [
|
|
95
|
+
/* @__PURE__ */ t(C, { name: "File", className: "h-4 w-4" }),
|
|
96
|
+
r?.title || e.title || w
|
|
97
|
+
] }),
|
|
98
|
+
[r, e.title, w]
|
|
99
|
+
);
|
|
100
|
+
return { loading: d, error: v, src: F, text: y, kind: b, title: P };
|
|
101
|
+
}
|
|
102
|
+
const ee = () => {
|
|
103
|
+
const [{ key: r, payload: s }, { asking: a, cancel: n }] = B(), { loading: d, error: u, src: v, text: m, kind: y, title: c } = I(
|
|
104
|
+
s,
|
|
105
|
+
a,
|
|
106
|
+
r
|
|
107
|
+
);
|
|
108
|
+
return /* @__PURE__ */ t(U, { open: a, onOpenChange: (e) => !e && n(), children: /* @__PURE__ */ T(O, { size: "xl", className: "sm:max-w-4xl", children: [
|
|
109
|
+
/* @__PURE__ */ T(E, { children: [
|
|
110
|
+
/* @__PURE__ */ t(L, { children: c }),
|
|
111
|
+
u ? /* @__PURE__ */ t(k, { className: "text-red-600", children: u }) : null
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ t("div", { className: H("relative", "max-h-[80vh] overflow-auto p-1"), children: d ? /* @__PURE__ */ t("div", { className: "grid h-[60vh] place-items-center", children: /* @__PURE__ */ t("div", { className: "border-d-border border-t-d-foreground h-10 w-10 animate-spin rounded-full border-2" }) }) : /* @__PURE__ */ t(K, { kind: y, src: v, text: m, officeUrl: v }) })
|
|
114
|
+
] }) });
|
|
115
|
+
}, K = ({
|
|
116
|
+
kind: r,
|
|
117
|
+
src: s,
|
|
118
|
+
text: a,
|
|
119
|
+
officeUrl: n
|
|
120
|
+
}) => {
|
|
121
|
+
if (!s && r !== "text" && r !== "office")
|
|
122
|
+
return /* @__PURE__ */ t("div", { className: "text-d-secondary-foreground", children: "Nessuna sorgente disponibile" });
|
|
123
|
+
switch (r) {
|
|
124
|
+
case "image":
|
|
125
|
+
return /* @__PURE__ */ t("div", { className: "grid place-items-center", children: /* @__PURE__ */ t(
|
|
126
|
+
"img",
|
|
127
|
+
{
|
|
128
|
+
src: s,
|
|
129
|
+
alt: "preview",
|
|
130
|
+
className: "max-h-[78vh] w-auto max-w-full object-contain"
|
|
131
|
+
}
|
|
132
|
+
) });
|
|
133
|
+
case "pdf":
|
|
134
|
+
return /* @__PURE__ */ t(
|
|
135
|
+
"iframe",
|
|
136
|
+
{
|
|
137
|
+
src: s,
|
|
138
|
+
title: "PDF Preview",
|
|
139
|
+
className: "h-[78vh] w-full rounded"
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
case "audio":
|
|
143
|
+
return /* @__PURE__ */ t("div", { className: "grid place-items-center", children: /* @__PURE__ */ t("audio", { controls: !0, className: "w-full max-w-2xl", children: /* @__PURE__ */ t("source", { src: s }) }) });
|
|
144
|
+
case "video":
|
|
145
|
+
return /* @__PURE__ */ t("div", { className: "grid place-items-center", children: /* @__PURE__ */ t("video", { controls: !0, className: "max-h-[78vh] w-full max-w-3xl rounded", children: /* @__PURE__ */ t("source", { src: s }) }) });
|
|
146
|
+
case "text":
|
|
147
|
+
return /* @__PURE__ */ t("pre", { className: "max-h-[78vh] overflow-auto rounded border p-3 text-sm whitespace-pre-wrap", children: a || "Caricamento…" });
|
|
148
|
+
case "office": {
|
|
149
|
+
if (n && A(n)) {
|
|
150
|
+
const d = z(n);
|
|
151
|
+
return /* @__PURE__ */ t(
|
|
152
|
+
"iframe",
|
|
153
|
+
{
|
|
154
|
+
src: d,
|
|
155
|
+
title: "Office Preview",
|
|
156
|
+
className: "h-[78vh] w-full rounded"
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
return /* @__PURE__ */ t("div", { className: "rounded border p-3 text-sm", children: 'Anteprima Office non disponibile per file locali. Usa "Apri in nuova scheda" o "Download".' });
|
|
161
|
+
}
|
|
162
|
+
default:
|
|
163
|
+
return /* @__PURE__ */ t("div", { className: "rounded border p-3 text-sm", children: "Anteprima non disponibile per questo tipo di file." });
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
export {
|
|
167
|
+
ee as FilePreviewer,
|
|
168
|
+
_ as previewFileModal,
|
|
169
|
+
$ as safePreviewFileModal
|
|
170
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { Root as d,
|
|
3
|
+
import { Root as d, Content as s, Indicator as u, Item as l, Link as g, List as c, Trigger as m, Viewport as v } from "../../node_modules/@radix-ui/react-navigation-menu/dist/index.js";
|
|
4
4
|
import { cva as f } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
5
|
import { cn as o } from "../../lib/utils.js";
|
|
6
6
|
import p from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
|
|
@@ -32,7 +32,7 @@ function j({
|
|
|
32
32
|
...a
|
|
33
33
|
}) {
|
|
34
34
|
return /* @__PURE__ */ e(
|
|
35
|
-
|
|
35
|
+
c,
|
|
36
36
|
{
|
|
37
37
|
"data-slot": "navigation-menu-list",
|
|
38
38
|
className: o(
|
|
@@ -48,7 +48,7 @@ function k({
|
|
|
48
48
|
...a
|
|
49
49
|
}) {
|
|
50
50
|
return /* @__PURE__ */ e(
|
|
51
|
-
|
|
51
|
+
l,
|
|
52
52
|
{
|
|
53
53
|
"data-slot": "navigation-menu-item",
|
|
54
54
|
className: o("relative", t),
|
|
@@ -65,7 +65,7 @@ function I({
|
|
|
65
65
|
...n
|
|
66
66
|
}) {
|
|
67
67
|
return /* @__PURE__ */ i(
|
|
68
|
-
|
|
68
|
+
m,
|
|
69
69
|
{
|
|
70
70
|
"data-slot": "navigation-menu-trigger",
|
|
71
71
|
className: o(w(), "group", t),
|
|
@@ -89,7 +89,7 @@ function L({
|
|
|
89
89
|
...a
|
|
90
90
|
}) {
|
|
91
91
|
return /* @__PURE__ */ e(
|
|
92
|
-
|
|
92
|
+
s,
|
|
93
93
|
{
|
|
94
94
|
"data-slot": "navigation-menu-content",
|
|
95
95
|
className: o(
|
|
@@ -130,7 +130,7 @@ function C({
|
|
|
130
130
|
...a
|
|
131
131
|
}) {
|
|
132
132
|
return /* @__PURE__ */ e(
|
|
133
|
-
|
|
133
|
+
g,
|
|
134
134
|
{
|
|
135
135
|
"data-slot": "navigation-menu-link",
|
|
136
136
|
className: o(
|
|
@@ -146,7 +146,7 @@ function T({
|
|
|
146
146
|
...a
|
|
147
147
|
}) {
|
|
148
148
|
return /* @__PURE__ */ e(
|
|
149
|
-
|
|
149
|
+
u,
|
|
150
150
|
{
|
|
151
151
|
"data-slot": "navigation-menu-indicator",
|
|
152
152
|
className: o(
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import { jsxs as t, Fragment as a, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { cn as n } from "../../lib/utils.js";
|
|
4
|
+
import { Label as o } from "./label.js";
|
|
5
|
+
function c({
|
|
6
|
+
className: d,
|
|
7
|
+
label: e,
|
|
8
|
+
...i
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ t(a, { children: [
|
|
11
|
+
e && /* @__PURE__ */ r(o, { htmlFor: i.id, children: e }),
|
|
12
|
+
/* @__PURE__ */ r(
|
|
13
|
+
"textarea",
|
|
14
|
+
{
|
|
15
|
+
id: i.id,
|
|
16
|
+
"data-slot": "textarea",
|
|
17
|
+
className: n(
|
|
18
|
+
"border-d-input placeholder:text-d-muted-foreground focus-visible:border-d-ring focus-visible:ring-d-ring/50 aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive dark:bg-d-input/30 !bg-d-input flex field-sizing-content min-h-16 w-full rounded-md border px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
19
|
+
d
|
|
20
|
+
),
|
|
21
|
+
...i
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
] });
|
|
16
25
|
}
|
|
17
26
|
export {
|
|
18
|
-
|
|
27
|
+
c as Textarea
|
|
19
28
|
};
|