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