@super-calendar/native 2.8.2 → 2.9.1
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/{DefaultMonthEvent-C_T4thzu.d.ts → DefaultMonthEvent--9Jg6w-x.d.ts} +82 -3
- package/dist/{DefaultMonthEvent-Cewbec1K.d.mts → DefaultMonthEvent-BlnKHaq2.d.mts} +82 -3
- package/dist/{MonthList-DjAz4xoi.mjs → MonthList-CjKhzOJX.mjs} +356 -102
- package/dist/{MonthList-C-vBotP0.js → MonthList-DNT1LJkk.js} +355 -101
- package/dist/index.d.mts +91 -37
- package/dist/index.d.ts +91 -37
- package/dist/index.js +536 -64
- package/dist/index.mjs +537 -65
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +2 -2
- package/src/components/Calendar.tsx +85 -16
- package/src/components/MonthPager.tsx +150 -62
- package/src/components/MonthView.tsx +415 -76
- package/src/components/MultiDayMovePreview.tsx +164 -0
- package/src/components/TimeGrid.tsx +327 -37
- package/src/components/YearView.tsx +368 -81
- package/src/types.ts +19 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as CalendarTheme, C as RecurrenceFrequency, D as TimeGridMode, E as RenderEventArgs, F as mergeTheme, I as useCalendarTheme, M as PartialCalendarTheme, N as darkTheme, O as WeekStartsOn, P as defaultTheme, S as ICalendarEvent, T as RenderEvent, _ as EventAccessibilityLabelContext, a as MonthPager, b as EventDragStartHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarMode, h as CalendarEvent, i as MonthListSlot, j as CalendarThemeProvider, k as WeekdayFormat, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabeler, w as RecurrenceRule, x as EventKeyExtractor, y as EventDragHandler } from "./DefaultMonthEvent-BlnKHaq2.mjs";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
3
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
4
4
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, DateRange, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
5
|
+
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
6
6
|
import { StyleProp, ViewStyle } from "react-native";
|
|
7
7
|
//#region src/components/YearView.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* The styleable parts of {@link YearView}. `dayText` and `eventDot` are the
|
|
10
|
-
* text/marker inside a day cell (React Native text colour doesn't inherit)
|
|
10
|
+
* text/marker inside a day cell (React Native text colour doesn't inherit);
|
|
11
|
+
* `dayBadge` is the round highlight behind the number and `rangeBand` the
|
|
12
|
+
* selection strip behind it.
|
|
11
13
|
*/
|
|
12
|
-
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "dayText" | "eventDot";
|
|
14
|
+
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "dayBadge" | "dayText" | "rangeBand" | "eventDot";
|
|
13
15
|
/** Props for {@link YearView}, the twelve mini-month year grid. */
|
|
14
16
|
type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
|
|
15
17
|
/** Any date inside the year to render. */
|
|
@@ -22,6 +24,16 @@ type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
|
|
|
22
24
|
locale?: Locale;
|
|
23
25
|
/** Highlight this date instead of the real "today". */
|
|
24
26
|
activeDate?: Date;
|
|
27
|
+
/** A selected span: endpoints get a filled badge, the days between get the range band. */
|
|
28
|
+
selectedRange?: DateRange$1;
|
|
29
|
+
/** Discrete selected days, drawn with a filled badge. */
|
|
30
|
+
selectedDates?: Date[];
|
|
31
|
+
/** Earliest selectable day (inclusive); earlier days render disabled. */
|
|
32
|
+
minDate?: Date;
|
|
33
|
+
/** Latest selectable day (inclusive); later days render disabled. */
|
|
34
|
+
maxDate?: Date;
|
|
35
|
+
/** Return true to render a specific day disabled (dimmed, taps ignored). */
|
|
36
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
25
37
|
/**
|
|
26
38
|
* Smallest width a mini month may take before the grid drops a column
|
|
27
39
|
* (default 150). The grid fits 2–4 columns from the measured width.
|
|
@@ -31,13 +43,29 @@ type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
|
|
|
31
43
|
onPressDay?: (date: Date) => void;
|
|
32
44
|
/** Tap a month's title (e.g. to jump to that month's view). */
|
|
33
45
|
onPressMonth?: (month: Date) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Enables drag-to-select and reports the swept span live, as the ordered
|
|
48
|
+
* inclusive `[start, end]` days (both at midnight). Pair it with
|
|
49
|
+
* `useDateRange`'s `selectRange` to drive `selectedRange`. Fires on every day the
|
|
50
|
+
* drag crosses, so the highlight follows it; `onCreateEvent` (when also set)
|
|
51
|
+
* fires once on release. Either handler enables the same sweep: hold a day and
|
|
52
|
+
* drag on a device, press and drag on the web. On a device a sweep stays inside
|
|
53
|
+
* the mini month it started in; on the web it can run across months.
|
|
54
|
+
*/
|
|
55
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Enables drag-to-create: sweep across days and release to fire this with the
|
|
58
|
+
* all-day range (`start` at midnight of the first day, `end` at midnight after
|
|
59
|
+
* the last, exclusive). A plain tap still fires `onPressDay`, not this.
|
|
60
|
+
*/
|
|
61
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
34
62
|
};
|
|
35
|
-
declare function YearViewInner<T>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, classNames, styles: styleOverrides }: YearViewProps<T>): ReactElement;
|
|
63
|
+
declare function YearViewInner<T>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, classNames, styles: styleOverrides }: YearViewProps<T>): ReactElement;
|
|
36
64
|
/**
|
|
37
65
|
* A year at a glance: the twelve months as compact mini grids, with today
|
|
38
66
|
* highlighted and a dot under days that hold events. Tap a day or a month
|
|
39
|
-
* title to drill into a denser view
|
|
40
|
-
* `mode="year"`.
|
|
67
|
+
* title to drill into a denser view, or hold and drag to sweep out a date
|
|
68
|
+
* range. It's the view `Calendar` renders for `mode="year"`.
|
|
41
69
|
*
|
|
42
70
|
* @example
|
|
43
71
|
* ```tsx
|
|
@@ -83,19 +111,6 @@ declare function Agenda<T>({ events, locale, renderEvent, keyExtractor, onPressE
|
|
|
83
111
|
//#region src/components/TimeGrid.d.ts
|
|
84
112
|
/** Default height in pixels of one hour row on the time grid. */
|
|
85
113
|
declare const DEFAULT_HOUR_HEIGHT = 48;
|
|
86
|
-
/**
|
|
87
|
-
* Called when an event is dragged (moved or resized) to new start/end times.
|
|
88
|
-
* Return `false` to reject the drop — the event snaps back to where it started
|
|
89
|
-
* (e.g. to forbid overlaps or out-of-bounds slots). Any other return accepts it.
|
|
90
|
-
*/
|
|
91
|
-
type EventDragHandler<T> = (event: CalendarEvent<T>, start: Date, end: Date) => void | boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Called when a move or resize gesture begins, before any change is committed:
|
|
94
|
-
* on grab for a move (after the long-press), and when the resize drag starts.
|
|
95
|
-
* Handy for haptic feedback (e.g. `expo-haptics`). Requires drag to be enabled
|
|
96
|
-
* via `onDragEvent`.
|
|
97
|
-
*/
|
|
98
|
-
type EventDragStartHandler<T> = (event: CalendarEvent<T>) => void;
|
|
99
114
|
/** Replace the hour-axis label. Receives the hour (0–23) and the `ampm` flag. */
|
|
100
115
|
type HourRenderer = (hour: number, ampm: boolean) => React.ReactNode;
|
|
101
116
|
/**
|
|
@@ -259,6 +274,12 @@ type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
|
259
274
|
type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
260
275
|
events: CalendarEvent<T>[];
|
|
261
276
|
mode: CalendarMode;
|
|
277
|
+
/**
|
|
278
|
+
* The controlled anchor date, read in the device's local time zone. Construct
|
|
279
|
+
* it as a local date (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
280
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
281
|
+
* and anchors the previous week.
|
|
282
|
+
*/
|
|
262
283
|
date: Date;
|
|
263
284
|
onChangeDate: (date: Date) => void;
|
|
264
285
|
/** Fired alongside `onChangeDate` with the `[start, end]` of the newly-visible range. */
|
|
@@ -267,19 +288,20 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
267
288
|
/** Long-press an event (month/week/day). */
|
|
268
289
|
onLongPressEvent?: (event: CalendarEvent<T>) => void;
|
|
269
290
|
/**
|
|
270
|
-
* Enable drag-to-move and drag-to-resize
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
291
|
+
* Enable drag-to-move and drag-to-resize. Called with the dragged event and its
|
|
292
|
+
* new start/end; update your own event state in response. On the week/day grid,
|
|
293
|
+
* long-press an event to move it (drag horizontally to change the day too) or
|
|
294
|
+
* drag its bottom grip to resize, snapped to `dragStepMinutes`. In `month` mode,
|
|
295
|
+
* long-press an event bar and drop it on another day: both ends shift by the
|
|
296
|
+
* days dragged, so the time of day and duration are kept. Return `false` to
|
|
297
|
+
* reject the drop (e.g. an overlap) and snap the event back.
|
|
275
298
|
*/
|
|
276
299
|
onDragEvent?: EventDragHandler<T>;
|
|
277
300
|
/**
|
|
278
|
-
* Fired when a
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* `onDragEvent` is also set.
|
|
301
|
+
* Fired when a drag gesture begins, before any change is committed: on grab for
|
|
302
|
+
* a move (after the long-press), and when a week/day resize drag starts. Use it
|
|
303
|
+
* to trigger haptic feedback, e.g. `Haptics.impactAsync()` from `expo-haptics`.
|
|
304
|
+
* Native-only and inert unless `onDragEvent` is also set.
|
|
283
305
|
*/
|
|
284
306
|
onDragStart?: EventDragStartHandler<T>;
|
|
285
307
|
/** Minutes a drag-to-move/resize snaps to. Default 15. */
|
|
@@ -297,20 +319,47 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
297
319
|
onLongPressDay?: (date: Date) => void;
|
|
298
320
|
/** Tap the "+N more" overflow label in a month cell. */
|
|
299
321
|
onPressMore?: (events: CalendarEvent<T>[], date: Date) => void;
|
|
300
|
-
/**
|
|
322
|
+
/**
|
|
323
|
+
* Tap empty space; receives the date+time pressed on the week/day grid, or the
|
|
324
|
+
* tapped day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
325
|
+
*/
|
|
301
326
|
onPressCell?: (date: Date) => void;
|
|
302
327
|
/** After an empty-cell press, snap the pager back to the active page. Default false. */
|
|
303
328
|
resetPageOnPressCell?: boolean;
|
|
304
329
|
/** Long-press empty space on the week/day grid; receives the date+time. */
|
|
305
330
|
onLongPressCell?: (date: Date) => void;
|
|
306
331
|
/**
|
|
307
|
-
* Enable drag-to-create
|
|
308
|
-
*
|
|
309
|
-
* `
|
|
310
|
-
*
|
|
311
|
-
* `
|
|
332
|
+
* Enable drag-to-create: long-press empty space and drag to sweep out a new
|
|
333
|
+
* event, then release. On the week/day grid that is a time range snapped to
|
|
334
|
+
* `dragStepMinutes` (a stationary press yields a one-step range); in `month`
|
|
335
|
+
* mode it is an **all-day** span across the days swept — `start` at midnight of
|
|
336
|
+
* the first day, `end` at midnight after the last. Create your own event in
|
|
337
|
+
* response. Supersedes `onLongPressCell` (and, in month mode, `onLongPressDay`)
|
|
338
|
+
* on empty space when set.
|
|
312
339
|
*/
|
|
313
340
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
341
|
+
/**
|
|
342
|
+
* Month and year modes: reports a create sweep's day span as it happens, as the
|
|
343
|
+
* ordered inclusive `[start, end]` days, so a selection highlight can follow the
|
|
344
|
+
* drag. Pair it with `useDateRange`'s `selectRange` to drive `selectedRange`.
|
|
345
|
+
* Enables the sweep on its own, so it works without `onCreateEvent`.
|
|
346
|
+
*/
|
|
347
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
348
|
+
/** Days drawn as selected (a filled badge) in month and year modes. */
|
|
349
|
+
selectedDates?: Date[];
|
|
350
|
+
/** A selected span: endpoints get a filled badge, the span gets the range band. */
|
|
351
|
+
selectedRange?: DateRange$1;
|
|
352
|
+
/**
|
|
353
|
+
* Fill the whole month cell with the range band instead of the default centered
|
|
354
|
+
* rounded "pill" strip. Default false.
|
|
355
|
+
*/
|
|
356
|
+
fillCellOnSelection?: boolean;
|
|
357
|
+
/** Earliest selectable day (inclusive); earlier days render disabled. */
|
|
358
|
+
minDate?: Date;
|
|
359
|
+
/** Latest selectable day (inclusive); later days render disabled. */
|
|
360
|
+
maxDate?: Date;
|
|
361
|
+
/** Return true to render a specific day disabled (dimmed, taps ignored). */
|
|
362
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
314
363
|
/** Tap a day's column header on the week/day grid (default header only). */
|
|
315
364
|
onPressDateHeader?: (date: Date) => void;
|
|
316
365
|
/**
|
|
@@ -409,6 +458,11 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
409
458
|
hourComponent?: HourRenderer;
|
|
410
459
|
/** Always render six week rows in month view, for a fixed-height grid. Default false. */
|
|
411
460
|
showSixWeeks?: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* Render the built-in "MMMM yyyy" title above the month grid. Default true. Set
|
|
463
|
+
* false when your own header already shows the month and year. Month mode only.
|
|
464
|
+
*/
|
|
465
|
+
showTitle?: boolean;
|
|
412
466
|
/** Allow swiping between pages (all modes). Default true. */
|
|
413
467
|
swipeEnabled?: boolean;
|
|
414
468
|
/** Show the vertical scroll indicator on the week/day grid. Default true. */
|
|
@@ -494,7 +548,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
494
548
|
* }
|
|
495
549
|
* ```
|
|
496
550
|
*/
|
|
497
|
-
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
551
|
+
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
498
552
|
//#endregion
|
|
499
553
|
//#region src/components/DefaultEvent.d.ts
|
|
500
554
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as CalendarTheme, C as RecurrenceFrequency, D as TimeGridMode, E as RenderEventArgs, F as mergeTheme, I as useCalendarTheme, M as PartialCalendarTheme, N as darkTheme, O as WeekStartsOn, P as defaultTheme, S as ICalendarEvent, T as RenderEvent, _ as EventAccessibilityLabelContext, a as MonthPager, b as EventDragStartHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarMode, h as CalendarEvent, i as MonthListSlot, j as CalendarThemeProvider, k as WeekdayFormat, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabeler, w as RecurrenceRule, x as EventKeyExtractor, y as EventDragHandler } from "./DefaultMonthEvent--9Jg6w-x.js";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
3
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
4
4
|
import { StyleProp, ViewStyle } from "react-native";
|
|
5
5
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
6
|
-
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, DateRange, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
6
|
+
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
7
7
|
//#region src/components/YearView.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* The styleable parts of {@link YearView}. `dayText` and `eventDot` are the
|
|
10
|
-
* text/marker inside a day cell (React Native text colour doesn't inherit)
|
|
10
|
+
* text/marker inside a day cell (React Native text colour doesn't inherit);
|
|
11
|
+
* `dayBadge` is the round highlight behind the number and `rangeBand` the
|
|
12
|
+
* selection strip behind it.
|
|
11
13
|
*/
|
|
12
|
-
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "dayText" | "eventDot";
|
|
14
|
+
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "dayBadge" | "dayText" | "rangeBand" | "eventDot";
|
|
13
15
|
/** Props for {@link YearView}, the twelve mini-month year grid. */
|
|
14
16
|
type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
|
|
15
17
|
/** Any date inside the year to render. */
|
|
@@ -22,6 +24,16 @@ type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
|
|
|
22
24
|
locale?: Locale;
|
|
23
25
|
/** Highlight this date instead of the real "today". */
|
|
24
26
|
activeDate?: Date;
|
|
27
|
+
/** A selected span: endpoints get a filled badge, the days between get the range band. */
|
|
28
|
+
selectedRange?: DateRange$1;
|
|
29
|
+
/** Discrete selected days, drawn with a filled badge. */
|
|
30
|
+
selectedDates?: Date[];
|
|
31
|
+
/** Earliest selectable day (inclusive); earlier days render disabled. */
|
|
32
|
+
minDate?: Date;
|
|
33
|
+
/** Latest selectable day (inclusive); later days render disabled. */
|
|
34
|
+
maxDate?: Date;
|
|
35
|
+
/** Return true to render a specific day disabled (dimmed, taps ignored). */
|
|
36
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
25
37
|
/**
|
|
26
38
|
* Smallest width a mini month may take before the grid drops a column
|
|
27
39
|
* (default 150). The grid fits 2–4 columns from the measured width.
|
|
@@ -31,13 +43,29 @@ type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
|
|
|
31
43
|
onPressDay?: (date: Date) => void;
|
|
32
44
|
/** Tap a month's title (e.g. to jump to that month's view). */
|
|
33
45
|
onPressMonth?: (month: Date) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Enables drag-to-select and reports the swept span live, as the ordered
|
|
48
|
+
* inclusive `[start, end]` days (both at midnight). Pair it with
|
|
49
|
+
* `useDateRange`'s `selectRange` to drive `selectedRange`. Fires on every day the
|
|
50
|
+
* drag crosses, so the highlight follows it; `onCreateEvent` (when also set)
|
|
51
|
+
* fires once on release. Either handler enables the same sweep: hold a day and
|
|
52
|
+
* drag on a device, press and drag on the web. On a device a sweep stays inside
|
|
53
|
+
* the mini month it started in; on the web it can run across months.
|
|
54
|
+
*/
|
|
55
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Enables drag-to-create: sweep across days and release to fire this with the
|
|
58
|
+
* all-day range (`start` at midnight of the first day, `end` at midnight after
|
|
59
|
+
* the last, exclusive). A plain tap still fires `onPressDay`, not this.
|
|
60
|
+
*/
|
|
61
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
34
62
|
};
|
|
35
|
-
declare function YearViewInner<T>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, classNames, styles: styleOverrides }: YearViewProps<T>): ReactElement;
|
|
63
|
+
declare function YearViewInner<T>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, classNames, styles: styleOverrides }: YearViewProps<T>): ReactElement;
|
|
36
64
|
/**
|
|
37
65
|
* A year at a glance: the twelve months as compact mini grids, with today
|
|
38
66
|
* highlighted and a dot under days that hold events. Tap a day or a month
|
|
39
|
-
* title to drill into a denser view
|
|
40
|
-
* `mode="year"`.
|
|
67
|
+
* title to drill into a denser view, or hold and drag to sweep out a date
|
|
68
|
+
* range. It's the view `Calendar` renders for `mode="year"`.
|
|
41
69
|
*
|
|
42
70
|
* @example
|
|
43
71
|
* ```tsx
|
|
@@ -83,19 +111,6 @@ declare function Agenda<T>({ events, locale, renderEvent, keyExtractor, onPressE
|
|
|
83
111
|
//#region src/components/TimeGrid.d.ts
|
|
84
112
|
/** Default height in pixels of one hour row on the time grid. */
|
|
85
113
|
declare const DEFAULT_HOUR_HEIGHT = 48;
|
|
86
|
-
/**
|
|
87
|
-
* Called when an event is dragged (moved or resized) to new start/end times.
|
|
88
|
-
* Return `false` to reject the drop — the event snaps back to where it started
|
|
89
|
-
* (e.g. to forbid overlaps or out-of-bounds slots). Any other return accepts it.
|
|
90
|
-
*/
|
|
91
|
-
type EventDragHandler<T> = (event: CalendarEvent<T>, start: Date, end: Date) => void | boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Called when a move or resize gesture begins, before any change is committed:
|
|
94
|
-
* on grab for a move (after the long-press), and when the resize drag starts.
|
|
95
|
-
* Handy for haptic feedback (e.g. `expo-haptics`). Requires drag to be enabled
|
|
96
|
-
* via `onDragEvent`.
|
|
97
|
-
*/
|
|
98
|
-
type EventDragStartHandler<T> = (event: CalendarEvent<T>) => void;
|
|
99
114
|
/** Replace the hour-axis label. Receives the hour (0–23) and the `ampm` flag. */
|
|
100
115
|
type HourRenderer = (hour: number, ampm: boolean) => React.ReactNode;
|
|
101
116
|
/**
|
|
@@ -259,6 +274,12 @@ type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
|
259
274
|
type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
260
275
|
events: CalendarEvent<T>[];
|
|
261
276
|
mode: CalendarMode;
|
|
277
|
+
/**
|
|
278
|
+
* The controlled anchor date, read in the device's local time zone. Construct
|
|
279
|
+
* it as a local date (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
280
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
281
|
+
* and anchors the previous week.
|
|
282
|
+
*/
|
|
262
283
|
date: Date;
|
|
263
284
|
onChangeDate: (date: Date) => void;
|
|
264
285
|
/** Fired alongside `onChangeDate` with the `[start, end]` of the newly-visible range. */
|
|
@@ -267,19 +288,20 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
267
288
|
/** Long-press an event (month/week/day). */
|
|
268
289
|
onLongPressEvent?: (event: CalendarEvent<T>) => void;
|
|
269
290
|
/**
|
|
270
|
-
* Enable drag-to-move and drag-to-resize
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
291
|
+
* Enable drag-to-move and drag-to-resize. Called with the dragged event and its
|
|
292
|
+
* new start/end; update your own event state in response. On the week/day grid,
|
|
293
|
+
* long-press an event to move it (drag horizontally to change the day too) or
|
|
294
|
+
* drag its bottom grip to resize, snapped to `dragStepMinutes`. In `month` mode,
|
|
295
|
+
* long-press an event bar and drop it on another day: both ends shift by the
|
|
296
|
+
* days dragged, so the time of day and duration are kept. Return `false` to
|
|
297
|
+
* reject the drop (e.g. an overlap) and snap the event back.
|
|
275
298
|
*/
|
|
276
299
|
onDragEvent?: EventDragHandler<T>;
|
|
277
300
|
/**
|
|
278
|
-
* Fired when a
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* `onDragEvent` is also set.
|
|
301
|
+
* Fired when a drag gesture begins, before any change is committed: on grab for
|
|
302
|
+
* a move (after the long-press), and when a week/day resize drag starts. Use it
|
|
303
|
+
* to trigger haptic feedback, e.g. `Haptics.impactAsync()` from `expo-haptics`.
|
|
304
|
+
* Native-only and inert unless `onDragEvent` is also set.
|
|
283
305
|
*/
|
|
284
306
|
onDragStart?: EventDragStartHandler<T>;
|
|
285
307
|
/** Minutes a drag-to-move/resize snaps to. Default 15. */
|
|
@@ -297,20 +319,47 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
297
319
|
onLongPressDay?: (date: Date) => void;
|
|
298
320
|
/** Tap the "+N more" overflow label in a month cell. */
|
|
299
321
|
onPressMore?: (events: CalendarEvent<T>[], date: Date) => void;
|
|
300
|
-
/**
|
|
322
|
+
/**
|
|
323
|
+
* Tap empty space; receives the date+time pressed on the week/day grid, or the
|
|
324
|
+
* tapped day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
325
|
+
*/
|
|
301
326
|
onPressCell?: (date: Date) => void;
|
|
302
327
|
/** After an empty-cell press, snap the pager back to the active page. Default false. */
|
|
303
328
|
resetPageOnPressCell?: boolean;
|
|
304
329
|
/** Long-press empty space on the week/day grid; receives the date+time. */
|
|
305
330
|
onLongPressCell?: (date: Date) => void;
|
|
306
331
|
/**
|
|
307
|
-
* Enable drag-to-create
|
|
308
|
-
*
|
|
309
|
-
* `
|
|
310
|
-
*
|
|
311
|
-
* `
|
|
332
|
+
* Enable drag-to-create: long-press empty space and drag to sweep out a new
|
|
333
|
+
* event, then release. On the week/day grid that is a time range snapped to
|
|
334
|
+
* `dragStepMinutes` (a stationary press yields a one-step range); in `month`
|
|
335
|
+
* mode it is an **all-day** span across the days swept — `start` at midnight of
|
|
336
|
+
* the first day, `end` at midnight after the last. Create your own event in
|
|
337
|
+
* response. Supersedes `onLongPressCell` (and, in month mode, `onLongPressDay`)
|
|
338
|
+
* on empty space when set.
|
|
312
339
|
*/
|
|
313
340
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
341
|
+
/**
|
|
342
|
+
* Month and year modes: reports a create sweep's day span as it happens, as the
|
|
343
|
+
* ordered inclusive `[start, end]` days, so a selection highlight can follow the
|
|
344
|
+
* drag. Pair it with `useDateRange`'s `selectRange` to drive `selectedRange`.
|
|
345
|
+
* Enables the sweep on its own, so it works without `onCreateEvent`.
|
|
346
|
+
*/
|
|
347
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
348
|
+
/** Days drawn as selected (a filled badge) in month and year modes. */
|
|
349
|
+
selectedDates?: Date[];
|
|
350
|
+
/** A selected span: endpoints get a filled badge, the span gets the range band. */
|
|
351
|
+
selectedRange?: DateRange$1;
|
|
352
|
+
/**
|
|
353
|
+
* Fill the whole month cell with the range band instead of the default centered
|
|
354
|
+
* rounded "pill" strip. Default false.
|
|
355
|
+
*/
|
|
356
|
+
fillCellOnSelection?: boolean;
|
|
357
|
+
/** Earliest selectable day (inclusive); earlier days render disabled. */
|
|
358
|
+
minDate?: Date;
|
|
359
|
+
/** Latest selectable day (inclusive); later days render disabled. */
|
|
360
|
+
maxDate?: Date;
|
|
361
|
+
/** Return true to render a specific day disabled (dimmed, taps ignored). */
|
|
362
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
314
363
|
/** Tap a day's column header on the week/day grid (default header only). */
|
|
315
364
|
onPressDateHeader?: (date: Date) => void;
|
|
316
365
|
/**
|
|
@@ -409,6 +458,11 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
409
458
|
hourComponent?: HourRenderer;
|
|
410
459
|
/** Always render six week rows in month view, for a fixed-height grid. Default false. */
|
|
411
460
|
showSixWeeks?: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* Render the built-in "MMMM yyyy" title above the month grid. Default true. Set
|
|
463
|
+
* false when your own header already shows the month and year. Month mode only.
|
|
464
|
+
*/
|
|
465
|
+
showTitle?: boolean;
|
|
412
466
|
/** Allow swiping between pages (all modes). Default true. */
|
|
413
467
|
swipeEnabled?: boolean;
|
|
414
468
|
/** Show the vertical scroll indicator on the week/day grid. Default true. */
|
|
@@ -494,7 +548,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
494
548
|
* }
|
|
495
549
|
* ```
|
|
496
550
|
*/
|
|
497
|
-
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
551
|
+
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
498
552
|
//#endregion
|
|
499
553
|
//#region src/components/DefaultEvent.d.ts
|
|
500
554
|
/**
|