@super-calendar/native 2.13.0 → 2.14.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 +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 +4 -2
- package/dist/index.mjs +4 -2
- 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 +12 -2
- package/src/components/MonthPager.tsx +19 -2
- package/src/components/MonthView.tsx +18 -12
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". */
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_MonthList = require("./MonthList-
|
|
24
|
+
const require_MonthList = require("./MonthList-D4_LBnbU.js");
|
|
25
25
|
let date_fns = require("date-fns");
|
|
26
26
|
let react = require("react");
|
|
27
27
|
let react_native_reanimated = require("react-native-reanimated");
|
|
@@ -3067,7 +3067,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
3067
3067
|
* ```
|
|
3068
3068
|
*/
|
|
3069
3069
|
const Calendar = (0, react.forwardRef)(CalendarInner);
|
|
3070
|
-
function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }, ref) {
|
|
3070
|
+
function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, chipHeight, chipGap, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }, ref) {
|
|
3071
3071
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
3072
3072
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
3073
3073
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -3148,6 +3148,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3148
3148
|
date,
|
|
3149
3149
|
events: displayEvents,
|
|
3150
3150
|
maxVisibleEventCount,
|
|
3151
|
+
chipHeight,
|
|
3152
|
+
chipGap,
|
|
3151
3153
|
weekStartsOn,
|
|
3152
3154
|
hiddenDays,
|
|
3153
3155
|
weekdayFormat,
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as withEventAccessibilityLabel, c as createSlots, d as useCalendarLabels, f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, l as useSlots, m as defaultTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as darkTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarLabelsContext } from "./MonthList-
|
|
1
|
+
import { a as withEventAccessibilityLabel, c as createSlots, d as useCalendarLabels, f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, l as useSlots, m as defaultTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as darkTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarLabelsContext } from "./MonthList-DWCH3GT5.mjs";
|
|
2
2
|
import { addDays, addMonths, addWeeks, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getHours, getISOWeek, getMinutes, isSameDay, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
3
3
|
import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
4
4
|
import Animated, { runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
|
|
@@ -3043,7 +3043,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
3043
3043
|
* ```
|
|
3044
3044
|
*/
|
|
3045
3045
|
const Calendar = forwardRef(CalendarInner);
|
|
3046
|
-
function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }, ref) {
|
|
3046
|
+
function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, chipHeight, chipGap, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }, ref) {
|
|
3047
3047
|
const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
|
|
3048
3048
|
const internalCellHeight = useSharedValue(hourHeight);
|
|
3049
3049
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -3124,6 +3124,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3124
3124
|
date,
|
|
3125
3125
|
events: displayEvents,
|
|
3126
3126
|
maxVisibleEventCount,
|
|
3127
|
+
chipHeight,
|
|
3128
|
+
chipGap,
|
|
3127
3129
|
weekStartsOn,
|
|
3128
3130
|
hiddenDays,
|
|
3129
3131
|
weekdayFormat,
|
package/dist/picker.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent } 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, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent } from "./DefaultMonthEvent-BDD7GgL8.mjs";
|
|
2
2
|
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/dist/picker.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent } 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, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent } from "./DefaultMonthEvent-ggwYo7Fy.js";
|
|
2
2
|
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/dist/picker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_MonthList = require("./MonthList-
|
|
2
|
+
const require_MonthList = require("./MonthList-D4_LBnbU.js");
|
|
3
3
|
let _super_calendar_core = require("@super-calendar/core");
|
|
4
4
|
exports.CalendarThemeProvider = require_MonthList.CalendarThemeProvider;
|
|
5
5
|
exports.DefaultMonthEvent = require_MonthList.DefaultMonthEvent;
|
package/dist/picker.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, m as defaultTheme, n as DefaultMonthEvent, p as darkTheme, r as MonthPager, t as MonthList } from "./MonthList-
|
|
1
|
+
import { f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, m as defaultTheme, n as DefaultMonthEvent, p as darkTheme, r as MonthPager, t as MonthList } from "./MonthList-DWCH3GT5.mjs";
|
|
2
2
|
import { buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { CalendarThemeProvider, DefaultMonthEvent, MonthList, MonthPager, MonthView, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Gesture-driven, virtualized month / week / day calendar and date picker for React Native (and web via react-native-web).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agenda",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@super-calendar/core": "2.
|
|
67
|
+
"@super-calendar/core": "2.14.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@legendapp/list": ">=3",
|
|
@@ -169,6 +169,10 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
169
169
|
* fixed cap. Pass an explicit value when using a custom `renderEvent`.
|
|
170
170
|
*/
|
|
171
171
|
maxVisibleEventCount?: number;
|
|
172
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
173
|
+
chipHeight?: number;
|
|
174
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
175
|
+
chipGap?: number;
|
|
172
176
|
/** Sort each month day's events by start. Default true. */
|
|
173
177
|
sortedMonthView?: boolean;
|
|
174
178
|
/** Month overflow label template; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
@@ -489,6 +493,8 @@ function CalendarInner<T>(
|
|
|
489
493
|
isDateDisabled,
|
|
490
494
|
onPressDateHeader,
|
|
491
495
|
maxVisibleEventCount,
|
|
496
|
+
chipHeight,
|
|
497
|
+
chipGap,
|
|
492
498
|
sortedMonthView,
|
|
493
499
|
moreLabel,
|
|
494
500
|
labels,
|
|
@@ -673,6 +679,8 @@ function CalendarInner<T>(
|
|
|
673
679
|
date={date}
|
|
674
680
|
events={displayEvents}
|
|
675
681
|
maxVisibleEventCount={maxVisibleEventCount}
|
|
682
|
+
chipHeight={chipHeight}
|
|
683
|
+
chipGap={chipGap}
|
|
676
684
|
weekStartsOn={weekStartsOn}
|
|
677
685
|
hiddenDays={hiddenDays}
|
|
678
686
|
weekdayFormat={weekdayFormat}
|
|
@@ -98,6 +98,10 @@ export type MonthListProps<T> = {
|
|
|
98
98
|
*/
|
|
99
99
|
monthHeaderHeight?: number;
|
|
100
100
|
maxVisibleEventCount?: number;
|
|
101
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
102
|
+
chipHeight?: number;
|
|
103
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
104
|
+
chipGap?: number;
|
|
101
105
|
locale?: Locale;
|
|
102
106
|
sortedMonthView?: boolean;
|
|
103
107
|
moreLabel?: string;
|
|
@@ -153,6 +157,8 @@ function MonthListInner<T>({
|
|
|
153
157
|
weekRowHeight: weekRowHeightProp,
|
|
154
158
|
monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT,
|
|
155
159
|
maxVisibleEventCount,
|
|
160
|
+
chipHeight,
|
|
161
|
+
chipGap,
|
|
156
162
|
locale,
|
|
157
163
|
sortedMonthView,
|
|
158
164
|
moreLabel,
|
|
@@ -209,8 +215,8 @@ function MonthListInner<T>({
|
|
|
209
215
|
// `firstViewableIndex` (the web `inert` cutoff must stay current). Selection
|
|
210
216
|
// needs no entry: it reaches MonthView through context.
|
|
211
217
|
const listExtraData = useMemo(
|
|
212
|
-
() => ({ events, activeDate, firstViewableIndex }),
|
|
213
|
-
[events, activeDate, firstViewableIndex],
|
|
218
|
+
() => ({ events, activeDate, firstViewableIndex, chipHeight, chipGap }),
|
|
219
|
+
[events, activeDate, firstViewableIndex, chipHeight, chipGap],
|
|
214
220
|
);
|
|
215
221
|
|
|
216
222
|
// A fixed window of months anchored once, aligned to the month start.
|
|
@@ -466,6 +472,8 @@ function MonthListInner<T>({
|
|
|
466
472
|
showTitle={false}
|
|
467
473
|
showWeekdays={false}
|
|
468
474
|
maxVisibleEventCount={maxVisibleEventCount}
|
|
475
|
+
chipHeight={chipHeight}
|
|
476
|
+
chipGap={chipGap}
|
|
469
477
|
weekStartsOn={weekStartsOn}
|
|
470
478
|
locale={locale}
|
|
471
479
|
sortedMonthView={sortedMonthView}
|
|
@@ -503,6 +511,8 @@ function MonthListInner<T>({
|
|
|
503
511
|
locale,
|
|
504
512
|
events,
|
|
505
513
|
maxVisibleEventCount,
|
|
514
|
+
chipHeight,
|
|
515
|
+
chipGap,
|
|
506
516
|
weekStartsOn,
|
|
507
517
|
sortedMonthView,
|
|
508
518
|
moreLabel,
|
|
@@ -57,6 +57,10 @@ export type MonthPagerProps<T> = {
|
|
|
57
57
|
date: Date;
|
|
58
58
|
events: CalendarEvent<T>[];
|
|
59
59
|
maxVisibleEventCount?: number;
|
|
60
|
+
/** Month chip height in pixels; omit to keep the theme default. */
|
|
61
|
+
chipHeight?: number;
|
|
62
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
63
|
+
chipGap?: number;
|
|
60
64
|
weekStartsOn: WeekStartsOn;
|
|
61
65
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
62
66
|
hiddenDays?: number[];
|
|
@@ -121,6 +125,8 @@ function MonthPagerInner<T>({
|
|
|
121
125
|
date,
|
|
122
126
|
events,
|
|
123
127
|
maxVisibleEventCount,
|
|
128
|
+
chipHeight,
|
|
129
|
+
chipGap,
|
|
124
130
|
weekStartsOn,
|
|
125
131
|
hiddenDays,
|
|
126
132
|
weekdayFormat = "short",
|
|
@@ -291,8 +297,15 @@ function MonthPagerInner<T>({
|
|
|
291
297
|
// grids as renderItem props, not through the selection context below: toggling
|
|
292
298
|
// a "pick dates" mode on must reach the pages already rendered.
|
|
293
299
|
const listExtraData = useMemo(
|
|
294
|
-
() => ({
|
|
295
|
-
|
|
300
|
+
() => ({
|
|
301
|
+
events,
|
|
302
|
+
activeDate,
|
|
303
|
+
fillCellOnSelection,
|
|
304
|
+
dragSelect: onSelectDrag != null,
|
|
305
|
+
chipHeight,
|
|
306
|
+
chipGap,
|
|
307
|
+
}),
|
|
308
|
+
[events, activeDate, fillCellOnSelection, onSelectDrag, chipHeight, chipGap],
|
|
296
309
|
);
|
|
297
310
|
|
|
298
311
|
// Selection reaches the grids through context, not `renderItem`, so a change
|
|
@@ -317,6 +330,8 @@ function MonthPagerInner<T>({
|
|
|
317
330
|
showTitle={false}
|
|
318
331
|
showWeekdays={false}
|
|
319
332
|
maxVisibleEventCount={maxVisibleEventCount}
|
|
333
|
+
chipHeight={chipHeight}
|
|
334
|
+
chipGap={chipGap}
|
|
320
335
|
weekStartsOn={weekStartsOn}
|
|
321
336
|
hiddenDays={hiddenDays}
|
|
322
337
|
locale={locale}
|
|
@@ -356,6 +371,8 @@ function MonthPagerInner<T>({
|
|
|
356
371
|
pageHeight,
|
|
357
372
|
events,
|
|
358
373
|
maxVisibleEventCount,
|
|
374
|
+
chipHeight,
|
|
375
|
+
chipGap,
|
|
359
376
|
weekStartsOn,
|
|
360
377
|
hiddenDays,
|
|
361
378
|
locale,
|
|
@@ -72,8 +72,6 @@ const DATE_BADGE_HEIGHT = 24;
|
|
|
72
72
|
const BAND_CENTER_Y = DAY_CELL_PADDING_TOP + DATE_BADGE_HEIGHT / 2;
|
|
73
73
|
const CELL_ROW_GAP = 2;
|
|
74
74
|
const CHIP_PADDING_V = 2;
|
|
75
|
-
// Where the first event row sits below the date badge (padding + badge + gap).
|
|
76
|
-
const BADGE_AREA = DAY_CELL_PADDING_TOP + DATE_BADGE_HEIGHT + CELL_ROW_GAP;
|
|
77
75
|
// Stable empty layout for the events-free picker (avoids a fresh object per render).
|
|
78
76
|
const EMPTY_LAYOUT = { segments: [], laneCount: 0 } as const;
|
|
79
77
|
// Horizontal inset of a chip within its cell (mirrors `styles.monthEvent`).
|
|
@@ -161,6 +159,10 @@ export type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
161
159
|
* explicit value when using a custom `renderEvent`.
|
|
162
160
|
*/
|
|
163
161
|
maxVisibleEventCount?: number;
|
|
162
|
+
/** Chip and overflow height in pixels; defaults to the theme title height plus padding. */
|
|
163
|
+
chipHeight?: number;
|
|
164
|
+
/** Vertical gap between chip rows in pixels (default 2). */
|
|
165
|
+
chipGap?: number;
|
|
164
166
|
weekStartsOn: WeekStartsOn;
|
|
165
167
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
166
168
|
hiddenDays?: number[];
|
|
@@ -272,6 +274,8 @@ function MonthViewInner<T>({
|
|
|
272
274
|
date,
|
|
273
275
|
events,
|
|
274
276
|
maxVisibleEventCount,
|
|
277
|
+
chipHeight,
|
|
278
|
+
chipGap = CELL_ROW_GAP,
|
|
275
279
|
weekStartsOn,
|
|
276
280
|
hiddenDays,
|
|
277
281
|
weekdayFormat = "short",
|
|
@@ -316,6 +320,7 @@ function MonthViewInner<T>({
|
|
|
316
320
|
styles: styleOverrides,
|
|
317
321
|
}: MonthViewProps<T>): ReactElement {
|
|
318
322
|
const theme = useCalendarTheme();
|
|
323
|
+
const badgeArea = DAY_CELL_PADDING_TOP + DATE_BADGE_HEIGHT + chipGap;
|
|
319
324
|
const slot = createSlots<MonthViewSlot>({ classNames, styles: styleOverrides });
|
|
320
325
|
const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
|
|
321
326
|
// Selection comes from context (so cached pages still repaint), but explicit
|
|
@@ -366,9 +371,9 @@ function MonthViewInner<T>({
|
|
|
366
371
|
const chipMetrics = useMemo(() => {
|
|
367
372
|
const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
|
|
368
373
|
const lineHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3));
|
|
369
|
-
const
|
|
370
|
-
return { chipHeight, chipRowHeight:
|
|
371
|
-
}, [theme]);
|
|
374
|
+
const height = chipHeight ?? lineHeight + CHIP_PADDING_V * 2;
|
|
375
|
+
return { chipHeight: height, chipRowHeight: height + chipGap };
|
|
376
|
+
}, [theme, chipHeight, chipGap]);
|
|
372
377
|
|
|
373
378
|
// How many chips fit per cell: a fixed cap when `maxVisibleEventCount` is set,
|
|
374
379
|
// else derived from the measured cell height and the (default) chip metrics.
|
|
@@ -381,10 +386,10 @@ function MonthViewInner<T>({
|
|
|
381
386
|
}
|
|
382
387
|
const rowHeight = gridHeight / weeks.length;
|
|
383
388
|
const moreFontSize = numericStyle(theme.text.more.fontSize, 11);
|
|
384
|
-
const moreRowHeight = Math.ceil(moreFontSize * 1.3) +
|
|
389
|
+
const moreRowHeight = (chipHeight ?? Math.ceil(moreFontSize * 1.3)) + chipGap;
|
|
385
390
|
const available = rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT;
|
|
386
391
|
return monthEventCapacity(available, chipMetrics.chipRowHeight, moreRowHeight);
|
|
387
|
-
}, [maxVisibleEventCount, gridHeight, weeks.length, theme, chipMetrics]);
|
|
392
|
+
}, [maxVisibleEventCount, gridHeight, weeks.length, theme, chipMetrics, chipHeight, chipGap]);
|
|
388
393
|
|
|
389
394
|
// Group events by calendar day once per `events` change (shared with the dom
|
|
390
395
|
// renderer via core's `groupEventsByDay`), rather than scanning the whole list
|
|
@@ -466,7 +471,7 @@ function MonthViewInner<T>({
|
|
|
466
471
|
if (!isDateSelectable(day, { minDate, maxDate, isDateDisabled })) return null;
|
|
467
472
|
// Which lane row the point lands on, mirroring the bar overlay's geometry.
|
|
468
473
|
const rowLayout = weekLayouts[row] ?? EMPTY_LAYOUT;
|
|
469
|
-
const lane = Math.floor((y - row * rowHeight -
|
|
474
|
+
const lane = Math.floor((y - row * rowHeight - badgeArea) / chipMetrics.chipRowHeight);
|
|
470
475
|
const visibleLanes = monthVisibleCount(rowLayout.laneCount, capacity);
|
|
471
476
|
const segment =
|
|
472
477
|
lane >= 0 && lane < visibleLanes
|
|
@@ -480,6 +485,7 @@ function MonthViewInner<T>({
|
|
|
480
485
|
weekLayouts,
|
|
481
486
|
capacity,
|
|
482
487
|
chipMetrics,
|
|
488
|
+
badgeArea,
|
|
483
489
|
showAdjacentMonths,
|
|
484
490
|
date,
|
|
485
491
|
minDate,
|
|
@@ -623,7 +629,7 @@ function MonthViewInner<T>({
|
|
|
623
629
|
<View
|
|
624
630
|
key={day.toISOString()}
|
|
625
631
|
{...slot("day", {
|
|
626
|
-
base: styles.dayCell,
|
|
632
|
+
base: [styles.dayCell, { gap: chipGap }],
|
|
627
633
|
themed: [
|
|
628
634
|
showGrid && {
|
|
629
635
|
borderTopWidth: StyleSheet.hairlineWidth,
|
|
@@ -715,7 +721,7 @@ function MonthViewInner<T>({
|
|
|
715
721
|
// Events mode mirrors the dom renderer: left-aligned cell content with
|
|
716
722
|
// the date badge in the top-right. The picker (no grid) stays centered
|
|
717
723
|
// so the selection range band lines up with the centered badge.
|
|
718
|
-
base: [styles.dayCell, showGrid && styles.dayCellEvents],
|
|
724
|
+
base: [styles.dayCell, { gap: chipGap }, showGrid && styles.dayCellEvents],
|
|
719
725
|
themed: [
|
|
720
726
|
showGrid && {
|
|
721
727
|
borderTopWidth: StyleSheet.hairlineWidth,
|
|
@@ -862,7 +868,7 @@ function MonthViewInner<T>({
|
|
|
862
868
|
{hiddenCount > 0 ? (
|
|
863
869
|
<Text
|
|
864
870
|
{...slot<TextStyle>("more", {
|
|
865
|
-
base: styles.moreLabel,
|
|
871
|
+
base: [styles.moreLabel, chipHeight != null && { height: chipHeight }],
|
|
866
872
|
themed: [theme.text.more, { color: theme.colors.textMuted }],
|
|
867
873
|
})}
|
|
868
874
|
onPress={
|
|
@@ -1036,7 +1042,7 @@ function MonthViewInner<T>({
|
|
|
1036
1042
|
position: "absolute",
|
|
1037
1043
|
left: pct((startCol / cols) * 100),
|
|
1038
1044
|
width: pct(((endCol - startCol + 1) / cols) * 100),
|
|
1039
|
-
top:
|
|
1045
|
+
top: badgeArea + seg.lane * chipMetrics.chipRowHeight,
|
|
1040
1046
|
height: chipMetrics.chipHeight,
|
|
1041
1047
|
paddingHorizontal: CHIP_INSET_H,
|
|
1042
1048
|
// Let a sweep in progress reach the cells underneath.
|