@ttoss/forms 0.5.7 → 0.5.9

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,27 +1,28 @@
1
- "use strict";
2
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
3
2
 
4
3
  // tsup.inject.js
5
4
  import * as React from "react";
6
5
 
7
6
  // src/Form.tsx
8
- import * as React2 from "react";
9
7
  import { Box } from "@ttoss/ui";
10
8
  import { FormProvider } from "react-hook-form";
9
+ import { jsx } from "react/jsx-runtime";
11
10
  var Form = ({
12
11
  children,
13
12
  onSubmit,
14
13
  sx,
15
14
  ...formMethods
16
15
  }) => {
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));
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
+ });
25
26
  };
26
27
 
27
28
  // src/FormFieldInput.tsx
@@ -31,16 +32,17 @@ import { Box as Box2, Input, Label } from "@ttoss/ui";
31
32
  import { useFormContext } from "react-hook-form";
32
33
  import { ErrorMessage as HookFormErrorMessage } from "@hookform/error-message";
33
34
  import { Text } from "@ttoss/ui";
35
+ import { jsx as jsx2 } from "react/jsx-runtime";
34
36
  var ErrorMessage = ({
35
37
  name
36
38
  }) => {
37
39
  const {
38
40
  formState: { errors }
39
41
  } = useFormContext();
40
- return /* @__PURE__ */ React.createElement(HookFormErrorMessage, {
42
+ return /* @__PURE__ */ jsx2(HookFormErrorMessage, {
41
43
  errors,
42
44
  name,
43
- as: /* @__PURE__ */ React.createElement(Text, {
45
+ as: /* @__PURE__ */ jsx2(Text, {
44
46
  variant: "text.error",
45
47
  role: "alert"
46
48
  })
@@ -49,6 +51,7 @@ var ErrorMessage = ({
49
51
 
50
52
  // src/FormFieldInput.tsx
51
53
  import { useController } from "react-hook-form";
54
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
52
55
  var FormFieldInput = ({
53
56
  label,
54
57
  name
@@ -60,18 +63,25 @@ var FormFieldInput = ({
60
63
  defaultValue: ""
61
64
  });
62
65
  const id = `form-field-input-${name}`;
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
- }));
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
+ });
75
85
  };
76
86
 
77
87
  // src/FormField.tsx
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";
2
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -18,7 +18,10 @@ 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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
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
+ ));
22
25
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
26
 
24
27
  // src/index.ts
@@ -33,23 +36,25 @@ module.exports = __toCommonJS(src_exports);
33
36
  var React = __toESM(require("react"));
34
37
 
35
38
  // src/Form.tsx
36
- var React2 = __toESM(require("react"));
37
39
  var import_ui = require("@ttoss/ui");
38
40
  var import_react_hook_form = require("react-hook-form");
41
+ var import_jsx_runtime = require("react/jsx-runtime");
39
42
  var Form = ({
40
43
  children,
41
44
  onSubmit,
42
45
  sx,
43
46
  ...formMethods
44
47
  }) => {
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));
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
+ });
53
58
  };
54
59
 
55
60
  // src/FormFieldInput.tsx
@@ -59,16 +64,17 @@ var import_ui3 = require("@ttoss/ui");
59
64
  var import_react_hook_form2 = require("react-hook-form");
60
65
  var import_error_message = require("@hookform/error-message");
61
66
  var import_ui2 = require("@ttoss/ui");
67
+ var import_jsx_runtime2 = require("react/jsx-runtime");
62
68
  var ErrorMessage = ({
63
69
  name
64
70
  }) => {
65
71
  const {
66
72
  formState: { errors }
67
73
  } = (0, import_react_hook_form2.useFormContext)();
68
- return /* @__PURE__ */ React.createElement(import_error_message.ErrorMessage, {
74
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_error_message.ErrorMessage, {
69
75
  errors,
70
76
  name,
71
- as: /* @__PURE__ */ React.createElement(import_ui2.Text, {
77
+ as: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Text, {
72
78
  variant: "text.error",
73
79
  role: "alert"
74
80
  })
@@ -77,6 +83,7 @@ var ErrorMessage = ({
77
83
 
78
84
  // src/FormFieldInput.tsx
79
85
  var import_react_hook_form3 = require("react-hook-form");
86
+ var import_jsx_runtime3 = require("react/jsx-runtime");
80
87
  var FormFieldInput = ({
81
88
  label,
82
89
  name
@@ -88,18 +95,25 @@ var FormFieldInput = ({
88
95
  defaultValue: ""
89
96
  });
90
97
  const id = `form-field-input-${name}`;
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
- }));
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
+ });
103
117
  };
104
118
 
105
119
  // src/FormField.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/forms",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
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.2",
32
+ "@ttoss/ui": "^1.22.0",
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": "b939e6a717618f4cc06605df922e37f89b877561"
45
+ "gitHead": "d1583c4306e792373d84030dba29f9e6cc57031d"
46
46
  }