@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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as mergeTheme, a as DateRows, c as useWebPagerKeys, d as useSlots, f as CalendarLabelsContext, g as defaultTheme, h as darkTheme, i as MonthPager, l as SlotStylesProvider, m as CalendarThemeProvider, n as DefaultMonthEvent, o as MonthView, p as useCalendarLabels, r as DateRowsPager, s as withEventAccessibilityLabel, t as MonthList, u as createSlots, v as useCalendarTheme } from "./MonthList-DdQxRhUy.mjs";
1
+ import { _ as mergeTheme, a as DateRows, c as useWebPagerKeys, d as useSlots, f as CalendarLabelsContext, g as defaultTheme, h as darkTheme, i as MonthPager, l as SlotStylesProvider, m as CalendarThemeProvider, n as DefaultMonthEvent, o as MonthView, p as useCalendarLabels, r as DateRowsPager, s as withEventAccessibilityLabel, t as MonthList, u as createSlots, v as useCalendarTheme } from "./MonthList-BGl1gTDr.mjs";
2
2
  import { addDays, addMonths, addWeeks, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getHours, getISOWeek, getMinutes, isSameDay, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
3
3
  import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
4
4
  import Animated, { runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
@@ -961,7 +961,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
961
961
  const resizeStartDelta = useSharedValue(0);
962
962
  const dragZ = useSharedValue(0);
963
963
  const moving = useSharedValue(0);
964
- const onHandle = useSharedValue(0);
964
+ const resizeYielded = useSharedValue(0);
965
965
  const edgeDir = useSharedValue(0);
966
966
  const lifted = useSharedValue(0);
967
967
  const grabX = useSharedValue(0);
@@ -1015,7 +1015,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
1015
1015
  ]);
1016
1016
  const boxStyle = useAnimatedStyle(() => {
1017
1017
  const top = (startHours + moveExtra.value.top - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
1018
- const floating = !onHandle.value && (moving.value || moveOffset.value !== 0 || moveOffsetX.value !== 0);
1018
+ const floating = moving.value || moveOffset.value !== 0 || moveOffsetX.value !== 0;
1019
1019
  return {
1020
1020
  left: floating ? dayLeftPx : left,
1021
1021
  width: floating ? dayWidth : width,
@@ -1299,14 +1299,18 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
1299
1299
  press?.(event);
1300
1300
  }, []);
1301
1301
  const resizeGesture = useMemo(() => {
1302
- const pan = Gesture.Pan().enabled(resizable).onBegin(() => {
1303
- onHandle.value = 1;
1304
- }).onStart(() => {
1302
+ const pan = Gesture.Pan().enabled(resizable).onStart(() => {
1303
+ if (moving.value) {
1304
+ resizeYielded.value = 1;
1305
+ return;
1306
+ }
1305
1307
  dragZ.value = DRAG_EVENT_Z;
1306
1308
  runOnJS(notifyDragStart)();
1307
1309
  }).onUpdate((event) => {
1310
+ if (resizeYielded.value) return;
1308
1311
  resizeDelta.value = event.translationY;
1309
1312
  }).onEnd((event) => {
1313
+ if (resizeYielded.value) return;
1310
1314
  const delta = snapDeltaMinutes(event.translationY, cellHeight.value, snapMinutes);
1311
1315
  if (delta === 0) {
1312
1316
  resizeDelta.value = 0;
@@ -1315,8 +1319,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
1315
1319
  resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1316
1320
  runOnJS(commitDrag)(0, delta);
1317
1321
  }).onFinalize(() => {
1318
- dragZ.value = 0;
1319
- onHandle.value = 0;
1322
+ if (!resizeYielded.value) dragZ.value = 0;
1323
+ resizeYielded.value = 0;
1320
1324
  });
1321
1325
  const tap = Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
1322
1326
  if (success) handlePress();
@@ -1329,7 +1333,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
1329
1333
  resizable,
1330
1334
  snapMinutes,
1331
1335
  cellHeight,
1332
- onHandle,
1336
+ moving,
1337
+ resizeYielded,
1333
1338
  resizeDelta,
1334
1339
  dragZ,
1335
1340
  commitDrag,
@@ -1339,14 +1344,18 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
1339
1344
  handleLongPressFromHandle
1340
1345
  ]);
1341
1346
  const resizeStartGesture = useMemo(() => {
1342
- const pan = Gesture.Pan().enabled(resizableFromStart).onBegin(() => {
1343
- onHandle.value = 1;
1344
- }).onStart(() => {
1347
+ const pan = Gesture.Pan().enabled(resizableFromStart).onStart(() => {
1348
+ if (moving.value) {
1349
+ resizeYielded.value = 1;
1350
+ return;
1351
+ }
1345
1352
  dragZ.value = DRAG_EVENT_Z;
1346
1353
  runOnJS(notifyDragStart)();
1347
1354
  }).onUpdate((event) => {
1355
+ if (resizeYielded.value) return;
1348
1356
  resizeStartDelta.value = event.translationY;
1349
1357
  }).onEnd((event) => {
1358
+ if (resizeYielded.value) return;
1350
1359
  const delta = snapDeltaMinutes(event.translationY, cellHeight.value, snapMinutes);
1351
1360
  if (delta === 0) {
1352
1361
  resizeStartDelta.value = 0;
@@ -1355,8 +1364,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
1355
1364
  resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1356
1365
  runOnJS(commitDrag)(delta, 0);
1357
1366
  }).onFinalize(() => {
1358
- dragZ.value = 0;
1359
- onHandle.value = 0;
1367
+ if (!resizeYielded.value) dragZ.value = 0;
1368
+ resizeYielded.value = 0;
1360
1369
  });
1361
1370
  const tap = Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
1362
1371
  if (success) handlePress();
@@ -1369,7 +1378,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
1369
1378
  resizableFromStart,
1370
1379
  snapMinutes,
1371
1380
  cellHeight,
1372
- onHandle,
1381
+ moving,
1382
+ resizeYielded,
1373
1383
  resizeStartDelta,
1374
1384
  dragZ,
1375
1385
  commitDrag,
@@ -1485,9 +1495,10 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
1485
1495
  }
1486
1496
  const AnimatedEventBox = memo(AnimatedEventBoxInner);
1487
1497
  const hourRange = (minHour, maxHour) => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index);
1488
- const HourLabel = ({ hour, width, label, ampm, hourComponent }) => {
1498
+ const HourLabel = ({ hour, width, label, ampm, hourComponent, hidden }) => {
1489
1499
  const theme = useCalendarTheme();
1490
1500
  const slot = useSlots();
1501
+ if (hidden) return null;
1491
1502
  return hourComponent ? /* @__PURE__ */ jsx(View, {
1492
1503
  style: { width },
1493
1504
  children: hourComponent(hour, ampm)
@@ -1522,12 +1533,24 @@ const HourLines = memo(function HourLines({ hours, timeslots }) {
1522
1533
  }, hour))
1523
1534
  });
1524
1535
  });
1525
- const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scrollY, showLane, showAllDayLabel, allDayLabel, headerHeight, weekNumber, ampm, hourComponent }) => {
1536
+ function getNowPosition(time, days, minHour, maxHour) {
1537
+ const hours = getHours(time) + getMinutes(time) / MINUTES_PER_HOUR$1;
1538
+ const dayIndex = days.findIndex((day) => isSameCalendarDay$1(day, time));
1539
+ return dayIndex >= 0 && hours >= minHour && hours <= maxHour ? {
1540
+ time,
1541
+ hours,
1542
+ dayIndex
1543
+ } : null;
1544
+ }
1545
+ const NOW_LABEL_CLEARANCE_HOURS = .25;
1546
+ const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scrollY, showLane, showAllDayLabel, allDayLabel, headerHeight, weekNumber, ampm, hourComponent, renderNowLabel, nowPosition }) => {
1526
1547
  const theme = useCalendarTheme();
1527
1548
  const slot = useSlots();
1528
1549
  const hours = useMemo(() => hourRange(minHour, maxHour), [minHour, maxHour]);
1550
+ const label = nowPosition && renderNowLabel?.(nowPosition.time);
1551
+ const labelHours = label == null || typeof label === "boolean" ? void 0 : nowPosition?.hours;
1529
1552
  const laneCellHeightStyle = useAnimatedStyle(() => ({ height: laneHeight.value }));
1530
- const pinStyle = useAnimatedStyle(() => ({ transform: [{ translateY: scrollY.value }] }));
1553
+ const pinStyle = useAnimatedStyle(() => ({ transform: [{ translateY: Math.max(0, scrollY.value) }] }));
1531
1554
  const rowsStyle = useAnimatedStyle(() => ({
1532
1555
  top: headerHeight + laneHeight.value + HOUR_LABEL_TOP_INSET,
1533
1556
  height: (maxHour - minHour) * cellHeight.value
@@ -1576,9 +1599,9 @@ const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scro
1576
1599
  children: allDayLabel
1577
1600
  }) : null
1578
1601
  }) : null,
1579
- /* @__PURE__ */ jsx(Animated.View, {
1602
+ /* @__PURE__ */ jsxs(Animated.View, {
1580
1603
  style: [styles$1.gutterRows, rowsStyle],
1581
- children: hours.map((hour) => /* @__PURE__ */ jsx(View, {
1604
+ children: [hours.map((hour) => /* @__PURE__ */ jsx(View, {
1582
1605
  style: styles$1.hourCell,
1583
1606
  children: /* @__PURE__ */ jsx(View, {
1584
1607
  style: [styles$1.hourRow, styles$1.nonInteractive],
@@ -1587,10 +1610,21 @@ const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scro
1587
1610
  width,
1588
1611
  label: formatHour(hour, { ampm }),
1589
1612
  ampm,
1590
- hourComponent
1613
+ hourComponent,
1614
+ hidden: labelHours != null && Math.abs(hour - labelHours) < NOW_LABEL_CLEARANCE_HOURS
1591
1615
  })
1592
1616
  })
1593
- }, hour))
1617
+ }, hour)), labelHours != null ? /* @__PURE__ */ jsx(View, {
1618
+ style: [
1619
+ styles$1.nowLabel,
1620
+ styles$1.nonInteractive,
1621
+ {
1622
+ width,
1623
+ top: `${(labelHours - minHour) / (maxHour - minHour) * 100}%`
1624
+ }
1625
+ ],
1626
+ children: label
1627
+ }) : null]
1594
1628
  })
1595
1629
  ]
1596
1630
  });
@@ -1719,14 +1753,13 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1719
1753
  if (date) onLongPressCell?.(date);
1720
1754
  };
1721
1755
  const hoursRange = useMemo(() => hourRange(minHour, maxHour), [minHour, maxHour]);
1722
- const now = useNow$1(showNowIndicator && isActive, {
1756
+ const tickOnPage = showNowIndicator && isActive && nowProp == null;
1757
+ const pageClock = useNow$1(tickOnPage, {
1723
1758
  now: nowProp,
1724
1759
  timeZone: nowTimeZone
1725
1760
  });
1726
- const today = showNowIndicator && isActive ? now : nowInTimeZone$1(nowProp, nowTimeZone);
1727
- const nowDayIndex = days.findIndex((day) => isSameCalendarDay$1(day, now));
1728
- const nowHours = (getHours(now) * MINUTES_PER_HOUR$1 + getMinutes(now)) / MINUTES_PER_HOUR$1;
1729
- const nowInWindow = nowHours >= minHour && nowHours <= maxHour;
1761
+ const today = tickOnPage ? pageClock : nowInTimeZone$1(nowProp, nowTimeZone);
1762
+ const nowPosition = showNowIndicator ? getNowPosition(today, days, minHour, maxHour) : null;
1730
1763
  const fullHeightStyle = useAnimatedStyle(() => ({ height: (maxHour - minHour) * heightSource.value }), [
1731
1764
  minHour,
1732
1765
  maxHour,
@@ -1746,7 +1779,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1746
1779
  height: Math.max(LANE_BAND_FLOOR, laneHeight.value),
1747
1780
  borderBottomWidth: laneHeight.value >= LANE_BAND_FLOOR ? StyleSheet.hairlineWidth : 0
1748
1781
  }));
1749
- const pinStyle = useAnimatedStyle(() => ({ transform: [{ translateY: scrollY.value }] }));
1782
+ const pinStyle = useAnimatedStyle(() => ({ transform: [{ translateY: Math.max(0, scrollY.value) }] }));
1750
1783
  const reportLaneLayout = useCallback((event) => {
1751
1784
  onLaneLayout(pageIndex, event.nativeEvent.layout.height);
1752
1785
  }, [onLaneLayout, pageIndex]);
@@ -2232,11 +2265,11 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
2232
2265
  minEventHeight,
2233
2266
  eventGap
2234
2267
  }) : null,
2235
- showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ jsx(NowIndicator, {
2268
+ nowPosition ? /* @__PURE__ */ jsx(NowIndicator, {
2236
2269
  cellHeight: heightSource,
2237
- nowHours,
2270
+ nowHours: nowPosition.hours,
2238
2271
  minHour,
2239
- left: dayLeft(nowDayIndex),
2272
+ left: dayLeft(nowPosition.dayIndex),
2240
2273
  width: dayWidth,
2241
2274
  color: theme.colors.nowIndicator
2242
2275
  }) : null,
@@ -2263,10 +2296,13 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
2263
2296
  });
2264
2297
  }
2265
2298
  const TimetablePage = memo(TimetablePageInner);
2266
- 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, renderCreateGhost, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }, ref) {
2299
+ 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: nowProp, 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, renderCreateGhost, onPressDateHeader, onChangeDate, renderHeader, renderNowLabel, contentPaddingBottom = 0, onVerticalScroll, verticalBounces = true, classNames, styles: styleOverrides }, ref) {
2267
2300
  const clampedMinHour = Math.max(0, Math.min(minHour, 23));
2268
2301
  const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
2269
2302
  const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
2303
+ const hasNowLabel = showNowIndicator && renderNowLabel != null && hourColumnWidth > 0;
2304
+ const labelClock = useNow$1(hasNowLabel, { now: nowProp });
2305
+ const now = nowProp ?? (hasNowLabel ? labelClock : void 0);
2270
2306
  const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
2271
2307
  const todayLabel = labels.today;
2272
2308
  const pagedHeader = renderHeader == null;
@@ -2302,7 +2338,21 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2302
2338
  const scrollY = useSharedValue(seedDefaultY);
2303
2339
  const scrollHandler = useAnimatedScrollHandler({ onScroll: (event) => {
2304
2340
  scrollY.value = event.contentOffset.y;
2305
- } });
2341
+ if (onVerticalScroll) runOnJS(onVerticalScroll)({ nativeEvent: {
2342
+ contentOffset: {
2343
+ x: event.contentOffset.x,
2344
+ y: event.contentOffset.y
2345
+ },
2346
+ contentSize: {
2347
+ width: event.contentSize.width,
2348
+ height: event.contentSize.height
2349
+ },
2350
+ layoutMeasurement: {
2351
+ width: event.layoutMeasurement.width,
2352
+ height: event.layoutMeasurement.height
2353
+ }
2354
+ } });
2355
+ } }, [onVerticalScroll]);
2306
2356
  const [mountOffsetY] = useState(seedDefaultY);
2307
2357
  const webSeededRef = useRef(!isWeb$1);
2308
2358
  const seedWebScroll = useCallback(() => {
@@ -2486,17 +2536,17 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2486
2536
  hiddenDays,
2487
2537
  weekNumberPrefix
2488
2538
  ]);
2489
- const headerDays = useMemo(() => getViewDays$1(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
2539
+ const activePageDate = pageDates[activeIndex] ?? date;
2540
+ const headerDays = useMemo(() => getViewDays$1(mode, activePageDate, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
2490
2541
  mode,
2491
- pageDates,
2492
- activeIndex,
2493
- date,
2542
+ activePageDate,
2494
2543
  weekStartsOn,
2495
2544
  numberOfDays,
2496
2545
  isRTL,
2497
2546
  weekEndsOn,
2498
2547
  hiddenDays
2499
2548
  ]);
2549
+ const gutterNow = hasNowLabel ? getNowPosition(nowInTimeZone$1(now, timeZone), headerDays, clampedMinHour, clampedMaxHour) : null;
2500
2550
  dropRef.current = {
2501
2551
  headerDays,
2502
2552
  columnsWidth,
@@ -2832,6 +2882,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2832
2882
  dragStepMinutes,
2833
2883
  minHour,
2834
2884
  maxHour,
2885
+ headerDays,
2886
+ showNowIndicator,
2835
2887
  nowTime,
2836
2888
  timeZone
2837
2889
  }), [
@@ -2844,6 +2896,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2844
2896
  dragStepMinutes,
2845
2897
  minHour,
2846
2898
  maxHour,
2899
+ headerDays,
2900
+ showNowIndicator,
2847
2901
  nowTime,
2848
2902
  timeZone
2849
2903
  ]);
@@ -2883,6 +2937,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2883
2937
  x: 0,
2884
2938
  y: mountOffsetY
2885
2939
  },
2940
+ contentContainerStyle: contentPaddingBottom > 0 ? { paddingBottom: contentPaddingBottom } : void 0,
2941
+ bounces: verticalBounces,
2942
+ overScrollMode: verticalBounces ? void 0 : "never",
2886
2943
  children: /* @__PURE__ */ jsxs(Animated.View, {
2887
2944
  testID: "time-grid-hours",
2888
2945
  style: [styles$1.gridRow, gridHeightStyle],
@@ -2899,7 +2956,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2899
2956
  headerHeight: headerOffset,
2900
2957
  weekNumber,
2901
2958
  ampm,
2902
- hourComponent
2959
+ hourComponent,
2960
+ renderNowLabel,
2961
+ nowPosition: gutterNow
2903
2962
  }) : null, /* @__PURE__ */ jsxs(View, {
2904
2963
  ref: pagerRef,
2905
2964
  testID: "time-grid-pager",
@@ -3141,6 +3200,11 @@ const styles$1 = StyleSheet.create({
3141
3200
  textAlign: "right",
3142
3201
  paddingRight: 6
3143
3202
  },
3203
+ nowLabel: {
3204
+ position: "absolute",
3205
+ left: 0,
3206
+ marginTop: -6
3207
+ },
3144
3208
  gutterRows: {
3145
3209
  position: "absolute",
3146
3210
  left: 0,
@@ -3301,7 +3365,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn, numb
3301
3365
  * ```
3302
3366
  */
3303
3367
  const Calendar = forwardRef(CalendarInner);
3304
- function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, renderCreateGhost, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, chipHeight, chipGap, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, numberOfWeeks = 2, 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) {
3368
+ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, renderCreateGhost, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, chipHeight, chipGap, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, numberOfWeeks = 2, 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, renderNowLabel, timeGridContentPaddingBottom, onTimeGridScroll, timeGridBounces, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }, ref) {
3305
3369
  const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
3306
3370
  const internalCellHeight = useSharedValue(hourHeight);
3307
3371
  const cellHeight = cellHeightProp ?? internalCellHeight;
@@ -3578,6 +3642,10 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
3578
3642
  onPressDateHeader,
3579
3643
  onChangeDate: handleChangeDate,
3580
3644
  renderHeader: renderTimeGridHeader,
3645
+ renderNowLabel,
3646
+ contentPaddingBottom: timeGridContentPaddingBottom,
3647
+ onVerticalScroll: onTimeGridScroll,
3648
+ verticalBounces: timeGridBounces,
3581
3649
  classNames,
3582
3650
  styles: styleOverrides
3583
3651
  })
package/dist/picker.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { C as EventKeyExtractor, D as RenderEvent, F as PartialCalendarTheme, I as darkTheme, L as defaultTheme, N as CalendarTheme, O as RenderEventArgs, P as CalendarThemeProvider, R as mergeTheme, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, j as WeekStartsOn, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as ICalendarEvent, z as useCalendarTheme } from "./DefaultMonthEvent-hGk7wSrr.mjs";
1
+ import { B as useCalendarTheme, C as EventKeyExtractor, F as CalendarThemeProvider, I as PartialCalendarTheme, L as darkTheme, M as WeekStartsOn, O as RenderEvent, P as CalendarTheme, R as defaultTheme, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, k as RenderEventArgs, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as ICalendarEvent, z as mergeTheme } from "./DefaultMonthEvent-DzgQFuVp.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 { C as EventKeyExtractor, D as RenderEvent, F as PartialCalendarTheme, I as darkTheme, L as defaultTheme, N as CalendarTheme, O as RenderEventArgs, P as CalendarThemeProvider, R as mergeTheme, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, j as WeekStartsOn, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as ICalendarEvent, z as useCalendarTheme } from "./DefaultMonthEvent-B7xVeY7Q.js";
1
+ import { B as useCalendarTheme, C as EventKeyExtractor, F as CalendarThemeProvider, I as PartialCalendarTheme, L as darkTheme, M as WeekStartsOn, O as RenderEvent, P as CalendarTheme, R as defaultTheme, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, k as RenderEventArgs, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as ICalendarEvent, z as mergeTheme } from "./DefaultMonthEvent-joYl8Tu2.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-C_NTufaK.js");
2
+ const require_MonthList = require("./MonthList-DeO-x5VW.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 { _ as mergeTheme, g as defaultTheme, h as darkTheme, i as MonthPager, m as CalendarThemeProvider, n as DefaultMonthEvent, o as MonthView, t as MonthList, v as useCalendarTheme } from "./MonthList-DdQxRhUy.mjs";
1
+ import { _ as mergeTheme, g as defaultTheme, h as darkTheme, i as MonthPager, m as CalendarThemeProvider, n as DefaultMonthEvent, o as MonthView, t as MonthList, v as useCalendarTheme } from "./MonthList-BGl1gTDr.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.18.0",
3
+ "version": "2.20.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.18.0"
67
+ "@super-calendar/core": "2.20.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@legendapp/list": ">=3",
@@ -5,8 +5,7 @@ import { StyleSheet, Text, type TextStyle, View, type ScrollViewProps } from "re
5
5
  import { useCalendarTheme } from "../theme";
6
6
  import type { CalendarEvent, EventKeyExtractor, RenderEvent } from "../types";
7
7
  import { createSlots, type SlotStyleProps } from "../utils/slots";
8
- import { getIsToday, nowInTimeZone } from "@super-calendar/core";
9
- import { isAllDayEvent, isBackgroundEvent } from "@super-calendar/core";
8
+ import { getIsToday, nowInTimeZone, isAllDayEvent, isBackgroundEvent } from "@super-calendar/core";
10
9
 
11
10
  /**
12
11
  * The styleable parts of {@link Agenda}. Mirrors the dom renderer's slot names;
@@ -33,6 +33,7 @@ import type {
33
33
  CalendarMode,
34
34
  CreateGhostArgs,
35
35
  EventKeyExtractor,
36
+ MonthDateInfo,
36
37
  RenderEvent,
37
38
  RenderEventArgs,
38
39
  WeekStartsOn,
@@ -49,8 +50,6 @@ import {
49
50
  expandRecurringEvents,
50
51
  type WeekdayFormat,
51
52
  getViewDays,
52
- } from "@super-calendar/core";
53
- import {
54
53
  type CalendarHandle,
55
54
  type CalendarLabels,
56
55
  resolveCalendarLabels,
@@ -69,6 +68,7 @@ import {
69
68
  type HourRenderer,
70
69
  TimeGrid,
71
70
  type TimeGridSlot,
71
+ type VerticalScrollEvent,
72
72
  } from "./TimeGrid";
73
73
 
74
74
  /**
@@ -374,14 +374,23 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
374
374
  freeSwipe?: boolean;
375
375
  /** Custom header above the week/day grid. Receives the visible days. */
376
376
  renderTimeGridHeader?: (days: Date[]) => React.ReactNode;
377
+ /** Draw a label in the hour column when the current-time line is visible. */
378
+ renderNowLabel?: (now: Date) => React.ReactNode;
379
+ /** Week/day grid: extra scrollable space below the last hour (e.g. for a floating tab bar). Default 0. */
380
+ timeGridContentPaddingBottom?: number;
381
+ /** Week/day grid: the vertical scroll view's scroll events, on the JS thread. */
382
+ onTimeGridScroll?: (event: VerticalScrollEvent) => void;
383
+ /** Week/day grid: `false` turns off overscroll on the hours (iOS bounce, Android stretch). Default true. */
384
+ timeGridBounces?: boolean;
377
385
  /** Replace the weekday-label header above the month grid. Return `null` to hide it. */
378
386
  renderHeaderForMonthView?: (weekDays: Date[]) => React.ReactNode;
379
387
  /**
380
388
  * Month mode only: replace the default date badge in each day cell. Receives
381
- * the day; return your own date label (e.g. a number with a dot or badge).
389
+ * the day and its state (`isCurrentMonth`, `isToday`, `isSelected`,
390
+ * `isDisabled`); return your own date label (e.g. a number with a dot or badge).
382
391
  * Event chips and the "+N more" label still render below it.
383
392
  */
384
- renderCustomDateForMonth?: (date: Date) => React.ReactNode;
393
+ renderCustomDateForMonth?: (date: Date, info: MonthDateInfo) => React.ReactNode;
385
394
  /** Drawn between rows of the `schedule` (agenda) list. */
386
395
  itemSeparatorComponent?: React.ComponentType<unknown> | null;
387
396
  };
@@ -590,6 +599,10 @@ function CalendarInner<T>(
590
599
  isRTL,
591
600
  freeSwipe,
592
601
  renderTimeGridHeader,
602
+ renderNowLabel,
603
+ timeGridContentPaddingBottom,
604
+ onTimeGridScroll,
605
+ timeGridBounces,
593
606
  renderHeaderForMonthView,
594
607
  renderCustomDateForMonth,
595
608
  itemSeparatorComponent,
@@ -974,6 +987,10 @@ function CalendarInner<T>(
974
987
  onPressDateHeader={onPressDateHeader}
975
988
  onChangeDate={handleChangeDate}
976
989
  renderHeader={renderTimeGridHeader}
990
+ renderNowLabel={renderNowLabel}
991
+ contentPaddingBottom={timeGridContentPaddingBottom}
992
+ onVerticalScroll={onTimeGridScroll}
993
+ verticalBounces={timeGridBounces}
977
994
  classNames={classNames}
978
995
  styles={styleOverrides}
979
996
  />