@super-calendar/core 2.16.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -75,6 +75,14 @@ Use `resolveDraggedBounds` to commit a move or resize. Equal start and end delta
75
75
  move the event while preserving elapsed duration, including across daylight
76
76
  saving changes. For a resize, pass zero for the edge you want to keep fixed.
77
77
 
78
+ `eventDayKeys` and `groupEventsByDay` index every occupied local calendar day by
79
+ its start-of-day ISO value. Midnight clock changes do not shift later day keys.
80
+ An event ending at the start of a day excludes that day.
81
+
82
+ `monthCreateRange(anchor, hover)` returns the ordered all-day creation range.
83
+ Its exclusive end is the start of the day after the last selected date,
84
+ including when a clock change skips midnight.
85
+
78
86
  `CalendarEvent<T>` includes an optional `dragHandleColor: string` for the native
79
87
  renderer's time-grid and resource-timeline resize grips. When omitted, those
80
88
  grips use `theme.colors.eventText`. Core preserves the field without interpreting it.
@@ -85,6 +93,31 @@ move and resize dialog. `eventChangeRejected` supplies the web dialog's rejectio
85
93
  message (default "This change is not allowed."). `resolveCalendarLabels` fills omitted labels with English
86
94
  defaults from `defaultCalendarLabels`.
87
95
 
96
+ ## Multi-week grids
97
+
98
+ `buildMultiWeekGrid` is available from both core entries. It builds consecutive
99
+ full weeks without month padding or hourly slots.
100
+
101
+ ```ts
102
+ import { buildMultiWeekGrid } from "@super-calendar/core/vanilla";
103
+
104
+ const grid = buildMultiWeekGrid(new Date(2026, 11, 28), {
105
+ numberOfWeeks: 3,
106
+ weekStartsOn: 1,
107
+ hiddenDays: [0, 6],
108
+ });
109
+ console.log(grid.weeks, grid.period, grid.visibleRange);
110
+ ```
111
+
112
+ `numberOfWeeks` defaults to `2` and must be a positive safe integer. Invalid
113
+ dates, invalid counts, and spans outside JavaScript's date range throw
114
+ `RangeError` before allocating rows. The builder materializes O(7 × N) days.
115
+ `period` covers full weeks; `visibleRange` gives the chronological visible
116
+ endpoints after hidden weekdays. Both use `{ start, endExclusive }`. RTL reverses
117
+ row display only. `MultiWeekGridDay` has the month builder's day state without
118
+ `isCurrentMonth`; `MultiWeekGridWeek.id` uses the unfiltered week start.
119
+ `getViewDays` and `viewDayCount` reject `multiweek`, so use this builder for it.
120
+
88
121
  ## Recurrence limits
89
122
 
90
123
  Recurring-event expansion stops at JavaScript's date limits and omits occurrences
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as cellRangeFromDrag, A as loadEventSource, At as nextDateRange, B as eventAccessibilityLabel, Bt as BusinessHoursBand, C as groupEventsByDay, Ct as DateSelectionConstraints, D as wallClockHours, Dt as isDateSelectable, E as layoutDayEvents, Et as daySelectionState, F as EventAccessibilityLabelContext, Ft as rangeBandKind, G as monthEventCapacity, Gt as CreateGhostArgs, H as eventTimeLabel, Ht as CalendarEvent, I as EventAccessibilityLabeler, It as CalendarColors, J as titleNumberOfLines, Jt as RecurrenceFrequency, K as monthVisibleCount, Kt as EventKeyExtractor, L as EventChipLayout, Lt as darkColors, M as ToICalendarOptions, Mt as RangeBandKind, N as parseICalendar, Nt as bandRounding, O as EventSource, Ot as isRangeEndpoint, P as toICalendar, Pt as dayBadgeKind, Q as resolveCalendarLabels, Qt as WeekStartsOn, R as MIN_BOX_HEIGHT_FOR_TIME, Rt as lightColors, S as eventDayKeys, St as DateRange, T as isBackgroundEvent, Tt as UseDateRangeOptions, U as formatHour, Ut as CalendarHandle, V as eventChipLayout, Vt as BusinessHoursValue, W as isTimeVisibleAtHeight, Wt as CalendarMode, X as dayAccessibilityLabel, Xt as ScrollToTimeOptions, Y as CalendarLabels, Yt as RecurrenceRule, Z as defaultCalendarLabels, Zt as TimeGridMode, _ as backgroundBandsForDay, _t as isWeekend, a as MonthEventSegment, at as overlapsOtherEvents, b as compareDayEvents, bt as weekDaysCount, c as MonthGridWeek, ct as shiftMinutes, d as UseMonthGridOptions, dt as filterHiddenDays, et as clampMoveStartMinutes, f as WeekdayFormat, ft as getIsToday, g as PositionedEvent, gt as isSameCalendarDay, h as weekdayFormatToken, ht as getYearMonths, i as expandRecurringEvents, it as movedClockSpan, j as ICalEvent, jt as DayBadgeKind, k as EventSourceOptions, kt as isWithinDateRange, l as MonthGridWeekday, lt as snapDeltaMinutes, m as layoutMonthWeek, mt as getWeekDays, n as toZonedTime, nt as monthCreateRange, o as MonthGrid, ot as pageStepDays, p as buildMonthGrid, pt as getViewDays, q as titleEllipsizeMode, qt as ICalendarEvent, r as zonedTimeToUtc, rt as monthDropBounds, s as MonthGridDay, st as resolveDraggedBounds, t as eventsInTimeZone, tt as eventsOverlap, u as MonthWeekEvents, ut as buildMonthWeeks, v as clockHoursBetween, vt as minutesIntoDay, w as isAllDayEvent, wt as DaySelectionState, x as drawnEnd, xt as CalendarSelection, y as closedHourBands, yt as viewDayCount, z as MonthEventCapacity, zt as BusinessHours } from "./timezone-d6EaWlvP.mjs";
1
+ import { $ as eventAccessibilityLabel, $t as BusinessHoursBand, A as backgroundBandsForDay, At as isWeekend, B as wallClockHours, Bt as isDateSelectable, C as MonthWeekEvents, Ct as buildMonthWeeks, D as layoutMonthWeek, Dt as getWeekDays, E as buildMonthGrid, Et as getViewDays, F as eventDayKeys, Ft as DateRange, G as ToICalendarOptions, Gt as RangeBandKind, H as EventSourceOptions, Ht as isWithinDateRange, I as groupEventsByDay, It as DateSelectionConstraints, J as EventAccessibilityLabelContext, Jt as rangeBandKind, K as parseICalendar, Kt as bandRounding, L as isAllDayEvent, Lt as DaySelectionState, M as closedHourBands, Mt as viewDayCount, N as compareDayEvents, Nt as weekDaysCount, O as weekdayFormatToken, Ot as getYearMonths, P as drawnEnd, Pt as CalendarSelection, Q as MonthEventCapacity, Qt as BusinessHours, R as isBackgroundEvent, Rt as UseDateRangeOptions, S as MonthGridWeekday, St as snapDeltaMinutes, T as WeekdayFormat, Tt as getIsToday, U as loadEventSource, Ut as nextDateRange, V as EventSource, Vt as isRangeEndpoint, W as ICalEvent, Wt as DayBadgeKind, X as EventChipLayout, Xt as darkColors, Y as EventAccessibilityLabeler, Yt as CalendarColors, Z as MIN_BOX_HEIGHT_FOR_TIME, Zt as lightColors, _ as buildMultiWeekGrid, _t as movedClockSpan, a as nowInTimeZone, an as EventKeyExtractor, at as monthVisibleCount, b as MonthGridDay, bt as resolveDraggedBounds, c as zonedEventSource, cn as RecurrenceRule, ct as CalendarLabels, d as expandRecurringEvents, dn as WeekStartsOn, dt as resolveCalendarLabels, en as BusinessHoursValue, et as eventChipLayout, f as MultiWeekGrid, ft as cellRangeFromDrag, g as MultiWeekGridWeek, gt as monthDropBounds, h as MultiWeekGridOptions, ht as monthCreateRange, i as fromZonedTime, in as CreateGhostArgs, it as monthEventCapacity, j as clockHoursBetween, jt as minutesIntoDay, k as PositionedEvent, kt as isSameCalendarDay, l as zonedTimeToUtc, ln as ScrollToTimeOptions, lt as dayAccessibilityLabel, m as MultiWeekGridInterval, mt as eventsOverlap, n as eventsInTimeZone, nn as CalendarHandle, nt as formatHour, o as toZonedTime, on as ICalendarEvent, ot as titleEllipsizeMode, p as MultiWeekGridDay, pt as clampMoveStartMinutes, q as toICalendar, qt as dayBadgeKind, r as fromZonedRange, rn as CalendarMode, rt as isTimeVisibleAtHeight, s as zonedDragBounds, sn as RecurrenceFrequency, st as titleNumberOfLines, t as ZonedDragBoundsOptions, tn as CalendarEvent, tt as eventTimeLabel, u as ExpandRecurringEventsOptions, un as TimeGridMode, ut as defaultCalendarLabels, v as MonthEventSegment, vt as overlapsOtherEvents, w as UseMonthGridOptions, wt as filterHiddenDays, x as MonthGridWeek, xt as shiftMinutes, y as MonthGrid, yt as pageStepDays, z as layoutDayEvents, zt as daySelectionState } from "./timezone-BY2vQwRx.mjs";
2
2
  import { Dispatch, SetStateAction } from "react";
3
3
  /** Options for {@link useNow}. */
4
4
  export interface UseNowOptions {
@@ -91,4 +91,4 @@ export declare function useDateRange(options?: UseDateRangeOptions): UseDateRang
91
91
  * ```
92
92
  */
93
93
  export declare function useMonthGrid(month: Date, options?: UseMonthGridOptions): MonthGrid;
94
- export { BusinessHours, BusinessHoursBand, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarHandle, CalendarLabels, CalendarMode, CalendarSelection, CreateGhostArgs, DateRange, DateSelectionConstraints, DayBadgeKind, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventChipLayout, EventKeyExtractor, EventSource, EventSourceOptions, ICalEvent, ICalendarEvent, MIN_BOX_HEIGHT_FOR_TIME, MonthEventCapacity, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, movedClockSpan, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, zonedTimeToUtc };
94
+ export { BusinessHours, BusinessHoursBand, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarHandle, CalendarLabels, CalendarMode, CalendarSelection, CreateGhostArgs, DateRange, DateSelectionConstraints, DayBadgeKind, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventChipLayout, EventKeyExtractor, EventSource, EventSourceOptions, ExpandRecurringEventsOptions, ICalEvent, ICalendarEvent, MIN_BOX_HEIGHT_FOR_TIME, MonthEventCapacity, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, ZonedDragBoundsOptions, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, movedClockSpan, nextDateRange, nowInTimeZone, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, zonedDragBounds, zonedEventSource, zonedTimeToUtc };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as cellRangeFromDrag, A as loadEventSource, At as nextDateRange, B as eventAccessibilityLabel, Bt as BusinessHoursBand, C as groupEventsByDay, Ct as DateSelectionConstraints, D as wallClockHours, Dt as isDateSelectable, E as layoutDayEvents, Et as daySelectionState, F as EventAccessibilityLabelContext, Ft as rangeBandKind, G as monthEventCapacity, Gt as CreateGhostArgs, H as eventTimeLabel, Ht as CalendarEvent, I as EventAccessibilityLabeler, It as CalendarColors, J as titleNumberOfLines, Jt as RecurrenceFrequency, K as monthVisibleCount, Kt as EventKeyExtractor, L as EventChipLayout, Lt as darkColors, M as ToICalendarOptions, Mt as RangeBandKind, N as parseICalendar, Nt as bandRounding, O as EventSource, Ot as isRangeEndpoint, P as toICalendar, Pt as dayBadgeKind, Q as resolveCalendarLabels, Qt as WeekStartsOn, R as MIN_BOX_HEIGHT_FOR_TIME, Rt as lightColors, S as eventDayKeys, St as DateRange, T as isBackgroundEvent, Tt as UseDateRangeOptions, U as formatHour, Ut as CalendarHandle, V as eventChipLayout, Vt as BusinessHoursValue, W as isTimeVisibleAtHeight, Wt as CalendarMode, X as dayAccessibilityLabel, Xt as ScrollToTimeOptions, Y as CalendarLabels, Yt as RecurrenceRule, Z as defaultCalendarLabels, Zt as TimeGridMode, _ as backgroundBandsForDay, _t as isWeekend, a as MonthEventSegment, at as overlapsOtherEvents, b as compareDayEvents, bt as weekDaysCount, c as MonthGridWeek, ct as shiftMinutes, d as UseMonthGridOptions, dt as filterHiddenDays, et as clampMoveStartMinutes, f as WeekdayFormat, ft as getIsToday, g as PositionedEvent, gt as isSameCalendarDay, h as weekdayFormatToken, ht as getYearMonths, i as expandRecurringEvents, it as movedClockSpan, j as ICalEvent, jt as DayBadgeKind, k as EventSourceOptions, kt as isWithinDateRange, l as MonthGridWeekday, lt as snapDeltaMinutes, m as layoutMonthWeek, mt as getWeekDays, n as toZonedTime, nt as monthCreateRange, o as MonthGrid, ot as pageStepDays, p as buildMonthGrid, pt as getViewDays, q as titleEllipsizeMode, qt as ICalendarEvent, r as zonedTimeToUtc, rt as monthDropBounds, s as MonthGridDay, st as resolveDraggedBounds, t as eventsInTimeZone, tt as eventsOverlap, u as MonthWeekEvents, ut as buildMonthWeeks, v as clockHoursBetween, vt as minutesIntoDay, w as isAllDayEvent, wt as DaySelectionState, x as drawnEnd, xt as CalendarSelection, y as closedHourBands, yt as viewDayCount, z as MonthEventCapacity, zt as BusinessHours } from "./timezone-d6EaWlvP.js";
1
+ import { $ as eventAccessibilityLabel, $t as BusinessHoursBand, A as backgroundBandsForDay, At as isWeekend, B as wallClockHours, Bt as isDateSelectable, C as MonthWeekEvents, Ct as buildMonthWeeks, D as layoutMonthWeek, Dt as getWeekDays, E as buildMonthGrid, Et as getViewDays, F as eventDayKeys, Ft as DateRange, G as ToICalendarOptions, Gt as RangeBandKind, H as EventSourceOptions, Ht as isWithinDateRange, I as groupEventsByDay, It as DateSelectionConstraints, J as EventAccessibilityLabelContext, Jt as rangeBandKind, K as parseICalendar, Kt as bandRounding, L as isAllDayEvent, Lt as DaySelectionState, M as closedHourBands, Mt as viewDayCount, N as compareDayEvents, Nt as weekDaysCount, O as weekdayFormatToken, Ot as getYearMonths, P as drawnEnd, Pt as CalendarSelection, Q as MonthEventCapacity, Qt as BusinessHours, R as isBackgroundEvent, Rt as UseDateRangeOptions, S as MonthGridWeekday, St as snapDeltaMinutes, T as WeekdayFormat, Tt as getIsToday, U as loadEventSource, Ut as nextDateRange, V as EventSource, Vt as isRangeEndpoint, W as ICalEvent, Wt as DayBadgeKind, X as EventChipLayout, Xt as darkColors, Y as EventAccessibilityLabeler, Yt as CalendarColors, Z as MIN_BOX_HEIGHT_FOR_TIME, Zt as lightColors, _ as buildMultiWeekGrid, _t as movedClockSpan, a as nowInTimeZone, an as EventKeyExtractor, at as monthVisibleCount, b as MonthGridDay, bt as resolveDraggedBounds, c as zonedEventSource, cn as RecurrenceRule, ct as CalendarLabels, d as expandRecurringEvents, dn as WeekStartsOn, dt as resolveCalendarLabels, en as BusinessHoursValue, et as eventChipLayout, f as MultiWeekGrid, ft as cellRangeFromDrag, g as MultiWeekGridWeek, gt as monthDropBounds, h as MultiWeekGridOptions, ht as monthCreateRange, i as fromZonedTime, in as CreateGhostArgs, it as monthEventCapacity, j as clockHoursBetween, jt as minutesIntoDay, k as PositionedEvent, kt as isSameCalendarDay, l as zonedTimeToUtc, ln as ScrollToTimeOptions, lt as dayAccessibilityLabel, m as MultiWeekGridInterval, mt as eventsOverlap, n as eventsInTimeZone, nn as CalendarHandle, nt as formatHour, o as toZonedTime, on as ICalendarEvent, ot as titleEllipsizeMode, p as MultiWeekGridDay, pt as clampMoveStartMinutes, q as toICalendar, qt as dayBadgeKind, r as fromZonedRange, rn as CalendarMode, rt as isTimeVisibleAtHeight, s as zonedDragBounds, sn as RecurrenceFrequency, st as titleNumberOfLines, t as ZonedDragBoundsOptions, tn as CalendarEvent, tt as eventTimeLabel, u as ExpandRecurringEventsOptions, un as TimeGridMode, ut as defaultCalendarLabels, v as MonthEventSegment, vt as overlapsOtherEvents, w as UseMonthGridOptions, wt as filterHiddenDays, x as MonthGridWeek, xt as shiftMinutes, y as MonthGrid, yt as pageStepDays, z as layoutDayEvents, zt as daySelectionState } from "./timezone-BY2vQwRx.js";
2
2
  import { Dispatch, SetStateAction } from "react";
3
3
  /** Options for {@link useNow}. */
4
4
  export interface UseNowOptions {
@@ -91,4 +91,4 @@ export declare function useDateRange(options?: UseDateRangeOptions): UseDateRang
91
91
  * ```
92
92
  */
93
93
  export declare function useMonthGrid(month: Date, options?: UseMonthGridOptions): MonthGrid;
94
- export { BusinessHours, BusinessHoursBand, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarHandle, CalendarLabels, CalendarMode, CalendarSelection, CreateGhostArgs, DateRange, DateSelectionConstraints, DayBadgeKind, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventChipLayout, EventKeyExtractor, EventSource, EventSourceOptions, ICalEvent, ICalendarEvent, MIN_BOX_HEIGHT_FOR_TIME, MonthEventCapacity, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, movedClockSpan, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, zonedTimeToUtc };
94
+ export { BusinessHours, BusinessHoursBand, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarHandle, CalendarLabels, CalendarMode, CalendarSelection, CreateGhostArgs, DateRange, DateSelectionConstraints, DayBadgeKind, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventChipLayout, EventKeyExtractor, EventSource, EventSourceOptions, ExpandRecurringEventsOptions, ICalEvent, ICalendarEvent, MIN_BOX_HEIGHT_FOR_TIME, MonthEventCapacity, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, ZonedDragBoundsOptions, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, movedClockSpan, nextDateRange, nowInTimeZone, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, zonedDragBounds, zonedEventSource, zonedTimeToUtc };
package/dist/index.js CHANGED
@@ -1,26 +1,22 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_recurrence = require("./recurrence-BvmTFytR.js");
2
+ const require_recurrence = require("./recurrence-M-rJQgqd.js");
3
3
  let date_fns = require("date-fns");
4
4
  let react = require("react");
5
5
  // src/utils/useNow.ts
6
6
  const MINUTE_MS = 6e4;
7
- const resolveNow = (now, timeZone) => {
8
- const instant = now ?? /* @__PURE__ */ new Date();
9
- return timeZone ? require_recurrence.toZonedTime(instant, timeZone) : instant;
10
- };
11
7
  /**
12
8
  * The current wall-clock time, re-read every `tickMs` while `enabled`, shifted
13
9
  * into `timeZone` when given, or pinned to a fixed `now` override. Drives the
14
10
  * now indicator on both renderers so it can't disagree with zone-shifted events.
15
11
  */
16
12
  function useNow(enabled, { now, timeZone, tickMs = MINUTE_MS } = {}) {
17
- const [value, setValue] = (0, react.useState)(() => resolveNow(now, timeZone));
13
+ const [value, setValue] = (0, react.useState)(() => require_recurrence.nowInTimeZone(now, timeZone));
18
14
  const nowMs = now?.getTime();
19
15
  (0, react.useEffect)(() => {
20
16
  if (!enabled) return;
21
- setValue(resolveNow(nowMs != null ? new Date(nowMs) : void 0, timeZone));
17
+ setValue(require_recurrence.nowInTimeZone(nowMs != null ? new Date(nowMs) : void 0, timeZone));
22
18
  if (nowMs != null) return;
23
- const id = setInterval(() => setValue(resolveNow(void 0, timeZone)), tickMs);
19
+ const id = setInterval(() => setValue(require_recurrence.nowInTimeZone(void 0, timeZone)), tickMs);
24
20
  return () => clearInterval(id);
25
21
  }, [
26
22
  enabled,
@@ -173,7 +169,8 @@ function useDateRange(options = {}) {
173
169
  * ```
174
170
  */
175
171
  function useMonthGrid(month, options = {}) {
176
- const { weekStartsOn, showSixWeeks, isRTL, selectedDates, selectedRange, minDate, maxDate, isDateDisabled, locale } = options;
172
+ const { weekStartsOn, showSixWeeks, isRTL, selectedDates, selectedRange, minDate, maxDate, isDateDisabled, locale, today } = options;
173
+ const todayKey = today ? (0, date_fns.startOfDay)(today).getTime() : void 0;
177
174
  return (0, react.useMemo)(() => require_recurrence.buildMonthGrid(month, options), [
178
175
  month,
179
176
  weekStartsOn,
@@ -184,7 +181,8 @@ function useMonthGrid(month, options = {}) {
184
181
  minDate,
185
182
  maxDate,
186
183
  isDateDisabled,
187
- locale
184
+ locale,
185
+ todayKey
188
186
  ]);
189
187
  }
190
188
  exports.CalendarSelectionProvider = CalendarSelectionProvider;
@@ -193,6 +191,7 @@ exports.backgroundBandsForDay = require_recurrence.backgroundBandsForDay;
193
191
  exports.bandRounding = require_recurrence.bandRounding;
194
192
  exports.buildMonthGrid = require_recurrence.buildMonthGrid;
195
193
  exports.buildMonthWeeks = require_recurrence.buildMonthWeeks;
194
+ exports.buildMultiWeekGrid = require_recurrence.buildMultiWeekGrid;
196
195
  exports.cellRangeFromDrag = require_recurrence.cellRangeFromDrag;
197
196
  exports.clampMoveStartMinutes = require_recurrence.clampMoveStartMinutes;
198
197
  exports.clockHoursBetween = require_recurrence.clockHoursBetween;
@@ -213,6 +212,8 @@ exports.eventsOverlap = require_recurrence.eventsOverlap;
213
212
  exports.expandRecurringEvents = require_recurrence.expandRecurringEvents;
214
213
  exports.filterHiddenDays = require_recurrence.filterHiddenDays;
215
214
  exports.formatHour = require_recurrence.formatHour;
215
+ exports.fromZonedRange = require_recurrence.fromZonedRange;
216
+ exports.fromZonedTime = require_recurrence.fromZonedTime;
216
217
  exports.getIsToday = require_recurrence.getIsToday;
217
218
  exports.getViewDays = require_recurrence.getViewDays;
218
219
  exports.getWeekDays = require_recurrence.getWeekDays;
@@ -237,6 +238,7 @@ exports.monthEventCapacity = require_recurrence.monthEventCapacity;
237
238
  exports.monthVisibleCount = require_recurrence.monthVisibleCount;
238
239
  exports.movedClockSpan = require_recurrence.movedClockSpan;
239
240
  exports.nextDateRange = require_recurrence.nextDateRange;
241
+ exports.nowInTimeZone = require_recurrence.nowInTimeZone;
240
242
  exports.overlapsOtherEvents = require_recurrence.overlapsOtherEvents;
241
243
  exports.pageStepDays = require_recurrence.pageStepDays;
242
244
  exports.parseICalendar = require_recurrence.parseICalendar;
@@ -258,4 +260,6 @@ exports.viewDayCount = require_recurrence.viewDayCount;
258
260
  exports.wallClockHours = require_recurrence.wallClockHours;
259
261
  exports.weekDaysCount = require_recurrence.weekDaysCount;
260
262
  exports.weekdayFormatToken = require_recurrence.weekdayFormatToken;
263
+ exports.zonedDragBounds = require_recurrence.zonedDragBounds;
264
+ exports.zonedEventSource = require_recurrence.zonedEventSource;
261
265
  exports.zonedTimeToUtc = require_recurrence.zonedTimeToUtc;
package/dist/index.mjs CHANGED
@@ -1,25 +1,21 @@
1
- import { $ as getIsToday, A as overlapsOtherEvents, B as eventDayKeys, C as resolveCalendarLabels, D as monthCreateRange, E as eventsOverlap, F as backgroundBandsForDay, G as wallClockHours, H as isAllDayEvent, I as clockHoursBetween, J as isRangeEndpoint, K as daySelectionState, L as closedHourBands, M as resolveDraggedBounds, N as shiftMinutes, O as monthDropBounds, P as snapDeltaMinutes, Q as filterHiddenDays, R as compareDayEvents, S as defaultCalendarLabels, T as clampMoveStartMinutes, U as isBackgroundEvent, V as groupEventsByDay, W as layoutDayEvents, X as nextDateRange, Y as isWithinDateRange, Z as buildMonthWeeks, _ as monthEventCapacity, a as loadEventSource, at as minutesIntoDay, b as titleNumberOfLines, c as eventsInTimeZone, ct as bandRounding, d as MIN_BOX_HEIGHT_FOR_TIME, dt as darkColors, et as getViewDays, f as eventAccessibilityLabel, ft as lightColors, g as isTimeVisibleAtHeight, h as formatHour, i as weekdayFormatToken, it as isWeekend, j as pageStepDays, k as movedClockSpan, l as toZonedTime, lt as dayBadgeKind, m as eventTimeLabel, n as buildMonthGrid, nt as getYearMonths, o as parseICalendar, ot as viewDayCount, p as eventChipLayout, q as isDateSelectable, r as layoutMonthWeek, rt as isSameCalendarDay, s as toICalendar, st as weekDaysCount, t as expandRecurringEvents, tt as getWeekDays, u as zonedTimeToUtc, ut as rangeBandKind, v as monthVisibleCount, w as cellRangeFromDrag, x as dayAccessibilityLabel, y as titleEllipsizeMode, z as drawnEnd } from "./recurrence-CvUX9ncg.mjs";
1
+ import { $ as isDateSelectable, A as cellRangeFromDrag, B as snapDeltaMinutes, C as monthEventCapacity, D as dayAccessibilityLabel, E as titleNumberOfLines, F as movedClockSpan, G as drawnEnd, H as clockHoursBetween, I as overlapsOtherEvents, J as isAllDayEvent, K as eventDayKeys, L as pageStepDays, M as eventsOverlap, N as monthCreateRange, O as defaultCalendarLabels, P as monthDropBounds, Q as daySelectionState, R as resolveDraggedBounds, S as isTimeVisibleAtHeight, T as titleEllipsizeMode, U as closedHourBands, V as backgroundBandsForDay, W as compareDayEvents, X as layoutDayEvents, Y as isBackgroundEvent, Z as wallClockHours, _ as MIN_BOX_HEIGHT_FOR_TIME, _t as darkColors, a as weekdayFormatToken, at as getIsToday, b as eventTimeLabel, c as toICalendar, ct as getYearMonths, d as fromZonedTime, dt as minutesIntoDay, et as isRangeEndpoint, f as nowInTimeZone, ft as viewDayCount, g as zonedTimeToUtc, gt as rangeBandKind, h as zonedEventSource, ht as dayBadgeKind, i as layoutMonthWeek, it as filterHiddenDays, j as clampMoveStartMinutes, k as resolveCalendarLabels, l as eventsInTimeZone, lt as isSameCalendarDay, m as zonedDragBounds, mt as bandRounding, n as buildMultiWeekGrid, nt as nextDateRange, o as loadEventSource, ot as getViewDays, p as toZonedTime, pt as weekDaysCount, q as groupEventsByDay, r as buildMonthGrid, rt as buildMonthWeeks, s as parseICalendar, st as getWeekDays, t as expandRecurringEvents, tt as isWithinDateRange, u as fromZonedRange, ut as isWeekend, v as eventAccessibilityLabel, vt as lightColors, w as monthVisibleCount, x as formatHour, y as eventChipLayout, z as shiftMinutes } from "./recurrence-15B6fu6K.mjs";
2
2
  import { startOfDay } from "date-fns";
3
3
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
4
4
  // src/utils/useNow.ts
5
5
  const MINUTE_MS = 6e4;
6
- const resolveNow = (now, timeZone) => {
7
- const instant = now ?? /* @__PURE__ */ new Date();
8
- return timeZone ? toZonedTime(instant, timeZone) : instant;
9
- };
10
6
  /**
11
7
  * The current wall-clock time, re-read every `tickMs` while `enabled`, shifted
12
8
  * into `timeZone` when given, or pinned to a fixed `now` override. Drives the
13
9
  * now indicator on both renderers so it can't disagree with zone-shifted events.
14
10
  */
15
11
  function useNow(enabled, { now, timeZone, tickMs = MINUTE_MS } = {}) {
16
- const [value, setValue] = useState(() => resolveNow(now, timeZone));
12
+ const [value, setValue] = useState(() => nowInTimeZone(now, timeZone));
17
13
  const nowMs = now?.getTime();
18
14
  useEffect(() => {
19
15
  if (!enabled) return;
20
- setValue(resolveNow(nowMs != null ? new Date(nowMs) : void 0, timeZone));
16
+ setValue(nowInTimeZone(nowMs != null ? new Date(nowMs) : void 0, timeZone));
21
17
  if (nowMs != null) return;
22
- const id = setInterval(() => setValue(resolveNow(void 0, timeZone)), tickMs);
18
+ const id = setInterval(() => setValue(nowInTimeZone(void 0, timeZone)), tickMs);
23
19
  return () => clearInterval(id);
24
20
  }, [
25
21
  enabled,
@@ -172,7 +168,8 @@ function useDateRange(options = {}) {
172
168
  * ```
173
169
  */
174
170
  function useMonthGrid(month, options = {}) {
175
- const { weekStartsOn, showSixWeeks, isRTL, selectedDates, selectedRange, minDate, maxDate, isDateDisabled, locale } = options;
171
+ const { weekStartsOn, showSixWeeks, isRTL, selectedDates, selectedRange, minDate, maxDate, isDateDisabled, locale, today } = options;
172
+ const todayKey = today ? startOfDay(today).getTime() : void 0;
176
173
  return useMemo(() => buildMonthGrid(month, options), [
177
174
  month,
178
175
  weekStartsOn,
@@ -183,7 +180,8 @@ function useMonthGrid(month, options = {}) {
183
180
  minDate,
184
181
  maxDate,
185
182
  isDateDisabled,
186
- locale
183
+ locale,
184
+ todayKey
187
185
  ]);
188
186
  }
189
- export { CalendarSelectionProvider, MIN_BOX_HEIGHT_FOR_TIME, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, movedClockSpan, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useCalendarSelection, useDateRange, useEventSource, useMonthGrid, useNow, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, zonedTimeToUtc };
187
+ export { CalendarSelectionProvider, MIN_BOX_HEIGHT_FOR_TIME, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, movedClockSpan, nextDateRange, nowInTimeZone, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useCalendarSelection, useDateRange, useEventSource, useMonthGrid, useNow, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, zonedDragBounds, zonedEventSource, zonedTimeToUtc };