/// import * as V from "@nexys/validation"; export declare type FormOptions = OptionSet[]; export declare type FormOptionsMap = Map>; export interface InputProps { onChange: (v: A | undefined) => void; value?: A; errors?: string[]; disabled?: boolean; placeholder?: string; } export interface OptionSet { id: A; name: string; } export interface WrapperProps { label?: string; info?: string; children: JSX.Element | JSX.Element[]; errors?: string[]; } /** * select props for dropdowns that return either a string or number (ie. enum) */ export declare type InputTypeString = "text" | "email" | "password"; /** * select props for dropdowns that return an option set */ export declare type InputType = InputTypeString | "number"; export interface SelectProps extends InputProps { options: OptionSet[]; } export interface SelectOptionSetProps extends InputProps> { options: OptionSet[]; } export declare enum FormType { Number = 0, Text = 1, Select = 2, SelectObject = 3, Switch = 4 } export interface StructureUnitCore { name: keyof A; label?: string; options?: FormOptions; } export interface StructureViewUnit extends StructureUnitCore { render?: (a: A) => string; } export interface FormDef extends StructureUnitCore { uiType: FormType; optional: boolean; disabled?: boolean; } export interface StructureUnit extends StructureViewUnit { uiType?: FormType; } export interface FormProps { onSuccess: (v: A) => Promise; valueDefault?: Partial; errors?: V.Type.ErrorOut | V.Type.Error; isLoading?: boolean; options?: FormOptionsMap; } export declare type ToggleProps = Omit, "valueDefault" | "formDef"> & { data: A; }; export declare type InputUnitProps = { type: FormType; options?: OptionSet[]; } & InputProps; export interface FormContentProps { disabled: boolean; data: A; onChange: (d: string, name: keyof A) => void; options?: FormOptionsMap; } export interface FormUIProps { data: Partial; errors?: V.Type.ErrorOut | V.Type.Error; onChange: (name: string, value: any) => void; disabled: boolean; }