forked from gpbl/react-day-picker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
166 lines (148 loc) · 5.86 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
// Type definitions for react-day-picker 5.2
// Project: https://github.com/gpbl/react-day-picker
// Definitions by: Giampaolo Bellavite <https://github.com/gpbl>, Jason Killian <https://github.com/jkillian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import * as React from 'react';
declare namespace DayPicker {
export interface LocaleUtils {
formatDay(day: Date, locale: string): string;
formatMonthTitle(month: Date, locale: string): string;
formatWeekdayLong(weekday: number, locale: string): string;
formatWeekdayShort(weekday: number, locale: string): string;
getFirstDayOfWeek(locale: string): number;
getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string];
}
export interface DateUtils {
addMonths(d: Date, n: number): Date;
clone(d: Date): Date;
isSameDay(d1: Date, d2: Date): Date;
isPastDay(d: Date): boolean;
isFutureDay(d: Date): boolean;
isDayBetween(day: Date, begin: Date, end: Date): boolean;
addDayToRange(day: Date, range: RangeModifier): RangeModifier;
isDayInRange(day: Date, range: RangeModifier): boolean;
}
export interface CaptionElementProps {
date: Date;
styles: Styles,
localeUtils: LocaleUtils;
locale: string;
months: undefined;
onClick?: React.MouseEventHandler<HTMLElement>;
}
export interface NavbarElementProps {
style: {};
styles: Styles;
previousMonth: Date;
nextMonth: Date;
showPreviousButton: boolean;
showNextButton: boolean;
onPreviousClick(callback?: () => void): void;
onNextClick(callback?: () => void): void;
dir?: string;
labels: { previousMonth: string; nextMonth: string; };
localeUtils: LocaleUtils;
locale: string;
}
export interface WeekdayElementProps {
weekday: number;
style: {};
localeUtils: LocaleUtils;
locale: string;
}
export interface Styles {
container?: {};
interactionDisabled?: {};
navBar?: {};
navButtonPrev?: {};
navButtonNext?: {};
month?: {};
caption?: {};
weekdays?: {};
weekdaysRow?: {};
weekday?: {};
body?: {};
week?: {};
day?: {};
today?: {};
selected?: {};
disabled?: {};
outside?: {};
}
export interface RangeModifier {
from: Date;
to: Date;
}
export interface BeforeModifier {
before: Date;
}
export interface AfterModifier {
after: Date;
}
export interface FunctionModifier {
(date: Date): boolean;
}
export type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier;
export interface Modifiers {
today: Modifier | Modifier[];
outside: Modifier | Modifier[];
[other: string]: Modifier | Modifier[] | undefined;
}
export interface Props {
canChangeMonth?: boolean;
captionElement?: React.ReactElement<Partial<CaptionElementProps>> |
React.ComponentClass<CaptionElementProps> |
React.SFC<CaptionElementProps>;
styles?: Styles;
containerProps?: React.HTMLAttributes<HTMLDivElement>;
disabledDays?: Modifier | Modifier[];
enableOutsideDays?: boolean;
firstDayOfWeek?: number;
fixedWeeks?: boolean;
fromMonth?: Date;
initialMonth?: Date;
labels?: { previousMonth: string; nextMonth: string; };
locale?: string;
localeUtils?: LocaleUtils;
modifiers?: Partial<Modifiers>;
month?: Date;
months?: [string, string, string, string, string, string, string, string, string, string, string, string];
navbarElement?: React.ReactElement<Partial<NavbarElementProps>> |
React.ComponentClass<NavbarElementProps> |
React.SFC<NavbarElementProps>;
numberOfMonths?: number;
onBlur?(e: React.FocusEvent<HTMLDivElement>): void;
onCaptionClick?(month: Date, e: React.MouseEvent<HTMLDivElement>): void;
onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent<HTMLDivElement>): void;
onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent<HTMLDivElement>): void;
onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent<HTMLDivElement>): void;
onFocus?(e: React.FocusEvent<HTMLDivElement>): void;
onKeyDown?(e: React.KeyboardEvent<HTMLDivElement>): void;
onMonthChange?(month: Date): void;
pagedNavigation?: boolean;
renderDay?(date: Date, modifiers: Modifiers): React.ReactNode;
reverseMonths?: boolean;
selectedDays?: Modifier | Modifier[];
toMonth?: Date;
weekdayElement?: React.ReactElement<Partial<WeekdayElementProps>> |
React.ComponentClass<WeekdayElementProps> |
React.SFC<WeekdayElementProps>;
weekdaysLong?: [string, string, string, string, string, string, string];
weekdaysShort?: [string, string, string, string, string, string, string];
}
const VERSION: string;
const LocaleUtils: DayPicker.LocaleUtils;
const DateUtils: DayPicker.DateUtils;
}
declare class DayPicker extends React.Component<DayPicker.Props, never> {
showMonth(month: Date): void;
showPreviousMonth(): void;
showNextMonth(): void;
showPreviousYear(): void;
showNextYear(): void;
}
export = DayPicker;