@super-calendar/native 2.13.0 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/{DefaultMonthEvent-H1IQMTqK.d.ts → DefaultMonthEvent-BDD7GgL8.d.mts} +16 -4
- package/dist/{DefaultMonthEvent-eip3mlq_.d.mts → DefaultMonthEvent-ggwYo7Fy.d.ts} +16 -4
- package/dist/{MonthList-sGAZxQZ_.js → MonthList-D4_LBnbU.js} +47 -19
- package/dist/{MonthList-B-UE37ZG.mjs → MonthList-DWCH3GT5.mjs} +47 -19
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +80 -16
- package/dist/index.mjs +81 -17
- 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 +8 -0
- package/src/components/MonthList.tsx +23 -4
- package/src/components/MonthPager.tsx +30 -4
- package/src/components/MonthView.tsx +29 -14
- package/src/components/MultiDayMovePreview.tsx +5 -5
- package/src/components/ResourceTimeline.tsx +44 -14
- package/src/components/TimeGrid.tsx +66 -10
- package/src/components/YearView.tsx +2 -2
package/README.md
CHANGED
|
@@ -91,6 +91,12 @@ Every styleable part is a named slot that accepts a class (resolved by a Tailwin
|
|
|
91
91
|
|
|
92
92
|
See the [styling guide](https://super-calendar.afonsojramos.me/guides/styling) for the slot list and the uniwind setup.
|
|
93
93
|
|
|
94
|
+
`chipHeight` and `chipGap` configure month lanes and overflow rows on `Calendar`,
|
|
95
|
+
`MonthView`, and `MonthList`. Native `MonthPager` forwards them too. DOM defaults
|
|
96
|
+
remain 18 px height and 2 px gaps; native height keeps its theme default.
|
|
97
|
+
Changing either dimension updates already mounted list and pager months.
|
|
98
|
+
See the [month guide](https://super-calendar.afonsojramos.me/guides/month-view).
|
|
99
|
+
|
|
94
100
|
## Documentation
|
|
95
101
|
|
|
96
102
|
See the [full documentation](https://super-calendar.afonsojramos.me) and the [quickstart](https://super-calendar.afonsojramos.me/quickstart), including theming, recurring events, time zones, and the headless picker.
|
|
@@ -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
4
|
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$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
|
+
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.
|
|
@@ -245,6 +245,10 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
245
245
|
* explicit value when using a custom `renderEvent`.
|
|
246
246
|
*/
|
|
247
247
|
maxVisibleEventCount?: number;
|
|
248
|
+
/** Chip and overflow height in pixels; defaults to the theme title height plus padding. */
|
|
249
|
+
chipHeight?: number;
|
|
250
|
+
/** Vertical gap between chip rows in pixels (default 2). */
|
|
251
|
+
chipGap?: number;
|
|
248
252
|
weekStartsOn: WeekStartsOn;
|
|
249
253
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
250
254
|
hiddenDays?: number[];
|
|
@@ -351,7 +355,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
351
355
|
*/
|
|
352
356
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
353
357
|
};
|
|
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;
|
|
358
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, chipHeight, chipGap, 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;
|
|
355
359
|
/**
|
|
356
360
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
357
361
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -376,6 +380,10 @@ type MonthPagerProps<T> = {
|
|
|
376
380
|
date: Date;
|
|
377
381
|
events: CalendarEvent$1<T>[];
|
|
378
382
|
maxVisibleEventCount?: number;
|
|
383
|
+
/** Month chip height in pixels; omit to keep the theme default. */
|
|
384
|
+
chipHeight?: number;
|
|
385
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
386
|
+
chipGap?: number;
|
|
379
387
|
weekStartsOn: WeekStartsOn;
|
|
380
388
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
381
389
|
hiddenDays?: number[];
|
|
@@ -435,7 +443,7 @@ type MonthPagerProps<T> = {
|
|
|
435
443
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
436
444
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
437
445
|
} & SlotStyleProps<MonthViewSlot>;
|
|
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;
|
|
446
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, chipHeight, chipGap, 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;
|
|
439
447
|
/**
|
|
440
448
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
441
449
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -480,6 +488,10 @@ type MonthListProps<T> = {
|
|
|
480
488
|
*/
|
|
481
489
|
monthHeaderHeight?: number;
|
|
482
490
|
maxVisibleEventCount?: number;
|
|
491
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
492
|
+
chipHeight?: number;
|
|
493
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
494
|
+
chipGap?: number;
|
|
483
495
|
locale?: Locale;
|
|
484
496
|
sortedMonthView?: boolean;
|
|
485
497
|
moreLabel?: string;
|
|
@@ -526,7 +538,7 @@ type MonthListProps<T> = {
|
|
|
526
538
|
/** Replace the per-month title (default "LLLL yyyy"). */
|
|
527
539
|
renderMonthHeader?: (month: Date) => React.ReactNode;
|
|
528
540
|
} & SlotStyleProps<MonthListSlot>;
|
|
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;
|
|
541
|
+
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, chipHeight, chipGap, 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;
|
|
530
542
|
/**
|
|
531
543
|
* A vertically scrolling, virtualized list of month grids. It doubles as the
|
|
532
544
|
* 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 { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
4
|
import { SharedValue } from "react-native-reanimated";
|
|
4
5
|
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$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
|
-
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.
|
|
@@ -245,6 +245,10 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
245
245
|
* explicit value when using a custom `renderEvent`.
|
|
246
246
|
*/
|
|
247
247
|
maxVisibleEventCount?: number;
|
|
248
|
+
/** Chip and overflow height in pixels; defaults to the theme title height plus padding. */
|
|
249
|
+
chipHeight?: number;
|
|
250
|
+
/** Vertical gap between chip rows in pixels (default 2). */
|
|
251
|
+
chipGap?: number;
|
|
248
252
|
weekStartsOn: WeekStartsOn;
|
|
249
253
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
250
254
|
hiddenDays?: number[];
|
|
@@ -351,7 +355,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
351
355
|
*/
|
|
352
356
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
353
357
|
};
|
|
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;
|
|
358
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, chipHeight, chipGap, 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;
|
|
355
359
|
/**
|
|
356
360
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
357
361
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -376,6 +380,10 @@ type MonthPagerProps<T> = {
|
|
|
376
380
|
date: Date;
|
|
377
381
|
events: CalendarEvent$1<T>[];
|
|
378
382
|
maxVisibleEventCount?: number;
|
|
383
|
+
/** Month chip height in pixels; omit to keep the theme default. */
|
|
384
|
+
chipHeight?: number;
|
|
385
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
386
|
+
chipGap?: number;
|
|
379
387
|
weekStartsOn: WeekStartsOn;
|
|
380
388
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
381
389
|
hiddenDays?: number[];
|
|
@@ -435,7 +443,7 @@ type MonthPagerProps<T> = {
|
|
|
435
443
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
436
444
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
437
445
|
} & SlotStyleProps<MonthViewSlot>;
|
|
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;
|
|
446
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, chipHeight, chipGap, 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;
|
|
439
447
|
/**
|
|
440
448
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
441
449
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -480,6 +488,10 @@ type MonthListProps<T> = {
|
|
|
480
488
|
*/
|
|
481
489
|
monthHeaderHeight?: number;
|
|
482
490
|
maxVisibleEventCount?: number;
|
|
491
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
492
|
+
chipHeight?: number;
|
|
493
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
494
|
+
chipGap?: number;
|
|
483
495
|
locale?: Locale;
|
|
484
496
|
sortedMonthView?: boolean;
|
|
485
497
|
moreLabel?: string;
|
|
@@ -526,7 +538,7 @@ type MonthListProps<T> = {
|
|
|
526
538
|
/** Replace the per-month title (default "LLLL yyyy"). */
|
|
527
539
|
renderMonthHeader?: (month: Date) => React.ReactNode;
|
|
528
540
|
} & SlotStyleProps<MonthListSlot>;
|
|
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;
|
|
541
|
+
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, chipHeight, chipGap, 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;
|
|
530
542
|
/**
|
|
531
543
|
* A vertically scrolling, virtualized list of month grids. It doubles as the
|
|
532
544
|
* date picker: pass `selectedRange`/`selectedDates` and selection handlers to
|
|
@@ -209,7 +209,6 @@ const DAY_CELL_PADDING_TOP = 4;
|
|
|
209
209
|
const DATE_BADGE_HEIGHT = 24;
|
|
210
210
|
const BAND_CENTER_Y = 16;
|
|
211
211
|
const CELL_ROW_GAP = 2;
|
|
212
|
-
const BADGE_AREA = 30;
|
|
213
212
|
const EMPTY_LAYOUT = {
|
|
214
213
|
segments: [],
|
|
215
214
|
laneCount: 0
|
|
@@ -240,8 +239,9 @@ function isInCreateSpan(drag, day) {
|
|
|
240
239
|
const b = (0, date_fns.startOfDay)(drag.hover).getTime();
|
|
241
240
|
return time >= Math.min(a, b) && time <= Math.max(a, b);
|
|
242
241
|
}
|
|
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 }) {
|
|
242
|
+
function MonthViewInner({ date, events, maxVisibleEventCount, chipHeight, chipGap = CELL_ROW_GAP, 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 }) {
|
|
244
243
|
const theme = useCalendarTheme();
|
|
244
|
+
const badgeArea = 28 + chipGap;
|
|
245
245
|
const slot = createSlots({
|
|
246
246
|
classNames,
|
|
247
247
|
styles: styleOverrides
|
|
@@ -284,12 +284,17 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
284
284
|
]);
|
|
285
285
|
const chipMetrics = (0, react.useMemo)(() => {
|
|
286
286
|
const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
|
|
287
|
-
const
|
|
287
|
+
const lineHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3));
|
|
288
|
+
const height = chipHeight ?? lineHeight + 4;
|
|
288
289
|
return {
|
|
289
|
-
chipHeight,
|
|
290
|
-
chipRowHeight:
|
|
290
|
+
chipHeight: height,
|
|
291
|
+
chipRowHeight: height + chipGap
|
|
291
292
|
};
|
|
292
|
-
}, [
|
|
293
|
+
}, [
|
|
294
|
+
theme,
|
|
295
|
+
chipHeight,
|
|
296
|
+
chipGap
|
|
297
|
+
]);
|
|
293
298
|
const capacity = (0, react.useMemo)(() => {
|
|
294
299
|
if (maxVisibleEventCount != null) return {
|
|
295
300
|
full: maxVisibleEventCount,
|
|
@@ -301,7 +306,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
301
306
|
};
|
|
302
307
|
const rowHeight = gridHeight / weeks.length;
|
|
303
308
|
const moreFontSize = numericStyle(theme.text.more.fontSize, 11);
|
|
304
|
-
const moreRowHeight = Math.ceil(moreFontSize * 1.3) +
|
|
309
|
+
const moreRowHeight = (chipHeight ?? Math.ceil(moreFontSize * 1.3)) + chipGap;
|
|
305
310
|
const available = rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT;
|
|
306
311
|
return (0, _super_calendar_core.monthEventCapacity)(available, chipMetrics.chipRowHeight, moreRowHeight);
|
|
307
312
|
}, [
|
|
@@ -309,7 +314,9 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
309
314
|
gridHeight,
|
|
310
315
|
weeks.length,
|
|
311
316
|
theme,
|
|
312
|
-
chipMetrics
|
|
317
|
+
chipMetrics,
|
|
318
|
+
chipHeight,
|
|
319
|
+
chipGap
|
|
313
320
|
]);
|
|
314
321
|
const eventsByDay = (0, react.useMemo)(() => {
|
|
315
322
|
const map = (0, _super_calendar_core.groupEventsByDay)(events.filter((event) => !(0, _super_calendar_core.isBackgroundEvent)(event)));
|
|
@@ -354,7 +361,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
354
361
|
isDateDisabled
|
|
355
362
|
})) return null;
|
|
356
363
|
const rowLayout = weekLayouts[row] ?? EMPTY_LAYOUT;
|
|
357
|
-
const lane = Math.floor((y - row * rowHeight -
|
|
364
|
+
const lane = Math.floor((y - row * rowHeight - badgeArea) / chipMetrics.chipRowHeight);
|
|
358
365
|
const visibleLanes = (0, _super_calendar_core.monthVisibleCount)(rowLayout.laneCount, capacity);
|
|
359
366
|
return {
|
|
360
367
|
day,
|
|
@@ -366,6 +373,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
366
373
|
weekLayouts,
|
|
367
374
|
capacity,
|
|
368
375
|
chipMetrics,
|
|
376
|
+
badgeArea,
|
|
369
377
|
showAdjacentMonths,
|
|
370
378
|
date,
|
|
371
379
|
minDate,
|
|
@@ -488,7 +496,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
488
496
|
const renderDay = (day, dayCol, rowLayout, visibleLanes) => {
|
|
489
497
|
const isCurrentMonth = (0, date_fns.isSameMonth)(day, date);
|
|
490
498
|
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { ...slot("day", {
|
|
491
|
-
base: styles$3.dayCell,
|
|
499
|
+
base: [styles$3.dayCell, { gap: chipGap }],
|
|
492
500
|
themed: [showGrid && {
|
|
493
501
|
borderTopWidth: react_native.StyleSheet.hairlineWidth,
|
|
494
502
|
borderRightWidth: react_native.StyleSheet.hairlineWidth,
|
|
@@ -533,7 +541,11 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
533
541
|
labels
|
|
534
542
|
});
|
|
535
543
|
const daySlot = slot("day", {
|
|
536
|
-
base: [
|
|
544
|
+
base: [
|
|
545
|
+
styles$3.dayCell,
|
|
546
|
+
{ gap: chipGap },
|
|
547
|
+
showGrid && styles$3.dayCellEvents
|
|
548
|
+
],
|
|
537
549
|
themed: [
|
|
538
550
|
showGrid && {
|
|
539
551
|
borderTopWidth: react_native.StyleSheet.hairlineWidth,
|
|
@@ -630,7 +642,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
630
642
|
} }, `lane-${i}`)),
|
|
631
643
|
hiddenCount > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
632
644
|
...slot("more", {
|
|
633
|
-
base: styles$3.moreLabel,
|
|
645
|
+
base: [styles$3.moreLabel, chipHeight != null && { height: chipHeight }],
|
|
634
646
|
themed: [theme.text.more, { color: theme.colors.textMuted }]
|
|
635
647
|
}),
|
|
636
648
|
onPress: onPressMore ? () => onPressMore(dayEvents, day) : () => setMoreOpenFor({
|
|
@@ -766,7 +778,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
766
778
|
position: "absolute",
|
|
767
779
|
left: pct(startCol / cols * 100),
|
|
768
780
|
width: pct((endCol - startCol + 1) / cols * 100),
|
|
769
|
-
top:
|
|
781
|
+
top: badgeArea + seg.lane * chipMetrics.chipRowHeight,
|
|
770
782
|
height: chipMetrics.chipHeight,
|
|
771
783
|
paddingHorizontal: CHIP_INSET_H,
|
|
772
784
|
pointerEvents: drag ? "none" : "box-none",
|
|
@@ -892,7 +904,7 @@ const styles$3 = react_native.StyleSheet.create({
|
|
|
892
904
|
const isWeb$1 = react_native.Platform.OS === "web";
|
|
893
905
|
const PAGE_WINDOW$1 = 60;
|
|
894
906
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
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 }) {
|
|
907
|
+
function MonthPagerInner({ date, events, maxVisibleEventCount, chipHeight, chipGap, 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 }) {
|
|
896
908
|
const theme = useCalendarTheme();
|
|
897
909
|
const slot = (0, react.useMemo)(() => createSlots({
|
|
898
910
|
classNames,
|
|
@@ -970,12 +982,16 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
970
982
|
events,
|
|
971
983
|
activeDate,
|
|
972
984
|
fillCellOnSelection,
|
|
973
|
-
dragSelect: onSelectDrag != null
|
|
985
|
+
dragSelect: onSelectDrag != null,
|
|
986
|
+
chipHeight,
|
|
987
|
+
chipGap
|
|
974
988
|
}), [
|
|
975
989
|
events,
|
|
976
990
|
activeDate,
|
|
977
991
|
fillCellOnSelection,
|
|
978
|
-
onSelectDrag
|
|
992
|
+
onSelectDrag,
|
|
993
|
+
chipHeight,
|
|
994
|
+
chipGap
|
|
979
995
|
]);
|
|
980
996
|
const selection = (0, react.useMemo)(() => ({
|
|
981
997
|
selectedDates,
|
|
@@ -1004,6 +1020,8 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
1004
1020
|
showTitle: false,
|
|
1005
1021
|
showWeekdays: false,
|
|
1006
1022
|
maxVisibleEventCount,
|
|
1023
|
+
chipHeight,
|
|
1024
|
+
chipGap,
|
|
1007
1025
|
weekStartsOn,
|
|
1008
1026
|
hiddenDays,
|
|
1009
1027
|
locale,
|
|
@@ -1041,6 +1059,8 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
1041
1059
|
pageHeight,
|
|
1042
1060
|
events,
|
|
1043
1061
|
maxVisibleEventCount,
|
|
1062
|
+
chipHeight,
|
|
1063
|
+
chipGap,
|
|
1044
1064
|
weekStartsOn,
|
|
1045
1065
|
hiddenDays,
|
|
1046
1066
|
locale,
|
|
@@ -1272,7 +1292,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
|
|
|
1272
1292
|
const NO_EVENTS = [];
|
|
1273
1293
|
const noop = () => {};
|
|
1274
1294
|
const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
|
|
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 }) {
|
|
1295
|
+
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, chipHeight, chipGap, 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 }) {
|
|
1276
1296
|
const theme = useCalendarTheme();
|
|
1277
1297
|
const slot = (0, react.useMemo)(() => createSlots({
|
|
1278
1298
|
classNames,
|
|
@@ -1284,11 +1304,15 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1284
1304
|
const listExtraData = (0, react.useMemo)(() => ({
|
|
1285
1305
|
events,
|
|
1286
1306
|
activeDate,
|
|
1287
|
-
firstViewableIndex
|
|
1307
|
+
firstViewableIndex,
|
|
1308
|
+
chipHeight,
|
|
1309
|
+
chipGap
|
|
1288
1310
|
}), [
|
|
1289
1311
|
events,
|
|
1290
1312
|
activeDate,
|
|
1291
|
-
firstViewableIndex
|
|
1313
|
+
firstViewableIndex,
|
|
1314
|
+
chipHeight,
|
|
1315
|
+
chipGap
|
|
1292
1316
|
]);
|
|
1293
1317
|
const [anchorDate] = (0, react.useState)(date);
|
|
1294
1318
|
const anchor = (0, react.useMemo)(() => (0, date_fns.startOfMonth)(anchorDate), [anchorDate]);
|
|
@@ -1498,6 +1522,8 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1498
1522
|
showTitle: false,
|
|
1499
1523
|
showWeekdays: false,
|
|
1500
1524
|
maxVisibleEventCount,
|
|
1525
|
+
chipHeight,
|
|
1526
|
+
chipGap,
|
|
1501
1527
|
weekStartsOn,
|
|
1502
1528
|
locale,
|
|
1503
1529
|
sortedMonthView,
|
|
@@ -1533,6 +1559,8 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1533
1559
|
locale,
|
|
1534
1560
|
events,
|
|
1535
1561
|
maxVisibleEventCount,
|
|
1562
|
+
chipHeight,
|
|
1563
|
+
chipGap,
|
|
1536
1564
|
weekStartsOn,
|
|
1537
1565
|
sortedMonthView,
|
|
1538
1566
|
moreLabel,
|
|
@@ -209,7 +209,6 @@ const DAY_CELL_PADDING_TOP = 4;
|
|
|
209
209
|
const DATE_BADGE_HEIGHT = 24;
|
|
210
210
|
const BAND_CENTER_Y = 16;
|
|
211
211
|
const CELL_ROW_GAP = 2;
|
|
212
|
-
const BADGE_AREA = 30;
|
|
213
212
|
const EMPTY_LAYOUT = {
|
|
214
213
|
segments: [],
|
|
215
214
|
laneCount: 0
|
|
@@ -240,8 +239,9 @@ function isInCreateSpan(drag, day) {
|
|
|
240
239
|
const b = startOfDay(drag.hover).getTime();
|
|
241
240
|
return time >= Math.min(a, b) && time <= Math.max(a, b);
|
|
242
241
|
}
|
|
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 }) {
|
|
242
|
+
function MonthViewInner({ date, events, maxVisibleEventCount, chipHeight, chipGap = CELL_ROW_GAP, 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 }) {
|
|
244
243
|
const theme = useCalendarTheme();
|
|
244
|
+
const badgeArea = 28 + chipGap;
|
|
245
245
|
const slot = createSlots({
|
|
246
246
|
classNames,
|
|
247
247
|
styles: styleOverrides
|
|
@@ -284,12 +284,17 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
284
284
|
]);
|
|
285
285
|
const chipMetrics = useMemo(() => {
|
|
286
286
|
const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
|
|
287
|
-
const
|
|
287
|
+
const lineHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3));
|
|
288
|
+
const height = chipHeight ?? lineHeight + 4;
|
|
288
289
|
return {
|
|
289
|
-
chipHeight,
|
|
290
|
-
chipRowHeight:
|
|
290
|
+
chipHeight: height,
|
|
291
|
+
chipRowHeight: height + chipGap
|
|
291
292
|
};
|
|
292
|
-
}, [
|
|
293
|
+
}, [
|
|
294
|
+
theme,
|
|
295
|
+
chipHeight,
|
|
296
|
+
chipGap
|
|
297
|
+
]);
|
|
293
298
|
const capacity = useMemo(() => {
|
|
294
299
|
if (maxVisibleEventCount != null) return {
|
|
295
300
|
full: maxVisibleEventCount,
|
|
@@ -301,7 +306,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
301
306
|
};
|
|
302
307
|
const rowHeight = gridHeight / weeks.length;
|
|
303
308
|
const moreFontSize = numericStyle(theme.text.more.fontSize, 11);
|
|
304
|
-
const moreRowHeight = Math.ceil(moreFontSize * 1.3) +
|
|
309
|
+
const moreRowHeight = (chipHeight ?? Math.ceil(moreFontSize * 1.3)) + chipGap;
|
|
305
310
|
const available = rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT;
|
|
306
311
|
return monthEventCapacity(available, chipMetrics.chipRowHeight, moreRowHeight);
|
|
307
312
|
}, [
|
|
@@ -309,7 +314,9 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
309
314
|
gridHeight,
|
|
310
315
|
weeks.length,
|
|
311
316
|
theme,
|
|
312
|
-
chipMetrics
|
|
317
|
+
chipMetrics,
|
|
318
|
+
chipHeight,
|
|
319
|
+
chipGap
|
|
313
320
|
]);
|
|
314
321
|
const eventsByDay = useMemo(() => {
|
|
315
322
|
const map = groupEventsByDay(events.filter((event) => !isBackgroundEvent(event)));
|
|
@@ -354,7 +361,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
354
361
|
isDateDisabled
|
|
355
362
|
})) return null;
|
|
356
363
|
const rowLayout = weekLayouts[row] ?? EMPTY_LAYOUT;
|
|
357
|
-
const lane = Math.floor((y - row * rowHeight -
|
|
364
|
+
const lane = Math.floor((y - row * rowHeight - badgeArea) / chipMetrics.chipRowHeight);
|
|
358
365
|
const visibleLanes = monthVisibleCount(rowLayout.laneCount, capacity);
|
|
359
366
|
return {
|
|
360
367
|
day,
|
|
@@ -366,6 +373,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
366
373
|
weekLayouts,
|
|
367
374
|
capacity,
|
|
368
375
|
chipMetrics,
|
|
376
|
+
badgeArea,
|
|
369
377
|
showAdjacentMonths,
|
|
370
378
|
date,
|
|
371
379
|
minDate,
|
|
@@ -488,7 +496,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
488
496
|
const renderDay = (day, dayCol, rowLayout, visibleLanes) => {
|
|
489
497
|
const isCurrentMonth = isSameMonth(day, date);
|
|
490
498
|
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ jsx(View, { ...slot("day", {
|
|
491
|
-
base: styles$3.dayCell,
|
|
499
|
+
base: [styles$3.dayCell, { gap: chipGap }],
|
|
492
500
|
themed: [showGrid && {
|
|
493
501
|
borderTopWidth: StyleSheet.hairlineWidth,
|
|
494
502
|
borderRightWidth: StyleSheet.hairlineWidth,
|
|
@@ -533,7 +541,11 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
533
541
|
labels
|
|
534
542
|
});
|
|
535
543
|
const daySlot = slot("day", {
|
|
536
|
-
base: [
|
|
544
|
+
base: [
|
|
545
|
+
styles$3.dayCell,
|
|
546
|
+
{ gap: chipGap },
|
|
547
|
+
showGrid && styles$3.dayCellEvents
|
|
548
|
+
],
|
|
537
549
|
themed: [
|
|
538
550
|
showGrid && {
|
|
539
551
|
borderTopWidth: StyleSheet.hairlineWidth,
|
|
@@ -630,7 +642,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
630
642
|
} }, `lane-${i}`)),
|
|
631
643
|
hiddenCount > 0 ? /* @__PURE__ */ jsx(Text, {
|
|
632
644
|
...slot("more", {
|
|
633
|
-
base: styles$3.moreLabel,
|
|
645
|
+
base: [styles$3.moreLabel, chipHeight != null && { height: chipHeight }],
|
|
634
646
|
themed: [theme.text.more, { color: theme.colors.textMuted }]
|
|
635
647
|
}),
|
|
636
648
|
onPress: onPressMore ? () => onPressMore(dayEvents, day) : () => setMoreOpenFor({
|
|
@@ -766,7 +778,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
766
778
|
position: "absolute",
|
|
767
779
|
left: pct(startCol / cols * 100),
|
|
768
780
|
width: pct((endCol - startCol + 1) / cols * 100),
|
|
769
|
-
top:
|
|
781
|
+
top: badgeArea + seg.lane * chipMetrics.chipRowHeight,
|
|
770
782
|
height: chipMetrics.chipHeight,
|
|
771
783
|
paddingHorizontal: CHIP_INSET_H,
|
|
772
784
|
pointerEvents: drag ? "none" : "box-none",
|
|
@@ -892,7 +904,7 @@ const styles$3 = StyleSheet.create({
|
|
|
892
904
|
const isWeb$1 = Platform.OS === "web";
|
|
893
905
|
const PAGE_WINDOW$1 = 60;
|
|
894
906
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
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 }) {
|
|
907
|
+
function MonthPagerInner({ date, events, maxVisibleEventCount, chipHeight, chipGap, 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 }) {
|
|
896
908
|
const theme = useCalendarTheme();
|
|
897
909
|
const slot = useMemo(() => createSlots({
|
|
898
910
|
classNames,
|
|
@@ -970,12 +982,16 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
970
982
|
events,
|
|
971
983
|
activeDate,
|
|
972
984
|
fillCellOnSelection,
|
|
973
|
-
dragSelect: onSelectDrag != null
|
|
985
|
+
dragSelect: onSelectDrag != null,
|
|
986
|
+
chipHeight,
|
|
987
|
+
chipGap
|
|
974
988
|
}), [
|
|
975
989
|
events,
|
|
976
990
|
activeDate,
|
|
977
991
|
fillCellOnSelection,
|
|
978
|
-
onSelectDrag
|
|
992
|
+
onSelectDrag,
|
|
993
|
+
chipHeight,
|
|
994
|
+
chipGap
|
|
979
995
|
]);
|
|
980
996
|
const selection = useMemo(() => ({
|
|
981
997
|
selectedDates,
|
|
@@ -1004,6 +1020,8 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
1004
1020
|
showTitle: false,
|
|
1005
1021
|
showWeekdays: false,
|
|
1006
1022
|
maxVisibleEventCount,
|
|
1023
|
+
chipHeight,
|
|
1024
|
+
chipGap,
|
|
1007
1025
|
weekStartsOn,
|
|
1008
1026
|
hiddenDays,
|
|
1009
1027
|
locale,
|
|
@@ -1041,6 +1059,8 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
1041
1059
|
pageHeight,
|
|
1042
1060
|
events,
|
|
1043
1061
|
maxVisibleEventCount,
|
|
1062
|
+
chipHeight,
|
|
1063
|
+
chipGap,
|
|
1044
1064
|
weekStartsOn,
|
|
1045
1065
|
hiddenDays,
|
|
1046
1066
|
locale,
|
|
@@ -1272,7 +1292,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
|
|
|
1272
1292
|
const NO_EVENTS = [];
|
|
1273
1293
|
const noop = () => {};
|
|
1274
1294
|
const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
|
|
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 }) {
|
|
1295
|
+
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, chipHeight, chipGap, 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 }) {
|
|
1276
1296
|
const theme = useCalendarTheme();
|
|
1277
1297
|
const slot = useMemo(() => createSlots({
|
|
1278
1298
|
classNames,
|
|
@@ -1284,11 +1304,15 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1284
1304
|
const listExtraData = useMemo(() => ({
|
|
1285
1305
|
events,
|
|
1286
1306
|
activeDate,
|
|
1287
|
-
firstViewableIndex
|
|
1307
|
+
firstViewableIndex,
|
|
1308
|
+
chipHeight,
|
|
1309
|
+
chipGap
|
|
1288
1310
|
}), [
|
|
1289
1311
|
events,
|
|
1290
1312
|
activeDate,
|
|
1291
|
-
firstViewableIndex
|
|
1313
|
+
firstViewableIndex,
|
|
1314
|
+
chipHeight,
|
|
1315
|
+
chipGap
|
|
1292
1316
|
]);
|
|
1293
1317
|
const [anchorDate] = useState(date);
|
|
1294
1318
|
const anchor = useMemo(() => startOfMonth(anchorDate), [anchorDate]);
|
|
@@ -1498,6 +1522,8 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1498
1522
|
showTitle: false,
|
|
1499
1523
|
showWeekdays: false,
|
|
1500
1524
|
maxVisibleEventCount,
|
|
1525
|
+
chipHeight,
|
|
1526
|
+
chipGap,
|
|
1501
1527
|
weekStartsOn,
|
|
1502
1528
|
locale,
|
|
1503
1529
|
sortedMonthView,
|
|
@@ -1533,6 +1559,8 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1533
1559
|
locale,
|
|
1534
1560
|
events,
|
|
1535
1561
|
maxVisibleEventCount,
|
|
1562
|
+
chipHeight,
|
|
1563
|
+
chipGap,
|
|
1536
1564
|
weekStartsOn,
|
|
1537
1565
|
sortedMonthView,
|
|
1538
1566
|
moreLabel,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, O as ScrollToTimeOptions, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, T as RecurrenceRule, _ as CalendarMode, a as MonthPager, b as EventDragHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarHandle, h as CalendarEvent, i as MonthListSlot, j as WeekdayFormat, k as TimeGridMode, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabelContext, w as RecurrenceFrequency, x as EventDragStartHandler, y as EventAccessibilityLabeler } from "./DefaultMonthEvent-
|
|
1
|
+
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, O as ScrollToTimeOptions, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, T as RecurrenceRule, _ as CalendarMode, a as MonthPager, b as EventDragHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarHandle, h as CalendarEvent, i as MonthListSlot, j as WeekdayFormat, k as TimeGridMode, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabelContext, w as RecurrenceFrequency, x as EventDragStartHandler, y as EventAccessibilityLabeler } from "./DefaultMonthEvent-BDD7GgL8.mjs";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
3
|
import { ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
4
4
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
@@ -394,6 +394,10 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
394
394
|
* fixed cap. Pass an explicit value when using a custom `renderEvent`.
|
|
395
395
|
*/
|
|
396
396
|
maxVisibleEventCount?: number;
|
|
397
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
398
|
+
chipHeight?: number;
|
|
399
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
400
|
+
chipGap?: number;
|
|
397
401
|
/** Sort each month day's events by start. Default true. */
|
|
398
402
|
sortedMonthView?: boolean;
|
|
399
403
|
/** Month overflow label template; `{moreCount}` is replaced. Default "{moreCount} More". */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, O as ScrollToTimeOptions, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, T as RecurrenceRule, _ as CalendarMode, a as MonthPager, b as EventDragHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarHandle, h as CalendarEvent, i as MonthListSlot, j as WeekdayFormat, k as TimeGridMode, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabelContext, w as RecurrenceFrequency, x as EventDragStartHandler, y as EventAccessibilityLabeler } from "./DefaultMonthEvent-
|
|
1
|
+
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, O as ScrollToTimeOptions, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, T as RecurrenceRule, _ as CalendarMode, a as MonthPager, b as EventDragHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarHandle, h as CalendarEvent, i as MonthListSlot, j as WeekdayFormat, k as TimeGridMode, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabelContext, w as RecurrenceFrequency, x as EventDragStartHandler, y as EventAccessibilityLabeler } from "./DefaultMonthEvent-ggwYo7Fy.js";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
3
|
import { ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
4
4
|
import { ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
@@ -394,6 +394,10 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
394
394
|
* fixed cap. Pass an explicit value when using a custom `renderEvent`.
|
|
395
395
|
*/
|
|
396
396
|
maxVisibleEventCount?: number;
|
|
397
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
398
|
+
chipHeight?: number;
|
|
399
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
400
|
+
chipGap?: number;
|
|
397
401
|
/** Sort each month day's events by start. Default true. */
|
|
398
402
|
sortedMonthView?: boolean;
|
|
399
403
|
/** Month overflow label template; `{moreCount}` is replaced. Default "{moreCount} More". */
|