@chopperqt/react-hook-form-rules 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +314 -0
- package/README.md +307 -0
- package/dist/cjs/index.d.ts +15 -0
- package/dist/cjs/index.js +31 -0
- package/dist/cjs/locales/TranslateKey.d.ts +12 -0
- package/dist/cjs/locales/TranslateKey.js +14 -0
- package/dist/cjs/locales/en.json +11 -0
- package/dist/cjs/locales/i18n.d.ts +5 -0
- package/dist/cjs/locales/i18n.js +37 -0
- package/dist/cjs/locales/index.d.ts +4 -0
- package/dist/cjs/locales/index.js +9 -0
- package/dist/cjs/locales/ru.json +11 -0
- package/dist/cjs/rules/array/get-max-array-length-rule.d.ts +9 -0
- package/dist/cjs/rules/array/get-max-array-length-rule.js +17 -0
- package/dist/cjs/rules/array/get-min-array-length-rule.d.ts +9 -0
- package/dist/cjs/rules/array/get-min-array-length-rule.js +17 -0
- package/dist/cjs/rules/array/get-required-array-rule.d.ts +8 -0
- package/dist/cjs/rules/array/get-required-array-rule.js +15 -0
- package/dist/cjs/rules/constants.d.ts +1 -0
- package/dist/cjs/rules/constants.js +4 -0
- package/dist/cjs/rules/date/get-required-date-range-rule.d.ts +12 -0
- package/dist/cjs/rules/date/get-required-date-range-rule.js +23 -0
- package/dist/cjs/rules/default/get-max-length-rule.d.ts +11 -0
- package/dist/cjs/rules/default/get-max-length-rule.js +18 -0
- package/dist/cjs/rules/default/get-max-rule.d.ts +11 -0
- package/dist/cjs/rules/default/get-max-rule.js +16 -0
- package/dist/cjs/rules/default/get-min-length-rule.d.ts +11 -0
- package/dist/cjs/rules/default/get-min-length-rule.js +18 -0
- package/dist/cjs/rules/default/get-min-rule.d.ts +11 -0
- package/dist/cjs/rules/default/get-min-rule.js +18 -0
- package/dist/cjs/rules/default/get-require-rule.d.ts +11 -0
- package/dist/cjs/rules/default/get-require-rule.js +16 -0
- package/dist/cjs/rules/object/get-required-object-rule.d.ts +8 -0
- package/dist/cjs/rules/object/get-required-object-rule.js +21 -0
- package/dist/cjs/rules/patterns/get-email-rule.d.ts +17 -0
- package/dist/cjs/rules/patterns/get-email-rule.js +16 -0
- package/dist/cjs/rules/patterns/get-pattern-rule.d.ts +12 -0
- package/dist/cjs/rules/patterns/get-pattern-rule.js +16 -0
- package/dist/cjs/rules/patterns/get-url-rule.d.ts +17 -0
- package/dist/cjs/rules/patterns/get-url-rule.js +16 -0
- package/dist/cjs/tests/locales/locales.test.d.ts +1 -0
- package/dist/cjs/tests/locales/locales.test.js +20 -0
- package/dist/cjs/tests/rules/array/get-max-array-length-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/array/get-max-array-length-rule.test.js +15 -0
- package/dist/cjs/tests/rules/array/get-min-array-length-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/array/get-min-array-length-rule.test.js +15 -0
- package/dist/cjs/tests/rules/array/get-required-array-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/array/get-required-array-rule.test.js +15 -0
- package/dist/cjs/tests/rules/date/get-required-date-range-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/date/get-required-date-range-rule.test.js +14 -0
- package/dist/cjs/tests/rules/default/get-max-length-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/default/get-max-length-rule.test.js +23 -0
- package/dist/cjs/tests/rules/default/get-max-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/default/get-max-rule.test.js +23 -0
- package/dist/cjs/tests/rules/default/get-min-length-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/default/get-min-length-rule.test.js +23 -0
- package/dist/cjs/tests/rules/default/get-min-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/default/get-min-rule.test.js +23 -0
- package/dist/cjs/tests/rules/default/get-required-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/default/get-required-rule.test.js +11 -0
- package/dist/cjs/tests/rules/object/get-require-object-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/object/get-require-object-rule.test.js +15 -0
- package/dist/cjs/tests/rules/patterns/get-email-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/patterns/get-email-rule.test.js +25 -0
- package/dist/cjs/tests/rules/patterns/get-pattern-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/patterns/get-pattern-rule.test.js +11 -0
- package/dist/cjs/tests/rules/patterns/get-url-rule.test.d.ts +1 -0
- package/dist/cjs/tests/rules/patterns/get-url-rule.test.js +25 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/locales/TranslateKey.js +11 -0
- package/dist/esm/locales/en.json +11 -0
- package/dist/esm/locales/i18n.js +31 -0
- package/dist/esm/locales/index.js +4 -0
- package/dist/esm/locales/ru.json +11 -0
- package/dist/esm/rules/array/get-max-array-length-rule.js +13 -0
- package/dist/esm/rules/array/get-min-array-length-rule.js +13 -0
- package/dist/esm/rules/array/get-required-array-rule.js +11 -0
- package/dist/esm/rules/constants.js +1 -0
- package/dist/esm/rules/date/get-required-date-range-rule.js +19 -0
- package/dist/esm/rules/default/get-max-length-rule.js +14 -0
- package/dist/esm/rules/default/get-max-rule.js +12 -0
- package/dist/esm/rules/default/get-min-length-rule.js +14 -0
- package/dist/esm/rules/default/get-min-rule.js +14 -0
- package/dist/esm/rules/default/get-require-rule.js +12 -0
- package/dist/esm/rules/object/get-required-object-rule.js +17 -0
- package/dist/esm/rules/patterns/get-email-rule.js +12 -0
- package/dist/esm/rules/patterns/get-pattern-rule.js +12 -0
- package/dist/esm/rules/patterns/get-url-rule.js +12 -0
- package/dist/esm/tests/locales/locales.test.js +18 -0
- package/dist/esm/tests/rules/array/get-max-array-length-rule.test.js +13 -0
- package/dist/esm/tests/rules/array/get-min-array-length-rule.test.js +13 -0
- package/dist/esm/tests/rules/array/get-required-array-rule.test.js +13 -0
- package/dist/esm/tests/rules/date/get-required-date-range-rule.test.js +12 -0
- package/dist/esm/tests/rules/default/get-max-length-rule.test.js +21 -0
- package/dist/esm/tests/rules/default/get-max-rule.test.js +21 -0
- package/dist/esm/tests/rules/default/get-min-length-rule.test.js +21 -0
- package/dist/esm/tests/rules/default/get-min-rule.test.js +21 -0
- package/dist/esm/tests/rules/default/get-required-rule.test.js +9 -0
- package/dist/esm/tests/rules/object/get-require-object-rule.test.js +13 -0
- package/dist/esm/tests/rules/patterns/get-email-rule.test.js +23 -0
- package/dist/esm/tests/rules/patterns/get-pattern-rule.test.js +9 -0
- package/dist/esm/tests/rules/patterns/get-url-rule.test.js +23 -0
- package/package.json +54 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
## [2.3.1](https://github.com/chopperqt/react-hook-form-rules/compare/v2.3.0...v2.3.1) (2026-03-15)
|
|
2
|
+
|
|
3
|
+
### 💿 Continuous Integration
|
|
4
|
+
|
|
5
|
+
* исправлеине в CI ([da3800b](https://github.com/chopperqt/react-hook-form-rules/commit/da3800b4499db40c73b765d1b945ff44a405f6a1))
|
|
6
|
+
|
|
7
|
+
### 🐞 Bug Fixes
|
|
8
|
+
|
|
9
|
+
* исправление Readmd ([0877561](https://github.com/chopperqt/react-hook-form-rules/commit/087756122aa1aaeac45f2b990fa60f180a448387))
|
|
10
|
+
|
|
11
|
+
## [2.3.0](https://github.com/chopperqt/react-hook-form-rules/compare/v2.2.0...v2.3.0) (2026-03-15)
|
|
12
|
+
|
|
13
|
+
### 📄 Documentation
|
|
14
|
+
|
|
15
|
+
* изменение readmi.md ([6d18980](https://github.com/chopperqt/react-hook-form-rules/commit/6d18980447ed0429201d071ead66afff27610967))
|
|
16
|
+
* обновление документации ([e966fb9](https://github.com/chopperqt/react-hook-form-rules/commit/e966fb970eca058821e8311c44e0bbd947975145))
|
|
17
|
+
|
|
18
|
+
### 🆕 Features
|
|
19
|
+
|
|
20
|
+
* добавлены ES Modules ([cf6ca4b](https://github.com/chopperqt/react-hook-form-rules/commit/cf6ca4be6857fc5499e258d2a5cc395efdb47cd6))
|
|
21
|
+
* добавлены ключи для перевода ([11edcef](https://github.com/chopperqt/react-hook-form-rules/commit/11edcef2cdefa72d8188284f06a63b6b62e6fd18))
|
|
22
|
+
|
|
23
|
+
### 🔥 Code Refactoring
|
|
24
|
+
|
|
25
|
+
* добавление translate метода, чтобы легче было получить перевод ([f38bcd6](https://github.com/chopperqt/react-hook-form-rules/commit/f38bcd6c80b403d22d308d16ccc5eabe13044673))
|
|
26
|
+
* добавлены alias ([80867d1](https://github.com/chopperqt/react-hook-form-rules/commit/80867d1e6bf1d3ff586fa21ba01d940179ccc81e))
|
|
27
|
+
* незначительные изменения ([20e3786](https://github.com/chopperqt/react-hook-form-rules/commit/20e378697bb89c42d22021b4dddfbf44e0ad4038))
|
|
28
|
+
* улучшение типизации ([2f887e0](https://github.com/chopperqt/react-hook-form-rules/commit/2f887e0d2504b6af80a5889ca25ad17c62e719a4))
|
|
29
|
+
|
|
30
|
+
### 🧪 Tests
|
|
31
|
+
|
|
32
|
+
* добавление текстов для get-required-date-range-rule ([33e7eb2](https://github.com/chopperqt/react-hook-form-rules/commit/33e7eb20216719be299d85faf7a192fc92b2f2dd))
|
|
33
|
+
|
|
34
|
+
## [2.2.0](https://github.com/chopperqt/react-hook-form-rules/compare/v2.1.0...v2.2.0) (2026-03-14)
|
|
35
|
+
|
|
36
|
+
### 💿 Continuous Integration
|
|
37
|
+
|
|
38
|
+
* исправление CI ([af687b7](https://github.com/chopperqt/react-hook-form-rules/commit/af687b79c8f8cc62ab9bb3a907384ea203dbbd82))
|
|
39
|
+
|
|
40
|
+
### 🆕 Features
|
|
41
|
+
|
|
42
|
+
* добавлено новое правильно валидации ([45c1712](https://github.com/chopperqt/react-hook-form-rules/commit/45c1712ab82048b5e0d251992b2b518a770615ab))
|
|
43
|
+
|
|
44
|
+
## [2.1.0](https://github.com/chopperqt/react-hook-form-rules/compare/v2.0.1...v2.1.0) (2025-12-28)
|
|
45
|
+
|
|
46
|
+
### 🆕 Features
|
|
47
|
+
|
|
48
|
+
* удалены tests из финальной сборки ([c785d34](https://github.com/chopperqt/react-hook-form-rules/commit/c785d34e6d8ad75e346a06ef64bb07f3ea558e1e))
|
|
49
|
+
|
|
50
|
+
## [2.0.1](https://github.com/chopperqt/react-hook-form-rules/compare/v2.0.0...v2.0.1) (2025-12-28)
|
|
51
|
+
|
|
52
|
+
### 📦 Build System
|
|
53
|
+
|
|
54
|
+
* обновление build ([698d327](https://github.com/chopperqt/react-hook-form-rules/commit/698d3270a62dd142e242dc104d04a03ac77d8c89))
|
|
55
|
+
|
|
56
|
+
### 🐞 Bug Fixes
|
|
57
|
+
|
|
58
|
+
* правки конфига ([f2e0bd4](https://github.com/chopperqt/react-hook-form-rules/commit/f2e0bd40eaa66d51f304f9926100c4ea137135a1))
|
|
59
|
+
|
|
60
|
+
## [2.0.0](https://github.com/chopperqt/react-hook-form-rules/compare/v1.7.4...v2.0.0) (2025-12-28)
|
|
61
|
+
|
|
62
|
+
### ⚠ BREAKING CHANGES
|
|
63
|
+
|
|
64
|
+
* API смены языка изменился
|
|
65
|
+
|
|
66
|
+
### 🆕 Features
|
|
67
|
+
|
|
68
|
+
* добавлен общий конфиг для языков ([70f62fc](https://github.com/chopperqt/react-hook-form-rules/commit/70f62fc5171b964f3ae52a8adfa3e49dd2c4bd5b))
|
|
69
|
+
|
|
70
|
+
## [1.7.4](https://github.com/chopperqt/react-hook-form-rules/compare/v1.7.3...v1.7.4) (2025-12-28)
|
|
71
|
+
|
|
72
|
+
### 🐞 Bug Fixes
|
|
73
|
+
|
|
74
|
+
* исправлен импорт i18n ([ed61898](https://github.com/chopperqt/react-hook-form-rules/commit/ed61898b211aba638837104ec3215e84840c444b))
|
|
75
|
+
* исправление конфликтов ([9ae79a4](https://github.com/chopperqt/react-hook-form-rules/commit/9ae79a4b9328afba1fcb2250e64fa3836edc4f87))
|
|
76
|
+
* испралвение package.json ([8165b1a](https://github.com/chopperqt/react-hook-form-rules/commit/8165b1ad0ab39b0ad28bb92a3ba14ee976f17378))
|
|
77
|
+
|
|
78
|
+
## [1.7.3](https://github.com/chopperqt/react-hook-form-rules/compare/v1.7.2...v1.7.3) (2025-12-28)
|
|
79
|
+
|
|
80
|
+
### 🐞 Bug Fixes
|
|
81
|
+
|
|
82
|
+
* исправлен импорт i18n ([c655a19](https://github.com/chopperqt/react-hook-form-rules/commit/c655a1985f6902d3993721e9b8ecc7136936ae5e))
|
|
83
|
+
|
|
84
|
+
## [1.7.2](https://github.com/chopperqt/react-hook-form-rules/compare/v1.7.1...v1.7.2) (2025-12-27)
|
|
85
|
+
|
|
86
|
+
### 🔥 Code Refactoring
|
|
87
|
+
|
|
88
|
+
* обновление локалей ([5f5d2d2](https://github.com/chopperqt/react-hook-form-rules/commit/5f5d2d2f01ea733c9ee54de20332ff1c51d0f116))
|
|
89
|
+
|
|
90
|
+
## [1.7.1](https://github.com/chopperqt/react-hook-form-rules/compare/v1.7.0...v1.7.1) (2025-12-27)
|
|
91
|
+
|
|
92
|
+
### 📄 Documentation
|
|
93
|
+
|
|
94
|
+
* улучшение JSDoc ([676297b](https://github.com/chopperqt/react-hook-form-rules/commit/676297be1710bc0b4220bcb54a1a9df4794fe181))
|
|
95
|
+
|
|
96
|
+
## [1.7.0](https://github.com/chopperqt/react-hook-form-rules/compare/v1.6.0...v1.7.0) (2025-12-27)
|
|
97
|
+
|
|
98
|
+
### 📦 Build System
|
|
99
|
+
|
|
100
|
+
* добавлен патч к папке dist ([4a61b76](https://github.com/chopperqt/react-hook-form-rules/commit/4a61b7630d1763454f9cfb4d287f3e60a04c962b))
|
|
101
|
+
|
|
102
|
+
### 🆕 Features
|
|
103
|
+
|
|
104
|
+
* добавлен CI для запуска тестов ([bedfee3](https://github.com/chopperqt/react-hook-form-rules/commit/bedfee3d756eca6f0f27d7fa7ba20d7291b160c1))
|
|
105
|
+
* добавлен текст для getMaxArrayLengthRule ([ea24bf5](https://github.com/chopperqt/react-hook-form-rules/commit/ea24bf5cf44b1c2b46eeb9e4e3ae5a9209b6829e))
|
|
106
|
+
* добавлен тест для getUrlRule ([0d695b4](https://github.com/chopperqt/react-hook-form-rules/commit/0d695b414cef77d83097b9f344d2395727a08f2f))
|
|
107
|
+
* добавлена локализация ошибок en/ru ([1b7949e](https://github.com/chopperqt/react-hook-form-rules/commit/1b7949e17c532c979de1e5b874960c6b0cafcabf))
|
|
108
|
+
* добавление unit(jest) тестов ([8f0c4c8](https://github.com/chopperqt/react-hook-form-rules/commit/8f0c4c8fa29425225e03583ceaed19136b1e8b57))
|
|
109
|
+
* добавление локали ([c932294](https://github.com/chopperqt/react-hook-form-rules/commit/c9322942d2d29684178dc9389db61104402439d9))
|
|
110
|
+
* добавление текстов для getMinRule и getRequiredRule ([ffd95cb](https://github.com/chopperqt/react-hook-form-rules/commit/ffd95cb08c15846504ff6539fd624a0488814506))
|
|
111
|
+
* добавление теста для getPatternRule ([4ca907f](https://github.com/chopperqt/react-hook-form-rules/commit/4ca907f654802fac318191eca6788a9b82dc58ea))
|
|
112
|
+
* добавление тестов для getMaxLengthRule ([2d66e5c](https://github.com/chopperqt/react-hook-form-rules/commit/2d66e5c2b3b606e83ea8c0cab715c6c800dcc95a))
|
|
113
|
+
* добавление тестов для getMaxRule ([98b0fc5](https://github.com/chopperqt/react-hook-form-rules/commit/98b0fc5dd0c2351bfdab3a779fe1dc882f7717c7))
|
|
114
|
+
* добавление тестов для getMinArrayLengthRule ([2e50f59](https://github.com/chopperqt/react-hook-form-rules/commit/2e50f5969dc80353d67014dc5268ab92b031f34c))
|
|
115
|
+
* добавлено новое правило ([90c3dbe](https://github.com/chopperqt/react-hook-form-rules/commit/90c3dbe68d9927e8230542c0dd2e7ebb42e449f6))
|
|
116
|
+
* добавлены тесты для getMinLengthRule ([be37c93](https://github.com/chopperqt/react-hook-form-rules/commit/be37c935e66995a7301189ec314ea4d0a92297a5))
|
|
117
|
+
|
|
118
|
+
### 🐞 Bug Fixes
|
|
119
|
+
|
|
120
|
+
* добавлен перевод ошибок ([eb30cb6](https://github.com/chopperqt/react-hook-form-rules/commit/eb30cb6aab8bdeb015a2a13201854e2d019d47bb))
|
|
121
|
+
|
|
122
|
+
### 🔥 Code Refactoring
|
|
123
|
+
|
|
124
|
+
* изменение архитектуры папок для тестов ([6e787e8](https://github.com/chopperqt/react-hook-form-rules/commit/6e787e880d1d34417fc91b5336390ba107bc9ad1))
|
|
125
|
+
* обновление .gitignore ([9d6e5c1](https://github.com/chopperqt/react-hook-form-rules/commit/9d6e5c1e331d82ea5d70452c47d5a18f4a2e154e))
|
|
126
|
+
* правки конфликтов ([9b0ccf6](https://github.com/chopperqt/react-hook-form-rules/commit/9b0ccf68b0db060dfaf7c1b35cabed07f419e808))
|
|
127
|
+
* ренейминг папки ([d176547](https://github.com/chopperqt/react-hook-form-rules/commit/d1765479f7a60425b3598e8143f06539255e204a))
|
|
128
|
+
|
|
129
|
+
## [1.6.0](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.8...v1.6.0) (2025-03-16)
|
|
130
|
+
|
|
131
|
+
### 🆕 Features
|
|
132
|
+
|
|
133
|
+
* добавлен CI для запуска тестов ([31146a6](https://github.com/chopperqt/react-hook-form-rules/commit/31146a64d76637d307181fbbbeca400bfc0a47a3))
|
|
134
|
+
* добавлен текст для getMaxArrayLengthRule ([bac2105](https://github.com/chopperqt/react-hook-form-rules/commit/bac2105c3958a7f85fcab6f9cebc902dd1ab4850))
|
|
135
|
+
* добавлен тест для getUrlRule ([c43710c](https://github.com/chopperqt/react-hook-form-rules/commit/c43710c869358bcf0a7fcae2a0948f3411d5f9f0))
|
|
136
|
+
* добавлена локализация ошибок en/ru ([3b0d373](https://github.com/chopperqt/react-hook-form-rules/commit/3b0d373d18ad32edf8e4d132d0e7b19499657aa0))
|
|
137
|
+
* добавление unit(jest) тестов ([5dfec8e](https://github.com/chopperqt/react-hook-form-rules/commit/5dfec8e8d9d34268c2a308fcd11e410fcede8d17))
|
|
138
|
+
* добавление локали ([b7a6c94](https://github.com/chopperqt/react-hook-form-rules/commit/b7a6c941453f0dfaa918d5fd8f0da1eeaa3e696b))
|
|
139
|
+
* добавление текстов для getMinRule и getRequiredRule ([313af6d](https://github.com/chopperqt/react-hook-form-rules/commit/313af6dab27f78c27ef4de5a4c3f73f3d9090786))
|
|
140
|
+
* добавление теста для getPatternRule ([ed891a8](https://github.com/chopperqt/react-hook-form-rules/commit/ed891a8e24b75dec6c011faf2ec884a43d1b01f8))
|
|
141
|
+
* добавление тестов для getMaxLengthRule ([db0ff06](https://github.com/chopperqt/react-hook-form-rules/commit/db0ff060495ff5d25e33135c7b6b3959afff961a))
|
|
142
|
+
* добавление тестов для getMaxRule ([b618a40](https://github.com/chopperqt/react-hook-form-rules/commit/b618a40be413912869cff0fae687d07bf6b76683))
|
|
143
|
+
* добавление тестов для getMinArrayLengthRule ([d6dab70](https://github.com/chopperqt/react-hook-form-rules/commit/d6dab7031c682d3f8827546b6da87afeb667a655))
|
|
144
|
+
* добавлено новое правило ([3debbcb](https://github.com/chopperqt/react-hook-form-rules/commit/3debbcb47eebcf08e4b8788d3c349808a4f0c258))
|
|
145
|
+
* добавлены тесты для getMinLengthRule ([385b798](https://github.com/chopperqt/react-hook-form-rules/commit/385b79874fb4da958caf9ac4d6575d49e7f88e3d))
|
|
146
|
+
|
|
147
|
+
### 🐞 Bug Fixes
|
|
148
|
+
|
|
149
|
+
* добавлен перевод ошибок ([21b63d6](https://github.com/chopperqt/react-hook-form-rules/commit/21b63d65f96571b746918d20910debea90473849))
|
|
150
|
+
|
|
151
|
+
### 🔥 Code Refactoring
|
|
152
|
+
|
|
153
|
+
* доработки конфига ([325f134](https://github.com/chopperqt/react-hook-form-rules/commit/325f134af712efd9159226b8f2778812467e7783))
|
|
154
|
+
* изменение архитектуры папок для тестов ([66d5d8a](https://github.com/chopperqt/react-hook-form-rules/commit/66d5d8a0b85e7df25d72aa5bfc14b54ff1179096))
|
|
155
|
+
* незначительные правки ([86c9616](https://github.com/chopperqt/react-hook-form-rules/commit/86c961681f10984c2da58e72c4a0be96539e264a))
|
|
156
|
+
* ренейминг папки ([21fae72](https://github.com/chopperqt/react-hook-form-rules/commit/21fae72f410c8a0b51ccfc3515dae3888dda213a))
|
|
157
|
+
|
|
158
|
+
## [1.5.9](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.8...v1.5.9) (2025-03-15)
|
|
159
|
+
|
|
160
|
+
### 🔥 Code Refactoring
|
|
161
|
+
|
|
162
|
+
* доработки конфига ([325f134](https://github.com/chopperqt/react-hook-form-rules/commit/325f134af712efd9159226b8f2778812467e7783))
|
|
163
|
+
* незначительные правки ([86c9616](https://github.com/chopperqt/react-hook-form-rules/commit/86c961681f10984c2da58e72c4a0be96539e264a))
|
|
164
|
+
|
|
165
|
+
## [1.5.8](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.7...v1.5.8) (2025-03-15)
|
|
166
|
+
|
|
167
|
+
### 🔥 Code Refactoring
|
|
168
|
+
|
|
169
|
+
* незначительные правки ([d388b0a](https://github.com/chopperqt/react-hook-form-rules/commit/d388b0a808884c29096c23eb13be16420117c100))
|
|
170
|
+
|
|
171
|
+
## [1.5.7](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.6...v1.5.7) (2025-03-15)
|
|
172
|
+
|
|
173
|
+
### 🔥 Code Refactoring
|
|
174
|
+
|
|
175
|
+
* незначительные правки ([994c39a](https://github.com/chopperqt/react-hook-form-rules/commit/994c39ab4c0e9c004375514a84c157faa727f00a))
|
|
176
|
+
* незначительные правки ([c8df194](https://github.com/chopperqt/react-hook-form-rules/commit/c8df19496287bc50a39f3e8018bdcdd51b36bfa4))
|
|
177
|
+
* незначительные правки ([d5b03da](https://github.com/chopperqt/react-hook-form-rules/commit/d5b03da524273c772658a28e557752c29b3b490a))
|
|
178
|
+
* правки конфига ([a7befe9](https://github.com/chopperqt/react-hook-form-rules/commit/a7befe91fb8755c92789c8db0b4c23c3094a470e))
|
|
179
|
+
* правки конфилктов ([a34bea4](https://github.com/chopperqt/react-hook-form-rules/commit/a34bea42b7197249dc84650a982243d8327baded))
|
|
180
|
+
* удаление файла, который больше не используется ([942962a](https://github.com/chopperqt/react-hook-form-rules/commit/942962ace0cbd44a0020d499fd896e16be6fe8ca))
|
|
181
|
+
|
|
182
|
+
## [1.5.6](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.5...v1.5.6) (2025-03-15)
|
|
183
|
+
|
|
184
|
+
### 🔥 Code Refactoring
|
|
185
|
+
|
|
186
|
+
* незначительные правки ([0338442](https://github.com/chopperqt/react-hook-form-rules/commit/033844264302d1d83bf60a1e3efc806f529d4697))
|
|
187
|
+
|
|
188
|
+
## [1.5.5](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.4...v1.5.5) (2025-03-15)
|
|
189
|
+
|
|
190
|
+
### 🔥 Code Refactoring
|
|
191
|
+
|
|
192
|
+
* правки конфига ([b2c4c15](https://github.com/chopperqt/react-hook-form-rules/commit/b2c4c1501f152276c7af547bee01d04baea2f7b3))
|
|
193
|
+
|
|
194
|
+
## [1.5.4](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.3...v1.5.4) (2025-03-15)
|
|
195
|
+
|
|
196
|
+
### 🔥 Code Refactoring
|
|
197
|
+
|
|
198
|
+
* незначительные правки ([c1a76cb](https://github.com/chopperqt/react-hook-form-rules/commit/c1a76cb6f9dedd9f5d298f7aa4f1d99e7292b645))
|
|
199
|
+
|
|
200
|
+
## [1.5.3](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.2...v1.5.3) (2025-03-15)
|
|
201
|
+
|
|
202
|
+
### 🔥 Code Refactoring
|
|
203
|
+
|
|
204
|
+
* незначительные правки ([0c30242](https://github.com/chopperqt/react-hook-form-rules/commit/0c30242e7b7f915830fb57ef32f3328102a7403b))
|
|
205
|
+
* удаление файла, который больше не используется ([68d57b2](https://github.com/chopperqt/react-hook-form-rules/commit/68d57b2ca382c7eaef73307ffa932f4989281f3b))
|
|
206
|
+
|
|
207
|
+
## [1.5.2](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.1...v1.5.2) (2025-03-15)
|
|
208
|
+
|
|
209
|
+
### 🔥 Code Refactoring
|
|
210
|
+
|
|
211
|
+
* доработаки release.config ([43407a0](https://github.com/chopperqt/react-hook-form-rules/commit/43407a01bf0996982808d0045a90732b9df83dcc))
|
|
212
|
+
|
|
213
|
+
## [1.5.1](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.0...v1.5.1) (2025-03-15)
|
|
214
|
+
|
|
215
|
+
### 🔥 Code Refactoring
|
|
216
|
+
|
|
217
|
+
* правки npmrc ([5f91200](https://github.com/chopperqt/react-hook-form-rules/commit/5f912005f638fcd7e79cd0f980a46747a013dbb8))
|
|
218
|
+
|
|
219
|
+
## [1.5.0](https://github.com/chopperqt/react-hook-form-rules/compare/v1.4.3...v1.5.0) (2025-03-15)
|
|
220
|
+
|
|
221
|
+
### 🆕 Features
|
|
222
|
+
|
|
223
|
+
* добавлена проверка токена ([7a2ad16](https://github.com/chopperqt/react-hook-form-rules/commit/7a2ad16d5521a8b773de35ccb89f66767fd27fb0))
|
|
224
|
+
|
|
225
|
+
### 🔥 Code Refactoring
|
|
226
|
+
|
|
227
|
+
* env подняты выше ([799628d](https://github.com/chopperqt/react-hook-form-rules/commit/799628d43debdb03bcc958fd95d4b02a076164d5))
|
|
228
|
+
* добавлен .npmrc ([80cebac](https://github.com/chopperqt/react-hook-form-rules/commit/80cebac0b76cf5e30b12c8b908404f5d494b7b04))
|
|
229
|
+
* добавлен .npmrc ([607979c](https://github.com/chopperqt/react-hook-form-rules/commit/607979c3c63023dfcb2b883168f6d7b1f54cb0ce))
|
|
230
|
+
* исправление npmrc ([946c28d](https://github.com/chopperqt/react-hook-form-rules/commit/946c28d1b57ffe984aaa42d0d135ddf18c3e4260))
|
|
231
|
+
|
|
232
|
+
## [1.4.3](https://github.com/chopperqt/react-hook-form-rules/compare/v1.4.2...v1.4.3) (2025-03-15)
|
|
233
|
+
|
|
234
|
+
### 🔥 Code Refactoring
|
|
235
|
+
|
|
236
|
+
* незначительные правки ([da9eef9](https://github.com/chopperqt/react-hook-form-rules/commit/da9eef91d6e80df56ec5a32bce7f62ce532b2b6f))
|
|
237
|
+
|
|
238
|
+
## [1.0.1](https://github.com/chopperqt/react-hook-form-rules/compare/v1.0.0...v1.0.1) (2025-03-15)
|
|
239
|
+
|
|
240
|
+
### 🔥 Code Refactoring
|
|
241
|
+
|
|
242
|
+
* измнеение версии ([ca25833](https://github.com/chopperqt/react-hook-form-rules/commit/ca25833c08484db0194ee6e3503e3f17dbe3d264))
|
|
243
|
+
|
|
244
|
+
## 1.0.0 (2025-03-15)
|
|
245
|
+
|
|
246
|
+
### 🆕 Features
|
|
247
|
+
|
|
248
|
+
* добавлен CI release ([a875975](https://github.com/chopperqt/react-hook-form-rules/commit/a875975601ed3be3e02d72bdbdfc9c3c74c7381f))
|
|
249
|
+
* добавлен commitizen и semantic-release ([fa61a4c](https://github.com/chopperqt/react-hook-form-rules/commit/fa61a4c9c6493b36b4abc304706d74104d631da6))
|
|
250
|
+
* добавлен недостающий пакет ([edaf738](https://github.com/chopperqt/react-hook-form-rules/commit/edaf7381593bde0e6798da036fe7f897defe64af))
|
|
251
|
+
* добавлен пакет ([cccdfee](https://github.com/chopperqt/react-hook-form-rules/commit/cccdfee421da031fe7433ca44ee9dc5688ef2bbf))
|
|
252
|
+
* добавлена публикация в github packages ([4e0d4db](https://github.com/chopperqt/react-hook-form-rules/commit/4e0d4db013f789ae193cefa3e121b5e317a376ec))
|
|
253
|
+
* добавлены permissionas ([e42b3d0](https://github.com/chopperqt/react-hook-form-rules/commit/e42b3d081854ec57d21923b37436be5032ebd2e6))
|
|
254
|
+
* добавлены некоторые плагины ([0d9e4f1](https://github.com/chopperqt/react-hook-form-rules/commit/0d9e4f1d556bd4c095300ac5e1e30bae2773b5fd))
|
|
255
|
+
* жалкая попытка ([3e14b80](https://github.com/chopperqt/react-hook-form-rules/commit/3e14b8031fea6fbb9a350c7ec80d88310688f428))
|
|
256
|
+
* изменен release ([42c4134](https://github.com/chopperqt/react-hook-form-rules/commit/42c413422f411bb83716b844120afceaa7f8f9d2))
|
|
257
|
+
* обновление CI rlease ([7312de2](https://github.com/chopperqt/react-hook-form-rules/commit/7312de21e2b5c491c1e3a5b7d46e0053ca7a69fe))
|
|
258
|
+
* обновление semantic-release node ([9f4d6ea](https://github.com/chopperqt/react-hook-form-rules/commit/9f4d6ea1b75e4cf1ad5d3dea5942f43931f2808a))
|
|
259
|
+
* правки импортов ([2c7b5de](https://github.com/chopperqt/react-hook-form-rules/commit/2c7b5de4c99ade3a3f755f6122eb78f1611054c9))
|
|
260
|
+
* правки нейминга ([c231562](https://github.com/chopperqt/react-hook-form-rules/commit/c231562e2b4e8822b386c6ea23c621f7f2e76719))
|
|
261
|
+
|
|
262
|
+
### 🔥 Code Refactoring
|
|
263
|
+
|
|
264
|
+
* ghjdhrf ([92668f0](https://github.com/chopperqt/react-hook-form-rules/commit/92668f015e765a64e31366e8e9cf272ad19c1389))
|
|
265
|
+
* gjgsnrf ([2759b1f](https://github.com/chopperqt/react-hook-form-rules/commit/2759b1ffe717855a239d56b3445326f34ca3717f))
|
|
266
|
+
* добавление которые плагинов ([3cc2e8a](https://github.com/chopperqt/react-hook-form-rules/commit/3cc2e8a9359075cad1f6d6eba4ba307d65ba1cf4))
|
|
267
|
+
* жалкие попытки ([3c1f17b](https://github.com/chopperqt/react-hook-form-rules/commit/3c1f17b73323c39d375d49409ec778443bdd62b7))
|
|
268
|
+
* исправление названия папки ([07a9d87](https://github.com/chopperqt/react-hook-form-rules/commit/07a9d87643a1219755b55d67db144387a635a79b))
|
|
269
|
+
* незначительные правки ([a94d8b9](https://github.com/chopperqt/react-hook-form-rules/commit/a94d8b9f30ac033f2b0542bede2411cab04d27dd))
|
|
270
|
+
* незначительные правки ([0b4af36](https://github.com/chopperqt/react-hook-form-rules/commit/0b4af365918b60a3bf9d13e00a36903860d9e28a))
|
|
271
|
+
* незначительные правки ([4ba2910](https://github.com/chopperqt/react-hook-form-rules/commit/4ba2910488730885a4c856fa85254f8f7f30587e))
|
|
272
|
+
* незначительные правки ([83cdca6](https://github.com/chopperqt/react-hook-form-rules/commit/83cdca6ea879f127569740b0df6e1fa12469fcc1))
|
|
273
|
+
* незначительные правки ([d957531](https://github.com/chopperqt/react-hook-form-rules/commit/d9575319912e9d9b9a6d655f8e275d191b0dfbee))
|
|
274
|
+
* незначительные правки ([ae4bc8d](https://github.com/chopperqt/react-hook-form-rules/commit/ae4bc8df55362669125b46e5fa7b5c7a2d6d3ff4))
|
|
275
|
+
* незначительные правки ([380bff6](https://github.com/chopperqt/react-hook-form-rules/commit/380bff6712720ceae40a4a2da8f67760be9ae607))
|
|
276
|
+
* незначительные правки ([7835978](https://github.com/chopperqt/react-hook-form-rules/commit/783597889151f9309308aae758516f0bfdc177a8))
|
|
277
|
+
* незначительные правки ([ca75448](https://github.com/chopperqt/react-hook-form-rules/commit/ca7544803e9a3118441b36dffb15bfe4884dd474))
|
|
278
|
+
* незначительные правки ([b570c47](https://github.com/chopperqt/react-hook-form-rules/commit/b570c47c96ebe44937abbe61df5fed0b2f71197e))
|
|
279
|
+
* незначительные правки ([30638e4](https://github.com/chopperqt/react-hook-form-rules/commit/30638e4ffd58dd08001ab365f6d03cafd60a63d0))
|
|
280
|
+
* незначительные правки ([0f40195](https://github.com/chopperqt/react-hook-form-rules/commit/0f4019502f2ad54eb2a73f4e705c2183963e9d2a))
|
|
281
|
+
* незначительные правки ([a523404](https://github.com/chopperqt/react-hook-form-rules/commit/a5234048c0f08eee34143454ee10057af4b6ebdf))
|
|
282
|
+
* обновление ([267436f](https://github.com/chopperqt/react-hook-form-rules/commit/267436fb9b1cb0cf16dd5f3c094d4f49263dca10))
|
|
283
|
+
* очередная жалкая попытка ([4cd5227](https://github.com/chopperqt/react-hook-form-rules/commit/4cd5227e96d50a475413431ca8e6b37f0f1406e7))
|
|
284
|
+
* поднятие версии node ([3d99e01](https://github.com/chopperqt/react-hook-form-rules/commit/3d99e017bfc0e1275c60c022c9c6267eda5d4df4))
|
|
285
|
+
* попытка ([b81087c](https://github.com/chopperqt/react-hook-form-rules/commit/b81087c547cbf4d0d358a51af1d054d1f03c9f31))
|
|
286
|
+
* попытка ([46282a8](https://github.com/chopperqt/react-hook-form-rules/commit/46282a833319073e403236832867da64687a168a))
|
|
287
|
+
* пОпытка запустить ([eec52db](https://github.com/chopperqt/react-hook-form-rules/commit/eec52dba0c42831a43ec26610443a075cd9d8bc6))
|
|
288
|
+
* пОпытка запустить ([b17ba07](https://github.com/chopperqt/react-hook-form-rules/commit/b17ba07bceda573b5a8e733ebbc27fc5e15ad420))
|
|
289
|
+
* попытка запушить как надо ([4b2c469](https://github.com/chopperqt/react-hook-form-rules/commit/4b2c469d0fd6faedb6ae42e261a26fabc57e38cc))
|
|
290
|
+
* попытка удачно запустить ([089654f](https://github.com/chopperqt/react-hook-form-rules/commit/089654fad7b032686578e69d8aaf0cb1f8ac9ffe))
|
|
291
|
+
* правки ([ada50f7](https://github.com/chopperqt/react-hook-form-rules/commit/ada50f78a3a5811721704f024a55c9933a8d4d03))
|
|
292
|
+
* правки release ([84a226a](https://github.com/chopperqt/react-hook-form-rules/commit/84a226a5c23a38bd0f255e2e4abe0cf9da844d36))
|
|
293
|
+
* удаление плагина, который не используется ([df4524e](https://github.com/chopperqt/react-hook-form-rules/commit/df4524eae5c470f9beba308c60223c09e3c52c48))
|
|
294
|
+
|
|
295
|
+
## [1.6.0](https://github.com/chopperqt/react-hook-form-rules/compare/v1.5.3...v1.6.0) (2025-03-15)
|
|
296
|
+
|
|
297
|
+
### 🆕 Features
|
|
298
|
+
|
|
299
|
+
* добавлен пакет ([cccdfee](https://github.com/chopperqt/react-hook-form-rules/commit/cccdfee421da031fe7433ca44ee9dc5688ef2bbf))
|
|
300
|
+
* жалкая попытка ([3e14b80](https://github.com/chopperqt/react-hook-form-rules/commit/3e14b8031fea6fbb9a350c7ec80d88310688f428))
|
|
301
|
+
|
|
302
|
+
### 🔥 Code Refactoring
|
|
303
|
+
|
|
304
|
+
* gjgsnrf ([2759b1f](https://github.com/chopperqt/react-hook-form-rules/commit/2759b1ffe717855a239d56b3445326f34ca3717f))
|
|
305
|
+
* жалкие попытки ([3c1f17b](https://github.com/chopperqt/react-hook-form-rules/commit/3c1f17b73323c39d375d49409ec778443bdd62b7))
|
|
306
|
+
* незначительные правки ([0b4af36](https://github.com/chopperqt/react-hook-form-rules/commit/0b4af365918b60a3bf9d13e00a36903860d9e28a))
|
|
307
|
+
* незначительные правки ([4ba2910](https://github.com/chopperqt/react-hook-form-rules/commit/4ba2910488730885a4c856fa85254f8f7f30587e))
|
|
308
|
+
* незначительные правки ([83cdca6](https://github.com/chopperqt/react-hook-form-rules/commit/83cdca6ea879f127569740b0df6e1fa12469fcc1))
|
|
309
|
+
* незначительные правки ([d957531](https://github.com/chopperqt/react-hook-form-rules/commit/d9575319912e9d9b9a6d655f8e275d191b0dfbee))
|
|
310
|
+
* незначительные правки ([ae4bc8d](https://github.com/chopperqt/react-hook-form-rules/commit/ae4bc8df55362669125b46e5fa7b5c7a2d6d3ff4))
|
|
311
|
+
* очередная жалкая попытка ([4cd5227](https://github.com/chopperqt/react-hook-form-rules/commit/4cd5227e96d50a475413431ca8e6b37f0f1406e7))
|
|
312
|
+
* попытка ([b81087c](https://github.com/chopperqt/react-hook-form-rules/commit/b81087c547cbf4d0d358a51af1d054d1f03c9f31))
|
|
313
|
+
* попытка ([46282a8](https://github.com/chopperqt/react-hook-form-rules/commit/46282a833319073e403236832867da64687a168a))
|
|
314
|
+
* правки ([ada50f7](https://github.com/chopperqt/react-hook-form-rules/commit/ada50f78a3a5811721704f024a55c9933a8d4d03))
|
package/README.md
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# react-hook-form-rules
|
|
2
|
+
|
|
3
|
+
This is a small library that contains rules for clearer validation handling in the [react-hook-form](https://www.react-hook-form.com/) library.
|
|
4
|
+
|
|
5
|
+
# Rules
|
|
6
|
+
|
|
7
|
+
## Default
|
|
8
|
+
|
|
9
|
+
### getRequiredRule
|
|
10
|
+
|
|
11
|
+
#### Description
|
|
12
|
+
|
|
13
|
+
This rule makes the field required.
|
|
14
|
+
|
|
15
|
+
#### Options
|
|
16
|
+
|
|
17
|
+
| Option | Type | Default | Description |
|
|
18
|
+
| ---------- | ------- | ------------------------- | --------------------------------------------------------------- |
|
|
19
|
+
| isRequired | boolean | true | Dynamic parameter that indicates whether the field is required. |
|
|
20
|
+
| message | string | "This field is required." | Custom message. |
|
|
21
|
+
|
|
22
|
+
#### Code example
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
import { getRequiredRule } from 'react-hook-form-rules';
|
|
26
|
+
|
|
27
|
+
const {...} = useController({
|
|
28
|
+
rules: {{
|
|
29
|
+
required: getRequiredRule()
|
|
30
|
+
}}
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### getMaxRule
|
|
35
|
+
|
|
36
|
+
#### Description
|
|
37
|
+
|
|
38
|
+
This rule returns an error if the number is greater than the specified value.
|
|
39
|
+
|
|
40
|
+
#### Options
|
|
41
|
+
|
|
42
|
+
| Option | Type | Default | Description |
|
|
43
|
+
| ------- | ------ | ------------------------- | --------------- |
|
|
44
|
+
| max | number | - | Maximum number. |
|
|
45
|
+
| message | string | "Maximum value - ${max}." | Custom message. |
|
|
46
|
+
|
|
47
|
+
#### Code example
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
import { getMaxRule } from 'react-hook-form-rules';
|
|
51
|
+
|
|
52
|
+
const {...} = useController({
|
|
53
|
+
rules: {{
|
|
54
|
+
max: getMaxRule(15)
|
|
55
|
+
}}
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### getMinRule
|
|
60
|
+
|
|
61
|
+
#### Description
|
|
62
|
+
|
|
63
|
+
This rule checks that the string contains a minimum number of characters.
|
|
64
|
+
|
|
65
|
+
#### Options
|
|
66
|
+
|
|
67
|
+
| Option | Type | Default | Description |
|
|
68
|
+
| ------- | ------ | ------------------------- | --------------- |
|
|
69
|
+
| min | number | - | Minimum number. |
|
|
70
|
+
| message | string | "Minimum value - ${min}." | Custom message. |
|
|
71
|
+
|
|
72
|
+
#### Code example
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
import { getMinRule } from 'react-hook-form-rules';
|
|
76
|
+
|
|
77
|
+
const {...} = useController({
|
|
78
|
+
rules: {{
|
|
79
|
+
min: getMinRule(15)
|
|
80
|
+
}}
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### getMaxLengthRule
|
|
85
|
+
|
|
86
|
+
#### Description
|
|
87
|
+
|
|
88
|
+
This rule checks that the number of characters in the string does not exceed the specified value.
|
|
89
|
+
|
|
90
|
+
#### Options
|
|
91
|
+
|
|
92
|
+
| Option | Type | Default | Description |
|
|
93
|
+
| --------- | ------ | -------------------------------- | ------------------------------------- |
|
|
94
|
+
| maxLength | number | - | Maximum number of characters allowed. |
|
|
95
|
+
| message | string | "Maximum length - ${maxLength}." | Custom message. |
|
|
96
|
+
|
|
97
|
+
#### Code example
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
import { getMaxLengthRule } from 'react-hook-form-rules';
|
|
101
|
+
|
|
102
|
+
const {...} = useController({
|
|
103
|
+
rules: {{
|
|
104
|
+
maxLength: getMaxLengthRule(15)
|
|
105
|
+
}}
|
|
106
|
+
})
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### getMinLengthRule
|
|
110
|
+
|
|
111
|
+
#### Description
|
|
112
|
+
|
|
113
|
+
The rule checks that the string contains at least the specified number of characters.
|
|
114
|
+
|
|
115
|
+
#### Options
|
|
116
|
+
|
|
117
|
+
| Option | Type | Default | Description |
|
|
118
|
+
| --------- | ------ | -------------------------------- | ------------------------------------- |
|
|
119
|
+
| minLength | number | - | Minimum number of characters allowed. |
|
|
120
|
+
| message | string | "Minimum length - ${minLength}." | Custom message |
|
|
121
|
+
|
|
122
|
+
#### Code example
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
import { getMinLengthRule } from 'react-hook-form-rules';
|
|
126
|
+
|
|
127
|
+
const {...} = useController({
|
|
128
|
+
rules: {{
|
|
129
|
+
minLength: getMinLengthRule(15)
|
|
130
|
+
}}
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Array
|
|
135
|
+
|
|
136
|
+
### getRequiredArrayRule
|
|
137
|
+
|
|
138
|
+
#### Description
|
|
139
|
+
|
|
140
|
+
This rule makes the array field required.
|
|
141
|
+
|
|
142
|
+
#### Options
|
|
143
|
+
|
|
144
|
+
| Option | Type | Default | Description |
|
|
145
|
+
| ------- | ------ | ------------------------- | ---------------- |
|
|
146
|
+
| arr | array | - | Array of values. |
|
|
147
|
+
| message | string | "This field is required." | Custom message. |
|
|
148
|
+
|
|
149
|
+
#### Code example
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
import { getRequiredArrayRule } from 'react-hook-form-rules';
|
|
153
|
+
|
|
154
|
+
const {...} = useController({
|
|
155
|
+
rules: {{
|
|
156
|
+
validate: (arr) => getRequiredArrayRule(arr)
|
|
157
|
+
}}
|
|
158
|
+
})
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### getMaxArrayLengthRule
|
|
162
|
+
|
|
163
|
+
#### Description
|
|
164
|
+
|
|
165
|
+
This rule returns an error if the number of values in the array exceeds the specified limit.
|
|
166
|
+
|
|
167
|
+
#### Options
|
|
168
|
+
|
|
169
|
+
| Option | Type | Default | Description |
|
|
170
|
+
| --------- | ------ | ------------------------------------------ | ------------------------- |
|
|
171
|
+
| arr | arrray | - | Array of values. |
|
|
172
|
+
| maxLength | number | - | Maximum number of values. |
|
|
173
|
+
| message | string | "Maximum number of values - ${maxLength}." | Custom message |
|
|
174
|
+
|
|
175
|
+
#### Code example
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
import { getMaxArrayLengthRule } from 'react-hook-form-rules';
|
|
179
|
+
|
|
180
|
+
const {...} = useController({
|
|
181
|
+
rules: {{
|
|
182
|
+
validate: (arr) => getMaxArrayLengthRule(arr, 15)
|
|
183
|
+
}}
|
|
184
|
+
})
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### getMinArrayLengthRule
|
|
188
|
+
|
|
189
|
+
#### Description
|
|
190
|
+
|
|
191
|
+
The rule checks that the array contains a minimum number of elements.
|
|
192
|
+
|
|
193
|
+
#### Options
|
|
194
|
+
|
|
195
|
+
| Option | Type | Default | Description |
|
|
196
|
+
| --------- | ------ | ------------------------------------------ | ------------------------- |
|
|
197
|
+
| arr | arrray | - | Array of values. |
|
|
198
|
+
| minLength | number | - | Maximum number of values. |
|
|
199
|
+
| message | string | "Minimum number of values - ${minLength}." | Custom message |
|
|
200
|
+
|
|
201
|
+
#### Code example
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
import { getMinArrayLengthRule } from 'react-hook-form-rules';
|
|
205
|
+
|
|
206
|
+
const {...} = useController({
|
|
207
|
+
rules: {{
|
|
208
|
+
validate: (arr) => getMinArrayLengthRule(arr, 15)
|
|
209
|
+
}}
|
|
210
|
+
})
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Object
|
|
214
|
+
|
|
215
|
+
### getRequiredObjectRule
|
|
216
|
+
|
|
217
|
+
#### Description
|
|
218
|
+
|
|
219
|
+
This rule makes the object field required.
|
|
220
|
+
|
|
221
|
+
#### Options
|
|
222
|
+
|
|
223
|
+
| Option | Type | Default | Description |
|
|
224
|
+
| ------- | ------ | ------------------------- | ------------------- |
|
|
225
|
+
| obj | object | - | Object with values. |
|
|
226
|
+
| message | string | "This field is required." | Custom message. |
|
|
227
|
+
|
|
228
|
+
#### Code example
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
import { getRequiredObjectRule } from 'react-hook-form-rules';
|
|
232
|
+
|
|
233
|
+
const {...} = useController({
|
|
234
|
+
rules: {{
|
|
235
|
+
validate: (arr) => getRequiredObjectRule(arr)
|
|
236
|
+
}}
|
|
237
|
+
})
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## URL
|
|
241
|
+
|
|
242
|
+
### getEmailRule
|
|
243
|
+
|
|
244
|
+
#### Description
|
|
245
|
+
|
|
246
|
+
he rule checks the entered email for correctness.
|
|
247
|
+
|
|
248
|
+
#### Options
|
|
249
|
+
|
|
250
|
+
| Option | Type | Default | Description |
|
|
251
|
+
| ------------- | ------ | ------------------------------------------------------------ | ------------------- |
|
|
252
|
+
| props | object | - | Object with values |
|
|
253
|
+
| props.pattern | RegExp | ^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$ | Regular expression. |
|
|
254
|
+
| props.message | string | "Please check the correctness of the entered email address." | Custom message |
|
|
255
|
+
|
|
256
|
+
#### Code example
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
import { getEmailRule } from 'react-hook-form-rules';
|
|
260
|
+
|
|
261
|
+
const {...} = useController({
|
|
262
|
+
rules: {{
|
|
263
|
+
pattern: getEmailRule({})
|
|
264
|
+
}}
|
|
265
|
+
})
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### getUrlRule
|
|
269
|
+
|
|
270
|
+
#### Description
|
|
271
|
+
|
|
272
|
+
The rule checks the entered URL for correctness.
|
|
273
|
+
|
|
274
|
+
#### Options
|
|
275
|
+
|
|
276
|
+
| Option | Type | Default | Description |
|
|
277
|
+
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------- | ------------------- |
|
|
278
|
+
| props | object | - | Object with values |
|
|
279
|
+
| props.pattern | RegExp | (http(s)?):\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]\*) | Regular expression. |
|
|
280
|
+
| props.message | string | "The URL does not match the format." | Custom message |
|
|
281
|
+
|
|
282
|
+
#### Code example
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
import { getUrlRule } from 'react-hook-form-rules';
|
|
286
|
+
|
|
287
|
+
const {...} = useController({
|
|
288
|
+
rules: {{
|
|
289
|
+
pattern: getUrlRule({})
|
|
290
|
+
}}
|
|
291
|
+
})
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Date
|
|
295
|
+
|
|
296
|
+
### getRequiredDateRangeRule
|
|
297
|
+
|
|
298
|
+
#### Description
|
|
299
|
+
|
|
300
|
+
The rule validates the date range value
|
|
301
|
+
|
|
302
|
+
#### Options
|
|
303
|
+
| Option | Type | Default | Description |
|
|
304
|
+
| ---------- | --------- | ------------------------- | ------------------- |
|
|
305
|
+
| value | DateRange | - | Array with DateRange. |
|
|
306
|
+
| isRequired | boolean | true | Dynamic parameter that indicates whether the field is required. |
|
|
307
|
+
| message | string | "This field is required." | Custom message. |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getEmailRule } from "./rules/patterns/get-email-rule";
|
|
2
|
+
import { getUrlRule } from "./rules/patterns/get-url-rule";
|
|
3
|
+
import { getPatternRule } from "./rules/patterns/get-pattern-rule";
|
|
4
|
+
import { getMaxArrayLengthRule } from "./rules/array/get-max-array-length-rule";
|
|
5
|
+
import { getMinArrayLengthRule } from "./rules/array/get-min-array-length-rule";
|
|
6
|
+
import { getRequiredArrayRule } from "./rules/array/get-required-array-rule";
|
|
7
|
+
import { getMaxLengthRule } from "./rules/default/get-max-length-rule";
|
|
8
|
+
import { getMaxRule } from "./rules/default/get-max-rule";
|
|
9
|
+
import { getMinLengthRule } from "./rules/default/get-min-length-rule";
|
|
10
|
+
import { getMinRule } from "./rules/default/get-min-rule";
|
|
11
|
+
import { getRequiredRule } from "./rules/default/get-require-rule";
|
|
12
|
+
import { getRequiredObjectRule } from "./rules/object/get-required-object-rule";
|
|
13
|
+
import { getRequiredDateRangeRule } from "@rules/date/get-required-date-range-rule";
|
|
14
|
+
import { config } from "./locales/i18n";
|
|
15
|
+
export { getPatternRule, getMaxRule, getRequiredObjectRule, getRequiredArrayRule, getEmailRule, getMaxLengthRule, getMaxArrayLengthRule, getMinArrayLengthRule, getMinLengthRule, getMinRule, getRequiredRule, getUrlRule, getRequiredDateRangeRule, config, };
|