@ttoss/forms 0.5.5 → 0.5.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.
package/dist/esm/index.js CHANGED
@@ -1,28 +1,27 @@
1
+ "use strict";
1
2
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
3
 
3
4
  // tsup.inject.js
4
5
  import * as React from "react";
5
6
 
6
7
  // src/Form.tsx
8
+ import * as React2 from "react";
7
9
  import { Box } from "@ttoss/ui";
8
10
  import { FormProvider } from "react-hook-form";
9
- import { jsx } from "react/jsx-runtime";
10
11
  var Form = ({
11
12
  children,
12
13
  onSubmit,
13
14
  sx,
14
15
  ...formMethods
15
16
  }) => {
16
- return /* @__PURE__ */ jsx(FormProvider, {
17
- ...formMethods,
18
- children: /* @__PURE__ */ jsx(Box, {
19
- as: "form",
20
- variant: "forms.form",
21
- onSubmit: formMethods.handleSubmit((data) => onSubmit(data)),
22
- sx,
23
- children
24
- })
25
- });
17
+ return /* @__PURE__ */ React2.createElement(FormProvider, {
18
+ ...formMethods
19
+ }, /* @__PURE__ */ React2.createElement(Box, {
20
+ as: "form",
21
+ variant: "forms.form",
22
+ onSubmit: formMethods.handleSubmit((data) => onSubmit(data)),
23
+ sx
24
+ }, children));
26
25
  };
27
26
 
28
27
  // src/FormFieldInput.tsx
@@ -32,17 +31,16 @@ import { Box as Box2, Input, Label } from "@ttoss/ui";
32
31
  import { useFormContext } from "react-hook-form";
33
32
  import { ErrorMessage as HookFormErrorMessage } from "@hookform/error-message";
34
33
  import { Text } from "@ttoss/ui";
35
- import { jsx as jsx2 } from "react/jsx-runtime";
36
34
  var ErrorMessage = ({
37
35
  name
38
36
  }) => {
39
37
  const {
40
38
  formState: { errors }
41
39
  } = useFormContext();
42
- return /* @__PURE__ */ jsx2(HookFormErrorMessage, {
40
+ return /* @__PURE__ */ React.createElement(HookFormErrorMessage, {
43
41
  errors,
44
42
  name,
45
- as: /* @__PURE__ */ jsx2(Text, {
43
+ as: /* @__PURE__ */ React.createElement(Text, {
46
44
  variant: "text.error",
47
45
  role: "alert"
48
46
  })
@@ -51,7 +49,6 @@ var ErrorMessage = ({
51
49
 
52
50
  // src/FormFieldInput.tsx
53
51
  import { useController } from "react-hook-form";
54
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
55
52
  var FormFieldInput = ({
56
53
  label,
57
54
  name
@@ -63,25 +60,18 @@ var FormFieldInput = ({
63
60
  defaultValue: ""
64
61
  });
65
62
  const id = `form-field-input-${name}`;
66
- return /* @__PURE__ */ jsxs(Box2, {
67
- children: [
68
- label && /* @__PURE__ */ jsx3(Label, {
69
- htmlFor: id,
70
- children: label
71
- }),
72
- /* @__PURE__ */ jsx3(Input, {
73
- ref,
74
- onChange,
75
- onBlur,
76
- value,
77
- name,
78
- id
79
- }),
80
- /* @__PURE__ */ jsx3(ErrorMessage, {
81
- name
82
- })
83
- ]
84
- });
63
+ return /* @__PURE__ */ React.createElement(Box2, null, label && /* @__PURE__ */ React.createElement(Label, {
64
+ htmlFor: id
65
+ }, label), /* @__PURE__ */ React.createElement(Input, {
66
+ ref,
67
+ onChange,
68
+ onBlur,
69
+ value,
70
+ name,
71
+ id
72
+ }), /* @__PURE__ */ React.createElement(ErrorMessage, {
73
+ name
74
+ }));
85
75
  };
86
76
 
87
77
  // src/FormField.tsx
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
1
  "use strict";
2
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -18,10 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  }
19
19
  return to;
20
20
  };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
25
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
23
 
27
24
  // src/index.ts
@@ -36,25 +33,23 @@ module.exports = __toCommonJS(src_exports);
36
33
  var React = __toESM(require("react"));
37
34
 
38
35
  // src/Form.tsx
36
+ var React2 = __toESM(require("react"));
39
37
  var import_ui = require("@ttoss/ui");
40
38
  var import_react_hook_form = require("react-hook-form");
41
- var import_jsx_runtime = require("react/jsx-runtime");
42
39
  var Form = ({
43
40
  children,
44
41
  onSubmit,
45
42
  sx,
46
43
  ...formMethods
47
44
  }) => {
48
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_hook_form.FormProvider, {
49
- ...formMethods,
50
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Box, {
51
- as: "form",
52
- variant: "forms.form",
53
- onSubmit: formMethods.handleSubmit((data) => onSubmit(data)),
54
- sx,
55
- children
56
- })
57
- });
45
+ return /* @__PURE__ */ React2.createElement(import_react_hook_form.FormProvider, {
46
+ ...formMethods
47
+ }, /* @__PURE__ */ React2.createElement(import_ui.Box, {
48
+ as: "form",
49
+ variant: "forms.form",
50
+ onSubmit: formMethods.handleSubmit((data) => onSubmit(data)),
51
+ sx
52
+ }, children));
58
53
  };
59
54
 
60
55
  // src/FormFieldInput.tsx
@@ -64,17 +59,16 @@ var import_ui3 = require("@ttoss/ui");
64
59
  var import_react_hook_form2 = require("react-hook-form");
65
60
  var import_error_message = require("@hookform/error-message");
66
61
  var import_ui2 = require("@ttoss/ui");
67
- var import_jsx_runtime2 = require("react/jsx-runtime");
68
62
  var ErrorMessage = ({
69
63
  name
70
64
  }) => {
71
65
  const {
72
66
  formState: { errors }
73
67
  } = (0, import_react_hook_form2.useFormContext)();
74
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_error_message.ErrorMessage, {
68
+ return /* @__PURE__ */ React.createElement(import_error_message.ErrorMessage, {
75
69
  errors,
76
70
  name,
77
- as: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Text, {
71
+ as: /* @__PURE__ */ React.createElement(import_ui2.Text, {
78
72
  variant: "text.error",
79
73
  role: "alert"
80
74
  })
@@ -83,7 +77,6 @@ var ErrorMessage = ({
83
77
 
84
78
  // src/FormFieldInput.tsx
85
79
  var import_react_hook_form3 = require("react-hook-form");
86
- var import_jsx_runtime3 = require("react/jsx-runtime");
87
80
  var FormFieldInput = ({
88
81
  label,
89
82
  name
@@ -95,25 +88,18 @@ var FormFieldInput = ({
95
88
  defaultValue: ""
96
89
  });
97
90
  const id = `form-field-input-${name}`;
98
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui3.Box, {
99
- children: [
100
- label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Label, {
101
- htmlFor: id,
102
- children: label
103
- }),
104
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Input, {
105
- ref,
106
- onChange,
107
- onBlur,
108
- value,
109
- name,
110
- id
111
- }),
112
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorMessage, {
113
- name
114
- })
115
- ]
116
- });
91
+ return /* @__PURE__ */ React.createElement(import_ui3.Box, null, label && /* @__PURE__ */ React.createElement(import_ui3.Label, {
92
+ htmlFor: id
93
+ }, label), /* @__PURE__ */ React.createElement(import_ui3.Input, {
94
+ ref,
95
+ onChange,
96
+ onBlur,
97
+ value,
98
+ name,
99
+ id
100
+ }), /* @__PURE__ */ React.createElement(ErrorMessage, {
101
+ name
102
+ }));
117
103
  };
118
104
 
119
105
  // src/FormField.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/forms",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -29,7 +29,7 @@
29
29
  "@hookform/resolvers": "^2.9.8",
30
30
  "@ttoss/config": "^1.18.3",
31
31
  "@ttoss/test-utils": "^1.16.10",
32
- "@ttoss/ui": "^1.21.0",
32
+ "@ttoss/ui": "^1.21.2",
33
33
  "@types/jest": "^29.0.3",
34
34
  "jest": "^29.0.3",
35
35
  "react": "^18.2.0",
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "8407ac0199e566fb6695f0caddb9f6bed4bf6578"
45
+ "gitHead": "b939e6a717618f4cc06605df922e37f89b877561"
46
46
  }