@paragrav/rhf-utils 0.0.95 → 0.0.99

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.
@@ -1,24 +1,24 @@
1
- import { useFormContext as a } from "react-hook-form";
2
- import f from "../../client/config/useRhfUtilsClientConfigContext.mjs";
3
- import c from "../../utils/isEmptyObject.mjs";
4
- import h from "../output/consoleErrors.mjs";
5
- import C from "./context/useFlatFieldErrorsContext.mjs";
6
- const w = () => {
7
- var n, m, p, l;
8
- const u = a(), o = f(), e = C(), s = {
1
+ import { useFormContext as C } from "react-hook-form";
2
+ import F from "../../client/config/useRhfUtilsClientConfigContext.mjs";
3
+ import x from "../../utils/isEmptyObject.mjs";
4
+ import E from "../output/consoleErrors.mjs";
5
+ import d from "./context/useFlatFieldErrorsContext.mjs";
6
+ const v = () => {
7
+ var p, l, t, i, u, a, r, f;
8
+ const h = C(), o = F(), n = d(), m = {
9
9
  isDevelopment: o == null ? void 0 : o.isDevelopment,
10
- hasOrphans: !c(e.orphans)
11
- }, t = (m = o == null ? void 0 : (n = o.errors.output.console).getConfig) == null ? void 0 : m.call(n, s);
12
- t && h(
13
- t.message ?? i,
14
- u.getValues(),
15
- e,
16
- t.type
10
+ hasOrphans: !x(n.orphans)
11
+ }, e = (i = (t = (l = (p = o == null ? void 0 : o.errors) == null ? void 0 : p.output) == null ? void 0 : l.console) == null ? void 0 : t.getConfig) == null ? void 0 : i.call(t, m);
12
+ e && E(
13
+ e.message ?? c,
14
+ h.getValues(),
15
+ n,
16
+ e.type
17
17
  );
18
- const r = (l = o == null ? void 0 : (p = o.errors.output.throw).getConfig) == null ? void 0 : l.call(p, s);
19
- if (r)
20
- throw new Error(typeof r == "string" ? r : i);
21
- }, i = "Form errors";
18
+ const s = (f = (r = (a = (u = o == null ? void 0 : o.errors) == null ? void 0 : u.output) == null ? void 0 : a.throw) == null ? void 0 : r.getConfig) == null ? void 0 : f.call(r, m);
19
+ if (s)
20
+ throw new Error(typeof s == "string" ? s : c);
21
+ }, c = "Form errors";
22
22
  export {
23
- w as default
23
+ v as default
24
24
  };
@@ -1,11 +1,10 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useFlatFieldErrorsContextMaybe as s } from "../flat/context/useFlatFieldErrorsContext.mjs";
3
- import e from "../flat/FlatFieldErrorsList.mjs";
4
- const i = () => {
5
- var r;
6
- const o = (r = s()) == null ? void 0 : r.roots;
7
- return /* @__PURE__ */ t(e, { errors: o });
8
- }, a = i;
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import t from "../flat/context/useFlatFieldErrorsContext.mjs";
3
+ import s from "../flat/FlatFieldErrorsList.mjs";
4
+ const e = () => {
5
+ const r = t().roots;
6
+ return /* @__PURE__ */ o(s, { errors: r });
7
+ }, m = e;
9
8
  export {
10
- a as default
9
+ m as default
11
10
  };
@@ -8,7 +8,7 @@ import P from "../submit/error/setCtxErrorsByFormSubmitError.mjs";
8
8
  import S from "./_Controller.mjs";
9
9
  import T from "./_FormBase.mjs";
10
10
  function q({
11
- formId: n,
11
+ formId: x,
12
12
  formRef: C,
13
13
  //
14
14
  onSubmit: d,
@@ -33,29 +33,29 @@ function q({
33
33
  l,
34
34
  a
35
35
  ), B = (r, a) => {
36
- var x;
36
+ var n;
37
37
  const m = r instanceof N ? (
38
38
  // consumer can manually throw FormSubmitError (e.g., manual validation)
39
39
  r
40
40
  ) : (
41
41
  // if error is not FormSubmitError, consumer can provide global handler
42
- (x = e == null ? void 0 : e.onSubmitError) == null ? void 0 : x.call(e, r)
42
+ (n = e == null ? void 0 : e.onSubmitError) == null ? void 0 : n.call(e, r)
43
43
  );
44
44
  m && P(l, m), c == null || c(
45
45
  r,
46
46
  l,
47
47
  a
48
48
  );
49
- }, i = {
50
- formId: n,
49
+ }, u = {
50
+ formId: x,
51
51
  formRef: C,
52
52
  ctx: l,
53
53
  options: t,
54
54
  Controller: S
55
- }, u = (r) => {
55
+ }, i = (r) => {
56
56
  var m;
57
57
  const a = (m = e == null ? void 0 : e.Children) == null ? void 0 : m[r];
58
- return a && /* @__PURE__ */ o(a, { ...i });
58
+ return a && /* @__PURE__ */ o(a, { ...u });
59
59
  };
60
60
  return /* @__PURE__ */ F(
61
61
  T,
@@ -70,7 +70,7 @@ function q({
70
70
  className: [t == null ? void 0 : t.classNames, s == null ? void 0 : s.className].filter(Boolean).join(" "),
71
71
  onSubmit: b,
72
72
  children: [
73
- u("top"),
73
+ i("top"),
74
74
  (t == null ? void 0 : t.devTool) !== "disabled" && /* @__PURE__ */ o(
75
75
  D,
76
76
  {
@@ -79,9 +79,9 @@ function q({
79
79
  ...t == null ? void 0 : t.devTool
80
80
  }
81
81
  ),
82
- h && /* @__PURE__ */ o(h, { ...i }),
82
+ h && /* @__PURE__ */ o(h, { ...u }),
83
83
  f,
84
- u("bottom")
84
+ i("bottom")
85
85
  ]
86
86
  }
87
87
  );
@@ -40,12 +40,12 @@ export type RhfUtilsClientConfig = {
40
40
  */
41
41
  onSubmitError?: (error: unknown) => FormSubmitError | undefined;
42
42
  FormComponent?: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLFormElement>>>;
43
- errors: {
44
- output: {
45
- console: {
43
+ errors?: {
44
+ output?: {
45
+ console?: {
46
46
  getConfig?: (context: RhfUtilsErrorsOutputConfigContext) => RhfUtilsErrorsOutputConsoleConfig | null;
47
47
  };
48
- throw: {
48
+ throw?: {
49
49
  getConfig?: (context: RhfUtilsErrorsOutputConfigContext) => true | string | false;
50
50
  };
51
51
  };
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.95",
5
+ "version": "0.0.99",
6
6
  "description": "Integration utilities for react-hook-form.",
7
7
  "type": "module",
8
8
  "sideEffects": false,