import { type InjectionKey } from 'vue'; export type FormValidator = (value: string) => string | null | undefined; export interface FormContext { /** Record of values for all fieldIds */ values: Record; /** Record of errors for all fieldIds */ errors: Record; /** Record of touched state for all fieldIds */ touched: Record; /** Flag to determine the overall validity. True if the record of errors is empty. */ readonly isValid: boolean; /** Get the value for a given fieldId */ getValue(fieldId: string): string; /** Set the value for a given fieldId, running its validator */ setValue(fieldId: string, value: string, triggerValidation?: boolean): void; /** Set multiple values within the managed record of values */ setValues(values: Record | ((values: Record) => Record)): void; /** Get the error message for a given fieldId */ getError(fieldId: string): string; /** Set the error message for a given fieldId, removing it when empty */ setError(fieldId: string, error: string | null | undefined): void; /** Set multiple errors within the managed record of errors */ setErrors(errors: Record | ((errors: Record) => Record)): void; /** Used to determine touched state for a given fieldId */ isTouched(fieldId: string): boolean; /** Used to update the touched state for a given fieldId */ setTouched(fieldId: string, touched: boolean): void; /** Triggers all fieldId-specific validators, returning the errors found */ validate(): Record; /** Set a validator for a specific fieldId */ setValidator(fieldId: string, validate: FormValidator): void; } export declare const FormContextKey: InjectionKey; /** Creates the reactive form state provided by pf-form-context-provider */ export declare function createFormContext(initialValues?: Record): FormContext; /** Returns the form state of the closest pf-form-context-provider */ export declare function useFormContext(): FormContext | undefined; //# sourceMappingURL=form-context.d.ts.map