From ccf0a887f72f08e27b187000fefc7d168f7e8bbf Mon Sep 17 00:00:00 2001 From: gokulakannant Date: Thu, 14 Nov 2019 19:14:58 +0530 Subject: [PATCH] Travis CI configured 1) Travis CI configured 2) Demo url updated in Readme.md Signed-off-by: gokulakannant --- .npmignore | 3 ++ .travis.yml | 7 ++++ README.md | 18 +++++---- src/types/ReactTypes.ts | 85 +++++++++++++++++++++++++++++++++++++++-- 4 files changed, 103 insertions(+), 10 deletions(-) create mode 100644 .travis.yml diff --git a/.npmignore b/.npmignore index b251205..c7969c6 100644 --- a/.npmignore +++ b/.npmignore @@ -11,3 +11,6 @@ typedocconfig.ts webpack.config.js tslint.json dist/typedocconfig.d.ts +Documentation/ +node_modules/ +.travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d493864 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - 7 + - 8 + - 9 + - 10 +install: npm install diff --git a/README.md b/README.md index 383a327..3e80ba9 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,25 @@ # React Input Form Validation -A customized validatorjs library to validate the react forms. This library is extended version of [validatorjs](https://www.npmjs.com/package/validatorjs). +[![Build Status](https://api.travis-ci.org/gokulakannant/react-form-input-validation.png?branch=master)](https://travis-ci.org/gokulakannant/react-form-input-validation) +[![GitHub license](https://img.shields.io/github/license/gokulakannant/react-form-input-validation.svg)](https://github.com/gokulakannant/react-form-input-validation/blob/master/LICENSE.md) + +A customized [validatorjs](https://www.npmjs.com/package/validatorjs) library to validate the react forms. * [Supported Rules](https://www.npmjs.com/package/validatorjs#available-rules) (It is supports all validatorjs rules) * [Documentation](https://gokulakannant.github.io/react-form-input-validation/index.html) +* [Demo](https://codesandbox.io/s/react-form-input-validation-demp-hyuju?fontsize=14&hidenavigation=1&theme=dark) (in CodeSandbox) ## Why use react-form-input-validation? -* JQuery Free -* Auto Controlled State +* JQuery Free. +* Auto Controlled State. * Compatible with libraries like [Material UI](https://material-ui.com/), and etc. * Readable and declarative validation rules which is inspired by laravel framework. * Error messages with multilingual support. ## Usage -A example form has given below. View all available apis in [documentation](https://gokulakannant.github.io/react-form-input-validation/classes/reactformvalidator.html) +A example form has given below. View all available apis in [documentation](https://gokulakannant.github.io/react-form-input-validation/classes/reactformvalidator.html). ```js import React from "react"; @@ -106,7 +110,7 @@ class ValidationForm extends React.Component { ## Custom attribute name -Refer the below example to override the attribute name +Refer the below example to override the attribute name, ```html ``` -The output will be like, "The USER NAME field is required." +The output will be like, "The USER NAME field is required.". ## License -This project is licensed under the GPLv3 License - see the [LICENSE.md](LICENSE.md) file for details +This project is licensed under the GPLv3 License - see the [LICENSE.md](LICENSE.md) file for details. diff --git a/src/types/ReactTypes.ts b/src/types/ReactTypes.ts index 5dd561e..f0e9586 100644 --- a/src/types/ReactTypes.ts +++ b/src/types/ReactTypes.ts @@ -9,17 +9,96 @@ interface IAppState { isOwnUpdate?: boolean; } interface IAppProps { } -export interface IReactComponent extends Component { - +export interface IReactComponent extends Component { } +export enum Lang { + ar = "ar", + az = "az", + be = "be", + bg = "bg", + bs = "bs", + ca = "ca", + cs = "cs", + cy = "cy", + da = "da", + de = "de", + el = "el", + en = "en", + es = "es", + et = "et", + eu = "eu", + fa = "fa", + fi = "fi", + fr = "fr", + hr = "hr", + hu = "hu", + id = "id", + it = "it", + ja = "ja", + ka = "ka", + ko = "ko", + It = "It", + Iv = "Iv", + mk = "mk", + mn = "mn", + ms = "ms", + nb_NO = "nb_NO", + nl = "nl", + pl = "pl", + pt = "pt", + pt_BR = "pt_BR", + ro = "ro", + ru = "ru", + se = "se", + sl = "sl", + sq = "sq", + sr = "sr", + sv = "sv", + tr = "tr", + ua = "ua", + uk = "uk", + vi = "vi", + zh = "zh", + zh_TW = "zh_TW", } +/** + * A dictionary object to have options + * @example + * ```js + * let options = { + * locale: "en" + * } + * ``` + */ export interface IOptions { - locale: string; + /** + * The supported languages are {@link Lang} + */ + locale: Lang; } +/** + * A dictionary object. + * @example + * ```js + * { + * has: true, + * message: "The name field is required" + * } + * ``` + */ interface IError { + /** + * Denotes has error + */ has: boolean; + /** + * Denotes corresponding error message + */ message: string; } export interface IInputErrors { + /** + * Denotes all input errors + */ [key: string]: IError; }