react-hook-form 7.4.3-beta.4 → 7.5.2
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 +11 -4
- package/README.md +6 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +24 -51
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/logic/getFields.d.ts +1 -1
- package/dist/logic/getFieldsValues.d.ts +2 -2
- package/dist/logic/getValueAndMessage.d.ts +1 -1
- package/dist/logic/hasValidation.d.ts +2 -2
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/validator.d.ts +1 -1
- package/dist/utils/isMessage.d.ts +1 -2
- package/package.json +11 -5
@@ -6,7 +6,7 @@ export default function getFields(fieldsNames: Set<InternalFieldName> | Internal
|
|
6
6
|
refs?: HTMLInputElement[] | undefined;
|
7
7
|
mount?: boolean | undefined;
|
8
8
|
} & Partial<{
|
9
|
-
required:
|
9
|
+
required: string | import("../types").ValidationRule<boolean>;
|
10
10
|
min: import("../types").ValidationRule<string | number>;
|
11
11
|
max: import("../types").ValidationRule<string | number>;
|
12
12
|
maxLength: import("../types").ValidationRule<string | number>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { FieldRefs, FieldValues } from '../types';
|
3
|
-
declare const
|
4
|
-
export default
|
3
|
+
declare const getFieldsValues: (fieldsRef: React.MutableRefObject<FieldRefs>, defaultValuesRef?: FieldValues | undefined, output?: Record<string, any>) => any;
|
4
|
+
export default getFieldsValues;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ValidationRule } from '../types';
|
2
|
-
declare const _default: (validationData?: ValidationRule<import("../types").ValidationValue> | undefined) =>
|
2
|
+
declare const _default: (validationData?: ValidationRule<import("../types").ValidationValue> | undefined) => {
|
3
3
|
value: string | number | boolean | RegExp | undefined;
|
4
4
|
message: string;
|
5
5
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
declare const _default: <T extends Partial<{
|
2
|
-
required:
|
2
|
+
required: string | import("../types").ValidationRule<boolean>;
|
3
3
|
min: import("../types").ValidationRule<string | number>;
|
4
4
|
max: import("../types").ValidationRule<string | number>;
|
5
5
|
maxLength: import("../types").ValidationRule<string | number>;
|
@@ -10,5 +10,5 @@ declare const _default: <T extends Partial<{
|
|
10
10
|
valueAsDate: boolean;
|
11
11
|
setValueAs: (value: any) => any;
|
12
12
|
shouldUnregister?: boolean | undefined;
|
13
|
-
}>>(options?: T | undefined, mounted?: boolean | undefined) => boolean |
|
13
|
+
}>>(options?: T | undefined, mounted?: boolean | undefined) => boolean | import("../types").ValidationValueMessage<boolean> | import("../types").ValidationRule<string | number> | import("../types").ValidationRule<RegExp> | import("../types").Validate<any> | Record<string, import("../types").Validate<any>> | undefined;
|
14
14
|
export default _default;
|
package/dist/types/errors.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { FieldValues, InternalFieldName, Ref } from './fields';
|
2
2
|
import { DeepMap, LiteralUnion } from './utils';
|
3
3
|
import { RegisterOptions, ValidateResult } from './validator';
|
4
|
-
export declare type Message = string
|
4
|
+
export declare type Message = string;
|
5
5
|
export declare type MultipleFieldErrors = {
|
6
6
|
[K in keyof RegisterOptions]?: ValidateResult;
|
7
7
|
} & {
|
@@ -7,7 +7,7 @@ export declare type ValidationValueMessage<TValidationValue extends ValidationVa
|
|
7
7
|
value: TValidationValue;
|
8
8
|
message: Message;
|
9
9
|
};
|
10
|
-
export declare type ValidateResult = Message | boolean | undefined;
|
10
|
+
export declare type ValidateResult = Message | Message[] | boolean | undefined;
|
11
11
|
export declare type Validate<TFieldValue> = (value: TFieldValue) => ValidateResult | Promise<ValidateResult>;
|
12
12
|
export declare type RegisterOptions<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Partial<{
|
13
13
|
required: Message | ValidationRule<boolean>;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-hook-form",
|
3
3
|
"description": "Performant, flexible and extensible forms library for React Hooks",
|
4
|
-
"version": "7.
|
4
|
+
"version": "7.5.2",
|
5
5
|
"main": "dist/index.cjs.js",
|
6
6
|
"module": "dist/index.esm.js",
|
7
7
|
"umd:main": "dist/index.umd.js",
|
@@ -29,6 +29,7 @@
|
|
29
29
|
"build:modern": "rollup -c ./scripts/rollup/rollup.config.js",
|
30
30
|
"build:esm": "rollup -c ./scripts/rollup/rollup.esm.config.js",
|
31
31
|
"cp:dts": "copyfiles -f ./src/**/*.d.ts dist && rimraf dist/__tests__",
|
32
|
+
"prettier:fix": "prettier --config .prettierrc --write \"**/*.{ts,tsx}\"",
|
32
33
|
"lint": "eslint '**/*.{js,ts,tsx}'",
|
33
34
|
"lint:fix": "yarn lint -- --fix",
|
34
35
|
"lint:types": "tsc --noEmit",
|
@@ -42,10 +43,9 @@
|
|
42
43
|
"cypress": "cypress run",
|
43
44
|
"cypress:open": "cypress open",
|
44
45
|
"cypress:parallel": "cypress-parallel -s cypress -t 4 -d -a",
|
45
|
-
"prepublishOnly": "yarn lint:fix && yarn lint:types && yarn test && yarn build",
|
46
|
+
"prepublishOnly": "yarn && yarn lint:fix && yarn lint:types && yarn test && yarn build",
|
46
47
|
"bundlesize": "yarn build:modern && bundlesize",
|
47
|
-
"start:app": "yarn build:esm && yarn link && yarn --cwd node_modules/react link && yarn --cwd ./app link react react-hook-form && yarn --cwd ./app && yarn --cwd ./app run dev"
|
48
|
-
"prepare": "husky install"
|
48
|
+
"start:app": "yarn build:esm && yarn link && yarn --cwd node_modules/react link && yarn --cwd ./app link react react-hook-form && yarn --cwd ./app && yarn --cwd ./app run dev"
|
49
49
|
},
|
50
50
|
"keywords": [
|
51
51
|
"react",
|
@@ -123,12 +123,18 @@
|
|
123
123
|
},
|
124
124
|
"lint-staged": {
|
125
125
|
"*.{js,ts,tsx}": [
|
126
|
-
"yarn lint:fix"
|
126
|
+
"yarn lint:fix",
|
127
|
+
"yarn prettier:fix"
|
127
128
|
],
|
128
129
|
"*.{md,json,yml}": [
|
129
130
|
"prettier --write"
|
130
131
|
]
|
131
132
|
},
|
133
|
+
"husky": {
|
134
|
+
"hooks": {
|
135
|
+
"pre-commit": "lint-staged"
|
136
|
+
}
|
137
|
+
},
|
132
138
|
"funding": {
|
133
139
|
"type": "opencollective",
|
134
140
|
"url": "https://opencollective.com/react-hook-form"
|