@innosolutions/inno-calendar 1.0.72 → 2.0.1

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 (200) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/LICENSE +48 -48
  3. package/README.md +333 -305
  4. package/dist/components/event/event-card.d.ts +4 -28
  5. package/dist/components/event/event-card.d.ts.map +1 -1
  6. package/dist/components/header/calendar-header.d.ts +14 -3
  7. package/dist/components/header/calendar-header.d.ts.map +1 -1
  8. package/dist/components/index.cjs +1 -1
  9. package/dist/components/index.d.ts +7 -6
  10. package/dist/components/index.d.ts.map +1 -1
  11. package/dist/components/index.mjs +48 -57
  12. package/dist/components/index.mjs.map +1 -1
  13. package/dist/components/inno-calendar.d.ts +139 -72
  14. package/dist/components/inno-calendar.d.ts.map +1 -1
  15. package/dist/components/primitives/field-layer.d.ts +22 -0
  16. package/dist/components/primitives/field-layer.d.ts.map +1 -0
  17. package/dist/components/primitives/index.d.ts +3 -0
  18. package/dist/components/primitives/index.d.ts.map +1 -1
  19. package/dist/components/primitives/multi-day-banner.d.ts.map +1 -1
  20. package/dist/components/primitives/quick-create.d.ts +44 -0
  21. package/dist/components/primitives/quick-create.d.ts.map +1 -0
  22. package/dist/components/primitives/recurrence-field.d.ts +102 -0
  23. package/dist/components/primitives/recurrence-field.d.ts.map +1 -0
  24. package/dist/components/primitives/week-all-day-row.d.ts.map +1 -1
  25. package/dist/components/primitives/when-row.d.ts +41 -0
  26. package/dist/components/primitives/when-row.d.ts.map +1 -0
  27. package/dist/components/shell/calendar-settings.d.ts +28 -0
  28. package/dist/components/shell/calendar-settings.d.ts.map +1 -0
  29. package/dist/components/shell/calendar-sidebar.d.ts +27 -0
  30. package/dist/components/shell/calendar-sidebar.d.ts.map +1 -0
  31. package/dist/components/shell/filter-panel.d.ts +10 -0
  32. package/dist/components/shell/filter-panel.d.ts.map +1 -0
  33. package/dist/components/shell/index.d.ts +5 -0
  34. package/dist/components/shell/index.d.ts.map +1 -0
  35. package/dist/components/shell/mini-month.d.ts +16 -0
  36. package/dist/components/shell/mini-month.d.ts.map +1 -0
  37. package/dist/components/ui/index.d.ts +0 -2
  38. package/dist/components/ui/index.d.ts.map +1 -1
  39. package/dist/components/views/agenda-view.d.ts +14 -15
  40. package/dist/components/views/agenda-view.d.ts.map +1 -1
  41. package/dist/components/views/day-events-expansion.d.ts +1 -1
  42. package/dist/components/views/day-events-expansion.d.ts.map +1 -1
  43. package/dist/components/views/day-view.d.ts +2 -6
  44. package/dist/components/views/day-view.d.ts.map +1 -1
  45. package/dist/components/views/index.d.ts +2 -1
  46. package/dist/components/views/index.d.ts.map +1 -1
  47. package/dist/components/views/month-view.d.ts +2 -12
  48. package/dist/components/views/month-view.d.ts.map +1 -1
  49. package/dist/components/views/resource-columns-view.d.ts +23 -0
  50. package/dist/components/views/resource-columns-view.d.ts.map +1 -0
  51. package/dist/components/views/timeline-view.d.ts +2 -6
  52. package/dist/components/views/timeline-view.d.ts.map +1 -1
  53. package/dist/components/views/week-view.d.ts +10 -6
  54. package/dist/components/views/week-view.d.ts.map +1 -1
  55. package/dist/components/views/year-view.d.ts +2 -6
  56. package/dist/components/views/year-view.d.ts.map +1 -1
  57. package/dist/core/constants.d.ts +39 -1
  58. package/dist/core/constants.d.ts.map +1 -1
  59. package/dist/core/context/drag-drop-context.d.ts +15 -1
  60. package/dist/core/context/drag-drop-context.d.ts.map +1 -1
  61. package/dist/core/context/event-card-context.d.ts +16 -0
  62. package/dist/core/context/event-card-context.d.ts.map +1 -0
  63. package/dist/core/context/inno-calendar-provider.d.ts +10 -1
  64. package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
  65. package/dist/core/context/slot-selection-context.d.ts +16 -0
  66. package/dist/core/context/slot-selection-context.d.ts.map +1 -1
  67. package/dist/core/index.cjs +1 -1
  68. package/dist/core/index.d.ts +3 -1
  69. package/dist/core/index.d.ts.map +1 -1
  70. package/dist/core/index.mjs +155 -149
  71. package/dist/core/index.mjs.map +1 -1
  72. package/dist/core/types.d.ts +44 -514
  73. package/dist/core/types.d.ts.map +1 -1
  74. package/dist/core/utils/date-input.d.ts +8 -0
  75. package/dist/core/utils/date-input.d.ts.map +1 -0
  76. package/dist/core/utils/grid-utils.d.ts.map +1 -1
  77. package/dist/core/utils/index.d.ts +1 -0
  78. package/dist/core/utils/index.d.ts.map +1 -1
  79. package/dist/core/utils/time-format.d.ts +33 -0
  80. package/dist/core/utils/time-format.d.ts.map +1 -0
  81. package/dist/core/utils/view-storage.d.ts +2 -2
  82. package/dist/core/utils/view-storage.d.ts.map +1 -1
  83. package/dist/core/z-layers.d.ts +21 -0
  84. package/dist/core/z-layers.d.ts.map +1 -0
  85. package/dist/index.cjs +1 -1
  86. package/dist/index.d.ts +0 -1
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.mjs +228 -234
  89. package/dist/index.mjs.map +1 -1
  90. package/dist/inno-calendar-DFEaWcSi.cjs +11 -0
  91. package/dist/inno-calendar-DFEaWcSi.cjs.map +1 -0
  92. package/dist/inno-calendar-R7LPGSJU.js +7454 -0
  93. package/dist/inno-calendar-R7LPGSJU.js.map +1 -0
  94. package/dist/lib/index.cjs +1 -1
  95. package/dist/lib/index.mjs +1 -1
  96. package/dist/position-utils-BH6T1FL5.js +1125 -0
  97. package/dist/position-utils-BH6T1FL5.js.map +1 -0
  98. package/dist/position-utils-BVt-Bp93.cjs +2 -0
  99. package/dist/position-utils-BVt-Bp93.cjs.map +1 -0
  100. package/dist/styles/index.css +1 -1
  101. package/dist/use-slot-selection-CSsSyfAi.cjs +2 -0
  102. package/dist/use-slot-selection-CSsSyfAi.cjs.map +1 -0
  103. package/dist/use-slot-selection-CT1z9v9X.js +357 -0
  104. package/dist/use-slot-selection-CT1z9v9X.js.map +1 -0
  105. package/dist/utils-B6yFEsav.js +9 -0
  106. package/dist/utils-B6yFEsav.js.map +1 -0
  107. package/dist/utils-IjLH3w2e.cjs +2 -0
  108. package/dist/utils-IjLH3w2e.cjs.map +1 -0
  109. package/dist/utils.cjs +1 -1
  110. package/dist/utils.d.ts +1 -1
  111. package/dist/utils.d.ts.map +1 -1
  112. package/dist/utils.mjs +108 -104
  113. package/dist/z-layers-CpHPAMdp.js +637 -0
  114. package/dist/z-layers-CpHPAMdp.js.map +1 -0
  115. package/dist/z-layers-D1DivrJg.cjs +2 -0
  116. package/dist/z-layers-D1DivrJg.cjs.map +1 -0
  117. package/package.json +117 -138
  118. package/AGENT.md +0 -1783
  119. package/dist/agenda-widget-B0t3TCcV.js +0 -4141
  120. package/dist/agenda-widget-B0t3TCcV.js.map +0 -1
  121. package/dist/agenda-widget-i2tjGr5U.cjs +0 -2
  122. package/dist/agenda-widget-i2tjGr5U.cjs.map +0 -1
  123. package/dist/components/calendar.d.ts +0 -45
  124. package/dist/components/calendar.d.ts.map +0 -1
  125. package/dist/components/event/event-page-transition.d.ts +0 -32
  126. package/dist/components/event/event-page-transition.d.ts.map +0 -1
  127. package/dist/components/filters/calendar-filter-sidebar.d.ts +0 -54
  128. package/dist/components/filters/calendar-filter-sidebar.d.ts.map +0 -1
  129. package/dist/components/filters/index.d.ts +0 -9
  130. package/dist/components/filters/index.d.ts.map +0 -1
  131. package/dist/components/filters/schedule-type-filter.d.ts +0 -31
  132. package/dist/components/filters/schedule-type-filter.d.ts.map +0 -1
  133. package/dist/components/filters/user-filter.d.ts +0 -31
  134. package/dist/components/filters/user-filter.d.ts.map +0 -1
  135. package/dist/components/header/components/index.d.ts +0 -8
  136. package/dist/components/header/components/index.d.ts.map +0 -1
  137. package/dist/components/integrated-calendar.d.ts +0 -37
  138. package/dist/components/integrated-calendar.d.ts.map +0 -1
  139. package/dist/components/settings/badge-variant-setting.d.ts +0 -25
  140. package/dist/components/settings/badge-variant-setting.d.ts.map +0 -1
  141. package/dist/components/settings/index.d.ts +0 -10
  142. package/dist/components/settings/index.d.ts.map +0 -1
  143. package/dist/components/settings/slot-duration-setting.d.ts +0 -20
  144. package/dist/components/settings/slot-duration-setting.d.ts.map +0 -1
  145. package/dist/components/settings/visible-hours-setting.d.ts +0 -23
  146. package/dist/components/settings/visible-hours-setting.d.ts.map +0 -1
  147. package/dist/components/settings/working-hours-setting.d.ts +0 -41
  148. package/dist/components/settings/working-hours-setting.d.ts.map +0 -1
  149. package/dist/components/ui/dialog.d.ts +0 -35
  150. package/dist/components/ui/dialog.d.ts.map +0 -1
  151. package/dist/components/ui/select.d.ts +0 -12
  152. package/dist/components/ui/select.d.ts.map +0 -1
  153. package/dist/components/widget/agenda-dropdown.d.ts +0 -20
  154. package/dist/components/widget/agenda-dropdown.d.ts.map +0 -1
  155. package/dist/components/widget/agenda-widget.d.ts +0 -27
  156. package/dist/components/widget/agenda-widget.d.ts.map +0 -1
  157. package/dist/components/widget/index.d.ts +0 -6
  158. package/dist/components/widget/index.d.ts.map +0 -1
  159. package/dist/index-D2U2F80P.cjs +0 -2
  160. package/dist/index-D2U2F80P.cjs.map +0 -1
  161. package/dist/index-DtaLkIY8.js +0 -2777
  162. package/dist/index-DtaLkIY8.js.map +0 -1
  163. package/dist/position-utils-D_KpwRus.js +0 -1053
  164. package/dist/position-utils-D_KpwRus.js.map +0 -1
  165. package/dist/position-utils-ksZ_IjXC.cjs +0 -2
  166. package/dist/position-utils-ksZ_IjXC.cjs.map +0 -1
  167. package/dist/presets/default/default-calendar.d.ts +0 -44
  168. package/dist/presets/default/default-calendar.d.ts.map +0 -1
  169. package/dist/presets/default/index.d.ts +0 -2
  170. package/dist/presets/default/index.d.ts.map +0 -1
  171. package/dist/presets/index.cjs +0 -2
  172. package/dist/presets/index.cjs.map +0 -1
  173. package/dist/presets/index.d.ts +0 -3
  174. package/dist/presets/index.d.ts.map +0 -1
  175. package/dist/presets/index.mjs +0 -6
  176. package/dist/presets/index.mjs.map +0 -1
  177. package/dist/presets/tailwind/index.d.ts +0 -2
  178. package/dist/presets/tailwind/index.d.ts.map +0 -1
  179. package/dist/presets/tailwind/tailwind-calendar.d.ts +0 -122
  180. package/dist/presets/tailwind/tailwind-calendar.d.ts.map +0 -1
  181. package/dist/slot-selection-context-CLYZU6ul.cjs +0 -2
  182. package/dist/slot-selection-context-CLYZU6ul.cjs.map +0 -1
  183. package/dist/slot-selection-context-Ct5cVcKW.js +0 -611
  184. package/dist/slot-selection-context-Ct5cVcKW.js.map +0 -1
  185. package/dist/tailwind-calendar-BbUb61uY.cjs +0 -2
  186. package/dist/tailwind-calendar-BbUb61uY.cjs.map +0 -1
  187. package/dist/tailwind-calendar-DrwGVSF-.js +0 -400
  188. package/dist/tailwind-calendar-DrwGVSF-.js.map +0 -1
  189. package/dist/use-calendar-BK0nQYJq.cjs +0 -2
  190. package/dist/use-calendar-BK0nQYJq.cjs.map +0 -1
  191. package/dist/use-calendar-DJI35SSd.js +0 -175
  192. package/dist/use-calendar-DJI35SSd.js.map +0 -1
  193. package/dist/use-slot-selection-CCE11R4j.cjs +0 -2
  194. package/dist/use-slot-selection-CCE11R4j.cjs.map +0 -1
  195. package/dist/use-slot-selection-CX1w8EdM.js +0 -188
  196. package/dist/use-slot-selection-CX1w8EdM.js.map +0 -1
  197. package/dist/week-view-BXmaRChB.cjs +0 -11
  198. package/dist/week-view-BXmaRChB.cjs.map +0 -1
  199. package/dist/week-view-BeasFcyR.js +0 -3520
  200. package/dist/week-view-BeasFcyR.js.map +0 -1
@@ -1,3520 +0,0 @@
1
- import { jsxs as o, jsx as e, Fragment as Be } from "react/jsx-runtime";
2
- import * as X from "react";
3
- import { forwardRef as je, createElement as $e, useState as Z, useEffect as ke, useCallback as L, useRef as re, useMemo as q, useLayoutEffect as Fe } from "react";
4
- import { c as s, a as Dt } from "./index-DtaLkIY8.js";
5
- import * as K from "@radix-ui/react-dropdown-menu";
6
- import { Z as Y, aP as Ct, ac as St, ai as Mt, at as Tt, aG as ce, A as ze, aC as ie, ad as Ve, aY as it, w as lt, am as dt, aI as ct, _ as Ae, a2 as zt, b2 as Xe, an as At } from "./position-utils-D_KpwRus.js";
7
- import { j as Ge, k as ut, l as Ue } from "./slot-selection-context-Ct5cVcKW.js";
8
- import * as V from "@radix-ui/react-dialog";
9
- import * as ge from "@radix-ui/react-popover";
10
- import * as De from "@radix-ui/react-tooltip";
11
- const mt = (...t) => t.filter((n, r, a) => !!n && n.trim() !== "" && a.indexOf(n) === r).join(" ").trim();
12
- const Et = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
13
- const Lt = (t) => t.replace(
14
- /^([A-Z])|[\s-_]+(\w)/g,
15
- (n, r, a) => a ? a.toUpperCase() : r.toLowerCase()
16
- );
17
- const Ye = (t) => {
18
- const n = Lt(t);
19
- return n.charAt(0).toUpperCase() + n.slice(1);
20
- };
21
- var Wt = {
22
- xmlns: "http://www.w3.org/2000/svg",
23
- width: 24,
24
- height: 24,
25
- viewBox: "0 0 24 24",
26
- fill: "none",
27
- stroke: "currentColor",
28
- strokeWidth: 2,
29
- strokeLinecap: "round",
30
- strokeLinejoin: "round"
31
- };
32
- const Rt = (t) => {
33
- for (const n in t)
34
- if (n.startsWith("aria-") || n === "role" || n === "title")
35
- return !0;
36
- return !1;
37
- };
38
- const _t = je(
39
- ({
40
- color: t = "currentColor",
41
- size: n = 24,
42
- strokeWidth: r = 2,
43
- absoluteStrokeWidth: a,
44
- className: d = "",
45
- children: p,
46
- iconNode: i,
47
- ...y
48
- }, C) => $e(
49
- "svg",
50
- {
51
- ref: C,
52
- ...Wt,
53
- width: n,
54
- height: n,
55
- stroke: t,
56
- strokeWidth: a ? Number(r) * 24 / Number(n) : r,
57
- className: mt("lucide", d),
58
- ...!p && !Rt(y) && { "aria-hidden": "true" },
59
- ...y
60
- },
61
- [
62
- ...i.map(([l, b]) => $e(l, b)),
63
- ...Array.isArray(p) ? p : [p]
64
- ]
65
- )
66
- );
67
- const We = (t, n) => {
68
- const r = je(
69
- ({ className: a, ...d }, p) => $e(_t, {
70
- ref: p,
71
- iconNode: n,
72
- className: mt(
73
- `lucide-${Et(Ye(t))}`,
74
- `lucide-${t}`,
75
- a
76
- ),
77
- ...d
78
- })
79
- );
80
- return r.displayName = Ye(t), r;
81
- };
82
- const It = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Bt = We("check", It);
83
- const $t = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], Ht = We("chevron-right", $t);
84
- const Ot = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], Pt = We("circle", Ot);
85
- const jt = [
86
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
87
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
88
- ], ht = We("x", jt), Ft = V.Root, Vt = V.Trigger, Gt = V.Portal, Gn = V.Close, pt = X.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
89
- V.Overlay,
90
- {
91
- ref: r,
92
- className: s(
93
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
94
- t
95
- ),
96
- ...n
97
- }
98
- ));
99
- pt.displayName = V.Overlay.displayName;
100
- const ft = X.forwardRef(({ className: t, children: n, ...r }, a) => /* @__PURE__ */ o(Gt, { children: [
101
- /* @__PURE__ */ e(pt, {}),
102
- /* @__PURE__ */ o(
103
- V.Content,
104
- {
105
- ref: a,
106
- className: s(
107
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",
108
- t
109
- ),
110
- ...r,
111
- children: [
112
- n,
113
- /* @__PURE__ */ o(V.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
114
- /* @__PURE__ */ e(ht, { className: "size-4" }),
115
- /* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
116
- ] })
117
- ]
118
- }
119
- )
120
- ] }));
121
- ft.displayName = V.Content.displayName;
122
- const Ut = ({
123
- className: t,
124
- ...n
125
- }) => /* @__PURE__ */ e(
126
- "div",
127
- {
128
- className: s("flex flex-col space-y-1.5 text-center sm:text-left", t),
129
- ...n
130
- }
131
- );
132
- Ut.displayName = "DialogHeader";
133
- const qt = X.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
134
- V.Title,
135
- {
136
- ref: r,
137
- className: s("text-lg font-semibold leading-none tracking-tight", t),
138
- ...n
139
- }
140
- ));
141
- qt.displayName = V.Title.displayName;
142
- const Kt = X.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
143
- V.Description,
144
- {
145
- ref: r,
146
- className: s("text-sm text-muted-foreground", t),
147
- ...n
148
- }
149
- ));
150
- Kt.displayName = V.Description.displayName;
151
- const ue = ge.Root, me = ge.Trigger, Un = ge.Anchor, le = X.forwardRef(({ className: t, align: n = "center", sideOffset: r = 4, ...a }, d) => /* @__PURE__ */ e(ge.Portal, { children: /* @__PURE__ */ e(
152
- ge.Content,
153
- {
154
- ref: d,
155
- align: n,
156
- sideOffset: r,
157
- className: s(
158
- "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",
159
- t
160
- ),
161
- ...a
162
- }
163
- ) }));
164
- le.displayName = ge.Content.displayName;
165
- const Xt = V.Root, Yt = V.Trigger, qn = V.Close, Jt = V.Portal, gt = X.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
166
- V.Overlay,
167
- {
168
- className: s(
169
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
170
- t
171
- ),
172
- ...n,
173
- ref: r
174
- }
175
- ));
176
- gt.displayName = V.Overlay.displayName;
177
- const xt = X.forwardRef(({ className: t, children: n, ...r }, a) => /* @__PURE__ */ o(Jt, { children: [
178
- /* @__PURE__ */ e(gt, {}),
179
- /* @__PURE__ */ o(
180
- V.Content,
181
- {
182
- ref: a,
183
- className: s(
184
- "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
185
- // Right-side slide
186
- "inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
187
- t
188
- ),
189
- ...r,
190
- children: [
191
- n,
192
- /* @__PURE__ */ o(V.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
193
- /* @__PURE__ */ e(ht, { className: "size-4" }),
194
- /* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
195
- ] })
196
- ]
197
- }
198
- )
199
- ] }));
200
- xt.displayName = "SheetContent";
201
- const Zt = ({
202
- className: t,
203
- ...n
204
- }) => /* @__PURE__ */ e(
205
- "div",
206
- {
207
- className: s("flex flex-col space-y-2 text-center sm:text-left", t),
208
- ...n
209
- }
210
- );
211
- Zt.displayName = "SheetHeader";
212
- const Qt = X.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
213
- V.Title,
214
- {
215
- ref: r,
216
- className: s("text-lg font-semibold text-foreground", t),
217
- ...n
218
- }
219
- ));
220
- Qt.displayName = V.Title.displayName;
221
- const en = X.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
222
- V.Description,
223
- {
224
- ref: r,
225
- className: s("text-sm text-muted-foreground", t),
226
- ...n
227
- }
228
- ));
229
- en.displayName = V.Description.displayName;
230
- const Kn = De.Provider, ae = De.Root, se = De.Trigger, oe = X.forwardRef(({ className: t, sideOffset: n = 4, ...r }, a) => /* @__PURE__ */ e(
231
- De.Content,
232
- {
233
- ref: a,
234
- sideOffset: n,
235
- className: s(
236
- "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",
237
- t
238
- ),
239
- ...r
240
- }
241
- ));
242
- oe.displayName = De.Content.displayName;
243
- function de(t) {
244
- return {
245
- blue: {
246
- bg: "bg-blue-50 dark:bg-blue-950/30",
247
- text: "text-blue-700 dark:text-blue-300",
248
- dot: "bg-blue-500",
249
- dotFill: "fill-blue-600 dark:fill-blue-500",
250
- border: "border-blue-400 dark:border-blue-600",
251
- accentBorder: "border-l-blue-500 dark:border-l-blue-400"
252
- },
253
- green: {
254
- bg: "bg-green-50 dark:bg-green-950/30",
255
- text: "text-green-700 dark:text-green-300",
256
- dot: "bg-green-500",
257
- dotFill: "fill-green-600 dark:fill-green-500",
258
- border: "border-green-400 dark:border-green-600",
259
- accentBorder: "border-l-green-500 dark:border-l-green-400"
260
- },
261
- red: {
262
- bg: "bg-red-50 dark:bg-red-950/30",
263
- text: "text-red-700 dark:text-red-300",
264
- dot: "bg-red-500",
265
- dotFill: "fill-red-600 dark:fill-red-500",
266
- border: "border-red-400 dark:border-red-600",
267
- accentBorder: "border-l-red-500 dark:border-l-red-400"
268
- },
269
- yellow: {
270
- bg: "bg-yellow-50 dark:bg-yellow-950/30",
271
- text: "text-yellow-700 dark:text-yellow-300",
272
- dot: "bg-yellow-500",
273
- dotFill: "fill-yellow-600 dark:fill-yellow-500",
274
- border: "border-yellow-400 dark:border-yellow-600",
275
- accentBorder: "border-l-yellow-500 dark:border-l-yellow-400"
276
- },
277
- purple: {
278
- bg: "bg-purple-50 dark:bg-purple-950/30",
279
- text: "text-purple-700 dark:text-purple-300",
280
- dot: "bg-purple-500",
281
- dotFill: "fill-purple-600 dark:fill-purple-500",
282
- border: "border-purple-400 dark:border-purple-600",
283
- accentBorder: "border-l-purple-500 dark:border-l-purple-400"
284
- },
285
- orange: {
286
- bg: "bg-orange-50 dark:bg-orange-950/30",
287
- text: "text-orange-700 dark:text-orange-300",
288
- dot: "bg-orange-500",
289
- dotFill: "fill-orange-600 dark:fill-orange-500",
290
- border: "border-orange-400 dark:border-orange-600",
291
- accentBorder: "border-l-orange-500 dark:border-l-orange-400"
292
- },
293
- pink: {
294
- bg: "bg-pink-50 dark:bg-pink-950/30",
295
- text: "text-pink-700 dark:text-pink-300",
296
- dot: "bg-pink-500",
297
- dotFill: "fill-pink-600 dark:fill-pink-500",
298
- border: "border-pink-400 dark:border-pink-600",
299
- accentBorder: "border-l-pink-500 dark:border-l-pink-400"
300
- },
301
- teal: {
302
- bg: "bg-teal-50 dark:bg-teal-950/30",
303
- text: "text-teal-700 dark:text-teal-300",
304
- dot: "bg-teal-500",
305
- dotFill: "fill-teal-600 dark:fill-teal-500",
306
- border: "border-teal-400 dark:border-teal-600",
307
- accentBorder: "border-l-teal-500 dark:border-l-teal-400"
308
- },
309
- gray: {
310
- bg: "bg-gray-50 dark:bg-gray-950/30",
311
- text: "text-gray-700 dark:text-gray-300",
312
- dot: "bg-gray-500",
313
- dotFill: "fill-gray-600 dark:fill-gray-500",
314
- border: "border-gray-400 dark:border-gray-600",
315
- accentBorder: "border-l-gray-500 dark:border-l-gray-400"
316
- },
317
- indigo: {
318
- bg: "bg-indigo-50 dark:bg-indigo-950/30",
319
- text: "text-indigo-700 dark:text-indigo-300",
320
- dot: "bg-indigo-500",
321
- dotFill: "fill-indigo-600 dark:fill-indigo-500",
322
- border: "border-indigo-400 dark:border-indigo-600",
323
- accentBorder: "border-l-indigo-500 dark:border-l-indigo-400"
324
- }
325
- }[t ?? "blue"];
326
- }
327
- function yt(t) {
328
- const n = new Date(t);
329
- return n.setHours(0, 0, 0, 0), n;
330
- }
331
- function Ee({
332
- event: t,
333
- variant: n = "full",
334
- badgeVariant: r = "colored",
335
- onClick: a,
336
- className: d,
337
- showTime: p = !0,
338
- showDescription: i = !1,
339
- showParticipants: y = !1,
340
- style: C,
341
- disablePopover: l = !1,
342
- renderPopover: b,
343
- enableDrag: v = !1,
344
- enablePageTransition: u = !1,
345
- pageTransitionDuration: x = 400,
346
- eventDetailMode: f = "popover",
347
- renderEventDetail: N
348
- }) {
349
- const g = de(t.color), [W, S] = Z(!1), [T, I] = Z(!1), [G, F] = Z(!1), [O, A] = Z(null), E = re(null), $ = Ge(), P = ut();
350
- ke(() => {
351
- if (!l && P?.focusEventId && P.focusEventId === t.id) {
352
- const U = setTimeout(() => {
353
- S(!0), P.clearFocusEventId();
354
- }, 300);
355
- return () => clearTimeout(U);
356
- }
357
- }, [P?.focusEventId, t.id, l]);
358
- const k = t.endDate < yt(/* @__PURE__ */ new Date()), h = t.isCanceled ?? !1, R = v && $ && !h && !k, _ = t.data, B = _?.meetingTookPlace ?? t.meetingTookPlace ?? !1, w = h ? /* @__PURE__ */ e(nn, { className: "h-3 w-3 text-zinc-800 dark:text-zinc-200" }) : B ? /* @__PURE__ */ e(tn, { className: s("h-3 w-3", g.text) }) : null, c = _?.productName, m = _?.extendedProps, M = _?.nrParticipant, D = _?.siteName, H = _?.siteCity, Q = !!D || !!H, z = L(() => {
359
- if (!T) {
360
- if (l && a) {
361
- a(t);
362
- return;
363
- }
364
- if (u && E.current) {
365
- const U = E.current.getBoundingClientRect();
366
- A(U), F(!0);
367
- } else l || S(!0);
368
- }
369
- }, [T, l, a, t, u]);
370
- L(() => {
371
- F(!1), A(null), l || S(!0);
372
- }, [l]);
373
- const j = L(() => {
374
- S(!1);
375
- }, []), te = L(
376
- (U) => {
377
- R && (U.dataTransfer.effectAllowed = "move", U.dataTransfer.setData("text/plain", t.id), I(!0), $?.startDrag?.(t));
378
- },
379
- [R, t, $]
380
- ), J = L(() => {
381
- I(!1), $?.isDragging && $.endDrag?.();
382
- }, [$]), ee = N ? N({ event: t, onClose: j }) : b ? b({ event: t, onClose: j }) : /* @__PURE__ */ e(Ke, { event: t, onClose: j }), xe = (U) => {
383
- switch (f) {
384
- case "dialog":
385
- return /* @__PURE__ */ o(Ft, { open: W, onOpenChange: S, children: [
386
- /* @__PURE__ */ e(Vt, { asChild: !0, children: U }),
387
- /* @__PURE__ */ e(ft, { className: "sm:max-w-md", children: ee })
388
- ] });
389
- case "sheet":
390
- return /* @__PURE__ */ o(Xt, { open: W, onOpenChange: S, children: [
391
- /* @__PURE__ */ e(Yt, { asChild: !0, children: U }),
392
- /* @__PURE__ */ e(xt, { children: ee })
393
- ] });
394
- case "custom":
395
- return U;
396
- default:
397
- return /* @__PURE__ */ o(ue, { open: W, onOpenChange: S, children: [
398
- /* @__PURE__ */ e(me, { asChild: !0, children: U }),
399
- /* @__PURE__ */ e(le, { className: "w-80", children: ee })
400
- ] });
401
- }
402
- };
403
- if (n === "dot") {
404
- const U = /* @__PURE__ */ e(
405
- "button",
406
- {
407
- type: "button",
408
- onClick: z,
409
- className: s(
410
- "size-2 rounded-full cursor-pointer transition-opacity",
411
- g.dot,
412
- t.isCanceled && "opacity-50",
413
- d
414
- ),
415
- style: C,
416
- "aria-label": Ct(t.title)
417
- }
418
- );
419
- return l ? /* @__PURE__ */ o(ae, { children: [
420
- /* @__PURE__ */ e(se, { asChild: !0, children: U }),
421
- /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
422
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
423
- /* @__PURE__ */ e("div", { className: "text-xs opacity-80", children: Y(t) })
424
- ] }) })
425
- ] }) : xe(
426
- /* @__PURE__ */ o(ae, { children: [
427
- /* @__PURE__ */ e(se, { asChild: !0, children: U }),
428
- /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }) })
429
- ] })
430
- );
431
- }
432
- if (n === "compact") {
433
- const U = /* @__PURE__ */ o(
434
- "div",
435
- {
436
- role: "button",
437
- tabIndex: 0,
438
- draggable: !!R,
439
- onDragStart: te,
440
- onDragEnd: J,
441
- onClick: l ? z : void 0,
442
- onKeyDown: (be) => {
443
- (be.key === "Enter" || be.key === " ") && (be.preventDefault(), z());
444
- },
445
- className: s(
446
- "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",
447
- R ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",
448
- T && "opacity-50",
449
- // Cancelled events get gray background with strikethrough
450
- h ? "bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through" : [
451
- r === "colored" && [g.bg, g.text],
452
- r === "mixed" && [g.bg, g.text],
453
- r === "dot" && "bg-muted/50"
454
- ],
455
- d
456
- ),
457
- style: C,
458
- children: [
459
- ["dot", "mixed"].includes(r) && !h && /* @__PURE__ */ e(
460
- "svg",
461
- {
462
- width: "8",
463
- height: "8",
464
- viewBox: "0 0 8 8",
465
- className: "event-dot absolute -top-1 -left-1 shrink-0",
466
- "aria-hidden": "true",
467
- focusable: "false",
468
- children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4", className: g.dotFill })
469
- }
470
- ),
471
- /* @__PURE__ */ e("span", { className: "flex-1 min-w-0 overflow-hidden", children: /* @__PURE__ */ o("span", { className: "", children: [
472
- /* @__PURE__ */ e(
473
- "span",
474
- {
475
- className: "relative block overflow-hidden whitespace-nowrap text-xs leading-tight",
476
- style: {
477
- maskImage: "linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)",
478
- WebkitMaskImage: "linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)"
479
- },
480
- children: /* @__PURE__ */ o("span", { className: "inline-flex event-marquee", children: [
481
- /* @__PURE__ */ e("span", { className: "shrink-0 px-1", children: t.title }),
482
- /* @__PURE__ */ e("span", { className: "shrink-0 px-1", children: "•" }),
483
- /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "shrink-0 px-1", children: t.title }),
484
- /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "shrink-0 px-1", children: "•" })
485
- ] })
486
- }
487
- ),
488
- /* @__PURE__ */ e(
489
- "div",
490
- {
491
- className: s(
492
- "w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",
493
- g.border
494
- ),
495
- children: Y(t)
496
- }
497
- )
498
- ] }) }),
499
- /* @__PURE__ */ e("div", { className: "flex gap-0.5", children: w })
500
- ]
501
- }
502
- );
503
- return l ? /* @__PURE__ */ o(ae, { children: [
504
- /* @__PURE__ */ e(se, { asChild: !0, children: U }),
505
- /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
506
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
507
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Y(t) })
508
- ] }) })
509
- ] }) : xe(U);
510
- }
511
- const ye = /* @__PURE__ */ o(
512
- "button",
513
- {
514
- type: "button",
515
- onClick: z,
516
- className: s(
517
- "group relative flex w-full flex-col gap-1 rounded-md border-l-[3px] px-2 py-1.5 text-left transition-all",
518
- "shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.12)]",
519
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
520
- // Cancelled events get gray background with strikethrough
521
- h ? "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" : [
522
- r === "colored" && [
523
- g.bg,
524
- g.accentBorder,
525
- g.text
526
- ],
527
- r === "mixed" && [
528
- g.bg,
529
- g.accentBorder,
530
- g.text
531
- ],
532
- r === "dot" && "bg-muted/50 border-l-neutral-400 dark:border-l-neutral-600"
533
- ],
534
- d
535
- ),
536
- style: C,
537
- children: [
538
- /* @__PURE__ */ o("div", { className: "flex items-start justify-between gap-1", children: [
539
- /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 min-w-0", children: [
540
- ["dot", "mixed"].includes(r) && !h && /* @__PURE__ */ e(
541
- "svg",
542
- {
543
- width: "8",
544
- height: "8",
545
- viewBox: "0 0 8 8",
546
- className: "event-dot shrink-0",
547
- "aria-hidden": "true",
548
- focusable: "false",
549
- children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4", className: g.dotFill })
550
- }
551
- ),
552
- /* @__PURE__ */ e(
553
- "span",
554
- {
555
- className: s(
556
- "text-sm font-medium truncate",
557
- !h && r !== "dot" && g.text,
558
- h && "line-through"
559
- ),
560
- children: t.title
561
- }
562
- )
563
- ] }),
564
- w
565
- ] }),
566
- c && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground truncate", children: c }),
567
- m && m.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-col text-xs text-muted-foreground", children: m.map((U, be) => /* @__PURE__ */ e("div", { children: U }, be)) }),
568
- M != null && M > 0 && /* @__PURE__ */ o("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
569
- /* @__PURE__ */ e(He, { className: "h-3 w-3 shrink-0" }),
570
- /* @__PURE__ */ o("span", { children: [
571
- M,
572
- " participant",
573
- M !== 1 ? "s" : ""
574
- ] })
575
- ] }),
576
- p && /* @__PURE__ */ o("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
577
- /* @__PURE__ */ e(qe, { className: "h-3 w-3 shrink-0" }),
578
- /* @__PURE__ */ e("span", { children: Y(t) })
579
- ] }),
580
- Q && /* @__PURE__ */ o("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
581
- /* @__PURE__ */ e(bt, { className: "h-3 w-3 shrink-0" }),
582
- /* @__PURE__ */ o("span", { className: "truncate", children: [
583
- D,
584
- D && H ? ", " : "",
585
- H
586
- ] })
587
- ] }),
588
- i && t.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground line-clamp-2", children: t.description }),
589
- y && t.participants && t.participants.length > 0 && /* @__PURE__ */ o("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
590
- /* @__PURE__ */ e(He, { className: "h-3 w-3 shrink-0" }),
591
- /* @__PURE__ */ e("span", { className: "truncate", children: t.participants.map((U) => U.name).join(", ") })
592
- ] })
593
- ]
594
- }
595
- );
596
- return l ? /* @__PURE__ */ o(ae, { children: [
597
- /* @__PURE__ */ e(se, { asChild: !0, children: ye }),
598
- /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
599
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
600
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Y(t) })
601
- ] }) })
602
- ] }) : xe(ye);
603
- }
604
- function qe({ className: t }) {
605
- return /* @__PURE__ */ o(
606
- "svg",
607
- {
608
- xmlns: "http://www.w3.org/2000/svg",
609
- viewBox: "0 0 24 24",
610
- fill: "none",
611
- stroke: "currentColor",
612
- strokeWidth: "2",
613
- strokeLinecap: "round",
614
- strokeLinejoin: "round",
615
- className: t,
616
- children: [
617
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
618
- /* @__PURE__ */ e("polyline", { points: "12 6 12 12 16 14" })
619
- ]
620
- }
621
- );
622
- }
623
- function tn({ className: t }) {
624
- return /* @__PURE__ */ e(
625
- "svg",
626
- {
627
- xmlns: "http://www.w3.org/2000/svg",
628
- viewBox: "0 0 24 24",
629
- fill: "none",
630
- stroke: "currentColor",
631
- strokeWidth: "2",
632
- strokeLinecap: "round",
633
- strokeLinejoin: "round",
634
- className: t,
635
- children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
636
- }
637
- );
638
- }
639
- function nn({ className: t }) {
640
- return /* @__PURE__ */ o(
641
- "svg",
642
- {
643
- xmlns: "http://www.w3.org/2000/svg",
644
- viewBox: "0 0 24 24",
645
- fill: "none",
646
- stroke: "currentColor",
647
- strokeWidth: "2",
648
- strokeLinecap: "round",
649
- strokeLinejoin: "round",
650
- className: t,
651
- children: [
652
- /* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
653
- /* @__PURE__ */ e("path", { d: "m6 6 12 12" })
654
- ]
655
- }
656
- );
657
- }
658
- function He({ className: t }) {
659
- return /* @__PURE__ */ o(
660
- "svg",
661
- {
662
- xmlns: "http://www.w3.org/2000/svg",
663
- viewBox: "0 0 24 24",
664
- fill: "none",
665
- stroke: "currentColor",
666
- strokeWidth: "2",
667
- strokeLinecap: "round",
668
- strokeLinejoin: "round",
669
- className: t,
670
- children: [
671
- /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
672
- /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
673
- /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
674
- /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
675
- ]
676
- }
677
- );
678
- }
679
- function bt({ className: t }) {
680
- return /* @__PURE__ */ o(
681
- "svg",
682
- {
683
- xmlns: "http://www.w3.org/2000/svg",
684
- viewBox: "0 0 24 24",
685
- fill: "none",
686
- stroke: "currentColor",
687
- strokeWidth: "2",
688
- strokeLinecap: "round",
689
- strokeLinejoin: "round",
690
- className: t,
691
- children: [
692
- /* @__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" }),
693
- /* @__PURE__ */ e("circle", { cx: "12", cy: "10", r: "3" })
694
- ]
695
- }
696
- );
697
- }
698
- function Ke({
699
- event: t,
700
- onClose: n
701
- }) {
702
- const r = de(t.color), a = t.isCanceled ?? !1;
703
- return /* @__PURE__ */ o("div", { className: "space-y-3", children: [
704
- /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
705
- /* @__PURE__ */ e("div", { className: s("size-4 rounded shrink-0 mt-0.5", r.dot) }),
706
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
707
- /* @__PURE__ */ e(
708
- "h3",
709
- {
710
- className: s(
711
- "font-semibold text-lg",
712
- a && "line-through opacity-50"
713
- ),
714
- children: t.title
715
- }
716
- ),
717
- /* @__PURE__ */ o("div", { className: "flex items-center gap-1 text-sm text-muted-foreground mt-1", children: [
718
- /* @__PURE__ */ e(qe, { className: "h-4 w-4 shrink-0" }),
719
- /* @__PURE__ */ e("span", { className: "tabular-nums", children: Y(t) })
720
- ] })
721
- ] })
722
- ] }),
723
- t.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t.description }),
724
- /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-1.5", children: [
725
- t.isAllDay && /* @__PURE__ */ e("span", { className: "text-xs bg-muted px-2 py-0.5 rounded-full font-medium", children: "All day" }),
726
- t.isRecurring && /* @__PURE__ */ e("span", { className: "text-xs bg-muted px-2 py-0.5 rounded-full font-medium", children: "Recurring" }),
727
- 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" })
728
- ] }),
729
- /* @__PURE__ */ e("div", { className: "flex justify-end pt-2 border-t", children: /* @__PURE__ */ e(
730
- "button",
731
- {
732
- type: "button",
733
- onClick: n,
734
- className: "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",
735
- children: "Close"
736
- }
737
- ) })
738
- ] });
739
- }
740
- function wt({
741
- event: t,
742
- position: n,
743
- hourHeight: r = 96,
744
- badgeVariant: a = "colored",
745
- onClick: d,
746
- className: p,
747
- disablePopover: i = !1,
748
- renderPopover: y,
749
- enableDrag: C = !0
750
- }) {
751
- const l = de(t.color), [b, v] = Z(!1), [u, x] = Z(!1), f = Ge(), N = ut();
752
- ke(() => {
753
- if (!i && N?.focusEventId && N.focusEventId === t.id) {
754
- const z = setTimeout(() => {
755
- v(!0), N.clearFocusEventId();
756
- }, 300);
757
- return () => clearTimeout(z);
758
- }
759
- }, [N?.focusEventId, t.id, i]);
760
- const g = (t.endDate.getTime() - t.startDate.getTime()) / (1e3 * 60), W = g / 60 * r - 8, S = t.endDate < yt(/* @__PURE__ */ new Date()), T = t.isCanceled ?? !1, I = C && f && !T && !S, G = g <= 20, F = g < 35, O = g > 20, A = g >= 45, E = t.data, $ = E?.productName, P = E?.extendedProps, k = E?.nrParticipant, h = E?.siteName, R = E?.siteCity, _ = !!h || !!R, B = a === "dot", w = L(() => {
761
- u || (i && d ? d(t) : i || v(!0));
762
- }, [u, i, d, t]), c = L(() => {
763
- v(!1);
764
- }, []), m = L(
765
- (z) => {
766
- if (!I) return;
767
- z.dataTransfer.effectAllowed = "move", z.dataTransfer.setData("text/plain", t.id);
768
- const j = z.currentTarget, te = j.getBoundingClientRect();
769
- z.dataTransfer.setDragImage(
770
- j,
771
- z.clientX - te.left,
772
- z.clientY - te.top
773
- ), x(!0), f?.startDrag?.(t);
774
- },
775
- [I, t, f]
776
- ), M = L(() => {
777
- x(!1), f?.isDragging && f.endDrag?.();
778
- }, [f]), D = L(
779
- (z) => {
780
- (z.key === "Enter" || z.key === " ") && (z.preventDefault(), w());
781
- },
782
- [w]
783
- ), H = /* @__PURE__ */ e(
784
- "div",
785
- {
786
- role: "button",
787
- tabIndex: 0,
788
- draggable: !!I,
789
- onDragStart: m,
790
- onDragEnd: M,
791
- onKeyDown: D,
792
- onClick: u ? void 0 : w,
793
- className: s(
794
- "group flex w-full select-none overflow-hidden rounded-md border-l-[3px] text-xs text-left",
795
- "shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.12)]",
796
- "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
797
- "transition-all",
798
- I ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",
799
- u && "opacity-50",
800
- // Cancelled events get gray background with strikethrough
801
- T ? "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" : [
802
- // Colored/mixed variants
803
- !B && [l.bg, l.accentBorder, l.text],
804
- // Dot variant - neutral background
805
- B && "bg-neutral-50 dark:bg-neutral-900 border-l-neutral-400 dark:border-l-neutral-600"
806
- ],
807
- // Very short events: single-row inline layout
808
- G ? "flex-row items-center gap-1.5 px-2 py-0" : F ? "flex-col gap-0.5 px-2 py-0 justify-center" : "flex-col gap-0.5 px-2 py-1.5",
809
- p
810
- ),
811
- style: { height: `${Math.max(W, 20)}px` },
812
- children: G ? (
813
- /* Single-row layout for very short events (≤20min) */
814
- /* @__PURE__ */ o(Be, { children: [
815
- ["mixed", "dot"].includes(a) && !T && /* @__PURE__ */ e(
816
- "svg",
817
- {
818
- width: "8",
819
- height: "8",
820
- viewBox: "0 0 8 8",
821
- className: "event-dot shrink-0",
822
- "aria-hidden": "true",
823
- focusable: "false",
824
- children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4", className: l.dotFill })
825
- }
826
- ),
827
- /* @__PURE__ */ e(
828
- "span",
829
- {
830
- className: s(
831
- "font-semibold truncate leading-none text-[11px]",
832
- !T && B && "text-foreground"
833
- ),
834
- children: t.title
835
- }
836
- ),
837
- /* @__PURE__ */ e("span", { className: "shrink-0 text-[10px] leading-none opacity-75 tabular-nums", children: Y(t) })
838
- ] })
839
- ) : (
840
- /* Standard stacked layout for events > 20min */
841
- /* @__PURE__ */ o(Be, { children: [
842
- /* @__PURE__ */ o("div", { className: "flex items-start gap-1.5 min-w-0", children: [
843
- ["mixed", "dot"].includes(a) && !T && /* @__PURE__ */ e(
844
- "svg",
845
- {
846
- width: "8",
847
- height: "8",
848
- viewBox: "0 0 8 8",
849
- className: "event-dot shrink-0",
850
- "aria-hidden": "true",
851
- focusable: "false",
852
- children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4", className: l.dotFill })
853
- }
854
- ),
855
- /* @__PURE__ */ e("div", { className: "flex-1 min-w-0 overflow-hidden", children: /* @__PURE__ */ e(
856
- "p",
857
- {
858
- className: s(
859
- "font-semibold truncate leading-tight",
860
- !T && B && "text-foreground"
861
- ),
862
- children: t.title
863
- }
864
- ) })
865
- ] }),
866
- A && $ && /* @__PURE__ */ e(
867
- "p",
868
- {
869
- className: s(
870
- "text-[11px] truncate leading-tight",
871
- B ? "text-muted-foreground" : "opacity-80"
872
- ),
873
- children: $
874
- }
875
- ),
876
- A && P && P.length > 0 && /* @__PURE__ */ e(
877
- "div",
878
- {
879
- className: s(
880
- "flex flex-col text-[11px] leading-tight",
881
- B ? "text-muted-foreground" : "opacity-80"
882
- ),
883
- children: P.map((z, j) => /* @__PURE__ */ e("div", { children: z }, j))
884
- }
885
- ),
886
- k != null && k > 0 && /* @__PURE__ */ o(
887
- "div",
888
- {
889
- className: s(
890
- "flex items-center gap-1 text-[11px] leading-tight",
891
- B ? "text-muted-foreground" : "opacity-80"
892
- ),
893
- children: [
894
- /* @__PURE__ */ e(He, { className: "h-3 w-3 shrink-0" }),
895
- /* @__PURE__ */ o("span", { children: [
896
- k,
897
- " participant",
898
- k !== 1 ? "s" : ""
899
- ] })
900
- ]
901
- }
902
- ),
903
- O && /* @__PURE__ */ o(
904
- "div",
905
- {
906
- className: s(
907
- "flex items-center gap-1 text-[11px] tabular-nums leading-tight",
908
- B ? "text-muted-foreground" : "opacity-90"
909
- ),
910
- children: [
911
- /* @__PURE__ */ e(qe, { className: "h-3 w-3 shrink-0" }),
912
- /* @__PURE__ */ e("span", { children: Y(t) })
913
- ]
914
- }
915
- ),
916
- A && _ && /* @__PURE__ */ o(
917
- "div",
918
- {
919
- className: s(
920
- "flex items-center gap-1 text-[11px] truncate leading-tight",
921
- B ? "text-muted-foreground" : "opacity-80"
922
- ),
923
- children: [
924
- /* @__PURE__ */ e(bt, { className: "h-3 w-3 shrink-0" }),
925
- /* @__PURE__ */ o("span", { className: "truncate", children: [
926
- h,
927
- h && R ? ", " : "",
928
- R
929
- ] })
930
- ]
931
- }
932
- )
933
- ] })
934
- )
935
- }
936
- ), Q = /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
937
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
938
- $ && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: $ }),
939
- P && P.length > 0 && P.map((z, j) => /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: z }, j)),
940
- k != null && /* @__PURE__ */ o("div", { className: "text-xs text-muted-foreground", children: [
941
- k,
942
- " participant",
943
- k !== 1 ? "s" : ""
944
- ] }),
945
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Y(t) }),
946
- _ && /* @__PURE__ */ o("div", { className: "text-xs text-muted-foreground", children: [
947
- h,
948
- h && R ? ", " : "",
949
- R
950
- ] })
951
- ] }) });
952
- return i ? /* @__PURE__ */ e(
953
- "div",
954
- {
955
- className: "absolute p-0.5",
956
- style: {
957
- top: `${n.top}px`,
958
- left: `${n.left}%`,
959
- width: n.minWidth ? `max(${n.minWidth}px, ${n.width}%)` : `${n.width}%`,
960
- minWidth: n.minWidth ? `${n.minWidth}px` : void 0
961
- },
962
- children: /* @__PURE__ */ o(ae, { children: [
963
- /* @__PURE__ */ e(se, { asChild: !0, children: H }),
964
- Q
965
- ] })
966
- }
967
- ) : /* @__PURE__ */ e(
968
- "div",
969
- {
970
- className: "absolute p-0.5",
971
- style: {
972
- top: `${n.top}px`,
973
- left: `${n.left}%`,
974
- width: n.minWidth ? `max(${n.minWidth}px, ${n.width}%)` : `${n.width}%`,
975
- minWidth: n.minWidth ? `${n.minWidth}px` : void 0
976
- },
977
- children: /* @__PURE__ */ o(ue, { open: b, onOpenChange: v, children: [
978
- /* @__PURE__ */ e(me, { asChild: !0, children: H }),
979
- /* @__PURE__ */ e(le, { className: "w-80", children: y ? y({ event: t, onClose: c }) : /* @__PURE__ */ e(Ke, { event: t, onClose: c }) })
980
- ] })
981
- }
982
- );
983
- }
984
- function Xn({
985
- event: t,
986
- spanDays: n,
987
- isStart: r,
988
- isEnd: a,
989
- onClick: d,
990
- className: p,
991
- disablePopover: i = !1,
992
- renderPopover: y
993
- }) {
994
- const C = de(t.color), [l, b] = Z(!1), v = t.isCanceled ?? !1, u = L(() => {
995
- i && d ? d(t) : i || b(!0);
996
- }, [i, d, t]), x = L(() => {
997
- b(!1);
998
- }, []), f = /* @__PURE__ */ e(
999
- "button",
1000
- {
1001
- type: "button",
1002
- onClick: u,
1003
- className: s(
1004
- "flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",
1005
- // Cancelled events get gray background with strikethrough
1006
- v ? "bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through" : [C.dot, "text-white"],
1007
- r && "rounded-l",
1008
- a && "rounded-r",
1009
- !r && "border-l-0",
1010
- !a && "border-r-0",
1011
- p
1012
- ),
1013
- style: { width: `${n * 100}%` },
1014
- children: r && /* @__PURE__ */ e("span", { className: "truncate", children: t.title })
1015
- }
1016
- ), N = /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
1017
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
1018
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Y(t) })
1019
- ] }) });
1020
- return i ? /* @__PURE__ */ o(ae, { children: [
1021
- /* @__PURE__ */ e(se, { asChild: !0, children: f }),
1022
- N
1023
- ] }) : /* @__PURE__ */ o(ue, { open: l, onOpenChange: b, children: [
1024
- /* @__PURE__ */ e(me, { asChild: !0, children: f }),
1025
- /* @__PURE__ */ e(le, { className: "w-80", children: y ? y({ event: t, onClose: x }) : /* @__PURE__ */ e(Ke, { event: t, onClose: x }) })
1026
- ] });
1027
- }
1028
- if (typeof window < "u" && !document.getElementById("inno-calendar-event-marquee-style")) {
1029
- const t = document.createElement("style");
1030
- t.id = "inno-calendar-event-marquee-style", t.innerHTML = `
1031
- @keyframes event-marquee {
1032
- 0% { transform: translateX(0); }
1033
- 100% { transform: translateX(-50%); }
1034
- }
1035
- .event-marquee {
1036
- animation: event-marquee 28s linear infinite;
1037
- will-change: transform;
1038
- }
1039
- `, document.head.appendChild(t);
1040
- }
1041
- const Je = (t) => typeof t == "boolean" ? `${t}` : t === 0 ? "0" : t, Ze = Dt, vt = (t, n) => (r) => {
1042
- var a;
1043
- if (n?.variants == null) return Ze(t, r?.class, r?.className);
1044
- const { variants: d, defaultVariants: p } = n, i = Object.keys(d).map((l) => {
1045
- const b = r?.[l], v = p?.[l];
1046
- if (b === null) return null;
1047
- const u = Je(b) || Je(v);
1048
- return d[l][u];
1049
- }), y = r && Object.entries(r).reduce((l, b) => {
1050
- let [v, u] = b;
1051
- return u === void 0 || (l[v] = u), l;
1052
- }, {}), C = n == null || (a = n.compoundVariants) === null || a === void 0 ? void 0 : a.reduce((l, b) => {
1053
- let { class: v, className: u, ...x } = b;
1054
- return Object.entries(x).every((f) => {
1055
- let [N, g] = f;
1056
- return Array.isArray(g) ? g.includes({
1057
- ...p,
1058
- ...y
1059
- }[N]) : {
1060
- ...p,
1061
- ...y
1062
- }[N] === g;
1063
- }) ? [
1064
- ...l,
1065
- v,
1066
- u
1067
- ] : l;
1068
- }, []);
1069
- return Ze(t, i, C, r?.class, r?.className);
1070
- }, rn = vt(
1071
- "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",
1072
- {
1073
- variants: {
1074
- variant: {
1075
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
1076
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
1077
- outline: "border border-input active:!bg-zinc-100 hover:!bg-zinc-50 active:bg-white !bg-white hover:bg-accent hover:text-accent-foreground",
1078
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
1079
- ghost: "hover:bg-accent hover:text-accent-foreground",
1080
- link: "text-primary underline-offset-4 hover:underline"
1081
- },
1082
- size: {
1083
- default: "h-9 px-4 py-2",
1084
- sm: "h-8 rounded-md px-3 text-xs",
1085
- lg: "h-10 rounded-md px-8",
1086
- icon: "h-9 w-9"
1087
- }
1088
- },
1089
- defaultVariants: {
1090
- variant: "default",
1091
- size: "default"
1092
- }
1093
- }
1094
- ), pe = je(
1095
- ({ className: t, variant: n, size: r, loading: a, disabled: d, children: p, ...i }, y) => /* @__PURE__ */ o(
1096
- "button",
1097
- {
1098
- className: s(rn({ variant: n, size: r, className: t })),
1099
- ref: y,
1100
- disabled: d || a,
1101
- ...i,
1102
- children: [
1103
- a && /* @__PURE__ */ o(
1104
- "svg",
1105
- {
1106
- className: "animate-spin -ml-1 mr-2 size-4",
1107
- xmlns: "http://www.w3.org/2000/svg",
1108
- fill: "none",
1109
- viewBox: "0 0 24 24",
1110
- children: [
1111
- /* @__PURE__ */ e(
1112
- "circle",
1113
- {
1114
- className: "opacity-25",
1115
- cx: "12",
1116
- cy: "12",
1117
- r: "10",
1118
- stroke: "currentColor",
1119
- strokeWidth: "4"
1120
- }
1121
- ),
1122
- /* @__PURE__ */ e(
1123
- "path",
1124
- {
1125
- className: "opacity-75",
1126
- fill: "currentColor",
1127
- 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"
1128
- }
1129
- )
1130
- ]
1131
- }
1132
- ),
1133
- p
1134
- ]
1135
- }
1136
- )
1137
- );
1138
- pe.displayName = "Button";
1139
- const Qe = K.Root, et = K.Trigger, on = X.forwardRef(({ className: t, inset: n, children: r, ...a }, d) => /* @__PURE__ */ o(
1140
- K.SubTrigger,
1141
- {
1142
- ref: d,
1143
- className: s(
1144
- "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",
1145
- n && "pl-8",
1146
- t
1147
- ),
1148
- ...a,
1149
- children: [
1150
- r,
1151
- /* @__PURE__ */ e(Ht, { className: "ml-auto h-4 w-4" })
1152
- ]
1153
- }
1154
- ));
1155
- on.displayName = K.SubTrigger.displayName;
1156
- const an = X.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
1157
- K.SubContent,
1158
- {
1159
- ref: r,
1160
- className: s(
1161
- "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",
1162
- t
1163
- ),
1164
- ...n
1165
- }
1166
- ));
1167
- an.displayName = K.SubContent.displayName;
1168
- const Oe = X.forwardRef(({ className: t, sideOffset: n = 4, ...r }, a) => /* @__PURE__ */ e(K.Portal, { children: /* @__PURE__ */ e(
1169
- K.Content,
1170
- {
1171
- ref: a,
1172
- sideOffset: n,
1173
- className: s(
1174
- "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",
1175
- t
1176
- ),
1177
- ...r
1178
- }
1179
- ) }));
1180
- Oe.displayName = K.Content.displayName;
1181
- const Pe = X.forwardRef(({ className: t, inset: n, ...r }, a) => /* @__PURE__ */ e(
1182
- K.Item,
1183
- {
1184
- ref: a,
1185
- className: s(
1186
- "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",
1187
- n && "pl-8",
1188
- t
1189
- ),
1190
- ...r
1191
- }
1192
- ));
1193
- Pe.displayName = K.Item.displayName;
1194
- const sn = X.forwardRef(({ className: t, children: n, checked: r = !1, ...a }, d) => /* @__PURE__ */ o(
1195
- K.CheckboxItem,
1196
- {
1197
- ref: d,
1198
- className: s(
1199
- "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",
1200
- t
1201
- ),
1202
- checked: r,
1203
- ...a,
1204
- children: [
1205
- /* @__PURE__ */ e("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(K.ItemIndicator, { children: /* @__PURE__ */ e(Bt, { className: "h-4 w-4" }) }) }),
1206
- n
1207
- ]
1208
- }
1209
- ));
1210
- sn.displayName = K.CheckboxItem.displayName;
1211
- const ln = X.forwardRef(({ className: t, children: n, ...r }, a) => /* @__PURE__ */ o(
1212
- K.RadioItem,
1213
- {
1214
- ref: a,
1215
- className: s(
1216
- "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",
1217
- t
1218
- ),
1219
- ...r,
1220
- children: [
1221
- /* @__PURE__ */ e("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(K.ItemIndicator, { children: /* @__PURE__ */ e(Pt, { className: "h-2 w-2 fill-current" }) }) }),
1222
- n
1223
- ]
1224
- }
1225
- ));
1226
- ln.displayName = K.RadioItem.displayName;
1227
- const dn = X.forwardRef(({ className: t, inset: n, ...r }, a) => /* @__PURE__ */ e(
1228
- K.Label,
1229
- {
1230
- ref: a,
1231
- className: s("px-2 py-1.5 text-sm font-semibold", n && "pl-8", t),
1232
- ...r
1233
- }
1234
- ));
1235
- dn.displayName = K.Label.displayName;
1236
- const cn = X.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
1237
- K.Separator,
1238
- {
1239
- ref: r,
1240
- className: s("-mx-1 my-1 h-px bg-muted", t),
1241
- ...n
1242
- }
1243
- ));
1244
- cn.displayName = K.Separator.displayName;
1245
- const un = vt(
1246
- "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",
1247
- {
1248
- variants: {
1249
- variant: {
1250
- default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
1251
- secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
1252
- destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
1253
- outline: "text-foreground"
1254
- }
1255
- },
1256
- defaultVariants: { variant: "default" }
1257
- }
1258
- );
1259
- function mn({ className: t, variant: n, ...r }) {
1260
- return /* @__PURE__ */ e("div", { className: s(un({ variant: n }), t), ...r });
1261
- }
1262
- function hn({ className: t }) {
1263
- return /* @__PURE__ */ e(
1264
- "svg",
1265
- {
1266
- className: t,
1267
- xmlns: "http://www.w3.org/2000/svg",
1268
- width: "24",
1269
- height: "24",
1270
- viewBox: "0 0 24 24",
1271
- fill: "none",
1272
- stroke: "currentColor",
1273
- strokeWidth: "2",
1274
- strokeLinecap: "round",
1275
- strokeLinejoin: "round",
1276
- children: /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" })
1277
- }
1278
- );
1279
- }
1280
- function pn({ className: t }) {
1281
- return /* @__PURE__ */ e(
1282
- "svg",
1283
- {
1284
- className: t,
1285
- xmlns: "http://www.w3.org/2000/svg",
1286
- width: "24",
1287
- height: "24",
1288
- viewBox: "0 0 24 24",
1289
- fill: "none",
1290
- stroke: "currentColor",
1291
- strokeWidth: "2",
1292
- strokeLinecap: "round",
1293
- strokeLinejoin: "round",
1294
- children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
1295
- }
1296
- );
1297
- }
1298
- const fn = [
1299
- "January",
1300
- "February",
1301
- "March",
1302
- "April",
1303
- "May",
1304
- "June",
1305
- "July",
1306
- "August",
1307
- "September",
1308
- "October",
1309
- "November",
1310
- "December"
1311
- ];
1312
- function gn({
1313
- date: t,
1314
- view: n,
1315
- events: r = [],
1316
- onNavigatePrev: a,
1317
- onNavigateNext: d,
1318
- weekStartsOn: p = 1,
1319
- showEventCount: i = !0,
1320
- className: y
1321
- }) {
1322
- const C = fn[t.getMonth()], l = t.getFullYear(), b = i ? St(r, t, n, p) : 0, v = Mt(t, n);
1323
- return /* @__PURE__ */ o("div", { className: s("min-w-0 flex-1", y), children: [
1324
- /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 sm:gap-2 flex-wrap", children: [
1325
- /* @__PURE__ */ o("span", { className: "text-base sm:text-lg font-semibold truncate", children: [
1326
- C,
1327
- " ",
1328
- l
1329
- ] }),
1330
- i && /* @__PURE__ */ e(mn, { variant: "outline", className: "px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0", children: b })
1331
- ] }),
1332
- /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 sm:gap-2", children: [
1333
- /* @__PURE__ */ e(
1334
- pe,
1335
- {
1336
- variant: "outline",
1337
- size: "icon",
1338
- className: "size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",
1339
- onClick: a,
1340
- children: /* @__PURE__ */ e(hn, {})
1341
- }
1342
- ),
1343
- /* @__PURE__ */ e("p", { className: "text-xs sm:text-sm text-muted-foreground truncate", children: v }),
1344
- /* @__PURE__ */ e(
1345
- pe,
1346
- {
1347
- variant: "outline",
1348
- size: "icon",
1349
- className: "size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",
1350
- onClick: d,
1351
- children: /* @__PURE__ */ e(pn, {})
1352
- }
1353
- )
1354
- ] })
1355
- ] });
1356
- }
1357
- const xn = [
1358
- "JAN",
1359
- "FEB",
1360
- "MAR",
1361
- "APR",
1362
- "MAY",
1363
- "JUN",
1364
- "JUL",
1365
- "AUG",
1366
- "SEP",
1367
- "OCT",
1368
- "NOV",
1369
- "DEC"
1370
- ];
1371
- function yn({ onClick: t, className: n }) {
1372
- const r = /* @__PURE__ */ new Date();
1373
- return /* @__PURE__ */ o(
1374
- "button",
1375
- {
1376
- type: "button",
1377
- className: s(
1378
- "flex size-11 sm:size-14 flex-col items-start overflow-hidden rounded-lg border shrink-0",
1379
- "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1380
- "hover:bg-accent/50 transition-colors",
1381
- n
1382
- ),
1383
- onClick: t,
1384
- children: [
1385
- /* @__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: xn[r.getMonth()] }),
1386
- /* @__PURE__ */ e("p", { className: "flex w-full flex-1 items-center justify-center text-sm sm:text-lg font-bold", children: r.getDate() })
1387
- ]
1388
- }
1389
- );
1390
- }
1391
- function bn({ className: t }) {
1392
- return /* @__PURE__ */ o(
1393
- "svg",
1394
- {
1395
- className: t,
1396
- xmlns: "http://www.w3.org/2000/svg",
1397
- width: "24",
1398
- height: "24",
1399
- viewBox: "0 0 24 24",
1400
- fill: "none",
1401
- stroke: "currentColor",
1402
- strokeWidth: "2",
1403
- strokeLinecap: "round",
1404
- strokeLinejoin: "round",
1405
- children: [
1406
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
1407
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
1408
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }),
1409
- /* @__PURE__ */ e("path", { d: "M3 10h18" }),
1410
- /* @__PURE__ */ e("path", { d: "M8 14h.01" }),
1411
- /* @__PURE__ */ e("path", { d: "M12 14h.01" }),
1412
- /* @__PURE__ */ e("path", { d: "M16 14h.01" }),
1413
- /* @__PURE__ */ e("path", { d: "M8 18h.01" }),
1414
- /* @__PURE__ */ e("path", { d: "M12 18h.01" }),
1415
- /* @__PURE__ */ e("path", { d: "M16 18h.01" })
1416
- ]
1417
- }
1418
- );
1419
- }
1420
- function fe({ className: t }) {
1421
- return /* @__PURE__ */ o(
1422
- "svg",
1423
- {
1424
- className: t,
1425
- xmlns: "http://www.w3.org/2000/svg",
1426
- width: "24",
1427
- height: "24",
1428
- viewBox: "0 0 24 24",
1429
- fill: "none",
1430
- stroke: "currentColor",
1431
- strokeWidth: "2",
1432
- strokeLinecap: "round",
1433
- strokeLinejoin: "round",
1434
- children: [
1435
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
1436
- /* @__PURE__ */ e("path", { d: "M9 8h7" }),
1437
- /* @__PURE__ */ e("path", { d: "M8 12h6" }),
1438
- /* @__PURE__ */ e("path", { d: "M11 16h5" })
1439
- ]
1440
- }
1441
- );
1442
- }
1443
- function tt({ className: t }) {
1444
- return /* @__PURE__ */ e(
1445
- "svg",
1446
- {
1447
- className: t,
1448
- xmlns: "http://www.w3.org/2000/svg",
1449
- width: "24",
1450
- height: "24",
1451
- viewBox: "0 0 24 24",
1452
- fill: "none",
1453
- stroke: "currentColor",
1454
- strokeWidth: "2",
1455
- strokeLinecap: "round",
1456
- strokeLinejoin: "round",
1457
- children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" })
1458
- }
1459
- );
1460
- }
1461
- function wn({ className: t }) {
1462
- return /* @__PURE__ */ o(
1463
- "svg",
1464
- {
1465
- className: t,
1466
- xmlns: "http://www.w3.org/2000/svg",
1467
- width: "24",
1468
- height: "24",
1469
- viewBox: "0 0 24 24",
1470
- fill: "none",
1471
- stroke: "currentColor",
1472
- strokeWidth: "2",
1473
- strokeLinecap: "round",
1474
- strokeLinejoin: "round",
1475
- children: [
1476
- /* @__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" }),
1477
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" })
1478
- ]
1479
- }
1480
- );
1481
- }
1482
- function nt({ className: t }) {
1483
- return /* @__PURE__ */ o(
1484
- "svg",
1485
- {
1486
- className: t,
1487
- xmlns: "http://www.w3.org/2000/svg",
1488
- width: "24",
1489
- height: "24",
1490
- viewBox: "0 0 24 24",
1491
- fill: "none",
1492
- stroke: "currentColor",
1493
- strokeWidth: "2",
1494
- strokeLinecap: "round",
1495
- strokeLinejoin: "round",
1496
- children: [
1497
- /* @__PURE__ */ e("path", { d: "M5 12h14" }),
1498
- /* @__PURE__ */ e("path", { d: "M12 5v14" })
1499
- ]
1500
- }
1501
- );
1502
- }
1503
- function vn({ className: t }) {
1504
- return /* @__PURE__ */ o(
1505
- "svg",
1506
- {
1507
- className: t,
1508
- xmlns: "http://www.w3.org/2000/svg",
1509
- width: "24",
1510
- height: "24",
1511
- viewBox: "0 0 24 24",
1512
- fill: "none",
1513
- stroke: "currentColor",
1514
- strokeWidth: "2",
1515
- strokeLinecap: "round",
1516
- strokeLinejoin: "round",
1517
- children: [
1518
- /* @__PURE__ */ e("rect", { width: "7", height: "7", x: "3", y: "3", rx: "1" }),
1519
- /* @__PURE__ */ e("rect", { width: "7", height: "7", x: "3", y: "14", rx: "1" }),
1520
- /* @__PURE__ */ e("path", { d: "M14 4h7" }),
1521
- /* @__PURE__ */ e("path", { d: "M14 9h7" }),
1522
- /* @__PURE__ */ e("path", { d: "M14 15h7" }),
1523
- /* @__PURE__ */ e("path", { d: "M14 20h7" })
1524
- ]
1525
- }
1526
- );
1527
- }
1528
- function Nn({ className: t }) {
1529
- return /* @__PURE__ */ o(
1530
- "svg",
1531
- {
1532
- className: t,
1533
- xmlns: "http://www.w3.org/2000/svg",
1534
- width: "24",
1535
- height: "24",
1536
- viewBox: "0 0 24 24",
1537
- fill: "none",
1538
- stroke: "currentColor",
1539
- strokeWidth: "2",
1540
- strokeLinecap: "round",
1541
- strokeLinejoin: "round",
1542
- children: [
1543
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
1544
- /* @__PURE__ */ e("path", { d: "M12 3v18" })
1545
- ]
1546
- }
1547
- );
1548
- }
1549
- function kn({ className: t }) {
1550
- return /* @__PURE__ */ o(
1551
- "svg",
1552
- {
1553
- className: t,
1554
- xmlns: "http://www.w3.org/2000/svg",
1555
- width: "24",
1556
- height: "24",
1557
- viewBox: "0 0 24 24",
1558
- fill: "none",
1559
- stroke: "currentColor",
1560
- strokeWidth: "2",
1561
- strokeLinecap: "round",
1562
- strokeLinejoin: "round",
1563
- children: [
1564
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
1565
- /* @__PURE__ */ e("path", { d: "M3 12h18" }),
1566
- /* @__PURE__ */ e("path", { d: "M12 3v18" })
1567
- ]
1568
- }
1569
- );
1570
- }
1571
- function Dn({ className: t }) {
1572
- return /* @__PURE__ */ o(
1573
- "svg",
1574
- {
1575
- className: t,
1576
- xmlns: "http://www.w3.org/2000/svg",
1577
- width: "24",
1578
- height: "24",
1579
- viewBox: "0 0 24 24",
1580
- fill: "none",
1581
- stroke: "currentColor",
1582
- strokeWidth: "2",
1583
- strokeLinecap: "round",
1584
- strokeLinejoin: "round",
1585
- children: [
1586
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
1587
- /* @__PURE__ */ e("path", { d: "M3 9h18" }),
1588
- /* @__PURE__ */ e("path", { d: "M3 15h18" }),
1589
- /* @__PURE__ */ e("path", { d: "M9 3v18" }),
1590
- /* @__PURE__ */ e("path", { d: "M15 3v18" })
1591
- ]
1592
- }
1593
- );
1594
- }
1595
- const Cn = [
1596
- { value: "day", label: "Day", icon: vn },
1597
- { value: "week", label: "Week", icon: Nn },
1598
- { value: "month", label: "Month", icon: kn },
1599
- { value: "year", label: "Year", icon: Dn }
1600
- // { value: 'agenda', label: 'Agenda', icon: ListIcon }, NOTE: Not needed currently
1601
- ], rt = [
1602
- { value: "timeline-day", label: "1 Day", icon: fe },
1603
- { value: "timeline-3day", label: "3 Days", icon: fe },
1604
- { value: "timeline-week", label: "7 Days", icon: fe }
1605
- ], Sn = [
1606
- { value: "resource-day", label: "1 Day", icon: fe },
1607
- { value: "resource-week", label: "7 Days", icon: fe }
1608
- ];
1609
- function Yn({
1610
- currentDate: t,
1611
- view: n,
1612
- events: r = [],
1613
- onNavigateToday: a,
1614
- onNavigatePrev: d,
1615
- onNavigateNext: p,
1616
- onNavigate: i,
1617
- onViewChange: y,
1618
- onAddEvent: C,
1619
- availableViews: l = ["day", "week", "month", "agenda"],
1620
- showTimelineViews: b = !1,
1621
- timelineViews: v,
1622
- settingsContent: u,
1623
- showSettings: x = !1,
1624
- filterContent: f,
1625
- actions: N,
1626
- className: g,
1627
- weekStartsOn: W = 1,
1628
- headerConfig: S,
1629
- labels: T = {}
1630
- }) {
1631
- const I = S?.showToday ?? !0, G = S?.showDateNavigator ?? !0, F = S?.showCalendarViews ?? !0, O = S?.showResourceViews ?? b, A = S?.showSettings ?? x, E = S?.showAddEvent ?? !0, $ = S?.showFilters ?? !0, P = q(
1632
- () => ({
1633
- today: "Today",
1634
- addEvent: "Add Event",
1635
- calendarView: "Calendar View",
1636
- resourceView: "Resource View",
1637
- ...T
1638
- }),
1639
- [T]
1640
- ), k = () => {
1641
- a?.(), i?.("today");
1642
- }, h = () => {
1643
- d?.(), i?.("prev");
1644
- }, R = () => {
1645
- p?.(), i?.("next");
1646
- }, _ = ["day", "week", "month", "year", "agenda"].includes(
1647
- n
1648
- ), B = n.startsWith("timeline-") || n.startsWith("resource-"), w = Cn.filter(
1649
- (D) => l.includes(D.value)
1650
- ), c = _ ? w.find((D) => D.value === n) : null, m = [...rt, ...Sn], M = B ? m.find((D) => D.value === n) : null;
1651
- return /* @__PURE__ */ o("div", { className: s("flex flex-col w-full gap-3 mb-2", g), children: [
1652
- /* @__PURE__ */ o("div", { className: "flex lg:flex-row flex-col w-full justify-between gap-3", children: [
1653
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2", children: [
1654
- /* @__PURE__ */ o("div", { className: "flex items-center gap-2 sm:gap-3 min-w-0", children: [
1655
- I && /* @__PURE__ */ e(yn, { onClick: k }),
1656
- G && /* @__PURE__ */ e(
1657
- gn,
1658
- {
1659
- date: t,
1660
- view: n,
1661
- events: r,
1662
- onNavigatePrev: h,
1663
- onNavigateNext: R,
1664
- weekStartsOn: W
1665
- }
1666
- )
1667
- ] }),
1668
- E && C && /* @__PURE__ */ e(
1669
- pe,
1670
- {
1671
- size: "icon",
1672
- className: "shrink-0 lg:hidden",
1673
- onClick: C,
1674
- children: /* @__PURE__ */ e(nt, { className: "size-4" })
1675
- }
1676
- )
1677
- ] }),
1678
- /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 sm:gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-none", children: [
1679
- F && y && w.length > 0 && /* @__PURE__ */ o(Qe, { children: [
1680
- /* @__PURE__ */ o(
1681
- et,
1682
- {
1683
- className: s(
1684
- "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors",
1685
- "h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",
1686
- _ ? "bg-primary text-primary-foreground hover:bg-primary/90" : "border border-input bg-background hover:bg-accent hover:text-accent-foreground"
1687
- ),
1688
- children: [
1689
- /* @__PURE__ */ e(bn, { className: "size-4" }),
1690
- /* @__PURE__ */ e("span", { className: "text-xs sm:text-sm font-medium", children: c?.label ?? P.calendarView }),
1691
- /* @__PURE__ */ e(tt, { className: "size-3 opacity-60" })
1692
- ]
1693
- }
1694
- ),
1695
- /* @__PURE__ */ e(Oe, { align: "start", className: "min-w-[120px]", children: w.map((D) => {
1696
- const H = D.icon;
1697
- return /* @__PURE__ */ o(
1698
- Pe,
1699
- {
1700
- onClick: () => y(D.value),
1701
- className: s(
1702
- "gap-2",
1703
- n === D.value && "bg-accent"
1704
- ),
1705
- children: [
1706
- /* @__PURE__ */ e(H, { className: "size-4" }),
1707
- /* @__PURE__ */ e("span", { children: D.label })
1708
- ]
1709
- },
1710
- D.value
1711
- );
1712
- }) })
1713
- ] }),
1714
- O && y && /* @__PURE__ */ o(Qe, { children: [
1715
- /* @__PURE__ */ o(
1716
- et,
1717
- {
1718
- className: s(
1719
- "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors",
1720
- "h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",
1721
- B ? "bg-primary text-primary-foreground hover:bg-primary/90" : "border border-input bg-white hover:bg-zinc-50 hover:text-accent-foreground"
1722
- ),
1723
- children: [
1724
- /* @__PURE__ */ e(fe, { className: "size-4" }),
1725
- /* @__PURE__ */ e("span", { className: "text-xs sm:text-sm font-medium", children: M?.label ?? P.resourceView }),
1726
- /* @__PURE__ */ e(tt, { className: "size-3 opacity-60" })
1727
- ]
1728
- }
1729
- ),
1730
- /* @__PURE__ */ e(Oe, { align: "start", className: "min-w-[120px]", children: rt.map((D) => {
1731
- const H = D.icon;
1732
- return /* @__PURE__ */ o(
1733
- Pe,
1734
- {
1735
- onClick: () => y(D.value),
1736
- className: s(
1737
- "gap-2",
1738
- n === D.value && "bg-accent"
1739
- ),
1740
- children: [
1741
- /* @__PURE__ */ e(H, { className: "size-4" }),
1742
- /* @__PURE__ */ e("span", { children: D.label })
1743
- ]
1744
- },
1745
- D.value
1746
- );
1747
- }) })
1748
- ] }),
1749
- A && u && /* @__PURE__ */ o(ue, { children: [
1750
- /* @__PURE__ */ e(me, { asChild: !0, children: /* @__PURE__ */ e(
1751
- pe,
1752
- {
1753
- variant: "outline",
1754
- size: "icon",
1755
- className: "min-w-10 min-h-10 shrink-0 mx-0",
1756
- children: /* @__PURE__ */ e(wn, { className: "size-4 sm:size-5" })
1757
- }
1758
- ) }),
1759
- /* @__PURE__ */ e(
1760
- le,
1761
- {
1762
- className: "w-auto min-w-80 p-0",
1763
- align: "end",
1764
- sideOffset: 8,
1765
- children: /* @__PURE__ */ e("div", { className: "max-h-[70vh] overflow-y-auto p-4 space-y-6", children: u })
1766
- }
1767
- )
1768
- ] }),
1769
- N,
1770
- E && C && /* @__PURE__ */ o(
1771
- pe,
1772
- {
1773
- className: "hidden lg:flex shrink-0 max-h-10",
1774
- onClick: C,
1775
- children: [
1776
- /* @__PURE__ */ e(nt, { className: "size-4" }),
1777
- P.addEvent
1778
- ]
1779
- }
1780
- )
1781
- ] })
1782
- ] }),
1783
- $ && f && /* @__PURE__ */ e("div", { className: "flex items-center gap-2 pb-1 -mb-1 scrollbar-none", children: f })
1784
- ] });
1785
- }
1786
- function Jn({
1787
- events: t,
1788
- date: n,
1789
- daysAhead: r = 60,
1790
- badgeVariant: a = "colored",
1791
- onEventClick: d,
1792
- className: p,
1793
- renderEvent: i,
1794
- renderPopover: y,
1795
- slots: C,
1796
- classNames: l
1797
- }) {
1798
- const b = q(() => {
1799
- const u = new Date(n);
1800
- u.setHours(0, 0, 0, 0);
1801
- const x = new Date(u);
1802
- return x.setDate(x.getDate() + r), t.filter((f) => f.endDate >= u && f.startDate <= x);
1803
- }, [t, r, n]), v = q(() => {
1804
- const u = Tt(b), x = [];
1805
- for (const [f, N] of u)
1806
- x.push({
1807
- date: new Date(f),
1808
- dateKey: f,
1809
- events: N
1810
- });
1811
- return x.sort((f, N) => f.date.getTime() - N.date.getTime()), x;
1812
- }, [b]);
1813
- return v.length === 0 ? /* @__PURE__ */ e("div", { className: s("flex flex-col items-center justify-center h-full py-12", p), children: /* @__PURE__ */ o("div", { className: "text-center", children: [
1814
- /* @__PURE__ */ e("p", { className: "text-muted-foreground", children: "No events found" }),
1815
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground/70", children: "No events scheduled for this period" })
1816
- ] }) }) : /* @__PURE__ */ o("div", { className: s("flex flex-col h-full overflow-auto", l?.agendaList, p), children: [
1817
- /* @__PURE__ */ e("div", { className: "sticky top-0 z-10 bg-background border-b px-4 py-3", children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
1818
- /* @__PURE__ */ e("h2", { className: "text-lg font-medium", children: "Schedule" }),
1819
- /* @__PURE__ */ o("span", { className: "text-sm text-muted-foreground", children: [
1820
- b.length,
1821
- " event",
1822
- b.length !== 1 ? "s" : ""
1823
- ] })
1824
- ] }) }),
1825
- /* @__PURE__ */ e("div", { className: "flex-1", children: v.map(({ date: u, dateKey: x, events: f }) => {
1826
- const N = ce(u), g = u.toLocaleDateString([], { weekday: "short" }), W = u.getDate(), S = u.toLocaleDateString([], { month: "short" });
1827
- return /* @__PURE__ */ o("div", { className: s("", l?.agendaDayGroup), children: [
1828
- /* @__PURE__ */ e(
1829
- "div",
1830
- {
1831
- className: s(
1832
- "sticky top-[52px] z-10 bg-background px-4 py-3 border-b",
1833
- l?.agendaDayHeader
1834
- ),
1835
- children: /* @__PURE__ */ o("div", { className: "flex items-center gap-3", children: [
1836
- /* @__PURE__ */ o("div", { className: "flex flex-col items-center min-w-[40px]", children: [
1837
- /* @__PURE__ */ e(
1838
- "span",
1839
- {
1840
- className: s(
1841
- "text-[11px] font-medium uppercase tracking-wide",
1842
- N ? "text-primary" : "text-muted-foreground"
1843
- ),
1844
- children: g
1845
- }
1846
- ),
1847
- /* @__PURE__ */ e(
1848
- "span",
1849
- {
1850
- className: s(
1851
- "flex items-center justify-center rounded-full mt-0.5",
1852
- "size-10 text-xl font-normal",
1853
- N ? "bg-primary text-primary-foreground" : "text-foreground"
1854
- ),
1855
- children: W
1856
- }
1857
- )
1858
- ] }),
1859
- /* @__PURE__ */ o("span", { className: "text-sm text-muted-foreground", children: [
1860
- S,
1861
- " ",
1862
- u.getFullYear()
1863
- ] })
1864
- ] })
1865
- }
1866
- ),
1867
- /* @__PURE__ */ e("div", { className: "px-4 py-3 space-y-2 border-b last:border-b-0", children: f.map(
1868
- (T) => i ? /* @__PURE__ */ e("div", { children: i({ event: T, variant: "full" }) }, T.id) : /* @__PURE__ */ e(
1869
- Ee,
1870
- {
1871
- event: T,
1872
- variant: "full",
1873
- badgeVariant: a,
1874
- onClick: d,
1875
- disablePopover: !!d && !y,
1876
- renderPopover: y,
1877
- showTime: !0,
1878
- showDescription: !0,
1879
- showParticipants: !0,
1880
- ...l?.eventCard && { className: l.eventCard }
1881
- },
1882
- T.id
1883
- )
1884
- ) })
1885
- ] }, x);
1886
- }) })
1887
- ] });
1888
- }
1889
- const Ce = 360, Se = 480, Re = 280;
1890
- function Mn({
1891
- isOpen: t,
1892
- onClose: n,
1893
- date: r,
1894
- events: a,
1895
- anchorRect: d,
1896
- badgeVariant: p = "colored",
1897
- onEventClick: i,
1898
- renderEvent: y,
1899
- renderPopover: C,
1900
- className: l
1901
- }) {
1902
- const b = re(null), v = re(null), [u, x] = Z("closed"), f = re(null);
1903
- d && (f.current = d);
1904
- const N = d ?? f.current, g = q(
1905
- () => [...a].sort((A, E) => A.startDate.getTime() - E.startDate.getTime()),
1906
- [a]
1907
- ), W = q(() => {
1908
- const A = N;
1909
- if (!A)
1910
- return {
1911
- top: 0,
1912
- left: 0,
1913
- width: Ce,
1914
- maxHeight: Se
1915
- };
1916
- const E = typeof window < "u" ? window.innerWidth : 1200, $ = typeof window < "u" ? window.innerHeight : 800;
1917
- let P = A.left + A.width / 2 - Ce / 2;
1918
- P = Math.max(16, Math.min(P, E - Ce - 16));
1919
- const k = Math.min(a.length * 68 + 80, Se);
1920
- let h = A.top + A.height / 2 - k / 2;
1921
- return h = Math.max(16, Math.min(h, $ - k - 16)), { top: h, left: P, width: Ce, maxHeight: Se };
1922
- }, [N, a.length]);
1923
- Fe(() => {
1924
- if (t && N)
1925
- x("entering"), requestAnimationFrame(() => {
1926
- requestAnimationFrame(() => {
1927
- x("open");
1928
- });
1929
- });
1930
- else if (!t && (u === "open" || u === "entering")) {
1931
- x("exiting");
1932
- const A = setTimeout(() => {
1933
- x("closed"), f.current = null;
1934
- }, Re);
1935
- return () => clearTimeout(A);
1936
- }
1937
- }, [t, N]), ke(() => {
1938
- if (u === "closed") return;
1939
- const A = (E) => {
1940
- E.key === "Escape" && (E.stopPropagation(), n());
1941
- };
1942
- return document.addEventListener("keydown", A), () => document.removeEventListener("keydown", A);
1943
- }, [u, n]), ke(() => {
1944
- u === "open" && v.current && v.current.focus();
1945
- }, [u]);
1946
- const S = L(
1947
- (A) => {
1948
- A.target === b.current && n();
1949
- },
1950
- [n]
1951
- );
1952
- if (u === "closed") return null;
1953
- const T = u === "entering" || u === "exiting", I = N, G = T && I ? {
1954
- // Collapsed state: match the day cell exactly
1955
- position: "fixed",
1956
- top: I.top,
1957
- left: I.left,
1958
- width: I.width,
1959
- height: I.height,
1960
- maxHeight: I.height,
1961
- opacity: u === "entering" ? 0.7 : 0,
1962
- transform: "scale(1)",
1963
- borderRadius: "8px"
1964
- } : {
1965
- // Expanded state: full panel
1966
- position: "fixed",
1967
- top: W.top,
1968
- left: W.left,
1969
- width: W.width,
1970
- maxHeight: W.maxHeight,
1971
- opacity: 1,
1972
- transform: "scale(1)",
1973
- borderRadius: "12px"
1974
- }, F = T ? 0 : 1, O = r.toLocaleDateString(void 0, {
1975
- weekday: "long",
1976
- month: "long",
1977
- day: "numeric"
1978
- });
1979
- return /* @__PURE__ */ o(Be, { children: [
1980
- /* @__PURE__ */ e(
1981
- "div",
1982
- {
1983
- ref: b,
1984
- role: "presentation",
1985
- onClick: S,
1986
- className: "ic-expansion-backdrop",
1987
- style: {
1988
- position: "fixed",
1989
- inset: 0,
1990
- zIndex: 40,
1991
- backgroundColor: "rgba(0, 0, 0, 0.2)",
1992
- opacity: F,
1993
- transition: `opacity ${Re}ms cubic-bezier(0.32, 0.72, 0, 1)`
1994
- }
1995
- }
1996
- ),
1997
- /* @__PURE__ */ o(
1998
- "div",
1999
- {
2000
- ref: v,
2001
- role: "dialog",
2002
- "aria-modal": "true",
2003
- "aria-label": `Events for ${O}`,
2004
- tabIndex: -1,
2005
- className: s(
2006
- "ic-expansion-panel",
2007
- "!bg-white border border-border shadow-2xl overflow-hidden",
2008
- "focus:outline-none",
2009
- l
2010
- ),
2011
- style: {
2012
- ...G,
2013
- zIndex: 41,
2014
- transition: `all ${Re}ms cubic-bezier(0.32, 0.72, 0, 1)`,
2015
- willChange: "top, left, width, height, max-height, opacity, border-radius"
2016
- },
2017
- children: [
2018
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between px-4 py-3 border-b bg-muted/30", children: [
2019
- /* @__PURE__ */ o("div", { className: "flex flex-col", children: [
2020
- /* @__PURE__ */ e("span", { className: "text-sm font-semibold text-foreground", children: O }),
2021
- /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground", children: [
2022
- a.length,
2023
- " event",
2024
- a.length !== 1 ? "s" : ""
2025
- ] })
2026
- ] }),
2027
- /* @__PURE__ */ e(
2028
- "button",
2029
- {
2030
- type: "button",
2031
- onClick: n,
2032
- className: "flex items-center justify-center size-7 rounded-full hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",
2033
- "aria-label": "Close",
2034
- children: /* @__PURE__ */ o(
2035
- "svg",
2036
- {
2037
- width: "14",
2038
- height: "14",
2039
- viewBox: "0 0 24 24",
2040
- fill: "none",
2041
- stroke: "currentColor",
2042
- strokeWidth: "2",
2043
- strokeLinecap: "round",
2044
- strokeLinejoin: "round",
2045
- children: [
2046
- /* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
2047
- /* @__PURE__ */ e("path", { d: "m6 6 12 12" })
2048
- ]
2049
- }
2050
- )
2051
- }
2052
- )
2053
- ] }),
2054
- /* @__PURE__ */ o(
2055
- "div",
2056
- {
2057
- className: "overflow-y-auto px-3 py-2 space-y-1.5",
2058
- style: { maxHeight: `${Se - 64}px` },
2059
- children: [
2060
- g.map((A) => /* @__PURE__ */ e("div", { onPointerDown: (E) => E.stopPropagation(), children: y ? y({ event: A, variant: "compact" }) : /* @__PURE__ */ e(
2061
- Ee,
2062
- {
2063
- event: A,
2064
- variant: "compact",
2065
- badgeVariant: p,
2066
- onClick: i,
2067
- renderPopover: C,
2068
- showTime: !0
2069
- }
2070
- ) }, A.id)),
2071
- a.length === 0 && /* @__PURE__ */ e("div", { className: "py-6 text-center text-sm text-muted-foreground", children: "No events" })
2072
- ]
2073
- }
2074
- )
2075
- ]
2076
- }
2077
- )
2078
- ] });
2079
- }
2080
- function Tn({
2081
- event: t,
2082
- date: n,
2083
- onEventClick: r,
2084
- disablePopover: a,
2085
- renderPopover: d
2086
- }) {
2087
- const [p, i] = Z(!1), y = de(t.color), C = ze(t), l = ie(t.startDate, n), b = ie(t.endDate, n), v = C && ie(t.startDate, t.endDate), u = L(() => {
2088
- a && r ? r(t) : a || i(!0);
2089
- }, [a, r, t]), x = L(() => {
2090
- i(!1);
2091
- }, []), f = /* @__PURE__ */ o(
2092
- "button",
2093
- {
2094
- type: "button",
2095
- onClick: u,
2096
- title: Y(t),
2097
- className: s(
2098
- "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium transition-opacity hover:opacity-80",
2099
- "sm:px-2 sm:py-1 sm:text-xs",
2100
- y.bg,
2101
- y.text,
2102
- t.isCanceled && "opacity-60 line-through"
2103
- ),
2104
- children: [
2105
- !v && l && !b && "→ ",
2106
- !v && !l && b && " ←",
2107
- !v && !l && !b && "↔ ",
2108
- /* @__PURE__ */ e("span", { className: "truncate max-w-24 sm:max-w-32", children: t.title }),
2109
- v && /* @__PURE__ */ e("span", { className: "text-[9px] opacity-70 sm:text-[10px]", children: "All day" })
2110
- ]
2111
- }
2112
- ), N = /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
2113
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.title }),
2114
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Y(t) })
2115
- ] }) });
2116
- return a ? /* @__PURE__ */ o(ae, { children: [
2117
- /* @__PURE__ */ e(se, { asChild: !0, children: f }),
2118
- N
2119
- ] }) : /* @__PURE__ */ o(ue, { open: p, onOpenChange: i, children: [
2120
- /* @__PURE__ */ e(me, { asChild: !0, children: f }),
2121
- /* @__PURE__ */ e(le, { className: "w-80", children: d ? d({ event: t, onClose: x }) : /* @__PURE__ */ e(zn, { event: t, onClose: x }) })
2122
- ] });
2123
- }
2124
- function zn({
2125
- event: t,
2126
- onClose: n
2127
- }) {
2128
- const r = de(t.color), a = t.isCanceled ?? !1;
2129
- return /* @__PURE__ */ o("div", { className: "space-y-3", children: [
2130
- /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
2131
- /* @__PURE__ */ e("div", { className: s("size-4 rounded shrink-0 mt-0.5", r.dot) }),
2132
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
2133
- /* @__PURE__ */ e("h3", { className: s("font-semibold text-lg", a && "line-through opacity-50"), children: t.title }),
2134
- /* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums", children: Y(t) })
2135
- ] })
2136
- ] }),
2137
- t.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t.description }),
2138
- /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-1.5", children: [
2139
- t.isAllDay && /* @__PURE__ */ e("span", { className: "text-xs bg-muted px-2 py-0.5 rounded-full font-medium", children: "All day" }),
2140
- 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" })
2141
- ] }),
2142
- /* @__PURE__ */ e("div", { className: "flex justify-end pt-2 border-t", children: /* @__PURE__ */ e(
2143
- "button",
2144
- {
2145
- type: "button",
2146
- onClick: n,
2147
- className: "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",
2148
- children: "Close"
2149
- }
2150
- ) })
2151
- ] });
2152
- }
2153
- function An({
2154
- events: t,
2155
- date: n,
2156
- onEventClick: r,
2157
- disablePopover: a = !1,
2158
- renderPopover: d,
2159
- className: p
2160
- }) {
2161
- if (t.length === 0) return null;
2162
- const i = t.some((l) => ze(l) && ie(l.startDate, l.endDate)), y = t.some(
2163
- (l) => !ie(l.startDate, l.endDate) || ze(l) && !ie(l.startDate, l.endDate)
2164
- ), C = i && y ? "All day / Multi-day" : i ? "All day" : "Multi-day";
2165
- return /* @__PURE__ */ o("div", { className: s("border-b bg-muted/20 px-2 py-1.5 space-y-1", "sm:px-4 sm:py-2", p), children: [
2166
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-muted-foreground sm:text-xs", children: C }),
2167
- /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: t.map((l) => /* @__PURE__ */ e(
2168
- Tn,
2169
- {
2170
- event: l,
2171
- date: n,
2172
- onEventClick: r,
2173
- disablePopover: a,
2174
- renderPopover: d
2175
- },
2176
- l.id
2177
- )) })
2178
- ] });
2179
- }
2180
- const En = 5;
2181
- function Nt({
2182
- slot: t,
2183
- onSelectionStart: n,
2184
- onSelectionMove: r,
2185
- onSelectionEnd: a,
2186
- isSelected: d = !1,
2187
- isSelecting: p = !1,
2188
- disabled: i = !1,
2189
- ariaLabel: y,
2190
- children: C,
2191
- className: l,
2192
- height: b,
2193
- style: v,
2194
- dataAttributes: u
2195
- }) {
2196
- const x = re(null), f = re(!1), N = re(!1), g = re(null), [W, S] = Z(!1), T = Ge(), I = L(
2197
- (k) => {
2198
- i || k.button !== 0 && k.pointerType === "mouse" || (k.preventDefault(), x.current = { x: k.clientX, y: k.clientY }, f.current = !1, N.current = !0, n?.(t));
2199
- },
2200
- [i, t, n]
2201
- ), G = L(
2202
- (k) => {
2203
- if (!(x.current && N.current && !i)) return;
2204
- const h = k.clientX - x.current.x, R = k.clientY - x.current.y;
2205
- Math.sqrt(h * h + R * R) >= En && (f.current = !0);
2206
- },
2207
- [i]
2208
- ), F = L(
2209
- (k) => {
2210
- i || (k.buttons > 0 || p) && r?.(t);
2211
- },
2212
- [i, p, t, r]
2213
- ), O = L(() => {
2214
- i || (a?.(), x.current = null, f.current = !1, N.current = !1);
2215
- }, [i, a]), A = L(
2216
- (k) => {
2217
- if (!T?.isDragging || i) return;
2218
- k.preventDefault(), k.dataTransfer.dropEffect = "move", S(!0);
2219
- const h = /* @__PURE__ */ new Date(), R = t.hour ?? h.getHours(), _ = t.minute ?? (h.getMinutes() >= 30 ? 30 : 0);
2220
- T.updateDragPreview?.(t.date, R, _);
2221
- },
2222
- [T, i, t]
2223
- ), E = L(() => {
2224
- S(!1);
2225
- }, []), $ = L(
2226
- (k) => {
2227
- k.preventDefault(), S(!1), !(!T?.isDragging || i) && T.endDrag?.();
2228
- },
2229
- [T, i]
2230
- );
2231
- ke(() => {
2232
- const k = () => {
2233
- N.current && (N.current = !1, x.current = null, f.current = !1);
2234
- };
2235
- return window.addEventListener("pointerup", k), window.addEventListener("pointercancel", k), () => {
2236
- window.removeEventListener("pointerup", k), window.removeEventListener("pointercancel", k);
2237
- };
2238
- }, []);
2239
- const P = L(
2240
- (k) => {
2241
- i || (k.key === "Enter" || k.key === " ") && (k.preventDefault(), n?.(t), a?.());
2242
- },
2243
- [i, t, n, a]
2244
- );
2245
- return /* @__PURE__ */ e(
2246
- "button",
2247
- {
2248
- ref: g,
2249
- type: "button",
2250
- "aria-label": y,
2251
- "aria-disabled": i,
2252
- "aria-pressed": d,
2253
- disabled: i,
2254
- onPointerDown: I,
2255
- onPointerMove: G,
2256
- onPointerUp: O,
2257
- onPointerEnter: F,
2258
- onKeyDown: P,
2259
- onDragOver: A,
2260
- onDragLeave: E,
2261
- onDrop: $,
2262
- className: s(
2263
- "select-none touch-none cursor-pointer transition-colors",
2264
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
2265
- // Hover state (only when not in selection)
2266
- !(p || i) && "hover:bg-blue-50/60",
2267
- // Selection state — blue tint matching the primary color
2268
- d && "bg-blue-100/70",
2269
- // Drag over state - visual feedback when event is dragged over
2270
- W && "bg-primary/20 ring-2 ring-primary ring-inset",
2271
- // Disabled state
2272
- i && "cursor-not-allowed opacity-50",
2273
- l
2274
- ),
2275
- style: { height: b, ...v },
2276
- ...u,
2277
- children: C
2278
- }
2279
- );
2280
- }
2281
- function kt({
2282
- slot: t,
2283
- date: n,
2284
- hour: r,
2285
- minute: a,
2286
- ariaLabel: d,
2287
- ...p
2288
- }) {
2289
- const i = t ?? { date: n, hour: r ?? 0, minute: a ?? 0 }, y = d ?? `Add event at ${(i.hour ?? 0).toString().padStart(2, "0")}:${(i.minute ?? 0).toString().padStart(2, "0")} on ${i.date.toLocaleDateString()}`;
2290
- return /* @__PURE__ */ e(Nt, { slot: i, ariaLabel: y, ...p });
2291
- }
2292
- function Ln({ slot: t, date: n, ariaLabel: r, ...a }) {
2293
- const d = t ?? { date: n }, p = r ?? `Select ${d.date.toLocaleDateString()}`;
2294
- return /* @__PURE__ */ e(Nt, { slot: d, ariaLabel: p, ...a });
2295
- }
2296
- const we = 96, _e = 72, Ie = 80;
2297
- function Zn({
2298
- events: t,
2299
- date: n,
2300
- visibleHours: r = { startHour: 0, endHour: 24 },
2301
- workingHours: a,
2302
- slotDuration: d = 30,
2303
- badgeVariant: p = "colored",
2304
- onEventClick: i,
2305
- onSlotSelect: y,
2306
- className: C,
2307
- renderEvent: l,
2308
- renderPopover: b,
2309
- slots: v,
2310
- classNames: u
2311
- }) {
2312
- const x = 60 / d, f = 100 / x, N = q(() => {
2313
- const w = [];
2314
- for (let c = 0; c < x; c++)
2315
- w.push(c * d);
2316
- return w;
2317
- }, [x, d]), g = q(() => Ve(t, n), [t, n]), { singleDay: W, multiDay: S } = q(() => it(g), [g]), T = q(() => {
2318
- const w = lt(W, n, r, we), c = /* @__PURE__ */ new Map();
2319
- for (const m of w)
2320
- c.set(m.event.id, m.position);
2321
- return c;
2322
- }, [W, n, r]), I = q(() => dt(r), [r]), G = /* @__PURE__ */ new Date(), F = ce(n), O = q(() => {
2323
- if (!F) return 0;
2324
- const w = G.getHours() + G.getMinutes() / 60;
2325
- return w < r.startHour || w > r.endHour ? -1 : (w - r.startHour) * we;
2326
- }, [F, r, G]), A = re(null);
2327
- Fe(() => {
2328
- const w = A.current;
2329
- if (!w) return;
2330
- const c = () => {
2331
- let m;
2332
- if (F) {
2333
- const D = (/* @__PURE__ */ new Date()).getHours();
2334
- m = Math.max(D - 1, r.startHour);
2335
- } else {
2336
- const D = n.getDay(), H = a?.[D];
2337
- H?.enabled && H.from > 0 ? m = Math.max(H.from - 1, r.startHour) : m = Math.max(7, r.startHour);
2338
- }
2339
- const M = (m - r.startHour) * we;
2340
- w.scrollTo({
2341
- top: M,
2342
- behavior: "instant"
2343
- });
2344
- };
2345
- requestAnimationFrame(() => {
2346
- requestAnimationFrame(c);
2347
- });
2348
- }, [n, a, r, F]);
2349
- const E = Ue(), $ = L(
2350
- (w) => {
2351
- E?.startSelection(w);
2352
- },
2353
- [E]
2354
- ), P = L(
2355
- (w) => {
2356
- E?.updateSelection(w);
2357
- },
2358
- [E]
2359
- ), k = L(() => {
2360
- E?.endSelection();
2361
- }, [E]), h = L(
2362
- (w) => {
2363
- i?.(w);
2364
- },
2365
- [i]
2366
- ), R = n.toLocaleDateString([], { weekday: "short" }), _ = n.getDate(), B = ce(n);
2367
- return /* @__PURE__ */ o("div", { className: s("flex flex-col h-full", C), children: [
2368
- /* @__PURE__ */ e(
2369
- "div",
2370
- {
2371
- className: s(
2372
- "flex items-center gap-3 border-b px-4 py-3",
2373
- u?.columnHeader,
2374
- B && u?.columnHeaderToday
2375
- ),
2376
- children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center", children: [
2377
- /* @__PURE__ */ e(
2378
- "span",
2379
- {
2380
- className: s(
2381
- "text-[11px] font-medium uppercase tracking-wide",
2382
- B ? "text-primary" : "text-muted-foreground"
2383
- ),
2384
- children: R
2385
- }
2386
- ),
2387
- /* @__PURE__ */ e(
2388
- "span",
2389
- {
2390
- className: s(
2391
- "flex items-center justify-center rounded-full mt-0.5",
2392
- "size-12 text-3xl font-normal",
2393
- B ? "bg-primary text-primary-foreground" : "text-foreground"
2394
- ),
2395
- children: _
2396
- }
2397
- )
2398
- ] })
2399
- }
2400
- ),
2401
- S.length > 0 && /* @__PURE__ */ e(
2402
- An,
2403
- {
2404
- events: S,
2405
- date: n,
2406
- onEventClick: h,
2407
- disablePopover: !!i && !b,
2408
- renderPopover: b,
2409
- ...u?.multiDayBanner && { className: u.multiDayBanner }
2410
- }
2411
- ),
2412
- /* @__PURE__ */ e(
2413
- "div",
2414
- {
2415
- ref: A,
2416
- className: s("flex-1", u?.scrollContainer),
2417
- children: /* @__PURE__ */ o("div", { className: "relative min-h-full", children: [
2418
- I.map((w, c) => {
2419
- const M = !ct(n, w, a);
2420
- return /* @__PURE__ */ o(
2421
- "div",
2422
- {
2423
- className: s(
2424
- "relative flex",
2425
- M && "bg-calendar-disabled-hour",
2426
- u?.timeSlot,
2427
- M ? u?.timeSlotNonWorking : u?.timeSlotWorking
2428
- ),
2429
- style: { height: we },
2430
- children: [
2431
- /* @__PURE__ */ e(
2432
- "div",
2433
- {
2434
- className: s(
2435
- "relative flex-shrink-0 border-r border-border/50 bg-zinc-50 dark:bg-zinc-900",
2436
- u?.timeGutter
2437
- ),
2438
- style: { width: _e },
2439
- children: /* @__PURE__ */ e("div", { className: "absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center", children: c !== 0 && /* @__PURE__ */ e(
2440
- "span",
2441
- {
2442
- className: s(
2443
- "text-[10px] sm:text-xs text-muted-foreground",
2444
- u?.timeGutterLabel
2445
- ),
2446
- children: Ae(w)
2447
- }
2448
- ) })
2449
- }
2450
- ),
2451
- /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
2452
- F && !M && /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-primary/5" }),
2453
- c !== 0 && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-x-0 top-0 border-b border-border/50" }),
2454
- N.slice(1).map((D) => /* @__PURE__ */ e(
2455
- "div",
2456
- {
2457
- className: "pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",
2458
- style: { top: `${D / 60 * 100}%` }
2459
- },
2460
- D
2461
- )),
2462
- N.map((D, H) => {
2463
- const Q = { date: n, hour: w, minute: D };
2464
- return /* @__PURE__ */ e(
2465
- kt,
2466
- {
2467
- slot: Q,
2468
- onSelectionStart: $,
2469
- onSelectionMove: P,
2470
- onSelectionEnd: k,
2471
- isSelected: E?.isSlotSelected(Q) ?? !1,
2472
- isSelecting: E?.isSelecting ?? !1,
2473
- disabled: M,
2474
- className: "absolute inset-x-0",
2475
- style: {
2476
- top: `${H * f}%`,
2477
- height: `${f}%`
2478
- },
2479
- ariaLabel: `Add event at ${Ae(w)}:${String(D).padStart(2, "0")}`
2480
- },
2481
- D
2482
- );
2483
- })
2484
- ] })
2485
- ]
2486
- },
2487
- w
2488
- );
2489
- }),
2490
- /* @__PURE__ */ e(
2491
- "div",
2492
- {
2493
- className: "absolute top-0 bottom-0 right-0 pointer-events-none",
2494
- style: { left: _e },
2495
- children: W.map((w) => {
2496
- const c = T.get(w.id);
2497
- if (!c) return null;
2498
- const m = `calc(${c.width}% - 2px)`, M = `max(${Ie}px, ${m})`;
2499
- return l ? /* @__PURE__ */ e(
2500
- "div",
2501
- {
2502
- className: "absolute pointer-events-auto p-0.5",
2503
- style: {
2504
- top: `${c.top}px`,
2505
- left: `${c.left}%`,
2506
- width: M,
2507
- minWidth: `${Ie}px`
2508
- },
2509
- children: l({ event: w, position: c })
2510
- },
2511
- w.id
2512
- ) : /* @__PURE__ */ e(
2513
- wt,
2514
- {
2515
- event: w,
2516
- position: {
2517
- top: c.top,
2518
- left: c.left,
2519
- width: c.width,
2520
- minWidth: Ie
2521
- },
2522
- hourHeight: we,
2523
- badgeVariant: p,
2524
- onClick: i,
2525
- disablePopover: !!i && !b,
2526
- renderPopover: b,
2527
- className: s("pointer-events-auto", u?.eventCard)
2528
- },
2529
- w.id
2530
- );
2531
- })
2532
- }
2533
- ),
2534
- F && O >= 0 && /* @__PURE__ */ o(
2535
- "div",
2536
- {
2537
- className: s(
2538
- "absolute left-0 right-0 z-20 flex items-center pointer-events-none",
2539
- u?.currentTimeIndicator
2540
- ),
2541
- style: {
2542
- top: O,
2543
- left: _e
2544
- },
2545
- children: [
2546
- /* @__PURE__ */ e("div", { className: "h-2.5 w-2.5 -ml-1 rounded-full bg-red-500" }),
2547
- /* @__PURE__ */ e("div", { className: "flex-1 h-0.5 bg-red-500" })
2548
- ]
2549
- }
2550
- )
2551
- ] })
2552
- }
2553
- )
2554
- ] });
2555
- }
2556
- const Wn = [
2557
- { full: "Monday", short: "Mon", tiny: "M" },
2558
- { full: "Tuesday", short: "Tue", tiny: "T" },
2559
- { full: "Wednesday", short: "Wed", tiny: "W" },
2560
- { full: "Thursday", short: "Thu", tiny: "T" },
2561
- { full: "Friday", short: "Fri", tiny: "F" },
2562
- { full: "Saturday", short: "Sat", tiny: "S" },
2563
- { full: "Sunday", short: "Sun", tiny: "S" }
2564
- ], Rn = [
2565
- { full: "Sunday", short: "Sun", tiny: "S" },
2566
- { full: "Monday", short: "Mon", tiny: "M" },
2567
- { full: "Tuesday", short: "Tue", tiny: "T" },
2568
- { full: "Wednesday", short: "Wed", tiny: "W" },
2569
- { full: "Thursday", short: "Thu", tiny: "T" },
2570
- { full: "Friday", short: "Fri", tiny: "F" },
2571
- { full: "Saturday", short: "Sat", tiny: "S" }
2572
- ], ve = 3;
2573
- function Qn({
2574
- events: t,
2575
- date: n,
2576
- weekStartsOn: r = 1,
2577
- badgeVariant: a = "colored",
2578
- onEventClick: d,
2579
- onSlotSelect: p,
2580
- onDayClick: i,
2581
- className: y,
2582
- renderEvent: C,
2583
- renderPopover: l,
2584
- showMoreMode: b,
2585
- showMoreEventsInPopover: v = !1,
2586
- slots: u,
2587
- classNames: x
2588
- }) {
2589
- const f = b ?? (v ? "popover" : "expand"), N = u?.dayCellHeader, g = u?.dayCellFooter, [W, S] = Z(null), [T, I] = Z(null), G = q(() => zt(n, r), [n, r]), F = q(() => {
2590
- const h = /* @__PURE__ */ new Map();
2591
- for (const R of G) {
2592
- const _ = R.date.toDateString(), B = Ve(t, R.date);
2593
- B.sort((w, c) => w.startDate.getTime() - c.startDate.getTime()), h.set(_, B);
2594
- }
2595
- return h;
2596
- }, [G, t]), O = Ue(), A = L(
2597
- (h) => {
2598
- O?.startSelection(h);
2599
- },
2600
- [O]
2601
- ), E = L(
2602
- (h) => {
2603
- O?.updateSelection(h);
2604
- },
2605
- [O]
2606
- ), $ = L(() => {
2607
- O?.endSelection();
2608
- }, [O]), P = L(
2609
- (h) => {
2610
- i?.(h);
2611
- },
2612
- [i]
2613
- ), k = r === 0 ? Rn : Wn;
2614
- return /* @__PURE__ */ o("div", { className: s("flex flex-col h-full overflow-hidden", y), children: [
2615
- /* @__PURE__ */ e("div", { className: "flex flex-col flex-1 overflow-auto", children: /* @__PURE__ */ o("div", { className: "flex flex-col flex-1 min-w-[560px] sm:min-w-0", children: [
2616
- /* @__PURE__ */ e(
2617
- "div",
2618
- {
2619
- className: s(
2620
- "grid grid-cols-7 border-b !sticky !top-0 bg-background z-10",
2621
- x?.weekdayHeader
2622
- ),
2623
- children: k.map((h, R) => /* @__PURE__ */ o(
2624
- "div",
2625
- {
2626
- className: s(
2627
- "py-2 sm:py-2.5 text-center text-[11px] uppercase font-medium tracking-wide text-muted-foreground",
2628
- R >= 5 && "text-muted-foreground/70",
2629
- // Weekend
2630
- x?.weekdayLabel
2631
- ),
2632
- children: [
2633
- /* @__PURE__ */ e("span", { className: "sm:hidden", children: h.short }),
2634
- /* @__PURE__ */ e("span", { className: "hidden sm:inline", children: h.short })
2635
- ]
2636
- },
2637
- h.full
2638
- ))
2639
- }
2640
- ),
2641
- /* @__PURE__ */ e("div", { className: s("grid grid-cols-7 auto-rows-min", x?.monthGrid), children: G.map((h) => {
2642
- const R = h.date.toDateString(), _ = F.get(R) || [], B = ce(h.date), w = h.date.getDay() === 0 || h.date.getDay() === 6, c = _.length > ve;
2643
- return /* @__PURE__ */ o(
2644
- Ln,
2645
- {
2646
- date: h.date,
2647
- dataAttributes: { "data-day-key": R },
2648
- onSelectionStart: A,
2649
- onSelectionMove: E,
2650
- onSelectionEnd: $,
2651
- isSelected: O?.isSlotSelected({ date: h.date }) ?? !1,
2652
- isSelecting: O?.isSelecting ?? !1,
2653
- className: s(
2654
- "relative flex flex-col border-r border-b text-left min-h-[80px] sm:min-h-[100px] overflow-hidden",
2655
- "[&:nth-child(7n)]:border-r-0",
2656
- !h.isCurrentMonth && "bg-muted/20",
2657
- w && h.isCurrentMonth && "bg-muted/10",
2658
- x?.dayCell,
2659
- B && x?.dayCellToday,
2660
- !h.isCurrentMonth && x?.dayCellOutside,
2661
- w && x?.dayCellWeekend
2662
- ),
2663
- ariaLabel: `${h.date.toLocaleDateString()} - ${_.length} events. Click to create event, double-click to view day.`,
2664
- children: [
2665
- /* @__PURE__ */ e(
2666
- "div",
2667
- {
2668
- className: s(
2669
- "flex items-center justify-center p-1",
2670
- !h.isCurrentMonth && "text-muted-foreground/40",
2671
- x?.dayCellNumber
2672
- ),
2673
- children: /* @__PURE__ */ e(
2674
- "button",
2675
- {
2676
- type: "button",
2677
- onClick: (m) => {
2678
- m.stopPropagation(), P(h.date);
2679
- },
2680
- className: s(
2681
- "flex items-center justify-center rounded-full transition-colors",
2682
- "size-7 text-sm font-normal",
2683
- B ? "bg-primary text-primary-foreground" : "hover:bg-muted"
2684
- ),
2685
- children: h.date.getDate()
2686
- }
2687
- )
2688
- }
2689
- ),
2690
- N && /* @__PURE__ */ e(
2691
- N,
2692
- {
2693
- date: h.date,
2694
- events: _,
2695
- isToday: B,
2696
- isCurrentMonth: h.isCurrentMonth,
2697
- isWeekend: w,
2698
- view: "month"
2699
- }
2700
- ),
2701
- /* @__PURE__ */ o(
2702
- "div",
2703
- {
2704
- className: s(
2705
- "flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1",
2706
- x?.dayCellContent
2707
- ),
2708
- children: [
2709
- _.slice(0, ve).map((m) => /* @__PURE__ */ e(
2710
- "div",
2711
- {
2712
- onPointerDown: (M) => {
2713
- M.stopPropagation();
2714
- },
2715
- children: C ? C({ event: m, variant: "compact" }) : /* @__PURE__ */ e(
2716
- Ee,
2717
- {
2718
- event: m,
2719
- variant: "compact",
2720
- badgeVariant: a,
2721
- onClick: d,
2722
- disablePopover: !!d && !l,
2723
- renderPopover: l,
2724
- showTime: !1,
2725
- enableDrag: !0,
2726
- ...x?.eventCardCompact && {
2727
- className: x.eventCardCompact
2728
- }
2729
- }
2730
- )
2731
- },
2732
- m.id
2733
- )),
2734
- c && f === "expand" && /* @__PURE__ */ o(
2735
- "button",
2736
- {
2737
- type: "button",
2738
- onPointerDown: (m) => m.stopPropagation(),
2739
- onClick: (m) => {
2740
- m.stopPropagation();
2741
- const M = document.querySelector(`[data-day-key="${R}"]`);
2742
- I({
2743
- date: h.date,
2744
- events: _,
2745
- rect: M?.getBoundingClientRect() ?? new DOMRect(window.innerWidth / 2 - 180, window.innerHeight / 2 - 240, 0, 0)
2746
- });
2747
- },
2748
- className: s(
2749
- "w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",
2750
- x?.moreEventsIndicator
2751
- ),
2752
- children: [
2753
- "+",
2754
- _.length - ve,
2755
- " more"
2756
- ]
2757
- }
2758
- ),
2759
- c && f === "popover" && /* @__PURE__ */ o(
2760
- ue,
2761
- {
2762
- open: W === R,
2763
- onOpenChange: (m) => S(m ? R : null),
2764
- children: [
2765
- /* @__PURE__ */ e(me, { asChild: !0, children: /* @__PURE__ */ o(
2766
- "button",
2767
- {
2768
- type: "button",
2769
- onPointerDown: (m) => m.stopPropagation(),
2770
- onClick: (m) => {
2771
- m.stopPropagation(), S(R);
2772
- },
2773
- className: s(
2774
- "w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",
2775
- x?.moreEventsIndicator
2776
- ),
2777
- children: [
2778
- "+",
2779
- _.length - ve,
2780
- " more"
2781
- ]
2782
- }
2783
- ) }),
2784
- /* @__PURE__ */ o(
2785
- le,
2786
- {
2787
- align: "start",
2788
- side: "right",
2789
- sideOffset: 8,
2790
- className: "w-72 max-h-80 overflow-y-auto p-2",
2791
- onPointerDown: (m) => m.stopPropagation(),
2792
- children: [
2793
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-2 pb-2 border-b", children: [
2794
- /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: h.date.toLocaleDateString(void 0, {
2795
- weekday: "short",
2796
- month: "short",
2797
- day: "numeric"
2798
- }) }),
2799
- /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground", children: [
2800
- _.length,
2801
- " events"
2802
- ] })
2803
- ] }),
2804
- /* @__PURE__ */ e("div", { className: "space-y-1.5", children: _.map((m) => /* @__PURE__ */ e("div", { children: C ? C({ event: m, variant: "compact" }) : /* @__PURE__ */ e(
2805
- Ee,
2806
- {
2807
- event: m,
2808
- variant: "compact",
2809
- badgeVariant: a,
2810
- onClick: (M) => {
2811
- S(null), d?.(M);
2812
- },
2813
- disablePopover: !!d && !l,
2814
- renderPopover: l,
2815
- showTime: !0
2816
- }
2817
- ) }, m.id)) })
2818
- ]
2819
- }
2820
- )
2821
- ]
2822
- }
2823
- ),
2824
- c && f === "dayView" && /* @__PURE__ */ o(
2825
- "div",
2826
- {
2827
- onPointerDown: (m) => {
2828
- m.stopPropagation(), P(h.date);
2829
- },
2830
- className: s(
2831
- "w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",
2832
- x?.moreEventsIndicator
2833
- ),
2834
- children: [
2835
- "+",
2836
- _.length - ve,
2837
- " more"
2838
- ]
2839
- }
2840
- )
2841
- ]
2842
- }
2843
- ),
2844
- g && /* @__PURE__ */ e(
2845
- g,
2846
- {
2847
- date: h.date,
2848
- events: _,
2849
- isToday: B,
2850
- isCurrentMonth: h.isCurrentMonth,
2851
- isWeekend: w,
2852
- view: "month"
2853
- }
2854
- )
2855
- ]
2856
- },
2857
- R
2858
- );
2859
- }) })
2860
- ] }) }),
2861
- /* @__PURE__ */ e(
2862
- Mn,
2863
- {
2864
- isOpen: T !== null,
2865
- onClose: () => I(null),
2866
- date: T?.date ?? /* @__PURE__ */ new Date(),
2867
- events: T?.events ?? [],
2868
- anchorRect: T?.rect ?? null,
2869
- badgeVariant: a,
2870
- onEventClick: d,
2871
- renderEvent: C,
2872
- renderPopover: l
2873
- }
2874
- )
2875
- ] });
2876
- }
2877
- const Le = 26, ot = 2, Me = 4;
2878
- function at(t, n) {
2879
- const r = Xe(t);
2880
- for (let d = 0; d < n.length; d++) {
2881
- const p = n[d];
2882
- if (p && ie(r, p)) return d;
2883
- }
2884
- const a = n[0];
2885
- return a && r < Xe(a) ? -1 : 7;
2886
- }
2887
- function _n(t) {
2888
- const n = [...t].sort((a, d) => {
2889
- const p = a.endCol - a.startCol, i = d.endCol - d.startCol;
2890
- return i !== p ? i - p : a.startCol - d.startCol;
2891
- }), r = [];
2892
- return n.map((a) => {
2893
- let d = -1;
2894
- for (let i = 0; i < r.length; i++) {
2895
- const y = r[i];
2896
- if (!y) continue;
2897
- let C = !0;
2898
- for (let l = a.startCol; l <= a.endCol; l++)
2899
- if (y[l]) {
2900
- C = !1;
2901
- break;
2902
- }
2903
- if (C) {
2904
- d = i;
2905
- break;
2906
- }
2907
- }
2908
- d === -1 && (d = r.length, r.push(new Array(7).fill(!1)));
2909
- const p = r[d];
2910
- if (p)
2911
- for (let i = a.startCol; i <= a.endCol; i++)
2912
- p[i] = !0;
2913
- return { ...a, row: d };
2914
- });
2915
- }
2916
- function In({
2917
- pe: t,
2918
- onEventClick: n,
2919
- disablePopover: r,
2920
- renderPopover: a
2921
- }) {
2922
- const [d, p] = Z(!1), i = de(t.event.color), y = L(() => {
2923
- r && n ? n(t.event) : r || p(!0);
2924
- }, [r, n, t.event]), C = L(() => {
2925
- p(!1);
2926
- }, []), l = /* @__PURE__ */ o(
2927
- "button",
2928
- {
2929
- type: "button",
2930
- onClick: y,
2931
- className: s(
2932
- "inline-flex items-center gap-1 rounded text-[10px] font-medium transition-opacity hover:opacity-80 mx-0.5 overflow-hidden w-full",
2933
- "sm:text-xs",
2934
- i.bg,
2935
- i.text,
2936
- t.event.isCanceled && "opacity-60 line-through",
2937
- t.continuesBefore && "rounded-l-none -ml-0.5 pl-1",
2938
- t.continuesAfter && "rounded-r-none -mr-0.5 pr-1"
2939
- ),
2940
- style: {
2941
- height: Le,
2942
- lineHeight: `${Le}px`,
2943
- paddingLeft: t.continuesBefore ? 4 : 6,
2944
- paddingRight: t.continuesAfter ? 4 : 6
2945
- },
2946
- children: [
2947
- t.continuesBefore && /* @__PURE__ */ e("span", { className: "text-[9px] opacity-60 flex-shrink-0", children: "◂" }),
2948
- /* @__PURE__ */ e("span", { className: "truncate", children: t.event.title }),
2949
- t.isSingleDayAllDay && /* @__PURE__ */ e("span", { className: "text-[9px] opacity-70 flex-shrink-0 hidden sm:inline", children: "All day" }),
2950
- t.continuesAfter && /* @__PURE__ */ e("span", { className: "text-[9px] opacity-60 flex-shrink-0", children: "▸" })
2951
- ]
2952
- }
2953
- ), b = /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-0.5", children: [
2954
- /* @__PURE__ */ e("div", { className: "font-medium", children: t.event.title }),
2955
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground tabular-nums", children: Y(t.event) })
2956
- ] }) }), v = {
2957
- gridColumn: `${t.startCol + 2} / ${t.endCol + 3}`,
2958
- gridRow: t.row + 1
2959
- };
2960
- return r ? /* @__PURE__ */ e("div", { style: v, children: /* @__PURE__ */ o(ae, { children: [
2961
- /* @__PURE__ */ e(se, { asChild: !0, children: l }),
2962
- b
2963
- ] }) }) : /* @__PURE__ */ e("div", { style: v, children: /* @__PURE__ */ o(ue, { open: d, onOpenChange: p, children: [
2964
- /* @__PURE__ */ e(me, { asChild: !0, children: l }),
2965
- /* @__PURE__ */ e(le, { className: "w-80", children: a ? a({ event: t.event, onClose: C }) : /* @__PURE__ */ e(Bn, { event: t.event, onClose: C }) })
2966
- ] }) });
2967
- }
2968
- function Bn({
2969
- event: t,
2970
- onClose: n
2971
- }) {
2972
- const r = de(t.color), a = t.isCanceled ?? !1;
2973
- return /* @__PURE__ */ o("div", { className: "space-y-3", children: [
2974
- /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
2975
- /* @__PURE__ */ e("div", { className: s("size-4 rounded shrink-0 mt-0.5", r.dot) }),
2976
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
2977
- /* @__PURE__ */ e(
2978
- "h3",
2979
- {
2980
- className: s(
2981
- "font-semibold text-lg",
2982
- a && "line-through opacity-50"
2983
- ),
2984
- children: t.title
2985
- }
2986
- ),
2987
- /* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums", children: Y(t) })
2988
- ] })
2989
- ] }),
2990
- t.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t.description }),
2991
- /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-1.5", children: [
2992
- t.isAllDay && /* @__PURE__ */ e("span", { className: "text-xs bg-muted px-2 py-0.5 rounded-full font-medium", children: "All day" }),
2993
- 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" })
2994
- ] }),
2995
- /* @__PURE__ */ e("div", { className: "flex justify-end pt-2 border-t", children: /* @__PURE__ */ e(
2996
- "button",
2997
- {
2998
- type: "button",
2999
- onClick: n,
3000
- className: "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",
3001
- children: "Close"
3002
- }
3003
- ) })
3004
- ] });
3005
- }
3006
- function $n({
3007
- events: t,
3008
- weekDays: n,
3009
- hourColumnWidth: r,
3010
- minDayColumnWidth: a,
3011
- dayColumnWidths: d,
3012
- onEventClick: p,
3013
- disablePopover: i = !1,
3014
- renderPopover: y,
3015
- className: C
3016
- }) {
3017
- const l = q(() => {
3018
- if (t.length === 0) return [];
3019
- const g = t.map((W) => {
3020
- const S = at(W.startDate, n), T = at(W.endDate, n), I = Math.max(0, S), G = Math.min(6, T);
3021
- if (I > 6 || G < 0) return null;
3022
- const F = S < 0, O = T > 6, E = ze(W) && ie(W.startDate, W.endDate);
3023
- return {
3024
- event: W,
3025
- startCol: I,
3026
- endCol: G,
3027
- continuesBefore: F,
3028
- continuesAfter: O,
3029
- isSingleDayAllDay: E
3030
- };
3031
- }).filter(Boolean);
3032
- return _n(g);
3033
- }, [t, n]);
3034
- if (l.length === 0) return null;
3035
- const b = Math.max(...l.map((g) => g.row)) + 1, v = Math.min(b, Me), u = b > Me, x = u ? l.filter((g) => g.row >= Me).length : 0, f = [
3036
- `${r}px`,
3037
- ...d.map((g) => g > a ? `${g}px` : `minmax(${a}px, 1fr)`)
3038
- ].join(" "), N = v * Le + (v - 1) * ot + 8;
3039
- return /* @__PURE__ */ o(
3040
- "div",
3041
- {
3042
- className: s(
3043
- "ic-all-day-row border-b bg-muted/20 relative",
3044
- C
3045
- ),
3046
- style: {
3047
- display: "grid",
3048
- gridTemplateColumns: f,
3049
- gridTemplateRows: `repeat(${v}, ${Le}px)`,
3050
- gap: `${ot}px 0`,
3051
- paddingTop: 4,
3052
- paddingBottom: 4,
3053
- minHeight: N
3054
- },
3055
- children: [
3056
- /* @__PURE__ */ e(
3057
- "div",
3058
- {
3059
- className: "flex items-start justify-center pt-1 text-[10px] font-medium text-muted-foreground",
3060
- style: {
3061
- gridColumn: 1,
3062
- gridRow: `1 / span ${v}`
3063
- },
3064
- children: /* @__PURE__ */ e("span", { className: "hidden sm:inline", children: "All day" })
3065
- }
3066
- ),
3067
- n.map((g, W) => /* @__PURE__ */ e(
3068
- "div",
3069
- {
3070
- className: "pointer-events-none border-r last:border-r-0",
3071
- style: {
3072
- gridColumn: W + 2,
3073
- gridRow: `1 / span ${v}`
3074
- }
3075
- },
3076
- g.toDateString()
3077
- )),
3078
- l.filter((g) => g.row < Me).map((g) => /* @__PURE__ */ e(
3079
- In,
3080
- {
3081
- pe: g,
3082
- onEventClick: p,
3083
- disablePopover: i,
3084
- renderPopover: y
3085
- },
3086
- g.event.id
3087
- )),
3088
- u && /* @__PURE__ */ o(
3089
- "div",
3090
- {
3091
- className: "text-[10px] text-muted-foreground font-medium px-2 flex items-center",
3092
- style: {
3093
- gridColumn: `2 / ${n.length + 2}`,
3094
- gridRow: v
3095
- },
3096
- children: [
3097
- "+",
3098
- x,
3099
- " more"
3100
- ]
3101
- }
3102
- )
3103
- ]
3104
- }
3105
- );
3106
- }
3107
- const he = 96, Ne = 56, st = 72, ne = 120, Te = 100, Hn = 3;
3108
- function er({
3109
- events: t,
3110
- date: n,
3111
- weekStartsOn: r = 1,
3112
- visibleHours: a = { startHour: 0, endHour: 24 },
3113
- workingHours: d,
3114
- slotDuration: p = 30,
3115
- badgeVariant: i = "colored",
3116
- onEventClick: y,
3117
- onSlotSelect: C,
3118
- onDayClick: l,
3119
- className: b,
3120
- renderEvent: v,
3121
- renderPopover: u,
3122
- slots: x,
3123
- classNames: f
3124
- }) {
3125
- const N = 60 / p, g = 100 / N, W = q(() => {
3126
- const c = [];
3127
- for (let m = 0; m < N; m++)
3128
- c.push(m * p);
3129
- return c;
3130
- }, [N, p]), S = q(
3131
- () => At(n, r),
3132
- [n, r]
3133
- ), T = q(
3134
- () => dt(a),
3135
- [a]
3136
- ), I = q(() => {
3137
- const c = /* @__PURE__ */ new Map();
3138
- for (const m of S) {
3139
- const M = m.toDateString(), D = Ve(t, m), { singleDay: H, multiDay: Q } = it(D), z = lt(
3140
- H,
3141
- m,
3142
- a,
3143
- he
3144
- ), j = /* @__PURE__ */ new Map();
3145
- let te = 1;
3146
- for (const J of z)
3147
- if (j.set(J.event.id, J.position), J.position.width > 0) {
3148
- const ee = Math.round(100 / J.position.width);
3149
- te = Math.max(te, ee);
3150
- }
3151
- c.set(M, {
3152
- singleDay: H,
3153
- multiDay: Q,
3154
- positions: j,
3155
- maxOverlapping: te
3156
- });
3157
- }
3158
- return c;
3159
- }, [S, t, a]), G = q(() => {
3160
- const c = /* @__PURE__ */ new Map();
3161
- for (const { multiDay: m } of I.values())
3162
- for (const M of m)
3163
- c.set(M.id, M);
3164
- return Array.from(c.values());
3165
- }, [I]), F = /* @__PURE__ */ new Date(), O = S.findIndex((c) => ce(c)), A = q(() => {
3166
- if (O < 0) return -1;
3167
- const c = F.getHours() + F.getMinutes() / 60;
3168
- return c < a.startHour || c > a.endHour ? -1 : (c - a.startHour) * he;
3169
- }, [O, a, F]), E = re(null);
3170
- Fe(() => {
3171
- const c = E.current;
3172
- if (!c) return;
3173
- const m = () => {
3174
- let M;
3175
- if (O !== -1) {
3176
- const H = (/* @__PURE__ */ new Date()).getHours();
3177
- M = Math.max(H - 1, a.startHour);
3178
- } else {
3179
- const Q = (/* @__PURE__ */ new Date()).getDay();
3180
- let z = d?.[Q];
3181
- if (!z?.enabled || z.from === 0) {
3182
- const j = d?.[1];
3183
- j?.enabled && (z = j);
3184
- }
3185
- z?.enabled && z.from > 0 ? M = Math.max(
3186
- z.from - 1,
3187
- a.startHour
3188
- ) : M = Math.max(7, a.startHour);
3189
- }
3190
- const D = (M - a.startHour) * he;
3191
- c.scrollTo({
3192
- top: D,
3193
- behavior: "instant"
3194
- });
3195
- };
3196
- requestAnimationFrame(() => {
3197
- requestAnimationFrame(m);
3198
- });
3199
- }, [n, d, a, O]);
3200
- const $ = Ue(), P = L(
3201
- (c) => {
3202
- $?.startSelection(c);
3203
- },
3204
- [$]
3205
- ), k = L(
3206
- (c) => {
3207
- $?.updateSelection(c);
3208
- },
3209
- [$]
3210
- ), h = L(() => {
3211
- $?.endSelection();
3212
- }, [$]), R = L(
3213
- (c) => {
3214
- y?.(c);
3215
- },
3216
- [y]
3217
- ), _ = Ne + 7 * ne, B = q(() => {
3218
- const c = [];
3219
- for (const m of S) {
3220
- const M = m.toDateString(), H = I.get(M)?.maxOverlapping ?? 1;
3221
- H > Hn ? c.push(
3222
- Math.max(ne, H * Te)
3223
- ) : c.push(ne);
3224
- }
3225
- return c;
3226
- }, [S, I]), w = Ne + B.reduce((c, m) => c + m, 0);
3227
- return /* @__PURE__ */ o("div", { className: s("ic-week-view flex flex-col h-full", b), children: [
3228
- G.length > 0 && /* @__PURE__ */ e(
3229
- $n,
3230
- {
3231
- events: G,
3232
- weekDays: S,
3233
- hourColumnWidth: Ne,
3234
- minDayColumnWidth: ne,
3235
- dayColumnWidths: B,
3236
- onEventClick: R,
3237
- disablePopover: !!y && !u,
3238
- renderPopover: u,
3239
- ...f?.multiDayBanner && {
3240
- className: f.multiDayBanner
3241
- }
3242
- }
3243
- ),
3244
- /* @__PURE__ */ e(
3245
- "div",
3246
- {
3247
- ref: E,
3248
- className: s(
3249
- "ic-week-scroll-container flex-1",
3250
- f?.scrollContainer
3251
- ),
3252
- children: /* @__PURE__ */ o("div", { style: { minWidth: Math.max(_, w) }, children: [
3253
- /* @__PURE__ */ e("div", { className: "ic-week-header sticky top-0 z-20 border-b bg-background", children: /* @__PURE__ */ o("div", { className: "flex", children: [
3254
- /* @__PURE__ */ e(
3255
- "div",
3256
- {
3257
- className: "flex-shrink-0 flex items-end justify-center pb-2 text-[10px] text-muted-foreground/70",
3258
- style: { width: Ne, height: st },
3259
- children: /* @__PURE__ */ o("span", { className: "hidden sm:inline", children: [
3260
- "GMT",
3261
- (() => {
3262
- const c = (/* @__PURE__ */ new Date()).getTimezoneOffset(), m = Math.abs(Math.floor(c / 60)), M = c <= 0 ? "+" : "-";
3263
- return m > 0 ? `${M}${String(m).padStart(2, "0")}` : "";
3264
- })()
3265
- ] })
3266
- }
3267
- ),
3268
- S.map((c, m) => {
3269
- const M = ce(c), D = B[m] ?? ne, H = D > ne;
3270
- return /* @__PURE__ */ o(
3271
- "div",
3272
- {
3273
- className: s(
3274
- "flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2",
3275
- f?.columnHeader,
3276
- M && f?.columnHeaderToday
3277
- ),
3278
- style: {
3279
- height: st,
3280
- minWidth: H ? D : ne
3281
- },
3282
- children: [
3283
- /* @__PURE__ */ e(
3284
- "span",
3285
- {
3286
- className: s(
3287
- "text-[11px] font-medium uppercase tracking-wide",
3288
- M ? "text-primary" : "text-muted-foreground"
3289
- ),
3290
- children: c.toLocaleDateString([], { weekday: "short" })
3291
- }
3292
- ),
3293
- /* @__PURE__ */ e(
3294
- "button",
3295
- {
3296
- type: "button",
3297
- onClick: () => l?.(c),
3298
- className: s(
3299
- "flex items-center justify-center rounded-full transition-colors mt-0.5",
3300
- "size-10 text-2xl font-normal",
3301
- M ? "bg-primary text-primary-foreground" : "text-foreground hover:bg-muted"
3302
- ),
3303
- children: c.getDate()
3304
- }
3305
- )
3306
- ]
3307
- },
3308
- c.toDateString()
3309
- );
3310
- })
3311
- ] }) }),
3312
- /* @__PURE__ */ o("div", { className: "relative flex", children: [
3313
- /* @__PURE__ */ e(
3314
- "div",
3315
- {
3316
- className: s(
3317
- "ic-hour-column sticky left-0 z-10 bg-zinc-50 border-r",
3318
- f?.timeGutter
3319
- ),
3320
- style: { width: Ne },
3321
- children: T.map((c, m) => /* @__PURE__ */ e(
3322
- "div",
3323
- {
3324
- className: "relative",
3325
- style: { height: he },
3326
- children: /* @__PURE__ */ e("div", { className: "absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center", children: m !== 0 && /* @__PURE__ */ e(
3327
- "span",
3328
- {
3329
- className: s(
3330
- "text-[10px] sm:text-xs text-muted-foreground",
3331
- f?.timeGutterLabel
3332
- ),
3333
- children: Ae(c)
3334
- }
3335
- ) })
3336
- },
3337
- c
3338
- ))
3339
- }
3340
- ),
3341
- /* @__PURE__ */ e("div", { className: "ic-week-grid relative flex-1", children: /* @__PURE__ */ e("div", { className: "flex divide-x", children: S.map((c, m) => {
3342
- const M = c.toDateString(), D = I.get(M), H = B[m] ?? ne, Q = H > ne;
3343
- return /* @__PURE__ */ o(
3344
- "div",
3345
- {
3346
- className: "ic-day-column relative flex-1",
3347
- style: {
3348
- minWidth: Q ? H : ne
3349
- },
3350
- children: [
3351
- T.map((z, j) => {
3352
- const J = !ct(
3353
- c,
3354
- z,
3355
- d
3356
- );
3357
- return /* @__PURE__ */ o(
3358
- "div",
3359
- {
3360
- className: s(
3361
- "relative",
3362
- J && "bg-calendar-disabled-hour",
3363
- ce(c) && !J && "bg-primary/5",
3364
- f?.timeSlot,
3365
- J ? f?.timeSlotNonWorking : f?.timeSlotWorking
3366
- ),
3367
- style: { height: he },
3368
- children: [
3369
- j !== 0 && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-x-0 top-0 border-b border-border/50" }),
3370
- W.slice(1).map((ee) => /* @__PURE__ */ e(
3371
- "div",
3372
- {
3373
- className: "pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",
3374
- style: { top: `${ee / 60 * 100}%` }
3375
- },
3376
- ee
3377
- )),
3378
- W.map((ee, xe) => {
3379
- const ye = {
3380
- date: c,
3381
- hour: z,
3382
- minute: ee
3383
- };
3384
- return /* @__PURE__ */ e(
3385
- kt,
3386
- {
3387
- slot: ye,
3388
- onSelectionStart: P,
3389
- onSelectionMove: k,
3390
- onSelectionEnd: h,
3391
- isSelected: $?.isSlotSelected(ye) ?? !1,
3392
- isSelecting: $?.isSelecting ?? !1,
3393
- disabled: J,
3394
- className: "absolute inset-x-0",
3395
- style: {
3396
- top: `${xe * g}%`,
3397
- height: `${g}%`
3398
- },
3399
- ariaLabel: `Add event on ${c.toLocaleDateString()} at ${Ae(z)}:${String(ee).padStart(2, "0")}`
3400
- },
3401
- ee
3402
- );
3403
- })
3404
- ]
3405
- },
3406
- z
3407
- );
3408
- }),
3409
- D?.singleDay.map((z) => {
3410
- const j = D.positions.get(z.id);
3411
- if (!j) return null;
3412
- const te = `calc(${j.width}% - 2px)`, J = `max(${Te}px, ${te})`;
3413
- return v ? /* @__PURE__ */ e(
3414
- "div",
3415
- {
3416
- className: "absolute pointer-events-auto p-0.5",
3417
- style: {
3418
- top: `${j.top}px`,
3419
- left: `${j.left}%`,
3420
- width: J,
3421
- minWidth: `${Te}px`
3422
- },
3423
- children: v({ event: z, position: j })
3424
- },
3425
- z.id
3426
- ) : /* @__PURE__ */ e(
3427
- wt,
3428
- {
3429
- event: z,
3430
- position: {
3431
- top: j.top,
3432
- left: j.left,
3433
- width: j.width,
3434
- minWidth: Te
3435
- },
3436
- hourHeight: he,
3437
- badgeVariant: i,
3438
- onClick: y,
3439
- disablePopover: !!y && !u,
3440
- renderPopover: u,
3441
- className: s(
3442
- "pointer-events-auto",
3443
- f?.eventCard
3444
- )
3445
- },
3446
- z.id
3447
- );
3448
- }),
3449
- m === O && A >= 0 && /* @__PURE__ */ o(
3450
- "div",
3451
- {
3452
- className: s(
3453
- "absolute left-0 right-0 z-20 flex items-center pointer-events-none",
3454
- f?.currentTimeIndicator
3455
- ),
3456
- style: { top: A },
3457
- children: [
3458
- /* @__PURE__ */ e("div", { className: "h-2 w-2 -ml-1 rounded-full bg-red-500" }),
3459
- /* @__PURE__ */ e("div", { className: "flex-1 h-0.5 bg-red-500" })
3460
- ]
3461
- }
3462
- )
3463
- ]
3464
- },
3465
- c.toDateString()
3466
- );
3467
- }) }) })
3468
- ] })
3469
- ] })
3470
- }
3471
- )
3472
- ] });
3473
- }
3474
- export {
3475
- Jn as A,
3476
- pe as B,
3477
- Yn as C,
3478
- gn as D,
3479
- wt as E,
3480
- se as F,
3481
- rn as G,
3482
- de as H,
3483
- Qe as I,
3484
- et as J,
3485
- Oe as K,
3486
- Pe as L,
3487
- Qn as M,
3488
- mn as N,
3489
- ue as P,
3490
- Xt as S,
3491
- kt as T,
3492
- er as W,
3493
- Mn as a,
3494
- Ln as b,
3495
- Zn as c,
3496
- Ft as d,
3497
- Gn as e,
3498
- ft as f,
3499
- Kt as g,
3500
- Ut as h,
3501
- qt as i,
3502
- Vt as j,
3503
- Ee as k,
3504
- An as l,
3505
- Xn as m,
3506
- Un as n,
3507
- le as o,
3508
- me as p,
3509
- qn as q,
3510
- xt as r,
3511
- en as s,
3512
- Zt as t,
3513
- Qt as u,
3514
- Yt as v,
3515
- yn as w,
3516
- ae as x,
3517
- oe as y,
3518
- Kn as z
3519
- };
3520
- //# sourceMappingURL=week-view-BeasFcyR.js.map