@ttoss/forms 0.5.1 → 0.5.2

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