UNPKG

@hhgtech/hhg-components

Version:
42 lines (41 loc) 1.46 kB
import React, { CSSProperties } from 'react'; import { UseFormReturnType } from '@mantine/form'; import { useLeadForm } from "../layouts/lightbox/formContext"; export type LeadGenBlock = { id: string; name: string; data: { placeholder: string; value: string; required: boolean; valueHTML?: string; isSendMailChimp?: boolean; listQuestion?: Array<{ value: string; placeholder: string; }>; }; }; export type ThankYou = { image: string; title: string; description: string; }; export type LeadGenFormValues = Record<string, unknown> | unknown; export type LeadGenUseFormReturnType<T> = UseFormReturnType<T, (values: T) => T>; export type LeadGenFormRef<T> = LeadGenUseFormReturnType<T> & { submit: () => void; }; export type LeadGenFormProps<T = LeadGenFormValues> = { locale?: string; blocks?: LeadGenBlock[]; scrollToErrorField?: boolean; form?: UseFormReturnType<T>; rules?: Parameters<typeof useLeadForm>[0]['validate']; initialValues?: T; onFinish?: Parameters<LeadGenUseFormReturnType<T>['onSubmit']>[0]; onFinishFailed?: Parameters<LeadGenUseFormReturnType<T>['onSubmit']>[1]; className?: string; style?: CSSProperties; }; export declare const LeadGenForm: React.ForwardRefExoticComponent<LeadGenFormProps<unknown> & React.RefAttributes<LeadGenFormRef<unknown>>>;