react-f0rm 0.3.0 → 0.4.1

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 +48 -2
  2. package/dist/devtools/index.cjs.js +20 -13
  3. package/dist/devtools/index.cjs.js.map +1 -1
  4. package/dist/devtools/index.d.ts +1 -1
  5. package/dist/devtools/index.mjs +20 -13
  6. package/dist/devtools/index.mjs.map +1 -1
  7. package/dist/{form-b9441d8c.cjs.js → form-B4r7INJ0.cjs.js} +10 -39
  8. package/dist/form-B4r7INJ0.cjs.js.map +1 -0
  9. package/dist/{form-61297bc0.d.ts → form-DeRFdFKE.d.ts} +2 -2
  10. package/dist/{form-94c70b4b.mjs → form-R1hDKjBm.mjs} +11 -40
  11. package/dist/form-R1hDKjBm.mjs.map +1 -0
  12. package/dist/index.cjs.js +30 -15
  13. package/dist/index.cjs.js.map +1 -1
  14. package/dist/index.d.ts +78 -19
  15. package/dist/index.mjs +31 -16
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +30 -15
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/index.umd.min.js +2 -2
  20. package/dist/index.umd.min.js.map +1 -1
  21. package/dist/resolvers/standard-schema.cjs.js +1 -1
  22. package/dist/resolvers/standard-schema.cjs.js.map +1 -1
  23. package/dist/resolvers/standard-schema.d.ts +2 -2
  24. package/dist/resolvers/standard-schema.mjs +1 -1
  25. package/dist/resolvers/standard-schema.mjs.map +1 -1
  26. package/dist/resolvers/yup.cjs.js +5 -7
  27. package/dist/resolvers/yup.cjs.js.map +1 -1
  28. package/dist/resolvers/yup.d.ts +2 -2
  29. package/dist/resolvers/yup.mjs +5 -7
  30. package/dist/resolvers/yup.mjs.map +1 -1
  31. package/dist/resolvers/zod.cjs.js +5 -7
  32. package/dist/resolvers/zod.cjs.js.map +1 -1
  33. package/dist/resolvers/zod.d.ts +2 -2
  34. package/dist/resolvers/zod.mjs +5 -7
  35. package/dist/resolvers/zod.mjs.map +1 -1
  36. package/dist/{validate-148fe167.d.ts → validate-B7S9EiRT.d.ts} +1 -1
  37. package/package.json +52 -51
  38. package/dist/form-94c70b4b.mjs.map +0 -1
  39. package/dist/form-b9441d8c.cjs.js.map +0 -1
package/dist/index.umd.js CHANGED
@@ -33,7 +33,7 @@
33
33
  function create$2() {
34
34
  return new Map();
35
35
  }
36
- function emit$1(ee, key) {
36
+ function emit(ee, key) {
37
37
  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
38
38
  args[_key - 2] = arguments[_key];
39
39
  }
@@ -188,7 +188,6 @@
188
188
  return { value, key: JSON.stringify(value) };
189
189
  }
190
190
 
191
- const emit = emit$1;
192
191
  const VALIDATION_OUTCOME = /* @__PURE__ */ Symbol("validation-outcome");
193
192
  function create(options) {
194
193
  const emitter = create$2();
@@ -783,7 +782,7 @@
783
782
  var nextValue = latestGetSnapshot();
784
783
  return !objectIs(inst, nextValue);
785
784
  } catch (error) {
786
- return !0;
785
+ return true;
787
786
  }
788
787
  }
789
788
  function useSyncExternalStore$1(subscribe, getSnapshot) {
@@ -825,7 +824,7 @@
825
824
  function useSyncExternalStore$2(subscribe, getSnapshot) {
826
825
  didWarnOld18Alpha ||
827
826
  void 0 === React$1.startTransition ||
828
- ((didWarnOld18Alpha = !0),
827
+ ((didWarnOld18Alpha = true),
829
828
  console.error(
830
829
  "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
831
830
  ));
@@ -836,7 +835,7 @@
836
835
  (console.error(
837
836
  "The result of getSnapshot should be cached to avoid an infinite loop"
838
837
  ),
839
- (didWarnUncachedGetSnapshot = !0));
838
+ (didWarnUncachedGetSnapshot = true));
840
839
  }
841
840
  cachedValue = useState({
842
841
  inst: { value: value, getSnapshot: getSnapshot }
@@ -870,7 +869,7 @@
870
869
  var nextValue = latestGetSnapshot();
871
870
  return !objectIs(inst, nextValue);
872
871
  } catch (error) {
873
- return !0;
872
+ return true;
874
873
  }
875
874
  }
876
875
  function useSyncExternalStore$1(subscribe, getSnapshot) {
@@ -886,8 +885,8 @@
886
885
  useEffect = React$1.useEffect,
887
886
  useLayoutEffect = React$1.useLayoutEffect,
888
887
  useDebugValue = React$1.useDebugValue,
889
- didWarnOld18Alpha = !1,
890
- didWarnUncachedGetSnapshot = !1,
888
+ didWarnOld18Alpha = false,
889
+ didWarnUncachedGetSnapshot = false,
891
890
  shim =
892
891
  "undefined" === typeof window ||
893
892
  "undefined" === typeof window.document ||
@@ -904,13 +903,21 @@
904
903
  return useSyncExternalStoreShim_development;
905
904
  }
906
905
 
907
- if (process.env.NODE_ENV === 'production') {
908
- shim.exports = requireUseSyncExternalStoreShim_production();
909
- } else {
910
- shim.exports = requireUseSyncExternalStoreShim_development();
906
+ var hasRequiredShim;
907
+
908
+ function requireShim () {
909
+ if (hasRequiredShim) return shim.exports;
910
+ hasRequiredShim = 1;
911
+
912
+ if (process.env.NODE_ENV === 'production') {
913
+ shim.exports = requireUseSyncExternalStoreShim_production();
914
+ } else {
915
+ shim.exports = requireUseSyncExternalStoreShim_development();
916
+ }
917
+ return shim.exports;
911
918
  }
912
919
 
913
- var shimExports = shim.exports;
920
+ var shimExports = requireShim();
914
921
 
915
922
  function isDescendant(key, ancestorKey) {
916
923
  return key.startsWith(`${ancestorKey.slice(0, -1)},`);
@@ -1443,7 +1450,13 @@
1443
1450
  function useFieldArray(options) {
1444
1451
  return useFieldArrayCore(options, Context);
1445
1452
  }
1446
- return { FormProvider: FormProvider2, useFormContext: useFormContext2, useField, useFieldArray };
1453
+ return {
1454
+ context: Context,
1455
+ FormProvider: FormProvider2,
1456
+ useFormContext: useFormContext2,
1457
+ useField,
1458
+ useFieldArray
1459
+ };
1447
1460
  }
1448
1461
  const CheckboxGroupContext = React.createContext(null);
1449
1462
  const CheckboxGroupProvider = CheckboxGroupContext.Provider;
@@ -1455,6 +1468,7 @@
1455
1468
 
1456
1469
  function Form({
1457
1470
  form: f1,
1471
+ context,
1458
1472
  initialValues,
1459
1473
  values,
1460
1474
  onSubmit,
@@ -1471,7 +1485,8 @@
1471
1485
  onInvalidSubmit,
1472
1486
  shouldFocusError
1473
1487
  });
1474
- return /* @__PURE__ */ React__namespace.createElement(FormProvider, { value: form }, /* @__PURE__ */ React__namespace.createElement("form", { ...props, noValidate: true, onSubmit: submit }));
1488
+ const { Provider } = context ?? FormContext;
1489
+ return /* @__PURE__ */ React__namespace.createElement(Provider, { value: form }, /* @__PURE__ */ React__namespace.createElement("form", { ...props, noValidate: true, onSubmit: submit }));
1475
1490
  }
1476
1491
 
1477
1492
  function setRef(ref, value) {