import { Dispatch, SetStateAction } from 'react'; import { CalendarProps, CalendarRangeValue, CalendarValue } from './Calendar'; import { DateTime } from 'luxon'; import { IanaZone } from '../../types'; type CalendarContextCommonProps = { /** * Whether the calendar should focus on the focused date. */ disableAutofocus: boolean; /** * The focused date. Used to determine what month and year is currently selected. */ focusedDate: DateTime; /** * The function to call when the focused date changes. * * @param date - The date that is focused. */ setFocusedDate: Dispatch>; /** * The selected month. Used to determine what month is currently selected in the month button. */ selectedMonth: DateTime["month"]; /** * The function to call when the selected month changes. * * @param month - The month that is selected. */ setSelectedMonth: Dispatch>; /** * The selected year. Used to determine what year is currently selected in the year button. */ selectedYear: DateTime["year"]; /** * The function to call when the selected year changes. * * @param year - The year that is selected. */ setSelectedYear: Dispatch>; /** * The hovered date. Used to determine what date is currently hovered over. */ hoveredDate: DateTime; setHoveredDate: Dispatch>; /** * The default time zone to use for the calendar. */ defaultTimeZone: IanaZone; /** * The minimum date allowed. */ minDate: DateTime | null; /** * The maximum date allowed. */ maxDate: DateTime | null; /** * The days of the week and dates that are unavailable. */ unavailable: { /** * The specific dates that are unavailable. */ dates: Set; /** * The days of the week that are unavailable. */ daysOfWeek: Set; }; /** * The locale to use for the calendar. */ locale: Exclude; /** * The id of the calendar. */ id: string; /** * The date format to use for the calendar. */ dateFormat: Intl.DateTimeFormatOptions; /** * The day of the week to start the calendar on. */ startDay: "Sunday" | "Monday"; /** * Whether the calendar is controlled. */ controlled?: boolean; /** * The date metadata to determine if a date has a pip associated with it. */ dateMetadata?: Map; }; export type CalendarSingleContextProps = CalendarContextCommonProps & { /** * The value of the calendar. */ value: DateTime | null; /** * The function to call when the value changes. */ setValue: Dispatch>; /** * The function to call when the selection changes. * * @param data - The data to pass to the function. */ onSelection?: (data: { value: CalendarValue; }) => void; /** * Whether the calendar is in range mode. */ range?: false; }; export type CalendarRangeContextProps = CalendarContextCommonProps & { /** * The value of the calendar. */ value: { start?: DateTime | null; end?: DateTime | null; }; /** * The function to call when the value changes. */ setValue: Dispatch>; /** * The function to call when the selection changes. * * @param data - The data to pass to the function. */ onSelection?: (data: { value: CalendarRangeValue; }) => void; /** * Whether the calendar is in range mode. */ range: true; }; export type CalendarContextProps = CalendarSingleContextProps | CalendarRangeContextProps; /** * The context for the calendar. */ export declare const CalendarContext: import('react').Context; /** * A hook to access the calendar context. * * @returns The calendar context. */ export declare function useCalendar(): CalendarContextProps; export {};