@super-calendar/native 2.8.0 → 2.8.2

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.
@@ -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, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
5
- import { AccessibilityActionEvent, AccessibilityActionInfo, 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.
@@ -173,6 +173,15 @@ type RenderEventArgs<T = unknown> = {
173
173
  type RenderEvent<T = unknown> = ComponentType<RenderEventArgs<T>>;
174
174
  //#endregion
175
175
  //#region src/utils/slots.d.ts
176
+ /**
177
+ * The style shapes a slot can resolve to. A slot carries the style type of the
178
+ * element it is spread on, because React Native's style types stop being
179
+ * mutually assignable as soon as a consumer's types diverge them: Expo's
180
+ * react-native-web types widen `cursor` on `TextStyle` and `userSelect` on
181
+ * `ViewStyle`, so a `View` slot typed as `TextStyle` fails to compile in any
182
+ * Expo app.
183
+ */
184
+ type SlotStyle = ViewStyle | TextStyle | ImageStyle;
176
185
  /**
177
186
  * Per-slot styling overrides. Give a slot a Tailwind class (uniwind/NativeWind)
178
187
  * and/or a style override; missing slots keep the built-in look.
@@ -186,18 +195,18 @@ interface SlotStyleProps<Slot extends string> {
186
195
  */
187
196
  classNames?: Partial<Record<Slot, string>>;
188
197
  /** Style overrides per slot, merged last (win over defaults and classes). */
189
- styles?: Partial<Record<Slot, StyleProp<TextStyle>>>;
198
+ styles?: Partial<Record<Slot, StyleProp<SlotStyle>>>;
190
199
  }
191
200
  /** A slot's built-in styling, split so classes can replace the look but not the layout. */
192
- interface SlotDefault {
201
+ interface SlotDefault<Style extends SlotStyle = ViewStyle> {
193
202
  /** Structural styles kept even when a class is supplied. */
194
- base?: StyleProp<TextStyle>;
203
+ base?: StyleProp<Style>;
195
204
  /** Themed styles (colour, type, spacing) dropped when a class is supplied. */
196
- themed?: StyleProp<TextStyle>;
205
+ themed?: StyleProp<Style>;
197
206
  }
198
207
  /** The props a resolved slot spreads onto an element. */
199
- interface ResolvedSlot {
200
- style: StyleProp<TextStyle>;
208
+ interface ResolvedSlot<Style extends SlotStyle = ViewStyle> {
209
+ style: StyleProp<Style>;
201
210
  className?: string;
202
211
  }
203
212
  //#endregion
@@ -235,6 +244,8 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
235
244
  moreLabel?: string;
236
245
  /** Show dimmed days from adjacent months in the grid. Default true. */
237
246
  showAdjacentMonths?: boolean;
247
+ /** Tint weekend day cells with the theme's weekend background. Default true. */
248
+ highlightWeekends?: boolean;
238
249
  /** Ignore taps on month-cell events (day-cell taps still fire). Default false. */
239
250
  disableMonthEventCellPress?: boolean;
240
251
  /** Reverse the day order within each week (right-to-left). Default false. */
@@ -287,7 +298,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
287
298
  */
288
299
  renderCustomDateForMonth?: (date: Date) => React.ReactNode;
289
300
  };
290
- 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;
301
+ declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
291
302
  /**
292
303
  * A single month rendered as a 7-column grid of day cells, each showing its
293
304
  * event chips with a "+N more" overflow. Render it on its own for a static
@@ -320,6 +331,7 @@ type MonthPagerProps<T> = {
320
331
  sortedMonthView?: boolean;
321
332
  moreLabel?: string;
322
333
  showAdjacentMonths?: boolean;
334
+ highlightWeekends?: boolean;
323
335
  disableMonthEventCellPress?: boolean;
324
336
  isRTL?: boolean;
325
337
  calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
@@ -340,7 +352,7 @@ type MonthPagerProps<T> = {
340
352
  /** Replace the default date badge in each day cell. Receives the day. */
341
353
  renderCustomDateForMonth?: (date: Date) => React.ReactNode;
342
354
  } & SlotStyleProps<MonthViewSlot>;
343
- 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;
355
+ declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
344
356
  /**
345
357
  * A horizontally swipeable month carousel. Swipe left/right to page between
346
358
  * months; the committed month is reported through `onChangeDate`. It is the
@@ -390,6 +402,8 @@ type MonthListProps<T> = {
390
402
  moreLabel?: string;
391
403
  /** Show dimmed adjacent-month days. Default false (each month shows only its own days). */
392
404
  showAdjacentMonths?: boolean;
405
+ /** Tint weekend day cells with the theme's weekend background. Default true. */
406
+ highlightWeekends?: boolean;
393
407
  disableMonthEventCellPress?: boolean;
394
408
  isRTL?: boolean;
395
409
  activeDate?: Date;
@@ -427,7 +441,7 @@ type MonthListProps<T> = {
427
441
  /** Replace the per-month title (default "LLLL yyyy"). */
428
442
  renderMonthHeader?: (month: Date) => React.ReactNode;
429
443
  } & SlotStyleProps<MonthListSlot>;
430
- declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, 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;
444
+ declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
431
445
  /**
432
446
  * A vertically scrolling, virtualized list of month grids. It doubles as the
433
447
  * 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, 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, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
5
+ import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
6
6
  //#region src/theme.d.ts
7
7
  /**
8
8
  * The full set of colours, text styles and metrics the calendar paints with.
@@ -173,6 +173,15 @@ type RenderEventArgs<T = unknown> = {
173
173
  type RenderEvent<T = unknown> = ComponentType<RenderEventArgs<T>>;
174
174
  //#endregion
175
175
  //#region src/utils/slots.d.ts
176
+ /**
177
+ * The style shapes a slot can resolve to. A slot carries the style type of the
178
+ * element it is spread on, because React Native's style types stop being
179
+ * mutually assignable as soon as a consumer's types diverge them: Expo's
180
+ * react-native-web types widen `cursor` on `TextStyle` and `userSelect` on
181
+ * `ViewStyle`, so a `View` slot typed as `TextStyle` fails to compile in any
182
+ * Expo app.
183
+ */
184
+ type SlotStyle = ViewStyle | TextStyle | ImageStyle;
176
185
  /**
177
186
  * Per-slot styling overrides. Give a slot a Tailwind class (uniwind/NativeWind)
178
187
  * and/or a style override; missing slots keep the built-in look.
@@ -186,18 +195,18 @@ interface SlotStyleProps<Slot extends string> {
186
195
  */
187
196
  classNames?: Partial<Record<Slot, string>>;
188
197
  /** Style overrides per slot, merged last (win over defaults and classes). */
189
- styles?: Partial<Record<Slot, StyleProp<TextStyle>>>;
198
+ styles?: Partial<Record<Slot, StyleProp<SlotStyle>>>;
190
199
  }
191
200
  /** A slot's built-in styling, split so classes can replace the look but not the layout. */
192
- interface SlotDefault {
201
+ interface SlotDefault<Style extends SlotStyle = ViewStyle> {
193
202
  /** Structural styles kept even when a class is supplied. */
194
- base?: StyleProp<TextStyle>;
203
+ base?: StyleProp<Style>;
195
204
  /** Themed styles (colour, type, spacing) dropped when a class is supplied. */
196
- themed?: StyleProp<TextStyle>;
205
+ themed?: StyleProp<Style>;
197
206
  }
198
207
  /** The props a resolved slot spreads onto an element. */
199
- interface ResolvedSlot {
200
- style: StyleProp<TextStyle>;
208
+ interface ResolvedSlot<Style extends SlotStyle = ViewStyle> {
209
+ style: StyleProp<Style>;
201
210
  className?: string;
202
211
  }
203
212
  //#endregion
@@ -235,6 +244,8 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
235
244
  moreLabel?: string;
236
245
  /** Show dimmed days from adjacent months in the grid. Default true. */
237
246
  showAdjacentMonths?: boolean;
247
+ /** Tint weekend day cells with the theme's weekend background. Default true. */
248
+ highlightWeekends?: boolean;
238
249
  /** Ignore taps on month-cell events (day-cell taps still fire). Default false. */
239
250
  disableMonthEventCellPress?: boolean;
240
251
  /** Reverse the day order within each week (right-to-left). Default false. */
@@ -287,7 +298,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
287
298
  */
288
299
  renderCustomDateForMonth?: (date: Date) => React.ReactNode;
289
300
  };
290
- 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;
301
+ declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
291
302
  /**
292
303
  * A single month rendered as a 7-column grid of day cells, each showing its
293
304
  * event chips with a "+N more" overflow. Render it on its own for a static
@@ -320,6 +331,7 @@ type MonthPagerProps<T> = {
320
331
  sortedMonthView?: boolean;
321
332
  moreLabel?: string;
322
333
  showAdjacentMonths?: boolean;
334
+ highlightWeekends?: boolean;
323
335
  disableMonthEventCellPress?: boolean;
324
336
  isRTL?: boolean;
325
337
  calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
@@ -340,7 +352,7 @@ type MonthPagerProps<T> = {
340
352
  /** Replace the default date badge in each day cell. Receives the day. */
341
353
  renderCustomDateForMonth?: (date: Date) => React.ReactNode;
342
354
  } & SlotStyleProps<MonthViewSlot>;
343
- 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;
355
+ declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
344
356
  /**
345
357
  * A horizontally swipeable month carousel. Swipe left/right to page between
346
358
  * months; the committed month is reported through `onChangeDate`. It is the
@@ -390,6 +402,8 @@ type MonthListProps<T> = {
390
402
  moreLabel?: string;
391
403
  /** Show dimmed adjacent-month days. Default false (each month shows only its own days). */
392
404
  showAdjacentMonths?: boolean;
405
+ /** Tint weekend day cells with the theme's weekend background. Default true. */
406
+ highlightWeekends?: boolean;
393
407
  disableMonthEventCellPress?: boolean;
394
408
  isRTL?: boolean;
395
409
  activeDate?: Date;
@@ -427,7 +441,7 @@ type MonthListProps<T> = {
427
441
  /** Replace the per-month title (default "LLLL yyyy"). */
428
442
  renderMonthHeader?: (month: Date) => React.ReactNode;
429
443
  } & SlotStyleProps<MonthListSlot>;
430
- declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, 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;
444
+ declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
431
445
  /**
432
446
  * A vertically scrolling, virtualized list of month grids. It doubles as the
433
447
  * date picker: pass `selectedRange`/`selectedDates` and selection handlers to
@@ -222,7 +222,7 @@ function collectRowEvents(week, eventsByDay) {
222
222
  return out;
223
223
  }
224
224
  const pct = (n) => `${n}%`;
225
- 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 }) {
225
+ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = true, highlightWeekends = true, disableMonthEventCellPress = false, isRTL = false, showSixWeeks = false, showTitle = true, showWeekdays = true, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection = false, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
226
226
  const theme = useCalendarTheme();
227
227
  const slot = createSlots({
228
228
  classNames,
@@ -341,7 +341,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
341
341
  borderRightWidth: react_native.StyleSheet.hairlineWidth,
342
342
  borderColor: theme.colors.gridLine
343
343
  },
344
- (0, _super_calendar_core.isWeekend)(day) && { backgroundColor: theme.colors.weekendBackground },
344
+ highlightWeekends && (0, _super_calendar_core.isWeekend)(day) && { backgroundColor: theme.colors.weekendBackground },
345
345
  theme.containers.dayCell
346
346
  ]
347
347
  });
@@ -658,7 +658,7 @@ const styles$3 = react_native.StyleSheet.create({
658
658
  const isWeb$1 = react_native.Platform.OS === "web";
659
659
  const PAGE_WINDOW$1 = 60;
660
660
  const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
661
- 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 }) {
661
+ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
662
662
  const theme = useCalendarTheme();
663
663
  const slot = (0, react.useMemo)(() => createSlots({
664
664
  classNames,
@@ -756,6 +756,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
756
756
  sortedMonthView,
757
757
  moreLabel,
758
758
  showAdjacentMonths,
759
+ highlightWeekends,
759
760
  disableMonthEventCellPress,
760
761
  isRTL,
761
762
  showSixWeeks,
@@ -992,7 +993,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
992
993
  const NO_EVENTS = [];
993
994
  const noop = () => {};
994
995
  const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
995
- function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, 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 }) {
996
+ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, highlightWeekends = true, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }) {
996
997
  const theme = useCalendarTheme();
997
998
  const slot = (0, react.useMemo)(() => createSlots({
998
999
  classNames,
@@ -1223,6 +1224,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
1223
1224
  sortedMonthView,
1224
1225
  moreLabel,
1225
1226
  showAdjacentMonths,
1227
+ highlightWeekends,
1226
1228
  disableMonthEventCellPress,
1227
1229
  isRTL,
1228
1230
  activeDate,
@@ -222,7 +222,7 @@ function collectRowEvents(week, eventsByDay) {
222
222
  return out;
223
223
  }
224
224
  const pct = (n) => `${n}%`;
225
- 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 }) {
225
+ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = true, highlightWeekends = true, disableMonthEventCellPress = false, isRTL = false, showSixWeeks = false, showTitle = true, showWeekdays = true, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection = false, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
226
226
  const theme = useCalendarTheme();
227
227
  const slot = createSlots({
228
228
  classNames,
@@ -341,7 +341,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
341
341
  borderRightWidth: StyleSheet.hairlineWidth,
342
342
  borderColor: theme.colors.gridLine
343
343
  },
344
- isWeekend(day) && { backgroundColor: theme.colors.weekendBackground },
344
+ highlightWeekends && isWeekend(day) && { backgroundColor: theme.colors.weekendBackground },
345
345
  theme.containers.dayCell
346
346
  ]
347
347
  });
@@ -658,7 +658,7 @@ const styles$3 = StyleSheet.create({
658
658
  const isWeb$1 = Platform.OS === "web";
659
659
  const PAGE_WINDOW$1 = 60;
660
660
  const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
661
- 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 }) {
661
+ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
662
662
  const theme = useCalendarTheme();
663
663
  const slot = useMemo(() => createSlots({
664
664
  classNames,
@@ -756,6 +756,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
756
756
  sortedMonthView,
757
757
  moreLabel,
758
758
  showAdjacentMonths,
759
+ highlightWeekends,
759
760
  disableMonthEventCellPress,
760
761
  isRTL,
761
762
  showSixWeeks,
@@ -992,7 +993,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
992
993
  const NO_EVENTS = [];
993
994
  const noop = () => {};
994
995
  const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
995
- function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, 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 }) {
996
+ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, highlightWeekends = true, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }) {
996
997
  const theme = useCalendarTheme();
997
998
  const slot = useMemo(() => createSlots({
998
999
  classNames,
@@ -1223,6 +1224,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
1223
1224
  sortedMonthView,
1224
1225
  moreLabel,
1225
1226
  showAdjacentMonths,
1227
+ highlightWeekends,
1226
1228
  disableMonthEventCellPress,
1227
1229
  isRTL,
1228
1230
  activeDate,
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as PartialCalendarTheme, C as RenderEvent, D as WeekdayFormat, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, S as RecurrenceRule, T as TimeGridMode, _ as EventAccessibilityLabelContext, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarMode, h as CalendarEvent, i as MonthListSlot, j as darkTheme, k as CalendarThemeProvider, 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 EventAccessibilityLabeler, w as RenderEventArgs, x as RecurrenceFrequency, y as EventKeyExtractor } from "./DefaultMonthEvent-Cm9DsHBK.mjs";
1
+ import { A as PartialCalendarTheme, C as RenderEvent, D as WeekdayFormat, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, S as RecurrenceRule, T as TimeGridMode, _ as EventAccessibilityLabelContext, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarMode, h as CalendarEvent, i as MonthListSlot, j as darkTheme, k as CalendarThemeProvider, 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 EventAccessibilityLabeler, w as RenderEventArgs, x as RecurrenceFrequency, y as EventKeyExtractor } from "./DefaultMonthEvent-Cewbec1K.mjs";
2
2
  import { Locale } from "date-fns";
3
3
  import { ComponentType, ReactElement, ReactNode } from "react";
4
4
  import { SharedValue, useSharedValue } from "react-native-reanimated";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as PartialCalendarTheme, C as RenderEvent, D as WeekdayFormat, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, S as RecurrenceRule, T as TimeGridMode, _ as EventAccessibilityLabelContext, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarMode, h as CalendarEvent, i as MonthListSlot, j as darkTheme, k as CalendarThemeProvider, 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 EventAccessibilityLabeler, w as RenderEventArgs, x as RecurrenceFrequency, y as EventKeyExtractor } from "./DefaultMonthEvent-DAxZjk_D.js";
1
+ import { A as PartialCalendarTheme, C as RenderEvent, D as WeekdayFormat, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, S as RecurrenceRule, T as TimeGridMode, _ as EventAccessibilityLabelContext, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarMode, h as CalendarEvent, i as MonthListSlot, j as darkTheme, k as CalendarThemeProvider, 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 EventAccessibilityLabeler, w as RenderEventArgs, x as RecurrenceFrequency, y as EventKeyExtractor } from "./DefaultMonthEvent-C_T4thzu.js";
2
2
  import { Locale } from "date-fns";
3
3
  import { ComponentType, ReactElement, ReactNode } from "react";
4
4
  import { StyleProp, ViewStyle } from "react-native";
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-BWTCCmko.js");
24
+ const require_MonthList = require("./MonthList-C-vBotP0.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");
@@ -2254,6 +2254,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
2254
2254
  sortedMonthView,
2255
2255
  moreLabel,
2256
2256
  showAdjacentMonths,
2257
+ highlightWeekends,
2257
2258
  disableMonthEventCellPress,
2258
2259
  isRTL,
2259
2260
  showSixWeeks,
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as withEventAccessibilityLabel, c as createSlots, d as darkTheme, f as defaultTheme, i as MonthView, l as useSlots, m as useCalendarTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as mergeTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarThemeProvider } from "./MonthList-Chx0jP5n.mjs";
1
+ import { a as withEventAccessibilityLabel, c as createSlots, d as darkTheme, f as defaultTheme, i as MonthView, l as useSlots, m as useCalendarTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as mergeTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarThemeProvider } from "./MonthList-DjAz4xoi.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, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
4
4
  import Animated, { runOnJS, scrollTo, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
@@ -2230,6 +2230,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
2230
2230
  sortedMonthView,
2231
2231
  moreLabel,
2232
2232
  showAdjacentMonths,
2233
+ highlightWeekends,
2233
2234
  disableMonthEventCellPress,
2234
2235
  isRTL,
2235
2236
  showSixWeeks,
package/dist/picker.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as PartialCalendarTheme, C as RenderEvent, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as darkTheme, k as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as RenderEventArgs, y as EventKeyExtractor } from "./DefaultMonthEvent-Cm9DsHBK.mjs";
1
+ import { A as PartialCalendarTheme, C as RenderEvent, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as darkTheme, k as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as RenderEventArgs, y as EventKeyExtractor } from "./DefaultMonthEvent-Cewbec1K.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 PartialCalendarTheme, C as RenderEvent, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as darkTheme, k as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as RenderEventArgs, y as EventKeyExtractor } from "./DefaultMonthEvent-DAxZjk_D.js";
1
+ import { A as PartialCalendarTheme, C as RenderEvent, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as darkTheme, k as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as RenderEventArgs, y as EventKeyExtractor } from "./DefaultMonthEvent-C_T4thzu.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-BWTCCmko.js");
2
+ const require_MonthList = require("./MonthList-C-vBotP0.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 { d as darkTheme, f as defaultTheme, i as MonthView, m as useCalendarTheme, n as DefaultMonthEvent, p as mergeTheme, r as MonthPager, t as MonthList, u as CalendarThemeProvider } from "./MonthList-Chx0jP5n.mjs";
1
+ import { d as darkTheme, f as defaultTheme, i as MonthView, m as useCalendarTheme, n as DefaultMonthEvent, p as mergeTheme, r as MonthPager, t as MonthList, u as CalendarThemeProvider } from "./MonthList-DjAz4xoi.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.8.0",
3
+ "version": "2.8.2",
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.8.0"
67
+ "@super-calendar/core": "2.8.2"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@legendapp/list": ">=3",
@@ -1,7 +1,7 @@
1
1
  import { LegendList, type LegendListRenderItemProps } from "@legendapp/list/react-native";
2
2
  import { format, isSameDay, type Locale, startOfDay } from "date-fns";
3
3
  import { type ComponentType, type ReactElement, useCallback, useMemo } from "react";
4
- import { StyleSheet, Text, View } from "react-native";
4
+ import { StyleSheet, Text, type TextStyle, View } from "react-native";
5
5
  import { useCalendarTheme } from "../theme";
6
6
  import type { CalendarEvent, EventKeyExtractor, RenderEvent } from "../types";
7
7
  import { createSlots, type SlotStyleProps } from "../utils/slots";
@@ -83,7 +83,7 @@ export function Agenda<T>({
83
83
  const isHighlighted = activeDate ? isSameDay(item.date, activeDate) : getIsToday(item.date);
84
84
  return (
85
85
  <Text
86
- {...slot("dayHeader", {
86
+ {...slot<TextStyle>("dayHeader", {
87
87
  base: styles.header,
88
88
  themed: [
89
89
  styles.headerText,
@@ -124,7 +124,7 @@ export function Agenda<T>({
124
124
  if (rows.length === 0) {
125
125
  return (
126
126
  <Text
127
- {...slot("empty", {
127
+ {...slot<TextStyle>("empty", {
128
128
  base: styles.empty,
129
129
  themed: [styles.emptyText, { color: theme.colors.textMuted }],
130
130
  })}
@@ -1,5 +1,5 @@
1
1
  import { addDays, startOfDay } from "date-fns";
2
- import { StyleSheet, Text, View } from "react-native";
2
+ import { StyleSheet, Text, type TextStyle, View } from "react-native";
3
3
  import { useCalendarTheme } from "../theme";
4
4
  import type { CalendarEvent, CalendarMode, EventKeyExtractor, RenderEvent } from "../types";
5
5
  import { useSlots } from "../utils/slots";
@@ -64,7 +64,7 @@ export function AllDayLane<T>({
64
64
  and right-aligned against the timed columns. Centered vertically so it
65
65
  lines up with the chips whether the lane holds one event or several. */}
66
66
  <Text
67
- {...slot("allDayLabel", {
67
+ {...slot<TextStyle>("allDayLabel", {
68
68
  base: styles.label,
69
69
  themed: { color: theme.colors.textMuted },
70
70
  })}
@@ -553,6 +553,7 @@ export function Calendar<T>({
553
553
  sortedMonthView={sortedMonthView}
554
554
  moreLabel={moreLabel}
555
555
  showAdjacentMonths={showAdjacentMonths}
556
+ highlightWeekends={highlightWeekends}
556
557
  disableMonthEventCellPress={disableMonthEventCellPress}
557
558
  isRTL={isRTL}
558
559
  showSixWeeks={showSixWeeks}
@@ -21,6 +21,7 @@ import {
21
21
  StyleSheet,
22
22
  type StyleProp,
23
23
  Text,
24
+ type TextStyle,
24
25
  View,
25
26
  type ViewStyle,
26
27
  } from "react-native";
@@ -101,6 +102,8 @@ export type MonthListProps<T> = {
101
102
  moreLabel?: string;
102
103
  /** Show dimmed adjacent-month days. Default false (each month shows only its own days). */
103
104
  showAdjacentMonths?: boolean;
105
+ /** Tint weekend day cells with the theme's weekend background. Default true. */
106
+ highlightWeekends?: boolean;
104
107
  disableMonthEventCellPress?: boolean;
105
108
  isRTL?: boolean;
106
109
  activeDate?: Date;
@@ -151,6 +154,7 @@ function MonthListInner<T>({
151
154
  sortedMonthView,
152
155
  moreLabel,
153
156
  showAdjacentMonths = false,
157
+ highlightWeekends = true,
154
158
  disableMonthEventCellPress,
155
159
  isRTL,
156
160
  activeDate,
@@ -437,7 +441,7 @@ function MonthListInner<T>({
437
441
  renderMonthHeader(item)
438
442
  ) : (
439
443
  <Text
440
- {...slot("title", {
444
+ {...slot<TextStyle>("title", {
441
445
  base: styles.monthTitle,
442
446
  themed: [styles.monthTitleText, { color: theme.colors.text }],
443
447
  })}
@@ -463,6 +467,7 @@ function MonthListInner<T>({
463
467
  sortedMonthView={sortedMonthView}
464
468
  moreLabel={moreLabel}
465
469
  showAdjacentMonths={showAdjacentMonths}
470
+ highlightWeekends={highlightWeekends}
466
471
  disableMonthEventCellPress={disableMonthEventCellPress}
467
472
  isRTL={isRTL}
468
473
  activeDate={activeDate}
@@ -556,7 +561,7 @@ function MonthListInner<T>({
556
561
  {weekDays.map((day) => (
557
562
  <Text
558
563
  key={day.toISOString()}
559
- {...slot("weekday", {
564
+ {...slot<TextStyle>("weekday", {
560
565
  base: styles.weekdayLabel,
561
566
  themed: [styles.weekdayLabelText, { color: theme.colors.textMuted }],
562
567
  })}
@@ -11,6 +11,7 @@ import {
11
11
  StyleSheet,
12
12
  type StyleProp,
13
13
  Text,
14
+ type TextStyle,
14
15
  useWindowDimensions,
15
16
  View,
16
17
  type ViewStyle,
@@ -53,6 +54,7 @@ export type MonthPagerProps<T> = {
53
54
  sortedMonthView?: boolean;
54
55
  moreLabel?: string;
55
56
  showAdjacentMonths?: boolean;
57
+ highlightWeekends?: boolean;
56
58
  disableMonthEventCellPress?: boolean;
57
59
  isRTL?: boolean;
58
60
  calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
@@ -85,6 +87,7 @@ function MonthPagerInner<T>({
85
87
  sortedMonthView,
86
88
  moreLabel,
87
89
  showAdjacentMonths,
90
+ highlightWeekends,
88
91
  disableMonthEventCellPress,
89
92
  isRTL,
90
93
  calendarCellStyle,
@@ -250,6 +253,7 @@ function MonthPagerInner<T>({
250
253
  sortedMonthView={sortedMonthView}
251
254
  moreLabel={moreLabel}
252
255
  showAdjacentMonths={showAdjacentMonths}
256
+ highlightWeekends={highlightWeekends}
253
257
  disableMonthEventCellPress={disableMonthEventCellPress}
254
258
  isRTL={isRTL}
255
259
  showSixWeeks={showSixWeeks}
@@ -301,7 +305,7 @@ function MonthPagerInner<T>({
301
305
  {/* The active month's title, above the (shared) weekday header — mirrors the
302
306
  dom MonthView's title. The grids below omit their own title/weekdays. */}
303
307
  <Text
304
- {...slot("title", {
308
+ {...slot<TextStyle>("title", {
305
309
  base: styles.monthTitle,
306
310
  themed: [theme.text.monthTitle, { color: theme.colors.text }],
307
311
  })}
@@ -408,7 +412,7 @@ const MonthWeekdayHeader = ({
408
412
  {weekDays.map((day) => (
409
413
  <Text
410
414
  key={day.toISOString()}
411
- {...slot("weekday", {
415
+ {...slot<TextStyle>("weekday", {
412
416
  base: styles.weekdayLabel,
413
417
  themed: [theme.text.weekday, { color: theme.colors.textMuted }],
414
418
  })}
@@ -10,6 +10,7 @@ import {
10
10
  StyleSheet,
11
11
  type StyleProp,
12
12
  Text,
13
+ type TextStyle,
13
14
  TouchableOpacity,
14
15
  View,
15
16
  type ViewStyle,
@@ -136,6 +137,8 @@ export type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
136
137
  moreLabel?: string;
137
138
  /** Show dimmed days from adjacent months in the grid. Default true. */
138
139
  showAdjacentMonths?: boolean;
140
+ /** Tint weekend day cells with the theme's weekend background. Default true. */
141
+ highlightWeekends?: boolean;
139
142
  /** Ignore taps on month-cell events (day-cell taps still fire). Default false. */
140
143
  disableMonthEventCellPress?: boolean;
141
144
  /** Reverse the day order within each week (right-to-left). Default false. */
@@ -200,6 +203,7 @@ function MonthViewInner<T>({
200
203
  sortedMonthView = true,
201
204
  moreLabel = "{moreCount} More",
202
205
  showAdjacentMonths = true,
206
+ highlightWeekends = true,
203
207
  disableMonthEventCellPress = false,
204
208
  isRTL = false,
205
209
  showSixWeeks = false,
@@ -412,7 +416,7 @@ function MonthViewInner<T>({
412
416
  borderRightWidth: StyleSheet.hairlineWidth,
413
417
  borderColor: theme.colors.gridLine,
414
418
  },
415
- isWeekend(day) && { backgroundColor: theme.colors.weekendBackground },
419
+ highlightWeekends && isWeekend(day) && { backgroundColor: theme.colors.weekendBackground },
416
420
  theme.containers.dayCell,
417
421
  ],
418
422
  });
@@ -528,7 +532,9 @@ function MonthViewInner<T>({
528
532
  })}
529
533
  >
530
534
  <Text
531
- {...slot("dayBadgeText", { themed: [theme.text.dateCell, { color: dateColor }] })}
535
+ {...slot<TextStyle>("dayBadgeText", {
536
+ themed: [theme.text.dateCell, { color: dateColor }],
537
+ })}
532
538
  allowFontScaling={false}
533
539
  >
534
540
  {format(day, "d")}
@@ -546,7 +552,7 @@ function MonthViewInner<T>({
546
552
  ))}
547
553
  {hiddenCount > 0 ? (
548
554
  <Text
549
- {...slot("more", {
555
+ {...slot<TextStyle>("more", {
550
556
  base: styles.moreLabel,
551
557
  themed: [theme.text.more, { color: theme.colors.textMuted }],
552
558
  })}
@@ -575,7 +581,7 @@ function MonthViewInner<T>({
575
581
  <View style={styles.root}>
576
582
  {showTitle ? (
577
583
  <Text
578
- {...slot("title", {
584
+ {...slot<TextStyle>("title", {
579
585
  base: styles.title,
580
586
  themed: [theme.text.monthTitle, { color: theme.colors.text }],
581
587
  })}
@@ -594,7 +600,7 @@ function MonthViewInner<T>({
594
600
  {weekdayLabels.map((day) => (
595
601
  <Text
596
602
  key={day.toISOString()}
597
- {...slot("weekday", {
603
+ {...slot<TextStyle>("weekday", {
598
604
  base: styles.weekdayLabel,
599
605
  themed: [theme.text.weekday, { color: theme.colors.textMuted }],
600
606
  })}
@@ -34,6 +34,7 @@ import {
34
34
  StyleSheet,
35
35
  type StyleProp,
36
36
  Text,
37
+ type TextStyle,
37
38
  useWindowDimensions,
38
39
  View,
39
40
  type ViewStyle,
@@ -842,7 +843,7 @@ const HourRow = ({
842
843
  <View style={{ width: hourColumnWidth }}>{hourComponent(hour, ampm)}</View>
843
844
  ) : (
844
845
  <Text
845
- {...slot("hourLabel", {
846
+ {...slot<TextStyle>("hourLabel", {
846
847
  base: [styles.hourLabel, { width: hourColumnWidth }],
847
848
  themed: [theme.text.hourLabel, { color: theme.colors.textMuted }],
848
849
  })}
@@ -2557,7 +2558,7 @@ const DefaultHeader = ({
2557
2558
  <View style={[styles.weekNumberGutter, { width: hourColumnWidth }]}>
2558
2559
  {showWeekNumber && hourColumnWidth > 0 && days[0] ? (
2559
2560
  <Text
2560
- {...slot("weekNumber", {
2561
+ {...slot<TextStyle>("weekNumber", {
2561
2562
  themed: [theme.text.hourLabel, { color: theme.colors.textMuted }],
2562
2563
  })}
2563
2564
  allowFontScaling={false}
@@ -2623,7 +2624,7 @@ const DayHeader = ({
2623
2624
  const content = (
2624
2625
  <>
2625
2626
  <Text
2626
- {...slot("columnHeaderWeekday", {
2627
+ {...slot<TextStyle>("columnHeaderWeekday", {
2627
2628
  themed: [{ color: theme.colors.textMuted }, theme.text.columnHeaderWeekday],
2628
2629
  })}
2629
2630
  allowFontScaling={false}
@@ -2641,7 +2642,7 @@ const DayHeader = ({
2641
2642
  })}
2642
2643
  >
2643
2644
  <Text
2644
- {...slot("columnHeaderDateText", {
2645
+ {...slot<TextStyle>("columnHeaderDateText", {
2645
2646
  themed: [
2646
2647
  theme.text.dayNumber,
2647
2648
  // The state colour stays last so a themed dayNumber can't break the
@@ -6,6 +6,7 @@ import {
6
6
  ScrollView,
7
7
  StyleSheet,
8
8
  Text,
9
+ type TextStyle,
9
10
  View,
10
11
  } from "react-native";
11
12
  import { useCalendarTheme } from "../theme";
@@ -117,7 +118,7 @@ function YearViewInner<T>({
117
118
  const monthLabel = format(month, "MMMM yyyy", { locale });
118
119
  const titleText = (
119
120
  <Text
120
- {...slot("monthTitle", {
121
+ {...slot<TextStyle>("monthTitle", {
121
122
  base: styles.monthTitle,
122
123
  themed: [styles.monthTitleText, { color: theme.colors.todayBackground }],
123
124
  })}
@@ -155,7 +156,7 @@ function YearViewInner<T>({
155
156
  {weekdayLabels.map((label, i) => (
156
157
  <Text
157
158
  key={i}
158
- {...slot("weekday", {
159
+ {...slot<TextStyle>("weekday", {
159
160
  base: styles.weekday,
160
161
  themed: [styles.weekdayText, { color: theme.colors.textMuted }],
161
162
  })}
@@ -192,7 +193,7 @@ function YearViewInner<T>({
192
193
  const content = (
193
194
  <>
194
195
  <Text
195
- {...slot("dayText", {
196
+ {...slot<TextStyle>("dayText", {
196
197
  themed: [
197
198
  styles.dayText,
198
199
  {
@@ -15,7 +15,17 @@
15
15
  // prop React Native silently ignores, so the props are safe to pass everywhere.
16
16
 
17
17
  import { createContext, createElement, type ReactNode, useContext, useMemo } from "react";
18
- import type { StyleProp, TextStyle } from "react-native";
18
+ import type { ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
19
+
20
+ /**
21
+ * The style shapes a slot can resolve to. A slot carries the style type of the
22
+ * element it is spread on, because React Native's style types stop being
23
+ * mutually assignable as soon as a consumer's types diverge them: Expo's
24
+ * react-native-web types widen `cursor` on `TextStyle` and `userSelect` on
25
+ * `ViewStyle`, so a `View` slot typed as `TextStyle` fails to compile in any
26
+ * Expo app.
27
+ */
28
+ export type SlotStyle = ViewStyle | TextStyle | ImageStyle;
19
29
 
20
30
  /**
21
31
  * Per-slot styling overrides. Give a slot a Tailwind class (uniwind/NativeWind)
@@ -30,20 +40,20 @@ export interface SlotStyleProps<Slot extends string> {
30
40
  */
31
41
  classNames?: Partial<Record<Slot, string>>;
32
42
  /** Style overrides per slot, merged last (win over defaults and classes). */
33
- styles?: Partial<Record<Slot, StyleProp<TextStyle>>>;
43
+ styles?: Partial<Record<Slot, StyleProp<SlotStyle>>>;
34
44
  }
35
45
 
36
46
  /** A slot's built-in styling, split so classes can replace the look but not the layout. */
37
- export interface SlotDefault {
47
+ export interface SlotDefault<Style extends SlotStyle = ViewStyle> {
38
48
  /** Structural styles kept even when a class is supplied. */
39
- base?: StyleProp<TextStyle>;
49
+ base?: StyleProp<Style>;
40
50
  /** Themed styles (colour, type, spacing) dropped when a class is supplied. */
41
- themed?: StyleProp<TextStyle>;
51
+ themed?: StyleProp<Style>;
42
52
  }
43
53
 
44
54
  /** The props a resolved slot spreads onto an element. */
45
- export interface ResolvedSlot {
46
- style: StyleProp<TextStyle>;
55
+ export interface ResolvedSlot<Style extends SlotStyle = ViewStyle> {
56
+ style: StyleProp<Style>;
47
57
  className?: string;
48
58
  }
49
59
 
@@ -53,10 +63,24 @@ export interface ResolvedSlot {
53
63
  * consumer supplied one, a `className` for the Tailwind runtime to pick up.
54
64
  */
55
65
  export function createSlots<Slot extends string>({ classNames, styles }: SlotStyleProps<Slot>) {
56
- return (name: Slot, defaults?: SlotDefault): ResolvedSlot => {
66
+ // `NoInfer` keeps the element type a decision, not a guess: without it the
67
+ // literal type of a `StyleSheet.create` entry wins the inference and every
68
+ // themed style passed alongside it is then measured against that one entry.
69
+ // Slots default to a `View`; `slot<TextStyle>(...)` marks the text ones.
70
+ return <Style extends SlotStyle = ViewStyle>(
71
+ name: Slot,
72
+ defaults?: SlotDefault<NoInfer<Style>>,
73
+ ): ResolvedSlot<Style> => {
57
74
  const slotClass = classNames?.[name];
58
75
  return {
59
- style: [defaults?.base, slotClass ? undefined : defaults?.themed, styles?.[name]],
76
+ style: [
77
+ defaults?.base,
78
+ slotClass ? undefined : defaults?.themed,
79
+ // A consumer's override is declared for any element's style, so it is
80
+ // narrowed to this slot's element here. React Native flattens the array
81
+ // and drops properties the element does not support either way.
82
+ styles?.[name] as StyleProp<Style>,
83
+ ],
60
84
  ...(slotClass ? { className: slotClass } : null),
61
85
  };
62
86
  };