laif-ds 0.1.71 → 0.1.73
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/index.js +3 -5
- package/dist/_virtual/index2.js +2 -5
- package/dist/_virtual/index3.js +2 -5
- package/dist/_virtual/index4.js +4 -2
- package/dist/_virtual/index5.js +5 -2
- package/dist/_virtual/index6.js +5 -2
- package/dist/_virtual/index7.js +5 -2
- package/dist/_virtual/index8.js +2 -5
- 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/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 +48 -1
- package/dist/index.js +110 -104
- package/dist/lib/utils.js +27 -5
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- 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/recharts/es6/util/ReactUtils.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/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
package/dist/_virtual/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
var t = e();
|
|
5
|
-
const a = /* @__PURE__ */ r(t);
|
|
2
|
+
import { __require as r } from "../node_modules/use-sync-external-store/shim/index.js";
|
|
3
|
+
var i = r();
|
|
6
4
|
export {
|
|
7
|
-
|
|
5
|
+
i as s
|
|
8
6
|
};
|
package/dist/_virtual/index2.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import { __require as r } from "../node_modules/extend/index.js";
|
|
4
|
-
var t = r();
|
|
5
|
-
const x = /* @__PURE__ */ e(t);
|
|
2
|
+
var e = { exports: {} };
|
|
6
3
|
export {
|
|
7
|
-
|
|
4
|
+
e as __module
|
|
8
5
|
};
|
package/dist/_virtual/index3.js
CHANGED
package/dist/_virtual/index4.js
CHANGED
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
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);
|
|
3
6
|
export {
|
|
4
|
-
|
|
7
|
+
a as default
|
|
5
8
|
};
|
package/dist/_virtual/index6.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
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);
|
|
3
6
|
export {
|
|
4
|
-
|
|
7
|
+
x as default
|
|
5
8
|
};
|
package/dist/_virtual/index7.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as e } from "../node_modules/classnames/index.js";
|
|
4
|
+
var s = e();
|
|
5
|
+
const o = /* @__PURE__ */ r(s);
|
|
3
6
|
export {
|
|
4
|
-
|
|
7
|
+
o as default
|
|
5
8
|
};
|
package/dist/_virtual/index8.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import { __require as e } from "../node_modules/classnames/index.js";
|
|
4
|
-
var s = e();
|
|
5
|
-
const o = /* @__PURE__ */ r(s);
|
|
2
|
+
var e = {};
|
|
6
3
|
export {
|
|
7
|
-
|
|
4
|
+
e as __exports
|
|
8
5
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as o, jsxs as M, Fragment as N } from "react/jsx-runtime";
|
|
3
3
|
import { useContext as R, useRef as a, useState as s, useCallback as k, useMemo as y, useEffect as u } from "react";
|
|
4
|
-
import A from "../../../../../_virtual/
|
|
4
|
+
import A from "../../../../../_virtual/index7.js";
|
|
5
5
|
import B from "../../../../../_virtual/debounce.js";
|
|
6
6
|
import { GanttContext as F } from "../Gantt/GanttContext.js";
|
|
7
7
|
import { transformData as O } from "../../utils/transformData.js";
|
|
@@ -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 y } from "./calendar-context.js";
|
|
6
|
+
import { l as v } from "../../../_virtual/lodash.js";
|
|
7
|
+
import { hexContrast as C, hexToRgba as g, cn as k } from "../../../lib/utils.js";
|
|
8
|
+
import { TooltipProvider as $, Tooltip as j, 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: N } = y(), T = b(() => {
|
|
13
|
+
if (r.color)
|
|
14
|
+
return {
|
|
15
|
+
backgroundColor: g(r.color, 0.75),
|
|
16
|
+
borderColor: g(r.color, 1),
|
|
17
|
+
color: C(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"), t = 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($, { delayDuration: 300, children: /* @__PURE__ */ e(j, { children: [
|
|
25
|
+
/* @__PURE__ */ l(w, { asChild: !0, children: /* @__PURE__ */ e(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
onClick: (s) => {
|
|
29
|
+
s.preventDefault(), s.stopPropagation(), N(r.id);
|
|
30
|
+
},
|
|
31
|
+
style: T,
|
|
32
|
+
className: k(
|
|
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", children: [
|
|
60
|
+
(r == null ? void 0 : r.title) && /* @__PURE__ */ e(D, { children: [
|
|
61
|
+
r == null ? void 0 : r.title,
|
|
62
|
+
" (",
|
|
63
|
+
t,
|
|
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: "mt-2 mb-3.5 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-start justify-between gap-4 py-1 text-right",
|
|
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 max-w-[200px]", 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 z-30 -translate-x-1/2 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
|
+
};
|