@super-calendar/dom 2.15.0 → 2.17.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/README.md +92 -0
- package/dist/index.d.mts +94 -31
- package/dist/index.d.ts +94 -31
- package/dist/index.js +1675 -526
- package/dist/index.mjs +1672 -530
- package/package.json +2 -2
- package/src/Calendar.tsx +91 -13
- package/src/DateRangePicker.tsx +60 -6
- package/src/EventActions.tsx +470 -0
- package/src/InertDiv.ts +7 -0
- package/src/MonthList.tsx +64 -38
- package/src/MonthView.tsx +398 -63
- package/src/MultiWeekView.tsx +54 -0
- package/src/ResourceTimeline.tsx +438 -98
- package/src/TimeGrid.tsx +305 -35
- package/src/index.ts +8 -0
- package/src/touch.ts +70 -0
package/README.md
CHANGED
|
@@ -52,6 +52,14 @@ export function MyCalendar() {
|
|
|
52
52
|
|
|
53
53
|
For a custom picker, pair the headless hooks (`useDateRange`, `useMonthGrid`) with `MonthList` and `TimeGrid`, all re-exported from this package.
|
|
54
54
|
|
|
55
|
+
`DatePicker` and `DateRangePicker` apply `theme` to both the popover chrome and
|
|
56
|
+
the calendar inside it. Theme updates apply while open, and per-slot styles take
|
|
57
|
+
precedence. Setting `disabled` closes an open popover; re-enabling the field
|
|
58
|
+
leaves it closed until you open it again.
|
|
59
|
+
|
|
60
|
+
`MonthList` applies callback, date-constraint, theme, and slot updates to mounted
|
|
61
|
+
months, including when `date` and `events` keep the same references.
|
|
62
|
+
|
|
55
63
|
## Touch event gestures
|
|
56
64
|
|
|
57
65
|
Touch and pen on `TimeGrid` wait for a 300 ms hold within 8 px before dragging.
|
|
@@ -61,6 +69,50 @@ Set `touchDragDelay` and `touchDragThreshold` on `TimeGrid` or `Calendar` to adj
|
|
|
61
69
|
the hold. Mouse drag and resize retain their existing behavior. See the
|
|
62
70
|
[dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
63
71
|
|
|
72
|
+
## Multi-week grids
|
|
73
|
+
|
|
74
|
+
Use `mode="multiweek"` with `numberOfWeeks` (default `2`) for consecutive full
|
|
75
|
+
week rows without hourly slots. The first week contains `date` and aligns to
|
|
76
|
+
`weekStartsOn`. Navigation moves by the full number of weeks. `hiddenDays` only
|
|
77
|
+
shortens rows; `custom` views remain hourly even above seven columns.
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { useState } from "react";
|
|
81
|
+
import { Calendar } from "@super-calendar/dom";
|
|
82
|
+
|
|
83
|
+
export function MultiWeekCalendar() {
|
|
84
|
+
const [date, setDate] = useState(new Date(2026, 11, 28));
|
|
85
|
+
return (
|
|
86
|
+
<Calendar
|
|
87
|
+
mode="multiweek"
|
|
88
|
+
numberOfWeeks={3}
|
|
89
|
+
weekStartsOn={1}
|
|
90
|
+
date={date}
|
|
91
|
+
onChangeDate={setDate}
|
|
92
|
+
events={[]}
|
|
93
|
+
height={480}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`MultiWeekView` exposes a standalone window with the month grid's event bars,
|
|
100
|
+
overflow, selection, drag interactions, and styling. Pass expanded events to it;
|
|
101
|
+
`Calendar` handles recurrence and time zones. Custom event renderers receive
|
|
102
|
+
`mode: "multiweek"`. Rows scroll vertically when the container is too short.
|
|
103
|
+
Event chips and overflow buttons default to 24 pixels high; use `chipHeight` to customize them.
|
|
104
|
+
Counts must be positive safe integers whose date span is representable; invalid
|
|
105
|
+
counts or dates throw `RangeError`. Rows are materialized, so larger counts need
|
|
106
|
+
more space. `MonthView` retains its month-only behavior.
|
|
107
|
+
|
|
108
|
+
In the multi-week web grid, a quick touch swipe scrolls. Hold a day or event for
|
|
109
|
+
400 ms, then drag to create or move. Mouse input starts immediately. Cancelling
|
|
110
|
+
the pointer or changing the displayed window cancels the hold or drag.
|
|
111
|
+
|
|
112
|
+
Keep `events` stable during unrelated UI updates. With recurrence or `timeZone`,
|
|
113
|
+
replacing the array rebuilds displayed events and cancels a held move. See
|
|
114
|
+
[keep event data stable](https://super-calendar.afonsojramos.me/guides/events#keep-event-data-stable).
|
|
115
|
+
|
|
64
116
|
## Moving events
|
|
65
117
|
|
|
66
118
|
Pass `onDragEvent` and update your event state with the returned `start` and `end`.
|
|
@@ -73,6 +125,24 @@ On the time grid, dragging any segment of a multi-day event previews the whole
|
|
|
73
125
|
range moving together and preserves its duration. Drag a resize grip to change
|
|
74
126
|
only the start or end. See the [dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
75
127
|
|
|
128
|
+
In `TimeGrid` and `ResourceTimeline`, choose **Edit events**, then an event,
|
|
129
|
+
to open move and resize actions (one `dragStepMinutes` step,
|
|
130
|
+
a page, or a neighbouring lane) for keyboard, click, and tap users. The actions
|
|
131
|
+
call `onDragEvent` with the same bounds as a drop. Rejected edits show a polite
|
|
132
|
+
status message, customizable with `labels.eventChangeRejected`. Long choosers
|
|
133
|
+
scroll without shrinking their choices. Titles without spaces wrap. The centered
|
|
134
|
+
dialog and chooser include both dates for multi-day events. Pass `getEventId` to `Calendar`,
|
|
135
|
+
`TimeGrid`, or `ResourceTimeline` to keep editing across full data refreshes.
|
|
136
|
+
Return a stable, unique string or number per event or recurring occurrence;
|
|
137
|
+
missing, invalid, or duplicate IDs close the dialog. Without this prop, full
|
|
138
|
+
refreshes close it. See
|
|
139
|
+
[Move and resize actions](https://super-calendar.afonsojramos.me/guides/accessibility#move-and-resize-actions-web).
|
|
140
|
+
|
|
141
|
+
`ResourceTimeline` supports keyboard event activation in both orientations.
|
|
142
|
+
`draggable: false` keeps an event clickable while preventing moves and resizes.
|
|
143
|
+
Active gestures retain the original event through live insertions and reordering;
|
|
144
|
+
removing the event or lane, losing capture, or unmounting cancels the gesture.
|
|
145
|
+
|
|
76
146
|
## Month chip dimensions
|
|
77
147
|
|
|
78
148
|
`chipHeight` and `chipGap` configure month lanes and overflow rows on `Calendar`,
|
|
@@ -102,6 +172,28 @@ On the time grid, an empty-slot touch tap calls `onPressCell` from the column's
|
|
|
102
172
|
click. Swipes and cancelled contacts do not press the slot. Mouse and pen retain
|
|
103
173
|
drag-to-create behavior. See the [DOM guide](https://super-calendar.afonsojramos.me/guides/dom).
|
|
104
174
|
|
|
175
|
+
The drag-to-create preview stays within the visible hours of the pressed column,
|
|
176
|
+
with its border inside the column.
|
|
177
|
+
|
|
178
|
+
Pass `renderCreateGhost` to `TimeGrid`, `Calendar`, or `ResourceTimeline` to draw
|
|
179
|
+
a draft inside that preview. Define the component once, outside render:
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
import { TimeGrid, type CreateGhostArgs } from "@super-calendar/dom";
|
|
183
|
+
import { format } from "date-fns";
|
|
184
|
+
|
|
185
|
+
function DraftPreview({ start, end }: CreateGhostArgs) {
|
|
186
|
+
return <strong>{`New event ${format(start, "HH:mm")} - ${format(end, "HH:mm")}`}</strong>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
<TimeGrid date={date} events={events} onCreateEvent={create} renderCreateGhost={DraftPreview} />;
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`start` and `end` are the range `onCreateEvent` would receive on release, which
|
|
193
|
+
can extend past a narrowed `minHour`/`maxHour` window. The content is clipped to
|
|
194
|
+
the preview, non-interactive, and hidden from assistive tech.
|
|
195
|
+
The range follows scrolling and zooming during a held sweep, even without another pointer move.
|
|
196
|
+
|
|
105
197
|
## Documentation
|
|
106
198
|
|
|
107
199
|
See the [full documentation](https://super-calendar.afonsojramos.me), the [quickstart](https://super-calendar.afonsojramos.me/quickstart), and the [API reference](https://super-calendar.afonsojramos.me/reference/api).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { CSSProperties, ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
3
|
-
import { BusinessHours, BusinessHours as BusinessHours$1, BusinessHoursBand, BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
4
|
-
//#region src/slots.d.ts
|
|
3
|
+
import { BusinessHours, BusinessHours as BusinessHours$1, BusinessHoursBand, BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs, CreateGhostArgs as CreateGhostArgs$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMultiWeekGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
5
4
|
/**
|
|
6
5
|
* Per-slot styling overrides. Give a slot a Tailwind/CSS class and/or an inline
|
|
7
6
|
* style; missing slots keep the built-in look.
|
|
@@ -29,8 +28,6 @@ interface ResolvedSlot {
|
|
|
29
28
|
style: CSSProperties | undefined;
|
|
30
29
|
"data-slot": string;
|
|
31
30
|
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/theme.d.ts
|
|
34
31
|
/**
|
|
35
32
|
* Theme for the react-dom renderer. Combines the shared color palette from
|
|
36
33
|
* `@super-calendar/core` with the DOM-specific pixel metrics and font stack.
|
|
@@ -55,8 +52,6 @@ export declare const defaultDomTheme: DomCalendarTheme;
|
|
|
55
52
|
export declare const darkDomTheme: DomCalendarTheme;
|
|
56
53
|
/** Merge a partial override onto a base theme (defaults to {@link defaultDomTheme}). */
|
|
57
54
|
export declare function mergeDomTheme(overrides?: Partial<DomCalendarTheme>, base?: DomCalendarTheme): DomCalendarTheme;
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/Agenda.d.ts
|
|
60
55
|
/**
|
|
61
56
|
* Styleable parts of {@link Agenda}. Pass a class or inline style per slot via the
|
|
62
57
|
* `classNames` / `styles` props.
|
|
@@ -120,8 +115,6 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
120
115
|
* ```
|
|
121
116
|
*/
|
|
122
117
|
export declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/YearView.d.ts
|
|
125
118
|
/**
|
|
126
119
|
* Styleable parts of {@link YearView}. Pass a class or inline style per slot
|
|
127
120
|
* via the `classNames` / `styles` props; day cells carry `data-today`,
|
|
@@ -186,8 +179,6 @@ interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
186
179
|
* renders for `mode="year"`.
|
|
187
180
|
*/
|
|
188
181
|
export declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/MonthView.d.ts
|
|
191
182
|
/**
|
|
192
183
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
193
184
|
* the `classNames` / `styles` props to restyle just that part.
|
|
@@ -199,6 +190,8 @@ interface DomMonthEventArgs<T = unknown> {
|
|
|
199
190
|
event: CalendarEvent$1<T>;
|
|
200
191
|
/** Call to fire the view's `onPressEvent` for this chip. */
|
|
201
192
|
onPress: () => void;
|
|
193
|
+
/** The current row view. Supplied by the calendar; optional for existing standalone chip callers. */
|
|
194
|
+
mode?: "month" | "multiweek";
|
|
202
195
|
}
|
|
203
196
|
/** A component that renders a single month-grid event chip. */
|
|
204
197
|
type DomMonthEvent<T = unknown> = ComponentType<DomMonthEventArgs<T>>;
|
|
@@ -326,14 +319,14 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
326
319
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
327
320
|
* ```
|
|
328
321
|
*/
|
|
329
|
-
export declare function MonthView<T = unknown>({ date,
|
|
330
|
-
|
|
331
|
-
|
|
322
|
+
export declare function MonthView<T = unknown>({ date, showAdjacentMonths, ...rest }: MonthViewInternalProps<T>): ReactElement;
|
|
323
|
+
/** Styleable parts of the built-in move and resize actions. */
|
|
324
|
+
type EventActionsSlot = "eventActionsTrigger" | "eventActionsList" | "eventActions" | "eventAction";
|
|
332
325
|
/**
|
|
333
326
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
334
327
|
* the `classNames` / `styles` props.
|
|
335
328
|
*/
|
|
336
|
-
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
329
|
+
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
337
330
|
/** Props passed to a custom time-grid event renderer. */
|
|
338
331
|
interface DomRenderEventArgs<T = unknown> {
|
|
339
332
|
/** The event to render. */
|
|
@@ -485,6 +478,16 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
485
478
|
onPressCell?: (date: Date) => void;
|
|
486
479
|
/** Drag empty grid space to create; called with the swept start/end. */
|
|
487
480
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
481
|
+
/**
|
|
482
|
+
* A component that draws content inside the drag-to-create preview, such as a
|
|
483
|
+
* draft title and the live time range. It receives the snapped `start` and
|
|
484
|
+
* `end` that `onCreateEvent` would get if the pointer were released now, and
|
|
485
|
+
* re-renders as the sweep changes them. The grid keeps positioning, sizing and
|
|
486
|
+
* styling the preview and clips the content to it; the content is
|
|
487
|
+
* non-interactive and hidden from assistive tech. Renders only while a sweep
|
|
488
|
+
* can create, so it needs `onCreateEvent` and does not enable creation itself.
|
|
489
|
+
*/
|
|
490
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
488
491
|
/** Fires when an event drag begins (e.g. to trigger haptics). */
|
|
489
492
|
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
490
493
|
/**
|
|
@@ -492,6 +495,8 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
492
495
|
* Return `false` to reject the drop (the event snaps back).
|
|
493
496
|
*/
|
|
494
497
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
498
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
499
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
495
500
|
/**
|
|
496
501
|
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
497
502
|
* turns on edge auto-advance: dragging an event to the left/right edge and
|
|
@@ -516,8 +521,6 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
516
521
|
* ```
|
|
517
522
|
*/
|
|
518
523
|
export declare const TimeGrid: <T = unknown>(props: TimeGridProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
519
|
-
//#endregion
|
|
520
|
-
//#region src/Calendar.d.ts
|
|
521
524
|
/**
|
|
522
525
|
* Styleable parts across every view {@link Calendar} can render. Only the slots
|
|
523
526
|
* for the active `mode` apply; the rest are ignored. See {@link MonthViewSlot},
|
|
@@ -527,8 +530,9 @@ type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
|
527
530
|
/** Props for {@link Calendar}. */
|
|
528
531
|
interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<CalendarSlot> {
|
|
529
532
|
/**
|
|
530
|
-
* The view to render (default "week"). `month` renders a month grid,
|
|
531
|
-
* a day-grouped agenda list,
|
|
533
|
+
* The view to render (default "week"). `month` renders a month grid,
|
|
534
|
+
* `multiweek` stacked week rows, `schedule` a day-grouped agenda list, `year`
|
|
535
|
+
* twelve mini months, and the others a time grid.
|
|
532
536
|
*/
|
|
533
537
|
mode?: CalendarMode$1;
|
|
534
538
|
/**
|
|
@@ -541,8 +545,9 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
541
545
|
date: Date;
|
|
542
546
|
/**
|
|
543
547
|
* Fires with the next/previous period's date when the user pages the focused
|
|
544
|
-
* calendar with **PageDown** / **PageUp** (a month in `month`,
|
|
545
|
-
* `schedule`, else the view's
|
|
548
|
+
* calendar with **PageDown** / **PageUp** (a month in `month`,
|
|
549
|
+
* `numberOfWeeks` weeks in `multiweek`, a week in `schedule`, else the view's
|
|
550
|
+
* day span). It's controlled, so update `date` in
|
|
546
551
|
* response. Omit it to leave paging to your own controls.
|
|
547
552
|
*/
|
|
548
553
|
onChangeDate?: (date: Date) => void;
|
|
@@ -560,6 +565,11 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
560
565
|
now?: Date;
|
|
561
566
|
/** Column count for `mode="custom"`. */
|
|
562
567
|
numberOfDays?: number;
|
|
568
|
+
/**
|
|
569
|
+
* Week rows for `mode="multiweek"`: a positive whole number, default 2. The
|
|
570
|
+
* rows start on the week containing `date`. Other values throw a `RangeError`.
|
|
571
|
+
*/
|
|
572
|
+
numberOfWeeks?: number;
|
|
563
573
|
/** date-fns locale for titles, headers, and time labels. */
|
|
564
574
|
locale?: Locale;
|
|
565
575
|
/**
|
|
@@ -658,6 +668,11 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
658
668
|
* dragged (`start` at midnight of the first, `end` at midnight after the last).
|
|
659
669
|
*/
|
|
660
670
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
671
|
+
/**
|
|
672
|
+
* A component that draws content inside the time-grid drag-to-create preview;
|
|
673
|
+
* see `TimeGrid`'s prop of the same name. Applies to the week/day grid only.
|
|
674
|
+
*/
|
|
675
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
661
676
|
/** Fires when an event drag begins. */
|
|
662
677
|
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
663
678
|
/**
|
|
@@ -666,6 +681,8 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
666
681
|
* days dragged so the time of day and duration are kept.
|
|
667
682
|
*/
|
|
668
683
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
684
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
685
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
669
686
|
/** Tap a day's column header. */
|
|
670
687
|
onPressDateHeader?: (day: Date) => void;
|
|
671
688
|
/** Custom time-grid event renderer. */
|
|
@@ -738,8 +755,6 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
738
755
|
* ```
|
|
739
756
|
*/
|
|
740
757
|
export declare const Calendar: <T = unknown>(props: CalendarProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
741
|
-
//#endregion
|
|
742
|
-
//#region src/MonthList.d.ts
|
|
743
758
|
/**
|
|
744
759
|
* Styleable parts of {@link MonthList}. The shared weekday header uses `weekdays`
|
|
745
760
|
* / `weekday`; every other slot is forwarded to each month's {@link MonthView}
|
|
@@ -815,8 +830,6 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
815
830
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
816
831
|
*/
|
|
817
832
|
export declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
818
|
-
//#endregion
|
|
819
|
-
//#region src/DateRangePicker.d.ts
|
|
820
833
|
/** Styleable chrome of the pickers (the calendar's own slots forward through too). */
|
|
821
834
|
type DatePickerSlot = "trigger" | "popover" | "footer" | "clear";
|
|
822
835
|
interface PickerBaseProps extends DateSelectionConstraints$1, SlotStyleProps<DatePickerSlot | MonthListSlot> {
|
|
@@ -826,7 +839,7 @@ interface PickerBaseProps extends DateSelectionConstraints$1, SlotStyleProps<Dat
|
|
|
826
839
|
height?: number;
|
|
827
840
|
/** Placeholder shown on the trigger when nothing is selected. */
|
|
828
841
|
placeholder?: string;
|
|
829
|
-
/** Disable the
|
|
842
|
+
/** Disable the field and close its popover. Re-enabling leaves the popover closed. */
|
|
830
843
|
disabled?: boolean;
|
|
831
844
|
/** Theme overrides for the calendar. */
|
|
832
845
|
theme?: Partial<DomCalendarTheme>;
|
|
@@ -877,13 +890,44 @@ interface DateRangePickerProps extends PickerBaseProps {
|
|
|
877
890
|
* ```
|
|
878
891
|
*/
|
|
879
892
|
export declare function DateRangePicker({ value, onChange, formatLabel, weekStartsOn, height, placeholder, disabled, theme: themeOverrides, className, style, classNames, styles, minDate, maxDate, isDateDisabled }: DateRangePickerProps): ReactElement;
|
|
880
|
-
|
|
881
|
-
|
|
893
|
+
/** Props for {@link MultiWeekView}. */
|
|
894
|
+
interface MultiWeekViewProps<T = unknown> extends Omit<MonthViewProps<T>, "date" | "weekStartsOn" | "showAdjacentMonths"> {
|
|
895
|
+
/**
|
|
896
|
+
* Any day in the first week to show. The rows start on the `weekStartsOn` day
|
|
897
|
+
* on or before it, in the device's local calendar.
|
|
898
|
+
*/
|
|
899
|
+
date: Date;
|
|
900
|
+
/**
|
|
901
|
+
* How many consecutive full weeks to show, as stacked rows. A positive whole
|
|
902
|
+
* number; default 2. Other values throw a `RangeError`.
|
|
903
|
+
*/
|
|
904
|
+
numberOfWeeks?: number;
|
|
905
|
+
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
906
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
907
|
+
/** Event chip and overflow-button height in pixels (default 24). */
|
|
908
|
+
chipHeight?: number;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Consecutive full weeks as stacked seven-day rows, with event chips and no hour
|
|
912
|
+
* slots. It has the month grid's event bars, overflow, selection, and drag
|
|
913
|
+
* interactions, and the month slots, `renderEvent`, and theme style it. Every
|
|
914
|
+
* row is kept at full height; when the view is given less room, the rows scroll
|
|
915
|
+
* under the title and weekday header.
|
|
916
|
+
*
|
|
917
|
+
* Standalone, it shows `events` as given; expand recurring events first with
|
|
918
|
+
* `expandRecurringEvents`, or use `Calendar` with `mode="multiweek"`.
|
|
919
|
+
*
|
|
920
|
+
* @example
|
|
921
|
+
* ```tsx
|
|
922
|
+
* <MultiWeekView date={new Date()} numberOfWeeks={3} events={events} />
|
|
923
|
+
* ```
|
|
924
|
+
*/
|
|
925
|
+
export declare function MultiWeekView<T = unknown>({ date, numberOfWeeks, chipHeight, ...rest }: MultiWeekViewProps<T>): ReactElement;
|
|
882
926
|
/**
|
|
883
927
|
* Styleable parts of {@link ResourceTimeline}. Pass a class or inline style per
|
|
884
928
|
* slot via the `classNames` / `styles` props.
|
|
885
929
|
*/
|
|
886
|
-
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
930
|
+
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
887
931
|
/** A schedulable lane (room, person, machine) that events are grouped under. */
|
|
888
932
|
interface Resource {
|
|
889
933
|
/** Stable id events reference via their `resourceId`. */
|
|
@@ -958,10 +1002,25 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
958
1002
|
* proposed new start/end. Return `false` to reject the drop (it snaps back).
|
|
959
1003
|
*/
|
|
960
1004
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
|
|
1005
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
1006
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
961
1007
|
/** Tap empty lane space; called with the snapped time and the lane's resource. */
|
|
962
1008
|
onPressCell?: (at: Date, resource: Resource) => void;
|
|
963
1009
|
/** Drag empty lane space to create; called with the swept start/end and the lane's resource. */
|
|
964
1010
|
onCreateEvent?: (start: Date, end: Date, resource: Resource) => void;
|
|
1011
|
+
/**
|
|
1012
|
+
* A component that draws content inside the drag-to-create preview, such as a
|
|
1013
|
+
* draft title and the live time range. It receives the snapped `start` and
|
|
1014
|
+
* `end` that `onCreateEvent` would get if the pointer were released now, plus
|
|
1015
|
+
* the lane's resource, and re-renders as the sweep changes them. The board
|
|
1016
|
+
* keeps positioning, sizing and styling the preview and clips the content to
|
|
1017
|
+
* it; the content is non-interactive and hidden from assistive tech. Renders
|
|
1018
|
+
* only while a sweep can create, so it needs `onCreateEvent` and does not
|
|
1019
|
+
* enable creation itself. Applies to both orientations.
|
|
1020
|
+
*/
|
|
1021
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1 & {
|
|
1022
|
+
resource: Resource;
|
|
1023
|
+
}>;
|
|
965
1024
|
/**
|
|
966
1025
|
* Shade the hours outside this window, per lane. Same shape as the Calendar's
|
|
967
1026
|
* `businessHours` plus the lane's resource, so per-resource opening hours work
|
|
@@ -987,6 +1046,11 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
987
1046
|
renderResourceHeader?: (resource: Resource, index: number) => ReactNode;
|
|
988
1047
|
/** Snap dragged events to this many minutes (default 15). */
|
|
989
1048
|
dragStepMinutes?: number;
|
|
1049
|
+
/**
|
|
1050
|
+
* Words for the move and resize actions and the event labels. Keys you omit
|
|
1051
|
+
* stay in English (`defaultCalendarLabels`).
|
|
1052
|
+
*/
|
|
1053
|
+
labels?: Partial<CalendarLabels$1>;
|
|
990
1054
|
/** Show the current-time line when `date` is today (default true). */
|
|
991
1055
|
showNowIndicator?: boolean;
|
|
992
1056
|
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
@@ -1014,6 +1078,5 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
1014
1078
|
* />
|
|
1015
1079
|
* ```
|
|
1016
1080
|
*/
|
|
1017
|
-
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, onPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
1018
|
-
|
|
1019
|
-
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type DatePickerProps, type DatePickerSlot, type DateRange, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, type MonthListProps, type MonthListSlot, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ResourceTimelineSlot, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
|
1081
|
+
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, getEventId, onPressCell, onCreateEvent, renderCreateGhost, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, labels: labelsProp, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
1082
|
+
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CreateGhostArgs, type DatePickerProps, type DatePickerSlot, type DateRange, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, type MonthListProps, type MonthListSlot, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type MultiWeekGrid, type MultiWeekGridDay, type MultiWeekGridInterval, type MultiWeekGridOptions, type MultiWeekGridWeek, type MultiWeekViewProps, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ResourceTimelineSlot, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, buildMultiWeekGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|