@mlw-packages/react-components 1.9.15 → 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
  ] })
@@ -1214,6 +1214,8 @@ var Toaster = ({ testId, ...props }) => {
1214
1214
  className: "toaster group",
1215
1215
  position: "top-center",
1216
1216
  duration: 4e3,
1217
+ swipeDirections: ["top", "bottom", "left", "right"],
1218
+ closeButton: true,
1217
1219
  toastOptions: {
1218
1220
  style: {
1219
1221
  backdropFilter: "blur(8px)",
@@ -1227,9 +1229,8 @@ var Toaster = ({ testId, ...props }) => {
1227
1229
  shadow-xl rounded-lg
1228
1230
  border-l-4
1229
1231
 
1230
- flex items-center gap-3
1232
+ flex items-center gap-3 pr-10
1231
1233
  transition-all duration-300
1232
- hover:scale-[1.02] hover:shadow-2xl
1233
1234
  data-[type=success]:border-l-green-500 data-[type=success]:bg-green-50/95 data-[type=success]:text-green-800 data-[type=success]:border-green-500 data-
1234
1235
  data-[type=error]:border-l-red-500 data-[type=error]:bg-red-50/95 data-[type=error]:text-red-800 data-[type=error]:border-red-500
1235
1236
  data-[type=warning]:border-l-yellow-500 data-[type=warning]:bg-yellow-50/95 data-[type=warning]:text-yellow-800 data-[type=warning]:border-yellow-500
@@ -1255,6 +1256,13 @@ var Toaster = ({ testId, ...props }) => {
1255
1256
  hover:bg-neutral-200 hover:scale-105
1256
1257
  transition-all duration-200
1257
1258
  active:scale-95
1259
+ `,
1260
+ closeButton: `
1261
+ !bg-transparent hover:!bg-black/5 dark:hover:!bg-white/10
1262
+ !border-0 !text-neutral-400 hover:!text-neutral-900 dark:hover:!text-neutral-100
1263
+ transition-all duration-200 !left-[auto] !right-3 !top-1/2 !-translate-y-1/2
1264
+ !w-7 !h-7 !rounded-lg flex items-center justify-center
1265
+ active:scale-95
1258
1266
  `
1259
1267
  }
1260
1268
  },
@@ -2050,7 +2058,7 @@ var CommandDebouncedInputBase = React32__namespace.forwardRef(
2050
2058
  }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
2051
2059
  "div",
2052
2060
  {
2053
- className: "flex items-center px-3 border-border border-b",
2061
+ className: "flex items-center px-3 border-border border-b focus:ring-0",
2054
2062
  "cmdk-input-wrapper": "",
2055
2063
  children: [
2056
2064
  /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 text-primary" }),
@@ -7483,15 +7491,15 @@ function isValid12Hour(value) {
7483
7491
  function isValidMinuteOrSecond(value) {
7484
7492
  return /^[0-5][0-9]$/.test(value);
7485
7493
  }
7486
- function getValidNumber(value, { max, min = 0, loop = false }) {
7494
+ function getValidNumber(value, { max: max2, min: min2 = 0, loop = false }) {
7487
7495
  let numericValue = parseInt(value, 10);
7488
7496
  if (!isNaN(numericValue)) {
7489
7497
  if (!loop) {
7490
- if (numericValue > max) numericValue = max;
7491
- if (numericValue < min) numericValue = min;
7498
+ if (numericValue > max2) numericValue = max2;
7499
+ if (numericValue < min2) numericValue = min2;
7492
7500
  } else {
7493
- if (numericValue > max) numericValue = min;
7494
- if (numericValue < min) numericValue = max;
7501
+ if (numericValue > max2) numericValue = min2;
7502
+ if (numericValue < min2) numericValue = max2;
7495
7503
  }
7496
7504
  return numericValue.toString().padStart(2, "0");
7497
7505
  }
@@ -7509,11 +7517,11 @@ function getValidMinuteOrSecond(value) {
7509
7517
  if (isValidMinuteOrSecond(value)) return value;
7510
7518
  return getValidNumber(value, { max: 59 });
7511
7519
  }
7512
- function getValidArrowNumber(value, { min, max, step }) {
7520
+ function getValidArrowNumber(value, { min: min2, max: max2, step }) {
7513
7521
  let numericValue = parseInt(value, 10);
7514
7522
  if (!isNaN(numericValue)) {
7515
7523
  numericValue += step;
7516
- return getValidNumber(String(numericValue), { min, max, loop: true });
7524
+ return getValidNumber(String(numericValue), { min: min2, max: max2, loop: true });
7517
7525
  }
7518
7526
  return "00";
7519
7527
  }
@@ -7624,19 +7632,19 @@ function visualForItem(item, value) {
7624
7632
  var ITEM_HEIGHT = 38.5;
7625
7633
  var VISIBLE_ITEMS = 5;
7626
7634
  var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
7627
- function getItems(max, step = 1) {
7628
- 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);
7629
7637
  }
7630
7638
 
7631
7639
  // src/components/ui/picker/hooks/useScrollColumn.tsx
7632
7640
  function useScrollColumn({
7633
7641
  value,
7634
7642
  onChange,
7635
- max,
7643
+ max: max2,
7636
7644
  step = 1
7637
7645
  }) {
7638
7646
  const containerRef = React32.useRef(null);
7639
- const items = getItems(max, step);
7647
+ const items = getItems(max2, step);
7640
7648
  const scrollTimeoutRef = React32.useRef(null);
7641
7649
  const isScrollingRef = React32.useRef(false);
7642
7650
  const [isDragging, setIsDragging] = React32.useState(false);
@@ -7704,7 +7712,7 @@ function useScrollColumn({
7704
7712
  function ScrollColumn({
7705
7713
  value,
7706
7714
  onChange,
7707
- max,
7715
+ max: max2,
7708
7716
  label,
7709
7717
  step = 1
7710
7718
  }) {
@@ -7719,7 +7727,7 @@ function ScrollColumn({
7719
7727
  handleMouseMove,
7720
7728
  handleMouseUp,
7721
7729
  isDragging
7722
- } = useScrollColumn({ value, onChange, max, step });
7730
+ } = useScrollColumn({ value, onChange, max: max2, step });
7723
7731
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
7724
7732
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground rounded-md font-semibold text-sm text-center pb-2 uppercase tracking-wider", children: label }),
7725
7733
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative w-20"), children: [
@@ -8731,7 +8739,7 @@ function Agenda({
8731
8739
  "span",
8732
8740
  {
8733
8741
  className: tailwindMerge.twMerge(
8734
- "-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",
8735
8743
  dateFns.isToday(day) ? "text-blue-500" : ""
8736
8744
  ),
8737
8745
  "data-today": dateFns.isToday(day) || void 0,
@@ -9018,19 +9026,39 @@ function getEventColorClassesAgenda(color) {
9018
9026
  const eventColor = color || "sky";
9019
9027
  switch (eventColor) {
9020
9028
  case "sky":
9021
- 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";
9022
9030
  case "amber":
9023
- 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";
9024
9032
  case "violet":
9025
- 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";
9026
9034
  case "rose":
9027
- 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";
9028
9036
  case "emerald":
9029
- 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";
9030
9038
  case "orange":
9031
- 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";
9032
9060
  default:
9033
- 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";
9034
9062
  }
9035
9063
  }
9036
9064
  function getBorderRadiusClassesAgenda(isFirstDay, isLastDay) {
@@ -9101,6 +9129,9 @@ function getEventEndDate(event) {
9101
9129
  if (start && typeof event.duration === "number" && !isNaN(event.duration)) {
9102
9130
  return addMinutesToDateAgenda(start, event.duration);
9103
9131
  }
9132
+ if (start && !event.allDay) {
9133
+ return addMinutesToDateAgenda(start, 60);
9134
+ }
9104
9135
  return void 0;
9105
9136
  }
9106
9137
  function isValidDate(d) {
@@ -9210,7 +9241,7 @@ function EventWrapper({
9210
9241
  "button",
9211
9242
  {
9212
9243
  className: cn(
9213
- "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",
9214
9245
  className?.includes("overflow-visible") ? "" : "overflow-hidden",
9215
9246
  colorClasses,
9216
9247
  getBorderRadiusClassesAgenda(isFirstDay, isLastDay),
@@ -9243,7 +9274,8 @@ function EventItemAgenda({
9243
9274
  dndAttributes,
9244
9275
  onMouseDown,
9245
9276
  onTouchStart,
9246
- agendaOnly = false
9277
+ agendaOnly = false,
9278
+ totalCols = 1
9247
9279
  }) {
9248
9280
  const eventColor = event.color;
9249
9281
  const startDate = getEventStartDate(event);
@@ -9301,7 +9333,7 @@ function EventItemAgenda({
9301
9333
  EventWrapper,
9302
9334
  {
9303
9335
  className: cn(
9304
- "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",
9305
9337
  className
9306
9338
  ),
9307
9339
  currentTime,
@@ -9329,13 +9361,58 @@ function EventItemAgenda({
9329
9361
  );
9330
9362
  }
9331
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
+ }
9332
9409
  return /* @__PURE__ */ jsxRuntime.jsx(
9333
9410
  EventWrapper,
9334
9411
  {
9335
9412
  className: cn(
9336
- "py-1",
9337
- durationMinutes < 45 ? "items-center" : "flex-col",
9338
- 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]",
9339
9416
  className
9340
9417
  ),
9341
9418
  currentTime,
@@ -9346,26 +9423,14 @@ function EventItemAgenda({
9346
9423
  isFirstDay,
9347
9424
  isLastDay,
9348
9425
  onClick,
9349
- children: durationMinutes < 45 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full", children: [
9350
- /* @__PURE__ */ jsxRuntime.jsx(
9351
- "div",
9352
- {
9353
- className: cn("truncate text-sm sm:text-base md:text-lg min-w-0"),
9354
- children: event.title
9355
- }
9356
- ),
9357
- 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) })
9358
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9359
- /* @__PURE__ */ jsxRuntime.jsx(
9360
- "div",
9361
- {
9362
- className: cn(
9363
- "truncate font-medium text-sm sm:text-base md:text-lg min-w-0"
9364
- ),
9365
- children: event.title
9366
- }
9367
- ),
9368
- 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() })
9369
9434
  ] })
9370
9435
  }
9371
9436
  );
@@ -9537,7 +9602,6 @@ function DayViewAgenda({
9537
9602
  });
9538
9603
  }, [dayEvents]);
9539
9604
  const positionedEvents = React32.useMemo(() => {
9540
- const result = [];
9541
9605
  const dayStart = dateFns.startOfDay(currentDate);
9542
9606
  const sortedEvents = [...timeEvents].sort((a, b) => {
9543
9607
  const aStart = getEventStartDate(a) ?? getEventEndDate(a) ?? /* @__PURE__ */ new Date();
@@ -9551,57 +9615,69 @@ function DayViewAgenda({
9551
9615
  return bDuration - aDuration;
9552
9616
  });
9553
9617
  const columns = [];
9618
+ const layouts = [];
9554
9619
  for (const event of sortedEvents) {
9555
9620
  const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
9556
- 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;
9557
9623
  const adjustedStart = dateFns.isSameDay(currentDate, eventStart) ? eventStart : dayStart;
9558
9624
  const adjustedEnd = dateFns.isSameDay(currentDate, eventEnd) ? eventEnd : dateFns.addHours(dayStart, 24);
9559
9625
  const startHour = dateFns.getHours(adjustedStart) + dateFns.getMinutes(adjustedStart) / 60;
9560
9626
  const endHour = dateFns.getHours(adjustedEnd) + dateFns.getMinutes(adjustedEnd) / 60;
9561
9627
  const top = (startHour - StartHourAgenda) * WeekCellsHeightAgenda;
9562
- const height = (endHour - startHour) * WeekCellsHeightAgenda;
9563
- let columnIndex = 0;
9564
- let placed = false;
9565
- while (!placed) {
9566
- const col = columns[columnIndex] || [];
9567
- if (col.length === 0) {
9568
- columns[columnIndex] = col;
9569
- placed = true;
9570
- } else {
9571
- const overlaps = col.some((c) => {
9572
- const cStart = getEventStartDate(c.event) ?? getEventEndDate(c.event) ?? /* @__PURE__ */ new Date();
9573
- const cEnd = getEventEndDate(c.event) ?? getEventStartDate(c.event) ?? /* @__PURE__ */ new Date();
9574
- return dateFns.areIntervalsOverlapping(
9575
- { end: adjustedEnd, start: adjustedStart },
9576
- { end: cEnd, start: cStart }
9577
- );
9578
- });
9579
- if (!overlaps) {
9580
- placed = true;
9581
- } else {
9582
- columnIndex++;
9583
- }
9584
- }
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++;
9585
9644
  }
9586
- const currentColumn = columns[columnIndex] || [];
9587
- columns[columnIndex] = currentColumn;
9588
- currentColumn.push({
9589
- end: adjustedEnd,
9590
- event,
9591
- start: adjustedStart
9592
- });
9593
- const width = columnIndex === 0 ? 1 : 0.9;
9594
- const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
9595
- result.push({
9645
+ if (!columns[col]) columns[col] = [];
9646
+ columns[col].push({ start: adjustedStart, end: adjustedEnd });
9647
+ layouts.push({
9596
9648
  event,
9597
- height,
9598
- left,
9649
+ adjustedStart,
9650
+ adjustedEnd,
9599
9651
  top,
9600
- width,
9601
- zIndex: 10 + columnIndex
9652
+ height,
9653
+ col,
9654
+ totalCols: 0
9602
9655
  });
9603
9656
  }
9604
- 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
+ );
9605
9681
  }, [currentDate, timeEvents]);
9606
9682
  const handleEventClick = (event, e) => {
9607
9683
  e.stopPropagation();
@@ -9636,7 +9712,7 @@ function DayViewAgenda({
9636
9712
  "div",
9637
9713
  {
9638
9714
  className: "relative h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
9639
- 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") })
9640
9716
  },
9641
9717
  hour.toString()
9642
9718
  )) }),
@@ -10025,25 +10101,25 @@ function EventAgenda({
10025
10101
  return condensed ? entry.short : entry.full;
10026
10102
  };
10027
10103
  const viewTitle = React32.useMemo(() => {
10028
- 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;
10029
10105
  if (view === "month")
10030
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10106
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10031
10107
  if (view === "week") {
10032
10108
  const start = dateFns.startOfWeek(currentDate, { weekStartsOn: 1 });
10033
10109
  const end = dateFns.endOfWeek(currentDate, { weekStartsOn: 1 });
10034
10110
  if (dateFns.isSameMonth(start, end))
10035
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10036
- const s1 = capitalize(dateFns.format(start, "MMM", { locale: locale.ptBR }));
10037
- 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 }));
10038
10114
  return `${s1} - ${s2}`;
10039
10115
  }
10040
10116
  if (view === "day")
10041
10117
  return dateFns.format(currentDate, "d 'de' MMMM 'de' yyyy", { locale: locale.ptBR });
10042
10118
  if (view === "agenda") {
10043
10119
  const start = currentDate;
10044
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10120
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
10045
10121
  }
10046
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10122
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
10047
10123
  }, [currentDate, view]);
10048
10124
  const selectItems = ["month", "week", "day", "agenda"].map((v) => ({
10049
10125
  label: viewLabel(v),
@@ -10230,6 +10306,159 @@ function useEventVisibilityAgenda({
10230
10306
  getVisibleEventCount
10231
10307
  };
10232
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
+ }
10233
10462
  function MonthViewAgenda({
10234
10463
  currentDate,
10235
10464
  events,
@@ -10243,13 +10472,14 @@ function MonthViewAgenda({
10243
10472
  const calendarEnd = dateFns.endOfWeek(monthEnd, { weekStartsOn: 0 });
10244
10473
  return dateFns.eachDayOfInterval({ end: calendarEnd, start: calendarStart });
10245
10474
  }, [currentDate]);
10246
- const weekdays = React32.useMemo(() => {
10247
- return Array.from({ length: 7 }).map((_, i) => {
10475
+ const weekdays = React32.useMemo(
10476
+ () => Array.from({ length: 7 }).map((_, i) => {
10248
10477
  const date = dateFns.addDays(dateFns.startOfWeek(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
10249
10478
  const short = dateFns.format(date, "EEE", { locale: locale.ptBR });
10250
10479
  return short.charAt(0).toUpperCase() + short.slice(1);
10251
- });
10252
- }, []);
10480
+ }),
10481
+ []
10482
+ );
10253
10483
  const weeks = React32.useMemo(() => {
10254
10484
  const result = [];
10255
10485
  let week = [];
@@ -10262,11 +10492,24 @@ function MonthViewAgenda({
10262
10492
  }
10263
10493
  return result;
10264
10494
  }, [days]);
10265
- const handleEventClick = (event, e) => {
10266
- e.stopPropagation();
10267
- onEventSelect(event, e);
10268
- };
10495
+ const todayColIndex = React32.useMemo(() => (/* @__PURE__ */ new Date()).getDay(), []);
10269
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
+ }, []);
10270
10513
  const { contentRef, getVisibleEventCount } = useEventVisibilityAgenda({
10271
10514
  eventGap: EventGapAgenda,
10272
10515
  eventHeight: EventHeightAgenda
@@ -10274,202 +10517,221 @@ function MonthViewAgenda({
10274
10517
  React32.useEffect(() => {
10275
10518
  setIsMounted(true);
10276
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
+ };
10277
10536
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "contents", "data-slot": "month-view", children: [
10278
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 border-border/70 border-b", children: weekdays.map((day) => /* @__PURE__ */ jsxRuntime.jsxs(
10279
- "div",
10280
- {
10281
- className: "py-1 px-1 text-center text-muted-foreground/70 text-xs uppercase sm:tracking-wide bg-muted/5 leading-none",
10282
- children: [
10283
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: day }),
10284
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline sm:hidden", children: day.charAt(0) })
10285
- ]
10286
- },
10287
- day
10288
- )) }),
10289
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid flex-1 auto-rows-fr", children: weeks.map((week, weekIndex) => /* @__PURE__ */ jsxRuntime.jsx(
10290
- "div",
10291
- {
10292
- className: "grid grid-cols-7 [&:last-child>*]:border-b-0",
10293
- children: week.map((day, dayIndex) => {
10294
- if (!day) return null;
10295
- const eventsWithStart = events.filter((ev) => {
10296
- try {
10297
- if (ev.start == null) return false;
10298
- const t = ev.start instanceof Date ? ev.start.getTime() : new Date(String(ev.start)).getTime();
10299
- return !isNaN(t);
10300
- } catch {
10301
- return false;
10302
- }
10303
- });
10304
- const dayEvents = getEventsForDayAgenda(eventsWithStart, day);
10305
- const spanningEvents = getSpanningEventsForDayAgenda(
10306
- eventsWithStart,
10307
- day
10308
- );
10309
- const isCurrentMonth = dateFns.isSameMonth(day, currentDate);
10310
- const cellId = `month-cell-${day.toISOString()}`;
10311
- const allDayEvents = [...spanningEvents, ...dayEvents];
10312
- const allEvents = getAllEventsForDayAgenda(events, day);
10313
- const isReferenceCell = weekIndex === 0 && dayIndex === 0;
10314
- const visibleCount = isMounted ? getVisibleEventCount(allDayEvents.length) : void 0;
10315
- const hasMore = visibleCount !== void 0 && allDayEvents.length > visibleCount;
10316
- const remainingCount = hasMore ? allDayEvents.length - visibleCount : 0;
10317
- return /* @__PURE__ */ jsxRuntime.jsx(
10318
- "div",
10319
- {
10320
- 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",
10321
- "data-outside-cell": !isCurrentMonth || void 0,
10322
- "data-today": dateFns.isToday(day) || void 0,
10323
- children: /* @__PURE__ */ jsxRuntime.jsxs(
10324
- 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",
10325
10591
  {
10326
- date: day,
10327
- id: cellId,
10328
- onClick: () => {
10329
- const startTime = new Date(day);
10330
- startTime.setHours(DefaultStartHourAgenda, 0, 0);
10331
- },
10332
- children: [
10333
- /* @__PURE__ */ jsxRuntime.jsx(
10334
- "div",
10335
- {
10336
- className: tailwindMerge.twMerge(
10337
- `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`,
10338
- 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
+ }
10339
10620
  ),
10340
- children: dateFns.format(day, "d")
10341
- }
10342
- ),
10343
- /* @__PURE__ */ jsxRuntime.jsxs(
10344
- "div",
10345
- {
10346
- 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",
10347
- ref: isReferenceCell ? contentRef : null,
10348
- children: [
10349
- sortEventsAgenda(allDayEvents).map((event, index) => {
10350
- const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10351
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10352
- const isFirstDay = dateFns.isSameDay(day, eventStart);
10353
- const isLastDay = dateFns.isSameDay(day, eventEnd);
10354
- const isHidden = isMounted && visibleCount && index >= visibleCount;
10355
- if (!visibleCount) return null;
10356
- if (!isFirstDay) {
10357
- return /* @__PURE__ */ jsxRuntime.jsx(
10358
- "div",
10359
- {
10360
- "aria-hidden": isHidden ? "true" : void 0,
10361
- className: "aria-hidden:hidden",
10362
- children: /* @__PURE__ */ jsxRuntime.jsx(
10363
- EventItemAgenda,
10364
- {
10365
- event,
10366
- isFirstDay,
10367
- isLastDay,
10368
- onClick: (e) => handleEventClick(event, e),
10369
- view: "month",
10370
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 truncate text-[12px] text-foreground" })
10371
- }
10372
- )
10373
- },
10374
- `spanning-${event.id}-${day.toISOString().slice(0, 10)}`
10375
- );
10376
- }
10377
- const isMultiDay = !isLastDay;
10378
- return /* @__PURE__ */ jsxRuntime.jsx(
10379
- "div",
10380
- {
10381
- "aria-hidden": isHidden ? "true" : void 0,
10382
- className: "aria-hidden:hidden relative",
10383
- children: /* @__PURE__ */ jsxRuntime.jsx(
10384
- 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",
10385
10630
  {
10386
- event,
10387
- isFirstDay,
10388
- isLastDay,
10389
- onClick: (e) => handleEventClick(event, e),
10390
- view: "month",
10391
- className: isMultiDay ? "overflow-visible" : "",
10392
- children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 sm:gap-2 truncate text-[12px] text-foreground relative z-10", children: [
10393
- !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") }),
10394
- /* @__PURE__ */ jsxRuntime.jsx(
10395
- "span",
10396
- {
10397
- className: `font-medium text-xs sm:text-sm ${isMultiDay ? "whitespace-nowrap" : "truncate"}`,
10398
- children: event.title
10399
- }
10400
- )
10401
- ] })
10402
- }
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}`
10403
10636
  )
10404
- },
10405
- event.id
10406
- );
10407
- }),
10408
- hasMore && /* @__PURE__ */ jsxRuntime.jsxs(PopoverBase, { modal: true, children: [
10409
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
10410
- "button",
10411
- {
10412
- 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",
10413
- onClick: (e) => e.stopPropagation(),
10414
- type: "button",
10415
- "aria-label": `Show ${remainingCount} more events on ${dateFns.format(
10416
- day,
10417
- "PPP",
10418
- { locale: locale.ptBR }
10419
- )}`,
10420
- children: [
10421
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
10422
- "+ ",
10423
- remainingCount
10424
- ] }),
10425
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " more" })
10426
- ]
10427
- }
10428
- ) }),
10429
- /* @__PURE__ */ jsxRuntime.jsx(
10430
- PopoverContentBase,
10431
- {
10432
- align: "center",
10433
- className: "max-w-52 p-3",
10434
- style: {
10435
- "--event-height": `${EventHeightAgenda}px`
10436
- },
10437
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
10438
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-sm", children: dateFns.format(day, "EEE d", { locale: locale.ptBR }) }),
10439
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: sortEventsAgenda(allEvents).map((event) => {
10440
- const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10441
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10442
- const isFirstDay = dateFns.isSameDay(day, eventStart);
10443
- const isLastDay = dateFns.isSameDay(day, eventEnd);
10444
- 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(
10445
10648
  EventItemAgenda,
10446
10649
  {
10447
10650
  event,
10448
- isFirstDay,
10449
- isLastDay,
10651
+ isFirstDay: true,
10652
+ isLastDay: true,
10450
10653
  onClick: (e) => handleEventClick(event, e),
10451
- view: "month"
10452
- },
10453
- event.id
10454
- );
10455
- }) })
10456
- ] })
10457
- }
10458
- )
10459
- ] })
10460
- ]
10461
- }
10462
- )
10463
- ]
10464
- }
10465
- )
10466
- },
10467
- day.toString()
10468
- );
10469
- })
10470
- },
10471
- `week-${weekIndex}`
10472
- )) }),
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
+ }) }),
10473
10735
  /* @__PURE__ */ jsxRuntime.jsx(
10474
10736
  UndatedEvents,
10475
10737
  {
@@ -10502,7 +10764,8 @@ function DraggableEvent({
10502
10764
  isFirstDay = true,
10503
10765
  isLastDay = true,
10504
10766
  "aria-hidden": ariaHidden,
10505
- draggable = true
10767
+ draggable = true,
10768
+ totalCols
10506
10769
  }) {
10507
10770
  const { activeId } = useCalendarDndAgenda();
10508
10771
  const elementRef = React32.useRef(null);
@@ -10587,7 +10850,8 @@ function DraggableEvent({
10587
10850
  onMouseDown: handleMouseDown,
10588
10851
  onTouchStart: handleTouchStart,
10589
10852
  showTime,
10590
- view
10853
+ view,
10854
+ totalCols
10591
10855
  }
10592
10856
  )
10593
10857
  }
@@ -10601,14 +10865,10 @@ function WeekViewAgenda({
10601
10865
  showUndatedEvents
10602
10866
  }) {
10603
10867
  const days = React32.useMemo(() => {
10604
- const weekStart2 = dateFns.startOfWeek(currentDate, { weekStartsOn: 0 });
10868
+ const weekStart = dateFns.startOfWeek(currentDate, { weekStartsOn: 0 });
10605
10869
  const weekEnd = dateFns.endOfWeek(currentDate, { weekStartsOn: 0 });
10606
- return dateFns.eachDayOfInterval({ end: weekEnd, start: weekStart2 });
10870
+ return dateFns.eachDayOfInterval({ end: weekEnd, start: weekStart });
10607
10871
  }, [currentDate]);
10608
- const weekStart = React32.useMemo(
10609
- () => dateFns.startOfWeek(currentDate, { weekStartsOn: 0 }),
10610
- [currentDate]
10611
- );
10612
10872
  const hours = React32.useMemo(() => {
10613
10873
  const dayStart = dateFns.startOfDay(currentDate);
10614
10874
  return dateFns.eachHourOfInterval({
@@ -10641,6 +10901,25 @@ function WeekViewAgenda({
10641
10901
  });
10642
10902
  });
10643
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]);
10644
10923
  const processedDayEvents = React32.useMemo(() => {
10645
10924
  const result = days.map((day) => {
10646
10925
  const dayEvents = events.filter((event) => {
@@ -10661,56 +10940,69 @@ function WeekViewAgenda({
10661
10940
  const bDuration = dateFns.differenceInMinutes(bEnd, bStart);
10662
10941
  return bDuration - aDuration;
10663
10942
  });
10664
- const positionedEvents = [];
10665
10943
  const dayStart = dateFns.startOfDay(day);
10666
10944
  const columns = [];
10945
+ const layouts = [];
10667
10946
  for (const event of sortedEvents) {
10668
10947
  const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
10669
- 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;
10670
10950
  const adjustedStart = dateFns.isSameDay(day, eventStart) ? eventStart : dayStart;
10671
10951
  const adjustedEnd = dateFns.isSameDay(day, eventEnd) ? eventEnd : dateFns.addHours(dayStart, 24);
10672
10952
  const startHour = dateFns.getHours(adjustedStart) + dateFns.getMinutes(adjustedStart) / 60;
10673
10953
  const endHour = dateFns.getHours(adjustedEnd) + dateFns.getMinutes(adjustedEnd) / 60;
10674
10954
  const top = (startHour - StartHour) * WeekCellsHeightAgenda;
10675
- const height = (endHour - startHour) * WeekCellsHeightAgenda;
10676
- let columnIndex = 0;
10677
- let placed = false;
10678
- while (!placed) {
10679
- const col = columns[columnIndex] || [];
10680
- if (col.length === 0) {
10681
- columns[columnIndex] = col;
10682
- placed = true;
10683
- } else {
10684
- const overlaps = col.some((c) => {
10685
- const cStart = getEventStartDate(c.event) ?? getEventEndDate(c.event) ?? /* @__PURE__ */ new Date();
10686
- const cEnd = getEventEndDate(c.event) ?? getEventStartDate(c.event) ?? /* @__PURE__ */ new Date();
10687
- return dateFns.areIntervalsOverlapping(
10688
- { end: adjustedEnd, start: adjustedStart },
10689
- { end: cEnd, start: cStart }
10690
- );
10691
- });
10692
- if (!overlaps) {
10693
- placed = true;
10694
- } else {
10695
- columnIndex++;
10696
- }
10697
- }
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++;
10698
10971
  }
10699
- const currentColumn = columns[columnIndex] || [];
10700
- columns[columnIndex] = currentColumn;
10701
- currentColumn.push({ end: adjustedEnd, event });
10702
- const width = columnIndex === 0 ? 1 : 0.9;
10703
- const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
10704
- positionedEvents.push({
10972
+ if (!columns[col]) columns[col] = [];
10973
+ columns[col].push({ start: adjustedStart, end: adjustedEnd });
10974
+ layouts.push({
10705
10975
  event,
10706
- height,
10707
- left,
10976
+ adjustedStart,
10977
+ adjustedEnd,
10708
10978
  top,
10709
- width,
10710
- zIndex: 10 + columnIndex
10979
+ height,
10980
+ col,
10981
+ totalCols: 0
10711
10982
  });
10712
10983
  }
10713
- 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
+ }));
10714
11006
  });
10715
11007
  return result;
10716
11008
  }, [days, events]);
@@ -10720,178 +11012,476 @@ function WeekViewAgenda({
10720
11012
  };
10721
11013
  const showAllDaySection = allDayEvents.length > 0;
10722
11014
  const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(currentDate, "week");
10723
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", "data-slot": "week-view", children: [
10724
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background", children: [
10725
- /* @__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") }) }),
10726
- days.map((day) => /* @__PURE__ */ jsxRuntime.jsxs(
10727
- "div",
10728
- {
10729
- className: "py-2 text-center text-muted-foreground/70 text-sm data-today:font-medium data-today:text-foreground",
10730
- "data-today": dateFns.isToday(day) || void 0,
10731
- children: [
10732
- /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": "true", className: "sm:hidden", children: [
10733
- dateFns.format(day, "EEE", { locale: locale.ptBR })[0],
10734
- " ",
10735
- dateFns.format(day, "d", { locale: locale.ptBR })
10736
- ] }),
10737
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-sm:hidden", children: dateFns.format(day, "EEE dd", { locale: locale.ptBR }) })
10738
- ]
10739
- },
10740
- day.toString()
10741
- ))
10742
- ] }),
10743
- 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: [
10744
- /* @__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" }) }),
10745
- days.map((day, dayIndex) => {
10746
- const dayAllDayEvents = allDayEvents.filter((event) => {
10747
- const eventStart = getEventStartDate(event);
10748
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event);
10749
- if (!eventStart && !eventEnd) return false;
10750
- return eventStart && dateFns.isSameDay(day, eventStart) || eventStart && eventEnd && day > eventStart && day < eventEnd || eventEnd && dateFns.isSameDay(day, eventEnd);
10751
- });
10752
- 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(
10753
11020
  "div",
10754
11021
  {
10755
- 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",
10756
11023
  "data-today": dateFns.isToday(day) || void 0,
10757
- children: dayAllDayEvents.map((event) => {
10758
- const eventStart = getEventStartDate(event);
10759
- const eventEnd = getEventEndDate(event) ?? getEventStartDate(event);
10760
- const isFirstDay = eventStart ? dateFns.isSameDay(day, eventStart) : false;
10761
- const isLastDay = eventEnd ? dateFns.isSameDay(day, eventEnd) : false;
10762
- const isFirstVisibleDay = eventStart ? dayIndex === 0 && dateFns.isBefore(eventStart, weekStart) : false;
10763
- const shouldShowTitle = isFirstDay || isFirstVisibleDay;
10764
- return /* @__PURE__ */ jsxRuntime.jsx(
10765
- EventItemAgenda,
10766
- {
10767
- event,
10768
- isFirstDay,
10769
- isLastDay,
10770
- onClick: (e) => handleEventClick(event, e),
10771
- view: "month",
10772
- children: /* @__PURE__ */ jsxRuntime.jsx(
10773
- "div",
10774
- {
10775
- "aria-hidden": !shouldShowTitle,
10776
- className: cn(
10777
- "truncate",
10778
- !shouldShowTitle && "invisible"
10779
- ),
10780
- children: event.title
10781
- }
10782
- )
10783
- },
10784
- `spanning-${event.id}`
10785
- );
10786
- })
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
+ ]
10787
11033
  },
10788
11034
  day.toString()
10789
- );
10790
- })
10791
- ] }) }),
10792
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 grid-cols-8 overflow-hidden", children: [
10793
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid auto-cols-fr border-border/70 border-r", children: hours.map((hour, index) => /* @__PURE__ */ jsxRuntime.jsx(
10794
- "div",
10795
- {
10796
- className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
10797
- 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") })
10798
- },
10799
- hour.toString()
10800
- )) }),
10801
- days.map((day, dayIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
10802
- "div",
10803
- {
10804
- className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
10805
- "data-today": dateFns.isToday(day) || void 0,
10806
- children: [
10807
- (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => /* @__PURE__ */ jsxRuntime.jsx(
10808
- "div",
10809
- {
10810
- className: "absolute z-10 px-0.5",
10811
- onClick: (e) => e.stopPropagation(),
10812
- style: {
10813
- height: `${positionedEvent.height}px`,
10814
- left: `${positionedEvent.left * 100}%`,
10815
- top: `${positionedEvent.top}px`,
10816
- width: `${positionedEvent.width * 100}%`,
10817
- zIndex: positionedEvent.zIndex
10818
- },
10819
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full", children: /* @__PURE__ */ jsxRuntime.jsx(
10820
- DraggableEvent,
10821
- {
10822
- event: positionedEvent.event,
10823
- height: positionedEvent.height,
10824
- onClick: (e) => handleEventClick(positionedEvent.event, e),
10825
- draggable: false,
10826
- showTime: true,
10827
- view: "week"
10828
- }
10829
- ) })
10830
- },
10831
- positionedEvent.event.id
10832
- )),
10833
- currentTimeVisible && dateFns.isToday(day) && /* @__PURE__ */ jsxRuntime.jsx(
10834
- "div",
10835
- {
10836
- className: "pointer-events-none absolute right-0 left-0 z-20",
10837
- style: { top: `${currentTimePosition}%` },
10838
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
10839
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-left-1 absolute h-2 w-2 rounded-full bg-primary" }),
10840
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[2px] w-full bg-primary" })
10841
- ] })
10842
- }
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",
11048
+ {
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"
10843
11107
  ),
10844
- hours.map((hour) => {
10845
- const hourValue = dateFns.getHours(hour);
10846
- 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(
10847
11111
  "div",
10848
11112
  {
10849
- className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
10850
- children: [0, 1, 2, 3].map((quarter) => {
10851
- const quarterHourTime = hourValue + quarter * 0.25;
10852
- return /* @__PURE__ */ jsxRuntime.jsx(
10853
- 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",
10854
11118
  {
10855
- className: cn(
10856
- "absolute h-[calc(var(--week-cells-height)/4)] w-full",
10857
- quarter === 0 && "top-0",
10858
- quarter === 1 && "top-[calc(var(--week-cells-height)/4)]",
10859
- quarter === 2 && "top-[calc(var(--week-cells-height)/4*2)]",
10860
- quarter === 3 && "top-[calc(var(--week-cells-height)/4*)]"
10861
- ),
10862
- date: day,
10863
- id: `week-cell-${day.toISOString()}-${quarterHourTime}`,
10864
- onClick: () => {
10865
- const startTime = new Date(day);
10866
- startTime.setHours(hourValue);
10867
- startTime.setMinutes(quarter * 15);
10868
- 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
+ )
10869
11180
  },
10870
- 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
10871
11222
  },
10872
- `${hour.toString()}-${quarter}`
10873
- );
10874
- })
10875
- },
10876
- hour.toString()
10877
- );
10878
- })
10879
- ]
10880
- },
10881
- day.toString()
10882
- ))
10883
- ] }),
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
+ ] }) }),
10884
11309
  /* @__PURE__ */ jsxRuntime.jsx(
10885
11310
  UndatedEvents,
10886
11311
  {
10887
11312
  events,
10888
11313
  onEventSelect,
10889
11314
  show: showUndatedEvents,
10890
- className: "my-"
11315
+ className: "my-4"
10891
11316
  }
10892
11317
  )
10893
11318
  ] });
10894
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
+ }
10895
11485
  function AgendaView({
10896
11486
  currentDate,
10897
11487
  events,
@@ -11737,23 +12327,23 @@ function EventCalendar({
11737
12327
  });
11738
12328
  };
11739
12329
  const viewTitle = React32.useMemo(() => {
11740
- 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;
11741
12331
  if (view === "month") {
11742
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
12332
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
11743
12333
  }
11744
12334
  if (view === "week") {
11745
12335
  const start = dateFns.startOfWeek(currentDate, { weekStartsOn: 1 });
11746
12336
  const end = dateFns.endOfWeek(currentDate, { weekStartsOn: 1 });
11747
12337
  if (dateFns.isSameMonth(start, end)) {
11748
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
12338
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
11749
12339
  }
11750
- const s1 = capitalize(dateFns.format(start, "MMM", { locale: locale.ptBR }));
11751
- 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 }));
11752
12342
  return `${s1} - ${s2}`;
11753
12343
  }
11754
12344
  if (view === "day") {
11755
12345
  const dayNum = dateFns.format(currentDate, "d", { locale: locale.ptBR });
11756
- const month = capitalize(dateFns.format(currentDate, "MMMM", { locale: locale.ptBR }));
12346
+ const month = capitalize2(dateFns.format(currentDate, "MMMM", { locale: locale.ptBR }));
11757
12347
  const year = dateFns.format(currentDate, "yyyy", { locale: locale.ptBR });
11758
12348
  const short = `${dayNum} de ${month} de ${year}`;
11759
12349
  const long = `${dateFns.format(currentDate, "EEE", {
@@ -11769,13 +12359,13 @@ function EventCalendar({
11769
12359
  const start = currentDate;
11770
12360
  const end = dateFns.addDays(currentDate, AgendaDaysToShow - 1);
11771
12361
  if (dateFns.isSameMonth(start, end)) {
11772
- return capitalize(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
12362
+ return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
11773
12363
  }
11774
- const s1 = capitalize(dateFns.format(start, "MMM", { locale: locale.ptBR }));
11775
- 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 }));
11776
12366
  return `${s1} - ${s2}`;
11777
12367
  }
11778
- return capitalize(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
12368
+ return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
11779
12369
  }, [currentDate, view]);
11780
12370
  const calendarContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11781
12371
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -13935,14 +14525,14 @@ var generateAdditionalColors = (baseColors, count) => {
13935
14525
  r /= 255;
13936
14526
  g /= 255;
13937
14527
  b /= 255;
13938
- 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);
13939
14529
  let h = 0;
13940
14530
  let s = 0;
13941
- const l = (max + min) / 2;
13942
- if (max !== min) {
13943
- const d = max - min;
13944
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
13945
- 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) {
13946
14536
  case r:
13947
14537
  h = (g - b) / d + (g < b ? 6 : 0);
13948
14538
  break;
@@ -14059,25 +14649,25 @@ var computeNiceMax = (maxValue) => {
14059
14649
  return niceCeil(padded);
14060
14650
  };
14061
14651
  var getMaxDataValue = (data, keys) => {
14062
- let max = 0;
14652
+ let max2 = 0;
14063
14653
  for (const row of data) {
14064
14654
  for (const key of keys) {
14065
14655
  const v = row[key];
14066
- if (typeof v === "number" && Number.isFinite(v) && v > max) max = v;
14656
+ if (typeof v === "number" && Number.isFinite(v) && v > max2) max2 = v;
14067
14657
  }
14068
14658
  }
14069
- return max;
14659
+ return max2;
14070
14660
  };
14071
14661
  var getMinDataValue = (data, keys) => {
14072
- let min = 0;
14662
+ let min2 = 0;
14073
14663
  for (const row of data) {
14074
14664
  for (const key of keys) {
14075
14665
  const v = row[key];
14076
- if (typeof v === "number" && Number.isFinite(v) && v < min)
14077
- min = v;
14666
+ if (typeof v === "number" && Number.isFinite(v) && v < min2)
14667
+ min2 = v;
14078
14668
  }
14079
14669
  }
14080
- return min;
14670
+ return min2;
14081
14671
  };
14082
14672
  var computeChartWidth = (width, dataLength, series, niceMaxLeft, niceMaxRight) => {
14083
14673
  if (typeof width === "number") return width;
@@ -14123,8 +14713,8 @@ var createValueFormatter = (customFormatter, formatBR) => {
14123
14713
  });
14124
14714
  const prefixFormats = ["R$", "$", "\u20AC", "\xA3"];
14125
14715
  const suffixFormats = ["%", "kg", "km", "m", "L", "un", "t", "h", "min", "s"];
14126
- const getFormattedValue = (baseValue, format17) => {
14127
- const trimmedFormat = format17.trim();
14716
+ const getFormattedValue = (baseValue, format19) => {
14717
+ const trimmedFormat = format19.trim();
14128
14718
  if (prefixFormats.includes(trimmedFormat)) {
14129
14719
  return `${trimmedFormat} ${baseValue}`;
14130
14720
  }
@@ -14149,8 +14739,8 @@ var createValueFormatter = (customFormatter, formatBR) => {
14149
14739
  num = Number.isNaN(parsed) ? NaN : parsed;
14150
14740
  }
14151
14741
  const baseFormatted = formatBR && !Number.isNaN(num) ? nf.format(num) : String(formattedValue ?? value ?? "");
14152
- const format17 = propsDataKey && formatterMap[propsDataKey] ? formatterMap[propsDataKey] : "";
14153
- return format17 ? getFormattedValue(baseFormatted, format17) : baseFormatted;
14742
+ const format19 = propsDataKey && formatterMap[propsDataKey] ? formatterMap[propsDataKey] : "";
14743
+ return format19 ? getFormattedValue(baseFormatted, format19) : baseFormatted;
14154
14744
  };
14155
14745
  }
14156
14746
  if (typeof customFormatter === "function") {
@@ -18463,8 +19053,8 @@ var TimeSeries_default = TimeSeries;
18463
19053
  function NumericInput({
18464
19054
  value,
18465
19055
  onChange,
18466
- min,
18467
- max,
19056
+ min: min2,
19057
+ max: max2,
18468
19058
  label,
18469
19059
  className,
18470
19060
  error,
@@ -18481,21 +19071,21 @@ function NumericInput({
18481
19071
  if (!hasChanged || isLoading || disabled) return;
18482
19072
  onChange(internalValue);
18483
19073
  };
18484
- function handleNumberChange(value2, currentValue = 0, max2 = 9999999, min2 = 0) {
19074
+ function handleNumberChange(value2, currentValue = 0, max3 = 9999999, min3 = 0) {
18485
19075
  const numbersOnly = value2.replace(/\D/g, "");
18486
19076
  if (numbersOnly === "") {
18487
19077
  return 0;
18488
19078
  }
18489
19079
  const numValue = Number(numbersOnly);
18490
- if (numValue < min2) {
19080
+ if (numValue < min3) {
18491
19081
  if (tooltip_on_overflow) {
18492
- sonner.toast.warning("O valor deve ser maior que " + min2.toString());
19082
+ sonner.toast.warning("O valor deve ser maior que " + min3.toString());
18493
19083
  }
18494
- return min2;
19084
+ return min3;
18495
19085
  }
18496
- if (numValue > max2) {
19086
+ if (numValue > max3) {
18497
19087
  if (tooltip_on_overflow) {
18498
- sonner.toast.warning("O valor deve ser menor que " + max2.toString());
19088
+ sonner.toast.warning("O valor deve ser menor que " + max3.toString());
18499
19089
  }
18500
19090
  return currentValue;
18501
19091
  }
@@ -18517,8 +19107,8 @@ function NumericInput({
18517
19107
  const processedValue = handleNumberChange(
18518
19108
  e.currentTarget.value,
18519
19109
  internalValue,
18520
- max,
18521
- min
19110
+ max2,
19111
+ min2
18522
19112
  );
18523
19113
  setInternalValue(processedValue);
18524
19114
  },
@@ -19336,6 +19926,12 @@ function useMediaQuery(query) {
19336
19926
  }, [query]);
19337
19927
  return value;
19338
19928
  }
19929
+ var CRUD_ITEMS = [
19930
+ { id: "edit", label: "Editar", icon: react.PencilIcon },
19931
+ { id: "copy", label: "Copiar", icon: react.CopyIcon },
19932
+ { id: "download", label: "Baixar", icon: react.DownloadIcon },
19933
+ { id: "delete", label: "Excluir", icon: react.TrashIcon, color: "danger" }
19934
+ ];
19339
19935
  var FULL_CIRCLE = 360;
19340
19936
  var START_ANGLE = -90;
19341
19937
  function degToRad(deg) {
@@ -19361,7 +19957,7 @@ function slicePath(index, total, wedgeRadius, innerRadius) {
19361
19957
  }
19362
19958
  function RadialMenu({
19363
19959
  children,
19364
- menuItems,
19960
+ menuItems = CRUD_ITEMS,
19365
19961
  size = 240,
19366
19962
  iconSize = 24,
19367
19963
  bandWidth = 60,
@@ -19372,44 +19968,13 @@ function RadialMenu({
19372
19968
  }) {
19373
19969
  const isMobile = useMediaQuery("(max-width: 768px)");
19374
19970
  const radius = size / 2;
19375
- const outerRingOuterRadius = radius;
19376
- const outerRingInnerRadius = outerRingOuterRadius - outerRingWidth;
19971
+ const outerRingInnerRadius = radius - outerRingWidth;
19377
19972
  const wedgeOuterRadius = outerRingInnerRadius - outerGap;
19378
19973
  const wedgeInnerRadius = wedgeOuterRadius - bandWidth;
19379
19974
  const iconRingRadius = (wedgeOuterRadius + wedgeInnerRadius) / 2;
19380
19975
  const centerRadius = Math.max(wedgeInnerRadius - innerGap, 0);
19381
19976
  const slice = 360 / menuItems.length;
19382
19977
  const [activeIndex, setActiveIndex] = React32__namespace.useState(null);
19383
- const timerRef = React32__namespace.useRef(null);
19384
- const isLongPress = React32__namespace.useRef(false);
19385
- const handleTouchStart = (e) => {
19386
- isLongPress.current = false;
19387
- const touch = e.touches[0];
19388
- const { clientX, clientY } = touch;
19389
- timerRef.current = setTimeout(() => {
19390
- isLongPress.current = true;
19391
- const event = new MouseEvent("contextmenu", {
19392
- bubbles: true,
19393
- cancelable: true,
19394
- view: window,
19395
- clientX,
19396
- clientY,
19397
- button: 2,
19398
- buttons: 2
19399
- });
19400
- e.target.dispatchEvent(event);
19401
- }, 1e3);
19402
- };
19403
- const handleTouchEnd = () => {
19404
- if (timerRef.current) {
19405
- clearTimeout(timerRef.current);
19406
- }
19407
- };
19408
- const handleTouchMove = () => {
19409
- if (timerRef.current) {
19410
- clearTimeout(timerRef.current);
19411
- }
19412
- };
19413
19978
  const containerVariants = {
19414
19979
  hidden: { opacity: 0, scale: 0.8 },
19415
19980
  visible: {
@@ -19439,22 +20004,13 @@ function RadialMenu({
19439
20004
  }
19440
20005
  };
19441
20006
  return /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuBase, { children: [
19442
- /* @__PURE__ */ jsxRuntime.jsx(ContextMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
19443
- "div",
19444
- {
19445
- className: "select-none outline-none group touch-none",
19446
- onTouchStart: handleTouchStart,
19447
- onTouchEnd: handleTouchEnd,
19448
- onTouchMove: handleTouchMove,
19449
- children: children || /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-80 flex justify-center items-center border-2 border-dashed border-muted-foreground/20 rounded-xl bg-muted/5 text-muted-foreground hover:bg-muted/10 transition-colors", children: "Right-click or Long-press here (1s)" })
19450
- }
19451
- ) }),
20007
+ /* @__PURE__ */ jsxRuntime.jsx(ContextMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "select-none outline-none group touch-none", children: children || /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-80 flex justify-center items-center border-2 border-dashed border-muted-foreground/20 rounded-xl bg-muted/5 cursor-context-menu", children: "Clique com bot\xE3o direito" }) }) }),
19452
20008
  /* @__PURE__ */ jsxRuntime.jsx(
19453
20009
  ContextMenuContentBase,
19454
20010
  {
19455
20011
  className: "p-0 border-none bg-transparent shadow-none overflow-visible -translate-x-1/2 -translate-y-1/2",
19456
20012
  style: { width: size, height: size },
19457
- children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsxs(
20013
+ children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsx(
19458
20014
  framerMotion.motion.div,
19459
20015
  {
19460
20016
  className: "relative size-full drop-shadow-xl will-change-transform",
@@ -19462,92 +20018,73 @@ function RadialMenu({
19462
20018
  initial: "hidden",
19463
20019
  animate: "visible",
19464
20020
  exit: "exit",
19465
- children: [
19466
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-background/5 blur-2xl -z-10" }),
19467
- /* @__PURE__ */ jsxRuntime.jsxs(
19468
- "svg",
19469
- {
19470
- className: "absolute inset-0 size-full overflow-visible",
19471
- viewBox: `${-radius} ${-radius} ${radius * 2} ${radius * 2}`,
19472
- children: [
19473
- /* @__PURE__ */ jsxRuntime.jsx(
19474
- framerMotion.motion.circle,
20021
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
20022
+ "svg",
20023
+ {
20024
+ className: "absolute inset-0 size-full overflow-visible",
20025
+ viewBox: `${-radius} ${-radius} ${radius * 2} ${radius * 2}`,
20026
+ children: [
20027
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.circle, { r: centerRadius, className: "fill-background stroke-border stroke-1" }),
20028
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: activeIndex !== null && /* @__PURE__ */ jsxRuntime.jsx(
20029
+ framerMotion.motion.text,
20030
+ {
20031
+ initial: { opacity: 0, y: 5 },
20032
+ animate: { opacity: 1, y: 0 },
20033
+ exit: { opacity: 0 },
20034
+ textAnchor: "middle",
20035
+ dominantBaseline: "middle",
20036
+ className: "fill-foreground text-[11px] font-bold uppercase tracking-tighter pointer-events-none",
20037
+ children: menuItems[activeIndex].label
20038
+ }
20039
+ ) }),
20040
+ menuItems.map((item, index) => {
20041
+ const Icon = item.icon;
20042
+ const midDeg = START_ANGLE + slice * index;
20043
+ const { x: iconX, y: iconY } = polarToCartesian(iconRingRadius, midDeg);
20044
+ const isActive = activeIndex === index;
20045
+ const ICON_BOX = iconSize * 2.5;
20046
+ return /* @__PURE__ */ jsxRuntime.jsxs(
20047
+ framerMotion.motion.g,
19475
20048
  {
19476
- r: centerRadius,
19477
- initial: { scale: 0 },
19478
- animate: { scale: 1 },
19479
- transition: isMobile ? { duration: 0 } : {
19480
- type: "spring",
19481
- stiffness: 300,
19482
- delay: 0.2
19483
- },
19484
- className: "fill-background stroke-border stroke-1 shadow-inner"
19485
- }
19486
- ),
19487
- menuItems.map((item, index) => {
19488
- const Icon = item.icon;
19489
- const midDeg = START_ANGLE + slice * index;
19490
- const { x: iconX, y: iconY } = polarToCartesian(
19491
- iconRingRadius,
19492
- midDeg
19493
- );
19494
- const isActive = activeIndex === index;
19495
- const ICON_BOX = iconSize * 2.5;
19496
- return /* @__PURE__ */ jsxRuntime.jsxs(
19497
- framerMotion.motion.g,
19498
- {
19499
- variants: itemVariants2,
19500
- className: "cursor-pointer outline-none",
19501
- onMouseEnter: () => setActiveIndex(index),
19502
- onMouseLeave: () => setActiveIndex(null),
19503
- onClick: () => onSelect?.(item),
19504
- style: { originX: "0px", originY: "0px" },
19505
- children: [
19506
- /* @__PURE__ */ jsxRuntime.jsx(
19507
- "path",
19508
- {
19509
- d: slicePath(
19510
- index,
19511
- menuItems.length,
19512
- wedgeOuterRadius,
19513
- wedgeInnerRadius
19514
- ),
19515
- className: cn(
19516
- "transition-colors duration-200 stroke-1",
19517
- isActive ? "fill-primary stroke-primary-foreground/20" : "fill-background/90 stroke-border/50 hover:fill-accent"
19518
- )
19519
- }
19520
- ),
19521
- /* @__PURE__ */ jsxRuntime.jsx(
19522
- "foreignObject",
19523
- {
19524
- x: iconX - ICON_BOX / 2,
19525
- y: iconY - ICON_BOX / 2,
19526
- width: ICON_BOX,
19527
- height: ICON_BOX,
19528
- className: "pointer-events-none",
19529
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
19530
- Icon,
19531
- {
19532
- size: iconSize,
19533
- weight: isActive ? "fill" : "regular",
19534
- className: cn(
19535
- "transition-all duration-200",
19536
- isActive ? "text-primary-foreground " : "text-muted-foreground"
19537
- )
19538
- }
19539
- ) })
19540
- }
19541
- )
19542
- ]
20049
+ variants: itemVariants2,
20050
+ className: "cursor-pointer outline-none",
20051
+ onMouseEnter: () => setActiveIndex(index),
20052
+ onMouseLeave: () => setActiveIndex(null),
20053
+ onClick: (e) => {
20054
+ e.stopPropagation();
20055
+ onSelect?.(item);
19543
20056
  },
19544
- item.id
19545
- );
19546
- })
19547
- ]
19548
- }
19549
- )
19550
- ]
20057
+ style: { originX: "0px", originY: "0px" },
20058
+ children: [
20059
+ /* @__PURE__ */ jsxRuntime.jsx(
20060
+ "path",
20061
+ {
20062
+ d: slicePath(index, menuItems.length, wedgeOuterRadius, wedgeInnerRadius),
20063
+ className: cn(
20064
+ "transition-colors duration-200 stroke-1",
20065
+ isActive ? item.color === "danger" ? "fill-destructive stroke-destructive-foreground/20" : "fill-primary stroke-primary-foreground/20" : "fill-background/90 stroke-border/50 hover:fill-accent"
20066
+ )
20067
+ }
20068
+ ),
20069
+ /* @__PURE__ */ jsxRuntime.jsx("foreignObject", { x: iconX - ICON_BOX / 2, y: iconY - ICON_BOX / 2, width: ICON_BOX, height: ICON_BOX, className: "pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
20070
+ Icon,
20071
+ {
20072
+ size: iconSize,
20073
+ weight: isActive ? "fill" : "regular",
20074
+ className: cn(
20075
+ "transition-all duration-200",
20076
+ isActive ? "text-primary-foreground" : item.color === "danger" ? "text-destructive" : "text-muted-foreground"
20077
+ )
20078
+ }
20079
+ ) }) })
20080
+ ]
20081
+ },
20082
+ item.id
20083
+ );
20084
+ })
20085
+ ]
20086
+ }
20087
+ )
19551
20088
  }
19552
20089
  ) })
19553
20090
  }
@@ -19564,6 +20101,8 @@ function ControlledCombobox({
19564
20101
  searchPlaceholder,
19565
20102
  empty = "Nenhum dado encontrado",
19566
20103
  error,
20104
+ label,
20105
+ labelClassname,
19567
20106
  testIds = {},
19568
20107
  onClear,
19569
20108
  hasSelected = false,
@@ -19577,9 +20116,10 @@ function ControlledCombobox({
19577
20116
  return /* @__PURE__ */ jsxRuntime.jsxs(
19578
20117
  "div",
19579
20118
  {
19580
- className: "col-span-1 w-full",
20119
+ className: "w-full flex flex-col",
19581
20120
  "data-testid": testIds.root ?? "combobox-base-root",
19582
20121
  children: [
20122
+ label && /* @__PURE__ */ jsxRuntime.jsx(LabelBase_default, { className: labelClassname, children: label }),
19583
20123
  /* @__PURE__ */ jsxRuntime.jsxs(
19584
20124
  PopoverBase,
19585
20125
  {
@@ -19638,16 +20178,16 @@ function ControlledCombobox({
19638
20178
  /* @__PURE__ */ jsxRuntime.jsx(
19639
20179
  PopoverContentBase,
19640
20180
  {
19641
- className: "max-h-[--radix-popover-content-available-height] w-[--radix-popover-trigger-width] p-0 border-none",
20181
+ className: "max-h-[--radix-popover-content-available-height] w-[--radix-popover-trigger-width] p-0 border-none focus:ring-0 focus:outline-none",
19642
20182
  "data-testid": testIds.popover ?? "combobox-popover",
19643
20183
  children: /* @__PURE__ */ jsxRuntime.jsxs(
19644
20184
  CommandBase,
19645
20185
  {
19646
- className: "dark:text-white hover:bg-rsecondary",
20186
+ className: "dark:text-white hover:bg-rsecondary focus:ring-0 focus:outline-none",
19647
20187
  "data-testid": testIds.command ?? "combobox-command",
19648
20188
  filter: onSearchChange ? () => 1 : (value, search2) => {
19649
- const label = items.find((item) => item.value === value)?.label || value;
19650
- if (label.toLowerCase().includes(search2.toLowerCase()))
20189
+ const label2 = items.find((item) => item.value === value)?.label || value;
20190
+ if (label2.toLowerCase().includes(search2.toLowerCase()))
19651
20191
  return 1;
19652
20192
  return 0;
19653
20193
  },
@@ -19669,6 +20209,7 @@ function ControlledCombobox({
19669
20209
  {
19670
20210
  "data-testid": testIds.list ?? "combobox-list",
19671
20211
  onEndReached,
20212
+ className: "focus:ring-0 focus:outline-none",
19672
20213
  children: [
19673
20214
  /* @__PURE__ */ jsxRuntime.jsx(CommandEmptyBase, { "data-testid": testIds.empty ?? "combobox-empty", children: loading ? "Carregando..." : empty }),
19674
20215
  /* @__PURE__ */ jsxRuntime.jsx(CommandGroupBase, { "data-testid": testIds.group ?? "combobox-group", children: items.map((item) => {
@@ -19873,6 +20414,7 @@ exports.EndHourAgenda = EndHourAgenda;
19873
20414
  exports.ErrorMessage = ErrorMessage_default;
19874
20415
  exports.EventAgenda = EventAgenda;
19875
20416
  exports.EventCalendar = EventCalendar;
20417
+ exports.EventDetailModalAgenda = EventDetailModalAgenda;
19876
20418
  exports.EventDialog = EventDialog;
19877
20419
  exports.EventGap = EventGap;
19878
20420
  exports.EventGapAgenda = EventGapAgenda;
@@ -19917,6 +20459,7 @@ exports.MonthView = MonthView;
19917
20459
  exports.MonthViewAgenda = MonthViewAgenda;
19918
20460
  exports.MoreButton = MoreButton;
19919
20461
  exports.MultiCombobox = MultiCombobox;
20462
+ exports.MultiDayOverlay = MultiDayOverlay;
19920
20463
  exports.MultiSelect = MultiSelect;
19921
20464
  exports.MultiSelectBase = MultiSelectBase;
19922
20465
  exports.MultiSelectContentBase = MultiSelectContentBase;