@mlw-packages/react-components 1.9.16 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -696,7 +696,7 @@ var DialogContentBase = React32__namespace.forwardRef(
696
696
  onWheel: userOnWheel,
697
697
  children: [
698
698
  children,
699
- /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-3 top-3 sm:right-4 sm: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 z-10 touch-manipulation", children: [
699
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-3 top-3 sm:right-4 sm:top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-n\n 0 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10 touch-manipulation", children: [
700
700
  /* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { className: "h-6 w-6 sm:h-4 sm:w-4 hover:text-red-500 font-extrabold" }),
701
701
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
702
702
  ] })
@@ -7491,15 +7491,15 @@ function isValid12Hour(value) {
7491
7491
  function isValidMinuteOrSecond(value) {
7492
7492
  return /^[0-5][0-9]$/.test(value);
7493
7493
  }
7494
- function getValidNumber(value, { max, min = 0, loop = false }) {
7494
+ function getValidNumber(value, { max: max2, min: min2 = 0, loop = false }) {
7495
7495
  let numericValue = parseInt(value, 10);
7496
7496
  if (!isNaN(numericValue)) {
7497
7497
  if (!loop) {
7498
- if (numericValue > max) numericValue = max;
7499
- if (numericValue < min) numericValue = min;
7498
+ if (numericValue > max2) numericValue = max2;
7499
+ if (numericValue < min2) numericValue = min2;
7500
7500
  } else {
7501
- if (numericValue > max) numericValue = min;
7502
- if (numericValue < min) numericValue = max;
7501
+ if (numericValue > max2) numericValue = min2;
7502
+ if (numericValue < min2) numericValue = max2;
7503
7503
  }
7504
7504
  return numericValue.toString().padStart(2, "0");
7505
7505
  }
@@ -7517,11 +7517,11 @@ function getValidMinuteOrSecond(value) {
7517
7517
  if (isValidMinuteOrSecond(value)) return value;
7518
7518
  return getValidNumber(value, { max: 59 });
7519
7519
  }
7520
- function getValidArrowNumber(value, { min, max, step }) {
7520
+ function getValidArrowNumber(value, { min: min2, max: max2, step }) {
7521
7521
  let numericValue = parseInt(value, 10);
7522
7522
  if (!isNaN(numericValue)) {
7523
7523
  numericValue += step;
7524
- return getValidNumber(String(numericValue), { min, max, loop: true });
7524
+ return getValidNumber(String(numericValue), { min: min2, max: max2, loop: true });
7525
7525
  }
7526
7526
  return "00";
7527
7527
  }
@@ -7632,19 +7632,19 @@ function visualForItem(item, value) {
7632
7632
  var ITEM_HEIGHT = 38.5;
7633
7633
  var VISIBLE_ITEMS = 5;
7634
7634
  var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
7635
- function getItems(max, step = 1) {
7636
- return Array.from({ length: Math.ceil(max / step) }, (_, i) => i * step);
7635
+ function getItems(max2, step = 1) {
7636
+ return Array.from({ length: Math.ceil(max2 / step) }, (_, i) => i * step);
7637
7637
  }
7638
7638
 
7639
7639
  // src/components/ui/picker/hooks/useScrollColumn.tsx
7640
7640
  function useScrollColumn({
7641
7641
  value,
7642
7642
  onChange,
7643
- max,
7643
+ max: max2,
7644
7644
  step = 1
7645
7645
  }) {
7646
7646
  const containerRef = React32.useRef(null);
7647
- const items = getItems(max, step);
7647
+ const items = getItems(max2, step);
7648
7648
  const scrollTimeoutRef = React32.useRef(null);
7649
7649
  const isScrollingRef = React32.useRef(false);
7650
7650
  const [isDragging, setIsDragging] = React32.useState(false);
@@ -7712,7 +7712,7 @@ function useScrollColumn({
7712
7712
  function ScrollColumn({
7713
7713
  value,
7714
7714
  onChange,
7715
- max,
7715
+ max: max2,
7716
7716
  label,
7717
7717
  step = 1
7718
7718
  }) {
@@ -7727,7 +7727,7 @@ function ScrollColumn({
7727
7727
  handleMouseMove,
7728
7728
  handleMouseUp,
7729
7729
  isDragging
7730
- } = useScrollColumn({ value, onChange, max, step });
7730
+ } = useScrollColumn({ value, onChange, max: max2, step });
7731
7731
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
7732
7732
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground rounded-md font-semibold text-sm text-center pb-2 uppercase tracking-wider", children: label }),
7733
7733
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative w-20"), children: [
@@ -8739,7 +8739,7 @@ function Agenda({
8739
8739
  "span",
8740
8740
  {
8741
8741
  className: tailwindMerge.twMerge(
8742
- "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 data-today:font-extrabold sm:pe-4 text-sm sm:text-md md:text-md font-bold min-w-0",
8742
+ "-top-3 absolute left-0 flex h-6 items-center bg-background pe-2 data-today:font-extrabold sm:pe-4 text-xs sm:text-sm md:text-base font-bold min-w-0",
8743
8743
  dateFns.isToday(day) ? "text-blue-500" : ""
8744
8744
  ),
8745
8745
  "data-today": dateFns.isToday(day) || void 0,
@@ -9022,23 +9022,75 @@ var StartHourAgenda = 0;
9022
9022
  var EndHourAgenda = 24;
9023
9023
  var DefaultStartHourAgenda = 9;
9024
9024
  var DefaultEndHourAgenda = 10;
9025
- function getEventColorClassesAgenda(color) {
9026
- const eventColor = color || "sky";
9025
+ function getAutoColorAgenda(id) {
9026
+ const colors2 = [
9027
+ "sky",
9028
+ "amber",
9029
+ "violet",
9030
+ "rose",
9031
+ "emerald",
9032
+ "orange",
9033
+ "green",
9034
+ "blue",
9035
+ "red",
9036
+ "purple",
9037
+ "indigo",
9038
+ "teal",
9039
+ "pink",
9040
+ "cyan",
9041
+ "lime",
9042
+ "fuchsia"
9043
+ ];
9044
+ let hash = 0;
9045
+ for (let i = 0; i < id.length; i++) {
9046
+ hash = id.charCodeAt(i) + ((hash << 5) - hash);
9047
+ }
9048
+ const index = Math.abs(hash) % colors2.length;
9049
+ return colors2[index];
9050
+ }
9051
+ function getEventColorClassesAgenda(color, eventId) {
9052
+ let eventColor = color;
9053
+ if (!eventColor && eventId) {
9054
+ eventColor = getAutoColorAgenda(eventId);
9055
+ }
9056
+ if (!eventColor) {
9057
+ eventColor = "sky";
9058
+ }
9027
9059
  switch (eventColor) {
9028
9060
  case "sky":
9029
- return "bg-sky-100 hover:bg-sky-200 text-sky-900 border dark:bg-sky-500/30 dark:hover:bg-sky-500/40 dark:text-sky-50 dark:border-sky-400/40 shadow-sky-500/15 hover:shadow-sky-500/25 transition-all duration-200";
9061
+ return "bg-sky-100 hover:bg-sky-200/80 text-sky-900 border border-sky-200/70 dark:bg-sky-500/25 dark:hover:bg-sky-500/35 dark:text-sky-50 dark:border-sky-400/30 transition-colors duration-150";
9030
9062
  case "amber":
9031
- return "bg-amber-100 hover:bg-amber-200 text-amber-900 border dark:bg-amber-500/30 dark:hover:bg-amber-500/40 dark:text-amber-50 dark:border-amber-400/40 shadow-amber-500/15 hover:shadow-amber-500/25 transition-all duration-200";
9063
+ return "bg-amber-100 hover:bg-amber-200/80 text-amber-900 border border-amber-200/70 dark:bg-amber-500/25 dark:hover:bg-amber-500/35 dark:text-amber-50 dark:border-amber-400/30 transition-colors duration-150";
9032
9064
  case "violet":
9033
- return "bg-violet-100 hover:bg-violet-200 text-violet-900 border dark:bg-violet-500/30 dark:hover:bg-violet-500/40 dark:text-violet-50 dark:border-violet-400/40 shadow-violet-500/15 hover:shadow-violet-500/25 transition-all duration-200";
9065
+ return "bg-violet-100 hover:bg-violet-200/80 text-violet-900 border border-violet-200/70 dark:bg-violet-500/25 dark:hover:bg-violet-500/35 dark:text-violet-50 dark:border-violet-400/30 transition-colors duration-150";
9034
9066
  case "rose":
9035
- return "bg-rose-100 hover:bg-rose-200 text-rose-900 border dark:bg-rose-500/30 dark:hover:bg-rose-500/40 dark:text-rose-50 dark:border-rose-400/40 shadow-rose-500/15 hover:shadow-rose-500/25 transition-all duration-200";
9067
+ return "bg-rose-100 hover:bg-rose-200/80 text-rose-900 border border-rose-200/70 dark:bg-rose-500/25 dark:hover:bg-rose-500/35 dark:text-rose-50 dark:border-rose-400/30 transition-colors duration-150";
9036
9068
  case "emerald":
9037
- return "bg-emerald-100 hover:bg-emerald-200 text-emerald-900 border dark:bg-emerald-500/30 dark:hover:bg-emerald-500/40 dark:text-emerald-50 dark:border-emerald-400/40 shadow-emerald-500/15 hover:shadow-emerald-500/25 transition-all duration-200";
9069
+ return "bg-emerald-100 hover:bg-emerald-200/80 text-emerald-900 border border-emerald-200/70 dark:bg-emerald-500/25 dark:hover:bg-emerald-500/35 dark:text-emerald-50 dark:border-emerald-400/30 transition-colors duration-150";
9038
9070
  case "orange":
9039
- return "bg-orange-100 hover:bg-orange-200 text-orange-900 border dark:bg-orange-500/30 dark:hover:bg-orange-500/40 dark:text-orange-50 dark:border-orange-400/40 shadow-orange-500/15 hover:shadow-orange-500/25 transition-all duration-200";
9071
+ return "bg-orange-100 hover:bg-orange-200/80 text-orange-900 border border-orange-200/70 dark:bg-orange-500/25 dark:hover:bg-orange-500/35 dark:text-orange-50 dark:border-orange-400/30 transition-colors duration-150";
9072
+ case "green":
9073
+ return "bg-green-100 hover:bg-green-200/80 text-green-900 border border-green-200/70 dark:bg-green-500/25 dark:hover:bg-green-500/35 dark:text-green-50 dark:border-green-400/30 transition-colors duration-150";
9074
+ case "blue":
9075
+ return "bg-blue-100 hover:bg-blue-200/80 text-blue-900 border border-blue-200/70 dark:bg-blue-500/25 dark:hover:bg-blue-500/35 dark:text-blue-50 dark:border-blue-400/30 transition-colors duration-150";
9076
+ case "red":
9077
+ return "bg-red-100 hover:bg-red-200/80 text-red-900 border border-red-200/70 dark:bg-red-500/25 dark:hover:bg-red-500/35 dark:text-red-50 dark:border-red-400/30 transition-colors duration-150";
9078
+ case "purple":
9079
+ return "bg-purple-100 hover:bg-purple-200/80 text-purple-900 border border-purple-200/70 dark:bg-purple-500/25 dark:hover:bg-purple-500/35 dark:text-purple-50 dark:border-purple-400/30 transition-colors duration-150";
9080
+ case "indigo":
9081
+ return "bg-indigo-100 hover:bg-indigo-200/80 text-indigo-900 border border-indigo-200/70 dark:bg-indigo-500/25 dark:hover:bg-indigo-500/35 dark:text-indigo-50 dark:border-indigo-400/30 transition-colors duration-150";
9082
+ case "teal":
9083
+ return "bg-teal-100 hover:bg-teal-200/80 text-teal-900 border border-teal-200/70 dark:bg-teal-500/25 dark:hover:bg-teal-500/35 dark:text-teal-50 dark:border-teal-400/30 transition-colors duration-150";
9084
+ case "pink":
9085
+ return "bg-pink-100 hover:bg-pink-200/80 text-pink-900 border border-pink-200/70 dark:bg-pink-500/25 dark:hover:bg-pink-500/35 dark:text-pink-50 dark:border-pink-400/30 transition-colors duration-150";
9086
+ case "cyan":
9087
+ return "bg-cyan-100 hover:bg-cyan-200/80 text-cyan-900 border border-cyan-200/70 dark:bg-cyan-500/25 dark:hover:bg-cyan-500/35 dark:text-cyan-50 dark:border-cyan-400/30 transition-colors duration-150";
9088
+ case "lime":
9089
+ return "bg-lime-100 hover:bg-lime-200/80 text-lime-900 border border-lime-200/70 dark:bg-lime-500/25 dark:hover:bg-lime-500/35 dark:text-lime-50 dark:border-lime-400/30 transition-colors duration-150";
9090
+ case "fuchsia":
9091
+ return "bg-fuchsia-100 hover:bg-fuchsia-200/80 text-fuchsia-900 border border-fuchsia-200/70 dark:bg-fuchsia-500/25 dark:hover:bg-fuchsia-500/35 dark:text-fuchsia-50 dark:border-fuchsia-400/30 transition-colors duration-150";
9040
9092
  default:
9041
- return "bg-sky-100 hover:bg-sky-200 text-sky-900 border dark:bg-sky-500/30 dark:hover:bg-sky-500/40 dark:text-sky-50 dark:border-sky-400/40 shadow-sky-500/15 hover:shadow-sky-500/25 transition-all duration-200";
9093
+ return "bg-sky-100 hover:bg-sky-200/80 text-sky-900 border border-sky-200/70 dark:bg-sky-500/25 dark:hover:bg-sky-500/35 dark:text-sky-50 dark:border-sky-400/30 transition-colors duration-150";
9042
9094
  }
9043
9095
  }
9044
9096
  function getBorderRadiusClassesAgenda(isFirstDay, isLastDay) {
@@ -9109,6 +9161,9 @@ function getEventEndDate(event) {
9109
9161
  if (start && typeof event.duration === "number" && !isNaN(event.duration)) {
9110
9162
  return addMinutesToDateAgenda(start, event.duration);
9111
9163
  }
9164
+ if (start && !event.allDay) {
9165
+ return addMinutesToDateAgenda(start, 60);
9166
+ }
9112
9167
  return void 0;
9113
9168
  }
9114
9169
  function isValidDate(d) {
@@ -9145,6 +9200,28 @@ function addMinutesToDateAgenda(date, minutes) {
9145
9200
  function addHoursToDateAgenda(date, hours) {
9146
9201
  return addMinutesToDateAgenda(date, Math.round(hours * 60));
9147
9202
  }
9203
+ function formatDurationAgenda(event) {
9204
+ const start = getEventStartDate(event);
9205
+ const end = getEventEndDate(event);
9206
+ if (!start) return "";
9207
+ const fmt = (d) => dateFns.format(d, "d 'de' MMM", { locale: locale.ptBR });
9208
+ if (!end || dateFns.isSameDay(start, end)) {
9209
+ return fmt(start) + (event.allDay ? " \xB7 Dia todo" : " \xB7 " + dateFns.format(start, "HH:mm"));
9210
+ }
9211
+ const days = dateFns.differenceInCalendarDays(end, start) + 1;
9212
+ return `${fmt(start)} \u2192 ${fmt(end)} \xB7 ${days} dias`;
9213
+ }
9214
+ function formatDurationAgendaDays(event) {
9215
+ const start = getEventStartDate(event);
9216
+ const end = getEventEndDate(event);
9217
+ if (!start) return "";
9218
+ const fmt = (d) => dateFns.format(d, "d 'de' MMM", { locale: locale.ptBR });
9219
+ if (!end || dateFns.isSameDay(start, end)) {
9220
+ return fmt(start) + (event.allDay ? " \xB7 Dia todo" : " \xB7 " + dateFns.format(start, "HH:mm"));
9221
+ }
9222
+ const days = dateFns.differenceInCalendarDays(end, start) + 1;
9223
+ return `${days} dias`;
9224
+ }
9148
9225
  function useCurrentTimeIndicatorAgenda(currentDate, view) {
9149
9226
  const [currentTimePosition, setCurrentTimePosition] = React32.useState(0);
9150
9227
  const [currentTimeVisible, setCurrentTimeVisible] = React32.useState(false);
@@ -9213,12 +9290,12 @@ function EventWrapper({
9213
9290
  return void 0;
9214
9291
  })();
9215
9292
  const isEventInPast = displayEnd ? dateFns.isPast(displayEnd) : false;
9216
- 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 ";
9293
+ const colorClasses = hasValidTimeForWrapper ? getEventColorClassesAgenda(event.color, event.id) : "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 ";
9217
9294
  return /* @__PURE__ */ jsxRuntime.jsx(
9218
9295
  "button",
9219
9296
  {
9220
9297
  className: cn(
9221
- "flex w-full select-none 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 ",
9298
+ "flex w-full select-none text-left font-medium outline-none transition-colors 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 rounded-lg border",
9222
9299
  className?.includes("overflow-visible") ? "" : "overflow-hidden",
9223
9300
  colorClasses,
9224
9301
  getBorderRadiusClassesAgenda(isFirstDay, isLastDay),
@@ -9251,13 +9328,14 @@ function EventItemAgenda({
9251
9328
  dndAttributes,
9252
9329
  onMouseDown,
9253
9330
  onTouchStart,
9254
- agendaOnly = false
9331
+ agendaOnly = false,
9332
+ totalCols = 1
9255
9333
  }) {
9256
9334
  const eventColor = event.color;
9257
9335
  const startDate = getEventStartDate(event);
9258
9336
  const endDate = getEventEndDate(event);
9259
9337
  const hasValidTime = !!startDate || !!endDate;
9260
- 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";
9338
+ const colorClasses = hasValidTime ? getEventColorClassesAgenda(eventColor, event.id) : "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";
9261
9339
  const displayStart = React32.useMemo(() => {
9262
9340
  if (!hasValidTime) return void 0;
9263
9341
  if (startDate) return currentTime || startDate;
@@ -9309,7 +9387,7 @@ function EventItemAgenda({
9309
9387
  EventWrapper,
9310
9388
  {
9311
9389
  className: cn(
9312
- "mt-[var(--event-gap)] h-[var(--event-height)] items-center sm:text-xs",
9390
+ "mt-[var(--event-gap)] h-[var(--event-height)] items-center px-1.5 sm:px-3 py-1 sm:text-xs",
9313
9391
  className
9314
9392
  ),
9315
9393
  currentTime,
@@ -9337,13 +9415,58 @@ function EventItemAgenda({
9337
9415
  );
9338
9416
  }
9339
9417
  if (view === "week" || view === "day") {
9418
+ const isCompact = durationMinutes < 45;
9419
+ const isDay = view === "day";
9420
+ const tier = isDay ? 1 : totalCols >= 5 ? 3 : totalCols >= 3 ? 2 : 1;
9421
+ if (tier === 3) {
9422
+ return /* @__PURE__ */ jsxRuntime.jsx(
9423
+ "button",
9424
+ {
9425
+ type: "button",
9426
+ className: cn(
9427
+ "h-full w-full rounded border overflow-hidden cursor-pointer",
9428
+ colorClasses,
9429
+ className
9430
+ ),
9431
+ onClick,
9432
+ onMouseDown,
9433
+ onTouchStart,
9434
+ "aria-label": ariaLabel,
9435
+ ...dndListeners,
9436
+ ...dndAttributes
9437
+ }
9438
+ );
9439
+ }
9440
+ if (tier === 2) {
9441
+ return /* @__PURE__ */ jsxRuntime.jsx(
9442
+ EventWrapper,
9443
+ {
9444
+ className: cn(
9445
+ "h-full px-1 py-0.5 overflow-hidden text-[9px]",
9446
+ isCompact ? "flex-row items-center" : "flex-col items-start",
9447
+ className
9448
+ ),
9449
+ currentTime,
9450
+ dndAttributes,
9451
+ dndListeners,
9452
+ event,
9453
+ ariaLabel,
9454
+ isFirstDay,
9455
+ isLastDay,
9456
+ onClick,
9457
+ onMouseDown,
9458
+ onTouchStart,
9459
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold leading-none truncate w-full block", children: event.title })
9460
+ }
9461
+ );
9462
+ }
9340
9463
  return /* @__PURE__ */ jsxRuntime.jsx(
9341
9464
  EventWrapper,
9342
9465
  {
9343
9466
  className: cn(
9344
- "py-1",
9345
- durationMinutes < 45 ? "items-center" : "flex-col",
9346
- view === "week" ? "text-[10px] sm:text-xs" : "text-xs",
9467
+ "h-full py-0.5 px-1.5 overflow-hidden",
9468
+ isCompact ? "items-center flex-row" : "flex-col items-start",
9469
+ isDay ? "text-xs" : "text-[10px]",
9347
9470
  className
9348
9471
  ),
9349
9472
  currentTime,
@@ -9354,26 +9477,14 @@ function EventItemAgenda({
9354
9477
  isFirstDay,
9355
9478
  isLastDay,
9356
9479
  onClick,
9357
- children: durationMinutes < 45 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full", children: [
9358
- /* @__PURE__ */ jsxRuntime.jsx(
9359
- "div",
9360
- {
9361
- className: cn("truncate text-sm sm:text-base md:text-lg min-w-0"),
9362
- children: event.title
9363
- }
9364
- ),
9365
- showTime && hasValidTime && displayStart && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 flex items-center gap-3 bg-white/10 py-0.5 rounded-full opacity-90 text-sm sm:text-base md:text-lg min-w-0", children: formatTimeWithOptionalMinutes(displayStart) })
9366
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9367
- /* @__PURE__ */ jsxRuntime.jsx(
9368
- "div",
9369
- {
9370
- className: cn(
9371
- "truncate font-medium text-sm sm:text-base md:text-lg min-w-0"
9372
- ),
9373
- children: event.title
9374
- }
9375
- ),
9376
- showTime && hasValidTime && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-normal opacity-70 text-sm sm:text-base", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block bg-white/5 px-0.5 py-0.5 rounded-full", children: getEventTime() }) })
9480
+ onMouseDown,
9481
+ onTouchStart,
9482
+ children: isCompact ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 w-full min-w-0 overflow-hidden", children: [
9483
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-semibold leading-none min-w-0", children: event.title }),
9484
+ showTime && hasValidTime && displayStart && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 opacity-75 leading-none", children: formatTimeWithOptionalMinutes(displayStart) })
9485
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5 w-full min-w-0 overflow-hidden h-full", children: [
9486
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold leading-snug truncate", children: event.title }),
9487
+ showTime && hasValidTime && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "opacity-75 leading-none truncate", children: getEventTime() })
9377
9488
  ] })
9378
9489
  }
9379
9490
  );
@@ -9384,7 +9495,7 @@ function EventItemAgenda({
9384
9495
  {
9385
9496
  className: cn(
9386
9497
  "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-past-event:line-through data-past-event:opacity-90 border-2 border-border",
9387
- getEventColorClassesAgenda(eventColor),
9498
+ getEventColorClassesAgenda(eventColor, event.id),
9388
9499
  className
9389
9500
  ),
9390
9501
  "aria-label": ariaLabel,
@@ -9545,7 +9656,6 @@ function DayViewAgenda({
9545
9656
  });
9546
9657
  }, [dayEvents]);
9547
9658
  const positionedEvents = React32.useMemo(() => {
9548
- const result = [];
9549
9659
  const dayStart = dateFns.startOfDay(currentDate);
9550
9660
  const sortedEvents = [...timeEvents].sort((a, b) => {
9551
9661
  const aStart = getEventStartDate(a) ?? getEventEndDate(a) ?? /* @__PURE__ */ new Date();
@@ -9559,57 +9669,69 @@ function DayViewAgenda({
9559
9669
  return bDuration - aDuration;
9560
9670
  });
9561
9671
  const columns = [];
9672
+ const layouts = [];
9562
9673
  for (const event of sortedEvents) {
9563
9674
  const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
9564
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
9675
+ const rawEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
9676
+ const eventEnd = rawEnd <= eventStart ? new Date(eventStart.getTime() + 30 * 60 * 1e3) : rawEnd;
9565
9677
  const adjustedStart = dateFns.isSameDay(currentDate, eventStart) ? eventStart : dayStart;
9566
9678
  const adjustedEnd = dateFns.isSameDay(currentDate, eventEnd) ? eventEnd : dateFns.addHours(dayStart, 24);
9567
9679
  const startHour = dateFns.getHours(adjustedStart) + dateFns.getMinutes(adjustedStart) / 60;
9568
9680
  const endHour = dateFns.getHours(adjustedEnd) + dateFns.getMinutes(adjustedEnd) / 60;
9569
9681
  const top = (startHour - StartHourAgenda) * WeekCellsHeightAgenda;
9570
- const height = (endHour - startHour) * WeekCellsHeightAgenda;
9571
- let columnIndex = 0;
9572
- let placed = false;
9573
- while (!placed) {
9574
- const col = columns[columnIndex] || [];
9575
- if (col.length === 0) {
9576
- columns[columnIndex] = col;
9577
- placed = true;
9578
- } else {
9579
- const overlaps = col.some((c) => {
9580
- const cStart = getEventStartDate(c.event) ?? getEventEndDate(c.event) ?? /* @__PURE__ */ new Date();
9581
- const cEnd = getEventEndDate(c.event) ?? getEventStartDate(c.event) ?? /* @__PURE__ */ new Date();
9582
- return dateFns.areIntervalsOverlapping(
9583
- { end: adjustedEnd, start: adjustedStart },
9584
- { end: cEnd, start: cStart }
9585
- );
9586
- });
9587
- if (!overlaps) {
9588
- placed = true;
9589
- } else {
9590
- columnIndex++;
9591
- }
9592
- }
9682
+ const height = Math.max(
9683
+ (endHour - startHour) * WeekCellsHeightAgenda,
9684
+ 24
9685
+ );
9686
+ let col = 0;
9687
+ while (true) {
9688
+ const colSlots = columns[col] ?? [];
9689
+ const hasConflict = colSlots.some(
9690
+ (slot) => dateFns.areIntervalsOverlapping(
9691
+ { start: adjustedStart, end: adjustedEnd },
9692
+ { start: slot.start, end: slot.end },
9693
+ { inclusive: false }
9694
+ )
9695
+ );
9696
+ if (!hasConflict) break;
9697
+ col++;
9593
9698
  }
9594
- const currentColumn = columns[columnIndex] || [];
9595
- columns[columnIndex] = currentColumn;
9596
- currentColumn.push({
9597
- end: adjustedEnd,
9598
- event,
9599
- start: adjustedStart
9600
- });
9601
- const width = columnIndex === 0 ? 1 : 0.9;
9602
- const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
9603
- result.push({
9699
+ if (!columns[col]) columns[col] = [];
9700
+ columns[col].push({ start: adjustedStart, end: adjustedEnd });
9701
+ layouts.push({
9604
9702
  event,
9605
- height,
9606
- left,
9703
+ adjustedStart,
9704
+ adjustedEnd,
9607
9705
  top,
9608
- width,
9609
- zIndex: 10 + columnIndex
9706
+ height,
9707
+ col,
9708
+ totalCols: 0
9610
9709
  });
9611
9710
  }
9612
- return result;
9711
+ for (const layout of layouts) {
9712
+ let maxCol = layout.col;
9713
+ for (const other of layouts) {
9714
+ if (other === layout) continue;
9715
+ if (dateFns.areIntervalsOverlapping(
9716
+ { start: layout.adjustedStart, end: layout.adjustedEnd },
9717
+ { start: other.adjustedStart, end: other.adjustedEnd },
9718
+ { inclusive: false }
9719
+ )) {
9720
+ maxCol = Math.max(maxCol, other.col);
9721
+ }
9722
+ }
9723
+ layout.totalCols = maxCol + 1;
9724
+ }
9725
+ return layouts.map(
9726
+ ({ event, top, height, col, totalCols }) => ({
9727
+ event,
9728
+ top,
9729
+ height,
9730
+ left: col / totalCols,
9731
+ width: 1 / totalCols,
9732
+ zIndex: 10 + col
9733
+ })
9734
+ );
9613
9735
  }, [currentDate, timeEvents]);
9614
9736
  const handleEventClick = (event, e) => {
9615
9737
  e.stopPropagation();
@@ -9626,14 +9748,31 @@ function DayViewAgenda({
9626
9748
  const isFirstDay = eventStart ? dateFns.isSameDay(currentDate, eventStart) : false;
9627
9749
  const isLastDay = eventEnd ? dateFns.isSameDay(currentDate, eventEnd) : false;
9628
9750
  return /* @__PURE__ */ jsxRuntime.jsx(
9629
- EventItemAgenda,
9751
+ TooltipProviderBase,
9630
9752
  {
9631
- event,
9632
- isFirstDay,
9633
- isLastDay,
9634
- onClick: (e) => handleEventClick(event, e),
9635
- view: "month",
9636
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: event.title })
9753
+ delayDuration: 400,
9754
+ children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
9755
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
9756
+ EventItemAgenda,
9757
+ {
9758
+ event,
9759
+ isFirstDay,
9760
+ isLastDay,
9761
+ onClick: (e) => handleEventClick(event, e),
9762
+ view: "month",
9763
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: event.title })
9764
+ }
9765
+ ) }) }),
9766
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", children: [
9767
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold truncate max-w-[200px]", children: event.title }),
9768
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "opacity-80 mt-0.5 leading-snug", children: formatDurationAgenda(event) }),
9769
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "opacity-60 mt-0.5 truncate text-[11px] max-w-[200px] flex items-center gap-1", children: [
9770
+ /* @__PURE__ */ jsxRuntime.jsx(react.MapPinIcon, { size: 14 }),
9771
+ " ",
9772
+ event.location
9773
+ ] })
9774
+ ] })
9775
+ ] })
9637
9776
  },
9638
9777
  `spanning-${event.id}`
9639
9778
  );
@@ -9644,7 +9783,7 @@ function DayViewAgenda({
9644
9783
  "div",
9645
9784
  {
9646
9785
  className: "relative h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
9647
- children: index > 0 && /* @__PURE__ */ jsxRuntime.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: dateFns.format(hour, "HH:mm") })
9786
+ children: index > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-1 sm:pe-4 text-[9px] sm:text-xs text-muted-foreground/70", children: dateFns.format(hour, "HH:mm") })
9648
9787
  },
9649
9788
  hour.toString()
9650
9789
  )) }),
@@ -9666,17 +9805,37 @@ function DayViewAgenda({
9666
9805
  width: `${positionedEvent.width * 100}%`,
9667
9806
  zIndex: positionedEvent.zIndex
9668
9807
  },
9669
- children: /* @__PURE__ */ jsxRuntime.jsx(
9670
- EventItemAgenda,
9671
- {
9672
- event: evt,
9673
- view: "day",
9674
- isFirstDay,
9675
- isLastDay,
9676
- onClick: (e) => handleEventClick(evt, e),
9677
- showTime: true
9678
- }
9679
- )
9808
+ children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
9809
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full", children: /* @__PURE__ */ jsxRuntime.jsx(
9810
+ EventItemAgenda,
9811
+ {
9812
+ event: evt,
9813
+ view: "day",
9814
+ isFirstDay,
9815
+ isLastDay,
9816
+ onClick: (e) => handleEventClick(evt, e),
9817
+ showTime: true
9818
+ }
9819
+ ) }) }),
9820
+ /* @__PURE__ */ jsxRuntime.jsxs(
9821
+ TooltipContentBase,
9822
+ {
9823
+ side: "top",
9824
+ sideOffset: 6,
9825
+ className: "max-w-[220px] space-y-0.5",
9826
+ children: [
9827
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm leading-snug", children: evt.title }),
9828
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-90", children: formatDurationAgenda(evt) }),
9829
+ evt.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs flex items-center gap-2", children: [
9830
+ /* @__PURE__ */ jsxRuntime.jsx(react.MapPinIcon, { size: 15 }),
9831
+ " ",
9832
+ evt.location
9833
+ ] }),
9834
+ evt.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-75 line-clamp-2", children: evt.description })
9835
+ ]
9836
+ }
9837
+ )
9838
+ ] }) })
9680
9839
  },
9681
9840
  positionedEvent.event.id
9682
9841
  );
@@ -10033,25 +10192,25 @@ function EventAgenda({
10033
10192
  return condensed ? entry.short : entry.full;
10034
10193
  };
10035
10194
  const viewTitle = React32.useMemo(() => {
10036
- const capitalize = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
10195
+ const capitalize2 = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
10037
10196
  if (view === "month")
10038
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10197
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10039
10198
  if (view === "week") {
10040
10199
  const start = dateFns.startOfWeek(currentDate, { weekStartsOn: 1 });
10041
10200
  const end = dateFns.endOfWeek(currentDate, { weekStartsOn: 1 });
10042
10201
  if (dateFns.isSameMonth(start, end))
10043
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10044
- const s1 = capitalize(dateFns.format(start, "MMM", { locale: locale.ptBR }));
10045
- const s2 = capitalize(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
10202
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10203
+ const s1 = capitalize2(dateFns.format(start, "MMM", { locale: locale.ptBR }));
10204
+ const s2 = capitalize2(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
10046
10205
  return `${s1} - ${s2}`;
10047
10206
  }
10048
10207
  if (view === "day")
10049
10208
  return dateFns.format(currentDate, "d 'de' MMMM 'de' yyyy", { locale: locale.ptBR });
10050
10209
  if (view === "agenda") {
10051
10210
  const start = currentDate;
10052
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10211
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10053
10212
  }
10054
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10213
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10055
10214
  }, [currentDate, view]);
10056
10215
  const selectItems = ["month", "week", "day", "agenda"].map((v) => ({
10057
10216
  label: viewLabel(v),
@@ -10238,6 +10397,151 @@ function useEventVisibilityAgenda({
10238
10397
  getVisibleEventCount
10239
10398
  };
10240
10399
  }
10400
+ function clampToWeek(date, weekStart, weekEnd) {
10401
+ return dateFns.max([dateFns.min([date, weekEnd]), weekStart]);
10402
+ }
10403
+ function dayCol(date, weekStart) {
10404
+ const diff = Math.round(
10405
+ (date.getTime() - weekStart.getTime()) / (1e3 * 60 * 60 * 24)
10406
+ );
10407
+ return Math.max(0, Math.min(6, diff));
10408
+ }
10409
+ function computeMultiDayBars(events, weekDays) {
10410
+ const weekStart = weekDays[0];
10411
+ const weekEnd = weekDays[6];
10412
+ const multiDayEvents = events.filter((ev) => {
10413
+ if (!isMultiDayEventAgenda(ev)) return false;
10414
+ const start = getEventStartDate(ev);
10415
+ const end = getEventEndDate(ev) ?? start;
10416
+ if (!start || !end) return false;
10417
+ return start <= weekEnd && end >= weekStart;
10418
+ });
10419
+ const sorted = [...multiDayEvents].sort((a, b) => {
10420
+ const aS = getEventStartDate(a) ?? /* @__PURE__ */ new Date(0);
10421
+ const bS = getEventStartDate(b) ?? /* @__PURE__ */ new Date(0);
10422
+ const aE = getEventEndDate(a) ?? aS;
10423
+ const bE = getEventEndDate(b) ?? bS;
10424
+ const diff = bE.getTime() - bS.getTime() - (aE.getTime() - aS.getTime());
10425
+ return diff !== 0 ? diff : aS.getTime() - bS.getTime();
10426
+ });
10427
+ const slotOccupancy = [];
10428
+ const bars = [];
10429
+ for (const event of sorted) {
10430
+ const evStart = getEventStartDate(event);
10431
+ const evEnd = getEventEndDate(event) ?? evStart;
10432
+ const cStart = clampToWeek(evStart, weekStart, weekEnd);
10433
+ const cEnd = clampToWeek(evEnd, weekStart, weekEnd);
10434
+ const sc = dayCol(cStart, weekStart);
10435
+ const ec = dayCol(cEnd, weekStart);
10436
+ let slot = 0;
10437
+ for (; ; ) {
10438
+ if (!slotOccupancy[slot]) slotOccupancy[slot] = Array(7).fill(false);
10439
+ let free = true;
10440
+ for (let c = sc; c <= ec; c++) {
10441
+ if (slotOccupancy[slot][c]) {
10442
+ free = false;
10443
+ break;
10444
+ }
10445
+ }
10446
+ if (free) {
10447
+ for (let c = sc; c <= ec; c++) slotOccupancy[slot][c] = true;
10448
+ break;
10449
+ }
10450
+ slot++;
10451
+ }
10452
+ bars.push({
10453
+ event,
10454
+ colStart: sc,
10455
+ colSpan: ec - sc + 1,
10456
+ isFirstDay: dateFns.isSameDay(cStart, evStart),
10457
+ isLastDay: dateFns.isSameDay(cEnd, evEnd),
10458
+ slot
10459
+ });
10460
+ }
10461
+ return bars;
10462
+ }
10463
+ function MultiDayOverlay({
10464
+ bars,
10465
+ weekIndex,
10466
+ hoveredEventId,
10467
+ onHover,
10468
+ onEventSelect
10469
+ }) {
10470
+ if (bars.length === 0) return null;
10471
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 pointer-events-none mt-1", children: bars.map((bar) => {
10472
+ const { event, colStart, colSpan, isFirstDay, isLastDay, slot } = bar;
10473
+ const isHovered = hoveredEventId === event.id;
10474
+ const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10475
+ const continuesFromPrev = !isFirstDay;
10476
+ const continuesToNext = !isLastDay;
10477
+ return /* @__PURE__ */ jsxRuntime.jsx(
10478
+ TooltipProviderBase,
10479
+ {
10480
+ delayDuration: 400,
10481
+ children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
10482
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
10483
+ "div",
10484
+ {
10485
+ className: "absolute pointer-events-auto px-[5px]",
10486
+ style: {
10487
+ left: continuesFromPrev ? `${colStart / 7 * 100}%` : `calc(${colStart / 7 * 100}% + 3px)`,
10488
+ right: continuesToNext ? `${100 - (colStart + colSpan) / 7 * 100}%` : `calc(${100 - (colStart + colSpan) / 7 * 100}% + 3px)`,
10489
+ top: `calc(34px + ${slot} * (var(--event-height) + var(--event-gap)) + var(--event-gap))`,
10490
+ zIndex: isHovered ? 10 : 1
10491
+ },
10492
+ onMouseEnter: () => onHover(event.id),
10493
+ onMouseLeave: () => onHover(null),
10494
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10495
+ EventItemAgenda,
10496
+ {
10497
+ event,
10498
+ isFirstDay,
10499
+ isLastDay,
10500
+ onClick: (e) => {
10501
+ e.stopPropagation();
10502
+ onEventSelect(event, e);
10503
+ },
10504
+ view: "month",
10505
+ className: cn(
10506
+ "w-full",
10507
+ isHovered && "[filter:brightness(0.92)]"
10508
+ ),
10509
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-0.5 w-full min-w-0", children: [
10510
+ continuesFromPrev && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 opacity-50 leading-none mr-0.5 flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretLeftIcon, { size: 10, weight: "bold" }) }),
10511
+ !event.allDay && isFirstDay && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 font-normal opacity-75 text-[10px] bg-white/15 px-1 py-0.5 rounded-full leading-none", children: dateFns.format(eventStart, "HH:mm") }),
10512
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-[11px] sm:text-xs truncate min-w-0 leading-none flex-1", children: event.title }),
10513
+ isFirstDay && (() => {
10514
+ const evStart = getEventStartDate(event);
10515
+ const evEnd = getEventEndDate(event);
10516
+ if (!evStart || !evEnd) return null;
10517
+ const totalDays = dateFns.differenceInCalendarDays(evEnd, evStart) + 1;
10518
+ if (totalDays < 2) return null;
10519
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "shrink-0 font-bold leading-none text-[10px] opacity-55 ml-0.5", children: [
10520
+ totalDays,
10521
+ "d"
10522
+ ] });
10523
+ })(),
10524
+ continuesToNext && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 opacity-50 leading-none ml-0.5 flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretRightIcon, { size: 10, weight: "bold" }) })
10525
+ ] })
10526
+ }
10527
+ )
10528
+ }
10529
+ ) }),
10530
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", children: [
10531
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold truncate max-w-[200px]", children: event.title }),
10532
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "opacity-80 mt-0.5 leading-snug", children: formatDurationAgenda(event) }),
10533
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "opacity-60 mt-0.5 truncate text-[11px] max-w-[200px]", children: [
10534
+ /* @__PURE__ */ jsxRuntime.jsx(react.MapPinIcon, { size: 15 }),
10535
+ " ",
10536
+ event.location
10537
+ ] })
10538
+ ] })
10539
+ ] })
10540
+ },
10541
+ `bar-${event.id}-w${weekIndex}`
10542
+ );
10543
+ }) });
10544
+ }
10241
10545
  function MonthViewAgenda({
10242
10546
  currentDate,
10243
10547
  events,
@@ -10251,13 +10555,14 @@ function MonthViewAgenda({
10251
10555
  const calendarEnd = dateFns.endOfWeek(monthEnd, { weekStartsOn: 0 });
10252
10556
  return dateFns.eachDayOfInterval({ end: calendarEnd, start: calendarStart });
10253
10557
  }, [currentDate]);
10254
- const weekdays = React32.useMemo(() => {
10255
- return Array.from({ length: 7 }).map((_, i) => {
10558
+ const weekdays = React32.useMemo(
10559
+ () => Array.from({ length: 7 }).map((_, i) => {
10256
10560
  const date = dateFns.addDays(dateFns.startOfWeek(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
10257
10561
  const short = dateFns.format(date, "EEE", { locale: locale.ptBR });
10258
10562
  return short.charAt(0).toUpperCase() + short.slice(1);
10259
- });
10260
- }, []);
10563
+ }),
10564
+ []
10565
+ );
10261
10566
  const weeks = React32.useMemo(() => {
10262
10567
  const result = [];
10263
10568
  let week = [];
@@ -10270,11 +10575,24 @@ function MonthViewAgenda({
10270
10575
  }
10271
10576
  return result;
10272
10577
  }, [days]);
10273
- const handleEventClick = (event, e) => {
10274
- e.stopPropagation();
10275
- onEventSelect(event, e);
10276
- };
10578
+ const todayColIndex = React32.useMemo(() => (/* @__PURE__ */ new Date()).getDay(), []);
10277
10579
  const [isMounted, setIsMounted] = React32.useState(false);
10580
+ const [hoveredEventId, setHoveredEventId] = React32.useState(null);
10581
+ const hoverLeaveTimerRef = React32.useRef(null);
10582
+ const handleHover = React32.useCallback((id) => {
10583
+ if (id !== null) {
10584
+ if (hoverLeaveTimerRef.current) {
10585
+ clearTimeout(hoverLeaveTimerRef.current);
10586
+ hoverLeaveTimerRef.current = null;
10587
+ }
10588
+ setHoveredEventId(id);
10589
+ } else {
10590
+ hoverLeaveTimerRef.current = setTimeout(() => {
10591
+ setHoveredEventId(null);
10592
+ hoverLeaveTimerRef.current = null;
10593
+ }, 150);
10594
+ }
10595
+ }, []);
10278
10596
  const { contentRef, getVisibleEventCount } = useEventVisibilityAgenda({
10279
10597
  eventGap: EventGapAgenda,
10280
10598
  eventHeight: EventHeightAgenda
@@ -10282,202 +10600,232 @@ function MonthViewAgenda({
10282
10600
  React32.useEffect(() => {
10283
10601
  setIsMounted(true);
10284
10602
  }, []);
10603
+ const eventsWithStart = React32.useMemo(
10604
+ () => events.filter((ev) => {
10605
+ try {
10606
+ if (ev.start == null) return false;
10607
+ const t = ev.start instanceof Date ? ev.start.getTime() : new Date(String(ev.start)).getTime();
10608
+ return !isNaN(t);
10609
+ } catch {
10610
+ return false;
10611
+ }
10612
+ }),
10613
+ [events]
10614
+ );
10615
+ const handleEventClick = (event, e) => {
10616
+ e.stopPropagation();
10617
+ onEventSelect(event, e);
10618
+ };
10285
10619
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "contents", "data-slot": "month-view", children: [
10286
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 border-border/70 border-b", children: weekdays.map((day) => /* @__PURE__ */ jsxRuntime.jsxs(
10287
- "div",
10288
- {
10289
- className: "py-1 px-1 text-center text-muted-foreground/70 text-xs uppercase sm:tracking-wide bg-muted/5 leading-none",
10290
- children: [
10291
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: day }),
10292
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline sm:hidden", children: day.charAt(0) })
10293
- ]
10294
- },
10295
- day
10296
- )) }),
10297
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid flex-1 auto-rows-fr", children: weeks.map((week, weekIndex) => /* @__PURE__ */ jsxRuntime.jsx(
10298
- "div",
10299
- {
10300
- className: "grid grid-cols-7 [&:last-child>*]:border-b-0",
10301
- children: week.map((day, dayIndex) => {
10302
- if (!day) return null;
10303
- const eventsWithStart = events.filter((ev) => {
10304
- try {
10305
- if (ev.start == null) return false;
10306
- const t = ev.start instanceof Date ? ev.start.getTime() : new Date(String(ev.start)).getTime();
10307
- return !isNaN(t);
10308
- } catch {
10309
- return false;
10310
- }
10311
- });
10312
- const dayEvents = getEventsForDayAgenda(eventsWithStart, day);
10313
- const spanningEvents = getSpanningEventsForDayAgenda(
10314
- eventsWithStart,
10315
- day
10316
- );
10317
- const isCurrentMonth = dateFns.isSameMonth(day, currentDate);
10318
- const cellId = `month-cell-${day.toISOString()}`;
10319
- const allDayEvents = [...spanningEvents, ...dayEvents];
10320
- const allEvents = getAllEventsForDayAgenda(events, day);
10321
- const isReferenceCell = weekIndex === 0 && dayIndex === 0;
10322
- const visibleCount = isMounted ? getVisibleEventCount(allDayEvents.length) : void 0;
10323
- const hasMore = visibleCount !== void 0 && allDayEvents.length > visibleCount;
10324
- const remainingCount = hasMore ? allDayEvents.length - visibleCount : 0;
10325
- return /* @__PURE__ */ jsxRuntime.jsx(
10326
- "div",
10327
- {
10328
- 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-1 sm:p-2",
10329
- "data-outside-cell": !isCurrentMonth || void 0,
10330
- "data-today": dateFns.isToday(day) || void 0,
10331
- children: /* @__PURE__ */ jsxRuntime.jsxs(
10332
- DroppableCellAgenda,
10333
- {
10334
- date: day,
10335
- id: cellId,
10336
- onClick: () => {
10337
- const startTime = new Date(day);
10338
- startTime.setHours(DefaultStartHourAgenda, 0, 0);
10339
- },
10340
- children: [
10341
- /* @__PURE__ */ jsxRuntime.jsx(
10342
- "div",
10343
- {
10344
- className: tailwindMerge.twMerge(
10345
- `mt-1 inline-flex w-6 h-6 sm:w-7 sm:h-7 items-center justify-center border rounded-md text-xs sm:text-sm font-semibold text-muted-foreground`,
10346
- dateFns.isToday(day) ? "bg-blue-500 text-white" : ""
10347
- ),
10348
- children: dateFns.format(day, "d")
10349
- }
10350
- ),
10351
- /* @__PURE__ */ jsxRuntime.jsxs(
10352
- "div",
10353
- {
10354
- className: "min-h-[calc((var(--event-height)+var(--event-gap))*2)] sm:min-h-[calc((var(--event-height)+var(--event-gap))*3)] lg:min-h-[calc((var(--event-height)+var(--event-gap))*4)] px-1 py-0.5 sm:py-1",
10355
- ref: isReferenceCell ? contentRef : null,
10356
- children: [
10357
- sortEventsAgenda(allDayEvents).map((event, index) => {
10358
- const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10359
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10360
- const isFirstDay = dateFns.isSameDay(day, eventStart);
10361
- const isLastDay = dateFns.isSameDay(day, eventEnd);
10362
- const isHidden = isMounted && visibleCount && index >= visibleCount;
10363
- if (!visibleCount) return null;
10364
- if (!isFirstDay) {
10365
- return /* @__PURE__ */ jsxRuntime.jsx(
10366
- "div",
10367
- {
10368
- "aria-hidden": isHidden ? "true" : void 0,
10369
- className: "aria-hidden:hidden",
10370
- children: /* @__PURE__ */ jsxRuntime.jsx(
10620
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 border-border/70 border-b", children: weekdays.map((day, i) => {
10621
+ const isTodayCol = i === todayColIndex;
10622
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10623
+ "div",
10624
+ {
10625
+ className: cn(
10626
+ "py-1.5 px-1 text-center text-xs uppercase sm:tracking-wide leading-none transition-colors",
10627
+ isTodayCol ? "bg-blue-50 dark:bg-blue-950/30 text-blue-600 dark:text-blue-400 font-bold" : "bg-muted/5 text-muted-foreground/70"
10628
+ ),
10629
+ children: [
10630
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: day }),
10631
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline sm:hidden", children: day.charAt(0) })
10632
+ ]
10633
+ },
10634
+ day
10635
+ );
10636
+ }) }),
10637
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid flex-1 auto-rows-fr", children: weeks.map((week, weekIndex) => {
10638
+ const multiDayBars = computeMultiDayBars(eventsWithStart, week);
10639
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10640
+ "div",
10641
+ {
10642
+ className: "grid grid-cols-7 [&:last-child>*]:border-b-0 relative p-0",
10643
+ children: [
10644
+ week.map((day, dayIndex) => {
10645
+ if (!day) return null;
10646
+ const isTodayCell = dateFns.isToday(day);
10647
+ const isTodayCol = dayIndex === todayColIndex;
10648
+ const isCurrentMonth = dateFns.isSameMonth(day, currentDate);
10649
+ const cellId = `month-cell-${day.toISOString()}`;
10650
+ const dayEvents = getEventsForDayAgenda(eventsWithStart, day);
10651
+ const spanningEvents = getSpanningEventsForDayAgenda(
10652
+ eventsWithStart,
10653
+ day
10654
+ );
10655
+ const allDayEvents = [...spanningEvents, ...dayEvents];
10656
+ const allEvents = getAllEventsForDayAgenda(events, day);
10657
+ const isReferenceCell = weekIndex === 0 && dayIndex === 0;
10658
+ const dayBars = multiDayBars.filter(
10659
+ (b) => dayIndex >= b.colStart && dayIndex < b.colStart + b.colSpan
10660
+ );
10661
+ const dayMaxSlot = dayBars.length > 0 ? Math.max(...dayBars.map((b) => b.slot)) : -1;
10662
+ const dayMultiDayRowCount = dayMaxSlot + 1;
10663
+ const singleEvents = sortEventsAgenda(allDayEvents).filter(
10664
+ (e) => !isMultiDayEventAgenda(e)
10665
+ );
10666
+ const visibleCount = isMounted ? getVisibleEventCount(
10667
+ singleEvents.length + dayMultiDayRowCount
10668
+ ) : void 0;
10669
+ const visibleAfterMultiday = visibleCount !== void 0 ? Math.max(0, visibleCount - dayMultiDayRowCount) : void 0;
10670
+ const hasMore = visibleAfterMultiday !== void 0 && singleEvents.length > visibleAfterMultiday;
10671
+ const remainingCount = hasMore ? singleEvents.length - (visibleAfterMultiday ?? 0) : 0;
10672
+ return /* @__PURE__ */ jsxRuntime.jsx(
10673
+ "div",
10674
+ {
10675
+ "data-outside-cell": !isCurrentMonth || void 0,
10676
+ "data-today": isTodayCell || void 0,
10677
+ className: cn(
10678
+ "group border-border/70 border-r border-b last:border-r-0 transition-colors py-0.5 relative",
10679
+ !isCurrentMonth && "bg-muted/20 text-muted-foreground/60",
10680
+ isTodayCol && isCurrentMonth && !isTodayCell && "bg-blue-50/20 dark:bg-blue-950/10",
10681
+ isTodayCell && "bg-blue-50/50 dark:bg-blue-950/20",
10682
+ "hover:bg-muted/5"
10683
+ ),
10684
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
10685
+ DroppableCellAgenda,
10686
+ {
10687
+ date: day,
10688
+ id: cellId,
10689
+ onClick: () => {
10690
+ const t = new Date(day);
10691
+ t.setHours(DefaultStartHourAgenda, 0, 0);
10692
+ },
10693
+ children: [
10694
+ /* @__PURE__ */ jsxRuntime.jsx(
10695
+ "div",
10696
+ {
10697
+ className: tailwindMerge.twMerge(
10698
+ "mt-1 inline-flex w-6 h-6 sm:w-7 sm:h-7 items-center justify-center rounded-lg text-xs sm:text-sm font-semibold border",
10699
+ isTodayCell ? "bg-blue-500 text-white border-blue-500 shadow-sm shadow-blue-400/40" : "text-muted-foreground border-transparent"
10700
+ ),
10701
+ children: dateFns.format(day, "d")
10702
+ }
10703
+ ),
10704
+ /* @__PURE__ */ jsxRuntime.jsxs(
10705
+ "div",
10706
+ {
10707
+ ref: isReferenceCell ? contentRef : null,
10708
+ className: "min-h-[calc((var(--event-height)+var(--event-gap))*2)] sm:min-h-[calc((var(--event-height)+var(--event-gap))*3)] lg:min-h-[calc((var(--event-height)+var(--event-gap))*4)] px-1 py-0.5 sm:py-1",
10709
+ children: [
10710
+ Array.from({ length: dayMultiDayRowCount }).map(
10711
+ (_, si) => /* @__PURE__ */ jsxRuntime.jsx(
10712
+ "div",
10713
+ {
10714
+ "aria-hidden": "true",
10715
+ className: "mt-[var(--event-gap)] h-[var(--event-height)] w-full",
10716
+ style: { opacity: 0, pointerEvents: "none" }
10717
+ },
10718
+ `spacer-${si}`
10719
+ )
10720
+ ),
10721
+ singleEvents.map((event, index) => {
10722
+ if (!isMounted) return null;
10723
+ const isHidden = visibleAfterMultiday !== void 0 && index >= visibleAfterMultiday;
10724
+ const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10725
+ return /* @__PURE__ */ jsxRuntime.jsx(
10726
+ "div",
10727
+ {
10728
+ "aria-hidden": isHidden ? "true" : void 0,
10729
+ className: "aria-hidden:hidden",
10730
+ children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
10731
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
10732
+ EventItemAgenda,
10733
+ {
10734
+ event,
10735
+ isFirstDay: true,
10736
+ isLastDay: true,
10737
+ onClick: (e) => handleEventClick(event, e),
10738
+ view: "month",
10739
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 sm:gap-1.5 truncate text-[11px] relative z-10", children: [
10740
+ !event.allDay && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-normal opacity-80 text-[10px] sm:text-[11px] bg-white/10 px-1 py-0.5 rounded-full", children: dateFns.format(eventStart, "HH:mm") }),
10741
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold truncate", children: event.title })
10742
+ ] })
10743
+ }
10744
+ ) }) }),
10745
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", children: [
10746
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold truncate max-w-[200px]", children: event.title }),
10747
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "opacity-80 mt-0.5 leading-snug", children: formatDurationAgenda(event) }),
10748
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "opacity-60 mt-0.5 truncate text-[11px] max-w-[200px] flex items-center gap-1", children: [
10749
+ /* @__PURE__ */ jsxRuntime.jsx(react.MapPinIcon, { size: 14 }),
10750
+ " ",
10751
+ event.location
10752
+ ] })
10753
+ ] })
10754
+ ] }) })
10755
+ },
10756
+ event.id
10757
+ );
10758
+ })
10759
+ ]
10760
+ }
10761
+ ),
10762
+ hasMore && /* @__PURE__ */ jsxRuntime.jsxs(PopoverBase, { modal: true, children: [
10763
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
10764
+ "button",
10765
+ {
10766
+ type: "button",
10767
+ onClick: (e) => e.stopPropagation(),
10768
+ "aria-label": `Mostrar mais ${remainingCount} eventos`,
10769
+ 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 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",
10770
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-semibold", children: [
10771
+ "+ ",
10772
+ remainingCount,
10773
+ " ",
10774
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "mais" })
10775
+ ] })
10776
+ }
10777
+ ) }),
10778
+ /* @__PURE__ */ jsxRuntime.jsx(
10779
+ PopoverContentBase,
10780
+ {
10781
+ align: "center",
10782
+ className: "max-w-52 p-3",
10783
+ style: {
10784
+ "--event-height": `${EventHeightAgenda}px`
10785
+ },
10786
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
10787
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm", children: dateFns.format(day, "EEE d", { locale: locale.ptBR }) }),
10788
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: sortEventsAgenda(allEvents).map((event) => {
10789
+ const s = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10790
+ const e2 = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10791
+ return /* @__PURE__ */ jsxRuntime.jsx(
10371
10792
  EventItemAgenda,
10372
10793
  {
10373
10794
  event,
10374
- isFirstDay,
10375
- isLastDay,
10795
+ isFirstDay: dateFns.isSameDay(day, s),
10796
+ isLastDay: dateFns.isSameDay(day, e2),
10376
10797
  onClick: (e) => handleEventClick(event, e),
10377
- view: "month",
10378
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 truncate text-[12px] text-foreground" })
10379
- }
10380
- )
10381
- },
10382
- `spanning-${event.id}-${day.toISOString().slice(0, 10)}`
10383
- );
10798
+ view: "month"
10799
+ },
10800
+ event.id
10801
+ );
10802
+ }) })
10803
+ ] })
10384
10804
  }
10385
- const isMultiDay = !isLastDay;
10386
- return /* @__PURE__ */ jsxRuntime.jsx(
10387
- "div",
10388
- {
10389
- "aria-hidden": isHidden ? "true" : void 0,
10390
- className: "aria-hidden:hidden relative",
10391
- children: /* @__PURE__ */ jsxRuntime.jsx(
10392
- EventItemAgenda,
10393
- {
10394
- event,
10395
- isFirstDay,
10396
- isLastDay,
10397
- onClick: (e) => handleEventClick(event, e),
10398
- view: "month",
10399
- className: isMultiDay ? "overflow-visible" : "",
10400
- children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 sm:gap-2 truncate text-[12px] text-foreground relative z-10", children: [
10401
- !event.allDay && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-normal opacity-80 text-[10px] sm:text-[11px] bg-white/10 px-1 py-0.5 rounded-full", children: dateFns.format(eventStart, "HH:mm") }),
10402
- /* @__PURE__ */ jsxRuntime.jsx(
10403
- "span",
10404
- {
10405
- className: `font-medium text-xs sm:text-sm ${isMultiDay ? "whitespace-nowrap" : "truncate"}`,
10406
- children: event.title
10407
- }
10408
- )
10409
- ] })
10410
- }
10411
- )
10412
- },
10413
- event.id
10414
- );
10415
- }),
10416
- hasMore && /* @__PURE__ */ jsxRuntime.jsxs(PopoverBase, { modal: true, children: [
10417
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
10418
- "button",
10419
- {
10420
- 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",
10421
- onClick: (e) => e.stopPropagation(),
10422
- type: "button",
10423
- "aria-label": `Show ${remainingCount} more events on ${dateFns.format(
10424
- day,
10425
- "PPP",
10426
- { locale: locale.ptBR }
10427
- )}`,
10428
- children: [
10429
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
10430
- "+ ",
10431
- remainingCount
10432
- ] }),
10433
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " more" })
10434
- ]
10435
- }
10436
- ) }),
10437
- /* @__PURE__ */ jsxRuntime.jsx(
10438
- PopoverContentBase,
10439
- {
10440
- align: "center",
10441
- className: "max-w-52 p-3",
10442
- style: {
10443
- "--event-height": `${EventHeightAgenda}px`
10444
- },
10445
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
10446
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-sm", children: dateFns.format(day, "EEE d", { locale: locale.ptBR }) }),
10447
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: sortEventsAgenda(allEvents).map((event) => {
10448
- const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10449
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10450
- const isFirstDay = dateFns.isSameDay(day, eventStart);
10451
- const isLastDay = dateFns.isSameDay(day, eventEnd);
10452
- return /* @__PURE__ */ jsxRuntime.jsx(
10453
- EventItemAgenda,
10454
- {
10455
- event,
10456
- isFirstDay,
10457
- isLastDay,
10458
- onClick: (e) => handleEventClick(event, e),
10459
- view: "month"
10460
- },
10461
- event.id
10462
- );
10463
- }) })
10464
- ] })
10465
- }
10466
- )
10467
- ] })
10468
- ]
10469
- }
10470
- )
10471
- ]
10472
- }
10473
- )
10474
- },
10475
- day.toString()
10476
- );
10477
- })
10478
- },
10479
- `week-${weekIndex}`
10480
- )) }),
10805
+ )
10806
+ ] })
10807
+ ]
10808
+ }
10809
+ )
10810
+ },
10811
+ day.toString()
10812
+ );
10813
+ }),
10814
+ /* @__PURE__ */ jsxRuntime.jsx(
10815
+ MultiDayOverlay,
10816
+ {
10817
+ bars: multiDayBars,
10818
+ weekIndex,
10819
+ hoveredEventId,
10820
+ onHover: handleHover,
10821
+ onEventSelect
10822
+ }
10823
+ )
10824
+ ]
10825
+ },
10826
+ `week-${weekIndex}`
10827
+ );
10828
+ }) }),
10481
10829
  /* @__PURE__ */ jsxRuntime.jsx(
10482
10830
  UndatedEvents,
10483
10831
  {
@@ -10510,7 +10858,8 @@ function DraggableEvent({
10510
10858
  isFirstDay = true,
10511
10859
  isLastDay = true,
10512
10860
  "aria-hidden": ariaHidden,
10513
- draggable = true
10861
+ draggable = true,
10862
+ totalCols
10514
10863
  }) {
10515
10864
  const { activeId } = useCalendarDndAgenda();
10516
10865
  const elementRef = React32.useRef(null);
@@ -10595,7 +10944,8 @@ function DraggableEvent({
10595
10944
  onMouseDown: handleMouseDown,
10596
10945
  onTouchStart: handleTouchStart,
10597
10946
  showTime,
10598
- view
10947
+ view,
10948
+ totalCols
10599
10949
  }
10600
10950
  )
10601
10951
  }
@@ -10609,14 +10959,10 @@ function WeekViewAgenda({
10609
10959
  showUndatedEvents
10610
10960
  }) {
10611
10961
  const days = React32.useMemo(() => {
10612
- const weekStart2 = dateFns.startOfWeek(currentDate, { weekStartsOn: 0 });
10962
+ const weekStart = dateFns.startOfWeek(currentDate, { weekStartsOn: 0 });
10613
10963
  const weekEnd = dateFns.endOfWeek(currentDate, { weekStartsOn: 0 });
10614
- return dateFns.eachDayOfInterval({ end: weekEnd, start: weekStart2 });
10964
+ return dateFns.eachDayOfInterval({ end: weekEnd, start: weekStart });
10615
10965
  }, [currentDate]);
10616
- const weekStart = React32.useMemo(
10617
- () => dateFns.startOfWeek(currentDate, { weekStartsOn: 0 }),
10618
- [currentDate]
10619
- );
10620
10966
  const hours = React32.useMemo(() => {
10621
10967
  const dayStart = dateFns.startOfDay(currentDate);
10622
10968
  return dateFns.eachHourOfInterval({
@@ -10649,6 +10995,25 @@ function WeekViewAgenda({
10649
10995
  });
10650
10996
  });
10651
10997
  }, [events, days]);
10998
+ const trueAllDayEvents = React32.useMemo(
10999
+ () => allDayEvents.filter((e) => e.allDay),
11000
+ [allDayEvents]
11001
+ );
11002
+ const multiDayTimedEvents = React32.useMemo(
11003
+ () => allDayEvents.filter((e) => !e.allDay),
11004
+ [allDayEvents]
11005
+ );
11006
+ const rowH = EventHeightAgenda + EventGapAgenda;
11007
+ const allDayBarData = React32.useMemo(() => {
11008
+ const bars = computeMultiDayBars(trueAllDayEvents, days);
11009
+ const maxSlot = bars.length > 0 ? Math.max(...bars.map((b) => b.slot)) : 0;
11010
+ return { bars, sectionH: (maxSlot + 1) * rowH + EventGapAgenda * 2 };
11011
+ }, [trueAllDayEvents, days, rowH]);
11012
+ const multiDayBarData = React32.useMemo(() => {
11013
+ const bars = computeMultiDayBars(multiDayTimedEvents, days);
11014
+ const maxSlot = bars.length > 0 ? Math.max(...bars.map((b) => b.slot)) : 0;
11015
+ return { bars, sectionH: (maxSlot + 1) * rowH + EventGapAgenda * 2 };
11016
+ }, [multiDayTimedEvents, days, rowH]);
10652
11017
  const processedDayEvents = React32.useMemo(() => {
10653
11018
  const result = days.map((day) => {
10654
11019
  const dayEvents = events.filter((event) => {
@@ -10669,56 +11034,69 @@ function WeekViewAgenda({
10669
11034
  const bDuration = dateFns.differenceInMinutes(bEnd, bStart);
10670
11035
  return bDuration - aDuration;
10671
11036
  });
10672
- const positionedEvents = [];
10673
11037
  const dayStart = dateFns.startOfDay(day);
10674
11038
  const columns = [];
11039
+ const layouts = [];
10675
11040
  for (const event of sortedEvents) {
10676
11041
  const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10677
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
11042
+ const rawEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
11043
+ const eventEnd = rawEnd <= eventStart ? new Date(eventStart.getTime() + 30 * 60 * 1e3) : rawEnd;
10678
11044
  const adjustedStart = dateFns.isSameDay(day, eventStart) ? eventStart : dayStart;
10679
11045
  const adjustedEnd = dateFns.isSameDay(day, eventEnd) ? eventEnd : dateFns.addHours(dayStart, 24);
10680
11046
  const startHour = dateFns.getHours(adjustedStart) + dateFns.getMinutes(adjustedStart) / 60;
10681
11047
  const endHour = dateFns.getHours(adjustedEnd) + dateFns.getMinutes(adjustedEnd) / 60;
10682
11048
  const top = (startHour - StartHour) * WeekCellsHeightAgenda;
10683
- const height = (endHour - startHour) * WeekCellsHeightAgenda;
10684
- let columnIndex = 0;
10685
- let placed = false;
10686
- while (!placed) {
10687
- const col = columns[columnIndex] || [];
10688
- if (col.length === 0) {
10689
- columns[columnIndex] = col;
10690
- placed = true;
10691
- } else {
10692
- const overlaps = col.some((c) => {
10693
- const cStart = getEventStartDate(c.event) ?? getEventEndDate(c.event) ?? /* @__PURE__ */ new Date();
10694
- const cEnd = getEventEndDate(c.event) ?? getEventStartDate(c.event) ?? /* @__PURE__ */ new Date();
10695
- return dateFns.areIntervalsOverlapping(
10696
- { end: adjustedEnd, start: adjustedStart },
10697
- { end: cEnd, start: cStart }
10698
- );
10699
- });
10700
- if (!overlaps) {
10701
- placed = true;
10702
- } else {
10703
- columnIndex++;
10704
- }
10705
- }
11049
+ const height = Math.max(
11050
+ (endHour - startHour) * WeekCellsHeightAgenda,
11051
+ 24
11052
+ );
11053
+ let col = 0;
11054
+ while (true) {
11055
+ const colSlots = columns[col] ?? [];
11056
+ const hasConflict = colSlots.some(
11057
+ (slot) => dateFns.areIntervalsOverlapping(
11058
+ { start: adjustedStart, end: adjustedEnd },
11059
+ { start: slot.start, end: slot.end },
11060
+ { inclusive: false }
11061
+ )
11062
+ );
11063
+ if (!hasConflict) break;
11064
+ col++;
10706
11065
  }
10707
- const currentColumn = columns[columnIndex] || [];
10708
- columns[columnIndex] = currentColumn;
10709
- currentColumn.push({ end: adjustedEnd, event });
10710
- const width = columnIndex === 0 ? 1 : 0.9;
10711
- const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
10712
- positionedEvents.push({
11066
+ if (!columns[col]) columns[col] = [];
11067
+ columns[col].push({ start: adjustedStart, end: adjustedEnd });
11068
+ layouts.push({
10713
11069
  event,
10714
- height,
10715
- left,
11070
+ adjustedStart,
11071
+ adjustedEnd,
10716
11072
  top,
10717
- width,
10718
- zIndex: 10 + columnIndex
11073
+ height,
11074
+ col,
11075
+ totalCols: 0
10719
11076
  });
10720
11077
  }
10721
- return positionedEvents;
11078
+ for (const layout of layouts) {
11079
+ let maxCol = layout.col;
11080
+ for (const other of layouts) {
11081
+ if (other === layout) continue;
11082
+ if (dateFns.areIntervalsOverlapping(
11083
+ { start: layout.adjustedStart, end: layout.adjustedEnd },
11084
+ { start: other.adjustedStart, end: other.adjustedEnd },
11085
+ { inclusive: false }
11086
+ )) {
11087
+ maxCol = Math.max(maxCol, other.col);
11088
+ }
11089
+ }
11090
+ layout.totalCols = maxCol + 1;
11091
+ }
11092
+ return layouts.map(({ event, top, height, col, totalCols }) => ({
11093
+ event,
11094
+ top,
11095
+ height,
11096
+ left: col / totalCols,
11097
+ width: 1 / totalCols,
11098
+ zIndex: 10 + col
11099
+ }));
10722
11100
  });
10723
11101
  return result;
10724
11102
  }, [days, events]);
@@ -10728,178 +11106,471 @@ function WeekViewAgenda({
10728
11106
  };
10729
11107
  const showAllDaySection = allDayEvents.length > 0;
10730
11108
  const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(currentDate, "week");
10731
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", "data-slot": "week-view", children: [
10732
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background", children: [
10733
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-[479px]:sr-only", children: dateFns.format(/* @__PURE__ */ new Date(), "O") }) }),
10734
- days.map((day) => /* @__PURE__ */ jsxRuntime.jsxs(
10735
- "div",
10736
- {
10737
- className: "py-2 text-center text-muted-foreground/70 text-sm data-today:font-medium data-today:text-foreground",
10738
- "data-today": dateFns.isToday(day) || void 0,
10739
- children: [
10740
- /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": "true", className: "sm:hidden", children: [
10741
- dateFns.format(day, "EEE", { locale: locale.ptBR })[0],
10742
- " ",
10743
- dateFns.format(day, "d", { locale: locale.ptBR })
10744
- ] }),
10745
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-sm:hidden", children: dateFns.format(day, "EEE dd", { locale: locale.ptBR }) })
10746
- ]
10747
- },
10748
- day.toString()
10749
- ))
10750
- ] }),
10751
- showAllDaySection && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border/70 border-b bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-8", children: [
10752
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative border-border/70 border-r", children: /* @__PURE__ */ jsxRuntime.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" }) }),
10753
- days.map((day, dayIndex) => {
10754
- const dayAllDayEvents = allDayEvents.filter((event) => {
10755
- const eventStart = getEventStartDate(event);
10756
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event);
10757
- if (!eventStart && !eventEnd) return false;
10758
- return eventStart && dateFns.isSameDay(day, eventStart) || eventStart && eventEnd && day > eventStart && day < eventEnd || eventEnd && dateFns.isSameDay(day, eventEnd);
10759
- });
10760
- return /* @__PURE__ */ jsxRuntime.jsx(
11109
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden", "data-slot": "week-view", children: [
11110
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-[600px] sm:min-w-full flex flex-col h-full", children: [
11111
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background", children: [
11112
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 text-center text-muted-foreground/70 text-[10px] sm:text-sm", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-[479px]:sr-only", children: dateFns.format(/* @__PURE__ */ new Date(), "O") }) }),
11113
+ days.map((day) => /* @__PURE__ */ jsxRuntime.jsxs(
10761
11114
  "div",
10762
11115
  {
10763
- className: "relative border-border/70 border-r p-1 last:border-r-0",
11116
+ className: "py-2 text-center text-muted-foreground/70 text-[10px] sm:text-sm data-today:font-medium data-today:text-foreground",
10764
11117
  "data-today": dateFns.isToday(day) || void 0,
10765
- children: dayAllDayEvents.map((event) => {
10766
- const eventStart = getEventStartDate(event);
10767
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event);
10768
- const isFirstDay = eventStart ? dateFns.isSameDay(day, eventStart) : false;
10769
- const isLastDay = eventEnd ? dateFns.isSameDay(day, eventEnd) : false;
10770
- const isFirstVisibleDay = eventStart ? dayIndex === 0 && dateFns.isBefore(eventStart, weekStart) : false;
10771
- const shouldShowTitle = isFirstDay || isFirstVisibleDay;
10772
- return /* @__PURE__ */ jsxRuntime.jsx(
10773
- EventItemAgenda,
10774
- {
10775
- event,
10776
- isFirstDay,
10777
- isLastDay,
10778
- onClick: (e) => handleEventClick(event, e),
10779
- view: "month",
10780
- children: /* @__PURE__ */ jsxRuntime.jsx(
10781
- "div",
10782
- {
10783
- "aria-hidden": !shouldShowTitle,
10784
- className: cn(
10785
- "truncate",
10786
- !shouldShowTitle && "invisible"
10787
- ),
10788
- children: event.title
10789
- }
10790
- )
10791
- },
10792
- `spanning-${event.id}`
10793
- );
10794
- })
11118
+ children: [
11119
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": "true", className: "sm:hidden", children: [
11120
+ dateFns.format(day, "EEE", { locale: locale.ptBR })[0],
11121
+ " ",
11122
+ dateFns.format(day, "d", { locale: locale.ptBR })
11123
+ ] }),
11124
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline md:hidden", children: dateFns.format(day, "EEE d", { locale: locale.ptBR }) }),
11125
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-md:hidden", children: dateFns.format(day, "EEE dd", { locale: locale.ptBR }) })
11126
+ ]
10795
11127
  },
10796
11128
  day.toString()
10797
- );
10798
- })
10799
- ] }) }),
10800
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 grid-cols-8 overflow-hidden", children: [
10801
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid auto-cols-fr border-border/70 border-r", children: hours.map((hour, index) => /* @__PURE__ */ jsxRuntime.jsx(
10802
- "div",
10803
- {
10804
- className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
10805
- children: index > 0 && /* @__PURE__ */ jsxRuntime.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: dateFns.format(hour, "HH:mm") })
10806
- },
10807
- hour.toString()
10808
- )) }),
10809
- days.map((day, dayIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
10810
- "div",
10811
- {
10812
- className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
10813
- "data-today": dateFns.isToday(day) || void 0,
10814
- children: [
10815
- (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => /* @__PURE__ */ jsxRuntime.jsx(
10816
- "div",
10817
- {
10818
- className: "absolute z-10 px-0.5",
10819
- onClick: (e) => e.stopPropagation(),
10820
- style: {
10821
- height: `${positionedEvent.height}px`,
10822
- left: `${positionedEvent.left * 100}%`,
10823
- top: `${positionedEvent.top}px`,
10824
- width: `${positionedEvent.width * 100}%`,
10825
- zIndex: positionedEvent.zIndex
10826
- },
10827
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full", children: /* @__PURE__ */ jsxRuntime.jsx(
10828
- DraggableEvent,
11129
+ ))
11130
+ ] }),
11131
+ showAllDaySection && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border/70 border-b bg-muted/50", children: [
11132
+ trueAllDayEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-8", children: [
11133
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative border-border/70 border-r", children: /* @__PURE__ */ jsxRuntime.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" }) }),
11134
+ /* @__PURE__ */ jsxRuntime.jsxs(
11135
+ "div",
11136
+ {
11137
+ className: "col-span-7 relative",
11138
+ style: { height: allDayBarData.sectionH },
11139
+ children: [
11140
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grid grid-cols-7 pointer-events-none", children: days.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
11141
+ "div",
10829
11142
  {
10830
- event: positionedEvent.event,
10831
- height: positionedEvent.height,
10832
- onClick: (e) => handleEventClick(positionedEvent.event, e),
10833
- draggable: false,
10834
- showTime: true,
10835
- view: "week"
10836
- }
10837
- ) })
10838
- },
10839
- positionedEvent.event.id
10840
- )),
10841
- currentTimeVisible && dateFns.isToday(day) && /* @__PURE__ */ jsxRuntime.jsx(
10842
- "div",
10843
- {
10844
- className: "pointer-events-none absolute right-0 left-0 z-20",
10845
- style: { top: `${currentTimePosition}%` },
10846
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
10847
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-left-1 absolute h-2 w-2 rounded-full bg-primary" }),
10848
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[2px] w-full bg-primary" })
10849
- ] })
10850
- }
11143
+ className: "border-r last:border-r-0 border-border/70",
11144
+ "data-today": dateFns.isToday(day) || void 0
11145
+ },
11146
+ day.toString()
11147
+ )) }),
11148
+ allDayBarData.bars.map((bar) => {
11149
+ const {
11150
+ event,
11151
+ colStart,
11152
+ colSpan,
11153
+ isFirstDay,
11154
+ isLastDay,
11155
+ slot
11156
+ } = bar;
11157
+ const showTitle = isFirstDay || !isFirstDay && colStart === 0;
11158
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
11159
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
11160
+ "div",
11161
+ {
11162
+ className: "absolute px-0.5",
11163
+ style: {
11164
+ left: `calc(${colStart / 7 * 100}% + 2px)`,
11165
+ width: `calc(${colSpan / 7 * 100}% - 4px)`,
11166
+ top: EventGapAgenda + slot * rowH,
11167
+ height: EventHeightAgenda
11168
+ },
11169
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11170
+ EventItemAgenda,
11171
+ {
11172
+ event,
11173
+ isFirstDay,
11174
+ isLastDay,
11175
+ onClick: (e) => {
11176
+ e.stopPropagation();
11177
+ handleEventClick(event, e);
11178
+ },
11179
+ view: "month",
11180
+ className: "h-full",
11181
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 min-w-0 w-full", children: [
11182
+ !isFirstDay && colStart === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretLeftIcon, {}) }),
11183
+ showTitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium", children: event.title }),
11184
+ !isLastDay && colStart + colSpan === 7 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 ml-auto text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretRightIcon, {}) })
11185
+ ] })
11186
+ }
11187
+ )
11188
+ }
11189
+ ) }),
11190
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", children: [
11191
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold truncate max-w-[200px]", children: event.title }),
11192
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "opacity-80 mt-0.5 leading-snug", children: formatDurationAgenda(event) }),
11193
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "opacity-60 mt-0.5 truncate text-[11px] max-w-[200px] flex items-center gap-1", children: [
11194
+ /* @__PURE__ */ jsxRuntime.jsx(ssr.MapPinIcon, { size: 14 }),
11195
+ " ",
11196
+ event.location
11197
+ ] })
11198
+ ] })
11199
+ ] }) }, event.id);
11200
+ })
11201
+ ]
11202
+ }
11203
+ )
11204
+ ] }),
11205
+ multiDayTimedEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
11206
+ "div",
11207
+ {
11208
+ className: cn(
11209
+ "grid grid-cols-8",
11210
+ trueAllDayEvents.length > 0 && "border-t border-border/40"
10851
11211
  ),
10852
- hours.map((hour) => {
10853
- const hourValue = dateFns.getHours(hour);
10854
- return /* @__PURE__ */ jsxRuntime.jsx(
11212
+ children: [
11213
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative border-border/70 border-r", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full px-1 text-muted-foreground/70 sm:text-xs", children: "Evento" }) }),
11214
+ /* @__PURE__ */ jsxRuntime.jsxs(
10855
11215
  "div",
10856
11216
  {
10857
- className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
10858
- children: [0, 1, 2, 3].map((quarter) => {
10859
- const quarterHourTime = hourValue + quarter * 0.25;
10860
- return /* @__PURE__ */ jsxRuntime.jsx(
10861
- DroppableCellAgenda,
11217
+ className: "col-span-7 relative",
11218
+ style: { height: multiDayBarData.sectionH },
11219
+ children: [
11220
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grid grid-cols-7 pointer-events-none", children: days.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
11221
+ "div",
10862
11222
  {
10863
- className: cn(
10864
- "absolute h-[calc(var(--week-cells-height)/4)] w-full",
10865
- quarter === 0 && "top-0",
10866
- quarter === 1 && "top-[calc(var(--week-cells-height)/4)]",
10867
- quarter === 2 && "top-[calc(var(--week-cells-height)/4*2)]",
10868
- quarter === 3 && "top-[calc(var(--week-cells-height)/4*)]"
10869
- ),
10870
- date: day,
10871
- id: `week-cell-${day.toISOString()}-${quarterHourTime}`,
10872
- onClick: () => {
10873
- const startTime = new Date(day);
10874
- startTime.setHours(hourValue);
10875
- startTime.setMinutes(quarter * 15);
10876
- if (onEventCreate) onEventCreate(startTime);
10877
- },
10878
- time: quarterHourTime
11223
+ className: "border-r last:border-r-0 border-border/70",
11224
+ "data-today": dateFns.isToday(day) || void 0
10879
11225
  },
10880
- `${hour.toString()}-${quarter}`
10881
- );
10882
- })
10883
- },
10884
- hour.toString()
10885
- );
10886
- })
10887
- ]
10888
- },
10889
- day.toString()
10890
- ))
10891
- ] }),
11226
+ day.toString()
11227
+ )) }),
11228
+ multiDayBarData.bars.map((bar) => {
11229
+ const {
11230
+ event,
11231
+ colStart,
11232
+ colSpan,
11233
+ isFirstDay,
11234
+ isLastDay,
11235
+ slot
11236
+ } = bar;
11237
+ const eventStart = getEventStartDate(event) ?? /* @__PURE__ */ new Date();
11238
+ const showTitle = isFirstDay || !isFirstDay && colStart === 0;
11239
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { delayDuration: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
11240
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
11241
+ "div",
11242
+ {
11243
+ className: "absolute px-0.5",
11244
+ style: {
11245
+ left: `calc(${colStart / 7 * 100}% + 2px)`,
11246
+ width: `calc(${colSpan / 7 * 100}% - 4px)`,
11247
+ top: EventGapAgenda + slot * rowH,
11248
+ height: EventHeightAgenda
11249
+ },
11250
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11251
+ EventItemAgenda,
11252
+ {
11253
+ event,
11254
+ isFirstDay,
11255
+ isLastDay,
11256
+ onClick: (e) => {
11257
+ e.stopPropagation();
11258
+ handleEventClick(event, e);
11259
+ },
11260
+ view: "month",
11261
+ className: "h-full border-dashed",
11262
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 min-w-0 w-full", children: [
11263
+ !isFirstDay && colStart === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretLeftIcon, {}) }),
11264
+ showTitle && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11265
+ isFirstDay && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-normal opacity-80 text-[10px] sm:text-[11px] bg-white/10 px-1 py-0.5 rounded-full", children: dateFns.format(eventStart, "HH:mm") }),
11266
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium", children: event.title }),
11267
+ isFirstDay && (() => {
11268
+ const evStart = getEventStartDate(event);
11269
+ const evEnd = getEventEndDate(event);
11270
+ if (!evStart || !evEnd) return null;
11271
+ const d = Math.round(
11272
+ (evEnd.getTime() - evStart.getTime()) / 864e5
11273
+ ) + 1;
11274
+ if (d < 2) return null;
11275
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "shrink-0 inline-flex items-end font-bold leading-none px-1 py-0.5 text-[10px]", children: [
11276
+ d,
11277
+ "d"
11278
+ ] });
11279
+ })()
11280
+ ] }),
11281
+ !isLastDay && colStart + colSpan === 7 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 ml-auto text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretRightIcon, {}) })
11282
+ ] })
11283
+ }
11284
+ )
11285
+ }
11286
+ ) }),
11287
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", children: [
11288
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold truncate max-w-[200px]", children: event.title }),
11289
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "opacity-80 mt-0.5 leading-snug", children: formatDurationAgenda(event) }),
11290
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "opacity-60 mt-0.5 truncate text-[11px] max-w-[200px] flex items-center gap-1", children: [
11291
+ /* @__PURE__ */ jsxRuntime.jsx(ssr.MapPinIcon, { size: 14 }),
11292
+ " ",
11293
+ event.location
11294
+ ] })
11295
+ ] })
11296
+ ] }) }, event.id);
11297
+ })
11298
+ ]
11299
+ }
11300
+ )
11301
+ ]
11302
+ }
11303
+ )
11304
+ ] }),
11305
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 grid-cols-8", children: [
11306
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid auto-cols-fr border-border/70 border-r", children: hours.map((hour, index) => /* @__PURE__ */ jsxRuntime.jsx(
11307
+ "div",
11308
+ {
11309
+ className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
11310
+ children: index > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-1 sm:pe-4 text-[9px] sm:text-xs text-muted-foreground/70", children: dateFns.format(hour, "HH:mm") })
11311
+ },
11312
+ hour.toString()
11313
+ )) }),
11314
+ days.map((day, dayIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
11315
+ "div",
11316
+ {
11317
+ className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
11318
+ "data-today": dateFns.isToday(day) || void 0,
11319
+ children: [
11320
+ (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => {
11321
+ const timeLabel = formatDurationAgenda(positionedEvent.event);
11322
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { delayDuration: 250, children: [
11323
+ /* @__PURE__ */ jsxRuntime.jsx(
11324
+ "div",
11325
+ {
11326
+ className: "absolute z-10 px-0.5",
11327
+ onClick: (e) => e.stopPropagation(),
11328
+ style: {
11329
+ height: `${positionedEvent.height}px`,
11330
+ left: `${positionedEvent.left * 100}%`,
11331
+ top: `${positionedEvent.top}px`,
11332
+ width: `${positionedEvent.width * 100}%`,
11333
+ zIndex: positionedEvent.zIndex
11334
+ },
11335
+ children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full", children: /* @__PURE__ */ jsxRuntime.jsx(
11336
+ DraggableEvent,
11337
+ {
11338
+ event: positionedEvent.event,
11339
+ height: positionedEvent.height,
11340
+ onClick: (e) => handleEventClick(positionedEvent.event, e),
11341
+ draggable: false,
11342
+ showTime: true,
11343
+ view: "week",
11344
+ totalCols: positionedEvent.totalCols
11345
+ }
11346
+ ) }) })
11347
+ }
11348
+ ),
11349
+ /* @__PURE__ */ jsxRuntime.jsxs(
11350
+ TooltipContentBase,
11351
+ {
11352
+ side: "right",
11353
+ sideOffset: 6,
11354
+ className: "max-w-[220px] space-y-0.5",
11355
+ children: [
11356
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm leading-snug", children: positionedEvent.event.title }),
11357
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-90", children: timeLabel }),
11358
+ positionedEvent.event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs flex items-center gap-2", children: [
11359
+ /* @__PURE__ */ jsxRuntime.jsx(ssr.MapPinIcon, { size: 15 }),
11360
+ " ",
11361
+ positionedEvent.event.location
11362
+ ] }),
11363
+ positionedEvent.event.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-75 line-clamp-2", children: positionedEvent.event.description })
11364
+ ]
11365
+ }
11366
+ )
11367
+ ] }) }, positionedEvent.event.id);
11368
+ }),
11369
+ currentTimeVisible && dateFns.isToday(day) && /* @__PURE__ */ jsxRuntime.jsx(
11370
+ "div",
11371
+ {
11372
+ className: "pointer-events-none absolute right-0 left-0 z-20",
11373
+ style: { top: `${currentTimePosition}%` },
11374
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
11375
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-left-1 absolute h-2 w-2 rounded-full bg-primary" }),
11376
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[2px] w-full bg-primary" })
11377
+ ] })
11378
+ }
11379
+ ),
11380
+ hours.map((hour) => {
11381
+ const hourValue = dateFns.getHours(hour);
11382
+ return /* @__PURE__ */ jsxRuntime.jsx(
11383
+ "div",
11384
+ {
11385
+ className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
11386
+ children: [0, 1, 2, 3].map((quarter) => {
11387
+ const quarterHourTime = hourValue + quarter * 0.25;
11388
+ return /* @__PURE__ */ jsxRuntime.jsx(
11389
+ DroppableCellAgenda,
11390
+ {
11391
+ className: cn(
11392
+ "absolute h-[calc(var(--week-cells-height)/4)] w-full",
11393
+ quarter === 0 && "top-0",
11394
+ quarter === 1 && "top-[calc(var(--week-cells-height)/4)]",
11395
+ quarter === 2 && "top-[calc(var(--week-cells-height)/4*2)]",
11396
+ quarter === 3 && "top-[calc(var(--week-cells-height)/4*3)]"
11397
+ ),
11398
+ date: day,
11399
+ id: `week-cell-${day.toISOString()}-${quarterHourTime}`,
11400
+ onClick: () => {
11401
+ const startTime = new Date(day);
11402
+ startTime.setHours(hourValue);
11403
+ startTime.setMinutes(quarter * 15);
11404
+ if (onEventCreate) onEventCreate(startTime);
11405
+ },
11406
+ time: quarterHourTime
11407
+ },
11408
+ `${hour.toString()}-${quarter}`
11409
+ );
11410
+ })
11411
+ },
11412
+ hour.toString()
11413
+ );
11414
+ })
11415
+ ]
11416
+ },
11417
+ day.toString()
11418
+ ))
11419
+ ] })
11420
+ ] }) }),
10892
11421
  /* @__PURE__ */ jsxRuntime.jsx(
10893
11422
  UndatedEvents,
10894
11423
  {
10895
11424
  events,
10896
11425
  onEventSelect,
10897
11426
  show: showUndatedEvents,
10898
- className: "my-"
11427
+ className: "my-4"
10899
11428
  }
10900
11429
  )
10901
11430
  ] });
10902
11431
  }
11432
+ var colorBannerMap = {
11433
+ sky: "from-sky-400 via-sky-500 to-cyan-500",
11434
+ amber: "from-amber-400 via-amber-500 to-orange-400",
11435
+ violet: "from-violet-400 via-violet-500 to-purple-600",
11436
+ rose: "from-rose-400 via-rose-500 to-pink-500",
11437
+ emerald: "from-emerald-400 via-emerald-500 to-teal-500",
11438
+ orange: "from-orange-400 via-orange-500 to-amber-500",
11439
+ green: "from-green-400 via-green-500 to-emerald-500",
11440
+ blue: "from-blue-400 via-blue-500 to-indigo-500",
11441
+ red: "from-red-400 via-red-500 to-rose-500",
11442
+ purple: "from-purple-400 via-purple-500 to-violet-600",
11443
+ indigo: "from-indigo-400 via-indigo-500 to-blue-600",
11444
+ teal: "from-teal-400 via-teal-500 to-cyan-500",
11445
+ pink: "from-pink-400 via-pink-500 to-rose-400",
11446
+ cyan: "from-cyan-400 via-cyan-500 to-sky-500",
11447
+ lime: "from-lime-400 via-lime-500 to-green-500",
11448
+ fuchsia: "from-fuchsia-400 via-fuchsia-500 to-purple-500"
11449
+ };
11450
+ function formatDuration(minutes) {
11451
+ if (minutes <= 0) return "";
11452
+ const h = Math.floor(minutes / 60);
11453
+ const m = minutes % 60;
11454
+ if (h === 0) return `${m}min`;
11455
+ if (m === 0) return `${h}h`;
11456
+ return `${h}h ${m}min`;
11457
+ }
11458
+ function formatDateFull(date) {
11459
+ return dateFns.format(date, "EEE',' d 'de' MMMM 'de' yyyy", { locale: locale.ptBR });
11460
+ }
11461
+ function capitalize(s) {
11462
+ return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
11463
+ }
11464
+ function EventDetailModalAgenda({
11465
+ event,
11466
+ onClose
11467
+ }) {
11468
+ const [open, setOpen] = React32.useState(true);
11469
+ if (!event) return null;
11470
+ const color = event.color ?? getAutoColorAgenda(event.id);
11471
+ const bannerGradient = colorBannerMap[color] ?? colorBannerMap.sky;
11472
+ const startDate = getEventStartDate(event);
11473
+ const endDate = getEventEndDate(event);
11474
+ const isMultiDay = isMultiDayEventAgenda(event);
11475
+ const durationMinutes = startDate && endDate ? dateFns.differenceInMinutes(endDate, startDate) : 0;
11476
+ const dateSection = (() => {
11477
+ if (!startDate) {
11478
+ return { primary: "Sem data definida", secondary: null, isAllDay: false };
11479
+ }
11480
+ if (event.allDay) {
11481
+ if (isMultiDay && endDate && !dateFns.isSameDay(startDate, endDate)) {
11482
+ return {
11483
+ primary: `${capitalize(formatDateFull(startDate))}`,
11484
+ secondary: `${capitalize(formatDateFull(endDate))}`,
11485
+ isAllDay: true
11486
+ };
11487
+ }
11488
+ return {
11489
+ primary: capitalize(formatDateFull(startDate)),
11490
+ secondary: null,
11491
+ isAllDay: true
11492
+ };
11493
+ }
11494
+ if (isMultiDay && endDate) {
11495
+ const startStr = capitalize(
11496
+ dateFns.format(startDate, "d MMM yyyy, HH:mm", { locale: locale.ptBR })
11497
+ );
11498
+ const endStr = capitalize(
11499
+ dateFns.format(endDate, "d MMM yyyy, HH:mm", { locale: locale.ptBR })
11500
+ );
11501
+ return { primary: startStr, secondary: endStr, isAllDay: false };
11502
+ }
11503
+ const dateStr = capitalize(formatDateFull(startDate));
11504
+ const timeStr = endDate ? `${dateFns.format(startDate, "HH:mm")} \u2013 ${dateFns.format(endDate, "HH:mm")}` : dateFns.format(startDate, "HH:mm");
11505
+ return { primary: dateStr, secondary: timeStr, isAllDay: false };
11506
+ })();
11507
+ return /* @__PURE__ */ jsxRuntime.jsx(
11508
+ DialogBase,
11509
+ {
11510
+ open,
11511
+ onOpenChange: (v) => {
11512
+ setOpen(v);
11513
+ if (!v) onClose?.();
11514
+ },
11515
+ children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContentBase, { className: "p-0 overflow-hidden gap-0 border-none shadow-2xl sm:max-w-md rounded-2xl", children: [
11516
+ /* @__PURE__ */ jsxRuntime.jsxs(
11517
+ "div",
11518
+ {
11519
+ className: cn(
11520
+ "relative bg-gradient-to-br w-full flex flex-col justify-end px-7 pt-14 pb-7 select-none overflow-hidden",
11521
+ bannerGradient
11522
+ ),
11523
+ children: [
11524
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-0 bg-gradient-to-br from-white/20 via-transparent to-black/10" }),
11525
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-4 left-5 flex items-center gap-2 z-10", children: dateSection.isAllDay ? /* @__PURE__ */ jsxRuntime.jsxs(Badge, { className: "bg-black/20 text-white border border-white/20 backdrop-blur-sm shadow-none gap-1 text-[11px] font-medium", children: [
11526
+ /* @__PURE__ */ jsxRuntime.jsx(react.SunIcon, { size: 11, weight: "bold" }),
11527
+ "Dia todo"
11528
+ ] }) : isMultiDay ? /* @__PURE__ */ jsxRuntime.jsxs(Badge, { className: "bg-black/20 text-white border border-white/20 backdrop-blur-sm shadow-none gap-1 text-[11px] font-medium", children: [
11529
+ /* @__PURE__ */ jsxRuntime.jsx(react.CalendarDotsIcon, { size: 11, weight: "bold" }),
11530
+ formatDurationAgendaDays(event)
11531
+ ] }) : durationMinutes > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(Badge, { className: "bg-black/20 text-white border border-white/20 backdrop-blur-sm shadow-none gap-1 text-[11px] font-medium", children: [
11532
+ /* @__PURE__ */ jsxRuntime.jsx(react.ClockIcon, { size: 11, weight: "bold" }),
11533
+ formatDuration(durationMinutes)
11534
+ ] }) : null }),
11535
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "relative z-10 text-2xl sm:text-[1.75rem] font-bold text-white leading-tight tracking-tight drop-shadow-sm", children: event.title })
11536
+ ]
11537
+ }
11538
+ ),
11539
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-7 py-6 bg-background", children: [
11540
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-4 py-4", children: [
11541
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 p-2 rounded-xl bg-muted border border-border shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(react.CalendarDotsIcon, { size: 18, weight: "duotone", className: "text-primary" }) }),
11542
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5 min-w-0", children: [
11543
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground leading-snug", children: dateSection.primary }),
11544
+ dateSection.secondary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1.5 mt-0.5", children: isMultiDay && !event.allDay || isMultiDay && dateSection.isAllDay ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11545
+ /* @__PURE__ */ jsxRuntime.jsx(react.ArrowRightIcon, { size: 11, className: "shrink-0 text-muted-foreground/60" }),
11546
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] font-medium text-muted-foreground", children: dateSection.secondary })
11547
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] font-medium text-muted-foreground", children: dateSection.secondary }) })
11548
+ ] })
11549
+ ] }),
11550
+ (event.location || event.description) && /* @__PURE__ */ jsxRuntime.jsx(SeparatorBase, { className: "opacity-40" }),
11551
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11552
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-4 py-4", children: [
11553
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 p-2 rounded-xl bg-muted border border-border shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(react.MapPinIcon, { size: 18, weight: "duotone", className: "text-primary" }) }),
11554
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5 min-w-0", children: [
11555
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-medium uppercase tracking-widest text-muted-foreground/60", children: "Localiza\xE7\xE3o" }),
11556
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-medium text-foreground leading-snug", children: event.location })
11557
+ ] })
11558
+ ] }),
11559
+ event.description && /* @__PURE__ */ jsxRuntime.jsx(SeparatorBase, { className: "opacity-40" })
11560
+ ] }),
11561
+ event.description && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-4 py-4", children: [
11562
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 p-2 rounded-xl bg-muted border border-border shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(react.AlignLeftIcon, { size: 18, weight: "duotone", className: "text-primary" }) }),
11563
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5 min-w-0", children: [
11564
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-medium uppercase tracking-widest text-muted-foreground/60", children: "Descri\xE7\xE3o" }),
11565
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[13px] text-muted-foreground leading-relaxed font-normal", children: event.description })
11566
+ ] })
11567
+ ] }),
11568
+ !event.location && !event.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-[11px] text-muted-foreground/40 italic text-center", children: "Nenhum detalhe adicional dispon\xEDvel." })
11569
+ ] })
11570
+ ] })
11571
+ }
11572
+ );
11573
+ }
10903
11574
  function AgendaView({
10904
11575
  currentDate,
10905
11576
  events,
@@ -11745,23 +12416,23 @@ function EventCalendar({
11745
12416
  });
11746
12417
  };
11747
12418
  const viewTitle = React32.useMemo(() => {
11748
- const capitalize = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
12419
+ const capitalize2 = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
11749
12420
  if (view === "month") {
11750
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
12421
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
11751
12422
  }
11752
12423
  if (view === "week") {
11753
12424
  const start = dateFns.startOfWeek(currentDate, { weekStartsOn: 1 });
11754
12425
  const end = dateFns.endOfWeek(currentDate, { weekStartsOn: 1 });
11755
12426
  if (dateFns.isSameMonth(start, end)) {
11756
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
12427
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
11757
12428
  }
11758
- const s1 = capitalize(dateFns.format(start, "MMM", { locale: locale.ptBR }));
11759
- const s2 = capitalize(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
12429
+ const s1 = capitalize2(dateFns.format(start, "MMM", { locale: locale.ptBR }));
12430
+ const s2 = capitalize2(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
11760
12431
  return `${s1} - ${s2}`;
11761
12432
  }
11762
12433
  if (view === "day") {
11763
12434
  const dayNum = dateFns.format(currentDate, "d", { locale: locale.ptBR });
11764
- const month = capitalize(dateFns.format(currentDate, "MMMM", { locale: locale.ptBR }));
12435
+ const month = capitalize2(dateFns.format(currentDate, "MMMM", { locale: locale.ptBR }));
11765
12436
  const year = dateFns.format(currentDate, "yyyy", { locale: locale.ptBR });
11766
12437
  const short = `${dayNum} de ${month} de ${year}`;
11767
12438
  const long = `${dateFns.format(currentDate, "EEE", {
@@ -11777,13 +12448,13 @@ function EventCalendar({
11777
12448
  const start = currentDate;
11778
12449
  const end = dateFns.addDays(currentDate, AgendaDaysToShow - 1);
11779
12450
  if (dateFns.isSameMonth(start, end)) {
11780
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
12451
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
11781
12452
  }
11782
- const s1 = capitalize(dateFns.format(start, "MMM", { locale: locale.ptBR }));
11783
- const s2 = capitalize(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
12453
+ const s1 = capitalize2(dateFns.format(start, "MMM", { locale: locale.ptBR }));
12454
+ const s2 = capitalize2(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
11784
12455
  return `${s1} - ${s2}`;
11785
12456
  }
11786
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
12457
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
11787
12458
  }, [currentDate, view]);
11788
12459
  const calendarContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11789
12460
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -13943,14 +14614,14 @@ var generateAdditionalColors = (baseColors, count) => {
13943
14614
  r /= 255;
13944
14615
  g /= 255;
13945
14616
  b /= 255;
13946
- const max = Math.max(r, g, b), min = Math.min(r, g, b);
14617
+ const max2 = Math.max(r, g, b), min2 = Math.min(r, g, b);
13947
14618
  let h = 0;
13948
14619
  let s = 0;
13949
- const l = (max + min) / 2;
13950
- if (max !== min) {
13951
- const d = max - min;
13952
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
13953
- switch (max) {
14620
+ const l = (max2 + min2) / 2;
14621
+ if (max2 !== min2) {
14622
+ const d = max2 - min2;
14623
+ s = l > 0.5 ? d / (2 - max2 - min2) : d / (max2 + min2);
14624
+ switch (max2) {
13954
14625
  case r:
13955
14626
  h = (g - b) / d + (g < b ? 6 : 0);
13956
14627
  break;
@@ -14067,25 +14738,25 @@ var computeNiceMax = (maxValue) => {
14067
14738
  return niceCeil(padded);
14068
14739
  };
14069
14740
  var getMaxDataValue = (data, keys) => {
14070
- let max = 0;
14741
+ let max2 = 0;
14071
14742
  for (const row of data) {
14072
14743
  for (const key of keys) {
14073
14744
  const v = row[key];
14074
- if (typeof v === "number" && Number.isFinite(v) && v > max) max = v;
14745
+ if (typeof v === "number" && Number.isFinite(v) && v > max2) max2 = v;
14075
14746
  }
14076
14747
  }
14077
- return max;
14748
+ return max2;
14078
14749
  };
14079
14750
  var getMinDataValue = (data, keys) => {
14080
- let min = 0;
14751
+ let min2 = 0;
14081
14752
  for (const row of data) {
14082
14753
  for (const key of keys) {
14083
14754
  const v = row[key];
14084
- if (typeof v === "number" && Number.isFinite(v) && v < min)
14085
- min = v;
14755
+ if (typeof v === "number" && Number.isFinite(v) && v < min2)
14756
+ min2 = v;
14086
14757
  }
14087
14758
  }
14088
- return min;
14759
+ return min2;
14089
14760
  };
14090
14761
  var computeChartWidth = (width, dataLength, series, niceMaxLeft, niceMaxRight) => {
14091
14762
  if (typeof width === "number") return width;
@@ -14131,8 +14802,8 @@ var createValueFormatter = (customFormatter, formatBR) => {
14131
14802
  });
14132
14803
  const prefixFormats = ["R$", "$", "\u20AC", "\xA3"];
14133
14804
  const suffixFormats = ["%", "kg", "km", "m", "L", "un", "t", "h", "min", "s"];
14134
- const getFormattedValue = (baseValue, format17) => {
14135
- const trimmedFormat = format17.trim();
14805
+ const getFormattedValue = (baseValue, format20) => {
14806
+ const trimmedFormat = format20.trim();
14136
14807
  if (prefixFormats.includes(trimmedFormat)) {
14137
14808
  return `${trimmedFormat} ${baseValue}`;
14138
14809
  }
@@ -14157,8 +14828,8 @@ var createValueFormatter = (customFormatter, formatBR) => {
14157
14828
  num = Number.isNaN(parsed) ? NaN : parsed;
14158
14829
  }
14159
14830
  const baseFormatted = formatBR && !Number.isNaN(num) ? nf.format(num) : String(formattedValue ?? value ?? "");
14160
- const format17 = propsDataKey && formatterMap[propsDataKey] ? formatterMap[propsDataKey] : "";
14161
- return format17 ? getFormattedValue(baseFormatted, format17) : baseFormatted;
14831
+ const format20 = propsDataKey && formatterMap[propsDataKey] ? formatterMap[propsDataKey] : "";
14832
+ return format20 ? getFormattedValue(baseFormatted, format20) : baseFormatted;
14162
14833
  };
14163
14834
  }
14164
14835
  if (typeof customFormatter === "function") {
@@ -18471,8 +19142,8 @@ var TimeSeries_default = TimeSeries;
18471
19142
  function NumericInput({
18472
19143
  value,
18473
19144
  onChange,
18474
- min,
18475
- max,
19145
+ min: min2,
19146
+ max: max2,
18476
19147
  label,
18477
19148
  className,
18478
19149
  error,
@@ -18489,21 +19160,21 @@ function NumericInput({
18489
19160
  if (!hasChanged || isLoading || disabled) return;
18490
19161
  onChange(internalValue);
18491
19162
  };
18492
- function handleNumberChange(value2, currentValue = 0, max2 = 9999999, min2 = 0) {
19163
+ function handleNumberChange(value2, currentValue = 0, max3 = 9999999, min3 = 0) {
18493
19164
  const numbersOnly = value2.replace(/\D/g, "");
18494
19165
  if (numbersOnly === "") {
18495
19166
  return 0;
18496
19167
  }
18497
19168
  const numValue = Number(numbersOnly);
18498
- if (numValue < min2) {
19169
+ if (numValue < min3) {
18499
19170
  if (tooltip_on_overflow) {
18500
- sonner.toast.warning("O valor deve ser maior que " + min2.toString());
19171
+ sonner.toast.warning("O valor deve ser maior que " + min3.toString());
18501
19172
  }
18502
- return min2;
19173
+ return min3;
18503
19174
  }
18504
- if (numValue > max2) {
19175
+ if (numValue > max3) {
18505
19176
  if (tooltip_on_overflow) {
18506
- sonner.toast.warning("O valor deve ser menor que " + max2.toString());
19177
+ sonner.toast.warning("O valor deve ser menor que " + max3.toString());
18507
19178
  }
18508
19179
  return currentValue;
18509
19180
  }
@@ -18525,8 +19196,8 @@ function NumericInput({
18525
19196
  const processedValue = handleNumberChange(
18526
19197
  e.currentTarget.value,
18527
19198
  internalValue,
18528
- max,
18529
- min
19199
+ max2,
19200
+ min2
18530
19201
  );
18531
19202
  setInternalValue(processedValue);
18532
19203
  },
@@ -19832,6 +20503,7 @@ exports.EndHourAgenda = EndHourAgenda;
19832
20503
  exports.ErrorMessage = ErrorMessage_default;
19833
20504
  exports.EventAgenda = EventAgenda;
19834
20505
  exports.EventCalendar = EventCalendar;
20506
+ exports.EventDetailModalAgenda = EventDetailModalAgenda;
19835
20507
  exports.EventDialog = EventDialog;
19836
20508
  exports.EventGap = EventGap;
19837
20509
  exports.EventGapAgenda = EventGapAgenda;
@@ -19876,6 +20548,7 @@ exports.MonthView = MonthView;
19876
20548
  exports.MonthViewAgenda = MonthViewAgenda;
19877
20549
  exports.MoreButton = MoreButton;
19878
20550
  exports.MultiCombobox = MultiCombobox;
20551
+ exports.MultiDayOverlay = MultiDayOverlay;
19879
20552
  exports.MultiSelect = MultiSelect;
19880
20553
  exports.MultiSelectBase = MultiSelectBase;
19881
20554
  exports.MultiSelectContentBase = MultiSelectContentBase;
@@ -20018,6 +20691,8 @@ exports.createYTickFormatter = createYTickFormatter;
20018
20691
  exports.detectDataFields = detectDataFields;
20019
20692
  exports.detectXAxis = detectXAxis;
20020
20693
  exports.display12HourValue = display12HourValue;
20694
+ exports.formatDurationAgenda = formatDurationAgenda;
20695
+ exports.formatDurationAgendaDays = formatDurationAgendaDays;
20021
20696
  exports.formatFieldName = formatFieldName;
20022
20697
  exports.formatLinePercentage = formatLinePercentage;
20023
20698
  exports.generateAdditionalColors = generateAdditionalColors;
@@ -20027,6 +20702,7 @@ exports.getAgendaEventsForDayAgenda = getAgendaEventsForDayAgenda;
20027
20702
  exports.getAllEventsForDay = getAllEventsForDay;
20028
20703
  exports.getAllEventsForDayAgenda = getAllEventsForDayAgenda;
20029
20704
  exports.getArrowByType = getArrowByType;
20705
+ exports.getAutoColorAgenda = getAutoColorAgenda;
20030
20706
  exports.getBorderRadiusClasses = getBorderRadiusClasses;
20031
20707
  exports.getBorderRadiusClassesAgenda = getBorderRadiusClassesAgenda;
20032
20708
  exports.getDateByType = getDateByType;