big-calendar 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CUSTOMIZATION.md +822 -0
- package/LICENSE +21 -0
- package/README.md +183 -0
- package/dist/big-calendar.cjs +2 -0
- package/dist/big-calendar.cjs.map +1 -0
- package/dist/big-calendar.mjs +2882 -0
- package/dist/big-calendar.mjs.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +101 -0
|
@@ -0,0 +1,2882 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import * as w from "react";
|
|
3
|
+
import { useState as j, useEffect as oe, useCallback as ve, useContext as Nr, createContext as wr, forwardRef as ht, Children as Dr, useMemo as L, cloneElement as kr, useRef as Cr } from "react";
|
|
4
|
+
import { formatDate as pt, startOfMonth as we, endOfMonth as Fe, eachDayOfInterval as st, differenceInDays as Y, parseISO as b, startOfDay as B, isWithinInterval as He, differenceInMinutes as bt, isSameMonth as De, isSameWeek as Sr, isSameDay as $, isSameYear as Mr, addDays as je, subDays as Er, addWeeks as Tr, subWeeks as Ir, addMonths as Ae, subMonths as lt, addYears as _r, subYears as zr, format as k, startOfWeek as Be, endOfWeek as vt, startOfYear as xt, endOfYear as Or, isToday as yt, getDaysInMonth as Pr, differenceInMilliseconds as Nt, endOfDay as Le, areIntervalsOverlapping as wt, isBefore as Fr, isAfter as Hr } from "date-fns";
|
|
5
|
+
import { clsx as Ar } from "clsx";
|
|
6
|
+
import { twMerge as Rr } from "tailwind-merge";
|
|
7
|
+
import { useDragLayer as Vr, DndProvider as jr, useDrag as Br, useDrop as Dt } from "react-dnd";
|
|
8
|
+
import { HTML5Backend as Lr, getEmptyImage as Wr } from "react-dnd-html5-backend";
|
|
9
|
+
import { Check as $r, ChevronDown as We, ChevronUp as Ur, ChevronLeft as kt, ChevronRight as Ct, X as Yr, List as Kr, Columns as Gr, Grid2x2 as qr, Grid3x3 as Zr, CalendarRange as Xr, Plus as Jr, User as $e, Calendar as Ue, Clock as Ye, Text as St, CalendarX2 as Qr, Info as Mt, Moon as Et, Sun as en, ArrowUpRight as it } from "lucide-react";
|
|
10
|
+
import { Slot as Tt } from "@radix-ui/react-slot";
|
|
11
|
+
import { cva as re } from "class-variance-authority";
|
|
12
|
+
import * as ce from "@radix-ui/react-avatar";
|
|
13
|
+
import * as E from "@radix-ui/react-select";
|
|
14
|
+
import { appendErrors as It, FormProvider as tn, Controller as rn, useFormContext as nn, useForm as _t } from "react-hook-form";
|
|
15
|
+
import { validateFieldsNatively as dt, toNestErrors as ct } from "@hookform/resolvers";
|
|
16
|
+
import { TimeField as an, DateInput as on, DateSegment as sn } from "react-aria-components";
|
|
17
|
+
import { DayPicker as ln } from "react-day-picker";
|
|
18
|
+
import * as se from "@radix-ui/react-popover";
|
|
19
|
+
import * as zt from "@radix-ui/react-label";
|
|
20
|
+
import * as W from "@radix-ui/react-dialog";
|
|
21
|
+
import { z as V } from "zod";
|
|
22
|
+
import * as J from "@radix-ui/react-scroll-area";
|
|
23
|
+
import * as le from "@radix-ui/react-tooltip";
|
|
24
|
+
import * as Re from "@radix-ui/react-switch";
|
|
25
|
+
import * as Q from "@radix-ui/react-accordion";
|
|
26
|
+
const X = [
|
|
27
|
+
{
|
|
28
|
+
id: "dd503cf9-6c38-43cf-94cc-0d4032e2f77a",
|
|
29
|
+
name: "Leonardo Ramos",
|
|
30
|
+
picturePath: null
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "f3b035ac-49f7-4e92-a715-35680bf63175",
|
|
34
|
+
name: "Michael Doe",
|
|
35
|
+
picturePath: null
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "3e36ea6e-78f3-40dd-ab8c-a6c737c3c422",
|
|
39
|
+
name: "Alice Johnson",
|
|
40
|
+
picturePath: null
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "a7aff6bd-a50a-4d6a-ab57-76f76bb27cf5",
|
|
44
|
+
name: "Robert Smith",
|
|
45
|
+
picturePath: null
|
|
46
|
+
}
|
|
47
|
+
], xe = ["blue", "green", "red", "yellow", "purple", "orange", "gray"], ye = [
|
|
48
|
+
"Doctor's appointment",
|
|
49
|
+
"Dental cleaning",
|
|
50
|
+
"Eye exam",
|
|
51
|
+
"Therapy session",
|
|
52
|
+
"Business meeting",
|
|
53
|
+
"Team stand-up",
|
|
54
|
+
"Project deadline",
|
|
55
|
+
"Weekly report submission",
|
|
56
|
+
"Client presentation",
|
|
57
|
+
"Marketing strategy review",
|
|
58
|
+
"Networking event",
|
|
59
|
+
"Sales call",
|
|
60
|
+
"Investor pitch",
|
|
61
|
+
"Board meeting",
|
|
62
|
+
"Employee training",
|
|
63
|
+
"Performance review",
|
|
64
|
+
"One-on-one meeting",
|
|
65
|
+
"Lunch with a colleague",
|
|
66
|
+
"HR interview",
|
|
67
|
+
"Conference call",
|
|
68
|
+
"Web development sprint planning",
|
|
69
|
+
"Software deployment",
|
|
70
|
+
"Code review",
|
|
71
|
+
"QA testing session",
|
|
72
|
+
"Cybersecurity audit",
|
|
73
|
+
"Server maintenance",
|
|
74
|
+
"API integration update",
|
|
75
|
+
"Data backup",
|
|
76
|
+
"Cloud migration",
|
|
77
|
+
"System upgrade",
|
|
78
|
+
"Content planning session",
|
|
79
|
+
"Product launch",
|
|
80
|
+
"Customer support review",
|
|
81
|
+
"Team building activity",
|
|
82
|
+
"Legal consultation",
|
|
83
|
+
"Budget review",
|
|
84
|
+
"Financial planning session",
|
|
85
|
+
"Tax filing deadline",
|
|
86
|
+
"Investor relations update",
|
|
87
|
+
"Partnership negotiation",
|
|
88
|
+
"Medical check-up",
|
|
89
|
+
"Vaccination appointment",
|
|
90
|
+
"Blood donation",
|
|
91
|
+
"Gym workout",
|
|
92
|
+
"Yoga class",
|
|
93
|
+
"Physical therapy session",
|
|
94
|
+
"Nutrition consultation",
|
|
95
|
+
"Personal trainer session",
|
|
96
|
+
"Parent-teacher meeting",
|
|
97
|
+
"School open house",
|
|
98
|
+
"College application deadline",
|
|
99
|
+
"Final exam",
|
|
100
|
+
"Graduation ceremony",
|
|
101
|
+
"Job interview",
|
|
102
|
+
"Internship orientation",
|
|
103
|
+
"Office relocation",
|
|
104
|
+
"Business trip",
|
|
105
|
+
"Flight departure",
|
|
106
|
+
"Hotel check-in",
|
|
107
|
+
"Vacation planning",
|
|
108
|
+
"Birthday party",
|
|
109
|
+
"Wedding anniversary",
|
|
110
|
+
"Family reunion",
|
|
111
|
+
"Housewarming party",
|
|
112
|
+
"Community volunteer work",
|
|
113
|
+
"Charity fundraiser",
|
|
114
|
+
"Religious service",
|
|
115
|
+
"Concert attendance",
|
|
116
|
+
"Theater play",
|
|
117
|
+
"Movie night",
|
|
118
|
+
"Sporting event",
|
|
119
|
+
"Football match",
|
|
120
|
+
"Basketball game",
|
|
121
|
+
"Tennis practice",
|
|
122
|
+
"Marathon training",
|
|
123
|
+
"Cycling event",
|
|
124
|
+
"Fishing trip",
|
|
125
|
+
"Camping weekend",
|
|
126
|
+
"Hiking expedition",
|
|
127
|
+
"Photography session",
|
|
128
|
+
"Art workshop",
|
|
129
|
+
"Cooking class",
|
|
130
|
+
"Book club meeting",
|
|
131
|
+
"Grocery shopping",
|
|
132
|
+
"Car maintenance",
|
|
133
|
+
"Home renovation meeting"
|
|
134
|
+
], dn = (t) => {
|
|
135
|
+
const n = [
|
|
136
|
+
{
|
|
137
|
+
id: 1204,
|
|
138
|
+
startDate: (/* @__PURE__ */ new Date("2025-09-20T00:00:00-03:00")).toISOString(),
|
|
139
|
+
endDate: (/* @__PURE__ */ new Date("2025-09-20T23:59:00-03:00")).toISOString(),
|
|
140
|
+
title: "My wedding :)",
|
|
141
|
+
color: "red",
|
|
142
|
+
description: "Can't wait to see the most beautiful woman in that dress!",
|
|
143
|
+
user: X[0]
|
|
144
|
+
}
|
|
145
|
+
];
|
|
146
|
+
let r = 1;
|
|
147
|
+
const a = X[Math.floor(Math.random() * X.length)], d = /* @__PURE__ */ new Date(), c = new Date(d);
|
|
148
|
+
c.setDate(d.getDate() - 30);
|
|
149
|
+
const i = new Date(d);
|
|
150
|
+
i.setDate(d.getDate() + 30);
|
|
151
|
+
const o = {
|
|
152
|
+
id: r++,
|
|
153
|
+
startDate: new Date(d.getTime() - 30 * 6e4).toISOString(),
|
|
154
|
+
endDate: new Date(d.getTime() + 30 * 6e4).toISOString(),
|
|
155
|
+
title: ye[Math.floor(Math.random() * ye.length)],
|
|
156
|
+
color: xe[Math.floor(Math.random() * xe.length)],
|
|
157
|
+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
158
|
+
user: a
|
|
159
|
+
};
|
|
160
|
+
(d.getMonth() !== 8 || d.getDate() !== 20) && n.push(o);
|
|
161
|
+
let s = 0, u = 0;
|
|
162
|
+
const f = t * 3;
|
|
163
|
+
for (; s < t - 1 && u < f; ) {
|
|
164
|
+
u++;
|
|
165
|
+
const h = Math.random() < 0.1, p = new Date(c.getTime() + Math.random() * (i.getTime() - c.getTime()));
|
|
166
|
+
if (p.getMonth() === 8 && p.getDate() === 20)
|
|
167
|
+
continue;
|
|
168
|
+
p.setHours(8 + Math.floor(Math.random() * 8), Math.floor(Math.random() * 4) * 15, 0, 0);
|
|
169
|
+
const g = new Date(p);
|
|
170
|
+
if (h) {
|
|
171
|
+
const m = Math.floor(Math.random() * 4) + 1;
|
|
172
|
+
g.setDate(p.getDate() + m);
|
|
173
|
+
const v = g.getMonth(), y = g.getDate(), C = p.getMonth(), S = p.getDate();
|
|
174
|
+
if (C === 8 && S < 20 && (v > 8 || v === 8 && y >= 20) || v === 8 && y >= 20 && (C < 8 || C === 8 && S < 20))
|
|
175
|
+
continue;
|
|
176
|
+
g.setHours(8 + Math.floor(Math.random() * 12), Math.floor(Math.random() * 4) * 15, 0, 0);
|
|
177
|
+
} else {
|
|
178
|
+
const m = (Math.floor(Math.random() * 11) + 2) * 15;
|
|
179
|
+
g.setTime(g.getTime() + m * 60 * 1e3);
|
|
180
|
+
}
|
|
181
|
+
n.push({
|
|
182
|
+
id: r++,
|
|
183
|
+
startDate: p.toISOString(),
|
|
184
|
+
endDate: g.toISOString(),
|
|
185
|
+
title: ye[Math.floor(Math.random() * ye.length)],
|
|
186
|
+
color: xe[Math.floor(Math.random() * xe.length)],
|
|
187
|
+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
188
|
+
user: X[Math.floor(Math.random() * X.length)]
|
|
189
|
+
}), s++;
|
|
190
|
+
}
|
|
191
|
+
return n;
|
|
192
|
+
}, ut = dn(80), Ot = wr({}), cn = {
|
|
193
|
+
0: { from: 0, to: 0 },
|
|
194
|
+
1: { from: 8, to: 17 },
|
|
195
|
+
2: { from: 8, to: 17 },
|
|
196
|
+
3: { from: 8, to: 17 },
|
|
197
|
+
4: { from: 8, to: 17 },
|
|
198
|
+
5: { from: 8, to: 17 },
|
|
199
|
+
6: { from: 8, to: 12 }
|
|
200
|
+
}, un = { from: 7, to: 18 };
|
|
201
|
+
function za({
|
|
202
|
+
children: t,
|
|
203
|
+
users: n,
|
|
204
|
+
events: r,
|
|
205
|
+
api: a = {},
|
|
206
|
+
useMocks: d = !1,
|
|
207
|
+
singleUser: c = !1,
|
|
208
|
+
currentUser: i,
|
|
209
|
+
defaultSettings: o = {},
|
|
210
|
+
onSettingsChange: s,
|
|
211
|
+
onEventCreate: u,
|
|
212
|
+
onEventUpdate: f,
|
|
213
|
+
onEventDelete: h
|
|
214
|
+
}) {
|
|
215
|
+
const [p, g] = j(o.badgeVariant || "colored"), [m, v] = j(o.visibleHours || un), [y, C] = j(o.workingHours || cn), [S, _] = j(/* @__PURE__ */ new Date()), [A, ne] = j("all"), [pe, Ie] = j(n || []), [ot, U] = j(r || []), [ur, ae] = j(!1), mr = c ? i || (pe.length > 0 ? pe[0] : null) || (n && n.length > 0 ? n[0] : null) : null, be = d || !a.getEvents && !r, _e = d || !a.getUsers && !n;
|
|
216
|
+
oe(() => {
|
|
217
|
+
_e && pe.length === 0 ? Ie(X) : a.getUsers && !_e && (ae(!0), a.getUsers().then((N) => {
|
|
218
|
+
Ie(N);
|
|
219
|
+
}).catch((N) => {
|
|
220
|
+
console.error("Failed to fetch users:", N), d && Ie(X);
|
|
221
|
+
}).finally(() => {
|
|
222
|
+
ae(!1);
|
|
223
|
+
}));
|
|
224
|
+
}, [a.getUsers, _e, d]), oe(() => {
|
|
225
|
+
be && ot.length === 0 ? U(ut) : a.getEvents && !be && (ae(!0), a.getEvents().then((N) => {
|
|
226
|
+
U(N);
|
|
227
|
+
}).catch((N) => {
|
|
228
|
+
console.error("Failed to fetch events:", N), d && U(ut);
|
|
229
|
+
}).finally(() => {
|
|
230
|
+
ae(!1);
|
|
231
|
+
}));
|
|
232
|
+
}, [a.getEvents, be, d]);
|
|
233
|
+
const fr = (N) => {
|
|
234
|
+
N && _(N);
|
|
235
|
+
}, gr = (N) => {
|
|
236
|
+
g(N), s == null || s({ badgeVariant: N, visibleHours: m, workingHours: y });
|
|
237
|
+
}, hr = (N) => {
|
|
238
|
+
v(N), s == null || s({ badgeVariant: p, visibleHours: N, workingHours: y });
|
|
239
|
+
}, pr = (N) => {
|
|
240
|
+
C(N), s == null || s({ badgeVariant: p, visibleHours: m, workingHours: N });
|
|
241
|
+
}, br = ve(async (N) => {
|
|
242
|
+
if (a.createEvent)
|
|
243
|
+
try {
|
|
244
|
+
const D = await a.createEvent(N);
|
|
245
|
+
return U((z) => [...z, D]), u == null || u(D), D;
|
|
246
|
+
} catch (D) {
|
|
247
|
+
throw console.error("Failed to create event:", D), D;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
const D = { ...N, id: Date.now() };
|
|
251
|
+
return U((z) => [...z, D]), u == null || u(D), D;
|
|
252
|
+
}
|
|
253
|
+
}, [a.createEvent, u]), vr = ve(async (N) => {
|
|
254
|
+
if (a.updateEvent)
|
|
255
|
+
try {
|
|
256
|
+
const D = await a.updateEvent(N);
|
|
257
|
+
return U((z) => {
|
|
258
|
+
const Z = z.findIndex((ze) => ze.id === N.id);
|
|
259
|
+
return Z === -1 ? z : [...z.slice(0, Z), D, ...z.slice(Z + 1)];
|
|
260
|
+
}), f == null || f(D), D;
|
|
261
|
+
} catch (D) {
|
|
262
|
+
throw console.error("Failed to update event:", D), D;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
const D = { ...N };
|
|
266
|
+
return U((z) => {
|
|
267
|
+
const Z = z.findIndex((ze) => ze.id === N.id);
|
|
268
|
+
return Z === -1 ? z : [...z.slice(0, Z), D, ...z.slice(Z + 1)];
|
|
269
|
+
}), f == null || f(D), D;
|
|
270
|
+
}
|
|
271
|
+
}, [a.updateEvent, f]), xr = ve(async (N) => {
|
|
272
|
+
if (a.deleteEvent)
|
|
273
|
+
try {
|
|
274
|
+
await a.deleteEvent(N), U((D) => D.filter((z) => z.id !== N)), h == null || h(N);
|
|
275
|
+
} catch (D) {
|
|
276
|
+
throw console.error("Failed to delete event:", D), D;
|
|
277
|
+
}
|
|
278
|
+
else
|
|
279
|
+
U((D) => D.filter((z) => z.id !== N)), h == null || h(N);
|
|
280
|
+
}, [a.deleteEvent, h]), yr = ve(async () => {
|
|
281
|
+
if (a.getEvents) {
|
|
282
|
+
ae(!0);
|
|
283
|
+
try {
|
|
284
|
+
const N = await a.getEvents();
|
|
285
|
+
U(N);
|
|
286
|
+
} catch (N) {
|
|
287
|
+
console.error("Failed to refetch events:", N);
|
|
288
|
+
} finally {
|
|
289
|
+
ae(!1);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}, [a.getEvents]);
|
|
293
|
+
return /* @__PURE__ */ e(
|
|
294
|
+
Ot.Provider,
|
|
295
|
+
{
|
|
296
|
+
value: {
|
|
297
|
+
selectedDate: S,
|
|
298
|
+
setSelectedDate: fr,
|
|
299
|
+
selectedUserId: A,
|
|
300
|
+
setSelectedUserId: ne,
|
|
301
|
+
badgeVariant: p,
|
|
302
|
+
setBadgeVariant: gr,
|
|
303
|
+
users: pe,
|
|
304
|
+
visibleHours: m,
|
|
305
|
+
setVisibleHours: hr,
|
|
306
|
+
workingHours: y,
|
|
307
|
+
setWorkingHours: pr,
|
|
308
|
+
events: ot,
|
|
309
|
+
setEvents: U,
|
|
310
|
+
isLoading: ur,
|
|
311
|
+
// API functions
|
|
312
|
+
createEvent: br,
|
|
313
|
+
updateEvent: vr,
|
|
314
|
+
deleteEvent: xr,
|
|
315
|
+
refetchEvents: yr,
|
|
316
|
+
// API object for direct access
|
|
317
|
+
api: a,
|
|
318
|
+
useMocks: be,
|
|
319
|
+
// Single user mode
|
|
320
|
+
singleUser: c,
|
|
321
|
+
currentUser: mr
|
|
322
|
+
},
|
|
323
|
+
children: t
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
function T() {
|
|
328
|
+
const t = Nr(Ot);
|
|
329
|
+
if (!t) throw new Error("useCalendar must be used within a CalendarProvider.");
|
|
330
|
+
return t;
|
|
331
|
+
}
|
|
332
|
+
function x(...t) {
|
|
333
|
+
return Rr(Ar(t));
|
|
334
|
+
}
|
|
335
|
+
function mn() {
|
|
336
|
+
const { isDragging: t, item: n, currentOffset: r, initialOffset: a, initialClientOffset: d } = Vr((s) => ({
|
|
337
|
+
item: s.getItem(),
|
|
338
|
+
itemType: s.getItemType(),
|
|
339
|
+
isDragging: s.isDragging(),
|
|
340
|
+
currentOffset: s.getClientOffset(),
|
|
341
|
+
initialOffset: s.getInitialSourceClientOffset(),
|
|
342
|
+
initialClientOffset: s.getInitialClientOffset()
|
|
343
|
+
}));
|
|
344
|
+
if (!t || !n || !r || !a || !d)
|
|
345
|
+
return null;
|
|
346
|
+
const c = d.x - a.x, i = d.y - a.y, o = {
|
|
347
|
+
position: "fixed",
|
|
348
|
+
pointerEvents: "none",
|
|
349
|
+
zIndex: 100,
|
|
350
|
+
left: r.x - c,
|
|
351
|
+
top: r.y - i
|
|
352
|
+
};
|
|
353
|
+
return /* @__PURE__ */ e("div", { style: o, children: /* @__PURE__ */ e(
|
|
354
|
+
"div",
|
|
355
|
+
{
|
|
356
|
+
className: "",
|
|
357
|
+
style: {
|
|
358
|
+
width: n.width,
|
|
359
|
+
height: n.height
|
|
360
|
+
},
|
|
361
|
+
children: n.children
|
|
362
|
+
}
|
|
363
|
+
) });
|
|
364
|
+
}
|
|
365
|
+
function fn({ children: t }) {
|
|
366
|
+
return /* @__PURE__ */ l(jr, { backend: Lr, children: [
|
|
367
|
+
t,
|
|
368
|
+
/* @__PURE__ */ e(mn, {})
|
|
369
|
+
] });
|
|
370
|
+
}
|
|
371
|
+
const Ve = re(
|
|
372
|
+
"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-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
373
|
+
{
|
|
374
|
+
variants: {
|
|
375
|
+
variant: {
|
|
376
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
377
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
378
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
379
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
380
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
381
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
382
|
+
},
|
|
383
|
+
size: {
|
|
384
|
+
default: "h-9 px-4 py-2",
|
|
385
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
386
|
+
lg: "h-10 rounded-md px-8",
|
|
387
|
+
icon: "size-9"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
defaultVariants: {
|
|
391
|
+
variant: "default",
|
|
392
|
+
size: "default"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
), I = w.forwardRef(({ className: t, variant: n, size: r, asChild: a = !1, ...d }, c) => /* @__PURE__ */ e(a ? Tt : "button", { className: x(Ve({ variant: n, size: r, className: t })), ref: c, ...d }));
|
|
396
|
+
I.displayName = "Button";
|
|
397
|
+
const Pt = ht(({ className: t, children: n, max: r = 1, spacing: a = 10, ...d }, c) => {
|
|
398
|
+
const i = Dr.toArray(n), o = L(() => /* @__PURE__ */ l(he, { children: [
|
|
399
|
+
i.slice(0, r).map((s, u) => kr(s, {
|
|
400
|
+
className: x(s.props.className, "border-2 border-background"),
|
|
401
|
+
style: { marginLeft: u === 0 ? 0 : -a, ...s.props.style }
|
|
402
|
+
})),
|
|
403
|
+
i.length > r && /* @__PURE__ */ e(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
className: x("relative flex items-center justify-center rounded-full border-2 border-background bg-muted", i[0].props.className),
|
|
407
|
+
style: { marginLeft: -a },
|
|
408
|
+
children: /* @__PURE__ */ l("p", { children: [
|
|
409
|
+
"+",
|
|
410
|
+
i.length - r
|
|
411
|
+
] })
|
|
412
|
+
}
|
|
413
|
+
)
|
|
414
|
+
] }), [i, r, a]);
|
|
415
|
+
return /* @__PURE__ */ e("div", { ref: c, className: x("relative flex", t), ...d, children: o });
|
|
416
|
+
});
|
|
417
|
+
Pt.displayName = "AvatarGroup";
|
|
418
|
+
const ue = w.forwardRef(
|
|
419
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(ce.Root, { ref: r, className: x("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", t), ...n })
|
|
420
|
+
);
|
|
421
|
+
ue.displayName = ce.Root.displayName;
|
|
422
|
+
const me = w.forwardRef(
|
|
423
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(ce.Image, { ref: r, className: x("aspect-square h-full w-full", t), ...n })
|
|
424
|
+
);
|
|
425
|
+
me.displayName = ce.Image.displayName;
|
|
426
|
+
const fe = w.forwardRef(
|
|
427
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(ce.Fallback, { ref: r, className: x("flex h-full w-full items-center justify-center rounded-full bg-muted", t), ...n })
|
|
428
|
+
);
|
|
429
|
+
fe.displayName = ce.Fallback.displayName;
|
|
430
|
+
const ie = E.Root, Oa = E.Group, de = E.Value, ee = w.forwardRef(
|
|
431
|
+
({ className: t, children: n, ...r }, a) => /* @__PURE__ */ l(
|
|
432
|
+
E.Trigger,
|
|
433
|
+
{
|
|
434
|
+
ref: a,
|
|
435
|
+
className: x(
|
|
436
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",
|
|
437
|
+
t
|
|
438
|
+
),
|
|
439
|
+
...r,
|
|
440
|
+
children: [
|
|
441
|
+
n,
|
|
442
|
+
/* @__PURE__ */ e(E.Icon, { asChild: !0, children: /* @__PURE__ */ e(We, { className: "size-4 opacity-50" }) })
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
)
|
|
446
|
+
);
|
|
447
|
+
ee.displayName = E.Trigger.displayName;
|
|
448
|
+
const Ft = w.forwardRef(
|
|
449
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(E.ScrollUpButton, { ref: r, className: x("flex cursor-default items-center justify-center py-1", t), ...n, children: /* @__PURE__ */ e(Ur, { className: "size-4" }) })
|
|
450
|
+
);
|
|
451
|
+
Ft.displayName = E.ScrollUpButton.displayName;
|
|
452
|
+
const Ht = w.forwardRef(
|
|
453
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(E.ScrollDownButton, { ref: r, className: x("flex cursor-default items-center justify-center py-1", t), ...n, children: /* @__PURE__ */ e(We, { className: "size-4" }) })
|
|
454
|
+
);
|
|
455
|
+
Ht.displayName = E.ScrollDownButton.displayName;
|
|
456
|
+
const te = w.forwardRef(
|
|
457
|
+
({ className: t, children: n, position: r = "popper", ...a }, d) => /* @__PURE__ */ e(E.Portal, { children: /* @__PURE__ */ l(
|
|
458
|
+
E.Content,
|
|
459
|
+
{
|
|
460
|
+
ref: d,
|
|
461
|
+
className: x(
|
|
462
|
+
"relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",
|
|
463
|
+
r === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
464
|
+
t
|
|
465
|
+
),
|
|
466
|
+
position: r,
|
|
467
|
+
...a,
|
|
468
|
+
children: [
|
|
469
|
+
/* @__PURE__ */ e(Ft, {}),
|
|
470
|
+
/* @__PURE__ */ e(
|
|
471
|
+
E.Viewport,
|
|
472
|
+
{
|
|
473
|
+
className: x("p-1", r === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),
|
|
474
|
+
children: n
|
|
475
|
+
}
|
|
476
|
+
),
|
|
477
|
+
/* @__PURE__ */ e(Ht, {})
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
) })
|
|
481
|
+
);
|
|
482
|
+
te.displayName = E.Content.displayName;
|
|
483
|
+
const gn = w.forwardRef(
|
|
484
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(E.Label, { ref: r, className: x("px-2 py-1.5 text-sm font-semibold", t), ...n })
|
|
485
|
+
);
|
|
486
|
+
gn.displayName = E.Label.displayName;
|
|
487
|
+
const M = w.forwardRef(
|
|
488
|
+
({ className: t, children: n, ...r }, a) => /* @__PURE__ */ l(
|
|
489
|
+
E.Item,
|
|
490
|
+
{
|
|
491
|
+
ref: a,
|
|
492
|
+
className: x(
|
|
493
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
494
|
+
t
|
|
495
|
+
),
|
|
496
|
+
...r,
|
|
497
|
+
children: [
|
|
498
|
+
/* @__PURE__ */ e("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ e(E.ItemIndicator, { children: /* @__PURE__ */ e($r, { className: "size-4" }) }) }),
|
|
499
|
+
/* @__PURE__ */ e(E.ItemText, { children: n })
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
);
|
|
504
|
+
M.displayName = E.Item.displayName;
|
|
505
|
+
const hn = w.forwardRef(
|
|
506
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(E.Separator, { ref: r, className: x("-mx-1 my-1 h-px bg-muted", t), ...n })
|
|
507
|
+
);
|
|
508
|
+
hn.displayName = E.Separator.displayName;
|
|
509
|
+
function pn() {
|
|
510
|
+
const { users: t, selectedUserId: n, setSelectedUserId: r } = T();
|
|
511
|
+
return /* @__PURE__ */ l(ie, { value: n, onValueChange: r, children: [
|
|
512
|
+
/* @__PURE__ */ e(ee, { className: "flex-1 md:w-48", children: /* @__PURE__ */ e(de, {}) }),
|
|
513
|
+
/* @__PURE__ */ l(te, { align: "end", children: [
|
|
514
|
+
/* @__PURE__ */ e(M, { value: "all", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
515
|
+
/* @__PURE__ */ e(Pt, { max: 2, children: t.map((a) => /* @__PURE__ */ l(ue, { className: "size-6 text-xxs", children: [
|
|
516
|
+
/* @__PURE__ */ e(me, { src: a.picturePath ?? void 0, alt: a.name }),
|
|
517
|
+
/* @__PURE__ */ e(fe, { className: "text-xxs", children: a.name[0] })
|
|
518
|
+
] }, a.id)) }),
|
|
519
|
+
"All"
|
|
520
|
+
] }) }),
|
|
521
|
+
t.map((a) => /* @__PURE__ */ e(M, { value: a.id, className: "flex-1", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
522
|
+
/* @__PURE__ */ l(ue, { className: "size-6", children: [
|
|
523
|
+
/* @__PURE__ */ e(me, { src: a.picturePath ?? void 0, alt: a.name }),
|
|
524
|
+
/* @__PURE__ */ e(fe, { className: "text-xxs", children: a.name[0] })
|
|
525
|
+
] }, a.id),
|
|
526
|
+
/* @__PURE__ */ e("p", { className: "truncate", children: a.name })
|
|
527
|
+
] }) }, a.id))
|
|
528
|
+
] })
|
|
529
|
+
] });
|
|
530
|
+
}
|
|
531
|
+
function bn() {
|
|
532
|
+
const { setSelectedDate: t } = T(), n = /* @__PURE__ */ new Date();
|
|
533
|
+
return /* @__PURE__ */ l(
|
|
534
|
+
"button",
|
|
535
|
+
{
|
|
536
|
+
className: "flex size-14 flex-col items-start overflow-hidden rounded-lg border focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
537
|
+
onClick: () => t(n),
|
|
538
|
+
children: [
|
|
539
|
+
/* @__PURE__ */ e("p", { className: "flex h-6 w-full items-center justify-center bg-primary text-center text-xs font-semibold text-primary-foreground", children: pt(n, "MMM").toUpperCase() }),
|
|
540
|
+
/* @__PURE__ */ e("p", { className: "flex w-full items-center justify-center text-lg font-bold", children: n.getDate() })
|
|
541
|
+
]
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
const vn = re(
|
|
546
|
+
"inline-flex items-center rounded-md 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",
|
|
547
|
+
{
|
|
548
|
+
variants: {
|
|
549
|
+
variant: {
|
|
550
|
+
default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
|
|
551
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
552
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
|
|
553
|
+
outline: "text-foreground"
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
defaultVariants: {
|
|
557
|
+
variant: "default"
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
function xn({ className: t, variant: n, ...r }) {
|
|
562
|
+
return /* @__PURE__ */ e("div", { className: x(vn({ variant: n }), t), ...r });
|
|
563
|
+
}
|
|
564
|
+
function yn(t, n) {
|
|
565
|
+
const r = "MMM d, yyyy";
|
|
566
|
+
let a, d;
|
|
567
|
+
switch (t) {
|
|
568
|
+
case "agenda":
|
|
569
|
+
a = we(n), d = Fe(n);
|
|
570
|
+
break;
|
|
571
|
+
case "year":
|
|
572
|
+
a = xt(n), d = Or(n);
|
|
573
|
+
break;
|
|
574
|
+
case "month":
|
|
575
|
+
a = we(n), d = Fe(n);
|
|
576
|
+
break;
|
|
577
|
+
case "week":
|
|
578
|
+
a = Be(n), d = vt(n);
|
|
579
|
+
break;
|
|
580
|
+
case "day":
|
|
581
|
+
return k(n, r);
|
|
582
|
+
default:
|
|
583
|
+
return "Error while formatting ";
|
|
584
|
+
}
|
|
585
|
+
return `${k(a, r)} - ${k(d, r)}`;
|
|
586
|
+
}
|
|
587
|
+
function mt(t, n, r) {
|
|
588
|
+
return {
|
|
589
|
+
agenda: r === "next" ? Ae : lt,
|
|
590
|
+
year: r === "next" ? _r : zr,
|
|
591
|
+
month: r === "next" ? Ae : lt,
|
|
592
|
+
week: r === "next" ? Tr : Ir,
|
|
593
|
+
day: r === "next" ? je : Er
|
|
594
|
+
}[n](t, 1);
|
|
595
|
+
}
|
|
596
|
+
function Nn(t, n, r) {
|
|
597
|
+
const a = {
|
|
598
|
+
agenda: De,
|
|
599
|
+
year: Mr,
|
|
600
|
+
day: $,
|
|
601
|
+
week: Sr,
|
|
602
|
+
month: De
|
|
603
|
+
};
|
|
604
|
+
return t.filter((d) => a[r](new Date(d.startDate), n)).length;
|
|
605
|
+
}
|
|
606
|
+
function wn(t) {
|
|
607
|
+
const n = /* @__PURE__ */ new Date();
|
|
608
|
+
return t.filter((r) => He(n, { start: b(r.startDate), end: b(r.endDate) })) || null;
|
|
609
|
+
}
|
|
610
|
+
function At(t) {
|
|
611
|
+
const n = t.sort((a, d) => b(a.startDate).getTime() - b(d.startDate).getTime()), r = [];
|
|
612
|
+
for (const a of n) {
|
|
613
|
+
const d = b(a.startDate);
|
|
614
|
+
let c = !1;
|
|
615
|
+
for (const i of r) {
|
|
616
|
+
const o = i[i.length - 1], s = b(o.endDate);
|
|
617
|
+
if (d >= s) {
|
|
618
|
+
i.push(a), c = !0;
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
c || r.push([a]);
|
|
623
|
+
}
|
|
624
|
+
return r;
|
|
625
|
+
}
|
|
626
|
+
function Rt(t, n, r, a, d) {
|
|
627
|
+
const c = b(t.startDate), i = new Date(n.setHours(0, 0, 0, 0)), o = c < i ? i : c, s = bt(o, i);
|
|
628
|
+
let u;
|
|
629
|
+
if (d) {
|
|
630
|
+
const p = d.from * 60, m = d.to * 60 - p;
|
|
631
|
+
u = (s - p) / m * 100;
|
|
632
|
+
} else
|
|
633
|
+
u = s / 1440 * 100;
|
|
634
|
+
const f = 100 / a, h = r * f;
|
|
635
|
+
return { top: `${u}%`, width: `${f}%`, left: `${h}%` };
|
|
636
|
+
}
|
|
637
|
+
function Vt(t, n, r) {
|
|
638
|
+
const a = t.getDay(), d = r[a];
|
|
639
|
+
return n >= d.from && n < d.to;
|
|
640
|
+
}
|
|
641
|
+
function jt(t, n) {
|
|
642
|
+
let r = t.from, a = t.to;
|
|
643
|
+
return n.forEach((c) => {
|
|
644
|
+
const i = b(c.startDate).getHours(), o = b(c.endDate), s = o.getHours() + (o.getMinutes() > 0 ? 1 : 0);
|
|
645
|
+
i < r && (r = i), s > a && (a = s);
|
|
646
|
+
}), a = Math.min(a, 24), { hours: Array.from({ length: a - r }, (c, i) => i + r), earliestEventHour: r, latestEventHour: a };
|
|
647
|
+
}
|
|
648
|
+
function Dn(t) {
|
|
649
|
+
const n = t.getFullYear(), r = t.getMonth(), a = (p, g) => new Date(p, g + 1, 0).getDate(), d = (p, g) => new Date(p, g, 1).getDay(), c = a(n, r), i = d(n, r), o = a(n, r - 1), s = i + c, u = Array.from({ length: i }, (p, g) => ({
|
|
650
|
+
day: o - i + g + 1,
|
|
651
|
+
currentMonth: !1,
|
|
652
|
+
date: new Date(n, r - 1, o - i + g + 1)
|
|
653
|
+
})), f = Array.from({ length: c }, (p, g) => ({
|
|
654
|
+
day: g + 1,
|
|
655
|
+
currentMonth: !0,
|
|
656
|
+
date: new Date(n, r, g + 1)
|
|
657
|
+
})), h = Array.from({ length: (7 - s % 7) % 7 }, (p, g) => ({
|
|
658
|
+
day: g + 1,
|
|
659
|
+
currentMonth: !1,
|
|
660
|
+
date: new Date(n, r + 1, g + 1)
|
|
661
|
+
}));
|
|
662
|
+
return [...u, ...f, ...h];
|
|
663
|
+
}
|
|
664
|
+
function kn(t, n, r) {
|
|
665
|
+
const a = we(r), d = Fe(r), c = {}, i = {};
|
|
666
|
+
return st({ start: a, end: d }).forEach((s) => {
|
|
667
|
+
i[s.toISOString()] = [!1, !1, !1];
|
|
668
|
+
}), [
|
|
669
|
+
...t.sort((s, u) => {
|
|
670
|
+
const f = Y(b(s.endDate), b(s.startDate));
|
|
671
|
+
return Y(b(u.endDate), b(u.startDate)) - f || b(s.startDate).getTime() - b(u.startDate).getTime();
|
|
672
|
+
}),
|
|
673
|
+
...n.sort((s, u) => b(s.startDate).getTime() - b(u.startDate).getTime())
|
|
674
|
+
].forEach((s) => {
|
|
675
|
+
const u = b(s.startDate), f = b(s.endDate), h = st({
|
|
676
|
+
start: u < a ? a : u,
|
|
677
|
+
end: f > d ? d : f
|
|
678
|
+
});
|
|
679
|
+
let p = -1;
|
|
680
|
+
for (let g = 0; g < 3; g++)
|
|
681
|
+
if (h.every((m) => {
|
|
682
|
+
const v = i[B(m).toISOString()];
|
|
683
|
+
return v && !v[g];
|
|
684
|
+
})) {
|
|
685
|
+
p = g;
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
p !== -1 && (h.forEach((g) => {
|
|
689
|
+
const m = B(g).toISOString();
|
|
690
|
+
i[m][p] = !0;
|
|
691
|
+
}), c[s.id] = p);
|
|
692
|
+
}), c;
|
|
693
|
+
}
|
|
694
|
+
function Cn(t, n, r) {
|
|
695
|
+
return n.filter((d) => {
|
|
696
|
+
const c = b(d.startDate), i = b(d.endDate);
|
|
697
|
+
return t >= c && t <= i || $(t, c) || $(t, i);
|
|
698
|
+
}).map((d) => ({
|
|
699
|
+
...d,
|
|
700
|
+
position: r[d.id] ?? -1,
|
|
701
|
+
isMultiDay: d.startDate !== d.endDate
|
|
702
|
+
})).sort((d, c) => d.isMultiDay && !c.isMultiDay ? -1 : !d.isMultiDay && c.isMultiDay ? 1 : d.position - c.position);
|
|
703
|
+
}
|
|
704
|
+
function Sn({ view: t, events: n }) {
|
|
705
|
+
const { selectedDate: r, setSelectedDate: a } = T(), d = pt(r, "MMMM"), c = r.getFullYear(), i = L(() => Nn(n, r, t), [n, r, t]), o = () => a(mt(r, t, "previous")), s = () => a(mt(r, t, "next"));
|
|
706
|
+
return /* @__PURE__ */ l("div", { className: "space-y-0.5", children: [
|
|
707
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
708
|
+
/* @__PURE__ */ l("span", { className: "text-lg font-semibold", children: [
|
|
709
|
+
d,
|
|
710
|
+
" ",
|
|
711
|
+
c
|
|
712
|
+
] }),
|
|
713
|
+
/* @__PURE__ */ l(xn, { variant: "outline", className: "px-1.5", children: [
|
|
714
|
+
i,
|
|
715
|
+
" events"
|
|
716
|
+
] })
|
|
717
|
+
] }),
|
|
718
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
719
|
+
/* @__PURE__ */ e(I, { variant: "outline", className: "size-6.5 px-0 [&_svg]:size-4.5", onClick: o, children: /* @__PURE__ */ e(kt, {}) }),
|
|
720
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: yn(t, r) }),
|
|
721
|
+
/* @__PURE__ */ e(I, { variant: "outline", className: "size-6.5 px-0 [&_svg]:size-4.5", onClick: s, children: /* @__PURE__ */ e(Ct, {}) })
|
|
722
|
+
] })
|
|
723
|
+
] });
|
|
724
|
+
}
|
|
725
|
+
function Bt(t, n, r) {
|
|
726
|
+
function a(o, s) {
|
|
727
|
+
var u;
|
|
728
|
+
Object.defineProperty(o, "_zod", {
|
|
729
|
+
value: o._zod ?? {},
|
|
730
|
+
enumerable: !1
|
|
731
|
+
}), (u = o._zod).traits ?? (u.traits = /* @__PURE__ */ new Set()), o._zod.traits.add(t), n(o, s);
|
|
732
|
+
for (const f in i.prototype)
|
|
733
|
+
f in o || Object.defineProperty(o, f, { value: i.prototype[f].bind(o) });
|
|
734
|
+
o._zod.constr = i, o._zod.def = s;
|
|
735
|
+
}
|
|
736
|
+
const d = (r == null ? void 0 : r.Parent) ?? Object;
|
|
737
|
+
class c extends d {
|
|
738
|
+
}
|
|
739
|
+
Object.defineProperty(c, "name", { value: t });
|
|
740
|
+
function i(o) {
|
|
741
|
+
var s;
|
|
742
|
+
const u = r != null && r.Parent ? new c() : this;
|
|
743
|
+
a(u, o), (s = u._zod).deferred ?? (s.deferred = []);
|
|
744
|
+
for (const f of u._zod.deferred)
|
|
745
|
+
f();
|
|
746
|
+
return u;
|
|
747
|
+
}
|
|
748
|
+
return Object.defineProperty(i, "init", { value: a }), Object.defineProperty(i, Symbol.hasInstance, {
|
|
749
|
+
value: (o) => {
|
|
750
|
+
var s, u;
|
|
751
|
+
return r != null && r.Parent && o instanceof r.Parent ? !0 : (u = (s = o == null ? void 0 : o._zod) == null ? void 0 : s.traits) == null ? void 0 : u.has(t);
|
|
752
|
+
}
|
|
753
|
+
}), Object.defineProperty(i, "name", { value: t }), i;
|
|
754
|
+
}
|
|
755
|
+
class Mn extends Error {
|
|
756
|
+
constructor() {
|
|
757
|
+
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
const En = {};
|
|
761
|
+
function Lt(t) {
|
|
762
|
+
return En;
|
|
763
|
+
}
|
|
764
|
+
function Tn(t, n) {
|
|
765
|
+
return typeof n == "bigint" ? n.toString() : n;
|
|
766
|
+
}
|
|
767
|
+
const Wt = Error.captureStackTrace ? Error.captureStackTrace : (...t) => {
|
|
768
|
+
};
|
|
769
|
+
function Ne(t) {
|
|
770
|
+
return typeof t == "string" ? t : t == null ? void 0 : t.message;
|
|
771
|
+
}
|
|
772
|
+
function $t(t, n, r) {
|
|
773
|
+
var d, c, i, o, s, u;
|
|
774
|
+
const a = { ...t, path: t.path ?? [] };
|
|
775
|
+
if (!t.message) {
|
|
776
|
+
const f = Ne((i = (c = (d = t.inst) == null ? void 0 : d._zod.def) == null ? void 0 : c.error) == null ? void 0 : i.call(c, t)) ?? Ne((o = n == null ? void 0 : n.error) == null ? void 0 : o.call(n, t)) ?? Ne((s = r.customError) == null ? void 0 : s.call(r, t)) ?? Ne((u = r.localeError) == null ? void 0 : u.call(r, t)) ?? "Invalid input";
|
|
777
|
+
a.message = f;
|
|
778
|
+
}
|
|
779
|
+
return delete a.inst, delete a.continue, n != null && n.reportInput || delete a.input, a;
|
|
780
|
+
}
|
|
781
|
+
const Ut = (t, n) => {
|
|
782
|
+
t.name = "$ZodError", Object.defineProperty(t, "_zod", {
|
|
783
|
+
value: t._zod,
|
|
784
|
+
enumerable: !1
|
|
785
|
+
}), Object.defineProperty(t, "issues", {
|
|
786
|
+
value: n,
|
|
787
|
+
enumerable: !1
|
|
788
|
+
}), Object.defineProperty(t, "message", {
|
|
789
|
+
get() {
|
|
790
|
+
return JSON.stringify(n, Tn, 2);
|
|
791
|
+
},
|
|
792
|
+
enumerable: !0
|
|
793
|
+
// configurable: false,
|
|
794
|
+
}), Object.defineProperty(t, "toString", {
|
|
795
|
+
value: () => t.message,
|
|
796
|
+
enumerable: !1
|
|
797
|
+
});
|
|
798
|
+
}, In = Bt("$ZodError", Ut), Yt = Bt("$ZodError", Ut, { Parent: Error }), _n = (t) => (n, r, a, d) => {
|
|
799
|
+
const c = a ? Object.assign(a, { async: !1 }) : { async: !1 }, i = n._zod.run({ value: r, issues: [] }, c);
|
|
800
|
+
if (i instanceof Promise)
|
|
801
|
+
throw new Mn();
|
|
802
|
+
if (i.issues.length) {
|
|
803
|
+
const o = new ((d == null ? void 0 : d.Err) ?? t)(i.issues.map((s) => $t(s, c, Lt())));
|
|
804
|
+
throw Wt(o, d == null ? void 0 : d.callee), o;
|
|
805
|
+
}
|
|
806
|
+
return i.value;
|
|
807
|
+
}, zn = /* @__PURE__ */ _n(Yt), On = (t) => async (n, r, a, d) => {
|
|
808
|
+
const c = a ? Object.assign(a, { async: !0 }) : { async: !0 };
|
|
809
|
+
let i = n._zod.run({ value: r, issues: [] }, c);
|
|
810
|
+
if (i instanceof Promise && (i = await i), i.issues.length) {
|
|
811
|
+
const o = new ((d == null ? void 0 : d.Err) ?? t)(i.issues.map((s) => $t(s, c, Lt())));
|
|
812
|
+
throw Wt(o, d == null ? void 0 : d.callee), o;
|
|
813
|
+
}
|
|
814
|
+
return i.value;
|
|
815
|
+
}, Pn = /* @__PURE__ */ On(Yt);
|
|
816
|
+
function ft(t, n) {
|
|
817
|
+
try {
|
|
818
|
+
var r = t();
|
|
819
|
+
} catch (a) {
|
|
820
|
+
return n(a);
|
|
821
|
+
}
|
|
822
|
+
return r && r.then ? r.then(void 0, n) : r;
|
|
823
|
+
}
|
|
824
|
+
function Fn(t, n) {
|
|
825
|
+
for (var r = {}; t.length; ) {
|
|
826
|
+
var a = t[0], d = a.code, c = a.message, i = a.path.join(".");
|
|
827
|
+
if (!r[i]) if ("unionErrors" in a) {
|
|
828
|
+
var o = a.unionErrors[0].errors[0];
|
|
829
|
+
r[i] = { message: o.message, type: o.code };
|
|
830
|
+
} else r[i] = { message: c, type: d };
|
|
831
|
+
if ("unionErrors" in a && a.unionErrors.forEach(function(f) {
|
|
832
|
+
return f.errors.forEach(function(h) {
|
|
833
|
+
return t.push(h);
|
|
834
|
+
});
|
|
835
|
+
}), n) {
|
|
836
|
+
var s = r[i].types, u = s && s[a.code];
|
|
837
|
+
r[i] = It(i, n, r, d, u ? [].concat(u, a.message) : a.message);
|
|
838
|
+
}
|
|
839
|
+
t.shift();
|
|
840
|
+
}
|
|
841
|
+
return r;
|
|
842
|
+
}
|
|
843
|
+
function Hn(t, n) {
|
|
844
|
+
for (var r = {}; t.length; ) {
|
|
845
|
+
var a = t[0], d = a.code, c = a.message, i = a.path.join(".");
|
|
846
|
+
if (!r[i]) if (a.code === "invalid_union" && a.errors.length > 0) {
|
|
847
|
+
var o = a.errors[0][0];
|
|
848
|
+
r[i] = { message: o.message, type: o.code };
|
|
849
|
+
} else r[i] = { message: c, type: d };
|
|
850
|
+
if (a.code === "invalid_union" && a.errors.forEach(function(f) {
|
|
851
|
+
return f.forEach(function(h) {
|
|
852
|
+
return t.push(h);
|
|
853
|
+
});
|
|
854
|
+
}), n) {
|
|
855
|
+
var s = r[i].types, u = s && s[a.code];
|
|
856
|
+
r[i] = It(i, n, r, d, u ? [].concat(u, a.message) : a.message);
|
|
857
|
+
}
|
|
858
|
+
t.shift();
|
|
859
|
+
}
|
|
860
|
+
return r;
|
|
861
|
+
}
|
|
862
|
+
function Kt(t, n, r) {
|
|
863
|
+
if (r === void 0 && (r = {}), function(a) {
|
|
864
|
+
return "_def" in a && typeof a._def == "object" && "typeName" in a._def;
|
|
865
|
+
}(t)) return function(a, d, c) {
|
|
866
|
+
try {
|
|
867
|
+
return Promise.resolve(ft(function() {
|
|
868
|
+
return Promise.resolve(t[r.mode === "sync" ? "parse" : "parseAsync"](a, n)).then(function(i) {
|
|
869
|
+
return c.shouldUseNativeValidation && dt({}, c), { errors: {}, values: r.raw ? Object.assign({}, a) : i };
|
|
870
|
+
});
|
|
871
|
+
}, function(i) {
|
|
872
|
+
if (function(o) {
|
|
873
|
+
return Array.isArray(o == null ? void 0 : o.issues);
|
|
874
|
+
}(i)) return { values: {}, errors: ct(Fn(i.errors, !c.shouldUseNativeValidation && c.criteriaMode === "all"), c) };
|
|
875
|
+
throw i;
|
|
876
|
+
}));
|
|
877
|
+
} catch (i) {
|
|
878
|
+
return Promise.reject(i);
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
if (function(a) {
|
|
882
|
+
return "_zod" in a && typeof a._zod == "object";
|
|
883
|
+
}(t)) return function(a, d, c) {
|
|
884
|
+
try {
|
|
885
|
+
return Promise.resolve(ft(function() {
|
|
886
|
+
return Promise.resolve((r.mode === "sync" ? zn : Pn)(t, a, n)).then(function(i) {
|
|
887
|
+
return c.shouldUseNativeValidation && dt({}, c), { errors: {}, values: r.raw ? Object.assign({}, a) : i };
|
|
888
|
+
});
|
|
889
|
+
}, function(i) {
|
|
890
|
+
if (function(o) {
|
|
891
|
+
return o instanceof In;
|
|
892
|
+
}(i)) return { values: {}, errors: ct(Hn(i.issues, !c.shouldUseNativeValidation && c.criteriaMode === "all"), c) };
|
|
893
|
+
throw i;
|
|
894
|
+
}));
|
|
895
|
+
} catch (i) {
|
|
896
|
+
return Promise.reject(i);
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
throw new Error("Invalid input: not a Zod schema");
|
|
900
|
+
}
|
|
901
|
+
function Ke({ defaultIsOpen: t = !1 } = {}) {
|
|
902
|
+
const [n, r] = j(t);
|
|
903
|
+
return { onOpen: () => r(!0), onClose: () => r(!1), isOpen: n, onToggle: () => r((i) => !i) };
|
|
904
|
+
}
|
|
905
|
+
const Ge = w.forwardRef(({ className: t, type: n, ...r }, a) => /* @__PURE__ */ e(
|
|
906
|
+
"input",
|
|
907
|
+
{
|
|
908
|
+
type: n,
|
|
909
|
+
className: x(
|
|
910
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
911
|
+
t
|
|
912
|
+
),
|
|
913
|
+
ref: a,
|
|
914
|
+
...r
|
|
915
|
+
}
|
|
916
|
+
));
|
|
917
|
+
Ge.displayName = "Input";
|
|
918
|
+
const qe = w.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
|
|
919
|
+
"textarea",
|
|
920
|
+
{
|
|
921
|
+
className: x(
|
|
922
|
+
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
923
|
+
t
|
|
924
|
+
),
|
|
925
|
+
ref: r,
|
|
926
|
+
...n
|
|
927
|
+
}
|
|
928
|
+
));
|
|
929
|
+
qe.displayName = "Textarea";
|
|
930
|
+
const G = ht(
|
|
931
|
+
({ className: t, dateInputClassName: n, segmentClassName: r, disabled: a, "data-invalid": d, ...c }, i) => /* @__PURE__ */ e(
|
|
932
|
+
an,
|
|
933
|
+
{
|
|
934
|
+
ref: i,
|
|
935
|
+
className: x("relative", t),
|
|
936
|
+
isDisabled: a,
|
|
937
|
+
isInvalid: d,
|
|
938
|
+
...c,
|
|
939
|
+
"aria-label": "Time",
|
|
940
|
+
shouldForceLeadingZeros: !0,
|
|
941
|
+
children: /* @__PURE__ */ e(
|
|
942
|
+
on,
|
|
943
|
+
{
|
|
944
|
+
className: x(
|
|
945
|
+
"peer inline-flex h-9 w-full items-center overflow-hidden whitespace-nowrap rounded-md border bg-background px-3 py-2 text-sm shadow-black",
|
|
946
|
+
"data-[focus-within]:outline-none data-[focus-within]:ring-1 data-[focus-within]:ring-ring",
|
|
947
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
948
|
+
n
|
|
949
|
+
),
|
|
950
|
+
children: (o) => /* @__PURE__ */ e(
|
|
951
|
+
sn,
|
|
952
|
+
{
|
|
953
|
+
segment: o,
|
|
954
|
+
className: x(
|
|
955
|
+
"inline rounded p-0.5 caret-transparent outline outline-0",
|
|
956
|
+
"data-[focused]:bg-foreground/10 data-[focused]:text-foreground",
|
|
957
|
+
"data-[placeholder]:text-muted-foreground",
|
|
958
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
959
|
+
r
|
|
960
|
+
)
|
|
961
|
+
}
|
|
962
|
+
)
|
|
963
|
+
}
|
|
964
|
+
)
|
|
965
|
+
}
|
|
966
|
+
)
|
|
967
|
+
);
|
|
968
|
+
G.displayName = "TimeInput";
|
|
969
|
+
function Ze({ className: t, classNames: n, showOutsideDays: r = !0, selected: a, ...d }) {
|
|
970
|
+
const [c, i] = w.useState(a instanceof Date ? a : void 0);
|
|
971
|
+
return /* @__PURE__ */ e(
|
|
972
|
+
ln,
|
|
973
|
+
{
|
|
974
|
+
selected: a,
|
|
975
|
+
showOutsideDays: r,
|
|
976
|
+
month: c,
|
|
977
|
+
onMonthChange: i,
|
|
978
|
+
className: x("p-3", t),
|
|
979
|
+
classNames: {
|
|
980
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
|
981
|
+
month: "space-y-4",
|
|
982
|
+
caption: "flex justify-center pt-1 relative items-center",
|
|
983
|
+
caption_label: "text-sm font-medium",
|
|
984
|
+
nav: "space-x-1 flex items-center",
|
|
985
|
+
nav_button: x(Ve({ variant: "outline" }), "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),
|
|
986
|
+
nav_button_previous: "absolute left-1",
|
|
987
|
+
nav_button_next: "absolute right-1",
|
|
988
|
+
table: "w-full border-collapse space-y-1",
|
|
989
|
+
head_row: "flex",
|
|
990
|
+
head_cell: "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
|
|
991
|
+
row: "flex w-full mt-2",
|
|
992
|
+
cell: x(
|
|
993
|
+
"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
|
|
994
|
+
"[&:has([aria-selected])]:rounded-md"
|
|
995
|
+
),
|
|
996
|
+
day: x(Ve({ variant: "ghost" }), "h-8 w-8 p-0 font-normal aria-selected:opacity-100"),
|
|
997
|
+
day_range_start: "day-range-start",
|
|
998
|
+
day_range_end: "day-range-end",
|
|
999
|
+
day_selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
1000
|
+
day_today: "bg-accent text-accent-foreground",
|
|
1001
|
+
day_outside: "day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
|
|
1002
|
+
day_disabled: "text-muted-foreground opacity-50",
|
|
1003
|
+
day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
|
|
1004
|
+
day_hidden: "invisible",
|
|
1005
|
+
...n
|
|
1006
|
+
},
|
|
1007
|
+
components: {
|
|
1008
|
+
IconLeft: ({ className: o, ...s }) => /* @__PURE__ */ e(kt, { className: x("h-4 w-4", o), ...s }),
|
|
1009
|
+
IconRight: ({ className: o, ...s }) => /* @__PURE__ */ e(Ct, { className: x("h-4 w-4", o), ...s })
|
|
1010
|
+
},
|
|
1011
|
+
...d
|
|
1012
|
+
}
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
Ze.displayName = "Calendar";
|
|
1016
|
+
const An = se.Root, Rn = se.Trigger, Pa = se.Anchor, Gt = w.forwardRef(
|
|
1017
|
+
({ className: t, align: n = "center", sideOffset: r = 4, ...a }, d) => /* @__PURE__ */ e(se.Portal, { children: /* @__PURE__ */ e(
|
|
1018
|
+
se.Content,
|
|
1019
|
+
{
|
|
1020
|
+
ref: d,
|
|
1021
|
+
align: n,
|
|
1022
|
+
sideOffset: r,
|
|
1023
|
+
className: x(
|
|
1024
|
+
"z-50 w-72 origin-[--radix-popover-content-transform-origin] rounded-md border bg-popover p-4 text-popover-foreground shadow-md 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",
|
|
1025
|
+
t
|
|
1026
|
+
),
|
|
1027
|
+
...a
|
|
1028
|
+
}
|
|
1029
|
+
) })
|
|
1030
|
+
);
|
|
1031
|
+
Gt.displayName = se.Content.displayName;
|
|
1032
|
+
function ke({ id: t, onSelect: n, className: r, placeholder: a, labelVariant: d = "PPP", value: c, ...i }) {
|
|
1033
|
+
const { isOpen: o, onClose: s, onToggle: u } = Ke(), f = (h) => {
|
|
1034
|
+
n(h), s();
|
|
1035
|
+
};
|
|
1036
|
+
return /* @__PURE__ */ l(An, { open: o, onOpenChange: u, modal: !0, children: [
|
|
1037
|
+
/* @__PURE__ */ e(Rn, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1038
|
+
I,
|
|
1039
|
+
{
|
|
1040
|
+
id: t,
|
|
1041
|
+
variant: "outline",
|
|
1042
|
+
className: x("group relative h-9 w-full justify-start whitespace-nowrap px-3 py-2 font-normal hover:bg-inherit", r),
|
|
1043
|
+
...i,
|
|
1044
|
+
children: [
|
|
1045
|
+
c && /* @__PURE__ */ e("span", { children: k(c, d) }),
|
|
1046
|
+
!c && /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: a })
|
|
1047
|
+
]
|
|
1048
|
+
}
|
|
1049
|
+
) }),
|
|
1050
|
+
/* @__PURE__ */ e(Gt, { align: "center", className: "w-fit p-0", children: /* @__PURE__ */ e(Ze, { mode: "single", selected: c, onSelect: f, initialFocus: !0 }) })
|
|
1051
|
+
] });
|
|
1052
|
+
}
|
|
1053
|
+
const Vn = re("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"), qt = w.forwardRef(
|
|
1054
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(zt.Root, { ref: r, className: x(Vn(), t), ...n })
|
|
1055
|
+
);
|
|
1056
|
+
qt.displayName = zt.Root.displayName;
|
|
1057
|
+
const Zt = tn, Xt = w.createContext({});
|
|
1058
|
+
function R({ ...t }) {
|
|
1059
|
+
return /* @__PURE__ */ e(Xt.Provider, { value: { name: t.name }, children: /* @__PURE__ */ e(rn, { ...t }) });
|
|
1060
|
+
}
|
|
1061
|
+
const Ce = () => {
|
|
1062
|
+
const t = w.useContext(Xt), n = w.useContext(Jt), { getFieldState: r, formState: a } = nn(), d = r(t.name, a);
|
|
1063
|
+
if (!t)
|
|
1064
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
1065
|
+
const { id: c } = n;
|
|
1066
|
+
return {
|
|
1067
|
+
id: c,
|
|
1068
|
+
name: t.name,
|
|
1069
|
+
formItemId: `${c}-form-item`,
|
|
1070
|
+
formDescriptionId: `${c}-form-item-description`,
|
|
1071
|
+
formMessageId: `${c}-form-item-message`,
|
|
1072
|
+
...d
|
|
1073
|
+
};
|
|
1074
|
+
}, Jt = w.createContext({}), O = w.forwardRef(({ className: t, ...n }, r) => {
|
|
1075
|
+
const a = w.useId();
|
|
1076
|
+
return /* @__PURE__ */ e(Jt.Provider, { value: { id: a }, children: /* @__PURE__ */ e("div", { ref: r, className: x("space-y-2", t), ...n }) });
|
|
1077
|
+
});
|
|
1078
|
+
O.displayName = "FormItem";
|
|
1079
|
+
const P = w.forwardRef(
|
|
1080
|
+
({ className: t, ...n }, r) => {
|
|
1081
|
+
const { error: a, formItemId: d } = Ce();
|
|
1082
|
+
return /* @__PURE__ */ e(qt, { ref: r, className: x(a && "text-destructive", t), htmlFor: d, ...n });
|
|
1083
|
+
}
|
|
1084
|
+
);
|
|
1085
|
+
P.displayName = "FormLabel";
|
|
1086
|
+
const F = w.forwardRef(({ ...t }, n) => {
|
|
1087
|
+
const { error: r, formItemId: a, formDescriptionId: d, formMessageId: c } = Ce();
|
|
1088
|
+
return /* @__PURE__ */ e(
|
|
1089
|
+
Tt,
|
|
1090
|
+
{
|
|
1091
|
+
ref: n,
|
|
1092
|
+
id: a,
|
|
1093
|
+
"aria-describedby": r ? `${d} ${c}` : `${d}`,
|
|
1094
|
+
"aria-invalid": !!r,
|
|
1095
|
+
...t
|
|
1096
|
+
}
|
|
1097
|
+
);
|
|
1098
|
+
});
|
|
1099
|
+
F.displayName = "FormControl";
|
|
1100
|
+
const jn = w.forwardRef(({ className: t, ...n }, r) => {
|
|
1101
|
+
const { formDescriptionId: a } = Ce();
|
|
1102
|
+
return /* @__PURE__ */ e("p", { ref: r, id: a, className: x("text-[0.8rem] text-muted-foreground", t), ...n });
|
|
1103
|
+
});
|
|
1104
|
+
jn.displayName = "FormDescription";
|
|
1105
|
+
const H = w.forwardRef(({ className: t, children: n, ...r }, a) => {
|
|
1106
|
+
const { error: d, formMessageId: c } = Ce(), i = d ? String((d == null ? void 0 : d.message) ?? "") : n;
|
|
1107
|
+
return i ? /* @__PURE__ */ e("p", { ref: a, id: c, className: x("text-[0.8rem] font-medium text-destructive", t), ...r, children: i }) : null;
|
|
1108
|
+
});
|
|
1109
|
+
H.displayName = "FormMessage";
|
|
1110
|
+
const Xe = W.Root, Je = W.Trigger, Bn = W.Portal, Qt = W.Close, er = w.forwardRef(
|
|
1111
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(
|
|
1112
|
+
W.Overlay,
|
|
1113
|
+
{
|
|
1114
|
+
ref: r,
|
|
1115
|
+
className: x(
|
|
1116
|
+
"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",
|
|
1117
|
+
t
|
|
1118
|
+
),
|
|
1119
|
+
...n
|
|
1120
|
+
}
|
|
1121
|
+
)
|
|
1122
|
+
);
|
|
1123
|
+
er.displayName = W.Overlay.displayName;
|
|
1124
|
+
const Se = w.forwardRef(
|
|
1125
|
+
({ className: t, children: n, ...r }, a) => /* @__PURE__ */ l(Bn, { children: [
|
|
1126
|
+
/* @__PURE__ */ e(er, {}),
|
|
1127
|
+
/* @__PURE__ */ l(
|
|
1128
|
+
W.Content,
|
|
1129
|
+
{
|
|
1130
|
+
ref: a,
|
|
1131
|
+
className: x(
|
|
1132
|
+
"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%] sm:rounded-lg",
|
|
1133
|
+
t
|
|
1134
|
+
),
|
|
1135
|
+
...r,
|
|
1136
|
+
children: [
|
|
1137
|
+
n,
|
|
1138
|
+
/* @__PURE__ */ l(W.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: [
|
|
1139
|
+
/* @__PURE__ */ e(Yr, { className: "size-4" }),
|
|
1140
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
|
|
1141
|
+
] })
|
|
1142
|
+
]
|
|
1143
|
+
}
|
|
1144
|
+
)
|
|
1145
|
+
] })
|
|
1146
|
+
);
|
|
1147
|
+
Se.displayName = W.Content.displayName;
|
|
1148
|
+
function Me({ className: t, ...n }) {
|
|
1149
|
+
return /* @__PURE__ */ e("div", { className: x("flex flex-col space-y-1.5 text-center sm:text-left", t), ...n });
|
|
1150
|
+
}
|
|
1151
|
+
Me.displayName = "DialogHeader";
|
|
1152
|
+
function Ee({ className: t, ...n }) {
|
|
1153
|
+
return /* @__PURE__ */ e("div", { className: x("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", t), ...n });
|
|
1154
|
+
}
|
|
1155
|
+
Ee.displayName = "DialogFooter";
|
|
1156
|
+
const Te = w.forwardRef(
|
|
1157
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(W.Title, { ref: r, className: x("text-lg font-semibold leading-none tracking-tight", t), ...n })
|
|
1158
|
+
);
|
|
1159
|
+
Te.displayName = W.Title.displayName;
|
|
1160
|
+
const Qe = w.forwardRef(
|
|
1161
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(W.Description, { ref: r, className: x("text-sm text-muted-foreground", t), ...n })
|
|
1162
|
+
);
|
|
1163
|
+
Qe.displayName = W.Description.displayName;
|
|
1164
|
+
const et = (t = !1) => V.object({
|
|
1165
|
+
user: t ? V.string().optional() : V.string(),
|
|
1166
|
+
title: V.string().min(1, "Title is required"),
|
|
1167
|
+
description: V.string().min(1, "Description is required"),
|
|
1168
|
+
startDate: V.date({ required_error: "Start date is required" }),
|
|
1169
|
+
startTime: V.object({ hour: V.number(), minute: V.number() }, { required_error: "Start time is required" }),
|
|
1170
|
+
endDate: V.date({ required_error: "End date is required" }),
|
|
1171
|
+
endTime: V.object({ hour: V.number(), minute: V.number() }, { required_error: "End time is required" }),
|
|
1172
|
+
color: V.enum(["blue", "green", "red", "yellow", "purple", "orange", "gray"], { required_error: "Color is required" })
|
|
1173
|
+
}).refine(
|
|
1174
|
+
(n) => {
|
|
1175
|
+
const r = new Date(n.startDate);
|
|
1176
|
+
r.setHours(n.startTime.hour, n.startTime.minute, 0, 0);
|
|
1177
|
+
const a = new Date(n.endDate);
|
|
1178
|
+
return a.setHours(n.endTime.hour, n.endTime.minute, 0, 0), r < a;
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
message: "Start date cannot be after end date",
|
|
1182
|
+
path: ["startDate"]
|
|
1183
|
+
}
|
|
1184
|
+
), Fa = et(!1);
|
|
1185
|
+
function K({ children: t, startDate: n, startTime: r, onEventCreated: a, showFormDisclaimer: d = !0 }) {
|
|
1186
|
+
const { users: c, createEvent: i, singleUser: o, currentUser: s } = T(), { isOpen: u, onClose: f, onToggle: h } = Ke(), p = _t({
|
|
1187
|
+
resolver: Kt(et(o)),
|
|
1188
|
+
defaultValues: {
|
|
1189
|
+
title: "",
|
|
1190
|
+
description: "",
|
|
1191
|
+
user: o && s ? s.id : void 0,
|
|
1192
|
+
startDate: typeof n < "u" ? n : void 0,
|
|
1193
|
+
startTime: typeof r < "u" ? r : void 0
|
|
1194
|
+
}
|
|
1195
|
+
}), g = async (m) => {
|
|
1196
|
+
try {
|
|
1197
|
+
const v = o ? s : c.find((A) => A.id === m.user);
|
|
1198
|
+
if (!v) {
|
|
1199
|
+
o || p.setError("user", { message: "User not found" });
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
const y = new Date(m.startDate);
|
|
1203
|
+
y.setHours(m.startTime.hour, m.startTime.minute, 0, 0);
|
|
1204
|
+
const C = new Date(m.endDate);
|
|
1205
|
+
C.setHours(m.endTime.hour, m.endTime.minute, 0, 0);
|
|
1206
|
+
const S = {
|
|
1207
|
+
user: v,
|
|
1208
|
+
title: m.title,
|
|
1209
|
+
color: m.color,
|
|
1210
|
+
description: m.description,
|
|
1211
|
+
startDate: y.toISOString(),
|
|
1212
|
+
endDate: C.toISOString()
|
|
1213
|
+
}, _ = await i(S);
|
|
1214
|
+
a == null || a(_), f(), p.reset();
|
|
1215
|
+
} catch (v) {
|
|
1216
|
+
console.error("Failed to create event:", v);
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
return oe(() => {
|
|
1220
|
+
p.reset({
|
|
1221
|
+
startDate: n,
|
|
1222
|
+
startTime: r
|
|
1223
|
+
});
|
|
1224
|
+
}, [n, r, p]), /* @__PURE__ */ l(Xe, { open: u, onOpenChange: h, children: [
|
|
1225
|
+
/* @__PURE__ */ e(Je, { asChild: !0, children: t }),
|
|
1226
|
+
/* @__PURE__ */ l(Se, { children: [
|
|
1227
|
+
/* @__PURE__ */ l(Me, { children: [
|
|
1228
|
+
/* @__PURE__ */ e(Te, { children: "Add New Event" }),
|
|
1229
|
+
d && /* @__PURE__ */ e(Qe, { className: "mt-2", children: "Create a new calendar event. The event will be saved according to your API configuration." })
|
|
1230
|
+
] }),
|
|
1231
|
+
/* @__PURE__ */ e(Zt, { ...p, children: /* @__PURE__ */ l("form", { id: "event-form", onSubmit: p.handleSubmit(g), className: "grid gap-4 py-4", children: [
|
|
1232
|
+
!o && /* @__PURE__ */ e(
|
|
1233
|
+
R,
|
|
1234
|
+
{
|
|
1235
|
+
control: p.control,
|
|
1236
|
+
name: "user",
|
|
1237
|
+
render: ({ field: m, fieldState: v }) => /* @__PURE__ */ l(O, { children: [
|
|
1238
|
+
/* @__PURE__ */ e(P, { children: "Responsible" }),
|
|
1239
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ l(ie, { value: m.value, onValueChange: m.onChange, children: [
|
|
1240
|
+
/* @__PURE__ */ e(ee, { "data-invalid": v.invalid, children: /* @__PURE__ */ e(de, { placeholder: "Select an option" }) }),
|
|
1241
|
+
/* @__PURE__ */ e(te, { children: c.map((y) => /* @__PURE__ */ e(M, { value: y.id, className: "flex-1", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1242
|
+
/* @__PURE__ */ l(ue, { className: "size-6", children: [
|
|
1243
|
+
/* @__PURE__ */ e(me, { src: y.picturePath ?? void 0, alt: y.name }),
|
|
1244
|
+
/* @__PURE__ */ e(fe, { className: "text-xxs", children: y.name[0] })
|
|
1245
|
+
] }, y.id),
|
|
1246
|
+
/* @__PURE__ */ e("p", { className: "truncate", children: y.name })
|
|
1247
|
+
] }) }, y.id)) })
|
|
1248
|
+
] }) }),
|
|
1249
|
+
/* @__PURE__ */ e(H, {})
|
|
1250
|
+
] })
|
|
1251
|
+
}
|
|
1252
|
+
),
|
|
1253
|
+
/* @__PURE__ */ e(
|
|
1254
|
+
R,
|
|
1255
|
+
{
|
|
1256
|
+
control: p.control,
|
|
1257
|
+
name: "title",
|
|
1258
|
+
render: ({ field: m, fieldState: v }) => /* @__PURE__ */ l(O, { children: [
|
|
1259
|
+
/* @__PURE__ */ e(P, { htmlFor: "title", children: "Title" }),
|
|
1260
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(Ge, { id: "title", placeholder: "Enter a title", "data-invalid": v.invalid, ...m }) }),
|
|
1261
|
+
/* @__PURE__ */ e(H, {})
|
|
1262
|
+
] })
|
|
1263
|
+
}
|
|
1264
|
+
),
|
|
1265
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
1266
|
+
/* @__PURE__ */ e(
|
|
1267
|
+
R,
|
|
1268
|
+
{
|
|
1269
|
+
control: p.control,
|
|
1270
|
+
name: "startDate",
|
|
1271
|
+
render: ({ field: m, fieldState: v }) => /* @__PURE__ */ l(O, { className: "flex-1", children: [
|
|
1272
|
+
/* @__PURE__ */ e(P, { htmlFor: "startDate", children: "Start Date" }),
|
|
1273
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(
|
|
1274
|
+
ke,
|
|
1275
|
+
{
|
|
1276
|
+
id: "startDate",
|
|
1277
|
+
value: m.value,
|
|
1278
|
+
onSelect: (y) => m.onChange(y),
|
|
1279
|
+
placeholder: "Select a date",
|
|
1280
|
+
"data-invalid": v.invalid
|
|
1281
|
+
}
|
|
1282
|
+
) }),
|
|
1283
|
+
/* @__PURE__ */ e(H, {})
|
|
1284
|
+
] })
|
|
1285
|
+
}
|
|
1286
|
+
),
|
|
1287
|
+
/* @__PURE__ */ e(
|
|
1288
|
+
R,
|
|
1289
|
+
{
|
|
1290
|
+
control: p.control,
|
|
1291
|
+
name: "startTime",
|
|
1292
|
+
render: ({ field: m, fieldState: v }) => /* @__PURE__ */ l(O, { className: "flex-1", children: [
|
|
1293
|
+
/* @__PURE__ */ e(P, { children: "Start Time" }),
|
|
1294
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(G, { value: m.value, onChange: m.onChange, hourCycle: 12, "data-invalid": v.invalid }) }),
|
|
1295
|
+
/* @__PURE__ */ e(H, {})
|
|
1296
|
+
] })
|
|
1297
|
+
}
|
|
1298
|
+
)
|
|
1299
|
+
] }),
|
|
1300
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
1301
|
+
/* @__PURE__ */ e(
|
|
1302
|
+
R,
|
|
1303
|
+
{
|
|
1304
|
+
control: p.control,
|
|
1305
|
+
name: "endDate",
|
|
1306
|
+
render: ({ field: m, fieldState: v }) => /* @__PURE__ */ l(O, { className: "flex-1", children: [
|
|
1307
|
+
/* @__PURE__ */ e(P, { children: "End Date" }),
|
|
1308
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(
|
|
1309
|
+
ke,
|
|
1310
|
+
{
|
|
1311
|
+
value: m.value,
|
|
1312
|
+
onSelect: (y) => m.onChange(y),
|
|
1313
|
+
placeholder: "Select a date",
|
|
1314
|
+
"data-invalid": v.invalid
|
|
1315
|
+
}
|
|
1316
|
+
) }),
|
|
1317
|
+
/* @__PURE__ */ e(H, {})
|
|
1318
|
+
] })
|
|
1319
|
+
}
|
|
1320
|
+
),
|
|
1321
|
+
/* @__PURE__ */ e(
|
|
1322
|
+
R,
|
|
1323
|
+
{
|
|
1324
|
+
control: p.control,
|
|
1325
|
+
name: "endTime",
|
|
1326
|
+
render: ({ field: m, fieldState: v }) => /* @__PURE__ */ l(O, { className: "flex-1", children: [
|
|
1327
|
+
/* @__PURE__ */ e(P, { children: "End Time" }),
|
|
1328
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(G, { value: m.value, onChange: m.onChange, hourCycle: 12, "data-invalid": v.invalid }) }),
|
|
1329
|
+
/* @__PURE__ */ e(H, {})
|
|
1330
|
+
] })
|
|
1331
|
+
}
|
|
1332
|
+
)
|
|
1333
|
+
] }),
|
|
1334
|
+
/* @__PURE__ */ e(
|
|
1335
|
+
R,
|
|
1336
|
+
{
|
|
1337
|
+
control: p.control,
|
|
1338
|
+
name: "color",
|
|
1339
|
+
render: ({ field: m, fieldState: v }) => /* @__PURE__ */ l(O, { children: [
|
|
1340
|
+
/* @__PURE__ */ e(P, { children: "Color" }),
|
|
1341
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ l(ie, { value: m.value, onValueChange: m.onChange, children: [
|
|
1342
|
+
/* @__PURE__ */ e(ee, { "data-invalid": v.invalid, children: /* @__PURE__ */ e(de, { placeholder: "Select an option" }) }),
|
|
1343
|
+
/* @__PURE__ */ l(te, { children: [
|
|
1344
|
+
/* @__PURE__ */ e(M, { value: "blue", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1345
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-blue-600" }),
|
|
1346
|
+
"Blue"
|
|
1347
|
+
] }) }),
|
|
1348
|
+
/* @__PURE__ */ e(M, { value: "green", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1349
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-green-600" }),
|
|
1350
|
+
"Green"
|
|
1351
|
+
] }) }),
|
|
1352
|
+
/* @__PURE__ */ e(M, { value: "red", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1353
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-red-600" }),
|
|
1354
|
+
"Red"
|
|
1355
|
+
] }) }),
|
|
1356
|
+
/* @__PURE__ */ e(M, { value: "yellow", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1357
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-yellow-600" }),
|
|
1358
|
+
"Yellow"
|
|
1359
|
+
] }) }),
|
|
1360
|
+
/* @__PURE__ */ e(M, { value: "purple", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1361
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-purple-600" }),
|
|
1362
|
+
"Purple"
|
|
1363
|
+
] }) }),
|
|
1364
|
+
/* @__PURE__ */ e(M, { value: "orange", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1365
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-orange-600" }),
|
|
1366
|
+
"Orange"
|
|
1367
|
+
] }) }),
|
|
1368
|
+
/* @__PURE__ */ e(M, { value: "gray", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1369
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-neutral-600" }),
|
|
1370
|
+
"Gray"
|
|
1371
|
+
] }) })
|
|
1372
|
+
] })
|
|
1373
|
+
] }) }),
|
|
1374
|
+
/* @__PURE__ */ e(H, {})
|
|
1375
|
+
] })
|
|
1376
|
+
}
|
|
1377
|
+
),
|
|
1378
|
+
/* @__PURE__ */ e(
|
|
1379
|
+
R,
|
|
1380
|
+
{
|
|
1381
|
+
control: p.control,
|
|
1382
|
+
name: "description",
|
|
1383
|
+
render: ({ field: m, fieldState: v }) => /* @__PURE__ */ l(O, { children: [
|
|
1384
|
+
/* @__PURE__ */ e(P, { children: "Description" }),
|
|
1385
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(qe, { ...m, value: m.value, "data-invalid": v.invalid }) }),
|
|
1386
|
+
/* @__PURE__ */ e(H, {})
|
|
1387
|
+
] })
|
|
1388
|
+
}
|
|
1389
|
+
)
|
|
1390
|
+
] }) }),
|
|
1391
|
+
/* @__PURE__ */ l(Ee, { children: [
|
|
1392
|
+
/* @__PURE__ */ e(Qt, { asChild: !0, children: /* @__PURE__ */ e(I, { type: "button", variant: "outline", children: "Cancel" }) }),
|
|
1393
|
+
/* @__PURE__ */ e(I, { form: "event-form", type: "submit", children: "Create Event" })
|
|
1394
|
+
] })
|
|
1395
|
+
] })
|
|
1396
|
+
] });
|
|
1397
|
+
}
|
|
1398
|
+
function Ln({
|
|
1399
|
+
view: t,
|
|
1400
|
+
events: n,
|
|
1401
|
+
onViewChange: r,
|
|
1402
|
+
showTodayButton: a = !0,
|
|
1403
|
+
showDateNavigator: d = !0,
|
|
1404
|
+
showViewSwitcher: c = !0,
|
|
1405
|
+
showUserSelect: i = !0,
|
|
1406
|
+
showAddEventButton: o = !0,
|
|
1407
|
+
availableViews: s = ["day", "week", "month", "year", "agenda"],
|
|
1408
|
+
className: u,
|
|
1409
|
+
leftSectionClassName: f,
|
|
1410
|
+
rightSectionClassName: h,
|
|
1411
|
+
viewSwitcherClassName: p,
|
|
1412
|
+
addButtonClassName: g
|
|
1413
|
+
}) {
|
|
1414
|
+
const { singleUser: m } = T(), v = (C) => {
|
|
1415
|
+
r && r(C);
|
|
1416
|
+
}, y = i && !m;
|
|
1417
|
+
return /* @__PURE__ */ l("div", { className: x("flex flex-col gap-4 border-b p-4 lg:flex-row lg:items-center lg:justify-between", u), children: [
|
|
1418
|
+
(a || d) && /* @__PURE__ */ l("div", { className: x("flex items-center gap-3", f), children: [
|
|
1419
|
+
a && /* @__PURE__ */ e(bn, {}),
|
|
1420
|
+
d && /* @__PURE__ */ e(Sn, { view: t, events: n })
|
|
1421
|
+
] }),
|
|
1422
|
+
(c || i || o) && /* @__PURE__ */ l("div", { className: x("flex flex-col items-center gap-1.5 sm:flex-row sm:justify-between", h), children: [
|
|
1423
|
+
(c || i) && /* @__PURE__ */ l("div", { className: "flex w-full items-center gap-1.5", children: [
|
|
1424
|
+
c && /* @__PURE__ */ l("div", { className: x("inline-flex first:rounded-r-none last:rounded-l-none [&:not(:first-child):not(:last-child)]:rounded-none", p), children: [
|
|
1425
|
+
s.includes("day") && /* @__PURE__ */ e(
|
|
1426
|
+
I,
|
|
1427
|
+
{
|
|
1428
|
+
"aria-label": "View by day",
|
|
1429
|
+
size: "icon",
|
|
1430
|
+
variant: t === "day" ? "default" : "outline",
|
|
1431
|
+
className: "rounded-r-none [&_svg]:size-5",
|
|
1432
|
+
onClick: () => v("day"),
|
|
1433
|
+
children: /* @__PURE__ */ e(Kr, { strokeWidth: 1.8 })
|
|
1434
|
+
}
|
|
1435
|
+
),
|
|
1436
|
+
s.includes("week") && /* @__PURE__ */ e(
|
|
1437
|
+
I,
|
|
1438
|
+
{
|
|
1439
|
+
"aria-label": "View by week",
|
|
1440
|
+
size: "icon",
|
|
1441
|
+
variant: t === "week" ? "default" : "outline",
|
|
1442
|
+
className: "-ml-px rounded-none [&_svg]:size-5",
|
|
1443
|
+
onClick: () => v("week"),
|
|
1444
|
+
children: /* @__PURE__ */ e(Gr, { strokeWidth: 1.8 })
|
|
1445
|
+
}
|
|
1446
|
+
),
|
|
1447
|
+
s.includes("month") && /* @__PURE__ */ e(
|
|
1448
|
+
I,
|
|
1449
|
+
{
|
|
1450
|
+
"aria-label": "View by month",
|
|
1451
|
+
size: "icon",
|
|
1452
|
+
variant: t === "month" ? "default" : "outline",
|
|
1453
|
+
className: "-ml-px rounded-none [&_svg]:size-5",
|
|
1454
|
+
onClick: () => v("month"),
|
|
1455
|
+
children: /* @__PURE__ */ e(qr, { strokeWidth: 1.8 })
|
|
1456
|
+
}
|
|
1457
|
+
),
|
|
1458
|
+
s.includes("year") && /* @__PURE__ */ e(
|
|
1459
|
+
I,
|
|
1460
|
+
{
|
|
1461
|
+
"aria-label": "View by year",
|
|
1462
|
+
size: "icon",
|
|
1463
|
+
variant: t === "year" ? "default" : "outline",
|
|
1464
|
+
className: "-ml-px rounded-none [&_svg]:size-5",
|
|
1465
|
+
onClick: () => v("year"),
|
|
1466
|
+
children: /* @__PURE__ */ e(Zr, { strokeWidth: 1.8 })
|
|
1467
|
+
}
|
|
1468
|
+
),
|
|
1469
|
+
s.includes("agenda") && /* @__PURE__ */ e(
|
|
1470
|
+
I,
|
|
1471
|
+
{
|
|
1472
|
+
"aria-label": "View by agenda",
|
|
1473
|
+
size: "icon",
|
|
1474
|
+
variant: t === "agenda" ? "default" : "outline",
|
|
1475
|
+
className: "-ml-px rounded-l-none [&_svg]:size-5",
|
|
1476
|
+
onClick: () => v("agenda"),
|
|
1477
|
+
children: /* @__PURE__ */ e(Xr, { strokeWidth: 1.8 })
|
|
1478
|
+
}
|
|
1479
|
+
)
|
|
1480
|
+
] }),
|
|
1481
|
+
y && /* @__PURE__ */ e(pn, {})
|
|
1482
|
+
] }),
|
|
1483
|
+
o && /* @__PURE__ */ e(K, { children: /* @__PURE__ */ l(I, { className: x("w-full sm:w-auto", g), children: [
|
|
1484
|
+
/* @__PURE__ */ e(Jr, {}),
|
|
1485
|
+
"Add Event"
|
|
1486
|
+
] }) })
|
|
1487
|
+
] })
|
|
1488
|
+
] });
|
|
1489
|
+
}
|
|
1490
|
+
function Wn({ day: t, date: n, events: r }) {
|
|
1491
|
+
const { setSelectedDate: a } = T(), d = 3, c = r.length;
|
|
1492
|
+
return /* @__PURE__ */ l(
|
|
1493
|
+
"button",
|
|
1494
|
+
{
|
|
1495
|
+
onClick: () => {
|
|
1496
|
+
a(n);
|
|
1497
|
+
},
|
|
1498
|
+
type: "button",
|
|
1499
|
+
className: "flex h-11 flex-1 flex-col items-center justify-start gap-0.5 rounded-md pt-1 hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1500
|
+
children: [
|
|
1501
|
+
/* @__PURE__ */ e(
|
|
1502
|
+
"div",
|
|
1503
|
+
{
|
|
1504
|
+
className: x(
|
|
1505
|
+
"flex size-6 items-center justify-center rounded-full text-xs font-medium",
|
|
1506
|
+
yt(n) && "bg-primary font-semibold text-primary-foreground"
|
|
1507
|
+
),
|
|
1508
|
+
children: t
|
|
1509
|
+
}
|
|
1510
|
+
),
|
|
1511
|
+
c > 0 && /* @__PURE__ */ e("div", { className: "mt-0.5 flex gap-0.5", children: c <= d ? r.map((o) => /* @__PURE__ */ e(
|
|
1512
|
+
"div",
|
|
1513
|
+
{
|
|
1514
|
+
className: x(
|
|
1515
|
+
"size-1.5 rounded-full",
|
|
1516
|
+
o.color === "blue" && "bg-blue-600",
|
|
1517
|
+
o.color === "green" && "bg-green-600",
|
|
1518
|
+
o.color === "red" && "bg-red-600",
|
|
1519
|
+
o.color === "yellow" && "bg-yellow-600",
|
|
1520
|
+
o.color === "purple" && "bg-purple-600",
|
|
1521
|
+
o.color === "orange" && "bg-orange-600",
|
|
1522
|
+
o.color === "gray" && "bg-neutral-600"
|
|
1523
|
+
)
|
|
1524
|
+
},
|
|
1525
|
+
o.id
|
|
1526
|
+
)) : /* @__PURE__ */ l(he, { children: [
|
|
1527
|
+
/* @__PURE__ */ e(
|
|
1528
|
+
"div",
|
|
1529
|
+
{
|
|
1530
|
+
className: x(
|
|
1531
|
+
"size-1.5 rounded-full",
|
|
1532
|
+
r[0].color === "blue" && "bg-blue-600",
|
|
1533
|
+
r[0].color === "green" && "bg-green-600",
|
|
1534
|
+
r[0].color === "red" && "bg-red-600",
|
|
1535
|
+
r[0].color === "yellow" && "bg-yellow-600",
|
|
1536
|
+
r[0].color === "purple" && "bg-purple-600",
|
|
1537
|
+
r[0].color === "orange" && "bg-orange-600"
|
|
1538
|
+
)
|
|
1539
|
+
}
|
|
1540
|
+
),
|
|
1541
|
+
/* @__PURE__ */ l("span", { className: "text-[7px] text-muted-foreground", children: [
|
|
1542
|
+
"+",
|
|
1543
|
+
c - 1
|
|
1544
|
+
] })
|
|
1545
|
+
] }) })
|
|
1546
|
+
]
|
|
1547
|
+
}
|
|
1548
|
+
);
|
|
1549
|
+
}
|
|
1550
|
+
function $n({ month: t, events: n }) {
|
|
1551
|
+
const { setSelectedDate: r } = T(), a = k(t, "MMMM"), d = L(() => {
|
|
1552
|
+
const o = Pr(t), s = we(t).getDay(), u = Array.from({ length: o }, (h, p) => p + 1);
|
|
1553
|
+
return [...Array(s).fill(null), ...u];
|
|
1554
|
+
}, [t]);
|
|
1555
|
+
return /* @__PURE__ */ l("div", { className: "flex flex-col", children: [
|
|
1556
|
+
/* @__PURE__ */ e(
|
|
1557
|
+
"button",
|
|
1558
|
+
{
|
|
1559
|
+
type: "button",
|
|
1560
|
+
onClick: () => {
|
|
1561
|
+
r(new Date(t.getFullYear(), t.getMonth(), 1));
|
|
1562
|
+
},
|
|
1563
|
+
className: "w-full rounded-t-lg border px-3 py-2 text-sm font-semibold hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1564
|
+
children: a
|
|
1565
|
+
}
|
|
1566
|
+
),
|
|
1567
|
+
/* @__PURE__ */ l("div", { className: "flex-1 space-y-2 rounded-b-lg border border-t-0 p-3", children: [
|
|
1568
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-x-0.5 text-center", children: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"].map((o, s) => /* @__PURE__ */ e("div", { className: "text-xs font-medium text-muted-foreground", children: o }, s)) }),
|
|
1569
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-x-0.5 gap-y-2", children: d.map((o, s) => {
|
|
1570
|
+
if (o === null) return /* @__PURE__ */ e("div", { className: "h-10" }, `blank-${s}`);
|
|
1571
|
+
const u = new Date(t.getFullYear(), t.getMonth(), o), f = n.filter((h) => $(b(h.startDate), u) || $(b(h.endDate), u));
|
|
1572
|
+
return /* @__PURE__ */ e(Wn, { day: o, date: u, events: f }, `day-${o}`);
|
|
1573
|
+
}) })
|
|
1574
|
+
] })
|
|
1575
|
+
] });
|
|
1576
|
+
}
|
|
1577
|
+
function Un({ allEvents: t }) {
|
|
1578
|
+
const { selectedDate: n } = T(), r = L(() => {
|
|
1579
|
+
const a = xt(n);
|
|
1580
|
+
return Array.from({ length: 12 }, (d, c) => Ae(a, c));
|
|
1581
|
+
}, [n]);
|
|
1582
|
+
return /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", children: r.map((a) => /* @__PURE__ */ e($n, { month: a, events: t }, a.toString())) }) });
|
|
1583
|
+
}
|
|
1584
|
+
const Yn = re("size-2 rounded-full", {
|
|
1585
|
+
variants: {
|
|
1586
|
+
color: {
|
|
1587
|
+
blue: "bg-blue-600 dark:bg-blue-500",
|
|
1588
|
+
green: "bg-green-600 dark:bg-green-500",
|
|
1589
|
+
red: "bg-red-600 dark:bg-red-500",
|
|
1590
|
+
yellow: "bg-yellow-600 dark:bg-yellow-500",
|
|
1591
|
+
purple: "bg-purple-600 dark:bg-purple-500",
|
|
1592
|
+
gray: "bg-neutral-600 dark:bg-neutral-500",
|
|
1593
|
+
orange: "bg-orange-600 dark:bg-orange-500"
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
defaultVariants: {
|
|
1597
|
+
color: "blue"
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
function Kn({ color: t, className: n }) {
|
|
1601
|
+
return /* @__PURE__ */ e("div", { className: x(Yn({ color: t, className: n })) });
|
|
1602
|
+
}
|
|
1603
|
+
function tr() {
|
|
1604
|
+
const { updateEvent: t } = T();
|
|
1605
|
+
return { updateEvent: t };
|
|
1606
|
+
}
|
|
1607
|
+
const tt = {
|
|
1608
|
+
EVENT: "event"
|
|
1609
|
+
};
|
|
1610
|
+
function rr({ event: t, children: n }) {
|
|
1611
|
+
const r = Cr(null), [{ isDragging: a }, d, c] = Br(() => ({
|
|
1612
|
+
type: tt.EVENT,
|
|
1613
|
+
item: () => {
|
|
1614
|
+
var s, u;
|
|
1615
|
+
const i = ((s = r.current) == null ? void 0 : s.offsetWidth) || 0, o = ((u = r.current) == null ? void 0 : u.offsetHeight) || 0;
|
|
1616
|
+
return { event: t, children: n, width: i, height: o };
|
|
1617
|
+
},
|
|
1618
|
+
collect: (i) => ({ isDragging: i.isDragging() })
|
|
1619
|
+
}));
|
|
1620
|
+
return oe(() => {
|
|
1621
|
+
c(Wr(), { captureDraggingState: !0 });
|
|
1622
|
+
}, [c]), d(r), /* @__PURE__ */ e("div", { ref: r, className: x(a && "opacity-40"), children: n });
|
|
1623
|
+
}
|
|
1624
|
+
function Gn({ cell: t, children: n }) {
|
|
1625
|
+
const { updateEvent: r } = tr(), [{ isOver: a, canDrop: d }, c] = Dt(
|
|
1626
|
+
() => ({
|
|
1627
|
+
accept: tt.EVENT,
|
|
1628
|
+
drop: (i) => {
|
|
1629
|
+
const o = i.event, s = b(o.startDate), u = b(o.endDate), f = Nt(u, s), h = new Date(t.date);
|
|
1630
|
+
h.setHours(s.getHours(), s.getMinutes(), s.getSeconds(), s.getMilliseconds());
|
|
1631
|
+
const p = new Date(h.getTime() + f);
|
|
1632
|
+
return r({
|
|
1633
|
+
...o,
|
|
1634
|
+
startDate: h.toISOString(),
|
|
1635
|
+
endDate: p.toISOString()
|
|
1636
|
+
}), { moved: !0 };
|
|
1637
|
+
},
|
|
1638
|
+
collect: (i) => ({
|
|
1639
|
+
isOver: i.isOver(),
|
|
1640
|
+
canDrop: i.canDrop()
|
|
1641
|
+
})
|
|
1642
|
+
}),
|
|
1643
|
+
[t.date, r]
|
|
1644
|
+
);
|
|
1645
|
+
return /* @__PURE__ */ e("div", { ref: c, className: x(a && d && "bg-accent/50"), children: n });
|
|
1646
|
+
}
|
|
1647
|
+
function qn({ children: t, event: n, onEventUpdated: r, showFormDisclaimer: a = !0 }) {
|
|
1648
|
+
const { isOpen: d, onClose: c, onToggle: i } = Ke(), { users: o, updateEvent: s, singleUser: u, currentUser: f } = T(), h = _t({
|
|
1649
|
+
resolver: Kt(et(u)),
|
|
1650
|
+
defaultValues: {
|
|
1651
|
+
user: u && (f == null ? void 0 : f.id) || n.user.id,
|
|
1652
|
+
title: n.title,
|
|
1653
|
+
description: n.description,
|
|
1654
|
+
startDate: b(n.startDate),
|
|
1655
|
+
startTime: { hour: b(n.startDate).getHours(), minute: b(n.startDate).getMinutes() },
|
|
1656
|
+
endDate: b(n.endDate),
|
|
1657
|
+
endTime: { hour: b(n.endDate).getHours(), minute: b(n.endDate).getMinutes() },
|
|
1658
|
+
color: n.color
|
|
1659
|
+
}
|
|
1660
|
+
}), p = async (g) => {
|
|
1661
|
+
try {
|
|
1662
|
+
const m = u ? f : o.find((S) => S.id === g.user);
|
|
1663
|
+
if (!m) {
|
|
1664
|
+
u || h.setError("user", { message: "User not found" });
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
const v = new Date(g.startDate);
|
|
1668
|
+
v.setHours(g.startTime.hour, g.startTime.minute, 0, 0);
|
|
1669
|
+
const y = new Date(g.endDate);
|
|
1670
|
+
y.setHours(g.endTime.hour, g.endTime.minute, 0, 0);
|
|
1671
|
+
const C = await s({
|
|
1672
|
+
...n,
|
|
1673
|
+
user: m,
|
|
1674
|
+
title: g.title,
|
|
1675
|
+
color: g.color,
|
|
1676
|
+
description: g.description,
|
|
1677
|
+
startDate: v.toISOString(),
|
|
1678
|
+
endDate: y.toISOString()
|
|
1679
|
+
});
|
|
1680
|
+
r == null || r(C), c();
|
|
1681
|
+
} catch (m) {
|
|
1682
|
+
console.error("Failed to update event:", m);
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
return /* @__PURE__ */ l(Xe, { open: d, onOpenChange: i, children: [
|
|
1686
|
+
/* @__PURE__ */ e(Je, { asChild: !0, children: t }),
|
|
1687
|
+
/* @__PURE__ */ l(Se, { children: [
|
|
1688
|
+
/* @__PURE__ */ l(Me, { children: [
|
|
1689
|
+
/* @__PURE__ */ e(Te, { children: "Edit Event" }),
|
|
1690
|
+
a && /* @__PURE__ */ e(Qe, { className: "mt-2", children: "Update the event details. Changes will be saved according to your API configuration." })
|
|
1691
|
+
] }),
|
|
1692
|
+
/* @__PURE__ */ e(Zt, { ...h, children: /* @__PURE__ */ l("form", { id: "event-form", onSubmit: h.handleSubmit(p), className: "grid gap-4 py-4", children: [
|
|
1693
|
+
!u && /* @__PURE__ */ e(
|
|
1694
|
+
R,
|
|
1695
|
+
{
|
|
1696
|
+
control: h.control,
|
|
1697
|
+
name: "user",
|
|
1698
|
+
render: ({ field: g, fieldState: m }) => /* @__PURE__ */ l(O, { children: [
|
|
1699
|
+
/* @__PURE__ */ e(P, { children: "Responsible" }),
|
|
1700
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ l(ie, { value: g.value, onValueChange: g.onChange, children: [
|
|
1701
|
+
/* @__PURE__ */ e(ee, { "data-invalid": m.invalid, children: /* @__PURE__ */ e(de, { placeholder: "Select an option" }) }),
|
|
1702
|
+
/* @__PURE__ */ e(te, { children: o.map((v) => /* @__PURE__ */ e(M, { value: v.id, className: "flex-1", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1703
|
+
/* @__PURE__ */ l(ue, { className: "size-6", children: [
|
|
1704
|
+
/* @__PURE__ */ e(me, { src: v.picturePath ?? void 0, alt: v.name }),
|
|
1705
|
+
/* @__PURE__ */ e(fe, { className: "text-xxs", children: v.name[0] })
|
|
1706
|
+
] }, v.id),
|
|
1707
|
+
/* @__PURE__ */ e("p", { className: "truncate", children: v.name })
|
|
1708
|
+
] }) }, v.id)) })
|
|
1709
|
+
] }) }),
|
|
1710
|
+
/* @__PURE__ */ e(H, {})
|
|
1711
|
+
] })
|
|
1712
|
+
}
|
|
1713
|
+
),
|
|
1714
|
+
/* @__PURE__ */ e(
|
|
1715
|
+
R,
|
|
1716
|
+
{
|
|
1717
|
+
control: h.control,
|
|
1718
|
+
name: "title",
|
|
1719
|
+
render: ({ field: g, fieldState: m }) => /* @__PURE__ */ l(O, { children: [
|
|
1720
|
+
/* @__PURE__ */ e(P, { htmlFor: "title", children: "Title" }),
|
|
1721
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(Ge, { id: "title", placeholder: "Enter a title", "data-invalid": m.invalid, ...g }) }),
|
|
1722
|
+
/* @__PURE__ */ e(H, {})
|
|
1723
|
+
] })
|
|
1724
|
+
}
|
|
1725
|
+
),
|
|
1726
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
1727
|
+
/* @__PURE__ */ e(
|
|
1728
|
+
R,
|
|
1729
|
+
{
|
|
1730
|
+
control: h.control,
|
|
1731
|
+
name: "startDate",
|
|
1732
|
+
render: ({ field: g, fieldState: m }) => /* @__PURE__ */ l(O, { className: "flex-1", children: [
|
|
1733
|
+
/* @__PURE__ */ e(P, { htmlFor: "startDate", children: "Start Date" }),
|
|
1734
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(
|
|
1735
|
+
ke,
|
|
1736
|
+
{
|
|
1737
|
+
id: "startDate",
|
|
1738
|
+
value: g.value,
|
|
1739
|
+
onSelect: (v) => g.onChange(v),
|
|
1740
|
+
placeholder: "Select a date",
|
|
1741
|
+
"data-invalid": m.invalid
|
|
1742
|
+
}
|
|
1743
|
+
) }),
|
|
1744
|
+
/* @__PURE__ */ e(H, {})
|
|
1745
|
+
] })
|
|
1746
|
+
}
|
|
1747
|
+
),
|
|
1748
|
+
/* @__PURE__ */ e(
|
|
1749
|
+
R,
|
|
1750
|
+
{
|
|
1751
|
+
control: h.control,
|
|
1752
|
+
name: "startTime",
|
|
1753
|
+
render: ({ field: g, fieldState: m }) => /* @__PURE__ */ l(O, { className: "flex-1", children: [
|
|
1754
|
+
/* @__PURE__ */ e(P, { children: "Start Time" }),
|
|
1755
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(G, { value: g.value, onChange: g.onChange, hourCycle: 12, "data-invalid": m.invalid }) }),
|
|
1756
|
+
/* @__PURE__ */ e(H, {})
|
|
1757
|
+
] })
|
|
1758
|
+
}
|
|
1759
|
+
)
|
|
1760
|
+
] }),
|
|
1761
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
1762
|
+
/* @__PURE__ */ e(
|
|
1763
|
+
R,
|
|
1764
|
+
{
|
|
1765
|
+
control: h.control,
|
|
1766
|
+
name: "endDate",
|
|
1767
|
+
render: ({ field: g, fieldState: m }) => /* @__PURE__ */ l(O, { className: "flex-1", children: [
|
|
1768
|
+
/* @__PURE__ */ e(P, { children: "End Date" }),
|
|
1769
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(
|
|
1770
|
+
ke,
|
|
1771
|
+
{
|
|
1772
|
+
value: g.value,
|
|
1773
|
+
onSelect: (v) => g.onChange(v),
|
|
1774
|
+
placeholder: "Select a date",
|
|
1775
|
+
"data-invalid": m.invalid
|
|
1776
|
+
}
|
|
1777
|
+
) }),
|
|
1778
|
+
/* @__PURE__ */ e(H, {})
|
|
1779
|
+
] })
|
|
1780
|
+
}
|
|
1781
|
+
),
|
|
1782
|
+
/* @__PURE__ */ e(
|
|
1783
|
+
R,
|
|
1784
|
+
{
|
|
1785
|
+
control: h.control,
|
|
1786
|
+
name: "endTime",
|
|
1787
|
+
render: ({ field: g, fieldState: m }) => /* @__PURE__ */ l(O, { className: "flex-1", children: [
|
|
1788
|
+
/* @__PURE__ */ e(P, { children: "End Time" }),
|
|
1789
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(G, { value: g.value, onChange: g.onChange, hourCycle: 12, "data-invalid": m.invalid }) }),
|
|
1790
|
+
/* @__PURE__ */ e(H, {})
|
|
1791
|
+
] })
|
|
1792
|
+
}
|
|
1793
|
+
)
|
|
1794
|
+
] }),
|
|
1795
|
+
/* @__PURE__ */ e(
|
|
1796
|
+
R,
|
|
1797
|
+
{
|
|
1798
|
+
control: h.control,
|
|
1799
|
+
name: "color",
|
|
1800
|
+
render: ({ field: g, fieldState: m }) => /* @__PURE__ */ l(O, { children: [
|
|
1801
|
+
/* @__PURE__ */ e(P, { children: "Color" }),
|
|
1802
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ l(ie, { value: g.value, onValueChange: g.onChange, children: [
|
|
1803
|
+
/* @__PURE__ */ e(ee, { "data-invalid": m.invalid, children: /* @__PURE__ */ e(de, { placeholder: "Select an option" }) }),
|
|
1804
|
+
/* @__PURE__ */ l(te, { children: [
|
|
1805
|
+
/* @__PURE__ */ e(M, { value: "blue", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1806
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-blue-600" }),
|
|
1807
|
+
"Blue"
|
|
1808
|
+
] }) }),
|
|
1809
|
+
/* @__PURE__ */ e(M, { value: "green", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1810
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-green-600" }),
|
|
1811
|
+
"Green"
|
|
1812
|
+
] }) }),
|
|
1813
|
+
/* @__PURE__ */ e(M, { value: "red", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1814
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-red-600" }),
|
|
1815
|
+
"Red"
|
|
1816
|
+
] }) }),
|
|
1817
|
+
/* @__PURE__ */ e(M, { value: "yellow", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1818
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-yellow-600" }),
|
|
1819
|
+
"Yellow"
|
|
1820
|
+
] }) }),
|
|
1821
|
+
/* @__PURE__ */ e(M, { value: "purple", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1822
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-purple-600" }),
|
|
1823
|
+
"Purple"
|
|
1824
|
+
] }) }),
|
|
1825
|
+
/* @__PURE__ */ e(M, { value: "orange", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1826
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-orange-600" }),
|
|
1827
|
+
"Orange"
|
|
1828
|
+
] }) }),
|
|
1829
|
+
/* @__PURE__ */ e(M, { value: "gray", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1830
|
+
/* @__PURE__ */ e("div", { className: "size-3.5 rounded-full bg-neutral-600" }),
|
|
1831
|
+
"Gray"
|
|
1832
|
+
] }) })
|
|
1833
|
+
] })
|
|
1834
|
+
] }) }),
|
|
1835
|
+
/* @__PURE__ */ e(H, {})
|
|
1836
|
+
] })
|
|
1837
|
+
}
|
|
1838
|
+
),
|
|
1839
|
+
/* @__PURE__ */ e(
|
|
1840
|
+
R,
|
|
1841
|
+
{
|
|
1842
|
+
control: h.control,
|
|
1843
|
+
name: "description",
|
|
1844
|
+
render: ({ field: g, fieldState: m }) => /* @__PURE__ */ l(O, { children: [
|
|
1845
|
+
/* @__PURE__ */ e(P, { children: "Description" }),
|
|
1846
|
+
/* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(qe, { ...g, value: g.value, "data-invalid": m.invalid }) }),
|
|
1847
|
+
/* @__PURE__ */ e(H, {})
|
|
1848
|
+
] })
|
|
1849
|
+
}
|
|
1850
|
+
)
|
|
1851
|
+
] }) }),
|
|
1852
|
+
/* @__PURE__ */ l(Ee, { children: [
|
|
1853
|
+
/* @__PURE__ */ e(Qt, { asChild: !0, children: /* @__PURE__ */ e(I, { type: "button", variant: "outline", children: "Cancel" }) }),
|
|
1854
|
+
/* @__PURE__ */ e(I, { form: "event-form", type: "submit", children: "Save changes" })
|
|
1855
|
+
] })
|
|
1856
|
+
] })
|
|
1857
|
+
] });
|
|
1858
|
+
}
|
|
1859
|
+
function rt({ event: t, children: n }) {
|
|
1860
|
+
const r = b(t.startDate), a = b(t.endDate);
|
|
1861
|
+
return /* @__PURE__ */ e(he, { children: /* @__PURE__ */ l(Xe, { children: [
|
|
1862
|
+
/* @__PURE__ */ e(Je, { asChild: !0, children: n }),
|
|
1863
|
+
/* @__PURE__ */ l(Se, { children: [
|
|
1864
|
+
/* @__PURE__ */ e(Me, { children: /* @__PURE__ */ e(Te, { children: t.title }) }),
|
|
1865
|
+
/* @__PURE__ */ l("div", { className: "space-y-4", children: [
|
|
1866
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
1867
|
+
/* @__PURE__ */ e($e, { className: "mt-1 size-4 shrink-0" }),
|
|
1868
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1869
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "Responsible" }),
|
|
1870
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t.user.name })
|
|
1871
|
+
] })
|
|
1872
|
+
] }),
|
|
1873
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
1874
|
+
/* @__PURE__ */ e(Ue, { className: "mt-1 size-4 shrink-0" }),
|
|
1875
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1876
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "Start Date" }),
|
|
1877
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: k(r, "MMM d, yyyy h:mm a") })
|
|
1878
|
+
] })
|
|
1879
|
+
] }),
|
|
1880
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
1881
|
+
/* @__PURE__ */ e(Ye, { className: "mt-1 size-4 shrink-0" }),
|
|
1882
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1883
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "End Date" }),
|
|
1884
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: k(a, "MMM d, yyyy h:mm a") })
|
|
1885
|
+
] })
|
|
1886
|
+
] }),
|
|
1887
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
1888
|
+
/* @__PURE__ */ e(St, { className: "mt-1 size-4 shrink-0" }),
|
|
1889
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1890
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "Description" }),
|
|
1891
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t.description })
|
|
1892
|
+
] })
|
|
1893
|
+
] })
|
|
1894
|
+
] }),
|
|
1895
|
+
/* @__PURE__ */ e(Ee, { children: /* @__PURE__ */ e(qn, { event: t, children: /* @__PURE__ */ e(I, { type: "button", variant: "outline", children: "Edit" }) }) })
|
|
1896
|
+
] })
|
|
1897
|
+
] }) });
|
|
1898
|
+
}
|
|
1899
|
+
const Zn = re(
|
|
1900
|
+
"mx-1 flex size-auto h-6.5 select-none items-center justify-between gap-1.5 truncate whitespace-nowrap rounded-md border px-2 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1901
|
+
{
|
|
1902
|
+
variants: {
|
|
1903
|
+
color: {
|
|
1904
|
+
// Colored and mixed variants
|
|
1905
|
+
blue: "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300 [&_.event-dot]:fill-blue-600",
|
|
1906
|
+
green: "border-green-200 bg-green-50 text-green-700 dark:border-green-800 dark:bg-green-950 dark:text-green-300 [&_.event-dot]:fill-green-600",
|
|
1907
|
+
red: "border-red-200 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300 [&_.event-dot]:fill-red-600",
|
|
1908
|
+
yellow: "border-yellow-200 bg-yellow-50 text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-300 [&_.event-dot]:fill-yellow-600",
|
|
1909
|
+
purple: "border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-300 [&_.event-dot]:fill-purple-600",
|
|
1910
|
+
orange: "border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-800 dark:bg-orange-950 dark:text-orange-300 [&_.event-dot]:fill-orange-600",
|
|
1911
|
+
gray: "border-neutral-200 bg-neutral-50 text-neutral-900 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300 [&_.event-dot]:fill-neutral-600",
|
|
1912
|
+
// Dot variants
|
|
1913
|
+
"blue-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-blue-600",
|
|
1914
|
+
"green-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-green-600",
|
|
1915
|
+
"red-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-red-600",
|
|
1916
|
+
"yellow-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-yellow-600",
|
|
1917
|
+
"purple-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-purple-600",
|
|
1918
|
+
"orange-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-orange-600",
|
|
1919
|
+
"gray-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-neutral-600"
|
|
1920
|
+
},
|
|
1921
|
+
multiDayPosition: {
|
|
1922
|
+
first: "relative z-10 mr-0 w-[calc(100%_-_3px)] rounded-r-none border-r-0 [&>span]:mr-2.5",
|
|
1923
|
+
middle: "relative z-10 mx-0 w-[calc(100%_+_1px)] rounded-none border-x-0",
|
|
1924
|
+
last: "ml-0 rounded-l-none border-l-0",
|
|
1925
|
+
none: ""
|
|
1926
|
+
}
|
|
1927
|
+
},
|
|
1928
|
+
defaultVariants: {
|
|
1929
|
+
color: "blue-dot"
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
);
|
|
1933
|
+
function nt({ event: t, cellDate: n, eventCurrentDay: r, eventTotalDays: a, className: d, position: c }) {
|
|
1934
|
+
const { badgeVariant: i } = T(), o = B(b(t.startDate)), s = Le(b(t.endDate));
|
|
1935
|
+
if (n < o || n > s) return null;
|
|
1936
|
+
let u;
|
|
1937
|
+
c ? u = c : r && a || $(o, s) ? u = "none" : $(n, o) ? u = "first" : $(n, s) ? u = "last" : u = "middle";
|
|
1938
|
+
const f = ["first", "none"].includes(u), h = i === "dot" ? `${t.color}-dot` : t.color, p = x(Zn({ color: h, multiDayPosition: u, className: d }));
|
|
1939
|
+
return /* @__PURE__ */ e(rr, { event: t, children: /* @__PURE__ */ e(rt, { event: t, children: /* @__PURE__ */ l("div", { role: "button", tabIndex: 0, className: p, onKeyDown: (m) => {
|
|
1940
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), m.currentTarget instanceof HTMLElement && m.currentTarget.click());
|
|
1941
|
+
}, children: [
|
|
1942
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5 truncate", children: [
|
|
1943
|
+
!["middle", "last"].includes(u) && ["mixed", "dot"].includes(i) && /* @__PURE__ */ e("svg", { width: "8", height: "8", viewBox: "0 0 8 8", className: "event-dot shrink-0", children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4" }) }),
|
|
1944
|
+
f && /* @__PURE__ */ l("p", { className: "flex-1 truncate font-semibold", children: [
|
|
1945
|
+
r && /* @__PURE__ */ l("span", { className: "text-xs", children: [
|
|
1946
|
+
"Day ",
|
|
1947
|
+
r,
|
|
1948
|
+
" of ",
|
|
1949
|
+
a,
|
|
1950
|
+
" •",
|
|
1951
|
+
" "
|
|
1952
|
+
] }),
|
|
1953
|
+
t.title
|
|
1954
|
+
] })
|
|
1955
|
+
] }),
|
|
1956
|
+
f && /* @__PURE__ */ e("span", { children: k(new Date(t.startDate), "h:mm a") })
|
|
1957
|
+
] }) }) });
|
|
1958
|
+
}
|
|
1959
|
+
const Oe = 3;
|
|
1960
|
+
function Xn({ cell: t, events: n, eventPositions: r }) {
|
|
1961
|
+
const { setSelectedDate: a } = T(), { day: d, currentMonth: c, date: i } = t, o = L(() => Cn(i, n, r), [i, n, r]), s = i.getDay() === 0, u = () => {
|
|
1962
|
+
a(i);
|
|
1963
|
+
};
|
|
1964
|
+
return /* @__PURE__ */ e(Gn, { cell: t, children: /* @__PURE__ */ l("div", { className: x("flex h-full flex-col gap-1 border-l border-t py-1.5 lg:pb-2 lg:pt-1", s && "border-l-0"), children: [
|
|
1965
|
+
/* @__PURE__ */ e(
|
|
1966
|
+
"button",
|
|
1967
|
+
{
|
|
1968
|
+
onClick: u,
|
|
1969
|
+
className: x(
|
|
1970
|
+
"flex size-6 translate-x-1 items-center justify-center rounded-full text-xs font-semibold hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring lg:px-2",
|
|
1971
|
+
!c && "opacity-20",
|
|
1972
|
+
yt(i) && "bg-primary font-bold text-primary-foreground hover:bg-primary"
|
|
1973
|
+
),
|
|
1974
|
+
children: d
|
|
1975
|
+
}
|
|
1976
|
+
),
|
|
1977
|
+
/* @__PURE__ */ e("div", { className: x("flex h-6 gap-1 px-2 lg:h-[94px] lg:flex-col lg:gap-2 lg:px-0", !c && "opacity-50"), children: [0, 1, 2].map((f) => {
|
|
1978
|
+
const h = o.find((g) => g.position === f), p = h ? `event-${h.id}-${f}` : `empty-${f}`;
|
|
1979
|
+
return /* @__PURE__ */ e("div", { className: "lg:flex-1", children: h && /* @__PURE__ */ l(he, { children: [
|
|
1980
|
+
/* @__PURE__ */ e(Kn, { className: "lg:hidden", color: h.color }),
|
|
1981
|
+
/* @__PURE__ */ e(nt, { className: "hidden lg:flex", event: h, cellDate: B(i) })
|
|
1982
|
+
] }) }, p);
|
|
1983
|
+
}) }),
|
|
1984
|
+
o.length > Oe && /* @__PURE__ */ l("p", { className: x("h-4.5 px-1.5 text-xs font-semibold text-muted-foreground", !c && "opacity-50"), children: [
|
|
1985
|
+
/* @__PURE__ */ l("span", { className: "sm:hidden", children: [
|
|
1986
|
+
"+",
|
|
1987
|
+
o.length - Oe
|
|
1988
|
+
] }),
|
|
1989
|
+
/* @__PURE__ */ l("span", { className: "hidden sm:inline", children: [
|
|
1990
|
+
" ",
|
|
1991
|
+
o.length - Oe,
|
|
1992
|
+
" more..."
|
|
1993
|
+
] })
|
|
1994
|
+
] })
|
|
1995
|
+
] }) });
|
|
1996
|
+
}
|
|
1997
|
+
const Jn = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
1998
|
+
function Qn({ singleDayEvents: t, multiDayEvents: n }) {
|
|
1999
|
+
const { selectedDate: r } = T(), a = [...n, ...t], d = L(() => Dn(r), [r]), c = L(
|
|
2000
|
+
() => kn(n, t, r),
|
|
2001
|
+
[n, t, r]
|
|
2002
|
+
);
|
|
2003
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
2004
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 divide-x", children: Jn.map((i) => /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-2", children: /* @__PURE__ */ e("span", { className: "text-xs font-medium text-muted-foreground", children: i }) }, i)) }),
|
|
2005
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 overflow-hidden", children: d.map((i) => /* @__PURE__ */ e(Xn, { cell: i, events: a, eventPositions: c }, i.date.toISOString())) })
|
|
2006
|
+
] });
|
|
2007
|
+
}
|
|
2008
|
+
const ge = w.forwardRef(
|
|
2009
|
+
({ className: t, children: n, ...r }, a) => /* @__PURE__ */ l(J.Root, { ref: a, className: x("relative overflow-hidden", t), ...r, children: [
|
|
2010
|
+
/* @__PURE__ */ e(J.Viewport, { className: "size-full rounded-[inherit]", children: n }),
|
|
2011
|
+
/* @__PURE__ */ e(nr, {}),
|
|
2012
|
+
/* @__PURE__ */ e(J.Corner, {})
|
|
2013
|
+
] })
|
|
2014
|
+
);
|
|
2015
|
+
ge.displayName = J.Root.displayName;
|
|
2016
|
+
const nr = w.forwardRef(
|
|
2017
|
+
({ className: t, orientation: n = "vertical", ...r }, a) => /* @__PURE__ */ e(
|
|
2018
|
+
J.ScrollAreaScrollbar,
|
|
2019
|
+
{
|
|
2020
|
+
ref: a,
|
|
2021
|
+
orientation: n,
|
|
2022
|
+
className: x(
|
|
2023
|
+
"flex touch-none select-none transition-colors",
|
|
2024
|
+
n === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
2025
|
+
n === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
2026
|
+
t
|
|
2027
|
+
),
|
|
2028
|
+
...r,
|
|
2029
|
+
children: /* @__PURE__ */ e(J.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
2030
|
+
}
|
|
2031
|
+
)
|
|
2032
|
+
);
|
|
2033
|
+
nr.displayName = J.ScrollAreaScrollbar.displayName;
|
|
2034
|
+
const ea = re(
|
|
2035
|
+
"flex select-none items-center justify-between gap-3 rounded-md border p-3 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2036
|
+
{
|
|
2037
|
+
variants: {
|
|
2038
|
+
color: {
|
|
2039
|
+
// Colored variants
|
|
2040
|
+
blue: "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300 [&_.event-dot]:fill-blue-600",
|
|
2041
|
+
green: "border-green-200 bg-green-50 text-green-700 dark:border-green-800 dark:bg-green-950 dark:text-green-300 [&_.event-dot]:fill-green-600",
|
|
2042
|
+
red: "border-red-200 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300 [&_.event-dot]:fill-red-600",
|
|
2043
|
+
yellow: "border-yellow-200 bg-yellow-50 text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-300 [&_.event-dot]:fill-yellow-600",
|
|
2044
|
+
purple: "border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-300 [&_.event-dot]:fill-purple-600",
|
|
2045
|
+
orange: "border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-800 dark:bg-orange-950 dark:text-orange-300 [&_.event-dot]:fill-orange-600",
|
|
2046
|
+
gray: "border-neutral-200 bg-neutral-50 text-neutral-900 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300 [&_.event-dot]:fill-neutral-600",
|
|
2047
|
+
// Dot variants
|
|
2048
|
+
"blue-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-blue-600",
|
|
2049
|
+
"green-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-green-600",
|
|
2050
|
+
"red-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-red-600",
|
|
2051
|
+
"orange-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-orange-600",
|
|
2052
|
+
"purple-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-purple-600",
|
|
2053
|
+
"yellow-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-yellow-600",
|
|
2054
|
+
"gray-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-neutral-600"
|
|
2055
|
+
}
|
|
2056
|
+
},
|
|
2057
|
+
defaultVariants: {
|
|
2058
|
+
color: "blue-dot"
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
);
|
|
2062
|
+
function gt({ event: t, eventCurrentDay: n, eventTotalDays: r, className: a }) {
|
|
2063
|
+
const { badgeVariant: d } = T(), c = b(t.startDate), i = b(t.endDate), o = d === "dot" ? `${t.color}-dot` : t.color, s = ea({ color: o, className: a });
|
|
2064
|
+
return /* @__PURE__ */ e(rt, { event: t, children: /* @__PURE__ */ e("div", { role: "button", tabIndex: 0, className: s, onKeyDown: (f) => {
|
|
2065
|
+
(f.key === "Enter" || f.key === " ") && (f.preventDefault(), f.currentTarget instanceof HTMLElement && f.currentTarget.click());
|
|
2066
|
+
}, children: /* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
|
|
2067
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
2068
|
+
["mixed", "dot"].includes(d) && /* @__PURE__ */ e("svg", { width: "8", height: "8", viewBox: "0 0 8 8", className: "event-dot shrink-0", children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4" }) }),
|
|
2069
|
+
/* @__PURE__ */ l("p", { className: "font-medium", children: [
|
|
2070
|
+
n && r && /* @__PURE__ */ l("span", { className: "mr-1 text-xs", children: [
|
|
2071
|
+
"Day ",
|
|
2072
|
+
n,
|
|
2073
|
+
" of ",
|
|
2074
|
+
r,
|
|
2075
|
+
" •",
|
|
2076
|
+
" "
|
|
2077
|
+
] }),
|
|
2078
|
+
t.title
|
|
2079
|
+
] })
|
|
2080
|
+
] }),
|
|
2081
|
+
/* @__PURE__ */ l("div", { className: "mt-1 flex items-center gap-1", children: [
|
|
2082
|
+
/* @__PURE__ */ e($e, { className: "size-3 shrink-0" }),
|
|
2083
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-foreground", children: t.user.name })
|
|
2084
|
+
] }),
|
|
2085
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
2086
|
+
/* @__PURE__ */ e(Ye, { className: "size-3 shrink-0" }),
|
|
2087
|
+
/* @__PURE__ */ l("p", { className: "text-xs text-foreground", children: [
|
|
2088
|
+
k(c, "h:mm a"),
|
|
2089
|
+
" - ",
|
|
2090
|
+
k(i, "h:mm a")
|
|
2091
|
+
] })
|
|
2092
|
+
] }),
|
|
2093
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
2094
|
+
/* @__PURE__ */ e(St, { className: "size-3 shrink-0" }),
|
|
2095
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-foreground", children: t.description })
|
|
2096
|
+
] })
|
|
2097
|
+
] }) }) });
|
|
2098
|
+
}
|
|
2099
|
+
function ta({ date: t, events: n, multiDayEvents: r }) {
|
|
2100
|
+
const a = [...n].sort((d, c) => new Date(d.startDate).getTime() - new Date(c.startDate).getTime());
|
|
2101
|
+
return /* @__PURE__ */ l("div", { className: "space-y-4", children: [
|
|
2102
|
+
/* @__PURE__ */ e("div", { className: "sticky top-0 flex items-center gap-4 bg-background py-2", children: /* @__PURE__ */ e("p", { className: "text-sm font-semibold", children: k(t, "EEEE, MMMM d, yyyy") }) }),
|
|
2103
|
+
/* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
2104
|
+
r.length > 0 && r.map((d) => {
|
|
2105
|
+
const c = B(b(d.startDate)), i = B(b(d.endDate)), o = B(t), s = Y(i, c) + 1, u = Y(o, c) + 1;
|
|
2106
|
+
return /* @__PURE__ */ e(gt, { event: d, eventCurrentDay: u, eventTotalDays: s }, d.id);
|
|
2107
|
+
}),
|
|
2108
|
+
a.length > 0 && a.map((d) => /* @__PURE__ */ e(gt, { event: d }, d.id))
|
|
2109
|
+
] })
|
|
2110
|
+
] });
|
|
2111
|
+
}
|
|
2112
|
+
function ra({ singleDayEvents: t, multiDayEvents: n }) {
|
|
2113
|
+
const { selectedDate: r } = T(), a = L(() => {
|
|
2114
|
+
const c = /* @__PURE__ */ new Map();
|
|
2115
|
+
return t.forEach((i) => {
|
|
2116
|
+
var u;
|
|
2117
|
+
const o = b(i.startDate);
|
|
2118
|
+
if (!De(o, r)) return;
|
|
2119
|
+
const s = k(o, "yyyy-MM-dd");
|
|
2120
|
+
c.has(s) || c.set(s, { date: B(o), events: [], multiDayEvents: [] }), (u = c.get(s)) == null || u.events.push(i);
|
|
2121
|
+
}), n.forEach((i) => {
|
|
2122
|
+
var h;
|
|
2123
|
+
const o = b(i.startDate), s = b(i.endDate);
|
|
2124
|
+
let u = B(o);
|
|
2125
|
+
const f = Le(s);
|
|
2126
|
+
for (; u <= f; ) {
|
|
2127
|
+
if (De(u, r)) {
|
|
2128
|
+
const p = k(u, "yyyy-MM-dd");
|
|
2129
|
+
c.has(p) || c.set(p, { date: new Date(u), events: [], multiDayEvents: [] }), (h = c.get(p)) == null || h.multiDayEvents.push(i);
|
|
2130
|
+
}
|
|
2131
|
+
u = new Date(u.setDate(u.getDate() + 1));
|
|
2132
|
+
}
|
|
2133
|
+
}), Array.from(c.values()).sort((i, o) => i.date.getTime() - o.date.getTime());
|
|
2134
|
+
}, [t, n, r]), d = t.length > 0 || n.length > 0;
|
|
2135
|
+
return /* @__PURE__ */ e("div", { className: "h-[800px]", children: /* @__PURE__ */ e(ge, { className: "h-full", type: "always", children: /* @__PURE__ */ l("div", { className: "space-y-6 p-4", children: [
|
|
2136
|
+
a.map((c) => /* @__PURE__ */ e(ta, { date: c.date, events: c.events, multiDayEvents: c.multiDayEvents }, k(c.date, "yyyy-MM-dd"))),
|
|
2137
|
+
!d && /* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-center gap-2 py-20 text-muted-foreground", children: [
|
|
2138
|
+
/* @__PURE__ */ e(Qr, { className: "size-10" }),
|
|
2139
|
+
/* @__PURE__ */ e("p", { className: "text-sm md:text-base", children: "No events scheduled for the selected month" })
|
|
2140
|
+
] })
|
|
2141
|
+
] }) }) });
|
|
2142
|
+
}
|
|
2143
|
+
const na = re(
|
|
2144
|
+
"flex select-none flex-col gap-0.5 truncate whitespace-nowrap rounded-md border px-2 py-1.5 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2145
|
+
{
|
|
2146
|
+
variants: {
|
|
2147
|
+
color: {
|
|
2148
|
+
// Colored and mixed variants
|
|
2149
|
+
blue: "border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300 [&_.event-dot]:fill-blue-600",
|
|
2150
|
+
green: "border-green-200 bg-green-50 text-green-700 dark:border-green-800 dark:bg-green-950 dark:text-green-300 [&_.event-dot]:fill-green-600",
|
|
2151
|
+
red: "border-red-200 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300 [&_.event-dot]:fill-red-600",
|
|
2152
|
+
yellow: "border-yellow-200 bg-yellow-50 text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-300 [&_.event-dot]:fill-yellow-600",
|
|
2153
|
+
purple: "border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-300 [&_.event-dot]:fill-purple-600",
|
|
2154
|
+
orange: "border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-800 dark:bg-orange-950 dark:text-orange-300 [&_.event-dot]:fill-orange-600",
|
|
2155
|
+
gray: "border-neutral-200 bg-neutral-50 text-neutral-700 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300 [&_.event-dot]:fill-neutral-600",
|
|
2156
|
+
// Dot variants
|
|
2157
|
+
"blue-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-blue-600",
|
|
2158
|
+
"green-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-green-600",
|
|
2159
|
+
"red-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-red-600",
|
|
2160
|
+
"orange-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-orange-600",
|
|
2161
|
+
"purple-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-purple-600",
|
|
2162
|
+
"yellow-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-yellow-600",
|
|
2163
|
+
"gray-dot": "bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-neutral-600"
|
|
2164
|
+
}
|
|
2165
|
+
},
|
|
2166
|
+
defaultVariants: {
|
|
2167
|
+
color: "blue-dot"
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
);
|
|
2171
|
+
function ar({ event: t, className: n }) {
|
|
2172
|
+
const { badgeVariant: r } = T(), a = b(t.startDate), d = b(t.endDate), c = bt(d, a), i = c / 60 * 96 - 8, o = r === "dot" ? `${t.color}-dot` : t.color, s = x(na({ color: o, className: n }), c < 35 && "py-0 justify-center"), u = (f) => {
|
|
2173
|
+
(f.key === "Enter" || f.key === " ") && (f.preventDefault(), f.currentTarget instanceof HTMLElement && f.currentTarget.click());
|
|
2174
|
+
};
|
|
2175
|
+
return /* @__PURE__ */ e(rr, { event: t, children: /* @__PURE__ */ e(rt, { event: t, children: /* @__PURE__ */ l("div", { role: "button", tabIndex: 0, className: s, style: { height: `${i}px` }, onKeyDown: u, children: [
|
|
2176
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5 truncate", children: [
|
|
2177
|
+
["mixed", "dot"].includes(r) && /* @__PURE__ */ e("svg", { width: "8", height: "8", viewBox: "0 0 8 8", className: "event-dot shrink-0", children: /* @__PURE__ */ e("circle", { cx: "4", cy: "4", r: "4" }) }),
|
|
2178
|
+
/* @__PURE__ */ e("p", { className: "truncate font-semibold", children: t.title })
|
|
2179
|
+
] }),
|
|
2180
|
+
c > 25 && /* @__PURE__ */ l("p", { children: [
|
|
2181
|
+
k(a, "h:mm a"),
|
|
2182
|
+
" - ",
|
|
2183
|
+
k(d, "h:mm a")
|
|
2184
|
+
] })
|
|
2185
|
+
] }) }) });
|
|
2186
|
+
}
|
|
2187
|
+
function q({ date: t, hour: n, minute: r, children: a }) {
|
|
2188
|
+
const { updateEvent: d } = tr(), [{ isOver: c, canDrop: i }, o] = Dt(
|
|
2189
|
+
() => ({
|
|
2190
|
+
accept: tt.EVENT,
|
|
2191
|
+
drop: (s) => {
|
|
2192
|
+
const u = s.event, f = b(u.startDate), h = b(u.endDate), p = Nt(h, f), g = new Date(t);
|
|
2193
|
+
g.setHours(n, r, 0, 0);
|
|
2194
|
+
const m = new Date(g.getTime() + p);
|
|
2195
|
+
return d({
|
|
2196
|
+
...u,
|
|
2197
|
+
startDate: g.toISOString(),
|
|
2198
|
+
endDate: m.toISOString()
|
|
2199
|
+
}), { moved: !0 };
|
|
2200
|
+
},
|
|
2201
|
+
collect: (s) => ({
|
|
2202
|
+
isOver: s.isOver(),
|
|
2203
|
+
canDrop: s.canDrop()
|
|
2204
|
+
})
|
|
2205
|
+
}),
|
|
2206
|
+
[t, n, r, d]
|
|
2207
|
+
);
|
|
2208
|
+
return /* @__PURE__ */ e("div", { ref: o, className: x("h-[24px]", c && i && "bg-accent/50"), children: a });
|
|
2209
|
+
}
|
|
2210
|
+
function or({ firstVisibleHour: t, lastVisibleHour: n }) {
|
|
2211
|
+
const [r, a] = j(/* @__PURE__ */ new Date());
|
|
2212
|
+
oe(() => {
|
|
2213
|
+
const o = setInterval(() => a(/* @__PURE__ */ new Date()), 6e4);
|
|
2214
|
+
return () => clearInterval(o);
|
|
2215
|
+
}, []);
|
|
2216
|
+
const d = () => {
|
|
2217
|
+
const o = r.getHours() * 60 + r.getMinutes(), s = t * 60, f = n * 60 - s;
|
|
2218
|
+
return (o - s) / f * 100;
|
|
2219
|
+
}, c = () => k(r, "h:mm a"), i = r.getHours();
|
|
2220
|
+
return i < t || i >= n ? null : /* @__PURE__ */ l("div", { className: "pointer-events-none absolute inset-x-0 z-50 border-t border-primary", style: { top: `${d()}%` }, children: [
|
|
2221
|
+
/* @__PURE__ */ e("div", { className: "absolute left-0 top-0 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary" }),
|
|
2222
|
+
/* @__PURE__ */ e("div", { className: "absolute -left-18 flex w-16 -translate-y-1/2 justify-end bg-background pr-1 text-xs font-medium text-primary", children: c() })
|
|
2223
|
+
] });
|
|
2224
|
+
}
|
|
2225
|
+
function aa({ selectedDate: t, multiDayEvents: n }) {
|
|
2226
|
+
const r = B(t), a = Le(t), d = n.filter((c) => {
|
|
2227
|
+
const i = b(c.startDate), o = b(c.endDate);
|
|
2228
|
+
return He(r, { start: i, end: o }) || He(a, { start: i, end: o }) || i <= r && o >= a;
|
|
2229
|
+
}).sort((c, i) => {
|
|
2230
|
+
const o = Y(b(c.endDate), b(c.startDate));
|
|
2231
|
+
return Y(b(i.endDate), b(i.startDate)) - o;
|
|
2232
|
+
});
|
|
2233
|
+
return d.length === 0 ? null : /* @__PURE__ */ l("div", { className: "flex border-b", children: [
|
|
2234
|
+
/* @__PURE__ */ e("div", { className: "w-18" }),
|
|
2235
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col gap-1 border-l py-1", children: d.map((c) => {
|
|
2236
|
+
const i = B(b(c.startDate)), o = B(b(c.endDate)), s = B(t), u = Y(o, i) + 1, f = Y(s, i) + 1;
|
|
2237
|
+
return /* @__PURE__ */ e(nt, { event: c, cellDate: t, eventCurrentDay: f, eventTotalDays: u }, c.id);
|
|
2238
|
+
}) })
|
|
2239
|
+
] });
|
|
2240
|
+
}
|
|
2241
|
+
function oa({ singleDayEvents: t, multiDayEvents: n }) {
|
|
2242
|
+
const { selectedDate: r, setSelectedDate: a, users: d, visibleHours: c, workingHours: i } = T(), { hours: o, earliestEventHour: s, latestEventHour: u } = jt(c, t), f = wn(t), h = t.filter((g) => {
|
|
2243
|
+
const m = b(g.startDate);
|
|
2244
|
+
return m.getDate() === r.getDate() && m.getMonth() === r.getMonth() && m.getFullYear() === r.getFullYear();
|
|
2245
|
+
}), p = At(h);
|
|
2246
|
+
return /* @__PURE__ */ l("div", { className: "flex", children: [
|
|
2247
|
+
/* @__PURE__ */ l("div", { className: "flex flex-1 flex-col", children: [
|
|
2248
|
+
/* @__PURE__ */ l("div", { children: [
|
|
2249
|
+
/* @__PURE__ */ e(aa, { selectedDate: r, multiDayEvents: n }),
|
|
2250
|
+
/* @__PURE__ */ l("div", { className: "relative z-20 flex border-b", children: [
|
|
2251
|
+
/* @__PURE__ */ e("div", { className: "w-18" }),
|
|
2252
|
+
/* @__PURE__ */ l("span", { className: "flex-1 border-l py-2 text-center text-xs font-medium text-muted-foreground", children: [
|
|
2253
|
+
k(r, "EE"),
|
|
2254
|
+
" ",
|
|
2255
|
+
/* @__PURE__ */ e("span", { className: "font-semibold text-foreground", children: k(r, "d") })
|
|
2256
|
+
] })
|
|
2257
|
+
] })
|
|
2258
|
+
] }),
|
|
2259
|
+
/* @__PURE__ */ e(ge, { className: "h-[800px]", type: "always", children: /* @__PURE__ */ l("div", { className: "flex", children: [
|
|
2260
|
+
/* @__PURE__ */ e("div", { className: "relative w-18", children: o.map((g, m) => /* @__PURE__ */ e("div", { className: "relative", style: { height: "96px" }, children: /* @__PURE__ */ e("div", { className: "absolute -top-3 right-2 flex h-6 items-center", children: m !== 0 && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: k((/* @__PURE__ */ new Date()).setHours(g, 0, 0, 0), "hh a") }) }) }, g)) }),
|
|
2261
|
+
/* @__PURE__ */ l("div", { className: "relative flex-1 border-l", children: [
|
|
2262
|
+
/* @__PURE__ */ l("div", { className: "relative", children: [
|
|
2263
|
+
o.map((g, m) => {
|
|
2264
|
+
const v = !Vt(r, g, i);
|
|
2265
|
+
return /* @__PURE__ */ l("div", { className: x("relative", v && "bg-calendar-disabled-hour"), style: { height: "96px" }, children: [
|
|
2266
|
+
m !== 0 && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-x-0 top-0 border-b" }),
|
|
2267
|
+
/* @__PURE__ */ e(q, { date: r, hour: g, minute: 0, children: /* @__PURE__ */ e(K, { startDate: r, startTime: { hour: g, minute: 0 }, children: /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-0 h-[24px] cursor-pointer transition-colors hover:bg-accent" }) }) }),
|
|
2268
|
+
/* @__PURE__ */ e(q, { date: r, hour: g, minute: 15, children: /* @__PURE__ */ e(K, { startDate: r, startTime: { hour: g, minute: 15 }, children: /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[24px] h-[24px] cursor-pointer transition-colors hover:bg-accent" }) }) }),
|
|
2269
|
+
/* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-x-0 top-1/2 border-b border-dashed" }),
|
|
2270
|
+
/* @__PURE__ */ e(q, { date: r, hour: g, minute: 30, children: /* @__PURE__ */ e(K, { startDate: r, startTime: { hour: g, minute: 30 }, children: /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[48px] h-[24px] cursor-pointer transition-colors hover:bg-accent" }) }) }),
|
|
2271
|
+
/* @__PURE__ */ e(q, { date: r, hour: g, minute: 45, children: /* @__PURE__ */ e(K, { startDate: r, startTime: { hour: g, minute: 45 }, children: /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[72px] h-[24px] cursor-pointer transition-colors hover:bg-accent" }) }) })
|
|
2272
|
+
] }, g);
|
|
2273
|
+
}),
|
|
2274
|
+
p.map(
|
|
2275
|
+
(g, m) => g.map((v) => {
|
|
2276
|
+
let y = Rt(v, r, m, p.length, { from: s, to: u });
|
|
2277
|
+
return p.some(
|
|
2278
|
+
(S, _) => _ !== m && S.some(
|
|
2279
|
+
(A) => wt(
|
|
2280
|
+
{ start: b(v.startDate), end: b(v.endDate) },
|
|
2281
|
+
{ start: b(A.startDate), end: b(A.endDate) }
|
|
2282
|
+
)
|
|
2283
|
+
)
|
|
2284
|
+
) || (y = { ...y, width: "100%", left: "0%" }), /* @__PURE__ */ e("div", { className: "absolute p-1", style: y, children: /* @__PURE__ */ e(ar, { event: v }) }, v.id);
|
|
2285
|
+
})
|
|
2286
|
+
)
|
|
2287
|
+
] }),
|
|
2288
|
+
/* @__PURE__ */ e(or, { firstVisibleHour: s, lastVisibleHour: u })
|
|
2289
|
+
] })
|
|
2290
|
+
] }) })
|
|
2291
|
+
] }),
|
|
2292
|
+
/* @__PURE__ */ l("div", { className: "hidden w-64 divide-y border-l md:block", children: [
|
|
2293
|
+
/* @__PURE__ */ e(Ze, { className: "mx-auto w-fit", mode: "single", selected: r, onSelect: a, initialFocus: !0 }),
|
|
2294
|
+
/* @__PURE__ */ l("div", { className: "flex-1 space-y-3", children: [
|
|
2295
|
+
f.length > 0 ? /* @__PURE__ */ l("div", { className: "flex items-start gap-2 px-4 pt-4", children: [
|
|
2296
|
+
/* @__PURE__ */ l("span", { className: "relative mt-[5px] flex size-2.5", children: [
|
|
2297
|
+
/* @__PURE__ */ e("span", { className: "absolute inline-flex size-full animate-ping rounded-full bg-green-400 opacity-75" }),
|
|
2298
|
+
/* @__PURE__ */ e("span", { className: "relative inline-flex size-2.5 rounded-full bg-green-600" })
|
|
2299
|
+
] }),
|
|
2300
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-semibold text-foreground", children: "Happening now" })
|
|
2301
|
+
] }) : /* @__PURE__ */ e("p", { className: "p-4 text-center text-sm italic text-muted-foreground", children: "No appointments or consultations at the moment" }),
|
|
2302
|
+
f.length > 0 && /* @__PURE__ */ e(ge, { className: "h-[422px] px-4", type: "always", children: /* @__PURE__ */ e("div", { className: "space-y-6 pb-4", children: f.map((g) => {
|
|
2303
|
+
const m = d.find((v) => v.id === g.user.id);
|
|
2304
|
+
return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
2305
|
+
/* @__PURE__ */ e("p", { className: "line-clamp-2 text-sm font-semibold", children: g.title }),
|
|
2306
|
+
m && /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
|
|
2307
|
+
/* @__PURE__ */ e($e, { className: "size-3.5" }),
|
|
2308
|
+
/* @__PURE__ */ e("span", { className: "text-sm", children: m.name })
|
|
2309
|
+
] }),
|
|
2310
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
|
|
2311
|
+
/* @__PURE__ */ e(Ue, { className: "size-3.5" }),
|
|
2312
|
+
/* @__PURE__ */ e("span", { className: "text-sm", children: k(/* @__PURE__ */ new Date(), "MMM d, yyyy") })
|
|
2313
|
+
] }),
|
|
2314
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
|
|
2315
|
+
/* @__PURE__ */ e(Ye, { className: "size-3.5" }),
|
|
2316
|
+
/* @__PURE__ */ l("span", { className: "text-sm", children: [
|
|
2317
|
+
k(b(g.startDate), "h:mm a"),
|
|
2318
|
+
" - ",
|
|
2319
|
+
k(b(g.endDate), "h:mm a")
|
|
2320
|
+
] })
|
|
2321
|
+
] })
|
|
2322
|
+
] }, g.id);
|
|
2323
|
+
}) }) })
|
|
2324
|
+
] })
|
|
2325
|
+
] })
|
|
2326
|
+
] });
|
|
2327
|
+
}
|
|
2328
|
+
function sa({ selectedDate: t, multiDayEvents: n }) {
|
|
2329
|
+
const r = Be(t), a = vt(t), d = Array.from({ length: 7 }, (s, u) => je(r, u)), c = L(() => n.map((s) => {
|
|
2330
|
+
const u = b(s.startDate), f = b(s.endDate), h = Fr(u, r) ? r : u, p = Hr(f, a) ? a : f, g = Y(h, r), m = Y(p, r);
|
|
2331
|
+
return {
|
|
2332
|
+
...s,
|
|
2333
|
+
adjustedStart: h,
|
|
2334
|
+
adjustedEnd: p,
|
|
2335
|
+
startIndex: g,
|
|
2336
|
+
endIndex: m
|
|
2337
|
+
};
|
|
2338
|
+
}).sort((s, u) => {
|
|
2339
|
+
const f = s.adjustedStart.getTime() - u.adjustedStart.getTime();
|
|
2340
|
+
return f !== 0 ? f : u.endIndex - u.startIndex - (s.endIndex - s.startIndex);
|
|
2341
|
+
}), [n, r, a]), i = L(() => {
|
|
2342
|
+
const s = [];
|
|
2343
|
+
return c.forEach((u) => {
|
|
2344
|
+
let f = s.findIndex((h) => h.every((p) => p.endIndex < u.startIndex || p.startIndex > u.endIndex));
|
|
2345
|
+
f === -1 && (f = s.length, s.push([])), s[f].push(u);
|
|
2346
|
+
}), s;
|
|
2347
|
+
}, [c]);
|
|
2348
|
+
return L(() => n.some((s) => {
|
|
2349
|
+
const u = b(s.startDate), f = b(s.endDate);
|
|
2350
|
+
return (
|
|
2351
|
+
// Event starts within the week
|
|
2352
|
+
u >= r && u <= a || // Event ends within the week
|
|
2353
|
+
f >= r && f <= a || // Event spans the entire week
|
|
2354
|
+
u <= r && f >= a
|
|
2355
|
+
);
|
|
2356
|
+
}), [n, r, a]) ? /* @__PURE__ */ l("div", { className: "hidden overflow-hidden sm:flex", children: [
|
|
2357
|
+
/* @__PURE__ */ e("div", { className: "w-18 border-b" }),
|
|
2358
|
+
/* @__PURE__ */ e("div", { className: "grid flex-1 grid-cols-7 divide-x border-b border-l", children: d.map((s, u) => /* @__PURE__ */ e("div", { className: "flex h-full flex-col gap-1 py-1", children: i.map((f, h) => {
|
|
2359
|
+
const p = f.find((m) => m.startIndex <= u && m.endIndex >= u);
|
|
2360
|
+
if (!p)
|
|
2361
|
+
return /* @__PURE__ */ e("div", { className: "h-6.5" }, `${h}-${u}`);
|
|
2362
|
+
let g = "none";
|
|
2363
|
+
return u === p.startIndex && u === p.endIndex ? g = "none" : u === p.startIndex ? g = "first" : u === p.endIndex ? g = "last" : g = "middle", /* @__PURE__ */ e(nt, { event: p, cellDate: B(s), position: g }, `${p.id}-${u}`);
|
|
2364
|
+
}) }, s.toISOString())) })
|
|
2365
|
+
] }) : null;
|
|
2366
|
+
}
|
|
2367
|
+
function la({ singleDayEvents: t, multiDayEvents: n }) {
|
|
2368
|
+
const { selectedDate: r, workingHours: a, visibleHours: d } = T(), { hours: c, earliestEventHour: i, latestEventHour: o } = jt(d, t), s = Be(r), u = Array.from({ length: 7 }, (f, h) => je(s, h));
|
|
2369
|
+
return /* @__PURE__ */ l(he, { children: [
|
|
2370
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-center border-b py-4 text-sm text-muted-foreground sm:hidden", children: [
|
|
2371
|
+
/* @__PURE__ */ e("p", { children: "Weekly view is not available on smaller devices." }),
|
|
2372
|
+
/* @__PURE__ */ e("p", { children: "Please switch to daily or monthly view." })
|
|
2373
|
+
] }),
|
|
2374
|
+
/* @__PURE__ */ l("div", { className: "hidden flex-col sm:flex", children: [
|
|
2375
|
+
/* @__PURE__ */ l("div", { children: [
|
|
2376
|
+
/* @__PURE__ */ e(sa, { selectedDate: r, multiDayEvents: n }),
|
|
2377
|
+
/* @__PURE__ */ l("div", { className: "relative z-20 flex border-b", children: [
|
|
2378
|
+
/* @__PURE__ */ e("div", { className: "w-18" }),
|
|
2379
|
+
/* @__PURE__ */ e("div", { className: "grid flex-1 grid-cols-7 divide-x border-l", children: u.map((f, h) => /* @__PURE__ */ l("span", { className: "py-2 text-center text-xs font-medium text-muted-foreground", children: [
|
|
2380
|
+
k(f, "EE"),
|
|
2381
|
+
" ",
|
|
2382
|
+
/* @__PURE__ */ e("span", { className: "ml-1 font-semibold text-foreground", children: k(f, "d") })
|
|
2383
|
+
] }, h)) })
|
|
2384
|
+
] })
|
|
2385
|
+
] }),
|
|
2386
|
+
/* @__PURE__ */ e(ge, { className: "h-[736px]", type: "always", children: /* @__PURE__ */ l("div", { className: "flex overflow-hidden", children: [
|
|
2387
|
+
/* @__PURE__ */ e("div", { className: "relative w-18", children: c.map((f, h) => /* @__PURE__ */ e("div", { className: "relative", style: { height: "96px" }, children: /* @__PURE__ */ e("div", { className: "absolute -top-3 right-2 flex h-6 items-center", children: h !== 0 && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: k((/* @__PURE__ */ new Date()).setHours(f, 0, 0, 0), "hh a") }) }) }, f)) }),
|
|
2388
|
+
/* @__PURE__ */ l("div", { className: "relative flex-1 border-l", children: [
|
|
2389
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-7 divide-x", children: u.map((f, h) => {
|
|
2390
|
+
const p = t.filter((m) => $(b(m.startDate), f) || $(b(m.endDate), f)), g = At(p);
|
|
2391
|
+
return /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
2392
|
+
c.map((m, v) => {
|
|
2393
|
+
const y = !Vt(f, m, a);
|
|
2394
|
+
return /* @__PURE__ */ l("div", { className: x("relative", y && "bg-calendar-disabled-hour"), style: { height: "96px" }, children: [
|
|
2395
|
+
v !== 0 && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-x-0 top-0 border-b" }),
|
|
2396
|
+
/* @__PURE__ */ e(q, { date: f, hour: m, minute: 0, children: /* @__PURE__ */ e(K, { startDate: f, startTime: { hour: m, minute: 0 }, children: /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-0 h-[24px] cursor-pointer transition-colors hover:bg-accent" }) }) }),
|
|
2397
|
+
/* @__PURE__ */ e(q, { date: f, hour: m, minute: 15, children: /* @__PURE__ */ e(K, { startDate: f, startTime: { hour: m, minute: 15 }, children: /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[24px] h-[24px] cursor-pointer transition-colors hover:bg-accent" }) }) }),
|
|
2398
|
+
/* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-x-0 top-1/2 border-b border-dashed" }),
|
|
2399
|
+
/* @__PURE__ */ e(q, { date: f, hour: m, minute: 30, children: /* @__PURE__ */ e(K, { startDate: f, startTime: { hour: m, minute: 30 }, children: /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[48px] h-[24px] cursor-pointer transition-colors hover:bg-accent" }) }) }),
|
|
2400
|
+
/* @__PURE__ */ e(q, { date: f, hour: m, minute: 45, children: /* @__PURE__ */ e(K, { startDate: f, startTime: { hour: m, minute: 45 }, children: /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[72px] h-[24px] cursor-pointer transition-colors hover:bg-accent" }) }) })
|
|
2401
|
+
] }, m);
|
|
2402
|
+
}),
|
|
2403
|
+
g.map(
|
|
2404
|
+
(m, v) => m.map((y) => {
|
|
2405
|
+
let C = Rt(y, f, v, g.length, { from: i, to: o });
|
|
2406
|
+
return g.some(
|
|
2407
|
+
(_, A) => A !== v && _.some(
|
|
2408
|
+
(ne) => wt(
|
|
2409
|
+
{ start: b(y.startDate), end: b(y.endDate) },
|
|
2410
|
+
{ start: b(ne.startDate), end: b(ne.endDate) }
|
|
2411
|
+
)
|
|
2412
|
+
)
|
|
2413
|
+
) || (C = { ...C, width: "100%", left: "0%" }), /* @__PURE__ */ e("div", { className: "absolute p-1", style: C, children: /* @__PURE__ */ e(ar, { event: y }) }, y.id);
|
|
2414
|
+
})
|
|
2415
|
+
)
|
|
2416
|
+
] }, h);
|
|
2417
|
+
}) }),
|
|
2418
|
+
/* @__PURE__ */ e(or, { firstVisibleHour: i, lastVisibleHour: o })
|
|
2419
|
+
] })
|
|
2420
|
+
] }) })
|
|
2421
|
+
] })
|
|
2422
|
+
] });
|
|
2423
|
+
}
|
|
2424
|
+
function Ha({
|
|
2425
|
+
view: t,
|
|
2426
|
+
onViewChange: n,
|
|
2427
|
+
showHeader: r = !0,
|
|
2428
|
+
headerProps: a = {},
|
|
2429
|
+
className: d,
|
|
2430
|
+
headerClassName: c,
|
|
2431
|
+
contentClassName: i
|
|
2432
|
+
}) {
|
|
2433
|
+
const { selectedDate: o, selectedUserId: s, events: u } = T(), f = L(() => u.filter((m) => {
|
|
2434
|
+
const v = b(m.startDate), y = b(m.endDate);
|
|
2435
|
+
if (t === "year") {
|
|
2436
|
+
const C = new Date(o.getFullYear(), 0, 1), S = new Date(o.getFullYear(), 11, 31, 23, 59, 59, 999), _ = v <= S && y >= C, A = s === "all" || m.user.id === s;
|
|
2437
|
+
return _ && A;
|
|
2438
|
+
}
|
|
2439
|
+
if (t === "month" || t === "agenda") {
|
|
2440
|
+
const C = new Date(o.getFullYear(), o.getMonth(), 1), S = new Date(o.getFullYear(), o.getMonth() + 1, 0, 23, 59, 59, 999), _ = v <= S && y >= C, A = s === "all" || m.user.id === s;
|
|
2441
|
+
return _ && A;
|
|
2442
|
+
}
|
|
2443
|
+
if (t === "week") {
|
|
2444
|
+
const C = o.getDay(), S = new Date(o);
|
|
2445
|
+
S.setDate(o.getDate() - C), S.setHours(0, 0, 0, 0);
|
|
2446
|
+
const _ = new Date(S);
|
|
2447
|
+
_.setDate(S.getDate() + 6), _.setHours(23, 59, 59, 999);
|
|
2448
|
+
const A = v <= _ && y >= S, ne = s === "all" || m.user.id === s;
|
|
2449
|
+
return A && ne;
|
|
2450
|
+
}
|
|
2451
|
+
if (t === "day") {
|
|
2452
|
+
const C = new Date(o.getFullYear(), o.getMonth(), o.getDate(), 0, 0, 0), S = new Date(o.getFullYear(), o.getMonth(), o.getDate(), 23, 59, 59), _ = v <= S && y >= C, A = s === "all" || m.user.id === s;
|
|
2453
|
+
return _ && A;
|
|
2454
|
+
}
|
|
2455
|
+
}), [o, s, u, t]), h = f.filter((m) => {
|
|
2456
|
+
const v = b(m.startDate), y = b(m.endDate);
|
|
2457
|
+
return $(v, y);
|
|
2458
|
+
}), p = f.filter((m) => {
|
|
2459
|
+
const v = b(m.startDate), y = b(m.endDate);
|
|
2460
|
+
return !$(v, y);
|
|
2461
|
+
}), g = L(() => f.map((m) => ({ ...m, endDate: m.startDate })), [f]);
|
|
2462
|
+
return /* @__PURE__ */ l("div", { className: x("overflow-hidden rounded-xl border", d), children: [
|
|
2463
|
+
r && /* @__PURE__ */ e(
|
|
2464
|
+
Ln,
|
|
2465
|
+
{
|
|
2466
|
+
view: t,
|
|
2467
|
+
events: f,
|
|
2468
|
+
onViewChange: n,
|
|
2469
|
+
className: x(c, a.className),
|
|
2470
|
+
...a
|
|
2471
|
+
}
|
|
2472
|
+
),
|
|
2473
|
+
/* @__PURE__ */ e(fn, { children: /* @__PURE__ */ l("div", { className: i, children: [
|
|
2474
|
+
t === "day" && /* @__PURE__ */ e(oa, { singleDayEvents: h, multiDayEvents: p }),
|
|
2475
|
+
t === "month" && /* @__PURE__ */ e(Qn, { singleDayEvents: h, multiDayEvents: p }),
|
|
2476
|
+
t === "week" && /* @__PURE__ */ e(la, { singleDayEvents: h, multiDayEvents: p }),
|
|
2477
|
+
t === "year" && /* @__PURE__ */ e(Un, { allEvents: g }),
|
|
2478
|
+
t === "agenda" && /* @__PURE__ */ e(ra, { singleDayEvents: h, multiDayEvents: p })
|
|
2479
|
+
] }) })
|
|
2480
|
+
] });
|
|
2481
|
+
}
|
|
2482
|
+
function Aa() {
|
|
2483
|
+
const { badgeVariant: t, setBadgeVariant: n } = T();
|
|
2484
|
+
return /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
2485
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-semibold", children: "Change badge variant" }),
|
|
2486
|
+
/* @__PURE__ */ l(ie, { value: t, onValueChange: n, children: [
|
|
2487
|
+
/* @__PURE__ */ e(ee, { className: "w-48", children: /* @__PURE__ */ e(de, {}) }),
|
|
2488
|
+
/* @__PURE__ */ l(te, { children: [
|
|
2489
|
+
/* @__PURE__ */ e(M, { value: "dot", children: "Dot" }),
|
|
2490
|
+
/* @__PURE__ */ e(M, { value: "colored", children: "Colored" }),
|
|
2491
|
+
/* @__PURE__ */ e(M, { value: "mixed", children: "Mixed" })
|
|
2492
|
+
] })
|
|
2493
|
+
] })
|
|
2494
|
+
] });
|
|
2495
|
+
}
|
|
2496
|
+
const sr = le.Provider, lr = le.Root, ir = le.Trigger, at = w.forwardRef(({ className: t, sideOffset: n = 4, ...r }, a) => /* @__PURE__ */ e(le.Portal, { children: /* @__PURE__ */ e(
|
|
2497
|
+
le.Content,
|
|
2498
|
+
{
|
|
2499
|
+
ref: a,
|
|
2500
|
+
sideOffset: n,
|
|
2501
|
+
className: x(
|
|
2502
|
+
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground 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 origin-[--radix-tooltip-content-transform-origin]",
|
|
2503
|
+
t
|
|
2504
|
+
),
|
|
2505
|
+
...r
|
|
2506
|
+
}
|
|
2507
|
+
) }));
|
|
2508
|
+
at.displayName = le.Content.displayName;
|
|
2509
|
+
function Ra() {
|
|
2510
|
+
const { visibleHours: t, setVisibleHours: n } = T(), [r, a] = j({ hour: t.from, minute: 0 }), [d, c] = j({ hour: t.to, minute: 0 });
|
|
2511
|
+
return /* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
|
|
2512
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2513
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-semibold", children: "Change visible hours" }),
|
|
2514
|
+
/* @__PURE__ */ e(sr, { delayDuration: 100, children: /* @__PURE__ */ l(lr, { children: [
|
|
2515
|
+
/* @__PURE__ */ e(ir, { children: /* @__PURE__ */ e(Mt, { className: "size-3" }) }),
|
|
2516
|
+
/* @__PURE__ */ e(at, { className: "max-w-80 text-center", children: /* @__PURE__ */ e("p", { children: "If an event falls outside the specified visible hours, the visible hours will automatically adjust to include that event." }) })
|
|
2517
|
+
] }) })
|
|
2518
|
+
] }),
|
|
2519
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-4", children: [
|
|
2520
|
+
/* @__PURE__ */ e("p", { children: "From" }),
|
|
2521
|
+
/* @__PURE__ */ e(G, { id: "start-time", hourCycle: 12, granularity: "hour", value: r, onChange: a }),
|
|
2522
|
+
/* @__PURE__ */ e("p", { children: "To" }),
|
|
2523
|
+
/* @__PURE__ */ e(G, { id: "end-time", hourCycle: 12, granularity: "hour", value: d, onChange: c })
|
|
2524
|
+
] }),
|
|
2525
|
+
/* @__PURE__ */ e(I, { className: "mt-4 w-fit", onClick: () => {
|
|
2526
|
+
const o = d.hour === 0 ? 24 : d.hour;
|
|
2527
|
+
n({ from: r.hour, to: o });
|
|
2528
|
+
}, children: "Apply" })
|
|
2529
|
+
] });
|
|
2530
|
+
}
|
|
2531
|
+
const dr = w.forwardRef(
|
|
2532
|
+
({ className: t, ...n }, r) => /* @__PURE__ */ e(
|
|
2533
|
+
Re.Root,
|
|
2534
|
+
{
|
|
2535
|
+
className: x(
|
|
2536
|
+
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
2537
|
+
t
|
|
2538
|
+
),
|
|
2539
|
+
...n,
|
|
2540
|
+
ref: r,
|
|
2541
|
+
children: /* @__PURE__ */ e(
|
|
2542
|
+
Re.Thumb,
|
|
2543
|
+
{
|
|
2544
|
+
className: x(
|
|
2545
|
+
"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
2546
|
+
)
|
|
2547
|
+
}
|
|
2548
|
+
)
|
|
2549
|
+
}
|
|
2550
|
+
)
|
|
2551
|
+
);
|
|
2552
|
+
dr.displayName = Re.Root.displayName;
|
|
2553
|
+
const ia = [
|
|
2554
|
+
{ index: 0, name: "Sunday" },
|
|
2555
|
+
{ index: 1, name: "Monday" },
|
|
2556
|
+
{ index: 2, name: "Tuesday" },
|
|
2557
|
+
{ index: 3, name: "Wednesday" },
|
|
2558
|
+
{ index: 4, name: "Thursday" },
|
|
2559
|
+
{ index: 5, name: "Friday" },
|
|
2560
|
+
{ index: 6, name: "Saturday" }
|
|
2561
|
+
];
|
|
2562
|
+
function Va() {
|
|
2563
|
+
const { workingHours: t, setWorkingHours: n } = T(), [r, a] = j({ ...t }), d = (o) => {
|
|
2564
|
+
a((s) => ({
|
|
2565
|
+
...s,
|
|
2566
|
+
[o]: s[o].from > 0 || s[o].to > 0 ? { from: 0, to: 0 } : { from: 9, to: 17 }
|
|
2567
|
+
}));
|
|
2568
|
+
}, c = (o, s, u) => {
|
|
2569
|
+
u && a((f) => {
|
|
2570
|
+
const h = { ...f[o], [s]: u.hour };
|
|
2571
|
+
return s === "to" && u.hour === 0 && h.from === 0 && (h.to = 24), { ...f, [o]: h };
|
|
2572
|
+
});
|
|
2573
|
+
}, i = () => {
|
|
2574
|
+
const o = { ...r };
|
|
2575
|
+
for (const s in o) {
|
|
2576
|
+
const u = o[parseInt(s)];
|
|
2577
|
+
r[parseInt(s)].from > 0 || r[parseInt(s)].to > 0 ? u.from === 0 && u.to === 0 ? o[s] = { from: 0, to: 24 } : u.to === 0 && u.from > 0 && (o[s] = { ...u, to: 24 }) : o[s] = { from: 0, to: 0 };
|
|
2578
|
+
}
|
|
2579
|
+
n(o);
|
|
2580
|
+
};
|
|
2581
|
+
return /* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
|
|
2582
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2583
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-semibold", children: "Change working hours" }),
|
|
2584
|
+
/* @__PURE__ */ e(sr, { delayDuration: 100, children: /* @__PURE__ */ l(lr, { children: [
|
|
2585
|
+
/* @__PURE__ */ e(ir, { children: /* @__PURE__ */ e(Mt, { className: "size-3" }) }),
|
|
2586
|
+
/* @__PURE__ */ e(at, { className: "max-w-80 text-center", children: /* @__PURE__ */ e("p", { children: "This will apply a dashed background to the hour cells that fall outside the working hours — only for week and day views." }) })
|
|
2587
|
+
] }) })
|
|
2588
|
+
] }),
|
|
2589
|
+
/* @__PURE__ */ e("div", { className: "space-y-4", children: ia.map((o) => {
|
|
2590
|
+
const s = r[o.index].from > 0 || r[o.index].to > 0;
|
|
2591
|
+
return /* @__PURE__ */ l("div", { className: "flex items-center gap-4", children: [
|
|
2592
|
+
/* @__PURE__ */ l("div", { className: "flex w-40 items-center gap-2", children: [
|
|
2593
|
+
/* @__PURE__ */ e(dr, { checked: s, onCheckedChange: () => d(o.index) }),
|
|
2594
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: o.name })
|
|
2595
|
+
] }),
|
|
2596
|
+
s ? /* @__PURE__ */ l("div", { className: "flex items-center gap-4", children: [
|
|
2597
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2598
|
+
/* @__PURE__ */ e("span", { children: "From" }),
|
|
2599
|
+
/* @__PURE__ */ e(
|
|
2600
|
+
G,
|
|
2601
|
+
{
|
|
2602
|
+
id: `${o.name.toLowerCase()}-from`,
|
|
2603
|
+
hourCycle: 12,
|
|
2604
|
+
granularity: "hour",
|
|
2605
|
+
value: { hour: r[o.index].from, minute: 0 },
|
|
2606
|
+
onChange: (u) => c(o.index, "from", u)
|
|
2607
|
+
}
|
|
2608
|
+
)
|
|
2609
|
+
] }),
|
|
2610
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2611
|
+
/* @__PURE__ */ e("span", { children: "To" }),
|
|
2612
|
+
/* @__PURE__ */ e(
|
|
2613
|
+
G,
|
|
2614
|
+
{
|
|
2615
|
+
id: `${o.name.toLowerCase()}-to`,
|
|
2616
|
+
hourCycle: 12,
|
|
2617
|
+
granularity: "hour",
|
|
2618
|
+
value: { hour: r[o.index].to, minute: 0 },
|
|
2619
|
+
onChange: (u) => c(o.index, "to", u)
|
|
2620
|
+
}
|
|
2621
|
+
)
|
|
2622
|
+
] })
|
|
2623
|
+
] }) : /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
2624
|
+
/* @__PURE__ */ e(Et, { className: "size-4" }),
|
|
2625
|
+
/* @__PURE__ */ e("span", { children: "Closed" })
|
|
2626
|
+
] })
|
|
2627
|
+
] }, o.index);
|
|
2628
|
+
}) }),
|
|
2629
|
+
/* @__PURE__ */ e(I, { className: "mt-4 w-fit", onClick: i, children: "Apply" })
|
|
2630
|
+
] });
|
|
2631
|
+
}
|
|
2632
|
+
const ja = Q.Root, da = w.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
|
|
2633
|
+
Q.Item,
|
|
2634
|
+
{
|
|
2635
|
+
ref: r,
|
|
2636
|
+
className: x("border-b", t),
|
|
2637
|
+
...n
|
|
2638
|
+
}
|
|
2639
|
+
));
|
|
2640
|
+
da.displayName = "AccordionItem";
|
|
2641
|
+
const ca = w.forwardRef(({ className: t, children: n, ...r }, a) => /* @__PURE__ */ e(Q.Header, { className: "flex", children: /* @__PURE__ */ l(
|
|
2642
|
+
Q.Trigger,
|
|
2643
|
+
{
|
|
2644
|
+
ref: a,
|
|
2645
|
+
className: x(
|
|
2646
|
+
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",
|
|
2647
|
+
t
|
|
2648
|
+
),
|
|
2649
|
+
...r,
|
|
2650
|
+
children: [
|
|
2651
|
+
n,
|
|
2652
|
+
/* @__PURE__ */ e(We, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" })
|
|
2653
|
+
]
|
|
2654
|
+
}
|
|
2655
|
+
) }));
|
|
2656
|
+
ca.displayName = Q.Trigger.displayName;
|
|
2657
|
+
const ua = w.forwardRef(({ className: t, children: n, ...r }, a) => /* @__PURE__ */ e(
|
|
2658
|
+
Q.Content,
|
|
2659
|
+
{
|
|
2660
|
+
ref: a,
|
|
2661
|
+
className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
|
|
2662
|
+
...r,
|
|
2663
|
+
children: /* @__PURE__ */ e("div", { className: x("pb-4 pt-0", t), children: n })
|
|
2664
|
+
}
|
|
2665
|
+
));
|
|
2666
|
+
ua.displayName = Q.Content.displayName;
|
|
2667
|
+
function ma({
|
|
2668
|
+
className: t,
|
|
2669
|
+
...n
|
|
2670
|
+
}) {
|
|
2671
|
+
return /* @__PURE__ */ e(
|
|
2672
|
+
"div",
|
|
2673
|
+
{
|
|
2674
|
+
className: x("animate-pulse rounded-md bg-primary/10", t),
|
|
2675
|
+
...n
|
|
2676
|
+
}
|
|
2677
|
+
);
|
|
2678
|
+
}
|
|
2679
|
+
const cr = "big-calendar-theme", fa = 60 * 60 * 24 * 365, Pe = { theme: "dark" };
|
|
2680
|
+
function ga(t) {
|
|
2681
|
+
document.cookie = `${cr}=${t}; path=/; max-age=${fa}`, document.documentElement.classList.remove("light", "dark"), document.documentElement.classList.add(t);
|
|
2682
|
+
}
|
|
2683
|
+
function ha() {
|
|
2684
|
+
const [t, n] = j();
|
|
2685
|
+
oe(() => {
|
|
2686
|
+
const a = document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
2687
|
+
n(a);
|
|
2688
|
+
}, []);
|
|
2689
|
+
const r = () => {
|
|
2690
|
+
const a = t === "light" ? "dark" : "light";
|
|
2691
|
+
ga(a), n(a);
|
|
2692
|
+
};
|
|
2693
|
+
return t ? /* @__PURE__ */ l(I, { variant: "ghost", size: "icon", onClick: r, children: [
|
|
2694
|
+
t === "light" && /* @__PURE__ */ e(en, {}),
|
|
2695
|
+
t === "dark" && /* @__PURE__ */ e(Et, {})
|
|
2696
|
+
] }) : /* @__PURE__ */ e(ma, { className: "size-9" });
|
|
2697
|
+
}
|
|
2698
|
+
function Ba() {
|
|
2699
|
+
return /* @__PURE__ */ e("header", { className: "mx-auto flex h-[88px] w-full max-w-screen-2xl items-center justify-center", children: /* @__PURE__ */ l("div", { className: "my-3 flex h-14 w-full items-center justify-between px-8", children: [
|
|
2700
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-3.5", children: [
|
|
2701
|
+
/* @__PURE__ */ e("div", { className: "flex size-12 items-center justify-center rounded-full border p-3", children: /* @__PURE__ */ e(Ue, { className: "size-6 text-foreground" }) }),
|
|
2702
|
+
/* @__PURE__ */ l("div", { className: "space-y-1", children: [
|
|
2703
|
+
/* @__PURE__ */ e("p", { className: "text-lg font-medium leading-6", children: "Big calendar" }),
|
|
2704
|
+
/* @__PURE__ */ l("p", { className: "text-sm text-foreground", children: [
|
|
2705
|
+
"Built with React and Tailwind by",
|
|
2706
|
+
" ",
|
|
2707
|
+
/* @__PURE__ */ l(
|
|
2708
|
+
"a",
|
|
2709
|
+
{
|
|
2710
|
+
href: "https://github.com/lramos33",
|
|
2711
|
+
target: "_blank",
|
|
2712
|
+
className: "inline-flex gap-0.5 text-sm underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2713
|
+
children: [
|
|
2714
|
+
"lramos33",
|
|
2715
|
+
/* @__PURE__ */ e(it, { size: 12, className: "text-foreground" })
|
|
2716
|
+
]
|
|
2717
|
+
}
|
|
2718
|
+
)
|
|
2719
|
+
] })
|
|
2720
|
+
] })
|
|
2721
|
+
] }),
|
|
2722
|
+
/* @__PURE__ */ l("div", { className: "hidden items-center gap-4 md:flex", children: [
|
|
2723
|
+
/* @__PURE__ */ l(
|
|
2724
|
+
"a",
|
|
2725
|
+
{
|
|
2726
|
+
href: "https://github.com/lramos33/big-calendar",
|
|
2727
|
+
target: "_blank",
|
|
2728
|
+
className: "inline-flex gap-0.5 text-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2729
|
+
children: [
|
|
2730
|
+
"View on GitHub",
|
|
2731
|
+
/* @__PURE__ */ e(it, { size: 14, className: "text-foreground" })
|
|
2732
|
+
]
|
|
2733
|
+
}
|
|
2734
|
+
),
|
|
2735
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2736
|
+
/* @__PURE__ */ e(I, { size: "icon", asChild: !0, variant: "ghost", children: /* @__PURE__ */ e("a", { href: "https://x.com/leoo_ramos1", target: "_blank", children: /* @__PURE__ */ l(
|
|
2737
|
+
"svg",
|
|
2738
|
+
{
|
|
2739
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2740
|
+
width: "24",
|
|
2741
|
+
height: "24",
|
|
2742
|
+
viewBox: "0 0 24 24",
|
|
2743
|
+
fill: "none",
|
|
2744
|
+
stroke: "currentColor",
|
|
2745
|
+
strokeWidth: "2",
|
|
2746
|
+
strokeLinecap: "round",
|
|
2747
|
+
strokeLinejoin: "round",
|
|
2748
|
+
children: [
|
|
2749
|
+
/* @__PURE__ */ e("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
2750
|
+
/* @__PURE__ */ e("path", { d: "M4 4l11.733 16h4.267l-11.733 -16z" }),
|
|
2751
|
+
/* @__PURE__ */ e("path", { d: "M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772" })
|
|
2752
|
+
]
|
|
2753
|
+
}
|
|
2754
|
+
) }) }),
|
|
2755
|
+
/* @__PURE__ */ e(ha, {})
|
|
2756
|
+
] })
|
|
2757
|
+
] })
|
|
2758
|
+
] }) });
|
|
2759
|
+
}
|
|
2760
|
+
const pa = ["light", "dark"];
|
|
2761
|
+
function La() {
|
|
2762
|
+
var a;
|
|
2763
|
+
if (typeof document > "u")
|
|
2764
|
+
return Pe.theme;
|
|
2765
|
+
const n = document.cookie.split(";").find((d) => d.trim().startsWith(`${cr}=`));
|
|
2766
|
+
if (!n)
|
|
2767
|
+
return Pe.theme;
|
|
2768
|
+
const r = (a = n.split("=")[1]) == null ? void 0 : a.trim();
|
|
2769
|
+
return pa.includes(r) ? r : Pe.theme;
|
|
2770
|
+
}
|
|
2771
|
+
const Wa = {
|
|
2772
|
+
variable: "--font-inter"
|
|
2773
|
+
};
|
|
2774
|
+
export {
|
|
2775
|
+
ja as Accordion,
|
|
2776
|
+
ua as AccordionContent,
|
|
2777
|
+
da as AccordionItem,
|
|
2778
|
+
ca as AccordionTrigger,
|
|
2779
|
+
K as AddEventDialog,
|
|
2780
|
+
ue as Avatar,
|
|
2781
|
+
fe as AvatarFallback,
|
|
2782
|
+
Pt as AvatarGroup,
|
|
2783
|
+
me as AvatarImage,
|
|
2784
|
+
xn as Badge,
|
|
2785
|
+
I as Button,
|
|
2786
|
+
ra as CalendarAgendaView,
|
|
2787
|
+
oa as CalendarDayView,
|
|
2788
|
+
Ln as CalendarHeader,
|
|
2789
|
+
Qn as CalendarMonthView,
|
|
2790
|
+
za as CalendarProvider,
|
|
2791
|
+
la as CalendarWeekView,
|
|
2792
|
+
Un as CalendarYearView,
|
|
2793
|
+
Aa as ChangeBadgeVariantInput,
|
|
2794
|
+
Ra as ChangeVisibleHoursInput,
|
|
2795
|
+
Va as ChangeWorkingHoursInput,
|
|
2796
|
+
Ha as ClientContainer,
|
|
2797
|
+
mn as CustomDragLayer,
|
|
2798
|
+
Pe as DEFAULT_VALUES,
|
|
2799
|
+
Sn as DateNavigator,
|
|
2800
|
+
Xe as Dialog,
|
|
2801
|
+
Qt as DialogClose,
|
|
2802
|
+
Se as DialogContent,
|
|
2803
|
+
Qe as DialogDescription,
|
|
2804
|
+
Ee as DialogFooter,
|
|
2805
|
+
Me as DialogHeader,
|
|
2806
|
+
er as DialogOverlay,
|
|
2807
|
+
Bn as DialogPortal,
|
|
2808
|
+
Te as DialogTitle,
|
|
2809
|
+
Je as DialogTrigger,
|
|
2810
|
+
fn as DndProviderWrapper,
|
|
2811
|
+
rr as DraggableEvent,
|
|
2812
|
+
Gn as DroppableDayCell,
|
|
2813
|
+
q as DroppableTimeBlock,
|
|
2814
|
+
qn as EditEventDialog,
|
|
2815
|
+
rt as EventDetailsDialog,
|
|
2816
|
+
Zt as Form,
|
|
2817
|
+
F as FormControl,
|
|
2818
|
+
jn as FormDescription,
|
|
2819
|
+
R as FormField,
|
|
2820
|
+
O as FormItem,
|
|
2821
|
+
P as FormLabel,
|
|
2822
|
+
H as FormMessage,
|
|
2823
|
+
Ba as Header,
|
|
2824
|
+
Ge as Input,
|
|
2825
|
+
tt as ItemTypes,
|
|
2826
|
+
qt as Label,
|
|
2827
|
+
An as Popover,
|
|
2828
|
+
Pa as PopoverAnchor,
|
|
2829
|
+
Gt as PopoverContent,
|
|
2830
|
+
Rn as PopoverTrigger,
|
|
2831
|
+
ge as ScrollArea,
|
|
2832
|
+
nr as ScrollBar,
|
|
2833
|
+
ie as Select,
|
|
2834
|
+
te as SelectContent,
|
|
2835
|
+
Oa as SelectGroup,
|
|
2836
|
+
M as SelectItem,
|
|
2837
|
+
gn as SelectLabel,
|
|
2838
|
+
Ht as SelectScrollDownButton,
|
|
2839
|
+
Ft as SelectScrollUpButton,
|
|
2840
|
+
hn as SelectSeparator,
|
|
2841
|
+
ee as SelectTrigger,
|
|
2842
|
+
de as SelectValue,
|
|
2843
|
+
Ze as SingleCalendar,
|
|
2844
|
+
ke as SingleDayPicker,
|
|
2845
|
+
ma as Skeleton,
|
|
2846
|
+
dr as Switch,
|
|
2847
|
+
pa as THEMES_VALUES,
|
|
2848
|
+
fa as THEME_COOKIE_MAX_AGE,
|
|
2849
|
+
cr as THEME_COOKIE_NAME,
|
|
2850
|
+
qe as Textarea,
|
|
2851
|
+
G as TimeInput,
|
|
2852
|
+
bn as TodayButton,
|
|
2853
|
+
ha as ToggleTheme,
|
|
2854
|
+
lr as Tooltip,
|
|
2855
|
+
at as TooltipContent,
|
|
2856
|
+
sr as TooltipProvider,
|
|
2857
|
+
ir as TooltipTrigger,
|
|
2858
|
+
pn as UserSelect,
|
|
2859
|
+
vn as badgeVariants,
|
|
2860
|
+
Ve as buttonVariants,
|
|
2861
|
+
kn as calculateMonthEventPositions,
|
|
2862
|
+
x as cn,
|
|
2863
|
+
Fa as eventSchema,
|
|
2864
|
+
Dn as getCalendarCells,
|
|
2865
|
+
wn as getCurrentEvents,
|
|
2866
|
+
Rt as getEventBlockStyle,
|
|
2867
|
+
Nn as getEventsCount,
|
|
2868
|
+
Cn as getMonthCellEvents,
|
|
2869
|
+
La as getTheme,
|
|
2870
|
+
jt as getVisibleHours,
|
|
2871
|
+
At as groupEvents,
|
|
2872
|
+
Wa as inter,
|
|
2873
|
+
Vt as isWorkingHour,
|
|
2874
|
+
mt as navigateDate,
|
|
2875
|
+
yn as rangeText,
|
|
2876
|
+
ga as setTheme,
|
|
2877
|
+
T as useCalendar,
|
|
2878
|
+
Ke as useDisclosure,
|
|
2879
|
+
Ce as useFormField,
|
|
2880
|
+
tr as useUpdateEvent
|
|
2881
|
+
};
|
|
2882
|
+
//# sourceMappingURL=big-calendar.mjs.map
|