@inpulse-ui/form 3.0.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 ADDED
@@ -0,0 +1,23 @@
1
+ # @inpulse-ui/form
2
+
3
+ An abstraction layer so that you can put together your form very close to how you would in the pre-React world.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ pnpm add @inpulse-ui/form
9
+ # or
10
+ bun add @inpulse-ui/form
11
+ # or
12
+ yarn add @inpulse-ui/form
13
+ # or
14
+ npm install @inpulse-ui/form
15
+ ```
16
+
17
+ ## Documentation
18
+
19
+ Visit https://ui.inpulse.cx/components/forms/form to view the documentation.
20
+
21
+ ## License
22
+
23
+ Licensed under the [MIT license](https://github.com/inpulse-cx/ui/blob/main/LICENSE).
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { UseFormReturn, SubmitHandler, FieldValues } from 'react-hook-form';
3
+
4
+ declare const Form: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & UseFormReturn<any, any, any> & {
5
+ children?: ReactNode;
6
+ onSubmit?: SubmitHandler<FieldValues>;
7
+ } & React.RefAttributes<HTMLFormElement>>;
8
+
9
+ export { Form };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var x=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},M=(r,e,t,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of W(e))!k.call(r,o)&&o!==t&&n(r,o,{get:()=>e[o],enumerable:!(m=U(e,o))||m.enumerable});return r};var T=r=>M(n({},"__esModule",{value:!0}),r);var z={};x(z,{Form:()=>f});module.exports=T(z);var l=require("react"),a=require("react-hook-form"),i=require("react/jsx-runtime"),f=(0,l.forwardRef)((r,e)=>{let{children:t,onSubmit:m,handleSubmit:o,control:c,register:d,formState:u,watch:p,getValues:F,setValue:h,reset:R,trigger:b,setError:g,clearErrors:S,unregister:y,setFocus:P,getFieldState:E,resetField:V,subscribe:N,...s}=r;if(!t)return console&&console.log('The "Form" component cannot be rendered. Missing "children".'),null;let v={handleSubmit:o,control:c,register:d,formState:u,watch:p,getValues:F,setValue:h,reset:R,trigger:b,setError:g,clearErrors:S,unregister:y,setFocus:P,getFieldState:E,resetField:V,subscribe:N},w=m?{onSubmit:o((C,H)=>m(C,H)),...s}:{...s};return(0,i.jsx)(a.FormProvider,{...v,children:(0,i.jsx)("form",{ref:e,...w,children:t})})});f.displayName="Form";0&&(module.exports={Form});
@@ -0,0 +1 @@
1
+ import{forwardRef as C}from"react";import{FormProvider as H}from"react-hook-form";import{jsx as m}from"react/jsx-runtime";var U=C((n,i)=>{let{children:e,onSubmit:r,handleSubmit:o,control:s,register:l,formState:a,watch:f,getValues:c,setValue:d,reset:u,trigger:p,setError:F,clearErrors:h,unregister:R,setFocus:b,getFieldState:g,resetField:S,subscribe:y,...t}=n;if(!e)return console&&console.log('The "Form" component cannot be rendered. Missing "children".'),null;let P={handleSubmit:o,control:s,register:l,formState:a,watch:f,getValues:c,setValue:d,reset:u,trigger:p,setError:F,clearErrors:h,unregister:R,setFocus:b,getFieldState:g,resetField:S,subscribe:y},E=r?{onSubmit:o((V,N)=>r(V,N)),...t}:{...t};return m(H,{...P,children:m("form",{ref:i,...E,children:e})})});U.displayName="Form";export{U as Form};
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@inpulse-ui/form",
3
+ "version": "3.0.0",
4
+ "keywords": [
5
+ "form"
6
+ ],
7
+ "author": "Jo Santana <josantana@gmail.com>",
8
+ "license": "MIT",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "homepage": "https://ui.inpulse.cx",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/inpulse-cx/ui.git",
16
+ "directory": "packages/components/form"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/inpulse-cx/ui/issues"
20
+ },
21
+ "source": "./src/index.ts",
22
+ "main": "./dist/index.js",
23
+ "module": "./dist/index.m.js",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "require": "./dist/index.js",
28
+ "import": "./dist/index.m.js",
29
+ "types": "./dist/index.d.ts"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "README.md"
35
+ ],
36
+ "scripts": {
37
+ "preinstall": "npx only-allow pnpm",
38
+ "link:local": "pnpm link --global --silent",
39
+ "build": "tsup && rimraf dist/*.d.mts",
40
+ "build:watch": "tsup --watch",
41
+ "check": "tsc",
42
+ "format": "prettier --write \"**/*.{ts,tsx,md}\"",
43
+ "release": "npm publish",
44
+ "prepublishOnly": "pnpm build && pnpm check"
45
+ },
46
+ "devDependencies": {
47
+ "@types/react": "^18.2.78 || ^19.0",
48
+ "@types/react-dom": "^18.2 || ^19.0",
49
+ "typescript": "^5.0"
50
+ },
51
+ "peerDependencies": {
52
+ "@hookform/resolvers": "^5.2",
53
+ "@types/react": "*",
54
+ "@types/react-dom": "*",
55
+ "react": "^18.2 || ^19.0",
56
+ "react-dom": "^18.2 || ^19.0",
57
+ "react-hook-form": "^7.6",
58
+ "tailwindcss": "^4.1",
59
+ "zod": "^4.0"
60
+ },
61
+ "peerDependenciesMeta": {
62
+ "@types/react": {
63
+ "optional": true
64
+ },
65
+ "@types/react-dom": {
66
+ "optional": true
67
+ }
68
+ }
69
+ }