chesai-ui 0.16.13 → 0.16.14
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/chesai-ui.css +1 -1
- package/dist/components/card/index.d.ts +3 -0
- package/dist/components/card/index.mjs +73 -42
- package/dist/components/full-calendar/index.mjs +115 -111
- package/dist/components/full-calendar/timeline-view.mjs +124 -122
- package/dist/components/full-calendar/types.d.ts +1 -1
- package/dist/components/full-calendar/utils.d.ts +3 -2
- package/dist/components/full-calendar/utils.mjs +184 -136
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { jsxs as h, jsx as l, Fragment as
|
|
1
|
+
import { jsxs as h, jsx as l, Fragment as Me } from "react/jsx-runtime";
|
|
2
2
|
import { clsx as d } from "clsx";
|
|
3
|
-
import { startOfDay as
|
|
4
|
-
import
|
|
3
|
+
import { startOfDay as U, addDays as X, isSameDay as he, format as O, isToday as Ce } from "date-fns";
|
|
4
|
+
import W, { useRef as V, useMemo as N, useState as De, useEffect as be } from "react";
|
|
5
5
|
import { Typography as M } from "../typography/index.mjs";
|
|
6
|
-
import { PrintModeContext as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
6
|
+
import { PrintModeContext as Ee, useFullCalendar as Se } from "./calendar-context.mjs";
|
|
7
|
+
import { useLayout as He } from "../../context/layout-context.mjs";
|
|
8
|
+
import { getDaysForWeekView as Te, expandEvents as Re, getEventSegments as Pe, getCalendarStickyBgClasses as ze, getTimelinePositionsForDay as Ae, getCalendarBgClasses as Oe } from "./utils.mjs";
|
|
9
|
+
import { ElasticScrollArea as Ve } from "../elastic-scroll-area/index.mjs";
|
|
10
|
+
const G = Array.from({ length: 24 }, (o, H) => H), q = {
|
|
10
11
|
primary: "bg-primary text-on-primary border-primary",
|
|
11
12
|
secondary: "bg-secondary text-on-secondary border-secondary",
|
|
12
13
|
tertiary: "bg-tertiary-container text-on-tertiary-container border-tertiary",
|
|
@@ -16,41 +17,41 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
16
17
|
indigo: "bg-indigo-500 text-white border-indigo-500",
|
|
17
18
|
teal: "bg-teal-500 text-white border-teal-500",
|
|
18
19
|
pink: "bg-pink-500 text-white border-pink-500"
|
|
19
|
-
},
|
|
20
|
-
const o =
|
|
21
|
-
currentDate:
|
|
22
|
-
view:
|
|
23
|
-
events:
|
|
24
|
-
variant:
|
|
20
|
+
}, We = () => {
|
|
21
|
+
const o = W.useContext(Ee), { isRtl: H } = He(), {
|
|
22
|
+
currentDate: I,
|
|
23
|
+
view: C,
|
|
24
|
+
events: D,
|
|
25
|
+
variant: J,
|
|
25
26
|
draftEvent: T,
|
|
26
|
-
setDraftEvent:
|
|
27
|
-
setCurrentDate:
|
|
28
|
-
setView:
|
|
29
|
-
openPopover:
|
|
30
|
-
onEventUpdate:
|
|
31
|
-
onDateClick:
|
|
32
|
-
onEventClick:
|
|
33
|
-
renderEventContent:
|
|
34
|
-
disableCreateOnGridClick:
|
|
35
|
-
disableEventClick:
|
|
36
|
-
disableDragAndDrop:
|
|
37
|
-
} =
|
|
38
|
-
let e =
|
|
27
|
+
setDraftEvent: $,
|
|
28
|
+
setCurrentDate: ge,
|
|
29
|
+
setView: pe,
|
|
30
|
+
openPopover: K,
|
|
31
|
+
onEventUpdate: Q,
|
|
32
|
+
onDateClick: Z,
|
|
33
|
+
onEventClick: ee,
|
|
34
|
+
renderEventContent: te,
|
|
35
|
+
disableCreateOnGridClick: re,
|
|
36
|
+
disableEventClick: j,
|
|
37
|
+
disableDragAndDrop: ne
|
|
38
|
+
} = Se(), L = V(null), B = V(null), R = V(!1), oe = o ? "bg-white text-black" : Oe(J), ae = o ? "bg-white text-black" : ze(J), x = o ? "border-black/20" : "border-outline-variant/30", u = N(() => C === "week" ? Te(I) : [I], [I, C]), E = N(() => {
|
|
39
|
+
let e = D;
|
|
39
40
|
if (T) {
|
|
40
41
|
const s = String(T.id).split("-occ-")[0];
|
|
41
42
|
e = [
|
|
42
|
-
...
|
|
43
|
+
...D.filter((a) => String(a.id) !== s),
|
|
43
44
|
T
|
|
44
45
|
];
|
|
45
46
|
}
|
|
46
|
-
const r =
|
|
47
|
-
return
|
|
48
|
-
}, [
|
|
49
|
-
if (!o) return { hours:
|
|
47
|
+
const r = U(u[0]), n = X(U(u[u.length - 1]), 1);
|
|
48
|
+
return Re(e, r, n);
|
|
49
|
+
}, [D, T, u]), k = N(() => {
|
|
50
|
+
if (!o) return { hours: G, blocks: [G] };
|
|
50
51
|
const e = /* @__PURE__ */ new Set();
|
|
51
|
-
if (
|
|
52
|
+
if (E.forEach((t) => {
|
|
52
53
|
t.isAllDay || u.forEach((i) => {
|
|
53
|
-
const c =
|
|
54
|
+
const c = U(i), b = X(c, 1);
|
|
54
55
|
if (t.start < b && t.end > c) {
|
|
55
56
|
const g = t.start < c ? c : t.start, f = t.end > b ? b : t.end, m = g.getHours();
|
|
56
57
|
let p = f.getHours();
|
|
@@ -72,50 +73,50 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
72
73
|
for (let t = 1; t < n.length; t++)
|
|
73
74
|
n[t] === n[t - 1] + 1 ? a.push(n[t]) : (s.push(a), a = [n[t]]);
|
|
74
75
|
return s.push(a), { hours: n, blocks: s };
|
|
75
|
-
}, [o,
|
|
76
|
+
}, [o, E, u]), P = o ? k.blocks : [G], S = 0.5, Y = (o ? k.hours.length + (k.blocks.length - 1) * S : 24) * 60, le = (e) => {
|
|
76
77
|
if (!o) return e;
|
|
77
78
|
const r = Math.min(Math.max(e, 0), 1440), n = Math.floor(r / 60), s = r % 60;
|
|
78
79
|
let a = 0;
|
|
79
80
|
for (let t = 0; t < k.blocks.length; t++) {
|
|
80
81
|
const i = k.blocks[t], c = i[0], b = i[i.length - 1];
|
|
81
82
|
if (n < c)
|
|
82
|
-
return (a -
|
|
83
|
+
return (a - S / 2) * 60;
|
|
83
84
|
if (n >= c && n <= b)
|
|
84
85
|
return (a + (n - c)) * 60 + s;
|
|
85
|
-
a += i.length, t < k.blocks.length - 1 && (a +=
|
|
86
|
+
a += i.length, t < k.blocks.length - 1 && (a += S);
|
|
86
87
|
}
|
|
87
88
|
return a * 60;
|
|
88
|
-
}, [
|
|
89
|
-
|
|
90
|
-
const e = setInterval(() =>
|
|
89
|
+
}, [_, ve] = De(/* @__PURE__ */ new Date());
|
|
90
|
+
be(() => {
|
|
91
|
+
const e = setInterval(() => ve(/* @__PURE__ */ new Date()), 6e4);
|
|
91
92
|
return () => clearInterval(e);
|
|
92
93
|
}, []);
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
if (
|
|
94
|
+
const xe = _.getHours() * 60 + _.getMinutes(), ye = o ? 0 : xe / 1440 * 100;
|
|
95
|
+
be(() => {
|
|
96
|
+
if (L.current && !o) {
|
|
96
97
|
const e = Math.max(0, 430);
|
|
97
|
-
|
|
98
|
+
L.current.scrollTop = e;
|
|
98
99
|
}
|
|
99
|
-
}, [
|
|
100
|
-
const
|
|
101
|
-
if (R.current ||
|
|
100
|
+
}, [C, o]);
|
|
101
|
+
const we = (e, r) => {
|
|
102
|
+
if (R.current || v.current || o) return;
|
|
102
103
|
const n = e.currentTarget.getBoundingClientRect(), s = e.clientY - n.top, i = 0 + Math.floor(s / n.height * 24), c = new Date(r);
|
|
103
|
-
c.setHours(i, 0, 0, 0),
|
|
104
|
-
},
|
|
104
|
+
c.setHours(i, 0, 0, 0), Z && Z(c, e), re || K("create", n, c);
|
|
105
|
+
}, se = (e, r) => {
|
|
105
106
|
if (R.current) {
|
|
106
107
|
e.stopPropagation(), e.preventDefault();
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
|
-
if (!(r.isDraft || o) && (e.stopPropagation(),
|
|
110
|
-
const n = e.currentTarget.getBoundingClientRect(), s = String(r.id).split("-occ-")[0], a =
|
|
111
|
-
|
|
110
|
+
if (!(r.isDraft || o) && (e.stopPropagation(), ee && ee(r, e), !j)) {
|
|
111
|
+
const n = e.currentTarget.getBoundingClientRect(), s = String(r.id).split("-occ-")[0], a = D.find((t) => String(t.id) === s) || r;
|
|
112
|
+
K("edit", n, void 0, a);
|
|
112
113
|
}
|
|
113
|
-
},
|
|
114
|
-
if (r.isDraft || r.editable === !1 || o ||
|
|
114
|
+
}, v = V(null), ie = (e, r, n, s) => {
|
|
115
|
+
if (r.isDraft || r.editable === !1 || o || ne)
|
|
115
116
|
return;
|
|
116
117
|
e.stopPropagation(), e.preventDefault();
|
|
117
|
-
const a = u.findIndex((g) =>
|
|
118
|
-
|
|
118
|
+
const a = u.findIndex((g) => he(g, s)), t = r.start.getHours() * 60 + r.start.getMinutes(), i = (r.end.getTime() - r.start.getTime()) / 6e4, c = String(r.id).split("-occ-")[0], b = D.find((g) => String(g.id) === c) || r;
|
|
119
|
+
v.current = {
|
|
119
120
|
eventId: b.id,
|
|
120
121
|
type: n,
|
|
121
122
|
startX: e.clientX,
|
|
@@ -125,9 +126,9 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
125
126
|
startHeightMins: i,
|
|
126
127
|
originalEvent: b,
|
|
127
128
|
hasMoved: !1
|
|
128
|
-
}, document.addEventListener("pointermove",
|
|
129
|
-
},
|
|
130
|
-
if (!
|
|
129
|
+
}, document.addEventListener("pointermove", ce), document.addEventListener("pointerup", de);
|
|
130
|
+
}, ce = (e) => {
|
|
131
|
+
if (!v.current) return;
|
|
131
132
|
const {
|
|
132
133
|
startX: r,
|
|
133
134
|
startY: n,
|
|
@@ -136,23 +137,24 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
136
137
|
startHeightMins: t,
|
|
137
138
|
originalEvent: i,
|
|
138
139
|
type: c
|
|
139
|
-
} =
|
|
140
|
-
if (!
|
|
140
|
+
} = v.current;
|
|
141
|
+
if (!v.current.hasMoved)
|
|
141
142
|
if (Math.abs(e.clientX - r) > 3 || Math.abs(e.clientY - n) > 3)
|
|
142
|
-
|
|
143
|
+
v.current.hasMoved = !0, document.body.style.cursor = c === "move" ? "grabbing" : "ns-resize";
|
|
143
144
|
else
|
|
144
145
|
return;
|
|
145
146
|
const b = e.clientY - n, g = Math.round(b / 15) * 15;
|
|
146
147
|
if (c === "move") {
|
|
147
148
|
let f = a + g, m = 0;
|
|
148
149
|
if (B.current && u.length > 1) {
|
|
149
|
-
const A = B.current.getBoundingClientRect(),
|
|
150
|
-
|
|
150
|
+
const A = B.current.getBoundingClientRect(), ke = A.width / u.length, Ne = e.clientX - A.left;
|
|
151
|
+
let F = Math.max(
|
|
151
152
|
0,
|
|
152
|
-
Math.min(u.length - 1, Math.floor(
|
|
153
|
-
)
|
|
153
|
+
Math.min(u.length - 1, Math.floor(Ne / ke))
|
|
154
|
+
);
|
|
155
|
+
H && (F = u.length - 1 - F), m = F - s;
|
|
154
156
|
}
|
|
155
|
-
const p =
|
|
157
|
+
const p = X(i.start, m);
|
|
156
158
|
p.setHours(0, f, 0, 0);
|
|
157
159
|
const y = new Date(p.getTime() + t * 6e4);
|
|
158
160
|
let w = i.recurrence;
|
|
@@ -161,7 +163,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
161
163
|
daysOfWeek: w.daysOfWeek.map(
|
|
162
164
|
(A) => (A + m % 7 + 7) % 7
|
|
163
165
|
)
|
|
164
|
-
}),
|
|
166
|
+
}), $({
|
|
165
167
|
...i,
|
|
166
168
|
start: p,
|
|
167
169
|
end: y,
|
|
@@ -174,28 +176,28 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
174
176
|
const m = new Date(
|
|
175
177
|
i.start.getTime() + f * 6e4
|
|
176
178
|
);
|
|
177
|
-
|
|
179
|
+
$({ ...i, end: m, isDraft: !0 });
|
|
178
180
|
}
|
|
179
|
-
},
|
|
180
|
-
document.removeEventListener("pointermove",
|
|
181
|
+
}, de = async () => {
|
|
182
|
+
document.removeEventListener("pointermove", ce), document.removeEventListener("pointerup", de), document.body.style.cursor = "", v.current && (v.current.hasMoved && (R.current = !0, setTimeout(() => {
|
|
181
183
|
R.current = !1;
|
|
182
|
-
}, 200),
|
|
183
|
-
if (e &&
|
|
184
|
+
}, 200), $((e) => {
|
|
185
|
+
if (e && Q) {
|
|
184
186
|
const r = { ...e };
|
|
185
|
-
delete r.isDraft,
|
|
187
|
+
delete r.isDraft, Q(r);
|
|
186
188
|
}
|
|
187
189
|
return null;
|
|
188
|
-
})),
|
|
189
|
-
},
|
|
190
|
+
})), v.current = null);
|
|
191
|
+
}, ue = N(() => E.filter((e) => e.isAllDay), [E]), z = N(() => Pe(u, ue), [u, ue]), fe = N(() => z.length === 0 ? 0 : Math.max(...z.map((e) => e.row)), [z]), me = /* @__PURE__ */ h("div", { className: "flex min-w-max md:min-w-full h-full", children: [
|
|
190
192
|
/* @__PURE__ */ l(
|
|
191
193
|
"div",
|
|
192
194
|
{
|
|
193
195
|
className: d(
|
|
194
196
|
"w-16 shrink-0 flex flex-col border-r relative z-10",
|
|
195
|
-
|
|
196
|
-
|
|
197
|
+
ae,
|
|
198
|
+
x
|
|
197
199
|
),
|
|
198
|
-
children: P.map((e, r) => /* @__PURE__ */ h(
|
|
200
|
+
children: P.map((e, r) => /* @__PURE__ */ h(W.Fragment, { children: [
|
|
199
201
|
e.map((n) => /* @__PURE__ */ l(
|
|
200
202
|
"div",
|
|
201
203
|
{
|
|
@@ -221,7 +223,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
221
223
|
r < P.length - 1 && /* @__PURE__ */ h(
|
|
222
224
|
"div",
|
|
223
225
|
{
|
|
224
|
-
style: o ? { flex:
|
|
226
|
+
style: o ? { flex: S } : { height: "30px" },
|
|
225
227
|
className: d(
|
|
226
228
|
"relative flex flex-col items-center justify-center bg-black/5 opacity-50 border-b border-black/20 box-border min-h-0"
|
|
227
229
|
),
|
|
@@ -236,7 +238,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
236
238
|
}
|
|
237
239
|
),
|
|
238
240
|
/* @__PURE__ */ h("div", { className: "flex-1 flex relative", ref: B, children: [
|
|
239
|
-
/* @__PURE__ */ l("div", { className: "absolute inset-0 pointer-events-none flex flex-col", children: P.map((e, r) => /* @__PURE__ */ h(
|
|
241
|
+
/* @__PURE__ */ l("div", { className: "absolute inset-0 pointer-events-none flex flex-col", children: P.map((e, r) => /* @__PURE__ */ h(W.Fragment, { children: [
|
|
240
242
|
e.map((n) => /* @__PURE__ */ l(
|
|
241
243
|
"div",
|
|
242
244
|
{
|
|
@@ -250,17 +252,17 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
250
252
|
r < P.length - 1 && /* @__PURE__ */ l(
|
|
251
253
|
"div",
|
|
252
254
|
{
|
|
253
|
-
style: o ? { flex:
|
|
255
|
+
style: o ? { flex: S } : { height: "30px" },
|
|
254
256
|
className: "w-full bg-black/5 border-b border-black/20 box-border min-h-0"
|
|
255
257
|
}
|
|
256
258
|
)
|
|
257
259
|
] }, r)) }),
|
|
258
|
-
!o && u.some((e) =>
|
|
260
|
+
!o && u.some((e) => he(e, _)) && /* @__PURE__ */ h(
|
|
259
261
|
"div",
|
|
260
262
|
{
|
|
261
263
|
className: "absolute left-0 right-0 z-20 pointer-events-none flex items-center",
|
|
262
264
|
style: {
|
|
263
|
-
top: `${
|
|
265
|
+
top: `${ye}%`,
|
|
264
266
|
marginLeft: "-6px"
|
|
265
267
|
},
|
|
266
268
|
children: [
|
|
@@ -270,23 +272,23 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
270
272
|
}
|
|
271
273
|
),
|
|
272
274
|
u.map((e) => {
|
|
273
|
-
const r =
|
|
275
|
+
const r = Ae(e, E);
|
|
274
276
|
return /* @__PURE__ */ l(
|
|
275
277
|
"div",
|
|
276
278
|
{
|
|
277
279
|
className: d(
|
|
278
280
|
"flex-1 relative border-r last:border-r-0 min-h-0",
|
|
279
|
-
|
|
280
|
-
!o && !
|
|
281
|
+
x,
|
|
282
|
+
!o && !re && "cursor-pointer"
|
|
281
283
|
),
|
|
282
284
|
style: o ? void 0 : { height: "1440px" },
|
|
283
|
-
onClick: (n) =>
|
|
285
|
+
onClick: (n) => we(n, e),
|
|
284
286
|
children: r.map((n) => {
|
|
285
287
|
let { top: s, height: a } = n;
|
|
286
|
-
const { event: t, left: i, width: c } = n, b = t.colorVariant || "primary", g = t.colorHex ? "" :
|
|
288
|
+
const { event: t, left: i, width: c } = n, b = t.colorVariant || "primary", g = t.colorHex ? "" : q[b], f = t.isDraft;
|
|
287
289
|
if (o) {
|
|
288
|
-
const m = s / 100 * 1440, p = (s + a) / 100 * 1440, y =
|
|
289
|
-
if (s = y /
|
|
290
|
+
const m = s / 100 * 1440, p = (s + a) / 100 * 1440, y = le(m), w = le(p);
|
|
291
|
+
if (s = y / Y * 100, a = (w - y) / Y * 100, s < 0 && (a += s, s = 0), s + a > 100 && (a = 100 - s), a <= 0) return null;
|
|
290
292
|
}
|
|
291
293
|
return /* @__PURE__ */ l(
|
|
292
294
|
"div",
|
|
@@ -298,7 +300,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
298
300
|
style: {
|
|
299
301
|
top: `${s}%`,
|
|
300
302
|
height: `${a}%`,
|
|
301
|
-
left: `${i}%`,
|
|
303
|
+
[H ? "right" : "left"]: `${i}%`,
|
|
302
304
|
width: `${c}%`
|
|
303
305
|
},
|
|
304
306
|
children: /* @__PURE__ */ h(
|
|
@@ -306,7 +308,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
306
308
|
{
|
|
307
309
|
className: d(
|
|
308
310
|
"w-full h-full rounded-md border-l-4 p-1.5 overflow-hidden shadow-sm flex flex-col relative group",
|
|
309
|
-
!f && !o &&
|
|
311
|
+
!f && !o && !j && "cursor-pointer hover:shadow-md transition-shadow",
|
|
310
312
|
f && "border-dashed shadow-lg ring-2 ring-primary ring-offset-1",
|
|
311
313
|
g,
|
|
312
314
|
o && "!shadow-none border border-black/30"
|
|
@@ -317,11 +319,11 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
317
319
|
color: t.colorHex
|
|
318
320
|
},
|
|
319
321
|
onPointerDown: (m) => {
|
|
320
|
-
|
|
322
|
+
ie(m, t, "move", e);
|
|
321
323
|
},
|
|
322
|
-
onClick: (m) =>
|
|
324
|
+
onClick: (m) => se(m, t),
|
|
323
325
|
children: [
|
|
324
|
-
|
|
326
|
+
te ? te(t, C) : /* @__PURE__ */ h(Me, { children: [
|
|
325
327
|
/* @__PURE__ */ l(
|
|
326
328
|
M,
|
|
327
329
|
{
|
|
@@ -330,25 +332,25 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
330
332
|
children: t.title || "(No title)"
|
|
331
333
|
}
|
|
332
334
|
),
|
|
333
|
-
a > 30 /
|
|
335
|
+
a > 30 / Y * 100 && /* @__PURE__ */ h(
|
|
334
336
|
M,
|
|
335
337
|
{
|
|
336
338
|
variant: "body-small",
|
|
337
339
|
className: "text-[10px] text-inherit opacity-80 truncate mt-0.5 pointer-events-none",
|
|
338
340
|
children: [
|
|
339
|
-
|
|
341
|
+
O(t.start, "h:mm a"),
|
|
340
342
|
" -",
|
|
341
343
|
" ",
|
|
342
|
-
|
|
344
|
+
O(t.end, "h:mm a")
|
|
343
345
|
]
|
|
344
346
|
}
|
|
345
347
|
)
|
|
346
348
|
] }),
|
|
347
|
-
t.editable !== !1 && !f && !o && !
|
|
349
|
+
t.editable !== !1 && !f && !o && !ne && /* @__PURE__ */ l(
|
|
348
350
|
"div",
|
|
349
351
|
{
|
|
350
352
|
className: "absolute bottom-0 left-0 right-0 h-2 cursor-ns-resize opacity-0 group-hover:opacity-100 flex justify-center items-center",
|
|
351
|
-
onPointerDown: (m) =>
|
|
353
|
+
onPointerDown: (m) => ie(m, t, "resize", e),
|
|
352
354
|
children: /* @__PURE__ */ l("div", { className: "w-4 h-1 bg-current opacity-50 rounded-full" })
|
|
353
355
|
}
|
|
354
356
|
)
|
|
@@ -365,26 +367,26 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
365
367
|
})
|
|
366
368
|
] })
|
|
367
369
|
] });
|
|
368
|
-
return /* @__PURE__ */ h("div", { className: d("flex flex-col flex-1 h-full min-h-0",
|
|
370
|
+
return /* @__PURE__ */ h("div", { className: d("flex flex-col flex-1 h-full min-h-0", oe), children: [
|
|
369
371
|
/* @__PURE__ */ h(
|
|
370
372
|
"div",
|
|
371
373
|
{
|
|
372
374
|
className: d(
|
|
373
375
|
"flex flex-col border-b shrink-0 z-20",
|
|
374
|
-
|
|
375
|
-
|
|
376
|
+
x,
|
|
377
|
+
ae
|
|
376
378
|
),
|
|
377
379
|
children: [
|
|
378
380
|
/* @__PURE__ */ h("div", { className: "flex", children: [
|
|
379
|
-
/* @__PURE__ */ l("div", { className: d("w-16 shrink-0 border-r",
|
|
381
|
+
/* @__PURE__ */ l("div", { className: d("w-16 shrink-0 border-r", x) }),
|
|
380
382
|
/* @__PURE__ */ l("div", { className: "flex flex-1", children: u.map((e) => {
|
|
381
|
-
const r =
|
|
383
|
+
const r = Ce(e);
|
|
382
384
|
return /* @__PURE__ */ h(
|
|
383
385
|
"div",
|
|
384
386
|
{
|
|
385
387
|
className: d(
|
|
386
388
|
"flex-1 flex flex-col items-center justify-center py-3 border-r last:border-r-0",
|
|
387
|
-
|
|
389
|
+
x
|
|
388
390
|
),
|
|
389
391
|
children: [
|
|
390
392
|
/* @__PURE__ */ l(
|
|
@@ -395,7 +397,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
395
397
|
"font-semibold mb-1",
|
|
396
398
|
r && !o ? "text-primary" : o ? "text-black" : "text-on-surface-variant"
|
|
397
399
|
),
|
|
398
|
-
children:
|
|
400
|
+
children: O(e, "EEE").toUpperCase()
|
|
399
401
|
}
|
|
400
402
|
),
|
|
401
403
|
/* @__PURE__ */ l(
|
|
@@ -403,7 +405,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
403
405
|
{
|
|
404
406
|
type: "button",
|
|
405
407
|
onClick: () => {
|
|
406
|
-
|
|
408
|
+
C !== "day" && !o && (ge(e), pe("day"));
|
|
407
409
|
},
|
|
408
410
|
className: d(
|
|
409
411
|
"flex items-center justify-center w-10 h-10 rounded-full text-lg transition-colors cursor-pointer",
|
|
@@ -411,7 +413,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
411
413
|
r && !o ? "bg-primary text-on-primary font-bold shadow-md hover:bg-primary/90" : o ? "text-black" : "text-on-surface",
|
|
412
414
|
r && o && "font-bold border-2 border-black rounded-full"
|
|
413
415
|
),
|
|
414
|
-
children:
|
|
416
|
+
children: O(e, "d")
|
|
415
417
|
}
|
|
416
418
|
)
|
|
417
419
|
]
|
|
@@ -420,13 +422,13 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
420
422
|
);
|
|
421
423
|
}) })
|
|
422
424
|
] }),
|
|
423
|
-
|
|
425
|
+
fe > 0 && /* @__PURE__ */ h("div", { className: d("flex border-t", x), children: [
|
|
424
426
|
/* @__PURE__ */ l(
|
|
425
427
|
"div",
|
|
426
428
|
{
|
|
427
429
|
className: d(
|
|
428
430
|
"w-16 shrink-0 border-r flex items-center justify-center py-2",
|
|
429
|
-
|
|
431
|
+
x
|
|
430
432
|
),
|
|
431
433
|
children: /* @__PURE__ */ l(
|
|
432
434
|
M,
|
|
@@ -454,7 +456,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
454
456
|
{
|
|
455
457
|
className: d(
|
|
456
458
|
"flex-1 border-r last:border-r-0",
|
|
457
|
-
|
|
459
|
+
x
|
|
458
460
|
)
|
|
459
461
|
},
|
|
460
462
|
r
|
|
@@ -465,7 +467,7 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
465
467
|
className: "grid gap-y-1 px-1 relative z-10",
|
|
466
468
|
style: {
|
|
467
469
|
gridTemplateColumns: `repeat(${u.length}, minmax(0, 1fr))`,
|
|
468
|
-
gridTemplateRows: `repeat(${
|
|
470
|
+
gridTemplateRows: `repeat(${fe}, 24px)`
|
|
469
471
|
},
|
|
470
472
|
children: z.map((e) => {
|
|
471
473
|
const { event: r, colStart: n, colSpan: s, row: a } = e, t = r.colorVariant || "tertiary", i = r.isDraft;
|
|
@@ -481,15 +483,15 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
481
483
|
gridColumnEnd: `span ${s}`,
|
|
482
484
|
gridRowStart: a
|
|
483
485
|
},
|
|
484
|
-
onClick: (c) =>
|
|
486
|
+
onClick: (c) => se(c, r),
|
|
485
487
|
children: /* @__PURE__ */ l(
|
|
486
488
|
"div",
|
|
487
489
|
{
|
|
488
490
|
className: d(
|
|
489
491
|
"h-full w-full rounded-md px-2 flex items-center overflow-hidden transition-all",
|
|
490
|
-
!i && !o &&
|
|
492
|
+
!i && !o && !j && "cursor-pointer hover:opacity-90",
|
|
491
493
|
i && "border-2 border-dashed border-current shadow-lg ring-2 ring-primary ring-offset-1",
|
|
492
|
-
r.colorHex ? "" :
|
|
494
|
+
r.colorHex ? "" : q[t].split(" ")[0] + " " + q[t].split(" ")[1],
|
|
493
495
|
o && "!shadow-none border border-black/30"
|
|
494
496
|
),
|
|
495
497
|
style: { backgroundColor: r.colorHex },
|
|
@@ -516,16 +518,16 @@ const X = Array.from({ length: 24 }, (o, C) => C), W = {
|
|
|
516
518
|
]
|
|
517
519
|
}
|
|
518
520
|
),
|
|
519
|
-
o ? /* @__PURE__ */ l("div", { className: "flex-1 w-full h-full relative overflow-hidden", children:
|
|
520
|
-
|
|
521
|
+
o ? /* @__PURE__ */ l("div", { className: "flex-1 w-full h-full relative overflow-hidden", children: me }) : /* @__PURE__ */ l(
|
|
522
|
+
Ve,
|
|
521
523
|
{
|
|
522
|
-
ref:
|
|
523
|
-
className: d("flex-1 w-full",
|
|
524
|
-
children:
|
|
524
|
+
ref: L,
|
|
525
|
+
className: d("flex-1 w-full", oe),
|
|
526
|
+
children: me
|
|
525
527
|
}
|
|
526
528
|
)
|
|
527
529
|
] });
|
|
528
530
|
};
|
|
529
531
|
export {
|
|
530
|
-
|
|
532
|
+
We as TimelineView
|
|
531
533
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export type CalendarView = 'day' | 'week' | 'month' | 'year';
|
|
3
3
|
export type EventType = 'event' | 'task' | 'appointment';
|
|
4
|
-
export type CalendarVariant = 'primary' | 'secondary' | '
|
|
4
|
+
export type CalendarVariant = 'primary' | 'secondary' | 'tertiary' | 'high-contrast' | 'ghost' | 'surface' | 'surface-container-lowest' | 'surface-container-low' | 'surface-container' | 'surface-container-high' | 'surface-container-highest';
|
|
5
5
|
export interface RecurrenceRule {
|
|
6
6
|
frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
|
|
7
7
|
interval: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CalendarEvent, CalendarVariant } from './types';
|
|
2
|
-
export declare const getCalendarBgClasses: (variant?: CalendarVariant) => "bg-transparent" | "bg-surface-container-
|
|
3
|
-
export declare const getCalendarStickyBgClasses: (variant?: CalendarVariant) => "bg-surface-container-
|
|
2
|
+
export declare const getCalendarBgClasses: (variant?: CalendarVariant) => "bg-surface-container-low text-on-surface" | "bg-surface-container-highest text-on-surface" | "bg-tertiary-container text-on-tertiary-container" | "bg-inverse-surface text-inverse-on-surface" | "bg-transparent text-on-surface" | "bg-surface text-on-surface" | "bg-surface-container-lowest text-on-surface" | "bg-surface-container text-on-surface" | "bg-surface-container-high text-on-surface";
|
|
3
|
+
export declare const getCalendarStickyBgClasses: (variant?: CalendarVariant) => "bg-surface-container-low text-on-surface" | "bg-surface-container-highest text-on-surface" | "bg-tertiary-container text-on-tertiary-container" | "bg-inverse-surface text-inverse-on-surface" | "bg-surface text-on-surface" | "bg-surface-container-lowest text-on-surface" | "bg-surface-container text-on-surface" | "bg-surface-container-high text-on-surface" | "bg-surface/80 backdrop-blur-md text-on-surface";
|
|
4
|
+
export declare const getCalendarSidePanelBgClasses: (variant?: CalendarVariant) => "bg-transparent" | "bg-surface-container-lowest" | "bg-surface-container-low" | "bg-surface-container-low/30" | "bg-surface-container-low/50" | "bg-surface-container-low/70" | "bg-inverse-surface/5";
|
|
4
5
|
export declare const expandEvents: (events: CalendarEvent[], viewStart: Date, viewEnd: Date) => CalendarEvent[];
|
|
5
6
|
export declare const getDaysForMonthView: (currentDate: Date) => Date[];
|
|
6
7
|
export declare const getDaysForWeekView: (currentDate: Date) => Date[];
|