@inpulse-ui/form 3.0.0 → 3.0.1
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 +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.js +1 -1
- package/dist/index.m.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @inpulse-ui/form
|
|
2
2
|
|
|
3
|
-
An abstraction layer so that you can put together your form very
|
|
3
|
+
An abstraction layer so that you can put together your form very closely to how you would in the pre-React world.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { UseFormReturn, SubmitHandler
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FieldValues, UseFormReturn, SubmitHandler } from 'react-hook-form';
|
|
3
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
type FormProps<TFieldValues extends FieldValues = FieldValues> = Omit<ComponentPropsWithoutRef<"form">, "onSubmit"> & UseFormReturn<TFieldValues> & {
|
|
5
6
|
children?: ReactNode;
|
|
6
|
-
onSubmit?: SubmitHandler<
|
|
7
|
-
}
|
|
7
|
+
onSubmit?: SubmitHandler<TFieldValues>;
|
|
8
|
+
};
|
|
9
|
+
declare const Form: {
|
|
10
|
+
<TFieldValues extends FieldValues = FieldValues>(props: FormProps<TFieldValues>): react_jsx_runtime.JSX.Element | null;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
8
13
|
|
|
9
14
|
export { Form };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var H=(o,e)=>{for(var r in e)s(o,r,{get:e[r],enumerable:!0})},U=(o,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of C(e))!E.call(o,t)&&t!==r&&s(o,t,{get:()=>e[t],enumerable:!(i=v(e,t))||i.enumerable});return o};var W=o=>U(s({},"__esModule",{value:!0}),o);var w={};H(w,{Form:()=>d});module.exports=W(w);var u=require("react-hook-form"),l=require("react/jsx-runtime"),d=o=>{let{children:e,onSubmit:r,handleSubmit:i,control:t,register:a,formState:c,watch:m,getValues:F,setValue:f,reset:p,trigger:b,setError:V,clearErrors:h,unregister:g,setFocus:S,getFieldState:P,resetField:R,...n}=o;if(!e)return console&&console.log('The "Form" component cannot be rendered. Missing "children".'),null;let T={handleSubmit:i,control:t,register:a,formState:c,watch:m,getValues:F,setValue:f,reset:p,trigger:b,setError:V,clearErrors:h,unregister:g,setFocus:S,getFieldState:P,resetField:R,subscribe:o?.subscribe||m},y=r?{onSubmit:i((x,N)=>r(x,N)),...n}:{...n};return(0,l.jsx)(u.FormProvider,{...T,children:(0,l.jsx)("form",{...y,children:e})})};d.displayName="Form";0&&(module.exports={Form});
|
package/dist/index.m.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{FormProvider as N}from"react-hook-form";import{jsx as l}from"react/jsx-runtime";var v=e=>{let{children:o,onSubmit:r,handleSubmit:t,control:m,register:n,formState:u,watch:i,getValues:d,setValue:a,reset:c,trigger:F,setError:f,clearErrors:p,unregister:b,setFocus:V,getFieldState:h,resetField:g,...s}=e;if(!o)return console&&console.log('The "Form" component cannot be rendered. Missing "children".'),null;let S={handleSubmit:t,control:m,register:n,formState:u,watch:i,getValues:d,setValue:a,reset:c,trigger:F,setError:f,clearErrors:p,unregister:b,setFocus:V,getFieldState:h,resetField:g,subscribe:e?.subscribe||i},P=r?{onSubmit:t((R,T)=>r(R,T)),...s}:{...s};return l(N,{...S,children:l("form",{...P,children:o})})};v.displayName="Form";export{v as Form};
|