UNPKG

1.32 kBTypeScriptView Raw
1import React from 'react';
2import { NativeProps } from '../../utils/native-props';
3import { Page } from './convert';
4export declare type CalendarRef = {
5 jumpTo: (page: Page | ((page: Page) => Page)) => void;
6 jumpToToday: () => void;
7};
8export declare type CalendarProps = {
9 prevMonthButton?: React.ReactNode;
10 prevYearButton?: React.ReactNode;
11 nextMonthButton?: React.ReactNode;
12 nextYearButton?: React.ReactNode;
13 onPageChange?: (year: number, month: number) => void;
14 weekStartsOn?: 'Monday' | 'Sunday';
15 renderLabel?: (date: Date) => React.ReactNode;
16 renderDate?: (date: Date) => React.ReactNode;
17 allowClear?: boolean;
18 max?: Date;
19 min?: Date;
20 shouldDisableDate?: (date: Date) => boolean;
21 minPage?: Page;
22 maxPage?: Page;
23} & ({
24 selectionMode?: undefined;
25 value?: undefined;
26 defaultValue?: undefined;
27 onChange?: undefined;
28} | {
29 selectionMode: 'single';
30 value?: Date | null;
31 defaultValue?: Date | null;
32 onChange?: (val: Date | null) => void;
33} | {
34 selectionMode: 'range';
35 value?: [Date, Date] | null;
36 defaultValue?: [Date, Date] | null;
37 onChange?: (val: [Date, Date] | null) => void;
38}) & NativeProps;
39export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalendarRef>>;