import type { DateTime } from '@gravity-ui/date-utils'; import type { DateFieldState } from "../../DateField/index.js"; import type { FormatInfo } from "../../DateField/types.js"; import type { DateFieldBase, PopupTriggerProps } from "../../types/index.js"; type OpenChangeReason = 'EscapeKeyDown' | 'FocusOut' | 'ClickOutside' | 'ValueSelected' | 'TriggerButtonClick' | 'ShortcutKeyDown'; export interface DatePickerState { /** The currently selected date. */ value: T | null; /** Sets the selected date. */ setValue: (value: T | null) => void; /** * The date portion of the value. This may be set prior to `value` if the user has * selected a date but has not yet selected a time. */ dateValue: T | null; /** Sets the date portion of the value. */ setDateValue: (value: T) => void; /** * The time portion of the value. This may be set prior to `value` if the user has * selected a time but has not yet selected a date. */ timeValue: T | null; /** Sets the time portion of the value. */ setTimeValue: (value: T | null) => void; /** Whether the field is read only. */ readOnly?: boolean; /** Whether the field is disabled. */ disabled?: boolean; /** Format of the date when rendered in the input. */ format: string; /** Format info */ formatInfo: FormatInfo; /** * @deprecated use formatInfo.hasDate instead * Whether the date picker supports selecting a date. */ hasDate: boolean; /** * @deprecated use formatInfo.hasTime instead * Whether the date picker supports selecting a time. */ hasTime: boolean; /** Format of the time when rendered in the input. */ timeFormat?: string; timeZone: string; /** Whether the calendar popover is currently open. */ isOpen: boolean; /** Sets whether the calendar popover is open. */ setOpen: (isOpen: boolean, reason: OpenChangeReason) => void; dateFieldState: DateFieldState; } export interface DatePickerStateFactoryOptions> { getPlaceholderTime: (placeholderValue: DateTime | undefined, timeZone?: string) => T; mergeDateTime: (date: T, time: T) => T; setTimezone: (date: T, timeZone: string) => T; getDateTime: (date: T | null | undefined) => DateTime | undefined; useDateFieldState: (props: O) => DateFieldState; adjustDateToFormat: (date: T, info: FormatInfo) => T; } export interface DatePickerStateOptions extends DateFieldBase, PopupTriggerProps<[OpenChangeReason]> { } export declare function datePickerStateFactory>({ getPlaceholderTime, mergeDateTime, setTimezone, getDateTime, useDateFieldState, adjustDateToFormat, }: DatePickerStateFactoryOptions): (props: O) => DatePickerState; export {};