@paragrav/rhf-utils 0.0.137 → 0.0.138
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/README.md +8 -8
- package/package.json +2 -5
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Integration and utility library for [react-hook-form](https://www.react-hook-for
|
|
|
25
25
|
- `RhfUtilsFieldErrorMessage` for displaying error message
|
|
26
26
|
- safer `FieldValues` type (`SafeFieldValues`)
|
|
27
27
|
- `zod` support, including input/output types for transformations
|
|
28
|
-
- ~3.
|
|
28
|
+
- ~3.6kB min+gzip (excluding [peer dependencies](#peer-dependencies))
|
|
29
29
|
|
|
30
30
|
## Install
|
|
31
31
|
|
|
@@ -37,13 +37,13 @@ yarn add @paragrav/rhf-utils # yarn
|
|
|
37
37
|
|
|
38
38
|
## Quick Start
|
|
39
39
|
|
|
40
|
-
- 🔗 [Config](#config) (`RhfUtilsClientConfig`): define your
|
|
40
|
+
- 🔗 [Config](#config) (`RhfUtilsClientConfig`): define your global config (optional)
|
|
41
41
|
- 🔗 [Provider](#provider) (`RhfUtilsClientForZodContextProvider`): add to your global stack
|
|
42
|
-
- 🔗 [Form](#form) (`RhfUtilsZodForm`): use
|
|
42
|
+
- 🔗 [Form](#form) (`RhfUtilsZodForm`): use as form component
|
|
43
43
|
|
|
44
44
|
## Config
|
|
45
45
|
|
|
46
|
-
Create a config (`RhfUtilsClientConfig`) object with desired global and default options.
|
|
46
|
+
Create a config (`RhfUtilsClientConfig`) object with desired global config and default options. Config applies across all forms, and defaults can be overridden per form.
|
|
47
47
|
|
|
48
48
|
```tsx
|
|
49
49
|
export const rhfUtilsClientConfig: RhfUtilsClientConfig = {
|
|
@@ -292,7 +292,7 @@ type RhfUtilsFormOptions = {
|
|
|
292
292
|
};
|
|
293
293
|
|
|
294
294
|
/** Control dev tool options. (Lazy-loaded when truthy value supplied.) */
|
|
295
|
-
devTool?:
|
|
295
|
+
devTool?: boolean | Pick<DevtoolUIProps, 'placement' | 'styles'>;
|
|
296
296
|
};
|
|
297
297
|
```
|
|
298
298
|
|
|
@@ -323,7 +323,7 @@ declare module '@paragrav/rhf-utils' {
|
|
|
323
323
|
|
|
324
324
|
`FlatFieldErrors` type is a flattened, simplified version of RHF's `FieldErrors`. Keys represent flattened, dot-notation field paths.
|
|
325
325
|
|
|
326
|
-
Use `useFlatFieldErrorsContext()` hook, which returns an object with errors grouped by `all`, `fields`, `roots`, `orphans` records, and
|
|
326
|
+
Use `useFlatFieldErrorsContext()` hook, which returns an object with errors grouped by `all`, `fields`, `roots`, `orphans` records, and boolean values for `hasErrors` and `hasOrphans`.
|
|
327
327
|
|
|
328
328
|
### Output
|
|
329
329
|
|
|
@@ -424,7 +424,7 @@ This library uses `SafeFieldValues` type which uses `unknown` instead of `any`.
|
|
|
424
424
|
- [react](https://www.npmjs.com/package/react)
|
|
425
425
|
- [react-dom](https://www.npmjs.com/package/react-dom)
|
|
426
426
|
- [react-hook-form](https://www.npmjs.com/package/react-hook-form)
|
|
427
|
-
- [zod](https://www.npmjs.com/package/zod)
|
|
428
|
-
- [flat](https://www.npmjs.com/package/flat)
|
|
429
427
|
- [@hookform/resolvers](https://www.npmjs.com/package/@hookform/resolvers)
|
|
430
428
|
- [@hookform/devtools](https://www.npmjs.com/package/@hookform/devtools) (optional)
|
|
429
|
+
- [zod](https://www.npmjs.com/package/zod)
|
|
430
|
+
- [flat](https://www.npmjs.com/package/flat) _(805B min+gzip)_
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@paragrav/rhf-utils",
|
|
3
3
|
"author": "paragrav.dev",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.138",
|
|
6
6
|
"description": "Integration utilities for react-hook-form.",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -30,10 +30,7 @@
|
|
|
30
30
|
"react-hook-form": "7",
|
|
31
31
|
"zod": "3"
|
|
32
32
|
},
|
|
33
|
-
"resolutions": {
|
|
34
|
-
"@playwright/experimental-ct-react": "1.44.1",
|
|
35
|
-
"@playwright/test": "1.44.1"
|
|
36
|
-
},
|
|
33
|
+
"resolutions": {},
|
|
37
34
|
"repository": {
|
|
38
35
|
"type": "git",
|
|
39
36
|
"url": "git+https://github.com/paragrav/rhf-utils.git"
|