@innosolutions/inno-calendar 1.0.35 → 1.0.38

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.
Files changed (55) hide show
  1. package/AGENT.md +36 -1
  2. package/dist/agenda-widget-BsRtRyZ3.cjs +2 -0
  3. package/dist/agenda-widget-BsRtRyZ3.cjs.map +1 -0
  4. package/dist/{agenda-widget-CyRPG-1p.js → agenda-widget-CNUXKiQT.js} +723 -745
  5. package/dist/agenda-widget-CNUXKiQT.js.map +1 -0
  6. package/dist/components/event/event-card.d.ts +16 -1
  7. package/dist/components/event/event-card.d.ts.map +1 -1
  8. package/dist/components/event/event-page-transition.d.ts +32 -0
  9. package/dist/components/event/event-page-transition.d.ts.map +1 -0
  10. package/dist/components/index.cjs +1 -1
  11. package/dist/components/index.d.ts +1 -1
  12. package/dist/components/index.d.ts.map +1 -1
  13. package/dist/components/index.mjs +27 -26
  14. package/dist/components/inno-calendar.d.ts.map +1 -1
  15. package/dist/components/primitives/multi-day-banner.d.ts.map +1 -1
  16. package/dist/components/views/day-events-expansion.d.ts +51 -0
  17. package/dist/components/views/day-events-expansion.d.ts.map +1 -0
  18. package/dist/components/views/index.d.ts +1 -0
  19. package/dist/components/views/index.d.ts.map +1 -1
  20. package/dist/components/views/month-view.d.ts +14 -3
  21. package/dist/components/views/month-view.d.ts.map +1 -1
  22. package/dist/components/views/timeline-view.d.ts.map +1 -1
  23. package/dist/core/index.cjs +1 -1
  24. package/dist/core/index.mjs +139 -136
  25. package/dist/core/utils/date-utils.d.ts +31 -1
  26. package/dist/core/utils/date-utils.d.ts.map +1 -1
  27. package/dist/core/utils/event-utils.d.ts +40 -0
  28. package/dist/core/utils/event-utils.d.ts.map +1 -1
  29. package/dist/core/utils/position-utils.d.ts +5 -1
  30. package/dist/core/utils/position-utils.d.ts.map +1 -1
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.mjs +190 -186
  33. package/dist/presets/index.cjs +1 -1
  34. package/dist/presets/index.mjs +1 -1
  35. package/dist/styles/index.css +1 -1
  36. package/dist/{tailwind-calendar-BaJAw6io.cjs → tailwind-calendar-BqhSHRk0.cjs} +2 -2
  37. package/dist/{tailwind-calendar-BaJAw6io.cjs.map → tailwind-calendar-BqhSHRk0.cjs.map} +1 -1
  38. package/dist/{tailwind-calendar-D-8ALvNh.js → tailwind-calendar-BvWm9ry9.js} +16 -16
  39. package/dist/{tailwind-calendar-D-8ALvNh.js.map → tailwind-calendar-BvWm9ry9.js.map} +1 -1
  40. package/dist/utils.cjs +1 -1
  41. package/dist/utils.cjs.map +1 -1
  42. package/dist/utils.mjs +380 -335
  43. package/dist/utils.mjs.map +1 -1
  44. package/dist/week-view-BGthazCB.js +3015 -0
  45. package/dist/week-view-BGthazCB.js.map +1 -0
  46. package/dist/week-view-DOvr2VIq.cjs +11 -0
  47. package/dist/week-view-DOvr2VIq.cjs.map +1 -0
  48. package/package.json +1 -1
  49. package/dist/agenda-widget-CuQxfYVI.cjs +0 -2
  50. package/dist/agenda-widget-CuQxfYVI.cjs.map +0 -1
  51. package/dist/agenda-widget-CyRPG-1p.js.map +0 -1
  52. package/dist/week-view-5nw-Hvod.js +0 -2754
  53. package/dist/week-view-5nw-Hvod.js.map +0 -1
  54. package/dist/week-view-C0iWG7_6.cjs +0 -11
  55. package/dist/week-view-C0iWG7_6.cjs.map +0 -1
@@ -1,2754 +0,0 @@
1
- import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
- import * as Y from "react";
3
- import { useState as oe, useCallback as M, forwardRef as ze, createElement as De, useMemo as V, useRef as se, useEffect as it, useLayoutEffect as qe } from "react";
4
- import { c as l, a as st } from "./index-DtaLkIY8.js";
5
- import * as H from "@radix-ui/react-dropdown-menu";
6
- import { getEventsCountInView as lt, getRangeText as dt, groupEventsByDate as ct, isToday as te, isSameDay as Pe, getEventsForDay as Le, separateEventsByDuration as Ke, calculateOverlappingPositions as Ye, getVisibleHoursArray as Xe, isWorkingHour as Je, formatHourLabel as we, generateMonthGrid as ut, getWeekDays as mt, startOfWeek as ht } from "./utils.mjs";
7
- import { a as We, b as Ee } from "./slot-selection-context-D2eu2o-7.js";
8
- import * as ue from "@radix-ui/react-popover";
9
- import * as pe from "@radix-ui/react-tooltip";
10
- const ne = ue.Root, re = ue.Trigger, an = ue.Anchor, Q = Y.forwardRef(({ className: t, align: n = "center", sideOffset: o = 4, ...a }, d) => /* @__PURE__ */ e(ue.Portal, { children: /* @__PURE__ */ e(
11
- ue.Content,
12
- {
13
- ref: d,
14
- align: n,
15
- sideOffset: o,
16
- className: l(
17
- "z-50 w-72 rounded-xl border bg-white text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
18
- t
19
- ),
20
- ...a
21
- }
22
- ) }));
23
- Q.displayName = ue.Content.displayName;
24
- const sn = pe.Provider, le = pe.Root, de = pe.Trigger, ee = Y.forwardRef(({ className: t, sideOffset: n = 4, ...o }, a) => /* @__PURE__ */ e(
25
- pe.Content,
26
- {
27
- ref: a,
28
- sideOffset: n,
29
- className: l(
30
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",
31
- t
32
- ),
33
- ...o
34
- }
35
- ));
36
- ee.displayName = pe.Content.displayName;
37
- function fe(t) {
38
- return {
39
- blue: {
40
- bg: "bg-blue-50 dark:bg-blue-950/30",
41
- text: "text-blue-700 dark:text-blue-300",
42
- dot: "bg-blue-500",
43
- dotFill: "fill-blue-600 dark:fill-blue-500",
44
- border: "border-blue-400 dark:border-blue-600"
45
- },
46
- green: {
47
- bg: "bg-green-50 dark:bg-green-950/30",
48
- text: "text-green-700 dark:text-green-300",
49
- dot: "bg-green-500",
50
- dotFill: "fill-green-600 dark:fill-green-500",
51
- border: "border-green-400 dark:border-green-600"
52
- },
53
- red: {
54
- bg: "bg-red-50 dark:bg-red-950/30",
55
- text: "text-red-700 dark:text-red-300",
56
- dot: "bg-red-500",
57
- dotFill: "fill-red-600 dark:fill-red-500",
58
- border: "border-red-400 dark:border-red-600"
59
- },
60
- yellow: {
61
- bg: "bg-yellow-50 dark:bg-yellow-950/30",
62
- text: "text-yellow-700 dark:text-yellow-300",
63
- dot: "bg-yellow-500",
64
- dotFill: "fill-yellow-600 dark:fill-yellow-500",
65
- border: "border-yellow-400 dark:border-yellow-600"
66
- },
67
- purple: {
68
- bg: "bg-purple-50 dark:bg-purple-950/30",
69
- text: "text-purple-700 dark:text-purple-300",
70
- dot: "bg-purple-500",
71
- dotFill: "fill-purple-600 dark:fill-purple-500",
72
- border: "border-purple-400 dark:border-purple-600"
73
- },
74
- orange: {
75
- bg: "bg-orange-50 dark:bg-orange-950/30",
76
- text: "text-orange-700 dark:text-orange-300",
77
- dot: "bg-orange-500",
78
- dotFill: "fill-orange-600 dark:fill-orange-500",
79
- border: "border-orange-400 dark:border-orange-600"
80
- },
81
- pink: {
82
- bg: "bg-pink-50 dark:bg-pink-950/30",
83
- text: "text-pink-700 dark:text-pink-300",
84
- dot: "bg-pink-500",
85
- dotFill: "fill-pink-600 dark:fill-pink-500",
86
- border: "border-pink-400 dark:border-pink-600"
87
- },
88
- teal: {
89
- bg: "bg-teal-50 dark:bg-teal-950/30",
90
- text: "text-teal-700 dark:text-teal-300",
91
- dot: "bg-teal-500",
92
- dotFill: "fill-teal-600 dark:fill-teal-500",
93
- border: "border-teal-400 dark:border-teal-600"
94
- },
95
- gray: {
96
- bg: "bg-gray-50 dark:bg-gray-950/30",
97
- text: "text-gray-700 dark:text-gray-300",
98
- dot: "bg-gray-500",
99
- dotFill: "fill-gray-600 dark:fill-gray-500",
100
- border: "border-gray-400 dark:border-gray-600"
101
- },
102
- indigo: {
103
- bg: "bg-indigo-50 dark:bg-indigo-950/30",
104
- text: "text-indigo-700 dark:text-indigo-300",
105
- dot: "bg-indigo-500",
106
- dotFill: "fill-indigo-600 dark:fill-indigo-500",
107
- border: "border-indigo-400 dark:border-indigo-600"
108
- }
109
- }[t ?? "blue"];
110
- }
111
- function ve(t) {
112
- return t.toLocaleTimeString([], {
113
- hour: "2-digit",
114
- minute: "2-digit",
115
- hour12: !1
116
- });
117
- }
118
- function Z(t, n) {
119
- return `${ve(t)} - ${ve(n)}`;
120
- }
121
- function _e(t) {
122
- const n = new Date(t);
123
- return n.setHours(0, 0, 0, 0), n;
124
- }
125
- function Ce({
126
- event: t,
127
- variant: n = "full",
128
- badgeVariant: o = "colored",
129
- onClick: a,
130
- className: d,
131
- showTime: g = !0,
132
- showDescription: c = !1,
133
- showParticipants: b = !1,
134
- style: z,
135
- disablePopover: p = !1,
136
- renderPopover: y,
137
- enableDrag: L = !1
138
- }) {
139
- const i = fe(t.color), [v, h] = oe(!1), [w, _] = oe(!1), W = We(), D = t.endDate < _e(/* @__PURE__ */ new Date()), x = t.isCanceled ?? !1, O = L && W && !x && !D, j = t.data, B = j?.meetingTookPlace ?? t.meetingTookPlace ?? !1, $ = x ? /* @__PURE__ */ e(ft, { className: "h-3 w-3 text-zinc-800 dark:text-zinc-200" }) : B ? /* @__PURE__ */ e(pt, { className: l("h-3 w-3", i.text) }) : null, F = t.scheduleTypeName || j?.scheduleTypeName || j?.typeName, u = j?.productName, k = j?.nrParticipant, A = j?.siteName, m = j?.siteCity, E = [A, m].filter(Boolean).join(", "), I = M(() => {
140
- w || (p && a ? a(t) : p || h(!0));
141
- }, [w, p, a, t]), N = M(() => {
142
- h(!1);
143
- }, []), G = M(
144
- (f) => {
145
- O && (f.dataTransfer.effectAllowed = "move", f.dataTransfer.setData("text/plain", t.id), _(!0), W?.startDrag?.(t));
146
- },
147
- [O, t, W]
148
- ), C = M(() => {
149
- _(!1), W?.isDragging && W.endDrag?.();
150
- }, [W]);
151
- if (n === "dot") {
152
- const f = /* @__PURE__ */ e(
153
- "button",
154
- {
155
- type: "button",
156
- onClick: I,
157
- className: l(
158
- "size-2 rounded-full cursor-pointer transition-opacity",
159
- D ? "bg-gray-400" : i.dot,
160
- t.isCanceled && "opacity-50",
161
- d
162
- ),
163
- style: z,
164
- "aria-label": t.title
165
- }
166
- );
167
- return p ? /* @__PURE__ */ r(le, { children: [
168
- /* @__PURE__ */ e(de, { asChild: !0, children: f }),
169
- /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5", children: [
170
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
171
- /* @__PURE__ */ e("div", { className: "text-xs opacity-80", children: Z(t.startDate, t.endDate) })
172
- ] }) })
173
- ] }) : /* @__PURE__ */ r(ne, { open: v, onOpenChange: h, children: [
174
- /* @__PURE__ */ e(re, { asChild: !0, children: /* @__PURE__ */ r(le, { children: [
175
- /* @__PURE__ */ e(de, { asChild: !0, children: f }),
176
- /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }) })
177
- ] }) }),
178
- /* @__PURE__ */ e(Q, { className: "w-80", children: y ? y({ event: t, onClose: N }) : /* @__PURE__ */ e(he, { event: t, onClose: N }) })
179
- ] });
180
- }
181
- if (n === "compact") {
182
- const f = /* @__PURE__ */ r(
183
- "div",
184
- {
185
- role: "button",
186
- tabIndex: 0,
187
- draggable: !!O,
188
- onDragStart: G,
189
- onDragEnd: C,
190
- onClick: p ? I : void 0,
191
- onKeyDown: (S) => {
192
- (S.key === "Enter" || S.key === " ") && (S.preventDefault(), I());
193
- },
194
- className: l(
195
- "group flex w-full relative items-center shadow-[0_0_1px_rgba(0,0,0,0.3)] gap-0 rounded px-1.5 py-1 text-left text-xs transition-colors hover:opacity-80",
196
- O ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",
197
- w && "opacity-50",
198
- // Cancelled events get gray background with strikethrough
199
- x || // Past events get neutral zinc styling
200
- D ? "bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through" : [
201
- o === "colored" && [i.bg, i.text],
202
- o === "mixed" && [i.bg, i.text],
203
- o === "dot" && "bg-muted/50"
204
- ],
205
- d
206
- ),
207
- style: z,
208
- children: [
209
- ["dot", "mixed"].includes(o) && !D && /* @__PURE__ */ e(
210
- "svg",
211
- {
212
- width: "8",
213
- height: "8",
214
- viewBox: "0 0 8 8",
215
- className: "event-dot absolute -top-1 -left-1 shrink-0",
216
- "aria-hidden": "true",
217
- focusable: "false",
218
- children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4", className: i.dotFill })
219
- }
220
- ),
221
- /* @__PURE__ */ e("span", { className: "flex-1 min-w-0 overflow-hidden", children: /* @__PURE__ */ r("span", { className: "", children: [
222
- /* @__PURE__ */ e(
223
- "span",
224
- {
225
- className: "relative block overflow-hidden whitespace-nowrap text-xs leading-tight",
226
- style: {
227
- maskImage: "linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)",
228
- WebkitMaskImage: "linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)"
229
- },
230
- children: /* @__PURE__ */ r("span", { className: "inline-flex event-marquee", children: [
231
- /* @__PURE__ */ e("span", { className: "shrink-0 px-1", children: t.title }),
232
- /* @__PURE__ */ e("span", { className: "shrink-0 px-1", children: "•" }),
233
- /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "shrink-0 px-1", children: t.title }),
234
- /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "shrink-0 px-1", children: "•" })
235
- ] })
236
- }
237
- ),
238
- /* @__PURE__ */ e(
239
- "div",
240
- {
241
- className: l(
242
- "w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",
243
- D ? "border-zinc-400 dark:border-zinc-600" : i.border
244
- ),
245
- children: Z(t.startDate, t.endDate)
246
- }
247
- )
248
- ] }) }),
249
- /* @__PURE__ */ e("div", { className: "flex gap-0.5", children: $ })
250
- ]
251
- }
252
- );
253
- return p ? /* @__PURE__ */ r(le, { children: [
254
- /* @__PURE__ */ e(de, { asChild: !0, children: f }),
255
- /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5", children: [
256
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
257
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Z(t.startDate, t.endDate) })
258
- ] }) })
259
- ] }) : /* @__PURE__ */ r(ne, { open: v, onOpenChange: h, children: [
260
- /* @__PURE__ */ e(re, { asChild: !0, children: f }),
261
- /* @__PURE__ */ e(Q, { className: "w-80", children: y ? y({ event: t, onClose: N }) : /* @__PURE__ */ e(he, { event: t, onClose: N }) })
262
- ] });
263
- }
264
- const s = /* @__PURE__ */ r(
265
- "button",
266
- {
267
- type: "button",
268
- onClick: I,
269
- className: l(
270
- "group relative flex w-full flex-col gap-1 rounded-md border px-2 py-1.5 text-left transition-all hover:shadow-md",
271
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
272
- // Cancelled events get gray background with strikethrough
273
- x || // Past events get neutral zinc styling with strikethrough
274
- D ? "bg-zinc-100 dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-500 dark:text-zinc-400 line-through" : [
275
- o === "colored" && [
276
- i.bg,
277
- i.border,
278
- i.text
279
- ],
280
- o === "mixed" && [
281
- i.bg,
282
- i.border,
283
- i.text
284
- ],
285
- o === "dot" && "bg-muted/50 border-border"
286
- ],
287
- d
288
- ),
289
- style: z,
290
- children: [
291
- /* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-1", children: [
292
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 min-w-0", children: [
293
- ["dot", "mixed"].includes(o) && !D && !x && /* @__PURE__ */ e(
294
- "svg",
295
- {
296
- width: "8",
297
- height: "8",
298
- viewBox: "0 0 8 8",
299
- className: "event-dot shrink-0",
300
- "aria-hidden": "true",
301
- focusable: "false",
302
- children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4", className: i.dotFill })
303
- }
304
- ),
305
- /* @__PURE__ */ r(
306
- "span",
307
- {
308
- className: l(
309
- "text-sm font-medium truncate",
310
- !D && !x && o !== "dot" && i.text,
311
- x && "line-through"
312
- ),
313
- children: [
314
- t.title,
315
- F && /* @__PURE__ */ r("span", { className: "font-normal opacity-75", children: [
316
- " ",
317
- "- ",
318
- F
319
- ] })
320
- ]
321
- }
322
- )
323
- ] }),
324
- $
325
- ] }),
326
- u && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground truncate", children: u }),
327
- k != null && /* @__PURE__ */ r("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
328
- /* @__PURE__ */ e(Se, { className: "h-3 w-3 shrink-0" }),
329
- /* @__PURE__ */ r("span", { children: [
330
- k,
331
- " participant",
332
- k !== 1 ? "s" : ""
333
- ] })
334
- ] }),
335
- g && /* @__PURE__ */ r("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
336
- /* @__PURE__ */ e($e, { className: "h-3 w-3 shrink-0" }),
337
- /* @__PURE__ */ e("span", { children: Z(t.startDate, t.endDate) })
338
- ] }),
339
- E && /* @__PURE__ */ r("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
340
- /* @__PURE__ */ e(Ze, { className: "h-3 w-3 shrink-0" }),
341
- /* @__PURE__ */ e("span", { className: "truncate", children: E })
342
- ] }),
343
- c && t.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground line-clamp-2", children: t.description }),
344
- b && t.participants && t.participants.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
345
- /* @__PURE__ */ e(Se, { className: "h-3 w-3 shrink-0" }),
346
- /* @__PURE__ */ e("span", { className: "truncate", children: t.participants.map((f) => f.name).join(", ") })
347
- ] })
348
- ]
349
- }
350
- );
351
- return p ? /* @__PURE__ */ r(le, { children: [
352
- /* @__PURE__ */ e(de, { asChild: !0, children: s }),
353
- /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5", children: [
354
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
355
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Z(t.startDate, t.endDate) })
356
- ] }) })
357
- ] }) : /* @__PURE__ */ r(ne, { open: v, onOpenChange: h, children: [
358
- /* @__PURE__ */ e(re, { asChild: !0, children: s }),
359
- /* @__PURE__ */ e(Q, { className: "w-80", children: y ? y({ event: t, onClose: N }) : /* @__PURE__ */ e(he, { event: t, onClose: N }) })
360
- ] });
361
- }
362
- function $e({ className: t }) {
363
- return /* @__PURE__ */ r(
364
- "svg",
365
- {
366
- xmlns: "http://www.w3.org/2000/svg",
367
- viewBox: "0 0 24 24",
368
- fill: "none",
369
- stroke: "currentColor",
370
- strokeWidth: "2",
371
- strokeLinecap: "round",
372
- strokeLinejoin: "round",
373
- className: t,
374
- children: [
375
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
376
- /* @__PURE__ */ e("polyline", { points: "12 6 12 12 16 14" })
377
- ]
378
- }
379
- );
380
- }
381
- function pt({ className: t }) {
382
- return /* @__PURE__ */ e(
383
- "svg",
384
- {
385
- xmlns: "http://www.w3.org/2000/svg",
386
- viewBox: "0 0 24 24",
387
- fill: "none",
388
- stroke: "currentColor",
389
- strokeWidth: "2",
390
- strokeLinecap: "round",
391
- strokeLinejoin: "round",
392
- className: t,
393
- children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
394
- }
395
- );
396
- }
397
- function ft({ className: t }) {
398
- return /* @__PURE__ */ r(
399
- "svg",
400
- {
401
- xmlns: "http://www.w3.org/2000/svg",
402
- viewBox: "0 0 24 24",
403
- fill: "none",
404
- stroke: "currentColor",
405
- strokeWidth: "2",
406
- strokeLinecap: "round",
407
- strokeLinejoin: "round",
408
- className: t,
409
- children: [
410
- /* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
411
- /* @__PURE__ */ e("path", { d: "m6 6 12 12" })
412
- ]
413
- }
414
- );
415
- }
416
- function Se({ className: t }) {
417
- return /* @__PURE__ */ r(
418
- "svg",
419
- {
420
- xmlns: "http://www.w3.org/2000/svg",
421
- viewBox: "0 0 24 24",
422
- fill: "none",
423
- stroke: "currentColor",
424
- strokeWidth: "2",
425
- strokeLinecap: "round",
426
- strokeLinejoin: "round",
427
- className: t,
428
- children: [
429
- /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
430
- /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
431
- /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
432
- /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
433
- ]
434
- }
435
- );
436
- }
437
- function Ze({ className: t }) {
438
- return /* @__PURE__ */ r(
439
- "svg",
440
- {
441
- xmlns: "http://www.w3.org/2000/svg",
442
- viewBox: "0 0 24 24",
443
- fill: "none",
444
- stroke: "currentColor",
445
- strokeWidth: "2",
446
- strokeLinecap: "round",
447
- strokeLinejoin: "round",
448
- className: t,
449
- children: [
450
- /* @__PURE__ */ e("path", { d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" }),
451
- /* @__PURE__ */ e("circle", { cx: "12", cy: "10", r: "3" })
452
- ]
453
- }
454
- );
455
- }
456
- function he({
457
- event: t,
458
- onClose: n
459
- }) {
460
- const o = fe(t.color), a = t.isCanceled ?? !1;
461
- return /* @__PURE__ */ r("div", { className: "space-y-3", children: [
462
- /* @__PURE__ */ r("div", { className: "flex items-start gap-3", children: [
463
- /* @__PURE__ */ e("div", { className: l("size-4 rounded shrink-0 mt-0.5", o.dot) }),
464
- /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
465
- /* @__PURE__ */ e(
466
- "h3",
467
- {
468
- className: l(
469
- "font-semibold text-lg",
470
- a && "line-through opacity-50"
471
- ),
472
- children: t.title
473
- }
474
- ),
475
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1 text-sm text-muted-foreground mt-1", children: [
476
- /* @__PURE__ */ e($e, { className: "h-4 w-4 shrink-0" }),
477
- /* @__PURE__ */ e("span", { className: "tabular-nums", children: Z(t.startDate, t.endDate) })
478
- ] })
479
- ] })
480
- ] }),
481
- t.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t.description }),
482
- /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-1.5", children: [
483
- t.isAllDay && /* @__PURE__ */ e("span", { className: "text-xs bg-muted px-2 py-0.5 rounded-full font-medium", children: "All day" }),
484
- t.isRecurring && /* @__PURE__ */ e("span", { className: "text-xs bg-muted px-2 py-0.5 rounded-full font-medium", children: "Recurring" }),
485
- a && /* @__PURE__ */ e("span", { className: "text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium", children: "Canceled" })
486
- ] }),
487
- /* @__PURE__ */ e("div", { className: "flex justify-end pt-2 border-t", children: /* @__PURE__ */ e(
488
- "button",
489
- {
490
- type: "button",
491
- onClick: n,
492
- className: "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",
493
- children: "Close"
494
- }
495
- ) })
496
- ] });
497
- }
498
- function Qe({
499
- event: t,
500
- position: n,
501
- hourHeight: o = 96,
502
- badgeVariant: a = "colored",
503
- onClick: d,
504
- className: g,
505
- disablePopover: c = !1,
506
- renderPopover: b,
507
- enableDrag: z = !0
508
- }) {
509
- const p = fe(t.color), [y, L] = oe(!1), [i, v] = oe(!1), h = We(), w = (t.endDate.getTime() - t.startDate.getTime()) / (1e3 * 60), _ = w / 60 * o - 8, W = t.endDate < _e(/* @__PURE__ */ new Date()), D = t.isCanceled ?? !1, x = z && h && !D && !W, O = w < 35, j = w > 25, B = w >= 45, $ = t.data, F = t.scheduleTypeName || $?.scheduleTypeName || $?.typeName, u = $?.productName, k = $?.nrParticipant, A = $?.siteName, m = $?.siteCity, E = [A, m].filter(Boolean).join(", "), I = a === "dot", N = M(() => {
510
- i || (c && d ? d(t) : c || L(!0));
511
- }, [i, c, d, t]), G = M(() => {
512
- L(!1);
513
- }, []), C = M(
514
- (T) => {
515
- if (!x) return;
516
- T.dataTransfer.effectAllowed = "move", T.dataTransfer.setData("text/plain", t.id);
517
- const q = T.currentTarget, R = q.getBoundingClientRect();
518
- T.dataTransfer.setDragImage(
519
- q,
520
- T.clientX - R.left,
521
- T.clientY - R.top
522
- ), v(!0), h?.startDrag?.(t);
523
- },
524
- [x, t, h]
525
- ), s = M(() => {
526
- v(!1), h?.isDragging && h.endDrag?.();
527
- }, [h]), f = M(
528
- (T) => {
529
- (T.key === "Enter" || T.key === " ") && (T.preventDefault(), N());
530
- },
531
- [N]
532
- ), S = /* @__PURE__ */ r(
533
- "div",
534
- {
535
- role: "button",
536
- tabIndex: 0,
537
- draggable: !!x,
538
- onDragStart: C,
539
- onDragEnd: s,
540
- onKeyDown: f,
541
- onClick: i ? void 0 : N,
542
- className: l(
543
- "group flex w-full select-none flex-col gap-0.5 overflow-hidden rounded-md border px-2 py-1.5 text-xs text-left",
544
- "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
545
- "transition-opacity",
546
- x ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",
547
- i && "opacity-50",
548
- // Cancelled events get gray background with strikethrough
549
- D || // Past events get neutral zinc styling with strikethrough
550
- W ? "bg-zinc-100 dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-500 dark:text-zinc-400 line-through" : [
551
- // Colored/mixed variants
552
- !I && [p.bg, p.border, p.text],
553
- // Dot variant - neutral background
554
- I && "bg-neutral-50 dark:bg-neutral-900 border-neutral-200 dark:border-neutral-700"
555
- ],
556
- // Short events center content
557
- O && "py-0 justify-center",
558
- g
559
- ),
560
- style: { height: `${Math.max(_, 20)}px` },
561
- children: [
562
- /* @__PURE__ */ r("div", { className: "flex items-start gap-1.5 min-w-0", children: [
563
- ["mixed", "dot"].includes(a) && !W && !D && /* @__PURE__ */ e(
564
- "svg",
565
- {
566
- width: "8",
567
- height: "8",
568
- viewBox: "0 0 8 8",
569
- className: "event-dot shrink-0",
570
- "aria-hidden": "true",
571
- focusable: "false",
572
- children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4", className: p.dotFill })
573
- }
574
- ),
575
- /* @__PURE__ */ e("div", { className: "flex-1 min-w-0 overflow-hidden", children: /* @__PURE__ */ r(
576
- "p",
577
- {
578
- className: l(
579
- "font-semibold truncate leading-tight",
580
- !W && !D && I && "text-foreground"
581
- ),
582
- children: [
583
- t.title,
584
- F && /* @__PURE__ */ r("span", { className: "font-normal opacity-75", children: [
585
- " ",
586
- "- ",
587
- F
588
- ] })
589
- ]
590
- }
591
- ) })
592
- ] }),
593
- B && u && /* @__PURE__ */ e(
594
- "p",
595
- {
596
- className: l(
597
- "text-[11px] truncate leading-tight",
598
- I ? "text-muted-foreground" : "opacity-80"
599
- ),
600
- children: u
601
- }
602
- ),
603
- B && k != null && /* @__PURE__ */ r(
604
- "div",
605
- {
606
- className: l(
607
- "flex items-center gap-1 text-[11px] leading-tight",
608
- I ? "text-muted-foreground" : "opacity-80"
609
- ),
610
- children: [
611
- /* @__PURE__ */ e(Se, { className: "h-3 w-3 shrink-0" }),
612
- /* @__PURE__ */ r("span", { children: [
613
- k,
614
- " participant",
615
- k !== 1 ? "s" : ""
616
- ] })
617
- ]
618
- }
619
- ),
620
- j && /* @__PURE__ */ r(
621
- "div",
622
- {
623
- className: l(
624
- "flex items-center gap-1 text-[11px] tabular-nums leading-tight",
625
- I ? "text-muted-foreground" : "opacity-90"
626
- ),
627
- children: [
628
- /* @__PURE__ */ e($e, { className: "h-3 w-3 shrink-0" }),
629
- /* @__PURE__ */ r("span", { children: [
630
- ve(t.startDate),
631
- " - ",
632
- ve(t.endDate)
633
- ] })
634
- ]
635
- }
636
- ),
637
- B && E && /* @__PURE__ */ r(
638
- "div",
639
- {
640
- className: l(
641
- "flex items-center gap-1 text-[11px] truncate leading-tight",
642
- I ? "text-muted-foreground" : "opacity-80"
643
- ),
644
- children: [
645
- /* @__PURE__ */ e(Ze, { className: "h-3 w-3 shrink-0" }),
646
- /* @__PURE__ */ e("span", { className: "truncate", children: E })
647
- ]
648
- }
649
- )
650
- ]
651
- }
652
- ), P = /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5", children: [
653
- /* @__PURE__ */ r("div", { className: "font-medium", children: [
654
- t.title,
655
- F && /* @__PURE__ */ r("span", { className: "font-normal opacity-75", children: [
656
- " ",
657
- "- ",
658
- F
659
- ] })
660
- ] }),
661
- u && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: u }),
662
- k != null && /* @__PURE__ */ r("div", { className: "text-xs text-muted-foreground", children: [
663
- k,
664
- " participant",
665
- k !== 1 ? "s" : ""
666
- ] }),
667
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Z(t.startDate, t.endDate) }),
668
- E && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: E })
669
- ] }) });
670
- return c ? /* @__PURE__ */ e(
671
- "div",
672
- {
673
- className: "absolute p-0.5",
674
- style: {
675
- top: `${n.top}px`,
676
- left: `${n.left}%`,
677
- width: n.minWidth ? `max(${n.minWidth}px, ${n.width}%)` : `${n.width}%`,
678
- minWidth: n.minWidth ? `${n.minWidth}px` : void 0
679
- },
680
- children: /* @__PURE__ */ r(le, { children: [
681
- /* @__PURE__ */ e(de, { asChild: !0, children: S }),
682
- P
683
- ] })
684
- }
685
- ) : /* @__PURE__ */ e(
686
- "div",
687
- {
688
- className: "absolute p-0.5",
689
- style: {
690
- top: `${n.top}px`,
691
- left: `${n.left}%`,
692
- width: n.minWidth ? `max(${n.minWidth}px, ${n.width}%)` : `${n.width}%`,
693
- minWidth: n.minWidth ? `${n.minWidth}px` : void 0
694
- },
695
- children: /* @__PURE__ */ r(ne, { open: y, onOpenChange: L, children: [
696
- /* @__PURE__ */ e(re, { asChild: !0, children: S }),
697
- /* @__PURE__ */ e(Q, { className: "w-80", children: b ? b({ event: t, onClose: G }) : /* @__PURE__ */ e(he, { event: t, onClose: G }) })
698
- ] })
699
- }
700
- );
701
- }
702
- function ln({
703
- event: t,
704
- spanDays: n,
705
- isStart: o,
706
- isEnd: a,
707
- onClick: d,
708
- className: g,
709
- disablePopover: c = !1,
710
- renderPopover: b
711
- }) {
712
- const z = fe(t.color), [p, y] = oe(!1), L = t.endDate < _e(/* @__PURE__ */ new Date()), i = t.isCanceled ?? !1, v = M(() => {
713
- c && d ? d(t) : c || y(!0);
714
- }, [c, d, t]), h = M(() => {
715
- y(!1);
716
- }, []), w = /* @__PURE__ */ e(
717
- "button",
718
- {
719
- type: "button",
720
- onClick: v,
721
- className: l(
722
- "flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",
723
- // Cancelled events get gray background with strikethrough
724
- i || // Past events get neutral zinc styling with strikethrough
725
- L ? "bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through" : [z.dot, "text-white"],
726
- o && "rounded-l",
727
- a && "rounded-r",
728
- !o && "border-l-0",
729
- !a && "border-r-0",
730
- g
731
- ),
732
- style: { width: `${n * 100}%` },
733
- children: o && /* @__PURE__ */ e("span", { className: "truncate", children: t.title })
734
- }
735
- ), _ = /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5", children: [
736
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
737
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Z(t.startDate, t.endDate) })
738
- ] }) });
739
- return c ? /* @__PURE__ */ r(le, { children: [
740
- /* @__PURE__ */ e(de, { asChild: !0, children: w }),
741
- _
742
- ] }) : /* @__PURE__ */ r(ne, { open: p, onOpenChange: y, children: [
743
- /* @__PURE__ */ e(re, { asChild: !0, children: w }),
744
- /* @__PURE__ */ e(Q, { className: "w-80", children: b ? b({ event: t, onClose: h }) : /* @__PURE__ */ e(he, { event: t, onClose: h }) })
745
- ] });
746
- }
747
- if (typeof window < "u" && !document.getElementById("inno-calendar-event-marquee-style")) {
748
- const t = document.createElement("style");
749
- t.id = "inno-calendar-event-marquee-style", t.innerHTML = `
750
- @keyframes event-marquee {
751
- 0% { transform: translateX(0); }
752
- 100% { transform: translateX(-50%); }
753
- }
754
- .event-marquee {
755
- animation: event-marquee 28s linear infinite;
756
- will-change: transform;
757
- }
758
- `, document.head.appendChild(t);
759
- }
760
- const je = (t) => typeof t == "boolean" ? `${t}` : t === 0 ? "0" : t, Be = st, et = (t, n) => (o) => {
761
- var a;
762
- if (n?.variants == null) return Be(t, o?.class, o?.className);
763
- const { variants: d, defaultVariants: g } = n, c = Object.keys(d).map((p) => {
764
- const y = o?.[p], L = g?.[p];
765
- if (y === null) return null;
766
- const i = je(y) || je(L);
767
- return d[p][i];
768
- }), b = o && Object.entries(o).reduce((p, y) => {
769
- let [L, i] = y;
770
- return i === void 0 || (p[L] = i), p;
771
- }, {}), z = n == null || (a = n.compoundVariants) === null || a === void 0 ? void 0 : a.reduce((p, y) => {
772
- let { class: L, className: i, ...v } = y;
773
- return Object.entries(v).every((h) => {
774
- let [w, _] = h;
775
- return Array.isArray(_) ? _.includes({
776
- ...g,
777
- ...b
778
- }[w]) : {
779
- ...g,
780
- ...b
781
- }[w] === _;
782
- }) ? [
783
- ...p,
784
- L,
785
- i
786
- ] : p;
787
- }, []);
788
- return Be(t, c, z, o?.class, o?.className);
789
- }, gt = et(
790
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
791
- {
792
- variants: {
793
- variant: {
794
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
795
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
796
- outline: "border border-input active:!bg-zinc-100 hover:!bg-zinc-50 active:bg-white !bg-white hover:bg-accent hover:text-accent-foreground",
797
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
798
- ghost: "hover:bg-accent hover:text-accent-foreground",
799
- link: "text-primary underline-offset-4 hover:underline"
800
- },
801
- size: {
802
- default: "h-9 px-4 py-2",
803
- sm: "h-8 rounded-md px-3 text-xs",
804
- lg: "h-10 rounded-md px-8",
805
- icon: "h-9 w-9"
806
- }
807
- },
808
- defaultVariants: {
809
- variant: "default",
810
- size: "default"
811
- }
812
- }
813
- ), ce = ze(
814
- ({ className: t, variant: n, size: o, loading: a, disabled: d, children: g, ...c }, b) => /* @__PURE__ */ r(
815
- "button",
816
- {
817
- className: l(gt({ variant: n, size: o, className: t })),
818
- ref: b,
819
- disabled: d || a,
820
- ...c,
821
- children: [
822
- a && /* @__PURE__ */ r(
823
- "svg",
824
- {
825
- className: "animate-spin -ml-1 mr-2 size-4",
826
- xmlns: "http://www.w3.org/2000/svg",
827
- fill: "none",
828
- viewBox: "0 0 24 24",
829
- children: [
830
- /* @__PURE__ */ e(
831
- "circle",
832
- {
833
- className: "opacity-25",
834
- cx: "12",
835
- cy: "12",
836
- r: "10",
837
- stroke: "currentColor",
838
- strokeWidth: "4"
839
- }
840
- ),
841
- /* @__PURE__ */ e(
842
- "path",
843
- {
844
- className: "opacity-75",
845
- fill: "currentColor",
846
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
847
- }
848
- )
849
- ]
850
- }
851
- ),
852
- g
853
- ]
854
- }
855
- )
856
- );
857
- ce.displayName = "Button";
858
- const tt = (...t) => t.filter((n, o, a) => !!n && n.trim() !== "" && a.indexOf(n) === o).join(" ").trim();
859
- const xt = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
860
- const bt = (t) => t.replace(
861
- /^([A-Z])|[\s-_]+(\w)/g,
862
- (n, o, a) => a ? a.toUpperCase() : o.toLowerCase()
863
- );
864
- const Re = (t) => {
865
- const n = bt(t);
866
- return n.charAt(0).toUpperCase() + n.slice(1);
867
- };
868
- var yt = {
869
- xmlns: "http://www.w3.org/2000/svg",
870
- width: 24,
871
- height: 24,
872
- viewBox: "0 0 24 24",
873
- fill: "none",
874
- stroke: "currentColor",
875
- strokeWidth: 2,
876
- strokeLinecap: "round",
877
- strokeLinejoin: "round"
878
- };
879
- const wt = (t) => {
880
- for (const n in t)
881
- if (n.startsWith("aria-") || n === "role" || n === "title")
882
- return !0;
883
- return !1;
884
- };
885
- const vt = ze(
886
- ({
887
- color: t = "currentColor",
888
- size: n = 24,
889
- strokeWidth: o = 2,
890
- absoluteStrokeWidth: a,
891
- className: d = "",
892
- children: g,
893
- iconNode: c,
894
- ...b
895
- }, z) => De(
896
- "svg",
897
- {
898
- ref: z,
899
- ...yt,
900
- width: n,
901
- height: n,
902
- stroke: t,
903
- strokeWidth: a ? Number(o) * 24 / Number(n) : o,
904
- className: tt("lucide", d),
905
- ...!g && !wt(b) && { "aria-hidden": "true" },
906
- ...b
907
- },
908
- [
909
- ...c.map(([p, y]) => De(p, y)),
910
- ...Array.isArray(g) ? g : [g]
911
- ]
912
- )
913
- );
914
- const Ie = (t, n) => {
915
- const o = ze(
916
- ({ className: a, ...d }, g) => De(vt, {
917
- ref: g,
918
- iconNode: n,
919
- className: tt(
920
- `lucide-${xt(Re(t))}`,
921
- `lucide-${t}`,
922
- a
923
- ),
924
- ...d
925
- })
926
- );
927
- return o.displayName = Re(t), o;
928
- };
929
- const Nt = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], kt = Ie("check", Nt);
930
- const Dt = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], Ct = Ie("chevron-right", Dt);
931
- const St = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], Mt = Ie("circle", St), He = H.Root, Oe = H.Trigger, Tt = Y.forwardRef(({ className: t, inset: n, children: o, ...a }, d) => /* @__PURE__ */ r(
932
- H.SubTrigger,
933
- {
934
- ref: d,
935
- className: l(
936
- "flex cursor-default select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
937
- n && "pl-8",
938
- t
939
- ),
940
- ...a,
941
- children: [
942
- o,
943
- /* @__PURE__ */ e(Ct, { className: "ml-auto h-4 w-4" })
944
- ]
945
- }
946
- ));
947
- Tt.displayName = H.SubTrigger.displayName;
948
- const zt = Y.forwardRef(({ className: t, ...n }, o) => /* @__PURE__ */ e(
949
- H.SubContent,
950
- {
951
- ref: o,
952
- className: l(
953
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
954
- t
955
- ),
956
- ...n
957
- }
958
- ));
959
- zt.displayName = H.SubContent.displayName;
960
- const Me = Y.forwardRef(({ className: t, sideOffset: n = 4, ...o }, a) => /* @__PURE__ */ e(H.Portal, { children: /* @__PURE__ */ e(
961
- H.Content,
962
- {
963
- ref: a,
964
- sideOffset: n,
965
- className: l(
966
- "z-50 rounded-xl border bg-popover p-1 text-popover-foreground shadow-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
967
- t
968
- ),
969
- ...o
970
- }
971
- ) }));
972
- Me.displayName = H.Content.displayName;
973
- const Te = Y.forwardRef(({ className: t, inset: n, ...o }, a) => /* @__PURE__ */ e(
974
- H.Item,
975
- {
976
- ref: a,
977
- className: l(
978
- "relative flex cursor-pointer select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
979
- n && "pl-8",
980
- t
981
- ),
982
- ...o
983
- }
984
- ));
985
- Te.displayName = H.Item.displayName;
986
- const Lt = Y.forwardRef(({ className: t, children: n, checked: o = !1, ...a }, d) => /* @__PURE__ */ r(
987
- H.CheckboxItem,
988
- {
989
- ref: d,
990
- className: l(
991
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
992
- t
993
- ),
994
- checked: o,
995
- ...a,
996
- children: [
997
- /* @__PURE__ */ e("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(H.ItemIndicator, { children: /* @__PURE__ */ e(kt, { className: "h-4 w-4" }) }) }),
998
- n
999
- ]
1000
- }
1001
- ));
1002
- Lt.displayName = H.CheckboxItem.displayName;
1003
- const Wt = Y.forwardRef(({ className: t, children: n, ...o }, a) => /* @__PURE__ */ r(
1004
- H.RadioItem,
1005
- {
1006
- ref: a,
1007
- className: l(
1008
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
1009
- t
1010
- ),
1011
- ...o,
1012
- children: [
1013
- /* @__PURE__ */ e("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(H.ItemIndicator, { children: /* @__PURE__ */ e(Mt, { className: "h-2 w-2 fill-current" }) }) }),
1014
- n
1015
- ]
1016
- }
1017
- ));
1018
- Wt.displayName = H.RadioItem.displayName;
1019
- const Et = Y.forwardRef(({ className: t, inset: n, ...o }, a) => /* @__PURE__ */ e(
1020
- H.Label,
1021
- {
1022
- ref: a,
1023
- className: l("px-2 py-1.5 text-sm font-semibold", n && "pl-8", t),
1024
- ...o
1025
- }
1026
- ));
1027
- Et.displayName = H.Label.displayName;
1028
- const _t = Y.forwardRef(({ className: t, ...n }, o) => /* @__PURE__ */ e(
1029
- H.Separator,
1030
- {
1031
- ref: o,
1032
- className: l("-mx-1 my-1 h-px bg-muted", t),
1033
- ...n
1034
- }
1035
- ));
1036
- _t.displayName = H.Separator.displayName;
1037
- const $t = et(
1038
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1039
- {
1040
- variants: {
1041
- variant: {
1042
- default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
1043
- secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
1044
- destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
1045
- outline: "text-foreground"
1046
- }
1047
- },
1048
- defaultVariants: { variant: "default" }
1049
- }
1050
- );
1051
- function It({ className: t, variant: n, ...o }) {
1052
- return /* @__PURE__ */ e("div", { className: l($t({ variant: n }), t), ...o });
1053
- }
1054
- function At({ className: t }) {
1055
- return /* @__PURE__ */ e(
1056
- "svg",
1057
- {
1058
- className: t,
1059
- xmlns: "http://www.w3.org/2000/svg",
1060
- width: "24",
1061
- height: "24",
1062
- viewBox: "0 0 24 24",
1063
- fill: "none",
1064
- stroke: "currentColor",
1065
- strokeWidth: "2",
1066
- strokeLinecap: "round",
1067
- strokeLinejoin: "round",
1068
- children: /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" })
1069
- }
1070
- );
1071
- }
1072
- function Pt({ className: t }) {
1073
- return /* @__PURE__ */ e(
1074
- "svg",
1075
- {
1076
- className: t,
1077
- xmlns: "http://www.w3.org/2000/svg",
1078
- width: "24",
1079
- height: "24",
1080
- viewBox: "0 0 24 24",
1081
- fill: "none",
1082
- stroke: "currentColor",
1083
- strokeWidth: "2",
1084
- strokeLinecap: "round",
1085
- strokeLinejoin: "round",
1086
- children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
1087
- }
1088
- );
1089
- }
1090
- const jt = [
1091
- "January",
1092
- "February",
1093
- "March",
1094
- "April",
1095
- "May",
1096
- "June",
1097
- "July",
1098
- "August",
1099
- "September",
1100
- "October",
1101
- "November",
1102
- "December"
1103
- ];
1104
- function Bt({
1105
- date: t,
1106
- view: n,
1107
- events: o = [],
1108
- onNavigatePrev: a,
1109
- onNavigateNext: d,
1110
- weekStartsOn: g = 1,
1111
- showEventCount: c = !0,
1112
- className: b
1113
- }) {
1114
- const z = jt[t.getMonth()], p = t.getFullYear(), y = c ? lt(o, t, n, g) : 0, L = dt(t, n);
1115
- return /* @__PURE__ */ r("div", { className: l("min-w-0 flex-1", b), children: [
1116
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 sm:gap-2 flex-wrap", children: [
1117
- /* @__PURE__ */ r("span", { className: "text-base sm:text-lg font-semibold truncate", children: [
1118
- z,
1119
- " ",
1120
- p
1121
- ] }),
1122
- c && /* @__PURE__ */ e(It, { variant: "outline", className: "px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0", children: y })
1123
- ] }),
1124
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 sm:gap-2", children: [
1125
- /* @__PURE__ */ e(
1126
- ce,
1127
- {
1128
- variant: "outline",
1129
- size: "icon",
1130
- className: "size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",
1131
- onClick: a,
1132
- children: /* @__PURE__ */ e(At, {})
1133
- }
1134
- ),
1135
- /* @__PURE__ */ e("p", { className: "text-xs sm:text-sm text-muted-foreground truncate", children: L }),
1136
- /* @__PURE__ */ e(
1137
- ce,
1138
- {
1139
- variant: "outline",
1140
- size: "icon",
1141
- className: "size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",
1142
- onClick: d,
1143
- children: /* @__PURE__ */ e(Pt, {})
1144
- }
1145
- )
1146
- ] })
1147
- ] });
1148
- }
1149
- const Rt = [
1150
- "JAN",
1151
- "FEB",
1152
- "MAR",
1153
- "APR",
1154
- "MAY",
1155
- "JUN",
1156
- "JUL",
1157
- "AUG",
1158
- "SEP",
1159
- "OCT",
1160
- "NOV",
1161
- "DEC"
1162
- ];
1163
- function Ht({ onClick: t, className: n }) {
1164
- const o = /* @__PURE__ */ new Date();
1165
- return /* @__PURE__ */ r(
1166
- "button",
1167
- {
1168
- type: "button",
1169
- className: l(
1170
- "flex size-11 sm:size-14 flex-col items-start overflow-hidden rounded-lg border shrink-0",
1171
- "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1172
- "hover:bg-accent/50 transition-colors",
1173
- n
1174
- ),
1175
- onClick: t,
1176
- children: [
1177
- /* @__PURE__ */ e("p", { className: "flex h-4 sm:h-6 w-full items-center justify-center bg-primary text-center text-[10px] sm:text-xs font-semibold text-primary-foreground", children: Rt[o.getMonth()] }),
1178
- /* @__PURE__ */ e("p", { className: "flex w-full flex-1 items-center justify-center text-sm sm:text-lg font-bold", children: o.getDate() })
1179
- ]
1180
- }
1181
- );
1182
- }
1183
- function Ot({ className: t }) {
1184
- return /* @__PURE__ */ r(
1185
- "svg",
1186
- {
1187
- className: t,
1188
- xmlns: "http://www.w3.org/2000/svg",
1189
- width: "24",
1190
- height: "24",
1191
- viewBox: "0 0 24 24",
1192
- fill: "none",
1193
- stroke: "currentColor",
1194
- strokeWidth: "2",
1195
- strokeLinecap: "round",
1196
- strokeLinejoin: "round",
1197
- children: [
1198
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
1199
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
1200
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }),
1201
- /* @__PURE__ */ e("path", { d: "M3 10h18" }),
1202
- /* @__PURE__ */ e("path", { d: "M8 14h.01" }),
1203
- /* @__PURE__ */ e("path", { d: "M12 14h.01" }),
1204
- /* @__PURE__ */ e("path", { d: "M16 14h.01" }),
1205
- /* @__PURE__ */ e("path", { d: "M8 18h.01" }),
1206
- /* @__PURE__ */ e("path", { d: "M12 18h.01" }),
1207
- /* @__PURE__ */ e("path", { d: "M16 18h.01" })
1208
- ]
1209
- }
1210
- );
1211
- }
1212
- function ye({ className: t }) {
1213
- return /* @__PURE__ */ r(
1214
- "svg",
1215
- {
1216
- className: t,
1217
- xmlns: "http://www.w3.org/2000/svg",
1218
- width: "24",
1219
- height: "24",
1220
- viewBox: "0 0 24 24",
1221
- fill: "none",
1222
- stroke: "currentColor",
1223
- strokeWidth: "2",
1224
- strokeLinecap: "round",
1225
- strokeLinejoin: "round",
1226
- children: [
1227
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
1228
- /* @__PURE__ */ e("path", { d: "M9 8h7" }),
1229
- /* @__PURE__ */ e("path", { d: "M8 12h6" }),
1230
- /* @__PURE__ */ e("path", { d: "M11 16h5" })
1231
- ]
1232
- }
1233
- );
1234
- }
1235
- function Fe({ className: t }) {
1236
- return /* @__PURE__ */ e(
1237
- "svg",
1238
- {
1239
- className: t,
1240
- xmlns: "http://www.w3.org/2000/svg",
1241
- width: "24",
1242
- height: "24",
1243
- viewBox: "0 0 24 24",
1244
- fill: "none",
1245
- stroke: "currentColor",
1246
- strokeWidth: "2",
1247
- strokeLinecap: "round",
1248
- strokeLinejoin: "round",
1249
- children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" })
1250
- }
1251
- );
1252
- }
1253
- function Ft({ className: t }) {
1254
- return /* @__PURE__ */ r(
1255
- "svg",
1256
- {
1257
- className: t,
1258
- xmlns: "http://www.w3.org/2000/svg",
1259
- width: "24",
1260
- height: "24",
1261
- viewBox: "0 0 24 24",
1262
- fill: "none",
1263
- stroke: "currentColor",
1264
- strokeWidth: "2",
1265
- strokeLinecap: "round",
1266
- strokeLinejoin: "round",
1267
- children: [
1268
- /* @__PURE__ */ e("path", { d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" }),
1269
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" })
1270
- ]
1271
- }
1272
- );
1273
- }
1274
- function Ve({ className: t }) {
1275
- return /* @__PURE__ */ r(
1276
- "svg",
1277
- {
1278
- className: t,
1279
- xmlns: "http://www.w3.org/2000/svg",
1280
- width: "24",
1281
- height: "24",
1282
- viewBox: "0 0 24 24",
1283
- fill: "none",
1284
- stroke: "currentColor",
1285
- strokeWidth: "2",
1286
- strokeLinecap: "round",
1287
- strokeLinejoin: "round",
1288
- children: [
1289
- /* @__PURE__ */ e("path", { d: "M5 12h14" }),
1290
- /* @__PURE__ */ e("path", { d: "M12 5v14" })
1291
- ]
1292
- }
1293
- );
1294
- }
1295
- function Vt({ className: t }) {
1296
- return /* @__PURE__ */ r(
1297
- "svg",
1298
- {
1299
- className: t,
1300
- xmlns: "http://www.w3.org/2000/svg",
1301
- width: "24",
1302
- height: "24",
1303
- viewBox: "0 0 24 24",
1304
- fill: "none",
1305
- stroke: "currentColor",
1306
- strokeWidth: "2",
1307
- strokeLinecap: "round",
1308
- strokeLinejoin: "round",
1309
- children: [
1310
- /* @__PURE__ */ e("rect", { width: "7", height: "7", x: "3", y: "3", rx: "1" }),
1311
- /* @__PURE__ */ e("rect", { width: "7", height: "7", x: "3", y: "14", rx: "1" }),
1312
- /* @__PURE__ */ e("path", { d: "M14 4h7" }),
1313
- /* @__PURE__ */ e("path", { d: "M14 9h7" }),
1314
- /* @__PURE__ */ e("path", { d: "M14 15h7" }),
1315
- /* @__PURE__ */ e("path", { d: "M14 20h7" })
1316
- ]
1317
- }
1318
- );
1319
- }
1320
- function Gt({ className: t }) {
1321
- return /* @__PURE__ */ r(
1322
- "svg",
1323
- {
1324
- className: t,
1325
- xmlns: "http://www.w3.org/2000/svg",
1326
- width: "24",
1327
- height: "24",
1328
- viewBox: "0 0 24 24",
1329
- fill: "none",
1330
- stroke: "currentColor",
1331
- strokeWidth: "2",
1332
- strokeLinecap: "round",
1333
- strokeLinejoin: "round",
1334
- children: [
1335
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
1336
- /* @__PURE__ */ e("path", { d: "M12 3v18" })
1337
- ]
1338
- }
1339
- );
1340
- }
1341
- function Ut({ className: t }) {
1342
- return /* @__PURE__ */ r(
1343
- "svg",
1344
- {
1345
- className: t,
1346
- xmlns: "http://www.w3.org/2000/svg",
1347
- width: "24",
1348
- height: "24",
1349
- viewBox: "0 0 24 24",
1350
- fill: "none",
1351
- stroke: "currentColor",
1352
- strokeWidth: "2",
1353
- strokeLinecap: "round",
1354
- strokeLinejoin: "round",
1355
- children: [
1356
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
1357
- /* @__PURE__ */ e("path", { d: "M3 12h18" }),
1358
- /* @__PURE__ */ e("path", { d: "M12 3v18" })
1359
- ]
1360
- }
1361
- );
1362
- }
1363
- function qt({ className: t }) {
1364
- return /* @__PURE__ */ r(
1365
- "svg",
1366
- {
1367
- className: t,
1368
- xmlns: "http://www.w3.org/2000/svg",
1369
- width: "24",
1370
- height: "24",
1371
- viewBox: "0 0 24 24",
1372
- fill: "none",
1373
- stroke: "currentColor",
1374
- strokeWidth: "2",
1375
- strokeLinecap: "round",
1376
- strokeLinejoin: "round",
1377
- children: [
1378
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
1379
- /* @__PURE__ */ e("path", { d: "M3 9h18" }),
1380
- /* @__PURE__ */ e("path", { d: "M3 15h18" }),
1381
- /* @__PURE__ */ e("path", { d: "M9 3v18" }),
1382
- /* @__PURE__ */ e("path", { d: "M15 3v18" })
1383
- ]
1384
- }
1385
- );
1386
- }
1387
- const Kt = [
1388
- { value: "day", label: "Day", icon: Vt },
1389
- { value: "week", label: "Week", icon: Gt },
1390
- { value: "month", label: "Month", icon: Ut },
1391
- { value: "year", label: "Year", icon: qt }
1392
- // { value: 'agenda', label: 'Agenda', icon: ListIcon }, NOTE: Not needed currently
1393
- ], Ge = [
1394
- { value: "timeline-day", label: "1 Day", icon: ye },
1395
- { value: "timeline-3day", label: "3 Days", icon: ye },
1396
- { value: "timeline-week", label: "7 Days", icon: ye }
1397
- ];
1398
- function dn({
1399
- currentDate: t,
1400
- view: n,
1401
- events: o = [],
1402
- onNavigateToday: a,
1403
- onNavigatePrev: d,
1404
- onNavigateNext: g,
1405
- onNavigate: c,
1406
- onViewChange: b,
1407
- onAddEvent: z,
1408
- availableViews: p = ["day", "week", "month", "agenda"],
1409
- showTimelineViews: y = !1,
1410
- timelineViews: L,
1411
- settingsContent: i,
1412
- showSettings: v = !1,
1413
- filterContent: h,
1414
- actions: w,
1415
- className: _,
1416
- weekStartsOn: W = 1,
1417
- labels: D = {}
1418
- }) {
1419
- const x = V(
1420
- () => ({
1421
- today: "Today",
1422
- addEvent: "Add Event",
1423
- calendarView: "Calendar View",
1424
- resourceView: "Resource View",
1425
- ...D
1426
- }),
1427
- [D]
1428
- ), O = () => {
1429
- a?.(), c?.("today");
1430
- }, j = () => {
1431
- d?.(), c?.("prev");
1432
- }, B = () => {
1433
- g?.(), c?.("next");
1434
- }, $ = ["day", "week", "month", "year", "agenda"].includes(
1435
- n
1436
- ), F = n.startsWith("timeline-") || n.startsWith("resource-"), u = Kt.filter(
1437
- (m) => p.includes(m.value)
1438
- ), k = $ ? u.find((m) => m.value === n) : null, A = F ? Ge.find((m) => m.value === n) : null;
1439
- return /* @__PURE__ */ r("div", { className: l("flex flex-col w-full gap-3 mb-2", _), children: [
1440
- /* @__PURE__ */ r("div", { className: "flex lg:flex-row flex-col w-full justify-between gap-3", children: [
1441
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2", children: [
1442
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2 sm:gap-3 min-w-0", children: [
1443
- /* @__PURE__ */ e(Ht, { onClick: O }),
1444
- /* @__PURE__ */ e(
1445
- Bt,
1446
- {
1447
- date: t,
1448
- view: n,
1449
- events: o,
1450
- onNavigatePrev: j,
1451
- onNavigateNext: B,
1452
- weekStartsOn: W
1453
- }
1454
- )
1455
- ] }),
1456
- z && /* @__PURE__ */ e(
1457
- ce,
1458
- {
1459
- size: "icon",
1460
- className: "shrink-0 lg:hidden",
1461
- onClick: z,
1462
- children: /* @__PURE__ */ e(Ve, { className: "size-4" })
1463
- }
1464
- )
1465
- ] }),
1466
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 sm:gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-none", children: [
1467
- b && u.length > 0 && /* @__PURE__ */ r(He, { children: [
1468
- /* @__PURE__ */ r(
1469
- Oe,
1470
- {
1471
- className: l(
1472
- "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors",
1473
- "h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",
1474
- $ ? "bg-primary text-primary-foreground hover:bg-primary/90" : "border border-input bg-background hover:bg-accent hover:text-accent-foreground"
1475
- ),
1476
- children: [
1477
- /* @__PURE__ */ e(Ot, { className: "size-4" }),
1478
- /* @__PURE__ */ e("span", { className: "text-xs sm:text-sm font-medium", children: k?.label ?? x.calendarView }),
1479
- /* @__PURE__ */ e(Fe, { className: "size-3 opacity-60" })
1480
- ]
1481
- }
1482
- ),
1483
- /* @__PURE__ */ e(Me, { align: "start", className: "min-w-[120px]", children: u.map((m) => {
1484
- const E = m.icon;
1485
- return /* @__PURE__ */ r(
1486
- Te,
1487
- {
1488
- onClick: () => b(m.value),
1489
- className: l(
1490
- "gap-2",
1491
- n === m.value && "bg-accent"
1492
- ),
1493
- children: [
1494
- /* @__PURE__ */ e(E, { className: "size-4" }),
1495
- /* @__PURE__ */ e("span", { children: m.label })
1496
- ]
1497
- },
1498
- m.value
1499
- );
1500
- }) })
1501
- ] }),
1502
- y && b && /* @__PURE__ */ r(He, { children: [
1503
- /* @__PURE__ */ r(
1504
- Oe,
1505
- {
1506
- className: l(
1507
- "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors",
1508
- "h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",
1509
- F ? "bg-primary text-primary-foreground hover:bg-primary/90" : "border border-input bg-white hover:bg-zinc-50 hover:text-accent-foreground"
1510
- ),
1511
- children: [
1512
- /* @__PURE__ */ e(ye, { className: "size-4" }),
1513
- /* @__PURE__ */ e("span", { className: "text-xs sm:text-sm font-medium", children: A?.label ?? x.resourceView }),
1514
- /* @__PURE__ */ e(Fe, { className: "size-3 opacity-60" })
1515
- ]
1516
- }
1517
- ),
1518
- /* @__PURE__ */ e(Me, { align: "start", className: "min-w-[120px]", children: Ge.map((m) => {
1519
- const E = m.icon;
1520
- return /* @__PURE__ */ r(
1521
- Te,
1522
- {
1523
- onClick: () => b(m.value),
1524
- className: l(
1525
- "gap-2",
1526
- n === m.value && "bg-accent"
1527
- ),
1528
- children: [
1529
- /* @__PURE__ */ e(E, { className: "size-4" }),
1530
- /* @__PURE__ */ e("span", { children: m.label })
1531
- ]
1532
- },
1533
- m.value
1534
- );
1535
- }) })
1536
- ] }),
1537
- v && i && /* @__PURE__ */ r(ne, { children: [
1538
- /* @__PURE__ */ e(re, { asChild: !0, children: /* @__PURE__ */ e(
1539
- ce,
1540
- {
1541
- variant: "outline",
1542
- size: "icon",
1543
- className: "min-w-10 min-h-10 shrink-0 mx-0",
1544
- children: /* @__PURE__ */ e(Ft, { className: "size-4 sm:size-5" })
1545
- }
1546
- ) }),
1547
- /* @__PURE__ */ e(
1548
- Q,
1549
- {
1550
- className: "w-auto min-w-80 p-0",
1551
- align: "end",
1552
- sideOffset: 8,
1553
- children: /* @__PURE__ */ e("div", { className: "max-h-[70vh] overflow-y-auto p-4 space-y-6", children: i })
1554
- }
1555
- )
1556
- ] }),
1557
- w,
1558
- z && /* @__PURE__ */ r(
1559
- ce,
1560
- {
1561
- className: "hidden lg:flex shrink-0 max-h-10",
1562
- onClick: z,
1563
- children: [
1564
- /* @__PURE__ */ e(Ve, { className: "size-4" }),
1565
- x.addEvent
1566
- ]
1567
- }
1568
- )
1569
- ] })
1570
- ] }),
1571
- h && /* @__PURE__ */ e("div", { className: "flex items-center gap-2 pb-1 -mb-1 scrollbar-none", children: h })
1572
- ] });
1573
- }
1574
- function cn({
1575
- events: t,
1576
- date: n,
1577
- daysAhead: o = 60,
1578
- badgeVariant: a = "colored",
1579
- onEventClick: d,
1580
- className: g,
1581
- renderEvent: c,
1582
- renderPopover: b,
1583
- slots: z,
1584
- classNames: p
1585
- }) {
1586
- const y = V(() => {
1587
- const i = new Date(n);
1588
- i.setHours(0, 0, 0, 0);
1589
- const v = new Date(i);
1590
- return v.setDate(v.getDate() + o), t.filter((h) => h.endDate >= i && h.startDate <= v);
1591
- }, [t, o, n]), L = V(() => {
1592
- const i = ct(y), v = [];
1593
- for (const [h, w] of i)
1594
- v.push({
1595
- date: new Date(h),
1596
- dateKey: h,
1597
- events: w
1598
- });
1599
- return v.sort((h, w) => h.date.getTime() - w.date.getTime()), v;
1600
- }, [y]);
1601
- return L.length === 0 ? /* @__PURE__ */ e("div", { className: l("flex flex-col items-center justify-center h-full py-12", g), children: /* @__PURE__ */ r("div", { className: "text-center", children: [
1602
- /* @__PURE__ */ e("p", { className: "text-muted-foreground", children: "No events found" }),
1603
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground/70", children: "No events scheduled for this period" })
1604
- ] }) }) : /* @__PURE__ */ r("div", { className: l("flex flex-col h-full overflow-auto", p?.agendaList, g), children: [
1605
- /* @__PURE__ */ e("div", { className: "sticky top-0 z-10 bg-background border-b px-4 py-3", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
1606
- /* @__PURE__ */ e("h2", { className: "text-lg font-medium", children: "Schedule" }),
1607
- /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground", children: [
1608
- y.length,
1609
- " event",
1610
- y.length !== 1 ? "s" : ""
1611
- ] })
1612
- ] }) }),
1613
- /* @__PURE__ */ e("div", { className: "flex-1", children: L.map(({ date: i, dateKey: v, events: h }) => {
1614
- const w = te(i), _ = i.toLocaleDateString([], { weekday: "short" }), W = i.getDate(), D = i.toLocaleDateString([], { month: "short" });
1615
- return /* @__PURE__ */ r("div", { className: l("", p?.agendaDayGroup), children: [
1616
- /* @__PURE__ */ e(
1617
- "div",
1618
- {
1619
- className: l(
1620
- "sticky top-[52px] z-10 bg-background px-4 py-3 border-b",
1621
- p?.agendaDayHeader
1622
- ),
1623
- children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
1624
- /* @__PURE__ */ r("div", { className: "flex flex-col items-center min-w-[40px]", children: [
1625
- /* @__PURE__ */ e(
1626
- "span",
1627
- {
1628
- className: l(
1629
- "text-[11px] font-medium uppercase tracking-wide",
1630
- w ? "text-primary" : "text-muted-foreground"
1631
- ),
1632
- children: _
1633
- }
1634
- ),
1635
- /* @__PURE__ */ e(
1636
- "span",
1637
- {
1638
- className: l(
1639
- "flex items-center justify-center rounded-full mt-0.5",
1640
- "size-10 text-xl font-normal",
1641
- w ? "bg-primary text-primary-foreground" : "text-foreground"
1642
- ),
1643
- children: W
1644
- }
1645
- )
1646
- ] }),
1647
- /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground", children: [
1648
- D,
1649
- " ",
1650
- i.getFullYear()
1651
- ] })
1652
- ] })
1653
- }
1654
- ),
1655
- /* @__PURE__ */ e("div", { className: "px-4 py-3 space-y-2 border-b last:border-b-0", children: h.map(
1656
- (x) => c ? /* @__PURE__ */ e("div", { children: c({ event: x, variant: "full" }) }, x.id) : /* @__PURE__ */ e(
1657
- Ce,
1658
- {
1659
- event: x,
1660
- variant: "full",
1661
- badgeVariant: a,
1662
- onClick: d,
1663
- disablePopover: !!d && !b,
1664
- renderPopover: b,
1665
- showTime: !0,
1666
- showDescription: !0,
1667
- showParticipants: !0,
1668
- ...p?.eventCard && { className: p.eventCard }
1669
- },
1670
- x.id
1671
- )
1672
- ) })
1673
- ] }, v);
1674
- }) })
1675
- ] });
1676
- }
1677
- function nt({
1678
- events: t,
1679
- date: n,
1680
- onEventClick: o,
1681
- className: a
1682
- }) {
1683
- return t.length === 0 ? null : /* @__PURE__ */ r("div", { className: l("border-b bg-muted/20 px-2 py-1.5 space-y-1", "sm:px-4 sm:py-2", a), children: [
1684
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-muted-foreground sm:text-xs", children: "All day / Multi-day" }),
1685
- /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: t.map((d) => {
1686
- const g = fe(d.color), c = Pe(d.startDate, n), b = Pe(d.endDate, n);
1687
- return /* @__PURE__ */ r(
1688
- "button",
1689
- {
1690
- type: "button",
1691
- onClick: () => o?.(d),
1692
- className: l(
1693
- "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium transition-opacity hover:opacity-80",
1694
- "sm:px-2 sm:py-1 sm:text-xs",
1695
- g.bg,
1696
- g.text,
1697
- d.isCanceled && "opacity-60 line-through"
1698
- ),
1699
- children: [
1700
- c && "→ ",
1701
- /* @__PURE__ */ e("span", { className: "truncate max-w-24 sm:max-w-32", children: d.title }),
1702
- b && " →"
1703
- ]
1704
- },
1705
- d.id
1706
- );
1707
- }) })
1708
- ] });
1709
- }
1710
- const Yt = 5;
1711
- function rt({
1712
- slot: t,
1713
- onSelectionStart: n,
1714
- onSelectionMove: o,
1715
- onSelectionEnd: a,
1716
- isSelected: d = !1,
1717
- isSelecting: g = !1,
1718
- disabled: c = !1,
1719
- ariaLabel: b,
1720
- children: z,
1721
- className: p,
1722
- height: y,
1723
- style: L,
1724
- dataAttributes: i
1725
- }) {
1726
- const v = se(null), h = se(!1), w = se(!1), _ = se(null), [W, D] = oe(!1), x = We(), O = M(
1727
- (m) => {
1728
- c || m.button !== 0 && m.pointerType === "mouse" || (m.preventDefault(), v.current = { x: m.clientX, y: m.clientY }, h.current = !1, w.current = !0, n?.(t));
1729
- },
1730
- [c, t, n]
1731
- ), j = M(
1732
- (m) => {
1733
- if (!(v.current && w.current && !c)) return;
1734
- const E = m.clientX - v.current.x, I = m.clientY - v.current.y;
1735
- Math.sqrt(E * E + I * I) >= Yt && (h.current = !0);
1736
- },
1737
- [c]
1738
- ), B = M(
1739
- (m) => {
1740
- c || (m.buttons > 0 || g) && o?.(t);
1741
- },
1742
- [c, g, t, o]
1743
- ), $ = M(() => {
1744
- c || (a?.(), v.current = null, h.current = !1, w.current = !1);
1745
- }, [c, a]), F = M(
1746
- (m) => {
1747
- if (!x?.isDragging || c) return;
1748
- m.preventDefault(), m.dataTransfer.dropEffect = "move", D(!0);
1749
- const E = /* @__PURE__ */ new Date(), I = t.hour ?? E.getHours(), N = t.minute ?? (E.getMinutes() >= 30 ? 30 : 0);
1750
- x.updateDragPreview?.(t.date, I, N);
1751
- },
1752
- [x, c, t]
1753
- ), u = M(() => {
1754
- D(!1);
1755
- }, []), k = M(
1756
- (m) => {
1757
- m.preventDefault(), D(!1), !(!x?.isDragging || c) && x.endDrag?.();
1758
- },
1759
- [x, c]
1760
- );
1761
- it(() => {
1762
- const m = () => {
1763
- w.current && (w.current = !1, v.current = null, h.current = !1);
1764
- };
1765
- return window.addEventListener("pointerup", m), window.addEventListener("pointercancel", m), () => {
1766
- window.removeEventListener("pointerup", m), window.removeEventListener("pointercancel", m);
1767
- };
1768
- }, []);
1769
- const A = M(
1770
- (m) => {
1771
- c || (m.key === "Enter" || m.key === " ") && (m.preventDefault(), n?.(t), a?.());
1772
- },
1773
- [c, t, n, a]
1774
- );
1775
- return /* @__PURE__ */ e(
1776
- "button",
1777
- {
1778
- ref: _,
1779
- type: "button",
1780
- "aria-label": b,
1781
- "aria-disabled": c,
1782
- "aria-pressed": d,
1783
- disabled: c,
1784
- onPointerDown: O,
1785
- onPointerMove: j,
1786
- onPointerUp: $,
1787
- onPointerEnter: B,
1788
- onKeyDown: A,
1789
- onDragOver: F,
1790
- onDragLeave: u,
1791
- onDrop: k,
1792
- className: l(
1793
- "select-none touch-none cursor-pointer transition-colors",
1794
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
1795
- // Hover state (only when not in selection)
1796
- !(g || c) && "hover:bg-blue-50/60",
1797
- // Selection state — blue tint matching the primary color
1798
- d && "bg-blue-100/70",
1799
- // Drag over state - visual feedback when event is dragged over
1800
- W && "bg-primary/20 ring-2 ring-primary ring-inset",
1801
- // Disabled state
1802
- c && "cursor-not-allowed opacity-50",
1803
- p
1804
- ),
1805
- style: { height: y, ...L },
1806
- ...i,
1807
- children: z
1808
- }
1809
- );
1810
- }
1811
- function ot({
1812
- slot: t,
1813
- date: n,
1814
- hour: o,
1815
- minute: a,
1816
- ariaLabel: d,
1817
- ...g
1818
- }) {
1819
- const c = t ?? { date: n, hour: o ?? 0, minute: a ?? 0 }, b = d ?? `Add event at ${(c.hour ?? 0).toString().padStart(2, "0")}:${(c.minute ?? 0).toString().padStart(2, "0")} on ${c.date.toLocaleDateString()}`;
1820
- return /* @__PURE__ */ e(rt, { slot: c, ariaLabel: b, ...g });
1821
- }
1822
- function Xt({ slot: t, date: n, ariaLabel: o, ...a }) {
1823
- const d = t ?? { date: n }, g = o ?? `Select ${d.date.toLocaleDateString()}`;
1824
- return /* @__PURE__ */ e(rt, { slot: d, ariaLabel: g, ...a });
1825
- }
1826
- const me = 96, Ne = 72, ke = 80;
1827
- function un({
1828
- events: t,
1829
- date: n,
1830
- visibleHours: o = { startHour: 0, endHour: 24 },
1831
- workingHours: a,
1832
- slotDuration: d = 30,
1833
- badgeVariant: g = "colored",
1834
- onEventClick: c,
1835
- onSlotSelect: b,
1836
- className: z,
1837
- renderEvent: p,
1838
- renderPopover: y,
1839
- slots: L,
1840
- classNames: i
1841
- }) {
1842
- const v = 60 / d, h = 100 / v, w = V(() => {
1843
- const C = [];
1844
- for (let s = 0; s < v; s++)
1845
- C.push(s * d);
1846
- return C;
1847
- }, [v, d]), _ = V(() => Le(t, n), [t, n]), { singleDay: W, multiDay: D } = V(() => Ke(_), [_]), x = V(() => {
1848
- const C = Ye(W, n, o, me), s = /* @__PURE__ */ new Map();
1849
- for (const f of C)
1850
- s.set(f.event.id, f.position);
1851
- return s;
1852
- }, [W, n, o]), O = V(() => Xe(o), [o]), j = /* @__PURE__ */ new Date(), B = te(n), $ = V(() => {
1853
- if (!B) return 0;
1854
- const C = j.getHours() + j.getMinutes() / 60;
1855
- return C < o.startHour || C > o.endHour ? -1 : (C - o.startHour) * me;
1856
- }, [B, o, j]), F = se(null);
1857
- qe(() => {
1858
- const C = F.current;
1859
- if (!C) return;
1860
- const s = () => {
1861
- let f;
1862
- if (B) {
1863
- const P = (/* @__PURE__ */ new Date()).getHours();
1864
- f = Math.max(P - 1, o.startHour);
1865
- } else {
1866
- const P = n.getDay(), T = a?.[P];
1867
- T?.enabled && T.from > 0 ? f = Math.max(T.from - 1, o.startHour) : f = Math.max(7, o.startHour);
1868
- }
1869
- const S = (f - o.startHour) * me;
1870
- C.scrollTo({
1871
- top: S,
1872
- behavior: "instant"
1873
- });
1874
- };
1875
- requestAnimationFrame(() => {
1876
- requestAnimationFrame(s);
1877
- });
1878
- }, [n, a, o, B]);
1879
- const u = Ee(), k = M(
1880
- (C) => {
1881
- u?.startSelection(C);
1882
- },
1883
- [u]
1884
- ), A = M(
1885
- (C) => {
1886
- u?.updateSelection(C);
1887
- },
1888
- [u]
1889
- ), m = M(() => {
1890
- u?.endSelection();
1891
- }, [u]), E = M(
1892
- (C) => {
1893
- c?.(C);
1894
- },
1895
- [c]
1896
- ), I = n.toLocaleDateString([], { weekday: "short" }), N = n.getDate(), G = te(n);
1897
- return /* @__PURE__ */ r("div", { className: l("flex flex-col h-full", z), children: [
1898
- /* @__PURE__ */ e(
1899
- "div",
1900
- {
1901
- className: l(
1902
- "flex items-center gap-3 border-b px-4 py-3",
1903
- i?.columnHeader,
1904
- G && i?.columnHeaderToday
1905
- ),
1906
- children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center", children: [
1907
- /* @__PURE__ */ e(
1908
- "span",
1909
- {
1910
- className: l(
1911
- "text-[11px] font-medium uppercase tracking-wide",
1912
- G ? "text-primary" : "text-muted-foreground"
1913
- ),
1914
- children: I
1915
- }
1916
- ),
1917
- /* @__PURE__ */ e(
1918
- "span",
1919
- {
1920
- className: l(
1921
- "flex items-center justify-center rounded-full mt-0.5",
1922
- "size-12 text-3xl font-normal",
1923
- G ? "bg-primary text-primary-foreground" : "text-foreground"
1924
- ),
1925
- children: N
1926
- }
1927
- )
1928
- ] })
1929
- }
1930
- ),
1931
- D.length > 0 && /* @__PURE__ */ e(
1932
- nt,
1933
- {
1934
- events: D,
1935
- date: n,
1936
- onEventClick: E,
1937
- ...i?.multiDayBanner && { className: i.multiDayBanner }
1938
- }
1939
- ),
1940
- /* @__PURE__ */ e(
1941
- "div",
1942
- {
1943
- ref: F,
1944
- className: l("flex-1 overflow-auto", i?.scrollContainer),
1945
- children: /* @__PURE__ */ r("div", { className: "relative min-h-full", children: [
1946
- O.map((C, s) => {
1947
- const S = !Je(n, C, a);
1948
- return /* @__PURE__ */ r(
1949
- "div",
1950
- {
1951
- className: l(
1952
- "relative flex",
1953
- S && "bg-calendar-disabled-hour",
1954
- i?.timeSlot,
1955
- S ? i?.timeSlotNonWorking : i?.timeSlotWorking
1956
- ),
1957
- style: { height: me },
1958
- children: [
1959
- /* @__PURE__ */ e(
1960
- "div",
1961
- {
1962
- className: l(
1963
- "relative flex-shrink-0 border-r border-border/50 bg-zinc-50 dark:bg-zinc-900",
1964
- i?.timeGutter
1965
- ),
1966
- style: { width: Ne },
1967
- children: /* @__PURE__ */ e("div", { className: "absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center", children: s !== 0 && /* @__PURE__ */ e(
1968
- "span",
1969
- {
1970
- className: l(
1971
- "text-[10px] sm:text-xs text-muted-foreground",
1972
- i?.timeGutterLabel
1973
- ),
1974
- children: we(C)
1975
- }
1976
- ) })
1977
- }
1978
- ),
1979
- /* @__PURE__ */ r("div", { className: "relative flex-1", children: [
1980
- B && !S && /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-primary/5" }),
1981
- s !== 0 && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-x-0 top-0 border-b border-border/50" }),
1982
- w.slice(1).map((P) => /* @__PURE__ */ e(
1983
- "div",
1984
- {
1985
- className: "pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",
1986
- style: { top: `${P / 60 * 100}%` }
1987
- },
1988
- P
1989
- )),
1990
- w.map((P, T) => {
1991
- const q = { date: n, hour: C, minute: P };
1992
- return /* @__PURE__ */ e(
1993
- ot,
1994
- {
1995
- slot: q,
1996
- onSelectionStart: k,
1997
- onSelectionMove: A,
1998
- onSelectionEnd: m,
1999
- isSelected: u?.isSlotSelected(q) ?? !1,
2000
- isSelecting: u?.isSelecting ?? !1,
2001
- disabled: S,
2002
- className: "absolute inset-x-0",
2003
- style: {
2004
- top: `${T * h}%`,
2005
- height: `${h}%`
2006
- },
2007
- ariaLabel: `Add event at ${we(C)}:${String(P).padStart(2, "0")}`
2008
- },
2009
- P
2010
- );
2011
- })
2012
- ] })
2013
- ]
2014
- },
2015
- C
2016
- );
2017
- }),
2018
- /* @__PURE__ */ e(
2019
- "div",
2020
- {
2021
- className: "absolute top-0 bottom-0 right-0 pointer-events-none",
2022
- style: { left: Ne },
2023
- children: W.map((C) => {
2024
- const s = x.get(C.id);
2025
- if (!s) return null;
2026
- const f = `calc(${s.width}% - 2px)`, S = `max(${ke}px, ${f})`;
2027
- return p ? /* @__PURE__ */ e(
2028
- "div",
2029
- {
2030
- className: "absolute pointer-events-auto p-0.5",
2031
- style: {
2032
- top: `${s.top}px`,
2033
- left: `${s.left}%`,
2034
- width: S,
2035
- minWidth: `${ke}px`
2036
- },
2037
- children: p({ event: C, position: s })
2038
- },
2039
- C.id
2040
- ) : /* @__PURE__ */ e(
2041
- Qe,
2042
- {
2043
- event: C,
2044
- position: {
2045
- top: s.top,
2046
- left: s.left,
2047
- width: s.width,
2048
- minWidth: ke
2049
- },
2050
- hourHeight: me,
2051
- badgeVariant: g,
2052
- onClick: c,
2053
- disablePopover: !!c && !y,
2054
- renderPopover: y,
2055
- className: l("pointer-events-auto", i?.eventCard)
2056
- },
2057
- C.id
2058
- );
2059
- })
2060
- }
2061
- ),
2062
- B && $ >= 0 && /* @__PURE__ */ r(
2063
- "div",
2064
- {
2065
- className: l(
2066
- "absolute left-0 right-0 z-20 flex items-center pointer-events-none",
2067
- i?.currentTimeIndicator
2068
- ),
2069
- style: {
2070
- top: $,
2071
- left: Ne
2072
- },
2073
- children: [
2074
- /* @__PURE__ */ e("div", { className: "h-2.5 w-2.5 -ml-1 rounded-full bg-red-500" }),
2075
- /* @__PURE__ */ e("div", { className: "flex-1 h-0.5 bg-red-500" })
2076
- ]
2077
- }
2078
- )
2079
- ] })
2080
- }
2081
- )
2082
- ] });
2083
- }
2084
- const Jt = [
2085
- { full: "Monday", short: "Mon", tiny: "M" },
2086
- { full: "Tuesday", short: "Tue", tiny: "T" },
2087
- { full: "Wednesday", short: "Wed", tiny: "W" },
2088
- { full: "Thursday", short: "Thu", tiny: "T" },
2089
- { full: "Friday", short: "Fri", tiny: "F" },
2090
- { full: "Saturday", short: "Sat", tiny: "S" },
2091
- { full: "Sunday", short: "Sun", tiny: "S" }
2092
- ], Zt = [
2093
- { full: "Sunday", short: "Sun", tiny: "S" },
2094
- { full: "Monday", short: "Mon", tiny: "M" },
2095
- { full: "Tuesday", short: "Tue", tiny: "T" },
2096
- { full: "Wednesday", short: "Wed", tiny: "W" },
2097
- { full: "Thursday", short: "Thu", tiny: "T" },
2098
- { full: "Friday", short: "Fri", tiny: "F" },
2099
- { full: "Saturday", short: "Sat", tiny: "S" }
2100
- ], ge = 3;
2101
- function mn({
2102
- events: t,
2103
- date: n,
2104
- weekStartsOn: o = 1,
2105
- badgeVariant: a = "colored",
2106
- onEventClick: d,
2107
- onSlotSelect: g,
2108
- onDayClick: c,
2109
- className: b,
2110
- renderEvent: z,
2111
- renderPopover: p,
2112
- showMoreEventsInPopover: y = !1,
2113
- slots: L,
2114
- classNames: i
2115
- }) {
2116
- const v = L?.dayCellHeader, h = L?.dayCellFooter, [w, _] = oe(null), W = V(() => ut(n, o), [n, o]), D = V(() => {
2117
- const u = /* @__PURE__ */ new Map();
2118
- for (const k of W) {
2119
- const A = k.date.toDateString(), m = Le(t, k.date);
2120
- m.sort((E, I) => E.startDate.getTime() - I.startDate.getTime()), u.set(A, m);
2121
- }
2122
- return u;
2123
- }, [W, t]), x = Ee(), O = M(
2124
- (u) => {
2125
- x?.startSelection(u);
2126
- },
2127
- [x]
2128
- ), j = M(
2129
- (u) => {
2130
- x?.updateSelection(u);
2131
- },
2132
- [x]
2133
- ), B = M(() => {
2134
- x?.endSelection();
2135
- }, [x]), $ = M(
2136
- (u) => {
2137
- c?.(u);
2138
- },
2139
- [c]
2140
- ), F = o === 0 ? Zt : Jt;
2141
- return /* @__PURE__ */ e("div", { className: l("flex flex-col h-full overflow-hidden", b), children: /* @__PURE__ */ e("div", { className: "flex flex-col flex-1 overflow-auto", children: /* @__PURE__ */ r("div", { className: "flex flex-col flex-1 min-w-[560px] sm:min-w-0", children: [
2142
- /* @__PURE__ */ e(
2143
- "div",
2144
- {
2145
- className: l(
2146
- "grid grid-cols-7 border-b !sticky !top-0 bg-background z-10",
2147
- i?.weekdayHeader
2148
- ),
2149
- children: F.map((u, k) => /* @__PURE__ */ r(
2150
- "div",
2151
- {
2152
- className: l(
2153
- "py-2 sm:py-2.5 text-center text-[11px] uppercase font-medium tracking-wide text-muted-foreground",
2154
- k >= 5 && "text-muted-foreground/70",
2155
- // Weekend
2156
- i?.weekdayLabel
2157
- ),
2158
- children: [
2159
- /* @__PURE__ */ e("span", { className: "sm:hidden", children: u.short }),
2160
- /* @__PURE__ */ e("span", { className: "hidden sm:inline", children: u.short })
2161
- ]
2162
- },
2163
- u.full
2164
- ))
2165
- }
2166
- ),
2167
- /* @__PURE__ */ e("div", { className: l("grid grid-cols-7 auto-rows-min", i?.monthGrid), children: W.map((u) => {
2168
- const k = u.date.toDateString(), A = D.get(k) || [], m = te(u.date), E = u.date.getDay() === 0 || u.date.getDay() === 6, I = A.length > ge;
2169
- return /* @__PURE__ */ r(
2170
- Xt,
2171
- {
2172
- date: u.date,
2173
- onSelectionStart: O,
2174
- onSelectionMove: j,
2175
- onSelectionEnd: B,
2176
- isSelected: x?.isSlotSelected({ date: u.date }) ?? !1,
2177
- isSelecting: x?.isSelecting ?? !1,
2178
- className: l(
2179
- "relative flex flex-col border-r border-b text-left min-h-[80px] sm:min-h-[100px] overflow-hidden",
2180
- "[&:nth-child(7n)]:border-r-0",
2181
- !u.isCurrentMonth && "bg-muted/20",
2182
- E && u.isCurrentMonth && "bg-muted/10",
2183
- i?.dayCell,
2184
- m && i?.dayCellToday,
2185
- !u.isCurrentMonth && i?.dayCellOutside,
2186
- E && i?.dayCellWeekend
2187
- ),
2188
- ariaLabel: `${u.date.toLocaleDateString()} - ${A.length} events. Click to create event, double-click to view day.`,
2189
- children: [
2190
- /* @__PURE__ */ e(
2191
- "div",
2192
- {
2193
- className: l(
2194
- "flex items-center justify-center p-1",
2195
- !u.isCurrentMonth && "text-muted-foreground/40",
2196
- i?.dayCellNumber
2197
- ),
2198
- children: /* @__PURE__ */ e(
2199
- "button",
2200
- {
2201
- type: "button",
2202
- onClick: (N) => {
2203
- N.stopPropagation(), $(u.date);
2204
- },
2205
- className: l(
2206
- "flex items-center justify-center rounded-full transition-colors",
2207
- "size-7 text-sm font-normal",
2208
- m ? "bg-primary text-primary-foreground" : "hover:bg-muted"
2209
- ),
2210
- children: u.date.getDate()
2211
- }
2212
- )
2213
- }
2214
- ),
2215
- v && /* @__PURE__ */ e(
2216
- v,
2217
- {
2218
- date: u.date,
2219
- events: A,
2220
- isToday: m,
2221
- isCurrentMonth: u.isCurrentMonth,
2222
- isWeekend: E,
2223
- view: "month"
2224
- }
2225
- ),
2226
- /* @__PURE__ */ r(
2227
- "div",
2228
- {
2229
- className: l(
2230
- "flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1",
2231
- i?.dayCellContent
2232
- ),
2233
- children: [
2234
- A.slice(0, ge).map((N) => /* @__PURE__ */ e(
2235
- "div",
2236
- {
2237
- onPointerDown: (G) => {
2238
- G.stopPropagation();
2239
- },
2240
- children: z ? z({ event: N, variant: "compact" }) : /* @__PURE__ */ e(
2241
- Ce,
2242
- {
2243
- event: N,
2244
- variant: "compact",
2245
- badgeVariant: a,
2246
- onClick: d,
2247
- disablePopover: !!d && !p,
2248
- renderPopover: p,
2249
- showTime: !1,
2250
- enableDrag: !0,
2251
- ...i?.eventCardCompact && {
2252
- className: i.eventCardCompact
2253
- }
2254
- }
2255
- )
2256
- },
2257
- N.id
2258
- )),
2259
- I && (y ? /* @__PURE__ */ r(
2260
- ne,
2261
- {
2262
- open: w === k,
2263
- onOpenChange: (N) => _(N ? k : null),
2264
- children: [
2265
- /* @__PURE__ */ e(re, { asChild: !0, children: /* @__PURE__ */ r(
2266
- "button",
2267
- {
2268
- type: "button",
2269
- onPointerDown: (N) => N.stopPropagation(),
2270
- onClick: (N) => {
2271
- N.stopPropagation(), _(k);
2272
- },
2273
- className: l(
2274
- "w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",
2275
- i?.moreEventsIndicator
2276
- ),
2277
- children: [
2278
- "+",
2279
- A.length - ge,
2280
- " more"
2281
- ]
2282
- }
2283
- ) }),
2284
- /* @__PURE__ */ r(
2285
- Q,
2286
- {
2287
- align: "start",
2288
- side: "right",
2289
- sideOffset: 8,
2290
- className: "w-72 max-h-80 overflow-y-auto p-2",
2291
- onPointerDown: (N) => N.stopPropagation(),
2292
- children: [
2293
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between mb-2 pb-2 border-b", children: [
2294
- /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: u.date.toLocaleDateString(void 0, {
2295
- weekday: "short",
2296
- month: "short",
2297
- day: "numeric"
2298
- }) }),
2299
- /* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground", children: [
2300
- A.length,
2301
- " events"
2302
- ] })
2303
- ] }),
2304
- /* @__PURE__ */ e("div", { className: "space-y-1.5", children: A.map((N) => /* @__PURE__ */ e("div", { children: z ? z({ event: N, variant: "compact" }) : /* @__PURE__ */ e(
2305
- Ce,
2306
- {
2307
- event: N,
2308
- variant: "compact",
2309
- badgeVariant: a,
2310
- onClick: (G) => {
2311
- _(null), d?.(G);
2312
- },
2313
- disablePopover: !!d && !p,
2314
- renderPopover: p,
2315
- showTime: !0
2316
- }
2317
- ) }, N.id)) })
2318
- ]
2319
- }
2320
- )
2321
- ]
2322
- }
2323
- ) : /* @__PURE__ */ r(
2324
- "div",
2325
- {
2326
- onPointerDown: (N) => {
2327
- N.stopPropagation(), $(u.date);
2328
- },
2329
- className: l(
2330
- "w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",
2331
- i?.moreEventsIndicator
2332
- ),
2333
- children: [
2334
- "+",
2335
- A.length - ge,
2336
- " more"
2337
- ]
2338
- }
2339
- ))
2340
- ]
2341
- }
2342
- ),
2343
- h && /* @__PURE__ */ e(
2344
- h,
2345
- {
2346
- date: u.date,
2347
- events: A,
2348
- isToday: m,
2349
- isCurrentMonth: u.isCurrentMonth,
2350
- isWeekend: E,
2351
- view: "month"
2352
- }
2353
- )
2354
- ]
2355
- },
2356
- k
2357
- );
2358
- }) })
2359
- ] }) }) });
2360
- }
2361
- const ie = 96, xe = 56, Ue = 72, X = 120, be = 100, Qt = 3;
2362
- function hn({
2363
- events: t,
2364
- date: n,
2365
- weekStartsOn: o = 1,
2366
- visibleHours: a = { startHour: 0, endHour: 24 },
2367
- workingHours: d,
2368
- slotDuration: g = 30,
2369
- badgeVariant: c = "colored",
2370
- onEventClick: b,
2371
- onSlotSelect: z,
2372
- onDayClick: p,
2373
- className: y,
2374
- renderEvent: L,
2375
- renderPopover: i,
2376
- slots: v,
2377
- classNames: h
2378
- }) {
2379
- const w = 60 / g, _ = 100 / w, W = V(() => {
2380
- const s = [];
2381
- for (let f = 0; f < w; f++)
2382
- s.push(f * g);
2383
- return s;
2384
- }, [w, g]), D = V(
2385
- () => mt(n, o),
2386
- [n, o]
2387
- ), x = V(
2388
- () => Xe(a),
2389
- [a]
2390
- ), O = V(() => {
2391
- const s = /* @__PURE__ */ new Map();
2392
- for (const f of D) {
2393
- const S = f.toDateString(), P = Le(t, f), { singleDay: T, multiDay: q } = Ke(P), R = Ye(
2394
- T,
2395
- f,
2396
- a,
2397
- ie
2398
- ), U = /* @__PURE__ */ new Map();
2399
- let ae = 1;
2400
- for (const K of R)
2401
- if (U.set(K.event.id, K.position), K.position.width > 0) {
2402
- const J = Math.round(100 / K.position.width);
2403
- ae = Math.max(ae, J);
2404
- }
2405
- s.set(S, {
2406
- singleDay: T,
2407
- multiDay: q,
2408
- positions: U,
2409
- maxOverlapping: ae
2410
- });
2411
- }
2412
- return s;
2413
- }, [D, t, a]), j = V(() => {
2414
- const s = /* @__PURE__ */ new Map();
2415
- for (const { multiDay: f } of O.values())
2416
- for (const S of f)
2417
- s.set(S.id, S);
2418
- return Array.from(s.values());
2419
- }, [O]), B = /* @__PURE__ */ new Date(), $ = D.findIndex((s) => te(s)), F = V(() => {
2420
- if ($ < 0) return -1;
2421
- const s = B.getHours() + B.getMinutes() / 60;
2422
- return s < a.startHour || s > a.endHour ? -1 : (s - a.startHour) * ie;
2423
- }, [$, a, B]), u = se(null);
2424
- qe(() => {
2425
- const s = u.current;
2426
- if (!s) return;
2427
- const f = () => {
2428
- let S;
2429
- if ($ !== -1) {
2430
- const T = (/* @__PURE__ */ new Date()).getHours();
2431
- S = Math.max(T - 1, a.startHour);
2432
- } else {
2433
- const q = (/* @__PURE__ */ new Date()).getDay();
2434
- let R = d?.[q];
2435
- if (!R?.enabled || R.from === 0) {
2436
- const U = d?.[1];
2437
- U?.enabled && (R = U);
2438
- }
2439
- R?.enabled && R.from > 0 ? S = Math.max(
2440
- R.from - 1,
2441
- a.startHour
2442
- ) : S = Math.max(7, a.startHour);
2443
- }
2444
- const P = (S - a.startHour) * ie;
2445
- s.scrollTo({
2446
- top: P,
2447
- behavior: "instant"
2448
- });
2449
- };
2450
- requestAnimationFrame(() => {
2451
- requestAnimationFrame(f);
2452
- });
2453
- }, [n, d, a, $]);
2454
- const k = Ee(), A = M(
2455
- (s) => {
2456
- k?.startSelection(s);
2457
- },
2458
- [k]
2459
- ), m = M(
2460
- (s) => {
2461
- k?.updateSelection(s);
2462
- },
2463
- [k]
2464
- ), E = M(() => {
2465
- k?.endSelection();
2466
- }, [k]), I = M(
2467
- (s) => {
2468
- b?.(s);
2469
- },
2470
- [b]
2471
- ), N = xe + 7 * X, G = V(() => {
2472
- const s = [];
2473
- for (const f of D) {
2474
- const S = f.toDateString(), T = O.get(S)?.maxOverlapping ?? 1;
2475
- T > Qt ? s.push(
2476
- Math.max(X, T * be)
2477
- ) : s.push(X);
2478
- }
2479
- return s;
2480
- }, [D, O]), C = xe + G.reduce((s, f) => s + f, 0);
2481
- return /* @__PURE__ */ r("div", { className: l("ic-week-view flex flex-col h-full", y), children: [
2482
- j.length > 0 && /* @__PURE__ */ e(
2483
- nt,
2484
- {
2485
- events: j,
2486
- date: ht(n, o),
2487
- onEventClick: I,
2488
- ...h?.multiDayBanner && {
2489
- className: h.multiDayBanner
2490
- }
2491
- }
2492
- ),
2493
- /* @__PURE__ */ e(
2494
- "div",
2495
- {
2496
- ref: u,
2497
- className: l(
2498
- "ic-week-scroll-container flex-1",
2499
- h?.scrollContainer
2500
- ),
2501
- children: /* @__PURE__ */ r("div", { style: { minWidth: Math.max(N, C) }, children: [
2502
- /* @__PURE__ */ e("div", { className: "ic-week-header sticky top-0 z-20 border-b bg-background", children: /* @__PURE__ */ r("div", { className: "flex", children: [
2503
- /* @__PURE__ */ e(
2504
- "div",
2505
- {
2506
- className: "flex-shrink-0 flex items-end justify-center pb-2 text-[10px] text-muted-foreground/70",
2507
- style: { width: xe, height: Ue },
2508
- children: /* @__PURE__ */ r("span", { className: "hidden sm:inline", children: [
2509
- "GMT",
2510
- (() => {
2511
- const s = (/* @__PURE__ */ new Date()).getTimezoneOffset(), f = Math.abs(Math.floor(s / 60)), S = s <= 0 ? "+" : "-";
2512
- return f > 0 ? `${S}${String(f).padStart(2, "0")}` : "";
2513
- })()
2514
- ] })
2515
- }
2516
- ),
2517
- D.map((s, f) => {
2518
- const S = te(s), P = G[f] ?? X, T = P > X;
2519
- return /* @__PURE__ */ r(
2520
- "div",
2521
- {
2522
- className: l(
2523
- "flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2",
2524
- h?.columnHeader,
2525
- S && h?.columnHeaderToday
2526
- ),
2527
- style: {
2528
- height: Ue,
2529
- minWidth: T ? P : X
2530
- },
2531
- children: [
2532
- /* @__PURE__ */ e(
2533
- "span",
2534
- {
2535
- className: l(
2536
- "text-[11px] font-medium uppercase tracking-wide",
2537
- S ? "text-primary" : "text-muted-foreground"
2538
- ),
2539
- children: s.toLocaleDateString([], { weekday: "short" })
2540
- }
2541
- ),
2542
- /* @__PURE__ */ e(
2543
- "button",
2544
- {
2545
- type: "button",
2546
- onClick: () => p?.(s),
2547
- className: l(
2548
- "flex items-center justify-center rounded-full transition-colors mt-0.5",
2549
- "size-10 text-2xl font-normal",
2550
- S ? "bg-primary text-primary-foreground" : "text-foreground hover:bg-muted"
2551
- ),
2552
- children: s.getDate()
2553
- }
2554
- )
2555
- ]
2556
- },
2557
- s.toDateString()
2558
- );
2559
- })
2560
- ] }) }),
2561
- /* @__PURE__ */ r("div", { className: "relative flex", children: [
2562
- /* @__PURE__ */ e(
2563
- "div",
2564
- {
2565
- className: l(
2566
- "ic-hour-column sticky left-0 z-10 bg-zinc-50 border-r",
2567
- h?.timeGutter
2568
- ),
2569
- style: { width: xe },
2570
- children: x.map((s, f) => /* @__PURE__ */ e(
2571
- "div",
2572
- {
2573
- className: "relative",
2574
- style: { height: ie },
2575
- children: /* @__PURE__ */ e("div", { className: "absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center", children: f !== 0 && /* @__PURE__ */ e(
2576
- "span",
2577
- {
2578
- className: l(
2579
- "text-[10px] sm:text-xs text-muted-foreground",
2580
- h?.timeGutterLabel
2581
- ),
2582
- children: we(s)
2583
- }
2584
- ) })
2585
- },
2586
- s
2587
- ))
2588
- }
2589
- ),
2590
- /* @__PURE__ */ e("div", { className: "ic-week-grid relative flex-1", children: /* @__PURE__ */ e("div", { className: "flex divide-x", children: D.map((s, f) => {
2591
- const S = s.toDateString(), P = O.get(S), T = G[f] ?? X, q = T > X;
2592
- return /* @__PURE__ */ r(
2593
- "div",
2594
- {
2595
- className: "ic-day-column relative flex-1",
2596
- style: {
2597
- minWidth: q ? T : X
2598
- },
2599
- children: [
2600
- x.map((R, U) => {
2601
- const K = !Je(
2602
- s,
2603
- R,
2604
- d
2605
- );
2606
- return /* @__PURE__ */ r(
2607
- "div",
2608
- {
2609
- className: l(
2610
- "relative",
2611
- K && "bg-calendar-disabled-hour",
2612
- te(s) && !K && "bg-primary/5",
2613
- h?.timeSlot,
2614
- K ? h?.timeSlotNonWorking : h?.timeSlotWorking
2615
- ),
2616
- style: { height: ie },
2617
- children: [
2618
- U !== 0 && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-x-0 top-0 border-b border-border/50" }),
2619
- W.slice(1).map((J) => /* @__PURE__ */ e(
2620
- "div",
2621
- {
2622
- className: "pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",
2623
- style: { top: `${J / 60 * 100}%` }
2624
- },
2625
- J
2626
- )),
2627
- W.map((J, at) => {
2628
- const Ae = {
2629
- date: s,
2630
- hour: R,
2631
- minute: J
2632
- };
2633
- return /* @__PURE__ */ e(
2634
- ot,
2635
- {
2636
- slot: Ae,
2637
- onSelectionStart: A,
2638
- onSelectionMove: m,
2639
- onSelectionEnd: E,
2640
- isSelected: k?.isSlotSelected(Ae) ?? !1,
2641
- isSelecting: k?.isSelecting ?? !1,
2642
- disabled: K,
2643
- className: "absolute inset-x-0",
2644
- style: {
2645
- top: `${at * _}%`,
2646
- height: `${_}%`
2647
- },
2648
- ariaLabel: `Add event on ${s.toLocaleDateString()} at ${we(R)}:${String(J).padStart(2, "0")}`
2649
- },
2650
- J
2651
- );
2652
- })
2653
- ]
2654
- },
2655
- R
2656
- );
2657
- }),
2658
- P?.singleDay.map((R) => {
2659
- const U = P.positions.get(R.id);
2660
- if (!U) return null;
2661
- const ae = `calc(${U.width}% - 2px)`, K = `max(${be}px, ${ae})`;
2662
- return L ? /* @__PURE__ */ e(
2663
- "div",
2664
- {
2665
- className: "absolute pointer-events-auto p-0.5",
2666
- style: {
2667
- top: `${U.top}px`,
2668
- left: `${U.left}%`,
2669
- width: K,
2670
- minWidth: `${be}px`
2671
- },
2672
- children: L({ event: R, position: U })
2673
- },
2674
- R.id
2675
- ) : /* @__PURE__ */ e(
2676
- Qe,
2677
- {
2678
- event: R,
2679
- position: {
2680
- top: U.top,
2681
- left: U.left,
2682
- width: U.width,
2683
- minWidth: be
2684
- },
2685
- hourHeight: ie,
2686
- badgeVariant: c,
2687
- onClick: b,
2688
- disablePopover: !!b && !i,
2689
- renderPopover: i,
2690
- className: l(
2691
- "pointer-events-auto",
2692
- h?.eventCard
2693
- )
2694
- },
2695
- R.id
2696
- );
2697
- }),
2698
- f === $ && F >= 0 && /* @__PURE__ */ r(
2699
- "div",
2700
- {
2701
- className: l(
2702
- "absolute left-0 right-0 z-20 flex items-center pointer-events-none",
2703
- h?.currentTimeIndicator
2704
- ),
2705
- style: { top: F },
2706
- children: [
2707
- /* @__PURE__ */ e("div", { className: "h-2 w-2 -ml-1 rounded-full bg-red-500" }),
2708
- /* @__PURE__ */ e("div", { className: "flex-1 h-0.5 bg-red-500" })
2709
- ]
2710
- }
2711
- )
2712
- ]
2713
- },
2714
- s.toDateString()
2715
- );
2716
- }) }) })
2717
- ] })
2718
- ] })
2719
- }
2720
- )
2721
- ] });
2722
- }
2723
- export {
2724
- cn as A,
2725
- ce as B,
2726
- dn as C,
2727
- Bt as D,
2728
- Qe as E,
2729
- mn as M,
2730
- ne as P,
2731
- ot as T,
2732
- hn as W,
2733
- Xt as a,
2734
- un as b,
2735
- Ce as c,
2736
- nt as d,
2737
- ln as e,
2738
- an as f,
2739
- Q as g,
2740
- re as h,
2741
- Ht as i,
2742
- le as j,
2743
- ee as k,
2744
- sn as l,
2745
- de as m,
2746
- gt as n,
2747
- fe as o,
2748
- He as p,
2749
- Oe as q,
2750
- Me as r,
2751
- Te as s,
2752
- It as t
2753
- };
2754
- //# sourceMappingURL=week-view-5nw-Hvod.js.map