import { default as React } from 'react'; import { DateRange, DayPickerProps, Locale, Matcher, OnSelectHandler } from 'react-day-picker'; import { CalendarView, DateFieldMode } from '../../form/date-field/date-field'; export interface CalendarProps extends Omit { /** * Current view of the calendar. Can be `'days'`, `'months'`, or `'years'`. * Controls which calendar grid is displayed. */ view?: CalendarView; /** * **Selection granularity** — controls the level at which a click finalises * the selection rather than drilling down to the next sub-grid: * - `'years'` — clicking a year selects Jan 1 of that year and closes; the * calendar starts on the year grid. * - `'months'` — clicking a month selects the first day of that month; the * calendar starts on the month grid. * - `'days'` (default) — full day-level selection; the calendar starts on * the day grid. * * Distinct from `view` / `setView`, which control the *currently visible* * grid — those flip as the user navigates between year / month / day. * `selectionLevel` is the lowest level the user can drill down to before * a click commits the selection. * @default days */ selectionLevel?: CalendarView; /** * The month currently displayed in the calendar. Used to render the correct month grid. */ currentMonth: Date; /** * Callback to update the `currentMonth` when navigating months/years. */ setCurrentMonth: (date: Date) => void; /** * Callback to update the current `view` (days, months, years) when the user switches calendar levels. */ setView?: (view: CalendarView) => void; /** * Selection mode of the calendar. Can be `'single'`, `'multiple'`, or `'range'`. */ mode?: DateFieldMode; /** * The currently selected value(s). * - Single mode: `Date | undefined` * - Multiple mode: `Date[]` * - Range mode: `DateRange` (object with `from` and optional `to`) */ value: Date | Date[] | DateRange | undefined; /** * Locale object for formatting and translating calendar labels (from `react-day-picker`). */ locale?: Locale; /** * The locale code string used for date formatting. Defaults to 'et-EE'. */ localeCode?: string; /** * Whether to display days from the previous and next months in the current month grid. * Default is `true`. */ showOutsideDays?: boolean; /** * Array of `Matcher`s or functions to disable specific dates. Used to prevent selection of certain days. */ disabledMatchers?: Matcher[]; /** * If `true`, a value must be selected before the calendar allows closing. */ required?: boolean; /** * Array of available dates or a function to dynamically mark dates as available. * Highlights selectable days without disabling other days. */ availableDays?: Date[] | ((date: Date) => boolean); /** * Array of unavailable dates or a function to dynamically mark dates as unavailable. * Used for styling and optionally disabling specific days. */ unavailableDays?: Date[] | ((date: Date) => boolean); /** * Optional footer element to render below the calendar grid, e.g., for action buttons. */ footer?: React.ReactNode; /** * How the month/year selector in the calendar header is rendered. * Forwarded to the internal `CalendarHeader`. * - `'dropdown'` (default) — each picker is a `