@super-calendar/native 2.6.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { addMonths, differenceInCalendarMonths, format, isSameMonth, startOfDay, startOfMonth } from "date-fns";
2
2
  import { createContext, createElement, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
- import { CalendarSelectionProvider, buildMonthWeeks, compareDayEvents, darkColors, dayBadgeKind, daySelectionState, eventAccessibilityLabel, eventTimeLabel, getIsToday, getWeekDays, groupEventsByDay, isAllDayEvent, isDateSelectable, isSameCalendarDay, isWeekend, lightColors, monthEventCapacity, monthVisibleCount, rangeBandKind, titleEllipsizeMode, titleNumberOfLines, useCalendarSelection, weekdayFormatToken } from "@super-calendar/core";
4
- import { Platform, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
3
+ import { CalendarSelectionProvider, buildMonthWeeks, compareDayEvents, darkColors, dayBadgeKind, daySelectionState, eventAccessibilityLabel, eventTimeLabel, filterHiddenDays, getIsToday, getWeekDays, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isSameCalendarDay, isWeekend, layoutMonthWeek, lightColors, monthEventCapacity, monthVisibleCount, rangeBandKind, titleEllipsizeMode, titleNumberOfLines, useCalendarSelection, weekdayFormatToken } from "@super-calendar/core";
4
+ import { Modal, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { LegendList } from "@legendapp/list/react-native";
7
7
  import { Gesture, GestureDetector } from "react-native-gesture-handler";
@@ -200,9 +200,29 @@ const DATE_BADGE_HEIGHT = 24;
200
200
  const BAND_CENTER_Y = 16;
201
201
  const CELL_ROW_GAP = 2;
202
202
  const CHIP_PADDING_V = 2;
203
+ const BADGE_AREA = 30;
204
+ const EMPTY_LAYOUT = {
205
+ segments: [],
206
+ laneCount: 0
207
+ };
208
+ const CHIP_INSET_H = 4;
203
209
  const FALLBACK_VISIBLE_COUNT = 3;
204
210
  const numericStyle = (value, fallback) => typeof value === "number" ? value : fallback;
205
- function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = true, disableMonthEventCellPress = false, isRTL = false, showSixWeeks = false, showTitle = true, showWeekdays = true, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection = false, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
211
+ function collectRowEvents(week, eventsByDay) {
212
+ const seen = /* @__PURE__ */ new Set();
213
+ const out = [];
214
+ for (const day of week) {
215
+ const list = eventsByDay.get(startOfDay(day).toISOString());
216
+ if (!list) continue;
217
+ for (const event of list) if (!seen.has(event)) {
218
+ seen.add(event);
219
+ out.push(event);
220
+ }
221
+ }
222
+ return out;
223
+ }
224
+ const pct = (n) => `${n}%`;
225
+ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = true, disableMonthEventCellPress = false, isRTL = false, showSixWeeks = false, showTitle = true, showWeekdays = true, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection = false, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
206
226
  const theme = useCalendarTheme();
207
227
  const slot = createSlots({
208
228
  classNames,
@@ -218,23 +238,35 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
218
238
  const [gridHeight, setGridHeight] = useState(0);
219
239
  const [hoveredKey, setHoveredKey] = useState(null);
220
240
  const [pressedKey, setPressedKey] = useState(null);
241
+ const [moreOpenFor, setMoreOpenFor] = useState(null);
221
242
  const weeks = useMemo(() => buildMonthWeeks(date, weekStartsOn, {
222
243
  showSixWeeks,
223
- isRTL
244
+ isRTL,
245
+ hiddenDays
224
246
  }), [
225
247
  date,
226
248
  weekStartsOn,
227
249
  isRTL,
228
- showSixWeeks
250
+ showSixWeeks,
251
+ hiddenDays
229
252
  ]);
230
253
  const weekdayLabels = useMemo(() => {
231
- const days = getWeekDays(date, weekStartsOn);
254
+ const days = filterHiddenDays(getWeekDays(date, weekStartsOn), hiddenDays);
232
255
  return isRTL ? days.reverse() : days;
233
256
  }, [
234
257
  date,
235
258
  weekStartsOn,
236
- isRTL
259
+ isRTL,
260
+ hiddenDays
237
261
  ]);
262
+ const chipMetrics = useMemo(() => {
263
+ const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
264
+ const chipHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3)) + CHIP_PADDING_V * 2;
265
+ return {
266
+ chipHeight,
267
+ chipRowHeight: chipHeight + CELL_ROW_GAP
268
+ };
269
+ }, [theme]);
238
270
  const capacity = useMemo(() => {
239
271
  if (maxVisibleEventCount != null) return {
240
272
  full: maxVisibleEventCount,
@@ -245,24 +277,28 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
245
277
  withMore: FALLBACK_VISIBLE_COUNT
246
278
  };
247
279
  const rowHeight = gridHeight / weeks.length;
248
- const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
249
- const chipRowHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3)) + CHIP_PADDING_V * 2 + CELL_ROW_GAP;
250
280
  const moreFontSize = numericStyle(theme.text.more.fontSize, 11);
251
281
  const moreRowHeight = Math.ceil(moreFontSize * 1.3) + CELL_ROW_GAP;
252
- return monthEventCapacity(rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT, chipRowHeight, moreRowHeight);
282
+ return monthEventCapacity(rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT, chipMetrics.chipRowHeight, moreRowHeight);
253
283
  }, [
254
284
  maxVisibleEventCount,
255
285
  gridHeight,
256
286
  weeks.length,
257
- theme
287
+ theme,
288
+ chipMetrics
258
289
  ]);
259
290
  const eventsByDay = useMemo(() => {
260
- const map = groupEventsByDay(events);
291
+ const map = groupEventsByDay(events.filter((event) => !isBackgroundEvent(event)));
261
292
  if (sortedMonthView) for (const list of map.values()) list.sort(compareDayEvents);
262
293
  return map;
263
294
  }, [events, sortedMonthView]);
264
295
  const showGrid = events.length > 0;
265
- const renderDay = (day) => {
296
+ const weekLayouts = useMemo(() => showGrid ? weeks.map((week) => layoutMonthWeek(week, collectRowEvents(week, eventsByDay))) : [], [
297
+ showGrid,
298
+ weeks,
299
+ eventsByDay
300
+ ]);
301
+ const renderDay = (day, dayCol, rowLayout, visibleLanes) => {
266
302
  const isCurrentMonth = isSameMonth(day, date);
267
303
  if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ jsx(View, { ...slot("day", {
268
304
  base: styles$3.dayCell,
@@ -283,8 +319,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
283
319
  maxDate,
284
320
  isDateDisabled
285
321
  });
286
- const visibleCount = monthVisibleCount(dayEvents.length, capacity);
287
- const hiddenCount = dayEvents.length - visibleCount;
322
+ const hiddenCount = rowLayout.segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >= visibleLanes).map((s) => s.event).length;
288
323
  const isFilledBadge = dayBadgeKind({ isSelected }, isHighlighted) !== "none";
289
324
  const hasBand = rangeBandKind({
290
325
  isInRange,
@@ -389,22 +424,19 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
389
424
  children: format(day, "d")
390
425
  })
391
426
  }),
392
- dayEvents.slice(0, visibleCount).map((event, index) => /* @__PURE__ */ jsx(View, {
393
- style: [styles$3.monthEvent, theme.containers.monthEvent],
394
- children: /* @__PURE__ */ jsx(RenderEventComponent, {
395
- event,
396
- mode: "month",
397
- isAllDay: isAllDayEvent(event),
398
- onPress: disableMonthEventCellPress ? () => {} : () => onPressEvent(event),
399
- onLongPress: disableMonthEventCellPress || !onLongPressEvent ? void 0 : () => onLongPressEvent(event)
400
- })
401
- }, keyExtractor(event, index))),
427
+ Array.from({ length: visibleLanes }, (_, i) => /* @__PURE__ */ jsx(View, { style: {
428
+ height: chipMetrics.chipHeight,
429
+ pointerEvents: "none"
430
+ } }, `lane-${i}`)),
402
431
  hiddenCount > 0 ? /* @__PURE__ */ jsx(Text, {
403
432
  ...slot("more", {
404
433
  base: styles$3.moreLabel,
405
434
  themed: [theme.text.more, { color: theme.colors.textMuted }]
406
435
  }),
407
- onPress: onPressMore ? () => onPressMore(dayEvents, day) : void 0,
436
+ onPress: onPressMore ? () => onPressMore(dayEvents, day) : () => setMoreOpenFor({
437
+ day,
438
+ events: dayEvents
439
+ }),
408
440
  accessibilityRole: "button",
409
441
  accessibilityLabel: `Show ${hiddenCount} more events`,
410
442
  allowFontScaling: false,
@@ -442,16 +474,93 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, week
442
474
  children: format(day, weekdayFormatToken(weekdayFormat), { locale })
443
475
  }, day.toISOString()))
444
476
  }) : null,
477
+ moreOpenFor ? /* @__PURE__ */ jsx(Modal, {
478
+ transparent: true,
479
+ animationType: "fade",
480
+ visible: true,
481
+ onRequestClose: () => setMoreOpenFor(null),
482
+ children: /* @__PURE__ */ jsx(Pressable, {
483
+ style: styles$3.moreBackdrop,
484
+ accessibilityLabel: "Close",
485
+ onPress: () => setMoreOpenFor(null),
486
+ children: /* @__PURE__ */ jsxs(Pressable, {
487
+ onPress: () => {},
488
+ ...slot("morePopover", {
489
+ base: styles$3.moreCard,
490
+ themed: {
491
+ backgroundColor: theme.colors.surface,
492
+ borderColor: theme.colors.gridLine
493
+ }
494
+ }),
495
+ children: [/* @__PURE__ */ jsx(Text, {
496
+ accessibilityRole: "header",
497
+ style: [styles$3.moreCardTitle, { color: theme.colors.text }],
498
+ allowFontScaling: false,
499
+ children: format(moreOpenFor.day, "EEEE, d LLLL yyyy", { locale })
500
+ }), /* @__PURE__ */ jsx(ScrollView, { children: moreOpenFor.events.map((event, index) => /* @__PURE__ */ jsx(View, {
501
+ style: styles$3.moreCardRow,
502
+ children: /* @__PURE__ */ jsx(RenderEventComponent, {
503
+ event,
504
+ mode: "month",
505
+ isAllDay: isAllDayEvent(event),
506
+ onPress: () => {
507
+ setMoreOpenFor(null);
508
+ onPressEvent(event);
509
+ }
510
+ })
511
+ }, keyExtractor(event, index))) })]
512
+ })
513
+ })
514
+ }) : null,
445
515
  /* @__PURE__ */ jsx(View, {
446
516
  ...slot("grid", { base: styles$3.container }),
447
517
  onLayout: handleLayout,
448
- children: weeks.map((week) => /* @__PURE__ */ createElement(View, {
449
- ...slot("week", {
450
- base: styles$3.weekRow,
451
- themed: theme.containers.weekRow
452
- }),
453
- key: week[0].toISOString()
454
- }, week.map((day) => renderDay(day))))
518
+ children: weeks.map((week, weekIndex) => {
519
+ const rowLayout = weekLayouts[weekIndex] ?? EMPTY_LAYOUT;
520
+ const visibleLanes = monthVisibleCount(rowLayout.laneCount, capacity);
521
+ const cols = week.length;
522
+ let firstVisCol = 0;
523
+ let lastVisCol = cols - 1;
524
+ if (showGrid && !showAdjacentMonths) {
525
+ const first = week.findIndex((d) => isSameMonth(d, date));
526
+ if (first !== -1) {
527
+ firstVisCol = first;
528
+ lastVisCol = cols - 1 - [...week].reverse().findIndex((d) => isSameMonth(d, date));
529
+ }
530
+ }
531
+ return /* @__PURE__ */ createElement(View, {
532
+ ...slot("week", {
533
+ base: styles$3.weekRow,
534
+ themed: theme.containers.weekRow
535
+ }),
536
+ key: week[0].toISOString()
537
+ }, week.map((day, dayCol) => renderDay(day, dayCol, rowLayout, visibleLanes)), showGrid ? /* @__PURE__ */ jsx(View, {
538
+ style: [StyleSheet.absoluteFill, { pointerEvents: "box-none" }],
539
+ children: rowLayout.segments.filter((seg) => seg.lane < visibleLanes).map((seg) => {
540
+ const startCol = Math.max(seg.startCol, firstVisCol);
541
+ const endCol = Math.min(seg.endCol, lastVisCol);
542
+ if (startCol > endCol) return null;
543
+ return /* @__PURE__ */ jsx(View, {
544
+ style: {
545
+ position: "absolute",
546
+ left: pct(startCol / cols * 100),
547
+ width: pct((endCol - startCol + 1) / cols * 100),
548
+ top: BADGE_AREA + seg.lane * chipMetrics.chipRowHeight,
549
+ height: chipMetrics.chipHeight,
550
+ paddingHorizontal: CHIP_INSET_H,
551
+ pointerEvents: "box-none"
552
+ },
553
+ children: /* @__PURE__ */ jsx(RenderEventComponent, {
554
+ event: seg.event,
555
+ mode: "month",
556
+ isAllDay: isAllDayEvent(seg.event),
557
+ onPress: disableMonthEventCellPress ? () => {} : () => onPressEvent(seg.event),
558
+ onLongPress: disableMonthEventCellPress || !onLongPressEvent ? void 0 : () => onLongPressEvent(seg.event)
559
+ })
560
+ }, `bar-${seg.event.start.toISOString()}:${seg.event.title}:${seg.lane}`);
561
+ })
562
+ }) : null);
563
+ })
455
564
  })
456
565
  ]
457
566
  });
@@ -520,14 +629,36 @@ const styles$3 = StyleSheet.create({
520
629
  moreLabel: {
521
630
  marginTop: 2,
522
631
  marginHorizontal: 4
523
- }
632
+ },
633
+ moreBackdrop: {
634
+ flex: 1,
635
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
636
+ alignItems: "center",
637
+ justifyContent: "center",
638
+ padding: 24
639
+ },
640
+ moreCard: {
641
+ width: "100%",
642
+ maxWidth: 360,
643
+ maxHeight: "60%",
644
+ borderRadius: 12,
645
+ borderWidth: StyleSheet.hairlineWidth,
646
+ padding: 12,
647
+ gap: 6
648
+ },
649
+ moreCardTitle: {
650
+ fontSize: 14,
651
+ fontWeight: "600",
652
+ marginBottom: 4
653
+ },
654
+ moreCardRow: { marginBottom: 4 }
524
655
  });
525
656
  //#endregion
526
657
  //#region src/components/MonthPager.tsx
527
658
  const isWeb$1 = Platform.OS === "web";
528
659
  const PAGE_WINDOW$1 = 60;
529
660
  const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
530
- function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
661
+ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
531
662
  const theme = useCalendarTheme();
532
663
  const slot = useMemo(() => createSlots({
533
664
  classNames,
@@ -593,12 +724,13 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, wee
593
724
  onChangeDate
594
725
  ]));
595
726
  const weekDays = useMemo(() => {
596
- const days = getWeekDays(anchor, weekStartsOn);
727
+ const days = filterHiddenDays(getWeekDays(anchor, weekStartsOn), hiddenDays);
597
728
  return isRTL ? days.reverse() : days;
598
729
  }, [
599
730
  anchor,
600
731
  weekStartsOn,
601
- isRTL
732
+ isRTL,
733
+ hiddenDays
602
734
  ]);
603
735
  const listExtraData = useMemo(() => ({
604
736
  events,
@@ -619,6 +751,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, wee
619
751
  showWeekdays: false,
620
752
  maxVisibleEventCount,
621
753
  weekStartsOn,
754
+ hiddenDays,
622
755
  locale,
623
756
  sortedMonthView,
624
757
  moreLabel,
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { A as darkTheme, C as RenderEventArgs, D as CalendarTheme, E as WeekdayFormat, M as mergeTheme, N as useCalendarTheme, O as CalendarThemeProvider, S as RenderEvent, T as WeekStartsOn, _ as EventAccessibilityLabeler, a as MonthPager, b as RecurrenceFrequency, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as EventAccessibilityLabelContext, h as CalendarMode, i as MonthListSlot, j as defaultTheme, k as PartialCalendarTheme, l as MonthViewSlot, m as CalendarEvent, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventKeyExtractor, w as TimeGridMode, x as RecurrenceRule, y as ICalendarEvent } from "./DefaultMonthEvent-zDj9dHEv.mjs";
1
+ import { A as PartialCalendarTheme, C as RenderEvent, D as WeekdayFormat, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, S as RecurrenceRule, T as TimeGridMode, _ as EventAccessibilityLabelContext, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarMode, h as CalendarEvent, i as MonthListSlot, j as darkTheme, k as CalendarThemeProvider, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabeler, w as RenderEventArgs, x as RecurrenceFrequency, y as EventKeyExtractor } from "./DefaultMonthEvent-Cm9DsHBK.mjs";
2
2
  import { Locale } from "date-fns";
3
- import { ComponentType, ReactElement } from "react";
3
+ import { ComponentType, ReactElement, ReactNode } from "react";
4
4
  import { SharedValue, useSharedValue } from "react-native-reanimated";
5
- import { CalendarEvent as CalendarEvent$1, DateRange, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useMonthGrid, weekdayFormatToken } from "@super-calendar/core";
5
+ import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, DateRange, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
6
6
  import { StyleProp, ViewStyle } from "react-native";
7
7
  //#region src/components/YearView.d.ts
8
8
  /**
@@ -17,6 +17,8 @@ type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
17
17
  /** Days holding at least one event get a dot. Omit for a plain year. */
18
18
  events?: CalendarEvent<T>[];
19
19
  weekStartsOn: WeekStartsOn;
20
+ /** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
21
+ hiddenDays?: number[];
20
22
  locale?: Locale;
21
23
  /** Highlight this date instead of the real "today". */
22
24
  activeDate?: Date;
@@ -30,7 +32,7 @@ type YearViewProps<T = unknown> = SlotStyleProps<YearViewSlot> & {
30
32
  /** Tap a month's title (e.g. to jump to that month's view). */
31
33
  onPressMonth?: (month: Date) => void;
32
34
  };
33
- declare function YearViewInner<T>({ date, events, weekStartsOn, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, classNames, styles: styleOverrides }: YearViewProps<T>): ReactElement;
35
+ declare function YearViewInner<T>({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth, onPressDay, onPressMonth, classNames, styles: styleOverrides }: YearViewProps<T>): ReactElement;
34
36
  /**
35
37
  * A year at a glance: the twelve months as compact mini grids, with today
36
38
  * highlighted and a dot under days that hold events. Tap a day or a month
@@ -106,7 +108,7 @@ type HourRenderer = (hour: number, ampm: boolean) => React.ReactNode;
106
108
  * `styles` map; their `className` reaches the element but needs a Tailwind
107
109
  * runtime that styles Animated components.
108
110
  */
109
- type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "columnHeaderDateText" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourLabel" | "gridLines" | "businessHours" | "weekendShade" | "daySeparator" | "event" | "nowIndicator" | "createGhost";
111
+ type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "columnHeaderDateText" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourLabel" | "gridLines" | "businessHours" | "backgroundEvent" | "weekendShade" | "daySeparator" | "event" | "nowIndicator" | "createGhost";
110
112
  /** Props for {@link TimeGrid}, the day/week timetable view. */
111
113
  type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
112
114
  mode: TimeGridMode;
@@ -118,6 +120,12 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
118
120
  * precedence over `numberOfDays`. Ignored by other modes.
119
121
  */
120
122
  weekEndsOn?: WeekStartsOn;
123
+ /** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
124
+ hiddenDays?: number[];
125
+ /** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
126
+ now?: Date;
127
+ /** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
128
+ timeZone?: string;
121
129
  date: Date;
122
130
  events: CalendarEvent<T>[];
123
131
  cellHeight: SharedValue<number>;
@@ -142,9 +150,19 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
142
150
  timeslots?: number;
143
151
  /** Show the all-day lane above the grid. Default true. */
144
152
  showAllDayEventCell?: boolean;
153
+ /** Tint Saturday/Sunday columns with the weekend background. Default true. Set
154
+ * false to treat weekends like any other day. */
155
+ highlightWeekends?: boolean;
145
156
  /** Per-date style merged onto each day column. */
146
157
  calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
147
158
  businessHours?: BusinessHours;
159
+ /**
160
+ * Render a closed-hours band's content yourself (a label, icon, pattern).
161
+ * The grid keeps positioning the band; when set, the themed tint is dropped
162
+ * and your output fills the band instead. Decorative only: the
163
+ * band stays non-interactive and hidden from assistive tech.
164
+ */
165
+ renderBusinessHours?: (band: BusinessHoursBand) => React.ReactNode;
148
166
  /** Show the ISO week number in the header gutter. Default false. */
149
167
  showWeekNumber?: boolean;
150
168
  /** Element rendered between the day header and the grid. */
@@ -183,6 +201,13 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
183
201
  * drag-to-move and drag-to-resize working while hiding the visible indicator.
184
202
  */
185
203
  showDragHandle?: boolean;
204
+ /** Allow moving events by default (per-event `startEditable` overrides). Default true. */
205
+ eventStartEditable?: boolean;
206
+ /** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
207
+ eventDurationEditable?: boolean;
208
+ /** Allow a dragged/resized event to overlap another (default true). Set false to
209
+ * reject a drop that would collide, snapping the event back. */
210
+ eventOverlap?: boolean;
186
211
  onPressEvent: (event: CalendarEvent<T>) => void;
187
212
  onLongPressEvent?: (event: CalendarEvent<T>) => void;
188
213
  /**
@@ -201,7 +226,7 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
201
226
  /** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
202
227
  renderHeader?: (days: Date[]) => React.ReactNode;
203
228
  };
204
- declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, calendarCellStyle, businessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
229
+ declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
205
230
  /**
206
231
  * The timetable view used in day, 3days, week, and custom modes: an
207
232
  * hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
@@ -304,6 +329,14 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
304
329
  disableMonthEventCellPress?: boolean;
305
330
  /** First day of the week. Sunday = 0 (default) … Saturday = 6. */
306
331
  weekStartsOn?: WeekStartsOn;
332
+ /** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
333
+ hiddenDays?: number[];
334
+ /**
335
+ * Fixed "now" instant for the current-time indicator (doesn't tick), e.g. a
336
+ * server-synced clock. Defaults to the device clock, shifted into `timeZone`
337
+ * when one is set so the line matches the displayed events.
338
+ */
339
+ now?: Date;
307
340
  /** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
308
341
  weekdayFormat?: WeekdayFormat$1;
309
342
  /** Number of day columns when `mode="custom"`. Ignored by other modes. Default 1. */
@@ -332,6 +365,13 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
332
365
  * whole day (closed). Omit for no shading.
333
366
  */
334
367
  businessHours?: BusinessHours;
368
+ /**
369
+ * Week/day grid only: render a closed-hours band's content yourself (a
370
+ * label, icon, pattern). The grid keeps positioning the band; when set, the
371
+ * themed tint is dropped and your output fills the band instead. Decorative only: the
372
+ * band stays non-interactive and hidden from assistive tech.
373
+ */
374
+ renderBusinessHours?: (band: BusinessHoursBand) => React.ReactNode;
335
375
  /** Stable key per event. Defaults to start-time + index. */
336
376
  keyExtractor?: EventKeyExtractor<T>;
337
377
  /** Partial theme merged over the defaults. */
@@ -353,6 +393,14 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
353
393
  * whole-day spans) are not shown on the time grid.
354
394
  */
355
395
  showAllDayEventCell?: boolean;
396
+ /** Tint weekend columns (default true). Set false to treat weekends normally. */
397
+ highlightWeekends?: boolean;
398
+ /** Allow moving events by default (per-event `startEditable` overrides). Default true. */
399
+ eventStartEditable?: boolean;
400
+ /** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
401
+ eventDurationEditable?: boolean;
402
+ /** Reject drags/resizes that would overlap another event (default true = allowed). */
403
+ eventOverlap?: boolean;
356
404
  /** Show the ISO week number in the week/day header gutter. Default false. */
357
405
  showWeekNumber?: boolean;
358
406
  /** Prefix for the week-number label (e.g. "W"). Default "W". */
@@ -446,7 +494,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
446
494
  * }
447
495
  * ```
448
496
  */
449
- declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
497
+ declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
450
498
  //#endregion
451
499
  //#region src/components/DefaultEvent.d.ts
452
500
  /**
@@ -492,6 +540,19 @@ interface ResourceTimelineProps<T = unknown> {
492
540
  orientation?: "horizontal" | "vertical";
493
541
  /** The resource lanes: rows when horizontal, columns when vertical. */
494
542
  resources: Resource[];
543
+ /**
544
+ * Cap the number of lanes shown at once; the rest sit on further pages. Pair
545
+ * with `resourcePage` and your own prev/next controls to page through them
546
+ * (like `date` drives the time axis). Omit to show every lane, sharing the
547
+ * available space.
548
+ */
549
+ resourcesPerPage?: number;
550
+ /**
551
+ * The 0-based page of lanes to show when `resourcesPerPage` is set (default
552
+ * 0, clamped to the last page). Controlled: update it from your own paging
553
+ * controls.
554
+ */
555
+ resourcePage?: number;
495
556
  /** Events; each is placed in the row named by `resourceId(event)`. */
496
557
  events: CalendarEvent$1<T>[];
497
558
  /** Read an event's resource id. Default: `event.resourceId`. */
@@ -520,11 +581,14 @@ interface ResourceTimelineProps<T = unknown> {
520
581
  */
521
582
  onLongPressEvent?: (event: CalendarEvent$1<T>) => void;
522
583
  /**
523
- * Enables drag-to-move and edge-resize along the time axis: long-press a bar to
524
- * move it, or drag its right edge to resize. Called with the proposed new
525
- * start/end; return `false` to reject the drop (it snaps back).
584
+ * Enables drag-to-move and edge-resize: long-press a bar to move it along the
585
+ * time axis or across lanes, or drag its trailing edge to resize. Called with
586
+ * the proposed new start/end and the lane the bar was dropped in (the original
587
+ * lane when it didn't cross); retarget the event's resource from it. Return
588
+ * `false` to reject the drop (it snaps back). Only visible lanes are drop
589
+ * targets (see `resourcesPerPage`).
526
590
  */
527
- onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
591
+ onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
528
592
  /** Tap empty lane space; called with the snapped time and the lane's resource. */
529
593
  onPressCell?: (at: Date, resource: Resource) => void;
530
594
  /**
@@ -542,12 +606,32 @@ interface ResourceTimelineProps<T = unknown> {
542
606
  * `businessHours` plus the lane's resource, so per-resource opening hours work
543
607
  * (return `null` for a fully closed lane). A date-only function is accepted.
544
608
  */
545
- businessHours?: (date: Date, resource: Resource) => {
546
- start: number;
547
- end: number;
548
- } | null;
609
+ businessHours?: (date: Date, resource: Resource) => BusinessHoursValue;
610
+ /**
611
+ * Render a closed-hours band's content yourself (a label, icon, pattern). The
612
+ * board keeps positioning the band; when set, the themed tint is dropped and
613
+ * your output fills the band instead. Receives the lane's resource. Decorative only: the
614
+ * band stays non-interactive and hidden from assistive tech.
615
+ */
616
+ renderBusinessHours?: (band: BusinessHoursBand$1 & {
617
+ resource: Resource;
618
+ }) => ReactNode;
619
+ /**
620
+ * Render each resource's header cell yourself (an avatar, a subtitle, a status
621
+ * dot). Receives the resource and its index; return the cell's content. The board
622
+ * keeps the header cell's sizing so columns stay aligned, so this replaces only
623
+ * the label content. Falls back to the resource title (or id). Applies to both
624
+ * orientations: the top header cells when vertical, the row labels when horizontal.
625
+ */
626
+ renderResourceHeader?: (resource: Resource, index: number) => ReactNode;
549
627
  /** Snap dragged events to this many minutes (default 15). */
550
628
  dragStepMinutes?: number;
629
+ /** Show the current-time line when `date` is today (default true). */
630
+ showNowIndicator?: boolean;
631
+ /** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
632
+ now?: Date;
633
+ /** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
634
+ timeZone?: string;
551
635
  }
552
636
  /**
553
637
  * A horizontal resource timeline: rows are resources (rooms, people, machines)
@@ -567,6 +651,6 @@ interface ResourceTimelineProps<T = unknown> {
567
651
  * />
568
652
  * ```
569
653
  */
570
- declare function ResourceTimeline<T = unknown>({ date, orientation, resources, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, dragStepMinutes }: ResourceTimelineProps<T>): ReactElement;
654
+ declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone }: ResourceTimelineProps<T>): ReactElement;
571
655
  //#endregion
572
- export { Agenda, type AgendaProps, type AgendaSlot, type BusinessHours, Calendar, type CalendarEvent, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultEvent, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, ResourceTimeline, type ResourceTimelineProps, type SlotDefault, type SlotStyleProps, TimeGrid, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, YearView, type YearViewProps, type YearViewSlot, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useMonthGrid, weekdayFormatToken };
656
+ export { Agenda, type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, Calendar, type CalendarEvent, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultEvent, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, ResourceTimeline, type ResourceTimelineProps, type SlotDefault, type SlotStyleProps, TimeGrid, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, YearView, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };