@super-calendar/native 2.11.0 → 2.12.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 -1
- package/dist/{DefaultMonthEvent--9Jg6w-x.d.ts → DefaultMonthEvent-B9KzVzFa.d.mts} +11 -5
- package/dist/{DefaultMonthEvent-BlnKHaq2.d.mts → DefaultMonthEvent-DlIIWDzr.d.ts} +11 -5
- package/dist/{MonthList-CjKhzOJX.mjs → MonthList-B-UE37ZG.mjs} +166 -139
- package/dist/{MonthList-DNT1LJkk.js → MonthList-sGAZxQZ_.js} +176 -137
- package/dist/index.d.mts +20 -12
- package/dist/index.d.ts +20 -12
- package/dist/index.js +319 -286
- package/dist/index.mjs +314 -287
- 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 +3 -3
- package/src/components/Calendar.tsx +162 -150
- package/src/components/DefaultEvent.tsx +3 -0
- package/src/components/DefaultMonthEvent.tsx +3 -0
- package/src/components/MonthList.tsx +6 -0
- package/src/components/MonthPager.tsx +6 -0
- package/src/components/MonthView.tsx +195 -172
- package/src/components/ResourceTimeline.tsx +18 -7
- package/src/components/TimeGrid.tsx +168 -150
- package/src/components/YearView.tsx +17 -5
- package/src/index.tsx +1 -0
- package/src/utils/labels.ts +13 -0
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ npm install @super-calendar/native
|
|
|
20
20
|
|
|
21
21
|
Also on [JSR](https://jsr.io/@super-calendar/native): `deno add jsr:@super-calendar/native`.
|
|
22
22
|
|
|
23
|
-
Peer dependencies: `@legendapp/list` (>=3), `date-fns` (>=3), `react` (>=19), `react-native` (>=0.
|
|
23
|
+
Peer dependencies: `@legendapp/list` (>=3), `date-fns` (>=3), `react` (>=19), `react-native` (>=0.74 <2), `react-native-gesture-handler` (>=2), `react-native-reanimated` (>=4), and `react-native-worklets` (>=0.8).
|
|
24
24
|
|
|
25
25
|
For a picker-only bundle that does not require Reanimated, import from the `@super-calendar/native/picker` subpath.
|
|
26
26
|
|
|
@@ -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, 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";
|
|
4
|
+
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarLabels, 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, 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.
|
|
@@ -255,6 +255,8 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
255
255
|
sortedMonthView?: boolean;
|
|
256
256
|
/** Template for the overflow label; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
257
257
|
moreLabel?: string;
|
|
258
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
259
|
+
labels?: Partial<CalendarLabels>;
|
|
258
260
|
/** Show dimmed days from adjacent months in the grid. Default true. */
|
|
259
261
|
showAdjacentMonths?: boolean;
|
|
260
262
|
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
@@ -349,7 +351,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
349
351
|
*/
|
|
350
352
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
351
353
|
};
|
|
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;
|
|
354
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, labels: labelsProp, 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;
|
|
353
355
|
/**
|
|
354
356
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
355
357
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -381,6 +383,8 @@ type MonthPagerProps<T> = {
|
|
|
381
383
|
locale?: Locale;
|
|
382
384
|
sortedMonthView?: boolean;
|
|
383
385
|
moreLabel?: string;
|
|
386
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
387
|
+
labels?: Partial<CalendarLabels>;
|
|
384
388
|
showAdjacentMonths?: boolean;
|
|
385
389
|
highlightWeekends?: boolean;
|
|
386
390
|
disableMonthEventCellPress?: boolean;
|
|
@@ -431,7 +435,7 @@ type MonthPagerProps<T> = {
|
|
|
431
435
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
432
436
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
433
437
|
} & SlotStyleProps<MonthViewSlot>;
|
|
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;
|
|
438
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, labels, 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;
|
|
435
439
|
/**
|
|
436
440
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
437
441
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -479,6 +483,8 @@ type MonthListProps<T> = {
|
|
|
479
483
|
locale?: Locale;
|
|
480
484
|
sortedMonthView?: boolean;
|
|
481
485
|
moreLabel?: string;
|
|
486
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
487
|
+
labels?: Partial<CalendarLabels>;
|
|
482
488
|
/** Show dimmed adjacent-month days. Default false (each month shows only its own days). */
|
|
483
489
|
showAdjacentMonths?: boolean;
|
|
484
490
|
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
@@ -520,7 +526,7 @@ type MonthListProps<T> = {
|
|
|
520
526
|
/** Replace the per-month title (default "LLLL yyyy"). */
|
|
521
527
|
renderMonthHeader?: (month: Date) => React.ReactNode;
|
|
522
528
|
} & SlotStyleProps<MonthListSlot>;
|
|
523
|
-
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
|
|
529
|
+
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, labels, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
|
|
524
530
|
/**
|
|
525
531
|
* A vertically scrolling, virtualized list of month grids. It doubles as the
|
|
526
532
|
* date picker: pass `selectedRange`/`selectedDates` and selection handlers to
|
|
@@ -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, 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
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, CalendarLabels, 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
|
|
7
7
|
/**
|
|
8
8
|
* The full set of colours, text styles and metrics the calendar paints with.
|
|
@@ -255,6 +255,8 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
255
255
|
sortedMonthView?: boolean;
|
|
256
256
|
/** Template for the overflow label; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
257
257
|
moreLabel?: string;
|
|
258
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
259
|
+
labels?: Partial<CalendarLabels>;
|
|
258
260
|
/** Show dimmed days from adjacent months in the grid. Default true. */
|
|
259
261
|
showAdjacentMonths?: boolean;
|
|
260
262
|
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
@@ -349,7 +351,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
349
351
|
*/
|
|
350
352
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
351
353
|
};
|
|
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;
|
|
354
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, labels: labelsProp, 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;
|
|
353
355
|
/**
|
|
354
356
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
355
357
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -381,6 +383,8 @@ type MonthPagerProps<T> = {
|
|
|
381
383
|
locale?: Locale;
|
|
382
384
|
sortedMonthView?: boolean;
|
|
383
385
|
moreLabel?: string;
|
|
386
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
387
|
+
labels?: Partial<CalendarLabels>;
|
|
384
388
|
showAdjacentMonths?: boolean;
|
|
385
389
|
highlightWeekends?: boolean;
|
|
386
390
|
disableMonthEventCellPress?: boolean;
|
|
@@ -431,7 +435,7 @@ type MonthPagerProps<T> = {
|
|
|
431
435
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
432
436
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
433
437
|
} & SlotStyleProps<MonthViewSlot>;
|
|
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;
|
|
438
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, labels, 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;
|
|
435
439
|
/**
|
|
436
440
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
437
441
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -479,6 +483,8 @@ type MonthListProps<T> = {
|
|
|
479
483
|
locale?: Locale;
|
|
480
484
|
sortedMonthView?: boolean;
|
|
481
485
|
moreLabel?: string;
|
|
486
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
487
|
+
labels?: Partial<CalendarLabels>;
|
|
482
488
|
/** Show dimmed adjacent-month days. Default false (each month shows only its own days). */
|
|
483
489
|
showAdjacentMonths?: boolean;
|
|
484
490
|
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
@@ -520,7 +526,7 @@ type MonthListProps<T> = {
|
|
|
520
526
|
/** Replace the per-month title (default "LLLL yyyy"). */
|
|
521
527
|
renderMonthHeader?: (month: Date) => React.ReactNode;
|
|
522
528
|
} & SlotStyleProps<MonthListSlot>;
|
|
523
|
-
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
|
|
529
|
+
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, labels, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
|
|
524
530
|
/**
|
|
525
531
|
* A vertically scrolling, virtualized list of month grids. It doubles as the
|
|
526
532
|
* date picker: pass `selectedRange`/`selectedDates` and selection handlers to
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addMonths, differenceInCalendarMonths, format, isSameMonth, startOfDay, startOfMonth } from "date-fns";
|
|
2
2
|
import { createContext, createElement, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { CalendarSelectionProvider, buildMonthWeeks, compareDayEvents, darkColors, dayBadgeKind, daySelectionState, eventAccessibilityLabel, eventTimeLabel, filterHiddenDays, getIsToday, getWeekDays, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isSameCalendarDay, isWeekend, layoutMonthWeek, lightColors, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, overlapsOtherEvents, rangeBandKind, titleEllipsizeMode, titleNumberOfLines, useCalendarSelection, weekdayFormatToken } from "@super-calendar/core";
|
|
3
|
+
import { CalendarSelectionProvider, buildMonthWeeks, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, eventAccessibilityLabel, eventTimeLabel, filterHiddenDays, getIsToday, getWeekDays, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isSameCalendarDay, isWeekend, layoutMonthWeek, lightColors, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, overlapsOtherEvents, rangeBandKind, resolveCalendarLabels, titleEllipsizeMode, titleNumberOfLines, useCalendarSelection, weekdayFormatToken } from "@super-calendar/core";
|
|
4
4
|
import { Modal, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
5
5
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -104,6 +104,16 @@ const CalendarThemeProvider = CalendarThemeContext.Provider;
|
|
|
104
104
|
/** Read the active {@link CalendarTheme} from context. Useful inside custom renderers. */
|
|
105
105
|
const useCalendarTheme = () => useContext(CalendarThemeContext);
|
|
106
106
|
//#endregion
|
|
107
|
+
//#region src/utils/labels.ts
|
|
108
|
+
/**
|
|
109
|
+
* The resolved `labels` of the nearest view, so the built-in event renderers
|
|
110
|
+
* can localize their screen-reader text without a prop on `RenderEventArgs`.
|
|
111
|
+
*/
|
|
112
|
+
const CalendarLabelsContext = createContext(defaultCalendarLabels);
|
|
113
|
+
function useCalendarLabels() {
|
|
114
|
+
return useContext(CalendarLabelsContext);
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
107
117
|
//#region src/utils/slots.ts
|
|
108
118
|
/**
|
|
109
119
|
* Build a slot resolver for one render. `slot(name, defaults)` returns the
|
|
@@ -199,7 +209,6 @@ const DAY_CELL_PADDING_TOP = 4;
|
|
|
199
209
|
const DATE_BADGE_HEIGHT = 24;
|
|
200
210
|
const BAND_CENTER_Y = 16;
|
|
201
211
|
const CELL_ROW_GAP = 2;
|
|
202
|
-
const CHIP_PADDING_V = 2;
|
|
203
212
|
const BADGE_AREA = 30;
|
|
204
213
|
const EMPTY_LAYOUT = {
|
|
205
214
|
segments: [],
|
|
@@ -231,12 +240,13 @@ function isInCreateSpan(drag, day) {
|
|
|
231
240
|
const b = startOfDay(drag.hover).getTime();
|
|
232
241
|
return time >= Math.min(a, b) && time <= Math.max(a, b);
|
|
233
242
|
}
|
|
234
|
-
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = true, highlightWeekends = true, disableMonthEventCellPress = false, isRTL = false, showSixWeeks = false, showTitle = true, showWeekdays = true, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection = false, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressCell, onPressEvent, onLongPressEvent, onPressMore, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable = true, eventOverlap = true, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
|
|
243
|
+
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", labels: labelsProp, showAdjacentMonths = true, highlightWeekends = true, disableMonthEventCellPress = false, isRTL = false, showSixWeeks = false, showTitle = true, showWeekdays = true, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection = false, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressCell, onPressEvent, onLongPressEvent, onPressMore, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable = true, eventOverlap = true, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
|
|
235
244
|
const theme = useCalendarTheme();
|
|
236
245
|
const slot = createSlots({
|
|
237
246
|
classNames,
|
|
238
247
|
styles: styleOverrides
|
|
239
248
|
});
|
|
249
|
+
const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
|
|
240
250
|
const selection = useCalendarSelection();
|
|
241
251
|
const selectedDates = selectedDatesProp ?? selection.selectedDates;
|
|
242
252
|
const selectedRange = selectedRangeProp ?? selection.selectedRange;
|
|
@@ -274,7 +284,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
274
284
|
]);
|
|
275
285
|
const chipMetrics = useMemo(() => {
|
|
276
286
|
const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
|
|
277
|
-
const chipHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3)) +
|
|
287
|
+
const chipHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3)) + 4;
|
|
278
288
|
return {
|
|
279
289
|
chipHeight,
|
|
280
290
|
chipRowHeight: chipHeight + CELL_ROW_GAP
|
|
@@ -292,7 +302,8 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
292
302
|
const rowHeight = gridHeight / weeks.length;
|
|
293
303
|
const moreFontSize = numericStyle(theme.text.more.fontSize, 11);
|
|
294
304
|
const moreRowHeight = Math.ceil(moreFontSize * 1.3) + CELL_ROW_GAP;
|
|
295
|
-
|
|
305
|
+
const available = rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT;
|
|
306
|
+
return monthEventCapacity(available, chipMetrics.chipRowHeight, moreRowHeight);
|
|
296
307
|
}, [
|
|
297
308
|
maxVisibleEventCount,
|
|
298
309
|
gridHeight,
|
|
@@ -513,7 +524,14 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
513
524
|
};
|
|
514
525
|
const handleLongPressDay = isDisabled || !onLongPressDay ? void 0 : () => onLongPressDay(day);
|
|
515
526
|
const eventCount = dayEvents.length;
|
|
516
|
-
const accessibilityLabel =
|
|
527
|
+
const accessibilityLabel = dayAccessibilityLabel({
|
|
528
|
+
dateLabel: format(day, "EEEE, d LLLL yyyy", { locale }),
|
|
529
|
+
isToday,
|
|
530
|
+
isSelected,
|
|
531
|
+
isDisabled,
|
|
532
|
+
eventCount,
|
|
533
|
+
labels
|
|
534
|
+
});
|
|
517
535
|
const daySlot = slot("day", {
|
|
518
536
|
base: [styles$3.dayCell, showGrid && styles$3.dayCellEvents],
|
|
519
537
|
themed: [
|
|
@@ -567,13 +585,13 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
567
585
|
},
|
|
568
586
|
!fillCellOnSelection && isRangeStart && {
|
|
569
587
|
left: "50%",
|
|
570
|
-
marginLeft: -
|
|
588
|
+
marginLeft: -12,
|
|
571
589
|
borderTopLeftRadius: theme.rangeBandHeight / 2,
|
|
572
590
|
borderBottomLeftRadius: theme.rangeBandHeight / 2
|
|
573
591
|
},
|
|
574
592
|
!fillCellOnSelection && isRangeEnd && {
|
|
575
593
|
right: "50%",
|
|
576
|
-
marginRight: -
|
|
594
|
+
marginRight: -12,
|
|
577
595
|
borderTopRightRadius: theme.rangeBandHeight / 2,
|
|
578
596
|
borderBottomRightRadius: theme.rangeBandHeight / 2
|
|
579
597
|
}
|
|
@@ -620,7 +638,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
620
638
|
events: dayEvents
|
|
621
639
|
}),
|
|
622
640
|
accessibilityRole: "button",
|
|
623
|
-
accessibilityLabel:
|
|
641
|
+
accessibilityLabel: `${labels.moreEvents(hiddenCount)}, ${format(day, "d MMMM", { locale })}`,
|
|
624
642
|
allowFontScaling: false,
|
|
625
643
|
children: moreLabel.replace("{moreCount}", String(hiddenCount))
|
|
626
644
|
}) : null
|
|
@@ -634,141 +652,144 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
634
652
|
height
|
|
635
653
|
});
|
|
636
654
|
};
|
|
637
|
-
return /* @__PURE__ */
|
|
638
|
-
|
|
639
|
-
children:
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
children: format(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
647
|
-
}) : null,
|
|
648
|
-
showWeekdays ? /* @__PURE__ */ jsx(View, {
|
|
649
|
-
...slot("weekdays", {
|
|
650
|
-
base: styles$3.weekdayHeader,
|
|
651
|
-
themed: theme.containers.weekdayHeader
|
|
652
|
-
}),
|
|
653
|
-
children: weekdayLabels.map((day) => /* @__PURE__ */ jsx(Text, {
|
|
654
|
-
...slot("weekday", {
|
|
655
|
-
base: styles$3.weekdayLabel,
|
|
656
|
-
themed: [theme.text.weekday, { color: theme.colors.textMuted }]
|
|
655
|
+
return /* @__PURE__ */ jsx(CalendarLabelsContext.Provider, {
|
|
656
|
+
value: labels,
|
|
657
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
658
|
+
style: styles$3.root,
|
|
659
|
+
children: [
|
|
660
|
+
showTitle ? /* @__PURE__ */ jsx(Text, {
|
|
661
|
+
...slot("title", {
|
|
662
|
+
base: styles$3.title,
|
|
663
|
+
themed: [theme.text.monthTitle, { color: theme.colors.text }]
|
|
657
664
|
}),
|
|
658
665
|
allowFontScaling: false,
|
|
659
|
-
children: format(
|
|
660
|
-
},
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
onPress: () => setMoreOpenFor(null),
|
|
671
|
-
children: /* @__PURE__ */ jsxs(Pressable, {
|
|
672
|
-
onPress: () => {},
|
|
673
|
-
...slot("morePopover", {
|
|
674
|
-
base: styles$3.moreCard,
|
|
675
|
-
themed: {
|
|
676
|
-
backgroundColor: theme.colors.surface,
|
|
677
|
-
borderColor: theme.colors.gridLine
|
|
678
|
-
}
|
|
666
|
+
children: format(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
667
|
+
}) : null,
|
|
668
|
+
showWeekdays ? /* @__PURE__ */ jsx(View, {
|
|
669
|
+
...slot("weekdays", {
|
|
670
|
+
base: styles$3.weekdayHeader,
|
|
671
|
+
themed: theme.containers.weekdayHeader
|
|
672
|
+
}),
|
|
673
|
+
children: weekdayLabels.map((day) => /* @__PURE__ */ jsx(Text, {
|
|
674
|
+
...slot("weekday", {
|
|
675
|
+
base: styles$3.weekdayLabel,
|
|
676
|
+
themed: [theme.text.weekday, { color: theme.colors.textMuted }]
|
|
679
677
|
}),
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
678
|
+
allowFontScaling: false,
|
|
679
|
+
children: format(day, weekdayFormatToken(weekdayFormat), { locale })
|
|
680
|
+
}, day.toISOString()))
|
|
681
|
+
}) : null,
|
|
682
|
+
moreOpenFor ? /* @__PURE__ */ jsx(Modal, {
|
|
683
|
+
transparent: true,
|
|
684
|
+
animationType: "fade",
|
|
685
|
+
visible: true,
|
|
686
|
+
onRequestClose: () => setMoreOpenFor(null),
|
|
687
|
+
children: /* @__PURE__ */ jsx(Pressable, {
|
|
688
|
+
style: styles$3.moreBackdrop,
|
|
689
|
+
accessibilityLabel: labels.close,
|
|
690
|
+
onPress: () => setMoreOpenFor(null),
|
|
691
|
+
children: /* @__PURE__ */ jsxs(Pressable, {
|
|
692
|
+
onPress: () => {},
|
|
693
|
+
...slot("morePopover", {
|
|
694
|
+
base: styles$3.moreCard,
|
|
695
|
+
themed: {
|
|
696
|
+
backgroundColor: theme.colors.surface,
|
|
697
|
+
borderColor: theme.colors.gridLine
|
|
694
698
|
}
|
|
695
|
-
})
|
|
696
|
-
|
|
699
|
+
}),
|
|
700
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
701
|
+
accessibilityRole: "header",
|
|
702
|
+
style: [styles$3.moreCardTitle, { color: theme.colors.text }],
|
|
703
|
+
allowFontScaling: false,
|
|
704
|
+
children: format(moreOpenFor.day, "EEEE, d LLLL yyyy", { locale })
|
|
705
|
+
}), /* @__PURE__ */ jsx(ScrollView, { children: moreOpenFor.events.map((event, index) => /* @__PURE__ */ jsx(View, {
|
|
706
|
+
style: styles$3.moreCardRow,
|
|
707
|
+
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
708
|
+
event,
|
|
709
|
+
mode: "month",
|
|
710
|
+
isAllDay: isAllDayEvent(event),
|
|
711
|
+
onPress: () => {
|
|
712
|
+
setMoreOpenFor(null);
|
|
713
|
+
onPressEvent(event);
|
|
714
|
+
}
|
|
715
|
+
})
|
|
716
|
+
}, keyExtractor(event, index))) })]
|
|
717
|
+
})
|
|
697
718
|
})
|
|
698
|
-
})
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
if (point) extendDrag(point.x, point.y);
|
|
716
|
-
}
|
|
717
|
-
} : null,
|
|
718
|
-
children: weeks.map((week, weekIndex) => {
|
|
719
|
-
const rowLayout = weekLayouts[weekIndex] ?? EMPTY_LAYOUT;
|
|
720
|
-
const visibleLanes = monthVisibleCount(rowLayout.laneCount, capacity);
|
|
721
|
-
const cols = week.length;
|
|
722
|
-
let firstVisCol = 0;
|
|
723
|
-
let lastVisCol = cols - 1;
|
|
724
|
-
if (showGrid && !showAdjacentMonths) {
|
|
725
|
-
const first = week.findIndex((d) => isSameMonth(d, date));
|
|
726
|
-
if (first !== -1) {
|
|
727
|
-
firstVisCol = first;
|
|
728
|
-
lastVisCol = cols - 1 - [...week].reverse().findIndex((d) => isSameMonth(d, date));
|
|
719
|
+
}) : null,
|
|
720
|
+
/* @__PURE__ */ jsx(MonthGridSurface, {
|
|
721
|
+
gesture: dragGesture,
|
|
722
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
723
|
+
ref: gridRef,
|
|
724
|
+
testID: "month-grid",
|
|
725
|
+
...slot("grid", { base: styles$3.container }),
|
|
726
|
+
onLayout: handleLayout,
|
|
727
|
+
...isWeb$2 && dragEnabled ? {
|
|
728
|
+
onPointerDown: (event) => {
|
|
729
|
+
const point = gridPoint(event.nativeEvent.clientX, event.nativeEvent.clientY);
|
|
730
|
+
if (point) beginDrag(point.x, point.y);
|
|
731
|
+
},
|
|
732
|
+
onPointerMove: (event) => {
|
|
733
|
+
if (!dragRef.current) return;
|
|
734
|
+
const point = gridPoint(event.nativeEvent.clientX, event.nativeEvent.clientY);
|
|
735
|
+
if (point) extendDrag(point.x, point.y);
|
|
729
736
|
}
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
737
|
+
} : null,
|
|
738
|
+
children: weeks.map((week, weekIndex) => {
|
|
739
|
+
const rowLayout = weekLayouts[weekIndex] ?? EMPTY_LAYOUT;
|
|
740
|
+
const visibleLanes = monthVisibleCount(rowLayout.laneCount, capacity);
|
|
741
|
+
const cols = week.length;
|
|
742
|
+
let firstVisCol = 0;
|
|
743
|
+
let lastVisCol = cols - 1;
|
|
744
|
+
if (showGrid && !showAdjacentMonths) {
|
|
745
|
+
const first = week.findIndex((d) => isSameMonth(d, date));
|
|
746
|
+
if (first !== -1) {
|
|
747
|
+
firstVisCol = first;
|
|
748
|
+
lastVisCol = cols - 1 - [...week].reverse().findIndex((d) => isSameMonth(d, date));
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return /* @__PURE__ */ createElement(View, {
|
|
752
|
+
...slot("week", {
|
|
753
|
+
base: styles$3.weekRow,
|
|
754
|
+
themed: theme.containers.weekRow
|
|
755
|
+
}),
|
|
756
|
+
key: week[0].toISOString()
|
|
757
|
+
}, week.map((day, dayCol) => renderDay(day, dayCol, rowLayout, visibleLanes)), showGrid ? /* @__PURE__ */ jsx(View, {
|
|
758
|
+
style: [StyleSheet.absoluteFill, { pointerEvents: "box-none" }],
|
|
759
|
+
children: rowLayout.segments.filter((seg) => seg.lane < visibleLanes).map((seg) => {
|
|
760
|
+
const startCol = Math.max(seg.startCol, firstVisCol);
|
|
761
|
+
const endCol = Math.min(seg.endCol, lastVisCol);
|
|
762
|
+
if (startCol > endCol) return null;
|
|
763
|
+
const isDragged = drag?.kind === "move" && drag.event === seg.event;
|
|
764
|
+
return /* @__PURE__ */ jsx(View, {
|
|
765
|
+
style: {
|
|
766
|
+
position: "absolute",
|
|
767
|
+
left: pct(startCol / cols * 100),
|
|
768
|
+
width: pct((endCol - startCol + 1) / cols * 100),
|
|
769
|
+
top: BADGE_AREA + seg.lane * chipMetrics.chipRowHeight,
|
|
770
|
+
height: chipMetrics.chipHeight,
|
|
771
|
+
paddingHorizontal: CHIP_INSET_H,
|
|
772
|
+
pointerEvents: drag ? "none" : "box-none",
|
|
773
|
+
opacity: isDragged ? DRAGGED_BAR_OPACITY : 1
|
|
762
774
|
},
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
775
|
+
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
776
|
+
event: seg.event,
|
|
777
|
+
mode: "month",
|
|
778
|
+
isAllDay: isAllDayEvent(seg.event),
|
|
779
|
+
onPress: disableMonthEventCellPress ? () => {} : () => {
|
|
780
|
+
if (consumeSuppressedPress()) return;
|
|
781
|
+
onPressEvent(seg.event);
|
|
782
|
+
},
|
|
783
|
+
onLongPress: disableMonthEventCellPress || !onLongPressEvent ? void 0 : () => onLongPressEvent(seg.event)
|
|
784
|
+
})
|
|
785
|
+
}, `bar-${seg.event.start.toISOString()}:${seg.event.title}:${seg.lane}`);
|
|
786
|
+
})
|
|
787
|
+
}) : null);
|
|
788
|
+
})
|
|
768
789
|
})
|
|
769
790
|
})
|
|
770
|
-
|
|
771
|
-
|
|
791
|
+
]
|
|
792
|
+
})
|
|
772
793
|
});
|
|
773
794
|
}
|
|
774
795
|
function MonthGridSurface({ gesture, children }) {
|
|
@@ -871,7 +892,7 @@ const styles$3 = StyleSheet.create({
|
|
|
871
892
|
const isWeb$1 = Platform.OS === "web";
|
|
872
893
|
const PAGE_WINDOW$1 = 60;
|
|
873
894
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
874
|
-
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", 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 = false, swipeEnabled = true, showSixWeeks = false, showTitle = true, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
895
|
+
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, labels, 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 = false, swipeEnabled = true, showSixWeeks = false, showTitle = true, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
875
896
|
const theme = useCalendarTheme();
|
|
876
897
|
const slot = useMemo(() => createSlots({
|
|
877
898
|
classNames,
|
|
@@ -988,6 +1009,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
988
1009
|
locale,
|
|
989
1010
|
sortedMonthView,
|
|
990
1011
|
moreLabel,
|
|
1012
|
+
labels,
|
|
991
1013
|
showAdjacentMonths,
|
|
992
1014
|
highlightWeekends,
|
|
993
1015
|
disableMonthEventCellPress,
|
|
@@ -1024,6 +1046,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
1024
1046
|
locale,
|
|
1025
1047
|
sortedMonthView,
|
|
1026
1048
|
moreLabel,
|
|
1049
|
+
labels,
|
|
1027
1050
|
showAdjacentMonths,
|
|
1028
1051
|
highlightWeekends,
|
|
1029
1052
|
disableMonthEventCellPress,
|
|
@@ -1167,6 +1190,7 @@ const styles$2 = StyleSheet.create({
|
|
|
1167
1190
|
*/
|
|
1168
1191
|
function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }) {
|
|
1169
1192
|
const theme = useCalendarTheme();
|
|
1193
|
+
const labels = useCalendarLabels();
|
|
1170
1194
|
const isAllDayEvent = isAllDay ?? false;
|
|
1171
1195
|
const timeLabel = eventTimeLabel({
|
|
1172
1196
|
mode,
|
|
@@ -1184,7 +1208,8 @@ function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = tru
|
|
|
1184
1208
|
start: event.start,
|
|
1185
1209
|
end: event.end,
|
|
1186
1210
|
ampm,
|
|
1187
|
-
allDayLabel
|
|
1211
|
+
allDayLabel,
|
|
1212
|
+
labels
|
|
1188
1213
|
});
|
|
1189
1214
|
return /* @__PURE__ */ jsxs(TouchableOpacity, {
|
|
1190
1215
|
style: [
|
|
@@ -1247,7 +1272,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
|
|
|
1247
1272
|
const NO_EVENTS = [];
|
|
1248
1273
|
const noop = () => {};
|
|
1249
1274
|
const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
|
|
1250
|
-
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, highlightWeekends = true, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }) {
|
|
1275
|
+
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, labels, showAdjacentMonths = false, highlightWeekends = true, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }) {
|
|
1251
1276
|
const theme = useCalendarTheme();
|
|
1252
1277
|
const slot = useMemo(() => createSlots({
|
|
1253
1278
|
classNames,
|
|
@@ -1477,6 +1502,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1477
1502
|
locale,
|
|
1478
1503
|
sortedMonthView,
|
|
1479
1504
|
moreLabel,
|
|
1505
|
+
labels,
|
|
1480
1506
|
showAdjacentMonths,
|
|
1481
1507
|
highlightWeekends,
|
|
1482
1508
|
disableMonthEventCellPress,
|
|
@@ -1510,6 +1536,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1510
1536
|
weekStartsOn,
|
|
1511
1537
|
sortedMonthView,
|
|
1512
1538
|
moreLabel,
|
|
1539
|
+
labels,
|
|
1513
1540
|
showAdjacentMonths,
|
|
1514
1541
|
disableMonthEventCellPress,
|
|
1515
1542
|
isRTL,
|
|
@@ -1634,4 +1661,4 @@ const styles = StyleSheet.create({
|
|
|
1634
1661
|
}
|
|
1635
1662
|
});
|
|
1636
1663
|
//#endregion
|
|
1637
|
-
export { withEventAccessibilityLabel as a, createSlots as c,
|
|
1664
|
+
export { withEventAccessibilityLabel as a, createSlots as c, useCalendarLabels as d, CalendarThemeProvider as f, useCalendarTheme as g, mergeTheme as h, MonthView as i, useSlots as l, defaultTheme as m, DefaultMonthEvent as n, useWebPagerKeys as o, darkTheme as p, MonthPager as r, SlotStylesProvider as s, MonthList as t, CalendarLabelsContext as u };
|