@super-calendar/native 2.12.1 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/{DefaultMonthEvent-B9KzVzFa.d.mts → DefaultMonthEvent-BDD7GgL8.d.mts} +17 -5
- package/dist/{DefaultMonthEvent-DlIIWDzr.d.ts → DefaultMonthEvent-ggwYo7Fy.d.ts} +17 -5
- package/dist/{MonthList-sGAZxQZ_.js → MonthList-D4_LBnbU.js} +47 -19
- package/dist/{MonthList-B-UE37ZG.mjs → MonthList-DWCH3GT5.mjs} +47 -19
- package/dist/index.d.mts +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +42 -5
- package/dist/index.mjs +43 -6
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +2 -2
- package/src/components/Calendar.tsx +134 -97
- package/src/components/MonthList.tsx +12 -2
- package/src/components/MonthPager.tsx +19 -2
- package/src/components/MonthView.tsx +18 -12
- package/src/components/TimeGrid.tsx +115 -70
- package/src/index.tsx +2 -0
- package/src/types.ts +2 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, O as ScrollToTimeOptions, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, T as RecurrenceRule, _ as CalendarMode, a as MonthPager, b as EventDragHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarHandle, h as CalendarEvent, i as MonthListSlot, j as WeekdayFormat, k as TimeGridMode, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabelContext, w as RecurrenceFrequency, x as EventDragStartHandler, y as EventAccessibilityLabeler } from "./DefaultMonthEvent-BDD7GgL8.mjs";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
|
-
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
4
4
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, CalendarLabels, CalendarLabels as CalendarLabels$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, defaultCalendarLabels, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
5
|
+
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, defaultCalendarLabels, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
6
6
|
import { ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
7
7
|
//#region src/components/YearView.d.ts
|
|
8
8
|
/**
|
|
@@ -268,7 +268,6 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
268
268
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
269
269
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
270
270
|
};
|
|
271
|
-
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, minEventHeight, eventGap, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
272
271
|
/**
|
|
273
272
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
274
273
|
* hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
|
|
@@ -288,7 +287,7 @@ declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events
|
|
|
288
287
|
* />
|
|
289
288
|
* ```
|
|
290
289
|
*/
|
|
291
|
-
export declare const TimeGrid:
|
|
290
|
+
export declare const TimeGrid: <T>(props: TimeGridProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
292
291
|
//#endregion
|
|
293
292
|
//#region src/components/Calendar.d.ts
|
|
294
293
|
/**
|
|
@@ -395,6 +394,10 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
395
394
|
* fixed cap. Pass an explicit value when using a custom `renderEvent`.
|
|
396
395
|
*/
|
|
397
396
|
maxVisibleEventCount?: number;
|
|
397
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
398
|
+
chipHeight?: number;
|
|
399
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
400
|
+
chipGap?: number;
|
|
398
401
|
/** Sort each month day's events by start. Default true. */
|
|
399
402
|
sortedMonthView?: boolean;
|
|
400
403
|
/** Month overflow label template; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
@@ -550,7 +553,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
550
553
|
ellipsizeTitle?: boolean;
|
|
551
554
|
/** Label the built-in renderer shows for an all-day event in the schedule (and its screen-reader text). Default "All day". */
|
|
552
555
|
allDayLabel?: string;
|
|
553
|
-
/**
|
|
556
|
+
/** Vertical scroll, in minutes from midnight (week/day). Applied on mount and whenever it changes. */
|
|
554
557
|
scrollOffsetMinutes?: number;
|
|
555
558
|
/** Show the current-time line on the week/day grid. Default true. */
|
|
556
559
|
showNowIndicator?: boolean;
|
|
@@ -615,7 +618,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
615
618
|
* }
|
|
616
619
|
* ```
|
|
617
620
|
*/
|
|
618
|
-
export declare
|
|
621
|
+
export declare const Calendar: <T>(props: CalendarProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
619
622
|
//#endregion
|
|
620
623
|
//#region src/components/DefaultEvent.d.ts
|
|
621
624
|
/**
|
|
@@ -776,4 +779,4 @@ interface ResourceTimelineProps<T = unknown> {
|
|
|
776
779
|
*/
|
|
777
780
|
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, labels: labelsProp }: ResourceTimelineProps<T>): ReactElement;
|
|
778
781
|
//#endregion
|
|
779
|
-
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
|
782
|
+
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, O as ScrollToTimeOptions, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, T as RecurrenceRule, _ as CalendarMode, a as MonthPager, b as EventDragHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarHandle, h as CalendarEvent, i as MonthListSlot, j as WeekdayFormat, k as TimeGridMode, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabelContext, w as RecurrenceFrequency, x as EventDragStartHandler, y as EventAccessibilityLabeler } from "./DefaultMonthEvent-ggwYo7Fy.js";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
|
-
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
4
4
|
import { ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
5
5
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
6
|
-
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, CalendarLabels, CalendarLabels as CalendarLabels$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, defaultCalendarLabels, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
6
|
+
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, defaultCalendarLabels, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
7
7
|
//#region src/components/YearView.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* The styleable parts of {@link YearView}. `dayText` and `eventDot` are the
|
|
@@ -268,7 +268,6 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
268
268
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
269
269
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
270
270
|
};
|
|
271
|
-
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, minEventHeight, eventGap, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
272
271
|
/**
|
|
273
272
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
274
273
|
* hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
|
|
@@ -288,7 +287,7 @@ declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events
|
|
|
288
287
|
* />
|
|
289
288
|
* ```
|
|
290
289
|
*/
|
|
291
|
-
export declare const TimeGrid:
|
|
290
|
+
export declare const TimeGrid: <T>(props: TimeGridProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
292
291
|
//#endregion
|
|
293
292
|
//#region src/components/Calendar.d.ts
|
|
294
293
|
/**
|
|
@@ -395,6 +394,10 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
395
394
|
* fixed cap. Pass an explicit value when using a custom `renderEvent`.
|
|
396
395
|
*/
|
|
397
396
|
maxVisibleEventCount?: number;
|
|
397
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
398
|
+
chipHeight?: number;
|
|
399
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
400
|
+
chipGap?: number;
|
|
398
401
|
/** Sort each month day's events by start. Default true. */
|
|
399
402
|
sortedMonthView?: boolean;
|
|
400
403
|
/** Month overflow label template; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
@@ -550,7 +553,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
550
553
|
ellipsizeTitle?: boolean;
|
|
551
554
|
/** Label the built-in renderer shows for an all-day event in the schedule (and its screen-reader text). Default "All day". */
|
|
552
555
|
allDayLabel?: string;
|
|
553
|
-
/**
|
|
556
|
+
/** Vertical scroll, in minutes from midnight (week/day). Applied on mount and whenever it changes. */
|
|
554
557
|
scrollOffsetMinutes?: number;
|
|
555
558
|
/** Show the current-time line on the week/day grid. Default true. */
|
|
556
559
|
showNowIndicator?: boolean;
|
|
@@ -615,7 +618,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
615
618
|
* }
|
|
616
619
|
* ```
|
|
617
620
|
*/
|
|
618
|
-
export declare
|
|
621
|
+
export declare const Calendar: <T>(props: CalendarProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
619
622
|
//#endregion
|
|
620
623
|
//#region src/components/DefaultEvent.d.ts
|
|
621
624
|
/**
|
|
@@ -776,4 +779,4 @@ interface ResourceTimelineProps<T = unknown> {
|
|
|
776
779
|
*/
|
|
777
780
|
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, labels: labelsProp }: ResourceTimelineProps<T>): ReactElement;
|
|
778
781
|
//#endregion
|
|
779
|
-
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
|
782
|
+
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_MonthList = require("./MonthList-
|
|
24
|
+
const require_MonthList = require("./MonthList-D4_LBnbU.js");
|
|
25
25
|
let date_fns = require("date-fns");
|
|
26
26
|
let react = require("react");
|
|
27
27
|
let react_native_reanimated = require("react-native-reanimated");
|
|
@@ -2067,7 +2067,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
2067
2067
|
});
|
|
2068
2068
|
}
|
|
2069
2069
|
const TimetablePage = (0, react.memo)(TimetablePageInner);
|
|
2070
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, showAllDayLabel = false, refreshControl, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
2070
|
+
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, showAllDayLabel = false, refreshControl, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }, ref) {
|
|
2071
2071
|
const clampedMinHour = Math.max(0, Math.min(minHour, 23));
|
|
2072
2072
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
2073
2073
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
@@ -2107,6 +2107,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2107
2107
|
const scrollHandler = (0, react_native_reanimated.useAnimatedScrollHandler)({ onScroll: (event) => {
|
|
2108
2108
|
scrollY.value = event.contentOffset.y;
|
|
2109
2109
|
} });
|
|
2110
|
+
const [mountOffsetY] = (0, react.useState)(seedDefaultY);
|
|
2110
2111
|
const webSeededRef = (0, react.useRef)(!isWeb$1);
|
|
2111
2112
|
const seedWebScroll = (0, react.useCallback)(() => {
|
|
2112
2113
|
if (webSeededRef.current) return;
|
|
@@ -2348,6 +2349,35 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2348
2349
|
frame = requestAnimationFrame(attempt);
|
|
2349
2350
|
return () => cancelAnimationFrame(frame);
|
|
2350
2351
|
}, [seedWebScroll]);
|
|
2352
|
+
const scrollToMinutes = (0, react.useCallback)((minutes, animated) => {
|
|
2353
|
+
webSeededRef.current = true;
|
|
2354
|
+
const y = Math.max(0, minutes / MINUTES_PER_HOUR$1 - clampedMinHour) * cellHeight.value;
|
|
2355
|
+
scrollRef.current?.scrollTo({
|
|
2356
|
+
y,
|
|
2357
|
+
animated
|
|
2358
|
+
});
|
|
2359
|
+
}, [
|
|
2360
|
+
clampedMinHour,
|
|
2361
|
+
cellHeight,
|
|
2362
|
+
scrollRef
|
|
2363
|
+
]);
|
|
2364
|
+
const appliedOffsetRef = (0, react.useRef)({
|
|
2365
|
+
minutes: scrollOffsetMinutes,
|
|
2366
|
+
minHour: clampedMinHour
|
|
2367
|
+
});
|
|
2368
|
+
(0, react.useEffect)(() => {
|
|
2369
|
+
const applied = appliedOffsetRef.current;
|
|
2370
|
+
if (applied.minutes === scrollOffsetMinutes && applied.minHour === clampedMinHour) return;
|
|
2371
|
+
appliedOffsetRef.current = {
|
|
2372
|
+
minutes: scrollOffsetMinutes,
|
|
2373
|
+
minHour: clampedMinHour
|
|
2374
|
+
};
|
|
2375
|
+
scrollToMinutes(scrollOffsetMinutes, false);
|
|
2376
|
+
}, [
|
|
2377
|
+
scrollOffsetMinutes,
|
|
2378
|
+
clampedMinHour,
|
|
2379
|
+
scrollToMinutes
|
|
2380
|
+
]);
|
|
2351
2381
|
(0, react.useEffect)(() => {
|
|
2352
2382
|
if (!isWeb$1) return;
|
|
2353
2383
|
const root = containerRef.current;
|
|
@@ -2366,6 +2396,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2366
2396
|
return () => cancelAnimationFrame(raf);
|
|
2367
2397
|
}, [columnsWidth]);
|
|
2368
2398
|
const reduceMotion = (0, react_native_reanimated.useReducedMotion)();
|
|
2399
|
+
(0, react.useImperativeHandle)(ref, () => ({ scrollToTime: (minutes, { animated = true } = {}) => scrollToMinutes(minutes, animated && !reduceMotion) }), [scrollToMinutes, reduceMotion]);
|
|
2369
2400
|
const goToPage = (0, react.useCallback)((delta) => {
|
|
2370
2401
|
const index = viewedIndexRef.current + delta;
|
|
2371
2402
|
const target = pageDates[index];
|
|
@@ -2634,7 +2665,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2634
2665
|
refreshControl: verticalScrollEnabled ? refreshControl : void 0,
|
|
2635
2666
|
contentOffset: {
|
|
2636
2667
|
x: 0,
|
|
2637
|
-
y:
|
|
2668
|
+
y: mountOffsetY
|
|
2638
2669
|
},
|
|
2639
2670
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
2640
2671
|
testID: "time-grid-hours",
|
|
@@ -2741,7 +2772,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2741
2772
|
* />
|
|
2742
2773
|
* ```
|
|
2743
2774
|
*/
|
|
2744
|
-
const TimeGrid = (0, react.memo)(TimeGridInner);
|
|
2775
|
+
const TimeGrid = (0, react.memo)((0, react.forwardRef)(TimeGridInner));
|
|
2745
2776
|
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
2746
2777
|
const slot = require_MonthList.useSlots();
|
|
2747
2778
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
@@ -3035,10 +3066,13 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
3035
3066
|
* }
|
|
3036
3067
|
* ```
|
|
3037
3068
|
*/
|
|
3038
|
-
|
|
3069
|
+
const Calendar = (0, react.forwardRef)(CalendarInner);
|
|
3070
|
+
function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, chipHeight, chipGap, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }, ref) {
|
|
3039
3071
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
3040
3072
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
3041
3073
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
3074
|
+
const timeGridRef = (0, react.useRef)(null);
|
|
3075
|
+
(0, react.useImperativeHandle)(ref, () => ({ scrollToTime: (minutes, options) => timeGridRef.current?.scrollToTime(minutes, options) }), []);
|
|
3042
3076
|
const displayEvents = (0, react.useMemo)(() => {
|
|
3043
3077
|
let out = events;
|
|
3044
3078
|
if (out.some((e) => e.recurrence)) {
|
|
@@ -3114,6 +3148,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
3114
3148
|
date,
|
|
3115
3149
|
events: displayEvents,
|
|
3116
3150
|
maxVisibleEventCount,
|
|
3151
|
+
chipHeight,
|
|
3152
|
+
chipGap,
|
|
3117
3153
|
weekStartsOn,
|
|
3118
3154
|
hiddenDays,
|
|
3119
3155
|
weekdayFormat,
|
|
@@ -3190,6 +3226,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
3190
3226
|
classNames,
|
|
3191
3227
|
styles: styleOverrides
|
|
3192
3228
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeGrid, {
|
|
3229
|
+
ref: timeGridRef,
|
|
3193
3230
|
mode,
|
|
3194
3231
|
numberOfDays,
|
|
3195
3232
|
weekEndsOn,
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as withEventAccessibilityLabel, c as createSlots, d as useCalendarLabels, f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, l as useSlots, m as defaultTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as darkTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarLabelsContext } from "./MonthList-
|
|
1
|
+
import { a as withEventAccessibilityLabel, c as createSlots, d as useCalendarLabels, f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, l as useSlots, m as defaultTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as darkTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarLabelsContext } from "./MonthList-DWCH3GT5.mjs";
|
|
2
2
|
import { addDays, addMonths, addWeeks, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getHours, getISOWeek, getMinutes, isSameDay, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
3
|
-
import { createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
4
4
|
import Animated, { runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
|
|
5
5
|
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, minutesIntoDay, monthCreateRange, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
6
6
|
import { PixelRatio, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
@@ -2043,7 +2043,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
2043
2043
|
});
|
|
2044
2044
|
}
|
|
2045
2045
|
const TimetablePage = memo(TimetablePageInner);
|
|
2046
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, showAllDayLabel = false, refreshControl, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
2046
|
+
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, showAllDayLabel = false, refreshControl, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }, ref) {
|
|
2047
2047
|
const clampedMinHour = Math.max(0, Math.min(minHour, 23));
|
|
2048
2048
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
2049
2049
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
@@ -2083,6 +2083,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2083
2083
|
const scrollHandler = useAnimatedScrollHandler({ onScroll: (event) => {
|
|
2084
2084
|
scrollY.value = event.contentOffset.y;
|
|
2085
2085
|
} });
|
|
2086
|
+
const [mountOffsetY] = useState(seedDefaultY);
|
|
2086
2087
|
const webSeededRef = useRef(!isWeb$1);
|
|
2087
2088
|
const seedWebScroll = useCallback(() => {
|
|
2088
2089
|
if (webSeededRef.current) return;
|
|
@@ -2324,6 +2325,35 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2324
2325
|
frame = requestAnimationFrame(attempt);
|
|
2325
2326
|
return () => cancelAnimationFrame(frame);
|
|
2326
2327
|
}, [seedWebScroll]);
|
|
2328
|
+
const scrollToMinutes = useCallback((minutes, animated) => {
|
|
2329
|
+
webSeededRef.current = true;
|
|
2330
|
+
const y = Math.max(0, minutes / MINUTES_PER_HOUR$1 - clampedMinHour) * cellHeight.value;
|
|
2331
|
+
scrollRef.current?.scrollTo({
|
|
2332
|
+
y,
|
|
2333
|
+
animated
|
|
2334
|
+
});
|
|
2335
|
+
}, [
|
|
2336
|
+
clampedMinHour,
|
|
2337
|
+
cellHeight,
|
|
2338
|
+
scrollRef
|
|
2339
|
+
]);
|
|
2340
|
+
const appliedOffsetRef = useRef({
|
|
2341
|
+
minutes: scrollOffsetMinutes,
|
|
2342
|
+
minHour: clampedMinHour
|
|
2343
|
+
});
|
|
2344
|
+
useEffect(() => {
|
|
2345
|
+
const applied = appliedOffsetRef.current;
|
|
2346
|
+
if (applied.minutes === scrollOffsetMinutes && applied.minHour === clampedMinHour) return;
|
|
2347
|
+
appliedOffsetRef.current = {
|
|
2348
|
+
minutes: scrollOffsetMinutes,
|
|
2349
|
+
minHour: clampedMinHour
|
|
2350
|
+
};
|
|
2351
|
+
scrollToMinutes(scrollOffsetMinutes, false);
|
|
2352
|
+
}, [
|
|
2353
|
+
scrollOffsetMinutes,
|
|
2354
|
+
clampedMinHour,
|
|
2355
|
+
scrollToMinutes
|
|
2356
|
+
]);
|
|
2327
2357
|
useEffect(() => {
|
|
2328
2358
|
if (!isWeb$1) return;
|
|
2329
2359
|
const root = containerRef.current;
|
|
@@ -2342,6 +2372,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2342
2372
|
return () => cancelAnimationFrame(raf);
|
|
2343
2373
|
}, [columnsWidth]);
|
|
2344
2374
|
const reduceMotion = useReducedMotion();
|
|
2375
|
+
useImperativeHandle(ref, () => ({ scrollToTime: (minutes, { animated = true } = {}) => scrollToMinutes(minutes, animated && !reduceMotion) }), [scrollToMinutes, reduceMotion]);
|
|
2345
2376
|
const goToPage = useCallback((delta) => {
|
|
2346
2377
|
const index = viewedIndexRef.current + delta;
|
|
2347
2378
|
const target = pageDates[index];
|
|
@@ -2610,7 +2641,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2610
2641
|
refreshControl: verticalScrollEnabled ? refreshControl : void 0,
|
|
2611
2642
|
contentOffset: {
|
|
2612
2643
|
x: 0,
|
|
2613
|
-
y:
|
|
2644
|
+
y: mountOffsetY
|
|
2614
2645
|
},
|
|
2615
2646
|
children: /* @__PURE__ */ jsxs(Animated.View, {
|
|
2616
2647
|
testID: "time-grid-hours",
|
|
@@ -2717,7 +2748,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2717
2748
|
* />
|
|
2718
2749
|
* ```
|
|
2719
2750
|
*/
|
|
2720
|
-
const TimeGrid = memo(TimeGridInner);
|
|
2751
|
+
const TimeGrid = memo(forwardRef(TimeGridInner));
|
|
2721
2752
|
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
2722
2753
|
const slot = useSlots();
|
|
2723
2754
|
return /* @__PURE__ */ jsx(View, {
|
|
@@ -3011,10 +3042,13 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
3011
3042
|
* }
|
|
3012
3043
|
* ```
|
|
3013
3044
|
*/
|
|
3014
|
-
|
|
3045
|
+
const Calendar = forwardRef(CalendarInner);
|
|
3046
|
+
function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, chipHeight, chipGap, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }, ref) {
|
|
3015
3047
|
const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
|
|
3016
3048
|
const internalCellHeight = useSharedValue(hourHeight);
|
|
3017
3049
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
3050
|
+
const timeGridRef = useRef(null);
|
|
3051
|
+
useImperativeHandle(ref, () => ({ scrollToTime: (minutes, options) => timeGridRef.current?.scrollToTime(minutes, options) }), []);
|
|
3018
3052
|
const displayEvents = useMemo(() => {
|
|
3019
3053
|
let out = events;
|
|
3020
3054
|
if (out.some((e) => e.recurrence)) {
|
|
@@ -3090,6 +3124,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
3090
3124
|
date,
|
|
3091
3125
|
events: displayEvents,
|
|
3092
3126
|
maxVisibleEventCount,
|
|
3127
|
+
chipHeight,
|
|
3128
|
+
chipGap,
|
|
3093
3129
|
weekStartsOn,
|
|
3094
3130
|
hiddenDays,
|
|
3095
3131
|
weekdayFormat,
|
|
@@ -3166,6 +3202,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
3166
3202
|
classNames,
|
|
3167
3203
|
styles: styleOverrides
|
|
3168
3204
|
}) : /* @__PURE__ */ jsx(TimeGrid, {
|
|
3205
|
+
ref: timeGridRef,
|
|
3169
3206
|
mode,
|
|
3170
3207
|
numberOfDays,
|
|
3171
3208
|
weekEndsOn,
|
package/dist/picker.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent } from "./DefaultMonthEvent-BDD7GgL8.mjs";
|
|
2
2
|
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/dist/picker.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent } from "./DefaultMonthEvent-ggwYo7Fy.js";
|
|
2
2
|
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/dist/picker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_MonthList = require("./MonthList-
|
|
2
|
+
const require_MonthList = require("./MonthList-D4_LBnbU.js");
|
|
3
3
|
let _super_calendar_core = require("@super-calendar/core");
|
|
4
4
|
exports.CalendarThemeProvider = require_MonthList.CalendarThemeProvider;
|
|
5
5
|
exports.DefaultMonthEvent = require_MonthList.DefaultMonthEvent;
|
package/dist/picker.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, m as defaultTheme, n as DefaultMonthEvent, p as darkTheme, r as MonthPager, t as MonthList } from "./MonthList-
|
|
1
|
+
import { f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, m as defaultTheme, n as DefaultMonthEvent, p as darkTheme, r as MonthPager, t as MonthList } from "./MonthList-DWCH3GT5.mjs";
|
|
2
2
|
import { buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { CalendarThemeProvider, DefaultMonthEvent, MonthList, MonthPager, MonthView, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Gesture-driven, virtualized month / week / day calendar and date picker for React Native (and web via react-native-web).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agenda",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@super-calendar/core": "2.
|
|
67
|
+
"@super-calendar/core": "2.14.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@legendapp/list": ">=3",
|