@br-validators/react-hook-form 1.0.0
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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/boleto.d.ts +14 -0
- package/dist/boleto.js +4 -0
- package/dist/boleto.js.map +1 -0
- package/dist/cartao-credito.d.ts +9 -0
- package/dist/cartao-credito.js +4 -0
- package/dist/cartao-credito.js.map +1 -0
- package/dist/cep.d.ts +9 -0
- package/dist/cep.js +4 -0
- package/dist/cep.js.map +1 -0
- package/dist/chunk-7BQ7GI4P.js +13 -0
- package/dist/chunk-7BQ7GI4P.js.map +1 -0
- package/dist/chunk-7JR3AA7Z.js +16 -0
- package/dist/chunk-7JR3AA7Z.js.map +1 -0
- package/dist/chunk-BLQOHSHO.js +22 -0
- package/dist/chunk-BLQOHSHO.js.map +1 -0
- package/dist/chunk-CFUAD3UH.js +13 -0
- package/dist/chunk-CFUAD3UH.js.map +1 -0
- package/dist/chunk-CWBBJKPP.js +13 -0
- package/dist/chunk-CWBBJKPP.js.map +1 -0
- package/dist/chunk-LQS4D4GG.js +23 -0
- package/dist/chunk-LQS4D4GG.js.map +1 -0
- package/dist/chunk-QKAMONRR.js +13 -0
- package/dist/chunk-QKAMONRR.js.map +1 -0
- package/dist/chunk-VNPR3RSZ.js +19 -0
- package/dist/chunk-VNPR3RSZ.js.map +1 -0
- package/dist/chunk-WBABRCH7.js +23 -0
- package/dist/chunk-WBABRCH7.js.map +1 -0
- package/dist/chunk-YABIU3AQ.js +52 -0
- package/dist/chunk-YABIU3AQ.js.map +1 -0
- package/dist/chunk-ZWK36JDO.js +13 -0
- package/dist/chunk-ZWK36JDO.js.map +1 -0
- package/dist/cnpj.d.ts +9 -0
- package/dist/cnpj.js +4 -0
- package/dist/cnpj.js.map +1 -0
- package/dist/cpf.d.ts +9 -0
- package/dist/cpf.js +4 -0
- package/dist/cpf.js.map +1 -0
- package/dist/create-br-adapter-DSGHwknM.d.ts +16 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/inscricao-estadual.d.ts +15 -0
- package/dist/inscricao-estadual.js +4 -0
- package/dist/inscricao-estadual.js.map +1 -0
- package/dist/pis-pasep.d.ts +13 -0
- package/dist/pis-pasep.js +4 -0
- package/dist/pis-pasep.js.map +1 -0
- package/dist/pix.d.ts +14 -0
- package/dist/pix.js +4 -0
- package/dist/pix.js.map +1 -0
- package/dist/placa.d.ts +9 -0
- package/dist/placa.js +4 -0
- package/dist/placa.js.map +1 -0
- package/dist/telefone.d.ts +9 -0
- package/dist/telefone.js +4 -0
- package/dist/telefone.js.map +1 -0
- package/package.json +106 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BR Validators contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @br-validators/react-hook-form
|
|
2
|
+
|
|
3
|
+
[React Hook Form](https://react-hook-form.com/) rules and resolvers that delegate to [`@br-validators/core`](../br-validators).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @br-validators/react-hook-form @br-validators/core react react-hook-form
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Register + validate rule
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { useForm } from 'react-hook-form';
|
|
15
|
+
import { cpfRule } from '@br-validators/react-hook-form';
|
|
16
|
+
|
|
17
|
+
const { register } = useForm<{ cpf: string }>();
|
|
18
|
+
<input {...register('cpf', cpfRule({ required: 'CPF is required' }))} />;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Resolver
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { useForm } from 'react-hook-form';
|
|
25
|
+
import { cpfResolver } from '@br-validators/react-hook-form';
|
|
26
|
+
|
|
27
|
+
const form = useForm<{ cpf: string }>({ resolver: cpfResolver() });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Invalid values surface the same `message` string returned by core `validate*`.
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT
|
package/dist/boleto.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { ValidateBoletoOptions } from '@br-validators/core';
|
|
3
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
4
|
+
|
|
5
|
+
declare function createBoletoRule(options?: BrRuleOptions & ValidateBoletoOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
6
|
+
declare function boletoRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
7
|
+
declare function createBoletoResolver(boletoOptions?: ValidateBoletoOptions): react_hook_form.Resolver<{
|
|
8
|
+
boleto: string;
|
|
9
|
+
}>;
|
|
10
|
+
declare function boletoResolver(): react_hook_form.Resolver<{
|
|
11
|
+
boleto: string;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export { boletoResolver, boletoRule, createBoletoResolver, createBoletoRule };
|
package/dist/boleto.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"boleto.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
3
|
+
|
|
4
|
+
declare function cartaoCreditoRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
5
|
+
declare function cartaoCreditoResolver(): react_hook_form.Resolver<{
|
|
6
|
+
cartaoCredito: string;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export { cartaoCreditoResolver, cartaoCreditoRule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"cartao-credito.js"}
|
package/dist/cep.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
3
|
+
|
|
4
|
+
declare function cepRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
5
|
+
declare function cepResolver(): react_hook_form.Resolver<{
|
|
6
|
+
cep: string;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export { cepResolver, cepRule };
|
package/dist/cep.js
ADDED
package/dist/cep.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"cep.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validateCnpj } from '@br-validators/core/cnpj';
|
|
3
|
+
|
|
4
|
+
function cnpjRule(options) {
|
|
5
|
+
return createBrRule(validateCnpj, options);
|
|
6
|
+
}
|
|
7
|
+
function cnpjResolver() {
|
|
8
|
+
return createBrResolver("cnpj", validateCnpj);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { cnpjResolver, cnpjRule };
|
|
12
|
+
//# sourceMappingURL=chunk-7BQ7GI4P.js.map
|
|
13
|
+
//# sourceMappingURL=chunk-7BQ7GI4P.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cnpj.ts"],"names":[],"mappings":";;;AAIO,SAAS,SAAS,OAAA,EAAyB;AAChD,EAAA,OAAO,YAAA,CAAa,cAAc,OAAO,CAAA;AAC3C;AAEO,SAAS,YAAA,GAAe;AAC7B,EAAA,OAAO,gBAAA,CAAmC,QAAQ,YAAY,CAAA;AAChE","file":"chunk-7BQ7GI4P.js","sourcesContent":["import { validateCnpj } from '@br-validators/core/cnpj';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function cnpjRule(options?: BrRuleOptions) {\n return createBrRule(validateCnpj, options);\n}\n\nexport function cnpjResolver() {\n return createBrResolver<{ cnpj: string }>('cnpj', validateCnpj);\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validateCartaoCredito } from '@br-validators/core/cartao-credito';
|
|
3
|
+
|
|
4
|
+
function cartaoCreditoRule(options) {
|
|
5
|
+
return createBrRule(validateCartaoCredito, options);
|
|
6
|
+
}
|
|
7
|
+
function cartaoCreditoResolver() {
|
|
8
|
+
return createBrResolver(
|
|
9
|
+
"cartaoCredito",
|
|
10
|
+
validateCartaoCredito
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { cartaoCreditoResolver, cartaoCreditoRule };
|
|
15
|
+
//# sourceMappingURL=chunk-7JR3AA7Z.js.map
|
|
16
|
+
//# sourceMappingURL=chunk-7JR3AA7Z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cartao-credito.ts"],"names":[],"mappings":";;;AAIO,SAAS,kBAAkB,OAAA,EAAyB;AACzD,EAAA,OAAO,YAAA,CAAa,uBAAuB,OAAO,CAAA;AACpD;AAEO,SAAS,qBAAA,GAAwB;AACtC,EAAA,OAAO,gBAAA;AAAA,IACL,eAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-7JR3AA7Z.js","sourcesContent":["import { validateCartaoCredito } from '@br-validators/core/cartao-credito';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function cartaoCreditoRule(options?: BrRuleOptions) {\n return createBrRule(validateCartaoCredito, options);\n}\n\nexport function cartaoCreditoResolver() {\n return createBrResolver<{ cartaoCredito: string }>(\n 'cartaoCredito',\n validateCartaoCredito,\n );\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validateInscricaoEstadual } from '@br-validators/core/inscricao-estadual';
|
|
3
|
+
|
|
4
|
+
function createInscricaoEstadualRule(ieOptions, options) {
|
|
5
|
+
return createBrRule((input) => validateInscricaoEstadual(input, ieOptions), options);
|
|
6
|
+
}
|
|
7
|
+
function inscricaoEstadualSpRule(options) {
|
|
8
|
+
return createInscricaoEstadualRule({ uf: "SP" }, options);
|
|
9
|
+
}
|
|
10
|
+
function createInscricaoEstadualResolver(ieOptions) {
|
|
11
|
+
return createBrResolver(
|
|
12
|
+
"inscricaoEstadual",
|
|
13
|
+
(input) => validateInscricaoEstadual(input, ieOptions)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
function inscricaoEstadualSpResolver() {
|
|
17
|
+
return createInscricaoEstadualResolver({ uf: "SP" });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { createInscricaoEstadualResolver, createInscricaoEstadualRule, inscricaoEstadualSpResolver, inscricaoEstadualSpRule };
|
|
21
|
+
//# sourceMappingURL=chunk-BLQOHSHO.js.map
|
|
22
|
+
//# sourceMappingURL=chunk-BLQOHSHO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/inscricao-estadual.ts"],"names":[],"mappings":";;;AAKO,SAAS,2BAAA,CACd,WACA,OAAA,EACA;AACA,EAAA,OAAO,aAAa,CAAC,KAAA,KAAU,0BAA0B,KAAA,EAAO,SAAS,GAAG,OAAO,CAAA;AACrF;AAEO,SAAS,wBAAwB,OAAA,EAAyB;AAC/D,EAAA,OAAO,2BAAA,CAA4B,EAAE,EAAA,EAAI,IAAA,IAAQ,OAAO,CAAA;AAC1D;AAEO,SAAS,gCAAgC,SAAA,EAA6C;AAC3F,EAAA,OAAO,gBAAA;AAAA,IACL,mBAAA;AAAA,IACA,CAAC,KAAA,KAAU,yBAAA,CAA0B,KAAA,EAAO,SAAS;AAAA,GACvD;AACF;AAEO,SAAS,2BAAA,GAA8B;AAC5C,EAAA,OAAO,+BAAA,CAAgC,EAAE,EAAA,EAAI,IAAA,EAAM,CAAA;AACrD","file":"chunk-BLQOHSHO.js","sourcesContent":["import { validateInscricaoEstadual } from '@br-validators/core/inscricao-estadual';\nimport type { UfCode, ValidateInscricaoEstadualOptions } from '@br-validators/core';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function createInscricaoEstadualRule(\n ieOptions: ValidateInscricaoEstadualOptions,\n options?: BrRuleOptions,\n) {\n return createBrRule((input) => validateInscricaoEstadual(input, ieOptions), options);\n}\n\nexport function inscricaoEstadualSpRule(options?: BrRuleOptions) {\n return createInscricaoEstadualRule({ uf: 'SP' }, options);\n}\n\nexport function createInscricaoEstadualResolver(ieOptions: ValidateInscricaoEstadualOptions) {\n return createBrResolver<{ inscricaoEstadual: string }>(\n 'inscricaoEstadual',\n (input) => validateInscricaoEstadual(input, ieOptions),\n );\n}\n\nexport function inscricaoEstadualSpResolver() {\n return createInscricaoEstadualResolver({ uf: 'SP' });\n}\n\nexport type { UfCode };\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validateCep } from '@br-validators/core/cep';
|
|
3
|
+
|
|
4
|
+
function cepRule(options) {
|
|
5
|
+
return createBrRule(validateCep, options);
|
|
6
|
+
}
|
|
7
|
+
function cepResolver() {
|
|
8
|
+
return createBrResolver("cep", validateCep);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { cepResolver, cepRule };
|
|
12
|
+
//# sourceMappingURL=chunk-CFUAD3UH.js.map
|
|
13
|
+
//# sourceMappingURL=chunk-CFUAD3UH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cep.ts"],"names":[],"mappings":";;;AAIO,SAAS,QAAQ,OAAA,EAAyB;AAC/C,EAAA,OAAO,YAAA,CAAa,aAAa,OAAO,CAAA;AAC1C;AAEO,SAAS,WAAA,GAAc;AAC5B,EAAA,OAAO,gBAAA,CAAkC,OAAO,WAAW,CAAA;AAC7D","file":"chunk-CFUAD3UH.js","sourcesContent":["import { validateCep } from '@br-validators/core/cep';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function cepRule(options?: BrRuleOptions) {\n return createBrRule(validateCep, options);\n}\n\nexport function cepResolver() {\n return createBrResolver<{ cep: string }>('cep', validateCep);\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validateTelefone } from '@br-validators/core/telefone';
|
|
3
|
+
|
|
4
|
+
function telefoneRule(options) {
|
|
5
|
+
return createBrRule(validateTelefone, options);
|
|
6
|
+
}
|
|
7
|
+
function telefoneResolver() {
|
|
8
|
+
return createBrResolver("telefone", validateTelefone);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { telefoneResolver, telefoneRule };
|
|
12
|
+
//# sourceMappingURL=chunk-CWBBJKPP.js.map
|
|
13
|
+
//# sourceMappingURL=chunk-CWBBJKPP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/telefone.ts"],"names":[],"mappings":";;;AAIO,SAAS,aAAa,OAAA,EAAyB;AACpD,EAAA,OAAO,YAAA,CAAa,kBAAkB,OAAO,CAAA;AAC/C;AAEO,SAAS,gBAAA,GAAmB;AACjC,EAAA,OAAO,gBAAA,CAAuC,YAAY,gBAAgB,CAAA;AAC5E","file":"chunk-CWBBJKPP.js","sourcesContent":["import { validateTelefone } from '@br-validators/core/telefone';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function telefoneRule(options?: BrRuleOptions) {\n return createBrRule(validateTelefone, options);\n}\n\nexport function telefoneResolver() {\n return createBrResolver<{ telefone: string }>('telefone', validateTelefone);\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validatePixKey } from '@br-validators/core/pix';
|
|
3
|
+
|
|
4
|
+
function createPixKeyRule(options) {
|
|
5
|
+
const { required, type } = options ?? {};
|
|
6
|
+
return createBrRule((input) => validatePixKey(input, type ? { type } : void 0), { required });
|
|
7
|
+
}
|
|
8
|
+
function pixKeyRule(options) {
|
|
9
|
+
return createPixKeyRule(options);
|
|
10
|
+
}
|
|
11
|
+
function createPixKeyResolver(pixOptions) {
|
|
12
|
+
return createBrResolver(
|
|
13
|
+
"pixKey",
|
|
14
|
+
(input) => validatePixKey(input, pixOptions)
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function pixKeyResolver() {
|
|
18
|
+
return createPixKeyResolver();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { createPixKeyResolver, createPixKeyRule, pixKeyResolver, pixKeyRule };
|
|
22
|
+
//# sourceMappingURL=chunk-LQS4D4GG.js.map
|
|
23
|
+
//# sourceMappingURL=chunk-LQS4D4GG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/pix.ts"],"names":[],"mappings":";;;AAKO,SAAS,iBAAiB,OAAA,EAAiD;AAChF,EAAA,MAAM,EAAE,QAAA,EAAU,IAAA,EAAK,GAAI,WAAW,EAAC;AACvC,EAAA,OAAO,YAAA,CAAa,CAAC,KAAA,KAAU,cAAA,CAAe,KAAA,EAAO,IAAA,GAAO,EAAE,IAAA,EAAK,GAAI,MAAS,CAAA,EAAG,EAAE,UAAU,CAAA;AACjG;AAEO,SAAS,WAAW,OAAA,EAAyB;AAClD,EAAA,OAAO,iBAAiB,OAAO,CAAA;AACjC;AAEO,SAAS,qBAAqB,UAAA,EAAoC;AACvE,EAAA,OAAO,gBAAA;AAAA,IACL,QAAA;AAAA,IACA,CAAC,KAAA,KAAU,cAAA,CAAe,KAAA,EAAO,UAAU;AAAA,GAC7C;AACF;AAEO,SAAS,cAAA,GAAiB;AAC/B,EAAA,OAAO,oBAAA,EAAqB;AAC9B","file":"chunk-LQS4D4GG.js","sourcesContent":["import { validatePixKey } from '@br-validators/core/pix';\nimport type { ValidatePixKeyOptions } from '@br-validators/core';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function createPixKeyRule(options?: BrRuleOptions & ValidatePixKeyOptions) {\n const { required, type } = options ?? {};\n return createBrRule((input) => validatePixKey(input, type ? { type } : undefined), { required });\n}\n\nexport function pixKeyRule(options?: BrRuleOptions) {\n return createPixKeyRule(options);\n}\n\nexport function createPixKeyResolver(pixOptions?: ValidatePixKeyOptions) {\n return createBrResolver<{ pixKey: string }>(\n 'pixKey',\n (input) => validatePixKey(input, pixOptions),\n );\n}\n\nexport function pixKeyResolver() {\n return createPixKeyResolver();\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validatePlaca } from '@br-validators/core/placa';
|
|
3
|
+
|
|
4
|
+
function placaRule(options) {
|
|
5
|
+
return createBrRule(validatePlaca, options);
|
|
6
|
+
}
|
|
7
|
+
function placaResolver() {
|
|
8
|
+
return createBrResolver("placa", validatePlaca);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { placaResolver, placaRule };
|
|
12
|
+
//# sourceMappingURL=chunk-QKAMONRR.js.map
|
|
13
|
+
//# sourceMappingURL=chunk-QKAMONRR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/placa.ts"],"names":[],"mappings":";;;AAIO,SAAS,UAAU,OAAA,EAAyB;AACjD,EAAA,OAAO,YAAA,CAAa,eAAe,OAAO,CAAA;AAC5C;AAEO,SAAS,aAAA,GAAgB;AAC9B,EAAA,OAAO,gBAAA,CAAoC,SAAS,aAAa,CAAA;AACnE","file":"chunk-QKAMONRR.js","sourcesContent":["import { validatePlaca } from '@br-validators/core/placa';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function placaRule(options?: BrRuleOptions) {\n return createBrRule(validatePlaca, options);\n}\n\nexport function placaResolver() {\n return createBrResolver<{ placa: string }>('placa', validatePlaca);\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validatePisPasep } from '@br-validators/core/pis-pasep';
|
|
3
|
+
|
|
4
|
+
function pisPasepRule(options) {
|
|
5
|
+
return createBrRule(validatePisPasep, options);
|
|
6
|
+
}
|
|
7
|
+
function pisRule(options) {
|
|
8
|
+
return pisPasepRule(options);
|
|
9
|
+
}
|
|
10
|
+
function pisPasepResolver() {
|
|
11
|
+
return createBrResolver("pisPasep", validatePisPasep);
|
|
12
|
+
}
|
|
13
|
+
function pisResolver() {
|
|
14
|
+
return createBrResolver("pis", validatePisPasep);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { pisPasepResolver, pisPasepRule, pisResolver, pisRule };
|
|
18
|
+
//# sourceMappingURL=chunk-VNPR3RSZ.js.map
|
|
19
|
+
//# sourceMappingURL=chunk-VNPR3RSZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/pis-pasep.ts"],"names":[],"mappings":";;;AAIO,SAAS,aAAa,OAAA,EAAyB;AACpD,EAAA,OAAO,YAAA,CAAa,kBAAkB,OAAO,CAAA;AAC/C;AAEO,SAAS,QAAQ,OAAA,EAAyB;AAC/C,EAAA,OAAO,aAAa,OAAO,CAAA;AAC7B;AAEO,SAAS,gBAAA,GAAmB;AACjC,EAAA,OAAO,gBAAA,CAAuC,YAAY,gBAAgB,CAAA;AAC5E;AAEO,SAAS,WAAA,GAAc;AAC5B,EAAA,OAAO,gBAAA,CAAkC,OAAO,gBAAgB,CAAA;AAClE","file":"chunk-VNPR3RSZ.js","sourcesContent":["import { validatePisPasep } from '@br-validators/core/pis-pasep';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function pisPasepRule(options?: BrRuleOptions) {\n return createBrRule(validatePisPasep, options);\n}\n\nexport function pisRule(options?: BrRuleOptions) {\n return pisPasepRule(options);\n}\n\nexport function pisPasepResolver() {\n return createBrResolver<{ pisPasep: string }>('pisPasep', validatePisPasep);\n}\n\nexport function pisResolver() {\n return createBrResolver<{ pis: string }>('pis', validatePisPasep);\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validateBoleto } from '@br-validators/core/boleto';
|
|
3
|
+
|
|
4
|
+
function createBoletoRule(options) {
|
|
5
|
+
const { required, ...boletoOptions } = options ?? {};
|
|
6
|
+
return createBrRule((input) => validateBoleto(input, boletoOptions), { required });
|
|
7
|
+
}
|
|
8
|
+
function boletoRule(options) {
|
|
9
|
+
return createBoletoRule(options);
|
|
10
|
+
}
|
|
11
|
+
function createBoletoResolver(boletoOptions) {
|
|
12
|
+
return createBrResolver(
|
|
13
|
+
"boleto",
|
|
14
|
+
(input) => validateBoleto(input, boletoOptions)
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function boletoResolver() {
|
|
18
|
+
return createBoletoResolver();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { boletoResolver, boletoRule, createBoletoResolver, createBoletoRule };
|
|
22
|
+
//# sourceMappingURL=chunk-WBABRCH7.js.map
|
|
23
|
+
//# sourceMappingURL=chunk-WBABRCH7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/boleto.ts"],"names":[],"mappings":";;;AAKO,SAAS,iBAAiB,OAAA,EAAiD;AAChF,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,aAAA,EAAc,GAAI,WAAW,EAAC;AACnD,EAAA,OAAO,YAAA,CAAa,CAAC,KAAA,KAAU,cAAA,CAAe,OAAO,aAAa,CAAA,EAAG,EAAE,QAAA,EAAU,CAAA;AACnF;AAEO,SAAS,WAAW,OAAA,EAAyB;AAClD,EAAA,OAAO,iBAAiB,OAAO,CAAA;AACjC;AAEO,SAAS,qBAAqB,aAAA,EAAuC;AAC1E,EAAA,OAAO,gBAAA;AAAA,IACL,QAAA;AAAA,IACA,CAAC,KAAA,KAAU,cAAA,CAAe,KAAA,EAAO,aAAa;AAAA,GAChD;AACF;AAEO,SAAS,cAAA,GAAiB;AAC/B,EAAA,OAAO,oBAAA,EAAqB;AAC9B","file":"chunk-WBABRCH7.js","sourcesContent":["import { validateBoleto } from '@br-validators/core/boleto';\nimport type { ValidateBoletoOptions } from '@br-validators/core';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function createBoletoRule(options?: BrRuleOptions & ValidateBoletoOptions) {\n const { required, ...boletoOptions } = options ?? {};\n return createBrRule((input) => validateBoleto(input, boletoOptions), { required });\n}\n\nexport function boletoRule(options?: BrRuleOptions) {\n return createBoletoRule(options);\n}\n\nexport function createBoletoResolver(boletoOptions?: ValidateBoletoOptions) {\n return createBrResolver<{ boleto: string }>(\n 'boleto',\n (input) => validateBoleto(input, boletoOptions),\n );\n}\n\nexport function boletoResolver() {\n return createBoletoResolver();\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/create-br-adapter.ts
|
|
2
|
+
function isEmptyValue(value) {
|
|
3
|
+
return value === void 0 || value === null || typeof value === "string" && value.trim() === "";
|
|
4
|
+
}
|
|
5
|
+
function requiredMessage(required) {
|
|
6
|
+
return typeof required === "string" ? required : "Required";
|
|
7
|
+
}
|
|
8
|
+
function createBrRule(validate, options) {
|
|
9
|
+
const validateFn = (value) => {
|
|
10
|
+
if (isEmptyValue(value)) {
|
|
11
|
+
if (options?.required) {
|
|
12
|
+
return requiredMessage(options.required);
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (typeof value !== "string") {
|
|
17
|
+
return "Value must be a string";
|
|
18
|
+
}
|
|
19
|
+
const result = validate(value);
|
|
20
|
+
return result.ok || result.message;
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
required: options?.required,
|
|
24
|
+
validate: validateFn
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function createBrResolver(fieldName, validate) {
|
|
28
|
+
return (values) => {
|
|
29
|
+
const raw = values[fieldName];
|
|
30
|
+
if (isEmptyValue(raw)) {
|
|
31
|
+
return { values, errors: {} };
|
|
32
|
+
}
|
|
33
|
+
if (typeof raw !== "string") {
|
|
34
|
+
const errors2 = {
|
|
35
|
+
[fieldName]: { type: "custom", message: "Value must be a string" }
|
|
36
|
+
};
|
|
37
|
+
return { values: {}, errors: errors2 };
|
|
38
|
+
}
|
|
39
|
+
const result = validate(raw);
|
|
40
|
+
if (result.ok) {
|
|
41
|
+
return { values, errors: {} };
|
|
42
|
+
}
|
|
43
|
+
const errors = {
|
|
44
|
+
[fieldName]: { type: "custom", message: result.message }
|
|
45
|
+
};
|
|
46
|
+
return { values: {}, errors };
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { createBrResolver, createBrRule };
|
|
51
|
+
//# sourceMappingURL=chunk-YABIU3AQ.js.map
|
|
52
|
+
//# sourceMappingURL=chunk-YABIU3AQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/create-br-adapter.ts"],"names":["errors"],"mappings":";AAUA,SAAS,aAAa,KAAA,EAAyB;AAC7C,EAAA,OAAO,KAAA,KAAU,UAAa,KAAA,KAAU,IAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,IAAA,EAAK,KAAM,EAAA;AACjG;AAEA,SAAS,gBAAgB,QAAA,EAAoC;AAC3D,EAAA,OAAO,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,UAAA;AACnD;AAEO,SAAS,YAAA,CACd,UACA,OAAA,EAC+B;AAC/B,EAAA,MAAM,UAAA,GAAa,CAAC,KAAA,KAAqC;AACvD,IAAA,IAAI,YAAA,CAAa,KAAK,CAAA,EAAG;AACvB,MAAA,IAAI,SAAS,QAAA,EAAU;AACrB,QAAA,OAAO,eAAA,CAAgB,QAAQ,QAAQ,CAAA;AAAA,MACzC;AACA,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAO,wBAAA;AAAA,IACT;AACA,IAAA,MAAM,MAAA,GAAS,SAAS,KAAK,CAAA;AAC7B,IAAA,OAAO,MAAA,CAAO,MAAM,MAAA,CAAO,OAAA;AAAA,EAC7B,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,UAAU,OAAA,EAAS,QAAA;AAAA,IACnB,QAAA,EAAU;AAAA,GACZ;AACF;AAEO,SAAS,gBAAA,CACd,WACA,QAAA,EACwB;AACxB,EAAA,OAAO,CAAC,MAAA,KAAW;AACjB,IAAA,MAAM,GAAA,GAAM,OAAO,SAAS,CAAA;AAC5B,IAAA,IAAI,YAAA,CAAa,GAAG,CAAA,EAAG;AACrB,MAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,EAAQ,EAAC,EAAE;AAAA,IAC9B;AACA,IAAA,IAAI,OAAO,QAAQ,QAAA,EAAU;AAC3B,MAAA,MAAMA,OAAAA,GAAS;AAAA,QACb,CAAC,SAAS,GAAG,EAAE,IAAA,EAAM,QAAA,EAAU,SAAS,wBAAA;AAAyB,OACnE;AACA,MAAA,OAAO,EAAE,MAAA,EAAQ,EAAC,EAAG,QAAAA,OAAAA,EAAO;AAAA,IAC9B;AACA,IAAA,MAAM,MAAA,GAAS,SAAS,GAAG,CAAA;AAC3B,IAAA,IAAI,OAAO,EAAA,EAAI;AACb,MAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,EAAQ,EAAC,EAAE;AAAA,IAC9B;AACA,IAAA,MAAM,MAAA,GAAS;AAAA,MACb,CAAC,SAAS,GAAG,EAAE,MAAM,QAAA,EAAU,OAAA,EAAS,OAAO,OAAA;AAAQ,KACzD;AACA,IAAA,OAAO,EAAE,MAAA,EAAQ,EAAC,EAAG,MAAA,EAAO;AAAA,EAC9B,CAAA;AACF","file":"chunk-YABIU3AQ.js","sourcesContent":["import type { FieldErrors, FieldValues, RegisterOptions, Resolver } from 'react-hook-form';\n\nexport type BrValidateResult = { ok: true } | { ok: false; message: string };\n\nexport type BrValidateFn = (input: string) => BrValidateResult;\n\nexport type BrRuleOptions = {\n required?: boolean | string;\n};\n\nfunction isEmptyValue(value: unknown): boolean {\n return value === undefined || value === null || (typeof value === 'string' && value.trim() === '');\n}\n\nfunction requiredMessage(required: boolean | string): string {\n return typeof required === 'string' ? required : 'Required';\n}\n\nexport function createBrRule<TFieldValues extends FieldValues>(\n validate: BrValidateFn,\n options?: BrRuleOptions,\n): RegisterOptions<TFieldValues> {\n const validateFn = (value: unknown): string | boolean => {\n if (isEmptyValue(value)) {\n if (options?.required) {\n return requiredMessage(options.required);\n }\n return true;\n }\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n const result = validate(value);\n return result.ok || result.message;\n };\n\n return {\n required: options?.required,\n validate: validateFn,\n };\n}\n\nexport function createBrResolver<TFieldValues extends FieldValues>(\n fieldName: keyof TFieldValues & string,\n validate: BrValidateFn,\n): Resolver<TFieldValues> {\n return (values) => {\n const raw = values[fieldName];\n if (isEmptyValue(raw)) {\n return { values, errors: {} };\n }\n if (typeof raw !== 'string') {\n const errors = {\n [fieldName]: { type: 'custom', message: 'Value must be a string' },\n } as FieldErrors<TFieldValues>;\n return { values: {}, errors };\n }\n const result = validate(raw);\n if (result.ok) {\n return { values, errors: {} };\n }\n const errors = {\n [fieldName]: { type: 'custom', message: result.message },\n } as FieldErrors<TFieldValues>;\n return { values: {}, errors };\n };\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createBrRule, createBrResolver } from './chunk-YABIU3AQ.js';
|
|
2
|
+
import { validateCpf } from '@br-validators/core/cpf';
|
|
3
|
+
|
|
4
|
+
function cpfRule(options) {
|
|
5
|
+
return createBrRule(validateCpf, options);
|
|
6
|
+
}
|
|
7
|
+
function cpfResolver() {
|
|
8
|
+
return createBrResolver("cpf", validateCpf);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { cpfResolver, cpfRule };
|
|
12
|
+
//# sourceMappingURL=chunk-ZWK36JDO.js.map
|
|
13
|
+
//# sourceMappingURL=chunk-ZWK36JDO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cpf.ts"],"names":[],"mappings":";;;AAIO,SAAS,QAAQ,OAAA,EAAyB;AAC/C,EAAA,OAAO,YAAA,CAAa,aAAa,OAAO,CAAA;AAC1C;AAEO,SAAS,WAAA,GAAc;AAC5B,EAAA,OAAO,gBAAA,CAAkC,OAAO,WAAW,CAAA;AAC7D","file":"chunk-ZWK36JDO.js","sourcesContent":["import { validateCpf } from '@br-validators/core/cpf';\nimport type { BrRuleOptions } from './create-br-adapter.js';\nimport { createBrResolver, createBrRule } from './create-br-adapter.js';\n\nexport function cpfRule(options?: BrRuleOptions) {\n return createBrRule(validateCpf, options);\n}\n\nexport function cpfResolver() {\n return createBrResolver<{ cpf: string }>('cpf', validateCpf);\n}\n"]}
|
package/dist/cnpj.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
3
|
+
|
|
4
|
+
declare function cnpjRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
5
|
+
declare function cnpjResolver(): react_hook_form.Resolver<{
|
|
6
|
+
cnpj: string;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export { cnpjResolver, cnpjRule };
|
package/dist/cnpj.js
ADDED
package/dist/cnpj.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"cnpj.js"}
|
package/dist/cpf.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
3
|
+
|
|
4
|
+
declare function cpfRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
5
|
+
declare function cpfResolver(): react_hook_form.Resolver<{
|
|
6
|
+
cpf: string;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export { cpfResolver, cpfRule };
|
package/dist/cpf.js
ADDED
package/dist/cpf.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"cpf.js"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldValues, Resolver, RegisterOptions } from 'react-hook-form';
|
|
2
|
+
|
|
3
|
+
type BrValidateResult = {
|
|
4
|
+
ok: true;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
type BrValidateFn = (input: string) => BrValidateResult;
|
|
10
|
+
type BrRuleOptions = {
|
|
11
|
+
required?: boolean | string;
|
|
12
|
+
};
|
|
13
|
+
declare function createBrRule<TFieldValues extends FieldValues>(validate: BrValidateFn, options?: BrRuleOptions): RegisterOptions<TFieldValues>;
|
|
14
|
+
declare function createBrResolver<TFieldValues extends FieldValues>(fieldName: keyof TFieldValues & string, validate: BrValidateFn): Resolver<TFieldValues>;
|
|
15
|
+
|
|
16
|
+
export { type BrRuleOptions as B, type BrValidateFn as a, type BrValidateResult as b, createBrResolver as c, createBrRule as d };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { B as BrRuleOptions, a as BrValidateFn, b as BrValidateResult, c as createBrResolver, d as createBrRule } from './create-br-adapter-DSGHwknM.js';
|
|
2
|
+
export { cpfResolver, cpfRule } from './cpf.js';
|
|
3
|
+
export { cnpjResolver, cnpjRule } from './cnpj.js';
|
|
4
|
+
export { cepResolver, cepRule } from './cep.js';
|
|
5
|
+
export { telefoneResolver, telefoneRule } from './telefone.js';
|
|
6
|
+
export { placaResolver, placaRule } from './placa.js';
|
|
7
|
+
export { pisPasepResolver, pisPasepRule, pisResolver, pisRule } from './pis-pasep.js';
|
|
8
|
+
export { createPixKeyResolver, createPixKeyRule, pixKeyResolver, pixKeyRule } from './pix.js';
|
|
9
|
+
export { boletoResolver, boletoRule, createBoletoResolver, createBoletoRule } from './boleto.js';
|
|
10
|
+
export { cartaoCreditoResolver, cartaoCreditoRule } from './cartao-credito.js';
|
|
11
|
+
export { createInscricaoEstadualResolver, createInscricaoEstadualRule, inscricaoEstadualSpResolver, inscricaoEstadualSpRule } from './inscricao-estadual.js';
|
|
12
|
+
export { UfCode } from '@br-validators/core';
|
|
13
|
+
import 'react-hook-form';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { createPixKeyResolver, createPixKeyRule, pixKeyResolver, pixKeyRule } from './chunk-LQS4D4GG.js';
|
|
2
|
+
export { placaResolver, placaRule } from './chunk-QKAMONRR.js';
|
|
3
|
+
export { telefoneResolver, telefoneRule } from './chunk-CWBBJKPP.js';
|
|
4
|
+
export { boletoResolver, boletoRule, createBoletoResolver, createBoletoRule } from './chunk-WBABRCH7.js';
|
|
5
|
+
export { cartaoCreditoResolver, cartaoCreditoRule } from './chunk-7JR3AA7Z.js';
|
|
6
|
+
export { cepResolver, cepRule } from './chunk-CFUAD3UH.js';
|
|
7
|
+
export { cnpjResolver, cnpjRule } from './chunk-7BQ7GI4P.js';
|
|
8
|
+
export { cpfResolver, cpfRule } from './chunk-ZWK36JDO.js';
|
|
9
|
+
export { createInscricaoEstadualResolver, createInscricaoEstadualRule, inscricaoEstadualSpResolver, inscricaoEstadualSpRule } from './chunk-BLQOHSHO.js';
|
|
10
|
+
export { pisPasepResolver, pisPasepRule, pisResolver, pisRule } from './chunk-VNPR3RSZ.js';
|
|
11
|
+
export { createBrResolver, createBrRule } from './chunk-YABIU3AQ.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { ValidateInscricaoEstadualOptions } from '@br-validators/core';
|
|
3
|
+
export { UfCode } from '@br-validators/core';
|
|
4
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
5
|
+
|
|
6
|
+
declare function createInscricaoEstadualRule(ieOptions: ValidateInscricaoEstadualOptions, options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
7
|
+
declare function inscricaoEstadualSpRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
8
|
+
declare function createInscricaoEstadualResolver(ieOptions: ValidateInscricaoEstadualOptions): react_hook_form.Resolver<{
|
|
9
|
+
inscricaoEstadual: string;
|
|
10
|
+
}>;
|
|
11
|
+
declare function inscricaoEstadualSpResolver(): react_hook_form.Resolver<{
|
|
12
|
+
inscricaoEstadual: string;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export { createInscricaoEstadualResolver, createInscricaoEstadualRule, inscricaoEstadualSpResolver, inscricaoEstadualSpRule };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createInscricaoEstadualResolver, createInscricaoEstadualRule, inscricaoEstadualSpResolver, inscricaoEstadualSpRule } from './chunk-BLQOHSHO.js';
|
|
2
|
+
import './chunk-YABIU3AQ.js';
|
|
3
|
+
//# sourceMappingURL=inscricao-estadual.js.map
|
|
4
|
+
//# sourceMappingURL=inscricao-estadual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"inscricao-estadual.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
3
|
+
|
|
4
|
+
declare function pisPasepRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
5
|
+
declare function pisRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
6
|
+
declare function pisPasepResolver(): react_hook_form.Resolver<{
|
|
7
|
+
pisPasep: string;
|
|
8
|
+
}>;
|
|
9
|
+
declare function pisResolver(): react_hook_form.Resolver<{
|
|
10
|
+
pis: string;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
export { pisPasepResolver, pisPasepRule, pisResolver, pisRule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"pis-pasep.js"}
|
package/dist/pix.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { ValidatePixKeyOptions } from '@br-validators/core';
|
|
3
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
4
|
+
|
|
5
|
+
declare function createPixKeyRule(options?: BrRuleOptions & ValidatePixKeyOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
6
|
+
declare function pixKeyRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
7
|
+
declare function createPixKeyResolver(pixOptions?: ValidatePixKeyOptions): react_hook_form.Resolver<{
|
|
8
|
+
pixKey: string;
|
|
9
|
+
}>;
|
|
10
|
+
declare function pixKeyResolver(): react_hook_form.Resolver<{
|
|
11
|
+
pixKey: string;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export { createPixKeyResolver, createPixKeyRule, pixKeyResolver, pixKeyRule };
|
package/dist/pix.js
ADDED
package/dist/pix.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"pix.js"}
|
package/dist/placa.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
3
|
+
|
|
4
|
+
declare function placaRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
5
|
+
declare function placaResolver(): react_hook_form.Resolver<{
|
|
6
|
+
placa: string;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export { placaResolver, placaRule };
|
package/dist/placa.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"placa.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_hook_form from 'react-hook-form';
|
|
2
|
+
import { B as BrRuleOptions } from './create-br-adapter-DSGHwknM.js';
|
|
3
|
+
|
|
4
|
+
declare function telefoneRule(options?: BrRuleOptions): react_hook_form.RegisterOptions<react_hook_form.FieldValues>;
|
|
5
|
+
declare function telefoneResolver(): react_hook_form.Resolver<{
|
|
6
|
+
telefone: string;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export { telefoneResolver, telefoneRule };
|
package/dist/telefone.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"telefone.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@br-validators/react-hook-form",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React Hook Form rules and resolvers for Brazilian document validators — delegates to @br-validators/core",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/AlexandreZanata/br-validators.git",
|
|
10
|
+
"directory": "packages/br-validators-rhf"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/AlexandreZanata/br-validators/tree/main/packages/br-validators-rhf#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/AlexandreZanata/br-validators/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"brazil",
|
|
18
|
+
"react-hook-form",
|
|
19
|
+
"validator",
|
|
20
|
+
"cpf",
|
|
21
|
+
"cnpj",
|
|
22
|
+
"cep"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"tag": "alpha"
|
|
27
|
+
},
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./cpf": {
|
|
36
|
+
"types": "./dist/cpf.d.ts",
|
|
37
|
+
"import": "./dist/cpf.js"
|
|
38
|
+
},
|
|
39
|
+
"./cnpj": {
|
|
40
|
+
"types": "./dist/cnpj.d.ts",
|
|
41
|
+
"import": "./dist/cnpj.js"
|
|
42
|
+
},
|
|
43
|
+
"./cep": {
|
|
44
|
+
"types": "./dist/cep.d.ts",
|
|
45
|
+
"import": "./dist/cep.js"
|
|
46
|
+
},
|
|
47
|
+
"./telefone": {
|
|
48
|
+
"types": "./dist/telefone.d.ts",
|
|
49
|
+
"import": "./dist/telefone.js"
|
|
50
|
+
},
|
|
51
|
+
"./placa": {
|
|
52
|
+
"types": "./dist/placa.d.ts",
|
|
53
|
+
"import": "./dist/placa.js"
|
|
54
|
+
},
|
|
55
|
+
"./pis-pasep": {
|
|
56
|
+
"types": "./dist/pis-pasep.d.ts",
|
|
57
|
+
"import": "./dist/pis-pasep.js"
|
|
58
|
+
},
|
|
59
|
+
"./pix": {
|
|
60
|
+
"types": "./dist/pix.d.ts",
|
|
61
|
+
"import": "./dist/pix.js"
|
|
62
|
+
},
|
|
63
|
+
"./boleto": {
|
|
64
|
+
"types": "./dist/boleto.d.ts",
|
|
65
|
+
"import": "./dist/boleto.js"
|
|
66
|
+
},
|
|
67
|
+
"./cartao-credito": {
|
|
68
|
+
"types": "./dist/cartao-credito.d.ts",
|
|
69
|
+
"import": "./dist/cartao-credito.js"
|
|
70
|
+
},
|
|
71
|
+
"./inscricao-estadual": {
|
|
72
|
+
"types": "./dist/inscricao-estadual.d.ts",
|
|
73
|
+
"import": "./dist/inscricao-estadual.js"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"files": [
|
|
77
|
+
"dist",
|
|
78
|
+
"README.md"
|
|
79
|
+
],
|
|
80
|
+
"peerDependencies": {
|
|
81
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
82
|
+
"react-hook-form": "^7.0.0"
|
|
83
|
+
},
|
|
84
|
+
"dependencies": {
|
|
85
|
+
"@br-validators/core": "1.0.0"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@types/react": "^19.1.8",
|
|
89
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
90
|
+
"react": "^19.1.0",
|
|
91
|
+
"react-hook-form": "^7.58.0",
|
|
92
|
+
"tsup": "^8.5.0",
|
|
93
|
+
"typescript": "^5.8.3",
|
|
94
|
+
"vitest": "^3.2.4"
|
|
95
|
+
},
|
|
96
|
+
"scripts": {
|
|
97
|
+
"build": "tsup",
|
|
98
|
+
"pretypecheck": "pnpm --filter @br-validators/core build",
|
|
99
|
+
"pretest": "pnpm --filter @br-validators/core build",
|
|
100
|
+
"pretest:coverage": "pnpm --filter @br-validators/core build",
|
|
101
|
+
"test": "vitest run",
|
|
102
|
+
"test:coverage": "vitest run --coverage",
|
|
103
|
+
"typecheck": "tsc --noEmit",
|
|
104
|
+
"lint": "eslint src tests --max-warnings 0"
|
|
105
|
+
}
|
|
106
|
+
}
|