UNPKG

3.24 kBTypeScriptView Raw
1import * as React from 'react';
2import { Theme } from '@material-ui/core';
3import { IconButtonProps } from '@material-ui/core/IconButton';
4import { WithStyles } from '@material-ui/core/styles/withStyles';
5import { WithUtilsProps } from '../../_shared/WithUtils';
6import { DateType } from '../../constants/prop-types';
7import { MaterialUiPickersDate } from '../../typings/date';
8import { SlideDirection } from './SlideTransition';
9export declare type RenderDay = (day: MaterialUiPickersDate, selectedDate: MaterialUiPickersDate, dayInCurrentMonth: boolean, dayComponent: React.ReactElement<IconButtonProps>) => JSX.Element;
10export interface CalendarProps extends WithUtilsProps, WithStyles<typeof styles, true> {
11 date: MaterialUiPickersDate;
12 minDate: DateType;
13 maxDate: DateType;
14 onChange: (date: MaterialUiPickersDate, isFinish?: boolean) => void;
15 disablePast?: boolean;
16 disableFuture?: boolean;
17 leftArrowIcon?: React.ReactNode;
18 rightArrowIcon?: React.ReactNode;
19 renderDay?: RenderDay;
20 allowKeyboardControl?: boolean;
21 onMonthChange?: (date: MaterialUiPickersDate) => void;
22 shouldDisableDate?: (day: MaterialUiPickersDate) => boolean;
23}
24export interface CalendarState {
25 slideDirection: SlideDirection;
26 currentMonth: MaterialUiPickersDate;
27 lastDate?: MaterialUiPickersDate;
28}
29export declare class Calendar extends React.Component<CalendarProps, CalendarState> {
30 static propTypes: any;
31 static defaultProps: {
32 minDate: Date;
33 maxDate: Date;
34 disablePast: boolean;
35 disableFuture: boolean;
36 allowKeyboardControl: boolean;
37 };
38 static getDerivedStateFromProps(nextProps: CalendarProps, state: CalendarState): {
39 lastDate: any;
40 currentMonth: any;
41 slideDirection: SlideDirection;
42 } | null;
43 state: CalendarState;
44 componentDidMount(): void;
45 onDateSelect: (day: any, isFinish?: boolean) => void;
46 handleChangeMonth: (newMonth: any, slideDirection: SlideDirection) => void;
47 validateMinMaxDate: (day: any) => boolean;
48 shouldDisablePrevMonth: () => boolean;
49 shouldDisableNextMonth: () => boolean;
50 shouldDisableDate: (day: any) => boolean;
51 moveToDay: (day: any) => void;
52 handleKeyDown: (event: KeyboardEvent) => void;
53 renderWeeks: () => JSX.Element[];
54 renderDays: (week: any[]) => JSX.Element[];
55 render(): JSX.Element;
56}
57export declare const styles: (theme: Theme) => {
58 transitionContainer: {
59 minHeight: number;
60 marginTop: number;
61 };
62 week: {
63 display: string;
64 justifyContent: string;
65 };
66};
67declare const _default: React.ComponentType<Pick<React.PropsWithChildren<Pick<CalendarProps, "onChange" | "date" | "classes" | "theme" | "maxDate" | "minDate" | "disablePast" | "disableFuture" | "shouldDisableDate" | "onMonthChange" | "leftArrowIcon" | "rightArrowIcon" | "renderDay" | "allowKeyboardControl">>, "children" | "onChange" | "date" | "maxDate" | "minDate" | "disablePast" | "disableFuture" | "shouldDisableDate" | "onMonthChange" | "leftArrowIcon" | "rightArrowIcon" | "renderDay" | "allowKeyboardControl"> & import("@material-ui/core").StyledComponentProps<"transitionContainer" | "week">>;
68export default _default;