Skip to content

Commit e7276b1

Browse files
Merge pull request #7 from gokulakannant/develop
Travis CI configured
2 parents 7d051fe + ccf0a88 commit e7276b1

File tree

4 files changed

+103
-10
lines changed

4 files changed

+103
-10
lines changed

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ typedocconfig.ts
1111
webpack.config.js
1212
tslint.json
1313
dist/typedocconfig.d.ts
14+
Documentation/
15+
node_modules/
16+
.travis.yml

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
node_js:
3+
- 7
4+
- 8
5+
- 9
6+
- 10
7+
install: npm install

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
# React Input Form Validation
22

3-
A customized validatorjs library to validate the react forms. This library is extended version of [validatorjs](https://www.npmjs.com/package/validatorjs).
3+
[![Build Status](https://api.travis-ci.org/gokulakannant/react-form-input-validation.png?branch=master)](https://travis-ci.org/gokulakannant/react-form-input-validation)
4+
[![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)
5+
6+
A customized [validatorjs](https://www.npmjs.com/package/validatorjs) library to validate the react forms.
47

58
* [Supported Rules](https://www.npmjs.com/package/validatorjs#available-rules) (It is supports all validatorjs rules)
69
* [Documentation](https://gokulakannant.github.io/react-form-input-validation/index.html)
10+
* [Demo](https://codesandbox.io/s/react-form-input-validation-demp-hyuju?fontsize=14&hidenavigation=1&theme=dark) (in CodeSandbox)
711

812
## Why use react-form-input-validation?
913

10-
* JQuery Free
11-
* Auto Controlled State
14+
* JQuery Free.
15+
* Auto Controlled State.
1216
* Compatible with libraries like [Material UI](https://material-ui.com/), and etc.
1317
* Readable and declarative validation rules which is inspired by laravel framework.
1418
* Error messages with multilingual support.
1519

1620
## Usage
1721

18-
A example form has given below. View all available apis in [documentation](https://gokulakannant.github.io/react-form-input-validation/classes/reactformvalidator.html)
22+
A example form has given below. View all available apis in [documentation](https://gokulakannant.github.io/react-form-input-validation/classes/reactformvalidator.html).
1923

2024
```js
2125
import React from "react";
@@ -106,7 +110,7 @@ class ValidationForm extends React.Component {
106110

107111
## Custom attribute name
108112

109-
Refer the below example to override the attribute name
113+
Refer the below example to override the attribute name,
110114

111115
```html
112116
<input
@@ -119,8 +123,8 @@ Refer the below example to override the attribute name
119123
/>
120124
```
121125

122-
The output will be like, "The USER NAME field is required."
126+
The output will be like, "The USER NAME field is required.".
123127

124128
## License
125129

126-
This project is licensed under the GPLv3 License - see the [LICENSE.md](LICENSE.md) file for details
130+
This project is licensed under the GPLv3 License - see the [LICENSE.md](LICENSE.md) file for details.

src/types/ReactTypes.ts

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,96 @@ interface IAppState {
99
isOwnUpdate?: boolean;
1010
}
1111
interface IAppProps { }
12-
export interface IReactComponent extends Component<IAppProps, IAppState> {
13-
12+
export interface IReactComponent extends Component<IAppProps, IAppState> { }
13+
export enum Lang {
14+
ar = "ar",
15+
az = "az",
16+
be = "be",
17+
bg = "bg",
18+
bs = "bs",
19+
ca = "ca",
20+
cs = "cs",
21+
cy = "cy",
22+
da = "da",
23+
de = "de",
24+
el = "el",
25+
en = "en",
26+
es = "es",
27+
et = "et",
28+
eu = "eu",
29+
fa = "fa",
30+
fi = "fi",
31+
fr = "fr",
32+
hr = "hr",
33+
hu = "hu",
34+
id = "id",
35+
it = "it",
36+
ja = "ja",
37+
ka = "ka",
38+
ko = "ko",
39+
It = "It",
40+
Iv = "Iv",
41+
mk = "mk",
42+
mn = "mn",
43+
ms = "ms",
44+
nb_NO = "nb_NO",
45+
nl = "nl",
46+
pl = "pl",
47+
pt = "pt",
48+
pt_BR = "pt_BR",
49+
ro = "ro",
50+
ru = "ru",
51+
se = "se",
52+
sl = "sl",
53+
sq = "sq",
54+
sr = "sr",
55+
sv = "sv",
56+
tr = "tr",
57+
ua = "ua",
58+
uk = "uk",
59+
vi = "vi",
60+
zh = "zh",
61+
zh_TW = "zh_TW",
1462
}
63+
/**
64+
* A dictionary object to have options
65+
* @example
66+
* ```js
67+
* let options = {
68+
* locale: "en"
69+
* }
70+
* ```
71+
*/
1572
export interface IOptions {
16-
locale: string;
73+
/**
74+
* The supported languages are {@link Lang}
75+
*/
76+
locale: Lang;
1777
}
78+
/**
79+
* A dictionary object.
80+
* @example
81+
* ```js
82+
* {
83+
* has: true,
84+
* message: "The name field is required"
85+
* }
86+
* ```
87+
*/
1888
interface IError {
89+
/**
90+
* Denotes has error
91+
*/
1992
has: boolean;
93+
/**
94+
* Denotes corresponding error message
95+
*/
2096
message: string;
2197
}
2298

2399
export interface IInputErrors {
100+
/**
101+
* Denotes all input errors
102+
*/
24103
[key: string]: IError;
25104
}

0 commit comments

Comments
 (0)