@kumix/ui 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -23
- package/dist/components/agents/agent-activity/activity-row.d.ts +8 -0
- package/dist/components/agents/agent-activity/activity-row.d.ts.map +1 -0
- package/dist/components/agents/agent-activity/activity-row.js +228 -0
- package/dist/components/agents/agent-activity/activity-row.js.map +1 -0
- package/dist/components/agents/agent-activity/index.d.ts +6 -0
- package/dist/components/agents/agent-activity/index.d.ts.map +1 -0
- package/dist/components/agents/agent-activity/index.js +182 -0
- package/dist/components/agents/agent-activity/index.js.map +1 -0
- package/dist/components/agents/agent-code.d.ts +25 -0
- package/dist/components/agents/agent-code.d.ts.map +1 -0
- package/dist/components/agents/agent-code.js +117 -0
- package/dist/components/agents/agent-code.js.map +1 -0
- package/dist/components/agents/agent-disclosure.d.ts +12 -0
- package/dist/components/agents/agent-disclosure.d.ts.map +1 -0
- package/dist/components/agents/agent-disclosure.js +36 -0
- package/dist/components/agents/agent-disclosure.js.map +1 -0
- package/dist/components/agents/ai-sidebar.d.ts +41 -0
- package/dist/components/agents/ai-sidebar.d.ts.map +1 -0
- package/dist/components/agents/ai-sidebar.js +576 -0
- package/dist/components/agents/ai-sidebar.js.map +1 -0
- package/dist/components/agents/approval-card/index.d.ts +51 -0
- package/dist/components/agents/approval-card/index.d.ts.map +1 -0
- package/dist/components/agents/approval-card/index.js +317 -0
- package/dist/components/agents/approval-card/index.js.map +1 -0
- package/dist/components/agents/chat-app.d.ts +10 -0
- package/dist/components/agents/chat-app.d.ts.map +1 -0
- package/dist/components/agents/chat-app.js +20 -0
- package/dist/components/agents/chat-app.js.map +1 -0
- package/dist/components/agents/citations.d.ts +45 -0
- package/dist/components/agents/citations.d.ts.map +1 -0
- package/dist/components/agents/citations.js +175 -0
- package/dist/components/agents/citations.js.map +1 -0
- package/dist/components/agents/code-block.d.ts +21 -0
- package/dist/components/agents/code-block.d.ts.map +1 -0
- package/dist/components/agents/code-block.js +113 -0
- package/dist/components/agents/code-block.js.map +1 -0
- package/dist/components/agents/file-diff.d.ts +30 -0
- package/dist/components/agents/file-diff.d.ts.map +1 -0
- package/dist/components/agents/file-diff.js +186 -0
- package/dist/components/agents/file-diff.js.map +1 -0
- package/dist/components/agents/image-generation.d.ts +27 -0
- package/dist/components/agents/image-generation.d.ts.map +1 -0
- package/dist/components/agents/image-generation.js +308 -0
- package/dist/components/agents/image-generation.js.map +1 -0
- package/dist/components/agents/loading-states/agent-progress.d.ts +16 -0
- package/dist/components/agents/loading-states/agent-progress.d.ts.map +1 -0
- package/dist/components/agents/loading-states/agent-progress.js +117 -0
- package/dist/components/agents/loading-states/agent-progress.js.map +1 -0
- package/dist/components/agents/loading-states/reasoning-text.d.ts +20 -0
- package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -0
- package/dist/components/agents/loading-states/reasoning-text.js +184 -0
- package/dist/components/agents/loading-states/reasoning-text.js.map +1 -0
- package/dist/components/agents/loading-states/thinking-shimmer.d.ts +13 -0
- package/dist/components/agents/loading-states/thinking-shimmer.d.ts.map +1 -0
- package/dist/components/agents/loading-states/thinking-shimmer.js +17 -0
- package/dist/components/agents/loading-states/thinking-shimmer.js.map +1 -0
- package/dist/components/agents/message-bubble.d.ts +38 -0
- package/dist/components/agents/message-bubble.d.ts.map +1 -0
- package/dist/components/agents/message-bubble.js +182 -0
- package/dist/components/agents/message-bubble.js.map +1 -0
- package/dist/components/agents/message-context.d.ts +6 -0
- package/dist/components/agents/message-context.d.ts.map +1 -0
- package/dist/components/agents/message-context.js +8 -0
- package/dist/components/agents/message-context.js.map +1 -0
- package/dist/components/agents/message-scroller.d.ts +30 -0
- package/dist/components/agents/message-scroller.d.ts.map +1 -0
- package/dist/components/agents/message-scroller.js +314 -0
- package/dist/components/agents/message-scroller.js.map +1 -0
- package/dist/components/agents/message.d.ts +37 -0
- package/dist/components/agents/message.d.ts.map +1 -0
- package/dist/components/agents/message.js +139 -0
- package/dist/components/agents/message.js.map +1 -0
- package/dist/components/agents/prompt-input.d.ts +37 -0
- package/dist/components/agents/prompt-input.d.ts.map +1 -0
- package/dist/components/agents/prompt-input.js +216 -0
- package/dist/components/agents/prompt-input.js.map +1 -0
- package/dist/components/agents/streaming-response.d.ts +35 -0
- package/dist/components/agents/streaming-response.d.ts.map +1 -0
- package/dist/components/agents/streaming-response.js +151 -0
- package/dist/components/agents/streaming-response.js.map +1 -0
- package/dist/components/agents/todo-list.d.ts +24 -0
- package/dist/components/agents/todo-list.d.ts.map +1 -0
- package/dist/components/agents/todo-list.js +334 -0
- package/dist/components/agents/todo-list.js.map +1 -0
- package/dist/components/agents/tool-approval.d.ts +33 -0
- package/dist/components/agents/tool-approval.d.ts.map +1 -0
- package/dist/components/agents/tool-approval.js +166 -0
- package/dist/components/agents/tool-approval.js.map +1 -0
- package/dist/components/agents/tool-result.d.ts +34 -0
- package/dist/components/agents/tool-result.d.ts.map +1 -0
- package/dist/components/agents/tool-result.js +220 -0
- package/dist/components/agents/tool-result.js.map +1 -0
- package/dist/components/custom/confirm-dialog.js +1 -1
- package/dist/components/motion/animated-badge.js +1 -1
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js +3 -3
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/animated-toast-stack.js +2 -2
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/attachment-upload.js +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +2 -2
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/bloom-menu.js +2 -2
- package/dist/components/motion/bloom-menu.js.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +1 -1
- package/dist/components/motion/button/base.d.ts +8 -1
- package/dist/components/motion/button/base.d.ts.map +1 -1
- package/dist/components/motion/button/base.js +14 -1
- package/dist/components/motion/button/base.js.map +1 -1
- package/dist/components/motion/button/index.d.ts +2 -2
- package/dist/components/motion/button/index.js +2 -2
- package/dist/components/motion/button/stateful.js +1 -1
- package/dist/components/motion/center-morph-modal.js +3 -3
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/chromatic-text-reveal.js +1 -1
- package/dist/components/motion/chromatic-text-reveal.js.map +1 -1
- package/dist/components/motion/command-palette.js +8 -4
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/feedback-widget.js +1 -1
- package/dist/components/motion/file-upload.js +1 -1
- package/dist/components/motion/infinite-masonry.js +1 -1
- package/dist/components/motion/morphing-tabs.d.ts +36 -0
- package/dist/components/motion/morphing-tabs.d.ts.map +1 -0
- package/dist/components/motion/morphing-tabs.js +518 -0
- package/dist/components/motion/morphing-tabs.js.map +1 -0
- package/dist/components/motion/notification-stack.js +1 -1
- package/dist/components/motion/overflow-actions.js +1 -1
- package/dist/components/motion/preview-rail.d.ts +10 -2
- package/dist/components/motion/preview-rail.d.ts.map +1 -1
- package/dist/components/motion/preview-rail.js +58 -27
- package/dist/components/motion/preview-rail.js.map +1 -1
- package/dist/components/motion/select-morph.js +1 -1
- package/dist/components/motion/select.js +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/text-shimmer.d.ts.map +1 -1
- package/dist/components/motion/text-shimmer.js +4 -3
- package/dist/components/motion/text-shimmer.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts +4 -3
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -2
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts +15 -4
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +36 -8
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts +3 -2
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +0 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +3 -4
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +12 -7
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts +71 -4
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +147 -40
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +5 -6
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +6 -5
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +9 -10
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +60 -33
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +152 -68
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +109 -20
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +87 -10
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.js +47 -44
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.js +20 -2
- package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +32 -1
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +33 -2
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +19 -4
- package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js +7 -5
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js +16 -4
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js +33 -5
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
- package/dist/components/reui/filters.js +26 -21
- package/dist/components/reui/filters.js.map +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.js +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/reui/icon-tile.d.ts +2 -2
- package/dist/components/reui/icon-tile.d.ts.map +1 -1
- package/dist/components/reui/icon-tile.js +8 -1
- package/dist/components/reui/icon-tile.js.map +1 -1
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/phone-input.js +1 -1
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/sortable.js +13 -11
- package/dist/components/reui/sortable.js.map +1 -1
- package/dist/components/reui/tree.js +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/attachment.d.ts +2 -2
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/questionnaire.d.ts +22 -0
- package/dist/components/ui/questionnaire.d.ts.map +1 -0
- package/dist/components/ui/questionnaire.js +171 -0
- package/dist/components/ui/questionnaire.js.map +1 -0
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/{copy-menu-BJ-MXnkN.js → copy-menu-Bk5GP9Gp.js} +3 -3
- package/dist/{copy-menu-BJ-MXnkN.js.map → copy-menu-Bk5GP9Gp.js.map} +1 -1
- package/dist/hooks/use-body-classes.d.ts +0 -3
- package/dist/hooks/use-body-classes.d.ts.map +1 -1
- package/dist/hooks/use-body-classes.js +0 -3
- package/dist/hooks/use-body-classes.js.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +0 -3
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.js +0 -3
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -1
- package/dist/hooks/use-file-upload.js +6 -4
- package/dist/hooks/use-file-upload.js.map +1 -1
- package/dist/hooks/use-hydrated.d.ts +0 -10
- package/dist/hooks/use-hydrated.d.ts.map +1 -1
- package/dist/hooks/use-hydrated.js +0 -10
- package/dist/hooks/use-hydrated.js.map +1 -1
- package/dist/hooks/use-intersection-observer.d.ts.map +1 -1
- package/dist/hooks/use-intersection-observer.js +0 -5
- package/dist/hooks/use-intersection-observer.js.map +1 -1
- package/dist/hooks/use-is-mac.d.ts +0 -5
- package/dist/hooks/use-is-mac.d.ts.map +1 -1
- package/dist/hooks/use-is-mac.js +0 -5
- package/dist/hooks/use-is-mac.js.map +1 -1
- package/dist/hooks/use-media-query.d.ts +0 -5
- package/dist/hooks/use-media-query.d.ts.map +1 -1
- package/dist/hooks/use-media-query.js +0 -5
- package/dist/hooks/use-media-query.js.map +1 -1
- package/dist/hooks/use-meta-color.d.ts.map +1 -1
- package/dist/hooks/use-meta-color.js +0 -3
- package/dist/hooks/use-meta-color.js.map +1 -1
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -1
- package/dist/hooks/use-mutation-observer.js +0 -5
- package/dist/hooks/use-mutation-observer.js.map +1 -1
- package/dist/hooks/use-scroll-position.d.ts.map +1 -1
- package/dist/hooks/use-scroll-position.js +0 -5
- package/dist/hooks/use-scroll-position.js.map +1 -1
- package/dist/hooks/use-slider-input.d.ts.map +1 -1
- package/dist/hooks/use-slider-input.js +0 -5
- package/dist/hooks/use-slider-input.js.map +1 -1
- package/dist/hooks/use-viewport.d.ts +0 -5
- package/dist/hooks/use-viewport.d.ts.map +1 -1
- package/dist/hooks/use-viewport.js +0 -5
- package/dist/hooks/use-viewport.js.map +1 -1
- package/dist/lib/favicon.d.ts +5 -0
- package/dist/lib/favicon.d.ts.map +1 -0
- package/dist/lib/favicon.js +12 -0
- package/dist/lib/favicon.js.map +1 -0
- package/dist/lib/text-shimmer.d.ts +8 -0
- package/dist/lib/text-shimmer.d.ts.map +1 -0
- package/dist/lib/text-shimmer.js +10 -0
- package/dist/lib/text-shimmer.js.map +1 -0
- package/dist/types-j36vVGtZ.d.ts +78 -0
- package/dist/types-j36vVGtZ.d.ts.map +1 -0
- package/package.json +87 -17
- package/dist/components/ui/sonner.d.ts +0 -7
- package/dist/components/ui/sonner.d.ts.map +0 -1
- package/dist/components/ui/sonner.js +0 -32
- package/dist/components/ui/sonner.js.map +0 -1
|
@@ -4,11 +4,11 @@ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
|
4
4
|
import { getDayKey, getRangeKey, resolveOffDay, toZoned, zonedStartOfDay } from "./event-calendar-lib.js";
|
|
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
|
-
import { EVENT_CALENDAR_GHOST, EventCalendarEvent } from "./event-calendar-event.js";
|
|
7
|
+
import { EVENT_CALENDAR_GHOST, EVENT_CALENDAR_SLOT_DRAFT, EventCalendarEvent } from "./event-calendar-event.js";
|
|
8
8
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { cn } from "@kumix/utils";
|
|
10
|
-
import { PlusIcon } from "lucide-react";
|
|
11
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { PlusIcon } from "lucide-react";
|
|
12
12
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
13
13
|
import { useRender } from "@base-ui/react/use-render";
|
|
14
14
|
import { addDays, format, getWeek } from "date-fns";
|
|
@@ -322,6 +322,14 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
|
|
|
322
322
|
isEnd: draft.end <= dayEnd
|
|
323
323
|
};
|
|
324
324
|
}, { isEqual: (a, b) => a === b || a !== null && b !== null && a.isStart === b.isStart && a.isEnd === b.isEnd });
|
|
325
|
+
const draftRange = useEventCalendarSelector((state) => {
|
|
326
|
+
const draft = state.slotDraft;
|
|
327
|
+
if (!draft?.allDay) return null;
|
|
328
|
+
return {
|
|
329
|
+
start: draft.start,
|
|
330
|
+
end: draft.end
|
|
331
|
+
};
|
|
332
|
+
}, { isEqual: (a, b) => a === b || a !== null && b !== null && a.start.getTime() === b.start.getTime() && a.end.getTime() === b.end.getTime() });
|
|
325
333
|
const inlineDrop = useEventCalendarSelector((state) => {
|
|
326
334
|
const drag = state.drag;
|
|
327
335
|
if (drag?.kind !== "move" || drag.proposedAllDay) return null;
|
|
@@ -454,7 +462,7 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
|
|
|
454
462
|
"data-off": isOff || void 0,
|
|
455
463
|
"data-draft": inDraft ? "" : void 0,
|
|
456
464
|
"aria-label": format(toZoned(day, settings.timeZone), settings.i18n.formats.monthCellAriaLabel, { locale: settings.locale }),
|
|
457
|
-
className: cn("group/ec-cell relative flex min-h-0 min-w-0 flex-col overflow-hidden", !isLast && "border-e", isOutside && !settings.showOutsideDays && "invisible", isOff && offClassName, isToday && cn("relative border-b-2 border-b-primary/40 bg-primary/3", viewConfig.todayClassName), viewConfig.dayClassName?.(day), inDraft &&
|
|
465
|
+
className: cn("group/ec-cell relative flex min-h-0 min-w-0 flex-col overflow-hidden", !isLast && "border-e", isOutside && !settings.showOutsideDays && "invisible", isOff && offClassName, isToday && cn("relative border-b-2 border-b-primary/40 bg-primary/3", viewConfig.todayClassName), viewConfig.dayClassName?.(day), inDraft && EVENT_CALENDAR_SLOT_DRAFT.surface, viewConfig.classNames?.monthCell),
|
|
458
466
|
onPointerDown: (e) => {
|
|
459
467
|
const target = e.target;
|
|
460
468
|
if (target.closest("[data-slot=event-calendar-event]")) return;
|
|
@@ -472,7 +480,14 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
|
|
|
472
480
|
children: [inDraft && /* @__PURE__ */ jsx("span", {
|
|
473
481
|
"aria-hidden": true,
|
|
474
482
|
"data-slot": "event-calendar-slot-draft",
|
|
475
|
-
className: cn("pointer-events-none absolute inset-0 z-10
|
|
483
|
+
className: cn("pointer-events-none absolute inset-0 z-10", EVENT_CALENDAR_SLOT_DRAFT.segment, inDraft.isStart && EVENT_CALENDAR_SLOT_DRAFT.segmentStart, inDraft.isEnd && EVENT_CALENDAR_SLOT_DRAFT.segmentEnd, viewConfig.classNames?.slotDraft),
|
|
484
|
+
children: inDraft.isStart && draftRange && /* @__PURE__ */ jsx("span", {
|
|
485
|
+
className: cn("absolute inset-x-1 bottom-1", EVENT_CALENDAR_SLOT_DRAFT.label),
|
|
486
|
+
children: settings.i18n.functions.formatDayRange({
|
|
487
|
+
start: toZoned(draftRange.start, settings.timeZone),
|
|
488
|
+
end: toZoned(draftRange.end, settings.timeZone)
|
|
489
|
+
}, { locale: settings.locale })
|
|
490
|
+
})
|
|
476
491
|
}), content]
|
|
477
492
|
});
|
|
478
493
|
}
|
|
@@ -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 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,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;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 {\n EVENT_CALENDAR_GHOST,\n EVENT_CALENDAR_SLOT_DRAFT,\n EventCalendarEvent,\n} 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\n // Month drag-create selects whole DAYS, so the readout is a date range rather\n // than a time range. Held separately from `inDraft` above, which only knows\n // whether this cell is an edge of the selection, not what the selection is.\n const draftRange = useEventCalendarSelector<unknown, { start: Date; end: Date } | null>(\n (state) => {\n const draft = state.slotDraft;\n if (!draft?.allDay) return null;\n return { start: draft.start, end: draft.end };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null &&\n b !== null &&\n a.start.getTime() === b.start.getTime() &&\n a.end.getTime() === b.end.getTime()),\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 && EVENT_CALENDAR_SLOT_DRAFT.surface,\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\",\n EVENT_CALENDAR_SLOT_DRAFT.segment,\n inDraft.isStart && EVENT_CALENDAR_SLOT_DRAFT.segmentStart,\n inDraft.isEnd && EVENT_CALENDAR_SLOT_DRAFT.segmentEnd,\n viewConfig.classNames?.slotDraft,\n )}\n >\n {/* Date-range readout, the month-view counterpart of the time-grid\n one. Rendered only on the FIRST cell of the selection, otherwise\n a three-day drag would repeat the same label three times. Pinned\n to the bottom because the day number owns the top of the cell,\n and given its own surface so it stays legible over event chips. */}\n {inDraft.isStart && draftRange && (\n <span className={cn(\"absolute inset-x-1 bottom-1\", EVENT_CALENDAR_SLOT_DRAFT.label)}>\n {settings.i18n.functions.formatDayRange(\n {\n start: toZoned(draftRange.start, settings.timeZone),\n end: toZoned(draftRange.end, settings.timeZone),\n },\n { locale: settings.locale },\n )}\n </span>\n )}\n </span>\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":";;;;;;;;;;;;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5D,cACE,WAAW,oBACP,OAAO,QAAQ,KAAK,SAAS,QAAQ,GAAG,SAAS,KAAK,QAAQ,eAAe,EAC3E,QAAQ,SAAS,OACnB,CAAC,IACD,KAAA;GAKN,WAAW,GAAG,4BAA4B,WAAW,YAAY,WAAW;GAC5E,UAAU,MAAwB,EAAE,gBAAgB;GAEnD,UAAA,WAAW,oBACV,WAAW,kBAAkB;IAC3B;IACA;IACA,aAAa,QAAQ,KAAK;GAC5B,CAAC,IAED,oBAAC,iCAAD;IAAsC;IAAe;IAAoB;GAAW,CAAA;EAExE,CAAA,CACT;;AAEb;;AAGA,SAAS,gCAAgC,EACvC,KACA,UACA,YAMC;CACD,MAAM,WAAW,yBAAyB;CAC1C,MAAM,aAAa,2BAA2B;CAC9C,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,OAAD;EACE,IAAI;EACJ,WAAW,GACT,uDACA,WAAW,YAAY,iBACzB;EAEC,UAAA,OAAO,QAAQ,KAAK,SAAS,QAAQ,GAAG,SAAS,KAAK,QAAQ,eAAe,EAC5E,QAAQ,SAAS,OACnB,CAAC;CACE,CAAA,GAMJ,WAAW,eAAe,WACzB,oBAAC,OAAD;EACE,yBAAsB;EACtB,WAAU;EAEV,UAAA,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,SAAS,KAAK,YACb,oBAAC,oBAAD;IAEW;IACT,WAAU;GACX,GAHM,QAAQ,WAAW,GAGzB,CACF;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"}
|
|
@@ -8,8 +8,8 @@ import { toZoned } from "./event-calendar-lib.js";
|
|
|
8
8
|
import { useEventCalendarNavigation, useEventCalendarSettings, useEventCalendarView, useEventCalendarViewConfig } from "./event-calendar.js";
|
|
9
9
|
import { useState } from "react";
|
|
10
10
|
import { cn } from "@kumix/utils";
|
|
11
|
-
import { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
12
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
13
13
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
14
14
|
import { useRender } from "@base-ui/react/use-render";
|
|
15
15
|
import { addDays, format } from "date-fns";
|
|
@@ -256,11 +256,13 @@ function expandRecurrence(event, range, ctx) {
|
|
|
256
256
|
let startPeriod = aheadMs > 0 ? Math.max(0, Math.floor(aheadMs / stepMs) - 2) : 0;
|
|
257
257
|
while (periodEdge(startPeriod, "last").getTime() + durationMs <= range.start.getTime()) startPeriod++;
|
|
258
258
|
let index = 0;
|
|
259
|
-
if (startPeriod > 0)
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
259
|
+
if (startPeriod > 0) {
|
|
260
|
+
if (hasMonthDayParts || hasLimits) for (let period = 0; period < startPeriod; period++) index += candidatesFor(period).length;
|
|
261
|
+
else if (weeklyDays) {
|
|
262
|
+
const anchorOffset = fromWeekStart(zonedStart.getDay());
|
|
263
|
+
index = weeklyDays.filter((d) => fromWeekStart(d) >= anchorOffset).length + (startPeriod - 1) * weeklyDays.length;
|
|
264
|
+
} else index = startPeriod;
|
|
265
|
+
}
|
|
264
266
|
const occurrences = [];
|
|
265
267
|
const pushIfVisible = (rawStart) => {
|
|
266
268
|
const start = new Date(rawStart.getTime());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-calendar-recurrence.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-recurrence.tsx"],"sourcesContent":["\"use client\";\n\nimport { TZDate } from \"@date-fns/tz\";\nimport { addDays, addMonths, addWeeks, addYears } from \"date-fns\";\n\nimport type {\n CalendarEvent,\n EventCalendarDateRange,\n EventCalendarOccurrence,\n EventCalendarRecurrenceRule,\n EventCalendarWeekday,\n} from \"./event-calendar-types\";\n\n/** Guard: max window-intersecting occurrences per event per expansion. */\nconst MAX_OCCURRENCES = 1000;\n\n/** Runaway guard: absolute cap on period iterations regardless of visibility. */\nconst MAX_ITERATIONS = 10000;\n\n/** Gregorian mean period lengths for the O(1) fast-forward approximation. */\nconst PERIOD_MS: Record<EventCalendarRecurrenceRule[\"freq\"], number> = {\n daily: 86400000,\n weekly: 604800000,\n monthly: 2629746000, // 365.2425 / 12 days\n yearly: 31556952000, // 365.2425 days\n};\n\nconst WEEKDAYS: EventCalendarWeekday[] = [\"SU\", \"MO\", \"TU\", \"WE\", \"TH\", \"FR\", \"SA\"];\n\nclass EventCalendarRecurrenceError extends Error {\n constructor(part: string) {\n super(\n `Unsupported recurrence part: ${part}. Use the getOccurrences prop to plug a full RRULE engine for exotic rules.`,\n );\n this.name = \"EventCalendarRecurrenceError\";\n }\n}\n\n/**\n * Parses a raw RRULE line (with or without the \"RRULE:\" prefix) into the\n * structured subset. Pass the display time zone so Z-less UNTIL values are\n * interpreted as wall time in that zone rather than the machine zone.\n */\nfunction parseRRuleString(input: string, timeZone?: string): EventCalendarRecurrenceRule {\n const body = input.trim().replace(/^RRULE:/i, \"\");\n const rule: Partial<EventCalendarRecurrenceRule> = {};\n\n for (const pair of body.split(\";\")) {\n if (!pair) continue;\n const [rawKey, rawValue] = pair.split(\"=\");\n const key = rawKey?.toUpperCase();\n const value = rawValue ?? \"\";\n\n switch (key) {\n case \"FREQ\": {\n const freq = value.toLowerCase();\n if (freq !== \"daily\" && freq !== \"weekly\" && freq !== \"monthly\" && freq !== \"yearly\") {\n throw new EventCalendarRecurrenceError(`FREQ=${value}`);\n }\n rule.freq = freq;\n break;\n }\n case \"INTERVAL\":\n rule.interval = Math.max(1, parseInt(value, 10) || 1);\n break;\n case \"COUNT\":\n rule.count = Math.max(1, parseInt(value, 10) || 1);\n break;\n case \"UNTIL\":\n rule.until = parseRRuleDate(value, timeZone);\n break;\n case \"BYDAY\":\n rule.byWeekday = value.split(\",\").map((token) => {\n // RFC 5545 3.1: enumerated values are case-insensitive, and FREQ is\n // already folded above - rejecting \"mo\" here would be inconsistent\n const match = /^(-?\\d+)?(SU|MO|TU|WE|TH|FR|SA)$/.exec(token.trim().toUpperCase());\n if (!match) throw new EventCalendarRecurrenceError(`BYDAY=${token}`);\n const day = match[2] as EventCalendarWeekday;\n return match[1] ? { day, ordinal: parseInt(match[1], 10) } : day;\n });\n break;\n case \"BYMONTHDAY\":\n rule.byMonthDay = value.split(\",\").map((v) => {\n const day = parseInt(v, 10);\n // NaN would survive parsing, match no day in any month and leave the\n // event permanently invisible with no error anywhere\n if (Number.isNaN(day)) {\n throw new EventCalendarRecurrenceError(`BYMONTHDAY=${v}`);\n }\n return day;\n });\n break;\n case \"BYMONTH\":\n rule.byMonth = value.split(\",\").map((v) => parseInt(v, 10));\n break;\n case \"WKST\": {\n const day = value.trim().toUpperCase() as EventCalendarWeekday;\n if (!WEEKDAYS.includes(day)) {\n throw new EventCalendarRecurrenceError(`WKST=${value}`);\n }\n rule.weekStart = day;\n break;\n }\n default:\n throw new EventCalendarRecurrenceError(key ?? pair);\n }\n }\n\n if (!rule.freq) throw new EventCalendarRecurrenceError(\"missing FREQ\");\n return rule as EventCalendarRecurrenceRule;\n}\n\nfunction parseRRuleDate(value: string, timeZone?: string): Date {\n // RFC 5545 basic formats: YYYYMMDD or YYYYMMDDTHHMMSS(Z). The T and Z\n // designators are case-insensitive too (RFC 5545 3.1), so fold before matching.\n const match = /^(\\d{4})(\\d{2})(\\d{2})(?:T(\\d{2})(\\d{2})(\\d{2})(Z)?)?$/.exec(\n value.trim().toUpperCase(),\n );\n if (!match) throw new EventCalendarRecurrenceError(`UNTIL=${value}`);\n const [, y, m, d, hh = \"23\", mm = \"59\", ss = \"59\", z] = match;\n // Z-less values (including date-only ones, which mean end of that day\n // inclusive) are wall time in the display zone, not the machine zone.\n const date = z\n ? new Date(`${y}-${m}-${d}T${hh}:${mm}:${ss}Z`)\n : timeZone\n ? new Date(new TZDate(+y, +m - 1, +d, +hh, +mm, +ss, timeZone).getTime())\n : new Date(`${y}-${m}-${d}T${hh}:${mm}:${ss}`);\n if (Number.isNaN(date.getTime())) {\n throw new EventCalendarRecurrenceError(`UNTIL=${value}`);\n }\n return date;\n}\n\n/** Serializes the structured subset back to an RRULE line (without prefix). */\nfunction formatRRuleString(rule: EventCalendarRecurrenceRule): string {\n const parts: string[] = [`FREQ=${rule.freq.toUpperCase()}`];\n if (rule.interval && rule.interval > 1) parts.push(`INTERVAL=${rule.interval}`);\n if (rule.count) parts.push(`COUNT=${rule.count}`);\n if (rule.until) {\n const u = rule.until;\n const pad = (n: number) => String(n).padStart(2, \"0\");\n parts.push(\n `UNTIL=${u.getUTCFullYear()}${pad(u.getUTCMonth() + 1)}${pad(u.getUTCDate())}T${pad(u.getUTCHours())}${pad(u.getUTCMinutes())}${pad(u.getUTCSeconds())}Z`,\n );\n }\n if (rule.byWeekday?.length) {\n parts.push(\n `BYDAY=${rule.byWeekday\n .map((d) => (typeof d === \"string\" ? d : `${d.ordinal}${d.day}`))\n .join(\",\")}`,\n );\n }\n if (rule.byMonthDay?.length) parts.push(`BYMONTHDAY=${rule.byMonthDay.join(\",\")}`);\n if (rule.byMonth?.length) parts.push(`BYMONTH=${rule.byMonth.join(\",\")}`);\n if (rule.weekStart) parts.push(`WKST=${rule.weekStart}`);\n return parts.join(\";\");\n}\n\nfunction resolveRule(\n recurrence: EventCalendarRecurrenceRule | string,\n timeZone?: string,\n): EventCalendarRecurrenceRule {\n return typeof recurrence === \"string\" ? parseRRuleString(recurrence, timeZone) : recurrence;\n}\n\n/**\n * Expands one event into its occurrences intersecting the range.\n * Non-recurring events yield at most one occurrence. Recurrence iteration is\n * wall-time based in the display zone (DST-safe day/week/month steps), and a\n * span that is a whole number of local days keeps that day count across a DST\n * transition (timed spans keep their absolute length instead).\n *\n * exDates remove exactly-matching instants (after COUNT numbering,\n * Google-style: an exception still consumes its COUNT slot); rDates add extra\n * instants with the same duration. RECURRENCE-ID override replacement lives\n * in buildEventIndex, where the override event and its parent series meet.\n */\nfunction expandRecurrence<TData>(\n event: CalendarEvent<TData>,\n range: EventCalendarDateRange,\n ctx: { timeZone: string },\n): EventCalendarOccurrence<TData>[] {\n const allDay = event.allDay ?? false;\n\n if (!event.recurrence) {\n // The exclusive `end > start` test is right for anything with duration,\n // but it also drops a zero-length milestone pinned to the first visible\n // instant - which reads as an event that randomly disappears until you\n // page one period back. A point occurrence only has to be inside.\n const isPoint = event.end.getTime() === event.start.getTime();\n if (\n event.start < range.end &&\n (event.end > range.start || (isPoint && event.start >= range.start))\n ) {\n return [\n {\n key: `${event.id}::${event.start.toISOString()}`,\n eventId: event.id,\n event,\n start: event.start,\n end: event.end,\n allDay,\n isRecurring: false,\n },\n ];\n }\n return [];\n }\n\n const rule = resolveRule(event.recurrence, ctx.timeZone);\n const interval = Math.max(1, rule.interval ?? 1);\n const durationMs = event.end.getTime() - event.start.getTime();\n const zonedStart = new TZDate(event.start.getTime(), ctx.timeZone);\n // A span of whole local days is wall time, not an absolute delta: a 3 day\n // all-day bar crossing spring forward would otherwise end at 01:00 and\n // occupy a fourth day in the month grid. Timed spans stay absolute so a two\n // hour meeting is still two hours.\n const daySpan = Math.round(durationMs / 86400000);\n const wallDaySpan =\n daySpan > 0 && addDays(zonedStart, daySpan).getTime() === event.end.getTime() ? daySpan : null;\n const endFor = (start: Date): Date =>\n wallDaySpan === null\n ? new Date(start.getTime() + durationMs)\n : new Date(addDays(new TZDate(start.getTime(), ctx.timeZone), wallDaySpan).getTime());\n // Excluded instants matched exactly; filtering happens at push time so an\n // exception still consumes its COUNT slot (Google-style numbering).\n const exTimes = new Set((rule.exDates ?? []).map((d) => d.getTime()));\n\n const weeklyDays: number[] | null =\n rule.freq === \"weekly\" && rule.byWeekday?.length\n ? [\n ...new Set(\n rule.byWeekday.map((d) => {\n if (typeof d !== \"string\") {\n throw new EventCalendarRecurrenceError(\"BYDAY ordinal outside monthly/yearly\");\n }\n return WEEKDAYS.indexOf(d);\n }),\n ),\n ]\n : null;\n\n // BYDAY resolved inside a month: monthly, and yearly within each BYMONTH\n // (FREQ=YEARLY;BYMONTH=11;BYDAY=4TH is Thanksgiving, not \"the anchor's day\")\n const monthlyByDay =\n (rule.freq === \"monthly\" || rule.freq === \"yearly\") && rule.byWeekday?.length\n ? rule.byWeekday\n : null;\n\n // RFC 5545 3.3.10 week numbering: with INTERVAL > 1 the week start decides\n // which selected days share a period, so an ignored WKST puts half of every\n // biweekly series a week off. Default MO, per the RFC.\n const weekStartIndex = WEEKDAYS.indexOf(rule.weekStart ?? \"MO\");\n /** Days from the WKST-aligned week start to `day` (0-6). */\n const fromWeekStart = (day: number) => (day - weekStartIndex + 7) % 7;\n\n // yearly BYMONTH filter (1-12), ascending; defaults to the anchor's month\n const validByMonth = rule.byMonth?.filter((m) => m >= 1 && m <= 12) ?? [];\n const yearlyMonths: number[] =\n validByMonth.length > 0\n ? [...new Set(validByMonth)].sort((a, b) => a - b)\n : [zonedStart.getMonth() + 1];\n\n // month-shaped BY* parts make the per-period occurrence count variable\n const hasMonthDayParts =\n (rule.freq === \"monthly\" && Boolean(rule.byMonthDay?.length || monthlyByDay)) ||\n (rule.freq === \"yearly\" &&\n Boolean(rule.byMonth?.length || rule.byMonthDay?.length || monthlyByDay));\n\n const daysInMonth = (year: number, month: number) => new Date(year, month + 1, 0).getDate();\n\n // RFC 5545 3.3.10 LIMIT filters: at these frequencies a BY* part narrows the\n // set instead of reshaping it. Dropping them silently expanded the series as\n // if the part were absent (FREQ=DAILY;BYDAY=MO filled every day). Filtering\n // here rather than at push time keeps COUNT numbering RFC-correct: a\n // candidate the filter removes is not an occurrence and consumes no slot.\n const limitByMonth = rule.freq !== \"yearly\" && validByMonth.length > 0 ? validByMonth : null;\n const limitByMonthDay = rule.freq === \"daily\" && rule.byMonthDay?.length ? rule.byMonthDay : null;\n const limitByWeekday =\n rule.freq === \"daily\" && rule.byWeekday?.length\n ? rule.byWeekday.map((d) => WEEKDAYS.indexOf(typeof d === \"string\" ? d : d.day))\n : null;\n const hasLimits = Boolean(limitByMonth || limitByMonthDay || limitByWeekday);\n\n const passesLimits = (candidate: TZDate): boolean => {\n if (limitByMonth && !limitByMonth.includes(candidate.getMonth() + 1)) {\n return false;\n }\n if (limitByWeekday && !limitByWeekday.includes(candidate.getDay())) {\n return false;\n }\n if (limitByMonthDay) {\n const total = daysInMonth(candidate.getFullYear(), candidate.getMonth());\n const day = candidate.getDate();\n // negative BYMONTHDAY counts back from month end, as in monthDays\n if (!limitByMonthDay.some((n) => (n < 0 ? total + 1 + n : n) === day)) {\n return false;\n }\n }\n return true;\n };\n\n /** Wall-clock instant in the display zone carrying DTSTART's time-of-day. */\n const zonedDate = (year: number, month: number, day: number) =>\n new TZDate(\n year,\n month,\n day,\n zonedStart.getHours(),\n zonedStart.getMinutes(),\n zonedStart.getSeconds(),\n zonedStart.getMilliseconds(),\n ctx.timeZone,\n );\n\n /** Selected days-of-month, ascending: BYMONTHDAY (and) BYDAY, else the clamped anchor day. */\n const monthDays = (year: number, month: number): number[] => {\n const total = daysInMonth(year, month);\n let days: number[] | null = null;\n if (rule.byMonthDay?.length) {\n // negative BYMONTHDAY counts back from month end; nonexistent days skip\n days = rule.byMonthDay\n .map((n) => (n < 0 ? total + 1 + n : n))\n .filter((n) => n >= 1 && n <= total);\n }\n if (monthlyByDay) {\n const byDayMatches: number[] = [];\n for (const entry of monthlyByDay) {\n const day = typeof entry === \"string\" ? entry : entry.day;\n const ordinal = typeof entry === \"string\" ? 0 : entry.ordinal;\n const weekday = WEEKDAYS.indexOf(day);\n const matches: number[] = [];\n for (let d = 1; d <= total; d++) {\n if (new Date(year, month, d).getDay() === weekday) matches.push(d);\n }\n if (ordinal === 0) {\n byDayMatches.push(...matches); // plain BYDAY: every matching weekday\n } else {\n // 2TU = 2nd Tuesday, -1FR = last Friday; absent ordinals skip\n const pick = ordinal > 0 ? matches[ordinal - 1] : matches[matches.length + ordinal];\n if (pick !== undefined) byDayMatches.push(pick);\n }\n }\n days = days ? days.filter((n) => byDayMatches.includes(n)) : byDayMatches;\n }\n if (!days) days = [Math.min(zonedStart.getDate(), total)]; // clamp to month end\n return [...new Set(days)].sort((a, b) => a - b);\n };\n\n /** Chronological candidates of one period, derived from the DTSTART anchor by index (no drift). */\n const periodCandidates = (period: number): TZDate[] => {\n if (rule.freq === \"daily\") return [addDays(zonedStart, period * interval)];\n if (rule.freq === \"weekly\") {\n const base = addWeeks(zonedStart, period * interval);\n if (!weeklyDays) return [base];\n const week: TZDate[] = [];\n // walk the WKST-aligned week so candidates stay chronological\n const baseOffset = fromWeekStart(base.getDay());\n for (let offset = 0; offset < 7; offset++) {\n const candidate = addDays(base, offset - baseOffset);\n if (!weeklyDays.includes(candidate.getDay())) continue;\n // days of the DTSTART week before DTSTART are not part of the series\n if (candidate.getTime() < zonedStart.getTime()) continue;\n week.push(candidate);\n }\n return week;\n }\n if (rule.freq === \"monthly\") {\n const anchor = addMonths(zonedStart, period * interval);\n const year = anchor.getFullYear();\n const month = anchor.getMonth();\n return monthDays(year, month)\n .map((day) => zonedDate(year, month, day))\n .filter((c) => c.getTime() >= zonedStart.getTime());\n }\n // yearly\n const year = addYears(zonedStart, period * interval).getFullYear();\n const dates: TZDate[] = [];\n for (const month of yearlyMonths) {\n for (const day of monthDays(year, month - 1)) {\n dates.push(zonedDate(year, month - 1, day));\n }\n }\n return dates.filter((c) => c.getTime() >= zonedStart.getTime());\n };\n\n /** Candidates of one period with the LIMIT filters applied. */\n const candidatesFor = (period: number): TZDate[] =>\n hasLimits ? periodCandidates(period).filter(passesLimits) : periodCandidates(period);\n\n /** Earliest/latest instant a period can produce - loop bounds without expanding it. */\n const periodEdge = (period: number, edge: \"first\" | \"last\"): TZDate => {\n if (rule.freq === \"daily\") return addDays(zonedStart, period * interval);\n if (rule.freq === \"weekly\") {\n const base = addWeeks(zonedStart, period * interval);\n if (!weeklyDays) return base;\n return addDays(base, (edge === \"first\" ? 0 : 6) - fromWeekStart(base.getDay()));\n }\n if (rule.freq === \"monthly\") {\n const anchor = addMonths(zonedStart, period * interval);\n const year = anchor.getFullYear();\n const month = anchor.getMonth();\n return zonedDate(year, month, edge === \"first\" ? 1 : daysInMonth(year, month));\n }\n const year = addYears(zonedStart, period * interval).getFullYear();\n const month = (edge === \"first\" ? yearlyMonths[0] : yearlyMonths[yearlyMonths.length - 1]) - 1;\n return zonedDate(year, month, edge === \"first\" ? 1 : daysInMonth(year, month));\n };\n\n // O(1) fast-forward: land a couple of periods before the window instead of\n // iterating from DTSTART, so years-old series still reach the visible range.\n const aheadMs = range.start.getTime() - durationMs - zonedStart.getTime();\n const stepMs = PERIOD_MS[rule.freq] * interval;\n let startPeriod = aheadMs > 0 ? Math.max(0, Math.floor(aheadMs / stepMs) - 2) : 0;\n // mean-length drift is bounded well under one period - refine forward\n while (periodEdge(startPeriod, \"last\").getTime() + durationMs <= range.start.getTime()) {\n startPeriod++;\n }\n\n // series ordinal at startPeriod, so COUNT and recurrenceIndex stay exact\n let index = 0;\n if (startPeriod > 0) {\n if (hasMonthDayParts || hasLimits) {\n // per-period counts vary (skipped days, 4-vs-5 weekday months, a LIMIT\n // filter that empties a whole period) - sum them\n for (let period = 0; period < startPeriod; period++) {\n index += candidatesFor(period).length;\n }\n } else if (weeklyDays) {\n // week 0 only counts selected weekdays at/after DTSTART's, inside the\n // WKST-aligned week that holds it\n const anchorOffset = fromWeekStart(zonedStart.getDay());\n const firstWeek = weeklyDays.filter((d) => fromWeekStart(d) >= anchorOffset).length;\n index = firstWeek + (startPeriod - 1) * weeklyDays.length;\n } else {\n index = startPeriod; // one occurrence per period\n }\n }\n\n const occurrences: EventCalendarOccurrence<TData>[] = [];\n\n const pushIfVisible = (rawStart: Date) => {\n // normalize to a plain instant so consumers never receive zone-carrying\n // TZDate instances (mixed-zone formatting bugs)\n const start = new Date(rawStart.getTime());\n if (exTimes.has(start.getTime())) return;\n const end = endFor(start);\n if (start < range.end && end > range.start) {\n occurrences.push({\n key: `${event.id}::${start.toISOString()}`,\n eventId: event.id,\n event,\n start,\n end,\n allDay,\n isRecurring: true,\n recurrenceIndex: index,\n });\n }\n };\n\n let iterations = 0;\n let period = startPeriod;\n while (iterations < MAX_ITERATIONS && occurrences.length < MAX_OCCURRENCES) {\n iterations++;\n if (rule.count !== undefined && index >= rule.count) break;\n // whole-period bounds: never break on a mid-period weekday/day-of-month,\n // so earlier candidates of the final period are still emitted\n const earliest = periodEdge(period, \"first\");\n if (earliest.getTime() >= range.end.getTime()) break;\n if (rule.until && earliest.getTime() > rule.until.getTime()) break;\n\n let ended = false;\n for (const candidate of candidatesFor(period)) {\n if (rule.count !== undefined && index >= rule.count) {\n ended = true;\n break;\n }\n if (rule.until && candidate.getTime() > rule.until.getTime()) {\n ended = true;\n break;\n }\n pushIfVisible(candidate);\n index++;\n if (occurrences.length >= MAX_OCCURRENCES) {\n ended = true;\n break;\n }\n }\n if (ended) break;\n period++;\n }\n\n // RDATE: extra instants join the set (deduped against generated starts and\n // exclusions) with the same wall-time duration. Sorted so direct consumers\n // still receive chronological order (buildEventIndex re-sorts regardless).\n if (rule.rDates?.length) {\n const seen = new Set(occurrences.map((o) => o.start.getTime()));\n for (const rDate of rule.rDates) {\n const start = new Date(rDate.getTime());\n if (seen.has(start.getTime()) || exTimes.has(start.getTime())) continue;\n const end = endFor(start);\n if (start >= range.end || end <= range.start) continue;\n seen.add(start.getTime());\n occurrences.push({\n key: `${event.id}::${start.toISOString()}`,\n eventId: event.id,\n event,\n start,\n end,\n allDay,\n isRecurring: true,\n // keep counting past the generated instants: an RDATE with no index\n // would fall back to undefined and break any consumer that identifies\n // an instance by its position in the series\n recurrenceIndex: index++,\n });\n }\n occurrences.sort((a, b) => a.start.getTime() - b.start.getTime());\n }\n\n return occurrences;\n}\n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;GACvB;GACA,IAAI,YAAY,UAAA,KAA2B;IACzC,QAAQ;IACR;GACF;EACF;EACA,IAAI,OAAO;EACX;CACF;CAKA,IAAI,KAAK,QAAQ,QAAQ;EACvB,MAAM,OAAO,IAAI,IAAI,YAAY,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC,CAAC;EAC9D,KAAK,MAAM,SAAS,KAAK,QAAQ;GAC/B,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,CAAC;GACtC,IAAI,KAAK,IAAI,MAAM,QAAQ,CAAC,KAAK,QAAQ,IAAI,MAAM,QAAQ,CAAC,GAAG;GAC/D,MAAM,MAAM,OAAO,KAAK;GACxB,IAAI,SAAS,MAAM,OAAO,OAAO,MAAM,OAAO;GAC9C,KAAK,IAAI,MAAM,QAAQ,CAAC;GACxB,YAAY,KAAK;IACf,KAAK,GAAG,MAAM,GAAG,IAAI,MAAM,YAAY;IACvC,SAAS,MAAM;IACf;IACA;IACA;IACA;IACA,aAAa;IAIb,iBAAiB;GACnB,CAAC;EACH;EACA,YAAY,MAAM,GAAG,MAAM,EAAE,MAAM,QAAQ,IAAI,EAAE,MAAM,QAAQ,CAAC;CAClE;CAEA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"event-calendar-recurrence.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-recurrence.tsx"],"sourcesContent":["\"use client\";\n\nimport { TZDate } from \"@date-fns/tz\";\nimport { addDays, addMonths, addWeeks, addYears } from \"date-fns\";\n\nimport type {\n CalendarEvent,\n EventCalendarDateRange,\n EventCalendarOccurrence,\n EventCalendarRecurrenceRule,\n EventCalendarWeekday,\n} from \"./event-calendar-types\";\n\n/** Guard: max window-intersecting occurrences per event per expansion. */\nconst MAX_OCCURRENCES = 1000;\n\n/** Runaway guard: absolute cap on period iterations regardless of visibility. */\nconst MAX_ITERATIONS = 10000;\n\n/** Gregorian mean period lengths for the O(1) fast-forward approximation. */\nconst PERIOD_MS: Record<EventCalendarRecurrenceRule[\"freq\"], number> = {\n daily: 86400000,\n weekly: 604800000,\n monthly: 2629746000, // 365.2425 / 12 days\n yearly: 31556952000, // 365.2425 days\n};\n\nconst WEEKDAYS: EventCalendarWeekday[] = [\"SU\", \"MO\", \"TU\", \"WE\", \"TH\", \"FR\", \"SA\"];\n\nclass EventCalendarRecurrenceError extends Error {\n constructor(part: string) {\n super(\n `Unsupported recurrence part: ${part}. Use the getOccurrences prop to plug a full RRULE engine for exotic rules.`,\n );\n this.name = \"EventCalendarRecurrenceError\";\n }\n}\n\n/**\n * Parses a raw RRULE line (with or without the \"RRULE:\" prefix) into the\n * structured subset. Pass the display time zone so Z-less UNTIL values are\n * interpreted as wall time in that zone rather than the machine zone.\n */\nfunction parseRRuleString(input: string, timeZone?: string): EventCalendarRecurrenceRule {\n const body = input.trim().replace(/^RRULE:/i, \"\");\n const rule: Partial<EventCalendarRecurrenceRule> = {};\n\n for (const pair of body.split(\";\")) {\n if (!pair) continue;\n const [rawKey, rawValue] = pair.split(\"=\");\n const key = rawKey?.toUpperCase();\n const value = rawValue ?? \"\";\n\n switch (key) {\n case \"FREQ\": {\n const freq = value.toLowerCase();\n if (freq !== \"daily\" && freq !== \"weekly\" && freq !== \"monthly\" && freq !== \"yearly\") {\n throw new EventCalendarRecurrenceError(`FREQ=${value}`);\n }\n rule.freq = freq;\n break;\n }\n case \"INTERVAL\":\n rule.interval = Math.max(1, parseInt(value, 10) || 1);\n break;\n case \"COUNT\":\n rule.count = Math.max(1, parseInt(value, 10) || 1);\n break;\n case \"UNTIL\":\n rule.until = parseRRuleDate(value, timeZone);\n break;\n case \"BYDAY\":\n rule.byWeekday = value.split(\",\").map((token) => {\n // RFC 5545 3.1: enumerated values are case-insensitive, and FREQ is\n // already folded above - rejecting \"mo\" here would be inconsistent\n const match = /^(-?\\d+)?(SU|MO|TU|WE|TH|FR|SA)$/.exec(token.trim().toUpperCase());\n if (!match) throw new EventCalendarRecurrenceError(`BYDAY=${token}`);\n const day = match[2] as EventCalendarWeekday;\n return match[1] ? { day, ordinal: parseInt(match[1], 10) } : day;\n });\n break;\n case \"BYMONTHDAY\":\n rule.byMonthDay = value.split(\",\").map((v) => {\n const day = parseInt(v, 10);\n // NaN would survive parsing, match no day in any month and leave the\n // event permanently invisible with no error anywhere\n if (Number.isNaN(day)) {\n throw new EventCalendarRecurrenceError(`BYMONTHDAY=${v}`);\n }\n return day;\n });\n break;\n case \"BYMONTH\":\n rule.byMonth = value.split(\",\").map((v) => parseInt(v, 10));\n break;\n case \"WKST\": {\n const day = value.trim().toUpperCase() as EventCalendarWeekday;\n if (!WEEKDAYS.includes(day)) {\n throw new EventCalendarRecurrenceError(`WKST=${value}`);\n }\n rule.weekStart = day;\n break;\n }\n default:\n throw new EventCalendarRecurrenceError(key ?? pair);\n }\n }\n\n if (!rule.freq) throw new EventCalendarRecurrenceError(\"missing FREQ\");\n return rule as EventCalendarRecurrenceRule;\n}\n\nfunction parseRRuleDate(value: string, timeZone?: string): Date {\n // RFC 5545 basic formats: YYYYMMDD or YYYYMMDDTHHMMSS(Z). The T and Z\n // designators are case-insensitive too (RFC 5545 3.1), so fold before matching.\n const match = /^(\\d{4})(\\d{2})(\\d{2})(?:T(\\d{2})(\\d{2})(\\d{2})(Z)?)?$/.exec(\n value.trim().toUpperCase(),\n );\n if (!match) throw new EventCalendarRecurrenceError(`UNTIL=${value}`);\n const [, y, m, d, hh = \"23\", mm = \"59\", ss = \"59\", z] = match;\n // Z-less values (including date-only ones, which mean end of that day\n // inclusive) are wall time in the display zone, not the machine zone.\n const date = z\n ? new Date(`${y}-${m}-${d}T${hh}:${mm}:${ss}Z`)\n : timeZone\n ? new Date(new TZDate(+y, +m - 1, +d, +hh, +mm, +ss, timeZone).getTime())\n : new Date(`${y}-${m}-${d}T${hh}:${mm}:${ss}`);\n if (Number.isNaN(date.getTime())) {\n throw new EventCalendarRecurrenceError(`UNTIL=${value}`);\n }\n return date;\n}\n\n/** Serializes the structured subset back to an RRULE line (without prefix). */\nfunction formatRRuleString(rule: EventCalendarRecurrenceRule): string {\n const parts: string[] = [`FREQ=${rule.freq.toUpperCase()}`];\n if (rule.interval && rule.interval > 1) parts.push(`INTERVAL=${rule.interval}`);\n if (rule.count) parts.push(`COUNT=${rule.count}`);\n if (rule.until) {\n const u = rule.until;\n const pad = (n: number) => String(n).padStart(2, \"0\");\n parts.push(\n `UNTIL=${u.getUTCFullYear()}${pad(u.getUTCMonth() + 1)}${pad(u.getUTCDate())}T${pad(u.getUTCHours())}${pad(u.getUTCMinutes())}${pad(u.getUTCSeconds())}Z`,\n );\n }\n if (rule.byWeekday?.length) {\n parts.push(\n `BYDAY=${rule.byWeekday\n .map((d) => (typeof d === \"string\" ? d : `${d.ordinal}${d.day}`))\n .join(\",\")}`,\n );\n }\n if (rule.byMonthDay?.length) parts.push(`BYMONTHDAY=${rule.byMonthDay.join(\",\")}`);\n if (rule.byMonth?.length) parts.push(`BYMONTH=${rule.byMonth.join(\",\")}`);\n if (rule.weekStart) parts.push(`WKST=${rule.weekStart}`);\n return parts.join(\";\");\n}\n\nfunction resolveRule(\n recurrence: EventCalendarRecurrenceRule | string,\n timeZone?: string,\n): EventCalendarRecurrenceRule {\n return typeof recurrence === \"string\" ? parseRRuleString(recurrence, timeZone) : recurrence;\n}\n\n/**\n * Expands one event into its occurrences intersecting the range.\n * Non-recurring events yield at most one occurrence. Recurrence iteration is\n * wall-time based in the display zone (DST-safe day/week/month steps), and a\n * span that is a whole number of local days keeps that day count across a DST\n * transition (timed spans keep their absolute length instead).\n *\n * exDates remove exactly-matching instants (after COUNT numbering,\n * Google-style: an exception still consumes its COUNT slot); rDates add extra\n * instants with the same duration. RECURRENCE-ID override replacement lives\n * in buildEventIndex, where the override event and its parent series meet.\n */\nfunction expandRecurrence<TData>(\n event: CalendarEvent<TData>,\n range: EventCalendarDateRange,\n ctx: { timeZone: string },\n): EventCalendarOccurrence<TData>[] {\n const allDay = event.allDay ?? false;\n\n if (!event.recurrence) {\n // The exclusive `end > start` test is right for anything with duration,\n // but it also drops a zero-length milestone pinned to the first visible\n // instant - which reads as an event that randomly disappears until you\n // page one period back. A point occurrence only has to be inside.\n const isPoint = event.end.getTime() === event.start.getTime();\n if (\n event.start < range.end &&\n (event.end > range.start || (isPoint && event.start >= range.start))\n ) {\n return [\n {\n key: `${event.id}::${event.start.toISOString()}`,\n eventId: event.id,\n event,\n start: event.start,\n end: event.end,\n allDay,\n isRecurring: false,\n },\n ];\n }\n return [];\n }\n\n const rule = resolveRule(event.recurrence, ctx.timeZone);\n const interval = Math.max(1, rule.interval ?? 1);\n const durationMs = event.end.getTime() - event.start.getTime();\n const zonedStart = new TZDate(event.start.getTime(), ctx.timeZone);\n // A span of whole local days is wall time, not an absolute delta: a 3 day\n // all-day bar crossing spring forward would otherwise end at 01:00 and\n // occupy a fourth day in the month grid. Timed spans stay absolute so a two\n // hour meeting is still two hours.\n const daySpan = Math.round(durationMs / 86400000);\n const wallDaySpan =\n daySpan > 0 && addDays(zonedStart, daySpan).getTime() === event.end.getTime() ? daySpan : null;\n const endFor = (start: Date): Date =>\n wallDaySpan === null\n ? new Date(start.getTime() + durationMs)\n : new Date(addDays(new TZDate(start.getTime(), ctx.timeZone), wallDaySpan).getTime());\n // Excluded instants matched exactly; filtering happens at push time so an\n // exception still consumes its COUNT slot (Google-style numbering).\n const exTimes = new Set((rule.exDates ?? []).map((d) => d.getTime()));\n\n const weeklyDays: number[] | null =\n rule.freq === \"weekly\" && rule.byWeekday?.length\n ? [\n ...new Set(\n rule.byWeekday.map((d) => {\n if (typeof d !== \"string\") {\n throw new EventCalendarRecurrenceError(\"BYDAY ordinal outside monthly/yearly\");\n }\n return WEEKDAYS.indexOf(d);\n }),\n ),\n ]\n : null;\n\n // BYDAY resolved inside a month: monthly, and yearly within each BYMONTH\n // (FREQ=YEARLY;BYMONTH=11;BYDAY=4TH is Thanksgiving, not \"the anchor's day\")\n const monthlyByDay =\n (rule.freq === \"monthly\" || rule.freq === \"yearly\") && rule.byWeekday?.length\n ? rule.byWeekday\n : null;\n\n // RFC 5545 3.3.10 week numbering: with INTERVAL > 1 the week start decides\n // which selected days share a period, so an ignored WKST puts half of every\n // biweekly series a week off. Default MO, per the RFC.\n const weekStartIndex = WEEKDAYS.indexOf(rule.weekStart ?? \"MO\");\n /** Days from the WKST-aligned week start to `day` (0-6). */\n const fromWeekStart = (day: number) => (day - weekStartIndex + 7) % 7;\n\n // yearly BYMONTH filter (1-12), ascending; defaults to the anchor's month\n const validByMonth = rule.byMonth?.filter((m) => m >= 1 && m <= 12) ?? [];\n const yearlyMonths: number[] =\n validByMonth.length > 0\n ? [...new Set(validByMonth)].sort((a, b) => a - b)\n : [zonedStart.getMonth() + 1];\n\n // month-shaped BY* parts make the per-period occurrence count variable\n const hasMonthDayParts =\n (rule.freq === \"monthly\" && Boolean(rule.byMonthDay?.length || monthlyByDay)) ||\n (rule.freq === \"yearly\" &&\n Boolean(rule.byMonth?.length || rule.byMonthDay?.length || monthlyByDay));\n\n const daysInMonth = (year: number, month: number) => new Date(year, month + 1, 0).getDate();\n\n // RFC 5545 3.3.10 LIMIT filters: at these frequencies a BY* part narrows the\n // set instead of reshaping it. Dropping them silently expanded the series as\n // if the part were absent (FREQ=DAILY;BYDAY=MO filled every day). Filtering\n // here rather than at push time keeps COUNT numbering RFC-correct: a\n // candidate the filter removes is not an occurrence and consumes no slot.\n const limitByMonth = rule.freq !== \"yearly\" && validByMonth.length > 0 ? validByMonth : null;\n const limitByMonthDay = rule.freq === \"daily\" && rule.byMonthDay?.length ? rule.byMonthDay : null;\n const limitByWeekday =\n rule.freq === \"daily\" && rule.byWeekday?.length\n ? rule.byWeekday.map((d) => WEEKDAYS.indexOf(typeof d === \"string\" ? d : d.day))\n : null;\n const hasLimits = Boolean(limitByMonth || limitByMonthDay || limitByWeekday);\n\n const passesLimits = (candidate: TZDate): boolean => {\n if (limitByMonth && !limitByMonth.includes(candidate.getMonth() + 1)) {\n return false;\n }\n if (limitByWeekday && !limitByWeekday.includes(candidate.getDay())) {\n return false;\n }\n if (limitByMonthDay) {\n const total = daysInMonth(candidate.getFullYear(), candidate.getMonth());\n const day = candidate.getDate();\n // negative BYMONTHDAY counts back from month end, as in monthDays\n if (!limitByMonthDay.some((n) => (n < 0 ? total + 1 + n : n) === day)) {\n return false;\n }\n }\n return true;\n };\n\n /** Wall-clock instant in the display zone carrying DTSTART's time-of-day. */\n const zonedDate = (year: number, month: number, day: number) =>\n new TZDate(\n year,\n month,\n day,\n zonedStart.getHours(),\n zonedStart.getMinutes(),\n zonedStart.getSeconds(),\n zonedStart.getMilliseconds(),\n ctx.timeZone,\n );\n\n /** Selected days-of-month, ascending: BYMONTHDAY (and) BYDAY, else the clamped anchor day. */\n const monthDays = (year: number, month: number): number[] => {\n const total = daysInMonth(year, month);\n let days: number[] | null = null;\n if (rule.byMonthDay?.length) {\n // negative BYMONTHDAY counts back from month end; nonexistent days skip\n days = rule.byMonthDay\n .map((n) => (n < 0 ? total + 1 + n : n))\n .filter((n) => n >= 1 && n <= total);\n }\n if (monthlyByDay) {\n const byDayMatches: number[] = [];\n for (const entry of monthlyByDay) {\n const day = typeof entry === \"string\" ? entry : entry.day;\n const ordinal = typeof entry === \"string\" ? 0 : entry.ordinal;\n const weekday = WEEKDAYS.indexOf(day);\n const matches: number[] = [];\n for (let d = 1; d <= total; d++) {\n if (new Date(year, month, d).getDay() === weekday) matches.push(d);\n }\n if (ordinal === 0) {\n byDayMatches.push(...matches); // plain BYDAY: every matching weekday\n } else {\n // 2TU = 2nd Tuesday, -1FR = last Friday; absent ordinals skip\n const pick = ordinal > 0 ? matches[ordinal - 1] : matches[matches.length + ordinal];\n if (pick !== undefined) byDayMatches.push(pick);\n }\n }\n days = days ? days.filter((n) => byDayMatches.includes(n)) : byDayMatches;\n }\n if (!days) days = [Math.min(zonedStart.getDate(), total)]; // clamp to month end\n return [...new Set(days)].sort((a, b) => a - b);\n };\n\n /** Chronological candidates of one period, derived from the DTSTART anchor by index (no drift). */\n const periodCandidates = (period: number): TZDate[] => {\n if (rule.freq === \"daily\") return [addDays(zonedStart, period * interval)];\n if (rule.freq === \"weekly\") {\n const base = addWeeks(zonedStart, period * interval);\n if (!weeklyDays) return [base];\n const week: TZDate[] = [];\n // walk the WKST-aligned week so candidates stay chronological\n const baseOffset = fromWeekStart(base.getDay());\n for (let offset = 0; offset < 7; offset++) {\n const candidate = addDays(base, offset - baseOffset);\n if (!weeklyDays.includes(candidate.getDay())) continue;\n // days of the DTSTART week before DTSTART are not part of the series\n if (candidate.getTime() < zonedStart.getTime()) continue;\n week.push(candidate);\n }\n return week;\n }\n if (rule.freq === \"monthly\") {\n const anchor = addMonths(zonedStart, period * interval);\n const year = anchor.getFullYear();\n const month = anchor.getMonth();\n return monthDays(year, month)\n .map((day) => zonedDate(year, month, day))\n .filter((c) => c.getTime() >= zonedStart.getTime());\n }\n // yearly\n const year = addYears(zonedStart, period * interval).getFullYear();\n const dates: TZDate[] = [];\n for (const month of yearlyMonths) {\n for (const day of monthDays(year, month - 1)) {\n dates.push(zonedDate(year, month - 1, day));\n }\n }\n return dates.filter((c) => c.getTime() >= zonedStart.getTime());\n };\n\n /** Candidates of one period with the LIMIT filters applied. */\n const candidatesFor = (period: number): TZDate[] =>\n hasLimits ? periodCandidates(period).filter(passesLimits) : periodCandidates(period);\n\n /** Earliest/latest instant a period can produce - loop bounds without expanding it. */\n const periodEdge = (period: number, edge: \"first\" | \"last\"): TZDate => {\n if (rule.freq === \"daily\") return addDays(zonedStart, period * interval);\n if (rule.freq === \"weekly\") {\n const base = addWeeks(zonedStart, period * interval);\n if (!weeklyDays) return base;\n return addDays(base, (edge === \"first\" ? 0 : 6) - fromWeekStart(base.getDay()));\n }\n if (rule.freq === \"monthly\") {\n const anchor = addMonths(zonedStart, period * interval);\n const year = anchor.getFullYear();\n const month = anchor.getMonth();\n return zonedDate(year, month, edge === \"first\" ? 1 : daysInMonth(year, month));\n }\n const year = addYears(zonedStart, period * interval).getFullYear();\n const month = (edge === \"first\" ? yearlyMonths[0] : yearlyMonths[yearlyMonths.length - 1]) - 1;\n return zonedDate(year, month, edge === \"first\" ? 1 : daysInMonth(year, month));\n };\n\n // O(1) fast-forward: land a couple of periods before the window instead of\n // iterating from DTSTART, so years-old series still reach the visible range.\n const aheadMs = range.start.getTime() - durationMs - zonedStart.getTime();\n const stepMs = PERIOD_MS[rule.freq] * interval;\n let startPeriod = aheadMs > 0 ? Math.max(0, Math.floor(aheadMs / stepMs) - 2) : 0;\n // mean-length drift is bounded well under one period - refine forward\n while (periodEdge(startPeriod, \"last\").getTime() + durationMs <= range.start.getTime()) {\n startPeriod++;\n }\n\n // series ordinal at startPeriod, so COUNT and recurrenceIndex stay exact\n let index = 0;\n if (startPeriod > 0) {\n if (hasMonthDayParts || hasLimits) {\n // per-period counts vary (skipped days, 4-vs-5 weekday months, a LIMIT\n // filter that empties a whole period) - sum them\n for (let period = 0; period < startPeriod; period++) {\n index += candidatesFor(period).length;\n }\n } else if (weeklyDays) {\n // week 0 only counts selected weekdays at/after DTSTART's, inside the\n // WKST-aligned week that holds it\n const anchorOffset = fromWeekStart(zonedStart.getDay());\n const firstWeek = weeklyDays.filter((d) => fromWeekStart(d) >= anchorOffset).length;\n index = firstWeek + (startPeriod - 1) * weeklyDays.length;\n } else {\n index = startPeriod; // one occurrence per period\n }\n }\n\n const occurrences: EventCalendarOccurrence<TData>[] = [];\n\n const pushIfVisible = (rawStart: Date) => {\n // normalize to a plain instant so consumers never receive zone-carrying\n // TZDate instances (mixed-zone formatting bugs)\n const start = new Date(rawStart.getTime());\n if (exTimes.has(start.getTime())) return;\n const end = endFor(start);\n if (start < range.end && end > range.start) {\n occurrences.push({\n key: `${event.id}::${start.toISOString()}`,\n eventId: event.id,\n event,\n start,\n end,\n allDay,\n isRecurring: true,\n recurrenceIndex: index,\n });\n }\n };\n\n let iterations = 0;\n let period = startPeriod;\n while (iterations < MAX_ITERATIONS && occurrences.length < MAX_OCCURRENCES) {\n iterations++;\n if (rule.count !== undefined && index >= rule.count) break;\n // whole-period bounds: never break on a mid-period weekday/day-of-month,\n // so earlier candidates of the final period are still emitted\n const earliest = periodEdge(period, \"first\");\n if (earliest.getTime() >= range.end.getTime()) break;\n if (rule.until && earliest.getTime() > rule.until.getTime()) break;\n\n let ended = false;\n for (const candidate of candidatesFor(period)) {\n if (rule.count !== undefined && index >= rule.count) {\n ended = true;\n break;\n }\n if (rule.until && candidate.getTime() > rule.until.getTime()) {\n ended = true;\n break;\n }\n pushIfVisible(candidate);\n index++;\n if (occurrences.length >= MAX_OCCURRENCES) {\n ended = true;\n break;\n }\n }\n if (ended) break;\n period++;\n }\n\n // RDATE: extra instants join the set (deduped against generated starts and\n // exclusions) with the same wall-time duration. Sorted so direct consumers\n // still receive chronological order (buildEventIndex re-sorts regardless).\n if (rule.rDates?.length) {\n const seen = new Set(occurrences.map((o) => o.start.getTime()));\n for (const rDate of rule.rDates) {\n const start = new Date(rDate.getTime());\n if (seen.has(start.getTime()) || exTimes.has(start.getTime())) continue;\n const end = endFor(start);\n if (start >= range.end || end <= range.start) continue;\n seen.add(start.getTime());\n occurrences.push({\n key: `${event.id}::${start.toISOString()}`,\n eventId: event.id,\n event,\n start,\n end,\n allDay,\n isRecurring: true,\n // keep counting past the generated instants: an RDATE with no index\n // would fall back to undefined and break any consumer that identifies\n // an instance by its position in the series\n recurrenceIndex: index++,\n });\n }\n occurrences.sort((a, b) => a.start.getTime() - b.start.getTime());\n }\n\n return occurrences;\n}\n\nexport {\n EventCalendarRecurrenceError,\n expandRecurrence,\n formatRRuleString,\n MAX_OCCURRENCES,\n parseRRuleString,\n};\n"],"mappings":";;;;;AAcA,MAAM,kBAAkB;;AAGxB,MAAM,iBAAiB;;AAGvB,MAAM,YAAiE;CACrE,OAAO;CACP,QAAQ;CACR,SAAS;CACT,QAAQ;AACV;AAEA,MAAM,WAAmC;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;AAElF,IAAM,+BAAN,cAA2C,MAAM;CAC/C,YAAY,MAAc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,QAAQ,CAAC,KAAK,QAAQ,IAAI,MAAM,QAAQ,CAAC,GAAG;GAC/D,MAAM,MAAM,OAAO,KAAK;GACxB,IAAI,SAAS,MAAM,OAAO,OAAO,MAAM,OAAO;GAC9C,KAAK,IAAI,MAAM,QAAQ,CAAC;GACxB,YAAY,KAAK;IACf,KAAK,GAAG,MAAM,GAAG,IAAI,MAAM,YAAY;IACvC,SAAS,MAAM;IACf;IACA;IACA;IACA;IACA,aAAa;IAIb,iBAAiB;GACnB,CAAC;EACH;EACA,YAAY,MAAM,GAAG,MAAM,EAAE,MAAM,QAAQ,IAAI,EAAE,MAAM,QAAQ,CAAC;CAClE;CAEA,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-calendar-resource-view.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-resource-view.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"event-calendar-resource-view.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-resource-view.tsx"],"mappings":";;UA2CU,uCAAuC,UAAU;EACzD;EACA;EACA;;EAEA;;;iBAIO,4BACP,WACA,QACA,cACA,YACA,YACA,UAAU,iBACP,SACF,iDAA8B,IAAA"}
|