@super-calendar/solid 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +311 -2
- package/dist/client/index.d.ts +1119 -0
- package/dist/client/index.js +7051 -0
- package/dist/server/index.d.ts +1119 -0
- package/dist/server/index.js +8527 -0
- package/package.json +59 -3
- package/src/Agenda.tsx +296 -0
- package/src/Calendar.tsx +645 -0
- package/src/DateRangePicker.tsx +405 -0
- package/src/EventActions.tsx +497 -0
- package/src/MonthList.tsx +233 -0
- package/src/MonthView.tsx +1936 -0
- package/src/MultiWeekView.tsx +49 -0
- package/src/ResourceTimeline.tsx +1748 -0
- package/src/TimeGrid.tsx +2833 -0
- package/src/VirtualList.tsx +119 -0
- package/src/YearView.tsx +652 -0
- package/src/createEventSource.ts +76 -0
- package/src/index.ts +113 -0
- package/src/props.ts +24 -0
- package/src/slots.ts +91 -0
- package/src/state.ts +62 -0
- package/src/styles.ts +68 -0
- package/src/theme.ts +44 -0
- package/src/touch.ts +131 -0
|
@@ -0,0 +1,1119 @@
|
|
|
1
|
+
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, EventSource, EventSource as EventSource$1, EventSourceOptions, EventSourceOptions as EventSourceOptions$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, UseMonthGridOptions as UseMonthGridOptions$1, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMultiWeekGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, loadEventSource, nextDateRange, parseICalendar, toICalendar, weekdayFormatToken } from "@super-calendar/core/vanilla";
|
|
2
|
+
import { Accessor, Component } from "solid-js";
|
|
3
|
+
import { JSX } from "@solidjs/web";
|
|
4
|
+
import { Locale } from "date-fns";
|
|
5
|
+
import * as CSS from "csstype";
|
|
6
|
+
/** Reactive state for a refreshable calendar feed. */
|
|
7
|
+
interface EventSourceState<T> {
|
|
8
|
+
/** Last successful batch, retained during loading and errors. */
|
|
9
|
+
events: Accessor<CalendarEvent$1<T>[]>;
|
|
10
|
+
loading: Accessor<boolean>;
|
|
11
|
+
error: Accessor<Error | null>;
|
|
12
|
+
/** Reload now. Does nothing after the owning component or root is disposed. */
|
|
13
|
+
refetch: () => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/** Load a reactive URL or async function, with optional polling and owned cleanup. */
|
|
16
|
+
export declare function createEventSource<T = unknown>(source: Accessor<EventSource$1<T>>, options?: Accessor<EventSourceOptions$1<T>>): EventSourceState<T>;
|
|
17
|
+
/** Inline styles accept CSS property names or camelCase names. Numeric lengths use pixels. */
|
|
18
|
+
type CSSProperties = CSS.Properties<string | number> & CSS.PropertiesHyphen<string | number> & {
|
|
19
|
+
[key: `--${string}`]: string | number | undefined;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Per-slot styling overrides. Give a slot a Tailwind/CSS class and/or an inline
|
|
23
|
+
* style; missing slots keep the built-in look.
|
|
24
|
+
*/
|
|
25
|
+
interface SlotStyleProps<Slot extends string> {
|
|
26
|
+
/**
|
|
27
|
+
* Class names per slot (e.g. Tailwind). Supplying a class for a slot drops the
|
|
28
|
+
* built-in *themed* inline styles for that slot so the class fully controls its
|
|
29
|
+
* look; the *structural* styles the layout depends on are kept.
|
|
30
|
+
*/
|
|
31
|
+
classNames?: Partial<Record<Slot, string>>;
|
|
32
|
+
/** Inline style overrides per slot, merged last (win over defaults and classes). */
|
|
33
|
+
styles?: Partial<Record<Slot, CSSProperties>>;
|
|
34
|
+
}
|
|
35
|
+
/** A slot's built-in styling, split so classes can replace the look but not the layout. */
|
|
36
|
+
interface SlotDefault {
|
|
37
|
+
/** Structural styles kept even when a class is supplied. */
|
|
38
|
+
base?: CSSProperties;
|
|
39
|
+
/** Themed styles (colour, type, spacing) dropped when a class is supplied. */
|
|
40
|
+
themed?: CSSProperties;
|
|
41
|
+
}
|
|
42
|
+
/** The props a resolved slot spreads onto an element. */
|
|
43
|
+
interface ResolvedSlot {
|
|
44
|
+
class: string | undefined;
|
|
45
|
+
style: JSX.CSSProperties | undefined;
|
|
46
|
+
"data-slot": string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Theme for the Solid renderer. Combines the shared color palette from
|
|
50
|
+
* `@super-calendar/core` with the DOM-specific pixel metrics and font stack.
|
|
51
|
+
*/
|
|
52
|
+
type SolidCalendarTheme = CalendarColors & {
|
|
53
|
+
/** Row height of a day cell, in px. */
|
|
54
|
+
cellHeight: number;
|
|
55
|
+
/** Diameter of the day badge, in px. */
|
|
56
|
+
dayBadgeSize: number;
|
|
57
|
+
/**
|
|
58
|
+
* Height of the selection band strip, in px (the default pill look). The pill's
|
|
59
|
+
* corner radius is half this. Ignored when `fillCellOnSelection` is set, where
|
|
60
|
+
* the band fills the whole cell instead.
|
|
61
|
+
*/
|
|
62
|
+
rangeBandHeight: number;
|
|
63
|
+
/** Font stack for the calendar. */
|
|
64
|
+
fontFamily: string;
|
|
65
|
+
};
|
|
66
|
+
/** The default light theme: the core light palette plus the DOM metrics. */
|
|
67
|
+
export declare const defaultSolidTheme: SolidCalendarTheme;
|
|
68
|
+
/** The dark theme: the core dark palette plus the DOM metrics. */
|
|
69
|
+
export declare const darkSolidTheme: SolidCalendarTheme;
|
|
70
|
+
/** Merge a partial override onto a base theme (defaults to {@link defaultSolidTheme}). */
|
|
71
|
+
export declare function mergeSolidTheme(overrides?: Partial<SolidCalendarTheme>, base?: SolidCalendarTheme): SolidCalendarTheme;
|
|
72
|
+
/**
|
|
73
|
+
* Styleable parts of {@link Agenda}. Pass a class or inline style per slot via the
|
|
74
|
+
* `classNames` / `styles` props.
|
|
75
|
+
*/
|
|
76
|
+
type AgendaSlot = "dayHeader" | "eventRow" | "event" | "empty";
|
|
77
|
+
/** Props passed to a custom agenda (schedule) event renderer. */
|
|
78
|
+
interface SolidAgendaEventArgs<T = unknown> {
|
|
79
|
+
/** The event to render. */
|
|
80
|
+
event: CalendarEvent$1<T>;
|
|
81
|
+
/** Always "schedule"; lets a renderer shared with other views branch on it. */
|
|
82
|
+
mode: "schedule";
|
|
83
|
+
/** Whether the event is all-day. */
|
|
84
|
+
isAllDay: boolean;
|
|
85
|
+
/** Render the time range in 12-hour AM/PM. */
|
|
86
|
+
ampm?: boolean;
|
|
87
|
+
/** Call to fire the view's `onPressEvent` for this row. */
|
|
88
|
+
onPress: () => void;
|
|
89
|
+
}
|
|
90
|
+
/** A component that renders a single agenda (schedule) event row. */
|
|
91
|
+
type SolidAgendaEvent<T = unknown> = Component<SolidAgendaEventArgs<T>>;
|
|
92
|
+
/** Props for {@link Agenda}. */
|
|
93
|
+
interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
94
|
+
/** Events to list. The consumer controls which (and therefore the date range). */
|
|
95
|
+
events: CalendarEvent$1<T>[];
|
|
96
|
+
/** date-fns locale for the day headers and time labels. */
|
|
97
|
+
locale?: Locale;
|
|
98
|
+
/** Render times in 12-hour AM/PM (default false, 24h). */
|
|
99
|
+
ampm?: boolean;
|
|
100
|
+
/** Highlight this date's header instead of the real "today". */
|
|
101
|
+
activeDate?: Date;
|
|
102
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
103
|
+
theme?: Partial<SolidCalendarTheme>;
|
|
104
|
+
/** Height of the scroll viewport, in px (default 480). */
|
|
105
|
+
height?: number | string;
|
|
106
|
+
/** Replace the built-in event row. */
|
|
107
|
+
renderEvent?: SolidAgendaEvent<T>;
|
|
108
|
+
/**
|
|
109
|
+
* Override the screen-reader label for each event row. Receives the event and a
|
|
110
|
+
* `{ mode: "schedule", isAllDay, ampm }` context; return the full text to
|
|
111
|
+
* announce. Defaults to the row's own text content.
|
|
112
|
+
*/
|
|
113
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
114
|
+
/** Tap an event row. */
|
|
115
|
+
onPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
116
|
+
/** Tap a day's header. */
|
|
117
|
+
onPressDay?: (date: Date) => void;
|
|
118
|
+
/** Class applied to the root element. */
|
|
119
|
+
className?: string;
|
|
120
|
+
/** Inline styles applied to the root element. */
|
|
121
|
+
style?: CSSProperties;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A vertical, day-grouped list of events: the schedule view, with plain DOM
|
|
125
|
+
* elements. Events are sorted by start and grouped under a date header per day;
|
|
126
|
+
* the consumer controls which events (and therefore which dates) are shown. The
|
|
127
|
+
* Solid agenda with measured, virtualized rows.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```tsx
|
|
131
|
+
* <Agenda events={events} onPressEvent={(e) => console.log(e.title)} />
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
export declare function Agenda<T = unknown>(incoming: AgendaProps<T>): JSX.Element;
|
|
135
|
+
/**
|
|
136
|
+
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
137
|
+
* the `classNames` / `styles` props to restyle just that part.
|
|
138
|
+
*/
|
|
139
|
+
type MonthViewSlot = "title" | "weekdays" | "weekday" | "grid" | "week" | "day" | "dayBadge" | "rangeBand" | "events" | "chipButton" | "chip" | "more" | "morePopover";
|
|
140
|
+
/** Props passed to a custom month event chip renderer. */
|
|
141
|
+
interface SolidMonthEventArgs<T = unknown> {
|
|
142
|
+
/** The event to render. */
|
|
143
|
+
event: CalendarEvent$1<T>;
|
|
144
|
+
/** Call to fire the view's `onPressEvent` for this chip. */
|
|
145
|
+
onPress: () => void;
|
|
146
|
+
/** The current row view. Supplied by the calendar; optional for existing standalone chip callers. */
|
|
147
|
+
mode?: "month" | "multiweek";
|
|
148
|
+
}
|
|
149
|
+
/** A component that renders a single month-grid event chip. */
|
|
150
|
+
type SolidMonthEvent<T = unknown> = Component<SolidMonthEventArgs<T>>;
|
|
151
|
+
/** Props for {@link MonthView}. */
|
|
152
|
+
interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<MonthViewSlot> {
|
|
153
|
+
/** Any day within the month to render. */
|
|
154
|
+
date: Date;
|
|
155
|
+
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
156
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
157
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
158
|
+
hiddenDays?: number[];
|
|
159
|
+
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
160
|
+
weekdayFormat?: WeekdayFormat$1;
|
|
161
|
+
/**
|
|
162
|
+
* Events to render as chips in each day cell. Passing this (even `[]`) switches
|
|
163
|
+
* the grid to the calendar layout (date in the corner, chips below); omit it for
|
|
164
|
+
* the compact date-picker look.
|
|
165
|
+
*/
|
|
166
|
+
events?: CalendarEvent$1<T>[];
|
|
167
|
+
/** Custom chip renderer; falls back to the built-in titled chip. */
|
|
168
|
+
renderEvent?: SolidMonthEvent<T>;
|
|
169
|
+
/**
|
|
170
|
+
* Override the screen-reader label for each event chip. Receives the event and a
|
|
171
|
+
* `{ mode: "month", isAllDay, ampm: false }` context; return the full text to
|
|
172
|
+
* announce. Defaults to the event title and day (e.g. "Standup, 15 July").
|
|
173
|
+
*/
|
|
174
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
175
|
+
/**
|
|
176
|
+
* Max event lanes (stacked rows) shown per week before the rest of a day's
|
|
177
|
+
* events collapse into a "+N more" row (default 3). Because multi-day events draw
|
|
178
|
+
* as one bar spanning a lane across the week, this caps lanes per row, not chips
|
|
179
|
+
* per day, so a long bar can push a lightly-booked day's own events into "+N more".
|
|
180
|
+
*/
|
|
181
|
+
maxVisibleEventCount?: number;
|
|
182
|
+
/** Height of an event chip and of the "+N more" row, in px (default 18). */
|
|
183
|
+
chipHeight?: number;
|
|
184
|
+
/** Vertical gap between event chips, in px (default 2). */
|
|
185
|
+
chipGap?: number;
|
|
186
|
+
/** Template for the overflow row; `{moreCount}` is replaced (default "{moreCount} More"). */
|
|
187
|
+
moreLabel?: string;
|
|
188
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
189
|
+
labels?: Partial<CalendarLabels$1>;
|
|
190
|
+
/** Tap an event chip. */
|
|
191
|
+
onPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
192
|
+
/** Tap the "+N more" overflow row. */
|
|
193
|
+
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
194
|
+
/** Selected span; days between the endpoints get the range band. */
|
|
195
|
+
selectedRange?: DateRange$1;
|
|
196
|
+
/** Discrete selected days (single / multiple). */
|
|
197
|
+
selectedDates?: Date[];
|
|
198
|
+
/** Render days from the neighbouring months in the leading/trailing cells (default true). */
|
|
199
|
+
showAdjacentMonths?: boolean;
|
|
200
|
+
/** Tint weekend day cells with the theme's weekend background (default true). */
|
|
201
|
+
highlightWeekends?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Fill the whole cell with the range background instead of the default
|
|
204
|
+
* centered rounded "pill" strip. Default false.
|
|
205
|
+
*/
|
|
206
|
+
fillCellOnSelection?: boolean;
|
|
207
|
+
/** Render the "Month yyyy" title above the grid (default true). */
|
|
208
|
+
showTitle?: boolean;
|
|
209
|
+
/** Render the weekday header row (default true). */
|
|
210
|
+
showWeekdays?: boolean;
|
|
211
|
+
/** date-fns locale for the title and weekday labels. */
|
|
212
|
+
locale?: Locale;
|
|
213
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
214
|
+
theme?: Partial<SolidCalendarTheme>;
|
|
215
|
+
/** Fired when a selectable day is clicked. */
|
|
216
|
+
onPressDay?: (date: Date) => void;
|
|
217
|
+
/**
|
|
218
|
+
* Fired alongside `onPressDay` when a day cell is clicked, with the same day at
|
|
219
|
+
* midnight, so one handler can create events across month and week/day modes.
|
|
220
|
+
*/
|
|
221
|
+
onPressCell?: (date: Date) => void;
|
|
222
|
+
/**
|
|
223
|
+
* In events mode, enables drag-to-create: press on a day and drag across others
|
|
224
|
+
* to sketch a span, then release to fire this with the all-day range (`start` at
|
|
225
|
+
* midnight of the first day, `end` at midnight after the last, exclusive). A plain
|
|
226
|
+
* click without dragging still fires `onPressDay`, not this. Days being sketched
|
|
227
|
+
* carry `data-creating` for styling.
|
|
228
|
+
*/
|
|
229
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
230
|
+
/**
|
|
231
|
+
* Reports the day span of a create sweep **as it happens**, as the ordered
|
|
232
|
+
* inclusive `[start, end]` days (both at midnight), so a selection highlight can
|
|
233
|
+
* follow the drag instead of appearing only on release. Pair it with
|
|
234
|
+
* `createDateRange`'s `selectRange` to drive `selectedRange`. Enables the sweep on
|
|
235
|
+
* its own, so it works without `onCreateEvent`.
|
|
236
|
+
*/
|
|
237
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
238
|
+
/**
|
|
239
|
+
* In events mode, enables drag-to-reschedule: press an event chip and drop it on
|
|
240
|
+
* another day. Called with the event and its new `start`/`end`, both shifted by
|
|
241
|
+
* the whole days dragged, so the time of day and duration are preserved. Return
|
|
242
|
+
* `false` to reject the drop. The day under the pointer carries `data-drop` for
|
|
243
|
+
* styling.
|
|
244
|
+
*/
|
|
245
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
246
|
+
/** Fired the instant an event is picked up for a drag, before anything is committed. */
|
|
247
|
+
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
248
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
249
|
+
eventStartEditable?: boolean;
|
|
250
|
+
/** Reject a drop that would overlap another event (default true = allowed). */
|
|
251
|
+
eventOverlap?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* When events are shown, also make the day cells keyboard-navigable: a single
|
|
254
|
+
* roving tab stop, arrow keys move the focus, Enter opens the day (`onPressDay`).
|
|
255
|
+
* Default false, so keyboard focus moves through events only. The date picker
|
|
256
|
+
* (rendered without `events`) is always navigable regardless of this flag.
|
|
257
|
+
*/
|
|
258
|
+
keyboardDayNavigation?: boolean;
|
|
259
|
+
/** Class applied to the root element. */
|
|
260
|
+
className?: string;
|
|
261
|
+
/** Inline styles applied to the root element. */
|
|
262
|
+
style?: CSSProperties;
|
|
263
|
+
}
|
|
264
|
+
interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
265
|
+
eventsByDay?: ReadonlyMap<string, CalendarEvent$1<T>[]>;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* A single static month grid, rendered with plain DOM elements.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```tsx
|
|
272
|
+
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
export declare function MonthView<T = unknown>(props: MonthViewInternalProps<T>): JSX.Element;
|
|
276
|
+
/** Styleable parts of the built-in move and resize actions. */
|
|
277
|
+
type EventActionsSlot = "eventActionsTrigger" | "eventActionsList" | "eventActions" | "eventAction";
|
|
278
|
+
/**
|
|
279
|
+
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
280
|
+
* the `classNames` / `styles` props.
|
|
281
|
+
*/
|
|
282
|
+
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
283
|
+
/** Props passed to a custom time-grid event renderer. */
|
|
284
|
+
interface SolidRenderEventArgs<T = unknown> {
|
|
285
|
+
/** The event to render. */
|
|
286
|
+
event: CalendarEvent$1<T>;
|
|
287
|
+
/** The current view mode. */
|
|
288
|
+
mode: CalendarMode$1;
|
|
289
|
+
/** Whether the event is all-day. */
|
|
290
|
+
isAllDay: boolean;
|
|
291
|
+
/** Pixel height of the event box (timed events only). */
|
|
292
|
+
boxHeight?: number;
|
|
293
|
+
/** The event started before the visible day and continues into it. */
|
|
294
|
+
continuesBefore?: boolean;
|
|
295
|
+
/** The event continues past the visible day. */
|
|
296
|
+
continuesAfter?: boolean;
|
|
297
|
+
/** Show the time range in 12-hour AM/PM. */
|
|
298
|
+
ampm?: boolean;
|
|
299
|
+
/** Call to fire the view's `onPressEvent` for this event. */
|
|
300
|
+
onPress: () => void;
|
|
301
|
+
}
|
|
302
|
+
/** A component that renders a single time-grid event box. */
|
|
303
|
+
type SolidRenderEvent<T = unknown> = Component<SolidRenderEventArgs<T>>;
|
|
304
|
+
/** Props for {@link TimeGrid}. */
|
|
305
|
+
interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
306
|
+
/** Anchor date; the visible columns are derived from it and `mode`. */
|
|
307
|
+
date: Date;
|
|
308
|
+
/** Events to lay out on the grid. */
|
|
309
|
+
events?: CalendarEvent$1<T>[];
|
|
310
|
+
/** "day" (default), "3days", "week", or "custom" (with `numberOfDays`). */
|
|
311
|
+
mode?: TimeGridMode$1;
|
|
312
|
+
/** Column count for `mode="custom"`. */
|
|
313
|
+
numberOfDays?: number;
|
|
314
|
+
/** First day of the week. Sunday = 0 (default) ... Saturday = 6. */
|
|
315
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
316
|
+
/** Column-header weekday label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
317
|
+
weekdayFormat?: WeekdayFormat$1;
|
|
318
|
+
/** Initial pixels per hour (default 48). */
|
|
319
|
+
hourHeight?: number;
|
|
320
|
+
/** Vertical scroll, in minutes from midnight (default 8:00). Applied on mount and whenever it changes. */
|
|
321
|
+
scrollOffsetMinutes?: number;
|
|
322
|
+
/** Pinch / Ctrl-⌘-scroll to zoom the grid (default true). */
|
|
323
|
+
zoomable?: boolean;
|
|
324
|
+
/** Lower bound for pixels per hour when zooming. */
|
|
325
|
+
minHourHeight?: number;
|
|
326
|
+
/** Upper bound for pixels per hour when zooming. */
|
|
327
|
+
maxHourHeight?: number;
|
|
328
|
+
/**
|
|
329
|
+
* Minimum pixel height of a timed event box, so short events stay legible and
|
|
330
|
+
* clickable. Also the floor of the `boxHeight` handed to `renderEvent`. Default
|
|
331
|
+
* 14; pass 0 to size every box strictly by its duration.
|
|
332
|
+
*/
|
|
333
|
+
minEventHeight?: number;
|
|
334
|
+
/**
|
|
335
|
+
* Inset in pixels between a timed event box and its column edges (each side).
|
|
336
|
+
* Default 1; pass 0 to let events fill their column.
|
|
337
|
+
*/
|
|
338
|
+
eventGap?: number;
|
|
339
|
+
/** Snap dragged events to this many minutes (default 15). */
|
|
340
|
+
dragStepMinutes?: number;
|
|
341
|
+
/** Hold duration before a DOM touch or pen drag, in ms (default 300). */
|
|
342
|
+
touchDragDelay?: number;
|
|
343
|
+
/** Movement tolerance for a DOM touch or pen hold, in px (default 8). */
|
|
344
|
+
touchDragThreshold?: number;
|
|
345
|
+
/** Render event time ranges in 12-hour AM/PM (default false, 24h). */
|
|
346
|
+
ampm?: boolean;
|
|
347
|
+
/** Sub-divisions per hour for the grid lines, e.g. 2 for half-hour (default 1). */
|
|
348
|
+
timeslots?: number;
|
|
349
|
+
/** First hour shown (0–23). Default 0. */
|
|
350
|
+
minHour?: number;
|
|
351
|
+
/** Last hour shown, exclusive (1–24). Default 24. */
|
|
352
|
+
maxHour?: number;
|
|
353
|
+
/** Hide the left hour-axis column (lines stay, labels/gutter go). Default false. */
|
|
354
|
+
hideHours?: boolean;
|
|
355
|
+
/** Show the ISO week number in the header gutter. Default false. */
|
|
356
|
+
showWeekNumber?: boolean;
|
|
357
|
+
/** Prefix for the week number, e.g. "W" → "W28". Default "W". */
|
|
358
|
+
weekNumberPrefix?: string;
|
|
359
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
360
|
+
hiddenDays?: number[];
|
|
361
|
+
/** Shade the hours outside business hours; `null` shades the whole day. */
|
|
362
|
+
businessHours?: BusinessHours$1;
|
|
363
|
+
/**
|
|
364
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
365
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
366
|
+
* and your output fills the band instead. Decorative only: the
|
|
367
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
368
|
+
*/
|
|
369
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => JSX.Element;
|
|
370
|
+
/**
|
|
371
|
+
* A component that draws a `display: "background"` event's band in place of
|
|
372
|
+
* the themed shade. Rendered like `renderEvent`, it receives the event, the
|
|
373
|
+
* mode, `continuesBefore` / `continuesAfter` for a multi-day event, and
|
|
374
|
+
* `onPress`, which fires `onPressEvent`. The band then takes pointer events and
|
|
375
|
+
* is no longer hidden from assistive tech; cell clicks and drag-to-create are
|
|
376
|
+
* unreachable underneath it. Without it the band stays a shaded, inert range.
|
|
377
|
+
*/
|
|
378
|
+
renderBackgroundEvent?: SolidRenderEvent<T>;
|
|
379
|
+
/** Show the current-time indicator on today's column (default true). */
|
|
380
|
+
showNowIndicator?: boolean;
|
|
381
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
382
|
+
now?: Date;
|
|
383
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
384
|
+
timeZone?: string;
|
|
385
|
+
/** Show the all-day lane above the grid (default true). */
|
|
386
|
+
showAllDayEventCell?: boolean;
|
|
387
|
+
/** Show the "all-day" text beside the lane (default false). */
|
|
388
|
+
showAllDayLabel?: boolean;
|
|
389
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
390
|
+
labels?: Partial<CalendarLabels$1>;
|
|
391
|
+
/** Tint Saturday/Sunday columns with the weekend background (default true). Set
|
|
392
|
+
* false to treat weekends like any other day. */
|
|
393
|
+
highlightWeekends?: boolean;
|
|
394
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
395
|
+
eventStartEditable?: boolean;
|
|
396
|
+
/** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
|
|
397
|
+
eventDurationEditable?: boolean;
|
|
398
|
+
/** Allow a dragged/resized event to overlap another (default true). Set false to
|
|
399
|
+
* reject a drop that would collide, snapping the event back. */
|
|
400
|
+
eventOverlap?: boolean;
|
|
401
|
+
/** date-fns locale for the column headers and time labels. */
|
|
402
|
+
locale?: Locale;
|
|
403
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
404
|
+
theme?: Partial<SolidCalendarTheme>;
|
|
405
|
+
/** Height of the scroll viewport, in px. */
|
|
406
|
+
height?: number | string;
|
|
407
|
+
/** Custom event renderer; falls back to the built-in event box. */
|
|
408
|
+
renderEvent?: SolidRenderEvent<T>;
|
|
409
|
+
/**
|
|
410
|
+
* Override the screen-reader label for each event. Receives the event and a
|
|
411
|
+
* `{ mode, isAllDay, ampm }` context; return the full text to announce. Defaults
|
|
412
|
+
* to the title plus the time range (or "all day"), which the grid otherwise only
|
|
413
|
+
* conveys visually.
|
|
414
|
+
*/
|
|
415
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
416
|
+
/** Replace the hour-axis label. Receives the hour (0-23) and the `ampm` flag. */
|
|
417
|
+
hourComponent?: (hour: number, ampm: boolean) => JSX.Element;
|
|
418
|
+
/**
|
|
419
|
+
* Add arrow-key navigation between events. Up/Down move between a day's events by
|
|
420
|
+
* time, Left/Right jump to the nearest event in the adjacent day, Home/End go to
|
|
421
|
+
* the day's first/last event; Enter/Space activate. Additive: every event stays
|
|
422
|
+
* individually tabbable (so screen-reader users keep full access), so this is a
|
|
423
|
+
* convenience for sighted keyboard users. Default false.
|
|
424
|
+
*/
|
|
425
|
+
keyboardEventNavigation?: boolean;
|
|
426
|
+
/** Tap an event. */
|
|
427
|
+
onPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
428
|
+
/** Tap a day's column header. */
|
|
429
|
+
onPressDateHeader?: (day: Date) => void;
|
|
430
|
+
/** Tap empty grid space; called with the date and time at the press. */
|
|
431
|
+
onPressCell?: (date: Date) => void;
|
|
432
|
+
/** Drag empty grid space to create; called with the swept start/end. */
|
|
433
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
434
|
+
/**
|
|
435
|
+
* A component that draws content inside the drag-to-create preview, such as a
|
|
436
|
+
* draft title and the live time range. It receives the snapped `start` and
|
|
437
|
+
* `end` that `onCreateEvent` would get if the pointer were released now, and
|
|
438
|
+
* its props update as the sweep changes them. The grid keeps positioning,
|
|
439
|
+
* sizing and styling the preview and clips the content to it; the content is
|
|
440
|
+
* non-interactive and hidden from assistive tech. Renders only while a sweep
|
|
441
|
+
* can create, so it needs `onCreateEvent` and does not enable creation itself.
|
|
442
|
+
*/
|
|
443
|
+
renderCreateGhost?: Component<CreateGhostArgs$1>;
|
|
444
|
+
/** Fires when an event drag begins (e.g. to trigger haptics). */
|
|
445
|
+
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
446
|
+
/**
|
|
447
|
+
* Enables drag-to-move and resize; called with the proposed new start/end.
|
|
448
|
+
* Return `false` to reject the drop (the event snaps back).
|
|
449
|
+
*/
|
|
450
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
451
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
452
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
453
|
+
/**
|
|
454
|
+
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
455
|
+
* turns on edge auto-advance: dragging an event to the left/right edge and
|
|
456
|
+
* dwelling briefly pages the view so the event can be dropped on a day in the
|
|
457
|
+
* previous/next period. Controlled, like the native renderer's `onChangeDate`.
|
|
458
|
+
*/
|
|
459
|
+
onChangeDate?: (date: Date) => void;
|
|
460
|
+
/** Class applied to the root element. */
|
|
461
|
+
className?: string;
|
|
462
|
+
/** Inline styles applied to the root element. */
|
|
463
|
+
style?: CSSProperties;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* A day / week / N-day time grid rendered with plain DOM elements. Events are
|
|
467
|
+
* positioned with the library's pure `layoutDayEvents`, so overlap columns and
|
|
468
|
+
* multi-day clipping match the React Native renderer. Supports Ctrl/⌘-scroll and
|
|
469
|
+
* two-finger pinch to zoom, and pointer drag to move / resize events.
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```tsx
|
|
473
|
+
* <TimeGrid mode="week" date={new Date()} events={events} />
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
export declare function TimeGrid<T = unknown>(incoming: TimeGridProps<T> & {
|
|
477
|
+
ref?: (handle: CalendarHandle$1) => void;
|
|
478
|
+
}): JSX.Element;
|
|
479
|
+
/**
|
|
480
|
+
* Styleable parts of {@link YearView}. Pass a class or inline style per slot
|
|
481
|
+
* via the `classNames` / `styles` props; day cells carry `data-today`,
|
|
482
|
+
* `data-events`, `data-selected`, `data-range`, `data-disabled` and
|
|
483
|
+
* `data-creating` state attributes for variants.
|
|
484
|
+
*/
|
|
485
|
+
type YearViewSlot = "grid" | "month" | "monthTitle" | "weekdays" | "weekday" | "week" | "day" | "dayBadge" | "rangeBand" | "eventDot";
|
|
486
|
+
/** Props for {@link YearView}, the twelve mini-month year grid. */
|
|
487
|
+
interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<YearViewSlot> {
|
|
488
|
+
/** Any date inside the year to render. */
|
|
489
|
+
date: Date;
|
|
490
|
+
/** Days holding at least one event get a dot. Omit for a plain year. */
|
|
491
|
+
events?: CalendarEvent$1<T>[];
|
|
492
|
+
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
493
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
494
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
495
|
+
hiddenDays?: number[];
|
|
496
|
+
locale?: Locale;
|
|
497
|
+
/** Translations for the screen-reader words; omitted keys use English. */
|
|
498
|
+
labels?: Partial<CalendarLabels$1>;
|
|
499
|
+
/** Highlight this date instead of the real "today". */
|
|
500
|
+
activeDate?: Date;
|
|
501
|
+
/** A selected span: endpoints get a filled badge, the days between get the range band. */
|
|
502
|
+
selectedRange?: DateRange$1;
|
|
503
|
+
/** Discrete selected days, drawn with a filled badge. */
|
|
504
|
+
selectedDates?: Date[];
|
|
505
|
+
/**
|
|
506
|
+
* Smallest width a mini month may take before the grid drops a column
|
|
507
|
+
* (default 150). The grid fits as many columns as the container allows.
|
|
508
|
+
*/
|
|
509
|
+
minMonthWidth?: number;
|
|
510
|
+
/** Tap a day cell (e.g. to drill into the day or month view). */
|
|
511
|
+
onPressDay?: (date: Date) => void;
|
|
512
|
+
/** Tap a month's title (e.g. to jump to that month's view). */
|
|
513
|
+
onPressMonth?: (month: Date) => void;
|
|
514
|
+
/**
|
|
515
|
+
* Enables drag-to-select and reports the swept span live, as the ordered
|
|
516
|
+
* inclusive `[start, end]` days (both at midnight). Pair it with
|
|
517
|
+
* `createDateRange`'s `selectRange` to drive `selectedRange`. Fires on every day the
|
|
518
|
+
* pointer crosses, so the highlight follows the drag; `onCreateEvent` (when also
|
|
519
|
+
* set) fires once on release. Either handler enables the same sweep gesture, and
|
|
520
|
+
* a sweep can run across mini months.
|
|
521
|
+
*/
|
|
522
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
523
|
+
/**
|
|
524
|
+
* Enables drag-to-create: press a day and drag across others, then release to
|
|
525
|
+
* fire this with the all-day range (`start` at midnight of the first day, `end`
|
|
526
|
+
* at midnight after the last, exclusive). A plain click without dragging still
|
|
527
|
+
* fires `onPressDay`, not this. Days being sketched carry `data-creating`.
|
|
528
|
+
*/
|
|
529
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
530
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
531
|
+
theme?: Partial<SolidCalendarTheme>;
|
|
532
|
+
/** Class applied to the root element. */
|
|
533
|
+
className?: string;
|
|
534
|
+
/** Inline styles applied to the root element. */
|
|
535
|
+
style?: CSSProperties;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* A year at a glance: the twelve months as compact mini grids, with today
|
|
539
|
+
* highlighted and a dot under days that hold events. It's the view `Calendar`
|
|
540
|
+
* renders for `mode="year"`.
|
|
541
|
+
*/
|
|
542
|
+
export declare function YearView<T = unknown>(incoming: YearViewProps<T>): JSX.Element;
|
|
543
|
+
/**
|
|
544
|
+
* Styleable parts across every view {@link Calendar} can render. Only the slots
|
|
545
|
+
* for the active `mode` apply; the rest are ignored. See {@link MonthViewSlot},
|
|
546
|
+
* {@link TimeGridSlot}, and {@link AgendaSlot}.
|
|
547
|
+
*/
|
|
548
|
+
type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
549
|
+
/** Props for {@link Calendar}. */
|
|
550
|
+
interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<CalendarSlot> {
|
|
551
|
+
/**
|
|
552
|
+
* The view to render (default "week"). `month` renders a month grid, `schedule`
|
|
553
|
+
* a day-grouped agenda list, and the others a time grid.
|
|
554
|
+
*/
|
|
555
|
+
mode?: CalendarMode$1;
|
|
556
|
+
/**
|
|
557
|
+
* Controlled anchor date, read in the device's local time zone; change it
|
|
558
|
+
* (e.g. from your own header) to navigate. Construct it as a local date
|
|
559
|
+
* (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
560
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
561
|
+
* and anchors the previous week.
|
|
562
|
+
*/
|
|
563
|
+
date: Date;
|
|
564
|
+
/**
|
|
565
|
+
* Fires with the next/previous period's date when the user pages the focused
|
|
566
|
+
* calendar with **PageDown** / **PageUp** (a month in `month`, a week in
|
|
567
|
+
* `schedule`, else the view's day span). It's controlled, so update `date` in
|
|
568
|
+
* response. Omit it to leave paging to your own controls.
|
|
569
|
+
*/
|
|
570
|
+
onChangeDate?: (date: Date) => void;
|
|
571
|
+
/** Your events. */
|
|
572
|
+
events?: CalendarEvent$1<T>[];
|
|
573
|
+
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
574
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
575
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
576
|
+
hiddenDays?: number[];
|
|
577
|
+
/**
|
|
578
|
+
* Fixed "now" instant for the current-time indicator (doesn't tick), e.g. a
|
|
579
|
+
* server-synced clock. Defaults to the device clock, shifted into `timeZone`
|
|
580
|
+
* when one is set so the line matches the displayed events.
|
|
581
|
+
*/
|
|
582
|
+
now?: Date;
|
|
583
|
+
/** Column count for `mode="custom"`. */
|
|
584
|
+
numberOfDays?: number;
|
|
585
|
+
/** Consecutive full week rows for `mode="multiweek"` (default 2). */
|
|
586
|
+
numberOfWeeks?: number;
|
|
587
|
+
/** date-fns locale for titles, headers, and time labels. */
|
|
588
|
+
locale?: Locale;
|
|
589
|
+
/**
|
|
590
|
+
* Display events in this IANA time zone (e.g. `"America/New_York"`), DST-correct
|
|
591
|
+
* and independent of the device zone. Display-only: it shifts the wall-clock the
|
|
592
|
+
* grid lays out from, it doesn't change your `Date`s. Uses `eventsInTimeZone`.
|
|
593
|
+
*/
|
|
594
|
+
timeZone?: string;
|
|
595
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
596
|
+
theme?: Partial<SolidCalendarTheme>;
|
|
597
|
+
/** Height of the scroll viewport, in px. */
|
|
598
|
+
height?: number | string;
|
|
599
|
+
/** Class applied to the root element. */
|
|
600
|
+
className?: string;
|
|
601
|
+
/** Inline styles applied to the root element. */
|
|
602
|
+
style?: CSSProperties;
|
|
603
|
+
/** Tap an event (both layouts). */
|
|
604
|
+
onPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
605
|
+
/**
|
|
606
|
+
* Override the screen-reader label for each event. Receives the event and a
|
|
607
|
+
* `{ mode, isAllDay, ampm }` context; return the full text to announce. Defaults
|
|
608
|
+
* to each view's built-in label.
|
|
609
|
+
*/
|
|
610
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
611
|
+
/** 12-hour AM/PM time labels (default false). */
|
|
612
|
+
ampm?: boolean;
|
|
613
|
+
/** Initial pixels per hour. */
|
|
614
|
+
hourHeight?: number;
|
|
615
|
+
/**
|
|
616
|
+
* Minimum pixel height of a timed event box, so short events stay legible and
|
|
617
|
+
* clickable. Also the floor of the `boxHeight` handed to `renderTimeEvent`.
|
|
618
|
+
* Default 14; pass 0 to size every box strictly by its duration.
|
|
619
|
+
*/
|
|
620
|
+
minEventHeight?: number;
|
|
621
|
+
/**
|
|
622
|
+
* Inset in pixels between a timed event box and its column edges (each side).
|
|
623
|
+
* Default 1; pass 0 to let events fill their column.
|
|
624
|
+
*/
|
|
625
|
+
eventGap?: number;
|
|
626
|
+
/** Vertical scroll, in minutes from midnight. Applied on mount and whenever it changes. */
|
|
627
|
+
scrollOffsetMinutes?: number;
|
|
628
|
+
/** Sub-divisions per hour for the grid lines. */
|
|
629
|
+
timeslots?: number;
|
|
630
|
+
/** First hour shown (0–23). Default 0. */
|
|
631
|
+
minHour?: number;
|
|
632
|
+
/** Last hour shown, exclusive (1–24). Default 24. */
|
|
633
|
+
maxHour?: number;
|
|
634
|
+
/** Hide the left hour-axis column (lines stay, labels/gutter go). Default false. */
|
|
635
|
+
hideHours?: boolean;
|
|
636
|
+
/** Show the ISO week number in the header gutter. Default false. */
|
|
637
|
+
showWeekNumber?: boolean;
|
|
638
|
+
/** Prefix for the week number, e.g. "W" → "W28". Default "W". */
|
|
639
|
+
weekNumberPrefix?: string;
|
|
640
|
+
/** Shade the hours outside business hours. */
|
|
641
|
+
businessHours?: BusinessHours$1;
|
|
642
|
+
/**
|
|
643
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern).
|
|
644
|
+
* The grid keeps positioning the band; when set, the themed tint is dropped
|
|
645
|
+
* and your output fills the band instead. Decorative only: the
|
|
646
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
647
|
+
*/
|
|
648
|
+
renderBusinessHours?: (band: BusinessHoursBand$1) => JSX.Element;
|
|
649
|
+
/**
|
|
650
|
+
* A component that draws a `display: "background"` event's band in place of
|
|
651
|
+
* the themed shade; see `TimeGrid`'s prop of the same name.
|
|
652
|
+
*/
|
|
653
|
+
renderBackgroundEvent?: SolidRenderEvent<T>;
|
|
654
|
+
/** Show the current-time indicator (default true). */
|
|
655
|
+
showNowIndicator?: boolean;
|
|
656
|
+
/** Show the all-day lane (default true). */
|
|
657
|
+
showAllDayEventCell?: boolean;
|
|
658
|
+
/** Show the "all-day" text beside the lane (default false). */
|
|
659
|
+
showAllDayLabel?: boolean;
|
|
660
|
+
/** Tint weekend columns (default true). Set false to treat weekends normally. */
|
|
661
|
+
highlightWeekends?: boolean;
|
|
662
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
663
|
+
eventStartEditable?: boolean;
|
|
664
|
+
/** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
|
|
665
|
+
eventDurationEditable?: boolean;
|
|
666
|
+
/** Reject drags/resizes that would overlap another event (default true = allowed). */
|
|
667
|
+
eventOverlap?: boolean;
|
|
668
|
+
/** Snap dragged/created events to this many minutes. */
|
|
669
|
+
dragStepMinutes?: number;
|
|
670
|
+
/** DOM touch/pen hold duration in ms (default 300). */
|
|
671
|
+
touchDragDelay?: number;
|
|
672
|
+
/** DOM touch/pen movement tolerance in px (default 8). */
|
|
673
|
+
touchDragThreshold?: number;
|
|
674
|
+
/**
|
|
675
|
+
* Tap empty space: the date+time pressed on the week/day grid, or the tapped
|
|
676
|
+
* day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
677
|
+
*/
|
|
678
|
+
onPressCell?: (date: Date) => void;
|
|
679
|
+
/**
|
|
680
|
+
* Drag empty space to create. On the week/day grid that sweeps out a time
|
|
681
|
+
* range; in `month` mode it sweeps out an **all-day** span across the days
|
|
682
|
+
* dragged (`start` at midnight of the first, `end` at midnight after the last).
|
|
683
|
+
*/
|
|
684
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
685
|
+
/**
|
|
686
|
+
* A component that draws content inside the time-grid drag-to-create preview;
|
|
687
|
+
* see `TimeGrid`'s prop of the same name. Applies to the week/day grid only.
|
|
688
|
+
*/
|
|
689
|
+
renderCreateGhost?: Component<CreateGhostArgs$1>;
|
|
690
|
+
/** Fires when an event drag begins. */
|
|
691
|
+
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
692
|
+
/**
|
|
693
|
+
* Enables drag-to-move/resize; return `false` to reject the drop. In `month`
|
|
694
|
+
* mode an event chip can be dragged onto another day, shifting both ends by the
|
|
695
|
+
* days dragged so the time of day and duration are kept.
|
|
696
|
+
*/
|
|
697
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
698
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
699
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
700
|
+
/** Tap a day's column header. */
|
|
701
|
+
onPressDateHeader?: (day: Date) => void;
|
|
702
|
+
/** Custom time-grid event renderer. */
|
|
703
|
+
renderTimeEvent?: SolidRenderEvent<T>;
|
|
704
|
+
/** Replace the hour-axis label. Receives the hour (0–23) and the `ampm` flag. */
|
|
705
|
+
hourComponent?: (hour: number, ampm: boolean) => JSX.Element;
|
|
706
|
+
/**
|
|
707
|
+
* Add arrow-key navigation between time-grid events (a convenience for sighted
|
|
708
|
+
* keyboard users; every event stays individually tabbable). Time-grid modes only.
|
|
709
|
+
*/
|
|
710
|
+
keyboardEventNavigation?: boolean;
|
|
711
|
+
/** Max chips per day before a "+N more" row. */
|
|
712
|
+
maxVisibleEventCount?: number;
|
|
713
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
714
|
+
chipHeight?: number;
|
|
715
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
716
|
+
chipGap?: number;
|
|
717
|
+
/** Overflow row template; `{moreCount}` is replaced. */
|
|
718
|
+
moreLabel?: string;
|
|
719
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
720
|
+
labels?: Partial<CalendarLabels$1>;
|
|
721
|
+
/** Render neighbouring months' days in the leading/trailing cells (default true). */
|
|
722
|
+
showAdjacentMonths?: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* Render the built-in "Month yyyy" title above the month grid. Default true. Set
|
|
725
|
+
* false when your own header already shows the month and year. Month mode only.
|
|
726
|
+
*/
|
|
727
|
+
showTitle?: boolean;
|
|
728
|
+
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
729
|
+
weekdayFormat?: WeekdayFormat$1;
|
|
730
|
+
/** Fill the cell with the range background instead of the pill band. */
|
|
731
|
+
fillCellOnSelection?: boolean;
|
|
732
|
+
/** Selected span. */
|
|
733
|
+
selectedRange?: DateRange$1;
|
|
734
|
+
/** Discrete selected days. */
|
|
735
|
+
selectedDates?: Date[];
|
|
736
|
+
/**
|
|
737
|
+
* In month mode, make day cells keyboard-navigable (one roving tab stop, arrow
|
|
738
|
+
* keys, Enter to open the day). Default false: keyboard focus moves through
|
|
739
|
+
* events only. Has no effect on the time-grid modes.
|
|
740
|
+
*/
|
|
741
|
+
keyboardDayNavigation?: boolean;
|
|
742
|
+
/** Tap a day cell. */
|
|
743
|
+
onPressDay?: (date: Date) => void;
|
|
744
|
+
/**
|
|
745
|
+
* Month and year modes: reports a create sweep's day span as it happens, as the
|
|
746
|
+
* ordered inclusive `[start, end]` days, so a selection highlight can follow the
|
|
747
|
+
* drag. Pair it with `createDateRange`'s `selectRange`. Enables the sweep on its
|
|
748
|
+
* own, so it works without `onCreateEvent`.
|
|
749
|
+
*/
|
|
750
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
751
|
+
/** Tap a month's title in the year view, e.g. jump to that month. */
|
|
752
|
+
onPressMonth?: (month: Date) => void;
|
|
753
|
+
/** Tap the "+N more" overflow row. */
|
|
754
|
+
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
755
|
+
/** Custom month chip renderer. */
|
|
756
|
+
renderMonthEvent?: SolidMonthEvent<T>;
|
|
757
|
+
/** Custom agenda row renderer (`mode="schedule"`). */
|
|
758
|
+
renderScheduleEvent?: SolidAgendaEvent<T>;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Main entry point for the Solid renderer: it picks the right
|
|
762
|
+
* view for `mode`. `month` renders a single {@link MonthView}; `schedule` renders
|
|
763
|
+
* an {@link Agenda}; the time-grid modes render a {@link TimeGrid}. For a
|
|
764
|
+
* scrolling month picker, use {@link MonthList} directly.
|
|
765
|
+
*
|
|
766
|
+
* @example
|
|
767
|
+
* ```tsx
|
|
768
|
+
* <Calendar mode="week" date={new Date()} events={events} />
|
|
769
|
+
* ```
|
|
770
|
+
*/
|
|
771
|
+
export declare function Calendar<T = unknown>(incoming: CalendarProps<T> & {
|
|
772
|
+
ref?: (handle: CalendarHandle$1) => void;
|
|
773
|
+
}): JSX.Element;
|
|
774
|
+
/**
|
|
775
|
+
* Styleable parts of {@link MonthList}. The shared weekday header uses `weekdays`
|
|
776
|
+
* / `weekday`; every other slot is forwarded to each month's {@link MonthView}
|
|
777
|
+
* (e.g. `title`, `day`, `chip`). See {@link MonthViewSlot}.
|
|
778
|
+
*/
|
|
779
|
+
type MonthListSlot = MonthViewSlot;
|
|
780
|
+
/** Props for {@link MonthList}. */
|
|
781
|
+
interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotStyleProps<MonthListSlot> {
|
|
782
|
+
/** Anchor month; the list spans `pastMonths` before to `futureMonths` after. */
|
|
783
|
+
date: Date;
|
|
784
|
+
/** Months to render before the anchor (default 1). */
|
|
785
|
+
pastMonths?: number;
|
|
786
|
+
/** Months to render after the anchor (default 12). */
|
|
787
|
+
futureMonths?: number;
|
|
788
|
+
/** First day of the week. Sunday = 0 (default) ... Saturday = 6. */
|
|
789
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
790
|
+
/** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
|
|
791
|
+
weekdayFormat?: WeekdayFormat$1;
|
|
792
|
+
/** Tint weekend day cells with the theme's weekend background (default true). */
|
|
793
|
+
highlightWeekends?: boolean;
|
|
794
|
+
/** Events to render as chips in each day cell (calendar layout when provided). */
|
|
795
|
+
events?: CalendarEvent$1<T>[];
|
|
796
|
+
/** Custom chip renderer; falls back to the built-in titled chip. */
|
|
797
|
+
renderEvent?: SolidMonthEvent<T>;
|
|
798
|
+
/**
|
|
799
|
+
* Override the screen-reader label for each event chip. Receives the event and a
|
|
800
|
+
* `{ mode: "month", isAllDay, ampm: false }` context; return the full text to
|
|
801
|
+
* announce. Defaults to the event title and day (e.g. "Standup, 15 July").
|
|
802
|
+
*/
|
|
803
|
+
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
804
|
+
/** Max chips shown per day before a "+N more" row (default 3). */
|
|
805
|
+
maxVisibleEventCount?: number;
|
|
806
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
807
|
+
chipHeight?: number;
|
|
808
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
809
|
+
chipGap?: number;
|
|
810
|
+
/** Template for the overflow row; `{moreCount}` is replaced. */
|
|
811
|
+
moreLabel?: string;
|
|
812
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
813
|
+
labels?: Partial<CalendarLabels$1>;
|
|
814
|
+
/** Tap an event chip. */
|
|
815
|
+
onPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
816
|
+
/** Tap the "+N more" overflow row. */
|
|
817
|
+
onPressMore?: (events: CalendarEvent$1<T>[], date: Date) => void;
|
|
818
|
+
/** Selected span; days between the endpoints get the range band. */
|
|
819
|
+
selectedRange?: DateRange$1;
|
|
820
|
+
/** Discrete selected days (single / multiple). */
|
|
821
|
+
selectedDates?: Date[];
|
|
822
|
+
/** Fill the whole cell on selection instead of the default rounded pill band. */
|
|
823
|
+
fillCellOnSelection?: boolean;
|
|
824
|
+
/** date-fns locale for the month titles and weekday labels. */
|
|
825
|
+
locale?: Locale;
|
|
826
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
827
|
+
theme?: Partial<SolidCalendarTheme>;
|
|
828
|
+
/** Height of the scroll viewport, in px (default 480). */
|
|
829
|
+
height?: number | string;
|
|
830
|
+
/**
|
|
831
|
+
* When events are shown, make each month's day cells keyboard-navigable (roving
|
|
832
|
+
* tab stop, arrow keys, Enter to open the day). Default false. The picker
|
|
833
|
+
* layout (no `events`) is always navigable regardless.
|
|
834
|
+
*/
|
|
835
|
+
keyboardDayNavigation?: boolean;
|
|
836
|
+
/** Fired when a selectable day is clicked. */
|
|
837
|
+
onPressDay?: (date: Date) => void;
|
|
838
|
+
/** Class applied to the root element. */
|
|
839
|
+
className?: string;
|
|
840
|
+
/** Inline styles applied to the root element. */
|
|
841
|
+
style?: CSSProperties;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* A vertically scrolling, virtualized list of months: the date picker. Built on
|
|
845
|
+
* measured row virtualization and the library's headless grid logic. Selection is
|
|
846
|
+
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
847
|
+
*/
|
|
848
|
+
export declare function MonthList<T = unknown>(incoming: MonthListProps<T>): JSX.Element;
|
|
849
|
+
/** Styleable chrome of the pickers (the calendar's own slots forward through too). */
|
|
850
|
+
type DatePickerSlot = "trigger" | "popover" | "footer" | "clear";
|
|
851
|
+
interface PickerBaseProps extends DateSelectionConstraints$1, SlotStyleProps<DatePickerSlot | MonthListSlot> {
|
|
852
|
+
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
853
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
854
|
+
/** Height of the popover calendar viewport in px (default 320). */
|
|
855
|
+
height?: number;
|
|
856
|
+
/** Placeholder shown on the trigger when nothing is selected. */
|
|
857
|
+
placeholder?: string;
|
|
858
|
+
/** Disable the field and close its popover. Re-enabling leaves the popover closed. */
|
|
859
|
+
disabled?: boolean;
|
|
860
|
+
/** Theme overrides for the calendar. */
|
|
861
|
+
theme?: Partial<SolidCalendarTheme>;
|
|
862
|
+
/** Class applied to the root element. */
|
|
863
|
+
className?: string;
|
|
864
|
+
/** Inline styles applied to the root element. */
|
|
865
|
+
style?: CSSProperties;
|
|
866
|
+
}
|
|
867
|
+
/** Props for {@link DatePicker}. */
|
|
868
|
+
interface DatePickerProps extends PickerBaseProps {
|
|
869
|
+
/** The selected day, or `null`. */
|
|
870
|
+
value: Date | null;
|
|
871
|
+
/** Called with the day the user picks. */
|
|
872
|
+
onChange: (date: Date) => void;
|
|
873
|
+
/** Format the trigger label. Default: `d MMM yyyy`. */
|
|
874
|
+
formatLabel?: (date: Date) => string;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* A single-date input with a popover calendar. Controlled via `value` / `onChange`.
|
|
878
|
+
* Composed from {@link MonthList}; forward calendar slots (e.g. `dayBadge`) through
|
|
879
|
+
* `classNames` to restyle the popover.
|
|
880
|
+
*
|
|
881
|
+
* @example
|
|
882
|
+
* ```tsx
|
|
883
|
+
* const [value, setValue] = createSignal<Date | null>(null);
|
|
884
|
+
* <DatePicker value={value} onChange={setValue} />
|
|
885
|
+
* ```
|
|
886
|
+
*/
|
|
887
|
+
export declare function DatePicker(incoming: DatePickerProps): JSX.Element;
|
|
888
|
+
/** Props for {@link DateRangePicker}. */
|
|
889
|
+
interface DateRangePickerProps extends PickerBaseProps {
|
|
890
|
+
/** The selected range, or `null`. `end` is `null` while only the start is picked. */
|
|
891
|
+
value: DateRange$1 | null;
|
|
892
|
+
/** Called with the next range on each pick (start-only, then complete). */
|
|
893
|
+
onChange: (range: DateRange$1 | null) => void;
|
|
894
|
+
/** Format the trigger label. Default: `d MMM – d MMM yyyy`. */
|
|
895
|
+
formatLabel?: (range: DateRange$1) => string;
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* A date-range input with a popover calendar. Controlled via `value` / `onChange`;
|
|
899
|
+
* each pick advances the range through {@link nextDateRange} (start, then end), and
|
|
900
|
+
* the popover closes once both ends are set.
|
|
901
|
+
*
|
|
902
|
+
* @example
|
|
903
|
+
* ```tsx
|
|
904
|
+
* const [range, setRange] = createSignal<DateRange | null>(null);
|
|
905
|
+
* <DateRangePicker value={range} onChange={setRange} />
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
export declare function DateRangePicker(incoming: DateRangePickerProps): JSX.Element;
|
|
909
|
+
/** Props for {@link MultiWeekView}. */
|
|
910
|
+
interface MultiWeekViewProps<T = unknown> extends Omit<MonthViewProps<T>, "date" | "weekStartsOn" | "showAdjacentMonths"> {
|
|
911
|
+
/**
|
|
912
|
+
* Any day in the first week to show. The rows start on the `weekStartsOn` day
|
|
913
|
+
* on or before it, in the device's local calendar.
|
|
914
|
+
*/
|
|
915
|
+
date: Date;
|
|
916
|
+
/**
|
|
917
|
+
* How many consecutive full weeks to show, as stacked rows. A positive whole
|
|
918
|
+
* number; default 2. Other values throw a `RangeError`.
|
|
919
|
+
*/
|
|
920
|
+
numberOfWeeks?: number;
|
|
921
|
+
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
922
|
+
weekStartsOn?: WeekStartsOn$1;
|
|
923
|
+
/** Event chip and overflow-button height in pixels (default 24). */
|
|
924
|
+
chipHeight?: number;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Consecutive full weeks as stacked seven-day rows, with event chips and no hour
|
|
928
|
+
* slots. It has the month grid's event bars, overflow, selection, and drag
|
|
929
|
+
* interactions, and the month slots, `renderEvent`, and theme style it. Every
|
|
930
|
+
* row is kept at full height; when the view is given less room, the rows scroll
|
|
931
|
+
* under the title and weekday header.
|
|
932
|
+
*
|
|
933
|
+
* Standalone, it shows `events` as given; expand recurring events first with
|
|
934
|
+
* `expandRecurringEvents`, or use `Calendar` with `mode="multiweek"`.
|
|
935
|
+
*
|
|
936
|
+
* @example
|
|
937
|
+
* ```tsx
|
|
938
|
+
* <MultiWeekView date={new Date()} numberOfWeeks={3} events={events} />
|
|
939
|
+
* ```
|
|
940
|
+
*/
|
|
941
|
+
export declare function MultiWeekView<T = unknown>(props: MultiWeekViewProps<T>): JSX.Element;
|
|
942
|
+
/**
|
|
943
|
+
* Styleable parts of {@link ResourceTimeline}. Pass a class or inline style per
|
|
944
|
+
* slot via the `classNames` / `styles` props.
|
|
945
|
+
*/
|
|
946
|
+
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
947
|
+
/** A schedulable lane (room, person, machine) that events are grouped under. */
|
|
948
|
+
interface Resource {
|
|
949
|
+
/** Stable id events reference via their `resourceId`. */
|
|
950
|
+
id: string;
|
|
951
|
+
/** Row label; falls back to the id. */
|
|
952
|
+
title?: string;
|
|
953
|
+
}
|
|
954
|
+
/** Props passed to a custom resource-timeline event renderer. */
|
|
955
|
+
interface ResourceEventArgs<T = unknown> {
|
|
956
|
+
event: CalendarEvent$1<T>;
|
|
957
|
+
/**
|
|
958
|
+
* Pixel width of the event bar. In the vertical orientation the columns flex
|
|
959
|
+
* to the container, so this is 0 there; size against `height` instead.
|
|
960
|
+
*/
|
|
961
|
+
width: number;
|
|
962
|
+
/** Pixel height of the event bar; set in the vertical orientation. */
|
|
963
|
+
height?: number;
|
|
964
|
+
onPress: () => void;
|
|
965
|
+
}
|
|
966
|
+
/** Props for {@link ResourceTimeline}. */
|
|
967
|
+
interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTimelineSlot> {
|
|
968
|
+
/** The day to lay out along the time axis. */
|
|
969
|
+
date: Date;
|
|
970
|
+
/**
|
|
971
|
+
* Lay the day out along the horizontal axis with resources as rows (the
|
|
972
|
+
* default), or down the vertical axis with resources as columns, like the
|
|
973
|
+
* time grid. Vertical reads better on narrow screens: the columns share the
|
|
974
|
+
* width instead of the axis scrolling sideways.
|
|
975
|
+
*/
|
|
976
|
+
orientation?: "horizontal" | "vertical";
|
|
977
|
+
/** The resource lanes: rows when horizontal, columns when vertical. */
|
|
978
|
+
resources: Resource[];
|
|
979
|
+
/**
|
|
980
|
+
* Cap the number of lanes shown at once; the rest sit on further pages. Pair
|
|
981
|
+
* with `resourcePage` and your own prev/next controls to page through them
|
|
982
|
+
* (like `date` drives the time axis). Omit to show every lane, sharing the
|
|
983
|
+
* available space.
|
|
984
|
+
*/
|
|
985
|
+
resourcesPerPage?: number;
|
|
986
|
+
/**
|
|
987
|
+
* The 0-based page of lanes to show when `resourcesPerPage` is set (default
|
|
988
|
+
* 0, clamped to the last page). Controlled: update it from your own paging
|
|
989
|
+
* controls.
|
|
990
|
+
*/
|
|
991
|
+
resourcePage?: number;
|
|
992
|
+
/** Events; each is placed in the row named by `resourceId(event)`. */
|
|
993
|
+
events: CalendarEvent$1<T>[];
|
|
994
|
+
/** Read an event's resource id. Default: `event.resourceId`. */
|
|
995
|
+
resourceId?: (event: CalendarEvent$1<T>) => string | undefined;
|
|
996
|
+
/** First hour shown (default 0). */
|
|
997
|
+
startHour?: number;
|
|
998
|
+
/** Last hour shown, exclusive (default 24). */
|
|
999
|
+
endHour?: number;
|
|
1000
|
+
/** Pixels per hour along the horizontal axis (default 80). Horizontal only. */
|
|
1001
|
+
hourWidth?: number;
|
|
1002
|
+
/** Pixels per hour down the vertical axis (default 48). Vertical only. */
|
|
1003
|
+
hourHeight?: number;
|
|
1004
|
+
/** Height of each resource row in px (default 56). Horizontal only. */
|
|
1005
|
+
rowHeight?: number;
|
|
1006
|
+
/** Width of the left resource-label column in px (default 140). Horizontal only. */
|
|
1007
|
+
labelWidth?: number;
|
|
1008
|
+
/** 12-hour AM/PM axis labels (default false). */
|
|
1009
|
+
ampm?: boolean;
|
|
1010
|
+
/** Theme overrides; falls back to the default light theme. */
|
|
1011
|
+
theme?: Partial<SolidCalendarTheme>;
|
|
1012
|
+
/** Custom event renderer; falls back to the built-in bar. */
|
|
1013
|
+
renderEvent?: Component<ResourceEventArgs<T>>;
|
|
1014
|
+
/** Tap an event. */
|
|
1015
|
+
onPressEvent?: (event: CalendarEvent$1<T>) => void;
|
|
1016
|
+
/**
|
|
1017
|
+
* Enables drag-to-move and edge-resize along the time axis; called with the
|
|
1018
|
+
* proposed new start/end. Return `false` to reject the drop (it snaps back).
|
|
1019
|
+
*/
|
|
1020
|
+
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
|
|
1021
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
1022
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
1023
|
+
/** Tap empty lane space; called with the snapped time and the lane's resource. */
|
|
1024
|
+
onPressCell?: (at: Date, resource: Resource) => void;
|
|
1025
|
+
/** Drag empty lane space to create; called with the swept start/end and the lane's resource. */
|
|
1026
|
+
onCreateEvent?: (start: Date, end: Date, resource: Resource) => void;
|
|
1027
|
+
/**
|
|
1028
|
+
* A component that draws content inside the drag-to-create preview, such as a
|
|
1029
|
+
* draft title and the live time range. It receives the snapped `start` and
|
|
1030
|
+
* `end` that `onCreateEvent` would get if the pointer were released now, plus
|
|
1031
|
+
* the lane's resource, and its props update as the sweep changes them. The
|
|
1032
|
+
* board keeps positioning, sizing and styling the preview and clips the
|
|
1033
|
+
* content to it; the content is non-interactive and hidden from assistive
|
|
1034
|
+
* tech. Renders only while a sweep can create, so it needs `onCreateEvent` and
|
|
1035
|
+
* does not enable creation itself. Applies to both orientations.
|
|
1036
|
+
*/
|
|
1037
|
+
renderCreateGhost?: Component<CreateGhostArgs$1 & {
|
|
1038
|
+
resource: Resource;
|
|
1039
|
+
}>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Shade the hours outside this window, per lane. Same shape as the Calendar's
|
|
1042
|
+
* `businessHours` plus the lane's resource, so per-resource opening hours work
|
|
1043
|
+
* (return `null` for a fully closed lane). A date-only function is accepted.
|
|
1044
|
+
*/
|
|
1045
|
+
businessHours?: (date: Date, resource: Resource) => BusinessHoursValue;
|
|
1046
|
+
/**
|
|
1047
|
+
* Render a closed-hours band's content yourself (a label, icon, pattern). The
|
|
1048
|
+
* board keeps positioning the band; when set, the themed tint is dropped and
|
|
1049
|
+
* your output fills the band instead. Receives the lane's resource. Decorative only: the
|
|
1050
|
+
* band stays non-interactive and hidden from assistive tech.
|
|
1051
|
+
*/
|
|
1052
|
+
renderBusinessHours?: (band: BusinessHoursBand$1 & {
|
|
1053
|
+
resource: Resource;
|
|
1054
|
+
}) => JSX.Element;
|
|
1055
|
+
/**
|
|
1056
|
+
* Render each resource's header cell yourself (an avatar, a subtitle, a status
|
|
1057
|
+
* dot). Receives the resource and its index; return the cell's content. The board
|
|
1058
|
+
* keeps the header cell's sizing so columns stay aligned, so this replaces only
|
|
1059
|
+
* the label content. Falls back to the resource title (or id). Applies to both
|
|
1060
|
+
* orientations: the top header cells when vertical, the row labels when horizontal.
|
|
1061
|
+
*/
|
|
1062
|
+
renderResourceHeader?: (resource: Resource, index: number) => JSX.Element;
|
|
1063
|
+
/** Snap dragged events to this many minutes (default 15). */
|
|
1064
|
+
dragStepMinutes?: number;
|
|
1065
|
+
/**
|
|
1066
|
+
* Words for the move and resize actions and the event labels. Keys you omit
|
|
1067
|
+
* stay in English (`defaultCalendarLabels`).
|
|
1068
|
+
*/
|
|
1069
|
+
labels?: Partial<CalendarLabels$1>;
|
|
1070
|
+
/** Show the current-time line when `date` is today (default true). */
|
|
1071
|
+
showNowIndicator?: boolean;
|
|
1072
|
+
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
1073
|
+
now?: Date;
|
|
1074
|
+
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
1075
|
+
timeZone?: string;
|
|
1076
|
+
/** Class applied to the root element. */
|
|
1077
|
+
className?: string;
|
|
1078
|
+
/** Inline styles applied to the root element. */
|
|
1079
|
+
style?: CSSProperties;
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* A horizontal resource timeline: rows are resources (rooms, people, machines)
|
|
1083
|
+
* and the x-axis is one day's hours. Events sit in their resource's row, and
|
|
1084
|
+
* overlapping events in the same row stack into sub-lanes (via the shared
|
|
1085
|
+
* `layoutDayEvents`). Pass `onDragEvent` to enable drag-to-move and edge-resize
|
|
1086
|
+
* along the axis.
|
|
1087
|
+
*
|
|
1088
|
+
* @example
|
|
1089
|
+
* ```tsx
|
|
1090
|
+
* <ResourceTimeline
|
|
1091
|
+
* date={new Date()}
|
|
1092
|
+
* resources={[{ id: "a", title: "Room A" }, { id: "b", title: "Room B" }]}
|
|
1093
|
+
* events={events} // each event carries a `resourceId`
|
|
1094
|
+
* />
|
|
1095
|
+
* ```
|
|
1096
|
+
*/
|
|
1097
|
+
export declare function ResourceTimeline<T = unknown>(incoming: ResourceTimelineProps<T>): JSX.Element;
|
|
1098
|
+
interface NowOptions {
|
|
1099
|
+
enabled?: boolean;
|
|
1100
|
+
now?: Date;
|
|
1101
|
+
timeZone?: string;
|
|
1102
|
+
tickMs?: number;
|
|
1103
|
+
}
|
|
1104
|
+
/** A clock accessor that follows reactive overrides and stops ticking on disposal. */
|
|
1105
|
+
export declare function createNow(options?: Accessor<NowOptions>): Accessor<Date>;
|
|
1106
|
+
interface DateRangeOptions extends DateSelectionConstraints$1 {
|
|
1107
|
+
initialRange?: DateRange$1 | null;
|
|
1108
|
+
}
|
|
1109
|
+
/** Reactive range selection. Pass a getter so constraints can change after mounting. */
|
|
1110
|
+
export declare function createDateRange(options?: Accessor<DateRangeOptions>): {
|
|
1111
|
+
range: import("solid-js").SourceAccessor<DateRange$1 | null>;
|
|
1112
|
+
setRange: import("solid-js").Setter<DateRange$1 | null>;
|
|
1113
|
+
reset: () => null;
|
|
1114
|
+
onPressDate: (date: Date) => DateRange$1 | null;
|
|
1115
|
+
selectRange: (a: Date, b: Date) => void;
|
|
1116
|
+
};
|
|
1117
|
+
/** A reactive, renderer-independent month grid. */
|
|
1118
|
+
export declare function createMonthGrid(month: Accessor<Date>, options?: Accessor<UseMonthGridOptions$1>): import("solid-js").SourceAccessor<import("@super-calendar/core/vanilla").MonthGrid>;
|
|
1119
|
+
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CSSProperties, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CreateGhostArgs, type DatePickerProps, type DatePickerSlot, type DateRange, type DateRangeOptions, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventSource, type EventSourceOptions, type EventSourceState, 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 NowOptions, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ResourceTimelineSlot, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type SolidAgendaEvent, type SolidAgendaEventArgs, type SolidCalendarTheme, type SolidMonthEvent, type SolidMonthEventArgs, type SolidRenderEvent, type SolidRenderEventArgs, 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, loadEventSource, nextDateRange, parseICalendar, toICalendar, weekdayFormatToken };
|