@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,7 +1,7 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { ComponentType, ReactElement } from "react";
|
|
3
3
|
import { SharedValue } from "react-native-reanimated";
|
|
4
|
-
import { BusinessHours, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn } from "@super-calendar/core";
|
|
4
|
+
import { BusinessHours, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
5
5
|
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
6
6
|
|
|
7
7
|
//#region src/theme.d.ts
|
|
@@ -16,12 +16,36 @@ interface CalendarTheme {
|
|
|
16
16
|
/** Text styles for the calendar's labels and the built-in event box. */
|
|
17
17
|
text: {
|
|
18
18
|
/** Large day number in the week/day header. */dayNumber: TextStyle; /** Short weekday label ("Mon") in headers. */
|
|
19
|
-
weekday: TextStyle; /**
|
|
19
|
+
weekday: TextStyle; /** The "MMMM yyyy" month title above the month grid. */
|
|
20
|
+
monthTitle: TextStyle; /** Date number inside a month cell. */
|
|
20
21
|
dateCell: TextStyle; /** Hour labels down the left of the time grid. */
|
|
21
22
|
hourLabel: TextStyle; /** The "+N more" overflow label in month cells. */
|
|
22
23
|
more: TextStyle; /** Title inside the built-in default event box. */
|
|
23
24
|
eventTitle: TextStyle;
|
|
24
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Per-part `ViewStyle` overrides for the renderer's container elements, the
|
|
28
|
+
* React Native counterpart of the web renderer's per-slot classes. Each is
|
|
29
|
+
* merged onto the built-in style, so you override only what you set. (Rolling
|
|
30
|
+
* out across the views; more slots as they land.)
|
|
31
|
+
*/
|
|
32
|
+
containers: {
|
|
33
|
+
/** The month view's outer container (title + weekday header + grid). */monthContainer: ViewStyle; /** The weekday-label header row above a month grid. */
|
|
34
|
+
weekdayHeader: ViewStyle; /** Each week (row of 7 day cells) in the month grid. */
|
|
35
|
+
weekRow: ViewStyle; /** Each day cell in the month grid. */
|
|
36
|
+
dayCell: ViewStyle; /** The date badge (the circle) inside a month day cell. */
|
|
37
|
+
dayBadge: ViewStyle; /** An event chip inside a month day cell. */
|
|
38
|
+
monthEvent: ViewStyle; /** Each day's column header in the time grid. */
|
|
39
|
+
columnHeader: ViewStyle; /** A timed event's positioned box in the time grid (and resource timeline). */
|
|
40
|
+
timeGridEvent: ViewStyle; /** The current-time indicator line. */
|
|
41
|
+
nowIndicator: ViewStyle; /** Each resource row in the resource timeline. */
|
|
42
|
+
resourceRow: ViewStyle; /** The left-hand resource-label cell in the resource timeline. */
|
|
43
|
+
resourceLabel: ViewStyle; /** The schedule/agenda list's outer container. */
|
|
44
|
+
agendaList: ViewStyle; /** Each event row in the agenda list. */
|
|
45
|
+
agendaRow: ViewStyle; /** The all-day lane above the time grid. */
|
|
46
|
+
allDayLane: ViewStyle; /** Each day's column within the all-day lane. */
|
|
47
|
+
allDayColumn: ViewStyle;
|
|
48
|
+
};
|
|
25
49
|
/** Corner radius of the today badge. Use a large value for a circle. */
|
|
26
50
|
todayBadgeRadius: number;
|
|
27
51
|
/**
|
|
@@ -48,6 +72,7 @@ declare function mergeTheme(theme?: PartialCalendarTheme): CalendarTheme;
|
|
|
48
72
|
type PartialCalendarTheme = {
|
|
49
73
|
colors?: Partial<CalendarTheme["colors"]>;
|
|
50
74
|
text?: Partial<CalendarTheme["text"]>;
|
|
75
|
+
containers?: Partial<CalendarTheme["containers"]>;
|
|
51
76
|
todayBadgeRadius?: number;
|
|
52
77
|
rangeBandHeight?: number;
|
|
53
78
|
};
|
|
@@ -88,6 +113,12 @@ type RenderEventArgs<T = unknown> = {
|
|
|
88
113
|
ellipsizeTitle?: boolean; /** Label shown for an all-day event in the schedule (and its screen-reader text). Default "All day". */
|
|
89
114
|
allDayLabel?: string; /** Per-event style resolved from `eventCellStyle`; the built-in renderer merges it onto the box. */
|
|
90
115
|
cellStyle?: StyleProp<ViewStyle>;
|
|
116
|
+
/**
|
|
117
|
+
* Screen-reader label to announce for the event, injected by a consumer's
|
|
118
|
+
* `eventAccessibilityLabel` override. The built-in renderers use it in place of
|
|
119
|
+
* their default label; `undefined` falls back to that default.
|
|
120
|
+
*/
|
|
121
|
+
accessibilityLabel?: string;
|
|
91
122
|
onPress: () => void; /** Wired when the consumer passes `onLongPressEvent`; otherwise undefined. */
|
|
92
123
|
onLongPress?: () => void;
|
|
93
124
|
};
|
|
@@ -111,7 +142,8 @@ type MonthViewProps<T> = {
|
|
|
111
142
|
* explicit value when using a custom `renderEvent`.
|
|
112
143
|
*/
|
|
113
144
|
maxVisibleEventCount?: number;
|
|
114
|
-
weekStartsOn: WeekStartsOn;
|
|
145
|
+
weekStartsOn: WeekStartsOn; /** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
146
|
+
weekdayFormat?: WeekdayFormat;
|
|
115
147
|
locale?: Locale; /** Sort each day's events by start time before slicing. Default true. */
|
|
116
148
|
sortedMonthView?: boolean; /** Template for the overflow label; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
117
149
|
moreLabel?: string; /** Show dimmed days from adjacent months in the grid. Default true. */
|
|
@@ -136,6 +168,12 @@ type MonthViewProps<T> = {
|
|
|
136
168
|
onDayPointerEnter?: (date: Date) => void; /** Per-date style merged onto the day cell. */
|
|
137
169
|
calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
|
|
138
170
|
renderEvent: RenderEvent<T>;
|
|
171
|
+
/**
|
|
172
|
+
* Override the screen-reader label for each event chip. Receives the event and a
|
|
173
|
+
* `{ mode: "month", isAllDay, ampm: false }` context; return the full text to
|
|
174
|
+
* announce. Defaults to the built-in title-and-time label.
|
|
175
|
+
*/
|
|
176
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler<T>;
|
|
139
177
|
keyExtractor: EventKeyExtractor<T>;
|
|
140
178
|
onPressDay?: (date: Date) => void;
|
|
141
179
|
onLongPressDay?: (date: Date) => void;
|
|
@@ -153,6 +191,7 @@ declare function MonthViewInner<T>({
|
|
|
153
191
|
events,
|
|
154
192
|
maxVisibleEventCount,
|
|
155
193
|
weekStartsOn,
|
|
194
|
+
weekdayFormat,
|
|
156
195
|
locale,
|
|
157
196
|
sortedMonthView,
|
|
158
197
|
moreLabel,
|
|
@@ -171,6 +210,7 @@ declare function MonthViewInner<T>({
|
|
|
171
210
|
isDateDisabled: isDateDisabledProp,
|
|
172
211
|
calendarCellStyle,
|
|
173
212
|
renderEvent,
|
|
213
|
+
eventAccessibilityLabel,
|
|
174
214
|
keyExtractor,
|
|
175
215
|
onPressDay,
|
|
176
216
|
onLongPressDay,
|
|
@@ -206,6 +246,7 @@ type MonthPagerProps<T> = {
|
|
|
206
246
|
events: CalendarEvent$1<T>[];
|
|
207
247
|
maxVisibleEventCount?: number;
|
|
208
248
|
weekStartsOn: WeekStartsOn;
|
|
249
|
+
weekdayFormat?: WeekdayFormat;
|
|
209
250
|
locale?: Locale;
|
|
210
251
|
sortedMonthView?: boolean;
|
|
211
252
|
moreLabel?: string;
|
|
@@ -233,6 +274,7 @@ declare function MonthPagerInner<T>({
|
|
|
233
274
|
events,
|
|
234
275
|
maxVisibleEventCount,
|
|
235
276
|
weekStartsOn,
|
|
277
|
+
weekdayFormat,
|
|
236
278
|
locale,
|
|
237
279
|
sortedMonthView,
|
|
238
280
|
moreLabel,
|
|
@@ -280,7 +322,8 @@ declare const MonthPager: typeof MonthPagerInner;
|
|
|
280
322
|
type MonthListProps<T> = {
|
|
281
323
|
/** The month scrolled to on mount. */date: Date; /** Events to render in the grids. Omit for an events-free date picker. */
|
|
282
324
|
events?: CalendarEvent$1<T>[];
|
|
283
|
-
weekStartsOn: WeekStartsOn;
|
|
325
|
+
weekStartsOn: WeekStartsOn; /** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
326
|
+
weekdayFormat?: WeekdayFormat;
|
|
284
327
|
/**
|
|
285
328
|
* Height of each week row (px). The month block sizes to its row count. Defaults
|
|
286
329
|
* to a taller row when `events` are shown (so a day fits ~3 chips) and a compact
|
|
@@ -307,7 +350,13 @@ type MonthListProps<T> = {
|
|
|
307
350
|
maxDate?: Date;
|
|
308
351
|
isDateDisabled?: (date: Date) => boolean;
|
|
309
352
|
calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>; /** Replace the built-in event box. Defaults to `DefaultEvent`. */
|
|
310
|
-
renderEvent?: RenderEvent<T>;
|
|
353
|
+
renderEvent?: RenderEvent<T>;
|
|
354
|
+
/**
|
|
355
|
+
* Override the screen-reader label for each event chip. Receives the event and a
|
|
356
|
+
* `{ mode: "month", isAllDay, ampm: false }` context; return the full text to
|
|
357
|
+
* announce. Defaults to the built-in title-and-time label.
|
|
358
|
+
*/
|
|
359
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler<T>; /** Stable key per event. Defaults to start-time + index. */
|
|
311
360
|
keyExtractor?: EventKeyExtractor<T>;
|
|
312
361
|
onPressDay?: (date: Date) => void;
|
|
313
362
|
onLongPressDay?: (date: Date) => void;
|
|
@@ -327,6 +376,7 @@ declare function MonthListInner<T>({
|
|
|
327
376
|
date,
|
|
328
377
|
events,
|
|
329
378
|
weekStartsOn,
|
|
379
|
+
weekdayFormat,
|
|
330
380
|
weekRowHeight: weekRowHeightProp,
|
|
331
381
|
monthHeaderHeight,
|
|
332
382
|
maxVisibleEventCount,
|
|
@@ -345,6 +395,7 @@ declare function MonthListInner<T>({
|
|
|
345
395
|
isDateDisabled,
|
|
346
396
|
calendarCellStyle,
|
|
347
397
|
renderEvent,
|
|
398
|
+
eventAccessibilityLabel,
|
|
348
399
|
keyExtractor,
|
|
349
400
|
onPressDay,
|
|
350
401
|
onLongPressDay,
|
|
@@ -391,9 +442,10 @@ declare function DefaultMonthEvent<T>({
|
|
|
391
442
|
showTime,
|
|
392
443
|
ellipsizeTitle,
|
|
393
444
|
allDayLabel,
|
|
445
|
+
accessibilityLabel: accessibilityLabelProp,
|
|
394
446
|
cellStyle,
|
|
395
447
|
onPress,
|
|
396
448
|
onLongPress
|
|
397
449
|
}: RenderEventArgs<T>): ReactElement;
|
|
398
450
|
//#endregion
|
|
399
|
-
export {
|
|
451
|
+
export { CalendarThemeProvider as C, mergeTheme as D, defaultTheme as E, useCalendarTheme as O, CalendarTheme as S, darkTheme as T, RenderEvent as _, MonthPagerProps as a, WeekStartsOn as b, BusinessHours as c, EventAccessibilityLabelContext as d, EventAccessibilityLabeler$1 as f, RecurrenceRule as g, RecurrenceFrequency as h, MonthPager as i, CalendarEvent$1 as l, ICalendarEvent as m, MonthList as n, MonthView as o, EventKeyExtractor as p, MonthListProps as r, MonthViewProps as s, DefaultMonthEvent as t, CalendarMode$1 as u, RenderEventArgs as v, PartialCalendarTheme as w, WeekdayFormat$1 as x, TimeGridMode as y };
|
|
@@ -2,7 +2,7 @@ import { Locale } from "date-fns";
|
|
|
2
2
|
import { ComponentType, ReactElement } from "react";
|
|
3
3
|
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
4
4
|
import { SharedValue } from "react-native-reanimated";
|
|
5
|
-
import { BusinessHours, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn } from "@super-calendar/core";
|
|
5
|
+
import { BusinessHours, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
6
6
|
|
|
7
7
|
//#region src/theme.d.ts
|
|
8
8
|
/**
|
|
@@ -16,12 +16,36 @@ interface CalendarTheme {
|
|
|
16
16
|
/** Text styles for the calendar's labels and the built-in event box. */
|
|
17
17
|
text: {
|
|
18
18
|
/** Large day number in the week/day header. */dayNumber: TextStyle; /** Short weekday label ("Mon") in headers. */
|
|
19
|
-
weekday: TextStyle; /**
|
|
19
|
+
weekday: TextStyle; /** The "MMMM yyyy" month title above the month grid. */
|
|
20
|
+
monthTitle: TextStyle; /** Date number inside a month cell. */
|
|
20
21
|
dateCell: TextStyle; /** Hour labels down the left of the time grid. */
|
|
21
22
|
hourLabel: TextStyle; /** The "+N more" overflow label in month cells. */
|
|
22
23
|
more: TextStyle; /** Title inside the built-in default event box. */
|
|
23
24
|
eventTitle: TextStyle;
|
|
24
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Per-part `ViewStyle` overrides for the renderer's container elements, the
|
|
28
|
+
* React Native counterpart of the web renderer's per-slot classes. Each is
|
|
29
|
+
* merged onto the built-in style, so you override only what you set. (Rolling
|
|
30
|
+
* out across the views; more slots as they land.)
|
|
31
|
+
*/
|
|
32
|
+
containers: {
|
|
33
|
+
/** The month view's outer container (title + weekday header + grid). */monthContainer: ViewStyle; /** The weekday-label header row above a month grid. */
|
|
34
|
+
weekdayHeader: ViewStyle; /** Each week (row of 7 day cells) in the month grid. */
|
|
35
|
+
weekRow: ViewStyle; /** Each day cell in the month grid. */
|
|
36
|
+
dayCell: ViewStyle; /** The date badge (the circle) inside a month day cell. */
|
|
37
|
+
dayBadge: ViewStyle; /** An event chip inside a month day cell. */
|
|
38
|
+
monthEvent: ViewStyle; /** Each day's column header in the time grid. */
|
|
39
|
+
columnHeader: ViewStyle; /** A timed event's positioned box in the time grid (and resource timeline). */
|
|
40
|
+
timeGridEvent: ViewStyle; /** The current-time indicator line. */
|
|
41
|
+
nowIndicator: ViewStyle; /** Each resource row in the resource timeline. */
|
|
42
|
+
resourceRow: ViewStyle; /** The left-hand resource-label cell in the resource timeline. */
|
|
43
|
+
resourceLabel: ViewStyle; /** The schedule/agenda list's outer container. */
|
|
44
|
+
agendaList: ViewStyle; /** Each event row in the agenda list. */
|
|
45
|
+
agendaRow: ViewStyle; /** The all-day lane above the time grid. */
|
|
46
|
+
allDayLane: ViewStyle; /** Each day's column within the all-day lane. */
|
|
47
|
+
allDayColumn: ViewStyle;
|
|
48
|
+
};
|
|
25
49
|
/** Corner radius of the today badge. Use a large value for a circle. */
|
|
26
50
|
todayBadgeRadius: number;
|
|
27
51
|
/**
|
|
@@ -48,6 +72,7 @@ declare function mergeTheme(theme?: PartialCalendarTheme): CalendarTheme;
|
|
|
48
72
|
type PartialCalendarTheme = {
|
|
49
73
|
colors?: Partial<CalendarTheme["colors"]>;
|
|
50
74
|
text?: Partial<CalendarTheme["text"]>;
|
|
75
|
+
containers?: Partial<CalendarTheme["containers"]>;
|
|
51
76
|
todayBadgeRadius?: number;
|
|
52
77
|
rangeBandHeight?: number;
|
|
53
78
|
};
|
|
@@ -88,6 +113,12 @@ type RenderEventArgs<T = unknown> = {
|
|
|
88
113
|
ellipsizeTitle?: boolean; /** Label shown for an all-day event in the schedule (and its screen-reader text). Default "All day". */
|
|
89
114
|
allDayLabel?: string; /** Per-event style resolved from `eventCellStyle`; the built-in renderer merges it onto the box. */
|
|
90
115
|
cellStyle?: StyleProp<ViewStyle>;
|
|
116
|
+
/**
|
|
117
|
+
* Screen-reader label to announce for the event, injected by a consumer's
|
|
118
|
+
* `eventAccessibilityLabel` override. The built-in renderers use it in place of
|
|
119
|
+
* their default label; `undefined` falls back to that default.
|
|
120
|
+
*/
|
|
121
|
+
accessibilityLabel?: string;
|
|
91
122
|
onPress: () => void; /** Wired when the consumer passes `onLongPressEvent`; otherwise undefined. */
|
|
92
123
|
onLongPress?: () => void;
|
|
93
124
|
};
|
|
@@ -111,7 +142,8 @@ type MonthViewProps<T> = {
|
|
|
111
142
|
* explicit value when using a custom `renderEvent`.
|
|
112
143
|
*/
|
|
113
144
|
maxVisibleEventCount?: number;
|
|
114
|
-
weekStartsOn: WeekStartsOn;
|
|
145
|
+
weekStartsOn: WeekStartsOn; /** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
146
|
+
weekdayFormat?: WeekdayFormat;
|
|
115
147
|
locale?: Locale; /** Sort each day's events by start time before slicing. Default true. */
|
|
116
148
|
sortedMonthView?: boolean; /** Template for the overflow label; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
117
149
|
moreLabel?: string; /** Show dimmed days from adjacent months in the grid. Default true. */
|
|
@@ -136,6 +168,12 @@ type MonthViewProps<T> = {
|
|
|
136
168
|
onDayPointerEnter?: (date: Date) => void; /** Per-date style merged onto the day cell. */
|
|
137
169
|
calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
|
|
138
170
|
renderEvent: RenderEvent<T>;
|
|
171
|
+
/**
|
|
172
|
+
* Override the screen-reader label for each event chip. Receives the event and a
|
|
173
|
+
* `{ mode: "month", isAllDay, ampm: false }` context; return the full text to
|
|
174
|
+
* announce. Defaults to the built-in title-and-time label.
|
|
175
|
+
*/
|
|
176
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler<T>;
|
|
139
177
|
keyExtractor: EventKeyExtractor<T>;
|
|
140
178
|
onPressDay?: (date: Date) => void;
|
|
141
179
|
onLongPressDay?: (date: Date) => void;
|
|
@@ -153,6 +191,7 @@ declare function MonthViewInner<T>({
|
|
|
153
191
|
events,
|
|
154
192
|
maxVisibleEventCount,
|
|
155
193
|
weekStartsOn,
|
|
194
|
+
weekdayFormat,
|
|
156
195
|
locale,
|
|
157
196
|
sortedMonthView,
|
|
158
197
|
moreLabel,
|
|
@@ -171,6 +210,7 @@ declare function MonthViewInner<T>({
|
|
|
171
210
|
isDateDisabled: isDateDisabledProp,
|
|
172
211
|
calendarCellStyle,
|
|
173
212
|
renderEvent,
|
|
213
|
+
eventAccessibilityLabel,
|
|
174
214
|
keyExtractor,
|
|
175
215
|
onPressDay,
|
|
176
216
|
onLongPressDay,
|
|
@@ -206,6 +246,7 @@ type MonthPagerProps<T> = {
|
|
|
206
246
|
events: CalendarEvent$1<T>[];
|
|
207
247
|
maxVisibleEventCount?: number;
|
|
208
248
|
weekStartsOn: WeekStartsOn;
|
|
249
|
+
weekdayFormat?: WeekdayFormat;
|
|
209
250
|
locale?: Locale;
|
|
210
251
|
sortedMonthView?: boolean;
|
|
211
252
|
moreLabel?: string;
|
|
@@ -233,6 +274,7 @@ declare function MonthPagerInner<T>({
|
|
|
233
274
|
events,
|
|
234
275
|
maxVisibleEventCount,
|
|
235
276
|
weekStartsOn,
|
|
277
|
+
weekdayFormat,
|
|
236
278
|
locale,
|
|
237
279
|
sortedMonthView,
|
|
238
280
|
moreLabel,
|
|
@@ -280,7 +322,8 @@ declare const MonthPager: typeof MonthPagerInner;
|
|
|
280
322
|
type MonthListProps<T> = {
|
|
281
323
|
/** The month scrolled to on mount. */date: Date; /** Events to render in the grids. Omit for an events-free date picker. */
|
|
282
324
|
events?: CalendarEvent$1<T>[];
|
|
283
|
-
weekStartsOn: WeekStartsOn;
|
|
325
|
+
weekStartsOn: WeekStartsOn; /** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
326
|
+
weekdayFormat?: WeekdayFormat;
|
|
284
327
|
/**
|
|
285
328
|
* Height of each week row (px). The month block sizes to its row count. Defaults
|
|
286
329
|
* to a taller row when `events` are shown (so a day fits ~3 chips) and a compact
|
|
@@ -307,7 +350,13 @@ type MonthListProps<T> = {
|
|
|
307
350
|
maxDate?: Date;
|
|
308
351
|
isDateDisabled?: (date: Date) => boolean;
|
|
309
352
|
calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>; /** Replace the built-in event box. Defaults to `DefaultEvent`. */
|
|
310
|
-
renderEvent?: RenderEvent<T>;
|
|
353
|
+
renderEvent?: RenderEvent<T>;
|
|
354
|
+
/**
|
|
355
|
+
* Override the screen-reader label for each event chip. Receives the event and a
|
|
356
|
+
* `{ mode: "month", isAllDay, ampm: false }` context; return the full text to
|
|
357
|
+
* announce. Defaults to the built-in title-and-time label.
|
|
358
|
+
*/
|
|
359
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler<T>; /** Stable key per event. Defaults to start-time + index. */
|
|
311
360
|
keyExtractor?: EventKeyExtractor<T>;
|
|
312
361
|
onPressDay?: (date: Date) => void;
|
|
313
362
|
onLongPressDay?: (date: Date) => void;
|
|
@@ -327,6 +376,7 @@ declare function MonthListInner<T>({
|
|
|
327
376
|
date,
|
|
328
377
|
events,
|
|
329
378
|
weekStartsOn,
|
|
379
|
+
weekdayFormat,
|
|
330
380
|
weekRowHeight: weekRowHeightProp,
|
|
331
381
|
monthHeaderHeight,
|
|
332
382
|
maxVisibleEventCount,
|
|
@@ -345,6 +395,7 @@ declare function MonthListInner<T>({
|
|
|
345
395
|
isDateDisabled,
|
|
346
396
|
calendarCellStyle,
|
|
347
397
|
renderEvent,
|
|
398
|
+
eventAccessibilityLabel,
|
|
348
399
|
keyExtractor,
|
|
349
400
|
onPressDay,
|
|
350
401
|
onLongPressDay,
|
|
@@ -391,9 +442,10 @@ declare function DefaultMonthEvent<T>({
|
|
|
391
442
|
showTime,
|
|
392
443
|
ellipsizeTitle,
|
|
393
444
|
allDayLabel,
|
|
445
|
+
accessibilityLabel: accessibilityLabelProp,
|
|
394
446
|
cellStyle,
|
|
395
447
|
onPress,
|
|
396
448
|
onLongPress
|
|
397
449
|
}: RenderEventArgs<T>): ReactElement;
|
|
398
450
|
//#endregion
|
|
399
|
-
export {
|
|
451
|
+
export { CalendarThemeProvider as C, mergeTheme as D, defaultTheme as E, useCalendarTheme as O, CalendarTheme as S, darkTheme as T, RenderEvent as _, MonthPagerProps as a, WeekStartsOn as b, BusinessHours as c, EventAccessibilityLabelContext as d, EventAccessibilityLabeler$1 as f, RecurrenceRule as g, RecurrenceFrequency as h, MonthPager as i, CalendarEvent$1 as l, ICalendarEvent as m, MonthList as n, MonthView as o, EventKeyExtractor as p, MonthListProps as r, MonthViewProps as s, DefaultMonthEvent as t, CalendarMode$1 as u, RenderEventArgs as v, PartialCalendarTheme as w, WeekdayFormat$1 as x, TimeGridMode as y };
|
|
@@ -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: _super_calendar_core.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__ */ (0, react_jsx_runtime.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 = react_native.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 = (0, _super_calendar_core.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 = (0, react.useMemo)(() => withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, false), [renderEvent, eventAccessibilityLabel]);
|
|
126
175
|
const [gridHeight, setGridHeight] = (0, react.useState)(0);
|
|
127
176
|
const [hoveredKey, setHoveredKey] = (0, react.useState)(null);
|
|
128
177
|
const [pressedKey, setPressedKey] = (0, react.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 = (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
|
-
|
|
224
|
+
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [
|
|
225
|
+
styles$3.dayCell,
|
|
226
|
+
showGrid && {
|
|
227
|
+
borderTopWidth: react_native.StyleSheet.hairlineWidth,
|
|
228
|
+
borderRightWidth: react_native.StyleSheet.hairlineWidth,
|
|
229
|
+
borderColor: theme.colors.gridLine
|
|
230
|
+
},
|
|
231
|
+
theme.containers.dayCell
|
|
232
|
+
] }, day.toISOString());
|
|
180
233
|
const dayEvents = eventsByDay.get((0, date_fns.startOfDay)(day).toISOString()) ?? [];
|
|
181
234
|
const isToday = (0, _super_calendar_core.getIsToday)(day);
|
|
182
235
|
const isHighlighted = activeDate ? (0, _super_calendar_core.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
|
(0, _super_calendar_core.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__ */ (0, react_jsx_runtime.jsx)(react_native.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__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
288
|
-
style: styles$3.monthEvent,
|
|
343
|
+
style: [styles$3.monthEvent, theme.containers.monthEvent],
|
|
289
344
|
children: /* @__PURE__ */ (0, react_jsx_runtime.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__ */ (0, react_jsx_runtime.jsx)(react_native.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: (0, date_fns.format)(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
323
382
|
}) : null,
|
|
324
383
|
showWeekdays ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
325
|
-
style: styles$3.weekdayHeader,
|
|
384
|
+
style: [styles$3.weekdayHeader, theme.containers.weekdayHeader],
|
|
326
385
|
children: weekdayLabels.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.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: (0, date_fns.format)(day,
|
|
392
|
+
children: (0, date_fns.format)(day, (0, _super_calendar_core.weekdayFormatToken)(weekdayFormat), { locale })
|
|
334
393
|
}, day.toISOString()))
|
|
335
394
|
}) : null,
|
|
336
395
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
337
396
|
style: styles$3.container,
|
|
338
397
|
onLayout: handleLayout,
|
|
339
398
|
children: weeks.map((week) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.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 = (0, react.memo)(MonthViewInner);
|
|
|
364
423
|
const styles$3 = react_native.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 = react_native.StyleSheet.create({
|
|
|
417
474
|
const isWeb$1 = react_native.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 } = (0, react_native.useWindowDimensions)();
|
|
423
480
|
const listRef = (0, react.useRef)(null);
|
|
@@ -545,15 +602,20 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, loc
|
|
|
545
602
|
]);
|
|
546
603
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
547
604
|
ref: containerRef,
|
|
548
|
-
style: styles$2.container,
|
|
605
|
+
style: [styles$2.container, theme.containers.monthContainer],
|
|
549
606
|
children: [
|
|
550
607
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.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: (0, date_fns.format)(date, "MMMM yyyy", locale ? { locale } : void 0)
|
|
554
615
|
}),
|
|
555
616
|
renderHeaderForMonthView ? renderHeaderForMonthView(weekDays) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MonthWeekdayHeader, {
|
|
556
617
|
weekDays,
|
|
618
|
+
weekdayFormat,
|
|
557
619
|
locale
|
|
558
620
|
}),
|
|
559
621
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
@@ -604,10 +666,10 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, loc
|
|
|
604
666
|
* ```
|
|
605
667
|
*/
|
|
606
668
|
const MonthPager = (0, react.memo)(MonthPagerInner);
|
|
607
|
-
const MonthWeekdayHeader = ({ weekDays, locale }) => {
|
|
669
|
+
const MonthWeekdayHeader = ({ weekDays, weekdayFormat = "short", locale }) => {
|
|
608
670
|
const theme = useCalendarTheme();
|
|
609
671
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
610
|
-
style: styles$2.weekdayHeader,
|
|
672
|
+
style: [styles$2.weekdayHeader, theme.containers.weekdayHeader],
|
|
611
673
|
children: weekDays.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.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: (0, date_fns.format)(day,
|
|
680
|
+
children: (0, date_fns.format)(day, (0, _super_calendar_core.weekdayFormatToken)(weekdayFormat), { locale })
|
|
619
681
|
}, day.toISOString()))
|
|
620
682
|
});
|
|
621
683
|
};
|
|
@@ -625,8 +687,6 @@ const styles$2 = react_native.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 = react_native.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 = (0, _super_calendar_core.eventTimeLabel)({
|
|
@@ -662,7 +722,7 @@ function DefaultMonthEvent({ event, mode, isAllDay, ampm = false, showTime = tru
|
|
|
662
722
|
allDayLabel
|
|
663
723
|
});
|
|
664
724
|
const ellipsizeMode = (0, _super_calendar_core.titleEllipsizeMode)(ellipsizeTitle);
|
|
665
|
-
const accessibilityLabel = (0, _super_calendar_core.eventAccessibilityLabel)({
|
|
725
|
+
const accessibilityLabel = accessibilityLabelProp ?? (0, _super_calendar_core.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 = (0, react.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__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1023
1084
|
style: [styles.weekdayLabel, { color: theme.colors.textMuted }],
|
|
1024
1085
|
allowFontScaling: false,
|
|
1025
|
-
children: (0, date_fns.format)(day,
|
|
1086
|
+
children: (0, date_fns.format)(day, (0, _super_calendar_core.weekdayFormatToken)(weekdayFormat), { locale })
|
|
1026
1087
|
}, day.toISOString()))
|
|
1027
1088
|
}), dragGesture && !isWeb ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1028
1089
|
gesture: dragGesture,
|
|
@@ -1146,3 +1207,9 @@ Object.defineProperty(exports, "useWebPagerKeys", {
|
|
|
1146
1207
|
return useWebPagerKeys;
|
|
1147
1208
|
}
|
|
1148
1209
|
});
|
|
1210
|
+
Object.defineProperty(exports, "withEventAccessibilityLabel", {
|
|
1211
|
+
enumerable: true,
|
|
1212
|
+
get: function() {
|
|
1213
|
+
return withEventAccessibilityLabel;
|
|
1214
|
+
}
|
|
1215
|
+
});
|