laif-ds 0.2.52 → 0.2.53
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 +84 -82
- package/dist/components/ui/async-select.js +54 -53
- package/dist/components/ui/date-picker.js +96 -86
- package/dist/components/ui/input.js +28 -29
- package/dist/index.d.ts +3 -1
- package/dist/lib/design-tokens.js +3 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,98 +1,108 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Calendar as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
2
|
+
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Calendar as w } from "./calendar.js";
|
|
4
|
+
import { Icon as E } from "./icon.js";
|
|
5
|
+
import { Label as L } from "./label.js";
|
|
6
|
+
import { Popover as q, PopoverTrigger as A, PopoverContent as B } from "./popover.js";
|
|
7
|
+
import { designTokens as o } from "../../lib/design-tokens.js";
|
|
8
|
+
import { cn as P } from "../../lib/utils.js";
|
|
9
|
+
import * as c from "react";
|
|
10
|
+
import { useEffect as F } from "react";
|
|
11
|
+
import { it as G } from "../../node_modules/date-fns/locale/it.js";
|
|
11
12
|
import { formatDate as d } from "../../node_modules/date-fns/format.js";
|
|
12
|
-
import { isSameDay as
|
|
13
|
-
function
|
|
13
|
+
import { isSameDay as H } from "../../node_modules/date-fns/isSameDay.js";
|
|
14
|
+
function v({
|
|
14
15
|
value: e,
|
|
15
16
|
onChange: p,
|
|
16
|
-
placeholder:
|
|
17
|
-
dateFormat:
|
|
18
|
-
className:
|
|
19
|
-
disabled:
|
|
20
|
-
size:
|
|
21
|
-
firstDate:
|
|
22
|
-
lastDate:
|
|
23
|
-
availableDates:
|
|
24
|
-
locale:
|
|
25
|
-
initialCalendarMonth:
|
|
26
|
-
customCalendarProps:
|
|
17
|
+
placeholder: I = "Seleziona data",
|
|
18
|
+
dateFormat: a = "dd/MM/yyyy",
|
|
19
|
+
className: M,
|
|
20
|
+
disabled: n = !1,
|
|
21
|
+
size: m = "default",
|
|
22
|
+
firstDate: l,
|
|
23
|
+
lastDate: u,
|
|
24
|
+
availableDates: h,
|
|
25
|
+
locale: N = G,
|
|
26
|
+
initialCalendarMonth: g,
|
|
27
|
+
customCalendarProps: j,
|
|
28
|
+
label: x,
|
|
29
|
+
wrpClassName: k
|
|
27
30
|
}) {
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
),
|
|
31
|
-
|
|
31
|
+
const [r, y] = c.useState(e), [O, C] = c.useState(
|
|
32
|
+
g
|
|
33
|
+
), [S, R] = c.useState(!1), z = (s) => {
|
|
34
|
+
y(s), s && C(s), p && p(s);
|
|
32
35
|
};
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
(s) => !
|
|
36
|
-
(
|
|
36
|
+
let i = [];
|
|
37
|
+
l && i.push({ before: l }), u && i.push({ after: u }), h?.length && i.push(
|
|
38
|
+
(s) => !h.some(
|
|
39
|
+
(T) => H(T, s)
|
|
37
40
|
)
|
|
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
|
-
children: /* @__PURE__ */ c("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
65
|
-
/* @__PURE__ */ r(
|
|
66
|
-
k,
|
|
67
|
-
{
|
|
68
|
-
name: "Calendar",
|
|
69
|
-
size: n === "default" ? "md" : n === "sm" ? "xs" : "sm"
|
|
70
|
-
}
|
|
41
|
+
), n && (i = [!0]), F(() => {
|
|
42
|
+
y(r), C(r || g);
|
|
43
|
+
}, [r]);
|
|
44
|
+
const b = c.useId();
|
|
45
|
+
return /* @__PURE__ */ f("div", { className: P("flex flex-col gap-1.5", k), children: [
|
|
46
|
+
x && /* @__PURE__ */ t(L, { htmlFor: b, children: x }),
|
|
47
|
+
/* @__PURE__ */ f(q, { open: n ? !1 : S, onOpenChange: R, children: [
|
|
48
|
+
/* @__PURE__ */ t(A, { asChild: !0, children: /* @__PURE__ */ f(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
id: b,
|
|
52
|
+
className: P(
|
|
53
|
+
o.input.base,
|
|
54
|
+
o.radius.default,
|
|
55
|
+
o.text.base,
|
|
56
|
+
o.interaction.disabled,
|
|
57
|
+
"flex items-center gap-2 font-normal whitespace-nowrap [&>span]:line-clamp-1",
|
|
58
|
+
o.focusRing,
|
|
59
|
+
S && o.activeRing,
|
|
60
|
+
"hover:border-d-ring cursor-pointer transition-colors",
|
|
61
|
+
!r && "text-d-muted-foreground",
|
|
62
|
+
n && "cursor-not-allowed opacity-50",
|
|
63
|
+
m === "default" && o.sizes.default,
|
|
64
|
+
m === "sm" && o.sizes.sm,
|
|
65
|
+
m === "lg" && o.sizes.lg,
|
|
66
|
+
M
|
|
71
67
|
),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
68
|
+
"aria-disabled": n,
|
|
69
|
+
role: "button",
|
|
70
|
+
tabIndex: n ? -1 : 0,
|
|
71
|
+
onClick: n ? void 0 : () => {
|
|
72
|
+
},
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ t(
|
|
75
|
+
E,
|
|
76
|
+
{
|
|
77
|
+
name: "Calendar",
|
|
78
|
+
size: m === "lg" ? "sm" : "xs"
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ t("div", { children: e && typeof e == "object" && "from" in e ? /* @__PURE__ */ f("span", { children: [
|
|
82
|
+
e.from && d(e.from, a),
|
|
83
|
+
e.from && e.to && " - ",
|
|
84
|
+
e.to && d(e.to, a)
|
|
85
|
+
] }) : r ? /* @__PURE__ */ t("span", { children: d(r, a) }) : /* @__PURE__ */ t("span", { className: "text-d-muted-foreground", children: I }) })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
) }),
|
|
89
|
+
/* @__PURE__ */ t(B, { className: "w-auto p-0", children: /* @__PURE__ */ t(
|
|
90
|
+
w,
|
|
91
|
+
{
|
|
92
|
+
...j || {
|
|
93
|
+
mode: "single",
|
|
94
|
+
selected: r,
|
|
95
|
+
onSelect: z
|
|
96
|
+
},
|
|
97
|
+
autoFocus: !0,
|
|
98
|
+
disabled: i,
|
|
99
|
+
locale: N,
|
|
100
|
+
defaultMonth: O
|
|
101
|
+
}
|
|
102
|
+
) })
|
|
103
|
+
] })
|
|
94
104
|
] });
|
|
95
105
|
}
|
|
96
106
|
export {
|
|
97
|
-
|
|
107
|
+
v as DatePicker
|
|
98
108
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as f, jsx as
|
|
2
|
+
import { jsxs as f, jsx as l } from "react/jsx-runtime";
|
|
3
3
|
import { Label as se } from "./label.js";
|
|
4
4
|
import { designTokens as o } from "../../lib/design-tokens.js";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { cva as
|
|
5
|
+
import { cn as n } from "../../lib/utils.js";
|
|
6
|
+
import { cva as j } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
7
7
|
import * as a from "react";
|
|
8
8
|
import { Icon as N } from "./icon.js";
|
|
9
9
|
import { Typo as te } from "./typo.js";
|
|
10
|
-
const ae =
|
|
11
|
-
|
|
10
|
+
const ae = j(
|
|
11
|
+
n(
|
|
12
12
|
o.input.base,
|
|
13
13
|
o.radius.default,
|
|
14
14
|
"items-center gap-2 px-3",
|
|
15
|
-
|
|
16
|
-
"focus-within:ring-d-ring/50 focus-within:ring-[3px] focus-within:border-d-ring outline-none",
|
|
15
|
+
o.focusRingWithin,
|
|
17
16
|
o.input.invalid
|
|
18
17
|
),
|
|
19
18
|
{
|
|
@@ -28,8 +27,8 @@ const ae = R(
|
|
|
28
27
|
size: "default"
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
), re =
|
|
32
|
-
|
|
30
|
+
), re = j(
|
|
31
|
+
n(
|
|
33
32
|
o.text.base,
|
|
34
33
|
"shadow-none flex-1 min-w-0 bg-transparent outline-none border-0 p-0 overflow-hidden text-ellipsis",
|
|
35
34
|
"file:text-d-foreground file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
@@ -43,7 +42,7 @@ const ae = R(
|
|
|
43
42
|
size: {
|
|
44
43
|
default: "file:h-7",
|
|
45
44
|
sm: "text-xs file:h-6",
|
|
46
|
-
lg: "text-
|
|
45
|
+
lg: "text-base file:h-8"
|
|
47
46
|
}
|
|
48
47
|
},
|
|
49
48
|
defaultVariants: {
|
|
@@ -55,7 +54,7 @@ const ae = R(
|
|
|
55
54
|
hide: "Nascondi password"
|
|
56
55
|
}, fe = a.forwardRef(
|
|
57
56
|
({
|
|
58
|
-
className:
|
|
57
|
+
className: A,
|
|
59
58
|
type: p,
|
|
60
59
|
label: T,
|
|
61
60
|
labelClassName: D,
|
|
@@ -77,7 +76,7 @@ const ae = R(
|
|
|
77
76
|
validityI18n: e,
|
|
78
77
|
...$
|
|
79
78
|
}, J) => {
|
|
80
|
-
const [u, K] = a.useState(!1), [h, k] = a.useState(!0), [Q, L] = a.useState(!1), [U, V] = a.useState(""), X = a.useId(), w = G ?? X,
|
|
79
|
+
const [u, K] = a.useState(!1), [h, k] = a.useState(!0), [Q, L] = a.useState(!1), [U, V] = a.useState(""), X = a.useId(), w = G ?? X, R = `${w}-validity`, x = a.useRef(null), b = p === "password", Y = b ? u ? "text" : "password" : p, W = F ?? (!h && Q ? !0 : void 0), Z = [H, B && R].filter(Boolean).join(" ").trim() || void 0;
|
|
81
80
|
a.useImperativeHandle(J, () => x.current);
|
|
82
81
|
const q = a.useCallback(
|
|
83
82
|
(t) => {
|
|
@@ -128,39 +127,39 @@ const ae = R(
|
|
|
128
127
|
},
|
|
129
128
|
[z, c]
|
|
130
129
|
);
|
|
131
|
-
return /* @__PURE__ */ f("div", { className:
|
|
132
|
-
T && /* @__PURE__ */ f(se, { htmlFor: w, className:
|
|
130
|
+
return /* @__PURE__ */ f("div", { className: n("flex flex-col gap-1.5", A), children: [
|
|
131
|
+
T && /* @__PURE__ */ f(se, { htmlFor: w, className: n("gap-0.5", D), children: [
|
|
133
132
|
T,
|
|
134
|
-
C && h && /* @__PURE__ */
|
|
135
|
-
!h && /* @__PURE__ */
|
|
133
|
+
C && h && /* @__PURE__ */ l("div", { children: "*" }),
|
|
134
|
+
!h && /* @__PURE__ */ l("div", { className: "text-d-destructive", children: "*" })
|
|
136
135
|
] }),
|
|
137
136
|
/* @__PURE__ */ f(
|
|
138
137
|
"div",
|
|
139
138
|
{
|
|
140
|
-
className:
|
|
139
|
+
className: n(
|
|
141
140
|
ae({ size: g }),
|
|
142
141
|
d ? "cursor-not-allowed opacity-50" : "cursor-text"
|
|
143
142
|
),
|
|
144
|
-
"aria-invalid":
|
|
143
|
+
"aria-invalid": W,
|
|
145
144
|
onClick: q,
|
|
146
145
|
children: [
|
|
147
146
|
(v || S) && /* @__PURE__ */ f("div", { className: "text-d-muted-foreground flex shrink-0 items-center gap-2", children: [
|
|
148
|
-
v && /* @__PURE__ */
|
|
147
|
+
v && /* @__PURE__ */ l(N, { name: v, size: g === "lg" ? "sm" : "xs" }),
|
|
149
148
|
S
|
|
150
149
|
] }),
|
|
151
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ l(
|
|
152
151
|
"input",
|
|
153
152
|
{
|
|
154
153
|
id: w,
|
|
155
154
|
type: Y,
|
|
156
155
|
"data-slot": "input",
|
|
157
|
-
className:
|
|
156
|
+
className: n(re({ size: g })),
|
|
158
157
|
ref: x,
|
|
159
158
|
disabled: d,
|
|
160
159
|
onChange: y,
|
|
161
160
|
onBlur: I,
|
|
162
161
|
onInvalid: ee,
|
|
163
|
-
"aria-invalid":
|
|
162
|
+
"aria-invalid": W,
|
|
164
163
|
"aria-describedby": Z,
|
|
165
164
|
required: C,
|
|
166
165
|
step: p === "number" ? "any" : void 0,
|
|
@@ -174,7 +173,7 @@ const ae = R(
|
|
|
174
173
|
onClick: (t) => {
|
|
175
174
|
t.stopPropagation(), t.preventDefault(), K((s) => !s);
|
|
176
175
|
},
|
|
177
|
-
className:
|
|
176
|
+
className: n(
|
|
178
177
|
"text-d-muted-foreground flex shrink-0 cursor-pointer items-center",
|
|
179
178
|
d && "cursor-not-allowed"
|
|
180
179
|
),
|
|
@@ -184,31 +183,31 @@ const ae = R(
|
|
|
184
183
|
title: u ? m.hide : m.show,
|
|
185
184
|
disabled: d,
|
|
186
185
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ l(
|
|
188
187
|
N,
|
|
189
188
|
{
|
|
190
189
|
name: u ? "EyeOff" : "Eye",
|
|
191
190
|
size: g === "lg" ? "sm" : "xs"
|
|
192
191
|
}
|
|
193
192
|
),
|
|
194
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ l("span", { className: "sr-only", children: u ? m.hide : m.show })
|
|
195
194
|
]
|
|
196
195
|
}
|
|
197
196
|
) : (M || E) && /* @__PURE__ */ f("div", { className: "text-d-muted-foreground flex shrink-0 items-center gap-2", children: [
|
|
198
197
|
E,
|
|
199
|
-
M && /* @__PURE__ */
|
|
198
|
+
M && /* @__PURE__ */ l(N, { name: M, size: g === "lg" ? "sm" : "xs" })
|
|
200
199
|
] })
|
|
201
200
|
]
|
|
202
201
|
}
|
|
203
202
|
),
|
|
204
|
-
B && U.length > 0 && /* @__PURE__ */
|
|
203
|
+
B && U.length > 0 && /* @__PURE__ */ l(
|
|
205
204
|
te,
|
|
206
205
|
{
|
|
207
206
|
variant: "caption",
|
|
208
|
-
id:
|
|
207
|
+
id: R,
|
|
209
208
|
role: h ? "status" : "alert",
|
|
210
209
|
"aria-live": "polite",
|
|
211
|
-
className:
|
|
210
|
+
className: n(
|
|
212
211
|
"max-w-full min-w-0 text-wrap",
|
|
213
212
|
h ? "text-d-success" : "text-d-destructive"
|
|
214
213
|
),
|
package/dist/index.d.ts
CHANGED
|
@@ -1421,7 +1421,7 @@ export declare interface DataTableState {
|
|
|
1421
1421
|
computedSorting?: DataTableSorting;
|
|
1422
1422
|
}
|
|
1423
1423
|
|
|
1424
|
-
export declare function DatePicker({ value, onChange, placeholder, dateFormat, className, disabled, size, firstDate, lastDate, availableDates, locale, initialCalendarMonth, customCalendarProps, }: DatePickerProps): JSX.Element;
|
|
1424
|
+
export declare function DatePicker({ value, onChange, placeholder, dateFormat, className, disabled, size, firstDate, lastDate, availableDates, locale, initialCalendarMonth, customCalendarProps, label, wrpClassName, }: DatePickerProps): JSX.Element;
|
|
1425
1425
|
|
|
1426
1426
|
export declare interface DatePickerProps {
|
|
1427
1427
|
value?: Date;
|
|
@@ -1438,6 +1438,8 @@ export declare interface DatePickerProps {
|
|
|
1438
1438
|
locale?: Partial<Locale>;
|
|
1439
1439
|
initialCalendarMonth?: Date;
|
|
1440
1440
|
customCalendarProps?: React_2.ComponentProps<typeof Calendar>;
|
|
1441
|
+
label?: string | React_2.ReactNode;
|
|
1442
|
+
wrpClassName?: string;
|
|
1441
1443
|
}
|
|
1442
1444
|
|
|
1443
1445
|
/**
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
const e = {
|
|
3
3
|
// Interaction states
|
|
4
4
|
focusRing: "focus-visible:ring-d-ring/50 focus-visible:ring-[3px] focus-visible:border-d-ring outline-none transition-all duration-200",
|
|
5
|
+
focusRingWithin: "focus-within:ring-d-ring/50 focus-within:ring-[3px] focus-within:border-d-ring outline-none transition-all duration-200",
|
|
6
|
+
activeRing: "ring-d-ring/50 ring-[3px] border-d-ring",
|
|
5
7
|
// Base shapes
|
|
6
8
|
radius: {
|
|
7
9
|
default: "rounded-md",
|
|
@@ -11,7 +13,7 @@ const e = {
|
|
|
11
13
|
},
|
|
12
14
|
// Input & Button heights/paddings
|
|
13
15
|
sizes: {
|
|
14
|
-
default: "h-9 px-3 py-2",
|
|
16
|
+
default: "h-9 px-3 py-2 text-sm",
|
|
15
17
|
sm: "h-8 px-2.5 py-1.5 text-xs",
|
|
16
18
|
lg: "h-10 px-4 py-2 text-base",
|
|
17
19
|
icon: {
|