forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-day-picker.d.ts
113 lines (99 loc) · 4.08 KB
/
react-day-picker.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
// Type definitions for react-day-picker v1.2.0
// 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
/// <reference path="../react/react.d.ts" />
declare module "react-day-picker" {
import DayPicker = ReactDayPicker.DayPicker;
export = DayPicker;
}
declare var DayPicker: typeof ReactDayPicker.DayPicker;
declare namespace ReactDayPicker {
import React = __React;
interface LocaleUtils {
formatMonthTitle: (month: Date, locale: string) => string;
formatWeekdayShort: (weekday: number, locale: string) => string;
formatWeekdayLong: (weekday: number, locale: string) => string;
getFirstDayOfWeek: (locale: string) => number;
getMonths: (locale: string) => string[];
}
interface DayModifiers {
selected?: boolean;
disabled?: boolean;
[name: string]: boolean;
}
interface Modifiers {
[name: string]: (date: Date) => boolean;
}
interface CaptionElementProps extends React.Props<any> {
date?: Date;
localeUtils?: LocaleUtils;
locale?: string;
onClick?: React.MouseEventHandler;
}
interface NavbarElementProps extends React.Props<any> {
className?: string;
previousMonth?: Date;
nextMonth?: Date;
showPreviousButton?: boolean;
showNextButton?: boolean;
onPreviousClick(): void;
onNextClick(): void;
dir?: string;
localeUtils?: LocaleUtils;
locale?: string;
}
interface WeekdayElementProps extends React.Props<any> {
weekday?: number;
className?: string;
localeUtils?: LocaleUtils;
locale?: string;
}
interface Props extends React.Props<DayPicker>{
modifiers?: Modifiers;
initialMonth?: Date;
numberOfMonths?: number;
renderDay?: (date: Date) => number | string | JSX.Element;
enableOutsideDays?: boolean;
canChangeMonth?: boolean;
disabledDays?: (date: Date) => boolean;
fixedWeeks?: boolean;
fromMonth?: Date;
reverseMonths?: boolean;
toMonth?: Date;
localeUtils?: LocaleUtils;
locale?: string;
captionElement?: React.ReactElement<CaptionElementProps>;
navbarElement?: React.ReactElement<NavbarElementProps>;
weekdayElement?: React.ReactElement<WeekdayElementProps>;
onDayClick?: (e: React.SyntheticEvent, day: Date, modifiers: DayModifiers) => any;
onDayKeyDown?: (e: React.SyntheticEvent, day: Date, modifiers: DayModifiers) => any;
onDayMouseEnter?: (e: React.SyntheticEvent, day: Date, modifiers: DayModifiers) => any;
onDayMouseLeave?: (e: React.SyntheticEvent, day: Date, modifiers: DayModifiers) => any;
onDayTouchEnd?: (e: React.SyntheticEvent, day: Date, modifiers: DayModifiers) => any;
onDayTouchStart?: (e: React.SyntheticEvent, day: Date, modifiers: DayModifiers) => any;
onMonthChange?: (month: Date) => any;
onCaptionClick?: (e: React.SyntheticEvent, month: Date) => any;
className?: string;
selectedDays?: (date: Date) => boolean;
style?: React.CSSProperties;
tabIndex?: number;
}
class DayPicker extends React.Component<Props, {}> {
showMonth(month: Date): void;
showPreviousMonth(): void;
showNextMonth(): void;
}
namespace DayPicker {
var LocaleUtils: LocaleUtils;
namespace DateUtils {
function addMonths(d: Date, n: number): Date;
function clone(d: Date): Date;
function isSameDay(d1?: Date, d2?: Date): boolean;
function isPastDay(d: Date): boolean;
function isDayBetween(day: Date, startDate: Date, endDate: Date): boolean;
function addDayToRange(day: Date, range: { from?: Date, to?: Date }): { from?: Date, to?: Date };
function isDayInRange(day: Date, range: { from?: Date, to?: Date }): boolean;
}
}
}