UNPKG

dynamic-modal

Version:

The dynamic-modal is a solution of creation different modals into project using a json configuration file

30 lines (29 loc) 1.54 kB
import { FC, PropsWithChildren } from 'react'; import { FieldError } from 'react-hook-form'; import { IOption } from './option'; import { IMakeInput } from './make-input'; import { IMakeButton } from './make-button'; import { IMakeSelect } from './make-select'; import { IMakeTextarea } from './make-textarea'; import { IMakeToggle } from './make-toggle'; import { IMakeCustomUpload } from './make-custom-upload'; export interface IComponentAditionalProps { onChange: (...event: any[]) => void; value: any; invalid: boolean; error?: FieldError; liveSearching?: boolean; } export interface IComponentState { ModalButtonCancel: FC<Omit<IMakeButton, 'elementType'>>; ModalButtonAction: FC<Omit<IMakeButton, 'elementType'>>; Button: FC<Omit<IMakeButton, 'elementType'>>; Input: FC<Omit<IMakeInput, 'elementType' | 'validation' | 'renderIf' | 'enableIf'> & IComponentAditionalProps>; CustomUpload: FC<Omit<IMakeCustomUpload, 'elementType' | 'validation' | 'renderIf' | 'enableIf'> & IComponentAditionalProps>; Select: FC<Omit<IMakeSelect, 'elementType' | 'validation' | 'renderIf' | 'enableIf'> & IComponentAditionalProps & Record<'options', Array<IOption>>>; Textarea: FC<Omit<IMakeTextarea, 'elementType' | 'validation' | 'renderIf' | 'enableIf'> & IComponentAditionalProps>; Toggle: FC<Omit<IMakeToggle, 'elementType' | 'validation' | 'renderIf' | 'enableIf'> & IComponentAditionalProps>; } export interface IComponentStateProps extends PropsWithChildren { components: IComponentState; }