react-f0rm 0.6.0 → 0.7.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.
Files changed (39) hide show
  1. package/README.md +22 -0
  2. package/dist/devtools/index.cjs.js +1 -743
  3. package/dist/devtools/index.cjs.js.map +1 -1
  4. package/dist/devtools/index.mjs +1 -723
  5. package/dist/devtools/index.mjs.map +1 -1
  6. package/dist/form-CGRvih_c.cjs.js +2 -0
  7. package/dist/form-CGRvih_c.cjs.js.map +1 -0
  8. package/dist/form-CfBBPz6p.mjs +2 -0
  9. package/dist/form-CfBBPz6p.mjs.map +1 -0
  10. package/dist/{form-D9COEt0-.d.ts → form-DHKns6j_.d.ts} +41 -1
  11. package/dist/index.cjs.js +1 -1812
  12. package/dist/index.cjs.js.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.mjs +1 -1719
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/index.umd.js +27 -7
  17. package/dist/index.umd.js.map +1 -1
  18. package/dist/index.umd.min.js +2 -2
  19. package/dist/index.umd.min.js.map +1 -1
  20. package/dist/resolvers/standard-schema.cjs.js +1 -89
  21. package/dist/resolvers/standard-schema.cjs.js.map +1 -1
  22. package/dist/resolvers/standard-schema.mjs +1 -85
  23. package/dist/resolvers/standard-schema.mjs.map +1 -1
  24. package/dist/resolvers/yup.cjs.js +1 -22
  25. package/dist/resolvers/yup.cjs.js.map +1 -1
  26. package/dist/resolvers/yup.d.ts +1 -1
  27. package/dist/resolvers/yup.mjs +1 -20
  28. package/dist/resolvers/yup.mjs.map +1 -1
  29. package/dist/resolvers/zod.cjs.js +1 -22
  30. package/dist/resolvers/zod.cjs.js.map +1 -1
  31. package/dist/resolvers/zod.d.ts +1 -1
  32. package/dist/resolvers/zod.mjs +1 -20
  33. package/dist/resolvers/zod.mjs.map +1 -1
  34. package/dist/{validate-Cu43SqhV.d.ts → validate-BoNZhOMY.d.ts} +1 -1
  35. package/package.json +6 -1
  36. package/dist/form-CXF5HwQG.mjs +0 -349
  37. package/dist/form-CXF5HwQG.mjs.map +0 -1
  38. package/dist/form-DbnzAKSM.cjs.js +0 -358
  39. package/dist/form-DbnzAKSM.cjs.js.map +0 -1
package/README.md CHANGED
@@ -458,6 +458,20 @@ setValue(form, 'email', 'a@b.com', {
458
458
  });
459
459
  ```
460
460
 
461
+ ### Writing as a user change (`changeValue`)
462
+
463
+ `setValue` is the imperative channel — `shouldValidate` kicks the field's validator unconditionally, ignoring any mode. `changeValue` is the user-change channel: the write routes through the mounted field's own `onChange`, so it fires exactly the validation a user typing into the field would fire — the field's effective `mode` (per-field override included) and the form's `reValidateMode`. With no mounted field on the path it degrades to a plain `setValue`.
464
+
465
+ ```jsx
466
+ import {changeValue} from 'react-f0rm';
467
+
468
+ // An onSubmit form with the default reValidateMode 'onChange': quiet
469
+ // while the field has no error, re-validates once it does — same as typing.
470
+ changeValue(form, 'email', 'a@b.com');
471
+ ```
472
+
473
+ This is the channel component libraries need when they hand a control a plain setter bound to a field (a `Control`/controlled-bridge over `useField`'s value): the mode gating — per-field override and live-error view — lives inside `useField`'s `onChange` closure and cannot be rebuilt from public form state, so `useField` publishes its `onChange` on the form (`form.changeHandlers`) and `changeValue`/`changeValueByPath` route through it.
474
+
461
475
  ### Field-level validation
462
476
 
463
477
  Pass a `validate` function to `Field` or `useField`. Return an error string, a `FieldError` object or `undefined` — sync or async:
@@ -791,6 +805,14 @@ import {renderToString} from 'react-dom/server';
791
805
  const html = renderToString(<ProfileForm initialValues={{name: 'ada', city: 'london'}} />);
792
806
  ```
793
807
 
808
+ ## Migrating
809
+
810
+ Coming from another library? Step-by-step migration guides live in the docs site:
811
+
812
+ - [Migrating from Formik](docs-site/docs/migration/from-formik.md)
813
+ - [Migrating from React Hook Form](docs-site/docs/migration/from-react-hook-form.md)
814
+ - [Migrating from TanStack Form](docs-site/docs/migration/from-tanstack-form.md)
815
+
794
816
  ## Breaking changes in 0.2
795
817
 
796
818
  v0.2 structures the error model (`FieldError`), changes unregister/reset/native-validation semantics, and more — see the [v0.1 → v0.2 migration guide](docs-site/docs/migration/v0.1-to-v0.2.md).