@kumix/ui 0.2.2 → 0.2.4

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.
Files changed (152) hide show
  1. package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
  2. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  3. package/dist/components/reui/data-grid/data-grid-pagination.d.ts +2 -2
  4. package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
  5. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  6. package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
  7. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  8. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
  9. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  10. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
  11. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  12. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +9 -2
  13. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
  14. package/dist/components/reui/data-grid/data-grid-table-virtual.js +158 -3
  15. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  16. package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
  17. package/dist/components/reui/data-grid/data-grid-table.js +1 -0
  18. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  19. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  20. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  21. package/dist/components/reui/date-selector.d.ts.map +1 -1
  22. package/dist/components/reui/date-selector.js.map +1 -1
  23. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +10 -2
  24. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  25. package/dist/components/reui/event-calendar/event-calendar-content.js +1 -1
  26. package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
  27. package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts +3 -1
  28. package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts.map +1 -1
  29. package/dist/components/reui/event-calendar/event-calendar-dnd.js +100 -20
  30. package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
  31. package/dist/components/reui/event-calendar/event-calendar-event.js +5 -4
  32. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  33. package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts +16 -4
  34. package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -1
  35. package/dist/components/reui/event-calendar/event-calendar-i18n.js +10 -9
  36. package/dist/components/reui/event-calendar/event-calendar-i18n.js.map +1 -1
  37. package/dist/components/reui/event-calendar/event-calendar-lib.d.ts +13 -6
  38. package/dist/components/reui/event-calendar/event-calendar-lib.d.ts.map +1 -1
  39. package/dist/components/reui/event-calendar/event-calendar-lib.js +30 -12
  40. package/dist/components/reui/event-calendar/event-calendar-lib.js.map +1 -1
  41. package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts.map +1 -1
  42. package/dist/components/reui/event-calendar/event-calendar-month-view.js +43 -6
  43. package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
  44. package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -1
  45. package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -1
  46. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  47. package/dist/components/reui/event-calendar/event-calendar-recurrence.d.ts +3 -2
  48. package/dist/components/reui/event-calendar/event-calendar-recurrence.d.ts.map +1 -1
  49. package/dist/components/reui/event-calendar/event-calendar-recurrence.js +56 -22
  50. package/dist/components/reui/event-calendar/event-calendar-recurrence.js.map +1 -1
  51. package/dist/components/reui/event-calendar/event-calendar-resource-view.js +13 -4
  52. package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
  53. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts +1 -1
  54. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -1
  55. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +21 -5
  56. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  57. package/dist/components/reui/event-calendar/event-calendar-types.d.ts +5 -0
  58. package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
  59. package/dist/components/reui/event-calendar/event-calendar.d.ts +2 -2
  60. package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
  61. package/dist/components/reui/event-calendar/event-calendar.js +106 -10
  62. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  63. package/dist/components/reui/frame.d.ts +7 -8
  64. package/dist/components/reui/frame.d.ts.map +1 -1
  65. package/dist/components/reui/frame.js +13 -11
  66. package/dist/components/reui/frame.js.map +1 -1
  67. package/dist/components/reui/gantt/gantt-i18n.d.ts.map +1 -1
  68. package/dist/components/reui/gantt/gantt-i18n.js +2 -1
  69. package/dist/components/reui/gantt/gantt-i18n.js.map +1 -1
  70. package/dist/components/reui/gantt/gantt-lib.d.ts.map +1 -1
  71. package/dist/components/reui/gantt/gantt-lib.js +2 -1
  72. package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
  73. package/dist/components/reui/gantt/gantt-nav.d.ts +1 -1
  74. package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -1
  75. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  76. package/dist/components/reui/gantt/gantt-recurrence.js +18 -17
  77. package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
  78. package/dist/components/reui/gantt/gantt-view.js +53 -6
  79. package/dist/components/reui/gantt/gantt-view.js.map +1 -1
  80. package/dist/components/reui/gantt/gantt.d.ts +8 -0
  81. package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
  82. package/dist/components/reui/gantt/gantt.js +2 -0
  83. package/dist/components/reui/gantt/gantt.js.map +1 -1
  84. package/dist/components/reui/icon-stack.d.ts +2 -3
  85. package/dist/components/reui/icon-stack.d.ts.map +1 -1
  86. package/dist/components/reui/icon-stack.js.map +1 -1
  87. package/dist/components/reui/icon-tile.d.ts +37 -0
  88. package/dist/components/reui/icon-tile.d.ts.map +1 -0
  89. package/dist/components/reui/icon-tile.js +103 -0
  90. package/dist/components/reui/icon-tile.js.map +1 -0
  91. package/dist/components/reui/kanban.d.ts.map +1 -1
  92. package/dist/components/reui/kanban.js +23 -8
  93. package/dist/components/reui/kanban.js.map +1 -1
  94. package/dist/components/reui/number-field.d.ts +7 -8
  95. package/dist/components/reui/number-field.d.ts.map +1 -1
  96. package/dist/components/reui/number-field.js +4 -4
  97. package/dist/components/reui/number-field.js.map +1 -1
  98. package/dist/components/reui/scrollspy.d.ts.map +1 -1
  99. package/dist/components/reui/scrollspy.js.map +1 -1
  100. package/dist/components/reui/sortable.d.ts.map +1 -1
  101. package/dist/components/reui/sortable.js +21 -10
  102. package/dist/components/reui/sortable.js.map +1 -1
  103. package/dist/components/ui/alert-dialog.js +1 -1
  104. package/dist/components/ui/alert-dialog.js.map +1 -1
  105. package/dist/components/ui/aspect-ratio.d.ts +2 -3
  106. package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
  107. package/dist/components/ui/aspect-ratio.js.map +1 -1
  108. package/dist/components/ui/badge.d.ts +1 -1
  109. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  110. package/dist/components/ui/breadcrumb.js +2 -0
  111. package/dist/components/ui/breadcrumb.js.map +1 -1
  112. package/dist/components/ui/bubble.d.ts +1 -1
  113. package/dist/components/ui/button-group.d.ts +3 -4
  114. package/dist/components/ui/button-group.d.ts.map +1 -1
  115. package/dist/components/ui/button-group.js.map +1 -1
  116. package/dist/components/ui/button.d.ts +1 -1
  117. package/dist/components/ui/card.js +1 -1
  118. package/dist/components/ui/card.js.map +1 -1
  119. package/dist/components/ui/carousel.d.ts.map +1 -1
  120. package/dist/components/ui/carousel.js +1 -2
  121. package/dist/components/ui/carousel.js.map +1 -1
  122. package/dist/components/ui/dialog.js +1 -1
  123. package/dist/components/ui/dialog.js.map +1 -1
  124. package/dist/components/ui/drawer.js +1 -1
  125. package/dist/components/ui/drawer.js.map +1 -1
  126. package/dist/components/ui/empty.d.ts +6 -7
  127. package/dist/components/ui/empty.d.ts.map +1 -1
  128. package/dist/components/ui/empty.js +1 -1
  129. package/dist/components/ui/empty.js.map +1 -1
  130. package/dist/components/ui/field.d.ts +14 -15
  131. package/dist/components/ui/field.d.ts.map +1 -1
  132. package/dist/components/ui/field.js.map +1 -1
  133. package/dist/components/ui/kbd.d.ts +2 -3
  134. package/dist/components/ui/kbd.d.ts.map +1 -1
  135. package/dist/components/ui/kbd.js +1 -1
  136. package/dist/components/ui/kbd.js.map +1 -1
  137. package/dist/components/ui/navigation-menu.d.ts +8 -9
  138. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  139. package/dist/components/ui/navigation-menu.js.map +1 -1
  140. package/dist/components/ui/progress.d.ts.map +1 -1
  141. package/dist/components/ui/progress.js +3 -3
  142. package/dist/components/ui/progress.js.map +1 -1
  143. package/dist/components/ui/sheet.js +1 -1
  144. package/dist/components/ui/sheet.js.map +1 -1
  145. package/dist/components/ui/skeleton.d.ts +1 -2
  146. package/dist/components/ui/skeleton.d.ts.map +1 -1
  147. package/dist/components/ui/skeleton.js.map +1 -1
  148. package/dist/components/ui/spinner.d.ts +1 -2
  149. package/dist/components/ui/spinner.d.ts.map +1 -1
  150. package/dist/components/ui/spinner.js.map +1 -1
  151. package/dist/theme.css +18 -58
  152. package/package.json +4 -4
@@ -5,7 +5,7 @@ import { getDayKey, getRangeKey, resolveOffDay, toZoned, zonedStartOfDay } from
5
5
  import { EventCalendarViewContext, useEventCalendar, useEventCalendarDay, useEventCalendarSelector, useEventCalendarSettings, useEventCalendarViewConfig, useEventCalendarViewSettings, useEventCalendarWeek } from "./event-calendar.js";
6
6
  import { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from "./event-calendar-dnd.js";
7
7
  import { EVENT_CALENDAR_GHOST, EventCalendarEvent } from "./event-calendar-event.js";
8
- import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
8
+ import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
9
9
  import { cn } from "@kumix/utils";
10
10
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { PlusIcon } from "lucide-react";
@@ -14,6 +14,20 @@ import { useRender } from "@base-ui/react/use-render";
14
14
  import { addDays, format, getWeek } from "date-fns";
15
15
  //#region src/components/reui/event-calendar/event-calendar-month-view.tsx
16
16
  const useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
17
+ let focusedChip = null;
18
+ /** Give focus back to the recorded chip's replacement, if `root` renders it. */
19
+ function restoreChipFocus(root, segments) {
20
+ const pending = focusedChip;
21
+ if (!root || !pending || pending.node.isConnected) return;
22
+ const active = document.activeElement;
23
+ if (active && active !== document.body) return;
24
+ const index = segments.findIndex((segment) => segment.occurrence.eventId === pending.eventId && segment.occurrence.recurrenceIndex === pending.recurrenceIndex);
25
+ if (index < 0) return;
26
+ const chip = root.querySelectorAll("[data-slot=event-calendar-event]")[index];
27
+ if (!chip) return;
28
+ focusedChip = null;
29
+ chip.focus();
30
+ }
17
31
  function EventCalendarMonthView({ className, render, maxEventsPerCell, ...props }) {
18
32
  const instance = useEventCalendar();
19
33
  const settings = useEventCalendarSettings();
@@ -212,7 +226,10 @@ function EventCalendarMonthWeek({ week, gridTemplateColumns, showWeekNumber, cap
212
226
  role: "rowheader",
213
227
  "data-slot": "event-calendar-week-number",
214
228
  className: cn("border-e px-2 pt-1 text-muted-foreground tabular-nums", viewConfig.classNames?.weekNumber),
215
- children: settings.i18n.labels.week(getWeek(toZoned(week[0], settings.timeZone), { weekStartsOn: settings.weekStartsOn }))
229
+ children: settings.i18n.labels.week(getWeek(toZoned(week[0], settings.timeZone), {
230
+ locale: settings.locale,
231
+ weekStartsOn: settings.weekStartsOn
232
+ }))
216
233
  }),
217
234
  week.map((day, col) => /* @__PURE__ */ jsx(EventCalendarMonthCell, {
218
235
  day,
@@ -287,7 +304,7 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
287
304
  const dayStart = zonedStartOfDay(day, settings.timeZone);
288
305
  const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);
289
306
  const { effective } = useEventCalendarViewSettings();
290
- const isOff = resolveOffDay(day, settings.timeZone, effective.offDays ? typeof viewConfig.offDays === "object" ? viewConfig.offDays : true : false);
307
+ const isOff = resolveOffDay(day, settings.timeZone, effective.offDays ? typeof viewConfig.offDays === "object" ? viewConfig.offDays : true : false, settings.weekendDays);
291
308
  const offClassName = typeof viewConfig.offDays === "object" && viewConfig.offDays.className || "bg-muted/25";
292
309
  const isDropTarget = useEventCalendarSelector((state) => {
293
310
  const drag = state.drag;
@@ -295,7 +312,7 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
295
312
  if (!(drag.proposedStart < dayEnd && drag.proposedEnd > dayStart)) return null;
296
313
  return drag.valid ? "valid" : "invalid";
297
314
  });
298
- const isInteracting = useEventCalendarSelector((state) => state.drag !== null || state.slotDraft !== null);
315
+ const isInteracting = useEventCalendarSelector((state) => viewConfig.showDayAddButton ? state.drag !== null || state.slotDraft !== null : false);
299
316
  const inDraft = useEventCalendarSelector((state) => {
300
317
  const draft = state.slotDraft;
301
318
  if (!draft?.allDay) return null;
@@ -341,6 +358,10 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
341
358
  placeholderIndex = placeholderAtMore ? -1 : insertRank;
342
359
  overflowCount = extraHidden + (m - visibleTimed.length) + (placeholderAtMore ? 1 : 0);
343
360
  }
361
+ const rootRef = useRef(null);
362
+ useIsoLayoutEffect(() => {
363
+ restoreChipFocus(rootRef.current, visibleTimed);
364
+ });
344
365
  const dropPlaceholder = inlineDrop ? /* @__PURE__ */ jsx("div", {
345
366
  "aria-hidden": true,
346
367
  "data-slot": "event-calendar-drop-placeholder",
@@ -363,6 +384,16 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
363
384
  visibleTimed.flatMap((segment, i) => {
364
385
  const chip = /* @__PURE__ */ jsx(EventCalendarEvent, {
365
386
  segment,
387
+ onFocus: (e) => {
388
+ focusedChip = {
389
+ node: e.currentTarget,
390
+ eventId: segment.occurrence.eventId,
391
+ recurrenceIndex: segment.occurrence.recurrenceIndex
392
+ };
393
+ },
394
+ onBlur: (e) => {
395
+ if (e.currentTarget.isConnected) focusedChip = null;
396
+ },
366
397
  className: "shrink-0"
367
398
  }, segment.occurrence.key);
368
399
  return i === placeholderIndex ? [dropPlaceholder, chip] : [chip];
@@ -412,6 +443,7 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
412
443
  defaultContent
413
444
  }) ?? defaultContent;
414
445
  return /* @__PURE__ */ jsxs("div", {
446
+ ref: rootRef,
415
447
  role: "gridcell",
416
448
  "data-slot": "event-calendar-month-cell",
417
449
  "data-today": isToday || void 0,
@@ -452,6 +484,7 @@ function EventCalendarMoreIndicator({ day, count, segments, dropInto }) {
452
484
  const settings = useEventCalendarSettings();
453
485
  const viewConfig = useEventCalendarViewConfig();
454
486
  const [open, setOpen] = useState(false);
487
+ const headerId = useId();
455
488
  const isDragging = useEventCalendarSelector((state) => state.drag !== null);
456
489
  useEffect(() => {
457
490
  if (isDragging) setOpen(false);
@@ -483,6 +516,8 @@ function EventCalendarMoreIndicator({ day, count, segments, dropInto }) {
483
516
  }), /* @__PURE__ */ jsx(PopoverContent, {
484
517
  "data-slot": "event-calendar-more-popover",
485
518
  align: viewConfig.morePopoverAlign,
519
+ "aria-labelledby": viewConfig.renderMoreContent ? void 0 : headerId,
520
+ "aria-label": viewConfig.renderMoreContent ? format(toZoned(day, settings.timeZone), settings.i18n.formats.moreDayHeader, { locale: settings.locale }) : void 0,
486
521
  className: cn("w-64 gap-1! p-2! text-xs", viewConfig.classNames?.morePopover),
487
522
  onClick: (e) => e.stopPropagation(),
488
523
  children: viewConfig.renderMoreContent ? viewConfig.renderMoreContent({
@@ -491,16 +526,18 @@ function EventCalendarMoreIndicator({ day, count, segments, dropInto }) {
491
526
  close: () => setOpen(false)
492
527
  }) : /* @__PURE__ */ jsx(EventCalendarMoreDefaultContent, {
493
528
  day,
494
- segments
529
+ segments,
530
+ headerId
495
531
  })
496
532
  })]
497
533
  });
498
534
  }
499
535
  /** Built-in "+N more" popover body: day header + the day's chips. */
500
- function EventCalendarMoreDefaultContent({ day, segments }) {
536
+ function EventCalendarMoreDefaultContent({ day, segments, headerId }) {
501
537
  const settings = useEventCalendarSettings();
502
538
  const viewConfig = useEventCalendarViewConfig();
503
539
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
540
+ id: headerId,
504
541
  className: cn("px-1 py-1 font-medium text-muted-foreground text-xs", viewConfig.classNames?.morePopoverHeader),
505
542
  children: format(toZoned(day, settings.timeZone), settings.i18n.formats.moreDayHeader, { locale: settings.locale })
506
543
  }), viewConfig.scrollbars === "native" ? /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"event-calendar-month-view.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-month-view.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n type Ref,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, format, getWeek } from \"date-fns\";\nimport { PlusIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { ScrollArea } from \"../../ui/scroll-area\";\nimport {\n EventCalendarViewContext,\n useEventCalendar,\n useEventCalendarDay,\n useEventCalendarSelector,\n useEventCalendarSettings,\n useEventCalendarViewConfig,\n useEventCalendarViewSettings,\n useEventCalendarWeek,\n} from \"./event-calendar\";\nimport { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from \"./event-calendar-dnd\";\nimport { EVENT_CALENDAR_GHOST, EventCalendarEvent } from \"./event-calendar-event\";\nimport {\n getDayKey,\n getRangeKey,\n resolveOffDay,\n toZoned,\n zonedStartOfDay,\n} from \"./event-calendar-lib\";\nimport type {\n EventCalendarDateRange,\n EventCalendarDragState,\n EventCalendarSegment,\n} from \"./event-calendar-types\";\n\n// Layout-effect on the client (measure before paint, no flash), plain effect on\n// the server (never runs there) to avoid the SSR useLayoutEffect warning.\nconst useIsoLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n\ninterface EventCalendarMonthViewProps extends useRender.ComponentProps<\"div\"> {\n maxEventsPerCell?: number | \"auto\";\n}\n\nfunction EventCalendarMonthView({\n className,\n render,\n maxEventsPerCell,\n ...props\n}: EventCalendarMonthViewProps) {\n const instance = useEventCalendar();\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const visibleRange = useEventCalendarSelector<unknown, EventCalendarDateRange>(\n (state) => state.visibleRange,\n {\n isEqual: (a, b) => getRangeKey(a) === getRangeKey(b),\n },\n );\n const anchorDate = useEventCalendarSelector((state) => state.date);\n\n const { effective } = useEventCalendarViewSettings();\n const weeks = useMemo(() => {\n const days: Date[] = [];\n let cursor = zonedStartOfDay(visibleRange.start, settings.timeZone);\n while (cursor < visibleRange.end) {\n days.push(cursor);\n cursor = zonedStartOfDay(addDays(toZoned(cursor, settings.timeZone), 1), settings.timeZone);\n }\n const rows: Date[][] = [];\n for (let i = 0; i < days.length; i += 7) rows.push(days.slice(i, i + 7));\n if (effective.weekends) return rows;\n return rows.map((row) =>\n row.filter((day) => !settings.weekendDays.includes(toZoned(day, settings.timeZone).getDay())),\n );\n }, [visibleRange, settings.timeZone, settings.weekendDays, effective.weekends]);\n\n const headerDays = weeks[0] ?? [];\n const title = settings.i18n.functions.formatTitle(\"month\", {\n date: toZoned(anchorDate, settings.timeZone),\n activeRange: instance.api.getActiveRange(),\n visibleRange,\n locale: settings.locale,\n });\n\n const gridTemplateColumns = `${effective.weekNumbers ? \"var(--ec-week-number-w, 2.75rem) \" : \"\"}repeat(${headerDays.length}, minmax(0, 1fr))`;\n const cap = maxEventsPerCell ?? viewConfig.maxEventsPerCell;\n const contained = viewConfig.scrollMode !== \"page\";\n\n // \"auto\" fits as many event rows as the cell height allows and rolls the rest\n // into \"+N more\". Only the contained mode gives a cell a bounded height to\n // measure; page mode grows to fit, so \"auto\" there keeps the fixed fallback.\n const autoFit = cap === \"auto\" && contained;\n // slotProbe resolves the event-row height (--ec-month-bar-h) to px, honoring\n // the current font size and any consumer override; contentProbe is the first\n // cell's flex-1 content area, whose height is the event space per cell.\n const slotProbeRef = useRef<HTMLDivElement | null>(null);\n const contentProbeRef = useRef<HTMLDivElement | null>(null);\n const [autoCap, setAutoCap] = useState<number | null>(null);\n const measureCap = useCallback(() => {\n const content = contentProbeRef.current;\n const slot = slotProbeRef.current;\n if (!content || !slot) return;\n const laneH = slot.getBoundingClientRect().height;\n if (laneH <= 0) return;\n const cs = getComputedStyle(content);\n const inner = content.clientHeight - (parseFloat(cs.paddingTop) || 0);\n const gap = parseFloat(cs.rowGap) || 0;\n // N rows occupy N*laneH - gap (the last row has no trailing gap)\n setAutoCap(Math.max(1, Math.floor((inner + gap) / laneH)));\n }, []);\n useIsoLayoutEffect(() => {\n if (!autoFit) {\n setAutoCap(null);\n return;\n }\n const content = contentProbeRef.current;\n if (!content || typeof ResizeObserver === \"undefined\") return;\n measureCap();\n const observer = new ResizeObserver(measureCap);\n observer.observe(content);\n return () => observer.disconnect();\n // re-observe the first cell after a re-layout (row count or month change)\n }, [autoFit, measureCap, weeks.length, anchorDate]);\n const resolvedCap = cap === \"auto\" ? (autoFit ? (autoCap ?? 3) : 3) : cap;\n\n const defaultProps = {\n \"data-slot\": \"event-calendar-month-view\",\n \"data-view\": \"month\",\n role: \"grid\",\n \"aria-label\": title,\n className: cn(\n \"flex flex-col border-t\",\n contained && \"min-h-0 flex-1 overflow-hidden\",\n viewConfig.classNames?.monthView,\n className,\n ),\n children: (\n <>\n <div\n role=\"row\"\n data-slot=\"event-calendar-month-header\"\n // @container scopes the narrow-label breakpoint to the header row\n className={cn(\"@container grid border-b\", viewConfig.classNames?.monthHeader)}\n style={{ gridTemplateColumns }}\n >\n {effective.weekNumbers && (\n <div\n role=\"columnheader\"\n aria-hidden\n className={cn(\"border-e px-2 py-1.5\", viewConfig.classNames?.weekNumber)}\n />\n )}\n {headerDays.map((day) => (\n <div\n key={day.getTime()}\n role=\"columnheader\"\n className={cn(\n \"truncate px-2 py-1.5 font-medium text-muted-foreground\",\n viewConfig.classNames?.monthDayHeader,\n )}\n >\n {viewConfig.renderDayHeader?.({\n day,\n view: \"month\",\n isToday:\n getDayKey(day, settings.timeZone) === getDayKey(new Date(), settings.timeZone),\n }) ?? (\n <>\n <span className=\"@max-[36rem]:hidden\">\n {format(toZoned(day, settings.timeZone), settings.i18n.formats.monthDayHeader, {\n locale: settings.locale,\n })}\n </span>\n <span className=\"@max-[36rem]:inline hidden\">\n {format(\n toZoned(day, settings.timeZone),\n settings.i18n.formats.monthDayHeaderNarrow,\n { locale: settings.locale },\n )}\n </span>\n </>\n )}\n </div>\n ))}\n </div>\n <div\n data-slot=\"event-calendar-month-body\"\n className={cn(\"grid\", contained && \"min-h-0 flex-1\", viewConfig.classNames?.monthBody)}\n style={{\n gridTemplateRows: contained\n ? `repeat(${weeks.length}, minmax(0, 1fr))`\n : `repeat(${weeks.length}, minmax(var(--ec-month-row-min-h, 8rem), auto))`,\n }}\n >\n {weeks.map((week, rowIndex) => (\n <EventCalendarMonthWeek\n key={rowIndex}\n week={week}\n gridTemplateColumns={gridTemplateColumns}\n showWeekNumber={effective.weekNumbers}\n cap={resolvedCap}\n autoFit={autoFit}\n contentRef={rowIndex === 0 ? contentProbeRef : undefined}\n />\n ))}\n </div>\n {autoFit && (\n <div\n ref={slotProbeRef}\n aria-hidden\n className=\"pointer-events-none invisible absolute h-(--ec-month-bar-h,1.75rem) w-0\"\n />\n )}\n </>\n ),\n };\n\n return (\n <EventCalendarViewContext.Provider value={{ view: \"month\" }}>\n {useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n })}\n </EventCalendarViewContext.Provider>\n );\n}\n\n/**\n * One month week row. Multi-day / all-day events render as CONTINUOUS bars in\n * an overlay grid that spans day columns (colStart -> colSpan) and stacks by\n * lane; single-day timed events render inside each cell below the reserved bar\n * lanes. This is what makes a cross-day event read as one whole block instead\n * of a chip repeated per cell.\n */\nfunction EventCalendarMonthWeek({\n week,\n gridTemplateColumns,\n showWeekNumber,\n cap,\n autoFit,\n contentRef,\n}: {\n week: Date[];\n gridTemplateColumns: string;\n showWeekNumber: boolean;\n cap: number;\n autoFit: boolean;\n /** Set on the first week only: forwarded to its first cell's content area so\n * the view can measure the per-cell event height for \"auto\". */\n contentRef?: Ref<HTMLDivElement>;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const { bars, rowStart } = useEventCalendarWeek(week[0]);\n const colOffset = showWeekNumber ? 1 : 0;\n const dayMs = 86400000;\n const rowStartMs = zonedStartOfDay(rowStart ?? week[0], settings.timeZone).getTime();\n // Day offsets from the TRUE row start (0-6) for each visible column, so a\n // weekends-hidden month still places bars on the right days.\n const offsets = week.map((d) =>\n Math.round((zonedStartOfDay(d, settings.timeZone).getTime() - rowStartMs) / dayMs),\n );\n /** Clamp a day-offset span onto the visible columns; null = fully hidden. */\n const gridPos = (colStart: number, colSpan: number) => {\n let start = -1;\n let end = -1;\n for (let o = colStart; o < colStart + colSpan; o++) {\n const col = offsets.indexOf(o);\n if (col === -1) continue;\n if (start === -1) start = col;\n end = col;\n }\n return start === -1 ? null : { col: start, span: end - start + 1 };\n };\n // bars fit within the cap; deeper lanes fall into each day's \"+N more\"\n const visibleBars = bars.filter((b) => (b.lane ?? 0) < cap);\n const covers = (b: EventCalendarSegment, dayOffset: number) =>\n (b.colStart ?? 0) <= dayOffset && dayOffset < (b.colStart ?? 0) + (b.colSpan ?? 1);\n // Occurrence keys of the bars hidden in each column (lane >= cap). Threaded to\n // the cell so its \"+N more\" popover can list the hidden bars WITHOUT re-listing\n // the visible ones (day buckets carry no lane, so the week row - which owns bar\n // laning - is the only place that knows which bars are hidden).\n const hiddenBarKeysByCol = week.map(\n (_, col) =>\n new Set(\n bars\n .filter((b) => (b.lane ?? 0) >= cap && covers(b, offsets[col]))\n .map((b) => b.occurrence.key),\n ),\n );\n\n // Live move/resize ghost at the PROPOSED day span. Standardized treatment\n // (EVENT_CALENDAR_GHOST): move = the event carried as a full clone, resize =\n // the same clone with a dashed boundary; invalid adds destructive marking\n // while the engine shows the not-allowed cursor + validation hint.\n const dragGhost = useEventCalendarSelector<\n unknown,\n | (Pick<\n EventCalendarDragState,\n \"kind\" | \"valid\" | \"occurrence\" | \"proposedStart\" | \"proposedEnd\" | \"proposedAllDay\"\n > & {\n colStart: number;\n colSpan: number;\n isStart: boolean;\n isEnd: boolean;\n color?: string;\n })\n | null\n >(\n (state) => {\n const drag = state.drag;\n if (!drag) return null;\n const rowEndMs = rowStartMs + 7 * dayMs;\n const startDayMs = zonedStartOfDay(drag.proposedStart, settings.timeZone).getTime();\n // exclusive end -> the last covered day\n const lastDayMs = zonedStartOfDay(\n new Date(drag.proposedEnd.getTime() - 1),\n settings.timeZone,\n ).getTime();\n if (startDayMs >= rowEndMs || lastDayMs < rowStartMs) return null;\n const startCol = Math.max(0, Math.round((startDayMs - rowStartMs) / dayMs));\n const endCol = Math.min(6, Math.round((lastDayMs - rowStartMs) / dayMs));\n if (endCol < startCol) return null;\n return {\n kind: drag.kind,\n valid: drag.valid,\n occurrence: drag.occurrence,\n proposedStart: drag.proposedStart,\n proposedEnd: drag.proposedEnd,\n proposedAllDay: drag.proposedAllDay,\n colStart: startCol,\n colSpan: endCol - startCol + 1,\n isStart: startDayMs >= rowStartMs,\n isEnd: lastDayMs < rowEndMs,\n color: drag.occurrence.event.color,\n };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null &&\n b !== null &&\n a.colStart === b.colStart &&\n a.colSpan === b.colSpan &&\n a.valid === b.valid &&\n a.kind === b.kind &&\n a.proposedAllDay === b.proposedAllDay &&\n a.proposedStart.getTime() === b.proposedStart.getTime() &&\n a.proposedEnd.getTime() === b.proposedEnd.getTime()),\n },\n );\n const ghostPos = dragGhost ? gridPos(dragGhost.colStart, dragGhost.colSpan) : null;\n const ghostLane = dragGhost\n ? (bars.find((b) => b.occurrence.key === dragGhost.occurrence.key)?.lane ?? 0)\n : 0;\n // A single-day timed MOVE is indicated INLINE in the target cell (a\n // placeholder at the time-sorted position, rendered by EventCalendarMonthCell)\n // rather than as a bar in this overlay, so only bar drags and every resize\n // render the overlay ghost. Bars = all-day or multi-day (span > 1 day).\n const ghostIsBar =\n !!dragGhost &&\n (dragGhost.kind !== \"move\" ||\n dragGhost.proposedAllDay ||\n dragGhost.proposedEnd.getTime() - dragGhost.proposedStart.getTime() > dayMs);\n\n return (\n <div\n role=\"row\"\n data-slot=\"event-calendar-month-row\"\n className={cn(\n \"relative grid min-h-0 border-b last:border-b-0\",\n viewConfig.classNames?.monthRow,\n )}\n style={{ gridTemplateColumns }}\n >\n {showWeekNumber && (\n <div\n role=\"rowheader\"\n data-slot=\"event-calendar-week-number\"\n className={cn(\n \"border-e px-2 pt-1 text-muted-foreground tabular-nums\",\n viewConfig.classNames?.weekNumber,\n )}\n >\n {settings.i18n.labels.week(\n getWeek(toZoned(week[0], settings.timeZone), {\n weekStartsOn: settings.weekStartsOn,\n }),\n )}\n </div>\n )}\n {week.map((day, col) => (\n <EventCalendarMonthCell\n key={day.getTime()}\n day={day}\n cap={cap}\n // Reserve lane space only for bars that pass through THIS cell, so a\n // short multi-day event does not push down timed events in unrelated\n // cells of the same row. Reserve down to the deepest covering bar\n // lane so timed events always sit below every bar in their own cell.\n reservedLanes={visibleBars.reduce(\n (max, b) => (covers(b, offsets[col]) ? Math.max(max, (b.lane ?? 0) + 1) : max),\n 0,\n )}\n hiddenBarKeys={hiddenBarKeysByCol[col]}\n isLast={col === week.length - 1}\n autoFit={autoFit}\n contentRef={col === 0 ? contentRef : undefined}\n />\n ))}\n {/* Continuous bar overlay: one element per bar, placed by grid-column so\n a cross-day span is a single unbroken block. pointer-events pass\n through the gaps to the cells below. NOT aria-hidden - these are the\n real interactive bars. */}\n {(visibleBars.length > 0 || (dragGhost && ghostPos && ghostIsBar)) && (\n <div\n data-slot=\"event-calendar-month-bar-overlay\"\n className={cn(\n \"pointer-events-none absolute inset-x-0 top-0 z-10 grid pt-1.5\",\n viewConfig.classNames?.monthBarOverlay,\n )}\n style={{\n gridTemplateColumns,\n gridAutoRows: \"var(--ec-month-bar-h, 1.75rem)\",\n }}\n >\n {visibleBars.map((bar) => {\n const pos = gridPos(bar.colStart ?? 0, bar.colSpan ?? 1);\n if (!pos) return null;\n return (\n <div\n key={bar.occurrence.key}\n className={cn(\"pointer-events-auto min-w-0 px-1\", viewConfig.classNames?.monthBar)}\n style={{\n gridColumn: `${colOffset + pos.col + 1} / span ${pos.span}`,\n gridRow: (bar.lane ?? 0) + 1,\n }}\n >\n {/* lane height minus the 2px inter-lane gap */}\n <EventCalendarEvent\n segment={bar}\n className=\"h-[calc(var(--ec-month-bar-h,1.75rem)-0.125rem)]\"\n />\n </div>\n );\n })}\n {dragGhost && ghostPos && ghostIsBar && (\n <div\n aria-hidden\n className={cn(\"min-w-0 px-1\", viewConfig.classNames?.monthBar)}\n style={{\n gridColumn: `${colOffset + ghostPos.col + 1} / span ${ghostPos.span}`,\n gridRow: ghostLane + 1,\n }}\n >\n <div\n data-slot=\"event-calendar-drag-ghost\"\n data-kind={dragGhost.kind}\n data-drop-invalid={!dragGhost.valid || undefined}\n className={cn(\n \"h-[calc(var(--ec-month-bar-h,1.75rem)-0.125rem)]\",\n dragGhost.kind === \"move\"\n ? // faint drop placeholder only: the cursor-attached\n // carry clone owns the visual during moves\n cn(\n EVENT_CALENDAR_GHOST.move,\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalid,\n )\n : cn(\n EVENT_CALENDAR_GHOST.resize,\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalidResize,\n ),\n viewConfig.classNames?.dragGhost,\n )}\n style={\n {\n \"--ec-event-color\": dragGhost.color ?? \"var(--color-primary)\",\n } as CSSProperties\n }\n >\n {dragGhost.kind !== \"move\" && (\n <EventCalendarEvent\n preview\n segment={{\n occurrence: {\n ...dragGhost.occurrence,\n start: dragGhost.proposedStart,\n end: dragGhost.proposedEnd,\n },\n day: week[ghostPos.col] ?? week[0],\n isStart: dragGhost.isStart,\n isEnd: dragGhost.isEnd,\n continuesBefore: !dragGhost.isStart,\n continuesAfter: !dragGhost.isEnd,\n }}\n className={cn(\n \"inset-ring-0 h-full\",\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalidContent,\n )}\n />\n )}\n </div>\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction EventCalendarMonthCell({\n day,\n cap,\n reservedLanes,\n hiddenBarKeys,\n isLast,\n autoFit,\n contentRef,\n}: {\n day: Date;\n cap: number;\n reservedLanes: number;\n /** Occurrence keys of the bars hidden in THIS column (lane >= cap), from the\n * week row. Lets the cell list hidden bars in its overflow popover without\n * re-listing the bars already visible in the row overlay. */\n hiddenBarKeys: Set<string>;\n /** Last column in the row - drops the right border so the grid's outer edge\n * is owned by the container, not a doubled cell border. Passed explicitly\n * because the bar overlay renders after the cells, so `:last-child` is\n * unreliable on rows that have bars. */\n isLast: boolean;\n /** When true, the \"+N more\" chip is treated as taking a row so the visible\n * chips + indicator always fit the measured cell height. */\n autoFit: boolean;\n /** Set on the first cell only: measured to derive the \"auto\" cap. */\n contentRef?: Ref<HTMLDivElement>;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const gestures = useEventCalendarGestures();\n const { segments, isToday, isOutside } = useEventCalendarDay(day);\n\n const dayStart = zonedStartOfDay(day, settings.timeZone);\n const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);\n const { effective } = useEventCalendarViewSettings();\n const isOff = resolveOffDay(\n day,\n settings.timeZone,\n effective.offDays\n ? typeof viewConfig.offDays === \"object\"\n ? viewConfig.offDays\n : true\n : false,\n );\n const offClassName =\n (typeof viewConfig.offDays === \"object\" && viewConfig.offDays.className) || \"bg-muted/25\";\n\n const isDropTarget = useEventCalendarSelector<unknown, \"valid\" | \"invalid\" | null>((state) => {\n const drag = state.drag;\n if (!drag) return null;\n const covered = drag.proposedStart < dayEnd && drag.proposedEnd > dayStart;\n if (!covered) return null;\n return drag.valid ? \"valid\" : \"invalid\";\n });\n // Hide hover affordances mid-gesture: the only intent is the drop target\n const isInteracting = useEventCalendarSelector<unknown, boolean>(\n (state) => state.drag !== null || state.slotDraft !== null,\n );\n const inDraft = useEventCalendarSelector<unknown, { isStart: boolean; isEnd: boolean } | null>(\n (state) => {\n const draft = state.slotDraft;\n if (!draft?.allDay) return null;\n if (draft.start >= dayEnd || draft.end <= dayStart) return null;\n return {\n isStart: draft.start >= dayStart,\n isEnd: draft.end <= dayEnd,\n };\n },\n {\n isEqual: (a, b) =>\n a === b || (a !== null && b !== null && a.isStart === b.isStart && a.isEnd === b.isEnd),\n },\n );\n // A single-day timed MOVE landing on THIS day: expose the proposed\n // minute-of-day (+ color/validity) so the cell can render a drop placeholder\n // at the correct time-sorted position, instead of the overlay marking a bar\n // over the first chip. Skipped for bars (they keep the overlay ghost) and for\n // a no-op move back onto the event's own day (the dimmed source already marks\n // the spot).\n const inlineDrop = useEventCalendarSelector<\n unknown,\n { min: number; valid: boolean; color?: string } | null\n >(\n (state) => {\n const drag = state.drag;\n if (drag?.kind !== \"move\" || drag.proposedAllDay) return null;\n if (drag.proposedEnd.getTime() - drag.proposedStart.getTime() > 86400000) return null;\n const dropDayMs = zonedStartOfDay(drag.proposedStart, settings.timeZone).getTime();\n if (dropDayMs !== dayStart.getTime()) return null;\n if (\n zonedStartOfDay(drag.occurrence.start, settings.timeZone).getTime() === dayStart.getTime()\n )\n return null;\n return {\n min: (drag.proposedStart.getTime() - dropDayMs) / 60000,\n valid: drag.valid,\n color: drag.occurrence.event.color,\n };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null && b !== null && a.min === b.min && a.valid === b.valid && a.color === b.color),\n },\n );\n\n // Bars (allDay/multi-day) are drawn by the week-row overlay; the cell renders\n // only single-day timed events, below the reserved bar lanes.\n const extraHidden = hiddenBarKeys.size;\n const hiddenBarSegs = segments.allDay.filter((s) => hiddenBarKeys.has(s.occurrence.key));\n const m = segments.timed.length;\n const timedSlots = Math.max(0, cap - reservedLanes);\n\n // Static (at-rest) split: what the cell shows with no drag, and - crucially -\n // what the \"+N more\" popover lists. The popover carries ONLY the hidden events\n // (hidden bars + timed past the cap), never the chips already visible in the\n // cell, so it never duplicates them. autoFit gives up one timed row to the\n // \"+N more\" indicator so the visible chips fit the clipped cell height.\n const staticOverflow = extraHidden > 0 || m > timedSlots;\n const staticShown = autoFit && staticOverflow ? Math.max(0, timedSlots - 1) : timedSlots;\n const overflowSegments = [...hiddenBarSegs, ...segments.timed.slice(staticShown)];\n\n // Live split: while a timed chip is dragged onto this day, render the day\n // exactly as it will look AFTER the drop. The dragged chip is a phantom in the\n // time-sorted order and is shown as the placeholder - inline where it lands,\n // or ON the \"+N more\" indicator when it lands in the overflow bucket (so the\n // user sees the drop will push it into \"more\"). The \"+N more\" count always\n // reflects the post-drop hidden total.\n let visibleTimed: EventCalendarSegment[];\n let overflowCount: number;\n let placeholderIndex: number;\n let placeholderAtMore: boolean;\n if (!inlineDrop) {\n visibleTimed = segments.timed.slice(0, staticShown);\n overflowCount = overflowSegments.length;\n placeholderIndex = -1;\n placeholderAtMore = false;\n } else {\n // rank of the dragged chip in the resulting time-sorted list (chips are\n // time-ordered, so this is the count starting at or before its time)\n const insertRank = segments.timed.filter((s) => (s.startMin ?? 0) <= inlineDrop.min).length;\n const dropOverflow = extraHidden > 0 || m + 1 > timedSlots;\n // rows for timed items INCLUDING the phantom, before the \"+N more\" row\n const vis = !dropOverflow ? m + 1 : autoFit ? Math.max(0, timedSlots - 1) : timedSlots;\n placeholderAtMore = insertRank >= vis;\n visibleTimed = placeholderAtMore\n ? segments.timed.slice(0, vis)\n : segments.timed.slice(0, Math.max(0, vis - 1));\n placeholderIndex = placeholderAtMore ? -1 : insertRank;\n overflowCount = extraHidden + (m - visibleTimed.length) + (placeholderAtMore ? 1 : 0);\n }\n\n // Faint dashed drop placeholder, tinted to the dragged event's color, echoing\n // the move ghost (EVENT_CALENDAR_GHOST.move); one chip-height tall so chips\n // shift by exactly one row when it is inserted.\n const dropPlaceholder = inlineDrop ? (\n <div\n key=\"ec-drop-placeholder\"\n aria-hidden\n data-slot=\"event-calendar-drop-placeholder\"\n data-drop-invalid={!inlineDrop.valid || undefined}\n className={cn(\n \"shrink-0 rounded-sm border border-dashed\",\n inlineDrop.valid\n ? \"border-(--ec-event-color)/50 bg-(--ec-event-color)/8\"\n : \"border-destructive/70 bg-destructive/10\",\n viewConfig.classNames?.dragGhost,\n )}\n style={\n {\n \"--ec-event-color\": inlineDrop.color ?? \"var(--color-primary)\",\n height: \"calc(var(--ec-month-bar-h, 1.75rem) - 0.125rem)\",\n } as CSSProperties\n }\n />\n ) : null;\n\n const defaultContent = (\n <>\n <div\n ref={contentRef}\n className={cn(\n // gap-0.5 pairs with the 0.125rem subtraction in the lane spacer\n // below; changing the gap requires renderMonthCell\n // px-1 matches the all-day bar wrapper inset so single-day chips and\n // multi-day bars line up on the same left/right edge in a cell\n \"flex min-h-0 flex-1 flex-col gap-0.5 overflow-hidden px-1 pt-1.5\",\n viewConfig.classNames?.monthCellContent,\n )}\n >\n {reservedLanes > 0 && (\n <div\n aria-hidden\n className=\"shrink-0\"\n style={{\n // lane height already carries the 2px inter-lane gap; subtract\n // it so spacer + the column's own gap-0.5 = the SAME 2px rhythm\n // between the last bar and the first timed chip\n height: `calc(${reservedLanes} * var(--ec-month-bar-h, 1.75rem) - 0.125rem)`,\n }}\n />\n )}\n {visibleTimed.flatMap((segment, i) => {\n const chip = (\n <EventCalendarEvent\n key={segment.occurrence.key}\n segment={segment}\n // Hold a fixed height like the all-day lane above; without this\n // the chip flex-shrinks to whatever room the cell has left, so\n // cells with a reserved bar lane or a second chip render shorter\n // chips.\n className=\"shrink-0\"\n />\n );\n return i === placeholderIndex ? [dropPlaceholder, chip] : [chip];\n })}\n {placeholderIndex >= 0 && placeholderIndex >= visibleTimed.length && dropPlaceholder}\n {overflowCount > 0 && (\n <EventCalendarMoreIndicator\n day={day}\n count={overflowCount}\n segments={overflowSegments}\n dropInto={\n placeholderAtMore && inlineDrop\n ? { color: inlineDrop.color, valid: inlineDrop.valid }\n : undefined\n }\n />\n )}\n </div>\n {/* Day number + add affordance, bottom-right (Notion-style) */}\n <div\n className={cn(\n \"flex items-center justify-end gap-1 px-2 pb-1.5\",\n viewConfig.classNames?.monthCellFooter,\n )}\n >\n {viewConfig.showDayAddButton && !isInteracting && (\n <button\n type=\"button\"\n data-slot=\"event-calendar-day-add\"\n aria-label={settings.i18n.labels.addEvent}\n // a different icon/markup is a renderMonthCell job\n className={cn(\n \"flex size-5 cursor-pointer items-center justify-center rounded-sm bg-primary text-primary-foreground opacity-0 transition-opacity focus-visible:opacity-100 group-hover/ec-cell:opacity-100\",\n viewConfig.classNames?.dayAddButton,\n )}\n onClick={(e) => {\n e.stopPropagation();\n settings.onSlotClick?.({ date: day, allDay: true, view: \"month\" }, e);\n }}\n >\n <PlusIcon className=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n )}\n <span\n data-slot=\"event-calendar-month-day-number\"\n className={cn(\n \"flex size-5 items-center justify-center rounded-full\",\n isOutside && \"text-muted-foreground\",\n // the filled circle already marks today; keep the number the same\n // weight/size as the other days so it does not read as larger\n // Same font-size as every other day; a lighter weight cancels the\n // way white digits on the filled circle read bolder/larger than the\n // dark-on-light numbers around them.\n isToday && \"bg-primary font-light text-primary-foreground\",\n viewConfig.classNames?.monthDayNumber,\n )}\n >\n {format(toZoned(day, settings.timeZone), settings.i18n.formats.monthCellDay, {\n locale: settings.locale,\n })}\n </span>\n </div>\n </>\n );\n\n const content =\n viewConfig.renderMonthCell?.({\n day,\n segments,\n isToday,\n isOutside,\n overflowCount,\n defaultContent,\n }) ?? defaultContent;\n\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: pointer/gesture surface; keyboard via toolbar\n <div\n role=\"gridcell\"\n data-slot=\"event-calendar-month-cell\"\n data-today={isToday || undefined}\n data-outside={isOutside || undefined}\n data-weekend={\n settings.weekendDays.includes(toZoned(day, settings.timeZone).getDay()) || undefined\n }\n data-ec-day={dayStart.getTime()}\n data-drop-target={isDropTarget ?? undefined}\n data-off={isOff || undefined}\n data-draft={inDraft ? \"\" : undefined}\n aria-label={format(\n toZoned(day, settings.timeZone),\n settings.i18n.formats.monthCellAriaLabel,\n { locale: settings.locale },\n )}\n className={cn(\n \"group/ec-cell relative flex min-h-0 min-w-0 flex-col overflow-hidden\",\n !isLast && \"border-e\",\n isOutside && !settings.showOutsideDays && \"invisible\",\n isOff && offClassName,\n isToday &&\n cn(\"relative border-b-2 border-b-primary/40 bg-primary/3\", viewConfig.todayClassName),\n viewConfig.dayClassName?.(day),\n // No drop-target bg fill on move/resize - the dragged bar + not-allowed\n // cursor carry the feedback; a cell-wide color wash is too distracting.\n // data-drop-target stays as an opt-in styling hook.\n inDraft && \"bg-primary/5\",\n viewConfig.classNames?.monthCell,\n )}\n onPointerDown={(e) => {\n const target = e.target as HTMLElement;\n if (target.closest(\"[data-slot=event-calendar-event]\")) return;\n if (target.closest(\"[data-slot=event-calendar-more]\")) return;\n gestures.beginCreate(e, day, true);\n }}\n onClick={(e) => {\n if (wasRecentDrag() || wasRecentChipPress()) return;\n settings.onSlotClick?.({ date: day, allDay: true, view: \"month\" }, e);\n }}\n >\n {inDraft && (\n <span\n aria-hidden\n data-slot=\"event-calendar-slot-draft\"\n className={cn(\n \"pointer-events-none absolute inset-0 z-10 border-primary/40 border-y border-dashed\",\n inDraft.isStart && \"border-s\",\n inDraft.isEnd && \"border-e\",\n viewConfig.classNames?.slotDraft,\n )}\n />\n )}\n {content}\n </div>\n );\n}\n\ninterface EventCalendarMoreIndicatorProps {\n day: Date;\n count: number;\n /** The OVERFLOW (hidden) segments for this day - bars first, then timed. The\n * popover lists only these, never the chips already visible in the cell. */\n segments: EventCalendarSegment[];\n /** Set while a timed chip is dragged and will land in THIS overflow bucket:\n * the indicator itself becomes the drop placeholder (dashed, event-tinted) so\n * it reads as \"the chip joins the +N more list\". */\n dropInto?: { color?: string; valid: boolean };\n}\n\n/**\n * \"+N more\" trigger opening a popover with the day's full event list.\n * onMoreClick returning false suppresses the built-in popover.\n */\nfunction EventCalendarMoreIndicator({\n day,\n count,\n segments,\n dropInto,\n}: EventCalendarMoreIndicatorProps) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const [open, setOpen] = useState(false);\n\n // Grabbing a chip from this list starts a drag; close the popover so it does\n // not sit over the drop target while the event is carried to another day.\n const isDragging = useEventCalendarSelector<unknown, boolean>((state) => state.drag !== null);\n useEffect(() => {\n if (isDragging) setOpen(false);\n }, [isDragging]);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n data-slot=\"event-calendar-more\"\n data-drop-into={dropInto ? \"\" : undefined}\n data-drop-invalid={dropInto && !dropInto.valid ? \"\" : undefined}\n className={cn(\n \"cursor-pointer truncate rounded-sm px-1.5 text-start text-muted-foreground hover:text-foreground\",\n // While a dragged chip will land in this overflow bucket, the \"+N more\"\n // link itself becomes the drop placeholder: dashed, event-tinted, one\n // chip tall, so the drop target is unmistakable.\n dropInto &&\n cn(\n \"flex shrink-0 items-center border border-dashed\",\n dropInto.valid\n ? \"border-(--ec-event-color)/50 bg-(--ec-event-color)/8 text-foreground\"\n : \"border-destructive/70 bg-destructive/10 text-destructive\",\n ),\n viewConfig.classNames?.moreIndicator,\n )}\n style={\n dropInto\n ? ({\n \"--ec-event-color\": dropInto.color ?? \"var(--color-primary)\",\n height: \"calc(var(--ec-month-bar-h, 1.75rem) - 0.125rem)\",\n } as CSSProperties)\n : undefined\n }\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n const verdict = settings.onMoreClick?.(\n day,\n segments.map((segment) => segment.occurrence),\n e,\n );\n if (verdict === false) {\n e.preventDefault();\n setOpen(false);\n }\n }}\n >\n {viewConfig.renderMoreIndicator?.({ day, count, segments }) ??\n settings.i18n.labels.more(count)}\n </PopoverTrigger>\n <PopoverContent\n data-slot=\"event-calendar-more-popover\"\n align={viewConfig.morePopoverAlign}\n // PopoverContent is unlayered (flex-col gap-4 p-4); override with !.\n // text-xs re-establishes the calendar's base type here because this\n // content is portaled out of the root subtree and cannot inherit it.\n className={cn(\"w-64 gap-1! p-2! text-xs\", viewConfig.classNames?.morePopover)}\n onClick={(e: React.MouseEvent) => e.stopPropagation()}\n >\n {viewConfig.renderMoreContent ? (\n viewConfig.renderMoreContent({\n day,\n segments,\n close: () => setOpen(false),\n })\n ) : (\n <EventCalendarMoreDefaultContent day={day} segments={segments} />\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\n/** Built-in \"+N more\" popover body: day header + the day's chips. */\nfunction EventCalendarMoreDefaultContent({\n day,\n segments,\n}: {\n day: Date;\n segments: EventCalendarSegment[];\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n return (\n <>\n <div\n className={cn(\n \"px-1 py-1 font-medium text-muted-foreground text-xs\",\n viewConfig.classNames?.morePopoverHeader,\n )}\n >\n {format(toZoned(day, settings.timeZone), settings.i18n.formats.moreDayHeader, {\n locale: settings.locale,\n })}\n </div>\n {/* The scroll region breaks out of the popover's right padding (-me-2)\n so the scrollbar sits flush in the gutter; the list then pads itself\n back (ps-1 aligns with the header, pe-4 clears the ~10px bar with a\n gap) and adds py-1 so the first/last focus ring is not clipped by\n the overflow. Layout is identical with or without a scrollbar. */}\n {viewConfig.scrollbars === \"native\" ? (\n <div\n data-ec-native-scroll=\"\"\n className=\"-me-2 max-h-(--ec-more-max-height,16rem) min-h-0 overflow-y-auto\"\n >\n <div className=\"flex flex-col gap-1 py-1 ps-1 pe-4\">\n {segments.map((segment) => (\n <EventCalendarEvent\n key={segment.occurrence.key}\n segment={segment}\n className=\"py-0.5\"\n />\n ))}\n </div>\n </div>\n ) : (\n <ScrollArea className=\"-me-2 min-h-0 **:data-[slot=scroll-area-viewport]:max-h-(--ec-more-max-height,16rem)\">\n <div className=\"flex flex-col gap-1 py-1 ps-1 pe-4\">\n {segments.map((segment) => (\n <EventCalendarEvent\n key={segment.occurrence.key}\n segment={segment}\n className=\"py-0.5\"\n />\n ))}\n </div>\n </ScrollArea>\n )}\n </>\n );\n}\n\nexport type { EventCalendarMonthViewProps, EventCalendarMoreIndicatorProps };\nexport { EventCalendarMonthView, EventCalendarMoreIndicator };\n"],"mappings":";;;;;;;;;;;;;;;AA+CA,MAAM,qBAAqB,OAAO,WAAW,cAAc,kBAAkB;AAM7E,SAAS,uBAAuB,EAC9B,WACA,QACA,kBACA,GAAG,SAC2B;CAC9B,MAAM,WAAW,iBAAiB;CAClC,MAAM,WAAW,yBAAyB;CAC1C,MAAM,aAAa,2BAA2B;CAC9C,MAAM,eAAe,0BAClB,UAAU,MAAM,cACjB,EACE,UAAU,GAAG,MAAM,YAAY,CAAC,MAAM,YAAY,CAAC,EACrD,CACF;CACA,MAAM,aAAa,0BAA0B,UAAU,MAAM,IAAI;CAEjE,MAAM,EAAE,cAAc,6BAA6B;CACnD,MAAM,QAAQ,cAAc;EAC1B,MAAM,OAAe,CAAC;EACtB,IAAI,SAAS,gBAAgB,aAAa,OAAO,SAAS,QAAQ;EAClE,OAAO,SAAS,aAAa,KAAK;GAChC,KAA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EACE,CAAA;CACF,CAAA,IAEL,oBAAC,YAAD;EAAY,WAAU;EACpB,UAAA,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,SAAS,KAAK,YACb,oBAAC,oBAAD;IAEW;IACT,WAAU;GACX,GAHM,QAAQ,WAAW,GAGzB,CACF;EACE,CAAA;CACK,CAAA,CAEd,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"event-calendar-month-view.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-month-view.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n type Ref,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, format, getWeek } from \"date-fns\";\nimport { PlusIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { ScrollArea } from \"../../ui/scroll-area\";\nimport {\n EventCalendarViewContext,\n useEventCalendar,\n useEventCalendarDay,\n useEventCalendarSelector,\n useEventCalendarSettings,\n useEventCalendarViewConfig,\n useEventCalendarViewSettings,\n useEventCalendarWeek,\n} from \"./event-calendar\";\nimport { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from \"./event-calendar-dnd\";\nimport { EVENT_CALENDAR_GHOST, EventCalendarEvent } from \"./event-calendar-event\";\nimport {\n getDayKey,\n getRangeKey,\n resolveOffDay,\n toZoned,\n zonedStartOfDay,\n} from \"./event-calendar-lib\";\nimport type {\n EventCalendarDateRange,\n EventCalendarDragState,\n EventCalendarEventId,\n EventCalendarSegment,\n} from \"./event-calendar-types\";\n\n// Layout-effect on the client (measure before paint, no flash), plain effect on\n// the server (never runs there) to avoid the SSR useLayoutEffect warning.\nconst useIsoLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n\n// An occurrence key encodes the start instant and is also the chip's React key,\n// so committing a move re-keys the chip: React remounts it and the browser\n// drops focus to <body>. The chip that owns focus is recorded here so the cell\n// rendering its replacement can hand focus back. Module scope because the drop\n// can land in a different cell than the one the chip left, and only one element\n// holds focus at a time anyway.\nlet focusedChip: {\n node: HTMLElement;\n eventId: EventCalendarEventId;\n recurrenceIndex?: number;\n} | null = null;\n\n/** Give focus back to the recorded chip's replacement, if `root` renders it. */\nfunction restoreChipFocus(root: HTMLElement | null, segments: EventCalendarSegment[]) {\n const pending = focusedChip;\n // Only a chip removed WHILE focused needs help: a node still in the tree, or\n // a focus that has already moved on by itself, is left alone.\n if (!root || !pending || pending.node.isConnected) return;\n const active = document.activeElement;\n if (active && active !== document.body) return;\n const index = segments.findIndex(\n (segment) =>\n segment.occurrence.eventId === pending.eventId &&\n segment.occurrence.recurrenceIndex === pending.recurrenceIndex,\n );\n if (index < 0) return;\n const chip = root.querySelectorAll<HTMLElement>(\"[data-slot=event-calendar-event]\")[index];\n if (!chip) return;\n // cleared first: focus() re-records through the new chip's own onFocus\n focusedChip = null;\n chip.focus();\n}\n\ninterface EventCalendarMonthViewProps extends useRender.ComponentProps<\"div\"> {\n maxEventsPerCell?: number | \"auto\";\n}\n\nfunction EventCalendarMonthView({\n className,\n render,\n maxEventsPerCell,\n ...props\n}: EventCalendarMonthViewProps) {\n const instance = useEventCalendar();\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const visibleRange = useEventCalendarSelector<unknown, EventCalendarDateRange>(\n (state) => state.visibleRange,\n {\n isEqual: (a, b) => getRangeKey(a) === getRangeKey(b),\n },\n );\n const anchorDate = useEventCalendarSelector((state) => state.date);\n\n const { effective } = useEventCalendarViewSettings();\n const weeks = useMemo(() => {\n const days: Date[] = [];\n let cursor = zonedStartOfDay(visibleRange.start, settings.timeZone);\n while (cursor < visibleRange.end) {\n days.push(cursor);\n cursor = zonedStartOfDay(addDays(toZoned(cursor, settings.timeZone), 1), settings.timeZone);\n }\n const rows: Date[][] = [];\n for (let i = 0; i < days.length; i += 7) rows.push(days.slice(i, i + 7));\n if (effective.weekends) return rows;\n return rows.map((row) =>\n row.filter((day) => !settings.weekendDays.includes(toZoned(day, settings.timeZone).getDay())),\n );\n }, [visibleRange, settings.timeZone, settings.weekendDays, effective.weekends]);\n\n const headerDays = weeks[0] ?? [];\n const title = settings.i18n.functions.formatTitle(\"month\", {\n date: toZoned(anchorDate, settings.timeZone),\n activeRange: instance.api.getActiveRange(),\n visibleRange,\n locale: settings.locale,\n });\n\n const gridTemplateColumns = `${effective.weekNumbers ? \"var(--ec-week-number-w, 2.75rem) \" : \"\"}repeat(${headerDays.length}, minmax(0, 1fr))`;\n const cap = maxEventsPerCell ?? viewConfig.maxEventsPerCell;\n const contained = viewConfig.scrollMode !== \"page\";\n\n // \"auto\" fits as many event rows as the cell height allows and rolls the rest\n // into \"+N more\". Only the contained mode gives a cell a bounded height to\n // measure; page mode grows to fit, so \"auto\" there keeps the fixed fallback.\n const autoFit = cap === \"auto\" && contained;\n // slotProbe resolves the event-row height (--ec-month-bar-h) to px, honoring\n // the current font size and any consumer override; contentProbe is the first\n // cell's flex-1 content area, whose height is the event space per cell.\n const slotProbeRef = useRef<HTMLDivElement | null>(null);\n const contentProbeRef = useRef<HTMLDivElement | null>(null);\n const [autoCap, setAutoCap] = useState<number | null>(null);\n const measureCap = useCallback(() => {\n const content = contentProbeRef.current;\n const slot = slotProbeRef.current;\n if (!content || !slot) return;\n const laneH = slot.getBoundingClientRect().height;\n if (laneH <= 0) return;\n const cs = getComputedStyle(content);\n const inner = content.clientHeight - (parseFloat(cs.paddingTop) || 0);\n const gap = parseFloat(cs.rowGap) || 0;\n // N rows occupy N*laneH - gap (the last row has no trailing gap)\n setAutoCap(Math.max(1, Math.floor((inner + gap) / laneH)));\n }, []);\n useIsoLayoutEffect(() => {\n if (!autoFit) {\n setAutoCap(null);\n return;\n }\n const content = contentProbeRef.current;\n if (!content || typeof ResizeObserver === \"undefined\") return;\n measureCap();\n const observer = new ResizeObserver(measureCap);\n observer.observe(content);\n return () => observer.disconnect();\n // re-observe the first cell after a re-layout (row count or month change)\n }, [autoFit, measureCap, weeks.length, anchorDate]);\n const resolvedCap = cap === \"auto\" ? (autoFit ? (autoCap ?? 3) : 3) : cap;\n\n const defaultProps = {\n \"data-slot\": \"event-calendar-month-view\",\n \"data-view\": \"month\",\n role: \"grid\",\n \"aria-label\": title,\n className: cn(\n \"flex flex-col border-t\",\n contained && \"min-h-0 flex-1 overflow-hidden\",\n viewConfig.classNames?.monthView,\n className,\n ),\n children: (\n <>\n <div\n role=\"row\"\n data-slot=\"event-calendar-month-header\"\n // @container scopes the narrow-label breakpoint to the header row\n className={cn(\"@container grid border-b\", viewConfig.classNames?.monthHeader)}\n style={{ gridTemplateColumns }}\n >\n {effective.weekNumbers && (\n <div\n role=\"columnheader\"\n aria-hidden\n className={cn(\"border-e px-2 py-1.5\", viewConfig.classNames?.weekNumber)}\n />\n )}\n {headerDays.map((day) => (\n <div\n key={day.getTime()}\n role=\"columnheader\"\n className={cn(\n \"truncate px-2 py-1.5 font-medium text-muted-foreground\",\n viewConfig.classNames?.monthDayHeader,\n )}\n >\n {viewConfig.renderDayHeader?.({\n day,\n view: \"month\",\n isToday:\n getDayKey(day, settings.timeZone) === getDayKey(new Date(), settings.timeZone),\n }) ?? (\n <>\n <span className=\"@max-[36rem]:hidden\">\n {format(toZoned(day, settings.timeZone), settings.i18n.formats.monthDayHeader, {\n locale: settings.locale,\n })}\n </span>\n <span className=\"@max-[36rem]:inline hidden\">\n {format(\n toZoned(day, settings.timeZone),\n settings.i18n.formats.monthDayHeaderNarrow,\n { locale: settings.locale },\n )}\n </span>\n </>\n )}\n </div>\n ))}\n </div>\n <div\n data-slot=\"event-calendar-month-body\"\n className={cn(\"grid\", contained && \"min-h-0 flex-1\", viewConfig.classNames?.monthBody)}\n style={{\n gridTemplateRows: contained\n ? `repeat(${weeks.length}, minmax(0, 1fr))`\n : `repeat(${weeks.length}, minmax(var(--ec-month-row-min-h, 8rem), auto))`,\n }}\n >\n {weeks.map((week, rowIndex) => (\n <EventCalendarMonthWeek\n key={rowIndex}\n week={week}\n gridTemplateColumns={gridTemplateColumns}\n showWeekNumber={effective.weekNumbers}\n cap={resolvedCap}\n autoFit={autoFit}\n contentRef={rowIndex === 0 ? contentProbeRef : undefined}\n />\n ))}\n </div>\n {autoFit && (\n <div\n ref={slotProbeRef}\n aria-hidden\n className=\"pointer-events-none invisible absolute h-(--ec-month-bar-h,1.75rem) w-0\"\n />\n )}\n </>\n ),\n };\n\n return (\n <EventCalendarViewContext.Provider value={{ view: \"month\" }}>\n {useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n })}\n </EventCalendarViewContext.Provider>\n );\n}\n\n/**\n * One month week row. Multi-day / all-day events render as CONTINUOUS bars in\n * an overlay grid that spans day columns (colStart -> colSpan) and stacks by\n * lane; single-day timed events render inside each cell below the reserved bar\n * lanes. This is what makes a cross-day event read as one whole block instead\n * of a chip repeated per cell.\n */\nfunction EventCalendarMonthWeek({\n week,\n gridTemplateColumns,\n showWeekNumber,\n cap,\n autoFit,\n contentRef,\n}: {\n week: Date[];\n gridTemplateColumns: string;\n showWeekNumber: boolean;\n cap: number;\n autoFit: boolean;\n /** Set on the first week only: forwarded to its first cell's content area so\n * the view can measure the per-cell event height for \"auto\". */\n contentRef?: Ref<HTMLDivElement>;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const { bars, rowStart } = useEventCalendarWeek(week[0]);\n const colOffset = showWeekNumber ? 1 : 0;\n const dayMs = 86400000;\n const rowStartMs = zonedStartOfDay(rowStart ?? week[0], settings.timeZone).getTime();\n // Day offsets from the TRUE row start (0-6) for each visible column, so a\n // weekends-hidden month still places bars on the right days.\n const offsets = week.map((d) =>\n Math.round((zonedStartOfDay(d, settings.timeZone).getTime() - rowStartMs) / dayMs),\n );\n /** Clamp a day-offset span onto the visible columns; null = fully hidden. */\n const gridPos = (colStart: number, colSpan: number) => {\n let start = -1;\n let end = -1;\n for (let o = colStart; o < colStart + colSpan; o++) {\n const col = offsets.indexOf(o);\n if (col === -1) continue;\n if (start === -1) start = col;\n end = col;\n }\n return start === -1 ? null : { col: start, span: end - start + 1 };\n };\n // bars fit within the cap; deeper lanes fall into each day's \"+N more\"\n const visibleBars = bars.filter((b) => (b.lane ?? 0) < cap);\n const covers = (b: EventCalendarSegment, dayOffset: number) =>\n (b.colStart ?? 0) <= dayOffset && dayOffset < (b.colStart ?? 0) + (b.colSpan ?? 1);\n // Occurrence keys of the bars hidden in each column (lane >= cap). Threaded to\n // the cell so its \"+N more\" popover can list the hidden bars WITHOUT re-listing\n // the visible ones (day buckets carry no lane, so the week row - which owns bar\n // laning - is the only place that knows which bars are hidden).\n const hiddenBarKeysByCol = week.map(\n (_, col) =>\n new Set(\n bars\n .filter((b) => (b.lane ?? 0) >= cap && covers(b, offsets[col]))\n .map((b) => b.occurrence.key),\n ),\n );\n\n // Live move/resize ghost at the PROPOSED day span. Standardized treatment\n // (EVENT_CALENDAR_GHOST): move = the event carried as a full clone, resize =\n // the same clone with a dashed boundary; invalid adds destructive marking\n // while the engine shows the not-allowed cursor + validation hint.\n const dragGhost = useEventCalendarSelector<\n unknown,\n | (Pick<\n EventCalendarDragState,\n \"kind\" | \"valid\" | \"occurrence\" | \"proposedStart\" | \"proposedEnd\" | \"proposedAllDay\"\n > & {\n colStart: number;\n colSpan: number;\n isStart: boolean;\n isEnd: boolean;\n color?: string;\n })\n | null\n >(\n (state) => {\n const drag = state.drag;\n if (!drag) return null;\n const rowEndMs = rowStartMs + 7 * dayMs;\n const startDayMs = zonedStartOfDay(drag.proposedStart, settings.timeZone).getTime();\n // exclusive end -> the last covered day\n const lastDayMs = zonedStartOfDay(\n new Date(drag.proposedEnd.getTime() - 1),\n settings.timeZone,\n ).getTime();\n if (startDayMs >= rowEndMs || lastDayMs < rowStartMs) return null;\n const startCol = Math.max(0, Math.round((startDayMs - rowStartMs) / dayMs));\n const endCol = Math.min(6, Math.round((lastDayMs - rowStartMs) / dayMs));\n if (endCol < startCol) return null;\n return {\n kind: drag.kind,\n valid: drag.valid,\n occurrence: drag.occurrence,\n proposedStart: drag.proposedStart,\n proposedEnd: drag.proposedEnd,\n proposedAllDay: drag.proposedAllDay,\n colStart: startCol,\n colSpan: endCol - startCol + 1,\n isStart: startDayMs >= rowStartMs,\n isEnd: lastDayMs < rowEndMs,\n color: drag.occurrence.event.color,\n };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null &&\n b !== null &&\n a.colStart === b.colStart &&\n a.colSpan === b.colSpan &&\n a.valid === b.valid &&\n a.kind === b.kind &&\n a.proposedAllDay === b.proposedAllDay &&\n a.proposedStart.getTime() === b.proposedStart.getTime() &&\n a.proposedEnd.getTime() === b.proposedEnd.getTime()),\n },\n );\n const ghostPos = dragGhost ? gridPos(dragGhost.colStart, dragGhost.colSpan) : null;\n const ghostLane = dragGhost\n ? (bars.find((b) => b.occurrence.key === dragGhost.occurrence.key)?.lane ?? 0)\n : 0;\n // A single-day timed MOVE is indicated INLINE in the target cell (a\n // placeholder at the time-sorted position, rendered by EventCalendarMonthCell)\n // rather than as a bar in this overlay, so only bar drags and every resize\n // render the overlay ghost. Bars = all-day or multi-day (span > 1 day).\n const ghostIsBar =\n !!dragGhost &&\n (dragGhost.kind !== \"move\" ||\n dragGhost.proposedAllDay ||\n dragGhost.proposedEnd.getTime() - dragGhost.proposedStart.getTime() > dayMs);\n\n return (\n <div\n role=\"row\"\n data-slot=\"event-calendar-month-row\"\n className={cn(\n \"relative grid min-h-0 border-b last:border-b-0\",\n viewConfig.classNames?.monthRow,\n )}\n style={{ gridTemplateColumns }}\n >\n {showWeekNumber && (\n <div\n role=\"rowheader\"\n data-slot=\"event-calendar-week-number\"\n className={cn(\n \"border-e px-2 pt-1 text-muted-foreground tabular-nums\",\n viewConfig.classNames?.weekNumber,\n )}\n >\n {settings.i18n.labels.week(\n getWeek(toZoned(week[0], settings.timeZone), {\n // locale supplies firstWeekContainsDate, so a de/ISO calendar\n // numbers the year-boundary weeks its own way instead of falling\n // back to US numbering; weekStartsOn stays explicit so the number\n // keeps matching the rendered grid\n locale: settings.locale,\n weekStartsOn: settings.weekStartsOn,\n }),\n )}\n </div>\n )}\n {week.map((day, col) => (\n <EventCalendarMonthCell\n key={day.getTime()}\n day={day}\n cap={cap}\n // Reserve lane space only for bars that pass through THIS cell, so a\n // short multi-day event does not push down timed events in unrelated\n // cells of the same row. Reserve down to the deepest covering bar\n // lane so timed events always sit below every bar in their own cell.\n reservedLanes={visibleBars.reduce(\n (max, b) => (covers(b, offsets[col]) ? Math.max(max, (b.lane ?? 0) + 1) : max),\n 0,\n )}\n hiddenBarKeys={hiddenBarKeysByCol[col]}\n isLast={col === week.length - 1}\n autoFit={autoFit}\n contentRef={col === 0 ? contentRef : undefined}\n />\n ))}\n {/* Continuous bar overlay: one element per bar, placed by grid-column so\n a cross-day span is a single unbroken block. pointer-events pass\n through the gaps to the cells below. NOT aria-hidden - these are the\n real interactive bars. */}\n {(visibleBars.length > 0 || (dragGhost && ghostPos && ghostIsBar)) && (\n <div\n data-slot=\"event-calendar-month-bar-overlay\"\n className={cn(\n \"pointer-events-none absolute inset-x-0 top-0 z-10 grid pt-1.5\",\n viewConfig.classNames?.monthBarOverlay,\n )}\n style={{\n gridTemplateColumns,\n gridAutoRows: \"var(--ec-month-bar-h, 1.75rem)\",\n }}\n >\n {visibleBars.map((bar) => {\n const pos = gridPos(bar.colStart ?? 0, bar.colSpan ?? 1);\n if (!pos) return null;\n return (\n <div\n key={bar.occurrence.key}\n className={cn(\"pointer-events-auto min-w-0 px-1\", viewConfig.classNames?.monthBar)}\n style={{\n gridColumn: `${colOffset + pos.col + 1} / span ${pos.span}`,\n gridRow: (bar.lane ?? 0) + 1,\n }}\n >\n {/* lane height minus the 2px inter-lane gap */}\n <EventCalendarEvent\n segment={bar}\n className=\"h-[calc(var(--ec-month-bar-h,1.75rem)-0.125rem)]\"\n />\n </div>\n );\n })}\n {dragGhost && ghostPos && ghostIsBar && (\n <div\n aria-hidden\n className={cn(\"min-w-0 px-1\", viewConfig.classNames?.monthBar)}\n style={{\n gridColumn: `${colOffset + ghostPos.col + 1} / span ${ghostPos.span}`,\n gridRow: ghostLane + 1,\n }}\n >\n <div\n data-slot=\"event-calendar-drag-ghost\"\n data-kind={dragGhost.kind}\n data-drop-invalid={!dragGhost.valid || undefined}\n className={cn(\n \"h-[calc(var(--ec-month-bar-h,1.75rem)-0.125rem)]\",\n dragGhost.kind === \"move\"\n ? // faint drop placeholder only: the cursor-attached\n // carry clone owns the visual during moves\n cn(\n EVENT_CALENDAR_GHOST.move,\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalid,\n )\n : cn(\n EVENT_CALENDAR_GHOST.resize,\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalidResize,\n ),\n viewConfig.classNames?.dragGhost,\n )}\n style={\n {\n \"--ec-event-color\": dragGhost.color ?? \"var(--color-primary)\",\n } as CSSProperties\n }\n >\n {dragGhost.kind !== \"move\" && (\n <EventCalendarEvent\n preview\n segment={{\n occurrence: {\n ...dragGhost.occurrence,\n start: dragGhost.proposedStart,\n end: dragGhost.proposedEnd,\n },\n day: week[ghostPos.col] ?? week[0],\n isStart: dragGhost.isStart,\n isEnd: dragGhost.isEnd,\n continuesBefore: !dragGhost.isStart,\n continuesAfter: !dragGhost.isEnd,\n }}\n className={cn(\n \"inset-ring-0 h-full\",\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalidContent,\n )}\n />\n )}\n </div>\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction EventCalendarMonthCell({\n day,\n cap,\n reservedLanes,\n hiddenBarKeys,\n isLast,\n autoFit,\n contentRef,\n}: {\n day: Date;\n cap: number;\n reservedLanes: number;\n /** Occurrence keys of the bars hidden in THIS column (lane >= cap), from the\n * week row. Lets the cell list hidden bars in its overflow popover without\n * re-listing the bars already visible in the row overlay. */\n hiddenBarKeys: Set<string>;\n /** Last column in the row - drops the right border so the grid's outer edge\n * is owned by the container, not a doubled cell border. Passed explicitly\n * because the bar overlay renders after the cells, so `:last-child` is\n * unreliable on rows that have bars. */\n isLast: boolean;\n /** When true, the \"+N more\" chip is treated as taking a row so the visible\n * chips + indicator always fit the measured cell height. */\n autoFit: boolean;\n /** Set on the first cell only: measured to derive the \"auto\" cap. */\n contentRef?: Ref<HTMLDivElement>;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const gestures = useEventCalendarGestures();\n const { segments, isToday, isOutside } = useEventCalendarDay(day);\n\n const dayStart = zonedStartOfDay(day, settings.timeZone);\n const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);\n const { effective } = useEventCalendarViewSettings();\n const isOff = resolveOffDay(\n day,\n settings.timeZone,\n effective.offDays\n ? typeof viewConfig.offDays === \"object\"\n ? viewConfig.offDays\n : true\n : false,\n settings.weekendDays,\n );\n const offClassName =\n (typeof viewConfig.offDays === \"object\" && viewConfig.offDays.className) || \"bg-muted/25\";\n\n const isDropTarget = useEventCalendarSelector<unknown, \"valid\" | \"invalid\" | null>((state) => {\n const drag = state.drag;\n if (!drag) return null;\n const covered = drag.proposedStart < dayEnd && drag.proposedEnd > dayStart;\n if (!covered) return null;\n return drag.valid ? \"valid\" : \"invalid\";\n });\n // Hide hover affordances mid-gesture: the only intent is the drop target.\n // Gated on the one thing that reads it: a plain global boolean flips for all\n // 42 cells the moment a gesture starts and again when it ends, which is pure\n // waste in the default configuration where no add button renders.\n const isInteracting = useEventCalendarSelector<unknown, boolean>((state) =>\n viewConfig.showDayAddButton ? state.drag !== null || state.slotDraft !== null : false,\n );\n const inDraft = useEventCalendarSelector<unknown, { isStart: boolean; isEnd: boolean } | null>(\n (state) => {\n const draft = state.slotDraft;\n if (!draft?.allDay) return null;\n if (draft.start >= dayEnd || draft.end <= dayStart) return null;\n return {\n isStart: draft.start >= dayStart,\n isEnd: draft.end <= dayEnd,\n };\n },\n {\n isEqual: (a, b) =>\n a === b || (a !== null && b !== null && a.isStart === b.isStart && a.isEnd === b.isEnd),\n },\n );\n // A single-day timed MOVE landing on THIS day: expose the proposed\n // minute-of-day (+ color/validity) so the cell can render a drop placeholder\n // at the correct time-sorted position, instead of the overlay marking a bar\n // over the first chip. Skipped for bars (they keep the overlay ghost) and for\n // a no-op move back onto the event's own day (the dimmed source already marks\n // the spot).\n const inlineDrop = useEventCalendarSelector<\n unknown,\n { min: number; valid: boolean; color?: string } | null\n >(\n (state) => {\n const drag = state.drag;\n if (drag?.kind !== \"move\" || drag.proposedAllDay) return null;\n if (drag.proposedEnd.getTime() - drag.proposedStart.getTime() > 86400000) return null;\n const dropDayMs = zonedStartOfDay(drag.proposedStart, settings.timeZone).getTime();\n if (dropDayMs !== dayStart.getTime()) return null;\n if (\n zonedStartOfDay(drag.occurrence.start, settings.timeZone).getTime() === dayStart.getTime()\n )\n return null;\n return {\n min: (drag.proposedStart.getTime() - dropDayMs) / 60000,\n valid: drag.valid,\n color: drag.occurrence.event.color,\n };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null && b !== null && a.min === b.min && a.valid === b.valid && a.color === b.color),\n },\n );\n\n // Bars (allDay/multi-day) are drawn by the week-row overlay; the cell renders\n // only single-day timed events, below the reserved bar lanes.\n const extraHidden = hiddenBarKeys.size;\n const hiddenBarSegs = segments.allDay.filter((s) => hiddenBarKeys.has(s.occurrence.key));\n const m = segments.timed.length;\n const timedSlots = Math.max(0, cap - reservedLanes);\n\n // Static (at-rest) split: what the cell shows with no drag, and - crucially -\n // what the \"+N more\" popover lists. The popover carries ONLY the hidden events\n // (hidden bars + timed past the cap), never the chips already visible in the\n // cell, so it never duplicates them. autoFit gives up one timed row to the\n // \"+N more\" indicator so the visible chips fit the clipped cell height.\n const staticOverflow = extraHidden > 0 || m > timedSlots;\n const staticShown = autoFit && staticOverflow ? Math.max(0, timedSlots - 1) : timedSlots;\n const overflowSegments = [...hiddenBarSegs, ...segments.timed.slice(staticShown)];\n\n // Live split: while a timed chip is dragged onto this day, render the day\n // exactly as it will look AFTER the drop. The dragged chip is a phantom in the\n // time-sorted order and is shown as the placeholder - inline where it lands,\n // or ON the \"+N more\" indicator when it lands in the overflow bucket (so the\n // user sees the drop will push it into \"more\"). The \"+N more\" count always\n // reflects the post-drop hidden total.\n let visibleTimed: EventCalendarSegment[];\n let overflowCount: number;\n let placeholderIndex: number;\n let placeholderAtMore: boolean;\n if (!inlineDrop) {\n visibleTimed = segments.timed.slice(0, staticShown);\n overflowCount = overflowSegments.length;\n placeholderIndex = -1;\n placeholderAtMore = false;\n } else {\n // rank of the dragged chip in the resulting time-sorted list (chips are\n // time-ordered, so this is the count starting at or before its time)\n const insertRank = segments.timed.filter((s) => (s.startMin ?? 0) <= inlineDrop.min).length;\n const dropOverflow = extraHidden > 0 || m + 1 > timedSlots;\n // rows for timed items INCLUDING the phantom, before the \"+N more\" row\n const vis = !dropOverflow ? m + 1 : autoFit ? Math.max(0, timedSlots - 1) : timedSlots;\n placeholderAtMore = insertRank >= vis;\n visibleTimed = placeholderAtMore\n ? segments.timed.slice(0, vis)\n : segments.timed.slice(0, Math.max(0, vis - 1));\n placeholderIndex = placeholderAtMore ? -1 : insertRank;\n overflowCount = extraHidden + (m - visibleTimed.length) + (placeholderAtMore ? 1 : 0);\n }\n\n // No dep array: the replacement for a chip that lost focus to a commit can\n // appear on any re-render of any cell, and a cell with nothing to restore\n // bails after two comparisons.\n const rootRef = useRef<HTMLDivElement | null>(null);\n useIsoLayoutEffect(() => {\n restoreChipFocus(rootRef.current, visibleTimed);\n });\n\n // Faint dashed drop placeholder, tinted to the dragged event's color, echoing\n // the move ghost (EVENT_CALENDAR_GHOST.move); one chip-height tall so chips\n // shift by exactly one row when it is inserted.\n const dropPlaceholder = inlineDrop ? (\n <div\n key=\"ec-drop-placeholder\"\n aria-hidden\n data-slot=\"event-calendar-drop-placeholder\"\n data-drop-invalid={!inlineDrop.valid || undefined}\n className={cn(\n \"shrink-0 rounded-sm border border-dashed\",\n inlineDrop.valid\n ? \"border-(--ec-event-color)/50 bg-(--ec-event-color)/8\"\n : \"border-destructive/70 bg-destructive/10\",\n viewConfig.classNames?.dragGhost,\n )}\n style={\n {\n \"--ec-event-color\": inlineDrop.color ?? \"var(--color-primary)\",\n height: \"calc(var(--ec-month-bar-h, 1.75rem) - 0.125rem)\",\n } as CSSProperties\n }\n />\n ) : null;\n\n const defaultContent = (\n <>\n <div\n ref={contentRef}\n className={cn(\n // gap-0.5 pairs with the 0.125rem subtraction in the lane spacer\n // below; changing the gap requires renderMonthCell\n // px-1 matches the all-day bar wrapper inset so single-day chips and\n // multi-day bars line up on the same left/right edge in a cell\n \"flex min-h-0 flex-1 flex-col gap-0.5 overflow-hidden px-1 pt-1.5\",\n viewConfig.classNames?.monthCellContent,\n )}\n >\n {reservedLanes > 0 && (\n <div\n aria-hidden\n className=\"shrink-0\"\n style={{\n // lane height already carries the 2px inter-lane gap; subtract\n // it so spacer + the column's own gap-0.5 = the SAME 2px rhythm\n // between the last bar and the first timed chip\n height: `calc(${reservedLanes} * var(--ec-month-bar-h, 1.75rem) - 0.125rem)`,\n }}\n />\n )}\n {visibleTimed.flatMap((segment, i) => {\n const chip = (\n <EventCalendarEvent\n key={segment.occurrence.key}\n segment={segment}\n // Remember the chip holding focus so a commit that re-keys it can\n // hand focus back to the remounted one (see restoreChipFocus)\n onFocus={(e) => {\n focusedChip = {\n node: e.currentTarget,\n eventId: segment.occurrence.eventId,\n recurrenceIndex: segment.occurrence.recurrenceIndex,\n };\n }}\n // A chip still in the tree lost focus on its own, so there is\n // nothing to restore; only a blur from the remount is kept.\n onBlur={(e) => {\n if (e.currentTarget.isConnected) focusedChip = null;\n }}\n // Hold a fixed height like the all-day lane above; without this\n // the chip flex-shrinks to whatever room the cell has left, so\n // cells with a reserved bar lane or a second chip render shorter\n // chips.\n className=\"shrink-0\"\n />\n );\n return i === placeholderIndex ? [dropPlaceholder, chip] : [chip];\n })}\n {placeholderIndex >= 0 && placeholderIndex >= visibleTimed.length && dropPlaceholder}\n {overflowCount > 0 && (\n <EventCalendarMoreIndicator\n day={day}\n count={overflowCount}\n segments={overflowSegments}\n dropInto={\n placeholderAtMore && inlineDrop\n ? { color: inlineDrop.color, valid: inlineDrop.valid }\n : undefined\n }\n />\n )}\n </div>\n {/* Day number + add affordance, bottom-right (Notion-style) */}\n <div\n className={cn(\n \"flex items-center justify-end gap-1 px-2 pb-1.5\",\n viewConfig.classNames?.monthCellFooter,\n )}\n >\n {viewConfig.showDayAddButton && !isInteracting && (\n <button\n type=\"button\"\n data-slot=\"event-calendar-day-add\"\n aria-label={settings.i18n.labels.addEvent}\n // a different icon/markup is a renderMonthCell job\n className={cn(\n \"flex size-5 cursor-pointer items-center justify-center rounded-sm bg-primary text-primary-foreground opacity-0 transition-opacity focus-visible:opacity-100 group-hover/ec-cell:opacity-100\",\n viewConfig.classNames?.dayAddButton,\n )}\n onClick={(e) => {\n e.stopPropagation();\n settings.onSlotClick?.({ date: day, allDay: true, view: \"month\" }, e);\n }}\n >\n <PlusIcon className=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n )}\n <span\n data-slot=\"event-calendar-month-day-number\"\n className={cn(\n \"flex size-5 items-center justify-center rounded-full\",\n isOutside && \"text-muted-foreground\",\n // the filled circle already marks today; keep the number the same\n // weight/size as the other days so it does not read as larger\n // Same font-size as every other day; a lighter weight cancels the\n // way white digits on the filled circle read bolder/larger than the\n // dark-on-light numbers around them.\n isToday && \"bg-primary font-light text-primary-foreground\",\n viewConfig.classNames?.monthDayNumber,\n )}\n >\n {format(toZoned(day, settings.timeZone), settings.i18n.formats.monthCellDay, {\n locale: settings.locale,\n })}\n </span>\n </div>\n </>\n );\n\n const content =\n viewConfig.renderMonthCell?.({\n day,\n segments,\n isToday,\n isOutside,\n overflowCount,\n defaultContent,\n }) ?? defaultContent;\n\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: pointer/gesture surface; keyboard via toolbar\n <div\n ref={rootRef}\n role=\"gridcell\"\n data-slot=\"event-calendar-month-cell\"\n data-today={isToday || undefined}\n data-outside={isOutside || undefined}\n data-weekend={\n settings.weekendDays.includes(toZoned(day, settings.timeZone).getDay()) || undefined\n }\n data-ec-day={dayStart.getTime()}\n data-drop-target={isDropTarget ?? undefined}\n data-off={isOff || undefined}\n data-draft={inDraft ? \"\" : undefined}\n aria-label={format(\n toZoned(day, settings.timeZone),\n settings.i18n.formats.monthCellAriaLabel,\n { locale: settings.locale },\n )}\n className={cn(\n \"group/ec-cell relative flex min-h-0 min-w-0 flex-col overflow-hidden\",\n !isLast && \"border-e\",\n isOutside && !settings.showOutsideDays && \"invisible\",\n isOff && offClassName,\n isToday &&\n cn(\"relative border-b-2 border-b-primary/40 bg-primary/3\", viewConfig.todayClassName),\n viewConfig.dayClassName?.(day),\n // No drop-target bg fill on move/resize - the dragged bar + not-allowed\n // cursor carry the feedback; a cell-wide color wash is too distracting.\n // data-drop-target stays as an opt-in styling hook.\n inDraft && \"bg-primary/5\",\n viewConfig.classNames?.monthCell,\n )}\n onPointerDown={(e) => {\n const target = e.target as HTMLElement;\n if (target.closest(\"[data-slot=event-calendar-event]\")) return;\n if (target.closest(\"[data-slot=event-calendar-more]\")) return;\n gestures.beginCreate(e, day, true);\n }}\n onClick={(e) => {\n if (wasRecentDrag() || wasRecentChipPress()) return;\n settings.onSlotClick?.({ date: day, allDay: true, view: \"month\" }, e);\n }}\n >\n {inDraft && (\n <span\n aria-hidden\n data-slot=\"event-calendar-slot-draft\"\n className={cn(\n \"pointer-events-none absolute inset-0 z-10 border-primary/40 border-y border-dashed\",\n inDraft.isStart && \"border-s\",\n inDraft.isEnd && \"border-e\",\n viewConfig.classNames?.slotDraft,\n )}\n />\n )}\n {content}\n </div>\n );\n}\n\ninterface EventCalendarMoreIndicatorProps {\n day: Date;\n count: number;\n /** The OVERFLOW (hidden) segments for this day - bars first, then timed. The\n * popover lists only these, never the chips already visible in the cell. */\n segments: EventCalendarSegment[];\n /** Set while a timed chip is dragged and will land in THIS overflow bucket:\n * the indicator itself becomes the drop placeholder (dashed, event-tinted) so\n * it reads as \"the chip joins the +N more list\". */\n dropInto?: { color?: string; valid: boolean };\n}\n\n/**\n * \"+N more\" trigger opening a popover with the day's full event list.\n * onMoreClick returning false suppresses the built-in popover.\n */\nfunction EventCalendarMoreIndicator({\n day,\n count,\n segments,\n dropInto,\n}: EventCalendarMoreIndicatorProps) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const [open, setOpen] = useState(false);\n const headerId = useId();\n\n // Grabbing a chip from this list starts a drag; close the popover so it does\n // not sit over the drop target while the event is carried to another day.\n const isDragging = useEventCalendarSelector<unknown, boolean>((state) => state.drag !== null);\n useEffect(() => {\n if (isDragging) setOpen(false);\n }, [isDragging]);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n data-slot=\"event-calendar-more\"\n data-drop-into={dropInto ? \"\" : undefined}\n data-drop-invalid={dropInto && !dropInto.valid ? \"\" : undefined}\n className={cn(\n \"cursor-pointer truncate rounded-sm px-1.5 text-start text-muted-foreground hover:text-foreground\",\n // While a dragged chip will land in this overflow bucket, the \"+N more\"\n // link itself becomes the drop placeholder: dashed, event-tinted, one\n // chip tall, so the drop target is unmistakable.\n dropInto &&\n cn(\n \"flex shrink-0 items-center border border-dashed\",\n dropInto.valid\n ? \"border-(--ec-event-color)/50 bg-(--ec-event-color)/8 text-foreground\"\n : \"border-destructive/70 bg-destructive/10 text-destructive\",\n ),\n viewConfig.classNames?.moreIndicator,\n )}\n style={\n dropInto\n ? ({\n \"--ec-event-color\": dropInto.color ?? \"var(--color-primary)\",\n height: \"calc(var(--ec-month-bar-h, 1.75rem) - 0.125rem)\",\n } as CSSProperties)\n : undefined\n }\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n const verdict = settings.onMoreClick?.(\n day,\n segments.map((segment) => segment.occurrence),\n e,\n );\n if (verdict === false) {\n e.preventDefault();\n setOpen(false);\n }\n }}\n >\n {viewConfig.renderMoreIndicator?.({ day, count, segments }) ??\n settings.i18n.labels.more(count)}\n </PopoverTrigger>\n <PopoverContent\n data-slot=\"event-calendar-more-popover\"\n align={viewConfig.morePopoverAlign}\n // The popover is a dialog, so it needs a name. The built-in body already\n // renders the day header this list belongs to, so point at that; a\n // consumer body has no header to point at and gets the same formatted\n // day as a label instead.\n aria-labelledby={viewConfig.renderMoreContent ? undefined : headerId}\n aria-label={\n viewConfig.renderMoreContent\n ? format(toZoned(day, settings.timeZone), settings.i18n.formats.moreDayHeader, {\n locale: settings.locale,\n })\n : undefined\n }\n // PopoverContent is unlayered (flex-col gap-4 p-4); override with !.\n // text-xs re-establishes the calendar's base type here because this\n // content is portaled out of the root subtree and cannot inherit it.\n className={cn(\"w-64 gap-1! p-2! text-xs\", viewConfig.classNames?.morePopover)}\n onClick={(e: React.MouseEvent) => e.stopPropagation()}\n >\n {viewConfig.renderMoreContent ? (\n viewConfig.renderMoreContent({\n day,\n segments,\n close: () => setOpen(false),\n })\n ) : (\n <EventCalendarMoreDefaultContent day={day} segments={segments} headerId={headerId} />\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\n/** Built-in \"+N more\" popover body: day header + the day's chips. */\nfunction EventCalendarMoreDefaultContent({\n day,\n segments,\n headerId,\n}: {\n day: Date;\n segments: EventCalendarSegment[];\n /** Names the popover dialog: the header IS the list's accessible name. */\n headerId?: string;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n return (\n <>\n <div\n id={headerId}\n className={cn(\n \"px-1 py-1 font-medium text-muted-foreground text-xs\",\n viewConfig.classNames?.morePopoverHeader,\n )}\n >\n {format(toZoned(day, settings.timeZone), settings.i18n.formats.moreDayHeader, {\n locale: settings.locale,\n })}\n </div>\n {/* The scroll region breaks out of the popover's right padding (-me-2)\n so the scrollbar sits flush in the gutter; the list then pads itself\n back (ps-1 aligns with the header, pe-4 clears the ~10px bar with a\n gap) and adds py-1 so the first/last focus ring is not clipped by\n the overflow. Layout is identical with or without a scrollbar. */}\n {viewConfig.scrollbars === \"native\" ? (\n <div\n data-ec-native-scroll=\"\"\n className=\"-me-2 max-h-(--ec-more-max-height,16rem) min-h-0 overflow-y-auto\"\n >\n <div className=\"flex flex-col gap-1 py-1 ps-1 pe-4\">\n {segments.map((segment) => (\n <EventCalendarEvent\n key={segment.occurrence.key}\n segment={segment}\n className=\"py-0.5\"\n />\n ))}\n </div>\n </div>\n ) : (\n <ScrollArea className=\"-me-2 min-h-0 **:data-[slot=scroll-area-viewport]:max-h-(--ec-more-max-height,16rem)\">\n <div className=\"flex flex-col gap-1 py-1 ps-1 pe-4\">\n {segments.map((segment) => (\n <EventCalendarEvent\n key={segment.occurrence.key}\n segment={segment}\n className=\"py-0.5\"\n />\n ))}\n </div>\n </ScrollArea>\n )}\n </>\n );\n}\n\nexport type { EventCalendarMonthViewProps, EventCalendarMoreIndicatorProps };\nexport { EventCalendarMonthView, EventCalendarMoreIndicator };\n"],"mappings":";;;;;;;;;;;;;;;AAiDA,MAAM,qBAAqB,OAAO,WAAW,cAAc,kBAAkB;AAQ7E,IAAI,cAIO;;AAGX,SAAS,iBAAiB,MAA0B,UAAkC;CACpF,MAAM,UAAU;CAGhB,IAAI,CAAC,QAAQ,CAAC,WAAW,QAAQ,KAAK,aAAa;CACnD,MAAM,SAAS,SAAS;CACxB,IAAI,UAAU,WAAW,SAAS,MAAM;CACxC,MAAM,QAAQ,SAAS,WACpB,YACC,QAAQ,WAAW,YAAY,QAAQ,WACvC,QAAQ,WAAW,oBAAoB,QAAQ,eACnD;CACA,IAAI,QAAQ,GAAG;CACf,MAAM,OAAO,KAAK,iBAA8B,kCAAkC,CAAC,CAAC;CACpF,IAAI,CAAC,MAAM;CAEX,cAAc;CACd,KAAK,MAAM;AACb;AAMA,SAAS,uBAAuB,EAC9B,WACA,QACA,kBACA,GAAG,SAC2B;CAC9B,MAAM,WAAW,iBAAiB;CAClC,MAA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event-calendar-nav.tsx"],"mappings":";;;KAuEK,iBAAiB,KAAK,UAAU;EACnC,WAAW;;;;;;;;;;;;EAYX,UAAU;;iBAwBH,wBAAwB,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;iBA6BxF,uBAAuB,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;iBAsBvF,uBAAuB,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;UAsBtF,gCAAgC,UAAU;EAClD,UAAU;IAAO;QAAoB;;iBAG9B,qBACP,WACA,QACA,QAAQ,gBACL,SACF,0CAAuB,+CAAA;UAoBhB,uCACA,KAAK,UAAU;EACvB,WAAW;;;EAGX,UAAU;;iBAGH,4BACP,WACA,QACA,UACA,YACG,SACF,iDAA8B,IAAA;UAwIvB,qCACA,KAAK,UAAU;EACvB,WAAW;;EAEX;;;EAGA,UAAU;;;;;;;;;;iBAcH,0BACP,WACA,QACA,UACA,SACA,SACG,SACF,+CAA4B,IAAA;KAsE1B,4BAA4B,UAAU;;iBAGlC,uBAAuB,WAAW,WAAW,SAAS,4CAAyB,+CAAA;UAc9E,8BAA8B,UAAU;;;;;;;EAOhD;;;;;;iBAOO,mBACP,WACA,QACA,UACA,qBACG,SACF,wCAAqB,+CAAA"}
1
+ {"version":3,"file":"event-calendar-nav.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-nav.tsx"],"mappings":";;;KAuEK,iBAAiB,KAAK,UAAU;EACnC,WAAW;;;;;;;;;;;;EAYX,UAAU;;iBAwBH,wBAAwB,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;iBA6BxF,uBAAuB,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;iBAsBvF,uBAAuB,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;UAsBtF,gCAAgC,UAAU;EAClD,UAAU;IAAO;QAAoB;;iBAG9B,qBACP,WACA,QACA,QAAQ,gBACL,SACF,0CAAuB,+CAAA;UAoBhB,uCACA,KAAK,UAAU;EACvB,WAAW;;;EAGX,UAAU;;iBAGH,4BACP,WACA,QACA,UACA,YACG,SACF,iDAA8B,IAAA;UAyIvB,qCACA,KAAK,UAAU;EACvB,WAAW;;EAEX;;;EAGA,UAAU;;;;;;;;;;iBAcH,0BACP,WACA,QACA,UACA,SACA,SACG,SACF,+CAA4B,IAAA;KAsE1B,4BAA4B,UAAU;;iBAGlC,uBAAuB,WAAW,WAAW,SAAS,4CAAyB,+CAAA;UAc9E,8BAA8B,UAAU;;;;;;;EAOhD;;;;;;iBAOO,mBACP,WACA,QACA,UACA,qBACG,SACF,wCAAqB,+CAAA"}
@@ -158,7 +158,8 @@ function EventCalendarViewSwitcher({ className, render, children, tooltip, ...pr
158
158
  size: nav.size,
159
159
  "data-slot": "event-calendar-view-switcher",
160
160
  "aria-label": labels.selectView,
161
- className: cn("gap-1", nav.className, className)
161
+ className: cn("gap-1", nav.className, className),
162
+ render
162
163
  }) }),
163
164
  ...props,
164
165
  children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [viewLabel(view), /* @__PURE__ */ jsx(ChevronDownIcon, {
@@ -1 +1 @@
1
- {"version":3,"file":"event-calendar-nav.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, format } from \"date-fns\";\nimport { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Calendar } from \"../../ui/calendar\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n useEventCalendarNavigation,\n useEventCalendarSettings,\n useEventCalendarView,\n useEventCalendarViewConfig,\n} from \"./event-calendar\";\nimport { toZoned } from \"./event-calendar-lib\";\nimport type { CalendarView } from \"./event-calendar-types\";\n\n/** Configured nav button variant/size (viewConfig.navButtonVariant/Size)\n * plus the shared classNames.navButton hook, merged on every nav button. */\nfunction useNavButtonProps(): {\n variant: \"ghost\" | \"outline\" | \"secondary\" | \"default\";\n size: \"sm\" | \"default\";\n iconSize: \"icon-sm\" | \"icon\";\n className: string | undefined;\n} {\n const viewConfig = useEventCalendarViewConfig();\n return {\n variant: viewConfig.navButtonVariant,\n size: viewConfig.navButtonSize,\n iconSize: viewConfig.navButtonSize === \"sm\" ? \"icon-sm\" : \"icon\",\n className: viewConfig.classNames?.navButton,\n };\n}\n\n/** Resolved nav tooltip policy (viewConfig.navTooltips + classNames.navTooltip). */\nfunction useNavTooltipConfig(): {\n disabled: boolean;\n side: \"top\" | \"bottom\" | \"left\" | \"right\";\n delay: number;\n closeDelay: number;\n timeout: number;\n className: string | undefined;\n} {\n const viewConfig = useEventCalendarViewConfig();\n const config = viewConfig.navTooltips === false ? undefined : viewConfig.navTooltips;\n return {\n disabled: viewConfig.navTooltips === false,\n // the nav sits at the top of the calendar, so tooltips open upward by\n // default (away from the grid); collision flipping still drops them below\n // when there is no room above\n side: config?.side ?? \"top\",\n delay: config?.delay ?? 600,\n closeDelay: config?.closeDelay ?? 0,\n timeout: config?.timeout ?? 300,\n className: viewConfig.classNames?.navTooltip,\n };\n}\n\ntype NavButtonProps = Omit<useRender.ComponentProps<\"button\">, \"children\"> & {\n children?: ReactNode;\n /**\n * Tooltip policy (the part that usually goes wrong on clickable elements):\n * tooltips appear ONLY on hover or keyboard focus-visible - a pointer click\n * never re-triggers them. Buttons that open overlays (the view switcher)\n * use a hover-only tooltip that is force-closed while the overlay is up and\n * ignores focus, so nothing flashes when focus returns after selection.\n * Icon-only buttons default to their accessible label; Today defaults to\n * the actual current date (info the label doesn't carry). Pass null to\n * disable one, or any node to override; viewConfig.navTooltips=false turns\n * them all off (its object form tunes side/delay/closeDelay/timeout).\n */\n tooltip?: ReactNode | null;\n};\n\n/** Hover/focus-visible tooltip wrapper; renders the bare button when disabled\n * (per-button content=null or viewConfig.navTooltips=false). */\nfunction NavTooltip({\n content,\n children,\n}: {\n content: ReactNode | null;\n children: React.ReactElement;\n}) {\n const tooltips = useNavTooltipConfig();\n if (tooltips.disabled || content === null || content === undefined) return children;\n return (\n <Tooltip>\n <TooltipTrigger render={children} />\n <TooltipContent side={tooltips.side} className={tooltips.className}>\n {content}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nfunction EventCalendarNavToday({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { today, isToday } = useEventCalendarNavigation();\n const settings = useEventCalendarSettings();\n const nav = useNavButtonProps();\n // display-zone \"today\", like every other today derivation in the calendar\n // (a system-zone new Date() can name a different day than Today opens)\n const defaultTooltip = format(\n toZoned(new Date(), settings.timeZone),\n settings.i18n.formats.dayTitle,\n { locale: settings.locale },\n );\n return (\n <NavTooltip content={tooltip === undefined ? defaultTooltip : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"event-calendar-nav-today\"\n data-active={isToday || undefined}\n className={cn(nav.className, className)}\n onClick={today}\n render={render}\n {...props}\n >\n {children ?? settings.i18n.labels.today}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction EventCalendarNavPrev({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { prev } = useEventCalendarNavigation();\n const settings = useEventCalendarSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.previous : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"event-calendar-nav-prev\"\n aria-label={settings.i18n.labels.previous}\n className={cn(nav.className, className)}\n onClick={prev}\n render={render}\n {...props}\n >\n {children ?? <ChevronLeftIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction EventCalendarNavNext({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { next } = useEventCalendarNavigation();\n const settings = useEventCalendarSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.next : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"event-calendar-nav-next\"\n aria-label={settings.i18n.labels.next}\n className={cn(nav.className, className)}\n onClick={next}\n render={render}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\ninterface EventCalendarTitleProps extends useRender.ComponentProps<\"div\"> {\n format?: (ctx: { title: string }) => ReactNode;\n}\n\nfunction EventCalendarTitle({\n className,\n render,\n format: formatTitle,\n ...props\n}: EventCalendarTitleProps) {\n const { title } = useEventCalendarNavigation();\n const viewConfig = useEventCalendarViewConfig();\n const defaultProps = {\n \"data-slot\": \"event-calendar-title\",\n \"aria-live\": \"polite\" as const,\n className: cn(\n \"min-w-0 truncate font-semibold text-sm\",\n viewConfig.classNames?.title,\n className,\n ),\n children: formatTitle?.({ title }) ?? title,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface EventCalendarViewSwitcherProps\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** Hover/focus-visible hint; defaults to the \"Select view\" label. Pass\n * null to disable (overlay-opener policy). */\n tooltip?: ReactNode | null;\n}\n\nfunction EventCalendarViewSwitcher({\n className,\n render,\n children,\n tooltip,\n ...props\n}: EventCalendarViewSwitcherProps) {\n const { view, dayCount, availableViews, setView } = useEventCalendarView();\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const nav = useNavButtonProps();\n const tooltips = useNavTooltipConfig();\n const labels = settings.i18n.labels;\n // Controlled open: selecting a view swaps the whole content subtree in the\n // same click, so closing must not depend on the menu's internal handler.\n const [open, setOpen] = useState(false);\n // Hover-only tooltip: when the menu closes, Base UI focuses the trigger\n // again and a focus-opened tooltip would flash - ignore focus opens.\n const [tipOpen, setTipOpen] = useState(false);\n\n const selectView = (v: CalendarView, opts?: { dayCount?: number }) => {\n setOpen(false);\n setView(v, opts);\n };\n\n const viewLabel = (v: CalendarView) =>\n v === \"days\" ? settings.i18n.viewNames.days(dayCount) : settings.i18n.viewNames[v];\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next: boolean) => {\n setOpen(next);\n if (next) setTipOpen(false);\n }}\n >\n {/* Tooltip on an overlay-opener: hover-only (focus opens ignored) and\n force-closed while the menu is up, so it never lingers or flashes\n when focus returns on close. Inherits the nav TooltipProvider's\n delay/closeDelay/timeout. */}\n <Tooltip\n open={tipOpen && !open}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens are hover-only; the trigger-focus open that follows a\n // menu close is ignored, closes always land\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"event-calendar-view-switcher\"\n aria-label={labels.selectView}\n className={cn(\"gap-1\", nav.className, className)}\n />\n }\n />\n }\n {...props}\n >\n {children ?? (\n <>\n {viewLabel(view)}\n <ChevronDownIcon className=\"size-4 opacity-60\" aria-hidden=\"true\" />\n </>\n )}\n </DropdownMenuTrigger>\n {tipOpen && !open && tooltip !== null && !tooltips.disabled && (\n <TooltipContent side={tooltips.side} className={tooltips.className}>\n {tooltip ?? labels.selectView}\n </TooltipContent>\n )}\n </Tooltip>\n <DropdownMenuContent\n align=\"start\"\n className={cn(\"min-w-44\", viewConfig.classNames?.viewSwitcherContent)}\n >\n {/* Base UI contract: GroupLabel must live inside Menu.Group */}\n <DropdownMenuGroup>\n <DropdownMenuLabel\n className={cn(\n \"font-normal text-muted-foreground\",\n viewConfig.classNames?.viewSwitcherLabel,\n )}\n >\n {settings.i18n.labels.selectView}\n </DropdownMenuLabel>\n {availableViews.map((v) =>\n v === \"days\" ? (\n viewConfig.dayCountPresets.map((count) => (\n <DropdownMenuItem\n key={`days-${count}`}\n data-active={(view === \"days\" && dayCount === count) || undefined}\n onClick={() => selectView(\"days\", { dayCount: count })}\n >\n {settings.i18n.viewNames.days(count)}\n {/* hint derived from the preset itself, not i18n's default */}\n {viewConfig.enableShortcuts && (\n <EventCalendarViewShortcut>{count}</EventCalendarViewShortcut>\n )}\n </DropdownMenuItem>\n ))\n ) : (\n <DropdownMenuItem\n key={v}\n data-active={view === v || undefined}\n onClick={() => selectView(v)}\n >\n {viewLabel(v)}\n {viewConfig.enableShortcuts && (\n <EventCalendarViewShortcut>{labels.viewShortcuts[v]}</EventCalendarViewShortcut>\n )}\n </DropdownMenuItem>\n ),\n )}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/** Outline key badge; theme-token only, so it adapts to every style. */\nfunction EventCalendarViewShortcut({ children }: { children: ReactNode }) {\n const viewConfig = useEventCalendarViewConfig();\n return (\n <kbd\n data-slot=\"event-calendar-view-shortcut\"\n className={cn(\n \"ms-auto inline-flex size-5 shrink-0 items-center justify-center rounded-sm border font-sans text-muted-foreground text-xs\",\n viewConfig.classNames?.viewShortcut,\n )}\n >\n {children}\n </kbd>\n );\n}\n\ninterface EventCalendarDatePickerProps\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** \"auto\" (default) resolves per view: range for week/N-days/agenda. */\n mode?: \"auto\" | \"single\" | \"range\";\n /** Hover/focus-visible hint; defaults to null - no tooltip, because the\n * button opens an overlay (see the NavButtonProps tooltip policy). */\n tooltip?: ReactNode | null;\n}\n\n/** Views whose period reads better as a highlighted range. */\nconst RANGE_VIEWS: CalendarView[] = [\"week\", \"days\", \"agenda\"];\n\n/**\n * Optional go-to-date picker (shadcn Calendar in a popover), view-aware:\n * week/N-days/agenda highlight the whole active range (any click re-anchors\n * the period), other views select a single date. Not part of the default\n * nav - compose it yourself (or any external picker driving\n * useEventCalendarNavigation().goTo). No tooltip by default: it opens an\n * overlay (see the NavButtonProps tooltip policy); pass `tooltip` to opt in.\n */\nfunction EventCalendarDatePicker({\n className,\n render,\n children,\n tooltip = null,\n mode,\n ...props\n}: EventCalendarDatePickerProps) {\n const { date, goTo, activeRange } = useEventCalendarNavigation();\n const { view } = useEventCalendarView();\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const nav = useNavButtonProps();\n const [open, setOpen] = useState(false);\n const zoned = toZoned(date, settings.timeZone);\n\n const configured = mode ?? \"auto\";\n const resolved =\n configured === \"auto\" ? (RANGE_VIEWS.includes(view) ? \"range\" : \"single\") : configured;\n\n const pick = (next: Date | undefined) => {\n if (!next) return;\n goTo(next);\n setOpen(false);\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <NavTooltip content={tooltip}>\n <PopoverTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"event-calendar-date-picker\"\n data-mode={resolved}\n aria-label={settings.i18n.labels.goToDate}\n className={cn(nav.className, className)}\n render={render}\n />\n }\n {...props}\n >\n {children ?? <CalendarIcon className=\"size-4\" aria-hidden=\"true\" />}\n </PopoverTrigger>\n </NavTooltip>\n <PopoverContent\n align=\"start\"\n className={cn(\"w-auto p-0!\", viewConfig.classNames?.datePickerContent)}\n >\n {resolved === \"range\" ? (\n <Calendar\n mode=\"range\"\n selected={{\n from: toZoned(activeRange.start, settings.timeZone),\n to: toZoned(addDays(activeRange.end, -1), settings.timeZone),\n }}\n defaultMonth={zoned}\n onDayClick={pick}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n />\n ) : (\n <Calendar\n mode=\"single\"\n selected={zoned}\n defaultMonth={zoned}\n onSelect={pick}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n />\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\ntype EventCalendarToolbarProps = useRender.ComponentProps<\"div\">;\n\n/** Free slot for consumer toolbar buttons; pure layout shell. */\nfunction EventCalendarToolbar({ className, render, ...props }: EventCalendarToolbarProps) {\n const viewConfig = useEventCalendarViewConfig();\n const defaultProps = {\n \"data-slot\": \"event-calendar-toolbar\",\n className: cn(\"flex items-center gap-2\", viewConfig.classNames?.toolbar, className),\n children: props.children,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface EventCalendarNavProps extends useRender.ComponentProps<\"div\"> {\n /**\n * Render the view switcher in the composed layout. Turn off when the\n * calendar ships with a fixed view (e.g. a month-only embed) and users\n * should not be able to change it.\n * @default true\n */\n showViewSwitcher?: boolean;\n}\n\n/**\n * Default composed nav: Today, prev/next, title, spacer, view switcher.\n * Pass children to use it as a pure layout shell instead.\n */\nfunction EventCalendarNav({\n className,\n render,\n children,\n showViewSwitcher = true,\n ...props\n}: EventCalendarNavProps) {\n const viewConfig = useEventCalendarViewConfig();\n const tooltips = useNavTooltipConfig();\n const defaultProps = {\n \"data-slot\": \"event-calendar-nav\",\n className: cn(\n \"flex min-w-0 flex-wrap items-center gap-1 px-2 py-2\",\n viewConfig.stickyNav && \"sticky top-0 z-30 bg-background\",\n viewConfig.classNames?.nav,\n className,\n ),\n children: children ?? (\n // Shared provider: first tooltip waits, moving between buttons is instant\n <TooltipProvider\n delay={tooltips.delay}\n closeDelay={tooltips.closeDelay}\n timeout={tooltips.timeout}\n >\n <EventCalendarNavToday />\n {showViewSwitcher && <EventCalendarViewSwitcher />}\n <div className=\"flex items-center\">\n <EventCalendarNavPrev />\n <EventCalendarNavNext />\n </div>\n {/* ms-3 sets the title apart from the tight control cluster so the\n period reads as its own group, not another button */}\n <EventCalendarTitle className=\"ms-3\" />\n <div className=\"grow\" />\n </TooltipProvider>\n ),\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\nexport type {\n EventCalendarNavProps,\n EventCalendarTitleProps,\n EventCalendarToolbarProps,\n EventCalendarViewSwitcherProps,\n};\nexport {\n EventCalendarDatePicker,\n EventCalendarNav,\n EventCalendarNavNext,\n EventCalendarNavPrev,\n EventCalendarNavToday,\n EventCalendarTitle,\n EventCalendarToolbar,\n EventCalendarViewSwitcher,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,SAAS,oBAKP;CACA,MAAM,aAAa,2BAA2B;CAC9C,OAAO;EACL,SAAS,WAAW;EACpB,MAAM,WAAW;EACjB,UAAU,WAAW,kBAAkB,OAAO,YAAY;EAC1D,WAAW,WAAW,YAAY;CACpC;AACF;;AAGA,SAAS,sBAOP;CACA,MAAM,aAAa,2BAA2B;CAC9C,MAAM,SAAS,WAAW,gBAAgB,QAAQ,KAAA,IAAY,WAAW;CACzE,OAAO;EACL,UAAU,WAAW,gBAAgB;EAIrC,MAAM,QAAQ,QAAQ;EACtB,OAAO,QAAQ,SAAS;EACxB,YAAY,QAAQ,cAAc;EAClC,SAAS,QAAQ,WAAW;EAC5B,WAAW,WAAW,YAAY;CACpC;AACF;;;AAoBA,SAAS,WAAW,EAClB,SACA,YAIC;CACD,MAAM,WAAW,oBAAoB;CACrC,IAAI,SAAS,YAAY,YAAY,QAAQ,YAAY,KAAA,GAAW,OAAO;CAC3E,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAgB,QAAQ,SAAW,CAAA,GACnC,oBAAC,gBAAD;EAAgB,MAAM,SAAS;EAAM,WAAW,SAAS;EACtD,UAAA;CACa,CAAA,CACT,EAAA,CAAA;AAEb;AAEA,SAAS,sBAAsB,EAAE,WAAW,QAAQ,UAAU,SAAS,GAAG,SAAyB;CACjG,MAAM,EAAE,OAAO,YAAY,2BAA2B;CACtD,MAAM,WAAW,yBAAyB;CAC1C,MAAM,MAAM,kBA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AU,OAAQ,CAAA;KACtC,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;IACR;;EAMiB,GAAG,KAAK;CAC9C,CAAC;AACH"}
1
+ {"version":3,"file":"event-calendar-nav.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, format } from \"date-fns\";\nimport { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Calendar } from \"../../ui/calendar\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n useEventCalendarNavigation,\n useEventCalendarSettings,\n useEventCalendarView,\n useEventCalendarViewConfig,\n} from \"./event-calendar\";\nimport { toZoned } from \"./event-calendar-lib\";\nimport type { CalendarView } from \"./event-calendar-types\";\n\n/** Configured nav button variant/size (viewConfig.navButtonVariant/Size)\n * plus the shared classNames.navButton hook, merged on every nav button. */\nfunction useNavButtonProps(): {\n variant: \"ghost\" | \"outline\" | \"secondary\" | \"default\";\n size: \"sm\" | \"default\";\n iconSize: \"icon-sm\" | \"icon\";\n className: string | undefined;\n} {\n const viewConfig = useEventCalendarViewConfig();\n return {\n variant: viewConfig.navButtonVariant,\n size: viewConfig.navButtonSize,\n iconSize: viewConfig.navButtonSize === \"sm\" ? \"icon-sm\" : \"icon\",\n className: viewConfig.classNames?.navButton,\n };\n}\n\n/** Resolved nav tooltip policy (viewConfig.navTooltips + classNames.navTooltip). */\nfunction useNavTooltipConfig(): {\n disabled: boolean;\n side: \"top\" | \"bottom\" | \"left\" | \"right\";\n delay: number;\n closeDelay: number;\n timeout: number;\n className: string | undefined;\n} {\n const viewConfig = useEventCalendarViewConfig();\n const config = viewConfig.navTooltips === false ? undefined : viewConfig.navTooltips;\n return {\n disabled: viewConfig.navTooltips === false,\n // the nav sits at the top of the calendar, so tooltips open upward by\n // default (away from the grid); collision flipping still drops them below\n // when there is no room above\n side: config?.side ?? \"top\",\n delay: config?.delay ?? 600,\n closeDelay: config?.closeDelay ?? 0,\n timeout: config?.timeout ?? 300,\n className: viewConfig.classNames?.navTooltip,\n };\n}\n\ntype NavButtonProps = Omit<useRender.ComponentProps<\"button\">, \"children\"> & {\n children?: ReactNode;\n /**\n * Tooltip policy (the part that usually goes wrong on clickable elements):\n * tooltips appear ONLY on hover or keyboard focus-visible - a pointer click\n * never re-triggers them. Buttons that open overlays (the view switcher)\n * use a hover-only tooltip that is force-closed while the overlay is up and\n * ignores focus, so nothing flashes when focus returns after selection.\n * Icon-only buttons default to their accessible label; Today defaults to\n * the actual current date (info the label doesn't carry). Pass null to\n * disable one, or any node to override; viewConfig.navTooltips=false turns\n * them all off (its object form tunes side/delay/closeDelay/timeout).\n */\n tooltip?: ReactNode | null;\n};\n\n/** Hover/focus-visible tooltip wrapper; renders the bare button when disabled\n * (per-button content=null or viewConfig.navTooltips=false). */\nfunction NavTooltip({\n content,\n children,\n}: {\n content: ReactNode | null;\n children: React.ReactElement;\n}) {\n const tooltips = useNavTooltipConfig();\n if (tooltips.disabled || content === null || content === undefined) return children;\n return (\n <Tooltip>\n <TooltipTrigger render={children} />\n <TooltipContent side={tooltips.side} className={tooltips.className}>\n {content}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nfunction EventCalendarNavToday({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { today, isToday } = useEventCalendarNavigation();\n const settings = useEventCalendarSettings();\n const nav = useNavButtonProps();\n // display-zone \"today\", like every other today derivation in the calendar\n // (a system-zone new Date() can name a different day than Today opens)\n const defaultTooltip = format(\n toZoned(new Date(), settings.timeZone),\n settings.i18n.formats.dayTitle,\n { locale: settings.locale },\n );\n return (\n <NavTooltip content={tooltip === undefined ? defaultTooltip : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"event-calendar-nav-today\"\n data-active={isToday || undefined}\n className={cn(nav.className, className)}\n onClick={today}\n render={render}\n {...props}\n >\n {children ?? settings.i18n.labels.today}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction EventCalendarNavPrev({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { prev } = useEventCalendarNavigation();\n const settings = useEventCalendarSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.previous : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"event-calendar-nav-prev\"\n aria-label={settings.i18n.labels.previous}\n className={cn(nav.className, className)}\n onClick={prev}\n render={render}\n {...props}\n >\n {children ?? <ChevronLeftIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction EventCalendarNavNext({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { next } = useEventCalendarNavigation();\n const settings = useEventCalendarSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.next : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"event-calendar-nav-next\"\n aria-label={settings.i18n.labels.next}\n className={cn(nav.className, className)}\n onClick={next}\n render={render}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\ninterface EventCalendarTitleProps extends useRender.ComponentProps<\"div\"> {\n format?: (ctx: { title: string }) => ReactNode;\n}\n\nfunction EventCalendarTitle({\n className,\n render,\n format: formatTitle,\n ...props\n}: EventCalendarTitleProps) {\n const { title } = useEventCalendarNavigation();\n const viewConfig = useEventCalendarViewConfig();\n const defaultProps = {\n \"data-slot\": \"event-calendar-title\",\n \"aria-live\": \"polite\" as const,\n className: cn(\n \"min-w-0 truncate font-semibold text-sm\",\n viewConfig.classNames?.title,\n className,\n ),\n children: formatTitle?.({ title }) ?? title,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface EventCalendarViewSwitcherProps\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** Hover/focus-visible hint; defaults to the \"Select view\" label. Pass\n * null to disable (overlay-opener policy). */\n tooltip?: ReactNode | null;\n}\n\nfunction EventCalendarViewSwitcher({\n className,\n render,\n children,\n tooltip,\n ...props\n}: EventCalendarViewSwitcherProps) {\n const { view, dayCount, availableViews, setView } = useEventCalendarView();\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const nav = useNavButtonProps();\n const tooltips = useNavTooltipConfig();\n const labels = settings.i18n.labels;\n // Controlled open: selecting a view swaps the whole content subtree in the\n // same click, so closing must not depend on the menu's internal handler.\n const [open, setOpen] = useState(false);\n // Hover-only tooltip: when the menu closes, Base UI focuses the trigger\n // again and a focus-opened tooltip would flash - ignore focus opens.\n const [tipOpen, setTipOpen] = useState(false);\n\n const selectView = (v: CalendarView, opts?: { dayCount?: number }) => {\n setOpen(false);\n setView(v, opts);\n };\n\n const viewLabel = (v: CalendarView) =>\n v === \"days\" ? settings.i18n.viewNames.days(dayCount) : settings.i18n.viewNames[v];\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next: boolean) => {\n setOpen(next);\n if (next) setTipOpen(false);\n }}\n >\n {/* Tooltip on an overlay-opener: hover-only (focus opens ignored) and\n force-closed while the menu is up, so it never lingers or flashes\n when focus returns on close. Inherits the nav TooltipProvider's\n delay/closeDelay/timeout. */}\n <Tooltip\n open={tipOpen && !open}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens are hover-only; the trigger-focus open that follows a\n // menu close is ignored, closes always land\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"event-calendar-view-switcher\"\n aria-label={labels.selectView}\n className={cn(\"gap-1\", nav.className, className)}\n render={render}\n />\n }\n />\n }\n {...props}\n >\n {children ?? (\n <>\n {viewLabel(view)}\n <ChevronDownIcon className=\"size-4 opacity-60\" aria-hidden=\"true\" />\n </>\n )}\n </DropdownMenuTrigger>\n {tipOpen && !open && tooltip !== null && !tooltips.disabled && (\n <TooltipContent side={tooltips.side} className={tooltips.className}>\n {tooltip ?? labels.selectView}\n </TooltipContent>\n )}\n </Tooltip>\n <DropdownMenuContent\n align=\"start\"\n className={cn(\"min-w-44\", viewConfig.classNames?.viewSwitcherContent)}\n >\n {/* Base UI contract: GroupLabel must live inside Menu.Group */}\n <DropdownMenuGroup>\n <DropdownMenuLabel\n className={cn(\n \"font-normal text-muted-foreground\",\n viewConfig.classNames?.viewSwitcherLabel,\n )}\n >\n {settings.i18n.labels.selectView}\n </DropdownMenuLabel>\n {availableViews.map((v) =>\n v === \"days\" ? (\n viewConfig.dayCountPresets.map((count) => (\n <DropdownMenuItem\n key={`days-${count}`}\n data-active={(view === \"days\" && dayCount === count) || undefined}\n onClick={() => selectView(\"days\", { dayCount: count })}\n >\n {settings.i18n.viewNames.days(count)}\n {/* hint derived from the preset itself, not i18n's default */}\n {viewConfig.enableShortcuts && (\n <EventCalendarViewShortcut>{count}</EventCalendarViewShortcut>\n )}\n </DropdownMenuItem>\n ))\n ) : (\n <DropdownMenuItem\n key={v}\n data-active={view === v || undefined}\n onClick={() => selectView(v)}\n >\n {viewLabel(v)}\n {viewConfig.enableShortcuts && (\n <EventCalendarViewShortcut>{labels.viewShortcuts[v]}</EventCalendarViewShortcut>\n )}\n </DropdownMenuItem>\n ),\n )}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/** Outline key badge; theme-token only, so it adapts to every style. */\nfunction EventCalendarViewShortcut({ children }: { children: ReactNode }) {\n const viewConfig = useEventCalendarViewConfig();\n return (\n <kbd\n data-slot=\"event-calendar-view-shortcut\"\n className={cn(\n \"ms-auto inline-flex size-5 shrink-0 items-center justify-center rounded-sm border font-sans text-muted-foreground text-xs\",\n viewConfig.classNames?.viewShortcut,\n )}\n >\n {children}\n </kbd>\n );\n}\n\ninterface EventCalendarDatePickerProps\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** \"auto\" (default) resolves per view: range for week/N-days/agenda. */\n mode?: \"auto\" | \"single\" | \"range\";\n /** Hover/focus-visible hint; defaults to null - no tooltip, because the\n * button opens an overlay (see the NavButtonProps tooltip policy). */\n tooltip?: ReactNode | null;\n}\n\n/** Views whose period reads better as a highlighted range. */\nconst RANGE_VIEWS: CalendarView[] = [\"week\", \"days\", \"agenda\"];\n\n/**\n * Optional go-to-date picker (shadcn Calendar in a popover), view-aware:\n * week/N-days/agenda highlight the whole active range (any click re-anchors\n * the period), other views select a single date. Not part of the default\n * nav - compose it yourself (or any external picker driving\n * useEventCalendarNavigation().goTo). No tooltip by default: it opens an\n * overlay (see the NavButtonProps tooltip policy); pass `tooltip` to opt in.\n */\nfunction EventCalendarDatePicker({\n className,\n render,\n children,\n tooltip = null,\n mode,\n ...props\n}: EventCalendarDatePickerProps) {\n const { date, goTo, activeRange } = useEventCalendarNavigation();\n const { view } = useEventCalendarView();\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const nav = useNavButtonProps();\n const [open, setOpen] = useState(false);\n const zoned = toZoned(date, settings.timeZone);\n\n const configured = mode ?? \"auto\";\n const resolved =\n configured === \"auto\" ? (RANGE_VIEWS.includes(view) ? \"range\" : \"single\") : configured;\n\n const pick = (next: Date | undefined) => {\n if (!next) return;\n goTo(next);\n setOpen(false);\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <NavTooltip content={tooltip}>\n <PopoverTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"event-calendar-date-picker\"\n data-mode={resolved}\n aria-label={settings.i18n.labels.goToDate}\n className={cn(nav.className, className)}\n render={render}\n />\n }\n {...props}\n >\n {children ?? <CalendarIcon className=\"size-4\" aria-hidden=\"true\" />}\n </PopoverTrigger>\n </NavTooltip>\n <PopoverContent\n align=\"start\"\n className={cn(\"w-auto p-0!\", viewConfig.classNames?.datePickerContent)}\n >\n {resolved === \"range\" ? (\n <Calendar\n mode=\"range\"\n selected={{\n from: toZoned(activeRange.start, settings.timeZone),\n to: toZoned(addDays(activeRange.end, -1), settings.timeZone),\n }}\n defaultMonth={zoned}\n onDayClick={pick}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n />\n ) : (\n <Calendar\n mode=\"single\"\n selected={zoned}\n defaultMonth={zoned}\n onSelect={pick}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n />\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\ntype EventCalendarToolbarProps = useRender.ComponentProps<\"div\">;\n\n/** Free slot for consumer toolbar buttons; pure layout shell. */\nfunction EventCalendarToolbar({ className, render, ...props }: EventCalendarToolbarProps) {\n const viewConfig = useEventCalendarViewConfig();\n const defaultProps = {\n \"data-slot\": \"event-calendar-toolbar\",\n className: cn(\"flex items-center gap-2\", viewConfig.classNames?.toolbar, className),\n children: props.children,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface EventCalendarNavProps extends useRender.ComponentProps<\"div\"> {\n /**\n * Render the view switcher in the composed layout. Turn off when the\n * calendar ships with a fixed view (e.g. a month-only embed) and users\n * should not be able to change it.\n * @default true\n */\n showViewSwitcher?: boolean;\n}\n\n/**\n * Default composed nav: Today, prev/next, title, spacer, view switcher.\n * Pass children to use it as a pure layout shell instead.\n */\nfunction EventCalendarNav({\n className,\n render,\n children,\n showViewSwitcher = true,\n ...props\n}: EventCalendarNavProps) {\n const viewConfig = useEventCalendarViewConfig();\n const tooltips = useNavTooltipConfig();\n const defaultProps = {\n \"data-slot\": \"event-calendar-nav\",\n className: cn(\n \"flex min-w-0 flex-wrap items-center gap-1 px-2 py-2\",\n viewConfig.stickyNav && \"sticky top-0 z-30 bg-background\",\n viewConfig.classNames?.nav,\n className,\n ),\n children: children ?? (\n // Shared provider: first tooltip waits, moving between buttons is instant\n <TooltipProvider\n delay={tooltips.delay}\n closeDelay={tooltips.closeDelay}\n timeout={tooltips.timeout}\n >\n <EventCalendarNavToday />\n {showViewSwitcher && <EventCalendarViewSwitcher />}\n <div className=\"flex items-center\">\n <EventCalendarNavPrev />\n <EventCalendarNavNext />\n </div>\n {/* ms-3 sets the title apart from the tight control cluster so the\n period reads as its own group, not another button */}\n <EventCalendarTitle className=\"ms-3\" />\n <div className=\"grow\" />\n </TooltipProvider>\n ),\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\nexport type {\n EventCalendarNavProps,\n EventCalendarTitleProps,\n EventCalendarToolbarProps,\n EventCalendarViewSwitcherProps,\n};\nexport {\n EventCalendarDatePicker,\n EventCalendarNav,\n EventCalendarNavNext,\n EventCalendarNavPrev,\n EventCalendarNavToday,\n EventCalendarTitle,\n EventCalendarToolbar,\n EventCalendarViewSwitcher,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,SAAS,oBAKP;CACA,MAAM,aAAa,2BAA2B;CAC9C,OAAO;EACL,SAAS,WAAW;EACpB,MAAM,WAAW;EACjB,UAAU,WAAW,kBAAkB,OAAO,YAAY;EAC1D,WAAW,WAAW,YAAY;CACpC;AACF;;AAGA,SAAS,sBAOP;CACA,MAAM,aAAa,2BAA2B;CAC9C,MAAM,SAAS,WAAW,gBAAgB,QAAQ,KAAA,IAAY,WAAW;CACzE,OAAO;EACL,UAAU,W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M;EAKoB,GAAG,KAAK;CAC9C,CAAC;AACH;;;;;AAgBA,SAAS,iBAAiB,EACxB,WACA,QACA,UACA,mBAAmB,MACnB,GAAG,SACqB;CACxB,MAAM,aAAa,2BAA2B;CAC9C,MAAM,WAAW,oBAAoB;CA6BrC,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO,WAAkB;GA9BzB,aAAa;GACb,WAAW,GACT,uDACA,WAAW,aAAa,mCACxB,WAAW,YAAY,KACvB,SACF;GACA,UAAU,YAER,qBAAC,iBAAD;IACE,OAAO,SAAS;IAChB,YAAY,SAAS;IACrB,SAAS,SAAS;IAHpB,UAAA;KAKE,oBAAC,uBAAD,CAAwB,CAAA;KACvB,oBAAoB,oBAAC,2BAAD,CAA4B,CAAA;KACjD,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,oBAAC,sBAAD,CAAuB,CAAA,GACvB,oBAAC,sBAAD,CAAuB,CAAA,CACpB;;KAGL,oBAAC,oBAAD,EAAoB,WAAU,OAAQ,CAAA;KACtC,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;IACR;;EAMiB,GAAG,KAAK;CAC9C,CAAC;AACH"}
@@ -16,8 +16,9 @@ declare function formatRRuleString(rule: EventCalendarRecurrenceRule): string;
16
16
  /**
17
17
  * Expands one event into its occurrences intersecting the range.
18
18
  * Non-recurring events yield at most one occurrence. Recurrence iteration is
19
- * wall-time based in the display zone (DST-safe day/week/month steps), and
20
- * wall-time duration is preserved across DST transitions.
19
+ * wall-time based in the display zone (DST-safe day/week/month steps), and a
20
+ * span that is a whole number of local days keeps that day count across a DST
21
+ * transition (timed spans keep their absolute length instead).
21
22
  *
22
23
  * exDates remove exactly-matching instants (after COUNT numbering,
23
24
  * Google-style: an exception still consumes its COUNT slot); rDates add extra
@@ -1 +1 @@
1
- {"version":3,"file":"event-calendar-recurrence.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-recurrence.tsx"],"mappings":";;;cAcM;cAeA,qCAAqC;EAC7B,YAAA;;;;;;;iBAaL,iBAAiB,eAAe,oBAAoB;;iBA6EpD,kBAAkB,MAAM;;;;;;;;;;;;iBA0CxB,iBAAiB,OACxB,OAAO,cAAc,QACrB,OAAO,wBACP;EAAO;IACN,wBAAwB"}
1
+ {"version":3,"file":"event-calendar-recurrence.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-recurrence.tsx"],"mappings":";;;cAcM;cAeA,qCAAqC;EAC7B,YAAA;;;;;;;iBAaL,iBAAiB,eAAe,oBAAoB;;iBA2FpD,kBAAkB,MAAM;;;;;;;;;;;;;iBA2CxB,iBAAiB,OACxB,OAAO,cAAc,QACrB,OAAO,wBACP;EAAO;IACN,wBAAwB"}