import { KeyValuePair } from './common' import { FormState } from '../src/types' export enum FormFieldType { Input = 0, Picker = 1, CheckBox = 2 } type ValidationValue = string | number | boolean | Array export type FormValidationRule = { errorMessage: string, validationFunction(value: ValidationValue, form: FormState): boolean } export type FormOptionValue = number | string export type FormOption = { value: FormOptionValue, label: string, isSelected?: boolean } export type FieldConfig = { value?: string | number | boolean, type: FormFieldType, isRequired?: boolean, validationRules?: Array, options?: Array, disabled?: boolean, liveParser?(value: ValidationValue): ValidationValue, forceLiveValidate?: boolean } export type FormConfig = KeyValuePair // tslint:disable-next-line:no-any export type OnSuccess = (form: any) => void export type OnError = (errors: Array) => void export type FormProps = { formName: string } export type OnUpdate = (form: any) => void export interface UseFormProps extends FormProps { formConfig: FormConfig, onSuccess?: OnSuccess, onError?: OnError, onUpdate?: OnUpdate }