///
import { FormatMessage } from '@comparaonline/react-intl-hooks';
import { FormApi, FormState } from 'final-form';
import { DialogState, SecondaryButtonProps, TypeStyle } from './NavigationButtonTypes';
import { StepManagerFieldProps } from './formTypes';
import { AlertSeverity } from '@comparaonline/ui-form-fields-next';
export interface ConditionalNext {
success: string;
failure: string;
}
export declare type NextStepProps = string | ConditionalNext;
export declare type TranslatableText = (t: FormatMessage, values: any, formApi: FormApi) => Result;
export interface TranslatableTexts {
label?: TranslatableText;
placeholder?: TranslatableText;
helperText?: TranslatableText;
}
export declare type WhenFuncProp = (formState: FormState, formApi: FormApi) => boolean | string | Promise;
export interface Warning {
component?: React.ComponentType;
text?: TranslatableText;
when?: (formApi: FormApi) => boolean;
severity?: AlertSeverity;
}
export interface IFieldProps {
name?: string;
component: React.ComponentType;
label?: TranslatableText;
placeholder?: TranslatableText;
helperText?: TranslatableText;
onChange?: any;
fieldProps?: StepManagerFieldProps;
conditionToRender?: (formApi: FormApi, extended?: boolean) => boolean;
conditionToDisable?: (formApi: FormApi, extended?: boolean) => boolean;
container?: 'div' | React.ComponentType;
[key: string]: any;
warning?: Warning | Warning[];
showLabel?: boolean;
}
export interface SectionProps {
id: string;
name: Text;
}
export interface ISection {
section: SectionProps;
}
export interface DialogProps {
bodies?: TranslatableText;
submitText?: TranslatableText;
title?: TranslatableText;
topAdornment?: React.ComponentType;
}
export declare type SubtitlePlacement = 'top' | 'bottom';
export interface Step {
section: SectionProps;
id: string;
title?: TranslatableText;
subtitle?: TranslatableText;
subtitlePlacement?: SubtitlePlacement;
submitText?: TranslatableText | React.ReactNode;
submitType?: TypeStyle;
disableSubmitButton?: (formApi: FormApi) => boolean;
nextAfterChange?: boolean;
secondaryButton?: SecondaryButtonProps;
dialogProps?: Partial;
adornments?: {
top?: React.ComponentType;
bottom?: React.ComponentType;
};
previous?: string;
next?: NextStepProps;
fields?: (IFieldProps | IFieldProps[])[];
fieldNames?: string[];
when?: WhenFuncProp;
noValidate?: boolean;
onStepLoad?: (OnStepLoadProps: any) => void;
withBackButton?: boolean;
withButtonsInline?: boolean;
}
export interface OnStepLoadProps {
dialogState: DialogState;
extended: boolean;
formApi: FormApi;
}
export interface ConditionalStep extends Step {
next: ConditionalNext | undefined;
when: WhenFuncProp;
}