-
Notifications
You must be signed in to change notification settings - Fork 81
/
index.d.ts
117 lines (102 loc) · 3.08 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
declare module "react-nice-dates" {
import * as React from "react";
import * as Locale from "date-fns";
type DateChangeCallBack = (date: Date | null) => void;
interface InputProps {
ref: React.MutableRefObject<any>;
placeholder: string;
type: string;
value: string;
onBlur: () => void;
onChange: () => void;
onFocus: () => void;
}
type DefaultModifiers = 'disabled' | 'selected' | 'today';
type ModifierMatcher = (date: Date) => boolean;
type Modifiers = { [key in DefaultModifiers | string]: ModifierMatcher };
type ModifiersClassNames = { [key in DefaultModifiers | string]: string };
interface CommonProps {
locale: Locale;
minimumDate?: Date;
maximumDate?: Date;
modifiers?: Modifiers;
modifiersClassNames?: ModifiersClassNames;
weekdayFormat?: string;
}
interface CalendarProps extends CommonProps {
month?: Date;
onMonthChange?: DateChangeCallBack;
onDayHover?: DateChangeCallBack;
onDayClick?: DateChangeCallBack;
}
interface DatePickerChildrenProps {
inputProps: InputProps;
focused: boolean;
}
interface DatePickerProps extends CommonProps {
children: (props: DatePickerChildrenProps) => React.ReactNode;
date?: Date;
onDateChange?: DateChangeCallBack;
format?: string;
}
type DateRangeFocus = 'startDate' | 'endDate';
interface DateRangePickerChildrenProps {
startDateInputProps: InputProps;
endDateInputProps: InputProps;
focus: DateRangeFocus;
}
interface DateRangePickerProps extends CommonProps {
children: (props: DateRangePickerChildrenProps) => React.ReactNode;
startDate?: Date;
endDate?: Date;
minimumLength?: number;
maximumLength?: number;
onStartDateChange?: DateChangeCallBack;
onEndDateChange?: DateChangeCallBack;
format?: string;
}
interface DatePickerCalendarProps extends CommonProps {
date?: Date;
month?: Date;
onDateChange?: DateChangeCallBack;
onMonthChange?: DateChangeCallBack;
}
interface DateRangePickerCalendarProps extends CommonProps {
startDate?: Date;
endDate?: Date;
focus?: DateRangeFocus;
month?: Date;
minimumLength?: number;
maximumLength?: number;
onFocusChange?: (focus: DateRangeFocus) => void;
onStartDateChange?: DateChangeCallBack;
onEndDateChange?: DateChangeCallBack;
onMonthChange?: DateChangeCallBack;
}
export function Calendar(props: CalendarProps): JSX.Element;
export function DatePicker(props: DatePickerProps): JSX.Element;
export function DateRangePicker(props: DateRangePickerProps): JSX.Element;
export function DatePickerCalendar(
props: DatePickerCalendarProps
): JSX.Element;
export function DateRangePickerCalendar(
props: DateRangePickerCalendarProps
): JSX.Element;
export function useDateInput({
date,
format,
locale,
minimumDate,
maximumDate,
onDateChange,
validate
}: {
date?: Date,
format?: string,
locale: Locale,
minimumDate?: Date,
maximumDate?: Date,
onDateChange: (date: Date) => void,
validate?: (date: Date) => boolean,
}): any
}