UNPKG

@mui/x-date-pickers

Version:

The community edition of the MUI X Date and Time Picker components.

44 lines 2.34 kB
import { UseFieldInternalProps, UseFieldState, FieldParsedSelectedSections, FieldSectionsValueBoundaries, SectionOrdering, UseFieldForwardedProps, CharacterEditingQuery } from "./useField.types.mjs"; import { FieldSelectedSections, PickersTimezone, InferFieldSection, PickerManager } from "../../../models/index.mjs"; import { PickerValidValue } from "../../models/index.mjs"; export declare const useFieldState: <TValue extends PickerValidValue, TError, TValidationProps extends {}, TForwardedProps extends UseFieldForwardedProps>(parameters: UseFieldStateParameters<TValue, TError, TValidationProps, TForwardedProps>) => UseFieldStateReturnValue<TValue>; interface UseFieldStateParameters<TValue extends PickerValidValue, TError, TValidationProps extends {}, TForwardedProps extends UseFieldForwardedProps> { manager: PickerManager<TValue, TError, TValidationProps, any>; internalPropsWithDefaults: UseFieldInternalProps<TValue, TError> & TValidationProps; forwardedProps: TForwardedProps; } export interface UpdateSectionValueParameters<TValue extends PickerValidValue> { /** * The section on which we want to apply the new value. */ section: InferFieldSection<TValue>; /** * Value to apply to the active section. */ newSectionValue: string; /** * If `true`, the focus will move to the next section. */ shouldGoToNextSection: boolean; } export interface UseFieldStateReturnValue<TValue extends PickerValidValue> { activeSectionIndex: number | null; areAllSectionsEmpty: boolean; error: boolean; localizedDigits: string[]; parsedSelectedSections: FieldParsedSelectedSections; sectionOrder: SectionOrdering; sectionsValueBoundaries: FieldSectionsValueBoundaries; state: UseFieldState<TValue>; timezone: PickersTimezone; value: TValue; clearValue: () => void; clearActiveSection: () => void; setCharacterQuery: (characterQuery: CharacterEditingQuery | null) => void; setSelectedSections: (sections: FieldSelectedSections) => void; setTempAndroidValueStr: (tempAndroidValueStr: string | null) => void; updateSectionValue: (parameters: UpdateSectionValueParameters<TValue>) => void; updateValueFromValueStr: (valueStr: string) => void; getSectionsFromValue: (value: TValue, fallbackSections?: InferFieldSection<TValue>[] | null) => InferFieldSection<TValue>[]; } export {};