@mlw-packages/react-components 1.7.19 → 1.7.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +0 -6
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +312 -556
- package/dist/index.mjs +239 -490
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12426,11 +12426,11 @@ function AgendaView({
|
|
|
12426
12426
|
}
|
|
12427
12427
|
};
|
|
12428
12428
|
const datedEvents = (0, import_react52.useMemo)(
|
|
12429
|
-
() => events.filter((e) => isValidDate6(e.start)
|
|
12429
|
+
() => events.filter((e) => isValidDate6(e.start) || isValidDate6(e.end)),
|
|
12430
12430
|
[events]
|
|
12431
12431
|
);
|
|
12432
12432
|
const undatedEvents = (0, import_react52.useMemo)(
|
|
12433
|
-
() => events.filter((e) => !(isValidDate6(e.start)
|
|
12433
|
+
() => events.filter((e) => !(isValidDate6(e.start) || isValidDate6(e.end))),
|
|
12434
12434
|
[events]
|
|
12435
12435
|
);
|
|
12436
12436
|
const days = (0, import_react52.useMemo)(() => {
|
|
@@ -15617,15 +15617,11 @@ function Agenda({
|
|
|
15617
15617
|
}
|
|
15618
15618
|
};
|
|
15619
15619
|
const datedEvents = (0, import_react73.useMemo)(
|
|
15620
|
-
() => events.filter(
|
|
15621
|
-
(e) => isValidDate6(e.start) && isValidDate6(e.end) || isValidDate6(e.attend_date)
|
|
15622
|
-
),
|
|
15620
|
+
() => events.filter((e) => isValidDate6(e.start) || isValidDate6(e.end)),
|
|
15623
15621
|
[events]
|
|
15624
15622
|
);
|
|
15625
15623
|
const undatedEvents = (0, import_react73.useMemo)(
|
|
15626
|
-
() => events.filter(
|
|
15627
|
-
(e) => !(isValidDate6(e.start) && isValidDate6(e.end)) && !isValidDate6(e.attend_date)
|
|
15628
|
-
),
|
|
15624
|
+
() => events.filter((e) => !(isValidDate6(e.start) || isValidDate6(e.end))),
|
|
15629
15625
|
[events]
|
|
15630
15626
|
);
|
|
15631
15627
|
const days = (0, import_react73.useMemo)(() => {
|
|
@@ -15654,12 +15650,18 @@ function Agenda({
|
|
|
15654
15650
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
15655
15651
|
"div",
|
|
15656
15652
|
{
|
|
15657
|
-
className: (0, import_tailwind_merge2.twMerge)(
|
|
15653
|
+
className: (0, import_tailwind_merge2.twMerge)(
|
|
15654
|
+
"relative my-12 border-border/70 border-t",
|
|
15655
|
+
(0, import_date_fns16.isToday)(day) ? "border-blue-200" : ""
|
|
15656
|
+
),
|
|
15658
15657
|
children: [
|
|
15659
15658
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
15660
15659
|
"span",
|
|
15661
15660
|
{
|
|
15662
|
-
className: (0, import_tailwind_merge2.twMerge)(
|
|
15661
|
+
className: (0, import_tailwind_merge2.twMerge)(
|
|
15662
|
+
"-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase data-today:font-extrabold sm:pe-4 text-lg font-bold",
|
|
15663
|
+
(0, import_date_fns16.isToday)(day) ? "text-blue-500" : ""
|
|
15664
|
+
),
|
|
15663
15665
|
"data-today": (0, import_date_fns16.isToday)(day) || void 0,
|
|
15664
15666
|
children: (() => {
|
|
15665
15667
|
const s = (0, import_date_fns16.format)(day, "d MMM, EEEE", { locale: import_locale9.ptBR });
|
|
@@ -15945,12 +15947,11 @@ var DefaultStartHourAgenda = 9;
|
|
|
15945
15947
|
var DefaultEndHourAgenda = 10;
|
|
15946
15948
|
|
|
15947
15949
|
// src/components/event-calendar-view/DayView.tsx
|
|
15948
|
-
var
|
|
15950
|
+
var import_date_fns21 = require("date-fns");
|
|
15949
15951
|
var import_react80 = require("react");
|
|
15950
15952
|
|
|
15951
15953
|
// src/components/event-calendar-view/utils.ts
|
|
15952
15954
|
var import_date_fns18 = require("date-fns");
|
|
15953
|
-
var import_date_fns19 = require("date-fns");
|
|
15954
15955
|
function getEventColorClassesAgenda(color) {
|
|
15955
15956
|
const eventColor = color || "sky";
|
|
15956
15957
|
switch (eventColor) {
|
|
@@ -15990,7 +15991,7 @@ function isMultiDayEventAgenda(event) {
|
|
|
15990
15991
|
}
|
|
15991
15992
|
function getEventsForDayAgenda(events, day) {
|
|
15992
15993
|
return events.filter((event) => {
|
|
15993
|
-
const eventStart = isValidDate3(event.start) ? new Date(event.start) :
|
|
15994
|
+
const eventStart = isValidDate3(event.start) ? new Date(event.start) : void 0;
|
|
15994
15995
|
return eventStart ? (0, import_date_fns18.isSameDay)(day, eventStart) : false;
|
|
15995
15996
|
}).sort((a, b) => getEventStartTimestamp2(a) - getEventStartTimestamp2(b));
|
|
15996
15997
|
}
|
|
@@ -16022,11 +16023,8 @@ function getAllEventsForDayAgenda(events, day) {
|
|
|
16022
16023
|
}
|
|
16023
16024
|
function getAgendaEventsForDayAgenda(events, day) {
|
|
16024
16025
|
return events.filter((event) => {
|
|
16025
|
-
const eventStart = isValidDate3(event.start) ? new Date(event.start) :
|
|
16026
|
-
const eventEnd = isValidDate3(event.end) ? new Date(event.end) :
|
|
16027
|
-
const dt = normalizeAttendDate(event.attend_date);
|
|
16028
|
-
return dt ? (0, import_date_fns19.addHours)(dt, 1) : void 0;
|
|
16029
|
-
})() : void 0;
|
|
16026
|
+
const eventStart = isValidDate3(event.start) ? new Date(event.start) : void 0;
|
|
16027
|
+
const eventEnd = isValidDate3(event.end) ? new Date(event.end) : void 0;
|
|
16030
16028
|
if (!eventStart) return false;
|
|
16031
16029
|
return (0, import_date_fns18.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns18.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
|
|
16032
16030
|
}).sort((a, b) => getEventStartTimestamp2(a) - getEventStartTimestamp2(b));
|
|
@@ -16041,8 +16039,6 @@ function isValidDate3(d) {
|
|
|
16041
16039
|
}
|
|
16042
16040
|
function getEventStartTimestamp2(e) {
|
|
16043
16041
|
if (isValidDate3(e.start)) return new Date(e.start).getTime();
|
|
16044
|
-
if (isValidDate3(e.attend_date))
|
|
16045
|
-
return normalizeAttendDate(e.attend_date).getTime();
|
|
16046
16042
|
return Number.MAX_SAFE_INTEGER;
|
|
16047
16043
|
}
|
|
16048
16044
|
function normalizeAttendDate(d) {
|
|
@@ -16065,7 +16061,7 @@ function addHoursToDateAgenda(date, hours) {
|
|
|
16065
16061
|
}
|
|
16066
16062
|
|
|
16067
16063
|
// src/components/event-calendar-view/hooks/use-current-time-indicator.ts
|
|
16068
|
-
var
|
|
16064
|
+
var import_date_fns19 = require("date-fns");
|
|
16069
16065
|
var import_locale10 = require("date-fns/locale");
|
|
16070
16066
|
var import_react77 = require("react");
|
|
16071
16067
|
function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
@@ -16082,11 +16078,11 @@ function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
|
16082
16078
|
const position = (totalMinutes - dayStartMinutes) / (dayEndMinutes - dayStartMinutes) * 100;
|
|
16083
16079
|
let isCurrentTimeVisible = false;
|
|
16084
16080
|
if (view === "day") {
|
|
16085
|
-
isCurrentTimeVisible = (0,
|
|
16081
|
+
isCurrentTimeVisible = (0, import_date_fns19.isSameDay)(now, currentDate);
|
|
16086
16082
|
} else if (view === "week") {
|
|
16087
|
-
const startOfWeekDate = (0,
|
|
16088
|
-
const endOfWeekDate = (0,
|
|
16089
|
-
isCurrentTimeVisible = (0,
|
|
16083
|
+
const startOfWeekDate = (0, import_date_fns19.startOfWeek)(currentDate, { locale: import_locale10.ptBR });
|
|
16084
|
+
const endOfWeekDate = (0, import_date_fns19.endOfWeek)(currentDate, { locale: import_locale10.ptBR });
|
|
16085
|
+
isCurrentTimeVisible = (0, import_date_fns19.isWithinInterval)(now, {
|
|
16090
16086
|
end: endOfWeekDate,
|
|
16091
16087
|
start: startOfWeekDate
|
|
16092
16088
|
});
|
|
@@ -16102,12 +16098,12 @@ function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
|
16102
16098
|
}
|
|
16103
16099
|
|
|
16104
16100
|
// src/components/event-calendar-view/EventItemAgenda.tsx
|
|
16105
|
-
var
|
|
16101
|
+
var import_date_fns20 = require("date-fns");
|
|
16106
16102
|
var import_react78 = require("react");
|
|
16107
16103
|
var import_react79 = require("@phosphor-icons/react");
|
|
16108
16104
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
16109
16105
|
var formatTimeWithOptionalMinutes2 = (date) => {
|
|
16110
|
-
return (0,
|
|
16106
|
+
return (0, import_date_fns20.format)(date, "HH:mm");
|
|
16111
16107
|
};
|
|
16112
16108
|
var isValidDate4 = (d) => {
|
|
16113
16109
|
try {
|
|
@@ -16132,26 +16128,28 @@ function EventWrapper2({
|
|
|
16132
16128
|
onTouchStart,
|
|
16133
16129
|
ariaLabel
|
|
16134
16130
|
}) {
|
|
16135
|
-
const hasValidTimeForWrapper = isValidDate4(event.start)
|
|
16131
|
+
const hasValidTimeForWrapper = isValidDate4(event.start) || isValidDate4(event.end);
|
|
16136
16132
|
const displayEnd = (() => {
|
|
16137
16133
|
if (isValidDate4(event.start) && isValidDate4(event.end)) {
|
|
16138
16134
|
return currentTime ? new Date(
|
|
16139
16135
|
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
16140
16136
|
) : new Date(event.end);
|
|
16141
16137
|
}
|
|
16142
|
-
if (isValidDate4(event.
|
|
16143
|
-
|
|
16144
|
-
|
|
16138
|
+
if (isValidDate4(event.start) && !isValidDate4(event.end)) {
|
|
16139
|
+
return currentTime ? new Date(currentTime) : new Date(event.start);
|
|
16140
|
+
}
|
|
16141
|
+
if (!isValidDate4(event.start) && isValidDate4(event.end)) {
|
|
16142
|
+
return currentTime ? new Date(currentTime) : new Date(event.end);
|
|
16145
16143
|
}
|
|
16146
16144
|
return void 0;
|
|
16147
16145
|
})();
|
|
16148
|
-
const isEventInPast = displayEnd ? (0,
|
|
16146
|
+
const isEventInPast = displayEnd ? (0, import_date_fns20.isPast)(displayEnd) : false;
|
|
16149
16147
|
const colorClasses = hasValidTimeForWrapper ? getEventColorClassesAgenda(event.color) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
|
|
16150
16148
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
16151
16149
|
"button",
|
|
16152
16150
|
{
|
|
16153
16151
|
className: cn(
|
|
16154
|
-
"flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md ",
|
|
16152
|
+
"flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md border",
|
|
16155
16153
|
colorClasses,
|
|
16156
16154
|
getBorderRadiusClassesAgenda(isFirstDay, isLastDay),
|
|
16157
16155
|
className
|
|
@@ -16186,32 +16184,31 @@ function EventItemAgenda({
|
|
|
16186
16184
|
agendaOnly = false
|
|
16187
16185
|
}) {
|
|
16188
16186
|
const eventColor = event.color;
|
|
16189
|
-
const hasValidTime = isValidDate4(event.start)
|
|
16187
|
+
const hasValidTime = isValidDate4(event.start) || isValidDate4(event.end);
|
|
16190
16188
|
const colorClasses = hasValidTime ? getEventColorClassesAgenda(eventColor) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
|
|
16191
16189
|
const displayStart = (0, import_react78.useMemo)(() => {
|
|
16192
16190
|
if (!hasValidTime) return void 0;
|
|
16193
16191
|
if (isValidDate4(event.start))
|
|
16194
16192
|
return currentTime || new Date(event.start);
|
|
16195
|
-
if (isValidDate4(event.
|
|
16196
|
-
return currentTime ||
|
|
16193
|
+
if (isValidDate4(event.end))
|
|
16194
|
+
return currentTime || new Date(event.end);
|
|
16197
16195
|
return void 0;
|
|
16198
|
-
}, [currentTime, event.start, event.
|
|
16196
|
+
}, [currentTime, event.start, event.end, hasValidTime]);
|
|
16199
16197
|
const displayEnd = (0, import_react78.useMemo)(() => {
|
|
16200
16198
|
if (!hasValidTime) return void 0;
|
|
16201
16199
|
if (isValidDate4(event.end)) {
|
|
16202
16200
|
return currentTime ? new Date(
|
|
16203
|
-
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
16201
|
+
new Date(currentTime).getTime() + (isValidDate4(event.start) ? new Date(event.end).getTime() - new Date(event.start).getTime() : 0)
|
|
16204
16202
|
) : new Date(event.end);
|
|
16205
16203
|
}
|
|
16206
|
-
if (isValidDate4(event.
|
|
16207
|
-
|
|
16208
|
-
return start ? addHoursToDateAgenda(start, 1) : void 0;
|
|
16204
|
+
if (isValidDate4(event.start)) {
|
|
16205
|
+
return currentTime ? new Date(currentTime) : new Date(event.start);
|
|
16209
16206
|
}
|
|
16210
16207
|
return void 0;
|
|
16211
|
-
}, [currentTime, event.start, event.end,
|
|
16208
|
+
}, [currentTime, event.start, event.end, hasValidTime]);
|
|
16212
16209
|
const durationMinutes = (0, import_react78.useMemo)(() => {
|
|
16213
16210
|
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
16214
|
-
return (0,
|
|
16211
|
+
return (0, import_date_fns20.differenceInMinutes)(displayEnd, displayStart);
|
|
16215
16212
|
}, [displayStart, displayEnd, hasValidTime]);
|
|
16216
16213
|
const getEventTime = () => {
|
|
16217
16214
|
if (!hasValidTime) return "";
|
|
@@ -16242,7 +16239,7 @@ function EventItemAgenda({
|
|
|
16242
16239
|
EventWrapper2,
|
|
16243
16240
|
{
|
|
16244
16241
|
className: cn(
|
|
16245
|
-
"mt-[var(--event-gap)] h-[var(--event-height)] items-center
|
|
16242
|
+
"mt-[var(--event-gap)] h-[var(--event-height)] items-center sm:text-xs",
|
|
16246
16243
|
className
|
|
16247
16244
|
),
|
|
16248
16245
|
currentTime,
|
|
@@ -16254,7 +16251,7 @@ function EventItemAgenda({
|
|
|
16254
16251
|
isLastDay,
|
|
16255
16252
|
onClick,
|
|
16256
16253
|
children: children || /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "flex items-center gap-2 truncate", children: [
|
|
16257
|
-
!event.allDay && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "truncate
|
|
16254
|
+
!event.allDay && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "truncate text-2xl opacity-80 bg-white/10 px-2 rounded-full", children: formatTimeWithOptionalMinutes2(displayStart) }),
|
|
16258
16255
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
16259
16256
|
"span",
|
|
16260
16257
|
{
|
|
@@ -16288,10 +16285,13 @@ function EventItemAgenda({
|
|
|
16288
16285
|
isLastDay,
|
|
16289
16286
|
children: durationMinutes < 45 ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
16290
16287
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("truncate text-lg"), children: event.title }),
|
|
16291
|
-
showTime && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime88.
|
|
16288
|
+
showTime && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "ml-2 flex items-center gap-3 bg-white/10 py-0.5 rounded-full opacity-90 text-lg ", children: [
|
|
16289
|
+
formatTimeWithOptionalMinutes2(displayStart),
|
|
16290
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react79.ClockUserIcon, {})
|
|
16291
|
+
] })
|
|
16292
16292
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
16293
16293
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("truncate font-medium text-lg"), children: event.title }),
|
|
16294
|
-
showTime && hasValidTime && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "truncate font-normal opacity-70
|
|
16294
|
+
showTime && hasValidTime && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "truncate font-normal opacity-70", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "inline-block bg-white/5 px-0.5 py-0.5 rounded-full", children: getEventTime() }) })
|
|
16295
16295
|
] })
|
|
16296
16296
|
}
|
|
16297
16297
|
);
|
|
@@ -16355,7 +16355,7 @@ function EventItemAgenda({
|
|
|
16355
16355
|
colorClasses,
|
|
16356
16356
|
className
|
|
16357
16357
|
),
|
|
16358
|
-
"data-past-event": (0,
|
|
16358
|
+
"data-past-event": (0, import_date_fns20.isPast)(displayEnd) || void 0,
|
|
16359
16359
|
"aria-label": ariaLabel,
|
|
16360
16360
|
onClick,
|
|
16361
16361
|
onMouseDown,
|
|
@@ -16366,10 +16366,8 @@ function EventItemAgenda({
|
|
|
16366
16366
|
children: [
|
|
16367
16367
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex w-full justify-between ", children: [
|
|
16368
16368
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("font-bold text-lg"), children: event.title }),
|
|
16369
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("opacity-90 flex items-center gap-2 text-lg"), children: event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { children: "Dia todo" }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "uppercase font-semibold flex items-center gap-2", children: [
|
|
16369
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("opacity-90 flex items-center gap-2 text-lg"), children: event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { children: "Dia todo" }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "uppercase font-semibold flex items-center gap-2 ", children: [
|
|
16370
16370
|
formatTimeWithOptionalMinutes2(displayStart),
|
|
16371
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "opacity-70", children: "-" }),
|
|
16372
|
-
formatTimeWithOptionalMinutes2(displayEnd),
|
|
16373
16371
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react79.ClockUserIcon, {})
|
|
16374
16372
|
] }) })
|
|
16375
16373
|
] }),
|
|
@@ -16436,40 +16434,20 @@ function DayViewAgenda({
|
|
|
16436
16434
|
showUndatedEvents
|
|
16437
16435
|
}) {
|
|
16438
16436
|
const hours = (0, import_react80.useMemo)(() => {
|
|
16439
|
-
const dayStart = (0,
|
|
16440
|
-
return (0,
|
|
16441
|
-
end: (0,
|
|
16442
|
-
start: (0,
|
|
16437
|
+
const dayStart = (0, import_date_fns21.startOfDay)(currentDate);
|
|
16438
|
+
return (0, import_date_fns21.eachHourOfInterval)({
|
|
16439
|
+
end: (0, import_date_fns21.addHours)(dayStart, EndHourAgenda - 1),
|
|
16440
|
+
start: (0, import_date_fns21.addHours)(dayStart, StartHourAgenda)
|
|
16443
16441
|
});
|
|
16444
16442
|
}, [currentDate]);
|
|
16445
16443
|
const dayEvents = (0, import_react80.useMemo)(() => {
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
const ad = new Date(event.attend_date);
|
|
16454
|
-
const hasTime = ad.getHours() !== 0 || ad.getMinutes() !== 0 || ad.getSeconds() !== 0 || ad.getMilliseconds() !== 0;
|
|
16455
|
-
if (hasTime) {
|
|
16456
|
-
if (!eventStart) eventStart = ad;
|
|
16457
|
-
if (!eventEnd) eventEnd = (0, import_date_fns22.addHours)(ad, 1);
|
|
16458
|
-
}
|
|
16459
|
-
} catch {
|
|
16460
|
-
}
|
|
16461
|
-
}
|
|
16462
|
-
return { event, eventStart, eventEnd };
|
|
16463
|
-
}).filter(({ eventStart, eventEnd }) => !!eventStart && !!eventEnd).filter(
|
|
16464
|
-
({ eventStart, eventEnd }) => (0, import_date_fns22.areIntervalsOverlapping)(
|
|
16465
|
-
{ start: eventStart, end: eventEnd },
|
|
16466
|
-
{ start: dayStart, end: dayEnd }
|
|
16467
|
-
)
|
|
16468
|
-
).map(({ event }) => event).sort((a, b) => {
|
|
16469
|
-
const aStart = a.start ? new Date(a.start).getTime() : a.attend_date ? new Date(a.attend_date).getTime() : 0;
|
|
16470
|
-
const bStart = b.start ? new Date(b.start).getTime() : b.attend_date ? new Date(b.attend_date).getTime() : 0;
|
|
16471
|
-
return aStart - bStart;
|
|
16472
|
-
});
|
|
16444
|
+
return events.filter((event) => {
|
|
16445
|
+
const eventStart = new Date(event.start ?? event.end ?? Date.now());
|
|
16446
|
+
const eventEnd = new Date(event.end ?? event.start ?? Date.now());
|
|
16447
|
+
return (0, import_date_fns21.isSameDay)(currentDate, eventStart) || (0, import_date_fns21.isSameDay)(currentDate, eventEnd) || currentDate > eventStart && currentDate < eventEnd;
|
|
16448
|
+
}).sort(
|
|
16449
|
+
(a, b) => new Date(a.start ?? a.end ?? Date.now()).getTime() - new Date(b.start ?? b.end ?? Date.now()).getTime()
|
|
16450
|
+
);
|
|
16473
16451
|
}, [currentDate, events]);
|
|
16474
16452
|
const allDayEvents = (0, import_react80.useMemo)(() => {
|
|
16475
16453
|
return dayEvents.filter((event) => {
|
|
@@ -16483,38 +16461,26 @@ function DayViewAgenda({
|
|
|
16483
16461
|
}, [dayEvents]);
|
|
16484
16462
|
const positionedEvents = (0, import_react80.useMemo)(() => {
|
|
16485
16463
|
const result = [];
|
|
16486
|
-
const dayStart = (0,
|
|
16464
|
+
const dayStart = (0, import_date_fns21.startOfDay)(currentDate);
|
|
16487
16465
|
const sortedEvents = [...timeEvents].sort((a, b) => {
|
|
16488
|
-
const aStart = new Date(a.start);
|
|
16489
|
-
const bStart = new Date(b.start);
|
|
16490
|
-
const aEnd = new Date(a.end);
|
|
16491
|
-
const bEnd = new Date(b.end);
|
|
16466
|
+
const aStart = new Date(a.start ?? a.end ?? Date.now());
|
|
16467
|
+
const bStart = new Date(b.start ?? b.end ?? Date.now());
|
|
16468
|
+
const aEnd = new Date(a.end ?? a.start ?? Date.now());
|
|
16469
|
+
const bEnd = new Date(b.end ?? b.start ?? Date.now());
|
|
16492
16470
|
if (aStart < bStart) return -1;
|
|
16493
16471
|
if (aStart > bStart) return 1;
|
|
16494
|
-
const aDuration = (0,
|
|
16495
|
-
const bDuration = (0,
|
|
16472
|
+
const aDuration = (0, import_date_fns21.differenceInMinutes)(aEnd, aStart);
|
|
16473
|
+
const bDuration = (0, import_date_fns21.differenceInMinutes)(bEnd, bStart);
|
|
16496
16474
|
return bDuration - aDuration;
|
|
16497
16475
|
});
|
|
16498
16476
|
const columns = [];
|
|
16499
16477
|
for (const event of sortedEvents) {
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
if (hasTime) {
|
|
16507
|
-
if (!eventStart) eventStart = ad;
|
|
16508
|
-
if (!eventEnd) eventEnd = (0, import_date_fns22.addHours)(ad, 1);
|
|
16509
|
-
}
|
|
16510
|
-
} catch {
|
|
16511
|
-
}
|
|
16512
|
-
}
|
|
16513
|
-
if (!eventStart || !eventEnd) continue;
|
|
16514
|
-
const adjustedStart = (0, import_date_fns22.isSameDay)(currentDate, eventStart) ? eventStart : dayStart;
|
|
16515
|
-
const adjustedEnd = (0, import_date_fns22.isSameDay)(currentDate, eventEnd) ? eventEnd : (0, import_date_fns22.addHours)(dayStart, 24);
|
|
16516
|
-
const startHour = (0, import_date_fns22.getHours)(adjustedStart) + (0, import_date_fns22.getMinutes)(adjustedStart) / 60;
|
|
16517
|
-
const endHour = (0, import_date_fns22.getHours)(adjustedEnd) + (0, import_date_fns22.getMinutes)(adjustedEnd) / 60;
|
|
16478
|
+
const eventStart = new Date(event.start ?? event.end ?? Date.now());
|
|
16479
|
+
const eventEnd = new Date(event.end ?? event.start ?? Date.now());
|
|
16480
|
+
const adjustedStart = (0, import_date_fns21.isSameDay)(currentDate, eventStart) ? eventStart : dayStart;
|
|
16481
|
+
const adjustedEnd = (0, import_date_fns21.isSameDay)(currentDate, eventEnd) ? eventEnd : (0, import_date_fns21.addHours)(dayStart, 24);
|
|
16482
|
+
const startHour = (0, import_date_fns21.getHours)(adjustedStart) + (0, import_date_fns21.getMinutes)(adjustedStart) / 60;
|
|
16483
|
+
const endHour = (0, import_date_fns21.getHours)(adjustedEnd) + (0, import_date_fns21.getMinutes)(adjustedEnd) / 60;
|
|
16518
16484
|
const top = (startHour - StartHourAgenda) * WeekCellsHeightAgenda;
|
|
16519
16485
|
const height = (endHour - startHour) * WeekCellsHeightAgenda;
|
|
16520
16486
|
let columnIndex = 0;
|
|
@@ -16526,9 +16492,12 @@ function DayViewAgenda({
|
|
|
16526
16492
|
placed = true;
|
|
16527
16493
|
} else {
|
|
16528
16494
|
const overlaps = col.some(
|
|
16529
|
-
(c) => (0,
|
|
16495
|
+
(c) => (0, import_date_fns21.areIntervalsOverlapping)(
|
|
16530
16496
|
{ end: adjustedEnd, start: adjustedStart },
|
|
16531
|
-
{
|
|
16497
|
+
{
|
|
16498
|
+
end: new Date(c.event.end ?? c.event.start ?? Date.now()),
|
|
16499
|
+
start: new Date(c.event.start ?? c.event.end ?? Date.now())
|
|
16500
|
+
}
|
|
16532
16501
|
)
|
|
16533
16502
|
);
|
|
16534
16503
|
if (!overlaps) {
|
|
@@ -16540,7 +16509,11 @@ function DayViewAgenda({
|
|
|
16540
16509
|
}
|
|
16541
16510
|
const currentColumn = columns[columnIndex] || [];
|
|
16542
16511
|
columns[columnIndex] = currentColumn;
|
|
16543
|
-
currentColumn.push({
|
|
16512
|
+
currentColumn.push({
|
|
16513
|
+
end: adjustedEnd,
|
|
16514
|
+
event,
|
|
16515
|
+
start: adjustedStart
|
|
16516
|
+
});
|
|
16544
16517
|
const width = columnIndex === 0 ? 1 : 0.9;
|
|
16545
16518
|
const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
|
|
16546
16519
|
result.push({
|
|
@@ -16559,22 +16532,19 @@ function DayViewAgenda({
|
|
|
16559
16532
|
onEventSelect(event);
|
|
16560
16533
|
};
|
|
16561
16534
|
const showAllDaySection = allDayEvents.length > 0;
|
|
16562
|
-
const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(
|
|
16563
|
-
currentDate,
|
|
16564
|
-
"day"
|
|
16565
|
-
);
|
|
16535
|
+
const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(currentDate, "day");
|
|
16566
16536
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "contents", "data-slot": "day-view", children: [
|
|
16567
16537
|
showAllDaySection && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "border-border/70 border-t bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "grid grid-cols-[3rem_1fr] sm:grid-cols-[4rem_1fr]", children: [
|
|
16568
16538
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full pe-2 text-right text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: "All day" }) }),
|
|
16569
16539
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "relative border-border/70 border-r p-1 last:border-r-0", children: allDayEvents.map((event) => {
|
|
16570
16540
|
const eventStart = new Date(
|
|
16571
|
-
event.start ?? event.
|
|
16541
|
+
event.start ?? event.end ?? Date.now()
|
|
16572
16542
|
);
|
|
16573
16543
|
const eventEnd = new Date(
|
|
16574
|
-
event.end ?? event.
|
|
16544
|
+
event.end ?? event.start ?? Date.now()
|
|
16575
16545
|
);
|
|
16576
|
-
const isFirstDay = (0,
|
|
16577
|
-
const isLastDay = (0,
|
|
16546
|
+
const isFirstDay = (0, import_date_fns21.isSameDay)(currentDate, eventStart);
|
|
16547
|
+
const isLastDay = (0, import_date_fns21.isSameDay)(currentDate, eventEnd);
|
|
16578
16548
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
16579
16549
|
EventItemAgenda,
|
|
16580
16550
|
{
|
|
@@ -16594,21 +16564,17 @@ function DayViewAgenda({
|
|
|
16594
16564
|
"div",
|
|
16595
16565
|
{
|
|
16596
16566
|
className: "relative h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
|
|
16597
|
-
children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0,
|
|
16567
|
+
children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0, import_date_fns21.format)(hour, "HH:mm") })
|
|
16598
16568
|
},
|
|
16599
16569
|
hour.toString()
|
|
16600
16570
|
)) }),
|
|
16601
16571
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "relative", children: [
|
|
16602
16572
|
positionedEvents.map((positionedEvent) => {
|
|
16603
16573
|
const evt = positionedEvent.event;
|
|
16604
|
-
const eventStart = new Date(
|
|
16605
|
-
|
|
16606
|
-
);
|
|
16607
|
-
const
|
|
16608
|
-
evt.end ?? evt.attend_date ?? evt.start ?? Date.now()
|
|
16609
|
-
);
|
|
16610
|
-
const isFirstDay = (0, import_date_fns22.isSameDay)(currentDate, eventStart);
|
|
16611
|
-
const isLastDay = (0, import_date_fns22.isSameDay)(currentDate, eventEnd);
|
|
16574
|
+
const eventStart = new Date(evt.start ?? evt.end ?? Date.now());
|
|
16575
|
+
const eventEnd = new Date(evt.end ?? evt.start ?? Date.now());
|
|
16576
|
+
const isFirstDay = (0, import_date_fns21.isSameDay)(currentDate, eventStart);
|
|
16577
|
+
const isLastDay = (0, import_date_fns21.isSameDay)(currentDate, eventEnd);
|
|
16612
16578
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
16613
16579
|
"div",
|
|
16614
16580
|
{
|
|
@@ -16647,7 +16613,7 @@ function DayViewAgenda({
|
|
|
16647
16613
|
}
|
|
16648
16614
|
),
|
|
16649
16615
|
hours.map((hour) => {
|
|
16650
|
-
const hourValue = (0,
|
|
16616
|
+
const hourValue = (0, import_date_fns21.getHours)(hour);
|
|
16651
16617
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
16652
16618
|
"div",
|
|
16653
16619
|
{
|
|
@@ -16694,7 +16660,7 @@ function DayViewAgenda({
|
|
|
16694
16660
|
}
|
|
16695
16661
|
|
|
16696
16662
|
// src/components/event-calendar-view/EventAgenda.tsx
|
|
16697
|
-
var
|
|
16663
|
+
var import_date_fns22 = require("date-fns");
|
|
16698
16664
|
var import_locale11 = require("date-fns/locale");
|
|
16699
16665
|
var import_react81 = require("react");
|
|
16700
16666
|
var import_sonner4 = require("sonner");
|
|
@@ -16705,370 +16671,170 @@ function EventAgenda({
|
|
|
16705
16671
|
onEventUpdate,
|
|
16706
16672
|
className,
|
|
16707
16673
|
initialView = "month",
|
|
16708
|
-
mode,
|
|
16709
16674
|
initialDate
|
|
16710
16675
|
}) {
|
|
16711
16676
|
const [currentDate, setCurrentDate] = (0, import_react81.useState)(
|
|
16712
16677
|
initialDate && new Date(initialDate) || /* @__PURE__ */ new Date()
|
|
16713
16678
|
);
|
|
16714
16679
|
const [view, setView] = (0, import_react81.useState)(initialView);
|
|
16715
|
-
const
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
(
|
|
16719
|
-
|
|
16720
|
-
|
|
16721
|
-
setIsFading(true);
|
|
16722
|
-
window.setTimeout(() => {
|
|
16723
|
-
setView(next);
|
|
16724
|
-
requestAnimationFrame(() => setIsFading(false));
|
|
16725
|
-
}, FADE_DURATION);
|
|
16726
|
-
},
|
|
16727
|
-
[view, mode]
|
|
16728
|
-
);
|
|
16729
|
-
const [isPaging, setIsPaging] = (0, import_react81.useState)(false);
|
|
16730
|
-
const [pageDirection, setPageDirection] = (0, import_react81.useState)(
|
|
16731
|
-
null
|
|
16732
|
-
);
|
|
16733
|
-
const PAGE_DURATION = 200;
|
|
16734
|
-
const pageTransition = (0, import_react81.useCallback)(
|
|
16735
|
-
(applyDateChange, direction) => {
|
|
16736
|
-
setIsPaging(true);
|
|
16737
|
-
setPageDirection(direction);
|
|
16738
|
-
window.setTimeout(() => {
|
|
16739
|
-
applyDateChange();
|
|
16740
|
-
requestAnimationFrame(() => {
|
|
16741
|
-
setIsPaging(false);
|
|
16742
|
-
setPageDirection(null);
|
|
16743
|
-
});
|
|
16744
|
-
}, PAGE_DURATION);
|
|
16745
|
-
},
|
|
16746
|
-
[]
|
|
16747
|
-
);
|
|
16748
|
-
const [isEventDialogOpen, setIsEventDialogOpen] = (0, import_react81.useState)(false);
|
|
16749
|
-
(0, import_react81.useEffect)(() => {
|
|
16750
|
-
const handleKeyDown = (e) => {
|
|
16751
|
-
if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
|
|
16752
|
-
return;
|
|
16753
|
-
}
|
|
16754
|
-
if (mode === "agenda-only") return;
|
|
16755
|
-
switch (e.key.toLowerCase()) {
|
|
16756
|
-
case "m":
|
|
16757
|
-
changeView("month");
|
|
16758
|
-
break;
|
|
16759
|
-
case "w":
|
|
16760
|
-
case "s":
|
|
16761
|
-
changeView("week");
|
|
16762
|
-
break;
|
|
16763
|
-
case "d":
|
|
16764
|
-
changeView("day");
|
|
16765
|
-
break;
|
|
16766
|
-
case "a":
|
|
16767
|
-
changeView("agenda");
|
|
16768
|
-
break;
|
|
16769
|
-
}
|
|
16770
|
-
};
|
|
16771
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
16772
|
-
return () => {
|
|
16773
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
16774
|
-
};
|
|
16775
|
-
}, [isEventDialogOpen, changeView, mode]);
|
|
16776
|
-
(0, import_react81.useEffect)(() => {
|
|
16777
|
-
if (mode === "agenda-only") setView("agenda");
|
|
16778
|
-
}, [mode]);
|
|
16779
|
-
const handlePrevious = () => {
|
|
16780
|
-
pageTransition(() => {
|
|
16781
|
-
if (view === "month") {
|
|
16782
|
-
setCurrentDate((0, import_date_fns23.subMonths)(currentDate, 1));
|
|
16783
|
-
} else if (view === "week") {
|
|
16784
|
-
setCurrentDate((0, import_date_fns23.subWeeks)(currentDate, 1));
|
|
16785
|
-
} else if (view === "day") {
|
|
16786
|
-
setCurrentDate((0, import_date_fns23.addDays)(currentDate, -1));
|
|
16787
|
-
} else if (view === "agenda") {
|
|
16788
|
-
setCurrentDate((0, import_date_fns23.addDays)(currentDate, -AgendaDaysToShowAgenda));
|
|
16789
|
-
}
|
|
16790
|
-
}, "right");
|
|
16680
|
+
const goPrevious = () => {
|
|
16681
|
+
if (view === "month") setCurrentDate((d) => (0, import_date_fns22.subMonths)(d, 1));
|
|
16682
|
+
else if (view === "week") setCurrentDate((d) => (0, import_date_fns22.subWeeks)(d, 1));
|
|
16683
|
+
else if (view === "day") setCurrentDate((d) => (0, import_date_fns22.addDays)(d, -1));
|
|
16684
|
+
else if (view === "agenda")
|
|
16685
|
+
setCurrentDate((d) => (0, import_date_fns22.addDays)(d, -AgendaDaysToShowAgenda));
|
|
16791
16686
|
};
|
|
16792
|
-
const
|
|
16793
|
-
|
|
16794
|
-
|
|
16795
|
-
|
|
16796
|
-
|
|
16797
|
-
|
|
16798
|
-
} else if (view === "day") {
|
|
16799
|
-
setCurrentDate((0, import_date_fns23.addDays)(currentDate, 1));
|
|
16800
|
-
} else if (view === "agenda") {
|
|
16801
|
-
setCurrentDate((0, import_date_fns23.addDays)(currentDate, AgendaDaysToShowAgenda));
|
|
16802
|
-
}
|
|
16803
|
-
}, "left");
|
|
16804
|
-
};
|
|
16805
|
-
const handleToday = () => {
|
|
16806
|
-
setCurrentDate(/* @__PURE__ */ new Date());
|
|
16687
|
+
const goNext = () => {
|
|
16688
|
+
if (view === "month") setCurrentDate((d) => (0, import_date_fns22.addMonths)(d, 1));
|
|
16689
|
+
else if (view === "week") setCurrentDate((d) => (0, import_date_fns22.addWeeks)(d, 1));
|
|
16690
|
+
else if (view === "day") setCurrentDate((d) => (0, import_date_fns22.addDays)(d, 1));
|
|
16691
|
+
else if (view === "agenda")
|
|
16692
|
+
setCurrentDate((d) => (0, import_date_fns22.addDays)(d, AgendaDaysToShowAgenda));
|
|
16807
16693
|
};
|
|
16808
16694
|
const handleEventSelect = (event) => {
|
|
16809
16695
|
console.log("Event selected:", event);
|
|
16810
|
-
setIsEventDialogOpen(true);
|
|
16811
16696
|
};
|
|
16812
16697
|
const handleEventUpdate = (updatedEvent) => {
|
|
16813
16698
|
onEventUpdate?.(updatedEvent);
|
|
16814
16699
|
const startDate = updatedEvent.start ?? /* @__PURE__ */ new Date();
|
|
16815
16700
|
(0, import_sonner4.toast)(`Evento "${updatedEvent.title}" movido`, {
|
|
16816
|
-
description: (0,
|
|
16701
|
+
description: (0, import_date_fns22.format)(startDate, "d 'de' MMMM 'de' yyyy", { locale: import_locale11.ptBR }),
|
|
16817
16702
|
position: "bottom-left"
|
|
16818
16703
|
});
|
|
16819
16704
|
};
|
|
16705
|
+
const viewLabel = (v, condensed = false) => {
|
|
16706
|
+
const labels = {
|
|
16707
|
+
month: { full: "M\xEAs", short: "M" },
|
|
16708
|
+
week: { full: "Semana", short: "S" },
|
|
16709
|
+
day: { full: "Dia", short: "D" },
|
|
16710
|
+
agenda: { full: "Agenda", short: "A" }
|
|
16711
|
+
};
|
|
16712
|
+
const entry = labels[v] || { full: v, short: v };
|
|
16713
|
+
return condensed ? entry.short : entry.full;
|
|
16714
|
+
};
|
|
16820
16715
|
const viewTitle = (0, import_react81.useMemo)(() => {
|
|
16821
|
-
const capitalize = (s) => s
|
|
16822
|
-
if (view === "month")
|
|
16823
|
-
return capitalize((0,
|
|
16824
|
-
}
|
|
16716
|
+
const capitalize = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
16717
|
+
if (view === "month")
|
|
16718
|
+
return capitalize((0, import_date_fns22.format)(currentDate, "MMMM yyyy", { locale: import_locale11.ptBR }));
|
|
16825
16719
|
if (view === "week") {
|
|
16826
|
-
const start = (0,
|
|
16827
|
-
const end = (0,
|
|
16828
|
-
if ((0,
|
|
16829
|
-
return capitalize((0,
|
|
16830
|
-
}
|
|
16831
|
-
const
|
|
16832
|
-
const s2 = capitalize((0, import_date_fns23.format)(end, "MMM yyyy", { locale: import_locale11.ptBR }));
|
|
16720
|
+
const start = (0, import_date_fns22.startOfWeek)(currentDate, { weekStartsOn: 1 });
|
|
16721
|
+
const end = (0, import_date_fns22.endOfWeek)(currentDate, { weekStartsOn: 1 });
|
|
16722
|
+
if ((0, import_date_fns22.isSameMonth)(start, end))
|
|
16723
|
+
return capitalize((0, import_date_fns22.format)(start, "MMMM yyyy", { locale: import_locale11.ptBR }));
|
|
16724
|
+
const s1 = capitalize((0, import_date_fns22.format)(start, "MMM", { locale: import_locale11.ptBR }));
|
|
16725
|
+
const s2 = capitalize((0, import_date_fns22.format)(end, "MMM yyyy", { locale: import_locale11.ptBR }));
|
|
16833
16726
|
return `${s1} - ${s2}`;
|
|
16834
16727
|
}
|
|
16835
|
-
if (view === "day")
|
|
16836
|
-
|
|
16837
|
-
const month = capitalize((0, import_date_fns23.format)(currentDate, "MMMM", { locale: import_locale11.ptBR }));
|
|
16838
|
-
const year = (0, import_date_fns23.format)(currentDate, "yyyy", { locale: import_locale11.ptBR });
|
|
16839
|
-
const short = `${dayNum} de ${month} de ${year}`;
|
|
16840
|
-
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
16841
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
|
|
16842
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short })
|
|
16843
|
-
] });
|
|
16844
|
-
}
|
|
16728
|
+
if (view === "day")
|
|
16729
|
+
return (0, import_date_fns22.format)(currentDate, "d 'de' MMMM 'de' yyyy", { locale: import_locale11.ptBR });
|
|
16845
16730
|
if (view === "agenda") {
|
|
16846
16731
|
const start = currentDate;
|
|
16847
|
-
const end = (0,
|
|
16848
|
-
if ((0,
|
|
16849
|
-
return capitalize((0,
|
|
16850
|
-
}
|
|
16851
|
-
const
|
|
16852
|
-
const s2 = capitalize((0, import_date_fns23.format)(end, "MMMM yyyy", { locale: import_locale11.ptBR }));
|
|
16732
|
+
const end = (0, import_date_fns22.addDays)(currentDate, AgendaDaysToShowAgenda - 1);
|
|
16733
|
+
if ((0, import_date_fns22.isSameMonth)(start, end))
|
|
16734
|
+
return capitalize((0, import_date_fns22.format)(start, "MMMM yyyy", { locale: import_locale11.ptBR }));
|
|
16735
|
+
const s1 = capitalize((0, import_date_fns22.format)(start, "MMMM", { locale: import_locale11.ptBR }));
|
|
16736
|
+
const s2 = capitalize((0, import_date_fns22.format)(end, "MMMM yyyy", { locale: import_locale11.ptBR }));
|
|
16853
16737
|
return `${s1} - ${s2}`;
|
|
16854
16738
|
}
|
|
16855
|
-
return capitalize((0,
|
|
16739
|
+
return capitalize((0, import_date_fns22.format)(currentDate, "MMMM yyyy", { locale: import_locale11.ptBR }));
|
|
16856
16740
|
}, [currentDate, view]);
|
|
16857
|
-
|
|
16858
|
-
|
|
16859
|
-
|
|
16860
|
-
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
|
|
16865
|
-
|
|
16741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16742
|
+
"div",
|
|
16743
|
+
{
|
|
16744
|
+
className: cn(
|
|
16745
|
+
"flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2",
|
|
16746
|
+
className
|
|
16747
|
+
),
|
|
16748
|
+
style: {
|
|
16749
|
+
"--event-gap": `${EventGapAgenda}px`,
|
|
16750
|
+
"--event-height": `${EventHeightAgenda}px`,
|
|
16751
|
+
"--week-cells-height": `${WeekCellsHeightAgenda}px`
|
|
16752
|
+
},
|
|
16753
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(CalendarDndProviderAgenda, { onEventUpdate: handleEventUpdate, children: [
|
|
16754
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center justify-between p-2 sm:p-4", children: [
|
|
16866
16755
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-1 sm:gap-4", children: [
|
|
16867
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
16868
|
-
ButtonBase,
|
|
16869
|
-
{
|
|
16870
|
-
className: "max-[479px]:aspect-square max-[479px]:p-0!",
|
|
16871
|
-
onClick: handleToday,
|
|
16872
|
-
variant: "outline",
|
|
16873
|
-
children: [
|
|
16874
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16875
|
-
import_react82.CalendarIcon,
|
|
16876
|
-
{
|
|
16877
|
-
"aria-hidden": "true",
|
|
16878
|
-
className: "min-[480px]:hidden",
|
|
16879
|
-
size: 16
|
|
16880
|
-
}
|
|
16881
|
-
),
|
|
16882
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "max-[479px]:sr-only", children: "Hoje" })
|
|
16883
|
-
]
|
|
16884
|
-
}
|
|
16885
|
-
),
|
|
16886
16756
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center sm:gap-2", children: [
|
|
16887
16757
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16888
16758
|
ButtonBase,
|
|
16889
16759
|
{
|
|
16890
16760
|
"aria-label": "Anterior",
|
|
16891
|
-
onClick:
|
|
16761
|
+
onClick: goPrevious,
|
|
16892
16762
|
size: "icon",
|
|
16893
16763
|
variant: "ghost",
|
|
16894
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.CaretLeftIcon, { "aria-hidden":
|
|
16764
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.CaretLeftIcon, { "aria-hidden": true, size: 16 })
|
|
16895
16765
|
}
|
|
16896
16766
|
),
|
|
16897
16767
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16898
16768
|
ButtonBase,
|
|
16899
16769
|
{
|
|
16900
16770
|
"aria-label": "Pr\xF3ximo",
|
|
16901
|
-
onClick:
|
|
16771
|
+
onClick: goNext,
|
|
16902
16772
|
size: "icon",
|
|
16903
16773
|
variant: "ghost",
|
|
16904
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.CaretRightIcon, { "aria-hidden":
|
|
16774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.CaretRightIcon, { "aria-hidden": true, size: 16 })
|
|
16905
16775
|
}
|
|
16906
16776
|
)
|
|
16907
16777
|
] }),
|
|
16908
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("h2", { className: "font-semibold text-xl", children: viewTitle })
|
|
16778
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("h2", { className: "font-semibold text-md sm:text-xl", children: viewTitle })
|
|
16909
16779
|
] }),
|
|
16910
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16911
|
-
|
|
16912
|
-
ButtonBase,
|
|
16913
|
-
{
|
|
16914
|
-
className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
|
|
16915
|
-
variant: "outline",
|
|
16916
|
-
children: [
|
|
16917
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
16918
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "hidden min-[480px]:inline-block", children: (() => {
|
|
16919
|
-
const labels = {
|
|
16920
|
-
month: "M\xEAs",
|
|
16921
|
-
week: "Semana",
|
|
16922
|
-
day: "Dia",
|
|
16923
|
-
agenda: "Agenda"
|
|
16924
|
-
};
|
|
16925
|
-
return labels[view] || view;
|
|
16926
|
-
})() }),
|
|
16927
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "min-[480px]:hidden", children: (() => {
|
|
16928
|
-
const labels = {
|
|
16929
|
-
month: "M",
|
|
16930
|
-
week: "S",
|
|
16931
|
-
day: "D",
|
|
16932
|
-
agenda: "A"
|
|
16933
|
-
};
|
|
16934
|
-
return labels[view] || view;
|
|
16935
|
-
})() })
|
|
16936
|
-
] }),
|
|
16937
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16938
|
-
import_react82.CaretDownIcon,
|
|
16939
|
-
{
|
|
16940
|
-
"aria-hidden": "true",
|
|
16941
|
-
className: "-me-1 opacity-60",
|
|
16942
|
-
size: 16
|
|
16943
|
-
}
|
|
16944
|
-
)
|
|
16945
|
-
]
|
|
16946
|
-
}
|
|
16947
|
-
) }),
|
|
16948
|
-
mode === "agenda-only" ? null : /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
16949
|
-
DropDownMenuContentBase,
|
|
16950
|
-
{
|
|
16951
|
-
align: "end",
|
|
16952
|
-
className: "min-w-32 rounded-md p-1",
|
|
16953
|
-
children: [
|
|
16954
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
16955
|
-
DropDownMenuItemBase,
|
|
16956
|
-
{
|
|
16957
|
-
onClick: () => changeView("month"),
|
|
16958
|
-
className: cn(
|
|
16959
|
-
"flex items-center justify-between gap-2 px-3 py-2 rounded",
|
|
16960
|
-
view === "month"
|
|
16961
|
-
),
|
|
16962
|
-
children: [
|
|
16963
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { children: " M\xEAs " }) }),
|
|
16964
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: view === "month" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.Check, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuShortcutBase, { children: "M" }) })
|
|
16965
|
-
]
|
|
16966
|
-
}
|
|
16967
|
-
),
|
|
16968
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
16969
|
-
DropDownMenuItemBase,
|
|
16970
|
-
{
|
|
16971
|
-
onClick: () => changeView("week"),
|
|
16972
|
-
className: cn(
|
|
16973
|
-
"flex items-center justify-between gap-2 px-3 py-2 rounded",
|
|
16974
|
-
view === "week"
|
|
16975
|
-
),
|
|
16976
|
-
children: [
|
|
16977
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: "Semana" }),
|
|
16978
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: view === "week" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.Check, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuShortcutBase, { children: "S" }) })
|
|
16979
|
-
]
|
|
16980
|
-
}
|
|
16981
|
-
),
|
|
16982
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
16983
|
-
DropDownMenuItemBase,
|
|
16984
|
-
{
|
|
16985
|
-
onClick: () => changeView("day"),
|
|
16986
|
-
className: cn(
|
|
16987
|
-
"flex items-center justify-between gap-2 px-3 py-2 rounded",
|
|
16988
|
-
view === "day"
|
|
16989
|
-
),
|
|
16990
|
-
children: [
|
|
16991
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: "Dia" }),
|
|
16992
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: view === "day" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.Check, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuShortcutBase, { children: "D" }) })
|
|
16993
|
-
]
|
|
16994
|
-
}
|
|
16995
|
-
),
|
|
16996
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
16997
|
-
DropDownMenuItemBase,
|
|
16998
|
-
{
|
|
16999
|
-
onClick: () => changeView("agenda"),
|
|
17000
|
-
className: cn(
|
|
17001
|
-
"flex items-center justify-between gap-2 px-3 py-2 rounded",
|
|
17002
|
-
view === "agenda"
|
|
17003
|
-
),
|
|
17004
|
-
children: [
|
|
17005
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: "Agenda" }),
|
|
17006
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: view === "agenda" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.Check, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuShortcutBase, { children: "A" }) })
|
|
17007
|
-
]
|
|
17008
|
-
}
|
|
17009
|
-
)
|
|
17010
|
-
]
|
|
17011
|
-
}
|
|
17012
|
-
)
|
|
17013
|
-
] }) }) })
|
|
17014
|
-
]
|
|
17015
|
-
}
|
|
17016
|
-
),
|
|
17017
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
17018
|
-
"div",
|
|
17019
|
-
{
|
|
17020
|
-
className: cn(
|
|
17021
|
-
"flex flex-1 flex-col transition-all duration-200 ease-in-out",
|
|
17022
|
-
isFading ? "opacity-0 -translate-y-2 pointer-events-none" : isPaging ? pageDirection === "left" ? "-translate-x-4 opacity-0 pointer-events-none" : "translate-x-4 opacity-0 pointer-events-none" : "opacity-100 translate-y-0"
|
|
17023
|
-
),
|
|
17024
|
-
"aria-live": "polite",
|
|
17025
|
-
children: [
|
|
17026
|
-
view === "month" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
17027
|
-
MonthViewAgenda,
|
|
16780
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16781
|
+
Select,
|
|
17028
16782
|
{
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
|
|
17039
|
-
onEventSelect: handleEventSelect
|
|
17040
|
-
}
|
|
17041
|
-
),
|
|
17042
|
-
view === "day" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
17043
|
-
DayViewAgenda,
|
|
17044
|
-
{
|
|
17045
|
-
currentDate,
|
|
17046
|
-
events,
|
|
17047
|
-
onEventSelect: handleEventSelect
|
|
17048
|
-
}
|
|
17049
|
-
),
|
|
17050
|
-
view === "agenda" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
17051
|
-
Agenda,
|
|
17052
|
-
{
|
|
17053
|
-
currentDate,
|
|
17054
|
-
events,
|
|
17055
|
-
onEventSelect: handleEventSelect
|
|
16783
|
+
selected: view,
|
|
16784
|
+
onChange: (v) => {
|
|
16785
|
+
setView(v);
|
|
16786
|
+
},
|
|
16787
|
+
items: ["month", "week", "day", "agenda"].map((v) => ({
|
|
16788
|
+
label: viewLabel(v),
|
|
16789
|
+
value: v
|
|
16790
|
+
})),
|
|
16791
|
+
className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
|
|
16792
|
+
placeholder: viewLabel(view)
|
|
17056
16793
|
}
|
|
17057
|
-
)
|
|
17058
|
-
]
|
|
17059
|
-
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
16794
|
+
) })
|
|
16795
|
+
] }),
|
|
16796
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
16797
|
+
"div",
|
|
16798
|
+
{
|
|
16799
|
+
className: "flex flex-1 flex-col transition-all duration-200 ease-in-out",
|
|
16800
|
+
"aria-live": "polite",
|
|
16801
|
+
children: [
|
|
16802
|
+
view === "month" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16803
|
+
MonthViewAgenda,
|
|
16804
|
+
{
|
|
16805
|
+
currentDate,
|
|
16806
|
+
events,
|
|
16807
|
+
onEventSelect: handleEventSelect
|
|
16808
|
+
}
|
|
16809
|
+
),
|
|
16810
|
+
view === "week" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16811
|
+
WeekViewAgenda,
|
|
16812
|
+
{
|
|
16813
|
+
currentDate,
|
|
16814
|
+
events,
|
|
16815
|
+
onEventSelect: handleEventSelect
|
|
16816
|
+
}
|
|
16817
|
+
),
|
|
16818
|
+
view === "day" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16819
|
+
DayViewAgenda,
|
|
16820
|
+
{
|
|
16821
|
+
currentDate,
|
|
16822
|
+
events,
|
|
16823
|
+
onEventSelect: handleEventSelect
|
|
16824
|
+
}
|
|
16825
|
+
),
|
|
16826
|
+
view === "agenda" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16827
|
+
Agenda,
|
|
16828
|
+
{
|
|
16829
|
+
currentDate,
|
|
16830
|
+
events,
|
|
16831
|
+
onEventSelect: handleEventSelect
|
|
16832
|
+
}
|
|
16833
|
+
)
|
|
16834
|
+
]
|
|
16835
|
+
}
|
|
16836
|
+
)
|
|
16837
|
+
] })
|
|
17072
16838
|
}
|
|
17073
16839
|
);
|
|
17074
16840
|
}
|
|
@@ -17092,14 +16858,12 @@ function UndatedEvents({
|
|
|
17092
16858
|
show = true
|
|
17093
16859
|
}) {
|
|
17094
16860
|
const undatedEvents = (0, import_react83.useMemo)(
|
|
17095
|
-
() => events.filter(
|
|
17096
|
-
(e) => !(isValidDate5(e.start) && isValidDate5(e.end)) && !isValidDate5(e.attend_date)
|
|
17097
|
-
),
|
|
16861
|
+
() => events.filter((e) => !(isValidDate5(e.start) || isValidDate5(e.end))),
|
|
17098
16862
|
[events]
|
|
17099
16863
|
);
|
|
17100
16864
|
if (!show || undatedEvents.length === 0) return null;
|
|
17101
16865
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "relative border-border/70 border-t", children: [
|
|
17102
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase sm:pe-4 text-lg", children: title }),
|
|
16866
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase sm:pe-4 text-md sm:text-lg", children: title }),
|
|
17103
16867
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "mt-6 space-y-2", children: undatedEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
17104
16868
|
EventItemAgenda,
|
|
17105
16869
|
{
|
|
@@ -17161,7 +16925,7 @@ function useEventVisibilityAgenda({
|
|
|
17161
16925
|
}
|
|
17162
16926
|
|
|
17163
16927
|
// src/components/event-calendar-view/MonthView.tsx
|
|
17164
|
-
var
|
|
16928
|
+
var import_date_fns23 = require("date-fns");
|
|
17165
16929
|
var import_locale12 = require("date-fns/locale");
|
|
17166
16930
|
var import_react85 = require("react");
|
|
17167
16931
|
var import_tailwind_merge3 = require("tailwind-merge");
|
|
@@ -17173,16 +16937,16 @@ function MonthViewAgenda({
|
|
|
17173
16937
|
showUndatedEvents
|
|
17174
16938
|
}) {
|
|
17175
16939
|
const days = (0, import_react85.useMemo)(() => {
|
|
17176
|
-
const monthStart = (0,
|
|
17177
|
-
const monthEnd = (0,
|
|
17178
|
-
const calendarStart = (0,
|
|
17179
|
-
const calendarEnd = (0,
|
|
17180
|
-
return (0,
|
|
16940
|
+
const monthStart = (0, import_date_fns23.startOfMonth)(currentDate);
|
|
16941
|
+
const monthEnd = (0, import_date_fns23.endOfMonth)(monthStart);
|
|
16942
|
+
const calendarStart = (0, import_date_fns23.startOfWeek)(monthStart, { weekStartsOn: 0 });
|
|
16943
|
+
const calendarEnd = (0, import_date_fns23.endOfWeek)(monthEnd, { weekStartsOn: 0 });
|
|
16944
|
+
return (0, import_date_fns23.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
|
|
17181
16945
|
}, [currentDate]);
|
|
17182
16946
|
const weekdays = (0, import_react85.useMemo)(() => {
|
|
17183
16947
|
return Array.from({ length: 7 }).map((_, i) => {
|
|
17184
|
-
const date = (0,
|
|
17185
|
-
const short = (0,
|
|
16948
|
+
const date = (0, import_date_fns23.addDays)((0, import_date_fns23.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
|
|
16949
|
+
const short = (0, import_date_fns23.format)(date, "EEE", { locale: import_locale12.ptBR });
|
|
17186
16950
|
return short.charAt(0).toUpperCase() + short.slice(1);
|
|
17187
16951
|
});
|
|
17188
16952
|
}, []);
|
|
@@ -17227,7 +16991,7 @@ function MonthViewAgenda({
|
|
|
17227
16991
|
if (!day) return null;
|
|
17228
16992
|
const dayEvents = getEventsForDayAgenda(events, day);
|
|
17229
16993
|
const spanningEvents = getSpanningEventsForDayAgenda(events, day);
|
|
17230
|
-
const isCurrentMonth = (0,
|
|
16994
|
+
const isCurrentMonth = (0, import_date_fns23.isSameMonth)(day, currentDate);
|
|
17231
16995
|
const cellId = `month-cell-${day.toISOString()}`;
|
|
17232
16996
|
const allDayEvents = [...spanningEvents, ...dayEvents];
|
|
17233
16997
|
const allEvents = getAllEventsForDayAgenda(events, day);
|
|
@@ -17240,7 +17004,7 @@ function MonthViewAgenda({
|
|
|
17240
17004
|
{
|
|
17241
17005
|
className: "group border-border/70 border-r border-b last:border-r-0 data-outside-cell:bg-muted/25 data-outside-cell:text-muted-foreground/70 hover:bg-muted/5 transition-colors p-2 ",
|
|
17242
17006
|
"data-outside-cell": !isCurrentMonth || void 0,
|
|
17243
|
-
"data-today": (0,
|
|
17007
|
+
"data-today": (0, import_date_fns23.isToday)(day) || void 0,
|
|
17244
17008
|
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
17245
17009
|
DroppableCellAgenda,
|
|
17246
17010
|
{
|
|
@@ -17256,9 +17020,9 @@ function MonthViewAgenda({
|
|
|
17256
17020
|
{
|
|
17257
17021
|
className: (0, import_tailwind_merge3.twMerge)(
|
|
17258
17022
|
`mt-1 inline-flex w-7 h-7 items-center justify-center rounded-full text-sm font-semibold text-muted-foreground`,
|
|
17259
|
-
(0,
|
|
17023
|
+
(0, import_date_fns23.isToday)(day) ? "bg-blue-500 text-white" : ""
|
|
17260
17024
|
),
|
|
17261
|
-
children: (0,
|
|
17025
|
+
children: (0, import_date_fns23.format)(day, "d")
|
|
17262
17026
|
}
|
|
17263
17027
|
),
|
|
17264
17028
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
@@ -17269,13 +17033,13 @@ function MonthViewAgenda({
|
|
|
17269
17033
|
children: [
|
|
17270
17034
|
sortEventsAgenda(allDayEvents).map((event, index) => {
|
|
17271
17035
|
const eventStart = new Date(
|
|
17272
|
-
event.start ?? event.
|
|
17036
|
+
event.start ?? event.end ?? Date.now()
|
|
17273
17037
|
);
|
|
17274
17038
|
const eventEnd = new Date(
|
|
17275
|
-
event.end ?? event.
|
|
17039
|
+
event.end ?? event.start ?? Date.now()
|
|
17276
17040
|
);
|
|
17277
|
-
const isFirstDay = (0,
|
|
17278
|
-
const isLastDay = (0,
|
|
17041
|
+
const isFirstDay = (0, import_date_fns23.isSameDay)(day, eventStart);
|
|
17042
|
+
const isLastDay = (0, import_date_fns23.isSameDay)(day, eventEnd);
|
|
17279
17043
|
const isHidden = isMounted && visibleCount && index >= visibleCount;
|
|
17280
17044
|
if (!visibleCount) return null;
|
|
17281
17045
|
if (!isFirstDay) {
|
|
@@ -17294,7 +17058,7 @@ function MonthViewAgenda({
|
|
|
17294
17058
|
view: "month",
|
|
17295
17059
|
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { "aria-hidden": true, className: "invisible", children: [
|
|
17296
17060
|
!event.allDay && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { children: [
|
|
17297
|
-
(0,
|
|
17061
|
+
(0, import_date_fns23.format)(eventStart, "HH:mm"),
|
|
17298
17062
|
" "
|
|
17299
17063
|
] }),
|
|
17300
17064
|
event.title
|
|
@@ -17320,7 +17084,7 @@ function MonthViewAgenda({
|
|
|
17320
17084
|
onClick: (e) => handleEventClick(event, e),
|
|
17321
17085
|
view: "month",
|
|
17322
17086
|
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "flex items-center gap-2 truncate", children: [
|
|
17323
|
-
!event.allDay && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: (0,
|
|
17087
|
+
!event.allDay && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: (0, import_date_fns23.format)(eventStart, "HH:mm") }),
|
|
17324
17088
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "truncate font-medium", children: event.title })
|
|
17325
17089
|
] })
|
|
17326
17090
|
}
|
|
@@ -17336,7 +17100,7 @@ function MonthViewAgenda({
|
|
|
17336
17100
|
className: "mt-[var(--event-gap)] flex h-[var(--event-height)] w-full select-none items-center overflow-hidden px-2 text-left text-[10px] text-muted-foreground outline-none backdrop-blur-md rounded-md transition hover:bg-muted/60 hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:text-xs",
|
|
17337
17101
|
onClick: (e) => e.stopPropagation(),
|
|
17338
17102
|
type: "button",
|
|
17339
|
-
"aria-label": `Show ${remainingCount} more events on ${(0,
|
|
17103
|
+
"aria-label": `Show ${remainingCount} more events on ${(0, import_date_fns23.format)(
|
|
17340
17104
|
day,
|
|
17341
17105
|
"PPP",
|
|
17342
17106
|
{ locale: import_locale12.ptBR }
|
|
@@ -17359,7 +17123,7 @@ function MonthViewAgenda({
|
|
|
17359
17123
|
"--event-height": `${EventHeightAgenda}px`
|
|
17360
17124
|
},
|
|
17361
17125
|
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "space-y-2", children: [
|
|
17362
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "font-medium text-sm", children: (0,
|
|
17126
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "font-medium text-sm", children: (0, import_date_fns23.format)(day, "EEE d", { locale: import_locale12.ptBR }) }),
|
|
17363
17127
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "space-y-1", children: sortEventsAgenda(allEvents).map((event) => {
|
|
17364
17128
|
const eventStart = new Date(
|
|
17365
17129
|
event.start ?? event.end ?? Date.now()
|
|
@@ -17367,8 +17131,8 @@ function MonthViewAgenda({
|
|
|
17367
17131
|
const eventEnd = new Date(
|
|
17368
17132
|
event.end ?? event.start ?? Date.now()
|
|
17369
17133
|
);
|
|
17370
|
-
const isFirstDay = (0,
|
|
17371
|
-
const isLastDay = (0,
|
|
17134
|
+
const isFirstDay = (0, import_date_fns23.isSameDay)(day, eventStart);
|
|
17135
|
+
const isLastDay = (0, import_date_fns23.isSameDay)(day, eventEnd);
|
|
17372
17136
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
17373
17137
|
EventItemAgenda,
|
|
17374
17138
|
{
|
|
@@ -17411,15 +17175,14 @@ function MonthViewAgenda({
|
|
|
17411
17175
|
}
|
|
17412
17176
|
|
|
17413
17177
|
// src/components/event-calendar-view/WeekView.tsx
|
|
17414
|
-
var
|
|
17415
|
-
var import_date_fns27 = require("date-fns");
|
|
17178
|
+
var import_date_fns25 = require("date-fns");
|
|
17416
17179
|
var import_locale13 = require("date-fns/locale");
|
|
17417
17180
|
var import_react87 = require("react");
|
|
17418
17181
|
|
|
17419
17182
|
// src/components/event-calendar-view/DraggablaEvent.tsx
|
|
17420
17183
|
var import_core6 = require("@dnd-kit/core");
|
|
17421
17184
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
17422
|
-
var
|
|
17185
|
+
var import_date_fns24 = require("date-fns");
|
|
17423
17186
|
var import_react86 = require("react");
|
|
17424
17187
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
17425
17188
|
function DraggableEvent2({
|
|
@@ -17432,14 +17195,15 @@ function DraggableEvent2({
|
|
|
17432
17195
|
multiDayWidth,
|
|
17433
17196
|
isFirstDay = true,
|
|
17434
17197
|
isLastDay = true,
|
|
17435
|
-
"aria-hidden": ariaHidden
|
|
17198
|
+
"aria-hidden": ariaHidden,
|
|
17199
|
+
draggable = true
|
|
17436
17200
|
}) {
|
|
17437
17201
|
const { activeId } = useCalendarDndAgenda();
|
|
17438
17202
|
const elementRef = (0, import_react86.useRef)(null);
|
|
17439
17203
|
const [dragHandlePosition, setDragHandlePosition] = (0, import_react86.useState)(null);
|
|
17440
17204
|
const eventStart = new Date(event.start ?? Date.now());
|
|
17441
17205
|
const eventEnd = new Date(event.end ?? Date.now());
|
|
17442
|
-
const isMultiDayEvent2 = isMultiDay || event.allDay || (0,
|
|
17206
|
+
const isMultiDayEvent2 = isMultiDay || event.allDay || (0, import_date_fns24.differenceInDays)(eventEnd, eventStart) >= 1;
|
|
17443
17207
|
const { attributes, listeners, setNodeRef, transform, isDragging } = (0, import_core6.useDraggable)({
|
|
17444
17208
|
data: {
|
|
17445
17209
|
dragHandlePosition,
|
|
@@ -17451,6 +17215,8 @@ function DraggableEvent2({
|
|
|
17451
17215
|
multiDayWidth,
|
|
17452
17216
|
view
|
|
17453
17217
|
},
|
|
17218
|
+
// allow callers to disable dragging
|
|
17219
|
+
disabled: !draggable,
|
|
17454
17220
|
id: `${event.id}-${view}`
|
|
17455
17221
|
});
|
|
17456
17222
|
const handleMouseDown = (e) => {
|
|
@@ -17528,89 +17294,69 @@ function WeekViewAgenda({
|
|
|
17528
17294
|
currentDate,
|
|
17529
17295
|
events,
|
|
17530
17296
|
onEventSelect,
|
|
17531
|
-
onEventCreate
|
|
17297
|
+
onEventCreate,
|
|
17298
|
+
showUndatedEvents
|
|
17532
17299
|
}) {
|
|
17533
17300
|
const days = (0, import_react87.useMemo)(() => {
|
|
17534
|
-
const weekStart2 = (0,
|
|
17535
|
-
const weekEnd = (0,
|
|
17536
|
-
return (0,
|
|
17301
|
+
const weekStart2 = (0, import_date_fns25.startOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
17302
|
+
const weekEnd = (0, import_date_fns25.endOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
17303
|
+
return (0, import_date_fns25.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
|
|
17537
17304
|
}, [currentDate]);
|
|
17538
17305
|
const weekStart = (0, import_react87.useMemo)(
|
|
17539
|
-
() => (0,
|
|
17306
|
+
() => (0, import_date_fns25.startOfWeek)(currentDate, { weekStartsOn: 0 }),
|
|
17540
17307
|
[currentDate]
|
|
17541
17308
|
);
|
|
17542
17309
|
const hours = (0, import_react87.useMemo)(() => {
|
|
17543
|
-
const dayStart = (0,
|
|
17544
|
-
return (0,
|
|
17545
|
-
end: (0,
|
|
17546
|
-
start: (0,
|
|
17310
|
+
const dayStart = (0, import_date_fns25.startOfDay)(currentDate);
|
|
17311
|
+
return (0, import_date_fns25.eachHourOfInterval)({
|
|
17312
|
+
end: (0, import_date_fns25.addHours)(dayStart, EndHour - 1),
|
|
17313
|
+
start: (0, import_date_fns25.addHours)(dayStart, StartHour)
|
|
17547
17314
|
});
|
|
17548
17315
|
}, [currentDate]);
|
|
17549
17316
|
const allDayEvents = (0, import_react87.useMemo)(() => {
|
|
17550
17317
|
return events.filter((event) => {
|
|
17551
17318
|
return event.allDay || isMultiDayEventAgenda(event);
|
|
17552
17319
|
}).filter((event) => {
|
|
17553
|
-
const eventStart = event.start ? new Date(event.start) : void 0;
|
|
17554
|
-
const eventEnd = event.end ? new Date(event.end) : void 0;
|
|
17320
|
+
const eventStart = event.start ? new Date(event.start) : event.end ? new Date(event.end) : void 0;
|
|
17321
|
+
const eventEnd = event.end ? new Date(event.end) : event.start ? new Date(event.start) : void 0;
|
|
17555
17322
|
return days.some((day) => {
|
|
17556
|
-
if (eventStart && (0,
|
|
17557
|
-
if (eventEnd && (0,
|
|
17558
|
-
if (eventStart && eventEnd && day > eventStart && day < eventEnd)
|
|
17323
|
+
if (eventStart && (0, import_date_fns25.isSameDay)(day, eventStart)) return true;
|
|
17324
|
+
if (eventEnd && (0, import_date_fns25.isSameDay)(day, eventEnd)) return true;
|
|
17325
|
+
if (eventStart && eventEnd && day > eventStart && day < eventEnd)
|
|
17326
|
+
return true;
|
|
17559
17327
|
return false;
|
|
17560
17328
|
});
|
|
17561
17329
|
});
|
|
17562
17330
|
}, [events, days]);
|
|
17563
17331
|
const processedDayEvents = (0, import_react87.useMemo)(() => {
|
|
17564
17332
|
const result = days.map((day) => {
|
|
17565
|
-
const
|
|
17566
|
-
|
|
17567
|
-
|
|
17568
|
-
|
|
17569
|
-
|
|
17570
|
-
const ad = new Date(event.attend_date);
|
|
17571
|
-
const hasTime = ad.getHours() !== 0 || ad.getMinutes() !== 0 || ad.getSeconds() !== 0 || ad.getMilliseconds() !== 0;
|
|
17572
|
-
if (hasTime) {
|
|
17573
|
-
if (!eventStart) eventStart = ad;
|
|
17574
|
-
if (!eventEnd) eventEnd = (0, import_date_fns26.addHours)(ad, 1);
|
|
17575
|
-
}
|
|
17576
|
-
} catch {
|
|
17577
|
-
}
|
|
17578
|
-
}
|
|
17579
|
-
return { event, eventStart, eventEnd };
|
|
17580
|
-
}).filter(({ eventStart, eventEnd }) => !!eventStart && !!eventEnd).filter(({ eventStart, eventEnd }) => {
|
|
17581
|
-
const dayStart2 = (0, import_date_fns26.startOfDay)(day);
|
|
17582
|
-
const dayEnd = (0, import_date_fns27.endOfDay)(day);
|
|
17583
|
-
return (0, import_date_fns26.areIntervalsOverlapping)(
|
|
17584
|
-
{ start: eventStart, end: eventEnd },
|
|
17585
|
-
{ start: dayStart2, end: dayEnd }
|
|
17586
|
-
);
|
|
17333
|
+
const dayEvents = events.filter((event) => {
|
|
17334
|
+
if (event.allDay || isMultiDayEventAgenda(event)) return false;
|
|
17335
|
+
const eventStart = new Date(event.start ?? event.end ?? Date.now());
|
|
17336
|
+
const eventEnd = new Date(event.end ?? event.start ?? Date.now());
|
|
17337
|
+
return (0, import_date_fns25.isSameDay)(day, eventStart) || (0, import_date_fns25.isSameDay)(day, eventEnd) || eventStart < day && eventEnd > day;
|
|
17587
17338
|
});
|
|
17588
|
-
const sortedEvents = [...
|
|
17589
|
-
const aStart = a.
|
|
17590
|
-
const bStart = b.
|
|
17339
|
+
const sortedEvents = [...dayEvents].sort((a, b) => {
|
|
17340
|
+
const aStart = new Date(a.start ?? a.end ?? Date.now());
|
|
17341
|
+
const bStart = new Date(b.start ?? b.end ?? Date.now());
|
|
17342
|
+
const aEnd = new Date(a.end ?? a.start ?? Date.now());
|
|
17343
|
+
const bEnd = new Date(b.end ?? b.start ?? Date.now());
|
|
17591
17344
|
if (aStart < bStart) return -1;
|
|
17592
17345
|
if (aStart > bStart) return 1;
|
|
17593
|
-
const aDuration = (0,
|
|
17594
|
-
|
|
17595
|
-
a.eventStart
|
|
17596
|
-
);
|
|
17597
|
-
const bDuration = (0, import_date_fns26.differenceInMinutes)(
|
|
17598
|
-
b.eventEnd,
|
|
17599
|
-
b.eventStart
|
|
17600
|
-
);
|
|
17346
|
+
const aDuration = (0, import_date_fns25.differenceInMinutes)(aEnd, aStart);
|
|
17347
|
+
const bDuration = (0, import_date_fns25.differenceInMinutes)(bEnd, bStart);
|
|
17601
17348
|
return bDuration - aDuration;
|
|
17602
17349
|
});
|
|
17603
17350
|
const positionedEvents = [];
|
|
17604
|
-
const dayStart = (0,
|
|
17351
|
+
const dayStart = (0, import_date_fns25.startOfDay)(day);
|
|
17605
17352
|
const columns = [];
|
|
17606
|
-
for (const
|
|
17607
|
-
const
|
|
17608
|
-
const
|
|
17609
|
-
const
|
|
17610
|
-
const
|
|
17611
|
-
const
|
|
17612
|
-
const
|
|
17613
|
-
const endHour = (0, import_date_fns26.getHours)(adjustedEnd) + (0, import_date_fns26.getMinutes)(adjustedEnd) / 60;
|
|
17353
|
+
for (const event of sortedEvents) {
|
|
17354
|
+
const eventStart = new Date(event.start ?? event.end ?? Date.now());
|
|
17355
|
+
const eventEnd = new Date(event.end ?? event.start ?? Date.now());
|
|
17356
|
+
const adjustedStart = (0, import_date_fns25.isSameDay)(day, eventStart) ? eventStart : dayStart;
|
|
17357
|
+
const adjustedEnd = (0, import_date_fns25.isSameDay)(day, eventEnd) ? eventEnd : (0, import_date_fns25.addHours)(dayStart, 24);
|
|
17358
|
+
const startHour = (0, import_date_fns25.getHours)(adjustedStart) + (0, import_date_fns25.getMinutes)(adjustedStart) / 60;
|
|
17359
|
+
const endHour = (0, import_date_fns25.getHours)(adjustedEnd) + (0, import_date_fns25.getMinutes)(adjustedEnd) / 60;
|
|
17614
17360
|
const top = (startHour - StartHour) * WeekCellsHeightAgenda;
|
|
17615
17361
|
const height = (endHour - startHour) * WeekCellsHeightAgenda;
|
|
17616
17362
|
let columnIndex = 0;
|
|
@@ -17622,9 +17368,12 @@ function WeekViewAgenda({
|
|
|
17622
17368
|
placed = true;
|
|
17623
17369
|
} else {
|
|
17624
17370
|
const overlaps = col.some(
|
|
17625
|
-
(c) => (0,
|
|
17371
|
+
(c) => (0, import_date_fns25.areIntervalsOverlapping)(
|
|
17626
17372
|
{ end: adjustedEnd, start: adjustedStart },
|
|
17627
|
-
{
|
|
17373
|
+
{
|
|
17374
|
+
end: new Date(c.event.end ?? c.event.start ?? Date.now()),
|
|
17375
|
+
start: new Date(c.event.start ?? c.event.end ?? Date.now())
|
|
17376
|
+
}
|
|
17628
17377
|
)
|
|
17629
17378
|
);
|
|
17630
17379
|
if (!overlaps) {
|
|
@@ -17636,9 +17385,9 @@ function WeekViewAgenda({
|
|
|
17636
17385
|
}
|
|
17637
17386
|
const currentColumn = columns[columnIndex] || [];
|
|
17638
17387
|
columns[columnIndex] = currentColumn;
|
|
17639
|
-
currentColumn.push({
|
|
17640
|
-
const width = columnIndex === 0 ? 1 : 0.
|
|
17641
|
-
const left = columnIndex === 0 ? 0 : columnIndex * 0.
|
|
17388
|
+
currentColumn.push({ end: adjustedEnd, event });
|
|
17389
|
+
const width = columnIndex === 0 ? 1 : 0.9;
|
|
17390
|
+
const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
|
|
17642
17391
|
positionedEvents.push({
|
|
17643
17392
|
event,
|
|
17644
17393
|
height,
|
|
@@ -17646,6 +17395,7 @@ function WeekViewAgenda({
|
|
|
17646
17395
|
top,
|
|
17647
17396
|
width,
|
|
17648
17397
|
zIndex: 10 + columnIndex
|
|
17398
|
+
// Higher columns get higher z-index
|
|
17649
17399
|
});
|
|
17650
17400
|
}
|
|
17651
17401
|
return positionedEvents;
|
|
@@ -17657,50 +17407,47 @@ function WeekViewAgenda({
|
|
|
17657
17407
|
onEventSelect(event);
|
|
17658
17408
|
};
|
|
17659
17409
|
const showAllDaySection = allDayEvents.length > 0;
|
|
17660
|
-
const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(
|
|
17661
|
-
currentDate,
|
|
17662
|
-
"week"
|
|
17663
|
-
);
|
|
17410
|
+
const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(currentDate, "week");
|
|
17664
17411
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "flex h-full flex-col", "data-slot": "week-view", children: [
|
|
17665
17412
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background", children: [
|
|
17666
|
-
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "max-[479px]:sr-only", children: (0,
|
|
17413
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "max-[479px]:sr-only", children: (0, import_date_fns25.format)(/* @__PURE__ */ new Date(), "O") }) }),
|
|
17667
17414
|
days.map((day) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
17668
17415
|
"div",
|
|
17669
17416
|
{
|
|
17670
17417
|
className: "py-2 text-center text-muted-foreground/70 text-sm data-today:font-medium data-today:text-foreground",
|
|
17671
|
-
"data-today": (0,
|
|
17418
|
+
"data-today": (0, import_date_fns25.isToday)(day) || void 0,
|
|
17672
17419
|
children: [
|
|
17673
17420
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { "aria-hidden": "true", className: "sm:hidden", children: [
|
|
17674
|
-
(0,
|
|
17421
|
+
(0, import_date_fns25.format)(day, "EEE", { locale: import_locale13.ptBR })[0],
|
|
17675
17422
|
" ",
|
|
17676
|
-
(0,
|
|
17423
|
+
(0, import_date_fns25.format)(day, "d", { locale: import_locale13.ptBR })
|
|
17677
17424
|
] }),
|
|
17678
|
-
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "max-sm:hidden", children: (0,
|
|
17425
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns25.format)(day, "EEE dd", { locale: import_locale13.ptBR }) })
|
|
17679
17426
|
]
|
|
17680
17427
|
},
|
|
17681
17428
|
day.toString()
|
|
17682
17429
|
))
|
|
17683
17430
|
] }),
|
|
17684
17431
|
showAllDaySection && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "border-border/70 border-b bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "grid grid-cols-8", children: [
|
|
17685
|
-
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "relative border-border/70 border-r", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full pe-2 text-right text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: "
|
|
17432
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "relative border-border/70 border-r", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full pe-2 text-right text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: "Todo Dia" }) }),
|
|
17686
17433
|
days.map((day, dayIndex) => {
|
|
17687
17434
|
const dayAllDayEvents = allDayEvents.filter((event) => {
|
|
17688
17435
|
const eventStart = event.start ? new Date(event.start) : void 0;
|
|
17689
17436
|
const eventEnd = event.end ? new Date(event.end) : void 0;
|
|
17690
17437
|
if (!eventStart && !eventEnd) return false;
|
|
17691
|
-
return eventStart && (0,
|
|
17438
|
+
return eventStart && (0, import_date_fns25.isSameDay)(day, eventStart) || eventStart && eventEnd && day > eventStart && day < eventEnd || eventEnd && (0, import_date_fns25.isSameDay)(day, eventEnd);
|
|
17692
17439
|
});
|
|
17693
17440
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
17694
17441
|
"div",
|
|
17695
17442
|
{
|
|
17696
17443
|
className: "relative border-border/70 border-r p-1 last:border-r-0",
|
|
17697
|
-
"data-today": (0,
|
|
17444
|
+
"data-today": (0, import_date_fns25.isToday)(day) || void 0,
|
|
17698
17445
|
children: dayAllDayEvents.map((event) => {
|
|
17699
17446
|
const eventStart = event.start ? new Date(event.start) : void 0;
|
|
17700
17447
|
const eventEnd = event.end ? new Date(event.end) : void 0;
|
|
17701
|
-
const isFirstDay = eventStart ? (0,
|
|
17702
|
-
const isLastDay = eventEnd ? (0,
|
|
17703
|
-
const isFirstVisibleDay = eventStart ? dayIndex === 0 && (0,
|
|
17448
|
+
const isFirstDay = eventStart ? (0, import_date_fns25.isSameDay)(day, eventStart) : false;
|
|
17449
|
+
const isLastDay = eventEnd ? (0, import_date_fns25.isSameDay)(day, eventEnd) : false;
|
|
17450
|
+
const isFirstVisibleDay = eventStart ? dayIndex === 0 && (0, import_date_fns25.isBefore)(eventStart, weekStart) : false;
|
|
17704
17451
|
const shouldShowTitle = isFirstDay || isFirstVisibleDay;
|
|
17705
17452
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
17706
17453
|
EventItemAgenda,
|
|
@@ -17735,7 +17482,7 @@ function WeekViewAgenda({
|
|
|
17735
17482
|
"div",
|
|
17736
17483
|
{
|
|
17737
17484
|
className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
|
|
17738
|
-
children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0,
|
|
17485
|
+
children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0, import_date_fns25.format)(hour, "HH:mm") })
|
|
17739
17486
|
},
|
|
17740
17487
|
hour.toString()
|
|
17741
17488
|
)) }),
|
|
@@ -17743,7 +17490,7 @@ function WeekViewAgenda({
|
|
|
17743
17490
|
"div",
|
|
17744
17491
|
{
|
|
17745
17492
|
className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
|
|
17746
|
-
"data-today": (0,
|
|
17493
|
+
"data-today": (0, import_date_fns25.isToday)(day) || void 0,
|
|
17747
17494
|
children: [
|
|
17748
17495
|
(processedDayEvents[dayIndex] ?? []).map((positionedEvent) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
17749
17496
|
"div",
|
|
@@ -17763,6 +17510,7 @@ function WeekViewAgenda({
|
|
|
17763
17510
|
event: positionedEvent.event,
|
|
17764
17511
|
height: positionedEvent.height,
|
|
17765
17512
|
onClick: (e) => handleEventClick(positionedEvent.event, e),
|
|
17513
|
+
draggable: false,
|
|
17766
17514
|
showTime: true,
|
|
17767
17515
|
view: "week"
|
|
17768
17516
|
}
|
|
@@ -17770,7 +17518,7 @@ function WeekViewAgenda({
|
|
|
17770
17518
|
},
|
|
17771
17519
|
positionedEvent.event.id
|
|
17772
17520
|
)),
|
|
17773
|
-
currentTimeVisible && (0,
|
|
17521
|
+
currentTimeVisible && (0, import_date_fns25.isToday)(day) && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
17774
17522
|
"div",
|
|
17775
17523
|
{
|
|
17776
17524
|
className: "pointer-events-none absolute right-0 left-0 z-20",
|
|
@@ -17782,7 +17530,7 @@ function WeekViewAgenda({
|
|
|
17782
17530
|
}
|
|
17783
17531
|
),
|
|
17784
17532
|
hours.map((hour) => {
|
|
17785
|
-
const hourValue = (0,
|
|
17533
|
+
const hourValue = (0, import_date_fns25.getHours)(hour);
|
|
17786
17534
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
17787
17535
|
"div",
|
|
17788
17536
|
{
|
|
@@ -17820,7 +17568,15 @@ function WeekViewAgenda({
|
|
|
17820
17568
|
},
|
|
17821
17569
|
day.toString()
|
|
17822
17570
|
))
|
|
17823
|
-
] })
|
|
17571
|
+
] }),
|
|
17572
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
17573
|
+
UndatedEvents,
|
|
17574
|
+
{
|
|
17575
|
+
events,
|
|
17576
|
+
onEventSelect,
|
|
17577
|
+
show: showUndatedEvents
|
|
17578
|
+
}
|
|
17579
|
+
)
|
|
17824
17580
|
] });
|
|
17825
17581
|
}
|
|
17826
17582
|
|