| 1 |
/// <reference types="react" /> |
| 2 |
export 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 |
} |
| 11 |
export interface CalendarMonthInlineProps { |
| 12 |
/** Component wrapping the calendar month when used inline. Recommended to be 'article'. */ |
| 13 |
component?: keyof React.JSX.IntrinsicElements; |
| 14 |
/** Title of the calendar rendered above the inline calendar month. Recommended to be a 'title' component. */ |
| 15 |
title?: React.ReactNode; |
| 16 |
/** Id of the accessible label of the calendar month. Recommended to map to the title. */ |
| 17 |
ariaLabelledby?: string; |
| 18 |
} |
| 19 |
/** Additional properties that extend from and can be passed to the main component. These |
| 20 |
* properties allow customizing the calendar formatting and aria-labels. |
| 21 |
*/ |
| 22 |
export interface CalendarFormat { |
| 23 |
/** Accessible label for the date cells. */ |
| 24 |
cellAriaLabel?: (date: Date) => string; |
| 25 |
/** How to format days in buttons in table cells. */ |
| 26 |
dayFormat?: (date: Date) => React.ReactNode; |
| 27 |
/** If using the default formatters which locale to use. Undefined defaults to current locale. |
| 28 |
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation |
| 29 |
*/ |
| 30 |
locale?: string; |
| 31 |
/** How to format days in header for screen readers. */ |
| 32 |
longWeekdayFormat?: (date: Date) => React.ReactNode; |
| 33 |
/** How to format months in month select. */ |
| 34 |
monthFormat?: (date: Date) => React.ReactNode; |
| 35 |
/** Accessible label for the previous month button. */ |
| 36 |
prevMonthAriaLabel?: string; |
| 37 |
/** Accessible label for the next month button. */ |
| 38 |
nextMonthAriaLabel?: string; |
| 39 |
/** Which date to start range styles from. */ |
| 40 |
rangeStart?: Date; |
| 41 |
/** How to format week days in header. */ |
| 42 |
weekdayFormat?: (date: Date) => React.ReactNode; |
| 43 |
/** Day of week that starts the week. 0 is Sunday, 6 is Saturday. */ |
| 44 |
weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday; |
| 45 |
/** Accessible label for the year input. */ |
| 46 |
yearInputAriaLabel?: string; |
| 47 |
/** Props used to ensure accessibility when displaying the calendar month inline. */ |
| 48 |
inlineProps?: CalendarMonthInlineProps; |
| 49 |
} |
| 50 |
export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> { |
| 51 |
/** Additional classes to add to the outer div of the calendar month. */ |
| 52 |
className?: string; |
| 53 |
/** Month/year to base other dates around. */ |
| 54 |
date?: Date; |
| 55 |
/** Flag to set browser focus on the passed date. **/ |
| 56 |
isDateFocused?: boolean; |
| 57 |
/** Callback when date is selected. */ |
| 58 |
onChange?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, date: Date) => void; |
| 59 |
/** Callback when month or year is changed. */ |
| 60 |
onMonthChange?: (event?: React.MouseEvent | React.ChangeEvent | React.FormEvent<HTMLInputElement>, newDate?: Date) => void; |
| 61 |
/** @hide Internal prop to allow pressing escape in select menu to not close popover. */ |
| 62 |
onSelectToggle?: (open: boolean) => void; |
| 63 |
/** Functions that returns if a date is valid and selectable. */ |
| 64 |
validators?: ((date: Date) => boolean)[]; |
| 65 |
/** The container to append the month select menu to. Defaults to 'inline'. |
| 66 |
* If your menu is being cut off you can append it to an element higher up the DOM tree. |
| 67 |
* Some examples: |
| 68 |
* monthAppendTo={() => document.body}; |
| 69 |
* monthAppendTo={document.getElementById('target')} |
| 70 |
*/ |
| 71 |
monthAppendTo?: HTMLElement | ((ref?: HTMLElement) => HTMLElement) | 'inline'; |
| 72 |
} |
| 73 |
/** The main calendar month component. */ |
| 74 |
export declare const CalendarMonth: { |
| 75 |
({ date: dateProp, locale, monthFormat, weekdayFormat, longWeekdayFormat, dayFormat, weekStart, onChange, validators, className, onSelectToggle, onMonthChange, rangeStart, prevMonthAriaLabel, nextMonthAriaLabel, yearInputAriaLabel, cellAriaLabel, isDateFocused, inlineProps, monthAppendTo, ...props }: CalendarProps): import("react/jsx-runtime").JSX.Element; |
| 76 |
displayName: string; |
| 77 |
}; |
| 78 |
//# sourceMappingURL=CalendarMonth.d.ts.map |