dynamic-modal
Version:
The dynamic-modal is a solution of creation different modals into project using a json configuration file
49 lines (44 loc) • 1.52 kB
text/typescript
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';
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'>>;
//Description: FC<Omit<IMakeDescription, 'elementType'>>
Input: FC<
Omit<IMakeInput, '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;
}