import { ReactNode } from 'react'; import { Props, Styles } from '../tasty'; /** Where to place label relative to input */ export declare type LabelPosition = 'side' | 'top'; /** The type of necessity indicator */ export declare type NecessityIndicator = 'icon' | 'label'; /** The validation state of the field */ export declare type ValidationState = 'invalid' | 'valid'; /** On which event perform the validation for the field */ export declare type ValidateTrigger = 'onBlur' | 'onChange' | 'onSubmit'; export interface OptionalFieldBaseProps { /** The label of the field */ label?: string; /** An additional content next to the label */ extra?: ReactNode; /** The validation state of the field */ validationState?: ValidationState; /** On which event perform the validation for the field */ validateTrigger?: ValidateTrigger; necessityIndicator?: NecessityIndicator; necessityLabel?: ReactNode; } export interface FieldBaseProps extends OptionalFieldBaseProps { /** The field name */ name: string[] | string; } export interface FormBaseProps { /** Styles of the label */ labelStyles?: Styles; /** Where to place label relative to input */ labelPosition?: LabelPosition; /** Whether the field presents required mark */ requiredMark?: boolean; /** Whether the field is required */ isRequired?: boolean; /** The type of necessity indicator */ necessityIndicator?: NecessityIndicator; /** That can replace the necessity label */ necessityLabel?: ReactNode; /** Whether the field is read only */ isReadOnly?: boolean; /** The validation state of the field */ validationState?: ValidationState; /** On which event perform validation for the field */ validateTrigger?: ValidateTrigger; } export interface FormFieldProps extends FormBaseProps { /** Whether the field is inside the form. Private field. */ insideForm?: boolean; /** A text label of the field */ label?: ReactNode; labelSuffix?: ReactNode; /** An additional content next to the label */ extra?: ReactNode; /** Custom label props */ labelProps?: Props; /** Message for the field. Some additional information or error notice */ message?: ReactNode; /** Description for the field. Will be placed below the label */ description?: ReactNode; /** A tooltip that is shown inside the label */ tooltip?: ReactNode; /** Whether the element should receive focus on render */ autoFocus?: boolean; } export declare type ValidationRuleBase = { [key: string]: any; } & { required?: boolean; message?: string; }; export declare type ValidationRule = ValidationRuleBase & { validator?: (ValidationRule: any, any: any) => Promise; };