@super-calendar/native 2.1.5 → 2.3.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-BW6qy50X.d.ts} +62 -8
- package/dist/{DefaultMonthEvent-CcZLyfps.d.ts → DefaultMonthEvent-BbCMc60z.d.mts} +62 -8
- package/dist/{MonthList-BKlLes2B.mjs → MonthList-BidXJMfm.mjs} +98 -32
- package/dist/{MonthList-ege6HsEP.js → MonthList-CFXm7BK_.js} +102 -30
- package/dist/index.d.mts +110 -6
- package/dist/index.d.ts +110 -6
- package/dist/index.js +480 -113
- package/dist/index.mjs +476 -116
- 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 +54 -17
- package/src/index.tsx +10 -0
- package/src/theme.ts +74 -4
- 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";
|
|
@@ -11,13 +11,21 @@ const defaultTheme = {
|
|
|
11
11
|
colors: lightColors,
|
|
12
12
|
text: {
|
|
13
13
|
dayNumber: {
|
|
14
|
-
fontSize:
|
|
15
|
-
fontWeight: "
|
|
14
|
+
fontSize: 15,
|
|
15
|
+
fontWeight: "600"
|
|
16
|
+
},
|
|
17
|
+
columnHeaderWeekday: {
|
|
18
|
+
fontSize: 11,
|
|
19
|
+
fontWeight: "600"
|
|
16
20
|
},
|
|
17
21
|
weekday: {
|
|
18
22
|
fontSize: 13,
|
|
19
23
|
fontWeight: "700"
|
|
20
24
|
},
|
|
25
|
+
monthTitle: {
|
|
26
|
+
fontSize: 17,
|
|
27
|
+
fontWeight: "700"
|
|
28
|
+
},
|
|
21
29
|
dateCell: {
|
|
22
30
|
fontSize: 13,
|
|
23
31
|
fontWeight: "700"
|
|
@@ -33,6 +41,24 @@ const defaultTheme = {
|
|
|
33
41
|
lineHeight: 16
|
|
34
42
|
}
|
|
35
43
|
},
|
|
44
|
+
containers: {
|
|
45
|
+
monthContainer: {},
|
|
46
|
+
weekdayHeader: {},
|
|
47
|
+
weekRow: {},
|
|
48
|
+
dayCell: {},
|
|
49
|
+
dayBadge: {},
|
|
50
|
+
monthEvent: {},
|
|
51
|
+
columnHeader: {},
|
|
52
|
+
columnHeaderBadge: {},
|
|
53
|
+
timeGridEvent: {},
|
|
54
|
+
nowIndicator: {},
|
|
55
|
+
resourceRow: {},
|
|
56
|
+
resourceLabel: {},
|
|
57
|
+
agendaList: {},
|
|
58
|
+
agendaRow: {},
|
|
59
|
+
allDayLane: {},
|
|
60
|
+
allDayColumn: {}
|
|
61
|
+
},
|
|
36
62
|
todayBadgeRadius: 999,
|
|
37
63
|
rangeBandHeight: 22
|
|
38
64
|
};
|
|
@@ -44,6 +70,7 @@ const defaultTheme = {
|
|
|
44
70
|
const darkTheme = {
|
|
45
71
|
colors: darkColors,
|
|
46
72
|
text: defaultTheme.text,
|
|
73
|
+
containers: defaultTheme.containers,
|
|
47
74
|
todayBadgeRadius: defaultTheme.todayBadgeRadius,
|
|
48
75
|
rangeBandHeight: defaultTheme.rangeBandHeight
|
|
49
76
|
};
|
|
@@ -59,6 +86,10 @@ function mergeTheme(theme) {
|
|
|
59
86
|
...defaultTheme.text,
|
|
60
87
|
...theme.text
|
|
61
88
|
},
|
|
89
|
+
containers: {
|
|
90
|
+
...defaultTheme.containers,
|
|
91
|
+
...theme.containers
|
|
92
|
+
},
|
|
62
93
|
todayBadgeRadius: theme.todayBadgeRadius ?? defaultTheme.todayBadgeRadius,
|
|
63
94
|
rangeBandHeight: theme.rangeBandHeight ?? defaultTheme.rangeBandHeight
|
|
64
95
|
};
|
|
@@ -105,6 +136,29 @@ function useWebPagerKeys(enabled, onPage) {
|
|
|
105
136
|
}, [enabled, onPage]);
|
|
106
137
|
}
|
|
107
138
|
//#endregion
|
|
139
|
+
//#region src/utils/withEventAccessibilityLabel.tsx
|
|
140
|
+
/**
|
|
141
|
+
* Wrap an event renderer so it injects a consumer's `eventAccessibilityLabel`
|
|
142
|
+
* override into `RenderEventArgs.accessibilityLabel`. The built-in renderers use
|
|
143
|
+
* that string in place of their default label, and custom renderers can read it
|
|
144
|
+
* too. Returns the renderer unchanged when no override is set, so the common path
|
|
145
|
+
* pays nothing.
|
|
146
|
+
*/
|
|
147
|
+
function withEventAccessibilityLabel(renderEvent, labeler, ampm) {
|
|
148
|
+
if (!labeler) return renderEvent;
|
|
149
|
+
const Base = renderEvent;
|
|
150
|
+
return function LabeledEvent(props) {
|
|
151
|
+
return /* @__PURE__ */ jsx(Base, {
|
|
152
|
+
...props,
|
|
153
|
+
accessibilityLabel: labeler(props.event, {
|
|
154
|
+
mode: props.mode,
|
|
155
|
+
isAllDay: props.isAllDay ?? false,
|
|
156
|
+
ampm
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
108
162
|
//#region src/components/MonthView.tsx
|
|
109
163
|
const isWeb$2 = Platform.OS === "web";
|
|
110
164
|
const DAY_CELL_PADDING_TOP = 4;
|
|
@@ -114,7 +168,7 @@ const CELL_ROW_GAP = 2;
|
|
|
114
168
|
const CHIP_PADDING_V = 2;
|
|
115
169
|
const FALLBACK_VISIBLE_COUNT = 3;
|
|
116
170
|
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 }) {
|
|
171
|
+
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
172
|
const theme = useCalendarTheme();
|
|
119
173
|
const selection = useCalendarSelection();
|
|
120
174
|
const selectedDates = selectedDatesProp ?? selection.selectedDates;
|
|
@@ -122,7 +176,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
122
176
|
const minDate = minDateProp ?? selection.minDate;
|
|
123
177
|
const maxDate = maxDateProp ?? selection.maxDate;
|
|
124
178
|
const isDateDisabled = isDateDisabledProp ?? selection.isDateDisabled;
|
|
125
|
-
const RenderEventComponent = renderEvent;
|
|
179
|
+
const RenderEventComponent = useMemo(() => withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, false), [renderEvent, eventAccessibilityLabel]);
|
|
126
180
|
const [gridHeight, setGridHeight] = useState(0);
|
|
127
181
|
const [hoveredKey, setHoveredKey] = useState(null);
|
|
128
182
|
const [pressedKey, setPressedKey] = useState(null);
|
|
@@ -172,11 +226,15 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
172
226
|
const showGrid = events.length > 0;
|
|
173
227
|
const renderDay = (day) => {
|
|
174
228
|
const isCurrentMonth = isSameMonth(day, date);
|
|
175
|
-
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ jsx(View, { style: [
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
229
|
+
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ jsx(View, { style: [
|
|
230
|
+
styles$3.dayCell,
|
|
231
|
+
showGrid && {
|
|
232
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
233
|
+
borderRightWidth: StyleSheet.hairlineWidth,
|
|
234
|
+
borderColor: theme.colors.gridLine
|
|
235
|
+
},
|
|
236
|
+
theme.containers.dayCell
|
|
237
|
+
] }, day.toISOString());
|
|
180
238
|
const dayEvents = eventsByDay.get(startOfDay(day).toISOString()) ?? [];
|
|
181
239
|
const isToday = getIsToday(day);
|
|
182
240
|
const isHighlighted = activeDate ? isSameCalendarDay(day, activeDate) : isToday;
|
|
@@ -213,7 +271,8 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
213
271
|
borderColor: theme.colors.gridLine
|
|
214
272
|
},
|
|
215
273
|
isWeekend(day) && { backgroundColor: theme.colors.weekendBackground },
|
|
216
|
-
calendarCellStyle?.(day)
|
|
274
|
+
calendarCellStyle?.(day),
|
|
275
|
+
theme.containers.dayCell
|
|
217
276
|
],
|
|
218
277
|
activeOpacity: showGrid ? .2 : 1,
|
|
219
278
|
...showGrid ? null : {
|
|
@@ -276,7 +335,8 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
276
335
|
backgroundColor: theme.colors.hoverBackground,
|
|
277
336
|
borderRadius: theme.todayBadgeRadius
|
|
278
337
|
},
|
|
279
|
-
!showGrid && pressedKey === dayKey && { opacity: .2 }
|
|
338
|
+
!showGrid && pressedKey === dayKey && { opacity: .2 },
|
|
339
|
+
theme.containers.dayBadge
|
|
280
340
|
],
|
|
281
341
|
children: /* @__PURE__ */ jsx(Text, {
|
|
282
342
|
style: [theme.text.dateCell, { color: dateColor }],
|
|
@@ -285,7 +345,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
285
345
|
})
|
|
286
346
|
}),
|
|
287
347
|
dayEvents.slice(0, visibleCount).map((event, index) => /* @__PURE__ */ jsx(View, {
|
|
288
|
-
style: styles$3.monthEvent,
|
|
348
|
+
style: [styles$3.monthEvent, theme.containers.monthEvent],
|
|
289
349
|
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
290
350
|
event,
|
|
291
351
|
mode: "month",
|
|
@@ -317,12 +377,16 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
317
377
|
style: styles$3.root,
|
|
318
378
|
children: [
|
|
319
379
|
showTitle ? /* @__PURE__ */ jsx(Text, {
|
|
320
|
-
style: [
|
|
380
|
+
style: [
|
|
381
|
+
styles$3.title,
|
|
382
|
+
theme.text.monthTitle,
|
|
383
|
+
{ color: theme.colors.text }
|
|
384
|
+
],
|
|
321
385
|
allowFontScaling: false,
|
|
322
386
|
children: format(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
323
387
|
}) : null,
|
|
324
388
|
showWeekdays ? /* @__PURE__ */ jsx(View, {
|
|
325
|
-
style: styles$3.weekdayHeader,
|
|
389
|
+
style: [styles$3.weekdayHeader, theme.containers.weekdayHeader],
|
|
326
390
|
children: weekdayLabels.map((day) => /* @__PURE__ */ jsx(Text, {
|
|
327
391
|
style: [
|
|
328
392
|
theme.text.weekday,
|
|
@@ -330,14 +394,14 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
330
394
|
{ color: theme.colors.textMuted }
|
|
331
395
|
],
|
|
332
396
|
allowFontScaling: false,
|
|
333
|
-
children: format(day,
|
|
397
|
+
children: format(day, weekdayFormatToken(weekdayFormat), { locale })
|
|
334
398
|
}, day.toISOString()))
|
|
335
399
|
}) : null,
|
|
336
400
|
/* @__PURE__ */ jsx(View, {
|
|
337
401
|
style: styles$3.container,
|
|
338
402
|
onLayout: handleLayout,
|
|
339
403
|
children: weeks.map((week) => /* @__PURE__ */ jsx(View, {
|
|
340
|
-
style: styles$3.weekRow,
|
|
404
|
+
style: [styles$3.weekRow, theme.containers.weekRow],
|
|
341
405
|
children: week.map((day) => renderDay(day))
|
|
342
406
|
}, week[0].toISOString()))
|
|
343
407
|
})
|
|
@@ -364,8 +428,6 @@ const MonthView = memo(MonthViewInner);
|
|
|
364
428
|
const styles$3 = StyleSheet.create({
|
|
365
429
|
root: { flex: 1 },
|
|
366
430
|
title: {
|
|
367
|
-
fontSize: 17,
|
|
368
|
-
fontWeight: "700",
|
|
369
431
|
paddingTop: 10,
|
|
370
432
|
paddingHorizontal: 14,
|
|
371
433
|
paddingBottom: 6
|
|
@@ -417,7 +479,7 @@ const styles$3 = StyleSheet.create({
|
|
|
417
479
|
const isWeb$1 = Platform.OS === "web";
|
|
418
480
|
const PAGE_WINDOW$1 = 60;
|
|
419
481
|
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 }) {
|
|
482
|
+
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
483
|
const theme = useCalendarTheme();
|
|
422
484
|
const { width, height } = useWindowDimensions();
|
|
423
485
|
const listRef = useRef(null);
|
|
@@ -545,15 +607,20 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, loc
|
|
|
545
607
|
]);
|
|
546
608
|
return /* @__PURE__ */ jsxs(View, {
|
|
547
609
|
ref: containerRef,
|
|
548
|
-
style: styles$2.container,
|
|
610
|
+
style: [styles$2.container, theme.containers.monthContainer],
|
|
549
611
|
children: [
|
|
550
612
|
/* @__PURE__ */ jsx(Text, {
|
|
551
|
-
style: [
|
|
613
|
+
style: [
|
|
614
|
+
styles$2.monthTitle,
|
|
615
|
+
theme.text.monthTitle,
|
|
616
|
+
{ color: theme.colors.text }
|
|
617
|
+
],
|
|
552
618
|
allowFontScaling: false,
|
|
553
619
|
children: format(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
554
620
|
}),
|
|
555
621
|
renderHeaderForMonthView ? renderHeaderForMonthView(weekDays) : /* @__PURE__ */ jsx(MonthWeekdayHeader, {
|
|
556
622
|
weekDays,
|
|
623
|
+
weekdayFormat,
|
|
557
624
|
locale
|
|
558
625
|
}),
|
|
559
626
|
/* @__PURE__ */ jsx(View, {
|
|
@@ -604,10 +671,10 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, loc
|
|
|
604
671
|
* ```
|
|
605
672
|
*/
|
|
606
673
|
const MonthPager = memo(MonthPagerInner);
|
|
607
|
-
const MonthWeekdayHeader = ({ weekDays, locale }) => {
|
|
674
|
+
const MonthWeekdayHeader = ({ weekDays, weekdayFormat = "short", locale }) => {
|
|
608
675
|
const theme = useCalendarTheme();
|
|
609
676
|
return /* @__PURE__ */ jsx(View, {
|
|
610
|
-
style: styles$2.weekdayHeader,
|
|
677
|
+
style: [styles$2.weekdayHeader, theme.containers.weekdayHeader],
|
|
611
678
|
children: weekDays.map((day) => /* @__PURE__ */ jsx(Text, {
|
|
612
679
|
style: [
|
|
613
680
|
theme.text.weekday,
|
|
@@ -615,7 +682,7 @@ const MonthWeekdayHeader = ({ weekDays, locale }) => {
|
|
|
615
682
|
{ color: theme.colors.textMuted }
|
|
616
683
|
],
|
|
617
684
|
allowFontScaling: false,
|
|
618
|
-
children: format(day,
|
|
685
|
+
children: format(day, weekdayFormatToken(weekdayFormat), { locale })
|
|
619
686
|
}, day.toISOString()))
|
|
620
687
|
});
|
|
621
688
|
};
|
|
@@ -625,8 +692,6 @@ const styles$2 = StyleSheet.create({
|
|
|
625
692
|
pagerList: { flex: 1 },
|
|
626
693
|
webNoScroll: { overflow: "hidden" },
|
|
627
694
|
monthTitle: {
|
|
628
|
-
fontSize: 17,
|
|
629
|
-
fontWeight: "700",
|
|
630
695
|
paddingTop: 10,
|
|
631
696
|
paddingHorizontal: 14,
|
|
632
697
|
paddingBottom: 6
|
|
@@ -649,7 +714,7 @@ const styles$2 = StyleSheet.create({
|
|
|
649
714
|
* default renderer for `MonthList`, so the `/picker` entry point stays free of
|
|
650
715
|
* Reanimated.
|
|
651
716
|
*/
|
|
652
|
-
function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, cellStyle, onPress, onLongPress }) {
|
|
717
|
+
function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }) {
|
|
653
718
|
const theme = useCalendarTheme();
|
|
654
719
|
const isAllDayEvent = isAllDay ?? false;
|
|
655
720
|
const timeLabel = eventTimeLabel({
|
|
@@ -662,7 +727,7 @@ function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = tru
|
|
|
662
727
|
allDayLabel
|
|
663
728
|
});
|
|
664
729
|
const ellipsizeMode = titleEllipsizeMode(ellipsizeTitle);
|
|
665
|
-
const accessibilityLabel = eventAccessibilityLabel({
|
|
730
|
+
const accessibilityLabel = accessibilityLabelProp ?? eventAccessibilityLabel({
|
|
666
731
|
title: event.title,
|
|
667
732
|
isAllDay: isAllDayEvent,
|
|
668
733
|
start: event.start,
|
|
@@ -731,7 +796,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
|
|
|
731
796
|
const NO_EVENTS = [];
|
|
732
797
|
const noop = () => {};
|
|
733
798
|
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 }) {
|
|
799
|
+
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
800
|
const theme = useCalendarTheme();
|
|
736
801
|
const listRef = useRef(null);
|
|
737
802
|
const weekRowHeight = weekRowHeightProp ?? (events.length > 0 ? DEFAULT_EVENT_WEEK_ROW_HEIGHT : DEFAULT_WEEK_ROW_HEIGHT);
|
|
@@ -951,6 +1016,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekRowHeight:
|
|
|
951
1016
|
fillCellOnSelection,
|
|
952
1017
|
calendarCellStyle,
|
|
953
1018
|
renderEvent,
|
|
1019
|
+
eventAccessibilityLabel,
|
|
954
1020
|
keyExtractor,
|
|
955
1021
|
onPressDay: dragEnabled ? handlePressDay : onPressDay,
|
|
956
1022
|
onLongPressDay,
|
|
@@ -1022,7 +1088,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekRowHeight:
|
|
|
1022
1088
|
children: weekDays.map((day) => /* @__PURE__ */ jsx(Text, {
|
|
1023
1089
|
style: [styles.weekdayLabel, { color: theme.colors.textMuted }],
|
|
1024
1090
|
allowFontScaling: false,
|
|
1025
|
-
children: format(day,
|
|
1091
|
+
children: format(day, weekdayFormatToken(weekdayFormat), { locale })
|
|
1026
1092
|
}, day.toISOString()))
|
|
1027
1093
|
}), dragGesture && !isWeb ? /* @__PURE__ */ jsx(GestureDetector, {
|
|
1028
1094
|
gesture: dragGesture,
|
|
@@ -1086,4 +1152,4 @@ const styles = StyleSheet.create({
|
|
|
1086
1152
|
}
|
|
1087
1153
|
});
|
|
1088
1154
|
//#endregion
|
|
1089
|
-
export {
|
|
1155
|
+
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 };
|
|
@@ -11,13 +11,21 @@ const defaultTheme = {
|
|
|
11
11
|
colors: _super_calendar_core.lightColors,
|
|
12
12
|
text: {
|
|
13
13
|
dayNumber: {
|
|
14
|
-
fontSize:
|
|
15
|
-
fontWeight: "
|
|
14
|
+
fontSize: 15,
|
|
15
|
+
fontWeight: "600"
|
|
16
|
+
},
|
|
17
|
+
columnHeaderWeekday: {
|
|
18
|
+
fontSize: 11,
|
|
19
|
+
fontWeight: "600"
|
|
16
20
|
},
|
|
17
21
|
weekday: {
|
|
18
22
|
fontSize: 13,
|
|
19
23
|
fontWeight: "700"
|
|
20
24
|
},
|
|
25
|
+
monthTitle: {
|
|
26
|
+
fontSize: 17,
|
|
27
|
+
fontWeight: "700"
|
|
28
|
+
},
|
|
21
29
|
dateCell: {
|
|
22
30
|
fontSize: 13,
|
|
23
31
|
fontWeight: "700"
|
|
@@ -33,6 +41,24 @@ const defaultTheme = {
|
|
|
33
41
|
lineHeight: 16
|
|
34
42
|
}
|
|
35
43
|
},
|
|
44
|
+
containers: {
|
|
45
|
+
monthContainer: {},
|
|
46
|
+
weekdayHeader: {},
|
|
47
|
+
weekRow: {},
|
|
48
|
+
dayCell: {},
|
|
49
|
+
dayBadge: {},
|
|
50
|
+
monthEvent: {},
|
|
51
|
+
columnHeader: {},
|
|
52
|
+
columnHeaderBadge: {},
|
|
53
|
+
timeGridEvent: {},
|
|
54
|
+
nowIndicator: {},
|
|
55
|
+
resourceRow: {},
|
|
56
|
+
resourceLabel: {},
|
|
57
|
+
agendaList: {},
|
|
58
|
+
agendaRow: {},
|
|
59
|
+
allDayLane: {},
|
|
60
|
+
allDayColumn: {}
|
|
61
|
+
},
|
|
36
62
|
todayBadgeRadius: 999,
|
|
37
63
|
rangeBandHeight: 22
|
|
38
64
|
};
|
|
@@ -44,6 +70,7 @@ const defaultTheme = {
|
|
|
44
70
|
const darkTheme = {
|
|
45
71
|
colors: _super_calendar_core.darkColors,
|
|
46
72
|
text: defaultTheme.text,
|
|
73
|
+
containers: defaultTheme.containers,
|
|
47
74
|
todayBadgeRadius: defaultTheme.todayBadgeRadius,
|
|
48
75
|
rangeBandHeight: defaultTheme.rangeBandHeight
|
|
49
76
|
};
|
|
@@ -59,6 +86,10 @@ function mergeTheme(theme) {
|
|
|
59
86
|
...defaultTheme.text,
|
|
60
87
|
...theme.text
|
|
61
88
|
},
|
|
89
|
+
containers: {
|
|
90
|
+
...defaultTheme.containers,
|
|
91
|
+
...theme.containers
|
|
92
|
+
},
|
|
62
93
|
todayBadgeRadius: theme.todayBadgeRadius ?? defaultTheme.todayBadgeRadius,
|
|
63
94
|
rangeBandHeight: theme.rangeBandHeight ?? defaultTheme.rangeBandHeight
|
|
64
95
|
};
|
|
@@ -105,6 +136,29 @@ function useWebPagerKeys(enabled, onPage) {
|
|
|
105
136
|
}, [enabled, onPage]);
|
|
106
137
|
}
|
|
107
138
|
//#endregion
|
|
139
|
+
//#region src/utils/withEventAccessibilityLabel.tsx
|
|
140
|
+
/**
|
|
141
|
+
* Wrap an event renderer so it injects a consumer's `eventAccessibilityLabel`
|
|
142
|
+
* override into `RenderEventArgs.accessibilityLabel`. The built-in renderers use
|
|
143
|
+
* that string in place of their default label, and custom renderers can read it
|
|
144
|
+
* too. Returns the renderer unchanged when no override is set, so the common path
|
|
145
|
+
* pays nothing.
|
|
146
|
+
*/
|
|
147
|
+
function withEventAccessibilityLabel(renderEvent, labeler, ampm) {
|
|
148
|
+
if (!labeler) return renderEvent;
|
|
149
|
+
const Base = renderEvent;
|
|
150
|
+
return function LabeledEvent(props) {
|
|
151
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Base, {
|
|
152
|
+
...props,
|
|
153
|
+
accessibilityLabel: labeler(props.event, {
|
|
154
|
+
mode: props.mode,
|
|
155
|
+
isAllDay: props.isAllDay ?? false,
|
|
156
|
+
ampm
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
108
162
|
//#region src/components/MonthView.tsx
|
|
109
163
|
const isWeb$2 = react_native.Platform.OS === "web";
|
|
110
164
|
const DAY_CELL_PADDING_TOP = 4;
|
|
@@ -114,7 +168,7 @@ const CELL_ROW_GAP = 2;
|
|
|
114
168
|
const CHIP_PADDING_V = 2;
|
|
115
169
|
const FALLBACK_VISIBLE_COUNT = 3;
|
|
116
170
|
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 }) {
|
|
171
|
+
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
172
|
const theme = useCalendarTheme();
|
|
119
173
|
const selection = (0, _super_calendar_core.useCalendarSelection)();
|
|
120
174
|
const selectedDates = selectedDatesProp ?? selection.selectedDates;
|
|
@@ -122,7 +176,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
122
176
|
const minDate = minDateProp ?? selection.minDate;
|
|
123
177
|
const maxDate = maxDateProp ?? selection.maxDate;
|
|
124
178
|
const isDateDisabled = isDateDisabledProp ?? selection.isDateDisabled;
|
|
125
|
-
const RenderEventComponent = renderEvent;
|
|
179
|
+
const RenderEventComponent = (0, react.useMemo)(() => withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, false), [renderEvent, eventAccessibilityLabel]);
|
|
126
180
|
const [gridHeight, setGridHeight] = (0, react.useState)(0);
|
|
127
181
|
const [hoveredKey, setHoveredKey] = (0, react.useState)(null);
|
|
128
182
|
const [pressedKey, setPressedKey] = (0, react.useState)(null);
|
|
@@ -172,11 +226,15 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
172
226
|
const showGrid = events.length > 0;
|
|
173
227
|
const renderDay = (day) => {
|
|
174
228
|
const isCurrentMonth = (0, date_fns.isSameMonth)(day, date);
|
|
175
|
-
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
229
|
+
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [
|
|
230
|
+
styles$3.dayCell,
|
|
231
|
+
showGrid && {
|
|
232
|
+
borderTopWidth: react_native.StyleSheet.hairlineWidth,
|
|
233
|
+
borderRightWidth: react_native.StyleSheet.hairlineWidth,
|
|
234
|
+
borderColor: theme.colors.gridLine
|
|
235
|
+
},
|
|
236
|
+
theme.containers.dayCell
|
|
237
|
+
] }, day.toISOString());
|
|
180
238
|
const dayEvents = eventsByDay.get((0, date_fns.startOfDay)(day).toISOString()) ?? [];
|
|
181
239
|
const isToday = (0, _super_calendar_core.getIsToday)(day);
|
|
182
240
|
const isHighlighted = activeDate ? (0, _super_calendar_core.isSameCalendarDay)(day, activeDate) : isToday;
|
|
@@ -213,7 +271,8 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
213
271
|
borderColor: theme.colors.gridLine
|
|
214
272
|
},
|
|
215
273
|
(0, _super_calendar_core.isWeekend)(day) && { backgroundColor: theme.colors.weekendBackground },
|
|
216
|
-
calendarCellStyle?.(day)
|
|
274
|
+
calendarCellStyle?.(day),
|
|
275
|
+
theme.containers.dayCell
|
|
217
276
|
],
|
|
218
277
|
activeOpacity: showGrid ? .2 : 1,
|
|
219
278
|
...showGrid ? null : {
|
|
@@ -276,7 +335,8 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
276
335
|
backgroundColor: theme.colors.hoverBackground,
|
|
277
336
|
borderRadius: theme.todayBadgeRadius
|
|
278
337
|
},
|
|
279
|
-
!showGrid && pressedKey === dayKey && { opacity: .2 }
|
|
338
|
+
!showGrid && pressedKey === dayKey && { opacity: .2 },
|
|
339
|
+
theme.containers.dayBadge
|
|
280
340
|
],
|
|
281
341
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
282
342
|
style: [theme.text.dateCell, { color: dateColor }],
|
|
@@ -285,7 +345,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
285
345
|
})
|
|
286
346
|
}),
|
|
287
347
|
dayEvents.slice(0, visibleCount).map((event, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
288
|
-
style: styles$3.monthEvent,
|
|
348
|
+
style: [styles$3.monthEvent, theme.containers.monthEvent],
|
|
289
349
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
290
350
|
event,
|
|
291
351
|
mode: "month",
|
|
@@ -317,12 +377,16 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
317
377
|
style: styles$3.root,
|
|
318
378
|
children: [
|
|
319
379
|
showTitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
320
|
-
style: [
|
|
380
|
+
style: [
|
|
381
|
+
styles$3.title,
|
|
382
|
+
theme.text.monthTitle,
|
|
383
|
+
{ color: theme.colors.text }
|
|
384
|
+
],
|
|
321
385
|
allowFontScaling: false,
|
|
322
386
|
children: (0, date_fns.format)(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
323
387
|
}) : null,
|
|
324
388
|
showWeekdays ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
325
|
-
style: styles$3.weekdayHeader,
|
|
389
|
+
style: [styles$3.weekdayHeader, theme.containers.weekdayHeader],
|
|
326
390
|
children: weekdayLabels.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
327
391
|
style: [
|
|
328
392
|
theme.text.weekday,
|
|
@@ -330,14 +394,14 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, loca
|
|
|
330
394
|
{ color: theme.colors.textMuted }
|
|
331
395
|
],
|
|
332
396
|
allowFontScaling: false,
|
|
333
|
-
children: (0, date_fns.format)(day,
|
|
397
|
+
children: (0, date_fns.format)(day, (0, _super_calendar_core.weekdayFormatToken)(weekdayFormat), { locale })
|
|
334
398
|
}, day.toISOString()))
|
|
335
399
|
}) : null,
|
|
336
400
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
337
401
|
style: styles$3.container,
|
|
338
402
|
onLayout: handleLayout,
|
|
339
403
|
children: weeks.map((week) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
340
|
-
style: styles$3.weekRow,
|
|
404
|
+
style: [styles$3.weekRow, theme.containers.weekRow],
|
|
341
405
|
children: week.map((day) => renderDay(day))
|
|
342
406
|
}, week[0].toISOString()))
|
|
343
407
|
})
|
|
@@ -364,8 +428,6 @@ const MonthView = (0, react.memo)(MonthViewInner);
|
|
|
364
428
|
const styles$3 = react_native.StyleSheet.create({
|
|
365
429
|
root: { flex: 1 },
|
|
366
430
|
title: {
|
|
367
|
-
fontSize: 17,
|
|
368
|
-
fontWeight: "700",
|
|
369
431
|
paddingTop: 10,
|
|
370
432
|
paddingHorizontal: 14,
|
|
371
433
|
paddingBottom: 6
|
|
@@ -417,7 +479,7 @@ const styles$3 = react_native.StyleSheet.create({
|
|
|
417
479
|
const isWeb$1 = react_native.Platform.OS === "web";
|
|
418
480
|
const PAGE_WINDOW$1 = 60;
|
|
419
481
|
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 }) {
|
|
482
|
+
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
483
|
const theme = useCalendarTheme();
|
|
422
484
|
const { width, height } = (0, react_native.useWindowDimensions)();
|
|
423
485
|
const listRef = (0, react.useRef)(null);
|
|
@@ -545,15 +607,20 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, loc
|
|
|
545
607
|
]);
|
|
546
608
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
547
609
|
ref: containerRef,
|
|
548
|
-
style: styles$2.container,
|
|
610
|
+
style: [styles$2.container, theme.containers.monthContainer],
|
|
549
611
|
children: [
|
|
550
612
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
551
|
-
style: [
|
|
613
|
+
style: [
|
|
614
|
+
styles$2.monthTitle,
|
|
615
|
+
theme.text.monthTitle,
|
|
616
|
+
{ color: theme.colors.text }
|
|
617
|
+
],
|
|
552
618
|
allowFontScaling: false,
|
|
553
619
|
children: (0, date_fns.format)(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
554
620
|
}),
|
|
555
621
|
renderHeaderForMonthView ? renderHeaderForMonthView(weekDays) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthWeekdayHeader, {
|
|
556
622
|
weekDays,
|
|
623
|
+
weekdayFormat,
|
|
557
624
|
locale
|
|
558
625
|
}),
|
|
559
626
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
@@ -604,10 +671,10 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, loc
|
|
|
604
671
|
* ```
|
|
605
672
|
*/
|
|
606
673
|
const MonthPager = (0, react.memo)(MonthPagerInner);
|
|
607
|
-
const MonthWeekdayHeader = ({ weekDays, locale }) => {
|
|
674
|
+
const MonthWeekdayHeader = ({ weekDays, weekdayFormat = "short", locale }) => {
|
|
608
675
|
const theme = useCalendarTheme();
|
|
609
676
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
610
|
-
style: styles$2.weekdayHeader,
|
|
677
|
+
style: [styles$2.weekdayHeader, theme.containers.weekdayHeader],
|
|
611
678
|
children: weekDays.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
612
679
|
style: [
|
|
613
680
|
theme.text.weekday,
|
|
@@ -615,7 +682,7 @@ const MonthWeekdayHeader = ({ weekDays, locale }) => {
|
|
|
615
682
|
{ color: theme.colors.textMuted }
|
|
616
683
|
],
|
|
617
684
|
allowFontScaling: false,
|
|
618
|
-
children: (0, date_fns.format)(day,
|
|
685
|
+
children: (0, date_fns.format)(day, (0, _super_calendar_core.weekdayFormatToken)(weekdayFormat), { locale })
|
|
619
686
|
}, day.toISOString()))
|
|
620
687
|
});
|
|
621
688
|
};
|
|
@@ -625,8 +692,6 @@ const styles$2 = react_native.StyleSheet.create({
|
|
|
625
692
|
pagerList: { flex: 1 },
|
|
626
693
|
webNoScroll: { overflow: "hidden" },
|
|
627
694
|
monthTitle: {
|
|
628
|
-
fontSize: 17,
|
|
629
|
-
fontWeight: "700",
|
|
630
695
|
paddingTop: 10,
|
|
631
696
|
paddingHorizontal: 14,
|
|
632
697
|
paddingBottom: 6
|
|
@@ -649,7 +714,7 @@ const styles$2 = react_native.StyleSheet.create({
|
|
|
649
714
|
* default renderer for `MonthList`, so the `/picker` entry point stays free of
|
|
650
715
|
* Reanimated.
|
|
651
716
|
*/
|
|
652
|
-
function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, cellStyle, onPress, onLongPress }) {
|
|
717
|
+
function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }) {
|
|
653
718
|
const theme = useCalendarTheme();
|
|
654
719
|
const isAllDayEvent = isAllDay ?? false;
|
|
655
720
|
const timeLabel = (0, _super_calendar_core.eventTimeLabel)({
|
|
@@ -662,7 +727,7 @@ function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = tru
|
|
|
662
727
|
allDayLabel
|
|
663
728
|
});
|
|
664
729
|
const ellipsizeMode = (0, _super_calendar_core.titleEllipsizeMode)(ellipsizeTitle);
|
|
665
|
-
const accessibilityLabel = (0, _super_calendar_core.eventAccessibilityLabel)({
|
|
730
|
+
const accessibilityLabel = accessibilityLabelProp ?? (0, _super_calendar_core.eventAccessibilityLabel)({
|
|
666
731
|
title: event.title,
|
|
667
732
|
isAllDay: isAllDayEvent,
|
|
668
733
|
start: event.start,
|
|
@@ -731,7 +796,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
|
|
|
731
796
|
const NO_EVENTS = [];
|
|
732
797
|
const noop = () => {};
|
|
733
798
|
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 }) {
|
|
799
|
+
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
800
|
const theme = useCalendarTheme();
|
|
736
801
|
const listRef = (0, react.useRef)(null);
|
|
737
802
|
const weekRowHeight = weekRowHeightProp ?? (events.length > 0 ? DEFAULT_EVENT_WEEK_ROW_HEIGHT : DEFAULT_WEEK_ROW_HEIGHT);
|
|
@@ -951,6 +1016,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekRowHeight:
|
|
|
951
1016
|
fillCellOnSelection,
|
|
952
1017
|
calendarCellStyle,
|
|
953
1018
|
renderEvent,
|
|
1019
|
+
eventAccessibilityLabel,
|
|
954
1020
|
keyExtractor,
|
|
955
1021
|
onPressDay: dragEnabled ? handlePressDay : onPressDay,
|
|
956
1022
|
onLongPressDay,
|
|
@@ -1022,7 +1088,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekRowHeight:
|
|
|
1022
1088
|
children: weekDays.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1023
1089
|
style: [styles.weekdayLabel, { color: theme.colors.textMuted }],
|
|
1024
1090
|
allowFontScaling: false,
|
|
1025
|
-
children: (0, date_fns.format)(day,
|
|
1091
|
+
children: (0, date_fns.format)(day, (0, _super_calendar_core.weekdayFormatToken)(weekdayFormat), { locale })
|
|
1026
1092
|
}, day.toISOString()))
|
|
1027
1093
|
}), dragGesture && !isWeb ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1028
1094
|
gesture: dragGesture,
|
|
@@ -1146,3 +1212,9 @@ Object.defineProperty(exports, "useWebPagerKeys", {
|
|
|
1146
1212
|
return useWebPagerKeys;
|
|
1147
1213
|
}
|
|
1148
1214
|
});
|
|
1215
|
+
Object.defineProperty(exports, "withEventAccessibilityLabel", {
|
|
1216
|
+
enumerable: true,
|
|
1217
|
+
get: function() {
|
|
1218
|
+
return withEventAccessibilityLabel;
|
|
1219
|
+
}
|
|
1220
|
+
});
|