react-simple-formkit 2.1.5 → 2.1.7

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.
Files changed (2) hide show
  1. package/README.md +14 -14
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -194,20 +194,20 @@ State updates only when observed via `watch()`, `useWatch()`, `subscribe()`, or
194
194
  - `onChange` is just a handler callback that is called when field values change.
195
195
  - `onBlur` is just a handler callback that is called when field blurred.
196
196
 
197
- > **Rule\*:** onBlur works for uncontrolled fields by default. But for controlled fields, you need to use onBlur when rendering a field. For captured fields, you need to use `actions.triggerFieldBlur(fieldName)` to trigger onBlur event.
197
+ > **Rule\*:** By default, onBlur works automatically for uncontrolled fields. However, for controlled fields, you must explicitly pass the onBlur prop when rendering the field. For captured fields, use actions.triggerFieldBlur(fieldName) to manually trigger the onBlur event.
198
198
 
199
199
  ### The Power of watch (Unified Observation)
200
200
 
201
201
  The `watch` function (and `useWatch`, `subscribe`) is the "brain" of your form. Instead of having multiple hooks for different states, you can observe anything in the form using a unified dot-notation syntax:
202
202
 
203
- | Target | Syntax Example | Description |
204
- | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------- |
205
- | **All Values** | `watch()` | Observe every field value in the form. |
206
- | **Specific Value** | `watch("email")` | Observe changes for a specific field. |
207
- | **Form State** | `watch("formState")` <br/> `watch("formState.isDirty")` <br/> `watch("formState.isError")` <br/> `watch("formState.dirtyFields")` <br/> `watch("formState.touchedFields")` <br/> `watch("formState.errorFields")` | Track if the form has been modified. |
208
- | **Field States** | `watch("fieldStates")` <br/> `watch("fieldStates.email")` <br/> `watch("fieldStates.email.isDirty")` <br/> `watch("fieldStates.email.isTouched")` <br/> `watch("fieldStates.email.isError")` <br/> `watch("fieldStates.email.customState")` <br/> | Monitor if a field has been interacted with. |
209
- | **Errors** | `watch("errors")` <br/> `watch("errors.email")` <br/> | Get real-time validation error messages. |
210
- | **Multiple values** | `watch(["email", "errors.email", "fieldStates.email", "formState.isDirty"])` <br/> | Get real-time validation error messages. |
203
+ | Target | Syntax Example |
204
+ | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
205
+ | **All Values** | `watch()` |
206
+ | **Specific Value** | `watch("email")` |
207
+ | **Form State** | `watch("formState")` <br/> `watch("formState.isDirty")` <br/> `watch("formState.isError")` <br/> `watch("formState.dirtyFields")` <br/> `watch("formState.touchedFields")` <br/> `watch("formState.errorFields")` |
208
+ | **Field States** | `watch("fieldStates")` <br/> `watch("fieldStates.email")` <br/> `watch("fieldStates.email.isDirty")` <br/> `watch("fieldStates.email.isTouched")` <br/> `watch("fieldStates.email.isError")` <br/> `watch("fieldStates.email.customState")` <br/> |
209
+ | **Errors** | `watch("errors")` <br/> `watch("errors.email")` <br/> |
210
+ | **Multiple values** | `watch(["email", "errors.email", "fieldStates.email", "formState.isDirty"])` <br/> |
211
211
 
212
212
  > **💡Why it matters\*:** This unified approach ensures you only need to learn one API to track the entire lifecycle of your form.
213
213
 
@@ -416,7 +416,7 @@ Generic props:
416
416
  - `defaultValue`
417
417
  - `render({name, value, onChange, onBlur, customState, setCustomState})`
418
418
 
419
- ## useController({ name, defaultValue })
419
+ ## useController
420
420
 
421
421
  Generic props:
422
422
 
@@ -425,7 +425,7 @@ Generic props:
425
425
 
426
426
  Return: everything in render function above
427
427
 
428
- ## useWatch({ name, compute })
428
+ ## useWatch
429
429
 
430
430
  [Example](#manage-values)
431
431
 
@@ -441,14 +441,14 @@ Return:
441
441
  - if name is array: object of values of the fields
442
442
  - if name is undefined: object of all input values
443
443
 
444
- ## useFormContext()
444
+ ## useFormContext
445
445
 
446
446
  Return:
447
447
 
448
448
  - `watch`
449
449
  - `actions`
450
450
 
451
- ## watch(name)
451
+ ## watch
452
452
 
453
453
  Arguments:
454
454
 
@@ -458,7 +458,7 @@ Return:
458
458
 
459
459
  - same with useWatch()
460
460
 
461
- ## subscribe(name, callback)
461
+ ## subscribe
462
462
 
463
463
  Arguments:
464
464
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-formkit",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "keywords": [
5
5
  "react formkit",
6
6
  "react ez formkit",