laif-ds 0.2.53 → 0.2.54
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/ui/app-select.js +45 -44
- package/dist/components/ui/app-tooltip.js +123 -0
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/file-preview.js +233 -286
- package/dist/index.d.ts +53 -0
- package/dist/index.js +41 -39
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as s, jsx as l, Fragment as
|
|
3
|
-
import { Badge as
|
|
4
|
-
import { Command as
|
|
5
|
-
import { Label as
|
|
2
|
+
import { jsxs as s, jsx as l, Fragment as re } from "react/jsx-runtime";
|
|
3
|
+
import { Badge as ne } from "./badge.js";
|
|
4
|
+
import { Command as te, CommandInput as se, CommandList as ie, CommandEmpty as oe, CommandGroup as R, CommandItem as A } from "./command.js";
|
|
5
|
+
import { Label as de } from "./label.js";
|
|
6
6
|
import { designTokens as d } from "../../lib/design-tokens.js";
|
|
7
7
|
import { cn as y } from "../../lib/utils.js";
|
|
8
|
-
import { useState as h, useRef as
|
|
9
|
-
import { Checkbox as
|
|
8
|
+
import { useState as h, useRef as ce, useMemo as S, useCallback as ue, useEffect as me } from "react";
|
|
9
|
+
import { Checkbox as fe } from "./checkbox.js";
|
|
10
10
|
import { Icon as z } from "./icon.js";
|
|
11
|
-
import { Popover as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
11
|
+
import { Popover as pe, PopoverTrigger as he, PopoverContent as ge } from "./popover.js";
|
|
12
|
+
import ve from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
|
|
13
|
+
const be = {
|
|
14
14
|
sm: d.sizes.sm,
|
|
15
15
|
default: d.sizes.default,
|
|
16
16
|
lg: d.sizes.lg
|
|
17
17
|
};
|
|
18
|
-
function
|
|
18
|
+
function ke(P) {
|
|
19
19
|
const {
|
|
20
20
|
multiple: r = !1,
|
|
21
21
|
options: c,
|
|
@@ -31,17 +31,18 @@ function Ve(P) {
|
|
|
31
31
|
maxSelectedMessage: G = (e) => `Puoi selezionare fino a ${e} elementi`,
|
|
32
32
|
label: D,
|
|
33
33
|
className: q = "",
|
|
34
|
-
|
|
34
|
+
labelClassName: H = "",
|
|
35
|
+
wrpClassName: J = "",
|
|
35
36
|
searchable: O = !1,
|
|
36
|
-
creatable:
|
|
37
|
+
creatable: K = !1,
|
|
37
38
|
groupBy: v = "group",
|
|
38
39
|
maxSelected: o,
|
|
39
|
-
showChipsInsteadOfCount:
|
|
40
|
+
showChipsInsteadOfCount: Q = !1,
|
|
40
41
|
disabled: b,
|
|
41
|
-
size:
|
|
42
|
-
isSingleSelectClearable:
|
|
43
|
-
} = P, [x, C] = h(!1), [u,
|
|
44
|
-
k ||
|
|
42
|
+
size: U = "default",
|
|
43
|
+
isSingleSelectClearable: Y = !1
|
|
44
|
+
} = P, [x, C] = h(!1), [u, N] = h(""), w = ce(null), [V, Z] = h(0), k = P.hasOwnProperty("value"), [_, ee] = h(T), i = k ? B : _, m = (e) => {
|
|
45
|
+
k || ee(e), W?.(e);
|
|
45
46
|
}, n = S(() => r ? Array.isArray(i) ? i : [] : i != null ? [i] : [], [i, r]), f = S(() => {
|
|
46
47
|
const e = c.filter((t) => n.includes(t.value));
|
|
47
48
|
if (r) {
|
|
@@ -61,44 +62,44 @@ function Ve(P) {
|
|
|
61
62
|
);
|
|
62
63
|
} else
|
|
63
64
|
m(e.value), C(!1);
|
|
64
|
-
}, j =
|
|
65
|
-
m(r ? [] : void 0),
|
|
66
|
-
}, [m, g, r]),
|
|
65
|
+
}, j = ue(() => {
|
|
66
|
+
m(r ? [] : void 0), N(""), g && g();
|
|
67
|
+
}, [m, g, r]), le = S(() => v ? c.reduce(
|
|
67
68
|
(e, t) => {
|
|
68
69
|
const a = t[v] || "";
|
|
69
70
|
return e[a] = e[a] || [], e[a].push(t), e;
|
|
70
71
|
},
|
|
71
72
|
{}
|
|
72
73
|
) : { "": c }, [c, v]);
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
}, [x, n, c]), /* @__PURE__ */ s("div", { className: y("flex flex-col gap-1.5",
|
|
76
|
-
D && /* @__PURE__ */ l(
|
|
74
|
+
return me(() => {
|
|
75
|
+
w.current && Z(w.current.getBoundingClientRect().width);
|
|
76
|
+
}, [x, n, c]), /* @__PURE__ */ s("div", { className: y("flex flex-col gap-1.5", J), children: [
|
|
77
|
+
D && /* @__PURE__ */ l(de, { className: H, children: D }),
|
|
77
78
|
/* @__PURE__ */ s(
|
|
78
|
-
|
|
79
|
+
pe,
|
|
79
80
|
{
|
|
80
81
|
open: b ? !1 : x,
|
|
81
82
|
onOpenChange: (e) => !b && C(e),
|
|
82
83
|
modal: !0,
|
|
83
84
|
children: [
|
|
84
|
-
/* @__PURE__ */ l(
|
|
85
|
+
/* @__PURE__ */ l(he, { asChild: !0, children: /* @__PURE__ */ s(
|
|
85
86
|
"div",
|
|
86
87
|
{
|
|
87
|
-
ref:
|
|
88
|
+
ref: w,
|
|
88
89
|
className: y(
|
|
89
90
|
d.input.base,
|
|
90
91
|
d.radius.default,
|
|
91
92
|
d.focusRingWithin,
|
|
92
93
|
"flex w-full min-w-[100px] cursor-pointer items-center justify-between gap-2",
|
|
93
94
|
x && d.activeRing,
|
|
94
|
-
|
|
95
|
+
be[U],
|
|
95
96
|
b && "cursor-not-allowed opacity-50",
|
|
96
97
|
q
|
|
97
98
|
),
|
|
98
99
|
children: [
|
|
99
100
|
f.length === 0 ? /* @__PURE__ */ l("span", { className: "text-d-muted-foreground", children: X }) : r ? /* @__PURE__ */ s("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
|
|
100
|
-
/* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children:
|
|
101
|
-
|
|
101
|
+
/* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: Q ? /* @__PURE__ */ l(re, { children: f.map((e) => /* @__PURE__ */ s(
|
|
102
|
+
ne,
|
|
102
103
|
{
|
|
103
104
|
variant: "secondary",
|
|
104
105
|
className: "hover:bg-d-secondary/100 bg-d-secondary/50 border-d-border flex cursor-pointer items-center gap-1 border",
|
|
@@ -133,7 +134,7 @@ function Ve(P) {
|
|
|
133
134
|
)
|
|
134
135
|
] }) : /* @__PURE__ */ s("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
|
|
135
136
|
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1 truncate", children: typeof f[0]?.label == "string" ? /* @__PURE__ */ l("span", { children: f[0]?.label }) : f[0]?.label }),
|
|
136
|
-
|
|
137
|
+
Y && i !== void 0 && i !== null && /* @__PURE__ */ l(
|
|
137
138
|
"div",
|
|
138
139
|
{
|
|
139
140
|
className: "border-d-input bg-d-accent cursor-pointer rounded-full p-1",
|
|
@@ -153,35 +154,35 @@ function Ve(P) {
|
|
|
153
154
|
}
|
|
154
155
|
)
|
|
155
156
|
] }),
|
|
156
|
-
/* @__PURE__ */ l(
|
|
157
|
+
/* @__PURE__ */ l(ve, { className: "h-4 w-4 opacity-50" })
|
|
157
158
|
]
|
|
158
159
|
}
|
|
159
160
|
) }),
|
|
160
161
|
/* @__PURE__ */ l(
|
|
161
|
-
|
|
162
|
+
ge,
|
|
162
163
|
{
|
|
163
164
|
className: "p-0",
|
|
164
165
|
style: { width: V > 0 ? V : "auto" },
|
|
165
166
|
align: "start",
|
|
166
167
|
sideOffset: 4,
|
|
167
|
-
children: /* @__PURE__ */ s(
|
|
168
|
+
children: /* @__PURE__ */ s(te, { shouldFilter: !!O, className: "w-full", children: [
|
|
168
169
|
O && /* @__PURE__ */ l(
|
|
169
|
-
|
|
170
|
+
se,
|
|
170
171
|
{
|
|
171
172
|
placeholder: F,
|
|
172
173
|
className: "placeholder:text-d-muted-foreground",
|
|
173
174
|
value: u,
|
|
174
|
-
onValueChange:
|
|
175
|
+
onValueChange: N
|
|
175
176
|
}
|
|
176
177
|
),
|
|
177
|
-
/* @__PURE__ */ s(
|
|
178
|
-
/* @__PURE__ */ l(
|
|
179
|
-
|
|
178
|
+
/* @__PURE__ */ s(ie, { className: "max-h-60 overflow-auto overscroll-contain", children: [
|
|
179
|
+
/* @__PURE__ */ l(oe, { children: E }),
|
|
180
|
+
K && u && /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
|
|
180
181
|
A,
|
|
181
182
|
{
|
|
182
183
|
className: "cursor-pointer",
|
|
183
184
|
onSelect: () => {
|
|
184
|
-
u && (m(r ? [...n, u] : u),
|
|
185
|
+
u && (m(r ? [...n, u] : u), N(""), !r && C(!1));
|
|
185
186
|
},
|
|
186
187
|
children: /* @__PURE__ */ s("div", { className: "text-d-foreground text-xs", children: [
|
|
187
188
|
L,
|
|
@@ -191,8 +192,8 @@ function Ve(P) {
|
|
|
191
192
|
] })
|
|
192
193
|
}
|
|
193
194
|
) }),
|
|
194
|
-
Object.entries(
|
|
195
|
-
const p = n.includes(a.value),
|
|
195
|
+
Object.entries(le).map(([e, t]) => /* @__PURE__ */ l(R, { heading: e || void 0, children: t.map((a) => {
|
|
196
|
+
const p = n.includes(a.value), ae = r && o !== void 0 && !p && n.length >= o, M = a.disabled || ae;
|
|
196
197
|
return /* @__PURE__ */ s(
|
|
197
198
|
A,
|
|
198
199
|
{
|
|
@@ -204,7 +205,7 @@ function Ve(P) {
|
|
|
204
205
|
!r && p && "bg-d-accent/75 text-d-accent-foreground"
|
|
205
206
|
),
|
|
206
207
|
children: [
|
|
207
|
-
r && /* @__PURE__ */ l(
|
|
208
|
+
r && /* @__PURE__ */ l(fe, { checked: p, className: "mr-1" }),
|
|
208
209
|
typeof a.label == "string" ? /* @__PURE__ */ l("span", { children: a.label }) : a.label
|
|
209
210
|
]
|
|
210
211
|
},
|
|
@@ -222,5 +223,5 @@ function Ve(P) {
|
|
|
222
223
|
] });
|
|
223
224
|
}
|
|
224
225
|
export {
|
|
225
|
-
|
|
226
|
+
ke as AppSelect
|
|
226
227
|
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { cn as r } from "../../lib/utils.js";
|
|
4
|
+
import { cva as k } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
|
+
import * as c from "react";
|
|
6
|
+
import { Label as g } from "./label.js";
|
|
7
|
+
import { Tooltip as z, TooltipTrigger as B, TooltipContent as C } from "./tooltip.js";
|
|
8
|
+
const x = k(
|
|
9
|
+
"inline-flex items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-d-ring focus-visible:ring-offset-2",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: "hover:text-d-foreground text-d-muted-foreground",
|
|
14
|
+
primary: "hover:text-d-primary text-d-primary/70",
|
|
15
|
+
secondary: "hover:text-d-secondary-foreground text-d-secondary-foreground/70",
|
|
16
|
+
accent: "hover:text-d-accent-foreground text-d-accent-foreground/70",
|
|
17
|
+
muted: "hover:text-d-muted-foreground text-d-muted-foreground/50",
|
|
18
|
+
ghost: "hover:bg-d-accent hover:text-d-accent-foreground"
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
sm: "text-xs",
|
|
22
|
+
default: "text-sm",
|
|
23
|
+
lg: "text-base"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "default",
|
|
28
|
+
size: "default"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
function E({
|
|
33
|
+
content: o,
|
|
34
|
+
children: n,
|
|
35
|
+
label: t,
|
|
36
|
+
labelClassName: i,
|
|
37
|
+
header: f,
|
|
38
|
+
variant: v = "primary",
|
|
39
|
+
triggerVariant: l = "default",
|
|
40
|
+
size: u = "default",
|
|
41
|
+
className: m,
|
|
42
|
+
wrpClassName: p,
|
|
43
|
+
contentClassName: h,
|
|
44
|
+
side: b = "top",
|
|
45
|
+
align: y = "center",
|
|
46
|
+
sideOffset: T = 4,
|
|
47
|
+
matchTriggerWidth: s = !1,
|
|
48
|
+
delayDuration: N = 200,
|
|
49
|
+
disabled: R = !1,
|
|
50
|
+
asChild: j = !1
|
|
51
|
+
}) {
|
|
52
|
+
const [w, A] = c.useState(), a = c.useRef(null);
|
|
53
|
+
return c.useEffect(() => {
|
|
54
|
+
s && a.current && A(a.current.getBoundingClientRect().width);
|
|
55
|
+
}, [s]), R ? /* @__PURE__ */ d("div", { className: r("flex flex-col gap-2", p), children: [
|
|
56
|
+
t && /* @__PURE__ */ e(g, { className: i, children: t }),
|
|
57
|
+
/* @__PURE__ */ e(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: r(
|
|
61
|
+
x({ variant: l, size: u }),
|
|
62
|
+
m
|
|
63
|
+
),
|
|
64
|
+
children: n
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
] }) : /* @__PURE__ */ d("div", { className: r("flex flex-col gap-2", p), children: [
|
|
68
|
+
t && /* @__PURE__ */ e(g, { className: i, children: t }),
|
|
69
|
+
/* @__PURE__ */ d(z, { delayDuration: N, children: [
|
|
70
|
+
/* @__PURE__ */ e(B, { asChild: j, children: /* @__PURE__ */ e(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
ref: a,
|
|
74
|
+
className: r(
|
|
75
|
+
x({ variant: l, size: u }),
|
|
76
|
+
m
|
|
77
|
+
),
|
|
78
|
+
children: n
|
|
79
|
+
}
|
|
80
|
+
) }),
|
|
81
|
+
/* @__PURE__ */ d(
|
|
82
|
+
C,
|
|
83
|
+
{
|
|
84
|
+
variant: v,
|
|
85
|
+
side: b,
|
|
86
|
+
align: y,
|
|
87
|
+
sideOffset: T,
|
|
88
|
+
className: r(h),
|
|
89
|
+
style: {
|
|
90
|
+
width: s ? w : void 0
|
|
91
|
+
},
|
|
92
|
+
children: [
|
|
93
|
+
f && /* @__PURE__ */ e("div", { className: "border-d-border mb-2 border-b pb-2 font-semibold", children: f }),
|
|
94
|
+
o
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] })
|
|
99
|
+
] });
|
|
100
|
+
}
|
|
101
|
+
function F({
|
|
102
|
+
text: o,
|
|
103
|
+
className: n,
|
|
104
|
+
variant: t = "primary",
|
|
105
|
+
truncate: i = !0
|
|
106
|
+
}) {
|
|
107
|
+
return /* @__PURE__ */ e(E, { content: o, variant: t, asChild: !0, children: /* @__PURE__ */ e(
|
|
108
|
+
"span",
|
|
109
|
+
{
|
|
110
|
+
className: r(
|
|
111
|
+
"text-d-secondary-foreground block w-full min-w-0",
|
|
112
|
+
i && "truncate",
|
|
113
|
+
n
|
|
114
|
+
),
|
|
115
|
+
children: o
|
|
116
|
+
}
|
|
117
|
+
) });
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
F as AppTextTooltip,
|
|
121
|
+
E as AppTooltip,
|
|
122
|
+
E as default
|
|
123
|
+
};
|
|
@@ -64,7 +64,7 @@ function N({
|
|
|
64
64
|
u,
|
|
65
65
|
{
|
|
66
66
|
"data-slot": "button",
|
|
67
|
-
className: s(m({ variant: a, size: e, className: d })
|
|
67
|
+
className: s("relative", m({ variant: a, size: e, className: d })),
|
|
68
68
|
...o,
|
|
69
69
|
children: [
|
|
70
70
|
/* @__PURE__ */ t("span", { className: "absolute inset-0 overflow-hidden rounded-[inherit] pointer-events-none", children: /* @__PURE__ */ t("span", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700 ease-out" }) }),
|