@paragrav/rhf-utils 0.0.86 → 0.0.87

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.
@@ -6,7 +6,7 @@ import { FormSubmitError as E } from "../submit/error/FormSubmitError.mjs";
6
6
  import V from "../submit/error/setCtxErrorsByFormSubmitError.mjs";
7
7
  import w from "./_Controller.mjs";
8
8
  import z from "./_FormBase.mjs";
9
- function I({
9
+ function J({
10
10
  formId: B,
11
11
  formRef: u,
12
12
  //
@@ -46,16 +46,16 @@ function I({
46
46
  l,
47
47
  e
48
48
  );
49
- }, c = {
49
+ }, y = {
50
50
  formId: B,
51
51
  formRef: u,
52
52
  ctx: l,
53
53
  options: r,
54
54
  Controller: w
55
- }, y = (t) => {
55
+ }, c = (t) => {
56
56
  var m;
57
57
  const e = (m = a == null ? void 0 : a.Children) == null ? void 0 : m[t];
58
- return e && /* @__PURE__ */ C(e, { ...c });
58
+ return e && /* @__PURE__ */ C(e, { ...y });
59
59
  };
60
60
  return /* @__PURE__ */ S(
61
61
  z,
@@ -64,20 +64,21 @@ function I({
64
64
  style: {
65
65
  position: "relative"
66
66
  },
67
+ config: a,
68
+ formRef: u,
67
69
  ...d,
68
70
  className: [r == null ? void 0 : r.classNames, d == null ? void 0 : d.className].filter(Boolean).join(" "),
69
71
  onSubmit: j,
70
- formRef: u,
71
72
  children: [
72
- y("top"),
73
+ c("top"),
73
74
  (r == null ? void 0 : r.devTool) !== "disabled" && /* @__PURE__ */ C(v, { placement: "top-right", ...r == null ? void 0 : r.devTool }),
74
- x && /* @__PURE__ */ C(x, { ...c }),
75
+ x && /* @__PURE__ */ C(x, { ...y }),
75
76
  _,
76
- y("bottom")
77
+ c("bottom")
77
78
  ]
78
79
  }
79
80
  );
80
81
  }
81
82
  export {
82
- I as default
83
+ J as default
83
84
  };
@@ -1,14 +1,18 @@
1
- import { jsxs as m, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as p, jsx as s } from "react/jsx-runtime";
2
2
  import "react";
3
- const f = ({
4
- formRef: e,
3
+ const l = ({
4
+ config: e,
5
+ formRef: t,
5
6
  antiCsrfToken: r,
6
7
  children: o,
7
- ...t
8
- }) => /* @__PURE__ */ m("form", { role: "form", ...t, ref: e, children: [
9
- r && /* @__PURE__ */ n("input", { type: "hidden", name: "anticsrftoken", value: r }),
10
- o
11
- ] });
8
+ ...m
9
+ }) => {
10
+ const n = (e == null ? void 0 : e.FormComponent) ?? "form";
11
+ return /* @__PURE__ */ p(n, { role: "form", ...m, ref: t, children: [
12
+ r && /* @__PURE__ */ s("input", { type: "hidden", name: "anticsrftoken", value: r }),
13
+ o
14
+ ] });
15
+ };
12
16
  export {
13
- f as default
17
+ l as default
14
18
  };
@@ -34,4 +34,5 @@ export type ClientConfig = {
34
34
  * Handle non-{@link FormSubmitError} errors. Optionally, return {@link FormSubmitError} to merge into context errors.
35
35
  */
36
36
  onSubmitError?: (error: unknown) => FormSubmitError | undefined;
37
+ FormComponent?: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLFormElement>>>;
37
38
  };
@@ -1,8 +1,10 @@
1
+ import { ClientConfig } from '../client/config';
1
2
  import { default as React } from 'react';
2
3
 
3
- export type FormBaseProps = React.PropsWithoutRef<JSX.IntrinsicElements['form']> & {
4
+ export type FormBaseProps = React.PropsWithChildren<React.HTMLAttributes<HTMLFormElement>> & {
5
+ config?: ClientConfig;
4
6
  formRef: React.RefObject<HTMLFormElement>;
5
7
  antiCsrfToken?: string;
6
8
  };
7
- declare const _FormBase: ({ formRef, antiCsrfToken, children, ...props }: FormBaseProps) => import("react/jsx-runtime").JSX.Element;
9
+ declare const _FormBase: ({ config, formRef, antiCsrfToken, children, ...props }: FormBaseProps) => import("react/jsx-runtime").JSX.Element;
8
10
  export default _FormBase;
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.86",
5
+ "version": "0.0.87",
6
6
  "description": "Integration utilities for react-hook-form.",
7
7
  "type": "module",
8
8
  "sideEffects": false,