import React, { FC } from 'react';
import { FieldValues, SubmitErrorHandler, SubmitHandler, UseFormProps, UseFormReturn } from 'react-hook-form';
import { FieldWrapperProps } from '@parlor/components/select-v4';
export interface ControlledFormProps<T = any> {
    [x: string]: any;
    autoSubmitOnDirty?: boolean;
    /**
     * Field child element.
     */
    children: JSX.Element | JSX.Element[];
    /**
     * custom form to pass from outside
     * useful for complicated cases
     *
     * ```tsx
     *   import { Form, useForm, useFormState } from '@parlor/ui/form';
     *
     *    let form = useForm(formConfigurationObject);
     *
     *   <Form form={form}>Example</Form>
     * ```
     */
    form?: UseFormReturn<T, Record<string, any>>;
    /**
     * @description `FormField` components `variation`. If `FormField` component has his own `variation` his `variation` will be used instead
     * @default ```undefined```
     */
    formVariation?: FieldWrapperProps['variation'];
    /**
     * auto submit debounce (milliseconds)
     */
    ms?: number;
    /**
     * @description
     * @param {{ reset: UseFormReturn<T>['reset'] }} api
     * @param {T} veryFirstDefaultValues be cautions this will return the values form received while initializing
     * if you need to reset unsaved changes consider tracking last updated state inside a component then manually reset
     * it
     */
    onReset?: () => void;
    /**
     * A function that handles the submit.
     */
    onSubmit?: SubmitHandler<T>;
    /**
     * A function that handles the submit invalid state.
     */
    onSubmitInvalid?: SubmitErrorHandler<T>;
}
export declare const useForm: <TValues extends FieldValues = FieldValues, TContext extends Record<string, any> = Record<string, any>>({ resetDefaultValues, ...formProps }: {
    resetDefaultValues?: boolean;
} & Partial<{
    mode: "onBlur" | "onChange" | "onSubmit" | "all" | "onTouched";
    disabled: boolean;
    reValidateMode: "onBlur" | "onChange" | "onSubmit";
    defaultValues: ((payload?: unknown) => Promise<TValues>) | import("react-hook-form").DefaultValues<TValues>;
    values: TValues;
    errors: import("react-hook-form").FieldErrors<TValues>;
    resetOptions: Partial<{
        keepDirtyValues: boolean;
        keepErrors: boolean;
        keepDirty: boolean;
        keepValues: boolean;
        keepDefaultValues: boolean;
        keepIsSubmitted: boolean;
        keepIsSubmitSuccessful: boolean;
        keepTouched: boolean;
        keepIsValid: boolean;
        keepSubmitCount: boolean;
    }>;
    resolver: import("react-hook-form").Resolver<TValues, TContext>;
    context: TContext;
    shouldFocusError: boolean;
    shouldUnregister: boolean;
    shouldUseNativeValidation: boolean;
    progressive: boolean;
    criteriaMode: import("react-hook-form").CriteriaMode;
    delayError: number;
}>) => UseFormReturn<any, any, any>;
export declare const ControlledForm: FC<React.PropsWithChildren<ControlledFormProps>>;
