UNPKG

2.38 kBTypeScriptView Raw
1import React from 'react';
2export declare enum Weekday {
3 Sunday = 0,
4 Monday = 1,
5 Tuesday = 2,
6 Wednesday = 3,
7 Thursday = 4,
8 Friday = 5,
9 Saturday = 6
10}
11export interface CalendarFormat {
12 /** How to format months in Select */
13 monthFormat?: (date: Date) => React.ReactNode;
14 /** How to format week days in header */
15 weekdayFormat?: (date: Date) => React.ReactNode;
16 /** How to format days in header for screen readers */
17 longWeekdayFormat?: (date: Date) => React.ReactNode;
18 /** How to format days in buttons in table cells */
19 dayFormat?: (date: Date) => React.ReactNode;
20 /** If using the default formatters which locale to use. Undefined defaults to current locale. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation */
21 locale?: string;
22 /** Day of week that starts the week. 0 is Sunday, 6 is Saturday. */
23 weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday;
24 /** Which date to start range styles from */
25 rangeStart?: Date;
26 /** Aria-label for the previous month button */
27 prevMonthAriaLabel?: string;
28 /** Aria-label for the next month button */
29 nextMonthAriaLabel?: string;
30 /** Aria-label for the year input */
31 yearInputAriaLabel?: string;
32 /** Aria-label for the date cells */
33 cellAriaLabel?: (date: Date) => string;
34}
35export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
36 /** Month/year to base other dates around */
37 date?: Date;
38 /** Callback when date is selected */
39 onChange?: (date: Date) => void;
40 /** Functions that returns if a date is valid and selectable */
41 validators?: ((date: Date) => boolean)[];
42 /** Classname to add to outer div */
43 className?: string;
44 /** @hide Internal prop to allow pressing escape in select menu to not close popover */
45 onSelectToggle?: (open: boolean) => void;
46}
47export declare const isValidDate: (date: Date) => boolean;
48export declare const CalendarMonth: ({ date: dateProp, locale, monthFormat, weekdayFormat, longWeekdayFormat, dayFormat, weekStart, onChange, validators, className, onSelectToggle, rangeStart, prevMonthAriaLabel, nextMonthAriaLabel, yearInputAriaLabel, cellAriaLabel, ...props }: CalendarProps) => JSX.Element;
49//# sourceMappingURL=CalendarMonth.d.ts.map
\No newline at end of file