laif-ds 0.2.69 → 0.2.71
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/agent-docs/components/AppForm.md +4 -1
- package/dist/agent-docs/components/AppTimePicker.md +304 -0
- package/dist/agent-docs/components/DatePicker.md +178 -43
- package/dist/agent-docs/components-list.md +2 -1
- package/dist/components/ui/app-kanban.js +155 -112
- package/dist/components/ui/app-time-picker.js +244 -0
- package/dist/components/ui/date-picker.js +221 -125
- package/dist/components/ui/kanban.js +414 -285
- package/dist/components/ui/textarea.js +21 -20
- package/dist/index.d.ts +89 -0
- package/dist/index.js +41 -39
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,135 +1,231 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { designTokens as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
2
|
+
import { jsxs as m, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { designTokens as i } from "../design-tokens.js";
|
|
4
|
+
import { TimePickerColumn as M } from "./app-time-picker.js";
|
|
5
|
+
import { Calendar as V } from "./calendar.js";
|
|
6
|
+
import { Icon as q } from "./icon.js";
|
|
7
|
+
import { Label as de } from "./label.js";
|
|
8
|
+
import { Popover as ce, PopoverTrigger as me, PopoverContent as ue } from "./popover.js";
|
|
9
|
+
import { cn as E } from "../../lib/utils.js";
|
|
10
|
+
import * as f from "react";
|
|
11
|
+
import { useCallback as L, useMemo as p, useEffect as fe } from "react";
|
|
12
|
+
import { it as he } from "../../node_modules/date-fns/locale/it.js";
|
|
13
|
+
import { formatDate as w } from "../../node_modules/date-fns/format.js";
|
|
14
|
+
import { isSameDay as ge } from "../../node_modules/date-fns/isSameDay.js";
|
|
15
|
+
function Pe(t) {
|
|
15
16
|
const {
|
|
16
|
-
placeholder:
|
|
17
|
-
dateFormat:
|
|
18
|
-
className:
|
|
19
|
-
disabled:
|
|
20
|
-
size:
|
|
21
|
-
firstDate:
|
|
22
|
-
lastDate:
|
|
23
|
-
availableDates:
|
|
24
|
-
locale:
|
|
25
|
-
initialCalendarMonth:
|
|
26
|
-
customCalendarProps:
|
|
27
|
-
label:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
17
|
+
placeholder: X = "Seleziona data",
|
|
18
|
+
dateFormat: B,
|
|
19
|
+
className: G,
|
|
20
|
+
disabled: l = !1,
|
|
21
|
+
size: h = "default",
|
|
22
|
+
firstDate: N,
|
|
23
|
+
lastDate: S,
|
|
24
|
+
availableDates: H,
|
|
25
|
+
locale: u = he,
|
|
26
|
+
initialCalendarMonth: g,
|
|
27
|
+
customCalendarProps: P,
|
|
28
|
+
label: k,
|
|
29
|
+
labelClassName: J,
|
|
30
|
+
wrpClassName: K,
|
|
31
|
+
id: Q,
|
|
32
|
+
"data-testid": U,
|
|
33
|
+
minDate: O,
|
|
34
|
+
maxDate: z,
|
|
35
|
+
numberOfMonths: W,
|
|
36
|
+
clearable: Y = !1,
|
|
37
|
+
onClear: I
|
|
38
|
+
} = t, o = t.mode === "range", C = !o && t.showTime === !0, T = !o && t.withSeconds === !0, x = B ?? (C ? T ? "dd/MM/yyyy HH:mm:ss" : "dd/MM/yyyy HH:mm" : "dd/MM/yyyy"), [n, b] = f.useState(
|
|
39
|
+
o ? void 0 : t.value
|
|
40
|
+
), [r, y] = f.useState(
|
|
41
|
+
o ? t.value : void 0
|
|
42
|
+
), [F, v] = f.useState(
|
|
43
|
+
g
|
|
44
|
+
), [j, A] = f.useState(!1), Z = (e) => {
|
|
45
|
+
const a = e ? new Date(e) : void 0;
|
|
46
|
+
C && a && n && a.setHours(
|
|
47
|
+
n.getHours(),
|
|
48
|
+
n.getMinutes(),
|
|
49
|
+
n.getSeconds()
|
|
50
|
+
), b(a), a && v(a), !o && t.onChange && t.onChange(a), !C && a && A(!1);
|
|
51
|
+
}, $ = L(() => {
|
|
52
|
+
o ? (y(void 0), t.onChange && t.onChange(void 0)) : (b(void 0), t.onChange && t.onChange(void 0)), I?.();
|
|
53
|
+
}, [o, t.onChange, I]), ee = n?.getHours(), te = n?.getMinutes(), ae = n?.getSeconds(), oe = p(
|
|
54
|
+
() => Array.from({ length: 24 }, (e, a) => a),
|
|
55
|
+
[]
|
|
56
|
+
), ne = p(
|
|
57
|
+
() => Array.from({ length: 60 }, (e, a) => a),
|
|
58
|
+
[]
|
|
59
|
+
), se = p(
|
|
60
|
+
() => Array.from({ length: 60 }, (e, a) => a),
|
|
61
|
+
[]
|
|
62
|
+
), D = L(
|
|
63
|
+
(e, a) => {
|
|
64
|
+
const c = n ? new Date(n) : /* @__PURE__ */ new Date();
|
|
65
|
+
n || c.setHours(0, 0, 0, 0), e === "hour" ? c.setHours(a) : e === "minute" ? c.setMinutes(a) : e === "second" && c.setSeconds(a), b(c), !o && t.onChange && t.onChange(c);
|
|
66
|
+
},
|
|
67
|
+
[n, o, t.onChange]
|
|
68
|
+
), re = (e) => {
|
|
69
|
+
y(e), e?.from && v(e.from), o && t.onChange && t.onChange(e);
|
|
44
70
|
};
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
(
|
|
48
|
-
(
|
|
71
|
+
let d = [];
|
|
72
|
+
N && d.push({ before: N }), S && d.push({ after: S }), H?.length && d.push(
|
|
73
|
+
(e) => !H.some(
|
|
74
|
+
(a) => ge(a, e)
|
|
49
75
|
)
|
|
50
|
-
),
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
76
|
+
), l && (d = [!0]), fe(() => {
|
|
77
|
+
if (o) {
|
|
78
|
+
y(t.value);
|
|
79
|
+
const e = t.value?.from;
|
|
80
|
+
v(e ?? g);
|
|
55
81
|
} else
|
|
56
|
-
|
|
57
|
-
|
|
82
|
+
b(t.value), v(
|
|
83
|
+
t.value ?? g
|
|
58
84
|
);
|
|
59
|
-
}, [
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
] }) : !
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
85
|
+
}, [t.value, o, g]);
|
|
86
|
+
const ie = f.useId(), R = Q ?? ie, _ = o ? !!r?.from : !!n, le = () => o && r ? /* @__PURE__ */ m("span", { children: [
|
|
87
|
+
r.from && w(r.from, x, { locale: u }),
|
|
88
|
+
r.from && r.to && " - ",
|
|
89
|
+
r.to && w(r.to, x, { locale: u })
|
|
90
|
+
] }) : !o && n ? /* @__PURE__ */ s("span", { children: w(n, x, { locale: u }) }) : /* @__PURE__ */ s("span", { className: "text-d-muted-foreground", children: X });
|
|
91
|
+
return /* @__PURE__ */ m("div", { className: E("flex flex-col gap-1.5", K), children: [
|
|
92
|
+
k && /* @__PURE__ */ s(de, { htmlFor: R, className: J, children: k }),
|
|
93
|
+
/* @__PURE__ */ m(
|
|
94
|
+
ce,
|
|
95
|
+
{
|
|
96
|
+
open: l ? !1 : j,
|
|
97
|
+
onOpenChange: A,
|
|
98
|
+
modal: !0,
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ s(me, { asChild: !0, children: /* @__PURE__ */ m(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
id: R,
|
|
104
|
+
"data-testid": U,
|
|
105
|
+
className: E(
|
|
106
|
+
i.input.base,
|
|
107
|
+
i.radius.default,
|
|
108
|
+
i.text.base,
|
|
109
|
+
i.interaction.disabled,
|
|
110
|
+
"flex items-center gap-2 font-normal whitespace-nowrap [&>span]:line-clamp-1",
|
|
111
|
+
i.focusRing,
|
|
112
|
+
j && i.activeRing,
|
|
113
|
+
"hover:border-d-ring cursor-pointer transition-colors",
|
|
114
|
+
!_ && "text-d-muted-foreground",
|
|
115
|
+
l && "cursor-not-allowed opacity-50",
|
|
116
|
+
h === "default" && i.sizes.default,
|
|
117
|
+
h === "sm" && i.sizes.sm,
|
|
118
|
+
h === "lg" && i.sizes.lg,
|
|
119
|
+
G
|
|
120
|
+
),
|
|
121
|
+
"aria-disabled": l,
|
|
122
|
+
role: "button",
|
|
123
|
+
tabIndex: l ? -1 : 0,
|
|
124
|
+
onClick: l ? void 0 : () => {
|
|
125
|
+
},
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ s(q, { name: "Calendar", size: h === "lg" ? "sm" : "xs" }),
|
|
128
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: le() }),
|
|
129
|
+
Y && _ && /* @__PURE__ */ s(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
role: "button",
|
|
133
|
+
className: "bg-d-accent hover:bg-d-accent/80 border-d-border flex shrink-0 cursor-pointer items-center justify-center rounded-full border p-1 transition-colors",
|
|
134
|
+
onClick: (e) => {
|
|
135
|
+
e.stopPropagation(), e.preventDefault(), $();
|
|
136
|
+
},
|
|
137
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
138
|
+
"aria-label": "Clear selection",
|
|
139
|
+
children: /* @__PURE__ */ s(
|
|
140
|
+
q,
|
|
141
|
+
{
|
|
142
|
+
name: "X",
|
|
143
|
+
size: "xs",
|
|
144
|
+
className: "!text-d-foreground opacity-50"
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
) }),
|
|
152
|
+
" ",
|
|
153
|
+
/* @__PURE__ */ m(
|
|
154
|
+
ue,
|
|
155
|
+
{
|
|
156
|
+
className: "flex min-h-0 w-auto flex-row p-0 shadow",
|
|
157
|
+
align: "start",
|
|
158
|
+
children: [
|
|
159
|
+
o ? /* @__PURE__ */ s(
|
|
160
|
+
V,
|
|
161
|
+
{
|
|
162
|
+
...P || {},
|
|
163
|
+
mode: "range",
|
|
164
|
+
selected: r,
|
|
165
|
+
onSelect: re,
|
|
166
|
+
autoFocus: !0,
|
|
167
|
+
disabled: d,
|
|
168
|
+
locale: u,
|
|
169
|
+
defaultMonth: F,
|
|
170
|
+
numberOfMonths: W ?? 1,
|
|
171
|
+
minDate: O,
|
|
172
|
+
maxDate: z
|
|
173
|
+
}
|
|
174
|
+
) : /* @__PURE__ */ s(
|
|
175
|
+
V,
|
|
176
|
+
{
|
|
177
|
+
...P || {},
|
|
178
|
+
mode: "single",
|
|
179
|
+
selected: n,
|
|
180
|
+
onSelect: Z,
|
|
181
|
+
autoFocus: !0,
|
|
182
|
+
disabled: d,
|
|
183
|
+
locale: u,
|
|
184
|
+
defaultMonth: F,
|
|
185
|
+
minDate: O,
|
|
186
|
+
maxDate: z
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
C && /* @__PURE__ */ m("div", { className: "border-d-border/50 flex max-h-[300px] min-h-0 flex-1 flex-row border-l", children: [
|
|
190
|
+
/* @__PURE__ */ s(
|
|
191
|
+
M,
|
|
192
|
+
{
|
|
193
|
+
type: "hour",
|
|
194
|
+
value: ee,
|
|
195
|
+
options: oe,
|
|
196
|
+
onChange: (e) => D("hour", e),
|
|
197
|
+
className: "flex flex-1"
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ s(
|
|
201
|
+
M,
|
|
202
|
+
{
|
|
203
|
+
type: "minute",
|
|
204
|
+
value: te,
|
|
205
|
+
options: ne,
|
|
206
|
+
onChange: (e) => D("minute", e),
|
|
207
|
+
className: "flex flex-1"
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
T && /* @__PURE__ */ s(
|
|
211
|
+
M,
|
|
212
|
+
{
|
|
213
|
+
type: "second",
|
|
214
|
+
value: ae,
|
|
215
|
+
options: se,
|
|
216
|
+
onChange: (e) => D("second", e),
|
|
217
|
+
className: "flex flex-1"
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
] })
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
)
|
|
131
227
|
] });
|
|
132
228
|
}
|
|
133
229
|
export {
|
|
134
|
-
|
|
230
|
+
Pe as DatePicker
|
|
135
231
|
};
|