@super-calendar/native 2.18.0 → 2.20.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.
@@ -111,6 +113,17 @@ Keep `events` stable during unrelated UI updates. With recurrence or `timeZone`,
111
113
  replacing the array rebuilds displayed events and cancels a held move on web. See
112
114
  [keep event data stable](https://super-calendar.afonsojramos.me/guides/events#keep-event-data-stable).
113
115
 
116
+ ## Vertical scrolling
117
+
118
+ In a day or week grid, set `timeGridContentPaddingBottom` to leave scrollable
119
+ space below the last hour. Set `timeGridBounces={false}` to turn off overscroll.
120
+ Use `onTimeGridScroll` to read `contentOffset`, `contentSize`, and
121
+ `layoutMeasurement` from `event.nativeEvent` on the JavaScript thread.
122
+
123
+ On the standalone `TimeGrid`, the same props are `contentPaddingBottom`,
124
+ `verticalBounces`, and `onVerticalScroll`. Both callbacks receive a
125
+ `VerticalScrollEvent`.
126
+
114
127
  ## Moving events
115
128
 
116
129
  Pass `onDragEvent` and update your event state with the returned `start` and `end`.
@@ -126,6 +139,13 @@ Set an event's `dragHandleColor` to colour its resize grips in `TimeGrid` and
126
139
  `showDragHandle={false}` still hides the time-grid grips.
127
140
  You can toggle it after mounting without replacing the `events` array.
128
141
 
142
+ ## Current-time label
143
+
144
+ Pass `renderNowLabel` to `Calendar` or `TimeGrid` to show a label beside the
145
+ current-time line. The callback receives the time in the calendar's `timeZone`.
146
+ When the line is visible, a custom label replaces hour labels less than
147
+ 15 minutes away. Return `null` to keep the ordinary hour labels.
148
+
129
149
  ## Creating events
130
150
 
131
151
  Pass `onCreateEvent` to long-press and sweep out a new event. To show a draft in
@@ -155,9 +175,9 @@ A cancelled gesture clears the preview without calling `onCreateEvent`.
155
175
  all-day range, with an exclusive end, and render one copy per covered week row.
156
176
  Use date labels rather than times for this content. The preview updates when
157
177
  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
178
+ `createGhost` slot, and sits on the lane the created all-day event will take,
179
+ moving the row's other bars aside without changing the row height. Content is
180
+ 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
181
  show the event-grid layout in an empty month. Omitting the renderer preserves
162
182
  the existing day highlight.
163
183
 
@@ -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 };