@super-calendar/native 2.16.0 → 2.17.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 +39 -0
- package/dist/{DefaultMonthEvent-ClIxUp__.d.ts → DefaultMonthEvent-C3C30hfV.d.mts} +8 -8
- package/dist/{DefaultMonthEvent-No5YhOcV.d.mts → DefaultMonthEvent-Dx3lD7ig.d.ts} +8 -8
- package/dist/{MonthList-Dmp8JXvj.js → MonthList-B2TSGYp7.js} +400 -91
- package/dist/{MonthList-D97JhM4F.mjs → MonthList-N1GVDIE4.mjs} +391 -94
- package/dist/index.d.mts +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +68 -11
- package/dist/index.mjs +63 -13
- 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 +74 -9
- package/src/components/MonthPager.tsx +175 -20
- package/src/components/MonthView.tsx +332 -116
- package/src/components/MultiWeekView.tsx +34 -0
- package/src/index.tsx +7 -0
- package/src/utils/holdWebDateDrag.ts +63 -0
package/README.md
CHANGED
|
@@ -63,6 +63,45 @@ export function MyCalendar() {
|
|
|
63
63
|
}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
## Multi-week grids
|
|
67
|
+
|
|
68
|
+
Use `mode="multiweek"` with `numberOfWeeks` (default `2`) for consecutive full
|
|
69
|
+
week rows without hourly slots. The first week contains `date` and aligns to
|
|
70
|
+
`weekStartsOn`. Navigation moves by the full number of weeks. `hiddenDays` only
|
|
71
|
+
shortens rows; `custom` views remain hourly even above seven columns.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { useState } from "react";
|
|
75
|
+
import { Calendar } from "@super-calendar/native";
|
|
76
|
+
|
|
77
|
+
export function MultiWeekCalendar() {
|
|
78
|
+
const [date, setDate] = useState(new Date(2026, 11, 28));
|
|
79
|
+
return (
|
|
80
|
+
<Calendar
|
|
81
|
+
mode="multiweek"
|
|
82
|
+
numberOfWeeks={3}
|
|
83
|
+
weekStartsOn={1}
|
|
84
|
+
date={date}
|
|
85
|
+
onChangeDate={setDate}
|
|
86
|
+
events={[]}
|
|
87
|
+
onPressEvent={(event) => console.log(event.title)}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`MultiWeekView` exposes a standalone window with the month grid's event bars,
|
|
94
|
+
overflow, selection, drag interactions, and styling. Pass expanded events to it;
|
|
95
|
+
`Calendar` handles recurrence and time zones. Custom event renderers receive
|
|
96
|
+
`mode: "multiweek"`. Rows scroll vertically when the container is too short.
|
|
97
|
+
Counts must be positive safe integers whose date span is representable; invalid
|
|
98
|
+
counts or dates throw `RangeError`. Rows are materialized, so larger counts need
|
|
99
|
+
more space. `MonthView` and `MonthPager` retain their month-only behavior.
|
|
100
|
+
|
|
101
|
+
Keep `events` stable during unrelated UI updates. With recurrence or `timeZone`,
|
|
102
|
+
replacing the array rebuilds displayed events and cancels a held move on web. See
|
|
103
|
+
[keep event data stable](https://super-calendar.afonsojramos.me/guides/events#keep-event-data-stable).
|
|
104
|
+
|
|
66
105
|
## Moving events
|
|
67
106
|
|
|
68
107
|
Pass `onDragEvent` and update your event state with the returned `start` and `end`.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
-
import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
4
3
|
import { SharedValue } from "react-native-reanimated";
|
|
5
|
-
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs as CreateGhostArgs$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
4
|
+
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs as CreateGhostArgs$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
5
|
+
import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
6
6
|
/**
|
|
7
7
|
* The full set of colours, text styles and metrics the calendar paints with.
|
|
8
8
|
* Supply a `Partial<CalendarTheme>` to `<Calendar theme={...} />`; missing keys
|
|
@@ -242,7 +242,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
242
242
|
chipHeight?: number;
|
|
243
243
|
/** Vertical gap between chip rows in pixels (default 2). */
|
|
244
244
|
chipGap?: number;
|
|
245
|
-
weekStartsOn: WeekStartsOn;
|
|
245
|
+
weekStartsOn: WeekStartsOn$1;
|
|
246
246
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
247
247
|
hiddenDays?: number[];
|
|
248
248
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
@@ -348,7 +348,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
348
348
|
*/
|
|
349
349
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
350
350
|
};
|
|
351
|
-
declare function MonthViewInner<T>({ date,
|
|
351
|
+
declare function MonthViewInner<T>({ date, showAdjacentMonths, showSixWeeks, ...rest }: MonthViewProps<T>): ReactElement;
|
|
352
352
|
/**
|
|
353
353
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
354
354
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -375,7 +375,7 @@ type MonthPagerProps<T> = {
|
|
|
375
375
|
chipHeight?: number;
|
|
376
376
|
/** Gap between month chip rows in pixels (default 2). */
|
|
377
377
|
chipGap?: number;
|
|
378
|
-
weekStartsOn: WeekStartsOn;
|
|
378
|
+
weekStartsOn: WeekStartsOn$1;
|
|
379
379
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
380
380
|
hiddenDays?: number[];
|
|
381
381
|
weekdayFormat?: WeekdayFormat;
|
|
@@ -434,7 +434,7 @@ type MonthPagerProps<T> = {
|
|
|
434
434
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
435
435
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
436
436
|
} & SlotStyleProps<MonthViewSlot>;
|
|
437
|
-
declare function MonthPagerInner<T>({
|
|
437
|
+
declare function MonthPagerInner<T>({ showAdjacentMonths, showSixWeeks, ...rest }: MonthPagerProps<T>): ReactElement;
|
|
438
438
|
/**
|
|
439
439
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
440
440
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -462,7 +462,7 @@ type MonthListProps<T> = {
|
|
|
462
462
|
date: Date;
|
|
463
463
|
/** Events to render in the grids. Omit for an events-free date picker. */
|
|
464
464
|
events?: CalendarEvent$1<T>[];
|
|
465
|
-
weekStartsOn: WeekStartsOn;
|
|
465
|
+
weekStartsOn: WeekStartsOn$1;
|
|
466
466
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
467
467
|
weekdayFormat?: WeekdayFormat;
|
|
468
468
|
/**
|
|
@@ -555,4 +555,4 @@ declare const MonthList: typeof MonthListInner;
|
|
|
555
555
|
* Reanimated.
|
|
556
556
|
*/
|
|
557
557
|
declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
|
|
558
|
-
export { TimeGridMode as A, EventKeyExtractor as C, RenderEvent as D, RecurrenceRule as E, PartialCalendarTheme as F, darkTheme as I, defaultTheme as L, WeekdayFormat$1 as M, CalendarTheme as N, RenderEventArgs as O, CalendarThemeProvider as P, mergeTheme as R, EventDragStartHandler as S, RecurrenceFrequency as T, CalendarMode$1 as _, MonthPager as a, EventAccessibilityLabeler$1 as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, WeekStartsOn as j, ScrollToTimeOptions 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, CreateGhostArgs$1 as v, ICalendarEvent as w, EventDragHandler as x, EventAccessibilityLabelContext as y, useCalendarTheme as z };
|
|
558
|
+
export { TimeGridMode as A, EventKeyExtractor as C, RenderEvent as D, RecurrenceRule as E, PartialCalendarTheme as F, darkTheme as I, defaultTheme as L, WeekdayFormat$1 as M, CalendarTheme as N, RenderEventArgs as O, CalendarThemeProvider as P, mergeTheme as R, EventDragStartHandler as S, RecurrenceFrequency as T, CalendarMode$1 as _, MonthPager as a, EventAccessibilityLabeler$1 as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, WeekStartsOn$1 as j, ScrollToTimeOptions 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, CreateGhostArgs$1 as v, ICalendarEvent as w, EventDragHandler as x, EventAccessibilityLabelContext as y, useCalendarTheme as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
-
import { SharedValue } from "react-native-reanimated";
|
|
4
|
-
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs as CreateGhostArgs$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
5
3
|
import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
4
|
+
import { SharedValue } from "react-native-reanimated";
|
|
5
|
+
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs as CreateGhostArgs$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
6
6
|
/**
|
|
7
7
|
* The full set of colours, text styles and metrics the calendar paints with.
|
|
8
8
|
* Supply a `Partial<CalendarTheme>` to `<Calendar theme={...} />`; missing keys
|
|
@@ -242,7 +242,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
242
242
|
chipHeight?: number;
|
|
243
243
|
/** Vertical gap between chip rows in pixels (default 2). */
|
|
244
244
|
chipGap?: number;
|
|
245
|
-
weekStartsOn: WeekStartsOn;
|
|
245
|
+
weekStartsOn: WeekStartsOn$1;
|
|
246
246
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
247
247
|
hiddenDays?: number[];
|
|
248
248
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
@@ -348,7 +348,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
348
348
|
*/
|
|
349
349
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
350
350
|
};
|
|
351
|
-
declare function MonthViewInner<T>({ date,
|
|
351
|
+
declare function MonthViewInner<T>({ date, showAdjacentMonths, showSixWeeks, ...rest }: MonthViewProps<T>): ReactElement;
|
|
352
352
|
/**
|
|
353
353
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
354
354
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -375,7 +375,7 @@ type MonthPagerProps<T> = {
|
|
|
375
375
|
chipHeight?: number;
|
|
376
376
|
/** Gap between month chip rows in pixels (default 2). */
|
|
377
377
|
chipGap?: number;
|
|
378
|
-
weekStartsOn: WeekStartsOn;
|
|
378
|
+
weekStartsOn: WeekStartsOn$1;
|
|
379
379
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
380
380
|
hiddenDays?: number[];
|
|
381
381
|
weekdayFormat?: WeekdayFormat;
|
|
@@ -434,7 +434,7 @@ type MonthPagerProps<T> = {
|
|
|
434
434
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
435
435
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
436
436
|
} & SlotStyleProps<MonthViewSlot>;
|
|
437
|
-
declare function MonthPagerInner<T>({
|
|
437
|
+
declare function MonthPagerInner<T>({ showAdjacentMonths, showSixWeeks, ...rest }: MonthPagerProps<T>): ReactElement;
|
|
438
438
|
/**
|
|
439
439
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
440
440
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -462,7 +462,7 @@ type MonthListProps<T> = {
|
|
|
462
462
|
date: Date;
|
|
463
463
|
/** Events to render in the grids. Omit for an events-free date picker. */
|
|
464
464
|
events?: CalendarEvent$1<T>[];
|
|
465
|
-
weekStartsOn: WeekStartsOn;
|
|
465
|
+
weekStartsOn: WeekStartsOn$1;
|
|
466
466
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
467
467
|
weekdayFormat?: WeekdayFormat;
|
|
468
468
|
/**
|
|
@@ -555,4 +555,4 @@ declare const MonthList: typeof MonthListInner;
|
|
|
555
555
|
* Reanimated.
|
|
556
556
|
*/
|
|
557
557
|
declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
|
|
558
|
-
export { TimeGridMode as A, EventKeyExtractor as C, RenderEvent as D, RecurrenceRule as E, PartialCalendarTheme as F, darkTheme as I, defaultTheme as L, WeekdayFormat$1 as M, CalendarTheme as N, RenderEventArgs as O, CalendarThemeProvider as P, mergeTheme as R, EventDragStartHandler as S, RecurrenceFrequency as T, CalendarMode$1 as _, MonthPager as a, EventAccessibilityLabeler$1 as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, WeekStartsOn as j, ScrollToTimeOptions 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, CreateGhostArgs$1 as v, ICalendarEvent as w, EventDragHandler as x, EventAccessibilityLabelContext as y, useCalendarTheme as z };
|
|
558
|
+
export { TimeGridMode as A, EventKeyExtractor as C, RenderEvent as D, RecurrenceRule as E, PartialCalendarTheme as F, darkTheme as I, defaultTheme as L, WeekdayFormat$1 as M, CalendarTheme as N, RenderEventArgs as O, CalendarThemeProvider as P, mergeTheme as R, EventDragStartHandler as S, RecurrenceFrequency as T, CalendarMode$1 as _, MonthPager as a, EventAccessibilityLabeler$1 as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, WeekStartsOn$1 as j, ScrollToTimeOptions 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, CreateGhostArgs$1 as v, ICalendarEvent as w, EventDragHandler as x, EventAccessibilityLabelContext as y, useCalendarTheme as z };
|