@super-calendar/native 2.10.0 → 2.11.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/dist/index.mjs CHANGED
@@ -1,18 +1,20 @@
1
- import { a as withEventAccessibilityLabel, c as createSlots, d as darkTheme, f as defaultTheme, i as MonthView, l as useSlots, m as useCalendarTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as mergeTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarThemeProvider } from "./MonthList-CjKhzOJX.mjs";
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-B-UE37ZG.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, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
4
- import Animated, { runOnJS, scrollTo, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
5
- import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, 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, 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";
4
+ import Animated, { runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
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 { Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
7
7
  import { Gesture, GestureDetector } from "react-native-gesture-handler";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { LegendList } from "@legendapp/list/react-native";
10
+ import { AnimatedLegendList } from "@legendapp/list/reanimated";
10
11
  //#region src/components/YearView.tsx
11
12
  const isWeb$2 = Platform.OS === "web";
12
13
  const DRAG_HOLD_MS = 400;
13
14
  const FALLBACK_COLUMNS = 3;
14
- function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, classNames, styles: styleOverrides }) {
15
+ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, refreshControl, classNames, styles: styleOverrides }) {
15
16
  const theme = useCalendarTheme();
17
+ const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
16
18
  const slot = createSlots({
17
19
  classNames,
18
20
  styles: styleOverrides
@@ -98,6 +100,7 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeD
98
100
  onLayout: handleLayout,
99
101
  showsVerticalScrollIndicator: true,
100
102
  scrollEnabled: isWeb$2 || sweep == null,
103
+ refreshControl,
101
104
  children: /* @__PURE__ */ jsx(View, {
102
105
  ...slot("grid", { base: styles$5.grid }),
103
106
  children: months.map((month, monthIndex) => {
@@ -165,7 +168,14 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeD
165
168
  });
166
169
  const dayTime = startOfDay(day).getTime();
167
170
  const inSweep = sweep != null && dayTime >= Math.min(sweep.anchor, sweep.hover) && dayTime <= Math.max(sweep.anchor, sweep.hover);
168
- const label = `${format(day, "EEEE, d LLLL yyyy", { locale })}${isToday ? ", today" : ""}${state.isSelected ? ", selected" : ""}${state.isDisabled ? ", unavailable" : ""}${hasEvents ? ", has events" : ""}`;
171
+ const label = dayAccessibilityLabel({
172
+ dateLabel: format(day, "EEEE, d LLLL yyyy", { locale }),
173
+ isToday,
174
+ isSelected: state.isSelected,
175
+ isDisabled: state.isDisabled,
176
+ hasEvents,
177
+ labels
178
+ });
169
179
  const badge = dayBadgeKind(state, isHighlighted);
170
180
  const daySlot = slot("day", { base: styles$5.day });
171
181
  const showBand = rangeBandKind(state, true) !== "none";
@@ -369,7 +379,7 @@ const styles$5 = StyleSheet.create({
369
379
  * start, grouped under a date header per day. The consumer controls which
370
380
  * events (and therefore which date range) are shown.
371
381
  */
372
- function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, classNames, styles: styleOverrides }) {
382
+ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, refreshControl, classNames, styles: styleOverrides }) {
373
383
  const theme = useCalendarTheme();
374
384
  const slot = useMemo(() => createSlots({
375
385
  classNames,
@@ -448,7 +458,8 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
448
458
  keyExtractor: keyExtractorRow,
449
459
  renderItem,
450
460
  ItemSeparatorComponent: itemSeparatorComponent ?? void 0,
451
- recycleItems: false
461
+ recycleItems: false,
462
+ refreshControl
452
463
  });
453
464
  }
454
465
  const styles$4 = StyleSheet.create({
@@ -488,6 +499,7 @@ const numericStyle = (value, fallback) => typeof value === "number" ? value : fa
488
499
  */
489
500
  function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, accessibilityActions, onAccessibilityAction, cellStyle, onPress, onLongPress }) {
490
501
  const theme = useCalendarTheme();
502
+ const labels = useCalendarLabels();
491
503
  const isAllDayEvent = isAllDay ?? false;
492
504
  const timeLabel = eventTimeLabel({
493
505
  mode,
@@ -506,7 +518,8 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
506
518
  start: event.start,
507
519
  end: event.end,
508
520
  ampm,
509
- allDayLabel
521
+ allDayLabel,
522
+ labels
510
523
  });
511
524
  const fixedTitleLines = titleNumberOfLines(mode, isAllDayEvent);
512
525
  const isSchedule = mode === "schedule";
@@ -665,12 +678,13 @@ function useWebGridZoom(enabled, target, cellHeight, committedCellHeight, minHei
665
678
  //#endregion
666
679
  //#region src/components/AllDayLane.tsx
667
680
  /**
668
- * The all-day lane that sits above the scrolling time grid. All-day events are
669
- * excluded from the timed columns (see `layoutDayEvents`) and shown here,
670
- * stacked under their day(s). Renders nothing when no day has an all-day event,
671
- * so timed-only calendars are unaffected.
681
+ * The all-day lane of one page, pinned above the scrolling hours. All-day
682
+ * events are excluded from the timed columns (see `layoutDayEvents`) and shown
683
+ * here, stacked under their day(s). Always rendered so every page reports a
684
+ * height, zero when the week has none, which the band above the grid follows
685
+ * live as you swipe; the "all-day" label lives in the hour column.
672
686
  */
673
- function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent, keyExtractor, onPressEvent, onLongPressEvent }) {
687
+ function AllDayLane({ days, events, mode, dayWidth, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onLayout }) {
674
688
  const theme = useCalendarTheme();
675
689
  const slot = useSlots();
676
690
  const RenderEventComponent = renderEvent;
@@ -680,23 +694,13 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
680
694
  const next = addDays(start, 1);
681
695
  return allDay.filter((event) => event.start < next && event.end > start);
682
696
  });
683
- if (perDay.every((list) => list.length === 0)) return null;
684
- return /* @__PURE__ */ jsxs(View, {
697
+ return /* @__PURE__ */ jsx(View, {
685
698
  ...slot("allDayLane", {
686
699
  base: styles$2.lane,
687
- themed: [{ borderBottomColor: theme.colors.gridLine }, theme.containers.allDayLane]
700
+ themed: theme.containers.allDayLane
688
701
  }),
689
- children: [/* @__PURE__ */ jsx(View, {
690
- style: [styles$2.gutter, { width: hourColumnWidth }],
691
- children: /* @__PURE__ */ jsx(Text, {
692
- ...slot("allDayLabel", {
693
- base: styles$2.label,
694
- themed: { color: theme.colors.textMuted }
695
- }),
696
- allowFontScaling: false,
697
- children: "all-day"
698
- })
699
- }), days.map((day, dayIndex) => /* @__PURE__ */ jsx(View, {
702
+ onLayout,
703
+ children: perDay.every((list) => list.length === 0) ? null : days.map((day, dayIndex) => /* @__PURE__ */ jsx(View, {
700
704
  ...slot("allDayColumn", {
701
705
  base: [styles$2.column, { width: dayWidth }],
702
706
  themed: theme.containers.allDayColumn
@@ -711,20 +715,11 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
711
715
  onLongPress: onLongPressEvent ? () => onLongPressEvent(event) : void 0
712
716
  })
713
717
  }, keyExtractor(event, index)))
714
- }, day.toISOString()))]
718
+ }, day.toISOString()))
715
719
  });
716
720
  }
717
721
  const styles$2 = StyleSheet.create({
718
- lane: {
719
- flexDirection: "row",
720
- borderBottomWidth: StyleSheet.hairlineWidth
721
- },
722
- gutter: { justifyContent: "center" },
723
- label: {
724
- fontSize: 10,
725
- textAlign: "right",
726
- paddingRight: 6
727
- },
722
+ lane: { flexDirection: "row" },
728
723
  column: {
729
724
  paddingVertical: 2,
730
725
  paddingHorizontal: 1,
@@ -746,7 +741,7 @@ function MultiDayMovePreview(props) {
746
741
  dayEnd: addDays(startOfDay(day), 1).getTime()
747
742
  }, day.toISOString()));
748
743
  }
749
- function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
744
+ function PreviewDay({ move, cellHeight, dayWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
750
745
  const theme = useCalendarTheme();
751
746
  const slot = useSlots();
752
747
  const { offsetX, offsetY, lifted, dayIndex, event } = move;
@@ -802,7 +797,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
802
797
  position: "absolute",
803
798
  overflow: "hidden",
804
799
  padding: eventGap,
805
- left: hourColumnWidth + index * dayWidth,
800
+ left: index * dayWidth,
806
801
  width: dayWidth,
807
802
  zIndex: 100
808
803
  },
@@ -823,7 +818,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
823
818
  const isWeb$1 = Platform.OS === "web";
824
819
  const MINUTES_PER_HOUR$1 = 60;
825
820
  const HOURS_PER_DAY = 24;
826
- const MINUTES_PER_DAY = MINUTES_PER_HOUR$1 * HOURS_PER_DAY;
821
+ const MINUTES_PER_DAY = 1440;
827
822
  const PAGE_WINDOW = 180;
828
823
  const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
829
824
  /** Default height in pixels of one hour row on the time grid. */
@@ -839,8 +834,9 @@ const DRAG_ACTIVATE_PX$1 = 8;
839
834
  const RESIZE_HANDLE_HEIGHT = 14;
840
835
  const DEFAULT_DRAG_STEP_MINUTES = 15;
841
836
  const DRAG_EVENT_Z = 100;
842
- const EDGE_DWELL_MS = 500;
843
- const EDGE_ZONE_PX = 36;
837
+ const EDGE_DWELL_MS = 600;
838
+ const EDGE_REPEAT_MS = 700;
839
+ const EDGE_ZONE_PX = 24;
844
840
  const EdgePagingContext = createContext(null);
845
841
  const noop = () => {};
846
842
  /**
@@ -918,9 +914,12 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent, eventGap })
918
914
  });
919
915
  }
920
916
  const HOUR_LABEL_TOP_INSET = 12;
921
- function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, minEventHeight, eventGap, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
917
+ const LANE_BAND_FLOOR = 1;
918
+ const DAY_HEADER_HEIGHT = 56;
919
+ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, minEventHeight, eventGap, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
922
920
  const RenderEventComponent = renderEvent;
923
921
  const theme = useCalendarTheme();
922
+ const labels = useCalendarLabels();
924
923
  const slot = useSlots();
925
924
  const edgePaging = useContext(EdgePagingContext);
926
925
  const pagerLeftSV = edgePaging?.pagerLeft;
@@ -970,9 +969,14 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
970
969
  top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
971
970
  height: visibleBoxHeight.value,
972
971
  transform: [{ translateX: moveOffsetX.value }],
973
- zIndex: dragZ.value
972
+ zIndex: dragZ.value,
973
+ opacity: hiddenForMove || lifted.value ? 0 : 1
974
974
  };
975
- }, [startHours, minHour]);
975
+ }, [
976
+ startHours,
977
+ minHour,
978
+ hiddenForMove
979
+ ]);
976
980
  const spillHeight = useDerivedValue(() => {
977
981
  if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
978
982
  const overflowHours = startHours + moveOffset.value / cellHeight.value + durationHours - HOURS_PER_DAY;
@@ -1015,13 +1019,17 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1015
1019
  event: positioned.event,
1016
1020
  eventIndex,
1017
1021
  onDragEvent,
1018
- onDragStart
1022
+ onDragStart,
1023
+ onPress,
1024
+ onLongPress
1019
1025
  });
1020
1026
  latest.current = {
1021
1027
  event: positioned.event,
1022
1028
  eventIndex,
1023
1029
  onDragEvent,
1024
- onDragStart
1030
+ onDragStart,
1031
+ onPress,
1032
+ onLongPress
1025
1033
  };
1026
1034
  const snapBack = useCallback(() => {
1027
1035
  moveOffset.value = 0;
@@ -1084,16 +1092,12 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1084
1092
  dwellTimer.current = null;
1085
1093
  }
1086
1094
  }, []);
1087
- const releaseEdge = useCallback(() => {
1088
- disarmEdge();
1089
- edgePaging?.lockScroll(false);
1090
- }, [disarmEdge, edgePaging]);
1095
+ const releaseEdge = disarmEdge;
1091
1096
  const armEdge = useCallback((dir) => {
1092
1097
  disarmEdge();
1093
- dwellTimer.current = setTimeout(() => {
1098
+ const fire = () => {
1094
1099
  dwellTimer.current = null;
1095
1100
  if (!edgePaging) return;
1096
- edgePaging.lockScroll(true);
1097
1101
  if (!lifted.value) {
1098
1102
  lifted.value = 1;
1099
1103
  edgePaging.ghostW.value = width;
@@ -1104,7 +1108,9 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1104
1108
  edgePaging.beginLift(latest.current.event);
1105
1109
  }
1106
1110
  onEdgeAdvance?.(dir);
1107
- }, EDGE_DWELL_MS);
1111
+ dwellTimer.current = setTimeout(fire, EDGE_REPEAT_MS);
1112
+ };
1113
+ dwellTimer.current = setTimeout(fire, EDGE_DWELL_MS);
1108
1114
  }, [
1109
1115
  disarmEdge,
1110
1116
  edgePaging,
@@ -1224,79 +1230,109 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1224
1230
  disarmEdge,
1225
1231
  releaseEdge
1226
1232
  ]);
1227
- const resizeGesture = useMemo(() => Gesture.Pan().enabled(resizable).onStart(() => {
1228
- dragZ.value = DRAG_EVENT_Z;
1229
- runOnJS(notifyDragStart)();
1230
- }).onUpdate((event) => {
1231
- resizeDelta.value = event.translationY;
1232
- }).onEnd((event) => {
1233
- const delta = snapDeltaMinutes(event.translationY, cellHeight.value, snapMinutes);
1234
- if (delta === 0) {
1235
- resizeDelta.value = 0;
1236
- return;
1237
- }
1238
- resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1239
- runOnJS(commitDrag)(0, delta);
1240
- }).onFinalize(() => {
1241
- dragZ.value = 0;
1242
- }), [
1233
+ const handlePress = useCallback(() => {
1234
+ const { event, onPress: press } = latest.current;
1235
+ press(event);
1236
+ }, []);
1237
+ const canLongPress = !canMove && onLongPress != null;
1238
+ const handleLongPressFromHandle = useCallback(() => {
1239
+ const { event, onLongPress: press } = latest.current;
1240
+ press?.(event);
1241
+ }, []);
1242
+ const resizeGesture = useMemo(() => {
1243
+ const pan = Gesture.Pan().enabled(resizable).onStart(() => {
1244
+ dragZ.value = DRAG_EVENT_Z;
1245
+ runOnJS(notifyDragStart)();
1246
+ }).onUpdate((event) => {
1247
+ resizeDelta.value = event.translationY;
1248
+ }).onEnd((event) => {
1249
+ const delta = snapDeltaMinutes(event.translationY, cellHeight.value, snapMinutes);
1250
+ if (delta === 0) {
1251
+ resizeDelta.value = 0;
1252
+ return;
1253
+ }
1254
+ resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1255
+ runOnJS(commitDrag)(0, delta);
1256
+ }).onFinalize(() => {
1257
+ dragZ.value = 0;
1258
+ });
1259
+ const tap = Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
1260
+ if (success) handlePress();
1261
+ });
1262
+ const longPress = Gesture.LongPress().enabled(canLongPress).runOnJS(true).onStart(() => {
1263
+ handleLongPressFromHandle();
1264
+ });
1265
+ return Gesture.Race(pan, tap, longPress);
1266
+ }, [
1243
1267
  resizable,
1244
1268
  snapMinutes,
1245
1269
  cellHeight,
1246
1270
  resizeDelta,
1247
1271
  dragZ,
1248
1272
  commitDrag,
1249
- notifyDragStart
1273
+ notifyDragStart,
1274
+ handlePress,
1275
+ canLongPress,
1276
+ handleLongPressFromHandle
1250
1277
  ]);
1251
- const resizeStartGesture = useMemo(() => Gesture.Pan().enabled(resizableFromStart).onStart(() => {
1252
- dragZ.value = DRAG_EVENT_Z;
1253
- runOnJS(notifyDragStart)();
1254
- }).onUpdate((event) => {
1255
- resizeStartDelta.value = event.translationY;
1256
- }).onEnd((event) => {
1257
- const delta = snapDeltaMinutes(event.translationY, cellHeight.value, snapMinutes);
1258
- if (delta === 0) {
1259
- resizeStartDelta.value = 0;
1260
- return;
1261
- }
1262
- resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1263
- runOnJS(commitDrag)(delta, 0);
1264
- }).onFinalize(() => {
1265
- dragZ.value = 0;
1266
- }), [
1278
+ const resizeStartGesture = useMemo(() => {
1279
+ const pan = Gesture.Pan().enabled(resizableFromStart).onStart(() => {
1280
+ dragZ.value = DRAG_EVENT_Z;
1281
+ runOnJS(notifyDragStart)();
1282
+ }).onUpdate((event) => {
1283
+ resizeStartDelta.value = event.translationY;
1284
+ }).onEnd((event) => {
1285
+ const delta = snapDeltaMinutes(event.translationY, cellHeight.value, snapMinutes);
1286
+ if (delta === 0) {
1287
+ resizeStartDelta.value = 0;
1288
+ return;
1289
+ }
1290
+ resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1291
+ runOnJS(commitDrag)(delta, 0);
1292
+ }).onFinalize(() => {
1293
+ dragZ.value = 0;
1294
+ });
1295
+ const tap = Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
1296
+ if (success) handlePress();
1297
+ });
1298
+ const longPress = Gesture.LongPress().enabled(canLongPress).runOnJS(true).onStart(() => {
1299
+ handleLongPressFromHandle();
1300
+ });
1301
+ return Gesture.Race(pan, tap, longPress);
1302
+ }, [
1267
1303
  resizableFromStart,
1268
1304
  snapMinutes,
1269
1305
  cellHeight,
1270
1306
  resizeStartDelta,
1271
1307
  dragZ,
1272
1308
  commitDrag,
1273
- notifyDragStart
1309
+ notifyDragStart,
1310
+ handlePress,
1311
+ canLongPress,
1312
+ handleLongPressFromHandle
1274
1313
  ]);
1275
- const handlePress = () => onPress(positioned.event);
1276
1314
  const handleLongPress = !canMove && onLongPress ? () => onLongPress(positioned.event) : void 0;
1277
- const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
1278
- const pageUnit = mode === "week" ? "week" : daysPerPage === 1 ? "day" : `${daysPerPage} day${daysPerPage === 1 ? "" : "s"}`;
1279
1315
  const dragActions = [
1280
1316
  ...canMove ? [{
1281
1317
  name: "move-later",
1282
- label: `Move ${unit(snapMinutes)} later`
1318
+ label: labels.moveLater(snapMinutes)
1283
1319
  }, {
1284
1320
  name: "move-earlier",
1285
- label: `Move ${unit(snapMinutes)} earlier`
1321
+ label: labels.moveEarlier(snapMinutes)
1286
1322
  }] : [],
1287
1323
  ...resizable ? [{
1288
1324
  name: "extend",
1289
- label: `Extend by ${unit(snapMinutes)}`
1325
+ label: labels.extend(snapMinutes)
1290
1326
  }, {
1291
1327
  name: "shrink",
1292
- label: `Shorten by ${unit(snapMinutes)}`
1328
+ label: labels.shorten(snapMinutes)
1293
1329
  }] : [],
1294
1330
  ...canMove ? [{
1295
1331
  name: "move-next-page",
1296
- label: `Move to next ${pageUnit}`
1332
+ label: labels.moveToNextPage(daysPerPage, mode)
1297
1333
  }, {
1298
1334
  name: "move-previous-page",
1299
- label: `Move to previous ${pageUnit}`
1335
+ label: labels.moveToPreviousPage(daysPerPage, mode)
1300
1336
  }] : []
1301
1337
  ];
1302
1338
  const accessibilityActions = dragActions.length ? dragActions : void 0;
@@ -1317,9 +1353,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1317
1353
  case "move-next-page":
1318
1354
  commitDrag(daysPerPage * MINUTES_PER_DAY, daysPerPage * MINUTES_PER_DAY);
1319
1355
  break;
1320
- case "move-previous-page":
1321
- commitDrag(-daysPerPage * MINUTES_PER_DAY, -daysPerPage * MINUTES_PER_DAY);
1322
- break;
1356
+ case "move-previous-page": commitDrag(-daysPerPage * MINUTES_PER_DAY, -daysPerPage * MINUTES_PER_DAY);
1323
1357
  }
1324
1358
  } : void 0;
1325
1359
  const eventSlot = slot("event", {
@@ -1332,11 +1366,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1332
1366
  });
1333
1367
  const box = /* @__PURE__ */ jsxs(Animated.View, {
1334
1368
  ...eventSlot,
1335
- style: [
1336
- eventSlot.style,
1337
- boxStyle,
1338
- hiddenForMove ? { opacity: 0 } : null
1339
- ],
1369
+ style: [eventSlot.style, boxStyle],
1340
1370
  children: [
1341
1371
  /* @__PURE__ */ jsx(RenderEventComponent, {
1342
1372
  event: positioned.event,
@@ -1352,6 +1382,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1352
1382
  resizableFromStart ? /* @__PURE__ */ jsx(GestureDetector, {
1353
1383
  gesture: resizeStartGesture,
1354
1384
  children: /* @__PURE__ */ jsx(Animated.View, {
1385
+ testID: "resize-handle-top",
1355
1386
  style: styles$1.resizeHandleTop,
1356
1387
  children: showDragHandle ? /* @__PURE__ */ jsx(View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
1357
1388
  })
@@ -1359,6 +1390,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1359
1390
  resizable ? /* @__PURE__ */ jsx(GestureDetector, {
1360
1391
  gesture: resizeGesture,
1361
1392
  children: /* @__PURE__ */ jsx(Animated.View, {
1393
+ testID: "resize-handle",
1362
1394
  style: styles$1.resizeHandle,
1363
1395
  children: showDragHandle ? /* @__PURE__ */ jsx(View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
1364
1396
  })
@@ -1384,53 +1416,119 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1384
1416
  slotProps: slot("event", { themed: theme.containers.timeGridEvent })
1385
1417
  }) : null] });
1386
1418
  }
1387
- const HourRow = ({ hour, minHour, cellHeight, hourColumnWidth, label, ampm, hourComponent }) => {
1419
+ const AnimatedEventBox = memo(AnimatedEventBoxInner);
1420
+ const hourRange = (minHour, maxHour) => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index);
1421
+ const HourLabel = ({ hour, width, label, ampm, hourComponent }) => {
1388
1422
  const theme = useCalendarTheme();
1389
1423
  const slot = useSlots();
1390
- const animatedStyle = useAnimatedStyle(() => ({ top: (hour - minHour) * cellHeight.value }), [hour, minHour]);
1391
- return /* @__PURE__ */ jsxs(Animated.View, {
1392
- style: [
1393
- styles$1.hourRow,
1394
- styles$1.nonInteractive,
1395
- animatedStyle
1396
- ],
1397
- children: [hourComponent ? /* @__PURE__ */ jsx(View, {
1398
- style: { width: hourColumnWidth },
1399
- children: hourComponent(hour, ampm)
1400
- }) : /* @__PURE__ */ jsx(Text, {
1401
- ...slot("hourLabel", {
1402
- base: [styles$1.hourLabel, { width: hourColumnWidth }],
1403
- themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
1404
- }),
1405
- allowFontScaling: false,
1406
- children: label
1407
- }), /* @__PURE__ */ jsx(View, { ...slot("gridLines", {
1408
- base: styles$1.hourLine,
1409
- themed: { backgroundColor: theme.colors.gridLine }
1410
- }) })]
1424
+ return hourComponent ? /* @__PURE__ */ jsx(View, {
1425
+ style: { width },
1426
+ children: hourComponent(hour, ampm)
1427
+ }) : /* @__PURE__ */ jsx(Text, {
1428
+ ...slot("hourLabel", {
1429
+ base: [styles$1.hourLabel, { width }],
1430
+ themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
1431
+ }),
1432
+ allowFontScaling: false,
1433
+ children: label
1411
1434
  });
1412
1435
  };
1413
- const TimeslotLine = ({ hour, minHour, fraction, cellHeight, hourColumnWidth }) => {
1436
+ const HourLines = memo(function HourLines({ hours, timeslots }) {
1414
1437
  const theme = useCalendarTheme();
1415
1438
  const slot = useSlots();
1416
- const animatedStyle = useAnimatedStyle(() => ({ top: (hour - minHour + fraction) * cellHeight.value }), [
1417
- hour,
1418
- minHour,
1419
- fraction
1420
- ]);
1421
- const lineSlot = slot("gridLines", {
1422
- base: [
1423
- styles$1.timeslotLine,
1424
- styles$1.nonInteractive,
1425
- { left: hourColumnWidth }
1426
- ],
1439
+ const hourLineSlot = slot("gridLines", {
1440
+ base: [styles$1.hourLine, styles$1.nonInteractive],
1427
1441
  themed: { backgroundColor: theme.colors.gridLine }
1428
1442
  });
1429
- return /* @__PURE__ */ jsx(Animated.View, {
1430
- ...lineSlot,
1431
- style: [lineSlot.style, animatedStyle]
1443
+ const timeslotLineSlot = slot("gridLines", {
1444
+ base: [styles$1.timeslotLine, styles$1.nonInteractive],
1445
+ themed: { backgroundColor: theme.colors.gridLine }
1446
+ });
1447
+ return /* @__PURE__ */ jsx(View, {
1448
+ style: [styles$1.fill, styles$1.nonInteractive],
1449
+ children: hours.map((hour) => /* @__PURE__ */ jsx(View, {
1450
+ style: styles$1.hourCell,
1451
+ children: Array.from({ length: Math.max(1, timeslots) }, (_, slotIndex) => /* @__PURE__ */ jsx(View, {
1452
+ style: styles$1.hourCell,
1453
+ children: /* @__PURE__ */ jsx(View, { ...slotIndex === 0 ? hourLineSlot : timeslotLineSlot })
1454
+ }, slotIndex))
1455
+ }, hour))
1456
+ });
1457
+ });
1458
+ const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scrollY, showLane, showAllDayLabel, allDayLabel, headerHeight, weekNumber, ampm, hourComponent }) => {
1459
+ const theme = useCalendarTheme();
1460
+ const slot = useSlots();
1461
+ const hours = useMemo(() => hourRange(minHour, maxHour), [minHour, maxHour]);
1462
+ const laneCellHeightStyle = useAnimatedStyle(() => ({ height: laneHeight.value }));
1463
+ const pinStyle = useAnimatedStyle(() => ({ transform: [{ translateY: scrollY.value }] }));
1464
+ const rowsStyle = useAnimatedStyle(() => ({
1465
+ top: headerHeight + laneHeight.value + HOUR_LABEL_TOP_INSET,
1466
+ height: (maxHour - minHour) * cellHeight.value
1467
+ }), [
1468
+ minHour,
1469
+ maxHour,
1470
+ headerHeight
1471
+ ]);
1472
+ return /* @__PURE__ */ jsxs(View, {
1473
+ testID: "hour-gutter",
1474
+ ...slot("hourGutter", { base: [styles$1.hourGutter, { width }] }),
1475
+ children: [
1476
+ headerHeight > 0 ? /* @__PURE__ */ jsx(Animated.View, {
1477
+ style: [
1478
+ styles$1.gutterCorner,
1479
+ {
1480
+ height: headerHeight,
1481
+ backgroundColor: theme.colors.surface,
1482
+ borderBottomColor: theme.colors.gridLine
1483
+ },
1484
+ pinStyle
1485
+ ],
1486
+ children: weekNumber ? /* @__PURE__ */ jsx(Text, {
1487
+ ...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
1488
+ allowFontScaling: false,
1489
+ children: weekNumber
1490
+ }) : null
1491
+ }) : null,
1492
+ showLane ? /* @__PURE__ */ jsx(Animated.View, {
1493
+ style: [
1494
+ styles$1.laneCell,
1495
+ { top: headerHeight },
1496
+ {
1497
+ backgroundColor: theme.colors.surface,
1498
+ borderBottomColor: theme.colors.gridLine
1499
+ },
1500
+ laneCellHeightStyle,
1501
+ pinStyle
1502
+ ],
1503
+ children: showAllDayLabel ? /* @__PURE__ */ jsx(Text, {
1504
+ ...slot("allDayLabel", {
1505
+ base: styles$1.allDayLabel,
1506
+ themed: { color: theme.colors.textMuted }
1507
+ }),
1508
+ allowFontScaling: false,
1509
+ children: allDayLabel
1510
+ }) : null
1511
+ }) : null,
1512
+ /* @__PURE__ */ jsx(Animated.View, {
1513
+ style: [styles$1.gutterRows, rowsStyle],
1514
+ children: hours.map((hour) => /* @__PURE__ */ jsx(View, {
1515
+ style: styles$1.hourCell,
1516
+ children: /* @__PURE__ */ jsx(View, {
1517
+ style: [styles$1.hourRow, styles$1.nonInteractive],
1518
+ children: /* @__PURE__ */ jsx(HourLabel, {
1519
+ hour,
1520
+ width,
1521
+ label: formatHour(hour, { ampm }),
1522
+ ampm,
1523
+ hourComponent
1524
+ })
1525
+ })
1526
+ }, hour))
1527
+ })
1528
+ ]
1432
1529
  });
1433
1530
  };
1531
+ const HourGutter = memo(HourGutterInner);
1434
1532
  const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) => {
1435
1533
  const theme = useCalendarTheme();
1436
1534
  const slot = useSlots();
@@ -1451,7 +1549,7 @@ const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) =>
1451
1549
  style: [lineSlot.style, animatedStyle]
1452
1550
  });
1453
1551
  };
1454
- const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", children }) => {
1552
+ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", interactive = false, children }) => {
1455
1553
  const slot = useSlots();
1456
1554
  const animatedStyle = useAnimatedStyle(() => ({
1457
1555
  top: (startHour - minHour) * cellHeight.value,
@@ -1464,7 +1562,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
1464
1562
  const bandSlot = slot(slotName, {
1465
1563
  base: [
1466
1564
  styles$1.shadeBand,
1467
- styles$1.nonInteractive,
1565
+ interactive ? styles$1.passThrough : styles$1.nonInteractive,
1468
1566
  {
1469
1567
  left,
1470
1568
  width
@@ -1474,56 +1572,46 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
1474
1572
  });
1475
1573
  return /* @__PURE__ */ jsx(Animated.View, {
1476
1574
  testID,
1477
- accessibilityElementsHidden: true,
1478
- importantForAccessibility: "no-hide-descendants",
1575
+ accessibilityElementsHidden: !interactive,
1576
+ importantForAccessibility: interactive ? "auto" : "no-hide-descendants",
1479
1577
  ...bandSlot,
1480
1578
  style: [bandSlot.style, animatedStyle],
1481
1579
  children
1482
1580
  });
1483
1581
  };
1484
- function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, highlightWeekends, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderBusinessHours, renderEvent, keyExtractor, snapMinutes, minEventHeight, eventGap, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, onGridTop }) {
1582
+ function BackgroundEventBand({ event, cellHeight, startHour, endHour, minHour, left, width, mode, continuesBefore, continuesAfter, render: Render, onPress, onLongPress }) {
1583
+ const boxHeight = useDerivedValue(() => (endHour - startHour) * cellHeight.value, [
1584
+ startHour,
1585
+ endHour,
1586
+ cellHeight
1587
+ ]);
1588
+ const handlePress = useCallback(() => onPress(event), [onPress, event]);
1589
+ const handleLongPress = useCallback(() => onLongPress?.(event), [onLongPress, event]);
1590
+ return /* @__PURE__ */ jsx(ShadeBand, {
1591
+ cellHeight,
1592
+ startHour,
1593
+ endHour,
1594
+ minHour,
1595
+ left,
1596
+ width,
1597
+ slotName: "backgroundEvent",
1598
+ testID: "background-event-shade",
1599
+ interactive: true,
1600
+ children: /* @__PURE__ */ jsx(Render, {
1601
+ event,
1602
+ mode,
1603
+ boxHeight,
1604
+ continuesBefore,
1605
+ continuesAfter,
1606
+ onPress: handlePress,
1607
+ onLongPress: onLongPress ? handleLongPress : void 0
1608
+ })
1609
+ });
1610
+ }
1611
+ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, committedCellHeight, isActive, weekStartsOn, weekEndsOn, width, minHour, maxHour, timeslots, isRTL, highlightWeekends, calendarCellStyle, showNowIndicator, businessHours, renderBusinessHours, renderBackgroundEvent, renderEvent, keyExtractor, snapMinutes, minEventHeight, eventGap, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, pageIndex, laneHeight, scrollY, showAllDayEventCell, onLaneLayout, height, pagedHeader, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) {
1485
1612
  const theme = useCalendarTheme();
1486
1613
  const slot = useSlots();
1487
- const scrollRef = useAnimatedRef();
1488
- const gridTopRef = useRef(0);
1489
- useEffect(() => {
1490
- if (isActive) onGridTop?.(gridTopRef.current);
1491
- }, [isActive, onGridTop]);
1492
1614
  const heightSource = isActive ? cellHeight : committedCellHeight;
1493
- const isDragging = useSharedValue(false);
1494
- const isActiveShared = useSharedValue(isActive);
1495
- useEffect(() => {
1496
- isActiveShared.value = isActive;
1497
- }, [isActive, isActiveShared]);
1498
- const scrollHandler = useAnimatedScrollHandler({
1499
- onScroll: (event) => {
1500
- if (isActiveShared.value && isDragging.value) scrollY.value = event.contentOffset.y;
1501
- },
1502
- onBeginDrag: () => {
1503
- isDragging.value = true;
1504
- },
1505
- onEndDrag: (event) => {
1506
- isDragging.value = false;
1507
- if (!isWeb$1 && isActiveShared.value) {
1508
- scrollY.value = event.contentOffset.y;
1509
- runOnJS(onSettleOffset)(event.contentOffset.y);
1510
- }
1511
- },
1512
- onMomentumEnd: (event) => {
1513
- isDragging.value = false;
1514
- if (!isWeb$1 && isActiveShared.value) {
1515
- scrollY.value = event.contentOffset.y;
1516
- runOnJS(onSettleOffset)(event.contentOffset.y);
1517
- }
1518
- }
1519
- });
1520
- useAnimatedReaction(() => scrollY.value, (current, previous) => {
1521
- if (!isActiveShared.value && current !== previous) scrollTo(scrollRef, 0, current, false);
1522
- });
1523
- useAnimatedReaction(() => isActiveShared.value, (active, previous) => {
1524
- if (isWeb$1 || !active || active === previous) return;
1525
- scrollTo(scrollRef, 0, scrollY.value, false);
1526
- });
1527
1615
  const days = useMemo(() => getViewDays$1(mode, date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
1528
1616
  mode,
1529
1617
  date,
@@ -1535,8 +1623,8 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1535
1623
  ]);
1536
1624
  const daysPerPage = pageStepDays(mode, date, weekStartsOn, numberOfDays);
1537
1625
  const dayCount = days.length;
1538
- const dayWidth = (width - hourColumnWidth) / dayCount;
1539
- const dayLeft = (dayIndex) => hourColumnWidth + dayIndex * dayWidth;
1626
+ const dayWidth = width / dayCount;
1627
+ const dayLeft = (dayIndex) => dayIndex * dayWidth;
1540
1628
  const dayOrdinals = useMemo(() => days.map((day) => differenceInCalendarDays(day, days[0])), [days]);
1541
1629
  const dayLayouts = useMemo(() => days.map((day) => layoutDayEvents$1(events, day)), [days, events]);
1542
1630
  const [multiDayMove, setMultiDayMove] = useState(null);
@@ -1563,7 +1651,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1563
1651
  const date = onLongPressCell && cellDateFromTouch(event);
1564
1652
  if (date) onLongPressCell?.(date);
1565
1653
  };
1566
- const hoursRange = useMemo(() => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index), [minHour, maxHour]);
1654
+ const hoursRange = useMemo(() => hourRange(minHour, maxHour), [minHour, maxHour]);
1567
1655
  const now = useNow$1(showNowIndicator && isActive, {
1568
1656
  now: nowProp,
1569
1657
  timeZone: nowTimeZone
@@ -1576,23 +1664,24 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1576
1664
  maxHour,
1577
1665
  heightSource
1578
1666
  ]);
1579
- const pinchStartCellHeight = useSharedValue(hourHeight);
1580
- const zoomGesture = useMemo(() => {
1581
- const pinch = Gesture.Pinch().onStart(() => {
1582
- pinchStartCellHeight.value = cellHeight.value;
1583
- }).onUpdate((event) => {
1584
- cellHeight.value = Math.min(maxHourHeight, Math.max(minHourHeight, pinchStartCellHeight.value * event.scale));
1585
- }).onEnd(() => {
1586
- committedCellHeight.value = cellHeight.value;
1587
- });
1588
- return Gesture.Simultaneous(pinch, Gesture.Native());
1589
- }, [
1590
- cellHeight,
1591
- committedCellHeight,
1592
- pinchStartCellHeight,
1593
- minHourHeight,
1594
- maxHourHeight
1667
+ const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
1668
+ const gridStyle = useAnimatedStyle(() => ({
1669
+ top: headerOffset + laneHeight.value + HOUR_LABEL_TOP_INSET,
1670
+ height: (maxHour - minHour) * heightSource.value
1671
+ }), [
1672
+ minHour,
1673
+ maxHour,
1674
+ heightSource,
1675
+ headerOffset
1595
1676
  ]);
1677
+ const laneHeightStyle = useAnimatedStyle(() => ({
1678
+ height: Math.max(LANE_BAND_FLOOR, laneHeight.value),
1679
+ borderBottomWidth: laneHeight.value >= LANE_BAND_FLOOR ? StyleSheet.hairlineWidth : 0
1680
+ }));
1681
+ const pinStyle = useAnimatedStyle(() => ({ transform: [{ translateY: scrollY.value }] }));
1682
+ const reportLaneLayout = useCallback((event) => {
1683
+ onLaneLayout(pageIndex, event.nativeEvent.layout.height);
1684
+ }, [onLaneLayout, pageIndex]);
1596
1685
  const createEnabled = onCreateEvent != null;
1597
1686
  const createActive = useSharedValue(0);
1598
1687
  const createTop = useSharedValue(0);
@@ -1635,7 +1724,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1635
1724
  const idx = dayCount === 1 ? 0 : Math.floor(event.x / dayWidth);
1636
1725
  createDayIndex.value = idx;
1637
1726
  createStartY.value = event.y;
1638
- createLeft.value = hourColumnWidth + idx * dayWidth;
1727
+ createLeft.value = idx * dayWidth;
1639
1728
  createWidth.value = dayWidth;
1640
1729
  createTop.value = event.y;
1641
1730
  createHeight.value = 0;
@@ -1660,7 +1749,6 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1660
1749
  createEnabled,
1661
1750
  dayCount,
1662
1751
  dayWidth,
1663
- hourColumnWidth,
1664
1752
  heightSource,
1665
1753
  snapMinutes,
1666
1754
  commitCreate,
@@ -1722,7 +1810,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1722
1810
  }
1723
1811
  });
1724
1812
  const cellLayer = onPressCell || onLongPressCell || createEnabled ? /* @__PURE__ */ jsx(Pressable, {
1725
- style: [styles$1.cellPressLayer, { left: hourColumnWidth }],
1813
+ style: styles$1.cellPressLayer,
1726
1814
  onPress: onPressCell ? handleBackgroundPress : void 0,
1727
1815
  onLongPress: !createEnabled && onLongPressCell ? handleBackgroundLongPress : void 0,
1728
1816
  tabIndex: -1,
@@ -1730,201 +1818,237 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1730
1818
  accessibilityElementsHidden: true
1731
1819
  }) : null;
1732
1820
  return /* @__PURE__ */ jsxs(View, {
1733
- style: styles$1.container,
1734
- children: [showAllDayEventCell ? /* @__PURE__ */ jsx(AllDayLane, {
1735
- days,
1736
- events,
1737
- mode,
1738
- hourColumnWidth,
1739
- dayWidth,
1740
- renderEvent,
1741
- keyExtractor,
1742
- onPressEvent,
1743
- onLongPressEvent
1744
- }) : null, /* @__PURE__ */ jsx(GestureDetector, {
1745
- gesture: zoomGesture,
1746
- children: /* @__PURE__ */ jsx(Animated.ScrollView, {
1747
- ref: scrollRef,
1748
- showsVerticalScrollIndicator: showVerticalScrollIndicator,
1749
- scrollEnabled: verticalScrollEnabled,
1750
- onScroll: scrollHandler,
1751
- scrollEventThrottle: 16,
1752
- onLayout: (event) => {
1753
- gridTopRef.current = event.nativeEvent.layout.y;
1754
- if (isActive) onGridTop?.(gridTopRef.current);
1755
- },
1756
- contentContainerStyle: { paddingTop: HOUR_LABEL_TOP_INSET },
1757
- contentOffset: {
1758
- x: 0,
1759
- y: initialScrollY
1760
- },
1761
- children: /* @__PURE__ */ jsxs(Animated.View, {
1762
- style: [styles$1.content, fullHeightStyle],
1763
- children: [
1764
- cellLayer && backgroundGesture ? /* @__PURE__ */ jsx(GestureDetector, {
1765
- gesture: backgroundGesture,
1766
- children: cellLayer
1767
- }) : cellLayer,
1768
- days.map((day, dayIndex) => {
1769
- if (!highlightWeekends || !isWeekend$1(day)) return null;
1770
- const shadeSlot = slot("weekendShade", {
1771
- base: [
1772
- styles$1.weekendColumn,
1773
- styles$1.nonInteractive,
1774
- {
1775
- left: dayLeft(dayIndex),
1776
- width: dayWidth
1777
- }
1778
- ],
1779
- themed: { backgroundColor: theme.colors.weekendBackground }
1780
- });
1781
- return /* @__PURE__ */ jsx(Animated.View, {
1782
- testID: "weekend-shade",
1783
- ...shadeSlot,
1784
- style: [shadeSlot.style, fullHeightStyle]
1785
- }, `weekend-${day.toISOString()}`);
1786
- }),
1787
- calendarCellStyle ? days.map((day, dayIndex) => {
1788
- const cellStyle = calendarCellStyle(day);
1789
- return cellStyle ? /* @__PURE__ */ jsx(Animated.View, { style: [
1821
+ testID: "time-grid-page",
1822
+ style: [styles$1.page, {
1823
+ width,
1824
+ height
1825
+ }],
1826
+ accessibilityElementsHidden: !isActive,
1827
+ importantForAccessibility: isActive ? "auto" : "no-hide-descendants",
1828
+ children: [
1829
+ pagedHeader ? /* @__PURE__ */ jsx(Animated.View, {
1830
+ testID: "paged-header",
1831
+ style: [
1832
+ styles$1.pagedHeader,
1833
+ {
1834
+ backgroundColor: theme.colors.surface,
1835
+ borderBottomColor: theme.colors.gridLine
1836
+ },
1837
+ pinStyle
1838
+ ],
1839
+ children: /* @__PURE__ */ jsx(DayHeaderRow, {
1840
+ days,
1841
+ mode,
1842
+ dayWidth,
1843
+ weekdayFormat,
1844
+ todayLabel,
1845
+ locale,
1846
+ activeDate,
1847
+ onPressDateHeader
1848
+ })
1849
+ }) : null,
1850
+ showAllDayEventCell ? /* @__PURE__ */ jsx(Animated.View, {
1851
+ testID: "all-day-band",
1852
+ style: [
1853
+ styles$1.laneBand,
1854
+ {
1855
+ top: headerOffset,
1856
+ backgroundColor: theme.colors.surface,
1857
+ borderBottomColor: theme.colors.gridLine
1858
+ },
1859
+ laneHeightStyle,
1860
+ pinStyle
1861
+ ],
1862
+ children: /* @__PURE__ */ jsx(AllDayLane, {
1863
+ days,
1864
+ events,
1865
+ mode,
1866
+ dayWidth,
1867
+ renderEvent,
1868
+ keyExtractor,
1869
+ onPressEvent,
1870
+ onLongPressEvent,
1871
+ onLayout: reportLaneLayout
1872
+ })
1873
+ }) : null,
1874
+ /* @__PURE__ */ jsxs(Animated.View, {
1875
+ style: [styles$1.grid, gridStyle],
1876
+ children: [
1877
+ cellLayer && backgroundGesture ? /* @__PURE__ */ jsx(GestureDetector, {
1878
+ gesture: backgroundGesture,
1879
+ children: cellLayer
1880
+ }) : cellLayer,
1881
+ days.map((day, dayIndex) => {
1882
+ if (!highlightWeekends || !isWeekend$1(day)) return null;
1883
+ const shadeSlot = slot("weekendShade", {
1884
+ base: [
1790
1885
  styles$1.weekendColumn,
1791
1886
  styles$1.nonInteractive,
1792
1887
  {
1793
1888
  left: dayLeft(dayIndex),
1794
1889
  width: dayWidth
1795
- },
1796
- cellStyle,
1797
- fullHeightStyle
1798
- ] }, `cell-${day.toISOString()}`) : null;
1799
- }) : null,
1800
- businessHours ? days.flatMap((day, dayIndex) => closedHourBands(day, businessHours, minHour, maxHour).map((band, bandIndex) => /* @__PURE__ */ jsx(ShadeBand, {
1801
- cellHeight: heightSource,
1802
- startHour: band.start,
1803
- endHour: band.end,
1804
- minHour,
1805
- left: dayLeft(dayIndex),
1806
- width: dayWidth,
1807
- color: renderBusinessHours ? void 0 : theme.colors.outsideHoursBackground,
1808
- children: renderBusinessHours?.({
1809
- date: day,
1810
- start: band.start,
1811
- end: band.end
1812
- })
1813
- }, `closed-${day.toISOString()}-${bandIndex}`))) : null,
1814
- days.flatMap((day, dayIndex) => backgroundBandsForDay$1(events, day).map((b) => ({
1890
+ }
1891
+ ],
1892
+ themed: { backgroundColor: theme.colors.weekendBackground }
1893
+ });
1894
+ return /* @__PURE__ */ jsx(Animated.View, {
1895
+ testID: "weekend-shade",
1896
+ ...shadeSlot,
1897
+ style: [shadeSlot.style, fullHeightStyle]
1898
+ }, `weekend-${day.toISOString()}`);
1899
+ }),
1900
+ calendarCellStyle ? days.map((day, dayIndex) => {
1901
+ const cellStyle = calendarCellStyle(day);
1902
+ return cellStyle ? /* @__PURE__ */ jsx(Animated.View, { style: [
1903
+ styles$1.weekendColumn,
1904
+ styles$1.nonInteractive,
1905
+ {
1906
+ left: dayLeft(dayIndex),
1907
+ width: dayWidth
1908
+ },
1909
+ cellStyle,
1910
+ fullHeightStyle
1911
+ ] }, `cell-${day.toISOString()}`) : null;
1912
+ }) : null,
1913
+ businessHours ? days.flatMap((day, dayIndex) => closedHourBands(day, businessHours, minHour, maxHour).map((band, bandIndex) => /* @__PURE__ */ jsx(ShadeBand, {
1914
+ cellHeight: heightSource,
1915
+ startHour: band.start,
1916
+ endHour: band.end,
1917
+ minHour,
1918
+ left: dayLeft(dayIndex),
1919
+ width: dayWidth,
1920
+ color: renderBusinessHours ? void 0 : theme.colors.outsideHoursBackground,
1921
+ children: renderBusinessHours?.({
1922
+ date: day,
1923
+ start: band.start,
1924
+ end: band.end
1925
+ })
1926
+ }, `closed-${day.toISOString()}-${bandIndex}`))) : null,
1927
+ days.flatMap((day, dayIndex) => {
1928
+ const dayStart = startOfDay(day);
1929
+ const nextDayStart = addDays(dayStart, 1);
1930
+ return backgroundBandsForDay$1(events, day).map((b) => ({
1815
1931
  ...b,
1816
1932
  startHours: Math.max(b.startHours, minHour),
1817
1933
  endHours: Math.min(b.endHours, maxHour)
1818
- })).filter((b) => b.endHours > b.startHours).map((b, bandIndex) => /* @__PURE__ */ jsx(ShadeBand, {
1819
- cellHeight: heightSource,
1820
- startHour: b.startHours,
1821
- endHour: b.endHours,
1822
- minHour,
1823
- left: dayLeft(dayIndex),
1824
- width: dayWidth,
1825
- color: theme.colors.backgroundEvent,
1826
- slotName: "backgroundEvent",
1827
- testID: "background-event-shade"
1828
- }, `bg-${day.toISOString()}-${bandIndex}`))),
1829
- days.map((day, dayIndex) => {
1830
- const separatorSlot = slot("daySeparator", {
1831
- base: [
1832
- styles$1.daySeparator,
1833
- styles$1.nonInteractive,
1834
- { left: dayLeft(dayIndex) }
1835
- ],
1836
- themed: { backgroundColor: theme.colors.gridLine }
1837
- });
1838
- return /* @__PURE__ */ jsx(Animated.View, {
1839
- ...separatorSlot,
1840
- style: [separatorSlot.style, fullHeightStyle]
1841
- }, `separator-${day.toISOString()}`);
1842
- }),
1843
- hoursRange.map((hour) => /* @__PURE__ */ jsx(HourRow, {
1844
- hour,
1845
- minHour,
1846
- cellHeight: heightSource,
1847
- hourColumnWidth,
1848
- label: formatHour(hour, { ampm }),
1849
- ampm,
1850
- hourComponent
1851
- }, hour)),
1852
- timeslots > 1 ? hoursRange.flatMap((hour) => Array.from({ length: timeslots - 1 }, (_, i) => /* @__PURE__ */ jsx(TimeslotLine, {
1853
- hour,
1854
- minHour,
1855
- fraction: (i + 1) / timeslots,
1856
- cellHeight: heightSource,
1857
- hourColumnWidth
1858
- }, `slot-${hour}-${i}`))) : null,
1859
- dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
1860
- const columnWidth = dayWidth / positioned.columns;
1861
- return /* @__PURE__ */ jsx(AnimatedEventBox, {
1862
- positioned,
1863
- eventIndex: events.indexOf(positioned.event),
1864
- movingEvent,
1865
- onMovePreview: setMultiDayMove,
1934
+ })).filter((b) => b.endHours > b.startHours).map((b, bandIndex) => {
1935
+ const key = `bg-${day.toISOString()}-${keyExtractor(b.event, bandIndex)}`;
1936
+ return renderBackgroundEvent ? /* @__PURE__ */ jsx(BackgroundEventBand, {
1937
+ event: b.event,
1866
1938
  cellHeight: heightSource,
1939
+ startHour: b.startHours,
1940
+ endHour: b.endHours,
1867
1941
  minHour,
1868
- maxHour,
1869
- left: dayLeft(dayIndex) + positioned.column * columnWidth,
1870
- width: columnWidth,
1871
- dayLeftPx: dayLeft(dayIndex),
1872
- nextDayDirection: isRTL ? -1 : 1,
1873
- dayWidth,
1874
- dayIndex,
1875
- dayCount: days.length,
1876
- dayOrdinals,
1942
+ left: dayLeft(dayIndex),
1943
+ width: dayWidth,
1877
1944
  mode,
1878
- daysPerPage,
1879
- renderEvent,
1880
- snapMinutes,
1881
- minEventHeight,
1882
- eventGap,
1883
- showDragHandle,
1884
- eventStartEditable,
1885
- eventDurationEditable,
1945
+ continuesBefore: b.event.start < dayStart,
1946
+ continuesAfter: b.event.end > nextDayStart,
1947
+ render: renderBackgroundEvent,
1886
1948
  onPress: onPressEvent,
1887
- onLongPress: onLongPressEvent,
1888
- onDragEvent,
1889
- onDragStart,
1890
- onEdgeAdvance
1891
- }, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
1892
- })),
1893
- multiDayMove ? /* @__PURE__ */ jsx(MultiDayMovePreview, {
1894
- move: multiDayMove,
1895
- days,
1949
+ onLongPress: onLongPressEvent
1950
+ }, key) : /* @__PURE__ */ jsx(ShadeBand, {
1951
+ cellHeight: heightSource,
1952
+ startHour: b.startHours,
1953
+ endHour: b.endHours,
1954
+ minHour,
1955
+ left: dayLeft(dayIndex),
1956
+ width: dayWidth,
1957
+ color: theme.colors.backgroundEvent,
1958
+ slotName: "backgroundEvent",
1959
+ testID: "background-event-shade"
1960
+ }, key);
1961
+ });
1962
+ }),
1963
+ days.map((day, dayIndex) => {
1964
+ const separatorSlot = slot("daySeparator", {
1965
+ base: [
1966
+ styles$1.daySeparator,
1967
+ styles$1.nonInteractive,
1968
+ { left: dayLeft(dayIndex) }
1969
+ ],
1970
+ themed: { backgroundColor: theme.colors.gridLine }
1971
+ });
1972
+ return /* @__PURE__ */ jsx(Animated.View, {
1973
+ ...separatorSlot,
1974
+ style: [separatorSlot.style, fullHeightStyle]
1975
+ }, `separator-${day.toISOString()}`);
1976
+ }),
1977
+ /* @__PURE__ */ jsx(HourLines, {
1978
+ hours: hoursRange,
1979
+ timeslots
1980
+ }),
1981
+ dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
1982
+ const columnWidth = dayWidth / positioned.columns;
1983
+ return /* @__PURE__ */ jsx(AnimatedEventBox, {
1984
+ positioned,
1985
+ eventIndex: events.indexOf(positioned.event),
1986
+ movingEvent,
1987
+ onMovePreview: setMultiDayMove,
1896
1988
  cellHeight: heightSource,
1897
- dayWidth,
1898
- hourColumnWidth,
1899
1989
  minHour,
1990
+ maxHour,
1991
+ left: dayLeft(dayIndex) + positioned.column * columnWidth,
1992
+ width: columnWidth,
1993
+ dayLeftPx: dayLeft(dayIndex),
1994
+ nextDayDirection: isRTL ? -1 : 1,
1995
+ dayWidth,
1996
+ dayIndex,
1997
+ dayCount: days.length,
1998
+ dayOrdinals,
1900
1999
  mode,
2000
+ daysPerPage,
1901
2001
  renderEvent,
2002
+ snapMinutes,
1902
2003
  minEventHeight,
1903
- eventGap
1904
- }) : null,
1905
- showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ jsx(NowIndicator, {
1906
- cellHeight: heightSource,
1907
- nowHours,
1908
- minHour,
1909
- left: dayLeft(nowDayIndex),
1910
- width: dayWidth,
1911
- color: theme.colors.nowIndicator
1912
- }) : null,
1913
- createEnabled ? /* @__PURE__ */ jsx(Animated.View, {
1914
- ...ghostSlot,
1915
- style: [ghostSlot.style, createGhostStyle]
1916
- }) : null
1917
- ]
1918
- })
2004
+ eventGap,
2005
+ showDragHandle,
2006
+ eventStartEditable,
2007
+ eventDurationEditable,
2008
+ onPress: onPressEvent,
2009
+ onLongPress: onLongPressEvent,
2010
+ onDragEvent,
2011
+ onDragStart,
2012
+ onEdgeAdvance
2013
+ }, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
2014
+ })),
2015
+ multiDayMove ? /* @__PURE__ */ jsx(MultiDayMovePreview, {
2016
+ move: multiDayMove,
2017
+ days,
2018
+ cellHeight: heightSource,
2019
+ dayWidth,
2020
+ minHour,
2021
+ mode,
2022
+ renderEvent,
2023
+ minEventHeight,
2024
+ eventGap
2025
+ }) : null,
2026
+ showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ jsx(NowIndicator, {
2027
+ cellHeight: heightSource,
2028
+ nowHours,
2029
+ minHour,
2030
+ left: dayLeft(nowDayIndex),
2031
+ width: dayWidth,
2032
+ color: theme.colors.nowIndicator
2033
+ }) : null,
2034
+ createEnabled ? /* @__PURE__ */ jsx(Animated.View, {
2035
+ ...ghostSlot,
2036
+ style: [ghostSlot.style, createGhostStyle]
2037
+ }) : null
2038
+ ]
1919
2039
  })
1920
- })]
2040
+ ]
1921
2041
  });
1922
2042
  }
1923
2043
  const TimetablePage = memo(TimetablePageInner);
1924
- function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, 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 }) {
1925
- const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
2044
+ 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 }) {
2045
+ const clampedMinHour = Math.max(0, Math.min(minHour, 23));
1926
2046
  const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
1927
2047
  const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
2048
+ const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
2049
+ const todayLabel = labels.today;
2050
+ const pagedHeader = renderHeader == null;
2051
+ const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
1928
2052
  const labeledRenderEvent = useMemo(() => withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, ampm), [
1929
2053
  renderEvent,
1930
2054
  eventAccessibilityLabel,
@@ -1938,34 +2062,76 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
1938
2062
  eventOverlap,
1939
2063
  events
1940
2064
  ]);
1941
- const { width, height } = useWindowDimensions();
2065
+ const { width } = useWindowDimensions();
1942
2066
  const listRef = useRef(null);
1943
2067
  const pagerRef = useRef(null);
1944
2068
  const containerRef = useRef(null);
1945
- const suppressCaptureUntilRef = useRef(0);
1946
- const [pageHeight, setPageHeight] = useState(height);
2069
+ const viewportRef = useRef(null);
2070
+ const pagerLayoutWidthRef = useRef(-1);
2071
+ const scrollRef = useAnimatedRef();
1947
2072
  const [containerWidth, setContainerWidth] = useState(width);
1948
- const [measured, setMeasured] = useState(false);
2073
+ const [pagerLayoutWidth, setPagerLayoutWidth] = useState(null);
2074
+ const columnsWidth = pagerLayoutWidth ?? containerWidth - hourColumnWidth;
2075
+ const pagerReady = pagerLayoutWidth != null && pagerLayoutWidth > 0;
2076
+ const [tallestLane, setTallestLane] = useState(0);
1949
2077
  const weekAnchored = mode === "week" || mode === "custom" && weekEndsOn != null;
1950
2078
  const step = weekAnchored ? 7 : viewDayCount(mode, numberOfDays);
1951
2079
  const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR$1 - clampedMinHour) * hourHeight;
1952
2080
  const scrollY = useSharedValue(seedDefaultY);
2081
+ const scrollHandler = useAnimatedScrollHandler({ onScroll: (event) => {
2082
+ scrollY.value = event.contentOffset.y;
2083
+ } });
2084
+ const webSeededRef = useRef(!isWeb$1);
2085
+ const seedWebScroll = useCallback(() => {
2086
+ if (webSeededRef.current) return;
2087
+ const node = scrollRef.current;
2088
+ if (!node) return;
2089
+ node.scrollTo({
2090
+ y: seedDefaultY,
2091
+ animated: false
2092
+ });
2093
+ const dom = node.getScrollableNode();
2094
+ if (dom && dom.scrollHeight > dom.clientHeight) webSeededRef.current = true;
2095
+ }, [scrollRef, seedDefaultY]);
2096
+ const laneHeights = useSharedValue({});
2097
+ const laneHeightsRef = useRef({});
2098
+ const pagerOffset = useSharedValue(PAGE_WINDOW * columnsWidth);
2099
+ const pagerSharedValues = useMemo(() => ({ scrollOffset: pagerOffset }), [pagerOffset]);
2100
+ const activeIndexShared = useSharedValue(PAGE_WINDOW);
2101
+ const laneHeight = useDerivedValue(() => {
2102
+ if (!showAllDayEventCell || columnsWidth <= 0) return 0;
2103
+ const heights = laneHeights.value;
2104
+ let progress = pagerOffset.value / columnsWidth;
2105
+ if (Math.abs(progress - activeIndexShared.value) > 1.5) progress = activeIndexShared.value;
2106
+ const from = Math.floor(progress);
2107
+ const fraction = progress - from;
2108
+ const start = heights[from] ?? 0;
2109
+ return start + ((heights[from + 1] ?? start) - start) * fraction;
2110
+ }, [showAllDayEventCell, columnsWidth]);
2111
+ const reportLaneHeight = useCallback((index, height) => {
2112
+ setTallestLane((tallest) => height > tallest ? height : tallest);
2113
+ if (laneHeightsRef.current[index] === height) return;
2114
+ laneHeightsRef.current = {
2115
+ ...laneHeightsRef.current,
2116
+ [index]: height
2117
+ };
2118
+ laneHeights.value = laneHeightsRef.current;
2119
+ }, [laneHeights]);
2120
+ const viewportTop = useSharedValue(0);
1953
2121
  const pagerLeft = useSharedValue(0);
1954
- const pagerTop = useSharedValue(0);
1955
2122
  const pagerWidth = useSharedValue(width);
1956
- const [edgePagingLock, setEdgePagingLock] = useState(false);
2123
+ const pagerTop = useDerivedValue(() => viewportTop.value - scrollY.value);
1957
2124
  const ghostX = useSharedValue(0);
1958
2125
  const ghostY = useSharedValue(0);
1959
2126
  const ghostW = useSharedValue(0);
1960
2127
  const ghostH = useSharedValue(0);
1961
2128
  const ghostVisible = useSharedValue(0);
1962
- const gridTop = useSharedValue(0);
1963
2129
  const [liftedEvent, setLiftedEvent] = useState(null);
1964
2130
  const liftedEventRef = useRef(null);
1965
2131
  const dropRef = useRef({
1966
2132
  headerDays: [],
1967
- containerWidth,
1968
- hourColumnWidth,
2133
+ columnsWidth,
2134
+ headerOffset,
1969
2135
  minHour: clampedMinHour,
1970
2136
  maxHour: clampedMaxHour,
1971
2137
  snapMinutes: Math.max(1, dragStepMinutes),
@@ -1980,17 +2146,16 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
1980
2146
  ghostVisible.value = 0;
1981
2147
  liftedEventRef.current = null;
1982
2148
  setLiftedEvent(null);
1983
- setEdgePagingLock(false);
1984
2149
  }, [ghostVisible]);
1985
2150
  const commitLiftedDrop = useCallback((ghostLocalX, ghostLocalY) => {
1986
- const { headerDays: days, containerWidth: cw, hourColumnWidth: hcw, minHour: min, maxHour: max, snapMinutes: snap, onDragEvent: onDrag, onChangeDate: onDate } = dropRef.current;
2151
+ const { headerDays: days, columnsWidth: cw, headerOffset: headerH, minHour: min, maxHour: max, snapMinutes: snap, onDragEvent: onDrag, onChangeDate: onDate } = dropRef.current;
1987
2152
  const ev = liftedEventRef.current;
1988
2153
  const duration = ev ? ev.end.getTime() - ev.start.getTime() : 0;
1989
2154
  clearLift();
1990
2155
  if (!ev || !onDrag || days.length === 0) return;
1991
- const dayWidth = (cw - hcw) / days.length;
1992
- const col = Math.min(Math.max(Math.floor((ghostLocalX - hcw) / dayWidth), 0), days.length - 1);
1993
- const rawMinutes = (min + (ghostLocalY - gridTop.value - HOUR_LABEL_TOP_INSET + scrollY.value) / cellHeight.value) * MINUTES_PER_HOUR$1;
2156
+ const dayWidth = cw / days.length;
2157
+ const col = Math.min(Math.max(Math.floor(ghostLocalX / dayWidth), 0), days.length - 1);
2158
+ const rawMinutes = (min + (ghostLocalY - headerH - laneHeight.value - HOUR_LABEL_TOP_INSET) / cellHeight.value) * MINUTES_PER_HOUR$1;
1994
2159
  const minutes = clampMoveStartMinutes(Math.round(rawMinutes / snap) * snap, min, max, snap);
1995
2160
  const start = new Date(days[col]);
1996
2161
  start.setHours(0, 0, 0, 0);
@@ -1998,18 +2163,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
1998
2163
  if (onDrag(ev, start, new Date(start.getTime() + duration)) === false) onDate(ev.start);
1999
2164
  }, [
2000
2165
  clearLift,
2001
- gridTop,
2002
- scrollY,
2003
- cellHeight
2166
+ cellHeight,
2167
+ laneHeight
2004
2168
  ]);
2005
- const handleGridTop = useCallback((y) => {
2006
- gridTop.value = y;
2007
- }, [gridTop]);
2008
2169
  const edgePaging = useMemo(() => ({
2009
2170
  pagerLeft,
2010
2171
  pagerTop,
2011
2172
  pagerWidth,
2012
- lockScroll: setEdgePagingLock,
2013
2173
  ghostX,
2014
2174
  ghostY,
2015
2175
  ghostW,
@@ -2029,11 +2189,37 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2029
2189
  beginLift,
2030
2190
  commitLiftedDrop
2031
2191
  ]);
2032
- const offsetSeedRef = useRef(null);
2033
- const captureOffsetSeed = useCallback((y) => {
2034
- offsetSeedRef.current = y;
2035
- }, []);
2036
2192
  const committedCellHeight = useSharedValue(hourHeight);
2193
+ const pinching = useSharedValue(false);
2194
+ useAnimatedReaction(() => cellHeight.value, (value) => {
2195
+ if (!pinching.value) committedCellHeight.value = value;
2196
+ });
2197
+ const pinchStartCellHeight = useSharedValue(hourHeight);
2198
+ const zoomGesture = useMemo(() => {
2199
+ const pinch = Gesture.Pinch().onStart(() => {
2200
+ pinching.value = true;
2201
+ pinchStartCellHeight.value = cellHeight.value;
2202
+ }).onUpdate((event) => {
2203
+ cellHeight.value = Math.min(maxHourHeight, Math.max(minHourHeight, pinchStartCellHeight.value * event.scale));
2204
+ }).onFinalize(() => {
2205
+ pinching.value = false;
2206
+ committedCellHeight.value = cellHeight.value;
2207
+ });
2208
+ return Gesture.Simultaneous(pinch, Gesture.Native());
2209
+ }, [
2210
+ cellHeight,
2211
+ committedCellHeight,
2212
+ pinching,
2213
+ pinchStartCellHeight,
2214
+ minHourHeight,
2215
+ maxHourHeight
2216
+ ]);
2217
+ const pagerHeight = headerOffset + HOUR_LABEL_TOP_INSET + (clampedMaxHour - clampedMinHour) * maxHourHeight + tallestLane;
2218
+ const gridHeightStyle = useAnimatedStyle(() => ({ height: headerOffset + laneHeight.value + HOUR_LABEL_TOP_INSET + (clampedMaxHour - clampedMinHour) * cellHeight.value }), [
2219
+ clampedMinHour,
2220
+ clampedMaxHour,
2221
+ headerOffset
2222
+ ]);
2037
2223
  useWebGridZoom(isWeb$1, containerRef, cellHeight, committedCellHeight, minHourHeight, maxHourHeight);
2038
2224
  const [anchorDate] = useState(date);
2039
2225
  const anchor = useMemo(() => weekAnchored ? startOfWeek(anchorDate, { weekStartsOn }) : startOfDay(anchorDate), [
@@ -2051,8 +2237,31 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2051
2237
  step,
2052
2238
  weekStartsOn
2053
2239
  ])(date);
2240
+ useEffect(() => {
2241
+ activeIndexShared.value = activeIndex;
2242
+ }, [activeIndex, activeIndexShared]);
2054
2243
  const viewedIndexRef = useRef(activeIndex);
2055
2244
  const pendingScrollIndexRef = useRef(null);
2245
+ const weekNumber = useMemo(() => {
2246
+ if (!pagedHeader || !showWeekNumber || hourColumnWidth === 0) return null;
2247
+ const days = getViewDays$1(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays);
2248
+ const thursday = days.find((d) => d.getDay() === 4) ?? days[0];
2249
+ return thursday ? `${weekNumberPrefix}${getISOWeek(thursday)}` : null;
2250
+ }, [
2251
+ pagedHeader,
2252
+ showWeekNumber,
2253
+ hourColumnWidth,
2254
+ mode,
2255
+ pageDates,
2256
+ activeIndex,
2257
+ date,
2258
+ weekStartsOn,
2259
+ numberOfDays,
2260
+ isRTL,
2261
+ weekEndsOn,
2262
+ hiddenDays,
2263
+ weekNumberPrefix
2264
+ ]);
2056
2265
  const headerDays = useMemo(() => getViewDays$1(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
2057
2266
  mode,
2058
2267
  pageDates,
@@ -2066,8 +2275,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2066
2275
  ]);
2067
2276
  dropRef.current = {
2068
2277
  headerDays,
2069
- containerWidth,
2070
- hourColumnWidth,
2278
+ columnsWidth,
2279
+ headerOffset,
2071
2280
  minHour: clampedMinHour,
2072
2281
  maxHour: clampedMaxHour,
2073
2282
  snapMinutes: Math.max(1, dragStepMinutes),
@@ -2093,55 +2302,26 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2093
2302
  if (activeIndex === viewedIndexRef.current) return;
2094
2303
  viewedIndexRef.current = activeIndex;
2095
2304
  pendingScrollIndexRef.current = activeIndex;
2305
+ pagerOffset.value = activeIndex * columnsWidth;
2096
2306
  listRef.current?.scrollToIndex({
2097
2307
  index: activeIndex,
2098
2308
  animated: false
2099
2309
  });
2100
2310
  }, [activeIndex]);
2101
2311
  useEffect(() => {
2102
- if (!isWeb$1) return;
2103
- const root = containerRef.current;
2104
- if (!root) return;
2105
- const restoreVisiblePage = () => {
2106
- const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
2107
- for (const el of root.querySelectorAll("*")) {
2108
- const style = getComputedStyle(el);
2109
- if (!((style.overflowY === "scroll" || style.overflowY === "auto") && el.scrollHeight > el.clientHeight + 20 && el.clientHeight > 100)) continue;
2110
- const rect = el.getBoundingClientRect();
2111
- if (rect.left > -50 && rect.right <= vw + 50) {
2112
- el.scrollTop = scrollY.value;
2113
- break;
2114
- }
2115
- }
2116
- };
2117
- suppressCaptureUntilRef.current = Date.now() + 400;
2118
- let raf2 = 0;
2119
- const raf1 = requestAnimationFrame(() => {
2120
- restoreVisiblePage();
2121
- raf2 = requestAnimationFrame(restoreVisiblePage);
2122
- });
2123
- return () => {
2124
- cancelAnimationFrame(raf1);
2125
- cancelAnimationFrame(raf2);
2126
- };
2127
- }, [activeIndex, pageHeight]);
2312
+ pagerOffset.value = activeIndex * columnsWidth;
2313
+ }, [columnsWidth, pagerOffset]);
2128
2314
  useEffect(() => {
2129
2315
  if (!isWeb$1) return;
2130
- const root = containerRef.current;
2131
- if (!root) return;
2132
- const onScrollCapture = (event) => {
2133
- if (Date.now() < suppressCaptureUntilRef.current) return;
2134
- const el = event.target;
2135
- if (!el || typeof el.scrollTop !== "number" || el.clientHeight <= 100) return;
2136
- const rect = el.getBoundingClientRect();
2137
- const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
2138
- if (rect.left <= -50 || rect.right > vw + 50) return;
2139
- scrollY.value = el.scrollTop;
2140
- offsetSeedRef.current = el.scrollTop;
2316
+ let attempts = 0;
2317
+ let frame = 0;
2318
+ const attempt = () => {
2319
+ seedWebScroll();
2320
+ if (!webSeededRef.current && attempts++ < 120) frame = requestAnimationFrame(attempt);
2141
2321
  };
2142
- root.addEventListener("scroll", onScrollCapture, true);
2143
- return () => root.removeEventListener("scroll", onScrollCapture, true);
2144
- }, []);
2322
+ frame = requestAnimationFrame(attempt);
2323
+ return () => cancelAnimationFrame(frame);
2324
+ }, [seedWebScroll]);
2145
2325
  useEffect(() => {
2146
2326
  if (!isWeb$1) return;
2147
2327
  const root = containerRef.current;
@@ -2158,17 +2338,51 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2158
2338
  };
2159
2339
  const raf = requestAnimationFrame(lockHorizontal);
2160
2340
  return () => cancelAnimationFrame(raf);
2161
- }, [pageHeight]);
2341
+ }, [columnsWidth]);
2342
+ const reduceMotion = useReducedMotion();
2162
2343
  const goToPage = useCallback((delta) => {
2163
- const target = pageDates[activeIndex + delta];
2164
- if (target) onChangeDate(target);
2344
+ const index = viewedIndexRef.current + delta;
2345
+ const target = pageDates[index];
2346
+ if (!target) return;
2347
+ viewedIndexRef.current = index;
2348
+ pendingScrollIndexRef.current = index;
2349
+ pagerOffset.value = index * columnsWidth;
2350
+ listRef.current?.scrollToIndex({
2351
+ index,
2352
+ animated: !isWeb$1 && !reduceMotion
2353
+ });
2354
+ onChangeDate(target);
2165
2355
  }, [
2166
2356
  pageDates,
2167
- activeIndex,
2168
- onChangeDate
2357
+ reduceMotion,
2358
+ onChangeDate,
2359
+ columnsWidth,
2360
+ pagerOffset
2169
2361
  ]);
2170
2362
  useWebPagerKeys(swipeEnabled, goToPage);
2171
- const reduceMotion = useReducedMotion();
2363
+ const handlePagerSettled = useCallback((event) => {
2364
+ if (columnsWidth <= 0) return;
2365
+ if (pendingScrollIndexRef.current != null) return;
2366
+ const raw = Math.round(event.nativeEvent.contentOffset.x / columnsWidth);
2367
+ const index = Math.min(Math.max(raw, 0), pageDates.length - 1);
2368
+ if (index !== viewedIndexRef.current) {
2369
+ viewedIndexRef.current = index;
2370
+ const target = pageDates[index];
2371
+ if (target) onChangeDate(target);
2372
+ }
2373
+ pagerOffset.value = index * columnsWidth;
2374
+ requestAnimationFrame(() => {
2375
+ listRef.current?.scrollToIndex({
2376
+ index,
2377
+ animated: false
2378
+ });
2379
+ });
2380
+ }, [
2381
+ columnsWidth,
2382
+ pageDates,
2383
+ onChangeDate,
2384
+ pagerOffset
2385
+ ]);
2172
2386
  const handlePressCell = useMemo(() => {
2173
2387
  if (!onPressCell) return void 0;
2174
2388
  if (!resetPageOnPressCell) return onPressCell;
@@ -2187,96 +2401,89 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2187
2401
  ]);
2188
2402
  const snapToIndices = useMemo(() => pageDates.map((_, index) => index), [pageDates]);
2189
2403
  const keyExtractorList = useCallback((item) => item.toISOString(), []);
2190
- const getFixedItemSize = useCallback(() => containerWidth, [containerWidth]);
2191
- const renderItem = useCallback(({ item, index }) => /* @__PURE__ */ jsx(View, {
2192
- style: {
2193
- width: containerWidth,
2194
- height: pageHeight
2195
- },
2196
- children: /* @__PURE__ */ jsx(TimetablePage, {
2197
- mode,
2198
- numberOfDays,
2199
- hiddenDays,
2200
- now,
2201
- nowTimeZone: timeZone,
2202
- date: item,
2203
- width: containerWidth,
2204
- events,
2205
- cellHeight,
2206
- hourHeight,
2207
- committedCellHeight,
2208
- scrollY,
2209
- isActive: index === activeIndex,
2210
- initialScrollY: offsetSeedRef.current ?? seedDefaultY,
2211
- onSettleOffset: captureOffsetSeed,
2212
- weekStartsOn,
2213
- weekEndsOn,
2214
- hourColumnWidth,
2215
- minHour: clampedMinHour,
2216
- maxHour: clampedMaxHour,
2217
- ampm,
2218
- timeslots,
2219
- isRTL,
2220
- showAllDayEventCell,
2221
- highlightWeekends,
2222
- showVerticalScrollIndicator,
2223
- verticalScrollEnabled,
2224
- hourComponent,
2225
- calendarCellStyle,
2226
- businessHours,
2227
- renderBusinessHours,
2228
- minHourHeight,
2229
- maxHourHeight,
2230
- showNowIndicator,
2231
- renderEvent: labeledRenderEvent,
2232
- keyExtractor,
2233
- snapMinutes: Math.max(1, dragStepMinutes),
2234
- minEventHeight,
2235
- eventGap,
2236
- showDragHandle,
2237
- eventStartEditable,
2238
- eventDurationEditable,
2239
- onPressEvent,
2240
- onLongPressEvent,
2241
- onDragEvent,
2242
- onDragStart,
2243
- onPressCell: handlePressCell,
2244
- onLongPressCell,
2245
- onCreateEvent,
2246
- onEdgeAdvance: goToPage,
2247
- onGridTop: handleGridTop
2248
- })
2249
- }), [
2250
- containerWidth,
2251
- pageHeight,
2252
- handleGridTop,
2404
+ const getFixedItemSize = useCallback(() => columnsWidth, [columnsWidth]);
2405
+ const renderItem = useCallback(({ item, index }) => /* @__PURE__ */ jsx(TimetablePage, {
2253
2406
  mode,
2254
2407
  numberOfDays,
2408
+ hiddenDays,
2409
+ now,
2410
+ nowTimeZone: timeZone,
2411
+ date: item,
2412
+ width: columnsWidth,
2255
2413
  events,
2256
2414
  cellHeight,
2257
- hourHeight,
2258
2415
  committedCellHeight,
2416
+ isActive: index === activeIndex,
2417
+ weekStartsOn,
2418
+ weekEndsOn,
2419
+ minHour: clampedMinHour,
2420
+ maxHour: clampedMaxHour,
2421
+ timeslots,
2422
+ isRTL,
2423
+ highlightWeekends,
2424
+ calendarCellStyle,
2425
+ businessHours,
2426
+ renderBusinessHours,
2427
+ renderBackgroundEvent,
2428
+ showNowIndicator,
2429
+ renderEvent: labeledRenderEvent,
2430
+ keyExtractor,
2431
+ snapMinutes: Math.max(1, dragStepMinutes),
2432
+ minEventHeight,
2433
+ eventGap,
2434
+ showDragHandle,
2435
+ eventStartEditable,
2436
+ eventDurationEditable,
2437
+ onPressEvent,
2438
+ onLongPressEvent,
2439
+ onDragEvent,
2440
+ onDragStart,
2441
+ onPressCell: handlePressCell,
2442
+ onLongPressCell,
2443
+ onCreateEvent,
2444
+ onEdgeAdvance: goToPage,
2445
+ pageIndex: index,
2446
+ laneHeight,
2447
+ scrollY,
2448
+ showAllDayEventCell,
2449
+ onLaneLayout: reportLaneHeight,
2450
+ height: pagerHeight,
2451
+ pagedHeader,
2452
+ weekdayFormat,
2453
+ todayLabel,
2454
+ locale,
2455
+ activeDate,
2456
+ onPressDateHeader
2457
+ }), [
2458
+ columnsWidth,
2459
+ pagerHeight,
2460
+ pagedHeader,
2461
+ weekdayFormat,
2462
+ todayLabel,
2463
+ locale,
2464
+ activeDate,
2465
+ onPressDateHeader,
2466
+ laneHeight,
2259
2467
  scrollY,
2468
+ showAllDayEventCell,
2469
+ reportLaneHeight,
2470
+ mode,
2471
+ numberOfDays,
2472
+ events,
2473
+ cellHeight,
2474
+ committedCellHeight,
2260
2475
  activeIndex,
2261
- seedDefaultY,
2262
- captureOffsetSeed,
2263
2476
  weekStartsOn,
2264
2477
  weekEndsOn,
2265
- hourColumnWidth,
2266
2478
  clampedMinHour,
2267
2479
  clampedMaxHour,
2268
- ampm,
2269
2480
  timeslots,
2270
2481
  isRTL,
2271
- showAllDayEventCell,
2272
2482
  highlightWeekends,
2273
- showVerticalScrollIndicator,
2274
- verticalScrollEnabled,
2275
- hourComponent,
2276
2483
  calendarCellStyle,
2277
2484
  businessHours,
2278
- minHourHeight,
2279
- maxHourHeight,
2485
+ renderBusinessHours,
2486
+ renderBackgroundEvent,
2280
2487
  showNowIndicator,
2281
2488
  labeledRenderEvent,
2282
2489
  keyExtractor,
@@ -2300,75 +2507,126 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2300
2507
  ]);
2301
2508
  const listExtraData = useMemo(() => ({
2302
2509
  events,
2303
- activeIndex
2304
- }), [events, activeIndex]);
2510
+ activeIndex,
2511
+ columnsWidth
2512
+ }), [
2513
+ events,
2514
+ activeIndex,
2515
+ columnsWidth
2516
+ ]);
2305
2517
  return /* @__PURE__ */ jsx(SlotStylesProvider, {
2306
2518
  classNames,
2307
2519
  styles: styleOverrides,
2308
- children: /* @__PURE__ */ jsx(EdgePagingContext.Provider, {
2309
- value: edgePaging,
2310
- children: /* @__PURE__ */ jsxs(View, {
2311
- ref: containerRef,
2312
- style: styles$1.container,
2313
- children: [
2314
- renderHeader ? renderHeader(headerDays) : /* @__PURE__ */ jsx(DefaultHeader, {
2315
- days: headerDays,
2316
- mode,
2317
- width: containerWidth,
2318
- hourColumnWidth,
2319
- showWeekNumber,
2320
- weekNumberPrefix,
2321
- weekdayFormat,
2322
- locale,
2323
- activeDate,
2324
- onPressDateHeader
2325
- }),
2326
- headerComponent,
2327
- /* @__PURE__ */ jsxs(View, {
2328
- ref: pagerRef,
2329
- style: styles$1.pager,
2330
- onLayout: (event) => {
2331
- setPageHeight(event.nativeEvent.layout.height);
2332
- setContainerWidth(event.nativeEvent.layout.width);
2333
- setMeasured(true);
2334
- pagerRef.current?.measureInWindow((x, y, w) => {
2335
- pagerLeft.value = x;
2336
- pagerTop.value = y;
2337
- pagerWidth.value = w;
2338
- });
2339
- },
2340
- children: [/* @__PURE__ */ jsx(LegendList, {
2341
- ref: listRef,
2342
- style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
2343
- data: pageDates,
2344
- extraData: listExtraData,
2345
- horizontal: true,
2346
- recycleItems: false,
2347
- keyExtractor: keyExtractorList,
2348
- getFixedItemSize,
2349
- ...isWeb$1 ? null : {
2350
- scrollEnabled: swipeEnabled && !edgePagingLock,
2351
- pagingEnabled: !freeSwipe,
2352
- snapToIndices: freeSwipe ? snapToIndices : void 0
2520
+ children: /* @__PURE__ */ jsx(CalendarLabelsContext.Provider, {
2521
+ value: labels,
2522
+ children: /* @__PURE__ */ jsx(EdgePagingContext.Provider, {
2523
+ value: edgePaging,
2524
+ children: /* @__PURE__ */ jsxs(View, {
2525
+ ref: containerRef,
2526
+ style: styles$1.container,
2527
+ onLayout: (event) => setContainerWidth(event.nativeEvent.layout.width),
2528
+ children: [
2529
+ renderHeader ? renderHeader(headerDays) : null,
2530
+ headerComponent,
2531
+ /* @__PURE__ */ jsx(View, {
2532
+ ref: viewportRef,
2533
+ style: styles$1.viewport,
2534
+ onLayout: () => {
2535
+ seedWebScroll();
2536
+ viewportRef.current?.measureInWindow((_x, y) => {
2537
+ viewportTop.value = y;
2538
+ });
2353
2539
  },
2354
- initialScrollIndex: activeIndex,
2355
- showsHorizontalScrollIndicator: false,
2356
- viewabilityConfig: PAGE_VIEWABILITY,
2357
- onViewableItemsChanged: handleViewableItemsChanged,
2358
- renderItem
2359
- }, measured ? "grid" : "grid-seed"), liftedEvent ? /* @__PURE__ */ jsx(DragGhost, {
2360
- x: ghostX,
2361
- y: ghostY,
2362
- w: ghostW,
2363
- h: ghostH,
2364
- visible: ghostVisible,
2365
- event: liftedEvent,
2366
- mode,
2367
- renderEvent: labeledRenderEvent,
2368
- eventGap
2369
- }) : null]
2370
- })
2371
- ]
2540
+ children: /* @__PURE__ */ jsx(GestureDetector, {
2541
+ gesture: zoomGesture,
2542
+ children: /* @__PURE__ */ jsx(Animated.ScrollView, {
2543
+ ref: scrollRef,
2544
+ showsVerticalScrollIndicator: showVerticalScrollIndicator,
2545
+ scrollEnabled: verticalScrollEnabled,
2546
+ onScroll: scrollHandler,
2547
+ scrollEventThrottle: 16,
2548
+ refreshControl: verticalScrollEnabled ? refreshControl : void 0,
2549
+ contentOffset: {
2550
+ x: 0,
2551
+ y: seedDefaultY
2552
+ },
2553
+ children: /* @__PURE__ */ jsxs(Animated.View, {
2554
+ testID: "time-grid-hours",
2555
+ style: [styles$1.gridRow, gridHeightStyle],
2556
+ children: [hourColumnWidth > 0 ? /* @__PURE__ */ jsx(HourGutter, {
2557
+ width: hourColumnWidth,
2558
+ minHour: clampedMinHour,
2559
+ maxHour: clampedMaxHour,
2560
+ cellHeight,
2561
+ laneHeight,
2562
+ scrollY,
2563
+ showLane: showAllDayEventCell,
2564
+ showAllDayLabel,
2565
+ allDayLabel: labels.allDay,
2566
+ headerHeight: headerOffset,
2567
+ weekNumber,
2568
+ ampm,
2569
+ hourComponent
2570
+ }) : null, /* @__PURE__ */ jsxs(View, {
2571
+ ref: pagerRef,
2572
+ testID: "time-grid-pager",
2573
+ style: [styles$1.pager, {
2574
+ left: hourColumnWidth,
2575
+ height: pagerHeight
2576
+ }],
2577
+ onLayout: (event) => {
2578
+ const laidOutWidth = event.nativeEvent.layout.width;
2579
+ if (laidOutWidth === pagerLayoutWidthRef.current) return;
2580
+ pagerLayoutWidthRef.current = laidOutWidth;
2581
+ setPagerLayoutWidth(laidOutWidth);
2582
+ pagerRef.current?.measureInWindow((x, _y, measuredWidth) => {
2583
+ pagerLeft.value = x;
2584
+ pagerWidth.value = measuredWidth;
2585
+ });
2586
+ },
2587
+ children: [pagerReady ? /* @__PURE__ */ jsx(AnimatedLegendList, {
2588
+ ref: listRef,
2589
+ style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
2590
+ data: pageDates,
2591
+ extraData: listExtraData,
2592
+ horizontal: true,
2593
+ recycleItems: false,
2594
+ keyExtractor: keyExtractorList,
2595
+ getFixedItemSize,
2596
+ drawDistance: columnsWidth * 2,
2597
+ sharedValues: pagerSharedValues,
2598
+ ...isWeb$1 ? null : {
2599
+ scrollEnabled: swipeEnabled,
2600
+ pagingEnabled: !freeSwipe,
2601
+ snapToIndices: freeSwipe ? snapToIndices : void 0,
2602
+ decelerationRate: freeSwipe ? "normal" : "fast",
2603
+ disableIntervalMomentum: !freeSwipe,
2604
+ scrollEventThrottle: 16,
2605
+ onMomentumScrollEnd: handlePagerSettled
2606
+ },
2607
+ initialScrollIndex: activeIndex,
2608
+ showsHorizontalScrollIndicator: false,
2609
+ viewabilityConfig: PAGE_VIEWABILITY,
2610
+ onViewableItemsChanged: handleViewableItemsChanged,
2611
+ renderItem
2612
+ }, `grid-${columnsWidth}`) : null, liftedEvent ? /* @__PURE__ */ jsx(DragGhost, {
2613
+ x: ghostX,
2614
+ y: ghostY,
2615
+ w: ghostW,
2616
+ h: ghostH,
2617
+ visible: ghostVisible,
2618
+ event: liftedEvent,
2619
+ mode,
2620
+ renderEvent: labeledRenderEvent,
2621
+ eventGap
2622
+ }) : null]
2623
+ })]
2624
+ })
2625
+ })
2626
+ })
2627
+ })
2628
+ ]
2629
+ })
2372
2630
  })
2373
2631
  })
2374
2632
  });
@@ -2393,39 +2651,28 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2393
2651
  * ```
2394
2652
  */
2395
2653
  const TimeGrid = memo(TimeGridInner);
2396
- const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, weekNumberPrefix = "W", weekdayFormat, locale, activeDate, onPressDateHeader }) => {
2397
- const theme = useCalendarTheme();
2654
+ const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
2398
2655
  const slot = useSlots();
2399
- const dayWidth = (width - hourColumnWidth) / days.length;
2400
- return /* @__PURE__ */ jsxs(View, {
2401
- ...slot("header", {
2402
- base: styles$1.headerRow,
2403
- themed: { borderBottomColor: theme.colors.gridLine }
2404
- }),
2405
- children: [/* @__PURE__ */ jsx(View, {
2406
- style: [styles$1.weekNumberGutter, { width: hourColumnWidth }],
2407
- children: showWeekNumber && hourColumnWidth > 0 && days[0] ? /* @__PURE__ */ jsx(Text, {
2408
- ...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
2409
- allowFontScaling: false,
2410
- children: `${weekNumberPrefix}${getISOWeek(days.find((d) => d.getDay() === 4) ?? days[0])}`
2411
- }) : null
2412
- }), days.map((day) => /* @__PURE__ */ jsx(DayHeader, {
2656
+ return /* @__PURE__ */ jsx(View, {
2657
+ ...slot("header", { base: styles$1.headerRow }),
2658
+ children: days.map((day) => /* @__PURE__ */ jsx(DayHeader, {
2413
2659
  day,
2414
2660
  mode,
2415
2661
  width: dayWidth,
2416
2662
  weekdayFormat,
2663
+ todayLabel,
2417
2664
  locale,
2418
2665
  activeDate,
2419
2666
  onPressDateHeader
2420
- }, day.toISOString()))]
2667
+ }, day.toISOString()))
2421
2668
  });
2422
2669
  };
2423
- const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, onPressDateHeader }) => {
2670
+ const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, locale, activeDate, onPressDateHeader }) => {
2424
2671
  const theme = useCalendarTheme();
2425
2672
  const slot = useSlots();
2426
2673
  const isToday = getIsToday$1(day);
2427
2674
  const isHighlighted = activeDate ? isSameCalendarDay$1(day, activeDate) : isToday;
2428
- const accessibilityLabel = `${format(day, "EEEE d MMMM", { locale })}${isToday ? ", today" : ""}`;
2675
+ const accessibilityLabel = `${format(day, "EEEE d MMMM", { locale })}${isToday ? `, ${todayLabel}` : ""}`;
2429
2676
  const headerSlot = slot("columnHeader", {
2430
2677
  base: [styles$1.dayHeader, { width }],
2431
2678
  themed: theme.containers.columnHeader
@@ -2461,17 +2708,58 @@ const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, on
2461
2708
  });
2462
2709
  };
2463
2710
  const styles$1 = StyleSheet.create({
2464
- pager: { flex: 1 },
2711
+ pager: {
2712
+ position: "absolute",
2713
+ top: 0,
2714
+ right: 0
2715
+ },
2465
2716
  pagerList: { flex: 1 },
2466
2717
  container: { flex: 1 },
2718
+ viewport: { flex: 1 },
2719
+ gridRow: {
2720
+ position: "relative",
2721
+ overflow: "hidden"
2722
+ },
2723
+ hourGutter: {
2724
+ position: "absolute",
2725
+ top: 0,
2726
+ left: 0,
2727
+ bottom: 0
2728
+ },
2729
+ fill: {
2730
+ position: "absolute",
2731
+ top: 0,
2732
+ left: 0,
2733
+ right: 0,
2734
+ bottom: 0
2735
+ },
2736
+ hourCell: { flex: 1 },
2467
2737
  headerRow: {
2738
+ flex: 1,
2739
+ flexDirection: "row",
2740
+ alignItems: "center"
2741
+ },
2742
+ pagedHeader: {
2743
+ position: "absolute",
2744
+ top: 0,
2745
+ left: 0,
2746
+ right: 0,
2747
+ height: DAY_HEADER_HEIGHT,
2748
+ zIndex: 2,
2468
2749
  flexDirection: "row",
2469
2750
  alignItems: "center",
2470
2751
  borderBottomWidth: StyleSheet.hairlineWidth
2471
2752
  },
2472
- weekNumberGutter: {
2753
+ gutterCorner: {
2754
+ position: "absolute",
2755
+ top: 0,
2756
+ left: 0,
2757
+ right: 0,
2758
+ zIndex: 2,
2473
2759
  alignItems: "center",
2474
- justifyContent: "flex-end"
2760
+ justifyContent: "flex-end",
2761
+ paddingBottom: 6,
2762
+ borderBottomWidth: StyleSheet.hairlineWidth
2475
2763
  },
2476
2764
  dayHeader: {
2477
2765
  alignItems: "center",
@@ -2485,14 +2773,45 @@ const styles$1 = StyleSheet.create({
2485
2773
  justifyContent: "center",
2486
2774
  alignItems: "center"
2487
2775
  },
2488
- content: {
2489
- width: "100%",
2490
- position: "relative"
2776
+ page: { position: "relative" },
2777
+ grid: {
2778
+ position: "absolute",
2779
+ left: 0,
2780
+ right: 0
2781
+ },
2782
+ laneBand: {
2783
+ position: "absolute",
2784
+ top: 0,
2785
+ left: 0,
2786
+ right: 0,
2787
+ overflow: "hidden",
2788
+ zIndex: 2
2789
+ },
2790
+ laneCell: {
2791
+ position: "absolute",
2792
+ top: 0,
2793
+ left: 0,
2794
+ right: 0,
2795
+ zIndex: 2,
2796
+ justifyContent: "center",
2797
+ overflow: "hidden",
2798
+ borderBottomWidth: StyleSheet.hairlineWidth
2799
+ },
2800
+ allDayLabel: {
2801
+ fontSize: 10,
2802
+ textAlign: "right",
2803
+ paddingRight: 6
2804
+ },
2805
+ gutterRows: {
2806
+ position: "absolute",
2807
+ left: 0,
2808
+ right: 0
2491
2809
  },
2492
2810
  cellPressLayer: {
2493
2811
  position: "absolute",
2494
2812
  top: 0,
2495
2813
  bottom: 0,
2814
+ left: 0,
2496
2815
  right: 0
2497
2816
  },
2498
2817
  createGhost: {
@@ -2504,7 +2823,10 @@ const styles$1 = StyleSheet.create({
2504
2823
  position: "absolute",
2505
2824
  top: 0
2506
2825
  },
2507
- shadeBand: { position: "absolute" },
2826
+ shadeBand: {
2827
+ position: "absolute",
2828
+ overflow: "hidden"
2829
+ },
2508
2830
  daySeparator: {
2509
2831
  position: "absolute",
2510
2832
  top: 0,
@@ -2512,6 +2834,7 @@ const styles$1 = StyleSheet.create({
2512
2834
  },
2513
2835
  hourRow: {
2514
2836
  position: "absolute",
2837
+ top: 0,
2515
2838
  left: 0,
2516
2839
  right: 0,
2517
2840
  flexDirection: "row",
@@ -2523,11 +2846,16 @@ const styles$1 = StyleSheet.create({
2523
2846
  paddingRight: 6
2524
2847
  },
2525
2848
  hourLine: {
2526
- flex: 1,
2849
+ position: "absolute",
2850
+ top: 0,
2851
+ left: 0,
2852
+ right: 0,
2527
2853
  height: StyleSheet.hairlineWidth
2528
2854
  },
2529
2855
  timeslotLine: {
2530
2856
  position: "absolute",
2857
+ top: 0,
2858
+ left: 0,
2531
2859
  right: 0,
2532
2860
  height: StyleSheet.hairlineWidth,
2533
2861
  opacity: .5
@@ -2570,6 +2898,7 @@ const styles$1 = StyleSheet.create({
2570
2898
  height: 2
2571
2899
  },
2572
2900
  nonInteractive: { pointerEvents: "none" },
2901
+ passThrough: { pointerEvents: "box-none" },
2573
2902
  webNoScroll: { overflow: "hidden" }
2574
2903
  });
2575
2904
  //#endregion
@@ -2615,7 +2944,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
2615
2944
  * }
2616
2945
  * ```
2617
2946
  */
2618
- function Calendar({ 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, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, 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 }) {
2947
+ function Calendar({ 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, 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 }) {
2619
2948
  const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
2620
2949
  const internalCellHeight = useSharedValue(hourHeight);
2621
2950
  const cellHeight = cellHeightProp ?? internalCellHeight;
@@ -2685,144 +3014,156 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
2685
3014
  allDayLabel,
2686
3015
  eventAccessibilityLabel
2687
3016
  ]);
3017
+ const resolvedLabels = useMemo(() => resolveCalendarLabels(labels), [labels]);
2688
3018
  return /* @__PURE__ */ jsx(CalendarThemeProvider, {
2689
3019
  value: mergedTheme,
2690
- children: mode === "month" ? /* @__PURE__ */ jsx(MonthPager, {
2691
- date,
2692
- events: displayEvents,
2693
- maxVisibleEventCount,
2694
- weekStartsOn,
2695
- hiddenDays,
2696
- weekdayFormat,
2697
- locale,
2698
- sortedMonthView,
2699
- moreLabel,
2700
- showAdjacentMonths,
2701
- highlightWeekends,
2702
- disableMonthEventCellPress,
2703
- isRTL,
2704
- showSixWeeks,
2705
- showTitle,
2706
- activeDate,
2707
- renderHeaderForMonthView,
2708
- renderCustomDateForMonth,
2709
- calendarCellStyle,
2710
- renderEvent: resolvedRenderEvent,
2711
- keyExtractor,
2712
- onPressDay,
2713
- onLongPressDay,
2714
- onPressCell,
2715
- onPressEvent: handlePressEvent,
2716
- onLongPressEvent: handleLongPressEvent,
2717
- onPressMore,
2718
- onCreateEvent,
2719
- onSelectDrag,
2720
- onDragEvent,
2721
- onDragStart,
2722
- eventStartEditable,
2723
- eventOverlap,
2724
- selectedDates,
2725
- selectedRange,
2726
- fillCellOnSelection,
2727
- minDate,
2728
- maxDate,
2729
- isDateDisabled,
2730
- onChangeDate: handleChangeDate,
2731
- freeSwipe,
2732
- swipeEnabled,
2733
- classNames,
2734
- styles: styleOverrides
2735
- }) : mode === "year" ? /* @__PURE__ */ jsx(YearView, {
2736
- date,
2737
- events: displayEvents,
2738
- weekStartsOn,
2739
- hiddenDays,
2740
- locale,
2741
- activeDate,
2742
- selectedDates,
2743
- selectedRange,
2744
- minDate,
2745
- maxDate,
2746
- isDateDisabled,
2747
- onPressDay,
2748
- onPressMonth,
2749
- onSelectDrag,
2750
- onCreateEvent,
2751
- classNames,
2752
- styles: styleOverrides
2753
- }) : mode === "schedule" ? /* @__PURE__ */ jsx(Agenda, {
2754
- events: displayEvents,
2755
- locale,
2756
- renderEvent: resolvedRenderEvent,
2757
- keyExtractor,
2758
- onPressEvent: handlePressEvent,
2759
- onLongPressEvent: handleLongPressEvent,
2760
- onPressDay,
2761
- activeDate,
2762
- itemSeparatorComponent,
2763
- classNames,
2764
- styles: styleOverrides
2765
- }) : /* @__PURE__ */ jsx(TimeGrid, {
2766
- mode,
2767
- numberOfDays,
2768
- weekEndsOn,
2769
- date,
2770
- events: displayEvents,
2771
- cellHeight,
2772
- hourHeight,
2773
- weekStartsOn,
2774
- weekdayFormat,
2775
- hiddenDays,
2776
- now,
2777
- timeZone,
2778
- renderEvent: resolvedRenderEvent,
2779
- keyExtractor,
2780
- scrollOffsetMinutes,
2781
- hourColumnWidth,
2782
- hideHours,
2783
- timeslots,
2784
- showAllDayEventCell,
2785
- highlightWeekends,
2786
- eventStartEditable,
2787
- eventDurationEditable,
2788
- eventOverlap,
2789
- calendarCellStyle,
2790
- businessHours,
2791
- renderBusinessHours,
2792
- showWeekNumber,
2793
- weekNumberPrefix,
2794
- hourComponent,
2795
- showVerticalScrollIndicator,
2796
- verticalScrollEnabled,
2797
- headerComponent,
2798
- minHour,
2799
- maxHour,
2800
- ampm,
2801
- minHourHeight,
2802
- maxHourHeight,
2803
- minEventHeight,
2804
- eventGap,
2805
- showNowIndicator,
2806
- locale,
2807
- activeDate,
2808
- isRTL,
2809
- freeSwipe,
2810
- swipeEnabled,
2811
- onPressEvent: handlePressEvent,
2812
- onLongPressEvent: handleLongPressEvent,
2813
- onDragEvent,
2814
- showDragHandle,
2815
- onDragStart,
2816
- dragStepMinutes,
2817
- onPressCell,
2818
- resetPageOnPressCell,
2819
- onLongPressCell,
2820
- onCreateEvent,
2821
- onPressDateHeader,
2822
- onChangeDate: handleChangeDate,
2823
- renderHeader: renderTimeGridHeader,
2824
- classNames,
2825
- styles: styleOverrides
3020
+ children: /* @__PURE__ */ jsx(CalendarLabelsContext.Provider, {
3021
+ value: resolvedLabels,
3022
+ children: mode === "month" ? /* @__PURE__ */ jsx(MonthPager, {
3023
+ date,
3024
+ events: displayEvents,
3025
+ maxVisibleEventCount,
3026
+ weekStartsOn,
3027
+ hiddenDays,
3028
+ weekdayFormat,
3029
+ locale,
3030
+ labels,
3031
+ sortedMonthView,
3032
+ moreLabel,
3033
+ showAdjacentMonths,
3034
+ highlightWeekends,
3035
+ disableMonthEventCellPress,
3036
+ isRTL,
3037
+ showSixWeeks,
3038
+ showTitle,
3039
+ activeDate,
3040
+ renderHeaderForMonthView,
3041
+ renderCustomDateForMonth,
3042
+ calendarCellStyle,
3043
+ renderEvent: resolvedRenderEvent,
3044
+ keyExtractor,
3045
+ onPressDay,
3046
+ onLongPressDay,
3047
+ onPressCell,
3048
+ onPressEvent: handlePressEvent,
3049
+ onLongPressEvent: handleLongPressEvent,
3050
+ onPressMore,
3051
+ onCreateEvent,
3052
+ onSelectDrag,
3053
+ onDragEvent,
3054
+ onDragStart,
3055
+ eventStartEditable,
3056
+ eventOverlap,
3057
+ selectedDates,
3058
+ selectedRange,
3059
+ fillCellOnSelection,
3060
+ minDate,
3061
+ maxDate,
3062
+ isDateDisabled,
3063
+ onChangeDate: handleChangeDate,
3064
+ freeSwipe,
3065
+ swipeEnabled,
3066
+ classNames,
3067
+ styles: styleOverrides
3068
+ }) : mode === "year" ? /* @__PURE__ */ jsx(YearView, {
3069
+ date,
3070
+ events: displayEvents,
3071
+ refreshControl,
3072
+ weekStartsOn,
3073
+ hiddenDays,
3074
+ locale,
3075
+ labels,
3076
+ activeDate,
3077
+ selectedDates,
3078
+ selectedRange,
3079
+ minDate,
3080
+ maxDate,
3081
+ isDateDisabled,
3082
+ onPressDay,
3083
+ onPressMonth,
3084
+ onSelectDrag,
3085
+ onCreateEvent,
3086
+ classNames,
3087
+ styles: styleOverrides
3088
+ }) : mode === "schedule" ? /* @__PURE__ */ jsx(Agenda, {
3089
+ events: displayEvents,
3090
+ locale,
3091
+ renderEvent: resolvedRenderEvent,
3092
+ keyExtractor,
3093
+ onPressEvent: handlePressEvent,
3094
+ onLongPressEvent: handleLongPressEvent,
3095
+ onPressDay,
3096
+ activeDate,
3097
+ itemSeparatorComponent,
3098
+ refreshControl,
3099
+ classNames,
3100
+ styles: styleOverrides
3101
+ }) : /* @__PURE__ */ jsx(TimeGrid, {
3102
+ mode,
3103
+ numberOfDays,
3104
+ weekEndsOn,
3105
+ date,
3106
+ events: displayEvents,
3107
+ cellHeight,
3108
+ hourHeight,
3109
+ weekStartsOn,
3110
+ weekdayFormat,
3111
+ hiddenDays,
3112
+ now,
3113
+ timeZone,
3114
+ renderEvent: resolvedRenderEvent,
3115
+ keyExtractor,
3116
+ scrollOffsetMinutes,
3117
+ hourColumnWidth,
3118
+ hideHours,
3119
+ timeslots,
3120
+ showAllDayEventCell,
3121
+ showAllDayLabel,
3122
+ refreshControl,
3123
+ highlightWeekends,
3124
+ eventStartEditable,
3125
+ eventDurationEditable,
3126
+ eventOverlap,
3127
+ calendarCellStyle,
3128
+ businessHours,
3129
+ renderBusinessHours,
3130
+ renderBackgroundEvent,
3131
+ showWeekNumber,
3132
+ weekNumberPrefix,
3133
+ hourComponent,
3134
+ showVerticalScrollIndicator,
3135
+ verticalScrollEnabled,
3136
+ headerComponent,
3137
+ minHour,
3138
+ maxHour,
3139
+ ampm,
3140
+ minHourHeight,
3141
+ maxHourHeight,
3142
+ minEventHeight,
3143
+ eventGap,
3144
+ showNowIndicator,
3145
+ locale,
3146
+ labels,
3147
+ activeDate,
3148
+ isRTL,
3149
+ freeSwipe,
3150
+ swipeEnabled,
3151
+ onPressEvent: handlePressEvent,
3152
+ onLongPressEvent: handleLongPressEvent,
3153
+ onDragEvent,
3154
+ showDragHandle,
3155
+ onDragStart,
3156
+ dragStepMinutes,
3157
+ onPressCell,
3158
+ resetPageOnPressCell,
3159
+ onLongPressCell,
3160
+ onCreateEvent,
3161
+ onPressDateHeader,
3162
+ onChangeDate: handleChangeDate,
3163
+ renderHeader: renderTimeGridHeader,
3164
+ classNames,
3165
+ styles: styleOverrides
3166
+ })
2826
3167
  })
2827
3168
  });
2828
3169
  }
@@ -2864,7 +3205,7 @@ function DefaultBar({ event, width, height }) {
2864
3205
  }) : null]
2865
3206
  });
2866
3207
  }
2867
- function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendererSize, snapMinutes, Renderer, onPress, onLongPress, onDragEvent, resources, laneIndex, laneSize, dragActive, onDragActiveChange, theme }) {
3208
+ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendererSize, snapMinutes, Renderer, onPress, onLongPress, onDragEvent, resources, laneIndex, laneSize, dragActive, onDragActiveChange, theme, labels }) {
2868
3209
  const moveX = useSharedValue(0);
2869
3210
  const moveCross = useSharedValue(0);
2870
3211
  const resizeW = useSharedValue(0);
@@ -2914,34 +3255,33 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
2914
3255
  }
2915
3256
  if (handler(event, next.start, next.end, target) === false) snapBack();
2916
3257
  }, [snapMinutes, snapBack]);
2917
- const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
2918
3258
  const laneTitle = (lane) => lane && (lane.title || lane.id);
2919
3259
  const nextLane = laneTitle(resources[laneIndex + 1]);
2920
3260
  const previousLane = laneTitle(resources[laneIndex - 1]);
2921
3261
  const barActions = draggable ? [
2922
3262
  {
2923
3263
  name: "move-later",
2924
- label: `Move ${unit(snapMinutes)} later`
3264
+ label: labels.moveLater(snapMinutes)
2925
3265
  },
2926
3266
  {
2927
3267
  name: "move-earlier",
2928
- label: `Move ${unit(snapMinutes)} earlier`
3268
+ label: labels.moveEarlier(snapMinutes)
2929
3269
  },
2930
3270
  {
2931
3271
  name: "extend",
2932
- label: `Extend by ${unit(snapMinutes)}`
3272
+ label: labels.extend(snapMinutes)
2933
3273
  },
2934
3274
  {
2935
3275
  name: "shrink",
2936
- label: `Shorten by ${unit(snapMinutes)}`
3276
+ label: labels.shorten(snapMinutes)
2937
3277
  },
2938
3278
  ...nextLane ? [{
2939
3279
  name: "move-next-lane",
2940
- label: `Move to ${nextLane}`
3280
+ label: labels.moveToResource(nextLane)
2941
3281
  }] : [],
2942
3282
  ...previousLane ? [{
2943
3283
  name: "move-previous-lane",
2944
- label: `Move to ${previousLane}`
3284
+ label: labels.moveToResource(previousLane)
2945
3285
  }] : []
2946
3286
  ] : void 0;
2947
3287
  const onBarAction = draggable ? (e) => {
@@ -2961,9 +3301,7 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
2961
3301
  case "move-next-lane":
2962
3302
  commit(0, 0, 1);
2963
3303
  break;
2964
- case "move-previous-lane":
2965
- commit(0, 0, -1);
2966
- break;
3304
+ case "move-previous-lane": commit(0, 0, -1);
2967
3305
  }
2968
3306
  } : void 0;
2969
3307
  const barStyle = useAnimatedStyle(() => vertical ? {
@@ -2987,7 +3325,8 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
2987
3325
  moveCross.value = Math.min(Math.max(cross, -laneIndex * laneSize), (laneCount - 1 - laneIndex) * laneSize);
2988
3326
  }
2989
3327
  }).onEnd((e) => {
2990
- const delta = snapDeltaMinutes(vertical ? e.translationY : e.translationX, hourSize, snapMinutes);
3328
+ const translation = vertical ? e.translationY : e.translationX;
3329
+ const delta = snapDeltaMinutes(translation, hourSize, snapMinutes);
2991
3330
  const cross = laneSize > 0 ? vertical ? e.translationX : e.translationY : 0;
2992
3331
  const laneDelta = laneSize > 0 ? Math.min(Math.max(Math.round(cross / laneSize), -laneIndex), laneCount - 1 - laneIndex) : 0;
2993
3332
  if (delta === 0 && laneDelta === 0) {
@@ -3017,7 +3356,8 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
3017
3356
  const resizeGesture = useMemo(() => Gesture.Pan().enabled(draggable).onUpdate((e) => {
3018
3357
  resizeW.value = vertical ? e.translationY : e.translationX;
3019
3358
  }).onEnd((e) => {
3020
- const delta = snapDeltaMinutes(vertical ? e.translationY : e.translationX, hourSize, snapMinutes);
3359
+ const translation = vertical ? e.translationY : e.translationX;
3360
+ const delta = snapDeltaMinutes(translation, hourSize, snapMinutes);
3021
3361
  if (delta === 0) {
3022
3362
  resizeW.value = 0;
3023
3363
  return;
@@ -3198,8 +3538,9 @@ function LaneInteractionLayer({ resource, vertical, hourSize, startHour, date, s
3198
3538
  * />
3199
3539
  * ```
3200
3540
  */
3201
- function ResourceTimeline({ date, orientation = "horizontal", resources: allResources, resourcesPerPage, resourcePage = 0, events, resourceId = (event) => event.resourceId, startHour = 0, endHour = 24, hourWidth = 80, hourHeight = 48, rowHeight = 56, labelWidth = 140, ampm = false, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes = 15, showNowIndicator = true, now: nowProp, timeZone }) {
3541
+ function ResourceTimeline({ date, orientation = "horizontal", resources: allResources, resourcesPerPage, resourcePage = 0, events, resourceId = (event) => event.resourceId, startHour = 0, endHour = 24, hourWidth = 80, hourHeight = 48, rowHeight = 56, labelWidth = 140, ampm = false, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes = 15, showNowIndicator = true, now: nowProp, timeZone, labels: labelsProp }) {
3202
3542
  const theme = useCalendarTheme();
3543
+ const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
3203
3544
  const resources = useMemo(() => {
3204
3545
  if (!resourcesPerPage || resourcesPerPage <= 0) return allResources;
3205
3546
  const pages = Math.max(1, Math.ceil(allResources.length / resourcesPerPage));
@@ -3383,7 +3724,8 @@ function ResourceTimeline({ date, orientation = "horizontal", resources: allReso
3383
3724
  onPress,
3384
3725
  onLongPress: onLongPressEvent ? () => onLongPressEvent(pe.event) : void 0,
3385
3726
  onDragEvent,
3386
- theme
3727
+ theme,
3728
+ labels
3387
3729
  }, idx);
3388
3730
  return /* @__PURE__ */ jsx(Pressable, {
3389
3731
  onPress,
@@ -3539,7 +3881,8 @@ function ResourceTimeline({ date, orientation = "horizontal", resources: allReso
3539
3881
  onPress,
3540
3882
  onLongPress: onLongPressEvent ? () => onLongPressEvent(pe.event) : void 0,
3541
3883
  onDragEvent,
3542
- theme
3884
+ theme,
3885
+ labels
3543
3886
  }, idx);
3544
3887
  return /* @__PURE__ */ jsx(Pressable, {
3545
3888
  onPress,
@@ -3683,4 +4026,4 @@ const styles = StyleSheet.create({
3683
4026
  }
3684
4027
  });
3685
4028
  //#endregion
3686
- export { Agenda, Calendar, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, DefaultEvent, DefaultMonthEvent, MonthList, MonthPager, MonthView, ResourceTimeline, TimeGrid, YearView, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, 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 };
4029
+ export { Agenda, Calendar, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, DefaultEvent, DefaultMonthEvent, MonthList, MonthPager, MonthView, ResourceTimeline, TimeGrid, YearView, 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 };