import { type FormEvent } from 'react'; import type { FocusableRefValue } from '@react-types/shared'; export interface UseFormWithDetachedSubmitButtonResult { formProps: { id: string; onSubmit?: (event: FormEvent) => void; }; submitButtonProps: { form: string; ref: (buttonEl: FocusableRefValue | null) => void; }; } /** * Returns props to associate a form with a submit button. It generates a unique * id that will be assigned to the form `id` attribute and a button `form` * attribute. Useful for cases where a submit button exists outside of the form. * * e.g. * * const preventDefaultFormSubmit = true; * const { formProps, submitButtonProps } = useFormWithDetachedSubmitButton(preventDefaultFormSubmit); * *
* * * @param enableDefaultFormSubmitBehavior Optionally enable default form submit behavior. * @returns props that can be spread on a form component + a submit button component. */ export default function useFormWithDetachedSubmitButton(enableDefaultFormSubmitBehavior?: boolean): UseFormWithDetachedSubmitButtonResult; //# sourceMappingURL=useFormWithDetachedSubmitButton.d.ts.map