@super-calendar/native 2.6.0 → 2.7.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/dist/{DefaultMonthEvent-BSvuJUFk.d.ts → DefaultMonthEvent-DCPDsnvq.d.ts} +10 -6
- package/dist/{DefaultMonthEvent-zDj9dHEv.d.mts → DefaultMonthEvent-DMOC5aNL.d.mts} +10 -6
- package/dist/{MonthList-Gu6p64fE.js → MonthList-CJs1vq5T.js} +80 -11
- package/dist/{MonthList-CMzYn9T0.mjs → MonthList-Dn37Ezj0.mjs} +82 -13
- package/dist/index.d.mts +80 -17
- package/dist/index.d.ts +80 -17
- package/dist/index.js +627 -125
- package/dist/index.mjs +606 -128
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +2 -2
- package/src/components/Agenda.tsx +5 -2
- package/src/components/AllDayLane.tsx +3 -2
- package/src/components/Calendar.tsx +29 -0
- package/src/components/DefaultEvent.tsx +3 -1
- package/src/components/MonthPager.tsx +12 -3
- package/src/components/MonthView.tsx +95 -8
- package/src/components/ResourceTimeline.tsx +270 -29
- package/src/components/TimeGrid.tsx +656 -97
- package/src/components/YearView.tsx +14 -4
- package/src/index.tsx +10 -1
- package/src/types.ts +1 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
|
-
import { ComponentType, ReactElement } from "react";
|
|
2
|
+
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
3
|
import { AccessibilityActionEvent, AccessibilityActionInfo, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
4
4
|
import { SharedValue } from "react-native-reanimated";
|
|
5
|
-
import { BusinessHours, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
5
|
+
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
6
6
|
//#region src/theme.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* The full set of colours, text styles and metrics the calendar paints with.
|
|
@@ -208,7 +208,7 @@ interface ResolvedSlot {
|
|
|
208
208
|
* Native text colour doesn't inherit from the badge). Event chips are styled
|
|
209
209
|
* by `renderEvent` (or the theme), not a slot.
|
|
210
210
|
*/
|
|
211
|
-
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "dayBadgeText" | "rangeBand" | "more";
|
|
211
|
+
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "dayBadgeText" | "rangeBand" | "more" | "morePopover";
|
|
212
212
|
/** Props for {@link MonthView}, the single-month grid. */
|
|
213
213
|
type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
214
214
|
date: Date;
|
|
@@ -221,6 +221,8 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
221
221
|
*/
|
|
222
222
|
maxVisibleEventCount?: number;
|
|
223
223
|
weekStartsOn: WeekStartsOn;
|
|
224
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
225
|
+
hiddenDays?: number[];
|
|
224
226
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
225
227
|
weekdayFormat?: WeekdayFormat;
|
|
226
228
|
locale?: Locale;
|
|
@@ -282,7 +284,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
282
284
|
*/
|
|
283
285
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
284
286
|
};
|
|
285
|
-
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
287
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
286
288
|
/**
|
|
287
289
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
288
290
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -308,6 +310,8 @@ type MonthPagerProps<T> = {
|
|
|
308
310
|
events: CalendarEvent$1<T>[];
|
|
309
311
|
maxVisibleEventCount?: number;
|
|
310
312
|
weekStartsOn: WeekStartsOn;
|
|
313
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
314
|
+
hiddenDays?: number[];
|
|
311
315
|
weekdayFormat?: WeekdayFormat;
|
|
312
316
|
locale?: Locale;
|
|
313
317
|
sortedMonthView?: boolean;
|
|
@@ -333,7 +337,7 @@ type MonthPagerProps<T> = {
|
|
|
333
337
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
334
338
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
335
339
|
} & SlotStyleProps<MonthViewSlot>;
|
|
336
|
-
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
340
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
337
341
|
/**
|
|
338
342
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
339
343
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -451,4 +455,4 @@ declare const MonthList: typeof MonthListInner;
|
|
|
451
455
|
*/
|
|
452
456
|
declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
|
|
453
457
|
//#endregion
|
|
454
|
-
export {
|
|
458
|
+
export { PartialCalendarTheme as A, RenderEvent as C, WeekdayFormat$1 as D, WeekStartsOn as E, defaultTheme as M, mergeTheme as N, CalendarTheme as O, useCalendarTheme as P, RecurrenceRule as S, TimeGridMode as T, EventAccessibilityLabelContext as _, MonthPager as a, ICalendarEvent as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarMode$1 as g, CalendarEvent$1 as h, MonthListSlot as i, darkTheme as j, CalendarThemeProvider as k, MonthViewSlot as l, BusinessHoursBand$1 as m, MonthList as n, MonthPagerProps as o, BusinessHours as p, MonthListProps as r, MonthView as s, DefaultMonthEvent as t, ResolvedSlot as u, EventAccessibilityLabeler$1 as v, RenderEventArgs as w, RecurrenceFrequency as x, EventKeyExtractor as y };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
|
-
import { ComponentType, ReactElement } from "react";
|
|
2
|
+
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
3
|
import { SharedValue } from "react-native-reanimated";
|
|
4
|
-
import { BusinessHours, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
4
|
+
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
5
5
|
import { AccessibilityActionEvent, AccessibilityActionInfo, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
6
6
|
//#region src/theme.d.ts
|
|
7
7
|
/**
|
|
@@ -208,7 +208,7 @@ interface ResolvedSlot {
|
|
|
208
208
|
* Native text colour doesn't inherit from the badge). Event chips are styled
|
|
209
209
|
* by `renderEvent` (or the theme), not a slot.
|
|
210
210
|
*/
|
|
211
|
-
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "dayBadgeText" | "rangeBand" | "more";
|
|
211
|
+
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "dayBadgeText" | "rangeBand" | "more" | "morePopover";
|
|
212
212
|
/** Props for {@link MonthView}, the single-month grid. */
|
|
213
213
|
type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
214
214
|
date: Date;
|
|
@@ -221,6 +221,8 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
221
221
|
*/
|
|
222
222
|
maxVisibleEventCount?: number;
|
|
223
223
|
weekStartsOn: WeekStartsOn;
|
|
224
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
225
|
+
hiddenDays?: number[];
|
|
224
226
|
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
225
227
|
weekdayFormat?: WeekdayFormat;
|
|
226
228
|
locale?: Locale;
|
|
@@ -282,7 +284,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
282
284
|
*/
|
|
283
285
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
284
286
|
};
|
|
285
|
-
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
287
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
286
288
|
/**
|
|
287
289
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
288
290
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -308,6 +310,8 @@ type MonthPagerProps<T> = {
|
|
|
308
310
|
events: CalendarEvent$1<T>[];
|
|
309
311
|
maxVisibleEventCount?: number;
|
|
310
312
|
weekStartsOn: WeekStartsOn;
|
|
313
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
314
|
+
hiddenDays?: number[];
|
|
311
315
|
weekdayFormat?: WeekdayFormat;
|
|
312
316
|
locale?: Locale;
|
|
313
317
|
sortedMonthView?: boolean;
|
|
@@ -333,7 +337,7 @@ type MonthPagerProps<T> = {
|
|
|
333
337
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
334
338
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
335
339
|
} & SlotStyleProps<MonthViewSlot>;
|
|
336
|
-
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
340
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
337
341
|
/**
|
|
338
342
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
339
343
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -451,4 +455,4 @@ declare const MonthList: typeof MonthListInner;
|
|
|
451
455
|
*/
|
|
452
456
|
declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
|
|
453
457
|
//#endregion
|
|
454
|
-
export {
|
|
458
|
+
export { PartialCalendarTheme as A, RenderEvent as C, WeekdayFormat$1 as D, WeekStartsOn as E, defaultTheme as M, mergeTheme as N, CalendarTheme as O, useCalendarTheme as P, RecurrenceRule as S, TimeGridMode as T, EventAccessibilityLabelContext as _, MonthPager as a, ICalendarEvent as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarMode$1 as g, CalendarEvent$1 as h, MonthListSlot as i, darkTheme as j, CalendarThemeProvider as k, MonthViewSlot as l, BusinessHoursBand$1 as m, MonthList as n, MonthPagerProps as o, BusinessHours as p, MonthListProps as r, MonthView as s, DefaultMonthEvent as t, ResolvedSlot as u, EventAccessibilityLabeler$1 as v, RenderEventArgs as w, RecurrenceFrequency as x, EventKeyExtractor as y };
|
|
@@ -202,7 +202,7 @@ const CELL_ROW_GAP = 2;
|
|
|
202
202
|
const CHIP_PADDING_V = 2;
|
|
203
203
|
const FALLBACK_VISIBLE_COUNT = 3;
|
|
204
204
|
const numericStyle = (value, fallback) => typeof value === "number" ? value : fallback;
|
|
205
|
-
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = 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, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
|
|
205
|
+
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = 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, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
|
|
206
206
|
const theme = useCalendarTheme();
|
|
207
207
|
const slot = createSlots({
|
|
208
208
|
classNames,
|
|
@@ -218,22 +218,26 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
|
|
|
218
218
|
const [gridHeight, setGridHeight] = (0, react.useState)(0);
|
|
219
219
|
const [hoveredKey, setHoveredKey] = (0, react.useState)(null);
|
|
220
220
|
const [pressedKey, setPressedKey] = (0, react.useState)(null);
|
|
221
|
+
const [moreOpenFor, setMoreOpenFor] = (0, react.useState)(null);
|
|
221
222
|
const weeks = (0, react.useMemo)(() => (0, _super_calendar_core.buildMonthWeeks)(date, weekStartsOn, {
|
|
222
223
|
showSixWeeks,
|
|
223
|
-
isRTL
|
|
224
|
+
isRTL,
|
|
225
|
+
hiddenDays
|
|
224
226
|
}), [
|
|
225
227
|
date,
|
|
226
228
|
weekStartsOn,
|
|
227
229
|
isRTL,
|
|
228
|
-
showSixWeeks
|
|
230
|
+
showSixWeeks,
|
|
231
|
+
hiddenDays
|
|
229
232
|
]);
|
|
230
233
|
const weekdayLabels = (0, react.useMemo)(() => {
|
|
231
|
-
const days = (0, _super_calendar_core.getWeekDays)(date, weekStartsOn);
|
|
234
|
+
const days = (0, _super_calendar_core.filterHiddenDays)((0, _super_calendar_core.getWeekDays)(date, weekStartsOn), hiddenDays);
|
|
232
235
|
return isRTL ? days.reverse() : days;
|
|
233
236
|
}, [
|
|
234
237
|
date,
|
|
235
238
|
weekStartsOn,
|
|
236
|
-
isRTL
|
|
239
|
+
isRTL,
|
|
240
|
+
hiddenDays
|
|
237
241
|
]);
|
|
238
242
|
const capacity = (0, react.useMemo)(() => {
|
|
239
243
|
if (maxVisibleEventCount != null) return {
|
|
@@ -257,7 +261,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
|
|
|
257
261
|
theme
|
|
258
262
|
]);
|
|
259
263
|
const eventsByDay = (0, react.useMemo)(() => {
|
|
260
|
-
const map = (0, _super_calendar_core.groupEventsByDay)(events);
|
|
264
|
+
const map = (0, _super_calendar_core.groupEventsByDay)(events.filter((event) => !(0, _super_calendar_core.isBackgroundEvent)(event)));
|
|
261
265
|
if (sortedMonthView) for (const list of map.values()) list.sort(_super_calendar_core.compareDayEvents);
|
|
262
266
|
return map;
|
|
263
267
|
}, [events, sortedMonthView]);
|
|
@@ -404,7 +408,10 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
|
|
|
404
408
|
base: styles$3.moreLabel,
|
|
405
409
|
themed: [theme.text.more, { color: theme.colors.textMuted }]
|
|
406
410
|
}),
|
|
407
|
-
onPress: onPressMore ? () => onPressMore(dayEvents, day) :
|
|
411
|
+
onPress: onPressMore ? () => onPressMore(dayEvents, day) : () => setMoreOpenFor({
|
|
412
|
+
day,
|
|
413
|
+
events: dayEvents
|
|
414
|
+
}),
|
|
408
415
|
accessibilityRole: "button",
|
|
409
416
|
accessibilityLabel: `Show ${hiddenCount} more events`,
|
|
410
417
|
allowFontScaling: false,
|
|
@@ -442,6 +449,44 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
|
|
|
442
449
|
children: (0, date_fns.format)(day, (0, _super_calendar_core.weekdayFormatToken)(weekdayFormat), { locale })
|
|
443
450
|
}, day.toISOString()))
|
|
444
451
|
}) : null,
|
|
452
|
+
moreOpenFor ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Modal, {
|
|
453
|
+
transparent: true,
|
|
454
|
+
animationType: "fade",
|
|
455
|
+
visible: true,
|
|
456
|
+
onRequestClose: () => setMoreOpenFor(null),
|
|
457
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
458
|
+
style: styles$3.moreBackdrop,
|
|
459
|
+
accessibilityLabel: "Close",
|
|
460
|
+
onPress: () => setMoreOpenFor(null),
|
|
461
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Pressable, {
|
|
462
|
+
onPress: () => {},
|
|
463
|
+
...slot("morePopover", {
|
|
464
|
+
base: styles$3.moreCard,
|
|
465
|
+
themed: {
|
|
466
|
+
backgroundColor: theme.colors.surface,
|
|
467
|
+
borderColor: theme.colors.gridLine
|
|
468
|
+
}
|
|
469
|
+
}),
|
|
470
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
471
|
+
accessibilityRole: "header",
|
|
472
|
+
style: [styles$3.moreCardTitle, { color: theme.colors.text }],
|
|
473
|
+
allowFontScaling: false,
|
|
474
|
+
children: (0, date_fns.format)(moreOpenFor.day, "EEEE, d LLLL yyyy", { locale })
|
|
475
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ScrollView, { children: moreOpenFor.events.map((event, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
476
|
+
style: styles$3.moreCardRow,
|
|
477
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
478
|
+
event,
|
|
479
|
+
mode: "month",
|
|
480
|
+
isAllDay: (0, _super_calendar_core.isAllDayEvent)(event),
|
|
481
|
+
onPress: () => {
|
|
482
|
+
setMoreOpenFor(null);
|
|
483
|
+
onPressEvent(event);
|
|
484
|
+
}
|
|
485
|
+
})
|
|
486
|
+
}, keyExtractor(event, index))) })]
|
|
487
|
+
})
|
|
488
|
+
})
|
|
489
|
+
}) : null,
|
|
445
490
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
446
491
|
...slot("grid", { base: styles$3.container }),
|
|
447
492
|
onLayout: handleLayout,
|
|
@@ -520,14 +565,36 @@ const styles$3 = react_native.StyleSheet.create({
|
|
|
520
565
|
moreLabel: {
|
|
521
566
|
marginTop: 2,
|
|
522
567
|
marginHorizontal: 4
|
|
523
|
-
}
|
|
568
|
+
},
|
|
569
|
+
moreBackdrop: {
|
|
570
|
+
flex: 1,
|
|
571
|
+
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
572
|
+
alignItems: "center",
|
|
573
|
+
justifyContent: "center",
|
|
574
|
+
padding: 24
|
|
575
|
+
},
|
|
576
|
+
moreCard: {
|
|
577
|
+
width: "100%",
|
|
578
|
+
maxWidth: 360,
|
|
579
|
+
maxHeight: "60%",
|
|
580
|
+
borderRadius: 12,
|
|
581
|
+
borderWidth: react_native.StyleSheet.hairlineWidth,
|
|
582
|
+
padding: 12,
|
|
583
|
+
gap: 6
|
|
584
|
+
},
|
|
585
|
+
moreCardTitle: {
|
|
586
|
+
fontSize: 14,
|
|
587
|
+
fontWeight: "600",
|
|
588
|
+
marginBottom: 4
|
|
589
|
+
},
|
|
590
|
+
moreCardRow: { marginBottom: 4 }
|
|
524
591
|
});
|
|
525
592
|
//#endregion
|
|
526
593
|
//#region src/components/MonthPager.tsx
|
|
527
594
|
const isWeb$1 = react_native.Platform.OS === "web";
|
|
528
595
|
const PAGE_WINDOW$1 = 60;
|
|
529
596
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
530
|
-
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
597
|
+
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
531
598
|
const theme = useCalendarTheme();
|
|
532
599
|
const slot = (0, react.useMemo)(() => createSlots({
|
|
533
600
|
classNames,
|
|
@@ -593,12 +660,13 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, wee
|
|
|
593
660
|
onChangeDate
|
|
594
661
|
]));
|
|
595
662
|
const weekDays = (0, react.useMemo)(() => {
|
|
596
|
-
const days = (0, _super_calendar_core.getWeekDays)(anchor, weekStartsOn);
|
|
663
|
+
const days = (0, _super_calendar_core.filterHiddenDays)((0, _super_calendar_core.getWeekDays)(anchor, weekStartsOn), hiddenDays);
|
|
597
664
|
return isRTL ? days.reverse() : days;
|
|
598
665
|
}, [
|
|
599
666
|
anchor,
|
|
600
667
|
weekStartsOn,
|
|
601
|
-
isRTL
|
|
668
|
+
isRTL,
|
|
669
|
+
hiddenDays
|
|
602
670
|
]);
|
|
603
671
|
const listExtraData = (0, react.useMemo)(() => ({
|
|
604
672
|
events,
|
|
@@ -619,6 +687,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, wee
|
|
|
619
687
|
showWeekdays: false,
|
|
620
688
|
maxVisibleEventCount,
|
|
621
689
|
weekStartsOn,
|
|
690
|
+
hiddenDays,
|
|
622
691
|
locale,
|
|
623
692
|
sortedMonthView,
|
|
624
693
|
moreLabel,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addMonths, differenceInCalendarMonths, format, isSameMonth, startOfDay, startOfMonth } from "date-fns";
|
|
2
2
|
import { createContext, createElement, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { CalendarSelectionProvider, buildMonthWeeks, compareDayEvents, darkColors, dayBadgeKind, daySelectionState, eventAccessibilityLabel, eventTimeLabel, getIsToday, getWeekDays, groupEventsByDay, isAllDayEvent, isDateSelectable, isSameCalendarDay, isWeekend, lightColors, monthEventCapacity, monthVisibleCount, rangeBandKind, titleEllipsizeMode, titleNumberOfLines, useCalendarSelection, weekdayFormatToken } from "@super-calendar/core";
|
|
4
|
-
import { Platform, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
3
|
+
import { CalendarSelectionProvider, buildMonthWeeks, compareDayEvents, darkColors, dayBadgeKind, daySelectionState, eventAccessibilityLabel, eventTimeLabel, filterHiddenDays, getIsToday, getWeekDays, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isSameCalendarDay, isWeekend, lightColors, monthEventCapacity, monthVisibleCount, rangeBandKind, titleEllipsizeMode, titleNumberOfLines, useCalendarSelection, weekdayFormatToken } from "@super-calendar/core";
|
|
4
|
+
import { Modal, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { LegendList } from "@legendapp/list/react-native";
|
|
7
7
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
@@ -202,7 +202,7 @@ const CELL_ROW_GAP = 2;
|
|
|
202
202
|
const CHIP_PADDING_V = 2;
|
|
203
203
|
const FALLBACK_VISIBLE_COUNT = 3;
|
|
204
204
|
const numericStyle = (value, fallback) => typeof value === "number" ? value : fallback;
|
|
205
|
-
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = 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, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
|
|
205
|
+
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = 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, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
|
|
206
206
|
const theme = useCalendarTheme();
|
|
207
207
|
const slot = createSlots({
|
|
208
208
|
classNames,
|
|
@@ -218,22 +218,26 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
|
|
|
218
218
|
const [gridHeight, setGridHeight] = useState(0);
|
|
219
219
|
const [hoveredKey, setHoveredKey] = useState(null);
|
|
220
220
|
const [pressedKey, setPressedKey] = useState(null);
|
|
221
|
+
const [moreOpenFor, setMoreOpenFor] = useState(null);
|
|
221
222
|
const weeks = useMemo(() => buildMonthWeeks(date, weekStartsOn, {
|
|
222
223
|
showSixWeeks,
|
|
223
|
-
isRTL
|
|
224
|
+
isRTL,
|
|
225
|
+
hiddenDays
|
|
224
226
|
}), [
|
|
225
227
|
date,
|
|
226
228
|
weekStartsOn,
|
|
227
229
|
isRTL,
|
|
228
|
-
showSixWeeks
|
|
230
|
+
showSixWeeks,
|
|
231
|
+
hiddenDays
|
|
229
232
|
]);
|
|
230
233
|
const weekdayLabels = useMemo(() => {
|
|
231
|
-
const days = getWeekDays(date, weekStartsOn);
|
|
234
|
+
const days = filterHiddenDays(getWeekDays(date, weekStartsOn), hiddenDays);
|
|
232
235
|
return isRTL ? days.reverse() : days;
|
|
233
236
|
}, [
|
|
234
237
|
date,
|
|
235
238
|
weekStartsOn,
|
|
236
|
-
isRTL
|
|
239
|
+
isRTL,
|
|
240
|
+
hiddenDays
|
|
237
241
|
]);
|
|
238
242
|
const capacity = useMemo(() => {
|
|
239
243
|
if (maxVisibleEventCount != null) return {
|
|
@@ -257,7 +261,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
|
|
|
257
261
|
theme
|
|
258
262
|
]);
|
|
259
263
|
const eventsByDay = useMemo(() => {
|
|
260
|
-
const map = groupEventsByDay(events);
|
|
264
|
+
const map = groupEventsByDay(events.filter((event) => !isBackgroundEvent(event)));
|
|
261
265
|
if (sortedMonthView) for (const list of map.values()) list.sort(compareDayEvents);
|
|
262
266
|
return map;
|
|
263
267
|
}, [events, sortedMonthView]);
|
|
@@ -404,7 +408,10 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
|
|
|
404
408
|
base: styles$3.moreLabel,
|
|
405
409
|
themed: [theme.text.more, { color: theme.colors.textMuted }]
|
|
406
410
|
}),
|
|
407
|
-
onPress: onPressMore ? () => onPressMore(dayEvents, day) :
|
|
411
|
+
onPress: onPressMore ? () => onPressMore(dayEvents, day) : () => setMoreOpenFor({
|
|
412
|
+
day,
|
|
413
|
+
events: dayEvents
|
|
414
|
+
}),
|
|
408
415
|
accessibilityRole: "button",
|
|
409
416
|
accessibilityLabel: `Show ${hiddenCount} more events`,
|
|
410
417
|
allowFontScaling: false,
|
|
@@ -442,6 +449,44 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
|
|
|
442
449
|
children: format(day, weekdayFormatToken(weekdayFormat), { locale })
|
|
443
450
|
}, day.toISOString()))
|
|
444
451
|
}) : null,
|
|
452
|
+
moreOpenFor ? /* @__PURE__ */ jsx(Modal, {
|
|
453
|
+
transparent: true,
|
|
454
|
+
animationType: "fade",
|
|
455
|
+
visible: true,
|
|
456
|
+
onRequestClose: () => setMoreOpenFor(null),
|
|
457
|
+
children: /* @__PURE__ */ jsx(Pressable, {
|
|
458
|
+
style: styles$3.moreBackdrop,
|
|
459
|
+
accessibilityLabel: "Close",
|
|
460
|
+
onPress: () => setMoreOpenFor(null),
|
|
461
|
+
children: /* @__PURE__ */ jsxs(Pressable, {
|
|
462
|
+
onPress: () => {},
|
|
463
|
+
...slot("morePopover", {
|
|
464
|
+
base: styles$3.moreCard,
|
|
465
|
+
themed: {
|
|
466
|
+
backgroundColor: theme.colors.surface,
|
|
467
|
+
borderColor: theme.colors.gridLine
|
|
468
|
+
}
|
|
469
|
+
}),
|
|
470
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
471
|
+
accessibilityRole: "header",
|
|
472
|
+
style: [styles$3.moreCardTitle, { color: theme.colors.text }],
|
|
473
|
+
allowFontScaling: false,
|
|
474
|
+
children: format(moreOpenFor.day, "EEEE, d LLLL yyyy", { locale })
|
|
475
|
+
}), /* @__PURE__ */ jsx(ScrollView, { children: moreOpenFor.events.map((event, index) => /* @__PURE__ */ jsx(View, {
|
|
476
|
+
style: styles$3.moreCardRow,
|
|
477
|
+
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
478
|
+
event,
|
|
479
|
+
mode: "month",
|
|
480
|
+
isAllDay: isAllDayEvent(event),
|
|
481
|
+
onPress: () => {
|
|
482
|
+
setMoreOpenFor(null);
|
|
483
|
+
onPressEvent(event);
|
|
484
|
+
}
|
|
485
|
+
})
|
|
486
|
+
}, keyExtractor(event, index))) })]
|
|
487
|
+
})
|
|
488
|
+
})
|
|
489
|
+
}) : null,
|
|
445
490
|
/* @__PURE__ */ jsx(View, {
|
|
446
491
|
...slot("grid", { base: styles$3.container }),
|
|
447
492
|
onLayout: handleLayout,
|
|
@@ -520,14 +565,36 @@ const styles$3 = StyleSheet.create({
|
|
|
520
565
|
moreLabel: {
|
|
521
566
|
marginTop: 2,
|
|
522
567
|
marginHorizontal: 4
|
|
523
|
-
}
|
|
568
|
+
},
|
|
569
|
+
moreBackdrop: {
|
|
570
|
+
flex: 1,
|
|
571
|
+
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
572
|
+
alignItems: "center",
|
|
573
|
+
justifyContent: "center",
|
|
574
|
+
padding: 24
|
|
575
|
+
},
|
|
576
|
+
moreCard: {
|
|
577
|
+
width: "100%",
|
|
578
|
+
maxWidth: 360,
|
|
579
|
+
maxHeight: "60%",
|
|
580
|
+
borderRadius: 12,
|
|
581
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
582
|
+
padding: 12,
|
|
583
|
+
gap: 6
|
|
584
|
+
},
|
|
585
|
+
moreCardTitle: {
|
|
586
|
+
fontSize: 14,
|
|
587
|
+
fontWeight: "600",
|
|
588
|
+
marginBottom: 4
|
|
589
|
+
},
|
|
590
|
+
moreCardRow: { marginBottom: 4 }
|
|
524
591
|
});
|
|
525
592
|
//#endregion
|
|
526
593
|
//#region src/components/MonthPager.tsx
|
|
527
594
|
const isWeb$1 = Platform.OS === "web";
|
|
528
595
|
const PAGE_WINDOW$1 = 60;
|
|
529
596
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
530
|
-
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
597
|
+
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
531
598
|
const theme = useCalendarTheme();
|
|
532
599
|
const slot = useMemo(() => createSlots({
|
|
533
600
|
classNames,
|
|
@@ -593,12 +660,13 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, wee
|
|
|
593
660
|
onChangeDate
|
|
594
661
|
]));
|
|
595
662
|
const weekDays = useMemo(() => {
|
|
596
|
-
const days = getWeekDays(anchor, weekStartsOn);
|
|
663
|
+
const days = filterHiddenDays(getWeekDays(anchor, weekStartsOn), hiddenDays);
|
|
597
664
|
return isRTL ? days.reverse() : days;
|
|
598
665
|
}, [
|
|
599
666
|
anchor,
|
|
600
667
|
weekStartsOn,
|
|
601
|
-
isRTL
|
|
668
|
+
isRTL,
|
|
669
|
+
hiddenDays
|
|
602
670
|
]);
|
|
603
671
|
const listExtraData = useMemo(() => ({
|
|
604
672
|
events,
|
|
@@ -619,6 +687,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, wee
|
|
|
619
687
|
showWeekdays: false,
|
|
620
688
|
maxVisibleEventCount,
|
|
621
689
|
weekStartsOn,
|
|
690
|
+
hiddenDays,
|
|
622
691
|
locale,
|
|
623
692
|
sortedMonthView,
|
|
624
693
|
moreLabel,
|