@super-calendar/native 2.8.1 → 2.9.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 +1 -0
- package/dist/{DefaultMonthEvent-CjwX3Nt1.d.ts → DefaultMonthEvent--9Jg6w-x.d.ts} +98 -10
- package/dist/{DefaultMonthEvent-VgJarTO_.d.mts → DefaultMonthEvent-BlnKHaq2.d.mts} +98 -10
- 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 +85 -37
- package/dist/index.d.ts +85 -37
- package/dist/index.js +377 -60
- package/dist/index.mjs +378 -61
- 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/Agenda.tsx +3 -3
- package/src/components/AllDayLane.tsx +2 -2
- package/src/components/Calendar.tsx +79 -16
- package/src/components/MonthList.tsx +3 -2
- package/src/components/MonthPager.tsx +152 -63
- package/src/components/MonthView.tsx +422 -80
- package/src/components/TimeGrid.tsx +247 -35
- package/src/components/YearView.tsx +371 -83
- package/src/types.ts +19 -0
- package/src/utils/slots.ts +33 -9
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ The React Native renderer for [super-calendar](https://github.com/afonsojramos/s
|
|
|
6
6
|
|
|
7
7
|
- 📆 Month grid plus day / 3-day / week / custom-N time grids and an agenda
|
|
8
8
|
- 🤏 Pinch-to-zoom week/day grid (UI thread, no re-renders)
|
|
9
|
+
- ✋ Drag to select, create, and move: by time on the week/day grid, by whole days on the month and year grids
|
|
9
10
|
- ♾️ Virtualized, snap-paging views via [`@legendapp/list`](https://legendapp.com/open-source/list/)
|
|
10
11
|
- 🧩 Bring-your-own event type (`CalendarEvent<T>`) and a `renderEvent` escape hatch
|
|
11
12
|
- 🪝 Headless `useMonthGrid` and `useDateRange` for fully custom UIs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
-
import { AccessibilityActionEvent, AccessibilityActionInfo, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
4
4
|
import { SharedValue } from "react-native-reanimated";
|
|
5
5
|
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
6
6
|
//#region src/theme.d.ts
|
|
@@ -111,6 +111,19 @@ declare const CalendarThemeProvider: import("react").Provider<CalendarTheme>;
|
|
|
111
111
|
declare const useCalendarTheme: () => CalendarTheme;
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/types.d.ts
|
|
114
|
+
/**
|
|
115
|
+
* Called when an event is dragged (moved or resized) to new start/end times.
|
|
116
|
+
* Return `false` to reject the drop — the event snaps back to where it started
|
|
117
|
+
* (e.g. to forbid overlaps or out-of-bounds slots). Any other return accepts it.
|
|
118
|
+
*/
|
|
119
|
+
type EventDragHandler<T> = (event: CalendarEvent<T>, start: Date, end: Date) => void | boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Called when a move or resize gesture begins, before any change is committed:
|
|
122
|
+
* on grab for a move (after the long-press), and when the resize drag starts.
|
|
123
|
+
* Handy for haptic feedback (e.g. `expo-haptics`). Requires drag to be enabled
|
|
124
|
+
* via `onDragEvent`.
|
|
125
|
+
*/
|
|
126
|
+
type EventDragStartHandler<T> = (event: CalendarEvent<T>) => void;
|
|
114
127
|
/**
|
|
115
128
|
* Props passed to a {@link RenderEvent} component for one event. Carries the
|
|
116
129
|
* event, the current mode, press handlers, and built-in renderer hints such as
|
|
@@ -173,6 +186,15 @@ type RenderEventArgs<T = unknown> = {
|
|
|
173
186
|
type RenderEvent<T = unknown> = ComponentType<RenderEventArgs<T>>;
|
|
174
187
|
//#endregion
|
|
175
188
|
//#region src/utils/slots.d.ts
|
|
189
|
+
/**
|
|
190
|
+
* The style shapes a slot can resolve to. A slot carries the style type of the
|
|
191
|
+
* element it is spread on, because React Native's style types stop being
|
|
192
|
+
* mutually assignable as soon as a consumer's types diverge them: Expo's
|
|
193
|
+
* react-native-web types widen `cursor` on `TextStyle` and `userSelect` on
|
|
194
|
+
* `ViewStyle`, so a `View` slot typed as `TextStyle` fails to compile in any
|
|
195
|
+
* Expo app.
|
|
196
|
+
*/
|
|
197
|
+
type SlotStyle = ViewStyle | TextStyle | ImageStyle;
|
|
176
198
|
/**
|
|
177
199
|
* Per-slot styling overrides. Give a slot a Tailwind class (uniwind/NativeWind)
|
|
178
200
|
* and/or a style override; missing slots keep the built-in look.
|
|
@@ -186,18 +208,18 @@ interface SlotStyleProps<Slot extends string> {
|
|
|
186
208
|
*/
|
|
187
209
|
classNames?: Partial<Record<Slot, string>>;
|
|
188
210
|
/** Style overrides per slot, merged last (win over defaults and classes). */
|
|
189
|
-
styles?: Partial<Record<Slot, StyleProp<
|
|
211
|
+
styles?: Partial<Record<Slot, StyleProp<SlotStyle>>>;
|
|
190
212
|
}
|
|
191
213
|
/** A slot's built-in styling, split so classes can replace the look but not the layout. */
|
|
192
|
-
interface SlotDefault {
|
|
214
|
+
interface SlotDefault<Style extends SlotStyle = ViewStyle> {
|
|
193
215
|
/** Structural styles kept even when a class is supplied. */
|
|
194
|
-
base?: StyleProp<
|
|
216
|
+
base?: StyleProp<Style>;
|
|
195
217
|
/** Themed styles (colour, type, spacing) dropped when a class is supplied. */
|
|
196
|
-
themed?: StyleProp<
|
|
218
|
+
themed?: StyleProp<Style>;
|
|
197
219
|
}
|
|
198
220
|
/** The props a resolved slot spreads onto an element. */
|
|
199
|
-
interface ResolvedSlot {
|
|
200
|
-
style: StyleProp<
|
|
221
|
+
interface ResolvedSlot<Style extends SlotStyle = ViewStyle> {
|
|
222
|
+
style: StyleProp<Style>;
|
|
201
223
|
className?: string;
|
|
202
224
|
}
|
|
203
225
|
//#endregion
|
|
@@ -280,16 +302,54 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
280
302
|
keyExtractor: EventKeyExtractor<T>;
|
|
281
303
|
onPressDay?: (date: Date) => void;
|
|
282
304
|
onLongPressDay?: (date: Date) => void;
|
|
305
|
+
/**
|
|
306
|
+
* Tap an empty day cell. Fires alongside `onPressDay` with the same day at
|
|
307
|
+
* midnight, so one handler can create events across month and week/day modes.
|
|
308
|
+
*/
|
|
309
|
+
onPressCell?: (date: Date) => void;
|
|
283
310
|
onPressEvent: (event: CalendarEvent$1<T>) => void;
|
|
284
311
|
onLongPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
285
312
|
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
313
|
+
/**
|
|
314
|
+
* Enable drag-to-create: **long-press an empty day** and sweep across others
|
|
315
|
+
* (**press and drag** on the web), then release to fire this with the **all-day**
|
|
316
|
+
* range — `start` at midnight of the first day, `end` at midnight after the last
|
|
317
|
+
* (exclusive). A sweep that never leaves its day still yields that one day. A
|
|
318
|
+
* plain tap fires `onPressDay`/`onPressCell` instead.
|
|
319
|
+
*/
|
|
320
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
321
|
+
/**
|
|
322
|
+
* Reports the day span of a create sweep **as it happens**, as the ordered
|
|
323
|
+
* inclusive `[start, end]` days (both at midnight), so a selection highlight can
|
|
324
|
+
* follow the drag instead of appearing only on release. Pair it with
|
|
325
|
+
* `useDateRange`'s `selectRange` to drive `selectedRange`. Enables the sweep on
|
|
326
|
+
* its own, so it works without `onCreateEvent`.
|
|
327
|
+
*/
|
|
328
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
329
|
+
/**
|
|
330
|
+
* Enable drag-to-reschedule: **long-press an event bar** and drag it onto
|
|
331
|
+
* another day (**press and drag** on the web). Called on release with the event
|
|
332
|
+
* and its new `start`/`end`, both shifted by the whole days dragged, so the time
|
|
333
|
+
* of day and duration are preserved. Return `false` to reject the drop. Update
|
|
334
|
+
* your own event state in response.
|
|
335
|
+
*/
|
|
336
|
+
onDragEvent?: EventDragHandler<T>;
|
|
337
|
+
/**
|
|
338
|
+
* Fired the instant an event is picked up for a month drag, before anything is
|
|
339
|
+
* committed. Use it for haptic feedback. Inert unless `onDragEvent` is also set.
|
|
340
|
+
*/
|
|
341
|
+
onDragStart?: EventDragStartHandler<T>;
|
|
342
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
343
|
+
eventStartEditable?: boolean;
|
|
344
|
+
/** Reject a drop that would overlap another event (default true = allowed). */
|
|
345
|
+
eventOverlap?: boolean;
|
|
286
346
|
/**
|
|
287
347
|
* Replace the default date badge in each day cell. Receives the day; return
|
|
288
348
|
* your own date label. Event chips and the "+N more" label still render below.
|
|
289
349
|
*/
|
|
290
350
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
291
351
|
};
|
|
292
|
-
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
352
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressCell, onPressEvent, onLongPressEvent, onPressMore, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
293
353
|
/**
|
|
294
354
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
295
355
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -330,20 +390,48 @@ type MonthPagerProps<T> = {
|
|
|
330
390
|
keyExtractor: EventKeyExtractor<T>;
|
|
331
391
|
onPressDay?: (date: Date) => void;
|
|
332
392
|
onLongPressDay?: (date: Date) => void;
|
|
393
|
+
/** Tap an empty day cell; receives the day at midnight. */
|
|
394
|
+
onPressCell?: (date: Date) => void;
|
|
333
395
|
onPressEvent: (event: CalendarEvent$1<T>) => void;
|
|
334
396
|
onLongPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
335
397
|
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
398
|
+
/** Drag across empty day cells to sweep out an all-day span for a new event. */
|
|
399
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
400
|
+
/** Drag-to-select: reports the swept `[start, end]` days live. */
|
|
401
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
402
|
+
/** Days drawn as selected (a filled badge). */
|
|
403
|
+
selectedDates?: Date[];
|
|
404
|
+
/** A selected span: endpoints get a filled badge, the span gets the range band. */
|
|
405
|
+
selectedRange?: DateRange;
|
|
406
|
+
/** Fill the whole cell on selection instead of the default rounded pill band. */
|
|
407
|
+
fillCellOnSelection?: boolean;
|
|
408
|
+
/** Earliest selectable day (inclusive); earlier days render disabled. */
|
|
409
|
+
minDate?: Date;
|
|
410
|
+
/** Latest selectable day (inclusive); later days render disabled. */
|
|
411
|
+
maxDate?: Date;
|
|
412
|
+
/** Return true to render a specific day disabled (dimmed, taps ignored). */
|
|
413
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
414
|
+
/** Drag an event bar onto another day to reschedule it. */
|
|
415
|
+
onDragEvent?: EventDragHandler<T>;
|
|
416
|
+
/** Fired when a month drag picks an event up, before anything is committed. */
|
|
417
|
+
onDragStart?: EventDragStartHandler<T>;
|
|
418
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
419
|
+
eventStartEditable?: boolean;
|
|
420
|
+
/** Reject a drop that would overlap another event (default true = allowed). */
|
|
421
|
+
eventOverlap?: boolean;
|
|
336
422
|
onChangeDate: (date: Date) => void;
|
|
337
423
|
freeSwipe?: boolean;
|
|
338
424
|
swipeEnabled?: boolean;
|
|
339
425
|
showSixWeeks?: boolean;
|
|
426
|
+
/** Render the "MMMM yyyy" title above the weekday header. Default true. */
|
|
427
|
+
showTitle?: boolean;
|
|
340
428
|
activeDate?: Date;
|
|
341
429
|
/** Replace the weekday-label header above the month grid. Receives the week's days. */
|
|
342
430
|
renderHeaderForMonthView?: (weekDays: Date[]) => React.ReactNode;
|
|
343
431
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
344
432
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
345
433
|
} & SlotStyleProps<MonthViewSlot>;
|
|
346
|
-
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
434
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressCell, onPressEvent, onLongPressEvent, onPressMore, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onDragEvent, onDragStart, eventStartEditable, eventOverlap, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, showTitle, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
347
435
|
/**
|
|
348
436
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
349
437
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -463,4 +551,4 @@ declare const MonthList: typeof MonthListInner;
|
|
|
463
551
|
*/
|
|
464
552
|
declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
|
|
465
553
|
//#endregion
|
|
466
|
-
export {
|
|
554
|
+
export { CalendarTheme as A, RecurrenceFrequency as C, TimeGridMode as D, RenderEventArgs as E, mergeTheme as F, useCalendarTheme as I, PartialCalendarTheme as M, darkTheme as N, WeekStartsOn as O, defaultTheme as P, ICalendarEvent as S, RenderEvent as T, EventAccessibilityLabelContext as _, MonthPager as a, EventDragStartHandler as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarMode$1 as g, CalendarEvent$1 as h, MonthListSlot as i, CalendarThemeProvider as j, WeekdayFormat$1 as k, MonthViewSlot as l, BusinessHoursBand$1 as m, MonthList as n, MonthPagerProps as o, BusinessHours as p, MonthListProps as r, MonthView as s, DefaultMonthEvent as t, ResolvedSlot as u, EventAccessibilityLabeler$1 as v, RecurrenceRule as w, EventKeyExtractor as x, EventDragHandler as y };
|
|
@@ -2,7 +2,7 @@ import { Locale } from "date-fns";
|
|
|
2
2
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
3
|
import { SharedValue } from "react-native-reanimated";
|
|
4
4
|
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
5
|
-
import { AccessibilityActionEvent, AccessibilityActionInfo, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
5
|
+
import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
6
6
|
//#region src/theme.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* The full set of colours, text styles and metrics the calendar paints with.
|
|
@@ -111,6 +111,19 @@ declare const CalendarThemeProvider: import("react").Provider<CalendarTheme>;
|
|
|
111
111
|
declare const useCalendarTheme: () => CalendarTheme;
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/types.d.ts
|
|
114
|
+
/**
|
|
115
|
+
* Called when an event is dragged (moved or resized) to new start/end times.
|
|
116
|
+
* Return `false` to reject the drop — the event snaps back to where it started
|
|
117
|
+
* (e.g. to forbid overlaps or out-of-bounds slots). Any other return accepts it.
|
|
118
|
+
*/
|
|
119
|
+
type EventDragHandler<T> = (event: CalendarEvent<T>, start: Date, end: Date) => void | boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Called when a move or resize gesture begins, before any change is committed:
|
|
122
|
+
* on grab for a move (after the long-press), and when the resize drag starts.
|
|
123
|
+
* Handy for haptic feedback (e.g. `expo-haptics`). Requires drag to be enabled
|
|
124
|
+
* via `onDragEvent`.
|
|
125
|
+
*/
|
|
126
|
+
type EventDragStartHandler<T> = (event: CalendarEvent<T>) => void;
|
|
114
127
|
/**
|
|
115
128
|
* Props passed to a {@link RenderEvent} component for one event. Carries the
|
|
116
129
|
* event, the current mode, press handlers, and built-in renderer hints such as
|
|
@@ -173,6 +186,15 @@ type RenderEventArgs<T = unknown> = {
|
|
|
173
186
|
type RenderEvent<T = unknown> = ComponentType<RenderEventArgs<T>>;
|
|
174
187
|
//#endregion
|
|
175
188
|
//#region src/utils/slots.d.ts
|
|
189
|
+
/**
|
|
190
|
+
* The style shapes a slot can resolve to. A slot carries the style type of the
|
|
191
|
+
* element it is spread on, because React Native's style types stop being
|
|
192
|
+
* mutually assignable as soon as a consumer's types diverge them: Expo's
|
|
193
|
+
* react-native-web types widen `cursor` on `TextStyle` and `userSelect` on
|
|
194
|
+
* `ViewStyle`, so a `View` slot typed as `TextStyle` fails to compile in any
|
|
195
|
+
* Expo app.
|
|
196
|
+
*/
|
|
197
|
+
type SlotStyle = ViewStyle | TextStyle | ImageStyle;
|
|
176
198
|
/**
|
|
177
199
|
* Per-slot styling overrides. Give a slot a Tailwind class (uniwind/NativeWind)
|
|
178
200
|
* and/or a style override; missing slots keep the built-in look.
|
|
@@ -186,18 +208,18 @@ interface SlotStyleProps<Slot extends string> {
|
|
|
186
208
|
*/
|
|
187
209
|
classNames?: Partial<Record<Slot, string>>;
|
|
188
210
|
/** Style overrides per slot, merged last (win over defaults and classes). */
|
|
189
|
-
styles?: Partial<Record<Slot, StyleProp<
|
|
211
|
+
styles?: Partial<Record<Slot, StyleProp<SlotStyle>>>;
|
|
190
212
|
}
|
|
191
213
|
/** A slot's built-in styling, split so classes can replace the look but not the layout. */
|
|
192
|
-
interface SlotDefault {
|
|
214
|
+
interface SlotDefault<Style extends SlotStyle = ViewStyle> {
|
|
193
215
|
/** Structural styles kept even when a class is supplied. */
|
|
194
|
-
base?: StyleProp<
|
|
216
|
+
base?: StyleProp<Style>;
|
|
195
217
|
/** Themed styles (colour, type, spacing) dropped when a class is supplied. */
|
|
196
|
-
themed?: StyleProp<
|
|
218
|
+
themed?: StyleProp<Style>;
|
|
197
219
|
}
|
|
198
220
|
/** The props a resolved slot spreads onto an element. */
|
|
199
|
-
interface ResolvedSlot {
|
|
200
|
-
style: StyleProp<
|
|
221
|
+
interface ResolvedSlot<Style extends SlotStyle = ViewStyle> {
|
|
222
|
+
style: StyleProp<Style>;
|
|
201
223
|
className?: string;
|
|
202
224
|
}
|
|
203
225
|
//#endregion
|
|
@@ -280,16 +302,54 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
280
302
|
keyExtractor: EventKeyExtractor<T>;
|
|
281
303
|
onPressDay?: (date: Date) => void;
|
|
282
304
|
onLongPressDay?: (date: Date) => void;
|
|
305
|
+
/**
|
|
306
|
+
* Tap an empty day cell. Fires alongside `onPressDay` with the same day at
|
|
307
|
+
* midnight, so one handler can create events across month and week/day modes.
|
|
308
|
+
*/
|
|
309
|
+
onPressCell?: (date: Date) => void;
|
|
283
310
|
onPressEvent: (event: CalendarEvent$1<T>) => void;
|
|
284
311
|
onLongPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
285
312
|
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
313
|
+
/**
|
|
314
|
+
* Enable drag-to-create: **long-press an empty day** and sweep across others
|
|
315
|
+
* (**press and drag** on the web), then release to fire this with the **all-day**
|
|
316
|
+
* range — `start` at midnight of the first day, `end` at midnight after the last
|
|
317
|
+
* (exclusive). A sweep that never leaves its day still yields that one day. A
|
|
318
|
+
* plain tap fires `onPressDay`/`onPressCell` instead.
|
|
319
|
+
*/
|
|
320
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
321
|
+
/**
|
|
322
|
+
* Reports the day span of a create sweep **as it happens**, as the ordered
|
|
323
|
+
* inclusive `[start, end]` days (both at midnight), so a selection highlight can
|
|
324
|
+
* follow the drag instead of appearing only on release. Pair it with
|
|
325
|
+
* `useDateRange`'s `selectRange` to drive `selectedRange`. Enables the sweep on
|
|
326
|
+
* its own, so it works without `onCreateEvent`.
|
|
327
|
+
*/
|
|
328
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
329
|
+
/**
|
|
330
|
+
* Enable drag-to-reschedule: **long-press an event bar** and drag it onto
|
|
331
|
+
* another day (**press and drag** on the web). Called on release with the event
|
|
332
|
+
* and its new `start`/`end`, both shifted by the whole days dragged, so the time
|
|
333
|
+
* of day and duration are preserved. Return `false` to reject the drop. Update
|
|
334
|
+
* your own event state in response.
|
|
335
|
+
*/
|
|
336
|
+
onDragEvent?: EventDragHandler<T>;
|
|
337
|
+
/**
|
|
338
|
+
* Fired the instant an event is picked up for a month drag, before anything is
|
|
339
|
+
* committed. Use it for haptic feedback. Inert unless `onDragEvent` is also set.
|
|
340
|
+
*/
|
|
341
|
+
onDragStart?: EventDragStartHandler<T>;
|
|
342
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
343
|
+
eventStartEditable?: boolean;
|
|
344
|
+
/** Reject a drop that would overlap another event (default true = allowed). */
|
|
345
|
+
eventOverlap?: boolean;
|
|
286
346
|
/**
|
|
287
347
|
* Replace the default date badge in each day cell. Receives the day; return
|
|
288
348
|
* your own date label. Event chips and the "+N more" label still render below.
|
|
289
349
|
*/
|
|
290
350
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
291
351
|
};
|
|
292
|
-
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
352
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressCell, onPressEvent, onLongPressEvent, onPressMore, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
293
353
|
/**
|
|
294
354
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
295
355
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -330,20 +390,48 @@ type MonthPagerProps<T> = {
|
|
|
330
390
|
keyExtractor: EventKeyExtractor<T>;
|
|
331
391
|
onPressDay?: (date: Date) => void;
|
|
332
392
|
onLongPressDay?: (date: Date) => void;
|
|
393
|
+
/** Tap an empty day cell; receives the day at midnight. */
|
|
394
|
+
onPressCell?: (date: Date) => void;
|
|
333
395
|
onPressEvent: (event: CalendarEvent$1<T>) => void;
|
|
334
396
|
onLongPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
335
397
|
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
398
|
+
/** Drag across empty day cells to sweep out an all-day span for a new event. */
|
|
399
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
400
|
+
/** Drag-to-select: reports the swept `[start, end]` days live. */
|
|
401
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
402
|
+
/** Days drawn as selected (a filled badge). */
|
|
403
|
+
selectedDates?: Date[];
|
|
404
|
+
/** A selected span: endpoints get a filled badge, the span gets the range band. */
|
|
405
|
+
selectedRange?: DateRange;
|
|
406
|
+
/** Fill the whole cell on selection instead of the default rounded pill band. */
|
|
407
|
+
fillCellOnSelection?: boolean;
|
|
408
|
+
/** Earliest selectable day (inclusive); earlier days render disabled. */
|
|
409
|
+
minDate?: Date;
|
|
410
|
+
/** Latest selectable day (inclusive); later days render disabled. */
|
|
411
|
+
maxDate?: Date;
|
|
412
|
+
/** Return true to render a specific day disabled (dimmed, taps ignored). */
|
|
413
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
414
|
+
/** Drag an event bar onto another day to reschedule it. */
|
|
415
|
+
onDragEvent?: EventDragHandler<T>;
|
|
416
|
+
/** Fired when a month drag picks an event up, before anything is committed. */
|
|
417
|
+
onDragStart?: EventDragStartHandler<T>;
|
|
418
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
419
|
+
eventStartEditable?: boolean;
|
|
420
|
+
/** Reject a drop that would overlap another event (default true = allowed). */
|
|
421
|
+
eventOverlap?: boolean;
|
|
336
422
|
onChangeDate: (date: Date) => void;
|
|
337
423
|
freeSwipe?: boolean;
|
|
338
424
|
swipeEnabled?: boolean;
|
|
339
425
|
showSixWeeks?: boolean;
|
|
426
|
+
/** Render the "MMMM yyyy" title above the weekday header. Default true. */
|
|
427
|
+
showTitle?: boolean;
|
|
340
428
|
activeDate?: Date;
|
|
341
429
|
/** Replace the weekday-label header above the month grid. Receives the week's days. */
|
|
342
430
|
renderHeaderForMonthView?: (weekDays: Date[]) => React.ReactNode;
|
|
343
431
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
344
432
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
345
433
|
} & SlotStyleProps<MonthViewSlot>;
|
|
346
|
-
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
434
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressCell, onPressEvent, onLongPressEvent, onPressMore, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onDragEvent, onDragStart, eventStartEditable, eventOverlap, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, showTitle, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
347
435
|
/**
|
|
348
436
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
349
437
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -463,4 +551,4 @@ declare const MonthList: typeof MonthListInner;
|
|
|
463
551
|
*/
|
|
464
552
|
declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
|
|
465
553
|
//#endregion
|
|
466
|
-
export {
|
|
554
|
+
export { CalendarTheme as A, RecurrenceFrequency as C, TimeGridMode as D, RenderEventArgs as E, mergeTheme as F, useCalendarTheme as I, PartialCalendarTheme as M, darkTheme as N, WeekStartsOn as O, defaultTheme as P, ICalendarEvent as S, RenderEvent as T, EventAccessibilityLabelContext as _, MonthPager as a, EventDragStartHandler as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarMode$1 as g, CalendarEvent$1 as h, MonthListSlot as i, CalendarThemeProvider as j, WeekdayFormat$1 as k, MonthViewSlot as l, BusinessHoursBand$1 as m, MonthList as n, MonthPagerProps as o, BusinessHours as p, MonthListProps as r, MonthView as s, DefaultMonthEvent as t, ResolvedSlot as u, EventAccessibilityLabeler$1 as v, RecurrenceRule as w, EventKeyExtractor as x, EventDragHandler as y };
|