laif-ds 0.1.70 → 0.1.72
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 -2
- package/dist/_virtual/index5.js +5 -5
- package/dist/_virtual/index6.js +2 -5
- package/dist/_virtual/index7.js +2 -5
- package/dist/_virtual/index8.js +5 -2
- package/dist/_virtual/isoWeek.js +8 -0
- package/dist/_virtual/isoWeek2.js +5 -0
- package/dist/_virtual/it.js +3 -0
- package/dist/_virtual/it2.js +5 -0
- package/dist/_virtual/lodash.js +6 -0
- package/dist/_virtual/lodash2.js +5 -0
- package/dist/components/ui/app-multiple-select-dropdown.js +96 -94
- package/dist/components/ui/command-portal.js +15 -13
- package/dist/components/ui/dialog.js +39 -35
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/components/ui/tooltip.js +61 -30
- package/dist/components/ui/weekly-calendar/appointment-card.js +97 -0
- package/dist/components/ui/weekly-calendar/calendar-context.js +35 -0
- package/dist/components/ui/weekly-calendar/calendar-header.js +73 -0
- package/dist/components/ui/weekly-calendar/current-timeline.js +26 -0
- package/dist/components/ui/weekly-calendar/day-column.js +108 -0
- package/dist/components/ui/weekly-calendar/time-column.js +34 -0
- package/dist/components/ui/weekly-calendar/weekly-calendar.js +120 -0
- package/dist/index.d.ts +50 -2
- package/dist/index.js +110 -104
- package/dist/lib/utils.js +27 -5
- package/dist/node_modules/dayjs/locale/it.js +22 -0
- package/dist/node_modules/dayjs/plugin/isoWeek.js +34 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/lodash/lodash.js +3678 -0
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +44 -44
|
@@ -1,56 +1,87 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Root as
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import { Root as l, Trigger as p, Portal as m, Content as c, Arrow as f, Provider as u } from "../../node_modules/@radix-ui/react-tooltip/dist/index.js";
|
|
4
|
+
import { cva as d } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
|
+
import { cn as i } from "../../lib/utils.js";
|
|
6
|
+
const g = d(
|
|
7
|
+
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
primary: "bg-d-primary text-d-primary-foreground",
|
|
12
|
+
card: "bg-d-card text-d-card-foreground border border-d-border shadow-xl"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "primary"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
), b = d(
|
|
20
|
+
"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
variant: {
|
|
24
|
+
primary: "bg-d-primary fill-d-primary",
|
|
25
|
+
card: "bg-d-card fill-d-card border border-d-border"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "primary"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
function x({
|
|
6
34
|
delayDuration: t = 0,
|
|
7
|
-
...
|
|
35
|
+
...o
|
|
8
36
|
}) {
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
|
|
37
|
+
return /* @__PURE__ */ r(
|
|
38
|
+
u,
|
|
11
39
|
{
|
|
12
40
|
"data-slot": "tooltip-provider",
|
|
13
41
|
delayDuration: t,
|
|
14
|
-
...
|
|
42
|
+
...o
|
|
15
43
|
}
|
|
16
44
|
);
|
|
17
45
|
}
|
|
18
|
-
function
|
|
46
|
+
function w({
|
|
19
47
|
...t
|
|
20
48
|
}) {
|
|
21
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ r(x, { children: /* @__PURE__ */ r(l, { "data-slot": "tooltip", ...t }) });
|
|
22
50
|
}
|
|
23
|
-
function
|
|
51
|
+
function z({
|
|
24
52
|
...t
|
|
25
53
|
}) {
|
|
26
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ r(p, { "data-slot": "tooltip-trigger", ...t });
|
|
27
55
|
}
|
|
28
|
-
function
|
|
56
|
+
function V({
|
|
29
57
|
className: t,
|
|
30
|
-
sideOffset:
|
|
31
|
-
|
|
32
|
-
|
|
58
|
+
sideOffset: o = 0,
|
|
59
|
+
variant: a,
|
|
60
|
+
children: e,
|
|
61
|
+
...n
|
|
33
62
|
}) {
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
|
|
63
|
+
return /* @__PURE__ */ r(m, { children: /* @__PURE__ */ s(
|
|
64
|
+
c,
|
|
36
65
|
{
|
|
37
66
|
"data-slot": "tooltip-content",
|
|
38
|
-
sideOffset:
|
|
39
|
-
className:
|
|
40
|
-
|
|
41
|
-
t
|
|
42
|
-
),
|
|
43
|
-
...e,
|
|
67
|
+
sideOffset: o,
|
|
68
|
+
className: i(g({ variant: a }), t),
|
|
69
|
+
...n,
|
|
44
70
|
children: [
|
|
45
|
-
|
|
46
|
-
/* @__PURE__ */
|
|
71
|
+
e,
|
|
72
|
+
/* @__PURE__ */ r(
|
|
73
|
+
f,
|
|
74
|
+
{
|
|
75
|
+
className: i(b({ variant: a }))
|
|
76
|
+
}
|
|
77
|
+
)
|
|
47
78
|
]
|
|
48
79
|
}
|
|
49
80
|
) });
|
|
50
81
|
}
|
|
51
82
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
83
|
+
w as Tooltip,
|
|
84
|
+
V as TooltipContent,
|
|
85
|
+
x as TooltipProvider,
|
|
86
|
+
z as TooltipTrigger
|
|
56
87
|
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l, jsxs as e } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as b } from "react";
|
|
4
|
+
import h from "../../../_virtual/dayjs.min.js";
|
|
5
|
+
import { useCalendar as C } from "./calendar-context.js";
|
|
6
|
+
import { l as v } from "../../../_virtual/lodash.js";
|
|
7
|
+
import { hexContrast as k, hexToRgba as N, cn as $ } from "../../../lib/utils.js";
|
|
8
|
+
import { TooltipProvider as j, Tooltip as t, TooltipTrigger as w, TooltipContent as m } from "../tooltip.js";
|
|
9
|
+
import { Typo as D } from "../typo.js";
|
|
10
|
+
const L = ({ appointment: r }) => {
|
|
11
|
+
var f, a, x;
|
|
12
|
+
const { setSelectedAppointmentId: g } = C(), T = b(() => {
|
|
13
|
+
if (r.color)
|
|
14
|
+
return {
|
|
15
|
+
backgroundColor: N(r.color, 0.75),
|
|
16
|
+
borderColor: N(r.color, 1),
|
|
17
|
+
color: k(r.color),
|
|
18
|
+
backdropFilter: "blur(5px)"
|
|
19
|
+
};
|
|
20
|
+
}, [r.color]), c = r.endTime || h(`2000-01-01 ${r.startTime}`).add(1, "hour").format("HH:mm"), y = b(() => {
|
|
21
|
+
const s = h(`2000-01-01 ${r.startTime}`), d = h(`2000-01-01 ${c}`).diff(s, "minute"), i = Math.floor(d / 60), u = d % 60;
|
|
22
|
+
return i === 0 ? `${u}m` : u === 0 ? `${i}h` : `${i}h ${u}m`;
|
|
23
|
+
}, [r.startTime, c]);
|
|
24
|
+
return /* @__PURE__ */ l(j, { delayDuration: 300, children: /* @__PURE__ */ e(t, { children: [
|
|
25
|
+
/* @__PURE__ */ l(w, { asChild: !0, children: /* @__PURE__ */ e(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
onClick: (s) => {
|
|
29
|
+
s.preventDefault(), s.stopPropagation(), g(r.id);
|
|
30
|
+
},
|
|
31
|
+
style: T,
|
|
32
|
+
className: $(
|
|
33
|
+
"flex h-full cursor-pointer flex-col justify-start rounded-r-md border border-l-4 p-2 shadow-md transition-all duration-200 ease-in-out hover:scale-105",
|
|
34
|
+
r.className
|
|
35
|
+
),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ l("div", { className: "text-sm font-semibold", children: ((f = r == null ? void 0 : r.title) == null ? void 0 : f.length) > 15 ? ((a = r == null ? void 0 : r.title) == null ? void 0 : a.slice(0, 15)) + "..." : r == null ? void 0 : r.title }),
|
|
38
|
+
/* @__PURE__ */ e("div", { className: "text-xs", children: [
|
|
39
|
+
r == null ? void 0 : r.startTime,
|
|
40
|
+
" - ",
|
|
41
|
+
c
|
|
42
|
+
] }),
|
|
43
|
+
(x = r == null ? void 0 : r.attributes) == null ? void 0 : x.filter((s) => s.showPreview).map((s, o) => /* @__PURE__ */ e(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: "bg-d-background/30 mt-1 rounded p-1 text-xs",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ l("span", { className: "font-semibold", children: s.key }),
|
|
49
|
+
":",
|
|
50
|
+
" ",
|
|
51
|
+
/* @__PURE__ */ l("span", { className: "font-medium", children: s.value })
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
o
|
|
55
|
+
))
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
) }),
|
|
59
|
+
/* @__PURE__ */ e(m, { side: "right", variant: "card", className: "w-[200px]", children: [
|
|
60
|
+
(r == null ? void 0 : r.title) && /* @__PURE__ */ e(D, { children: [
|
|
61
|
+
r == null ? void 0 : r.title,
|
|
62
|
+
" (",
|
|
63
|
+
y,
|
|
64
|
+
")"
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ e("div", { className: "text-d-accent-foreground", children: [
|
|
67
|
+
r == null ? void 0 : r.startTime,
|
|
68
|
+
" - ",
|
|
69
|
+
c
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ e("div", { className: "my-2 flex flex-col", children: [
|
|
72
|
+
/* @__PURE__ */ l("span", { className: "font-medium", children: "Descrizione:" }),
|
|
73
|
+
/* @__PURE__ */ l("span", { className: "text-d-accent-foreground text-xs", children: (r == null ? void 0 : r.description) || "-" })
|
|
74
|
+
] }),
|
|
75
|
+
(r == null ? void 0 : r.attributes) && r.attributes.length > 0 && /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l("div", { className: "space-y-1", children: r.attributes.map((s, o) => {
|
|
76
|
+
var d;
|
|
77
|
+
return /* @__PURE__ */ e(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: "flex items-center justify-between py-1",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: [
|
|
83
|
+
v.upperFirst(s.key),
|
|
84
|
+
":"
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ l("span", { className: "text-d-accent-foreground", children: v.upperFirst(((d = s.value) == null ? void 0 : d.toString()) || "") })
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
o
|
|
90
|
+
);
|
|
91
|
+
}) }) })
|
|
92
|
+
] })
|
|
93
|
+
] }) });
|
|
94
|
+
};
|
|
95
|
+
export {
|
|
96
|
+
L as AppointmentCard
|
|
97
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { useState as t, useEffect as u, createContext as c, useContext as m } from "react";
|
|
4
|
+
import C from "../../../_virtual/dayjs.min.js";
|
|
5
|
+
const r = c(
|
|
6
|
+
void 0
|
|
7
|
+
), x = () => {
|
|
8
|
+
const e = m(r);
|
|
9
|
+
if (!e)
|
|
10
|
+
throw new Error("useCalendar must be used within a CalendarProvider");
|
|
11
|
+
return e;
|
|
12
|
+
}, I = ({ children: e, value: n }) => {
|
|
13
|
+
const [o, s] = t(null), [a, l] = t(null);
|
|
14
|
+
return u(() => {
|
|
15
|
+
const d = setInterval(() => {
|
|
16
|
+
l(C().format("HH:mm"));
|
|
17
|
+
}, 1e3);
|
|
18
|
+
return () => clearInterval(d);
|
|
19
|
+
}, []), /* @__PURE__ */ i(
|
|
20
|
+
r.Provider,
|
|
21
|
+
{
|
|
22
|
+
value: {
|
|
23
|
+
...n,
|
|
24
|
+
selectedAppointmentId: o,
|
|
25
|
+
setSelectedAppointmentId: s,
|
|
26
|
+
currentTime: a
|
|
27
|
+
},
|
|
28
|
+
children: e
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
I as CalendarProvider,
|
|
34
|
+
x as useCalendar
|
|
35
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
3
|
+
import c from "../../../_virtual/dayjs.min.js";
|
|
4
|
+
import "../../../_virtual/it.js";
|
|
5
|
+
import { useCalendar as h } from "./calendar-context.js";
|
|
6
|
+
import { l as v } from "../../../_virtual/lodash.js";
|
|
7
|
+
import { Typo as l } from "../typo.js";
|
|
8
|
+
import { Button as a } from "../button.js";
|
|
9
|
+
c.locale("it");
|
|
10
|
+
const M = () => {
|
|
11
|
+
const {
|
|
12
|
+
todayString: m,
|
|
13
|
+
currentWeekOffset: o,
|
|
14
|
+
showNavigation: n,
|
|
15
|
+
customActions: r,
|
|
16
|
+
goToPreviousWeek: d,
|
|
17
|
+
goToNextWeek: f,
|
|
18
|
+
goToCurrentWeek: u
|
|
19
|
+
} = h(), i = c().startOf("isoWeek").add(o, "week"), p = i.endOf("isoWeek"), s = o === 0;
|
|
20
|
+
return !n && !r ? null : /* @__PURE__ */ e("div", { className: "mb-4", children: n && /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
|
|
21
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
22
|
+
/* @__PURE__ */ e(
|
|
23
|
+
a,
|
|
24
|
+
{
|
|
25
|
+
onClick: d,
|
|
26
|
+
variant: "outline",
|
|
27
|
+
size: "sm",
|
|
28
|
+
iconLeft: "ChevronLeft",
|
|
29
|
+
"aria-label": "Settimana precedente"
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ e(
|
|
33
|
+
a,
|
|
34
|
+
{
|
|
35
|
+
onClick: u,
|
|
36
|
+
variant: "outline",
|
|
37
|
+
size: "sm",
|
|
38
|
+
disabled: s,
|
|
39
|
+
children: m
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ e(
|
|
43
|
+
a,
|
|
44
|
+
{
|
|
45
|
+
onClick: f,
|
|
46
|
+
variant: "outline",
|
|
47
|
+
size: "sm",
|
|
48
|
+
iconRight: "ChevronRight",
|
|
49
|
+
"aria-label": "Settimana successiva"
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col items-center text-center leading-tight", children: [
|
|
54
|
+
/* @__PURE__ */ e(
|
|
55
|
+
l,
|
|
56
|
+
{
|
|
57
|
+
variant: "h3",
|
|
58
|
+
className: s ? "text-d-primary font-bold" : "font-bold",
|
|
59
|
+
children: v.upperFirst(i.format("MMMM YYYY"))
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ t(l, { variant: "small", className: "text-d-muted-foreground", children: [
|
|
63
|
+
i.format("D"),
|
|
64
|
+
" – ",
|
|
65
|
+
p.format("D MMM")
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: r && r })
|
|
69
|
+
] }) });
|
|
70
|
+
};
|
|
71
|
+
export {
|
|
72
|
+
M as CalendarHeader
|
|
73
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useCalendar as a } from "./calendar-context.js";
|
|
4
|
+
const f = () => {
|
|
5
|
+
const { currentTime: t } = a();
|
|
6
|
+
if (!t) return null;
|
|
7
|
+
const [e, s] = t.split(":").map(Number), { calendarStartHour: o, calendarEndHour: n } = a();
|
|
8
|
+
if (e < o || e > n || e === n && s > 0)
|
|
9
|
+
return null;
|
|
10
|
+
const d = (e - o) * 60 + s, l = 48, i = 64 / 60, u = l + d * i;
|
|
11
|
+
return /* @__PURE__ */ c(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: "pointer-events-none absolute inset-x-0 z-50",
|
|
15
|
+
style: { top: `${u}px` },
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ r("div", { className: "bg-d-destructive h-0.5 w-full shadow-sm" }),
|
|
18
|
+
/* @__PURE__ */ r("div", { className: "bg-d-destructive absolute top-0 -left-1.5 h-3 w-3 -translate-y-1/2 rounded-full border-2 border-white shadow-md" }),
|
|
19
|
+
/* @__PURE__ */ r("div", { className: "bg-d-destructive absolute left-4 -translate-y-1/2 rounded-md px-2 py-0.5 text-xs font-medium text-white shadow-md", children: t })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
f as CurrentTimeLine
|
|
26
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import j from "react";
|
|
4
|
+
import b from "../../../_virtual/dayjs.min.js";
|
|
5
|
+
import { useCalendar as A } from "./calendar-context.js";
|
|
6
|
+
import { AppointmentCard as C } from "./appointment-card.js";
|
|
7
|
+
import { Typo as v } from "../typo.js";
|
|
8
|
+
import { Badge as I } from "../badge.js";
|
|
9
|
+
import { cn as w } from "../../../lib/utils.js";
|
|
10
|
+
import { Tooltip as Y, TooltipTrigger as _, TooltipContent as k } from "../tooltip.js";
|
|
11
|
+
const J = ({ date: o, weekdayInfo: l }) => {
|
|
12
|
+
const {
|
|
13
|
+
calendarStartHour: s,
|
|
14
|
+
calendarEndHour: d,
|
|
15
|
+
enableGrouping: c,
|
|
16
|
+
groupLabel: y,
|
|
17
|
+
appointmentsByDay: M,
|
|
18
|
+
groupedAppointmentsByDay: N
|
|
19
|
+
} = A(), T = j.useMemo(() => Array.from(
|
|
20
|
+
{ length: d - s + 1 },
|
|
21
|
+
(e, r) => `${(r + s).toString().padStart(2, "0")}:00`
|
|
22
|
+
), [s, d]), m = o.format("YYYY-MM-DD"), i = c ? N[m] || {} : { default: M[m] || [] }, g = o.isSame(b(), "day"), a = Object.keys(i), h = a.length > 1, p = (e) => {
|
|
23
|
+
const r = parseInt(e.startTime.split(":")[0]), f = parseInt(e.startTime.split(":")[1]), u = e.endTime || b(`2000-01-01 ${e.startTime}`).add(1, "hour").format("HH:mm"), D = parseInt(u.split(":")[0]), H = parseInt(u.split(":")[1]), x = (r - s) * 60 + f, O = (D - s) * 60 + H - x, S = x * 64 / 60, $ = Math.max(O * 64 / 60, 32);
|
|
24
|
+
return /* @__PURE__ */ t(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: "absolute right-1 left-1",
|
|
28
|
+
style: {
|
|
29
|
+
top: `${S}px`,
|
|
30
|
+
height: `${$}px`,
|
|
31
|
+
zIndex: 10
|
|
32
|
+
},
|
|
33
|
+
children: /* @__PURE__ */ t(C, { appointment: e })
|
|
34
|
+
},
|
|
35
|
+
e.id
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ n(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: w(
|
|
42
|
+
"border-d-border border-r",
|
|
43
|
+
g ? "text-d-primary" : ""
|
|
44
|
+
),
|
|
45
|
+
style: {
|
|
46
|
+
flex: h ? a.length : 1,
|
|
47
|
+
minWidth: `${Math.max(a.length, 1) * 120}px`
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ t("div", { className: "border-d-border sticky top-0 h-14 border-b p-2 text-center", children: /* @__PURE__ */ n("div", { className: "flex flex-col items-center justify-center", children: [
|
|
51
|
+
/* @__PURE__ */ t(v, { variant: "small", className: "font-medium", children: l.label.slice(0, 3) }),
|
|
52
|
+
/* @__PURE__ */ t(v, { className: "font-bold", children: o.format("DD") })
|
|
53
|
+
] }) }),
|
|
54
|
+
/* @__PURE__ */ n("div", { className: "relative flex", children: [
|
|
55
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-0", children: T.map((e) => /* @__PURE__ */ t(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: "border-d-border border-b border-dashed",
|
|
59
|
+
style: { height: "64px" }
|
|
60
|
+
},
|
|
61
|
+
e
|
|
62
|
+
)) }),
|
|
63
|
+
h ? a.map((e) => /* @__PURE__ */ n(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: "relative flex-1",
|
|
67
|
+
style: {
|
|
68
|
+
minWidth: "120px"
|
|
69
|
+
},
|
|
70
|
+
children: [
|
|
71
|
+
c && y && /* @__PURE__ */ n(Y, { children: [
|
|
72
|
+
/* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ t(
|
|
73
|
+
I,
|
|
74
|
+
{
|
|
75
|
+
className: "absolute top-1 left-1/2 -translate-x-1/2 z-30 truncate overflow-hidden whitespace-nowrap",
|
|
76
|
+
variant: "outline",
|
|
77
|
+
children: e.length > 12 ? `${e.slice(0, 12)}...` : e
|
|
78
|
+
}
|
|
79
|
+
) }),
|
|
80
|
+
e.length > 20 && /* @__PURE__ */ t(
|
|
81
|
+
k,
|
|
82
|
+
{
|
|
83
|
+
sideOffset: 4,
|
|
84
|
+
className: "max-w-xs text-center break-words",
|
|
85
|
+
children: e
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] }),
|
|
89
|
+
i[e].map(
|
|
90
|
+
(r) => p(r)
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
e
|
|
95
|
+
)) : /* @__PURE__ */ t("div", { className: "relative flex-1", children: a.map(
|
|
96
|
+
(e) => i[e].map(
|
|
97
|
+
(r) => p(r)
|
|
98
|
+
)
|
|
99
|
+
) })
|
|
100
|
+
] })
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
l.key
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
J as DayColumn
|
|
108
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import l from "react";
|
|
4
|
+
import { useCalendar as i } from "./calendar-context.js";
|
|
5
|
+
const f = () => {
|
|
6
|
+
const { calendarStartHour: t = 6, calendarEndHour: d = 18 } = i(), a = l.useMemo(() => {
|
|
7
|
+
const r = d - t + 1;
|
|
8
|
+
return Array.from({ length: r }, (n, c) => {
|
|
9
|
+
const o = c + t, m = o < 12 ? "AM" : "PM";
|
|
10
|
+
return {
|
|
11
|
+
label: `${(o % 12 === 0 ? 12 : o % 12).toString().padStart(2, "0")}:00`,
|
|
12
|
+
ampm: m
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
}, [t, d]);
|
|
16
|
+
return /* @__PURE__ */ s("div", { className: "border-d-border bg-d-background z-20 w-20 flex-shrink-0 border-r", children: [
|
|
17
|
+
/* @__PURE__ */ e("div", { className: "bg-d-muted/30 border-d-border h-14 border-b" }),
|
|
18
|
+
/* @__PURE__ */ e("div", { className: "relative", children: a.map(({ label: r, ampm: n }) => /* @__PURE__ */ s(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: "text-muted-foreground border-d-border/50 flex h-16 flex-col items-center justify-center border-b text-sm font-medium",
|
|
22
|
+
style: { height: "64px" },
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ e("span", { children: r }),
|
|
25
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-normal uppercase opacity-70", children: n })
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
r
|
|
29
|
+
)) })
|
|
30
|
+
] });
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
f as TimeColumn
|
|
34
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as f, jsxs as y } from "react/jsx-runtime";
|
|
3
|
+
import d from "react";
|
|
4
|
+
import a from "../../../_virtual/dayjs.min.js";
|
|
5
|
+
import N from "../../../_virtual/isoWeek.js";
|
|
6
|
+
import { CalendarProvider as h } from "./calendar-context.js";
|
|
7
|
+
import { CalendarHeader as B } from "./calendar-header.js";
|
|
8
|
+
import { TimeColumn as C } from "./time-column.js";
|
|
9
|
+
import { DayColumn as V } from "./day-column.js";
|
|
10
|
+
import { CurrentTimeLine as z } from "./current-timeline.js";
|
|
11
|
+
a.extend(N);
|
|
12
|
+
const L = [
|
|
13
|
+
{ key: "monday", label: "Lunedì", dayjs: 1 },
|
|
14
|
+
{ key: "tuesday", label: "Martedì", dayjs: 2 },
|
|
15
|
+
{ key: "wednesday", label: "Mercoledì", dayjs: 3 },
|
|
16
|
+
{ key: "thursday", label: "Giovedì", dayjs: 4 },
|
|
17
|
+
{ key: "friday", label: "Venerdì", dayjs: 5 },
|
|
18
|
+
{ key: "saturday", label: "Sabato", dayjs: 6 },
|
|
19
|
+
{ key: "sunday", label: "Domenica", dayjs: 0 }
|
|
20
|
+
];
|
|
21
|
+
function Q({
|
|
22
|
+
appointments: l = [],
|
|
23
|
+
onWeekChange: r,
|
|
24
|
+
initialWeekOffset: D = 0,
|
|
25
|
+
showNavigation: M = !0,
|
|
26
|
+
customActions: w,
|
|
27
|
+
enableGrouping: i = !1,
|
|
28
|
+
groupLabel: O,
|
|
29
|
+
calendarStartHour: W = 8,
|
|
30
|
+
calendarEndHour: p = 20,
|
|
31
|
+
todayString: b = "Oggi"
|
|
32
|
+
}) {
|
|
33
|
+
const [o, m] = d.useState(D), x = d.useMemo(
|
|
34
|
+
() => a().startOf("isoWeek").add(o, "week").format("YYYY-MM-DD"),
|
|
35
|
+
[o]
|
|
36
|
+
), j = d.useMemo(
|
|
37
|
+
() => a().startOf("isoWeek").add(o, "week").endOf("isoWeek").format("YYYY-MM-DD"),
|
|
38
|
+
[o]
|
|
39
|
+
), k = d.useMemo(() => {
|
|
40
|
+
const e = [], t = a().startOf("isoWeek").add(o, "week");
|
|
41
|
+
for (let s = 0; s < 7; s++)
|
|
42
|
+
e.push(t.add(s, "day"));
|
|
43
|
+
return e;
|
|
44
|
+
}, [o]), v = o === 0, n = d.useMemo(() => {
|
|
45
|
+
const e = {};
|
|
46
|
+
return l.forEach((t) => {
|
|
47
|
+
const s = t.date;
|
|
48
|
+
e[s] || (e[s] = []), e[s].push(t);
|
|
49
|
+
}), e;
|
|
50
|
+
}, [l]), E = d.useMemo(() => {
|
|
51
|
+
const e = {};
|
|
52
|
+
return Object.keys(n).forEach((t) => {
|
|
53
|
+
const s = n[t];
|
|
54
|
+
if (!i)
|
|
55
|
+
e[t] = { default: s };
|
|
56
|
+
else {
|
|
57
|
+
const c = {};
|
|
58
|
+
s.forEach((Y) => {
|
|
59
|
+
const u = Y.groupBy || "Senza categoria";
|
|
60
|
+
c[u] || (c[u] = []), c[u].push(Y);
|
|
61
|
+
}), e[t] = c;
|
|
62
|
+
}
|
|
63
|
+
}), e;
|
|
64
|
+
}, [n, i]), S = d.useCallback(() => {
|
|
65
|
+
const e = o - 1;
|
|
66
|
+
if (m(e), r) {
|
|
67
|
+
const t = a().startOf("isoWeek").add(e, "week").format("YYYY-MM-DD"), s = a().startOf("isoWeek").add(e, "week").endOf("isoWeek").format("YYYY-MM-DD");
|
|
68
|
+
r(e, t, s);
|
|
69
|
+
}
|
|
70
|
+
}, [o, r]), T = d.useCallback(() => {
|
|
71
|
+
const e = o + 1;
|
|
72
|
+
if (m(e), r) {
|
|
73
|
+
const t = a().startOf("isoWeek").add(e, "week").format("YYYY-MM-DD"), s = a().startOf("isoWeek").add(e, "week").endOf("isoWeek").format("YYYY-MM-DD");
|
|
74
|
+
r(e, t, s);
|
|
75
|
+
}
|
|
76
|
+
}, [o, r]), A = d.useCallback(() => {
|
|
77
|
+
if (m(0), r) {
|
|
78
|
+
const t = a().startOf("isoWeek").format("YYYY-MM-DD"), s = a().endOf("isoWeek").format("YYYY-MM-DD");
|
|
79
|
+
r(0, t, s);
|
|
80
|
+
}
|
|
81
|
+
}, [r]);
|
|
82
|
+
return /* @__PURE__ */ f(h, { value: {
|
|
83
|
+
calendarStartHour: W,
|
|
84
|
+
calendarEndHour: p,
|
|
85
|
+
currentWeekOffset: o,
|
|
86
|
+
weekStart: x,
|
|
87
|
+
weekEnd: j,
|
|
88
|
+
weekDates: k,
|
|
89
|
+
isCurrentWeek: v,
|
|
90
|
+
goToPreviousWeek: S,
|
|
91
|
+
goToNextWeek: T,
|
|
92
|
+
goToCurrentWeek: A,
|
|
93
|
+
appointments: l,
|
|
94
|
+
appointmentsByDay: n,
|
|
95
|
+
groupedAppointmentsByDay: E,
|
|
96
|
+
enableGrouping: i,
|
|
97
|
+
groupLabel: O,
|
|
98
|
+
showNavigation: M,
|
|
99
|
+
customActions: w,
|
|
100
|
+
onWeekChange: r,
|
|
101
|
+
todayString: b
|
|
102
|
+
}, children: /* @__PURE__ */ y("div", { className: "flex h-full flex-col", children: [
|
|
103
|
+
/* @__PURE__ */ f(B, {}),
|
|
104
|
+
/* @__PURE__ */ y("div", { className: "border-d-border relative flex flex-1 border-t border-l", children: [
|
|
105
|
+
/* @__PURE__ */ f(C, {}),
|
|
106
|
+
/* @__PURE__ */ f(z, {}),
|
|
107
|
+
/* @__PURE__ */ f("div", { className: "flex flex-1 overflow-x-auto", children: k.map((e, t) => /* @__PURE__ */ f(
|
|
108
|
+
V,
|
|
109
|
+
{
|
|
110
|
+
date: e,
|
|
111
|
+
weekdayInfo: L[t]
|
|
112
|
+
},
|
|
113
|
+
e.format("YYYY-MM-DD")
|
|
114
|
+
)) })
|
|
115
|
+
] })
|
|
116
|
+
] }) });
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
Q as WeeklyCalendar
|
|
120
|
+
};
|