import { ButtonGroupProps } from '../ButtonGroup'; import { MQ, InlineMessageProps, LabelProps, FormInputTextFieldProps, AssistiveTextProps, SelectProps } from 'newskit'; import { NextRouter } from 'next/router'; import { Dispatch, SetStateAction } from 'react'; export interface EditFieldType { value: string | boolean; field: string; type?: 'text' | 'select'; options?: Array<{ label: string; value: string; }>; selectProps?: Omit; } export interface Data { validationSchemaKey?: string; fields?: EditFieldType[]; } interface InputTextOverrides { cells?: MQ; marginBlockEnd?: MQ; stylePreset?: MQ; paddingInline?: MQ; paddingBlock?: MQ; } export interface InputText extends InputTextOverrides { labelProps?: Omit & { text?: string; }; formInputTextFieldProps?: FormInputTextFieldProps; assistiveTextProps?: Omit & { text?: string; }; } export interface InfoPanel extends InlineMessageProps { infoPanelCells?: MQ; marginBlockEnd?: MQ; useInlineMessageComponent?: boolean; } export interface FormWrapperProps { baseUrl: string; text?: string[]; textOverriders?: { stylePreset?: MQ; typographyPreset?: MQ; marginBlockEnd?: MQ; }; buttonGroupProps?: ButtonGroupProps; inputText?: Omit; labelObject?: { [key: string]: string; }; data?: Data; infoPanel?: InfoPanel; fieldError?: string; setFieldError?: Dispatch>; isEmbeddedModeOn?: boolean; isUserVisitingFromOnboardingModal?: boolean; } export type ToastType = 'success' | 'error' | 'pending'; export type ErrorMessage = { [key: string]: { [key in ToastType]?: string; }; }; export type GenericErrorMessage = { [key in ToastType]?: string; }; export interface FormProps extends FormWrapperProps { validation?: Record; validationSchemaKey?: string; fields: EditFieldType[]; disable?: boolean; handleError?: (type: string, errorMessage?: ErrorMessage, genericErrorMessage?: GenericErrorMessage, message?: string) => void; handleLoading?: (type: string, errorMessage?: ErrorMessage, genericErrorMessage?: GenericErrorMessage) => void; handleSuccess?: () => void; errorMessages?: ErrorMessage; genericErrorMessage?: GenericErrorMessage; onSubmit?: (e: { [x: string]: unknown; }, validationSchemaKey: string, router?: NextRouter, handleError?: ((overrideMessage?: string) => void) | undefined, handleSuccess?: (() => void) | undefined, redirectUrl?: string | undefined) => Promise; isFooterVisible?: boolean; onValidationChange?: (errors: any) => void; } export interface FormGridProps { isFooterVisible?: boolean; } export interface FormErrorsProps { [x: string]: string; } export interface FormStateProviderProps { onFormValidate?: (errors: FormErrorsProps) => void; } export {};