@carrot-farm/mongsil-ui
Version:
react ui library
25 lines (24 loc) • 1.19 kB
TypeScript
/// <reference types="react" />
import { FormProps } from '../Form';
import { FormItemProps } from '../FormItem';
import { InputProps } from '../Input';
import { SelectCreatorProps } from '../SelectCreator';
import { CheckboxCreatorProps } from '../CheckboxCreator';
import { RadioCreatorProps } from '../RadioCreator';
import { SwitchProps } from '../Switch';
import { ButtonProps } from '../Button';
import { LayoutProps } from '../Layout';
import { InputChange } from '../../types/components';
export interface FormCreatorProps extends Omit<FormProps, 'children' | 'onChange'> {
model: FormCreatorModel[];
layout?: Pick<LayoutProps, 'areas' | 'columns' | 'rows' | 'gap' | 'gapX' | 'gapY'>;
onChange?: InputChange;
}
interface FormCreatorModel extends FormItemProps, ButtonProps {
itemId: FormItemProps['itemId'];
component: Component;
props?: InputProps | SelectCreatorProps | CheckboxCreatorProps | RadioCreatorProps | SwitchProps;
}
declare type Component = 'input' | 'textArea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'button';
declare function FormCreator({ model, layout, onChange, ...args }: FormCreatorProps): JSX.Element;
export default FormCreator;