@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.js CHANGED
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
- const require_MonthList = require("./MonthList-DNT1LJkk.js");
24
+ const require_MonthList = require("./MonthList-sGAZxQZ_.js");
25
25
  let date_fns = require("date-fns");
26
26
  let react = require("react");
27
27
  let react_native_reanimated = require("react-native-reanimated");
@@ -31,12 +31,14 @@ let react_native = require("react-native");
31
31
  let react_native_gesture_handler = require("react-native-gesture-handler");
32
32
  let react_jsx_runtime = require("react/jsx-runtime");
33
33
  let _legendapp_list_react_native = require("@legendapp/list/react-native");
34
+ let _legendapp_list_reanimated = require("@legendapp/list/reanimated");
34
35
  //#region src/components/YearView.tsx
35
36
  const isWeb$2 = react_native.Platform.OS === "web";
36
37
  const DRAG_HOLD_MS = 400;
37
38
  const FALLBACK_COLUMNS = 3;
38
- function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, classNames, styles: styleOverrides }) {
39
+ 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 }) {
39
40
  const theme = require_MonthList.useCalendarTheme();
41
+ const labels = (0, react.useMemo)(() => (0, _super_calendar_core.resolveCalendarLabels)(labelsProp), [labelsProp]);
40
42
  const slot = require_MonthList.createSlots({
41
43
  classNames,
42
44
  styles: styleOverrides
@@ -122,6 +124,7 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeD
122
124
  onLayout: handleLayout,
123
125
  showsVerticalScrollIndicator: true,
124
126
  scrollEnabled: isWeb$2 || sweep == null,
127
+ refreshControl,
125
128
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
126
129
  ...slot("grid", { base: styles$5.grid }),
127
130
  children: months.map((month, monthIndex) => {
@@ -189,7 +192,14 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeD
189
192
  });
190
193
  const dayTime = (0, date_fns.startOfDay)(day).getTime();
191
194
  const inSweep = sweep != null && dayTime >= Math.min(sweep.anchor, sweep.hover) && dayTime <= Math.max(sweep.anchor, sweep.hover);
192
- const label = `${(0, date_fns.format)(day, "EEEE, d LLLL yyyy", { locale })}${isToday ? ", today" : ""}${state.isSelected ? ", selected" : ""}${state.isDisabled ? ", unavailable" : ""}${hasEvents ? ", has events" : ""}`;
195
+ const label = (0, _super_calendar_core.dayAccessibilityLabel)({
196
+ dateLabel: (0, date_fns.format)(day, "EEEE, d LLLL yyyy", { locale }),
197
+ isToday,
198
+ isSelected: state.isSelected,
199
+ isDisabled: state.isDisabled,
200
+ hasEvents,
201
+ labels
202
+ });
193
203
  const badge = (0, _super_calendar_core.dayBadgeKind)(state, isHighlighted);
194
204
  const daySlot = slot("day", { base: styles$5.day });
195
205
  const showBand = (0, _super_calendar_core.rangeBandKind)(state, true) !== "none";
@@ -393,7 +403,7 @@ const styles$5 = react_native.StyleSheet.create({
393
403
  * start, grouped under a date header per day. The consumer controls which
394
404
  * events (and therefore which date range) are shown.
395
405
  */
396
- function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, classNames, styles: styleOverrides }) {
406
+ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, refreshControl, classNames, styles: styleOverrides }) {
397
407
  const theme = require_MonthList.useCalendarTheme();
398
408
  const slot = (0, react.useMemo)(() => require_MonthList.createSlots({
399
409
  classNames,
@@ -472,7 +482,8 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
472
482
  keyExtractor: keyExtractorRow,
473
483
  renderItem,
474
484
  ItemSeparatorComponent: itemSeparatorComponent ?? void 0,
475
- recycleItems: false
485
+ recycleItems: false,
486
+ refreshControl
476
487
  });
477
488
  }
478
489
  const styles$4 = react_native.StyleSheet.create({
@@ -512,6 +523,7 @@ const numericStyle = (value, fallback) => typeof value === "number" ? value : fa
512
523
  */
513
524
  function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, accessibilityActions, onAccessibilityAction, cellStyle, onPress, onLongPress }) {
514
525
  const theme = require_MonthList.useCalendarTheme();
526
+ const labels = require_MonthList.useCalendarLabels();
515
527
  const isAllDayEvent = isAllDay ?? false;
516
528
  const timeLabel = (0, _super_calendar_core.eventTimeLabel)({
517
529
  mode,
@@ -530,7 +542,8 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
530
542
  start: event.start,
531
543
  end: event.end,
532
544
  ampm,
533
- allDayLabel
545
+ allDayLabel,
546
+ labels
534
547
  });
535
548
  const fixedTitleLines = (0, _super_calendar_core.titleNumberOfLines)(mode, isAllDayEvent);
536
549
  const isSchedule = mode === "schedule";
@@ -689,12 +702,13 @@ function useWebGridZoom(enabled, target, cellHeight, committedCellHeight, minHei
689
702
  //#endregion
690
703
  //#region src/components/AllDayLane.tsx
691
704
  /**
692
- * The all-day lane that sits above the scrolling time grid. All-day events are
693
- * excluded from the timed columns (see `layoutDayEvents`) and shown here,
694
- * stacked under their day(s). Renders nothing when no day has an all-day event,
695
- * so timed-only calendars are unaffected.
705
+ * The all-day lane of one page, pinned above the scrolling hours. All-day
706
+ * events are excluded from the timed columns (see `layoutDayEvents`) and shown
707
+ * here, stacked under their day(s). Always rendered so every page reports a
708
+ * height, zero when the week has none, which the band above the grid follows
709
+ * live as you swipe; the "all-day" label lives in the hour column.
696
710
  */
697
- function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent, keyExtractor, onPressEvent, onLongPressEvent }) {
711
+ function AllDayLane({ days, events, mode, dayWidth, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onLayout }) {
698
712
  const theme = require_MonthList.useCalendarTheme();
699
713
  const slot = require_MonthList.useSlots();
700
714
  const RenderEventComponent = renderEvent;
@@ -704,23 +718,13 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
704
718
  const next = (0, date_fns.addDays)(start, 1);
705
719
  return allDay.filter((event) => event.start < next && event.end > start);
706
720
  });
707
- if (perDay.every((list) => list.length === 0)) return null;
708
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
721
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
709
722
  ...slot("allDayLane", {
710
723
  base: styles$2.lane,
711
- themed: [{ borderBottomColor: theme.colors.gridLine }, theme.containers.allDayLane]
724
+ themed: theme.containers.allDayLane
712
725
  }),
713
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
714
- style: [styles$2.gutter, { width: hourColumnWidth }],
715
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
716
- ...slot("allDayLabel", {
717
- base: styles$2.label,
718
- themed: { color: theme.colors.textMuted }
719
- }),
720
- allowFontScaling: false,
721
- children: "all-day"
722
- })
723
- }), days.map((day, dayIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
726
+ onLayout,
727
+ children: perDay.every((list) => list.length === 0) ? null : days.map((day, dayIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
724
728
  ...slot("allDayColumn", {
725
729
  base: [styles$2.column, { width: dayWidth }],
726
730
  themed: theme.containers.allDayColumn
@@ -735,20 +739,11 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
735
739
  onLongPress: onLongPressEvent ? () => onLongPressEvent(event) : void 0
736
740
  })
737
741
  }, keyExtractor(event, index)))
738
- }, day.toISOString()))]
742
+ }, day.toISOString()))
739
743
  });
740
744
  }
741
745
  const styles$2 = react_native.StyleSheet.create({
742
- lane: {
743
- flexDirection: "row",
744
- borderBottomWidth: react_native.StyleSheet.hairlineWidth
745
- },
746
- gutter: { justifyContent: "center" },
747
- label: {
748
- fontSize: 10,
749
- textAlign: "right",
750
- paddingRight: 6
751
- },
746
+ lane: { flexDirection: "row" },
752
747
  column: {
753
748
  paddingVertical: 2,
754
749
  paddingHorizontal: 1,
@@ -770,7 +765,7 @@ function MultiDayMovePreview(props) {
770
765
  dayEnd: (0, date_fns.addDays)((0, date_fns.startOfDay)(day), 1).getTime()
771
766
  }, day.toISOString()));
772
767
  }
773
- function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
768
+ function PreviewDay({ move, cellHeight, dayWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
774
769
  const theme = require_MonthList.useCalendarTheme();
775
770
  const slot = require_MonthList.useSlots();
776
771
  const { offsetX, offsetY, lifted, dayIndex, event } = move;
@@ -826,7 +821,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
826
821
  position: "absolute",
827
822
  overflow: "hidden",
828
823
  padding: eventGap,
829
- left: hourColumnWidth + index * dayWidth,
824
+ left: index * dayWidth,
830
825
  width: dayWidth,
831
826
  zIndex: 100
832
827
  },
@@ -847,7 +842,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
847
842
  const isWeb$1 = react_native.Platform.OS === "web";
848
843
  const MINUTES_PER_HOUR$1 = 60;
849
844
  const HOURS_PER_DAY = 24;
850
- const MINUTES_PER_DAY = MINUTES_PER_HOUR$1 * HOURS_PER_DAY;
845
+ const MINUTES_PER_DAY = 1440;
851
846
  const PAGE_WINDOW = 180;
852
847
  const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
853
848
  /** Default height in pixels of one hour row on the time grid. */
@@ -863,8 +858,9 @@ const DRAG_ACTIVATE_PX$1 = 8;
863
858
  const RESIZE_HANDLE_HEIGHT = 14;
864
859
  const DEFAULT_DRAG_STEP_MINUTES = 15;
865
860
  const DRAG_EVENT_Z = 100;
866
- const EDGE_DWELL_MS = 500;
867
- const EDGE_ZONE_PX = 36;
861
+ const EDGE_DWELL_MS = 600;
862
+ const EDGE_REPEAT_MS = 700;
863
+ const EDGE_ZONE_PX = 24;
868
864
  const EdgePagingContext = (0, react.createContext)(null);
869
865
  const noop = () => {};
870
866
  /**
@@ -942,9 +938,12 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent, eventGap })
942
938
  });
943
939
  }
944
940
  const HOUR_LABEL_TOP_INSET = 12;
945
- 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 }) {
941
+ const LANE_BAND_FLOOR = 1;
942
+ const DAY_HEADER_HEIGHT = 56;
943
+ 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 }) {
946
944
  const RenderEventComponent = renderEvent;
947
945
  const theme = require_MonthList.useCalendarTheme();
946
+ const labels = require_MonthList.useCalendarLabels();
948
947
  const slot = require_MonthList.useSlots();
949
948
  const edgePaging = (0, react.useContext)(EdgePagingContext);
950
949
  const pagerLeftSV = edgePaging?.pagerLeft;
@@ -994,9 +993,14 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
994
993
  top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
995
994
  height: visibleBoxHeight.value,
996
995
  transform: [{ translateX: moveOffsetX.value }],
997
- zIndex: dragZ.value
996
+ zIndex: dragZ.value,
997
+ opacity: hiddenForMove || lifted.value ? 0 : 1
998
998
  };
999
- }, [startHours, minHour]);
999
+ }, [
1000
+ startHours,
1001
+ minHour,
1002
+ hiddenForMove
1003
+ ]);
1000
1004
  const spillHeight = (0, react_native_reanimated.useDerivedValue)(() => {
1001
1005
  if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
1002
1006
  const overflowHours = startHours + moveOffset.value / cellHeight.value + durationHours - HOURS_PER_DAY;
@@ -1039,13 +1043,17 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1039
1043
  event: positioned.event,
1040
1044
  eventIndex,
1041
1045
  onDragEvent,
1042
- onDragStart
1046
+ onDragStart,
1047
+ onPress,
1048
+ onLongPress
1043
1049
  });
1044
1050
  latest.current = {
1045
1051
  event: positioned.event,
1046
1052
  eventIndex,
1047
1053
  onDragEvent,
1048
- onDragStart
1054
+ onDragStart,
1055
+ onPress,
1056
+ onLongPress
1049
1057
  };
1050
1058
  const snapBack = (0, react.useCallback)(() => {
1051
1059
  moveOffset.value = 0;
@@ -1108,16 +1116,12 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1108
1116
  dwellTimer.current = null;
1109
1117
  }
1110
1118
  }, []);
1111
- const releaseEdge = (0, react.useCallback)(() => {
1112
- disarmEdge();
1113
- edgePaging?.lockScroll(false);
1114
- }, [disarmEdge, edgePaging]);
1119
+ const releaseEdge = disarmEdge;
1115
1120
  const armEdge = (0, react.useCallback)((dir) => {
1116
1121
  disarmEdge();
1117
- dwellTimer.current = setTimeout(() => {
1122
+ const fire = () => {
1118
1123
  dwellTimer.current = null;
1119
1124
  if (!edgePaging) return;
1120
- edgePaging.lockScroll(true);
1121
1125
  if (!lifted.value) {
1122
1126
  lifted.value = 1;
1123
1127
  edgePaging.ghostW.value = width;
@@ -1128,7 +1132,9 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1128
1132
  edgePaging.beginLift(latest.current.event);
1129
1133
  }
1130
1134
  onEdgeAdvance?.(dir);
1131
- }, EDGE_DWELL_MS);
1135
+ dwellTimer.current = setTimeout(fire, EDGE_REPEAT_MS);
1136
+ };
1137
+ dwellTimer.current = setTimeout(fire, EDGE_DWELL_MS);
1132
1138
  }, [
1133
1139
  disarmEdge,
1134
1140
  edgePaging,
@@ -1248,79 +1254,109 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1248
1254
  disarmEdge,
1249
1255
  releaseEdge
1250
1256
  ]);
1251
- const resizeGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(resizable).onStart(() => {
1252
- dragZ.value = DRAG_EVENT_Z;
1253
- (0, react_native_reanimated.runOnJS)(notifyDragStart)();
1254
- }).onUpdate((event) => {
1255
- resizeDelta.value = event.translationY;
1256
- }).onEnd((event) => {
1257
- const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
1258
- if (delta === 0) {
1259
- resizeDelta.value = 0;
1260
- return;
1261
- }
1262
- resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1263
- (0, react_native_reanimated.runOnJS)(commitDrag)(0, delta);
1264
- }).onFinalize(() => {
1265
- dragZ.value = 0;
1266
- }), [
1257
+ const handlePress = (0, react.useCallback)(() => {
1258
+ const { event, onPress: press } = latest.current;
1259
+ press(event);
1260
+ }, []);
1261
+ const canLongPress = !canMove && onLongPress != null;
1262
+ const handleLongPressFromHandle = (0, react.useCallback)(() => {
1263
+ const { event, onLongPress: press } = latest.current;
1264
+ press?.(event);
1265
+ }, []);
1266
+ const resizeGesture = (0, react.useMemo)(() => {
1267
+ const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizable).onStart(() => {
1268
+ dragZ.value = DRAG_EVENT_Z;
1269
+ (0, react_native_reanimated.runOnJS)(notifyDragStart)();
1270
+ }).onUpdate((event) => {
1271
+ resizeDelta.value = event.translationY;
1272
+ }).onEnd((event) => {
1273
+ const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
1274
+ if (delta === 0) {
1275
+ resizeDelta.value = 0;
1276
+ return;
1277
+ }
1278
+ resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1279
+ (0, react_native_reanimated.runOnJS)(commitDrag)(0, delta);
1280
+ }).onFinalize(() => {
1281
+ dragZ.value = 0;
1282
+ });
1283
+ const tap = react_native_gesture_handler.Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
1284
+ if (success) handlePress();
1285
+ });
1286
+ const longPress = react_native_gesture_handler.Gesture.LongPress().enabled(canLongPress).runOnJS(true).onStart(() => {
1287
+ handleLongPressFromHandle();
1288
+ });
1289
+ return react_native_gesture_handler.Gesture.Race(pan, tap, longPress);
1290
+ }, [
1267
1291
  resizable,
1268
1292
  snapMinutes,
1269
1293
  cellHeight,
1270
1294
  resizeDelta,
1271
1295
  dragZ,
1272
1296
  commitDrag,
1273
- notifyDragStart
1297
+ notifyDragStart,
1298
+ handlePress,
1299
+ canLongPress,
1300
+ handleLongPressFromHandle
1274
1301
  ]);
1275
- const resizeStartGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(resizableFromStart).onStart(() => {
1276
- dragZ.value = DRAG_EVENT_Z;
1277
- (0, react_native_reanimated.runOnJS)(notifyDragStart)();
1278
- }).onUpdate((event) => {
1279
- resizeStartDelta.value = event.translationY;
1280
- }).onEnd((event) => {
1281
- const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
1282
- if (delta === 0) {
1283
- resizeStartDelta.value = 0;
1284
- return;
1285
- }
1286
- resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1287
- (0, react_native_reanimated.runOnJS)(commitDrag)(delta, 0);
1288
- }).onFinalize(() => {
1289
- dragZ.value = 0;
1290
- }), [
1302
+ const resizeStartGesture = (0, react.useMemo)(() => {
1303
+ const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizableFromStart).onStart(() => {
1304
+ dragZ.value = DRAG_EVENT_Z;
1305
+ (0, react_native_reanimated.runOnJS)(notifyDragStart)();
1306
+ }).onUpdate((event) => {
1307
+ resizeStartDelta.value = event.translationY;
1308
+ }).onEnd((event) => {
1309
+ const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
1310
+ if (delta === 0) {
1311
+ resizeStartDelta.value = 0;
1312
+ return;
1313
+ }
1314
+ resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
1315
+ (0, react_native_reanimated.runOnJS)(commitDrag)(delta, 0);
1316
+ }).onFinalize(() => {
1317
+ dragZ.value = 0;
1318
+ });
1319
+ const tap = react_native_gesture_handler.Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
1320
+ if (success) handlePress();
1321
+ });
1322
+ const longPress = react_native_gesture_handler.Gesture.LongPress().enabled(canLongPress).runOnJS(true).onStart(() => {
1323
+ handleLongPressFromHandle();
1324
+ });
1325
+ return react_native_gesture_handler.Gesture.Race(pan, tap, longPress);
1326
+ }, [
1291
1327
  resizableFromStart,
1292
1328
  snapMinutes,
1293
1329
  cellHeight,
1294
1330
  resizeStartDelta,
1295
1331
  dragZ,
1296
1332
  commitDrag,
1297
- notifyDragStart
1333
+ notifyDragStart,
1334
+ handlePress,
1335
+ canLongPress,
1336
+ handleLongPressFromHandle
1298
1337
  ]);
1299
- const handlePress = () => onPress(positioned.event);
1300
1338
  const handleLongPress = !canMove && onLongPress ? () => onLongPress(positioned.event) : void 0;
1301
- const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
1302
- const pageUnit = mode === "week" ? "week" : daysPerPage === 1 ? "day" : `${daysPerPage} day${daysPerPage === 1 ? "" : "s"}`;
1303
1339
  const dragActions = [
1304
1340
  ...canMove ? [{
1305
1341
  name: "move-later",
1306
- label: `Move ${unit(snapMinutes)} later`
1342
+ label: labels.moveLater(snapMinutes)
1307
1343
  }, {
1308
1344
  name: "move-earlier",
1309
- label: `Move ${unit(snapMinutes)} earlier`
1345
+ label: labels.moveEarlier(snapMinutes)
1310
1346
  }] : [],
1311
1347
  ...resizable ? [{
1312
1348
  name: "extend",
1313
- label: `Extend by ${unit(snapMinutes)}`
1349
+ label: labels.extend(snapMinutes)
1314
1350
  }, {
1315
1351
  name: "shrink",
1316
- label: `Shorten by ${unit(snapMinutes)}`
1352
+ label: labels.shorten(snapMinutes)
1317
1353
  }] : [],
1318
1354
  ...canMove ? [{
1319
1355
  name: "move-next-page",
1320
- label: `Move to next ${pageUnit}`
1356
+ label: labels.moveToNextPage(daysPerPage, mode)
1321
1357
  }, {
1322
1358
  name: "move-previous-page",
1323
- label: `Move to previous ${pageUnit}`
1359
+ label: labels.moveToPreviousPage(daysPerPage, mode)
1324
1360
  }] : []
1325
1361
  ];
1326
1362
  const accessibilityActions = dragActions.length ? dragActions : void 0;
@@ -1341,9 +1377,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1341
1377
  case "move-next-page":
1342
1378
  commitDrag(daysPerPage * MINUTES_PER_DAY, daysPerPage * MINUTES_PER_DAY);
1343
1379
  break;
1344
- case "move-previous-page":
1345
- commitDrag(-daysPerPage * MINUTES_PER_DAY, -daysPerPage * MINUTES_PER_DAY);
1346
- break;
1380
+ case "move-previous-page": commitDrag(-daysPerPage * MINUTES_PER_DAY, -daysPerPage * MINUTES_PER_DAY);
1347
1381
  }
1348
1382
  } : void 0;
1349
1383
  const eventSlot = slot("event", {
@@ -1356,11 +1390,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1356
1390
  });
1357
1391
  const box = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
1358
1392
  ...eventSlot,
1359
- style: [
1360
- eventSlot.style,
1361
- boxStyle,
1362
- hiddenForMove ? { opacity: 0 } : null
1363
- ],
1393
+ style: [eventSlot.style, boxStyle],
1364
1394
  children: [
1365
1395
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
1366
1396
  event: positioned.event,
@@ -1376,6 +1406,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1376
1406
  resizableFromStart ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
1377
1407
  gesture: resizeStartGesture,
1378
1408
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1409
+ testID: "resize-handle-top",
1379
1410
  style: styles$1.resizeHandleTop,
1380
1411
  children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
1381
1412
  })
@@ -1383,6 +1414,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1383
1414
  resizable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
1384
1415
  gesture: resizeGesture,
1385
1416
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1417
+ testID: "resize-handle",
1386
1418
  style: styles$1.resizeHandle,
1387
1419
  children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
1388
1420
  })
@@ -1408,53 +1440,119 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
1408
1440
  slotProps: slot("event", { themed: theme.containers.timeGridEvent })
1409
1441
  }) : null] });
1410
1442
  }
1411
- const HourRow = ({ hour, minHour, cellHeight, hourColumnWidth, label, ampm, hourComponent }) => {
1443
+ const AnimatedEventBox = (0, react.memo)(AnimatedEventBoxInner);
1444
+ const hourRange = (minHour, maxHour) => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index);
1445
+ const HourLabel = ({ hour, width, label, ampm, hourComponent }) => {
1412
1446
  const theme = require_MonthList.useCalendarTheme();
1413
1447
  const slot = require_MonthList.useSlots();
1414
- const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ top: (hour - minHour) * cellHeight.value }), [hour, minHour]);
1415
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
1416
- style: [
1417
- styles$1.hourRow,
1418
- styles$1.nonInteractive,
1419
- animatedStyle
1420
- ],
1421
- children: [hourComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
1422
- style: { width: hourColumnWidth },
1423
- children: hourComponent(hour, ampm)
1424
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
1425
- ...slot("hourLabel", {
1426
- base: [styles$1.hourLabel, { width: hourColumnWidth }],
1427
- themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
1428
- }),
1429
- allowFontScaling: false,
1430
- children: label
1431
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { ...slot("gridLines", {
1432
- base: styles$1.hourLine,
1433
- themed: { backgroundColor: theme.colors.gridLine }
1434
- }) })]
1448
+ return hourComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
1449
+ style: { width },
1450
+ children: hourComponent(hour, ampm)
1451
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
1452
+ ...slot("hourLabel", {
1453
+ base: [styles$1.hourLabel, { width }],
1454
+ themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
1455
+ }),
1456
+ allowFontScaling: false,
1457
+ children: label
1435
1458
  });
1436
1459
  };
1437
- const TimeslotLine = ({ hour, minHour, fraction, cellHeight, hourColumnWidth }) => {
1460
+ const HourLines = (0, react.memo)(function HourLines({ hours, timeslots }) {
1438
1461
  const theme = require_MonthList.useCalendarTheme();
1439
1462
  const slot = require_MonthList.useSlots();
1440
- const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ top: (hour - minHour + fraction) * cellHeight.value }), [
1441
- hour,
1442
- minHour,
1443
- fraction
1444
- ]);
1445
- const lineSlot = slot("gridLines", {
1446
- base: [
1447
- styles$1.timeslotLine,
1448
- styles$1.nonInteractive,
1449
- { left: hourColumnWidth }
1450
- ],
1463
+ const hourLineSlot = slot("gridLines", {
1464
+ base: [styles$1.hourLine, styles$1.nonInteractive],
1451
1465
  themed: { backgroundColor: theme.colors.gridLine }
1452
1466
  });
1453
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1454
- ...lineSlot,
1455
- style: [lineSlot.style, animatedStyle]
1467
+ const timeslotLineSlot = slot("gridLines", {
1468
+ base: [styles$1.timeslotLine, styles$1.nonInteractive],
1469
+ themed: { backgroundColor: theme.colors.gridLine }
1470
+ });
1471
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
1472
+ style: [styles$1.fill, styles$1.nonInteractive],
1473
+ children: hours.map((hour) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
1474
+ style: styles$1.hourCell,
1475
+ children: Array.from({ length: Math.max(1, timeslots) }, (_, slotIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
1476
+ style: styles$1.hourCell,
1477
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { ...slotIndex === 0 ? hourLineSlot : timeslotLineSlot })
1478
+ }, slotIndex))
1479
+ }, hour))
1480
+ });
1481
+ });
1482
+ const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scrollY, showLane, showAllDayLabel, allDayLabel, headerHeight, weekNumber, ampm, hourComponent }) => {
1483
+ const theme = require_MonthList.useCalendarTheme();
1484
+ const slot = require_MonthList.useSlots();
1485
+ const hours = (0, react.useMemo)(() => hourRange(minHour, maxHour), [minHour, maxHour]);
1486
+ const laneCellHeightStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ height: laneHeight.value }));
1487
+ const pinStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ transform: [{ translateY: scrollY.value }] }));
1488
+ const rowsStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
1489
+ top: headerHeight + laneHeight.value + HOUR_LABEL_TOP_INSET,
1490
+ height: (maxHour - minHour) * cellHeight.value
1491
+ }), [
1492
+ minHour,
1493
+ maxHour,
1494
+ headerHeight
1495
+ ]);
1496
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
1497
+ testID: "hour-gutter",
1498
+ ...slot("hourGutter", { base: [styles$1.hourGutter, { width }] }),
1499
+ children: [
1500
+ headerHeight > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1501
+ style: [
1502
+ styles$1.gutterCorner,
1503
+ {
1504
+ height: headerHeight,
1505
+ backgroundColor: theme.colors.surface,
1506
+ borderBottomColor: theme.colors.gridLine
1507
+ },
1508
+ pinStyle
1509
+ ],
1510
+ children: weekNumber ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
1511
+ ...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
1512
+ allowFontScaling: false,
1513
+ children: weekNumber
1514
+ }) : null
1515
+ }) : null,
1516
+ showLane ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1517
+ style: [
1518
+ styles$1.laneCell,
1519
+ { top: headerHeight },
1520
+ {
1521
+ backgroundColor: theme.colors.surface,
1522
+ borderBottomColor: theme.colors.gridLine
1523
+ },
1524
+ laneCellHeightStyle,
1525
+ pinStyle
1526
+ ],
1527
+ children: showAllDayLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
1528
+ ...slot("allDayLabel", {
1529
+ base: styles$1.allDayLabel,
1530
+ themed: { color: theme.colors.textMuted }
1531
+ }),
1532
+ allowFontScaling: false,
1533
+ children: allDayLabel
1534
+ }) : null
1535
+ }) : null,
1536
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1537
+ style: [styles$1.gutterRows, rowsStyle],
1538
+ children: hours.map((hour) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
1539
+ style: styles$1.hourCell,
1540
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
1541
+ style: [styles$1.hourRow, styles$1.nonInteractive],
1542
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourLabel, {
1543
+ hour,
1544
+ width,
1545
+ label: (0, _super_calendar_core.formatHour)(hour, { ampm }),
1546
+ ampm,
1547
+ hourComponent
1548
+ })
1549
+ })
1550
+ }, hour))
1551
+ })
1552
+ ]
1456
1553
  });
1457
1554
  };
1555
+ const HourGutter = (0, react.memo)(HourGutterInner);
1458
1556
  const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) => {
1459
1557
  const theme = require_MonthList.useCalendarTheme();
1460
1558
  const slot = require_MonthList.useSlots();
@@ -1475,7 +1573,7 @@ const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) =>
1475
1573
  style: [lineSlot.style, animatedStyle]
1476
1574
  });
1477
1575
  };
1478
- const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", children }) => {
1576
+ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", interactive = false, children }) => {
1479
1577
  const slot = require_MonthList.useSlots();
1480
1578
  const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
1481
1579
  top: (startHour - minHour) * cellHeight.value,
@@ -1488,7 +1586,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
1488
1586
  const bandSlot = slot(slotName, {
1489
1587
  base: [
1490
1588
  styles$1.shadeBand,
1491
- styles$1.nonInteractive,
1589
+ interactive ? styles$1.passThrough : styles$1.nonInteractive,
1492
1590
  {
1493
1591
  left,
1494
1592
  width
@@ -1498,56 +1596,46 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
1498
1596
  });
1499
1597
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1500
1598
  testID,
1501
- accessibilityElementsHidden: true,
1502
- importantForAccessibility: "no-hide-descendants",
1599
+ accessibilityElementsHidden: !interactive,
1600
+ importantForAccessibility: interactive ? "auto" : "no-hide-descendants",
1503
1601
  ...bandSlot,
1504
1602
  style: [bandSlot.style, animatedStyle],
1505
1603
  children
1506
1604
  });
1507
1605
  };
1508
- 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 }) {
1606
+ function BackgroundEventBand({ event, cellHeight, startHour, endHour, minHour, left, width, mode, continuesBefore, continuesAfter, render: Render, onPress, onLongPress }) {
1607
+ const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => (endHour - startHour) * cellHeight.value, [
1608
+ startHour,
1609
+ endHour,
1610
+ cellHeight
1611
+ ]);
1612
+ const handlePress = (0, react.useCallback)(() => onPress(event), [onPress, event]);
1613
+ const handleLongPress = (0, react.useCallback)(() => onLongPress?.(event), [onLongPress, event]);
1614
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
1615
+ cellHeight,
1616
+ startHour,
1617
+ endHour,
1618
+ minHour,
1619
+ left,
1620
+ width,
1621
+ slotName: "backgroundEvent",
1622
+ testID: "background-event-shade",
1623
+ interactive: true,
1624
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Render, {
1625
+ event,
1626
+ mode,
1627
+ boxHeight,
1628
+ continuesBefore,
1629
+ continuesAfter,
1630
+ onPress: handlePress,
1631
+ onLongPress: onLongPress ? handleLongPress : void 0
1632
+ })
1633
+ });
1634
+ }
1635
+ 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 }) {
1509
1636
  const theme = require_MonthList.useCalendarTheme();
1510
1637
  const slot = require_MonthList.useSlots();
1511
- const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
1512
- const gridTopRef = (0, react.useRef)(0);
1513
- (0, react.useEffect)(() => {
1514
- if (isActive) onGridTop?.(gridTopRef.current);
1515
- }, [isActive, onGridTop]);
1516
1638
  const heightSource = isActive ? cellHeight : committedCellHeight;
1517
- const isDragging = (0, react_native_reanimated.useSharedValue)(false);
1518
- const isActiveShared = (0, react_native_reanimated.useSharedValue)(isActive);
1519
- (0, react.useEffect)(() => {
1520
- isActiveShared.value = isActive;
1521
- }, [isActive, isActiveShared]);
1522
- const scrollHandler = (0, react_native_reanimated.useAnimatedScrollHandler)({
1523
- onScroll: (event) => {
1524
- if (isActiveShared.value && isDragging.value) scrollY.value = event.contentOffset.y;
1525
- },
1526
- onBeginDrag: () => {
1527
- isDragging.value = true;
1528
- },
1529
- onEndDrag: (event) => {
1530
- isDragging.value = false;
1531
- if (!isWeb$1 && isActiveShared.value) {
1532
- scrollY.value = event.contentOffset.y;
1533
- (0, react_native_reanimated.runOnJS)(onSettleOffset)(event.contentOffset.y);
1534
- }
1535
- },
1536
- onMomentumEnd: (event) => {
1537
- isDragging.value = false;
1538
- if (!isWeb$1 && isActiveShared.value) {
1539
- scrollY.value = event.contentOffset.y;
1540
- (0, react_native_reanimated.runOnJS)(onSettleOffset)(event.contentOffset.y);
1541
- }
1542
- }
1543
- });
1544
- (0, react_native_reanimated.useAnimatedReaction)(() => scrollY.value, (current, previous) => {
1545
- if (!isActiveShared.value && current !== previous) (0, react_native_reanimated.scrollTo)(scrollRef, 0, current, false);
1546
- });
1547
- (0, react_native_reanimated.useAnimatedReaction)(() => isActiveShared.value, (active, previous) => {
1548
- if (isWeb$1 || !active || active === previous) return;
1549
- (0, react_native_reanimated.scrollTo)(scrollRef, 0, scrollY.value, false);
1550
- });
1551
1639
  const days = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
1552
1640
  mode,
1553
1641
  date,
@@ -1559,8 +1647,8 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1559
1647
  ]);
1560
1648
  const daysPerPage = (0, _super_calendar_core.pageStepDays)(mode, date, weekStartsOn, numberOfDays);
1561
1649
  const dayCount = days.length;
1562
- const dayWidth = (width - hourColumnWidth) / dayCount;
1563
- const dayLeft = (dayIndex) => hourColumnWidth + dayIndex * dayWidth;
1650
+ const dayWidth = width / dayCount;
1651
+ const dayLeft = (dayIndex) => dayIndex * dayWidth;
1564
1652
  const dayOrdinals = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[0])), [days]);
1565
1653
  const dayLayouts = (0, react.useMemo)(() => days.map((day) => (0, _super_calendar_core.layoutDayEvents)(events, day)), [days, events]);
1566
1654
  const [multiDayMove, setMultiDayMove] = (0, react.useState)(null);
@@ -1587,7 +1675,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1587
1675
  const date = onLongPressCell && cellDateFromTouch(event);
1588
1676
  if (date) onLongPressCell?.(date);
1589
1677
  };
1590
- const hoursRange = (0, react.useMemo)(() => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index), [minHour, maxHour]);
1678
+ const hoursRange = (0, react.useMemo)(() => hourRange(minHour, maxHour), [minHour, maxHour]);
1591
1679
  const now = (0, _super_calendar_core.useNow)(showNowIndicator && isActive, {
1592
1680
  now: nowProp,
1593
1681
  timeZone: nowTimeZone
@@ -1600,23 +1688,24 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1600
1688
  maxHour,
1601
1689
  heightSource
1602
1690
  ]);
1603
- const pinchStartCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
1604
- const zoomGesture = (0, react.useMemo)(() => {
1605
- const pinch = react_native_gesture_handler.Gesture.Pinch().onStart(() => {
1606
- pinchStartCellHeight.value = cellHeight.value;
1607
- }).onUpdate((event) => {
1608
- cellHeight.value = Math.min(maxHourHeight, Math.max(minHourHeight, pinchStartCellHeight.value * event.scale));
1609
- }).onEnd(() => {
1610
- committedCellHeight.value = cellHeight.value;
1611
- });
1612
- return react_native_gesture_handler.Gesture.Simultaneous(pinch, react_native_gesture_handler.Gesture.Native());
1613
- }, [
1614
- cellHeight,
1615
- committedCellHeight,
1616
- pinchStartCellHeight,
1617
- minHourHeight,
1618
- maxHourHeight
1691
+ const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
1692
+ const gridStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
1693
+ top: headerOffset + laneHeight.value + HOUR_LABEL_TOP_INSET,
1694
+ height: (maxHour - minHour) * heightSource.value
1695
+ }), [
1696
+ minHour,
1697
+ maxHour,
1698
+ heightSource,
1699
+ headerOffset
1619
1700
  ]);
1701
+ const laneHeightStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
1702
+ height: Math.max(LANE_BAND_FLOOR, laneHeight.value),
1703
+ borderBottomWidth: laneHeight.value >= LANE_BAND_FLOOR ? react_native.StyleSheet.hairlineWidth : 0
1704
+ }));
1705
+ const pinStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ transform: [{ translateY: scrollY.value }] }));
1706
+ const reportLaneLayout = (0, react.useCallback)((event) => {
1707
+ onLaneLayout(pageIndex, event.nativeEvent.layout.height);
1708
+ }, [onLaneLayout, pageIndex]);
1620
1709
  const createEnabled = onCreateEvent != null;
1621
1710
  const createActive = (0, react_native_reanimated.useSharedValue)(0);
1622
1711
  const createTop = (0, react_native_reanimated.useSharedValue)(0);
@@ -1659,7 +1748,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1659
1748
  const idx = dayCount === 1 ? 0 : Math.floor(event.x / dayWidth);
1660
1749
  createDayIndex.value = idx;
1661
1750
  createStartY.value = event.y;
1662
- createLeft.value = hourColumnWidth + idx * dayWidth;
1751
+ createLeft.value = idx * dayWidth;
1663
1752
  createWidth.value = dayWidth;
1664
1753
  createTop.value = event.y;
1665
1754
  createHeight.value = 0;
@@ -1684,7 +1773,6 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1684
1773
  createEnabled,
1685
1774
  dayCount,
1686
1775
  dayWidth,
1687
- hourColumnWidth,
1688
1776
  heightSource,
1689
1777
  snapMinutes,
1690
1778
  commitCreate,
@@ -1746,7 +1834,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1746
1834
  }
1747
1835
  });
1748
1836
  const cellLayer = onPressCell || onLongPressCell || createEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
1749
- style: [styles$1.cellPressLayer, { left: hourColumnWidth }],
1837
+ style: styles$1.cellPressLayer,
1750
1838
  onPress: onPressCell ? handleBackgroundPress : void 0,
1751
1839
  onLongPress: !createEnabled && onLongPressCell ? handleBackgroundLongPress : void 0,
1752
1840
  tabIndex: -1,
@@ -1754,201 +1842,237 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
1754
1842
  accessibilityElementsHidden: true
1755
1843
  }) : null;
1756
1844
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
1757
- style: styles$1.container,
1758
- children: [showAllDayEventCell ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AllDayLane, {
1759
- days,
1760
- events,
1761
- mode,
1762
- hourColumnWidth,
1763
- dayWidth,
1764
- renderEvent,
1765
- keyExtractor,
1766
- onPressEvent,
1767
- onLongPressEvent
1768
- }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
1769
- gesture: zoomGesture,
1770
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.ScrollView, {
1771
- ref: scrollRef,
1772
- showsVerticalScrollIndicator: showVerticalScrollIndicator,
1773
- scrollEnabled: verticalScrollEnabled,
1774
- onScroll: scrollHandler,
1775
- scrollEventThrottle: 16,
1776
- onLayout: (event) => {
1777
- gridTopRef.current = event.nativeEvent.layout.y;
1778
- if (isActive) onGridTop?.(gridTopRef.current);
1779
- },
1780
- contentContainerStyle: { paddingTop: HOUR_LABEL_TOP_INSET },
1781
- contentOffset: {
1782
- x: 0,
1783
- y: initialScrollY
1784
- },
1785
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
1786
- style: [styles$1.content, fullHeightStyle],
1787
- children: [
1788
- cellLayer && backgroundGesture ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
1789
- gesture: backgroundGesture,
1790
- children: cellLayer
1791
- }) : cellLayer,
1792
- days.map((day, dayIndex) => {
1793
- if (!highlightWeekends || !(0, _super_calendar_core.isWeekend)(day)) return null;
1794
- const shadeSlot = slot("weekendShade", {
1795
- base: [
1796
- styles$1.weekendColumn,
1797
- styles$1.nonInteractive,
1798
- {
1799
- left: dayLeft(dayIndex),
1800
- width: dayWidth
1801
- }
1802
- ],
1803
- themed: { backgroundColor: theme.colors.weekendBackground }
1804
- });
1805
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1806
- testID: "weekend-shade",
1807
- ...shadeSlot,
1808
- style: [shadeSlot.style, fullHeightStyle]
1809
- }, `weekend-${day.toISOString()}`);
1810
- }),
1811
- calendarCellStyle ? days.map((day, dayIndex) => {
1812
- const cellStyle = calendarCellStyle(day);
1813
- return cellStyle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
1845
+ testID: "time-grid-page",
1846
+ style: [styles$1.page, {
1847
+ width,
1848
+ height
1849
+ }],
1850
+ accessibilityElementsHidden: !isActive,
1851
+ importantForAccessibility: isActive ? "auto" : "no-hide-descendants",
1852
+ children: [
1853
+ pagedHeader ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1854
+ testID: "paged-header",
1855
+ style: [
1856
+ styles$1.pagedHeader,
1857
+ {
1858
+ backgroundColor: theme.colors.surface,
1859
+ borderBottomColor: theme.colors.gridLine
1860
+ },
1861
+ pinStyle
1862
+ ],
1863
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DayHeaderRow, {
1864
+ days,
1865
+ mode,
1866
+ dayWidth,
1867
+ weekdayFormat,
1868
+ todayLabel,
1869
+ locale,
1870
+ activeDate,
1871
+ onPressDateHeader
1872
+ })
1873
+ }) : null,
1874
+ showAllDayEventCell ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1875
+ testID: "all-day-band",
1876
+ style: [
1877
+ styles$1.laneBand,
1878
+ {
1879
+ top: headerOffset,
1880
+ backgroundColor: theme.colors.surface,
1881
+ borderBottomColor: theme.colors.gridLine
1882
+ },
1883
+ laneHeightStyle,
1884
+ pinStyle
1885
+ ],
1886
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AllDayLane, {
1887
+ days,
1888
+ events,
1889
+ mode,
1890
+ dayWidth,
1891
+ renderEvent,
1892
+ keyExtractor,
1893
+ onPressEvent,
1894
+ onLongPressEvent,
1895
+ onLayout: reportLaneLayout
1896
+ })
1897
+ }) : null,
1898
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
1899
+ style: [styles$1.grid, gridStyle],
1900
+ children: [
1901
+ cellLayer && backgroundGesture ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
1902
+ gesture: backgroundGesture,
1903
+ children: cellLayer
1904
+ }) : cellLayer,
1905
+ days.map((day, dayIndex) => {
1906
+ if (!highlightWeekends || !(0, _super_calendar_core.isWeekend)(day)) return null;
1907
+ const shadeSlot = slot("weekendShade", {
1908
+ base: [
1814
1909
  styles$1.weekendColumn,
1815
1910
  styles$1.nonInteractive,
1816
1911
  {
1817
1912
  left: dayLeft(dayIndex),
1818
1913
  width: dayWidth
1819
- },
1820
- cellStyle,
1821
- fullHeightStyle
1822
- ] }, `cell-${day.toISOString()}`) : null;
1823
- }) : null,
1824
- businessHours ? days.flatMap((day, dayIndex) => (0, _super_calendar_core.closedHourBands)(day, businessHours, minHour, maxHour).map((band, bandIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
1825
- cellHeight: heightSource,
1826
- startHour: band.start,
1827
- endHour: band.end,
1828
- minHour,
1829
- left: dayLeft(dayIndex),
1830
- width: dayWidth,
1831
- color: renderBusinessHours ? void 0 : theme.colors.outsideHoursBackground,
1832
- children: renderBusinessHours?.({
1833
- date: day,
1834
- start: band.start,
1835
- end: band.end
1836
- })
1837
- }, `closed-${day.toISOString()}-${bandIndex}`))) : null,
1838
- days.flatMap((day, dayIndex) => (0, _super_calendar_core.backgroundBandsForDay)(events, day).map((b) => ({
1914
+ }
1915
+ ],
1916
+ themed: { backgroundColor: theme.colors.weekendBackground }
1917
+ });
1918
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1919
+ testID: "weekend-shade",
1920
+ ...shadeSlot,
1921
+ style: [shadeSlot.style, fullHeightStyle]
1922
+ }, `weekend-${day.toISOString()}`);
1923
+ }),
1924
+ calendarCellStyle ? days.map((day, dayIndex) => {
1925
+ const cellStyle = calendarCellStyle(day);
1926
+ return cellStyle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
1927
+ styles$1.weekendColumn,
1928
+ styles$1.nonInteractive,
1929
+ {
1930
+ left: dayLeft(dayIndex),
1931
+ width: dayWidth
1932
+ },
1933
+ cellStyle,
1934
+ fullHeightStyle
1935
+ ] }, `cell-${day.toISOString()}`) : null;
1936
+ }) : null,
1937
+ businessHours ? days.flatMap((day, dayIndex) => (0, _super_calendar_core.closedHourBands)(day, businessHours, minHour, maxHour).map((band, bandIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
1938
+ cellHeight: heightSource,
1939
+ startHour: band.start,
1940
+ endHour: band.end,
1941
+ minHour,
1942
+ left: dayLeft(dayIndex),
1943
+ width: dayWidth,
1944
+ color: renderBusinessHours ? void 0 : theme.colors.outsideHoursBackground,
1945
+ children: renderBusinessHours?.({
1946
+ date: day,
1947
+ start: band.start,
1948
+ end: band.end
1949
+ })
1950
+ }, `closed-${day.toISOString()}-${bandIndex}`))) : null,
1951
+ days.flatMap((day, dayIndex) => {
1952
+ const dayStart = (0, date_fns.startOfDay)(day);
1953
+ const nextDayStart = (0, date_fns.addDays)(dayStart, 1);
1954
+ return (0, _super_calendar_core.backgroundBandsForDay)(events, day).map((b) => ({
1839
1955
  ...b,
1840
1956
  startHours: Math.max(b.startHours, minHour),
1841
1957
  endHours: Math.min(b.endHours, maxHour)
1842
- })).filter((b) => b.endHours > b.startHours).map((b, bandIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
1843
- cellHeight: heightSource,
1844
- startHour: b.startHours,
1845
- endHour: b.endHours,
1846
- minHour,
1847
- left: dayLeft(dayIndex),
1848
- width: dayWidth,
1849
- color: theme.colors.backgroundEvent,
1850
- slotName: "backgroundEvent",
1851
- testID: "background-event-shade"
1852
- }, `bg-${day.toISOString()}-${bandIndex}`))),
1853
- days.map((day, dayIndex) => {
1854
- const separatorSlot = slot("daySeparator", {
1855
- base: [
1856
- styles$1.daySeparator,
1857
- styles$1.nonInteractive,
1858
- { left: dayLeft(dayIndex) }
1859
- ],
1860
- themed: { backgroundColor: theme.colors.gridLine }
1861
- });
1862
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1863
- ...separatorSlot,
1864
- style: [separatorSlot.style, fullHeightStyle]
1865
- }, `separator-${day.toISOString()}`);
1866
- }),
1867
- hoursRange.map((hour) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourRow, {
1868
- hour,
1869
- minHour,
1870
- cellHeight: heightSource,
1871
- hourColumnWidth,
1872
- label: (0, _super_calendar_core.formatHour)(hour, { ampm }),
1873
- ampm,
1874
- hourComponent
1875
- }, hour)),
1876
- timeslots > 1 ? hoursRange.flatMap((hour) => Array.from({ length: timeslots - 1 }, (_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeslotLine, {
1877
- hour,
1878
- minHour,
1879
- fraction: (i + 1) / timeslots,
1880
- cellHeight: heightSource,
1881
- hourColumnWidth
1882
- }, `slot-${hour}-${i}`))) : null,
1883
- dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
1884
- const columnWidth = dayWidth / positioned.columns;
1885
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedEventBox, {
1886
- positioned,
1887
- eventIndex: events.indexOf(positioned.event),
1888
- movingEvent,
1889
- onMovePreview: setMultiDayMove,
1958
+ })).filter((b) => b.endHours > b.startHours).map((b, bandIndex) => {
1959
+ const key = `bg-${day.toISOString()}-${keyExtractor(b.event, bandIndex)}`;
1960
+ return renderBackgroundEvent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BackgroundEventBand, {
1961
+ event: b.event,
1890
1962
  cellHeight: heightSource,
1963
+ startHour: b.startHours,
1964
+ endHour: b.endHours,
1891
1965
  minHour,
1892
- maxHour,
1893
- left: dayLeft(dayIndex) + positioned.column * columnWidth,
1894
- width: columnWidth,
1895
- dayLeftPx: dayLeft(dayIndex),
1896
- nextDayDirection: isRTL ? -1 : 1,
1897
- dayWidth,
1898
- dayIndex,
1899
- dayCount: days.length,
1900
- dayOrdinals,
1966
+ left: dayLeft(dayIndex),
1967
+ width: dayWidth,
1901
1968
  mode,
1902
- daysPerPage,
1903
- renderEvent,
1904
- snapMinutes,
1905
- minEventHeight,
1906
- eventGap,
1907
- showDragHandle,
1908
- eventStartEditable,
1909
- eventDurationEditable,
1969
+ continuesBefore: b.event.start < dayStart,
1970
+ continuesAfter: b.event.end > nextDayStart,
1971
+ render: renderBackgroundEvent,
1910
1972
  onPress: onPressEvent,
1911
- onLongPress: onLongPressEvent,
1912
- onDragEvent,
1913
- onDragStart,
1914
- onEdgeAdvance
1915
- }, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
1916
- })),
1917
- multiDayMove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiDayMovePreview, {
1918
- move: multiDayMove,
1919
- days,
1973
+ onLongPress: onLongPressEvent
1974
+ }, key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
1975
+ cellHeight: heightSource,
1976
+ startHour: b.startHours,
1977
+ endHour: b.endHours,
1978
+ minHour,
1979
+ left: dayLeft(dayIndex),
1980
+ width: dayWidth,
1981
+ color: theme.colors.backgroundEvent,
1982
+ slotName: "backgroundEvent",
1983
+ testID: "background-event-shade"
1984
+ }, key);
1985
+ });
1986
+ }),
1987
+ days.map((day, dayIndex) => {
1988
+ const separatorSlot = slot("daySeparator", {
1989
+ base: [
1990
+ styles$1.daySeparator,
1991
+ styles$1.nonInteractive,
1992
+ { left: dayLeft(dayIndex) }
1993
+ ],
1994
+ themed: { backgroundColor: theme.colors.gridLine }
1995
+ });
1996
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1997
+ ...separatorSlot,
1998
+ style: [separatorSlot.style, fullHeightStyle]
1999
+ }, `separator-${day.toISOString()}`);
2000
+ }),
2001
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourLines, {
2002
+ hours: hoursRange,
2003
+ timeslots
2004
+ }),
2005
+ dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
2006
+ const columnWidth = dayWidth / positioned.columns;
2007
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedEventBox, {
2008
+ positioned,
2009
+ eventIndex: events.indexOf(positioned.event),
2010
+ movingEvent,
2011
+ onMovePreview: setMultiDayMove,
1920
2012
  cellHeight: heightSource,
1921
- dayWidth,
1922
- hourColumnWidth,
1923
2013
  minHour,
2014
+ maxHour,
2015
+ left: dayLeft(dayIndex) + positioned.column * columnWidth,
2016
+ width: columnWidth,
2017
+ dayLeftPx: dayLeft(dayIndex),
2018
+ nextDayDirection: isRTL ? -1 : 1,
2019
+ dayWidth,
2020
+ dayIndex,
2021
+ dayCount: days.length,
2022
+ dayOrdinals,
1924
2023
  mode,
2024
+ daysPerPage,
1925
2025
  renderEvent,
2026
+ snapMinutes,
1926
2027
  minEventHeight,
1927
- eventGap
1928
- }) : null,
1929
- showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NowIndicator, {
1930
- cellHeight: heightSource,
1931
- nowHours,
1932
- minHour,
1933
- left: dayLeft(nowDayIndex),
1934
- width: dayWidth,
1935
- color: theme.colors.nowIndicator
1936
- }) : null,
1937
- createEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
1938
- ...ghostSlot,
1939
- style: [ghostSlot.style, createGhostStyle]
1940
- }) : null
1941
- ]
1942
- })
2028
+ eventGap,
2029
+ showDragHandle,
2030
+ eventStartEditable,
2031
+ eventDurationEditable,
2032
+ onPress: onPressEvent,
2033
+ onLongPress: onLongPressEvent,
2034
+ onDragEvent,
2035
+ onDragStart,
2036
+ onEdgeAdvance
2037
+ }, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
2038
+ })),
2039
+ multiDayMove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiDayMovePreview, {
2040
+ move: multiDayMove,
2041
+ days,
2042
+ cellHeight: heightSource,
2043
+ dayWidth,
2044
+ minHour,
2045
+ mode,
2046
+ renderEvent,
2047
+ minEventHeight,
2048
+ eventGap
2049
+ }) : null,
2050
+ showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NowIndicator, {
2051
+ cellHeight: heightSource,
2052
+ nowHours,
2053
+ minHour,
2054
+ left: dayLeft(nowDayIndex),
2055
+ width: dayWidth,
2056
+ color: theme.colors.nowIndicator
2057
+ }) : null,
2058
+ createEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
2059
+ ...ghostSlot,
2060
+ style: [ghostSlot.style, createGhostStyle]
2061
+ }) : null
2062
+ ]
1943
2063
  })
1944
- })]
2064
+ ]
1945
2065
  });
1946
2066
  }
1947
2067
  const TimetablePage = (0, react.memo)(TimetablePageInner);
1948
- 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 }) {
1949
- const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
2068
+ 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 }) {
2069
+ const clampedMinHour = Math.max(0, Math.min(minHour, 23));
1950
2070
  const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
1951
2071
  const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
2072
+ const labels = (0, react.useMemo)(() => (0, _super_calendar_core.resolveCalendarLabels)(labelsProp), [labelsProp]);
2073
+ const todayLabel = labels.today;
2074
+ const pagedHeader = renderHeader == null;
2075
+ const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
1952
2076
  const labeledRenderEvent = (0, react.useMemo)(() => require_MonthList.withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, ampm), [
1953
2077
  renderEvent,
1954
2078
  eventAccessibilityLabel,
@@ -1962,34 +2086,76 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
1962
2086
  eventOverlap,
1963
2087
  events
1964
2088
  ]);
1965
- const { width, height } = (0, react_native.useWindowDimensions)();
2089
+ const { width } = (0, react_native.useWindowDimensions)();
1966
2090
  const listRef = (0, react.useRef)(null);
1967
2091
  const pagerRef = (0, react.useRef)(null);
1968
2092
  const containerRef = (0, react.useRef)(null);
1969
- const suppressCaptureUntilRef = (0, react.useRef)(0);
1970
- const [pageHeight, setPageHeight] = (0, react.useState)(height);
2093
+ const viewportRef = (0, react.useRef)(null);
2094
+ const pagerLayoutWidthRef = (0, react.useRef)(-1);
2095
+ const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
1971
2096
  const [containerWidth, setContainerWidth] = (0, react.useState)(width);
1972
- const [measured, setMeasured] = (0, react.useState)(false);
2097
+ const [pagerLayoutWidth, setPagerLayoutWidth] = (0, react.useState)(null);
2098
+ const columnsWidth = pagerLayoutWidth ?? containerWidth - hourColumnWidth;
2099
+ const pagerReady = pagerLayoutWidth != null && pagerLayoutWidth > 0;
2100
+ const [tallestLane, setTallestLane] = (0, react.useState)(0);
1973
2101
  const weekAnchored = mode === "week" || mode === "custom" && weekEndsOn != null;
1974
2102
  const step = weekAnchored ? 7 : (0, _super_calendar_core.viewDayCount)(mode, numberOfDays);
1975
2103
  const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR$1 - clampedMinHour) * hourHeight;
1976
2104
  const scrollY = (0, react_native_reanimated.useSharedValue)(seedDefaultY);
2105
+ const scrollHandler = (0, react_native_reanimated.useAnimatedScrollHandler)({ onScroll: (event) => {
2106
+ scrollY.value = event.contentOffset.y;
2107
+ } });
2108
+ const webSeededRef = (0, react.useRef)(!isWeb$1);
2109
+ const seedWebScroll = (0, react.useCallback)(() => {
2110
+ if (webSeededRef.current) return;
2111
+ const node = scrollRef.current;
2112
+ if (!node) return;
2113
+ node.scrollTo({
2114
+ y: seedDefaultY,
2115
+ animated: false
2116
+ });
2117
+ const dom = node.getScrollableNode();
2118
+ if (dom && dom.scrollHeight > dom.clientHeight) webSeededRef.current = true;
2119
+ }, [scrollRef, seedDefaultY]);
2120
+ const laneHeights = (0, react_native_reanimated.useSharedValue)({});
2121
+ const laneHeightsRef = (0, react.useRef)({});
2122
+ const pagerOffset = (0, react_native_reanimated.useSharedValue)(PAGE_WINDOW * columnsWidth);
2123
+ const pagerSharedValues = (0, react.useMemo)(() => ({ scrollOffset: pagerOffset }), [pagerOffset]);
2124
+ const activeIndexShared = (0, react_native_reanimated.useSharedValue)(PAGE_WINDOW);
2125
+ const laneHeight = (0, react_native_reanimated.useDerivedValue)(() => {
2126
+ if (!showAllDayEventCell || columnsWidth <= 0) return 0;
2127
+ const heights = laneHeights.value;
2128
+ let progress = pagerOffset.value / columnsWidth;
2129
+ if (Math.abs(progress - activeIndexShared.value) > 1.5) progress = activeIndexShared.value;
2130
+ const from = Math.floor(progress);
2131
+ const fraction = progress - from;
2132
+ const start = heights[from] ?? 0;
2133
+ return start + ((heights[from + 1] ?? start) - start) * fraction;
2134
+ }, [showAllDayEventCell, columnsWidth]);
2135
+ const reportLaneHeight = (0, react.useCallback)((index, height) => {
2136
+ setTallestLane((tallest) => height > tallest ? height : tallest);
2137
+ if (laneHeightsRef.current[index] === height) return;
2138
+ laneHeightsRef.current = {
2139
+ ...laneHeightsRef.current,
2140
+ [index]: height
2141
+ };
2142
+ laneHeights.value = laneHeightsRef.current;
2143
+ }, [laneHeights]);
2144
+ const viewportTop = (0, react_native_reanimated.useSharedValue)(0);
1977
2145
  const pagerLeft = (0, react_native_reanimated.useSharedValue)(0);
1978
- const pagerTop = (0, react_native_reanimated.useSharedValue)(0);
1979
2146
  const pagerWidth = (0, react_native_reanimated.useSharedValue)(width);
1980
- const [edgePagingLock, setEdgePagingLock] = (0, react.useState)(false);
2147
+ const pagerTop = (0, react_native_reanimated.useDerivedValue)(() => viewportTop.value - scrollY.value);
1981
2148
  const ghostX = (0, react_native_reanimated.useSharedValue)(0);
1982
2149
  const ghostY = (0, react_native_reanimated.useSharedValue)(0);
1983
2150
  const ghostW = (0, react_native_reanimated.useSharedValue)(0);
1984
2151
  const ghostH = (0, react_native_reanimated.useSharedValue)(0);
1985
2152
  const ghostVisible = (0, react_native_reanimated.useSharedValue)(0);
1986
- const gridTop = (0, react_native_reanimated.useSharedValue)(0);
1987
2153
  const [liftedEvent, setLiftedEvent] = (0, react.useState)(null);
1988
2154
  const liftedEventRef = (0, react.useRef)(null);
1989
2155
  const dropRef = (0, react.useRef)({
1990
2156
  headerDays: [],
1991
- containerWidth,
1992
- hourColumnWidth,
2157
+ columnsWidth,
2158
+ headerOffset,
1993
2159
  minHour: clampedMinHour,
1994
2160
  maxHour: clampedMaxHour,
1995
2161
  snapMinutes: Math.max(1, dragStepMinutes),
@@ -2004,17 +2170,16 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2004
2170
  ghostVisible.value = 0;
2005
2171
  liftedEventRef.current = null;
2006
2172
  setLiftedEvent(null);
2007
- setEdgePagingLock(false);
2008
2173
  }, [ghostVisible]);
2009
2174
  const commitLiftedDrop = (0, react.useCallback)((ghostLocalX, ghostLocalY) => {
2010
- const { headerDays: days, containerWidth: cw, hourColumnWidth: hcw, minHour: min, maxHour: max, snapMinutes: snap, onDragEvent: onDrag, onChangeDate: onDate } = dropRef.current;
2175
+ const { headerDays: days, columnsWidth: cw, headerOffset: headerH, minHour: min, maxHour: max, snapMinutes: snap, onDragEvent: onDrag, onChangeDate: onDate } = dropRef.current;
2011
2176
  const ev = liftedEventRef.current;
2012
2177
  const duration = ev ? ev.end.getTime() - ev.start.getTime() : 0;
2013
2178
  clearLift();
2014
2179
  if (!ev || !onDrag || days.length === 0) return;
2015
- const dayWidth = (cw - hcw) / days.length;
2016
- const col = Math.min(Math.max(Math.floor((ghostLocalX - hcw) / dayWidth), 0), days.length - 1);
2017
- const rawMinutes = (min + (ghostLocalY - gridTop.value - HOUR_LABEL_TOP_INSET + scrollY.value) / cellHeight.value) * MINUTES_PER_HOUR$1;
2180
+ const dayWidth = cw / days.length;
2181
+ const col = Math.min(Math.max(Math.floor(ghostLocalX / dayWidth), 0), days.length - 1);
2182
+ const rawMinutes = (min + (ghostLocalY - headerH - laneHeight.value - HOUR_LABEL_TOP_INSET) / cellHeight.value) * MINUTES_PER_HOUR$1;
2018
2183
  const minutes = (0, _super_calendar_core.clampMoveStartMinutes)(Math.round(rawMinutes / snap) * snap, min, max, snap);
2019
2184
  const start = new Date(days[col]);
2020
2185
  start.setHours(0, 0, 0, 0);
@@ -2022,18 +2187,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2022
2187
  if (onDrag(ev, start, new Date(start.getTime() + duration)) === false) onDate(ev.start);
2023
2188
  }, [
2024
2189
  clearLift,
2025
- gridTop,
2026
- scrollY,
2027
- cellHeight
2190
+ cellHeight,
2191
+ laneHeight
2028
2192
  ]);
2029
- const handleGridTop = (0, react.useCallback)((y) => {
2030
- gridTop.value = y;
2031
- }, [gridTop]);
2032
2193
  const edgePaging = (0, react.useMemo)(() => ({
2033
2194
  pagerLeft,
2034
2195
  pagerTop,
2035
2196
  pagerWidth,
2036
- lockScroll: setEdgePagingLock,
2037
2197
  ghostX,
2038
2198
  ghostY,
2039
2199
  ghostW,
@@ -2053,11 +2213,37 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2053
2213
  beginLift,
2054
2214
  commitLiftedDrop
2055
2215
  ]);
2056
- const offsetSeedRef = (0, react.useRef)(null);
2057
- const captureOffsetSeed = (0, react.useCallback)((y) => {
2058
- offsetSeedRef.current = y;
2059
- }, []);
2060
2216
  const committedCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
2217
+ const pinching = (0, react_native_reanimated.useSharedValue)(false);
2218
+ (0, react_native_reanimated.useAnimatedReaction)(() => cellHeight.value, (value) => {
2219
+ if (!pinching.value) committedCellHeight.value = value;
2220
+ });
2221
+ const pinchStartCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
2222
+ const zoomGesture = (0, react.useMemo)(() => {
2223
+ const pinch = react_native_gesture_handler.Gesture.Pinch().onStart(() => {
2224
+ pinching.value = true;
2225
+ pinchStartCellHeight.value = cellHeight.value;
2226
+ }).onUpdate((event) => {
2227
+ cellHeight.value = Math.min(maxHourHeight, Math.max(minHourHeight, pinchStartCellHeight.value * event.scale));
2228
+ }).onFinalize(() => {
2229
+ pinching.value = false;
2230
+ committedCellHeight.value = cellHeight.value;
2231
+ });
2232
+ return react_native_gesture_handler.Gesture.Simultaneous(pinch, react_native_gesture_handler.Gesture.Native());
2233
+ }, [
2234
+ cellHeight,
2235
+ committedCellHeight,
2236
+ pinching,
2237
+ pinchStartCellHeight,
2238
+ minHourHeight,
2239
+ maxHourHeight
2240
+ ]);
2241
+ const pagerHeight = headerOffset + HOUR_LABEL_TOP_INSET + (clampedMaxHour - clampedMinHour) * maxHourHeight + tallestLane;
2242
+ const gridHeightStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ height: headerOffset + laneHeight.value + HOUR_LABEL_TOP_INSET + (clampedMaxHour - clampedMinHour) * cellHeight.value }), [
2243
+ clampedMinHour,
2244
+ clampedMaxHour,
2245
+ headerOffset
2246
+ ]);
2061
2247
  useWebGridZoom(isWeb$1, containerRef, cellHeight, committedCellHeight, minHourHeight, maxHourHeight);
2062
2248
  const [anchorDate] = (0, react.useState)(date);
2063
2249
  const anchor = (0, react.useMemo)(() => weekAnchored ? (0, date_fns.startOfWeek)(anchorDate, { weekStartsOn }) : (0, date_fns.startOfDay)(anchorDate), [
@@ -2075,8 +2261,31 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2075
2261
  step,
2076
2262
  weekStartsOn
2077
2263
  ])(date);
2264
+ (0, react.useEffect)(() => {
2265
+ activeIndexShared.value = activeIndex;
2266
+ }, [activeIndex, activeIndexShared]);
2078
2267
  const viewedIndexRef = (0, react.useRef)(activeIndex);
2079
2268
  const pendingScrollIndexRef = (0, react.useRef)(null);
2269
+ const weekNumber = (0, react.useMemo)(() => {
2270
+ if (!pagedHeader || !showWeekNumber || hourColumnWidth === 0) return null;
2271
+ const days = (0, _super_calendar_core.getViewDays)(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays);
2272
+ const thursday = days.find((d) => d.getDay() === 4) ?? days[0];
2273
+ return thursday ? `${weekNumberPrefix}${(0, date_fns.getISOWeek)(thursday)}` : null;
2274
+ }, [
2275
+ pagedHeader,
2276
+ showWeekNumber,
2277
+ hourColumnWidth,
2278
+ mode,
2279
+ pageDates,
2280
+ activeIndex,
2281
+ date,
2282
+ weekStartsOn,
2283
+ numberOfDays,
2284
+ isRTL,
2285
+ weekEndsOn,
2286
+ hiddenDays,
2287
+ weekNumberPrefix
2288
+ ]);
2080
2289
  const headerDays = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
2081
2290
  mode,
2082
2291
  pageDates,
@@ -2090,8 +2299,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2090
2299
  ]);
2091
2300
  dropRef.current = {
2092
2301
  headerDays,
2093
- containerWidth,
2094
- hourColumnWidth,
2302
+ columnsWidth,
2303
+ headerOffset,
2095
2304
  minHour: clampedMinHour,
2096
2305
  maxHour: clampedMaxHour,
2097
2306
  snapMinutes: Math.max(1, dragStepMinutes),
@@ -2117,55 +2326,26 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2117
2326
  if (activeIndex === viewedIndexRef.current) return;
2118
2327
  viewedIndexRef.current = activeIndex;
2119
2328
  pendingScrollIndexRef.current = activeIndex;
2329
+ pagerOffset.value = activeIndex * columnsWidth;
2120
2330
  listRef.current?.scrollToIndex({
2121
2331
  index: activeIndex,
2122
2332
  animated: false
2123
2333
  });
2124
2334
  }, [activeIndex]);
2125
2335
  (0, react.useEffect)(() => {
2126
- if (!isWeb$1) return;
2127
- const root = containerRef.current;
2128
- if (!root) return;
2129
- const restoreVisiblePage = () => {
2130
- const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
2131
- for (const el of root.querySelectorAll("*")) {
2132
- const style = getComputedStyle(el);
2133
- if (!((style.overflowY === "scroll" || style.overflowY === "auto") && el.scrollHeight > el.clientHeight + 20 && el.clientHeight > 100)) continue;
2134
- const rect = el.getBoundingClientRect();
2135
- if (rect.left > -50 && rect.right <= vw + 50) {
2136
- el.scrollTop = scrollY.value;
2137
- break;
2138
- }
2139
- }
2140
- };
2141
- suppressCaptureUntilRef.current = Date.now() + 400;
2142
- let raf2 = 0;
2143
- const raf1 = requestAnimationFrame(() => {
2144
- restoreVisiblePage();
2145
- raf2 = requestAnimationFrame(restoreVisiblePage);
2146
- });
2147
- return () => {
2148
- cancelAnimationFrame(raf1);
2149
- cancelAnimationFrame(raf2);
2150
- };
2151
- }, [activeIndex, pageHeight]);
2336
+ pagerOffset.value = activeIndex * columnsWidth;
2337
+ }, [columnsWidth, pagerOffset]);
2152
2338
  (0, react.useEffect)(() => {
2153
2339
  if (!isWeb$1) return;
2154
- const root = containerRef.current;
2155
- if (!root) return;
2156
- const onScrollCapture = (event) => {
2157
- if (Date.now() < suppressCaptureUntilRef.current) return;
2158
- const el = event.target;
2159
- if (!el || typeof el.scrollTop !== "number" || el.clientHeight <= 100) return;
2160
- const rect = el.getBoundingClientRect();
2161
- const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
2162
- if (rect.left <= -50 || rect.right > vw + 50) return;
2163
- scrollY.value = el.scrollTop;
2164
- offsetSeedRef.current = el.scrollTop;
2340
+ let attempts = 0;
2341
+ let frame = 0;
2342
+ const attempt = () => {
2343
+ seedWebScroll();
2344
+ if (!webSeededRef.current && attempts++ < 120) frame = requestAnimationFrame(attempt);
2165
2345
  };
2166
- root.addEventListener("scroll", onScrollCapture, true);
2167
- return () => root.removeEventListener("scroll", onScrollCapture, true);
2168
- }, []);
2346
+ frame = requestAnimationFrame(attempt);
2347
+ return () => cancelAnimationFrame(frame);
2348
+ }, [seedWebScroll]);
2169
2349
  (0, react.useEffect)(() => {
2170
2350
  if (!isWeb$1) return;
2171
2351
  const root = containerRef.current;
@@ -2182,17 +2362,51 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2182
2362
  };
2183
2363
  const raf = requestAnimationFrame(lockHorizontal);
2184
2364
  return () => cancelAnimationFrame(raf);
2185
- }, [pageHeight]);
2365
+ }, [columnsWidth]);
2366
+ const reduceMotion = (0, react_native_reanimated.useReducedMotion)();
2186
2367
  const goToPage = (0, react.useCallback)((delta) => {
2187
- const target = pageDates[activeIndex + delta];
2188
- if (target) onChangeDate(target);
2368
+ const index = viewedIndexRef.current + delta;
2369
+ const target = pageDates[index];
2370
+ if (!target) return;
2371
+ viewedIndexRef.current = index;
2372
+ pendingScrollIndexRef.current = index;
2373
+ pagerOffset.value = index * columnsWidth;
2374
+ listRef.current?.scrollToIndex({
2375
+ index,
2376
+ animated: !isWeb$1 && !reduceMotion
2377
+ });
2378
+ onChangeDate(target);
2189
2379
  }, [
2190
2380
  pageDates,
2191
- activeIndex,
2192
- onChangeDate
2381
+ reduceMotion,
2382
+ onChangeDate,
2383
+ columnsWidth,
2384
+ pagerOffset
2193
2385
  ]);
2194
2386
  require_MonthList.useWebPagerKeys(swipeEnabled, goToPage);
2195
- const reduceMotion = (0, react_native_reanimated.useReducedMotion)();
2387
+ const handlePagerSettled = (0, react.useCallback)((event) => {
2388
+ if (columnsWidth <= 0) return;
2389
+ if (pendingScrollIndexRef.current != null) return;
2390
+ const raw = Math.round(event.nativeEvent.contentOffset.x / columnsWidth);
2391
+ const index = Math.min(Math.max(raw, 0), pageDates.length - 1);
2392
+ if (index !== viewedIndexRef.current) {
2393
+ viewedIndexRef.current = index;
2394
+ const target = pageDates[index];
2395
+ if (target) onChangeDate(target);
2396
+ }
2397
+ pagerOffset.value = index * columnsWidth;
2398
+ requestAnimationFrame(() => {
2399
+ listRef.current?.scrollToIndex({
2400
+ index,
2401
+ animated: false
2402
+ });
2403
+ });
2404
+ }, [
2405
+ columnsWidth,
2406
+ pageDates,
2407
+ onChangeDate,
2408
+ pagerOffset
2409
+ ]);
2196
2410
  const handlePressCell = (0, react.useMemo)(() => {
2197
2411
  if (!onPressCell) return void 0;
2198
2412
  if (!resetPageOnPressCell) return onPressCell;
@@ -2211,96 +2425,89 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2211
2425
  ]);
2212
2426
  const snapToIndices = (0, react.useMemo)(() => pageDates.map((_, index) => index), [pageDates]);
2213
2427
  const keyExtractorList = (0, react.useCallback)((item) => item.toISOString(), []);
2214
- const getFixedItemSize = (0, react.useCallback)(() => containerWidth, [containerWidth]);
2215
- const renderItem = (0, react.useCallback)(({ item, index }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
2216
- style: {
2217
- width: containerWidth,
2218
- height: pageHeight
2219
- },
2220
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimetablePage, {
2221
- mode,
2222
- numberOfDays,
2223
- hiddenDays,
2224
- now,
2225
- nowTimeZone: timeZone,
2226
- date: item,
2227
- width: containerWidth,
2228
- events,
2229
- cellHeight,
2230
- hourHeight,
2231
- committedCellHeight,
2232
- scrollY,
2233
- isActive: index === activeIndex,
2234
- initialScrollY: offsetSeedRef.current ?? seedDefaultY,
2235
- onSettleOffset: captureOffsetSeed,
2236
- weekStartsOn,
2237
- weekEndsOn,
2238
- hourColumnWidth,
2239
- minHour: clampedMinHour,
2240
- maxHour: clampedMaxHour,
2241
- ampm,
2242
- timeslots,
2243
- isRTL,
2244
- showAllDayEventCell,
2245
- highlightWeekends,
2246
- showVerticalScrollIndicator,
2247
- verticalScrollEnabled,
2248
- hourComponent,
2249
- calendarCellStyle,
2250
- businessHours,
2251
- renderBusinessHours,
2252
- minHourHeight,
2253
- maxHourHeight,
2254
- showNowIndicator,
2255
- renderEvent: labeledRenderEvent,
2256
- keyExtractor,
2257
- snapMinutes: Math.max(1, dragStepMinutes),
2258
- minEventHeight,
2259
- eventGap,
2260
- showDragHandle,
2261
- eventStartEditable,
2262
- eventDurationEditable,
2263
- onPressEvent,
2264
- onLongPressEvent,
2265
- onDragEvent,
2266
- onDragStart,
2267
- onPressCell: handlePressCell,
2268
- onLongPressCell,
2269
- onCreateEvent,
2270
- onEdgeAdvance: goToPage,
2271
- onGridTop: handleGridTop
2272
- })
2273
- }), [
2274
- containerWidth,
2275
- pageHeight,
2276
- handleGridTop,
2428
+ const getFixedItemSize = (0, react.useCallback)(() => columnsWidth, [columnsWidth]);
2429
+ const renderItem = (0, react.useCallback)(({ item, index }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimetablePage, {
2277
2430
  mode,
2278
2431
  numberOfDays,
2432
+ hiddenDays,
2433
+ now,
2434
+ nowTimeZone: timeZone,
2435
+ date: item,
2436
+ width: columnsWidth,
2279
2437
  events,
2280
2438
  cellHeight,
2281
- hourHeight,
2282
2439
  committedCellHeight,
2440
+ isActive: index === activeIndex,
2441
+ weekStartsOn,
2442
+ weekEndsOn,
2443
+ minHour: clampedMinHour,
2444
+ maxHour: clampedMaxHour,
2445
+ timeslots,
2446
+ isRTL,
2447
+ highlightWeekends,
2448
+ calendarCellStyle,
2449
+ businessHours,
2450
+ renderBusinessHours,
2451
+ renderBackgroundEvent,
2452
+ showNowIndicator,
2453
+ renderEvent: labeledRenderEvent,
2454
+ keyExtractor,
2455
+ snapMinutes: Math.max(1, dragStepMinutes),
2456
+ minEventHeight,
2457
+ eventGap,
2458
+ showDragHandle,
2459
+ eventStartEditable,
2460
+ eventDurationEditable,
2461
+ onPressEvent,
2462
+ onLongPressEvent,
2463
+ onDragEvent,
2464
+ onDragStart,
2465
+ onPressCell: handlePressCell,
2466
+ onLongPressCell,
2467
+ onCreateEvent,
2468
+ onEdgeAdvance: goToPage,
2469
+ pageIndex: index,
2470
+ laneHeight,
2283
2471
  scrollY,
2472
+ showAllDayEventCell,
2473
+ onLaneLayout: reportLaneHeight,
2474
+ height: pagerHeight,
2475
+ pagedHeader,
2476
+ weekdayFormat,
2477
+ todayLabel,
2478
+ locale,
2479
+ activeDate,
2480
+ onPressDateHeader
2481
+ }), [
2482
+ columnsWidth,
2483
+ pagerHeight,
2484
+ pagedHeader,
2485
+ weekdayFormat,
2486
+ todayLabel,
2487
+ locale,
2488
+ activeDate,
2489
+ onPressDateHeader,
2490
+ laneHeight,
2491
+ scrollY,
2492
+ showAllDayEventCell,
2493
+ reportLaneHeight,
2494
+ mode,
2495
+ numberOfDays,
2496
+ events,
2497
+ cellHeight,
2498
+ committedCellHeight,
2284
2499
  activeIndex,
2285
- seedDefaultY,
2286
- captureOffsetSeed,
2287
2500
  weekStartsOn,
2288
2501
  weekEndsOn,
2289
- hourColumnWidth,
2290
2502
  clampedMinHour,
2291
2503
  clampedMaxHour,
2292
- ampm,
2293
2504
  timeslots,
2294
2505
  isRTL,
2295
- showAllDayEventCell,
2296
2506
  highlightWeekends,
2297
- showVerticalScrollIndicator,
2298
- verticalScrollEnabled,
2299
- hourComponent,
2300
2507
  calendarCellStyle,
2301
2508
  businessHours,
2302
- minHourHeight,
2303
- maxHourHeight,
2509
+ renderBusinessHours,
2510
+ renderBackgroundEvent,
2304
2511
  showNowIndicator,
2305
2512
  labeledRenderEvent,
2306
2513
  keyExtractor,
@@ -2324,75 +2531,126 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2324
2531
  ]);
2325
2532
  const listExtraData = (0, react.useMemo)(() => ({
2326
2533
  events,
2327
- activeIndex
2328
- }), [events, activeIndex]);
2534
+ activeIndex,
2535
+ columnsWidth
2536
+ }), [
2537
+ events,
2538
+ activeIndex,
2539
+ columnsWidth
2540
+ ]);
2329
2541
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.SlotStylesProvider, {
2330
2542
  classNames,
2331
2543
  styles: styleOverrides,
2332
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EdgePagingContext.Provider, {
2333
- value: edgePaging,
2334
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
2335
- ref: containerRef,
2336
- style: styles$1.container,
2337
- children: [
2338
- renderHeader ? renderHeader(headerDays) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultHeader, {
2339
- days: headerDays,
2340
- mode,
2341
- width: containerWidth,
2342
- hourColumnWidth,
2343
- showWeekNumber,
2344
- weekNumberPrefix,
2345
- weekdayFormat,
2346
- locale,
2347
- activeDate,
2348
- onPressDateHeader
2349
- }),
2350
- headerComponent,
2351
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
2352
- ref: pagerRef,
2353
- style: styles$1.pager,
2354
- onLayout: (event) => {
2355
- setPageHeight(event.nativeEvent.layout.height);
2356
- setContainerWidth(event.nativeEvent.layout.width);
2357
- setMeasured(true);
2358
- pagerRef.current?.measureInWindow((x, y, w) => {
2359
- pagerLeft.value = x;
2360
- pagerTop.value = y;
2361
- pagerWidth.value = w;
2362
- });
2363
- },
2364
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_legendapp_list_react_native.LegendList, {
2365
- ref: listRef,
2366
- style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
2367
- data: pageDates,
2368
- extraData: listExtraData,
2369
- horizontal: true,
2370
- recycleItems: false,
2371
- keyExtractor: keyExtractorList,
2372
- getFixedItemSize,
2373
- ...isWeb$1 ? null : {
2374
- scrollEnabled: swipeEnabled && !edgePagingLock,
2375
- pagingEnabled: !freeSwipe,
2376
- snapToIndices: freeSwipe ? snapToIndices : void 0
2544
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.CalendarLabelsContext.Provider, {
2545
+ value: labels,
2546
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EdgePagingContext.Provider, {
2547
+ value: edgePaging,
2548
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
2549
+ ref: containerRef,
2550
+ style: styles$1.container,
2551
+ onLayout: (event) => setContainerWidth(event.nativeEvent.layout.width),
2552
+ children: [
2553
+ renderHeader ? renderHeader(headerDays) : null,
2554
+ headerComponent,
2555
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
2556
+ ref: viewportRef,
2557
+ style: styles$1.viewport,
2558
+ onLayout: () => {
2559
+ seedWebScroll();
2560
+ viewportRef.current?.measureInWindow((_x, y) => {
2561
+ viewportTop.value = y;
2562
+ });
2377
2563
  },
2378
- initialScrollIndex: activeIndex,
2379
- showsHorizontalScrollIndicator: false,
2380
- viewabilityConfig: PAGE_VIEWABILITY,
2381
- onViewableItemsChanged: handleViewableItemsChanged,
2382
- renderItem
2383
- }, measured ? "grid" : "grid-seed"), liftedEvent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DragGhost, {
2384
- x: ghostX,
2385
- y: ghostY,
2386
- w: ghostW,
2387
- h: ghostH,
2388
- visible: ghostVisible,
2389
- event: liftedEvent,
2390
- mode,
2391
- renderEvent: labeledRenderEvent,
2392
- eventGap
2393
- }) : null]
2394
- })
2395
- ]
2564
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
2565
+ gesture: zoomGesture,
2566
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.ScrollView, {
2567
+ ref: scrollRef,
2568
+ showsVerticalScrollIndicator: showVerticalScrollIndicator,
2569
+ scrollEnabled: verticalScrollEnabled,
2570
+ onScroll: scrollHandler,
2571
+ scrollEventThrottle: 16,
2572
+ refreshControl: verticalScrollEnabled ? refreshControl : void 0,
2573
+ contentOffset: {
2574
+ x: 0,
2575
+ y: seedDefaultY
2576
+ },
2577
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
2578
+ testID: "time-grid-hours",
2579
+ style: [styles$1.gridRow, gridHeightStyle],
2580
+ children: [hourColumnWidth > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourGutter, {
2581
+ width: hourColumnWidth,
2582
+ minHour: clampedMinHour,
2583
+ maxHour: clampedMaxHour,
2584
+ cellHeight,
2585
+ laneHeight,
2586
+ scrollY,
2587
+ showLane: showAllDayEventCell,
2588
+ showAllDayLabel,
2589
+ allDayLabel: labels.allDay,
2590
+ headerHeight: headerOffset,
2591
+ weekNumber,
2592
+ ampm,
2593
+ hourComponent
2594
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
2595
+ ref: pagerRef,
2596
+ testID: "time-grid-pager",
2597
+ style: [styles$1.pager, {
2598
+ left: hourColumnWidth,
2599
+ height: pagerHeight
2600
+ }],
2601
+ onLayout: (event) => {
2602
+ const laidOutWidth = event.nativeEvent.layout.width;
2603
+ if (laidOutWidth === pagerLayoutWidthRef.current) return;
2604
+ pagerLayoutWidthRef.current = laidOutWidth;
2605
+ setPagerLayoutWidth(laidOutWidth);
2606
+ pagerRef.current?.measureInWindow((x, _y, measuredWidth) => {
2607
+ pagerLeft.value = x;
2608
+ pagerWidth.value = measuredWidth;
2609
+ });
2610
+ },
2611
+ children: [pagerReady ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_legendapp_list_reanimated.AnimatedLegendList, {
2612
+ ref: listRef,
2613
+ style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
2614
+ data: pageDates,
2615
+ extraData: listExtraData,
2616
+ horizontal: true,
2617
+ recycleItems: false,
2618
+ keyExtractor: keyExtractorList,
2619
+ getFixedItemSize,
2620
+ drawDistance: columnsWidth * 2,
2621
+ sharedValues: pagerSharedValues,
2622
+ ...isWeb$1 ? null : {
2623
+ scrollEnabled: swipeEnabled,
2624
+ pagingEnabled: !freeSwipe,
2625
+ snapToIndices: freeSwipe ? snapToIndices : void 0,
2626
+ decelerationRate: freeSwipe ? "normal" : "fast",
2627
+ disableIntervalMomentum: !freeSwipe,
2628
+ scrollEventThrottle: 16,
2629
+ onMomentumScrollEnd: handlePagerSettled
2630
+ },
2631
+ initialScrollIndex: activeIndex,
2632
+ showsHorizontalScrollIndicator: false,
2633
+ viewabilityConfig: PAGE_VIEWABILITY,
2634
+ onViewableItemsChanged: handleViewableItemsChanged,
2635
+ renderItem
2636
+ }, `grid-${columnsWidth}`) : null, liftedEvent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DragGhost, {
2637
+ x: ghostX,
2638
+ y: ghostY,
2639
+ w: ghostW,
2640
+ h: ghostH,
2641
+ visible: ghostVisible,
2642
+ event: liftedEvent,
2643
+ mode,
2644
+ renderEvent: labeledRenderEvent,
2645
+ eventGap
2646
+ }) : null]
2647
+ })]
2648
+ })
2649
+ })
2650
+ })
2651
+ })
2652
+ ]
2653
+ })
2396
2654
  })
2397
2655
  })
2398
2656
  });
@@ -2417,39 +2675,28 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
2417
2675
  * ```
2418
2676
  */
2419
2677
  const TimeGrid = (0, react.memo)(TimeGridInner);
2420
- const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, weekNumberPrefix = "W", weekdayFormat, locale, activeDate, onPressDateHeader }) => {
2421
- const theme = require_MonthList.useCalendarTheme();
2678
+ const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
2422
2679
  const slot = require_MonthList.useSlots();
2423
- const dayWidth = (width - hourColumnWidth) / days.length;
2424
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
2425
- ...slot("header", {
2426
- base: styles$1.headerRow,
2427
- themed: { borderBottomColor: theme.colors.gridLine }
2428
- }),
2429
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
2430
- style: [styles$1.weekNumberGutter, { width: hourColumnWidth }],
2431
- children: showWeekNumber && hourColumnWidth > 0 && days[0] ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
2432
- ...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
2433
- allowFontScaling: false,
2434
- children: `${weekNumberPrefix}${(0, date_fns.getISOWeek)(days.find((d) => d.getDay() === 4) ?? days[0])}`
2435
- }) : null
2436
- }), days.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DayHeader, {
2680
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
2681
+ ...slot("header", { base: styles$1.headerRow }),
2682
+ children: days.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DayHeader, {
2437
2683
  day,
2438
2684
  mode,
2439
2685
  width: dayWidth,
2440
2686
  weekdayFormat,
2687
+ todayLabel,
2441
2688
  locale,
2442
2689
  activeDate,
2443
2690
  onPressDateHeader
2444
- }, day.toISOString()))]
2691
+ }, day.toISOString()))
2445
2692
  });
2446
2693
  };
2447
- const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, onPressDateHeader }) => {
2694
+ const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, locale, activeDate, onPressDateHeader }) => {
2448
2695
  const theme = require_MonthList.useCalendarTheme();
2449
2696
  const slot = require_MonthList.useSlots();
2450
2697
  const isToday = (0, _super_calendar_core.getIsToday)(day);
2451
2698
  const isHighlighted = activeDate ? (0, _super_calendar_core.isSameCalendarDay)(day, activeDate) : isToday;
2452
- const accessibilityLabel = `${(0, date_fns.format)(day, "EEEE d MMMM", { locale })}${isToday ? ", today" : ""}`;
2699
+ const accessibilityLabel = `${(0, date_fns.format)(day, "EEEE d MMMM", { locale })}${isToday ? `, ${todayLabel}` : ""}`;
2453
2700
  const headerSlot = slot("columnHeader", {
2454
2701
  base: [styles$1.dayHeader, { width }],
2455
2702
  themed: theme.containers.columnHeader
@@ -2485,17 +2732,58 @@ const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, on
2485
2732
  });
2486
2733
  };
2487
2734
  const styles$1 = react_native.StyleSheet.create({
2488
- pager: { flex: 1 },
2735
+ pager: {
2736
+ position: "absolute",
2737
+ top: 0,
2738
+ right: 0
2739
+ },
2489
2740
  pagerList: { flex: 1 },
2490
2741
  container: { flex: 1 },
2742
+ viewport: { flex: 1 },
2743
+ gridRow: {
2744
+ position: "relative",
2745
+ overflow: "hidden"
2746
+ },
2747
+ hourGutter: {
2748
+ position: "absolute",
2749
+ top: 0,
2750
+ left: 0,
2751
+ bottom: 0
2752
+ },
2753
+ fill: {
2754
+ position: "absolute",
2755
+ top: 0,
2756
+ left: 0,
2757
+ right: 0,
2758
+ bottom: 0
2759
+ },
2760
+ hourCell: { flex: 1 },
2491
2761
  headerRow: {
2762
+ flex: 1,
2763
+ flexDirection: "row",
2764
+ alignItems: "center"
2765
+ },
2766
+ pagedHeader: {
2767
+ position: "absolute",
2768
+ top: 0,
2769
+ left: 0,
2770
+ right: 0,
2771
+ height: DAY_HEADER_HEIGHT,
2772
+ zIndex: 2,
2492
2773
  flexDirection: "row",
2493
2774
  alignItems: "center",
2494
2775
  borderBottomWidth: react_native.StyleSheet.hairlineWidth
2495
2776
  },
2496
- weekNumberGutter: {
2777
+ gutterCorner: {
2778
+ position: "absolute",
2779
+ top: 0,
2780
+ left: 0,
2781
+ right: 0,
2782
+ zIndex: 2,
2497
2783
  alignItems: "center",
2498
- justifyContent: "flex-end"
2784
+ justifyContent: "flex-end",
2785
+ paddingBottom: 6,
2786
+ borderBottomWidth: react_native.StyleSheet.hairlineWidth
2499
2787
  },
2500
2788
  dayHeader: {
2501
2789
  alignItems: "center",
@@ -2509,14 +2797,45 @@ const styles$1 = react_native.StyleSheet.create({
2509
2797
  justifyContent: "center",
2510
2798
  alignItems: "center"
2511
2799
  },
2512
- content: {
2513
- width: "100%",
2514
- position: "relative"
2800
+ page: { position: "relative" },
2801
+ grid: {
2802
+ position: "absolute",
2803
+ left: 0,
2804
+ right: 0
2805
+ },
2806
+ laneBand: {
2807
+ position: "absolute",
2808
+ top: 0,
2809
+ left: 0,
2810
+ right: 0,
2811
+ overflow: "hidden",
2812
+ zIndex: 2
2813
+ },
2814
+ laneCell: {
2815
+ position: "absolute",
2816
+ top: 0,
2817
+ left: 0,
2818
+ right: 0,
2819
+ zIndex: 2,
2820
+ justifyContent: "center",
2821
+ overflow: "hidden",
2822
+ borderBottomWidth: react_native.StyleSheet.hairlineWidth
2823
+ },
2824
+ allDayLabel: {
2825
+ fontSize: 10,
2826
+ textAlign: "right",
2827
+ paddingRight: 6
2828
+ },
2829
+ gutterRows: {
2830
+ position: "absolute",
2831
+ left: 0,
2832
+ right: 0
2515
2833
  },
2516
2834
  cellPressLayer: {
2517
2835
  position: "absolute",
2518
2836
  top: 0,
2519
2837
  bottom: 0,
2838
+ left: 0,
2520
2839
  right: 0
2521
2840
  },
2522
2841
  createGhost: {
@@ -2528,7 +2847,10 @@ const styles$1 = react_native.StyleSheet.create({
2528
2847
  position: "absolute",
2529
2848
  top: 0
2530
2849
  },
2531
- shadeBand: { position: "absolute" },
2850
+ shadeBand: {
2851
+ position: "absolute",
2852
+ overflow: "hidden"
2853
+ },
2532
2854
  daySeparator: {
2533
2855
  position: "absolute",
2534
2856
  top: 0,
@@ -2536,6 +2858,7 @@ const styles$1 = react_native.StyleSheet.create({
2536
2858
  },
2537
2859
  hourRow: {
2538
2860
  position: "absolute",
2861
+ top: 0,
2539
2862
  left: 0,
2540
2863
  right: 0,
2541
2864
  flexDirection: "row",
@@ -2547,11 +2870,16 @@ const styles$1 = react_native.StyleSheet.create({
2547
2870
  paddingRight: 6
2548
2871
  },
2549
2872
  hourLine: {
2550
- flex: 1,
2873
+ position: "absolute",
2874
+ top: 0,
2875
+ left: 0,
2876
+ right: 0,
2551
2877
  height: react_native.StyleSheet.hairlineWidth
2552
2878
  },
2553
2879
  timeslotLine: {
2554
2880
  position: "absolute",
2881
+ top: 0,
2882
+ left: 0,
2555
2883
  right: 0,
2556
2884
  height: react_native.StyleSheet.hairlineWidth,
2557
2885
  opacity: .5
@@ -2594,6 +2922,7 @@ const styles$1 = react_native.StyleSheet.create({
2594
2922
  height: 2
2595
2923
  },
2596
2924
  nonInteractive: { pointerEvents: "none" },
2925
+ passThrough: { pointerEvents: "box-none" },
2597
2926
  webNoScroll: { overflow: "hidden" }
2598
2927
  });
2599
2928
  //#endregion
@@ -2639,7 +2968,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
2639
2968
  * }
2640
2969
  * ```
2641
2970
  */
2642
- 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 }) {
2971
+ 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 }) {
2643
2972
  const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
2644
2973
  const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
2645
2974
  const cellHeight = cellHeightProp ?? internalCellHeight;
@@ -2709,144 +3038,156 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
2709
3038
  allDayLabel,
2710
3039
  eventAccessibilityLabel
2711
3040
  ]);
3041
+ const resolvedLabels = (0, react.useMemo)(() => (0, _super_calendar_core.resolveCalendarLabels)(labels), [labels]);
2712
3042
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.CalendarThemeProvider, {
2713
3043
  value: mergedTheme,
2714
- children: mode === "month" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.MonthPager, {
2715
- date,
2716
- events: displayEvents,
2717
- maxVisibleEventCount,
2718
- weekStartsOn,
2719
- hiddenDays,
2720
- weekdayFormat,
2721
- locale,
2722
- sortedMonthView,
2723
- moreLabel,
2724
- showAdjacentMonths,
2725
- highlightWeekends,
2726
- disableMonthEventCellPress,
2727
- isRTL,
2728
- showSixWeeks,
2729
- showTitle,
2730
- activeDate,
2731
- renderHeaderForMonthView,
2732
- renderCustomDateForMonth,
2733
- calendarCellStyle,
2734
- renderEvent: resolvedRenderEvent,
2735
- keyExtractor,
2736
- onPressDay,
2737
- onLongPressDay,
2738
- onPressCell,
2739
- onPressEvent: handlePressEvent,
2740
- onLongPressEvent: handleLongPressEvent,
2741
- onPressMore,
2742
- onCreateEvent,
2743
- onSelectDrag,
2744
- onDragEvent,
2745
- onDragStart,
2746
- eventStartEditable,
2747
- eventOverlap,
2748
- selectedDates,
2749
- selectedRange,
2750
- fillCellOnSelection,
2751
- minDate,
2752
- maxDate,
2753
- isDateDisabled,
2754
- onChangeDate: handleChangeDate,
2755
- freeSwipe,
2756
- swipeEnabled,
2757
- classNames,
2758
- styles: styleOverrides
2759
- }) : mode === "year" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(YearView, {
2760
- date,
2761
- events: displayEvents,
2762
- weekStartsOn,
2763
- hiddenDays,
2764
- locale,
2765
- activeDate,
2766
- selectedDates,
2767
- selectedRange,
2768
- minDate,
2769
- maxDate,
2770
- isDateDisabled,
2771
- onPressDay,
2772
- onPressMonth,
2773
- onSelectDrag,
2774
- onCreateEvent,
2775
- classNames,
2776
- styles: styleOverrides
2777
- }) : mode === "schedule" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Agenda, {
2778
- events: displayEvents,
2779
- locale,
2780
- renderEvent: resolvedRenderEvent,
2781
- keyExtractor,
2782
- onPressEvent: handlePressEvent,
2783
- onLongPressEvent: handleLongPressEvent,
2784
- onPressDay,
2785
- activeDate,
2786
- itemSeparatorComponent,
2787
- classNames,
2788
- styles: styleOverrides
2789
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeGrid, {
2790
- mode,
2791
- numberOfDays,
2792
- weekEndsOn,
2793
- date,
2794
- events: displayEvents,
2795
- cellHeight,
2796
- hourHeight,
2797
- weekStartsOn,
2798
- weekdayFormat,
2799
- hiddenDays,
2800
- now,
2801
- timeZone,
2802
- renderEvent: resolvedRenderEvent,
2803
- keyExtractor,
2804
- scrollOffsetMinutes,
2805
- hourColumnWidth,
2806
- hideHours,
2807
- timeslots,
2808
- showAllDayEventCell,
2809
- highlightWeekends,
2810
- eventStartEditable,
2811
- eventDurationEditable,
2812
- eventOverlap,
2813
- calendarCellStyle,
2814
- businessHours,
2815
- renderBusinessHours,
2816
- showWeekNumber,
2817
- weekNumberPrefix,
2818
- hourComponent,
2819
- showVerticalScrollIndicator,
2820
- verticalScrollEnabled,
2821
- headerComponent,
2822
- minHour,
2823
- maxHour,
2824
- ampm,
2825
- minHourHeight,
2826
- maxHourHeight,
2827
- minEventHeight,
2828
- eventGap,
2829
- showNowIndicator,
2830
- locale,
2831
- activeDate,
2832
- isRTL,
2833
- freeSwipe,
2834
- swipeEnabled,
2835
- onPressEvent: handlePressEvent,
2836
- onLongPressEvent: handleLongPressEvent,
2837
- onDragEvent,
2838
- showDragHandle,
2839
- onDragStart,
2840
- dragStepMinutes,
2841
- onPressCell,
2842
- resetPageOnPressCell,
2843
- onLongPressCell,
2844
- onCreateEvent,
2845
- onPressDateHeader,
2846
- onChangeDate: handleChangeDate,
2847
- renderHeader: renderTimeGridHeader,
2848
- classNames,
2849
- styles: styleOverrides
3044
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.CalendarLabelsContext.Provider, {
3045
+ value: resolvedLabels,
3046
+ children: mode === "month" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.MonthPager, {
3047
+ date,
3048
+ events: displayEvents,
3049
+ maxVisibleEventCount,
3050
+ weekStartsOn,
3051
+ hiddenDays,
3052
+ weekdayFormat,
3053
+ locale,
3054
+ labels,
3055
+ sortedMonthView,
3056
+ moreLabel,
3057
+ showAdjacentMonths,
3058
+ highlightWeekends,
3059
+ disableMonthEventCellPress,
3060
+ isRTL,
3061
+ showSixWeeks,
3062
+ showTitle,
3063
+ activeDate,
3064
+ renderHeaderForMonthView,
3065
+ renderCustomDateForMonth,
3066
+ calendarCellStyle,
3067
+ renderEvent: resolvedRenderEvent,
3068
+ keyExtractor,
3069
+ onPressDay,
3070
+ onLongPressDay,
3071
+ onPressCell,
3072
+ onPressEvent: handlePressEvent,
3073
+ onLongPressEvent: handleLongPressEvent,
3074
+ onPressMore,
3075
+ onCreateEvent,
3076
+ onSelectDrag,
3077
+ onDragEvent,
3078
+ onDragStart,
3079
+ eventStartEditable,
3080
+ eventOverlap,
3081
+ selectedDates,
3082
+ selectedRange,
3083
+ fillCellOnSelection,
3084
+ minDate,
3085
+ maxDate,
3086
+ isDateDisabled,
3087
+ onChangeDate: handleChangeDate,
3088
+ freeSwipe,
3089
+ swipeEnabled,
3090
+ classNames,
3091
+ styles: styleOverrides
3092
+ }) : mode === "year" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(YearView, {
3093
+ date,
3094
+ events: displayEvents,
3095
+ refreshControl,
3096
+ weekStartsOn,
3097
+ hiddenDays,
3098
+ locale,
3099
+ labels,
3100
+ activeDate,
3101
+ selectedDates,
3102
+ selectedRange,
3103
+ minDate,
3104
+ maxDate,
3105
+ isDateDisabled,
3106
+ onPressDay,
3107
+ onPressMonth,
3108
+ onSelectDrag,
3109
+ onCreateEvent,
3110
+ classNames,
3111
+ styles: styleOverrides
3112
+ }) : mode === "schedule" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Agenda, {
3113
+ events: displayEvents,
3114
+ locale,
3115
+ renderEvent: resolvedRenderEvent,
3116
+ keyExtractor,
3117
+ onPressEvent: handlePressEvent,
3118
+ onLongPressEvent: handleLongPressEvent,
3119
+ onPressDay,
3120
+ activeDate,
3121
+ itemSeparatorComponent,
3122
+ refreshControl,
3123
+ classNames,
3124
+ styles: styleOverrides
3125
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeGrid, {
3126
+ mode,
3127
+ numberOfDays,
3128
+ weekEndsOn,
3129
+ date,
3130
+ events: displayEvents,
3131
+ cellHeight,
3132
+ hourHeight,
3133
+ weekStartsOn,
3134
+ weekdayFormat,
3135
+ hiddenDays,
3136
+ now,
3137
+ timeZone,
3138
+ renderEvent: resolvedRenderEvent,
3139
+ keyExtractor,
3140
+ scrollOffsetMinutes,
3141
+ hourColumnWidth,
3142
+ hideHours,
3143
+ timeslots,
3144
+ showAllDayEventCell,
3145
+ showAllDayLabel,
3146
+ refreshControl,
3147
+ highlightWeekends,
3148
+ eventStartEditable,
3149
+ eventDurationEditable,
3150
+ eventOverlap,
3151
+ calendarCellStyle,
3152
+ businessHours,
3153
+ renderBusinessHours,
3154
+ renderBackgroundEvent,
3155
+ showWeekNumber,
3156
+ weekNumberPrefix,
3157
+ hourComponent,
3158
+ showVerticalScrollIndicator,
3159
+ verticalScrollEnabled,
3160
+ headerComponent,
3161
+ minHour,
3162
+ maxHour,
3163
+ ampm,
3164
+ minHourHeight,
3165
+ maxHourHeight,
3166
+ minEventHeight,
3167
+ eventGap,
3168
+ showNowIndicator,
3169
+ locale,
3170
+ labels,
3171
+ activeDate,
3172
+ isRTL,
3173
+ freeSwipe,
3174
+ swipeEnabled,
3175
+ onPressEvent: handlePressEvent,
3176
+ onLongPressEvent: handleLongPressEvent,
3177
+ onDragEvent,
3178
+ showDragHandle,
3179
+ onDragStart,
3180
+ dragStepMinutes,
3181
+ onPressCell,
3182
+ resetPageOnPressCell,
3183
+ onLongPressCell,
3184
+ onCreateEvent,
3185
+ onPressDateHeader,
3186
+ onChangeDate: handleChangeDate,
3187
+ renderHeader: renderTimeGridHeader,
3188
+ classNames,
3189
+ styles: styleOverrides
3190
+ })
2850
3191
  })
2851
3192
  });
2852
3193
  }
@@ -2888,7 +3229,7 @@ function DefaultBar({ event, width, height }) {
2888
3229
  }) : null]
2889
3230
  });
2890
3231
  }
2891
- function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendererSize, snapMinutes, Renderer, onPress, onLongPress, onDragEvent, resources, laneIndex, laneSize, dragActive, onDragActiveChange, theme }) {
3232
+ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendererSize, snapMinutes, Renderer, onPress, onLongPress, onDragEvent, resources, laneIndex, laneSize, dragActive, onDragActiveChange, theme, labels }) {
2892
3233
  const moveX = (0, react_native_reanimated.useSharedValue)(0);
2893
3234
  const moveCross = (0, react_native_reanimated.useSharedValue)(0);
2894
3235
  const resizeW = (0, react_native_reanimated.useSharedValue)(0);
@@ -2938,34 +3279,33 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
2938
3279
  }
2939
3280
  if (handler(event, next.start, next.end, target) === false) snapBack();
2940
3281
  }, [snapMinutes, snapBack]);
2941
- const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
2942
3282
  const laneTitle = (lane) => lane && (lane.title || lane.id);
2943
3283
  const nextLane = laneTitle(resources[laneIndex + 1]);
2944
3284
  const previousLane = laneTitle(resources[laneIndex - 1]);
2945
3285
  const barActions = draggable ? [
2946
3286
  {
2947
3287
  name: "move-later",
2948
- label: `Move ${unit(snapMinutes)} later`
3288
+ label: labels.moveLater(snapMinutes)
2949
3289
  },
2950
3290
  {
2951
3291
  name: "move-earlier",
2952
- label: `Move ${unit(snapMinutes)} earlier`
3292
+ label: labels.moveEarlier(snapMinutes)
2953
3293
  },
2954
3294
  {
2955
3295
  name: "extend",
2956
- label: `Extend by ${unit(snapMinutes)}`
3296
+ label: labels.extend(snapMinutes)
2957
3297
  },
2958
3298
  {
2959
3299
  name: "shrink",
2960
- label: `Shorten by ${unit(snapMinutes)}`
3300
+ label: labels.shorten(snapMinutes)
2961
3301
  },
2962
3302
  ...nextLane ? [{
2963
3303
  name: "move-next-lane",
2964
- label: `Move to ${nextLane}`
3304
+ label: labels.moveToResource(nextLane)
2965
3305
  }] : [],
2966
3306
  ...previousLane ? [{
2967
3307
  name: "move-previous-lane",
2968
- label: `Move to ${previousLane}`
3308
+ label: labels.moveToResource(previousLane)
2969
3309
  }] : []
2970
3310
  ] : void 0;
2971
3311
  const onBarAction = draggable ? (e) => {
@@ -2985,9 +3325,7 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
2985
3325
  case "move-next-lane":
2986
3326
  commit(0, 0, 1);
2987
3327
  break;
2988
- case "move-previous-lane":
2989
- commit(0, 0, -1);
2990
- break;
3328
+ case "move-previous-lane": commit(0, 0, -1);
2991
3329
  }
2992
3330
  } : void 0;
2993
3331
  const barStyle = (0, react_native_reanimated.useAnimatedStyle)(() => vertical ? {
@@ -3011,7 +3349,8 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
3011
3349
  moveCross.value = Math.min(Math.max(cross, -laneIndex * laneSize), (laneCount - 1 - laneIndex) * laneSize);
3012
3350
  }
3013
3351
  }).onEnd((e) => {
3014
- const delta = (0, _super_calendar_core.snapDeltaMinutes)(vertical ? e.translationY : e.translationX, hourSize, snapMinutes);
3352
+ const translation = vertical ? e.translationY : e.translationX;
3353
+ const delta = (0, _super_calendar_core.snapDeltaMinutes)(translation, hourSize, snapMinutes);
3015
3354
  const cross = laneSize > 0 ? vertical ? e.translationX : e.translationY : 0;
3016
3355
  const laneDelta = laneSize > 0 ? Math.min(Math.max(Math.round(cross / laneSize), -laneIndex), laneCount - 1 - laneIndex) : 0;
3017
3356
  if (delta === 0 && laneDelta === 0) {
@@ -3041,7 +3380,8 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
3041
3380
  const resizeGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(draggable).onUpdate((e) => {
3042
3381
  resizeW.value = vertical ? e.translationY : e.translationX;
3043
3382
  }).onEnd((e) => {
3044
- const delta = (0, _super_calendar_core.snapDeltaMinutes)(vertical ? e.translationY : e.translationX, hourSize, snapMinutes);
3383
+ const translation = vertical ? e.translationY : e.translationX;
3384
+ const delta = (0, _super_calendar_core.snapDeltaMinutes)(translation, hourSize, snapMinutes);
3045
3385
  if (delta === 0) {
3046
3386
  resizeW.value = 0;
3047
3387
  return;
@@ -3222,8 +3562,9 @@ function LaneInteractionLayer({ resource, vertical, hourSize, startHour, date, s
3222
3562
  * />
3223
3563
  * ```
3224
3564
  */
3225
- 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 }) {
3565
+ 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 }) {
3226
3566
  const theme = require_MonthList.useCalendarTheme();
3567
+ const labels = (0, react.useMemo)(() => (0, _super_calendar_core.resolveCalendarLabels)(labelsProp), [labelsProp]);
3227
3568
  const resources = (0, react.useMemo)(() => {
3228
3569
  if (!resourcesPerPage || resourcesPerPage <= 0) return allResources;
3229
3570
  const pages = Math.max(1, Math.ceil(allResources.length / resourcesPerPage));
@@ -3407,7 +3748,8 @@ function ResourceTimeline({ date, orientation = "horizontal", resources: allReso
3407
3748
  onPress,
3408
3749
  onLongPress: onLongPressEvent ? () => onLongPressEvent(pe.event) : void 0,
3409
3750
  onDragEvent,
3410
- theme
3751
+ theme,
3752
+ labels
3411
3753
  }, idx);
3412
3754
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
3413
3755
  onPress,
@@ -3563,7 +3905,8 @@ function ResourceTimeline({ date, orientation = "horizontal", resources: allReso
3563
3905
  onPress,
3564
3906
  onLongPress: onLongPressEvent ? () => onLongPressEvent(pe.event) : void 0,
3565
3907
  onDragEvent,
3566
- theme
3908
+ theme,
3909
+ labels
3567
3910
  }, idx);
3568
3911
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
3569
3912
  onPress,
@@ -3744,6 +4087,12 @@ Object.defineProperty(exports, "daySelectionState", {
3744
4087
  return _super_calendar_core.daySelectionState;
3745
4088
  }
3746
4089
  });
4090
+ Object.defineProperty(exports, "defaultCalendarLabels", {
4091
+ enumerable: true,
4092
+ get: function() {
4093
+ return _super_calendar_core.defaultCalendarLabels;
4094
+ }
4095
+ });
3747
4096
  exports.defaultTheme = require_MonthList.defaultTheme;
3748
4097
  Object.defineProperty(exports, "eventsInTimeZone", {
3749
4098
  enumerable: true,