@super-calendar/native 2.1.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DefaultMonthEvent-C-BiOsXb.d.mts → DefaultMonthEvent-BlfDkmF5.d.mts} +58 -6
- package/dist/{DefaultMonthEvent-CcZLyfps.d.ts → DefaultMonthEvent-Cagj4aBo.d.ts} +58 -6
- package/dist/{MonthList-ege6HsEP.js → MonthList-DWAjW5R7.js} +95 -28
- package/dist/{MonthList-BKlLes2B.mjs → MonthList-DZx8rPle.mjs} +91 -30
- package/dist/index.d.mts +110 -6
- package/dist/index.d.ts +110 -6
- package/dist/index.js +474 -105
- package/dist/index.mjs +470 -108
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +2 -2
- package/src/components/Agenda.tsx +2 -2
- package/src/components/AllDayLane.tsx +11 -2
- package/src/components/Calendar.tsx +37 -3
- package/src/components/DefaultEvent.tsx +68 -47
- package/src/components/DefaultMonthEvent.tsx +11 -8
- package/src/components/MonthList.tsx +15 -2
- package/src/components/MonthPager.tsx +18 -10
- package/src/components/MonthView.tsx +39 -10
- package/src/components/ResourceTimeline.tsx +441 -0
- package/src/components/TimeGrid.tsx +43 -6
- package/src/index.tsx +10 -0
- package/src/theme.ts +62 -1
- package/src/types.ts +9 -0
- package/src/utils/withEventAccessibilityLabel.tsx +30 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addMonths, differenceInCalendarMonths, format, isSameMonth, startOfDay, startOfMonth } from "date-fns";
|
|
2
2
|
import { createContext, 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 } from "@super-calendar/core";
|
|
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
4
|
import { LegendList } from "@legendapp/list/react-native";
|
|
5
5
|
import { Platform, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -18,6 +18,10 @@ const defaultTheme = {
|
|
|
18
18
|
fontSize: 13,
|
|
19
19
|
fontWeight: "700"
|
|
20
20
|
},
|
|
21
|
+
monthTitle: {
|
|
22
|
+
fontSize: 17,
|
|
23
|
+
fontWeight: "700"
|
|
24
|
+
},
|
|
21
25
|
dateCell: {
|
|
22
26
|
fontSize: 13,
|
|
23
27
|
fontWeight: "700"
|
|
@@ -33,6 +37,23 @@ const defaultTheme = {
|
|
|
33
37
|
lineHeight: 16
|
|
34
38
|
}
|
|
35
39
|
},
|
|
40
|
+
containers: {
|
|
41
|
+
monthContainer: {},
|
|
42
|
+
weekdayHeader: {},
|
|
43
|
+
weekRow: {},
|
|
44
|
+
dayCell: {},
|
|
45
|
+
dayBadge: {},
|
|
46
|
+
monthEvent: {},
|
|
47
|
+
columnHeader: {},
|
|
48
|
+
timeGridEvent: {},
|
|
49
|
+
nowIndicator: {},
|
|
50
|
+
resourceRow: {},
|
|
51
|
+
resourceLabel: {},
|
|
52
|
+
agendaList: {},
|
|
53
|
+
agendaRow: {},
|
|
54
|
+
allDayLane: {},
|
|
55
|
+
allDayColumn: {}
|
|
56
|
+
},
|
|
36
57
|
todayBadgeRadius: 999,
|
|
37
58
|
rangeBandHeight: 22
|
|
38
59
|
};
|
|
@@ -44,6 +65,7 @@ const defaultTheme = {
|
|
|
44
65
|
const darkTheme = {
|
|
45
66
|
colors: darkColors,
|
|
46
67
|
text: defaultTheme.text,
|
|
68
|
+
containers: defaultTheme.containers,
|
|
47
69
|
todayBadgeRadius: defaultTheme.todayBadgeRadius,
|
|
48
70
|
rangeBandHeight: defaultTheme.rangeBandHeight
|
|
49
71
|
};
|
|
@@ -59,6 +81,10 @@ function mergeTheme(theme) {
|
|
|
59
81
|
...defaultTheme.text,
|
|
60
82
|
...theme.text
|
|
61
83
|
},
|
|
84
|
+
containers: {
|
|
85
|
+
...defaultTheme.containers,
|
|
86
|
+
...theme.containers
|
|
87
|
+
},
|
|
62
88
|
todayBadgeRadius: theme.todayBadgeRadius ?? defaultTheme.todayBadgeRadius,
|
|
63
89
|
rangeBandHeight: theme.rangeBandHeight ?? defaultTheme.rangeBandHeight
|
|
64
90
|
};
|
|
@@ -105,6 +131,29 @@ function useWebPagerKeys(enabled, onPage) {
|
|
|
105
131
|
}, [enabled, onPage]);
|
|
106
132
|
}
|
|
107
133
|
//#endregion
|
|
134
|
+
//#region src/utils/withEventAccessibilityLabel.tsx
|
|
135
|
+
/**
|
|
136
|
+
* Wrap an event renderer so it injects a consumer's `eventAccessibilityLabel`
|
|
137
|
+
* override into `RenderEventArgs.accessibilityLabel`. The built-in renderers use
|
|
138
|
+
* that string in place of their default label, and custom renderers can read it
|
|
139
|
+
* too. Returns the renderer unchanged when no override is set, so the common path
|
|
140
|
+
* pays nothing.
|
|
141
|
+
*/
|
|
142
|
+
function withEventAccessibilityLabel(renderEvent, labeler, ampm) {
|
|
143
|
+
if (!labeler) return renderEvent;
|
|
144
|
+
const Base = renderEvent;
|
|
145
|
+
return function LabeledEvent(props) {
|
|
146
|
+
return /* @__PURE__ */ jsx(Base, {
|
|
147
|
+
...props,
|
|
148
|
+
accessibilityLabel: labeler(props.event, {
|
|
149
|
+
mode: props.mode,
|
|
150
|
+
isAllDay: props.isAllDay ?? false,
|
|
151
|
+
ampm
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
108
157
|
//#region src/components/MonthView.tsx
|
|
109
158
|
const isWeb$2 = Platform.OS === "web";
|
|
110
159
|
const DAY_CELL_PADDING_TOP = 4;
|
|
@@ -114,7 +163,7 @@ const CELL_ROW_GAP = 2;
|
|
|
114
163
|
const CHIP_PADDING_V = 2;
|
|
115
164
|
const FALLBACK_VISIBLE_COUNT = 3;
|
|
116
165
|
const numericStyle = (value, fallback) => typeof value === "number" ? value : fallback;
|
|
117
|
-
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, 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, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter }) {
|
|
166
|
+
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 }) {
|
|
118
167
|
const theme = useCalendarTheme();
|
|
119
168
|
const selection = useCalendarSelection();
|
|
120
169
|
const selectedDates = selectedDatesProp ?? selection.selectedDates;
|
|
@@ -122,7 +171,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
122
171
|
const minDate = minDateProp ?? selection.minDate;
|
|
123
172
|
const maxDate = maxDateProp ?? selection.maxDate;
|
|
124
173
|
const isDateDisabled = isDateDisabledProp ?? selection.isDateDisabled;
|
|
125
|
-
const RenderEventComponent = renderEvent;
|
|
174
|
+
const RenderEventComponent = useMemo(() => withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, false), [renderEvent, eventAccessibilityLabel]);
|
|
126
175
|
const [gridHeight, setGridHeight] = useState(0);
|
|
127
176
|
const [hoveredKey, setHoveredKey] = useState(null);
|
|
128
177
|
const [pressedKey, setPressedKey] = useState(null);
|
|
@@ -172,11 +221,15 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
172
221
|
const showGrid = events.length > 0;
|
|
173
222
|
const renderDay = (day) => {
|
|
174
223
|
const isCurrentMonth = isSameMonth(day, date);
|
|
175
|
-
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ jsx(View, { style: [
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
224
|
+
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ jsx(View, { style: [
|
|
225
|
+
styles$3.dayCell,
|
|
226
|
+
showGrid && {
|
|
227
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
228
|
+
borderRightWidth: StyleSheet.hairlineWidth,
|
|
229
|
+
borderColor: theme.colors.gridLine
|
|
230
|
+
},
|
|
231
|
+
theme.containers.dayCell
|
|
232
|
+
] }, day.toISOString());
|
|
180
233
|
const dayEvents = eventsByDay.get(startOfDay(day).toISOString()) ?? [];
|
|
181
234
|
const isToday = getIsToday(day);
|
|
182
235
|
const isHighlighted = activeDate ? isSameCalendarDay(day, activeDate) : isToday;
|
|
@@ -213,7 +266,8 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
213
266
|
borderColor: theme.colors.gridLine
|
|
214
267
|
},
|
|
215
268
|
isWeekend(day) && { backgroundColor: theme.colors.weekendBackground },
|
|
216
|
-
calendarCellStyle?.(day)
|
|
269
|
+
calendarCellStyle?.(day),
|
|
270
|
+
theme.containers.dayCell
|
|
217
271
|
],
|
|
218
272
|
activeOpacity: showGrid ? .2 : 1,
|
|
219
273
|
...showGrid ? null : {
|
|
@@ -276,7 +330,8 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
276
330
|
backgroundColor: theme.colors.hoverBackground,
|
|
277
331
|
borderRadius: theme.todayBadgeRadius
|
|
278
332
|
},
|
|
279
|
-
!showGrid && pressedKey === dayKey && { opacity: .2 }
|
|
333
|
+
!showGrid && pressedKey === dayKey && { opacity: .2 },
|
|
334
|
+
theme.containers.dayBadge
|
|
280
335
|
],
|
|
281
336
|
children: /* @__PURE__ */ jsx(Text, {
|
|
282
337
|
style: [theme.text.dateCell, { color: dateColor }],
|
|
@@ -285,7 +340,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
285
340
|
})
|
|
286
341
|
}),
|
|
287
342
|
dayEvents.slice(0, visibleCount).map((event, index) => /* @__PURE__ */ jsx(View, {
|
|
288
|
-
style: styles$3.monthEvent,
|
|
343
|
+
style: [styles$3.monthEvent, theme.containers.monthEvent],
|
|
289
344
|
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
290
345
|
event,
|
|
291
346
|
mode: "month",
|
|
@@ -317,12 +372,16 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
317
372
|
style: styles$3.root,
|
|
318
373
|
children: [
|
|
319
374
|
showTitle ? /* @__PURE__ */ jsx(Text, {
|
|
320
|
-
style: [
|
|
375
|
+
style: [
|
|
376
|
+
styles$3.title,
|
|
377
|
+
theme.text.monthTitle,
|
|
378
|
+
{ color: theme.colors.text }
|
|
379
|
+
],
|
|
321
380
|
allowFontScaling: false,
|
|
322
381
|
children: format(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
323
382
|
}) : null,
|
|
324
383
|
showWeekdays ? /* @__PURE__ */ jsx(View, {
|
|
325
|
-
style: styles$3.weekdayHeader,
|
|
384
|
+
style: [styles$3.weekdayHeader, theme.containers.weekdayHeader],
|
|
326
385
|
children: weekdayLabels.map((day) => /* @__PURE__ */ jsx(Text, {
|
|
327
386
|
style: [
|
|
328
387
|
theme.text.weekday,
|
|
@@ -330,14 +389,14 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
330
389
|
{ color: theme.colors.textMuted }
|
|
331
390
|
],
|
|
332
391
|
allowFontScaling: false,
|
|
333
|
-
children: format(day,
|
|
392
|
+
children: format(day, weekdayFormatToken(weekdayFormat), { locale })
|
|
334
393
|
}, day.toISOString()))
|
|
335
394
|
}) : null,
|
|
336
395
|
/* @__PURE__ */ jsx(View, {
|
|
337
396
|
style: styles$3.container,
|
|
338
397
|
onLayout: handleLayout,
|
|
339
398
|
children: weeks.map((week) => /* @__PURE__ */ jsx(View, {
|
|
340
|
-
style: styles$3.weekRow,
|
|
399
|
+
style: [styles$3.weekRow, theme.containers.weekRow],
|
|
341
400
|
children: week.map((day) => renderDay(day))
|
|
342
401
|
}, week[0].toISOString()))
|
|
343
402
|
})
|
|
@@ -364,8 +423,6 @@ const MonthView = memo(MonthViewInner);
|
|
|
364
423
|
const styles$3 = StyleSheet.create({
|
|
365
424
|
root: { flex: 1 },
|
|
366
425
|
title: {
|
|
367
|
-
fontSize: 17,
|
|
368
|
-
fontWeight: "700",
|
|
369
426
|
paddingTop: 10,
|
|
370
427
|
paddingHorizontal: 14,
|
|
371
428
|
paddingBottom: 6
|
|
@@ -417,7 +474,7 @@ const styles$3 = StyleSheet.create({
|
|
|
417
474
|
const isWeb$1 = Platform.OS === "web";
|
|
418
475
|
const PAGE_WINDOW$1 = 60;
|
|
419
476
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
420
|
-
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth }) {
|
|
477
|
+
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 }) {
|
|
421
478
|
const theme = useCalendarTheme();
|
|
422
479
|
const { width, height } = useWindowDimensions();
|
|
423
480
|
const listRef = useRef(null);
|
|
@@ -545,15 +602,20 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, loc
|
|
|
545
602
|
]);
|
|
546
603
|
return /* @__PURE__ */ jsxs(View, {
|
|
547
604
|
ref: containerRef,
|
|
548
|
-
style: styles$2.container,
|
|
605
|
+
style: [styles$2.container, theme.containers.monthContainer],
|
|
549
606
|
children: [
|
|
550
607
|
/* @__PURE__ */ jsx(Text, {
|
|
551
|
-
style: [
|
|
608
|
+
style: [
|
|
609
|
+
styles$2.monthTitle,
|
|
610
|
+
theme.text.monthTitle,
|
|
611
|
+
{ color: theme.colors.text }
|
|
612
|
+
],
|
|
552
613
|
allowFontScaling: false,
|
|
553
614
|
children: format(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
554
615
|
}),
|
|
555
616
|
renderHeaderForMonthView ? renderHeaderForMonthView(weekDays) : /* @__PURE__ */ jsx(MonthWeekdayHeader, {
|
|
556
617
|
weekDays,
|
|
618
|
+
weekdayFormat,
|
|
557
619
|
locale
|
|
558
620
|
}),
|
|
559
621
|
/* @__PURE__ */ jsx(View, {
|
|
@@ -604,10 +666,10 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, loc
|
|
|
604
666
|
* ```
|
|
605
667
|
*/
|
|
606
668
|
const MonthPager = memo(MonthPagerInner);
|
|
607
|
-
const MonthWeekdayHeader = ({ weekDays, locale }) => {
|
|
669
|
+
const MonthWeekdayHeader = ({ weekDays, weekdayFormat = "short", locale }) => {
|
|
608
670
|
const theme = useCalendarTheme();
|
|
609
671
|
return /* @__PURE__ */ jsx(View, {
|
|
610
|
-
style: styles$2.weekdayHeader,
|
|
672
|
+
style: [styles$2.weekdayHeader, theme.containers.weekdayHeader],
|
|
611
673
|
children: weekDays.map((day) => /* @__PURE__ */ jsx(Text, {
|
|
612
674
|
style: [
|
|
613
675
|
theme.text.weekday,
|
|
@@ -615,7 +677,7 @@ const MonthWeekdayHeader = ({ weekDays, locale }) => {
|
|
|
615
677
|
{ color: theme.colors.textMuted }
|
|
616
678
|
],
|
|
617
679
|
allowFontScaling: false,
|
|
618
|
-
children: format(day,
|
|
680
|
+
children: format(day, weekdayFormatToken(weekdayFormat), { locale })
|
|
619
681
|
}, day.toISOString()))
|
|
620
682
|
});
|
|
621
683
|
};
|
|
@@ -625,8 +687,6 @@ const styles$2 = StyleSheet.create({
|
|
|
625
687
|
pagerList: { flex: 1 },
|
|
626
688
|
webNoScroll: { overflow: "hidden" },
|
|
627
689
|
monthTitle: {
|
|
628
|
-
fontSize: 17,
|
|
629
|
-
fontWeight: "700",
|
|
630
690
|
paddingTop: 10,
|
|
631
691
|
paddingHorizontal: 14,
|
|
632
692
|
paddingBottom: 6
|
|
@@ -649,7 +709,7 @@ const styles$2 = StyleSheet.create({
|
|
|
649
709
|
* default renderer for `MonthList`, so the `/picker` entry point stays free of
|
|
650
710
|
* Reanimated.
|
|
651
711
|
*/
|
|
652
|
-
function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, cellStyle, onPress, onLongPress }) {
|
|
712
|
+
function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }) {
|
|
653
713
|
const theme = useCalendarTheme();
|
|
654
714
|
const isAllDayEvent = isAllDay ?? false;
|
|
655
715
|
const timeLabel = eventTimeLabel({
|
|
@@ -662,7 +722,7 @@ function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = tru
|
|
|
662
722
|
allDayLabel
|
|
663
723
|
});
|
|
664
724
|
const ellipsizeMode = titleEllipsizeMode(ellipsizeTitle);
|
|
665
|
-
const accessibilityLabel = eventAccessibilityLabel({
|
|
725
|
+
const accessibilityLabel = accessibilityLabelProp ?? eventAccessibilityLabel({
|
|
666
726
|
title: event.title,
|
|
667
727
|
isAllDay: isAllDayEvent,
|
|
668
728
|
start: event.start,
|
|
@@ -731,7 +791,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
|
|
|
731
791
|
const NO_EVENTS = [];
|
|
732
792
|
const noop = () => {};
|
|
733
793
|
const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
|
|
734
|
-
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader }) {
|
|
794
|
+
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader }) {
|
|
735
795
|
const theme = useCalendarTheme();
|
|
736
796
|
const listRef = useRef(null);
|
|
737
797
|
const weekRowHeight = weekRowHeightProp ?? (events.length > 0 ? DEFAULT_EVENT_WEEK_ROW_HEIGHT : DEFAULT_WEEK_ROW_HEIGHT);
|
|
@@ -951,6 +1011,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekRowHeight:
|
|
|
951
1011
|
fillCellOnSelection,
|
|
952
1012
|
calendarCellStyle,
|
|
953
1013
|
renderEvent,
|
|
1014
|
+
eventAccessibilityLabel,
|
|
954
1015
|
keyExtractor,
|
|
955
1016
|
onPressDay: dragEnabled ? handlePressDay : onPressDay,
|
|
956
1017
|
onLongPressDay,
|
|
@@ -1022,7 +1083,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekRowHeight:
|
|
|
1022
1083
|
children: weekDays.map((day) => /* @__PURE__ */ jsx(Text, {
|
|
1023
1084
|
style: [styles.weekdayLabel, { color: theme.colors.textMuted }],
|
|
1024
1085
|
allowFontScaling: false,
|
|
1025
|
-
children: format(day,
|
|
1086
|
+
children: format(day, weekdayFormatToken(weekdayFormat), { locale })
|
|
1026
1087
|
}, day.toISOString()))
|
|
1027
1088
|
}), dragGesture && !isWeb ? /* @__PURE__ */ jsx(GestureDetector, {
|
|
1028
1089
|
gesture: dragGesture,
|
|
@@ -1086,4 +1147,4 @@ const styles = StyleSheet.create({
|
|
|
1086
1147
|
}
|
|
1087
1148
|
});
|
|
1088
1149
|
//#endregion
|
|
1089
|
-
export {
|
|
1150
|
+
export { withEventAccessibilityLabel as a, darkTheme as c, useCalendarTheme as d, MonthView as i, defaultTheme as l, DefaultMonthEvent as n, useWebPagerKeys as o, MonthPager as r, CalendarThemeProvider as s, MonthList as t, mergeTheme as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as defaultTheme, S as
|
|
1
|
+
import { C as CalendarThemeProvider, D as mergeTheme, E as defaultTheme, O as useCalendarTheme, S as CalendarTheme, T as darkTheme, _ as RenderEvent, a as MonthPagerProps, b as WeekStartsOn, c as BusinessHours, d as EventAccessibilityLabelContext, f as EventAccessibilityLabeler, g as RecurrenceRule, h as RecurrenceFrequency, i as MonthPager, l as CalendarEvent, m as ICalendarEvent, n as MonthList, o as MonthView, p as EventKeyExtractor, r as MonthListProps, s as MonthViewProps, t as DefaultMonthEvent, u as CalendarMode, v as RenderEventArgs, w as PartialCalendarTheme, x as WeekdayFormat, y as TimeGridMode } from "./DefaultMonthEvent-BlfDkmF5.mjs";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
3
|
import { ComponentType, ReactElement } from "react";
|
|
4
4
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, minutesIntoDay, nextDateRange, toZonedTime, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
5
|
+
import { CalendarEvent as CalendarEvent$1, DateRange, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, minutesIntoDay, nextDateRange, toZonedTime, useDateRange, useMonthGrid, weekdayFormatToken } from "@super-calendar/core";
|
|
6
6
|
import { StyleProp, ViewStyle } from "react-native";
|
|
7
7
|
|
|
8
8
|
//#region src/components/TimeGrid.d.ts
|
|
@@ -37,8 +37,15 @@ type TimeGridProps<T> = {
|
|
|
37
37
|
events: CalendarEvent<T>[];
|
|
38
38
|
cellHeight: SharedValue<number>; /** Initial per-hour row height in px; seeds scroll/zoom without reading the shared value during render. */
|
|
39
39
|
hourHeight?: number;
|
|
40
|
-
weekStartsOn: WeekStartsOn;
|
|
40
|
+
weekStartsOn: WeekStartsOn; /** Column-header weekday label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
41
|
+
weekdayFormat?: WeekdayFormat$1;
|
|
41
42
|
renderEvent: RenderEvent<T>;
|
|
43
|
+
/**
|
|
44
|
+
* Override the screen-reader label for each event. Receives the event and a
|
|
45
|
+
* `{ mode, isAllDay, ampm }` context; return the full text to announce. Defaults
|
|
46
|
+
* to the built-in title-and-time label.
|
|
47
|
+
*/
|
|
48
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
42
49
|
keyExtractor: EventKeyExtractor<T>;
|
|
43
50
|
scrollOffsetMinutes?: number;
|
|
44
51
|
hourColumnWidth?: number; /** Hide the left hour-axis column (lines stay, labels/gutter go). Default false. */
|
|
@@ -95,7 +102,9 @@ declare function TimeGridInner<T>({
|
|
|
95
102
|
cellHeight,
|
|
96
103
|
hourHeight,
|
|
97
104
|
weekStartsOn,
|
|
105
|
+
weekdayFormat,
|
|
98
106
|
renderEvent,
|
|
107
|
+
eventAccessibilityLabel,
|
|
99
108
|
keyExtractor,
|
|
100
109
|
scrollOffsetMinutes,
|
|
101
110
|
hourColumnWidth: hourColumnWidthProp,
|
|
@@ -213,7 +222,8 @@ type CalendarProps<T> = {
|
|
|
213
222
|
moreLabel?: string; /** Show dimmed adjacent-month days in the month grid. Default true. */
|
|
214
223
|
showAdjacentMonths?: boolean; /** Ignore taps on month-cell events (day taps still fire). Default false. */
|
|
215
224
|
disableMonthEventCellPress?: boolean; /** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
216
|
-
weekStartsOn?: WeekStartsOn; /**
|
|
225
|
+
weekStartsOn?: WeekStartsOn; /** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
226
|
+
weekdayFormat?: WeekdayFormat$1; /** Number of day columns when `mode="custom"`. Ignored by other modes. Default 1. */
|
|
217
227
|
numberOfDays?: number;
|
|
218
228
|
/**
|
|
219
229
|
* Last weekday of a `custom` partial-week view (0–6). When set, `custom` shows
|
|
@@ -221,7 +231,13 @@ type CalendarProps<T> = {
|
|
|
221
231
|
* precedence over `numberOfDays`. Ignored by other modes.
|
|
222
232
|
*/
|
|
223
233
|
weekEndsOn?: WeekStartsOn; /** Replace the built-in event box. Return a `flex: 1` element. */
|
|
224
|
-
renderEvent?: RenderEvent<T>;
|
|
234
|
+
renderEvent?: RenderEvent<T>;
|
|
235
|
+
/**
|
|
236
|
+
* Override the screen-reader label for each event. Receives the event and a
|
|
237
|
+
* `{ mode, isAllDay, ampm }` context; return the full text to announce. Applies
|
|
238
|
+
* across every view. Defaults to the built-in title-and-time label.
|
|
239
|
+
*/
|
|
240
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>; /** Per-event style merged onto the built-in event box (static or a function of the event). */
|
|
225
241
|
eventCellStyle?: StyleProp<ViewStyle> | ((event: CalendarEvent<T>) => StyleProp<ViewStyle>); /** Per-date style for month cells and week/day columns (e.g. shade specific dates). */
|
|
226
242
|
calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
|
|
227
243
|
/**
|
|
@@ -337,9 +353,11 @@ declare function Calendar<T>({
|
|
|
337
353
|
showAdjacentMonths,
|
|
338
354
|
disableMonthEventCellPress,
|
|
339
355
|
weekStartsOn,
|
|
356
|
+
weekdayFormat,
|
|
340
357
|
numberOfDays,
|
|
341
358
|
weekEndsOn,
|
|
342
359
|
renderEvent,
|
|
360
|
+
eventAccessibilityLabel,
|
|
343
361
|
eventCellStyle,
|
|
344
362
|
calendarCellStyle,
|
|
345
363
|
businessHours,
|
|
@@ -427,9 +445,95 @@ declare function DefaultEvent<T>({
|
|
|
427
445
|
showTime,
|
|
428
446
|
ellipsizeTitle,
|
|
429
447
|
allDayLabel,
|
|
448
|
+
accessibilityLabel: accessibilityLabelProp,
|
|
430
449
|
cellStyle,
|
|
431
450
|
onPress,
|
|
432
451
|
onLongPress
|
|
433
452
|
}: RenderEventArgs<T>): ReactElement;
|
|
434
453
|
//#endregion
|
|
435
|
-
|
|
454
|
+
//#region src/components/ResourceTimeline.d.ts
|
|
455
|
+
/** A schedulable lane (room, person, machine) events are grouped under. */
|
|
456
|
+
interface Resource {
|
|
457
|
+
/** Stable id events reference via their `resourceId`. */
|
|
458
|
+
id: string;
|
|
459
|
+
/** Row label; falls back to the id. */
|
|
460
|
+
title?: string;
|
|
461
|
+
}
|
|
462
|
+
/** Props passed to a custom resource-timeline event renderer. */
|
|
463
|
+
interface ResourceEventArgs<T = unknown> {
|
|
464
|
+
event: CalendarEvent$1<T>;
|
|
465
|
+
/** Pixel width of the event bar. */
|
|
466
|
+
width: number;
|
|
467
|
+
onPress: () => void;
|
|
468
|
+
}
|
|
469
|
+
/** Props for {@link ResourceTimeline}. */
|
|
470
|
+
interface ResourceTimelineProps<T = unknown> {
|
|
471
|
+
/** The day to lay out along the horizontal axis. */
|
|
472
|
+
date: Date;
|
|
473
|
+
/** The rows, top to bottom. */
|
|
474
|
+
resources: Resource[];
|
|
475
|
+
/** Events; each is placed in the row named by `resourceId(event)`. */
|
|
476
|
+
events: CalendarEvent$1<T>[];
|
|
477
|
+
/** Read an event's resource id. Default: `event.resourceId`. */
|
|
478
|
+
resourceId?: (event: CalendarEvent$1<T>) => string | undefined;
|
|
479
|
+
/** First hour shown (default 0). */
|
|
480
|
+
startHour?: number;
|
|
481
|
+
/** Last hour shown, exclusive (default 24). */
|
|
482
|
+
endHour?: number;
|
|
483
|
+
/** Pixels per hour along the axis (default 80). */
|
|
484
|
+
hourWidth?: number;
|
|
485
|
+
/** Height of each resource row in px (default 56). */
|
|
486
|
+
rowHeight?: number;
|
|
487
|
+
/** Width of the left resource-label column in px (default 140). */
|
|
488
|
+
labelWidth?: number;
|
|
489
|
+
/** 12-hour AM/PM axis labels (default false). */
|
|
490
|
+
ampm?: boolean;
|
|
491
|
+
/** Custom event renderer; falls back to the built-in bar. */
|
|
492
|
+
renderEvent?: ComponentType<ResourceEventArgs<T>>;
|
|
493
|
+
/** Tap an event. */
|
|
494
|
+
onPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
495
|
+
/**
|
|
496
|
+
* Enables drag-to-move and edge-resize along the time axis: long-press a bar to
|
|
497
|
+
* move it, or drag its right edge to resize. Called with the proposed new
|
|
498
|
+
* start/end; return `false` to reject the drop (it snaps back).
|
|
499
|
+
*/
|
|
500
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
501
|
+
/** Snap dragged events to this many minutes (default 15). */
|
|
502
|
+
dragStepMinutes?: number;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* A horizontal resource timeline: rows are resources (rooms, people, machines)
|
|
506
|
+
* and the x-axis is one day's hours. Events sit in their resource's row, and
|
|
507
|
+
* overlapping events in the same row stack into sub-lanes (via the shared
|
|
508
|
+
* `layoutDayEvents`). The grid scrolls horizontally when the axis is wider than
|
|
509
|
+
* the screen. Pass `onDragEvent` to enable long-press drag-to-move and edge
|
|
510
|
+
* resize along the time axis. Read the theme from context — wrap in
|
|
511
|
+
* `CalendarThemeProvider` (or render inside `<Calendar>`) to restyle.
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```tsx
|
|
515
|
+
* <ResourceTimeline
|
|
516
|
+
* date={new Date()}
|
|
517
|
+
* resources={[{ id: "a", title: "Room A" }, { id: "b", title: "Room B" }]}
|
|
518
|
+
* events={events} // each event carries a `resourceId`
|
|
519
|
+
* />
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
declare function ResourceTimeline<T = unknown>({
|
|
523
|
+
date,
|
|
524
|
+
resources,
|
|
525
|
+
events,
|
|
526
|
+
resourceId,
|
|
527
|
+
startHour,
|
|
528
|
+
endHour,
|
|
529
|
+
hourWidth,
|
|
530
|
+
rowHeight,
|
|
531
|
+
labelWidth,
|
|
532
|
+
ampm,
|
|
533
|
+
renderEvent,
|
|
534
|
+
onPressEvent,
|
|
535
|
+
onDragEvent,
|
|
536
|
+
dragStepMinutes
|
|
537
|
+
}: ResourceTimelineProps<T>): ReactElement;
|
|
538
|
+
//#endregion
|
|
539
|
+
export { Agenda, type AgendaProps, type BusinessHours, Calendar, type CalendarEvent, type CalendarMode, type CalendarProps, 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 ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type Resource, type ResourceEventArgs, ResourceTimeline, type ResourceTimelineProps, TimeGrid, type TimeGridMode, type TimeGridProps, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, mergeTheme, minutesIntoDay, nextDateRange, toZonedTime, useCalendarTheme, useDateRange, useMonthGrid, weekdayFormatToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as defaultTheme, S as
|
|
1
|
+
import { C as CalendarThemeProvider, D as mergeTheme, E as defaultTheme, O as useCalendarTheme, S as CalendarTheme, T as darkTheme, _ as RenderEvent, a as MonthPagerProps, b as WeekStartsOn, c as BusinessHours, d as EventAccessibilityLabelContext, f as EventAccessibilityLabeler, g as RecurrenceRule, h as RecurrenceFrequency, i as MonthPager, l as CalendarEvent, m as ICalendarEvent, n as MonthList, o as MonthView, p as EventKeyExtractor, r as MonthListProps, s as MonthViewProps, t as DefaultMonthEvent, u as CalendarMode, v as RenderEventArgs, w as PartialCalendarTheme, x as WeekdayFormat, y as TimeGridMode } from "./DefaultMonthEvent-Cagj4aBo.js";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
3
|
import { ComponentType, ReactElement } from "react";
|
|
4
4
|
import { StyleProp, ViewStyle } from "react-native";
|
|
5
5
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
6
|
-
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, minutesIntoDay, nextDateRange, toZonedTime, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
6
|
+
import { CalendarEvent as CalendarEvent$1, DateRange, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, PositionedEvent, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, buildMonthGrid, buildMonthWeeks, daySelectionState, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, minutesIntoDay, nextDateRange, toZonedTime, useDateRange, useMonthGrid, weekdayFormatToken } from "@super-calendar/core";
|
|
7
7
|
|
|
8
8
|
//#region src/components/TimeGrid.d.ts
|
|
9
9
|
/** Default height in pixels of one hour row on the time grid. */
|
|
@@ -37,8 +37,15 @@ type TimeGridProps<T> = {
|
|
|
37
37
|
events: CalendarEvent<T>[];
|
|
38
38
|
cellHeight: SharedValue<number>; /** Initial per-hour row height in px; seeds scroll/zoom without reading the shared value during render. */
|
|
39
39
|
hourHeight?: number;
|
|
40
|
-
weekStartsOn: WeekStartsOn;
|
|
40
|
+
weekStartsOn: WeekStartsOn; /** Column-header weekday label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
41
|
+
weekdayFormat?: WeekdayFormat$1;
|
|
41
42
|
renderEvent: RenderEvent<T>;
|
|
43
|
+
/**
|
|
44
|
+
* Override the screen-reader label for each event. Receives the event and a
|
|
45
|
+
* `{ mode, isAllDay, ampm }` context; return the full text to announce. Defaults
|
|
46
|
+
* to the built-in title-and-time label.
|
|
47
|
+
*/
|
|
48
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
42
49
|
keyExtractor: EventKeyExtractor<T>;
|
|
43
50
|
scrollOffsetMinutes?: number;
|
|
44
51
|
hourColumnWidth?: number; /** Hide the left hour-axis column (lines stay, labels/gutter go). Default false. */
|
|
@@ -95,7 +102,9 @@ declare function TimeGridInner<T>({
|
|
|
95
102
|
cellHeight,
|
|
96
103
|
hourHeight,
|
|
97
104
|
weekStartsOn,
|
|
105
|
+
weekdayFormat,
|
|
98
106
|
renderEvent,
|
|
107
|
+
eventAccessibilityLabel,
|
|
99
108
|
keyExtractor,
|
|
100
109
|
scrollOffsetMinutes,
|
|
101
110
|
hourColumnWidth: hourColumnWidthProp,
|
|
@@ -213,7 +222,8 @@ type CalendarProps<T> = {
|
|
|
213
222
|
moreLabel?: string; /** Show dimmed adjacent-month days in the month grid. Default true. */
|
|
214
223
|
showAdjacentMonths?: boolean; /** Ignore taps on month-cell events (day taps still fire). Default false. */
|
|
215
224
|
disableMonthEventCellPress?: boolean; /** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
216
|
-
weekStartsOn?: WeekStartsOn; /**
|
|
225
|
+
weekStartsOn?: WeekStartsOn; /** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
226
|
+
weekdayFormat?: WeekdayFormat$1; /** Number of day columns when `mode="custom"`. Ignored by other modes. Default 1. */
|
|
217
227
|
numberOfDays?: number;
|
|
218
228
|
/**
|
|
219
229
|
* Last weekday of a `custom` partial-week view (0–6). When set, `custom` shows
|
|
@@ -221,7 +231,13 @@ type CalendarProps<T> = {
|
|
|
221
231
|
* precedence over `numberOfDays`. Ignored by other modes.
|
|
222
232
|
*/
|
|
223
233
|
weekEndsOn?: WeekStartsOn; /** Replace the built-in event box. Return a `flex: 1` element. */
|
|
224
|
-
renderEvent?: RenderEvent<T>;
|
|
234
|
+
renderEvent?: RenderEvent<T>;
|
|
235
|
+
/**
|
|
236
|
+
* Override the screen-reader label for each event. Receives the event and a
|
|
237
|
+
* `{ mode, isAllDay, ampm }` context; return the full text to announce. Applies
|
|
238
|
+
* across every view. Defaults to the built-in title-and-time label.
|
|
239
|
+
*/
|
|
240
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>; /** Per-event style merged onto the built-in event box (static or a function of the event). */
|
|
225
241
|
eventCellStyle?: StyleProp<ViewStyle> | ((event: CalendarEvent<T>) => StyleProp<ViewStyle>); /** Per-date style for month cells and week/day columns (e.g. shade specific dates). */
|
|
226
242
|
calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
|
|
227
243
|
/**
|
|
@@ -337,9 +353,11 @@ declare function Calendar<T>({
|
|
|
337
353
|
showAdjacentMonths,
|
|
338
354
|
disableMonthEventCellPress,
|
|
339
355
|
weekStartsOn,
|
|
356
|
+
weekdayFormat,
|
|
340
357
|
numberOfDays,
|
|
341
358
|
weekEndsOn,
|
|
342
359
|
renderEvent,
|
|
360
|
+
eventAccessibilityLabel,
|
|
343
361
|
eventCellStyle,
|
|
344
362
|
calendarCellStyle,
|
|
345
363
|
businessHours,
|
|
@@ -427,9 +445,95 @@ declare function DefaultEvent<T>({
|
|
|
427
445
|
showTime,
|
|
428
446
|
ellipsizeTitle,
|
|
429
447
|
allDayLabel,
|
|
448
|
+
accessibilityLabel: accessibilityLabelProp,
|
|
430
449
|
cellStyle,
|
|
431
450
|
onPress,
|
|
432
451
|
onLongPress
|
|
433
452
|
}: RenderEventArgs<T>): ReactElement;
|
|
434
453
|
//#endregion
|
|
435
|
-
|
|
454
|
+
//#region src/components/ResourceTimeline.d.ts
|
|
455
|
+
/** A schedulable lane (room, person, machine) events are grouped under. */
|
|
456
|
+
interface Resource {
|
|
457
|
+
/** Stable id events reference via their `resourceId`. */
|
|
458
|
+
id: string;
|
|
459
|
+
/** Row label; falls back to the id. */
|
|
460
|
+
title?: string;
|
|
461
|
+
}
|
|
462
|
+
/** Props passed to a custom resource-timeline event renderer. */
|
|
463
|
+
interface ResourceEventArgs<T = unknown> {
|
|
464
|
+
event: CalendarEvent$1<T>;
|
|
465
|
+
/** Pixel width of the event bar. */
|
|
466
|
+
width: number;
|
|
467
|
+
onPress: () => void;
|
|
468
|
+
}
|
|
469
|
+
/** Props for {@link ResourceTimeline}. */
|
|
470
|
+
interface ResourceTimelineProps<T = unknown> {
|
|
471
|
+
/** The day to lay out along the horizontal axis. */
|
|
472
|
+
date: Date;
|
|
473
|
+
/** The rows, top to bottom. */
|
|
474
|
+
resources: Resource[];
|
|
475
|
+
/** Events; each is placed in the row named by `resourceId(event)`. */
|
|
476
|
+
events: CalendarEvent$1<T>[];
|
|
477
|
+
/** Read an event's resource id. Default: `event.resourceId`. */
|
|
478
|
+
resourceId?: (event: CalendarEvent$1<T>) => string | undefined;
|
|
479
|
+
/** First hour shown (default 0). */
|
|
480
|
+
startHour?: number;
|
|
481
|
+
/** Last hour shown, exclusive (default 24). */
|
|
482
|
+
endHour?: number;
|
|
483
|
+
/** Pixels per hour along the axis (default 80). */
|
|
484
|
+
hourWidth?: number;
|
|
485
|
+
/** Height of each resource row in px (default 56). */
|
|
486
|
+
rowHeight?: number;
|
|
487
|
+
/** Width of the left resource-label column in px (default 140). */
|
|
488
|
+
labelWidth?: number;
|
|
489
|
+
/** 12-hour AM/PM axis labels (default false). */
|
|
490
|
+
ampm?: boolean;
|
|
491
|
+
/** Custom event renderer; falls back to the built-in bar. */
|
|
492
|
+
renderEvent?: ComponentType<ResourceEventArgs<T>>;
|
|
493
|
+
/** Tap an event. */
|
|
494
|
+
onPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
495
|
+
/**
|
|
496
|
+
* Enables drag-to-move and edge-resize along the time axis: long-press a bar to
|
|
497
|
+
* move it, or drag its right edge to resize. Called with the proposed new
|
|
498
|
+
* start/end; return `false` to reject the drop (it snaps back).
|
|
499
|
+
*/
|
|
500
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
501
|
+
/** Snap dragged events to this many minutes (default 15). */
|
|
502
|
+
dragStepMinutes?: number;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* A horizontal resource timeline: rows are resources (rooms, people, machines)
|
|
506
|
+
* and the x-axis is one day's hours. Events sit in their resource's row, and
|
|
507
|
+
* overlapping events in the same row stack into sub-lanes (via the shared
|
|
508
|
+
* `layoutDayEvents`). The grid scrolls horizontally when the axis is wider than
|
|
509
|
+
* the screen. Pass `onDragEvent` to enable long-press drag-to-move and edge
|
|
510
|
+
* resize along the time axis. Read the theme from context — wrap in
|
|
511
|
+
* `CalendarThemeProvider` (or render inside `<Calendar>`) to restyle.
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```tsx
|
|
515
|
+
* <ResourceTimeline
|
|
516
|
+
* date={new Date()}
|
|
517
|
+
* resources={[{ id: "a", title: "Room A" }, { id: "b", title: "Room B" }]}
|
|
518
|
+
* events={events} // each event carries a `resourceId`
|
|
519
|
+
* />
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
declare function ResourceTimeline<T = unknown>({
|
|
523
|
+
date,
|
|
524
|
+
resources,
|
|
525
|
+
events,
|
|
526
|
+
resourceId,
|
|
527
|
+
startHour,
|
|
528
|
+
endHour,
|
|
529
|
+
hourWidth,
|
|
530
|
+
rowHeight,
|
|
531
|
+
labelWidth,
|
|
532
|
+
ampm,
|
|
533
|
+
renderEvent,
|
|
534
|
+
onPressEvent,
|
|
535
|
+
onDragEvent,
|
|
536
|
+
dragStepMinutes
|
|
537
|
+
}: ResourceTimelineProps<T>): ReactElement;
|
|
538
|
+
//#endregion
|
|
539
|
+
export { Agenda, type AgendaProps, type BusinessHours, Calendar, type CalendarEvent, type CalendarMode, type CalendarProps, 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 ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type Resource, type ResourceEventArgs, ResourceTimeline, type ResourceTimelineProps, TimeGrid, type TimeGridMode, type TimeGridProps, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, mergeTheme, minutesIntoDay, nextDateRange, toZonedTime, useCalendarTheme, useDateRange, useMonthGrid, weekdayFormatToken };
|