rfa
Version:
**React Form Architect** is an ultimate solution for creating and rendering forms in React. Its main focus is to provide users with a tool to define, render and share a form in a browser.
38 lines (37 loc) • 1.3 kB
TypeScript
import React from 'react';
export declare type OptionType = {
name: string;
};
export declare type AttributeValueType = string | number | boolean | string[];
export declare type KeyValueData = {
name: string;
placeholder?: string;
value?: string;
};
export declare type AttributeSchema = {
name: string;
type: 'input' | 'select' | 'radio' | 'switch' | 'checkbox' | 'options' | 'keyValueData';
label: string;
value?: AttributeValueType;
options?: OptionType[];
keyValueData?: KeyValueData[];
};
export declare type ValidationType = 'string' | 'number' | 'array' | 'boolean' | 'object';
export declare type Validation = {
type: string;
params: any[];
};
export declare type FormElement = {
name: string;
label: string;
description?: string;
icon: React.ReactElement<any>;
render: React.FC<any>;
attributes: AttributeSchema[];
validators?: Validators[];
validationType: ValidationType;
isReadOnly?: boolean;
isCustomRegistered?: boolean;
};
export declare type Validators = 'required' | 'min' | 'max' | 'length' | 'matches' | 'email' | 'url' | 'moreThan' | 'lessThan' | 'positive' | 'negative' | 'integer';
export declare const validatorsMapper: Record<Validators, React.FC<any>>;