@cutting/react-hook-form-components 0.4.4 → 0.4.6
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.
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { FormInput, FormTextArea } from '@cutting/component-library';
|
|
3
|
-
import type { UseFormRegister, UseFormReturn } from 'react-hook-form';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
type Controls = typeof FormInput | typeof FormTextArea;
|
|
8
|
-
export type FormProps<C extends Controls, E> = ComponentProps<C> & {
|
|
3
|
+
import type { FieldValues, UseFormRegister, UseFormReturn } from 'react-hook-form';
|
|
4
|
+
import type { FormElementFromComponent, ComponentProps } from '@cutting/component-library';
|
|
5
|
+
export type FormProps<C extends FunctionComponent<any>> = ComponentProps<C> & {
|
|
9
6
|
required?: boolean;
|
|
10
7
|
className?: string;
|
|
11
|
-
errors?:
|
|
12
|
-
} & ReturnType<UseFormRegister<
|
|
13
|
-
export declare function createFormComponent
|
|
14
|
-
export declare const Input:
|
|
15
|
-
export declare const TextArea:
|
|
16
|
-
export {};
|
|
8
|
+
errors?: unknown;
|
|
9
|
+
} & ReturnType<UseFormRegister<FieldValues>> & Partial<Pick<UseFormReturn<FieldValues>, 'setValue'>>;
|
|
10
|
+
export declare function createFormComponent<C extends FunctionComponent<any>>(Component: C): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<ComponentProps<C>> & import("react").RefAttributes<FormElementFromComponent<C>>>;
|
|
11
|
+
export declare const Input: (props: FormProps<typeof FormInput>) => ReactNode;
|
|
12
|
+
export declare const TextArea: (props: FormProps<typeof FormTextArea>) => ReactNode;
|
|
17
13
|
//# sourceMappingURL=FormComponents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormComponents.d.ts","sourceRoot":"","sources":["../../../../src/components/FormComponents/FormComponents.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormComponents.d.ts","sourceRoot":"","sources":["../../../../src/components/FormComponents/FormComponents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE3F,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,iBAAiB,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,GAC1C,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AAGxD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,iBAAiB,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,8JAOjF;AAKD,eAAO,MAAM,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,SAAS,CAAC,KAAK,SAA0C,CAAC;AACvG,eAAO,MAAM,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,YAAY,CAAC,KAAK,SAA6C,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{forwardRef as t}from"react";import{FormInput as n,FormTextArea as o}from"@cutting/component-library";function e(n){return t((function(t,o){return r(n,{innerRef:o,...t})}))}const i=e(n),m=e(o);export{i as Input,m as TextArea,e as createFormComponent};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/components/FormComponents/FormComponents.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/components/FormComponents/FormComponents.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { FunctionComponent, ReactNode, Ref } from 'react';\nimport { forwardRef } from 'react';\nimport { FormInput, FormTextArea } from '@cutting/component-library';\nimport type { FieldValues, UseFormRegister, UseFormReturn } from 'react-hook-form';\nimport type { FormElementFromComponent, ComponentProps } from '@cutting/component-library';\n\nexport type FormProps<C extends FunctionComponent<any>> = ComponentProps<C> & {\n required?: boolean;\n className?: string;\n errors?: unknown;\n} & ReturnType<UseFormRegister<FieldValues>> &\n Partial<Pick<UseFormReturn<FieldValues>, 'setValue'>>;\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function createFormComponent<C extends FunctionComponent<any>>(Component: C) {\n return forwardRef<FormElementFromComponent<typeof Component>, ComponentProps<C>>(function ReactHookFormComponent(\n props: FormProps<typeof Component>,\n ref: Ref<FormElementFromComponent<typeof Component>>,\n ) {\n return <Component innerRef={ref} {...(props as any)} />;\n });\n}\n\n// TODO: remove annotations. Currently weird type error\n// The inferred type of 'Input' cannot be named without a reference to '@cutting/component-library/node_modules/@types/react'.\n// This is likely not portable. A type annotation is necessary.\nexport const Input: (props: FormProps<typeof FormInput>) => ReactNode = createFormComponent(FormInput);\nexport const TextArea: (props: FormProps<typeof FormTextArea>) => ReactNode = createFormComponent(FormTextArea);\n"],"names":["createFormComponent","Component","forwardRef","props","ref","_jsx","innerRef","Input","FormInput","TextArea","FormTextArea"],"mappings":"oJAeM,SAAUA,EAAsDC,GACpE,OAAOC,GAA0E,SAC/EC,EACAC,GAEA,OAAOC,EAACJ,EAAU,CAAAK,SAAUF,KAAUD,GACxC,GACF,OAKaI,EAA2DP,EAAoBQ,GAC/EC,EAAiET,EAAoBU"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cutting/react-hook-form-components",
|
|
3
3
|
"description": "components for react-hook-form.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
@@ -16,22 +16,24 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"assert-ts": "^0.3.4",
|
|
19
|
-
"react-hook-form": "7.
|
|
20
|
-
"@cutting/component-library": "5.
|
|
21
|
-
"@cutting/util": "4.58.
|
|
19
|
+
"react-hook-form": "7.44.3",
|
|
20
|
+
"@cutting/component-library": "5.40.0",
|
|
21
|
+
"@cutting/util": "4.58.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/react": "18.
|
|
25
|
-
"@
|
|
26
|
-
"
|
|
24
|
+
"@types/react": "18.2.12",
|
|
25
|
+
"@types/react-dom": "18.2.5",
|
|
26
|
+
"@vanilla-extract/css": "^1.11.1",
|
|
27
|
+
"eslint": "8.43.0",
|
|
27
28
|
"react": "18.2.0",
|
|
28
29
|
"react-dom": "18.2.0",
|
|
29
30
|
"react-syntax-highlighter": "15.5.0",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"@cutting/
|
|
33
|
-
"@cutting/
|
|
34
|
-
"@cutting/
|
|
31
|
+
"@testing-library/react": "14.0.0",
|
|
32
|
+
"typescript": "5.1.3",
|
|
33
|
+
"@cutting/devtools": "4.63.1",
|
|
34
|
+
"@cutting/eslint-config": "4.44.1",
|
|
35
|
+
"@cutting/tsconfig": "4.40.1",
|
|
36
|
+
"@cutting/useful-types": "4.40.1"
|
|
35
37
|
},
|
|
36
38
|
"peerDependencies": {
|
|
37
39
|
"react": ">= 18.x.x",
|
|
@@ -62,7 +64,8 @@
|
|
|
62
64
|
},
|
|
63
65
|
"scripts": {
|
|
64
66
|
"start": "echo no demo",
|
|
65
|
-
"test": "
|
|
67
|
+
"test": "NODE_ENV=test vitest",
|
|
68
|
+
"test:ci": "CI=true pnpm test",
|
|
66
69
|
"lint": "eslint ./src/**/*.{ts,tsx} --fix",
|
|
67
70
|
"lint:fix": "pnpm lint --fix",
|
|
68
71
|
"build": "NODE_ENV=production devtools rollup"
|