@mlw-packages/react-components 1.9.16 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,
@@ -9026,19 +9026,39 @@ function getEventColorClassesAgenda(color) {
9026
9026
  const eventColor = color || "sky";
9027
9027
  switch (eventColor) {
9028
9028
  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";
9029
+ 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
9030
  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";
9031
+ 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
9032
  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";
9033
+ 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
9034
  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";
9035
+ 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
9036
  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";
9037
+ 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
9038
  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";
9039
+ 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";
9040
+ case "green":
9041
+ 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";
9042
+ case "blue":
9043
+ 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";
9044
+ case "red":
9045
+ 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";
9046
+ case "purple":
9047
+ 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";
9048
+ case "indigo":
9049
+ 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";
9050
+ case "teal":
9051
+ 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";
9052
+ case "pink":
9053
+ 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";
9054
+ case "cyan":
9055
+ 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";
9056
+ case "lime":
9057
+ 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";
9058
+ case "fuchsia":
9059
+ 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
9060
  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";
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";
9042
9062
  }
9043
9063
  }
9044
9064
  function getBorderRadiusClassesAgenda(isFirstDay, isLastDay) {
@@ -9109,6 +9129,9 @@ function getEventEndDate(event) {
9109
9129
  if (start && typeof event.duration === "number" && !isNaN(event.duration)) {
9110
9130
  return addMinutesToDateAgenda(start, event.duration);
9111
9131
  }
9132
+ if (start && !event.allDay) {
9133
+ return addMinutesToDateAgenda(start, 60);
9134
+ }
9112
9135
  return void 0;
9113
9136
  }
9114
9137
  function isValidDate(d) {
@@ -9218,7 +9241,7 @@ function EventWrapper({
9218
9241
  "button",
9219
9242
  {
9220
9243
  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 ",
9244
+ "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
9245
  className?.includes("overflow-visible") ? "" : "overflow-hidden",
9223
9246
  colorClasses,
9224
9247
  getBorderRadiusClassesAgenda(isFirstDay, isLastDay),
@@ -9251,7 +9274,8 @@ function EventItemAgenda({
9251
9274
  dndAttributes,
9252
9275
  onMouseDown,
9253
9276
  onTouchStart,
9254
- agendaOnly = false
9277
+ agendaOnly = false,
9278
+ totalCols = 1
9255
9279
  }) {
9256
9280
  const eventColor = event.color;
9257
9281
  const startDate = getEventStartDate(event);
@@ -9309,7 +9333,7 @@ function EventItemAgenda({
9309
9333
  EventWrapper,
9310
9334
  {
9311
9335
  className: cn(
9312
- "mt-[var(--event-gap)] h-[var(--event-height)] items-center sm:text-xs",
9336
+ "mt-[var(--event-gap)] h-[var(--event-height)] items-center px-1.5 sm:px-3 py-1 sm:text-xs",
9313
9337
  className
9314
9338
  ),
9315
9339
  currentTime,
@@ -9337,13 +9361,58 @@ function EventItemAgenda({
9337
9361
  );
9338
9362
  }
9339
9363
  if (view === "week" || view === "day") {
9364
+ const isCompact = durationMinutes < 45;
9365
+ const isDay = view === "day";
9366
+ const tier = isDay ? 1 : totalCols >= 5 ? 3 : totalCols >= 3 ? 2 : 1;
9367
+ if (tier === 3) {
9368
+ return /* @__PURE__ */ jsxRuntime.jsx(
9369
+ "button",
9370
+ {
9371
+ type: "button",
9372
+ className: cn(
9373
+ "h-full w-full rounded border overflow-hidden cursor-pointer",
9374
+ colorClasses,
9375
+ className
9376
+ ),
9377
+ onClick,
9378
+ onMouseDown,
9379
+ onTouchStart,
9380
+ "aria-label": ariaLabel,
9381
+ ...dndListeners,
9382
+ ...dndAttributes
9383
+ }
9384
+ );
9385
+ }
9386
+ if (tier === 2) {
9387
+ return /* @__PURE__ */ jsxRuntime.jsx(
9388
+ EventWrapper,
9389
+ {
9390
+ className: cn(
9391
+ "h-full px-1 py-0.5 overflow-hidden text-[9px]",
9392
+ isCompact ? "flex-row items-center" : "flex-col items-start",
9393
+ className
9394
+ ),
9395
+ currentTime,
9396
+ dndAttributes,
9397
+ dndListeners,
9398
+ event,
9399
+ ariaLabel,
9400
+ isFirstDay,
9401
+ isLastDay,
9402
+ onClick,
9403
+ onMouseDown,
9404
+ onTouchStart,
9405
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold leading-none truncate w-full block", children: event.title })
9406
+ }
9407
+ );
9408
+ }
9340
9409
  return /* @__PURE__ */ jsxRuntime.jsx(
9341
9410
  EventWrapper,
9342
9411
  {
9343
9412
  className: cn(
9344
- "py-1",
9345
- durationMinutes < 45 ? "items-center" : "flex-col",
9346
- view === "week" ? "text-[10px] sm:text-xs" : "text-xs",
9413
+ "h-full py-0.5 px-1.5 overflow-hidden",
9414
+ isCompact ? "items-center flex-row" : "flex-col items-start",
9415
+ isDay ? "text-xs" : "text-[10px]",
9347
9416
  className
9348
9417
  ),
9349
9418
  currentTime,
@@ -9354,26 +9423,14 @@ function EventItemAgenda({
9354
9423
  isFirstDay,
9355
9424
  isLastDay,
9356
9425
  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() }) })
9426
+ onMouseDown,
9427
+ onTouchStart,
9428
+ children: isCompact ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 w-full min-w-0 overflow-hidden", children: [
9429
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-semibold leading-none min-w-0", children: event.title }),
9430
+ showTime && hasValidTime && displayStart && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 opacity-75 leading-none", children: formatTimeWithOptionalMinutes(displayStart) })
9431
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5 w-full min-w-0 overflow-hidden h-full", children: [
9432
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold leading-snug truncate", children: event.title }),
9433
+ showTime && hasValidTime && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "opacity-75 leading-none truncate", children: getEventTime() })
9377
9434
  ] })
9378
9435
  }
9379
9436
  );
@@ -9545,7 +9602,6 @@ function DayViewAgenda({
9545
9602
  });
9546
9603
  }, [dayEvents]);
9547
9604
  const positionedEvents = React32.useMemo(() => {
9548
- const result = [];
9549
9605
  const dayStart = dateFns.startOfDay(currentDate);
9550
9606
  const sortedEvents = [...timeEvents].sort((a, b) => {
9551
9607
  const aStart = getEventStartDate(a) ?? getEventEndDate(a) ?? /* @__PURE__ */ new Date();
@@ -9559,57 +9615,69 @@ function DayViewAgenda({
9559
9615
  return bDuration - aDuration;
9560
9616
  });
9561
9617
  const columns = [];
9618
+ const layouts = [];
9562
9619
  for (const event of sortedEvents) {
9563
9620
  const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
9564
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
9621
+ const rawEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
9622
+ const eventEnd = rawEnd <= eventStart ? new Date(eventStart.getTime() + 30 * 60 * 1e3) : rawEnd;
9565
9623
  const adjustedStart = dateFns.isSameDay(currentDate, eventStart) ? eventStart : dayStart;
9566
9624
  const adjustedEnd = dateFns.isSameDay(currentDate, eventEnd) ? eventEnd : dateFns.addHours(dayStart, 24);
9567
9625
  const startHour = dateFns.getHours(adjustedStart) + dateFns.getMinutes(adjustedStart) / 60;
9568
9626
  const endHour = dateFns.getHours(adjustedEnd) + dateFns.getMinutes(adjustedEnd) / 60;
9569
9627
  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
- }
9628
+ const height = Math.max(
9629
+ (endHour - startHour) * WeekCellsHeightAgenda,
9630
+ 24
9631
+ );
9632
+ let col = 0;
9633
+ while (true) {
9634
+ const colSlots = columns[col] ?? [];
9635
+ const hasConflict = colSlots.some(
9636
+ (slot) => dateFns.areIntervalsOverlapping(
9637
+ { start: adjustedStart, end: adjustedEnd },
9638
+ { start: slot.start, end: slot.end },
9639
+ { inclusive: false }
9640
+ )
9641
+ );
9642
+ if (!hasConflict) break;
9643
+ col++;
9593
9644
  }
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({
9645
+ if (!columns[col]) columns[col] = [];
9646
+ columns[col].push({ start: adjustedStart, end: adjustedEnd });
9647
+ layouts.push({
9604
9648
  event,
9605
- height,
9606
- left,
9649
+ adjustedStart,
9650
+ adjustedEnd,
9607
9651
  top,
9608
- width,
9609
- zIndex: 10 + columnIndex
9652
+ height,
9653
+ col,
9654
+ totalCols: 0
9610
9655
  });
9611
9656
  }
9612
- return result;
9657
+ for (const layout of layouts) {
9658
+ let maxCol = layout.col;
9659
+ for (const other of layouts) {
9660
+ if (other === layout) continue;
9661
+ if (dateFns.areIntervalsOverlapping(
9662
+ { start: layout.adjustedStart, end: layout.adjustedEnd },
9663
+ { start: other.adjustedStart, end: other.adjustedEnd },
9664
+ { inclusive: false }
9665
+ )) {
9666
+ maxCol = Math.max(maxCol, other.col);
9667
+ }
9668
+ }
9669
+ layout.totalCols = maxCol + 1;
9670
+ }
9671
+ return layouts.map(
9672
+ ({ event, top, height, col, totalCols }) => ({
9673
+ event,
9674
+ top,
9675
+ height,
9676
+ left: col / totalCols,
9677
+ width: 1 / totalCols,
9678
+ zIndex: 10 + col
9679
+ })
9680
+ );
9613
9681
  }, [currentDate, timeEvents]);
9614
9682
  const handleEventClick = (event, e) => {
9615
9683
  e.stopPropagation();
@@ -9644,7 +9712,7 @@ function DayViewAgenda({
9644
9712
  "div",
9645
9713
  {
9646
9714
  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") })
9715
+ 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
9716
  },
9649
9717
  hour.toString()
9650
9718
  )) }),
@@ -10033,25 +10101,25 @@ function EventAgenda({
10033
10101
  return condensed ? entry.short : entry.full;
10034
10102
  };
10035
10103
  const viewTitle = React32.useMemo(() => {
10036
- const capitalize = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
10104
+ const capitalize2 = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
10037
10105
  if (view === "month")
10038
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10106
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10039
10107
  if (view === "week") {
10040
10108
  const start = dateFns.startOfWeek(currentDate, { weekStartsOn: 1 });
10041
10109
  const end = dateFns.endOfWeek(currentDate, { weekStartsOn: 1 });
10042
10110
  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 }));
10111
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10112
+ const s1 = capitalize2(dateFns.format(start, "MMM", { locale: locale.ptBR }));
10113
+ const s2 = capitalize2(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
10046
10114
  return `${s1} - ${s2}`;
10047
10115
  }
10048
10116
  if (view === "day")
10049
10117
  return dateFns.format(currentDate, "d 'de' MMMM 'de' yyyy", { locale: locale.ptBR });
10050
10118
  if (view === "agenda") {
10051
10119
  const start = currentDate;
10052
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10120
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10053
10121
  }
10054
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10122
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10055
10123
  }, [currentDate, view]);
10056
10124
  const selectItems = ["month", "week", "day", "agenda"].map((v) => ({
10057
10125
  label: viewLabel(v),
@@ -10238,6 +10306,159 @@ function useEventVisibilityAgenda({
10238
10306
  getVisibleEventCount
10239
10307
  };
10240
10308
  }
10309
+ function clampToWeek(date, weekStart, weekEnd) {
10310
+ return dateFns.max([dateFns.min([date, weekEnd]), weekStart]);
10311
+ }
10312
+ function dayCol(date, weekStart) {
10313
+ const diff = Math.round(
10314
+ (date.getTime() - weekStart.getTime()) / (1e3 * 60 * 60 * 24)
10315
+ );
10316
+ return Math.max(0, Math.min(6, diff));
10317
+ }
10318
+ function computeMultiDayBars(events, weekDays) {
10319
+ const weekStart = weekDays[0];
10320
+ const weekEnd = weekDays[6];
10321
+ const multiDayEvents = events.filter((ev) => {
10322
+ if (!isMultiDayEventAgenda(ev)) return false;
10323
+ const start = getEventStartDate(ev);
10324
+ const end = getEventEndDate(ev) ?? start;
10325
+ if (!start || !end) return false;
10326
+ return start <= weekEnd && end >= weekStart;
10327
+ });
10328
+ const sorted = [...multiDayEvents].sort((a, b) => {
10329
+ const aS = getEventStartDate(a) ?? /* @__PURE__ */ new Date(0);
10330
+ const bS = getEventStartDate(b) ?? /* @__PURE__ */ new Date(0);
10331
+ const aE = getEventEndDate(a) ?? aS;
10332
+ const bE = getEventEndDate(b) ?? bS;
10333
+ const diff = bE.getTime() - bS.getTime() - (aE.getTime() - aS.getTime());
10334
+ return diff !== 0 ? diff : aS.getTime() - bS.getTime();
10335
+ });
10336
+ const slotOccupancy = [];
10337
+ const bars = [];
10338
+ for (const event of sorted) {
10339
+ const evStart = getEventStartDate(event);
10340
+ const evEnd = getEventEndDate(event) ?? evStart;
10341
+ const cStart = clampToWeek(evStart, weekStart, weekEnd);
10342
+ const cEnd = clampToWeek(evEnd, weekStart, weekEnd);
10343
+ const sc = dayCol(cStart, weekStart);
10344
+ const ec = dayCol(cEnd, weekStart);
10345
+ let slot = 0;
10346
+ for (; ; ) {
10347
+ if (!slotOccupancy[slot]) slotOccupancy[slot] = Array(7).fill(false);
10348
+ let free = true;
10349
+ for (let c = sc; c <= ec; c++) {
10350
+ if (slotOccupancy[slot][c]) {
10351
+ free = false;
10352
+ break;
10353
+ }
10354
+ }
10355
+ if (free) {
10356
+ for (let c = sc; c <= ec; c++) slotOccupancy[slot][c] = true;
10357
+ break;
10358
+ }
10359
+ slot++;
10360
+ }
10361
+ bars.push({
10362
+ event,
10363
+ colStart: sc,
10364
+ colSpan: ec - sc + 1,
10365
+ isFirstDay: dateFns.isSameDay(cStart, evStart),
10366
+ isLastDay: dateFns.isSameDay(cEnd, evEnd),
10367
+ slot
10368
+ });
10369
+ }
10370
+ return bars;
10371
+ }
10372
+ function formatDuration(event) {
10373
+ const start = getEventStartDate(event);
10374
+ const end = getEventEndDate(event);
10375
+ if (!start) return "";
10376
+ const fmt = (d) => dateFns.format(d, "d 'de' MMM", { locale: locale.ptBR });
10377
+ if (!end || dateFns.isSameDay(start, end)) {
10378
+ return fmt(start) + (event.allDay ? " \xB7 Dia todo" : " \xB7 " + dateFns.format(start, "HH:mm"));
10379
+ }
10380
+ const days = dateFns.differenceInCalendarDays(end, start) + 1;
10381
+ return `${fmt(start)} \u2192 ${fmt(end)} \xB7 ${days} dias`;
10382
+ }
10383
+ function MultiDayOverlay({
10384
+ bars,
10385
+ weekIndex,
10386
+ hoveredEventId,
10387
+ onHover,
10388
+ onEventSelect
10389
+ }) {
10390
+ if (bars.length === 0) return null;
10391
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 pointer-events-none mt-1", children: bars.map((bar) => {
10392
+ const { event, colStart, colSpan, isFirstDay, isLastDay, slot } = bar;
10393
+ const isHovered = hoveredEventId === event.id;
10394
+ const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10395
+ const continuesFromPrev = !isFirstDay;
10396
+ const continuesToNext = !isLastDay;
10397
+ return /* @__PURE__ */ jsxRuntime.jsx(
10398
+ TooltipProviderBase,
10399
+ {
10400
+ delayDuration: 400,
10401
+ children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
10402
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
10403
+ "div",
10404
+ {
10405
+ className: "absolute pointer-events-auto px-1.5",
10406
+ style: {
10407
+ left: continuesFromPrev ? `${colStart / 7 * 100}%` : `calc(${colStart / 7 * 100}% + 3px)`,
10408
+ right: continuesToNext ? `${100 - (colStart + colSpan) / 7 * 100}%` : `calc(${100 - (colStart + colSpan) / 7 * 100}% + 3px)`,
10409
+ top: `calc(34px + ${slot} * (var(--event-height) + var(--event-gap)) + var(--event-gap))`,
10410
+ zIndex: isHovered ? 10 : 1
10411
+ },
10412
+ onMouseEnter: () => onHover(event.id),
10413
+ onMouseLeave: () => onHover(null),
10414
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10415
+ EventItemAgenda,
10416
+ {
10417
+ event,
10418
+ isFirstDay,
10419
+ isLastDay,
10420
+ onClick: (e) => {
10421
+ e.stopPropagation();
10422
+ onEventSelect(event, e);
10423
+ },
10424
+ view: "month",
10425
+ className: cn("w-full", isHovered && "[filter:brightness(0.92)]"),
10426
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-0.5 w-full min-w-0", children: [
10427
+ 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" }) }),
10428
+ !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") }),
10429
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-[11px] sm:text-xs truncate min-w-0 leading-none flex-1", children: event.title }),
10430
+ isFirstDay && (() => {
10431
+ const evStart = getEventStartDate(event);
10432
+ const evEnd = getEventEndDate(event);
10433
+ if (!evStart || !evEnd) return null;
10434
+ const totalDays = dateFns.differenceInCalendarDays(evEnd, evStart) + 1;
10435
+ if (totalDays < 2) return null;
10436
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "shrink-0 font-bold leading-none text-[10px] opacity-55 ml-0.5", children: [
10437
+ totalDays,
10438
+ "d"
10439
+ ] });
10440
+ })(),
10441
+ 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" }) })
10442
+ ] })
10443
+ }
10444
+ )
10445
+ }
10446
+ ) }),
10447
+ /* @__PURE__ */ jsxRuntime.jsxs(TooltipContentBase, { side: "top", children: [
10448
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold truncate max-w-[200px]", children: event.title }),
10449
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "opacity-80 mt-0.5 leading-snug", children: formatDuration(event) }),
10450
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "opacity-60 mt-0.5 truncate text-[11px] max-w-[200px]", children: [
10451
+ /* @__PURE__ */ jsxRuntime.jsx(react.MapPinIcon, { size: 15 }),
10452
+ " ",
10453
+ event.location
10454
+ ] })
10455
+ ] })
10456
+ ] })
10457
+ },
10458
+ `bar-${event.id}-w${weekIndex}`
10459
+ );
10460
+ }) });
10461
+ }
10241
10462
  function MonthViewAgenda({
10242
10463
  currentDate,
10243
10464
  events,
@@ -10251,13 +10472,14 @@ function MonthViewAgenda({
10251
10472
  const calendarEnd = dateFns.endOfWeek(monthEnd, { weekStartsOn: 0 });
10252
10473
  return dateFns.eachDayOfInterval({ end: calendarEnd, start: calendarStart });
10253
10474
  }, [currentDate]);
10254
- const weekdays = React32.useMemo(() => {
10255
- return Array.from({ length: 7 }).map((_, i) => {
10475
+ const weekdays = React32.useMemo(
10476
+ () => Array.from({ length: 7 }).map((_, i) => {
10256
10477
  const date = dateFns.addDays(dateFns.startOfWeek(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
10257
10478
  const short = dateFns.format(date, "EEE", { locale: locale.ptBR });
10258
10479
  return short.charAt(0).toUpperCase() + short.slice(1);
10259
- });
10260
- }, []);
10480
+ }),
10481
+ []
10482
+ );
10261
10483
  const weeks = React32.useMemo(() => {
10262
10484
  const result = [];
10263
10485
  let week = [];
@@ -10270,11 +10492,24 @@ function MonthViewAgenda({
10270
10492
  }
10271
10493
  return result;
10272
10494
  }, [days]);
10273
- const handleEventClick = (event, e) => {
10274
- e.stopPropagation();
10275
- onEventSelect(event, e);
10276
- };
10495
+ const todayColIndex = React32.useMemo(() => (/* @__PURE__ */ new Date()).getDay(), []);
10277
10496
  const [isMounted, setIsMounted] = React32.useState(false);
10497
+ const [hoveredEventId, setHoveredEventId] = React32.useState(null);
10498
+ const hoverLeaveTimerRef = React32.useRef(null);
10499
+ const handleHover = React32.useCallback((id) => {
10500
+ if (id !== null) {
10501
+ if (hoverLeaveTimerRef.current) {
10502
+ clearTimeout(hoverLeaveTimerRef.current);
10503
+ hoverLeaveTimerRef.current = null;
10504
+ }
10505
+ setHoveredEventId(id);
10506
+ } else {
10507
+ hoverLeaveTimerRef.current = setTimeout(() => {
10508
+ setHoveredEventId(null);
10509
+ hoverLeaveTimerRef.current = null;
10510
+ }, 150);
10511
+ }
10512
+ }, []);
10278
10513
  const { contentRef, getVisibleEventCount } = useEventVisibilityAgenda({
10279
10514
  eventGap: EventGapAgenda,
10280
10515
  eventHeight: EventHeightAgenda
@@ -10282,202 +10517,221 @@ function MonthViewAgenda({
10282
10517
  React32.useEffect(() => {
10283
10518
  setIsMounted(true);
10284
10519
  }, []);
10520
+ const eventsWithStart = React32.useMemo(
10521
+ () => events.filter((ev) => {
10522
+ try {
10523
+ if (ev.start == null) return false;
10524
+ const t = ev.start instanceof Date ? ev.start.getTime() : new Date(String(ev.start)).getTime();
10525
+ return !isNaN(t);
10526
+ } catch {
10527
+ return false;
10528
+ }
10529
+ }),
10530
+ [events]
10531
+ );
10532
+ const handleEventClick = (event, e) => {
10533
+ e.stopPropagation();
10534
+ onEventSelect(event, e);
10535
+ };
10285
10536
  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,
10537
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 border-border/70 border-b", children: weekdays.map((day, i) => {
10538
+ const isTodayCol = i === todayColIndex;
10539
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10540
+ "div",
10541
+ {
10542
+ className: cn(
10543
+ "py-1.5 px-1 text-center text-xs uppercase sm:tracking-wide leading-none transition-colors",
10544
+ 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"
10545
+ ),
10546
+ children: [
10547
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: day }),
10548
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline sm:hidden", children: day.charAt(0) })
10549
+ ]
10550
+ },
10551
+ day
10552
+ );
10553
+ }) }),
10554
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid flex-1 auto-rows-fr", children: weeks.map((week, weekIndex) => {
10555
+ const multiDayBars = computeMultiDayBars(eventsWithStart, week);
10556
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10557
+ "div",
10558
+ {
10559
+ className: "grid grid-cols-7 [&:last-child>*]:border-b-0 relative p-0",
10560
+ children: [
10561
+ week.map((day, dayIndex) => {
10562
+ if (!day) return null;
10563
+ const isTodayCell = dateFns.isToday(day);
10564
+ const isTodayCol = dayIndex === todayColIndex;
10565
+ const isCurrentMonth = dateFns.isSameMonth(day, currentDate);
10566
+ const cellId = `month-cell-${day.toISOString()}`;
10567
+ const dayEvents = getEventsForDayAgenda(eventsWithStart, day);
10568
+ const spanningEvents = getSpanningEventsForDayAgenda(
10569
+ eventsWithStart,
10570
+ day
10571
+ );
10572
+ const allDayEvents = [...spanningEvents, ...dayEvents];
10573
+ const allEvents = getAllEventsForDayAgenda(events, day);
10574
+ const isReferenceCell = weekIndex === 0 && dayIndex === 0;
10575
+ const dayBars = multiDayBars.filter(
10576
+ (b) => dayIndex >= b.colStart && dayIndex < b.colStart + b.colSpan
10577
+ );
10578
+ const dayMaxSlot = dayBars.length > 0 ? Math.max(...dayBars.map((b) => b.slot)) : -1;
10579
+ const dayMultiDayRowCount = dayMaxSlot + 1;
10580
+ const singleEvents = sortEventsAgenda(allDayEvents).filter(
10581
+ (e) => !isMultiDayEventAgenda(e)
10582
+ );
10583
+ const visibleCount = isMounted ? getVisibleEventCount(
10584
+ singleEvents.length + dayMultiDayRowCount
10585
+ ) : void 0;
10586
+ const visibleAfterMultiday = visibleCount !== void 0 ? Math.max(0, visibleCount - dayMultiDayRowCount) : void 0;
10587
+ const hasMore = visibleAfterMultiday !== void 0 && singleEvents.length > visibleAfterMultiday;
10588
+ const remainingCount = hasMore ? singleEvents.length - (visibleAfterMultiday ?? 0) : 0;
10589
+ return /* @__PURE__ */ jsxRuntime.jsx(
10590
+ "div",
10333
10591
  {
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" : ""
10592
+ "data-outside-cell": !isCurrentMonth || void 0,
10593
+ "data-today": isTodayCell || void 0,
10594
+ className: cn(
10595
+ "group border-border/70 border-r border-b last:border-r-0 transition-colors py-0.5 relative",
10596
+ !isCurrentMonth && "bg-muted/20 text-muted-foreground/60",
10597
+ isTodayCol && isCurrentMonth && !isTodayCell && "bg-blue-50/20 dark:bg-blue-950/10",
10598
+ isTodayCell && "bg-blue-50/50 dark:bg-blue-950/20",
10599
+ "hover:bg-muted/5"
10600
+ ),
10601
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
10602
+ DroppableCellAgenda,
10603
+ {
10604
+ date: day,
10605
+ id: cellId,
10606
+ onClick: () => {
10607
+ const t = new Date(day);
10608
+ t.setHours(DefaultStartHourAgenda, 0, 0);
10609
+ },
10610
+ children: [
10611
+ /* @__PURE__ */ jsxRuntime.jsx(
10612
+ "div",
10613
+ {
10614
+ className: tailwindMerge.twMerge(
10615
+ "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",
10616
+ isTodayCell ? "bg-blue-500 text-white border-blue-500 shadow-sm shadow-blue-400/40" : "text-muted-foreground border-transparent"
10617
+ ),
10618
+ children: dateFns.format(day, "d")
10619
+ }
10347
10620
  ),
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(
10371
- EventItemAgenda,
10372
- {
10373
- event,
10374
- isFirstDay,
10375
- isLastDay,
10376
- 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
- );
10384
- }
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,
10621
+ /* @__PURE__ */ jsxRuntime.jsxs(
10622
+ "div",
10623
+ {
10624
+ ref: isReferenceCell ? contentRef : null,
10625
+ 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",
10626
+ children: [
10627
+ Array.from({ length: dayMultiDayRowCount }).map(
10628
+ (_, si) => /* @__PURE__ */ jsxRuntime.jsx(
10629
+ "div",
10393
10630
  {
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
- }
10631
+ "aria-hidden": "true",
10632
+ className: "mt-[var(--event-gap)] h-[var(--event-height)] w-full",
10633
+ style: { opacity: 0, pointerEvents: "none" }
10634
+ },
10635
+ `spacer-${si}`
10411
10636
  )
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(
10637
+ ),
10638
+ singleEvents.map((event, index) => {
10639
+ if (!isMounted) return null;
10640
+ const isHidden = visibleAfterMultiday !== void 0 && index >= visibleAfterMultiday;
10641
+ const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10642
+ return /* @__PURE__ */ jsxRuntime.jsx(
10643
+ "div",
10644
+ {
10645
+ "aria-hidden": isHidden ? "true" : void 0,
10646
+ className: "aria-hidden:hidden",
10647
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10453
10648
  EventItemAgenda,
10454
10649
  {
10455
10650
  event,
10456
- isFirstDay,
10457
- isLastDay,
10651
+ isFirstDay: true,
10652
+ isLastDay: true,
10458
10653
  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
- )) }),
10654
+ view: "month",
10655
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 sm:gap-1.5 truncate text-[11px] relative z-10", children: [
10656
+ !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") }),
10657
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold truncate", children: event.title })
10658
+ ] })
10659
+ }
10660
+ )
10661
+ },
10662
+ event.id
10663
+ );
10664
+ })
10665
+ ]
10666
+ }
10667
+ ),
10668
+ hasMore && /* @__PURE__ */ jsxRuntime.jsxs(PopoverBase, { modal: true, children: [
10669
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
10670
+ "button",
10671
+ {
10672
+ type: "button",
10673
+ onClick: (e) => e.stopPropagation(),
10674
+ "aria-label": `Mostrar mais ${remainingCount} eventos`,
10675
+ 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",
10676
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-semibold", children: [
10677
+ "+ ",
10678
+ remainingCount,
10679
+ " ",
10680
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: "mais" })
10681
+ ] })
10682
+ }
10683
+ ) }),
10684
+ /* @__PURE__ */ jsxRuntime.jsx(
10685
+ PopoverContentBase,
10686
+ {
10687
+ align: "center",
10688
+ className: "max-w-52 p-3",
10689
+ style: {
10690
+ "--event-height": `${EventHeightAgenda}px`
10691
+ },
10692
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
10693
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm", children: dateFns.format(day, "EEE d", { locale: locale.ptBR }) }),
10694
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: sortEventsAgenda(allEvents).map((event) => {
10695
+ const s = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10696
+ const e2 = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10697
+ return /* @__PURE__ */ jsxRuntime.jsx(
10698
+ EventItemAgenda,
10699
+ {
10700
+ event,
10701
+ isFirstDay: dateFns.isSameDay(day, s),
10702
+ isLastDay: dateFns.isSameDay(day, e2),
10703
+ onClick: (e) => handleEventClick(event, e),
10704
+ view: "month"
10705
+ },
10706
+ event.id
10707
+ );
10708
+ }) })
10709
+ ] })
10710
+ }
10711
+ )
10712
+ ] })
10713
+ ]
10714
+ }
10715
+ )
10716
+ },
10717
+ day.toString()
10718
+ );
10719
+ }),
10720
+ /* @__PURE__ */ jsxRuntime.jsx(
10721
+ MultiDayOverlay,
10722
+ {
10723
+ bars: multiDayBars,
10724
+ weekIndex,
10725
+ hoveredEventId,
10726
+ onHover: handleHover,
10727
+ onEventSelect
10728
+ }
10729
+ )
10730
+ ]
10731
+ },
10732
+ `week-${weekIndex}`
10733
+ );
10734
+ }) }),
10481
10735
  /* @__PURE__ */ jsxRuntime.jsx(
10482
10736
  UndatedEvents,
10483
10737
  {
@@ -10510,7 +10764,8 @@ function DraggableEvent({
10510
10764
  isFirstDay = true,
10511
10765
  isLastDay = true,
10512
10766
  "aria-hidden": ariaHidden,
10513
- draggable = true
10767
+ draggable = true,
10768
+ totalCols
10514
10769
  }) {
10515
10770
  const { activeId } = useCalendarDndAgenda();
10516
10771
  const elementRef = React32.useRef(null);
@@ -10595,7 +10850,8 @@ function DraggableEvent({
10595
10850
  onMouseDown: handleMouseDown,
10596
10851
  onTouchStart: handleTouchStart,
10597
10852
  showTime,
10598
- view
10853
+ view,
10854
+ totalCols
10599
10855
  }
10600
10856
  )
10601
10857
  }
@@ -10609,14 +10865,10 @@ function WeekViewAgenda({
10609
10865
  showUndatedEvents
10610
10866
  }) {
10611
10867
  const days = React32.useMemo(() => {
10612
- const weekStart2 = dateFns.startOfWeek(currentDate, { weekStartsOn: 0 });
10868
+ const weekStart = dateFns.startOfWeek(currentDate, { weekStartsOn: 0 });
10613
10869
  const weekEnd = dateFns.endOfWeek(currentDate, { weekStartsOn: 0 });
10614
- return dateFns.eachDayOfInterval({ end: weekEnd, start: weekStart2 });
10870
+ return dateFns.eachDayOfInterval({ end: weekEnd, start: weekStart });
10615
10871
  }, [currentDate]);
10616
- const weekStart = React32.useMemo(
10617
- () => dateFns.startOfWeek(currentDate, { weekStartsOn: 0 }),
10618
- [currentDate]
10619
- );
10620
10872
  const hours = React32.useMemo(() => {
10621
10873
  const dayStart = dateFns.startOfDay(currentDate);
10622
10874
  return dateFns.eachHourOfInterval({
@@ -10649,6 +10901,25 @@ function WeekViewAgenda({
10649
10901
  });
10650
10902
  });
10651
10903
  }, [events, days]);
10904
+ const trueAllDayEvents = React32.useMemo(
10905
+ () => allDayEvents.filter((e) => e.allDay),
10906
+ [allDayEvents]
10907
+ );
10908
+ const multiDayTimedEvents = React32.useMemo(
10909
+ () => allDayEvents.filter((e) => !e.allDay),
10910
+ [allDayEvents]
10911
+ );
10912
+ const rowH = EventHeightAgenda + EventGapAgenda;
10913
+ const allDayBarData = React32.useMemo(() => {
10914
+ const bars = computeMultiDayBars(trueAllDayEvents, days);
10915
+ const maxSlot = bars.length > 0 ? Math.max(...bars.map((b) => b.slot)) : 0;
10916
+ return { bars, sectionH: (maxSlot + 1) * rowH + EventGapAgenda * 2 };
10917
+ }, [trueAllDayEvents, days, rowH]);
10918
+ const multiDayBarData = React32.useMemo(() => {
10919
+ const bars = computeMultiDayBars(multiDayTimedEvents, days);
10920
+ const maxSlot = bars.length > 0 ? Math.max(...bars.map((b) => b.slot)) : 0;
10921
+ return { bars, sectionH: (maxSlot + 1) * rowH + EventGapAgenda * 2 };
10922
+ }, [multiDayTimedEvents, days, rowH]);
10652
10923
  const processedDayEvents = React32.useMemo(() => {
10653
10924
  const result = days.map((day) => {
10654
10925
  const dayEvents = events.filter((event) => {
@@ -10669,56 +10940,69 @@ function WeekViewAgenda({
10669
10940
  const bDuration = dateFns.differenceInMinutes(bEnd, bStart);
10670
10941
  return bDuration - aDuration;
10671
10942
  });
10672
- const positionedEvents = [];
10673
10943
  const dayStart = dateFns.startOfDay(day);
10674
10944
  const columns = [];
10945
+ const layouts = [];
10675
10946
  for (const event of sortedEvents) {
10676
10947
  const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10677
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10948
+ const rawEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10949
+ const eventEnd = rawEnd <= eventStart ? new Date(eventStart.getTime() + 30 * 60 * 1e3) : rawEnd;
10678
10950
  const adjustedStart = dateFns.isSameDay(day, eventStart) ? eventStart : dayStart;
10679
10951
  const adjustedEnd = dateFns.isSameDay(day, eventEnd) ? eventEnd : dateFns.addHours(dayStart, 24);
10680
10952
  const startHour = dateFns.getHours(adjustedStart) + dateFns.getMinutes(adjustedStart) / 60;
10681
10953
  const endHour = dateFns.getHours(adjustedEnd) + dateFns.getMinutes(adjustedEnd) / 60;
10682
10954
  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
- }
10955
+ const height = Math.max(
10956
+ (endHour - startHour) * WeekCellsHeightAgenda,
10957
+ 24
10958
+ );
10959
+ let col = 0;
10960
+ while (true) {
10961
+ const colSlots = columns[col] ?? [];
10962
+ const hasConflict = colSlots.some(
10963
+ (slot) => dateFns.areIntervalsOverlapping(
10964
+ { start: adjustedStart, end: adjustedEnd },
10965
+ { start: slot.start, end: slot.end },
10966
+ { inclusive: false }
10967
+ )
10968
+ );
10969
+ if (!hasConflict) break;
10970
+ col++;
10706
10971
  }
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({
10972
+ if (!columns[col]) columns[col] = [];
10973
+ columns[col].push({ start: adjustedStart, end: adjustedEnd });
10974
+ layouts.push({
10713
10975
  event,
10714
- height,
10715
- left,
10976
+ adjustedStart,
10977
+ adjustedEnd,
10716
10978
  top,
10717
- width,
10718
- zIndex: 10 + columnIndex
10979
+ height,
10980
+ col,
10981
+ totalCols: 0
10719
10982
  });
10720
10983
  }
10721
- return positionedEvents;
10984
+ for (const layout of layouts) {
10985
+ let maxCol = layout.col;
10986
+ for (const other of layouts) {
10987
+ if (other === layout) continue;
10988
+ if (dateFns.areIntervalsOverlapping(
10989
+ { start: layout.adjustedStart, end: layout.adjustedEnd },
10990
+ { start: other.adjustedStart, end: other.adjustedEnd },
10991
+ { inclusive: false }
10992
+ )) {
10993
+ maxCol = Math.max(maxCol, other.col);
10994
+ }
10995
+ }
10996
+ layout.totalCols = maxCol + 1;
10997
+ }
10998
+ return layouts.map(({ event, top, height, col, totalCols }) => ({
10999
+ event,
11000
+ top,
11001
+ height,
11002
+ left: col / totalCols,
11003
+ width: 1 / totalCols,
11004
+ zIndex: 10 + col
11005
+ }));
10722
11006
  });
10723
11007
  return result;
10724
11008
  }, [days, events]);
@@ -10728,178 +11012,476 @@ function WeekViewAgenda({
10728
11012
  };
10729
11013
  const showAllDaySection = allDayEvents.length > 0;
10730
11014
  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(
11015
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden", "data-slot": "week-view", children: [
11016
+ /* @__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: [
11017
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background", children: [
11018
+ /* @__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") }) }),
11019
+ days.map((day) => /* @__PURE__ */ jsxRuntime.jsxs(
10761
11020
  "div",
10762
11021
  {
10763
- className: "relative border-border/70 border-r p-1 last:border-r-0",
11022
+ className: "py-2 text-center text-muted-foreground/70 text-[10px] sm:text-sm data-today:font-medium data-today:text-foreground",
10764
11023
  "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
- })
11024
+ children: [
11025
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": "true", className: "sm:hidden", children: [
11026
+ dateFns.format(day, "EEE", { locale: locale.ptBR })[0],
11027
+ " ",
11028
+ dateFns.format(day, "d", { locale: locale.ptBR })
11029
+ ] }),
11030
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline md:hidden", children: dateFns.format(day, "EEE d", { locale: locale.ptBR }) }),
11031
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-md:hidden", children: dateFns.format(day, "EEE dd", { locale: locale.ptBR }) })
11032
+ ]
10795
11033
  },
10796
11034
  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,
11035
+ ))
11036
+ ] }),
11037
+ showAllDaySection && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border/70 border-b bg-muted/50", children: [
11038
+ trueAllDayEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-8", children: [
11039
+ /* @__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" }) }),
11040
+ /* @__PURE__ */ jsxRuntime.jsxs(
11041
+ "div",
11042
+ {
11043
+ className: "col-span-7 relative",
11044
+ style: { height: allDayBarData.sectionH },
11045
+ children: [
11046
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grid grid-cols-7 pointer-events-none", children: days.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
11047
+ "div",
10829
11048
  {
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
- }
11049
+ className: "border-r last:border-r-0 border-border/70",
11050
+ "data-today": dateFns.isToday(day) || void 0
11051
+ },
11052
+ day.toString()
11053
+ )) }),
11054
+ allDayBarData.bars.map((bar) => {
11055
+ const {
11056
+ event,
11057
+ colStart,
11058
+ colSpan,
11059
+ isFirstDay,
11060
+ isLastDay,
11061
+ slot
11062
+ } = bar;
11063
+ const showTitle = isFirstDay || !isFirstDay && colStart === 0;
11064
+ return /* @__PURE__ */ jsxRuntime.jsx(
11065
+ "div",
11066
+ {
11067
+ className: "absolute px-0.5",
11068
+ style: {
11069
+ left: `calc(${colStart / 7 * 100}% + 2px)`,
11070
+ width: `calc(${colSpan / 7 * 100}% - 4px)`,
11071
+ top: EventGapAgenda + slot * rowH,
11072
+ height: EventHeightAgenda
11073
+ },
11074
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11075
+ EventItemAgenda,
11076
+ {
11077
+ event,
11078
+ isFirstDay,
11079
+ isLastDay,
11080
+ onClick: (e) => {
11081
+ e.stopPropagation();
11082
+ handleEventClick(event, e);
11083
+ },
11084
+ view: "month",
11085
+ className: "h-full",
11086
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 min-w-0 w-full", children: [
11087
+ !isFirstDay && colStart === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretLeftIcon, {}) }),
11088
+ showTitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium", children: event.title }),
11089
+ !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, {}) })
11090
+ ] })
11091
+ }
11092
+ )
11093
+ },
11094
+ event.id
11095
+ );
11096
+ })
11097
+ ]
11098
+ }
11099
+ )
11100
+ ] }),
11101
+ multiDayTimedEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
11102
+ "div",
11103
+ {
11104
+ className: cn(
11105
+ "grid grid-cols-8",
11106
+ trueAllDayEvents.length > 0 && "border-t border-border/40"
10851
11107
  ),
10852
- hours.map((hour) => {
10853
- const hourValue = dateFns.getHours(hour);
10854
- return /* @__PURE__ */ jsxRuntime.jsx(
11108
+ children: [
11109
+ /* @__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" }) }),
11110
+ /* @__PURE__ */ jsxRuntime.jsxs(
10855
11111
  "div",
10856
11112
  {
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,
11113
+ className: "col-span-7 relative",
11114
+ style: { height: multiDayBarData.sectionH },
11115
+ children: [
11116
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grid grid-cols-7 pointer-events-none", children: days.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
11117
+ "div",
10862
11118
  {
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);
11119
+ className: "border-r last:border-r-0 border-border/70",
11120
+ "data-today": dateFns.isToday(day) || void 0
11121
+ },
11122
+ day.toString()
11123
+ )) }),
11124
+ multiDayBarData.bars.map((bar) => {
11125
+ const {
11126
+ event,
11127
+ colStart,
11128
+ colSpan,
11129
+ isFirstDay,
11130
+ isLastDay,
11131
+ slot
11132
+ } = bar;
11133
+ const eventStart = getEventStartDate(event) ?? /* @__PURE__ */ new Date();
11134
+ const showTitle = isFirstDay || !isFirstDay && colStart === 0;
11135
+ return /* @__PURE__ */ jsxRuntime.jsx(
11136
+ "div",
11137
+ {
11138
+ className: "absolute px-0.5",
11139
+ style: {
11140
+ left: `calc(${colStart / 7 * 100}% + 2px)`,
11141
+ width: `calc(${colSpan / 7 * 100}% - 4px)`,
11142
+ top: EventGapAgenda + slot * rowH,
11143
+ height: EventHeightAgenda
11144
+ },
11145
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11146
+ EventItemAgenda,
11147
+ {
11148
+ event,
11149
+ isFirstDay,
11150
+ isLastDay,
11151
+ onClick: (e) => {
11152
+ e.stopPropagation();
11153
+ handleEventClick(event, e);
11154
+ },
11155
+ view: "month",
11156
+ className: "h-full border-dashed",
11157
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 min-w-0 w-full", children: [
11158
+ !isFirstDay && colStart === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] font-bold opacity-60", children: /* @__PURE__ */ jsxRuntime.jsx(ssr.CaretLeftIcon, {}) }),
11159
+ showTitle && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11160
+ 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") }),
11161
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium", children: event.title }),
11162
+ isFirstDay && (() => {
11163
+ const evStart = getEventStartDate(event);
11164
+ const evEnd = getEventEndDate(event);
11165
+ if (!evStart || !evEnd) return null;
11166
+ const d = Math.round(
11167
+ (evEnd.getTime() - evStart.getTime()) / 864e5
11168
+ ) + 1;
11169
+ if (d < 2) return null;
11170
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "shrink-0 inline-flex items-end font-bold leading-none px-1 py-0.5 text-[10px]", children: [
11171
+ d,
11172
+ "d"
11173
+ ] });
11174
+ })()
11175
+ ] }),
11176
+ !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, {}) })
11177
+ ] })
11178
+ }
11179
+ )
10877
11180
  },
10878
- time: quarterHourTime
11181
+ event.id
11182
+ );
11183
+ })
11184
+ ]
11185
+ }
11186
+ )
11187
+ ]
11188
+ }
11189
+ )
11190
+ ] }),
11191
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 grid-cols-8", children: [
11192
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid auto-cols-fr border-border/70 border-r", children: hours.map((hour, index) => /* @__PURE__ */ jsxRuntime.jsx(
11193
+ "div",
11194
+ {
11195
+ className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
11196
+ 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") })
11197
+ },
11198
+ hour.toString()
11199
+ )) }),
11200
+ days.map((day, dayIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
11201
+ "div",
11202
+ {
11203
+ className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
11204
+ "data-today": dateFns.isToday(day) || void 0,
11205
+ children: [
11206
+ (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => {
11207
+ const evStart = getEventStartDate(positionedEvent.event);
11208
+ const evEnd = getEventEndDate(positionedEvent.event);
11209
+ const timeLabel = evStart ? evEnd ? `${dateFns.format(evStart, "HH:mm")} \u2013 ${dateFns.format(evEnd, "HH:mm")}` : dateFns.format(evStart, "HH:mm") : void 0;
11210
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { delayDuration: 250, children: [
11211
+ /* @__PURE__ */ jsxRuntime.jsx(
11212
+ "div",
11213
+ {
11214
+ className: "absolute z-10 px-0.5",
11215
+ onClick: (e) => e.stopPropagation(),
11216
+ style: {
11217
+ height: `${positionedEvent.height}px`,
11218
+ left: `${positionedEvent.left * 100}%`,
11219
+ top: `${positionedEvent.top}px`,
11220
+ width: `${positionedEvent.width * 100}%`,
11221
+ zIndex: positionedEvent.zIndex
10879
11222
  },
10880
- `${hour.toString()}-${quarter}`
10881
- );
10882
- })
10883
- },
10884
- hour.toString()
10885
- );
10886
- })
10887
- ]
10888
- },
10889
- day.toString()
10890
- ))
10891
- ] }),
11223
+ children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full", children: /* @__PURE__ */ jsxRuntime.jsx(
11224
+ DraggableEvent,
11225
+ {
11226
+ event: positionedEvent.event,
11227
+ height: positionedEvent.height,
11228
+ onClick: (e) => handleEventClick(positionedEvent.event, e),
11229
+ draggable: false,
11230
+ showTime: true,
11231
+ view: "week",
11232
+ totalCols: positionedEvent.totalCols
11233
+ }
11234
+ ) }) })
11235
+ }
11236
+ ),
11237
+ /* @__PURE__ */ jsxRuntime.jsxs(
11238
+ TooltipContentBase,
11239
+ {
11240
+ side: "right",
11241
+ sideOffset: 6,
11242
+ className: "max-w-[220px] space-y-0.5",
11243
+ children: [
11244
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm leading-snug", children: positionedEvent.event.title }),
11245
+ timeLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-90", children: timeLabel }),
11246
+ positionedEvent.event.location && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs flex items-center gap-2", children: [
11247
+ /* @__PURE__ */ jsxRuntime.jsx(ssr.MapPinIcon, { size: 15 }),
11248
+ " ",
11249
+ positionedEvent.event.location
11250
+ ] }),
11251
+ positionedEvent.event.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-75 line-clamp-2", children: positionedEvent.event.description })
11252
+ ]
11253
+ }
11254
+ )
11255
+ ] }) }, positionedEvent.event.id);
11256
+ }),
11257
+ currentTimeVisible && dateFns.isToday(day) && /* @__PURE__ */ jsxRuntime.jsx(
11258
+ "div",
11259
+ {
11260
+ className: "pointer-events-none absolute right-0 left-0 z-20",
11261
+ style: { top: `${currentTimePosition}%` },
11262
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
11263
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-left-1 absolute h-2 w-2 rounded-full bg-primary" }),
11264
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[2px] w-full bg-primary" })
11265
+ ] })
11266
+ }
11267
+ ),
11268
+ hours.map((hour) => {
11269
+ const hourValue = dateFns.getHours(hour);
11270
+ return /* @__PURE__ */ jsxRuntime.jsx(
11271
+ "div",
11272
+ {
11273
+ className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
11274
+ children: [0, 1, 2, 3].map((quarter) => {
11275
+ const quarterHourTime = hourValue + quarter * 0.25;
11276
+ return /* @__PURE__ */ jsxRuntime.jsx(
11277
+ DroppableCellAgenda,
11278
+ {
11279
+ className: cn(
11280
+ "absolute h-[calc(var(--week-cells-height)/4)] w-full",
11281
+ quarter === 0 && "top-0",
11282
+ quarter === 1 && "top-[calc(var(--week-cells-height)/4)]",
11283
+ quarter === 2 && "top-[calc(var(--week-cells-height)/4*2)]",
11284
+ quarter === 3 && "top-[calc(var(--week-cells-height)/4*3)]"
11285
+ ),
11286
+ date: day,
11287
+ id: `week-cell-${day.toISOString()}-${quarterHourTime}`,
11288
+ onClick: () => {
11289
+ const startTime = new Date(day);
11290
+ startTime.setHours(hourValue);
11291
+ startTime.setMinutes(quarter * 15);
11292
+ if (onEventCreate) onEventCreate(startTime);
11293
+ },
11294
+ time: quarterHourTime
11295
+ },
11296
+ `${hour.toString()}-${quarter}`
11297
+ );
11298
+ })
11299
+ },
11300
+ hour.toString()
11301
+ );
11302
+ })
11303
+ ]
11304
+ },
11305
+ day.toString()
11306
+ ))
11307
+ ] })
11308
+ ] }) }),
10892
11309
  /* @__PURE__ */ jsxRuntime.jsx(
10893
11310
  UndatedEvents,
10894
11311
  {
10895
11312
  events,
10896
11313
  onEventSelect,
10897
11314
  show: showUndatedEvents,
10898
- className: "my-"
11315
+ className: "my-4"
10899
11316
  }
10900
11317
  )
10901
11318
  ] });
10902
11319
  }
11320
+ var colorBannerMap = {
11321
+ sky: "from-sky-400 to-sky-500",
11322
+ amber: "from-amber-400 to-amber-500",
11323
+ violet: "from-violet-400 to-violet-500",
11324
+ rose: "from-rose-400 to-rose-500",
11325
+ emerald: "from-emerald-400 to-emerald-500",
11326
+ orange: "from-orange-400 to-orange-500",
11327
+ green: "from-green-400 to-green-500",
11328
+ blue: "from-blue-400 to-blue-500",
11329
+ red: "from-red-400 to-red-500",
11330
+ purple: "from-purple-400 to-purple-500",
11331
+ indigo: "from-indigo-400 to-indigo-500",
11332
+ teal: "from-teal-400 to-teal-500",
11333
+ pink: "from-pink-400 to-pink-500",
11334
+ cyan: "from-cyan-400 to-cyan-500",
11335
+ lime: "from-lime-400 to-lime-500",
11336
+ fuchsia: "from-fuchsia-400 to-fuchsia-500"
11337
+ };
11338
+ function formatDuration2(minutes) {
11339
+ if (minutes <= 0) return "";
11340
+ const h = Math.floor(minutes / 60);
11341
+ const m = minutes % 60;
11342
+ if (h === 0) return `${m}min`;
11343
+ if (m === 0) return `${h}h`;
11344
+ return `${h}h ${m}min`;
11345
+ }
11346
+ function formatDateFull(date) {
11347
+ return dateFns.format(date, "EEE',' d 'de' MMMM 'de' yyyy", { locale: locale.ptBR });
11348
+ }
11349
+ function capitalize(s) {
11350
+ return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
11351
+ }
11352
+ function EventDetailModalAgenda({
11353
+ event,
11354
+ onClose
11355
+ }) {
11356
+ const [open, setOpen] = React32.useState(true);
11357
+ if (!event) return null;
11358
+ const color = event.color ?? "sky";
11359
+ const bannerGradient = colorBannerMap[color] ?? colorBannerMap.sky;
11360
+ const startDate = getEventStartDate(event);
11361
+ const endDate = getEventEndDate(event);
11362
+ const isMultiDay = isMultiDayEventAgenda(event);
11363
+ const durationMinutes = startDate && endDate ? dateFns.differenceInMinutes(endDate, startDate) : 0;
11364
+ const dateSection = (() => {
11365
+ if (!startDate) {
11366
+ return { primary: "Sem data definida", secondary: null, isAllDay: false };
11367
+ }
11368
+ if (event.allDay) {
11369
+ if (isMultiDay && endDate && !dateFns.isSameDay(startDate, endDate)) {
11370
+ return {
11371
+ primary: `${capitalize(formatDateFull(startDate))}`,
11372
+ secondary: `${capitalize(formatDateFull(endDate))}`,
11373
+ isAllDay: true
11374
+ };
11375
+ }
11376
+ return {
11377
+ primary: capitalize(formatDateFull(startDate)),
11378
+ secondary: null,
11379
+ isAllDay: true
11380
+ };
11381
+ }
11382
+ if (isMultiDay && endDate) {
11383
+ const startStr = capitalize(
11384
+ dateFns.format(startDate, "d MMM yyyy, HH:mm", { locale: locale.ptBR })
11385
+ );
11386
+ const endStr = capitalize(
11387
+ dateFns.format(endDate, "d MMM yyyy, HH:mm", { locale: locale.ptBR })
11388
+ );
11389
+ return { primary: startStr, secondary: endStr, isAllDay: false };
11390
+ }
11391
+ const dateStr = capitalize(formatDateFull(startDate));
11392
+ const timeStr = endDate ? `${dateFns.format(startDate, "HH:mm")} \u2013 ${dateFns.format(endDate, "HH:mm")}` : dateFns.format(startDate, "HH:mm");
11393
+ return { primary: dateStr, secondary: timeStr, isAllDay: false };
11394
+ })();
11395
+ return /* @__PURE__ */ jsxRuntime.jsx(
11396
+ DialogBase,
11397
+ {
11398
+ open,
11399
+ onOpenChange: (v) => {
11400
+ setOpen(v);
11401
+ if (!v) onClose?.();
11402
+ },
11403
+ children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContentBase, { className: "p-0 overflow-hidden gap-0 border-none shadow-xl sm:max-w-md", children: [
11404
+ /* @__PURE__ */ jsxRuntime.jsxs(
11405
+ "div",
11406
+ {
11407
+ className: cn(
11408
+ "relative bg-gradient-to-tl w-full flex flex-col justify-end px-6 pt-12 pb-8 select-none transition-all duration-300",
11409
+ bannerGradient
11410
+ ),
11411
+ children: [
11412
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-4 left-6 flex items-center gap-2", children: dateSection.isAllDay ? /* @__PURE__ */ jsxRuntime.jsxs(Badge, { className: "bg-white/20 text-white backdrop-blur-md", children: [
11413
+ /* @__PURE__ */ jsxRuntime.jsx(react.SunIcon, { size: 12, weight: "bold" }),
11414
+ "Dia todo"
11415
+ ] }) : isMultiDay ? /* @__PURE__ */ jsxRuntime.jsxs(Badge, { className: "bg-white/20 text-white backdrop-blur-md", children: [
11416
+ /* @__PURE__ */ jsxRuntime.jsx(react.CalendarDotsIcon, { size: 12, weight: "bold" }),
11417
+ "Multi-dia"
11418
+ ] }) : durationMinutes > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(Badge, { className: "bg-white/20 text-white backdrop-blur-md", children: [
11419
+ /* @__PURE__ */ jsxRuntime.jsx(react.ClockIcon, { size: 12, weight: "bold" }),
11420
+ formatDuration2(durationMinutes)
11421
+ ] }) : null }),
11422
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl sm:text-3xl font-bold text-white leading-tight tracking-tight drop-shadow-md", children: event.title })
11423
+ ]
11424
+ }
11425
+ ),
11426
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6 px-6 py-8 bg-background", children: [
11427
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-4", children: [
11428
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 rounded-lg bg-muted/50 border border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
11429
+ react.CalendarDotsIcon,
11430
+ {
11431
+ size: 20,
11432
+ weight: "duotone",
11433
+ className: "text-primary"
11434
+ }
11435
+ ) }),
11436
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
11437
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-foreground leading-none", children: dateSection.primary }),
11438
+ dateSection.secondary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 text-sm text-muted-foreground mt-0.5", children: isMultiDay && !event.allDay || isMultiDay && dateSection.isAllDay ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11439
+ /* @__PURE__ */ jsxRuntime.jsx(
11440
+ react.ArrowRightIcon,
11441
+ {
11442
+ size: 12,
11443
+ className: "shrink-0 opacity-70"
11444
+ }
11445
+ ),
11446
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: dateSection.secondary })
11447
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-foreground/70", children: dateSection.secondary }) })
11448
+ ] })
11449
+ ] }),
11450
+ /* @__PURE__ */ jsxRuntime.jsx(SeparatorBase, { className: "opacity-50" }),
11451
+ event.location && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-4", children: [
11452
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 rounded-lg bg-muted/50 border border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
11453
+ react.MapPinIcon,
11454
+ {
11455
+ size: 20,
11456
+ weight: "duotone",
11457
+ className: "text-primary"
11458
+ }
11459
+ ) }),
11460
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
11461
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Localiza\xE7\xE3o" }),
11462
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-foreground font-medium", children: event.location })
11463
+ ] })
11464
+ ] }),
11465
+ event.description && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-4", children: [
11466
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 rounded-lg bg-muted/50 border border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
11467
+ react.AlignLeftIcon,
11468
+ {
11469
+ size: 20,
11470
+ weight: "duotone",
11471
+ className: "text-primary"
11472
+ }
11473
+ ) }),
11474
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
11475
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider", children: "Descri\xE7\xE3o" }),
11476
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground leading-relaxed font-normal", children: event.description })
11477
+ ] })
11478
+ ] }),
11479
+ !event.location && !event.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground/60 italic text-center py-2 border border-dashed border-border rounded-lg", children: "Nenhum detalhe adicional dispon\xEDvel." })
11480
+ ] })
11481
+ ] })
11482
+ }
11483
+ );
11484
+ }
10903
11485
  function AgendaView({
10904
11486
  currentDate,
10905
11487
  events,
@@ -11745,23 +12327,23 @@ function EventCalendar({
11745
12327
  });
11746
12328
  };
11747
12329
  const viewTitle = React32.useMemo(() => {
11748
- const capitalize = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
12330
+ const capitalize2 = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
11749
12331
  if (view === "month") {
11750
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
12332
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
11751
12333
  }
11752
12334
  if (view === "week") {
11753
12335
  const start = dateFns.startOfWeek(currentDate, { weekStartsOn: 1 });
11754
12336
  const end = dateFns.endOfWeek(currentDate, { weekStartsOn: 1 });
11755
12337
  if (dateFns.isSameMonth(start, end)) {
11756
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
12338
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
11757
12339
  }
11758
- const s1 = capitalize(dateFns.format(start, "MMM", { locale: locale.ptBR }));
11759
- const s2 = capitalize(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
12340
+ const s1 = capitalize2(dateFns.format(start, "MMM", { locale: locale.ptBR }));
12341
+ const s2 = capitalize2(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
11760
12342
  return `${s1} - ${s2}`;
11761
12343
  }
11762
12344
  if (view === "day") {
11763
12345
  const dayNum = dateFns.format(currentDate, "d", { locale: locale.ptBR });
11764
- const month = capitalize(dateFns.format(currentDate, "MMMM", { locale: locale.ptBR }));
12346
+ const month = capitalize2(dateFns.format(currentDate, "MMMM", { locale: locale.ptBR }));
11765
12347
  const year = dateFns.format(currentDate, "yyyy", { locale: locale.ptBR });
11766
12348
  const short = `${dayNum} de ${month} de ${year}`;
11767
12349
  const long = `${dateFns.format(currentDate, "EEE", {
@@ -11777,13 +12359,13 @@ function EventCalendar({
11777
12359
  const start = currentDate;
11778
12360
  const end = dateFns.addDays(currentDate, AgendaDaysToShow - 1);
11779
12361
  if (dateFns.isSameMonth(start, end)) {
11780
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
12362
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
11781
12363
  }
11782
- const s1 = capitalize(dateFns.format(start, "MMM", { locale: locale.ptBR }));
11783
- const s2 = capitalize(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
12364
+ const s1 = capitalize2(dateFns.format(start, "MMM", { locale: locale.ptBR }));
12365
+ const s2 = capitalize2(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
11784
12366
  return `${s1} - ${s2}`;
11785
12367
  }
11786
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
12368
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
11787
12369
  }, [currentDate, view]);
11788
12370
  const calendarContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11789
12371
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -13943,14 +14525,14 @@ var generateAdditionalColors = (baseColors, count) => {
13943
14525
  r /= 255;
13944
14526
  g /= 255;
13945
14527
  b /= 255;
13946
- const max = Math.max(r, g, b), min = Math.min(r, g, b);
14528
+ const max2 = Math.max(r, g, b), min2 = Math.min(r, g, b);
13947
14529
  let h = 0;
13948
14530
  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) {
14531
+ const l = (max2 + min2) / 2;
14532
+ if (max2 !== min2) {
14533
+ const d = max2 - min2;
14534
+ s = l > 0.5 ? d / (2 - max2 - min2) : d / (max2 + min2);
14535
+ switch (max2) {
13954
14536
  case r:
13955
14537
  h = (g - b) / d + (g < b ? 6 : 0);
13956
14538
  break;
@@ -14067,25 +14649,25 @@ var computeNiceMax = (maxValue) => {
14067
14649
  return niceCeil(padded);
14068
14650
  };
14069
14651
  var getMaxDataValue = (data, keys) => {
14070
- let max = 0;
14652
+ let max2 = 0;
14071
14653
  for (const row of data) {
14072
14654
  for (const key of keys) {
14073
14655
  const v = row[key];
14074
- if (typeof v === "number" && Number.isFinite(v) && v > max) max = v;
14656
+ if (typeof v === "number" && Number.isFinite(v) && v > max2) max2 = v;
14075
14657
  }
14076
14658
  }
14077
- return max;
14659
+ return max2;
14078
14660
  };
14079
14661
  var getMinDataValue = (data, keys) => {
14080
- let min = 0;
14662
+ let min2 = 0;
14081
14663
  for (const row of data) {
14082
14664
  for (const key of keys) {
14083
14665
  const v = row[key];
14084
- if (typeof v === "number" && Number.isFinite(v) && v < min)
14085
- min = v;
14666
+ if (typeof v === "number" && Number.isFinite(v) && v < min2)
14667
+ min2 = v;
14086
14668
  }
14087
14669
  }
14088
- return min;
14670
+ return min2;
14089
14671
  };
14090
14672
  var computeChartWidth = (width, dataLength, series, niceMaxLeft, niceMaxRight) => {
14091
14673
  if (typeof width === "number") return width;
@@ -14131,8 +14713,8 @@ var createValueFormatter = (customFormatter, formatBR) => {
14131
14713
  });
14132
14714
  const prefixFormats = ["R$", "$", "\u20AC", "\xA3"];
14133
14715
  const suffixFormats = ["%", "kg", "km", "m", "L", "un", "t", "h", "min", "s"];
14134
- const getFormattedValue = (baseValue, format17) => {
14135
- const trimmedFormat = format17.trim();
14716
+ const getFormattedValue = (baseValue, format19) => {
14717
+ const trimmedFormat = format19.trim();
14136
14718
  if (prefixFormats.includes(trimmedFormat)) {
14137
14719
  return `${trimmedFormat} ${baseValue}`;
14138
14720
  }
@@ -14157,8 +14739,8 @@ var createValueFormatter = (customFormatter, formatBR) => {
14157
14739
  num = Number.isNaN(parsed) ? NaN : parsed;
14158
14740
  }
14159
14741
  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;
14742
+ const format19 = propsDataKey && formatterMap[propsDataKey] ? formatterMap[propsDataKey] : "";
14743
+ return format19 ? getFormattedValue(baseFormatted, format19) : baseFormatted;
14162
14744
  };
14163
14745
  }
14164
14746
  if (typeof customFormatter === "function") {
@@ -18471,8 +19053,8 @@ var TimeSeries_default = TimeSeries;
18471
19053
  function NumericInput({
18472
19054
  value,
18473
19055
  onChange,
18474
- min,
18475
- max,
19056
+ min: min2,
19057
+ max: max2,
18476
19058
  label,
18477
19059
  className,
18478
19060
  error,
@@ -18489,21 +19071,21 @@ function NumericInput({
18489
19071
  if (!hasChanged || isLoading || disabled) return;
18490
19072
  onChange(internalValue);
18491
19073
  };
18492
- function handleNumberChange(value2, currentValue = 0, max2 = 9999999, min2 = 0) {
19074
+ function handleNumberChange(value2, currentValue = 0, max3 = 9999999, min3 = 0) {
18493
19075
  const numbersOnly = value2.replace(/\D/g, "");
18494
19076
  if (numbersOnly === "") {
18495
19077
  return 0;
18496
19078
  }
18497
19079
  const numValue = Number(numbersOnly);
18498
- if (numValue < min2) {
19080
+ if (numValue < min3) {
18499
19081
  if (tooltip_on_overflow) {
18500
- sonner.toast.warning("O valor deve ser maior que " + min2.toString());
19082
+ sonner.toast.warning("O valor deve ser maior que " + min3.toString());
18501
19083
  }
18502
- return min2;
19084
+ return min3;
18503
19085
  }
18504
- if (numValue > max2) {
19086
+ if (numValue > max3) {
18505
19087
  if (tooltip_on_overflow) {
18506
- sonner.toast.warning("O valor deve ser menor que " + max2.toString());
19088
+ sonner.toast.warning("O valor deve ser menor que " + max3.toString());
18507
19089
  }
18508
19090
  return currentValue;
18509
19091
  }
@@ -18525,8 +19107,8 @@ function NumericInput({
18525
19107
  const processedValue = handleNumberChange(
18526
19108
  e.currentTarget.value,
18527
19109
  internalValue,
18528
- max,
18529
- min
19110
+ max2,
19111
+ min2
18530
19112
  );
18531
19113
  setInternalValue(processedValue);
18532
19114
  },
@@ -19832,6 +20414,7 @@ exports.EndHourAgenda = EndHourAgenda;
19832
20414
  exports.ErrorMessage = ErrorMessage_default;
19833
20415
  exports.EventAgenda = EventAgenda;
19834
20416
  exports.EventCalendar = EventCalendar;
20417
+ exports.EventDetailModalAgenda = EventDetailModalAgenda;
19835
20418
  exports.EventDialog = EventDialog;
19836
20419
  exports.EventGap = EventGap;
19837
20420
  exports.EventGapAgenda = EventGapAgenda;
@@ -19876,6 +20459,7 @@ exports.MonthView = MonthView;
19876
20459
  exports.MonthViewAgenda = MonthViewAgenda;
19877
20460
  exports.MoreButton = MoreButton;
19878
20461
  exports.MultiCombobox = MultiCombobox;
20462
+ exports.MultiDayOverlay = MultiDayOverlay;
19879
20463
  exports.MultiSelect = MultiSelect;
19880
20464
  exports.MultiSelectBase = MultiSelectBase;
19881
20465
  exports.MultiSelectContentBase = MultiSelectContentBase;