forked from clauderic/react-infinite-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
259 lines (210 loc) · 5.04 KB
/
index.d.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
import * as React from "react";
export interface CalendarProps {
/**
* Value of the date that appears to be selected. Set to false if you don't wish to have a date initially selected.
*
* @default new Date()
*/
selected?: Date | Date[] | false | CalendarDateRanger;
/**
* Width of the calendar, in pixels
*
* @default 400
*/
width?: number;
/**
* Height of the calendar, in pixels
*
* @default 600
*/
height?: number;
/**
* The minimum date that is selectable.
*
* @default new Date(1980, 0, 1)
*/
minDate?: Date;
/**
* The maximum date that is selectable.
*
* @default new Date(2050, 11, 31)
*/
maxDate?: Date;
/**
* Array of days of the week that should be disabled.
*
* @default []
*/
disabledDays?: DayOfWeek[]
/**
* Array of dates that should be disabled.
*
* @default[]
*/
disabledDates?: Date[];
/**
* Whether to display the years or days view.
*
* @default "days"
*/
display?: "years" | "days";
displayOptions?: CalendarDisplayOptions;
locale?: CalendarLocale;
theme?: CalendarTheme;
/**
* Optional CSS class name to append to the root InfiniteCalendar element.
*/
className?: string;
/**
* Height of each row in the calendar (each week is considered a row)
*
* @default 56
*/
rowHeight?: number;
/**
* Whether the Calendar root should be auto-focused when it mounts.
*
* This is useful when keyboardSupport is enabled (the calendar must be focused to listen for keyboard events)
*
* @default true
*/
autoFocus?: boolean;
/**
* Tab-index of the calendar
*
* @default 1
*/
tabIndex?: number;
/**
* @default withDateSelection(Calendar)
*/
Component?: Calendar;
/**
* Callback invoked after beforeSelect() returns true, but before the state of the calendar updates
*/
onSelect?(value: Date | Date[] | CalendarDateRanger): void;
/**
* Callback invoked when the scroll offset changes
*/
onScroll?(scrollTop: number): void;
/**
* Callback invoked 150ms after the last onScroll event is triggered.
*/
onScrollEnd?(scrollTop: number): void;
}
/**
* Calendar with default settings
*/
export default Calendar;
export class Calendar extends React.PureComponent<CalendarProps, {}> {
}
export function withDateSelection(component: Calendar): Calendar;
export function withKeyboardSupport(component: Calendar): Calendar;
export function withMultipleDates(component: Calendar): Calendar;
export function defaultMultipleDateInterpolatio(component: Calendar): Calendar;
export function withRange(component: Calendar): Calendar;
export enum EVENT_TYPE {
START = 1,
HOVER = 2,
END = 3,
}
export enum DayOfWeek {MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY}
export interface CalendarDisplayOptions {
/**
* Layout of the calendar.
*
* @default portrait
*/
layout?: "portrait" | "landscape";
/**
* Show/hide the header
*
* @default true
*/
showHeader?: boolean;
/**
* Enable/Disable the header animation
*
* @default true
*/
shouldHeaderAnimate?: boolean;
/**
* Show/hide the month overlay when scrolling
*
* @default true
*/
showOverlay?: boolean;
/**
* Show/hide the floating back to Today helper
*
* @default true
*/
showTodayHelper?: boolean;
/**
* Show/hide the weekdays in the header
*
* @default true
*/
showWeekdays?: boolean;
/**
* Whether to automatically hide the years view on select.
*
* @default true
*/
hideYearsOnSelect?: boolean;
/**
* Number of months to render above/below the visible months.
*
* Tweaking this can help reduce flickering during scrolling on certain browers/devices.
*
* @default 4
*/
overscanMonthCount?: number;
/**
* This controls the number of rows to scroll past before the Today helper appears
*
* @default 4
*/
todayHelperRowOffset?: number;
}
export interface CalendarLocale {
/**
* @example Select a date...
*/
blank?: string;
/**
* @example ddd, MMM Do
*/
headerFormat?: string;
todayLabel?: {
/**
* @example Today
*/
long?: string;
},
/**
* @example ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
*/
weekdays?: string[];
weekStartsOn?: DayOfWeek;
}
export interface CalendarTheme {
accentColor?: string;
floatingNav?: {
background?: string;
color?: string;
chevron?: string;
};
headerColor?: string;
selectionColor?: string;
textColor?: {
active?: string;
default?: string;
},
todayColor?: string;
weekdayColor?: string;
}
export interface CalendarDateRanger {
from: Date;
to: Date;
}