import { type FocusEvent, type KeyboardEvent, type RefObject } from 'react'; import type { DateProblem } from '../core/date.js'; import type { DateField, DatePickerState } from '../core/date-picker.js'; import type { CalendarHandle, CalendarLinkProps } from './lib/calendar-link.js'; export type Boxes = Record; export interface DatePickerContextValue { id: string; range: boolean; /** `start`, and `end` in a range. */ fields: DateField[]; /** Text, values, open, the active box, touched … (core/date-picker). */ state: DatePickerState; disabled: boolean; readOnly: boolean; required: boolean; /** Not disabled and not read-only. */ interactive: boolean; /** What is wrong with each box, null when nothing. */ problems: Record; /** The same in `locale`'s words. */ errors: Record; /** The box shows its error: forced `invalid`, or a problem after a commit or a submit. */ showsError: (field: DateField) => boolean; /** What a calendar in the popup takes. */ calendar: CalendarLinkProps; calendarHandle: RefObject; popup: RefObject; /** The calendar opened (or last opened) in the bottom sheet rather than the popover. */ sheet: boolean; /** The sheet's `` (`Popup` renders it) and its grip (`SheetGrip`). */ sheetDialog: RefObject; sheetGrip: RefObject; group: RefObject; trigger: RefObject; registerInput: (field: DateField, el: HTMLInputElement | null) => void; registerNative: (field: DateField, el: HTMLInputElement | null) => void; /** Close (committing typed text); focus inside the calendar goes back to the box that last had it. */ close: () => void; /** Empty a box and put focus back in it, without opening the calendar. */ clear: (field: DateField) => void; /** Open on the last box with focus in the grid, or close. */ toggle: () => void; input: (field: DateField, input: HTMLInputElement) => void; keyDown: (field: DateField, event: KeyboardEvent) => void; focus: (field: DateField, event: FocusEvent) => void; blur: (field: DateField, event: FocusEvent) => void; /** `event`: the press, whose default (focusing the box) a mouse press that opens the sheet prevents. */ pointerDown: (field: DateField, pointerType: string, pointerId?: number, event?: { preventDefault: () => void; }) => void; /** A finger or pen lifted on a box: the tap that opens the calendar (with a day focused), unless it became a scroll. */ pointerUp: (field: DateField, pointerId: number) => void; /** The finger scrolled instead: no tap. */ pointerCancel: () => void; /** Lifting the finger that opened the calendar: the box doesn't take focus (no on-screen keyboard over the calendar). */ touchEnd: (event: { preventDefault: () => void; }) => void; tap: (field: DateField) => void; invalidEvent: (field: DateField, box: HTMLInputElement, event: { preventDefault: () => void; }) => void; nativePick: (field: DateField, iso: string) => void; popupKeyDown: (event: KeyboardEvent) => void; popupBlur: (next: EventTarget | null) => void; /** A press (pointer or mouse) inside the calendar began. */ popupMouseDown: () => void; } export declare const DatePickerContext: import("react").Context; /** The state of the enclosing `DatePicker.Root` (text, values, open, problems …). */ export declare function useDatePickerContext(part?: string): DatePickerContextValue;