@super-calendar/core 2.17.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 +8 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -10
- package/dist/index.mjs +9 -11
- package/dist/{recurrence-CvIJfSMl.mjs → recurrence-15B6fu6K.mjs} +306 -101
- package/dist/{recurrence-D_oJ7A9D.js → recurrence-M-rJQgqd.js} +334 -99
- package/dist/{timezone-vbd68uRS.d.mts → timezone-BY2vQwRx.d.mts} +109 -13
- package/dist/{timezone-vbd68uRS.d.ts → timezone-BY2vQwRx.d.ts} +109 -13
- package/dist/vanilla.d.mts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +6 -1
- package/dist/vanilla.mjs +1 -1
- package/package.json +1 -1
- package/src/types.ts +7 -0
- package/src/utils/dates.ts +7 -2
- package/src/utils/drag.ts +14 -6
- package/src/utils/eventSource.ts +2 -0
- package/src/utils/ical.ts +5 -0
- package/src/utils/layout.ts +19 -5
- package/src/utils/monthGrid.ts +7 -1
- package/src/utils/multiWeekGrid.ts +2 -1
- package/src/utils/recurrence.ts +203 -77
- package/src/utils/timezone.ts +151 -48
- package/src/utils/useMonthGrid.ts +5 -0
- package/src/utils/useNow.ts +4 -9
- package/src/utils/zoneFields.ts +71 -0
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.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
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, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, 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, 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
|
|
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, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, 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, 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-
|
|
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)(() =>
|
|
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(
|
|
17
|
+
setValue(require_recurrence.nowInTimeZone(nowMs != null ? new Date(nowMs) : void 0, timeZone));
|
|
22
18
|
if (nowMs != null) return;
|
|
23
|
-
const id = setInterval(() => setValue(
|
|
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;
|
|
@@ -214,6 +212,8 @@ exports.eventsOverlap = require_recurrence.eventsOverlap;
|
|
|
214
212
|
exports.expandRecurringEvents = require_recurrence.expandRecurringEvents;
|
|
215
213
|
exports.filterHiddenDays = require_recurrence.filterHiddenDays;
|
|
216
214
|
exports.formatHour = require_recurrence.formatHour;
|
|
215
|
+
exports.fromZonedRange = require_recurrence.fromZonedRange;
|
|
216
|
+
exports.fromZonedTime = require_recurrence.fromZonedTime;
|
|
217
217
|
exports.getIsToday = require_recurrence.getIsToday;
|
|
218
218
|
exports.getViewDays = require_recurrence.getViewDays;
|
|
219
219
|
exports.getWeekDays = require_recurrence.getWeekDays;
|
|
@@ -238,6 +238,7 @@ exports.monthEventCapacity = require_recurrence.monthEventCapacity;
|
|
|
238
238
|
exports.monthVisibleCount = require_recurrence.monthVisibleCount;
|
|
239
239
|
exports.movedClockSpan = require_recurrence.movedClockSpan;
|
|
240
240
|
exports.nextDateRange = require_recurrence.nextDateRange;
|
|
241
|
+
exports.nowInTimeZone = require_recurrence.nowInTimeZone;
|
|
241
242
|
exports.overlapsOtherEvents = require_recurrence.overlapsOtherEvents;
|
|
242
243
|
exports.pageStepDays = require_recurrence.pageStepDays;
|
|
243
244
|
exports.parseICalendar = require_recurrence.parseICalendar;
|
|
@@ -259,4 +260,6 @@ exports.viewDayCount = require_recurrence.viewDayCount;
|
|
|
259
260
|
exports.wallClockHours = require_recurrence.wallClockHours;
|
|
260
261
|
exports.weekDaysCount = require_recurrence.weekDaysCount;
|
|
261
262
|
exports.weekdayFormatToken = require_recurrence.weekdayFormatToken;
|
|
263
|
+
exports.zonedDragBounds = require_recurrence.zonedDragBounds;
|
|
264
|
+
exports.zonedEventSource = require_recurrence.zonedEventSource;
|
|
262
265
|
exports.zonedTimeToUtc = require_recurrence.zonedTimeToUtc;
|
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { $ as
|
|
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(() =>
|
|
12
|
+
const [value, setValue] = useState(() => nowInTimeZone(now, timeZone));
|
|
17
13
|
const nowMs = now?.getTime();
|
|
18
14
|
useEffect(() => {
|
|
19
15
|
if (!enabled) return;
|
|
20
|
-
setValue(
|
|
16
|
+
setValue(nowInTimeZone(nowMs != null ? new Date(nowMs) : void 0, timeZone));
|
|
21
17
|
if (nowMs != null) return;
|
|
22
|
-
const id = setInterval(() => setValue(
|
|
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, buildMultiWeekGrid, 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 };
|