@super-calendar/native 2.19.0 → 2.20.1
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 +19 -1
- package/dist/{MonthList-DeO-x5VW.js → MonthList-CGgy0Juh.js} +28 -7
- package/dist/{MonthList-BGl1gTDr.mjs → MonthList-CPpsr5Oa.mjs} +28 -7
- package/dist/index.d.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +110 -34
- package/dist/index.mjs +110 -34
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +3 -3
- package/src/components/Calendar.tsx +17 -0
- package/src/components/MonthList.tsx +13 -3
- package/src/components/MonthPager.tsx +21 -5
- package/src/components/MonthView.tsx +11 -4
- package/src/components/TimeGrid.tsx +173 -46
- package/src/index.tsx +1 -0
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ npm install @super-calendar/native
|
|
|
29
29
|
|
|
30
30
|
Also on [JSR](https://jsr.io/@super-calendar/native): `deno add jsr:@super-calendar/native`.
|
|
31
31
|
|
|
32
|
-
Peer dependencies: `@legendapp/list` (>=3), `date-fns` (>=3), `react` (>=19), `react-native` (>=0.74 <2), `react-native-gesture-handler` (>=2), `react-native-reanimated` (>=4), and `react-native-worklets` (>=0.8).
|
|
32
|
+
Peer dependencies: `@legendapp/list` (>=3.7.1), `date-fns` (>=3), `react` (>=19), `react-native` (>=0.74 <2), `react-native-gesture-handler` (>=2), `react-native-reanimated` (>=4), and `react-native-worklets` (>=0.8).
|
|
33
33
|
|
|
34
34
|
For a picker-only bundle that does not require Reanimated, import from the `@super-calendar/native/picker` subpath.
|
|
35
35
|
|
|
@@ -113,6 +113,17 @@ Keep `events` stable during unrelated UI updates. With recurrence or `timeZone`,
|
|
|
113
113
|
replacing the array rebuilds displayed events and cancels a held move on web. See
|
|
114
114
|
[keep event data stable](https://super-calendar.afonsojramos.me/guides/events#keep-event-data-stable).
|
|
115
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
|
+
|
|
116
127
|
## Moving events
|
|
117
128
|
|
|
118
129
|
Pass `onDragEvent` and update your event state with the returned `start` and `end`.
|
|
@@ -128,6 +139,13 @@ Set an event's `dragHandleColor` to colour its resize grips in `TimeGrid` and
|
|
|
128
139
|
`showDragHandle={false}` still hides the time-grid grips.
|
|
129
140
|
You can toggle it after mounting without replacing the `events` array.
|
|
130
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
|
+
|
|
131
149
|
## Creating events
|
|
132
150
|
|
|
133
151
|
Pass `onCreateEvent` to long-press and sweep out a new event. To show a draft in
|
|
@@ -816,17 +816,19 @@ function DateRowsInner({ source, events, maxVisibleEventCount, chipHeight, chipG
|
|
|
816
816
|
if (!(0, _super_calendar_core.isDateSelectable)(origin.day, constraints) || !(0, _super_calendar_core.isDateSelectable)(destination, constraints) || (origin.event ? !onDragEvent || !events.includes(origin.event) || !canMoveEvent(origin.event) : !onCreateEvent && !onSelectDrag)) heldTouch.current?.();
|
|
817
817
|
});
|
|
818
818
|
const hitTest = (0, react.useCallback)((x, y) => {
|
|
819
|
-
|
|
819
|
+
let { width, height } = gridSize;
|
|
820
|
+
if ((width <= 0 || height <= 0) && isWeb$2 && gridRef.current instanceof Element) ({width, height} = gridRef.current.getBoundingClientRect());
|
|
820
821
|
if (width <= 0 || height <= 0 || weeks.length === 0) return null;
|
|
821
|
-
|
|
822
|
-
let
|
|
822
|
+
const pitch = rowHeight > 0 ? rowHeight : height / weeks.length;
|
|
823
|
+
let row = Math.min(weeks.length - 1, Math.max(0, Math.floor(y / pitch)));
|
|
824
|
+
let rowTop = row * pitch;
|
|
823
825
|
if (multiWeek) {
|
|
824
826
|
const grid = isWeb$2 && typeof Element !== "undefined" && gridRef.current instanceof Element ? gridRef.current : null;
|
|
825
827
|
const gridTop = grid?.getBoundingClientRect().top ?? 0;
|
|
826
828
|
const topOf = (index) => {
|
|
827
829
|
const node = grid?.children[index];
|
|
828
830
|
const borderTop = node ? node.getBoundingClientRect().top - gridTop : weekTops.current[index];
|
|
829
|
-
return borderTop == null ? index *
|
|
831
|
+
return borderTop == null ? index * pitch : borderTop - cellGeometry.weekMarginTop;
|
|
830
832
|
};
|
|
831
833
|
row = weekAtOffset(y, weeks.length, topOf);
|
|
832
834
|
rowTop = topOf(row);
|
|
@@ -1664,6 +1666,15 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1664
1666
|
animated: false
|
|
1665
1667
|
});
|
|
1666
1668
|
}, [activeIndex]);
|
|
1669
|
+
const laidOutWidthRef = (0, react.useRef)(containerWidth);
|
|
1670
|
+
(0, react.useLayoutEffect)(() => {
|
|
1671
|
+
if (containerWidth === laidOutWidthRef.current) return;
|
|
1672
|
+
laidOutWidthRef.current = containerWidth;
|
|
1673
|
+
listRef.current?.scrollToIndex({
|
|
1674
|
+
index: activeIndex,
|
|
1675
|
+
animated: false
|
|
1676
|
+
});
|
|
1677
|
+
}, [containerWidth, activeIndex]);
|
|
1667
1678
|
useWebPagerKeys(swipeEnabled, (0, react.useCallback)((delta) => {
|
|
1668
1679
|
const target = monthDates[activeIndex + delta];
|
|
1669
1680
|
if (target) onChangeDate(target);
|
|
@@ -1683,6 +1694,8 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1683
1694
|
]);
|
|
1684
1695
|
const nowTime = now?.getTime();
|
|
1685
1696
|
const monthExtraData = (0, react.useMemo)(() => ({
|
|
1697
|
+
containerWidth,
|
|
1698
|
+
pageHeight,
|
|
1686
1699
|
events,
|
|
1687
1700
|
activeDate,
|
|
1688
1701
|
nowTime,
|
|
@@ -1696,6 +1709,8 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1696
1709
|
createGhostClassName: classNames?.createGhost,
|
|
1697
1710
|
createGhostStyle: styleOverrides?.createGhost
|
|
1698
1711
|
}), [
|
|
1712
|
+
containerWidth,
|
|
1713
|
+
pageHeight,
|
|
1699
1714
|
events,
|
|
1700
1715
|
activeDate,
|
|
1701
1716
|
nowTime,
|
|
@@ -1740,6 +1755,7 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1740
1755
|
const keyExtractorList = (0, react.useCallback)((item) => item.toISOString(), []);
|
|
1741
1756
|
const getFixedItemSize = (0, react.useCallback)(() => containerWidth, [containerWidth]);
|
|
1742
1757
|
const renderItem = (0, react.useCallback)(({ item }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1758
|
+
testID: "month-pager-page",
|
|
1743
1759
|
style: {
|
|
1744
1760
|
width: containerWidth,
|
|
1745
1761
|
height: pageHeight
|
|
@@ -1863,6 +1879,7 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1863
1879
|
slot
|
|
1864
1880
|
}),
|
|
1865
1881
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1882
|
+
testID: "month-pager",
|
|
1866
1883
|
style: styles$2.pager,
|
|
1867
1884
|
onLayout: (event) => {
|
|
1868
1885
|
setPageHeight(event.nativeEvent.layout.height);
|
|
@@ -1887,7 +1904,7 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1887
1904
|
viewabilityConfig: PAGE_VIEWABILITY,
|
|
1888
1905
|
onViewableItemsChanged: handleViewableItemsChanged,
|
|
1889
1906
|
renderItem
|
|
1890
|
-
}
|
|
1907
|
+
})
|
|
1891
1908
|
})
|
|
1892
1909
|
]
|
|
1893
1910
|
})
|
|
@@ -2101,13 +2118,17 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
2101
2118
|
activeDate,
|
|
2102
2119
|
firstViewableIndex,
|
|
2103
2120
|
chipHeight,
|
|
2104
|
-
chipGap
|
|
2121
|
+
chipGap,
|
|
2122
|
+
weekRowHeight,
|
|
2123
|
+
monthHeaderHeight
|
|
2105
2124
|
}), [
|
|
2106
2125
|
events,
|
|
2107
2126
|
activeDate,
|
|
2108
2127
|
firstViewableIndex,
|
|
2109
2128
|
chipHeight,
|
|
2110
|
-
chipGap
|
|
2129
|
+
chipGap,
|
|
2130
|
+
weekRowHeight,
|
|
2131
|
+
monthHeaderHeight
|
|
2111
2132
|
]);
|
|
2112
2133
|
const [anchorDate] = (0, react.useState)(date);
|
|
2113
2134
|
const anchor = (0, react.useMemo)(() => (0, date_fns.startOfMonth)(anchorDate), [anchorDate]);
|
|
@@ -816,17 +816,19 @@ function DateRowsInner({ source, events, maxVisibleEventCount, chipHeight, chipG
|
|
|
816
816
|
if (!isDateSelectable(origin.day, constraints) || !isDateSelectable(destination, constraints) || (origin.event ? !onDragEvent || !events.includes(origin.event) || !canMoveEvent(origin.event) : !onCreateEvent && !onSelectDrag)) heldTouch.current?.();
|
|
817
817
|
});
|
|
818
818
|
const hitTest = useCallback((x, y) => {
|
|
819
|
-
|
|
819
|
+
let { width, height } = gridSize;
|
|
820
|
+
if ((width <= 0 || height <= 0) && isWeb$2 && gridRef.current instanceof Element) ({width, height} = gridRef.current.getBoundingClientRect());
|
|
820
821
|
if (width <= 0 || height <= 0 || weeks.length === 0) return null;
|
|
821
|
-
|
|
822
|
-
let
|
|
822
|
+
const pitch = rowHeight > 0 ? rowHeight : height / weeks.length;
|
|
823
|
+
let row = Math.min(weeks.length - 1, Math.max(0, Math.floor(y / pitch)));
|
|
824
|
+
let rowTop = row * pitch;
|
|
823
825
|
if (multiWeek) {
|
|
824
826
|
const grid = isWeb$2 && typeof Element !== "undefined" && gridRef.current instanceof Element ? gridRef.current : null;
|
|
825
827
|
const gridTop = grid?.getBoundingClientRect().top ?? 0;
|
|
826
828
|
const topOf = (index) => {
|
|
827
829
|
const node = grid?.children[index];
|
|
828
830
|
const borderTop = node ? node.getBoundingClientRect().top - gridTop : weekTops.current[index];
|
|
829
|
-
return borderTop == null ? index *
|
|
831
|
+
return borderTop == null ? index * pitch : borderTop - cellGeometry.weekMarginTop;
|
|
830
832
|
};
|
|
831
833
|
row = weekAtOffset(y, weeks.length, topOf);
|
|
832
834
|
rowTop = topOf(row);
|
|
@@ -1664,6 +1666,15 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1664
1666
|
animated: false
|
|
1665
1667
|
});
|
|
1666
1668
|
}, [activeIndex]);
|
|
1669
|
+
const laidOutWidthRef = useRef(containerWidth);
|
|
1670
|
+
useLayoutEffect(() => {
|
|
1671
|
+
if (containerWidth === laidOutWidthRef.current) return;
|
|
1672
|
+
laidOutWidthRef.current = containerWidth;
|
|
1673
|
+
listRef.current?.scrollToIndex({
|
|
1674
|
+
index: activeIndex,
|
|
1675
|
+
animated: false
|
|
1676
|
+
});
|
|
1677
|
+
}, [containerWidth, activeIndex]);
|
|
1667
1678
|
useWebPagerKeys(swipeEnabled, useCallback((delta) => {
|
|
1668
1679
|
const target = monthDates[activeIndex + delta];
|
|
1669
1680
|
if (target) onChangeDate(target);
|
|
@@ -1683,6 +1694,8 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1683
1694
|
]);
|
|
1684
1695
|
const nowTime = now?.getTime();
|
|
1685
1696
|
const monthExtraData = useMemo(() => ({
|
|
1697
|
+
containerWidth,
|
|
1698
|
+
pageHeight,
|
|
1686
1699
|
events,
|
|
1687
1700
|
activeDate,
|
|
1688
1701
|
nowTime,
|
|
@@ -1696,6 +1709,8 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1696
1709
|
createGhostClassName: classNames?.createGhost,
|
|
1697
1710
|
createGhostStyle: styleOverrides?.createGhost
|
|
1698
1711
|
}), [
|
|
1712
|
+
containerWidth,
|
|
1713
|
+
pageHeight,
|
|
1699
1714
|
events,
|
|
1700
1715
|
activeDate,
|
|
1701
1716
|
nowTime,
|
|
@@ -1740,6 +1755,7 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1740
1755
|
const keyExtractorList = useCallback((item) => item.toISOString(), []);
|
|
1741
1756
|
const getFixedItemSize = useCallback(() => containerWidth, [containerWidth]);
|
|
1742
1757
|
const renderItem = useCallback(({ item }) => /* @__PURE__ */ jsx(View, {
|
|
1758
|
+
testID: "month-pager-page",
|
|
1743
1759
|
style: {
|
|
1744
1760
|
width: containerWidth,
|
|
1745
1761
|
height: pageHeight
|
|
@@ -1863,6 +1879,7 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1863
1879
|
slot
|
|
1864
1880
|
}),
|
|
1865
1881
|
/* @__PURE__ */ jsx(View, {
|
|
1882
|
+
testID: "month-pager",
|
|
1866
1883
|
style: styles$2.pager,
|
|
1867
1884
|
onLayout: (event) => {
|
|
1868
1885
|
setPageHeight(event.nativeEvent.layout.height);
|
|
@@ -1887,7 +1904,7 @@ function DateRowsPagerInner({ spec, initialAnchor, date, events, maxVisibleEvent
|
|
|
1887
1904
|
viewabilityConfig: PAGE_VIEWABILITY,
|
|
1888
1905
|
onViewableItemsChanged: handleViewableItemsChanged,
|
|
1889
1906
|
renderItem
|
|
1890
|
-
}
|
|
1907
|
+
})
|
|
1891
1908
|
})
|
|
1892
1909
|
]
|
|
1893
1910
|
})
|
|
@@ -2101,13 +2118,17 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
2101
2118
|
activeDate,
|
|
2102
2119
|
firstViewableIndex,
|
|
2103
2120
|
chipHeight,
|
|
2104
|
-
chipGap
|
|
2121
|
+
chipGap,
|
|
2122
|
+
weekRowHeight,
|
|
2123
|
+
monthHeaderHeight
|
|
2105
2124
|
}), [
|
|
2106
2125
|
events,
|
|
2107
2126
|
activeDate,
|
|
2108
2127
|
firstViewableIndex,
|
|
2109
2128
|
chipHeight,
|
|
2110
|
-
chipGap
|
|
2129
|
+
chipGap,
|
|
2130
|
+
weekRowHeight,
|
|
2131
|
+
monthHeaderHeight
|
|
2111
2132
|
]);
|
|
2112
2133
|
const [anchorDate] = useState(date);
|
|
2113
2134
|
const anchor = useMemo(() => startOfMonth(anchorDate), [anchorDate]);
|
package/dist/index.d.mts
CHANGED
|
@@ -293,6 +293,44 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
293
293
|
onChangeDate: (date: Date) => void;
|
|
294
294
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
295
295
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
296
|
+
/**
|
|
297
|
+
* Draw a label in the hour column when the current-time line is visible.
|
|
298
|
+
* A custom label replaces hour labels less than 15 minutes away.
|
|
299
|
+
*/
|
|
300
|
+
renderNowLabel?: (now: Date) => React.ReactNode;
|
|
301
|
+
/**
|
|
302
|
+
* Extra scrollable space below the last hour, inside the vertical scroll view,
|
|
303
|
+
* so the end of the day can scroll clear of something floating over the grid
|
|
304
|
+
* (a tab bar, a button). Default 0.
|
|
305
|
+
*/
|
|
306
|
+
contentPaddingBottom?: number;
|
|
307
|
+
/**
|
|
308
|
+
* The vertical scroll view's scroll events, on the JS thread. Use it to react
|
|
309
|
+
* to the hours scrolling, such as collapsing a toolbar.
|
|
310
|
+
*/
|
|
311
|
+
onVerticalScroll?: (event: VerticalScrollEvent) => void;
|
|
312
|
+
/**
|
|
313
|
+
* Overscroll on the hours: iOS `bounces`, Android `overScrollMode`. Set
|
|
314
|
+
* `false` to stop the grid at its ends. Default true.
|
|
315
|
+
*/
|
|
316
|
+
verticalBounces?: boolean;
|
|
317
|
+
};
|
|
318
|
+
/** The scroll event `onVerticalScroll` receives, shaped like React Native's scroll event. */
|
|
319
|
+
type VerticalScrollEvent = {
|
|
320
|
+
nativeEvent: {
|
|
321
|
+
contentOffset: {
|
|
322
|
+
x: number;
|
|
323
|
+
y: number;
|
|
324
|
+
};
|
|
325
|
+
contentSize: {
|
|
326
|
+
width: number;
|
|
327
|
+
height: number;
|
|
328
|
+
};
|
|
329
|
+
layoutMeasurement: {
|
|
330
|
+
width: number;
|
|
331
|
+
height: number;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
296
334
|
};
|
|
297
335
|
/**
|
|
298
336
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
@@ -616,6 +654,14 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
616
654
|
freeSwipe?: boolean;
|
|
617
655
|
/** Custom header above the week/day grid. Receives the visible days. */
|
|
618
656
|
renderTimeGridHeader?: (days: Date[]) => React.ReactNode;
|
|
657
|
+
/** Draw a label in the hour column when the current-time line is visible. */
|
|
658
|
+
renderNowLabel?: (now: Date) => React.ReactNode;
|
|
659
|
+
/** Week/day grid: extra scrollable space below the last hour (e.g. for a floating tab bar). Default 0. */
|
|
660
|
+
timeGridContentPaddingBottom?: number;
|
|
661
|
+
/** Week/day grid: the vertical scroll view's scroll events, on the JS thread. */
|
|
662
|
+
onTimeGridScroll?: (event: VerticalScrollEvent) => void;
|
|
663
|
+
/** Week/day grid: `false` turns off overscroll on the hours (iOS bounce, Android stretch). Default true. */
|
|
664
|
+
timeGridBounces?: boolean;
|
|
619
665
|
/** Replace the weekday-label header above the month grid. Return `null` to hide it. */
|
|
620
666
|
renderHeaderForMonthView?: (weekDays: Date[]) => React.ReactNode;
|
|
621
667
|
/**
|
|
@@ -838,4 +884,4 @@ interface ResourceTimelineProps<T = unknown> {
|
|
|
838
884
|
* ```
|
|
839
885
|
*/
|
|
840
886
|
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, renderCreateGhost, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, labels: labelsProp }: ResourceTimelineProps<T>): ReactElement;
|
|
841
|
-
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 CreateGhostArgs, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type ExpandRecurringEventsOptions, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthDateInfo, 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 MultiWeekGrid, type MultiWeekGridDay, type MultiWeekGridInterval, type MultiWeekGridOptions, type MultiWeekGridWeek, type MultiWeekViewProps, 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, buildMultiWeekGrid, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, nowInTimeZone, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken, zonedDragBounds, zonedEventSource };
|
|
887
|
+
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 CreateGhostArgs, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type ExpandRecurringEventsOptions, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthDateInfo, 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 MultiWeekGrid, type MultiWeekGridDay, type MultiWeekGridInterval, type MultiWeekGridOptions, type MultiWeekGridWeek, type MultiWeekViewProps, 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 VerticalScrollEvent, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, nowInTimeZone, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken, zonedDragBounds, zonedEventSource };
|
package/dist/index.d.ts
CHANGED
|
@@ -293,6 +293,44 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
293
293
|
onChangeDate: (date: Date) => void;
|
|
294
294
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
295
295
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
296
|
+
/**
|
|
297
|
+
* Draw a label in the hour column when the current-time line is visible.
|
|
298
|
+
* A custom label replaces hour labels less than 15 minutes away.
|
|
299
|
+
*/
|
|
300
|
+
renderNowLabel?: (now: Date) => React.ReactNode;
|
|
301
|
+
/**
|
|
302
|
+
* Extra scrollable space below the last hour, inside the vertical scroll view,
|
|
303
|
+
* so the end of the day can scroll clear of something floating over the grid
|
|
304
|
+
* (a tab bar, a button). Default 0.
|
|
305
|
+
*/
|
|
306
|
+
contentPaddingBottom?: number;
|
|
307
|
+
/**
|
|
308
|
+
* The vertical scroll view's scroll events, on the JS thread. Use it to react
|
|
309
|
+
* to the hours scrolling, such as collapsing a toolbar.
|
|
310
|
+
*/
|
|
311
|
+
onVerticalScroll?: (event: VerticalScrollEvent) => void;
|
|
312
|
+
/**
|
|
313
|
+
* Overscroll on the hours: iOS `bounces`, Android `overScrollMode`. Set
|
|
314
|
+
* `false` to stop the grid at its ends. Default true.
|
|
315
|
+
*/
|
|
316
|
+
verticalBounces?: boolean;
|
|
317
|
+
};
|
|
318
|
+
/** The scroll event `onVerticalScroll` receives, shaped like React Native's scroll event. */
|
|
319
|
+
type VerticalScrollEvent = {
|
|
320
|
+
nativeEvent: {
|
|
321
|
+
contentOffset: {
|
|
322
|
+
x: number;
|
|
323
|
+
y: number;
|
|
324
|
+
};
|
|
325
|
+
contentSize: {
|
|
326
|
+
width: number;
|
|
327
|
+
height: number;
|
|
328
|
+
};
|
|
329
|
+
layoutMeasurement: {
|
|
330
|
+
width: number;
|
|
331
|
+
height: number;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
296
334
|
};
|
|
297
335
|
/**
|
|
298
336
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
@@ -616,6 +654,14 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
616
654
|
freeSwipe?: boolean;
|
|
617
655
|
/** Custom header above the week/day grid. Receives the visible days. */
|
|
618
656
|
renderTimeGridHeader?: (days: Date[]) => React.ReactNode;
|
|
657
|
+
/** Draw a label in the hour column when the current-time line is visible. */
|
|
658
|
+
renderNowLabel?: (now: Date) => React.ReactNode;
|
|
659
|
+
/** Week/day grid: extra scrollable space below the last hour (e.g. for a floating tab bar). Default 0. */
|
|
660
|
+
timeGridContentPaddingBottom?: number;
|
|
661
|
+
/** Week/day grid: the vertical scroll view's scroll events, on the JS thread. */
|
|
662
|
+
onTimeGridScroll?: (event: VerticalScrollEvent) => void;
|
|
663
|
+
/** Week/day grid: `false` turns off overscroll on the hours (iOS bounce, Android stretch). Default true. */
|
|
664
|
+
timeGridBounces?: boolean;
|
|
619
665
|
/** Replace the weekday-label header above the month grid. Return `null` to hide it. */
|
|
620
666
|
renderHeaderForMonthView?: (weekDays: Date[]) => React.ReactNode;
|
|
621
667
|
/**
|
|
@@ -838,4 +884,4 @@ interface ResourceTimelineProps<T = unknown> {
|
|
|
838
884
|
* ```
|
|
839
885
|
*/
|
|
840
886
|
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, renderCreateGhost, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, labels: labelsProp }: ResourceTimelineProps<T>): ReactElement;
|
|
841
|
-
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 CreateGhostArgs, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type ExpandRecurringEventsOptions, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthDateInfo, 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 MultiWeekGrid, type MultiWeekGridDay, type MultiWeekGridInterval, type MultiWeekGridOptions, type MultiWeekGridWeek, type MultiWeekViewProps, 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, buildMultiWeekGrid, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, nowInTimeZone, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken, zonedDragBounds, zonedEventSource };
|
|
887
|
+
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 CreateGhostArgs, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type ExpandRecurringEventsOptions, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthDateInfo, 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 MultiWeekGrid, type MultiWeekGridDay, type MultiWeekGridInterval, type MultiWeekGridOptions, type MultiWeekGridWeek, type MultiWeekViewProps, 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 VerticalScrollEvent, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, nowInTimeZone, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken, zonedDragBounds, zonedEventSource };
|