@ttoss/forms 0.6.0 → 0.8.0

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/README.md CHANGED
@@ -5,16 +5,14 @@
5
5
  ## Installation
6
6
 
7
7
  ```shell
8
- yarn add @ttoss/forms react-hook-form yup
8
+ yarn add @ttoss/forms
9
9
  ```
10
10
 
11
11
  ## Quick Start
12
12
 
13
13
  ```tsx
14
- import * as yup from 'yup';
15
14
  import { Button } from '@ttoss/ui';
16
- import { Form, FormField, yupResolver } from '@ttoss/forms';
17
- import { useForm } from 'react-hook-form';
15
+ import { Form, FormField, yupResolver, useForm, yup } from '@ttoss/forms';
18
16
 
19
17
  const schema = yup.object({
20
18
  firstName: yup.string().required('First name is required'),
@@ -38,3 +36,5 @@ export const FormComponent = () => {
38
36
  );
39
37
  };
40
38
  ```
39
+
40
+ > NOTE: You can also use yup and all of API from react-hook-form importing `import { yup, useForm } from @ttoss/forms`
package/dist/esm/index.js CHANGED
@@ -229,8 +229,11 @@ FormField.Checkbox = FormFieldCheckbox;
229
229
 
230
230
  // src/index.ts
231
231
  import { yupResolver } from "@hookform/resolvers/yup";
232
+ export * from "react-hook-form";
233
+ import * as yup from "yup";
232
234
  export {
233
235
  Form,
234
236
  FormField,
237
+ yup,
235
238
  yupResolver
236
239
  };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import * as react_hook_form from 'react-hook-form';
2
2
  import { FieldValues } from 'react-hook-form';
3
+ export * from 'react-hook-form';
3
4
  import * as React from 'react';
4
5
  import { BoxProps } from '@ttoss/ui';
5
6
  export { yupResolver } from '@hookform/resolvers/yup';
7
+ import * as yup from 'yup';
8
+ export { yup };
6
9
 
7
10
  declare const Form: <TFieldValues extends FieldValues = FieldValues>({ children, onSubmit, sx, ...formMethods }: {
8
11
  children?: React.ReactNode;
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  }
19
19
  return to;
20
20
  };
21
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
23
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
24
  mod
@@ -29,6 +30,7 @@ var src_exports = {};
29
30
  __export(src_exports, {
30
31
  Form: () => Form,
31
32
  FormField: () => FormField,
33
+ yup: () => yup,
32
34
  yupResolver: () => import_yup.yupResolver
33
35
  });
34
36
  module.exports = __toCommonJS(src_exports);
@@ -262,9 +264,12 @@ FormField.Checkbox = FormFieldCheckbox;
262
264
 
263
265
  // src/index.ts
264
266
  var import_yup = require("@hookform/resolvers/yup");
267
+ __reExport(src_exports, require("react-hook-form"), module.exports);
268
+ var yup = __toESM(require("yup"));
265
269
  // Annotate the CommonJS export names for ESM import in node:
266
270
  0 && (module.exports = {
267
271
  Form,
268
272
  FormField,
273
+ yup,
269
274
  yupResolver
270
275
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/forms",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -19,18 +19,18 @@
19
19
  "typings": "dist/index.d.ts",
20
20
  "dependencies": {
21
21
  "@hookform/error-message": "^2.0.1",
22
- "@hookform/resolvers": "^2.9.10"
22
+ "@hookform/resolvers": "^2.9.10",
23
+ "react-hook-form": "^7.39.7",
24
+ "yup": "^0.32.11"
23
25
  },
24
26
  "peerDependencies": {
25
27
  "@ttoss/ui": "^1.23.0",
26
- "react": "^18.2.0",
27
- "react-hook-form": "^7.39.7",
28
- "yup": "^0.32.11"
28
+ "react": "^18.2.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@ttoss/config": "^1.18.3",
32
- "@ttoss/test-utils": "^1.17.0",
33
- "@ttoss/ui": "^1.23.2",
31
+ "@ttoss/config": "^1.20.0",
32
+ "@ttoss/test-utils": "^1.18.0",
33
+ "@ttoss/ui": "^1.25.0",
34
34
  "@types/jest": "^29.2.3",
35
35
  "jest": "^29.3.1",
36
36
  "react": "^18.2.0",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "eaf4015635a5476a3b59beb3c35284404c1f07d5"
46
+ "gitHead": "b53562b00ffe5a2723780d2e8bee365d4fe1047d"
47
47
  }
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { Form } from './Form';
2
2
  export { FormField } from './FormField';
3
3
  export { yupResolver } from '@hookform/resolvers/yup';
4
+ export * from 'react-hook-form';
5
+ export * as yup from 'yup';