import { Nullable } from '@viasat/beam-shared/utils/types'; import { AppendDigitResult, SegmentAdjustment, SegmentText, SegmentType, SegmentValues } from './DateField.types'; export interface UseDateFieldValueArgs { value?: Nullable; defaultValue?: Nullable; /** Fires on user-driven value transitions only, never on controlled `value` changes. */ onChange?: (value: Nullable) => void; /** Inclusive floor, compared by calendar day. Bounds the blur clamp, never the year spin. */ minDate?: Nullable; /** Inclusive ceiling, compared by calendar day. Bounds the blur clamp, never the year spin. */ maxDate?: Nullable; /** Returns the localized message announced when the blur clamp moves a value. */ getClampAnnouncement?: (clampedDate: Date) => string; } export interface UseDateFieldValueReturn { segmentText: SegmentText; segmentValues: SegmentValues; currentValue: Nullable; isControlled: boolean; wasTouched: boolean; appendDigit: (type: SegmentType, digit: string) => AppendDigitResult; /** * Steps a segment by `amount`, or jumps it to a boundary with `'min'`/`'max'`. * Returns `false` for a no-op — only year `'min'`/`'max'`, since the year is * free-spinning — which tells the keyboard dispatcher to leave the key to the * browser rather than `preventDefault` it. */ adjustSegment: (type: SegmentType, amount: SegmentAdjustment) => boolean; /** * Empties one segment. Reports `{ wasEmpty: true }` without mutating when * there was nothing to clear, so Backspace can step to the previous segment * instead. */ clearSegment: (type: SegmentType) => { wasEmpty: boolean; }; /** Empties every segment at once; unlike `clearSegment`, needs no focused segment. */ clearAll: () => void; beginSegmentEdit: (type: SegmentType) => void; commitOnBlur: () => void; /** Polite live-region message set when the blur clamp springs a value to a bound. */ clampAnnouncement: string; } export declare function useDateFieldValue({ value, defaultValue, onChange, minDate, maxDate, getClampAnnouncement, }: UseDateFieldValueArgs): UseDateFieldValueReturn;