-
Notifications
You must be signed in to change notification settings - Fork 210
Expand file tree
/
Copy pathindex.ts
More file actions
95 lines (82 loc) · 2.56 KB
/
index.ts
File metadata and controls
95 lines (82 loc) · 2.56 KB
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
import React from "react";
import { COLORS } from "../constants";
export interface Period {
start: string | null;
end: string | null;
}
interface CustomShortcuts {
[key: string]: ShortcutsItem;
}
interface DefaultShortcuts {
today?: string;
yesterday?: string;
past?: (period: number) => string;
currentMonth?: string;
pastMonth?: string;
}
export interface Configs {
shortcuts?: DefaultShortcuts | CustomShortcuts;
footer?: {
cancel?: string;
apply?: string;
};
}
export interface ShortcutsItem {
text: string;
daysNumber?: number;
period: {
start: Date | string;
end: Date | string;
};
}
export type DateType = string | null | Date;
export type DateRangeType = {
startDate: DateType;
endDate: DateType;
};
export type DateValueType = DateRangeType | null;
export type ClassNamesTypeProp = {
container?: (p?: object | null | undefined) => string | undefined;
input?: (p?: object | null | undefined) => string | undefined;
toggleButton?: (p?: object | null | undefined) => string | undefined;
footer?: (p?: object | null | undefined) => string | undefined;
};
export type PopoverDirectionType = "up" | "down";
export interface DatepickerType {
primaryColor?: ColorKeys;
value: DateValueType;
onChange: (value: DateValueType, e?: HTMLInputElement | null | undefined) => void;
useRange?: boolean;
showFooter?: boolean;
showShortcuts?: boolean;
configs?: Configs;
asSingle?: boolean;
placeholder?: string;
separator?: string;
startFrom?: Date | null;
i18n?: string;
disabled?: boolean;
classNames?: ClassNamesTypeProp | undefined;
containerClassName?: ((className: string) => string) | string | null;
shortcutClassName?: ((className: string) => string) | string | null;
shortcutItemClassName?: ((className: string) => string) | string | null;
inputClassName?: ((className: string) => string) | string | null;
toggleClassName?: ((className: string) => string) | string | null;
toggleIcon?: (open: boolean) => React.ReactNode;
inputId?: string;
inputName?: string;
displayFormat?: string;
readOnly?: boolean;
minDate?: Date | null;
maxDate?: Date | null;
dateLooking?: "forward" | "backward" | "middle";
disabledDates?: DateRangeType[] | null;
startWeekOn?: string | null;
popoverDirection?: PopoverDirectionType;
}
export type ColorKeys = (typeof COLORS)[number]; // "blue" | "orange"
export interface Colors {
[key: string]: {
[K in ColorKeys]: string;
};
}