react-form-validator-component
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -0,0 +0,0 @@ module.exports = { |
{ | ||
"name": "react-form-validator-component", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"main": "build/lib/index.js", | ||
@@ -13,3 +13,4 @@ "repository": "git@github.com:JDLT-Ltd/react-form-validator-component.git", | ||
"build": "webpack", | ||
"start": "webpack-dev-server --hot --config webpack.dev.config.js" | ||
"start": "webpack-dev-server --hot --config webpack.dev.config.js", | ||
"release": "release-it" | ||
}, | ||
@@ -37,2 +38,3 @@ "devDependencies": { | ||
"react-dom": "^16.4.1", | ||
"release-it": "^7.4.7", | ||
"semantic-ui-react": "^0.81.3", | ||
@@ -47,10 +49,10 @@ "webpack": "^4.12.2", | ||
"keywords": [ | ||
"react", | ||
"form", | ||
"validation", | ||
"form-validation", | ||
"form validation", | ||
"react-form-validation", | ||
"react-form-validation-component" | ||
] | ||
"react", | ||
"form", | ||
"validation", | ||
"form-validation", | ||
"form validation", | ||
"react-form-validation", | ||
"react-form-validation-component" | ||
] | ||
} |
# React Form Validator | ||
React Form Validator exposes a single React component which uses the render prop pattern to validate the input on its child form. | ||
React Form Validator exposes a single React component which uses the render prop pattern to validate the input on its child form. | ||
It is built as a pure React component, with no additional dependencies, making it efficient and cheap to add to any React project. Due to interacting with underlying basic HTML tags, it is compatible with popular design Frameworks like Semantic or Bootstrap out of the box. | ||
<!-- | ||
The render prop function will be passed `isFormValid`, `isFieldValid`, `errors`, `fields`, and `onChange` to use in the form itself. --> | ||
The render prop function will be passed `isFormValid`, `isFieldValid`, `errors`, `fields`, and `onChange` to use in the form itself. | ||
## Table of Contents | ||
[**Installation**](#installation) | ||
* [**1.1 - Using NPM/YARN**](#npm/yarn) | ||
* [**1.2 - Clone the repo**](#clone) | ||
[**Usage**](#Usage) | ||
* [**2.1 - Example**](#example) | ||
* [**2.2 - Props in RFVC**](#props-in-rfvc) | ||
* [**2.2.1 - Required props**](#required-props) | ||
* [**2.2.2 - Optional props**](#optional-props) | ||
* [**2.3 - Rules in RFVC**](#rules-in-rfvc) | ||
* [**2.3.1 - Default rules**](#default-rules) | ||
* [**2.3.2 - Custom rules**](#custom-rules) | ||
* [**2.4 - Arguments in RFVC**](#arguments) | ||
[**Project Motivation**](#project-motivation) | ||
**Additional Info** | ||
* [**Current Goals**](#current-goals) | ||
* [**Changelog**](#changelog) | ||
* [**License**](#license) | ||
## Installation | ||
### NPM/YARN | ||
`yarn add react-validator-component` | ||
@@ -13,4 +41,10 @@ | ||
## Example | ||
### Clone | ||
`git clone git@github.com:JDLT-Ltd/react-form-validator-component.git` | ||
## Usage | ||
### Example | ||
```javascript | ||
@@ -51,5 +85,5 @@ class ExampleForm extends React.Component { | ||
## Usage | ||
### Props in RFVC | ||
### Props | ||
#### Required props | ||
@@ -60,2 +94,3 @@ `Validator` has one **required** props | ||
#### Optional Props | ||
@@ -74,4 +109,8 @@ It also has three **optional** props | ||
#### Using predefined rules | ||
### Rules in RFVC | ||
RFVC let's you use a mixture of predefined rules and your personal custom rules, just as it let's you provide your own functionality for `onPassValidation`. | ||
#### Default Rules | ||
```javascript | ||
@@ -85,4 +124,6 @@ fields: { | ||
#### Using custom rules | ||
We are currently still working on creating a comprehensive list of default rules, please check `src/lib/rules.js` for now. | ||
#### Custom Rules | ||
```javascript | ||
@@ -105,2 +146,10 @@ fields: { | ||
You can write custom rules and simply use them inside the rules Array as long as they follow RFVC's format of | ||
```javascript | ||
{ | ||
validator: {Your Code}, | ||
error: {Your Error Message} | ||
} | ||
``` | ||
Where `validator` is a function returning a boolean and `error` is the desired error message. | ||
@@ -107,0 +156,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
322075
202
27