@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
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-BbCMc60z.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-BW6qy50X.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 };
|