-
-
Notifications
You must be signed in to change notification settings - Fork 697
/
EventHandlers.ts
102 lines (90 loc) · 2.78 KB
/
EventHandlers.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import {
FocusEvent,
KeyboardEvent,
MouseEvent,
PointerEvent,
TouchEvent
} from "react";
import { DateRange } from "./Matchers";
import { ActiveModifiers } from "./Modifiers";
/** The event handler when a day is clicked. */
export type DayClickEventHandler = (
day: Date,
activeModifiers: ActiveModifiers,
e: MouseEvent
) => void;
/** The event handler when a day is focused. */
export type DayFocusEventHandler = (
day: Date,
activeModifiers: ActiveModifiers,
e: FocusEvent | KeyboardEvent
) => void;
/** The event handler when a day gets a keyboard event. */
export type DayKeyboardEventHandler = (
day: Date,
activeModifiers: ActiveModifiers,
e: KeyboardEvent
) => void;
/** The event handler when a day gets a mouse event. */
export type DayMouseEventHandler = (
day: Date,
activeModifiers: ActiveModifiers,
e: MouseEvent
) => void;
/** The event handler when a day gets a pointer event. */
export type DayPointerEventHandler = (
day: Date,
activeModifiers: ActiveModifiers,
e: PointerEvent
) => void;
/** The event handler when a month is changed in the calendar. */
export type MonthChangeEventHandler = (month: Date) => void;
/** The event handler when selecting multiple days. */
export type SelectMultipleEventHandler = (
/** The selected days */
days: Date[] | undefined,
/** The day that was clicked triggering the event. */
selectedDay: Date,
/** The day that was clicked */
activeModifiers: ActiveModifiers,
/** The mouse event that triggered this event. */
e: MouseEvent
) => void;
/** The event handler when selecting a range of days. */
export type SelectRangeEventHandler = (
/** The current range of the selected days. */
range: DateRange | undefined,
/** The day that was selected (or clicked) triggering the event. */
selectedDay: Date,
/** The modifiers of the selected day. */
activeModifiers: ActiveModifiers,
e: MouseEvent
) => void;
/** The event handler when selecting a single day. */
export type SelectSingleEventHandler = (
/**
* The selected day, `undefined` when `required={false}` (default) and the day
* is clicked again.
*/
day: Date | undefined,
/** The day that was selected (or clicked) triggering the event. */
selectedDay: Date,
/** The modifiers of the selected day. */
activeModifiers: ActiveModifiers,
e: MouseEvent
) => void;
/** The event handler when the week number is clicked. */
export type WeekNumberClickEventHandler = (
/** The week number that has been clicked. */
weekNumber: number,
/** The dates in the clicked week. */
dates: Date[],
/** The mouse event that triggered this event. */
e: MouseEvent
) => void;
/** The event handler when a day gets a touch event. */
export type DayTouchEventHandler = (
day: Date,
activeModifiers: ActiveModifiers,
e: TouchEvent
) => void;