@super-calendar/native 2.18.0 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -102,7 +102,9 @@ export function MultiWeekCalendar() {
102
102
  `MultiWeekView` exposes a standalone window with the month grid's event bars,
103
103
  overflow, selection, drag interactions, and styling. Pass expanded events to it;
104
104
  `Calendar` handles recurrence and time zones. Custom event renderers receive
105
- `mode: "multiweek"`. Rows scroll vertically when the container is too short.
105
+ `mode: "multiweek"`. Week rows share the available height and scroll vertically
106
+ when their contents need more room. Dates align at the top of each cell so bars
107
+ and overflow labels line up across days.
106
108
  Counts must be positive safe integers whose date span is representable; invalid
107
109
  counts or dates throw `RangeError`. Rows are materialized, so larger counts need
108
110
  more space. `MonthView` and `MonthPager` retain their month-only behavior.
@@ -155,9 +157,9 @@ A cancelled gesture clears the preview without calling `onCreateEvent`.
155
157
  all-day range, with an exclusive end, and render one copy per covered week row.
156
158
  Use date labels rather than times for this content. The preview updates when
157
159
  the sweep reaches another day, uses `chipHeight`, `chipGap`, and the
158
- `createGhost` slot, and overlays a visible event lane without changing the row
159
- height. Content is clipped, ignores pointer input, and is hidden from screen
160
- readers. On React Native Web, it also stays out of the tab order. Both the renderer and `onCreateEvent` are required; together they also
160
+ `createGhost` slot, and sits on the lane the created all-day event will take,
161
+ moving the row's other bars aside without changing the row height. Content is
162
+ clipped, ignores pointer input, and is hidden from screen readers. On React Native Web, it also stays out of the tab order. Both the renderer and `onCreateEvent` are required; together they also
161
163
  show the event-grid layout in an empty month. Omitting the renderer preserves
162
164
  the existing day highlight.
163
165
 
@@ -1,8 +1,8 @@
1
1
  import { Locale } from "date-fns";
2
2
  import { ComponentType, ReactElement, ReactNode } from "react";
3
- import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
4
3
  import { SharedValue } from "react-native-reanimated";
5
4
  import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs, CreateGhostArgs as CreateGhostArgs$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
5
+ import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
6
6
  /**
7
7
  * The full set of colours, text styles and metrics the calendar paints with.
8
8
  * Supply a `Partial<CalendarTheme>` to `<Calendar theme={...} />`; missing keys
@@ -181,6 +181,23 @@ type RenderEventArgs<T = unknown> = {
181
181
  * (`flex: 1`); the calendar positions and sizes the wrapping box for you.
182
182
  */
183
183
  type RenderEvent<T = unknown> = ComponentType<RenderEventArgs<T>>;
184
+ /**
185
+ * The state of a month day cell, passed to `renderCustomDateForMonth` so a custom
186
+ * date badge can style the day the way the built-in badge does.
187
+ */
188
+ type MonthDateInfo = {
189
+ /**
190
+ * False for a day from the previous or next month, shown with
191
+ * `showAdjacentMonths`. Always true in `MultiWeekView`.
192
+ */
193
+ isCurrentMonth: boolean;
194
+ /** The day is today. */
195
+ isToday: boolean;
196
+ /** The day is in `selectedDates` or is an endpoint of `selectedRange`. */
197
+ isSelected: boolean;
198
+ /** The day fails `minDate`, `maxDate` or `isDateDisabled`. */
199
+ isDisabled: boolean;
200
+ };
184
201
  /**
185
202
  * The style shapes a slot can resolve to. A slot carries the style type of the
186
203
  * element it is spread on, because React Native's style types stop being
@@ -358,10 +375,11 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
358
375
  /** Reject a drop that would overlap another event (default true = allowed). */
359
376
  eventOverlap?: boolean;
360
377
  /**
361
- * Replace the default date badge in each day cell. Receives the day; return
362
- * your own date label. Event chips and the "+N more" label still render below.
378
+ * Replace the default date badge in each day cell. Receives the day and its
379
+ * state (`isCurrentMonth`, `isToday`, `isSelected`, `isDisabled`); return your
380
+ * own date label. Event chips and the "+N more" label still render below.
363
381
  */
364
- renderCustomDateForMonth?: (date: Date) => React.ReactNode;
382
+ renderCustomDateForMonth?: (date: Date, info: MonthDateInfo) => React.ReactNode;
365
383
  };
366
384
  declare function MonthViewInner<T>({ date, showAdjacentMonths, showSixWeeks, ...rest }: MonthViewProps<T>): ReactElement;
367
385
  /**
@@ -450,8 +468,8 @@ type MonthPagerProps<T> = {
450
468
  activeDate?: Date;
451
469
  /** Replace the weekday-label header above the month grid. Receives the week's days. */
452
470
  renderHeaderForMonthView?: (weekDays: Date[]) => React.ReactNode;
453
- /** Replace the default date badge in each day cell. Receives the day. */
454
- renderCustomDateForMonth?: (date: Date) => React.ReactNode;
471
+ /** Replace the default date badge in each day cell. Receives the day and its state. */
472
+ renderCustomDateForMonth?: (date: Date, info: MonthDateInfo) => React.ReactNode;
455
473
  } & SlotStyleProps<MonthViewSlot>;
456
474
  declare function MonthPagerInner<T>({ showAdjacentMonths, showSixWeeks, ...rest }: MonthPagerProps<T>): ReactElement;
457
475
  /**
@@ -574,4 +592,4 @@ declare const MonthList: typeof MonthListInner;
574
592
  * Reanimated.
575
593
  */
576
594
  declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
577
- export { TimeGridMode as A, EventKeyExtractor as C, RenderEvent as D, RecurrenceRule as E, PartialCalendarTheme as F, darkTheme as I, defaultTheme as L, WeekdayFormat$1 as M, CalendarTheme as N, RenderEventArgs as O, CalendarThemeProvider as P, mergeTheme as R, EventDragStartHandler as S, RecurrenceFrequency as T, CalendarMode$1 as _, MonthPager as a, EventAccessibilityLabeler$1 as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, WeekStartsOn$1 as j, ScrollToTimeOptions 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, CreateGhostArgs$1 as v, ICalendarEvent as w, EventDragHandler as x, EventAccessibilityLabelContext as y, useCalendarTheme as z };
595
+ export { ScrollToTimeOptions as A, useCalendarTheme as B, EventKeyExtractor as C, RecurrenceRule as D, RecurrenceFrequency as E, CalendarThemeProvider as F, PartialCalendarTheme as I, darkTheme as L, WeekStartsOn$1 as M, WeekdayFormat$1 as N, RenderEvent as O, CalendarTheme as P, defaultTheme as R, EventDragStartHandler as S, MonthDateInfo as T, CalendarMode$1 as _, MonthPager as a, EventAccessibilityLabeler$1 as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, TimeGridMode as j, RenderEventArgs 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, CreateGhostArgs$1 as v, ICalendarEvent as w, EventDragHandler as x, EventAccessibilityLabelContext as y, mergeTheme as z };
@@ -1,8 +1,8 @@
1
1
  import { Locale } from "date-fns";
2
2
  import { ComponentType, ReactElement, ReactNode } from "react";
3
+ import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
3
4
  import { SharedValue } from "react-native-reanimated";
4
5
  import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs, CreateGhostArgs as CreateGhostArgs$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
5
- import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
6
6
  /**
7
7
  * The full set of colours, text styles and metrics the calendar paints with.
8
8
  * Supply a `Partial<CalendarTheme>` to `<Calendar theme={...} />`; missing keys
@@ -181,6 +181,23 @@ type RenderEventArgs<T = unknown> = {
181
181
  * (`flex: 1`); the calendar positions and sizes the wrapping box for you.
182
182
  */
183
183
  type RenderEvent<T = unknown> = ComponentType<RenderEventArgs<T>>;
184
+ /**
185
+ * The state of a month day cell, passed to `renderCustomDateForMonth` so a custom
186
+ * date badge can style the day the way the built-in badge does.
187
+ */
188
+ type MonthDateInfo = {
189
+ /**
190
+ * False for a day from the previous or next month, shown with
191
+ * `showAdjacentMonths`. Always true in `MultiWeekView`.
192
+ */
193
+ isCurrentMonth: boolean;
194
+ /** The day is today. */
195
+ isToday: boolean;
196
+ /** The day is in `selectedDates` or is an endpoint of `selectedRange`. */
197
+ isSelected: boolean;
198
+ /** The day fails `minDate`, `maxDate` or `isDateDisabled`. */
199
+ isDisabled: boolean;
200
+ };
184
201
  /**
185
202
  * The style shapes a slot can resolve to. A slot carries the style type of the
186
203
  * element it is spread on, because React Native's style types stop being
@@ -358,10 +375,11 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
358
375
  /** Reject a drop that would overlap another event (default true = allowed). */
359
376
  eventOverlap?: boolean;
360
377
  /**
361
- * Replace the default date badge in each day cell. Receives the day; return
362
- * your own date label. Event chips and the "+N more" label still render below.
378
+ * Replace the default date badge in each day cell. Receives the day and its
379
+ * state (`isCurrentMonth`, `isToday`, `isSelected`, `isDisabled`); return your
380
+ * own date label. Event chips and the "+N more" label still render below.
363
381
  */
364
- renderCustomDateForMonth?: (date: Date) => React.ReactNode;
382
+ renderCustomDateForMonth?: (date: Date, info: MonthDateInfo) => React.ReactNode;
365
383
  };
366
384
  declare function MonthViewInner<T>({ date, showAdjacentMonths, showSixWeeks, ...rest }: MonthViewProps<T>): ReactElement;
367
385
  /**
@@ -450,8 +468,8 @@ type MonthPagerProps<T> = {
450
468
  activeDate?: Date;
451
469
  /** Replace the weekday-label header above the month grid. Receives the week's days. */
452
470
  renderHeaderForMonthView?: (weekDays: Date[]) => React.ReactNode;
453
- /** Replace the default date badge in each day cell. Receives the day. */
454
- renderCustomDateForMonth?: (date: Date) => React.ReactNode;
471
+ /** Replace the default date badge in each day cell. Receives the day and its state. */
472
+ renderCustomDateForMonth?: (date: Date, info: MonthDateInfo) => React.ReactNode;
455
473
  } & SlotStyleProps<MonthViewSlot>;
456
474
  declare function MonthPagerInner<T>({ showAdjacentMonths, showSixWeeks, ...rest }: MonthPagerProps<T>): ReactElement;
457
475
  /**
@@ -574,4 +592,4 @@ declare const MonthList: typeof MonthListInner;
574
592
  * Reanimated.
575
593
  */
576
594
  declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
577
- export { TimeGridMode as A, EventKeyExtractor as C, RenderEvent as D, RecurrenceRule as E, PartialCalendarTheme as F, darkTheme as I, defaultTheme as L, WeekdayFormat$1 as M, CalendarTheme as N, RenderEventArgs as O, CalendarThemeProvider as P, mergeTheme as R, EventDragStartHandler as S, RecurrenceFrequency as T, CalendarMode$1 as _, MonthPager as a, EventAccessibilityLabeler$1 as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, WeekStartsOn$1 as j, ScrollToTimeOptions 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, CreateGhostArgs$1 as v, ICalendarEvent as w, EventDragHandler as x, EventAccessibilityLabelContext as y, useCalendarTheme as z };
595
+ export { ScrollToTimeOptions as A, useCalendarTheme as B, EventKeyExtractor as C, RecurrenceRule as D, RecurrenceFrequency as E, CalendarThemeProvider as F, PartialCalendarTheme as I, darkTheme as L, WeekStartsOn$1 as M, WeekdayFormat$1 as N, RenderEvent as O, CalendarTheme as P, defaultTheme as R, EventDragStartHandler as S, MonthDateInfo as T, CalendarMode$1 as _, MonthPager as a, EventAccessibilityLabeler$1 as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, TimeGridMode as j, RenderEventArgs 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, CreateGhostArgs$1 as v, ICalendarEvent as w, EventDragHandler as x, EventAccessibilityLabelContext as y, mergeTheme as z };