react-simple-formkit 1.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 +24 -0
- package/dist/react-ez-form.js +22 -0
- package/dist/react-ez-form.mjs +427 -0
- package/dist/react-ez-form.umd.js +22 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# React EZ Form
|
|
2
|
+
|
|
3
|
+
Support form handling simply. Simple, fast and productive.
|
|
4
|
+
|
|
5
|
+
# Quick start
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
import { Form, useForm } form 'react-ez-form'
|
|
9
|
+
|
|
10
|
+
const form = useForm();
|
|
11
|
+
const { isDirty } = form;
|
|
12
|
+
|
|
13
|
+
const handleSubmit = (data) => {
|
|
14
|
+
console.log(data);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Form form={form} onSubmit={handleSubmit}>
|
|
19
|
+
<input required name="email" />
|
|
20
|
+
<input required name="password" type="password" />
|
|
21
|
+
<button type="submit" disabled={!isDirty}>Submit</button>
|
|
22
|
+
</Form>
|
|
23
|
+
);
|
|
24
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),te=(c,o)=>{let d=!1;return Object.keys(o).forEach(f=>{if(!(f in c)||d)return;const s=o[f],a=c[f];typeof s=="object"?te(a,s)&&(d=!0):s!==a&&(d=!0)}),d},ne=()=>{const[c,o]=n.useState({}),d=n.useMemo(()=>Object.values(c).filter(Boolean).length>0,[c]),f=n.useCallback((l,E)=>{o(p=>p[l]===E?p:{...p,[l]:E})},[]),s=n.useCallback(l=>{o(E=>({...E,...l}))},[]),a=n.useCallback(l=>{o(E=>E[l]?{...E,[l]:""}:E)},[]),b=n.useCallback(()=>{o({})},[]);return{isError:d,errors:c,changeError:f,changeErrors:s,clearError:a,clearErrors:b}},z={defaultValues:{},numberFields:[]},se=(c=z)=>{const{defaultValues:o=z.defaultValues,numberFields:d=z.numberFields}=c,{changeError:f,errors:s,changeErrors:a,clearError:b,clearErrors:l,isError:E}=ne(),[p,O]=n.useState(!1),_=n.useRef({}),k=n.useRef(o),C=n.useRef({}),g=n.useRef(),y=n.useCallback((t,{shouldDirty:v=!0}={})=>{if(Object.keys(t).forEach(i=>_.current[i]=t[i]),v){const i=te(_.current,k.current);i!==p&&O(i)}},[p]),F=n.useCallback(()=>{O(!1),l();const t=C.current;Object.values(t).forEach(i=>i("")),g.current.reset(),_.current=k.current},[l]),N=n.useCallback(t=>t?_.current[t]:_.current,[]),D=n.useCallback(()=>k.current,[]),j=n.useCallback(()=>setTimeout(()=>g.current.dispatchEvent(new Event("input",{bubbles:!0}))),[]),M=n.useCallback((t,v)=>{const i=C.current;return i[t]=v,()=>i[t]=null},[]),V=n.useCallback((t,v)=>{const i=C.current;if(typeof t=="string"){const h=i[t];if(!h)throw new Error(`${t} is uncontrolled, please use Controller for it!`);h(v),j()}typeof t=="object"&&(Object.entries(t).forEach(([h,Y])=>{const I=i[h];if(!I)throw new Error(`${h} is uncontrolled, please use Controller for it!`);I(Y)}),j())},[j]),P=n.useCallback(()=>{const t=Object.fromEntries(new FormData(g.current)),v=C.current;return Object.keys(v).map(i=>{t[i]=_.current[i]}),d.forEach(i=>t.hasOwnProperty(i)&&(t[i]=+t[i])),t},[]),L=n.useMemo(()=>({setValue:V,instantChange:j,getDefaultValues:D,getFormState:N,setFormState:y,changeError:f,changeErrors:a,clearError:b,clearErrors:l,loadFormValues:P,reset:F}),[V,j,D,N,y,f,a,b,P,F]);return n.useEffect(()=>{if(g.current){const t=P();k.current={...t,...o},_.current={...t,...o}}},[]),{ref:g,isDirty:p,isError:E,errors:s,numberFields:d,subscribe:M,actions:L}};var $={exports:{}},x={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Q;function ce(){if(Q)return x;Q=1;var c=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function d(f,s,a){var b=null;if(a!==void 0&&(b=""+a),s.key!==void 0&&(b=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:c,type:f,key:b,ref:s!==void 0?s:null,props:a}}return x.Fragment=o,x.jsx=d,x.jsxs=d,x}var A={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var K;function ue(){return K||(K=1,process.env.NODE_ENV!=="production"&&function(){function c(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===i?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case N:return"Profiler";case F:return"StrictMode";case V:return"Suspense";case P:return"SuspenseList";case v:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case g:return"Portal";case j:return(e.displayName||"Context")+".Provider";case D:return(e._context.displayName||"Context")+".Consumer";case M:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return r=e.displayName||null,r!==null?r:c(e.type)||"Memo";case t:r=e._payload,e=e._init;try{return c(e(r))}catch{}}return null}function o(e){return""+e}function d(e){try{o(e);var r=!1}catch{r=!0}if(r){r=console;var u=r.error,m=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return u.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",m),o(e)}}function f(e){if(e===y)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===t)return"<...>";try{var r=c(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function s(){var e=h.A;return e===null?null:e.getOwner()}function a(){return Error("react-stack-top-frame")}function b(e){if(Y.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function l(e,r){function u(){G||(G=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}u.isReactWarning=!0,Object.defineProperty(e,"key",{get:u,configurable:!0})}function E(){var e=c(this.type);return X[e]||(X[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function p(e,r,u,m,S,T,U,q){return u=T.ref,e={$$typeof:C,type:e,key:r,props:T,_owner:S},(u!==void 0?u:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:E}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function O(e,r,u,m,S,T,U,q){var R=r.children;if(R!==void 0)if(m)if(I(R)){for(m=0;m<R.length;m++)_(R[m]);Object.freeze&&Object.freeze(R)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else _(R);if(Y.call(r,"key")){R=c(e);var w=Object.keys(r).filter(function(ae){return ae!=="key"});m=0<w.length?"{key: someKey, "+w.join(": ..., ")+": ...}":"{key: someKey}",Z[R+m]||(w=0<w.length?"{"+w.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,m,R,w,R),Z[R+m]=!0)}if(R=null,u!==void 0&&(d(u),R=""+u),b(r)&&(d(r.key),R=""+r.key),"key"in r){u={};for(var J in r)J!=="key"&&(u[J]=r[J])}else u=r;return R&&l(u,typeof e=="function"?e.displayName||e.name||"Unknown":e),p(e,R,T,S,s(),u,U,q)}function _(e){typeof e=="object"&&e!==null&&e.$$typeof===C&&e._store&&(e._store.validated=1)}var k=n,C=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),j=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),t=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),i=Symbol.for("react.client.reference"),h=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,I=Array.isArray,W=console.createTask?console.createTask:function(){return null};k={"react-stack-bottom-frame":function(e){return e()}};var G,X={},B=k["react-stack-bottom-frame"].bind(k,a)(),H=W(f(a)),Z={};A.Fragment=y,A.jsx=function(e,r,u,m,S){var T=1e4>h.recentlyCreatedOwnerStacks++;return O(e,r,u,!1,m,S,T?Error("react-stack-top-frame"):B,T?W(f(e)):H)},A.jsxs=function(e,r,u,m,S){var T=1e4>h.recentlyCreatedOwnerStacks++;return O(e,r,u,!0,m,S,T?Error("react-stack-top-frame"):B,T?W(f(e)):H)}}()),A}var ee;function le(){return ee||(ee=1,process.env.NODE_ENV==="production"?$.exports=ce():$.exports=ue()),$.exports}var re=le();const oe=n.createContext({}),ie=()=>n.useContext(oe),fe=({id:c,form:o,method:d,action:f,children:s,onSubmit:a=()=>{},onInput:b=()=>{},onChange:l=()=>{},numberFields:E=[],className:p,...O})=>re.jsx(oe.Provider,{value:o,children:re.jsx("form",{ref:o==null?void 0:o.ref,action:f,className:p,onSubmit:_=>{_.preventDefault();const k=o.actions.loadFormValues();a(k)},onChange:_=>{const k=o.actions.loadFormValues();o.actions.setFormState(k),l(k)},...O,children:s})}),de=({name:c,defaultValue:o,render:d=({ref:f,name:s,defaultValue:a,value:b,setValue:l})=>null})=>{const[f,s]=n.useState(),a=ie(),b=n.useRef(),l=n.useCallback(E=>{a.actions.setFormState({[c]:E},{shouldDirty:!1}),s(E)},[s,a.actions.setFormState]);return n.useEffect(()=>(a.actions.setFormState({[c]:o},{shouldDirty:!1}),a.subscribe(c,p=>{s(p),a.actions.setFormState({[c]:p},{shouldDirty:!0}),b.current&&typeof b.current.dispatchEvent=="function"&&b.current.dispatchEvent(new Event("change"))})),[]),d({ref:b,name:c,defaultValue:o,value:f,setValue:l})};exports.Controller=de;exports.Form=fe;exports.useForm=se;exports.useValidateForm=ne;
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import le, { useState as X, useMemo as oe, useCallback as v, useRef as C, useEffect as se, createContext as ie, useContext as fe } from "react";
|
|
2
|
+
const ae = (a, n) => {
|
|
3
|
+
let f = !1;
|
|
4
|
+
return Object.keys(n).forEach((i) => {
|
|
5
|
+
if (!(i in a) || f) return;
|
|
6
|
+
const s = n[i], o = a[i];
|
|
7
|
+
typeof s == "object" ? ae(o, s) && (f = !0) : s !== o && (f = !0);
|
|
8
|
+
}), f;
|
|
9
|
+
}, de = () => {
|
|
10
|
+
const [a, n] = X({}), f = oe(() => Object.values(a).filter(Boolean).length > 0, [a]), i = v((u, E) => {
|
|
11
|
+
n((R) => R[u] === E ? R : { ...R, [u]: E });
|
|
12
|
+
}, []), s = v((u) => {
|
|
13
|
+
n((E) => ({ ...E, ...u }));
|
|
14
|
+
}, []), o = v((u) => {
|
|
15
|
+
n((E) => E[u] ? { ...E, [u]: "" } : E);
|
|
16
|
+
}, []), d = v(() => {
|
|
17
|
+
n({});
|
|
18
|
+
}, []);
|
|
19
|
+
return { isError: f, errors: a, changeError: i, changeErrors: s, clearError: o, clearErrors: d };
|
|
20
|
+
}, G = {
|
|
21
|
+
defaultValues: {},
|
|
22
|
+
numberFields: []
|
|
23
|
+
}, _e = (a = G) => {
|
|
24
|
+
const { defaultValues: n = G.defaultValues, numberFields: f = G.numberFields } = a, { changeError: i, errors: s, changeErrors: o, clearError: d, clearErrors: u, isError: E } = de(), [R, O] = X(!1), _ = C({}), p = C(n), j = C({}), g = C(), y = v(
|
|
25
|
+
(t, { shouldDirty: T = !0 } = {}) => {
|
|
26
|
+
if (Object.keys(t).forEach((l) => _.current[l] = t[l]), T) {
|
|
27
|
+
const l = ae(_.current, p.current);
|
|
28
|
+
l !== R && O(l);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
[R]
|
|
32
|
+
), N = v(() => {
|
|
33
|
+
O(!1), u();
|
|
34
|
+
const t = j.current;
|
|
35
|
+
Object.values(t).forEach((l) => l("")), g.current.reset(), _.current = p.current;
|
|
36
|
+
}, [u]), D = v((t) => t ? _.current[t] : _.current, []), Y = v(() => p.current, []), w = v(
|
|
37
|
+
() => setTimeout(() => g.current.dispatchEvent(new Event("input", { bubbles: !0 }))),
|
|
38
|
+
[]
|
|
39
|
+
), M = v((t, T) => {
|
|
40
|
+
const l = j.current;
|
|
41
|
+
return l[t] = T, () => l[t] = null;
|
|
42
|
+
}, []), V = v(
|
|
43
|
+
(t, T) => {
|
|
44
|
+
const l = j.current;
|
|
45
|
+
if (typeof t == "string") {
|
|
46
|
+
const k = l[t];
|
|
47
|
+
if (!k)
|
|
48
|
+
throw new Error(`${t} is uncontrolled, please use Controller for it!`);
|
|
49
|
+
k(T), w();
|
|
50
|
+
}
|
|
51
|
+
typeof t == "object" && (Object.entries(t).forEach(([k, I]) => {
|
|
52
|
+
const $ = l[k];
|
|
53
|
+
if (!$)
|
|
54
|
+
throw new Error(`${k} is uncontrolled, please use Controller for it!`);
|
|
55
|
+
$(I);
|
|
56
|
+
}), w());
|
|
57
|
+
},
|
|
58
|
+
[w]
|
|
59
|
+
), A = v(() => {
|
|
60
|
+
const t = Object.fromEntries(new FormData(g.current)), T = j.current;
|
|
61
|
+
return Object.keys(T).map((l) => {
|
|
62
|
+
t[l] = _.current[l];
|
|
63
|
+
}), f.forEach((l) => t.hasOwnProperty(l) && (t[l] = +t[l])), t;
|
|
64
|
+
}, []), W = oe(
|
|
65
|
+
() => ({
|
|
66
|
+
setValue: V,
|
|
67
|
+
instantChange: w,
|
|
68
|
+
getDefaultValues: Y,
|
|
69
|
+
getFormState: D,
|
|
70
|
+
setFormState: y,
|
|
71
|
+
changeError: i,
|
|
72
|
+
changeErrors: o,
|
|
73
|
+
clearError: d,
|
|
74
|
+
clearErrors: u,
|
|
75
|
+
loadFormValues: A,
|
|
76
|
+
reset: N
|
|
77
|
+
}),
|
|
78
|
+
[
|
|
79
|
+
V,
|
|
80
|
+
w,
|
|
81
|
+
Y,
|
|
82
|
+
D,
|
|
83
|
+
y,
|
|
84
|
+
i,
|
|
85
|
+
o,
|
|
86
|
+
d,
|
|
87
|
+
A,
|
|
88
|
+
N
|
|
89
|
+
]
|
|
90
|
+
);
|
|
91
|
+
return se(() => {
|
|
92
|
+
if (g.current) {
|
|
93
|
+
const t = A();
|
|
94
|
+
p.current = { ...t, ...n }, _.current = { ...t, ...n };
|
|
95
|
+
}
|
|
96
|
+
}, []), { ref: g, isDirty: R, isError: E, errors: s, numberFields: f, subscribe: M, actions: W };
|
|
97
|
+
};
|
|
98
|
+
var L = { exports: {} }, P = {};
|
|
99
|
+
/**
|
|
100
|
+
* @license React
|
|
101
|
+
* react-jsx-runtime.production.js
|
|
102
|
+
*
|
|
103
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the MIT license found in the
|
|
106
|
+
* LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/
|
|
108
|
+
var ee;
|
|
109
|
+
function Ee() {
|
|
110
|
+
if (ee) return P;
|
|
111
|
+
ee = 1;
|
|
112
|
+
var a = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
113
|
+
function f(i, s, o) {
|
|
114
|
+
var d = null;
|
|
115
|
+
if (o !== void 0 && (d = "" + o), s.key !== void 0 && (d = "" + s.key), "key" in s) {
|
|
116
|
+
o = {};
|
|
117
|
+
for (var u in s)
|
|
118
|
+
u !== "key" && (o[u] = s[u]);
|
|
119
|
+
} else o = s;
|
|
120
|
+
return s = o.ref, {
|
|
121
|
+
$$typeof: a,
|
|
122
|
+
type: i,
|
|
123
|
+
key: d,
|
|
124
|
+
ref: s !== void 0 ? s : null,
|
|
125
|
+
props: o
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return P.Fragment = n, P.jsx = f, P.jsxs = f, P;
|
|
129
|
+
}
|
|
130
|
+
var F = {};
|
|
131
|
+
/**
|
|
132
|
+
* @license React
|
|
133
|
+
* react-jsx-runtime.development.js
|
|
134
|
+
*
|
|
135
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
136
|
+
*
|
|
137
|
+
* This source code is licensed under the MIT license found in the
|
|
138
|
+
* LICENSE file in the root directory of this source tree.
|
|
139
|
+
*/
|
|
140
|
+
var re;
|
|
141
|
+
function me() {
|
|
142
|
+
return re || (re = 1, process.env.NODE_ENV !== "production" && function() {
|
|
143
|
+
function a(e) {
|
|
144
|
+
if (e == null) return null;
|
|
145
|
+
if (typeof e == "function")
|
|
146
|
+
return e.$$typeof === l ? null : e.displayName || e.name || null;
|
|
147
|
+
if (typeof e == "string") return e;
|
|
148
|
+
switch (e) {
|
|
149
|
+
case y:
|
|
150
|
+
return "Fragment";
|
|
151
|
+
case D:
|
|
152
|
+
return "Profiler";
|
|
153
|
+
case N:
|
|
154
|
+
return "StrictMode";
|
|
155
|
+
case V:
|
|
156
|
+
return "Suspense";
|
|
157
|
+
case A:
|
|
158
|
+
return "SuspenseList";
|
|
159
|
+
case T:
|
|
160
|
+
return "Activity";
|
|
161
|
+
}
|
|
162
|
+
if (typeof e == "object")
|
|
163
|
+
switch (typeof e.tag == "number" && console.error(
|
|
164
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
165
|
+
), e.$$typeof) {
|
|
166
|
+
case g:
|
|
167
|
+
return "Portal";
|
|
168
|
+
case w:
|
|
169
|
+
return (e.displayName || "Context") + ".Provider";
|
|
170
|
+
case Y:
|
|
171
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
172
|
+
case M:
|
|
173
|
+
var r = e.render;
|
|
174
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
175
|
+
case W:
|
|
176
|
+
return r = e.displayName || null, r !== null ? r : a(e.type) || "Memo";
|
|
177
|
+
case t:
|
|
178
|
+
r = e._payload, e = e._init;
|
|
179
|
+
try {
|
|
180
|
+
return a(e(r));
|
|
181
|
+
} catch {
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
function n(e) {
|
|
187
|
+
return "" + e;
|
|
188
|
+
}
|
|
189
|
+
function f(e) {
|
|
190
|
+
try {
|
|
191
|
+
n(e);
|
|
192
|
+
var r = !1;
|
|
193
|
+
} catch {
|
|
194
|
+
r = !0;
|
|
195
|
+
}
|
|
196
|
+
if (r) {
|
|
197
|
+
r = console;
|
|
198
|
+
var c = r.error, m = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
199
|
+
return c.call(
|
|
200
|
+
r,
|
|
201
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
202
|
+
m
|
|
203
|
+
), n(e);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function i(e) {
|
|
207
|
+
if (e === y) return "<>";
|
|
208
|
+
if (typeof e == "object" && e !== null && e.$$typeof === t)
|
|
209
|
+
return "<...>";
|
|
210
|
+
try {
|
|
211
|
+
var r = a(e);
|
|
212
|
+
return r ? "<" + r + ">" : "<...>";
|
|
213
|
+
} catch {
|
|
214
|
+
return "<...>";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function s() {
|
|
218
|
+
var e = k.A;
|
|
219
|
+
return e === null ? null : e.getOwner();
|
|
220
|
+
}
|
|
221
|
+
function o() {
|
|
222
|
+
return Error("react-stack-top-frame");
|
|
223
|
+
}
|
|
224
|
+
function d(e) {
|
|
225
|
+
if (I.call(e, "key")) {
|
|
226
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
227
|
+
if (r && r.isReactWarning) return !1;
|
|
228
|
+
}
|
|
229
|
+
return e.key !== void 0;
|
|
230
|
+
}
|
|
231
|
+
function u(e, r) {
|
|
232
|
+
function c() {
|
|
233
|
+
B || (B = !0, console.error(
|
|
234
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
235
|
+
r
|
|
236
|
+
));
|
|
237
|
+
}
|
|
238
|
+
c.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
239
|
+
get: c,
|
|
240
|
+
configurable: !0
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function E() {
|
|
244
|
+
var e = a(this.type);
|
|
245
|
+
return H[e] || (H[e] = !0, console.error(
|
|
246
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
247
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
248
|
+
}
|
|
249
|
+
function R(e, r, c, m, S, h, q, J) {
|
|
250
|
+
return c = h.ref, e = {
|
|
251
|
+
$$typeof: j,
|
|
252
|
+
type: e,
|
|
253
|
+
key: r,
|
|
254
|
+
props: h,
|
|
255
|
+
_owner: S
|
|
256
|
+
}, (c !== void 0 ? c : null) !== null ? Object.defineProperty(e, "ref", {
|
|
257
|
+
enumerable: !1,
|
|
258
|
+
get: E
|
|
259
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
260
|
+
configurable: !1,
|
|
261
|
+
enumerable: !1,
|
|
262
|
+
writable: !0,
|
|
263
|
+
value: 0
|
|
264
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
265
|
+
configurable: !1,
|
|
266
|
+
enumerable: !1,
|
|
267
|
+
writable: !0,
|
|
268
|
+
value: null
|
|
269
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
270
|
+
configurable: !1,
|
|
271
|
+
enumerable: !1,
|
|
272
|
+
writable: !0,
|
|
273
|
+
value: q
|
|
274
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
275
|
+
configurable: !1,
|
|
276
|
+
enumerable: !1,
|
|
277
|
+
writable: !0,
|
|
278
|
+
value: J
|
|
279
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
280
|
+
}
|
|
281
|
+
function O(e, r, c, m, S, h, q, J) {
|
|
282
|
+
var b = r.children;
|
|
283
|
+
if (b !== void 0)
|
|
284
|
+
if (m)
|
|
285
|
+
if ($(b)) {
|
|
286
|
+
for (m = 0; m < b.length; m++)
|
|
287
|
+
_(b[m]);
|
|
288
|
+
Object.freeze && Object.freeze(b);
|
|
289
|
+
} else
|
|
290
|
+
console.error(
|
|
291
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
292
|
+
);
|
|
293
|
+
else _(b);
|
|
294
|
+
if (I.call(r, "key")) {
|
|
295
|
+
b = a(e);
|
|
296
|
+
var x = Object.keys(r).filter(function(ue) {
|
|
297
|
+
return ue !== "key";
|
|
298
|
+
});
|
|
299
|
+
m = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", K[b + m] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
300
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
301
|
+
let props = %s;
|
|
302
|
+
<%s {...props} />
|
|
303
|
+
React keys must be passed directly to JSX without using spread:
|
|
304
|
+
let props = %s;
|
|
305
|
+
<%s key={someKey} {...props} />`,
|
|
306
|
+
m,
|
|
307
|
+
b,
|
|
308
|
+
x,
|
|
309
|
+
b
|
|
310
|
+
), K[b + m] = !0);
|
|
311
|
+
}
|
|
312
|
+
if (b = null, c !== void 0 && (f(c), b = "" + c), d(r) && (f(r.key), b = "" + r.key), "key" in r) {
|
|
313
|
+
c = {};
|
|
314
|
+
for (var z in r)
|
|
315
|
+
z !== "key" && (c[z] = r[z]);
|
|
316
|
+
} else c = r;
|
|
317
|
+
return b && u(
|
|
318
|
+
c,
|
|
319
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
320
|
+
), R(
|
|
321
|
+
e,
|
|
322
|
+
b,
|
|
323
|
+
h,
|
|
324
|
+
S,
|
|
325
|
+
s(),
|
|
326
|
+
c,
|
|
327
|
+
q,
|
|
328
|
+
J
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
function _(e) {
|
|
332
|
+
typeof e == "object" && e !== null && e.$$typeof === j && e._store && (e._store.validated = 1);
|
|
333
|
+
}
|
|
334
|
+
var p = le, j = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), N = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), Y = Symbol.for("react.consumer"), w = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), V = Symbol.for("react.suspense"), A = Symbol.for("react.suspense_list"), W = Symbol.for("react.memo"), t = Symbol.for("react.lazy"), T = Symbol.for("react.activity"), l = Symbol.for("react.client.reference"), k = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, $ = Array.isArray, U = console.createTask ? console.createTask : function() {
|
|
335
|
+
return null;
|
|
336
|
+
};
|
|
337
|
+
p = {
|
|
338
|
+
"react-stack-bottom-frame": function(e) {
|
|
339
|
+
return e();
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
var B, H = {}, Z = p["react-stack-bottom-frame"].bind(
|
|
343
|
+
p,
|
|
344
|
+
o
|
|
345
|
+
)(), Q = U(i(o)), K = {};
|
|
346
|
+
F.Fragment = y, F.jsx = function(e, r, c, m, S) {
|
|
347
|
+
var h = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
348
|
+
return O(
|
|
349
|
+
e,
|
|
350
|
+
r,
|
|
351
|
+
c,
|
|
352
|
+
!1,
|
|
353
|
+
m,
|
|
354
|
+
S,
|
|
355
|
+
h ? Error("react-stack-top-frame") : Z,
|
|
356
|
+
h ? U(i(e)) : Q
|
|
357
|
+
);
|
|
358
|
+
}, F.jsxs = function(e, r, c, m, S) {
|
|
359
|
+
var h = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
360
|
+
return O(
|
|
361
|
+
e,
|
|
362
|
+
r,
|
|
363
|
+
c,
|
|
364
|
+
!0,
|
|
365
|
+
m,
|
|
366
|
+
S,
|
|
367
|
+
h ? Error("react-stack-top-frame") : Z,
|
|
368
|
+
h ? U(i(e)) : Q
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
}()), F;
|
|
372
|
+
}
|
|
373
|
+
var te;
|
|
374
|
+
function be() {
|
|
375
|
+
return te || (te = 1, process.env.NODE_ENV === "production" ? L.exports = Ee() : L.exports = me()), L.exports;
|
|
376
|
+
}
|
|
377
|
+
var ne = be();
|
|
378
|
+
const ce = ie({}), Re = () => fe(ce), ve = ({
|
|
379
|
+
id: a,
|
|
380
|
+
form: n,
|
|
381
|
+
method: f,
|
|
382
|
+
action: i,
|
|
383
|
+
children: s,
|
|
384
|
+
onSubmit: o = () => {
|
|
385
|
+
},
|
|
386
|
+
onInput: d = () => {
|
|
387
|
+
},
|
|
388
|
+
onChange: u = () => {
|
|
389
|
+
},
|
|
390
|
+
numberFields: E = [],
|
|
391
|
+
className: R,
|
|
392
|
+
...O
|
|
393
|
+
}) => /* @__PURE__ */ ne.jsx(ce.Provider, { value: n, children: /* @__PURE__ */ ne.jsx(
|
|
394
|
+
"form",
|
|
395
|
+
{
|
|
396
|
+
ref: n == null ? void 0 : n.ref,
|
|
397
|
+
action: i,
|
|
398
|
+
className: R,
|
|
399
|
+
onSubmit: (_) => {
|
|
400
|
+
_.preventDefault();
|
|
401
|
+
const p = n.actions.loadFormValues();
|
|
402
|
+
o(p);
|
|
403
|
+
},
|
|
404
|
+
onChange: (_) => {
|
|
405
|
+
const p = n.actions.loadFormValues();
|
|
406
|
+
n.actions.setFormState(p), u(p);
|
|
407
|
+
},
|
|
408
|
+
...O,
|
|
409
|
+
children: s
|
|
410
|
+
}
|
|
411
|
+
) }), Te = ({ name: a, defaultValue: n, render: f = ({ ref: i, name: s, defaultValue: o, value: d, setValue: u }) => null }) => {
|
|
412
|
+
const [i, s] = X(), o = Re(), d = C(), u = v(
|
|
413
|
+
(E) => {
|
|
414
|
+
o.actions.setFormState({ [a]: E }, { shouldDirty: !1 }), s(E);
|
|
415
|
+
},
|
|
416
|
+
[s, o.actions.setFormState]
|
|
417
|
+
);
|
|
418
|
+
return se(() => (o.actions.setFormState({ [a]: n }, { shouldDirty: !1 }), o.subscribe(a, (R) => {
|
|
419
|
+
s(R), o.actions.setFormState({ [a]: R }, { shouldDirty: !0 }), d.current && typeof d.current.dispatchEvent == "function" && d.current.dispatchEvent(new Event("change"));
|
|
420
|
+
})), []), f({ ref: d, name: a, defaultValue: n, value: i, setValue: u });
|
|
421
|
+
};
|
|
422
|
+
export {
|
|
423
|
+
Te as Controller,
|
|
424
|
+
ve as Form,
|
|
425
|
+
_e as useForm,
|
|
426
|
+
de as useValidateForm
|
|
427
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(function(_,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],r):(_=typeof globalThis<"u"?globalThis:_||self,r(_.Name={},_.React))})(this,function(_,r){"use strict";const H=(c,o)=>{let d=!1;return Object.keys(o).forEach(f=>{if(!(f in c)||d)return;const s=o[f],a=c[f];typeof s=="object"?H(a,s)&&(d=!0):s!==a&&(d=!0)}),d},Z=()=>{const[c,o]=r.useState({}),d=r.useMemo(()=>Object.values(c).filter(Boolean).length>0,[c]),f=r.useCallback((l,m)=>{o(p=>p[l]===m?p:{...p,[l]:m})},[]),s=r.useCallback(l=>{o(m=>({...m,...l}))},[]),a=r.useCallback(l=>{o(m=>m[l]?{...m,[l]:""}:m)},[]),b=r.useCallback(()=>{o({})},[]);return{isError:d,errors:c,changeError:f,changeErrors:s,clearError:a,clearErrors:b}},W={defaultValues:{},numberFields:[]},se=(c=W)=>{const{defaultValues:o=W.defaultValues,numberFields:d=W.numberFields}=c,{changeError:f,errors:s,changeErrors:a,clearError:b,clearErrors:l,isError:m}=Z(),[p,j]=r.useState(!1),T=r.useRef({}),k=r.useRef(o),y=r.useRef({}),C=r.useRef(),w=r.useCallback((n,{shouldDirty:v=!0}={})=>{if(Object.keys(n).forEach(i=>T.current[i]=n[i]),v){const i=H(T.current,k.current);i!==p&&j(i)}},[p]),D=r.useCallback(()=>{j(!1),l();const n=y.current;Object.values(n).forEach(i=>i("")),C.current.reset(),T.current=k.current},[l]),V=r.useCallback(n=>n?T.current[n]:T.current,[]),Y=r.useCallback(()=>k.current,[]),g=r.useCallback(()=>setTimeout(()=>C.current.dispatchEvent(new Event("input",{bubbles:!0}))),[]),U=r.useCallback((n,v)=>{const i=y.current;return i[n]=v,()=>i[n]=null},[]),I=r.useCallback((n,v)=>{const i=y.current;if(typeof n=="string"){const S=i[n];if(!S)throw new Error(`${n} is uncontrolled, please use Controller for it!`);S(v),g()}typeof n=="object"&&(Object.entries(n).forEach(([S,M])=>{const L=i[S];if(!L)throw new Error(`${S} is uncontrolled, please use Controller for it!`);L(M)}),g())},[g]),x=r.useCallback(()=>{const n=Object.fromEntries(new FormData(C.current)),v=y.current;return Object.keys(v).map(i=>{n[i]=T.current[i]}),d.forEach(i=>n.hasOwnProperty(i)&&(n[i]=+n[i])),n},[]),J=r.useMemo(()=>({setValue:I,instantChange:g,getDefaultValues:Y,getFormState:V,setFormState:w,changeError:f,changeErrors:a,clearError:b,clearErrors:l,loadFormValues:x,reset:D}),[I,g,Y,V,w,f,a,b,x,D]);return r.useEffect(()=>{if(C.current){const n=x();k.current={...n,...o},T.current={...n,...o}}},[]),{ref:C,isDirty:p,isError:m,errors:s,numberFields:d,subscribe:U,actions:J}};var N={exports:{}},A={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Q;function ce(){if(Q)return A;Q=1;var c=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function d(f,s,a){var b=null;if(a!==void 0&&(b=""+a),s.key!==void 0&&(b=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:c,type:f,key:b,ref:s!==void 0?s:null,props:a}}return A.Fragment=o,A.jsx=d,A.jsxs=d,A}var F={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var K;function ue(){return K||(K=1,process.env.NODE_ENV!=="production"&&function(){function c(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===i?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case V:return"Profiler";case D:return"StrictMode";case I:return"Suspense";case x:return"SuspenseList";case v:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case C:return"Portal";case g:return(e.displayName||"Context")+".Provider";case Y:return(e._context.displayName||"Context")+".Consumer";case U:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case J:return t=e.displayName||null,t!==null?t:c(e.type)||"Memo";case n:t=e._payload,e=e._init;try{return c(e(t))}catch{}}return null}function o(e){return""+e}function d(e){try{o(e);var t=!1}catch{t=!0}if(t){t=console;var u=t.error,E=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return u.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",E),o(e)}}function f(e){if(e===w)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===n)return"<...>";try{var t=c(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function s(){var e=S.A;return e===null?null:e.getOwner()}function a(){return Error("react-stack-top-frame")}function b(e){if(M.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function l(e,t){function u(){te||(te=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}u.isReactWarning=!0,Object.defineProperty(e,"key",{get:u,configurable:!0})}function m(){var e=c(this.type);return re[e]||(re[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function p(e,t,u,E,O,h,G,X){return u=h.ref,e={$$typeof:y,type:e,key:t,props:h,_owner:O},(u!==void 0?u:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:m}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function j(e,t,u,E,O,h,G,X){var R=t.children;if(R!==void 0)if(E)if(L(R)){for(E=0;E<R.length;E++)T(R[E]);Object.freeze&&Object.freeze(R)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else T(R);if(M.call(t,"key")){R=c(e);var P=Object.keys(t).filter(function(be){return be!=="key"});E=0<P.length?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}",ae[R+E]||(P=0<P.length?"{"+P.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,E,R,P,R),ae[R+E]=!0)}if(R=null,u!==void 0&&(d(u),R=""+u),b(t)&&(d(t.key),R=""+t.key),"key"in t){u={};for(var B in t)B!=="key"&&(u[B]=t[B])}else u=t;return R&&l(u,typeof e=="function"?e.displayName||e.name||"Unknown":e),p(e,R,h,O,s(),u,G,X)}function T(e){typeof e=="object"&&e!==null&&e.$$typeof===y&&e._store&&(e._store.validated=1)}var k=r,y=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),g=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),n=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),i=Symbol.for("react.client.reference"),S=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,L=Array.isArray,z=console.createTask?console.createTask:function(){return null};k={"react-stack-bottom-frame":function(e){return e()}};var te,re={},ne=k["react-stack-bottom-frame"].bind(k,a)(),oe=z(f(a)),ae={};F.Fragment=w,F.jsx=function(e,t,u,E,O){var h=1e4>S.recentlyCreatedOwnerStacks++;return j(e,t,u,!1,E,O,h?Error("react-stack-top-frame"):ne,h?z(f(e)):oe)},F.jsxs=function(e,t,u,E,O){var h=1e4>S.recentlyCreatedOwnerStacks++;return j(e,t,u,!0,E,O,h?Error("react-stack-top-frame"):ne,h?z(f(e)):oe)}}()),F}var q;function le(){return q||(q=1,process.env.NODE_ENV==="production"?N.exports=ce():N.exports=ue()),N.exports}var $=le();const ee=r.createContext({}),ie=()=>r.useContext(ee),fe=({id:c,form:o,method:d,action:f,children:s,onSubmit:a=()=>{},onInput:b=()=>{},onChange:l=()=>{},numberFields:m=[],className:p,...j})=>$.jsx(ee.Provider,{value:o,children:$.jsx("form",{ref:o==null?void 0:o.ref,action:f,className:p,onSubmit:T=>{T.preventDefault();const k=o.actions.loadFormValues();a(k)},onChange:T=>{const k=o.actions.loadFormValues();o.actions.setFormState(k),l(k)},...j,children:s})}),de=({name:c,defaultValue:o,render:d=({ref:f,name:s,defaultValue:a,value:b,setValue:l})=>null})=>{const[f,s]=r.useState(),a=ie(),b=r.useRef(),l=r.useCallback(m=>{a.actions.setFormState({[c]:m},{shouldDirty:!1}),s(m)},[s,a.actions.setFormState]);return r.useEffect(()=>(a.actions.setFormState({[c]:o},{shouldDirty:!1}),a.subscribe(c,p=>{s(p),a.actions.setFormState({[c]:p},{shouldDirty:!0}),b.current&&typeof b.current.dispatchEvent=="function"&&b.current.dispatchEvent(new Event("change"))})),[]),d({ref:b,name:c,defaultValue:o,value:f,setValue:l})};_.Controller=de,_.Form=fe,_.useForm=se,_.useValidateForm=Z,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-simple-formkit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"react formkit",
|
|
6
|
+
"react ez formkit",
|
|
7
|
+
"react easy formkit",
|
|
8
|
+
"react simple formkit",
|
|
9
|
+
"react simple formkit",
|
|
10
|
+
"simple formkit",
|
|
11
|
+
"easy formkit",
|
|
12
|
+
"ez formkit"
|
|
13
|
+
],
|
|
14
|
+
"description": "Support form handling simply. Simple, fast and productive.",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"main": "dist/react-simple-formkit.js",
|
|
19
|
+
"module": "dist/react-simple-formkit.mjs",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/huynguyen294/react-simple-formkit.git"
|
|
23
|
+
},
|
|
24
|
+
"author": "huynguyen294",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "vite build",
|
|
28
|
+
"prepublish": "vite build",
|
|
29
|
+
"publish": "npm publish",
|
|
30
|
+
"dev": "vite"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@vitejs/plugin-react": "^4.4.1",
|
|
35
|
+
"react": "^19.1.0",
|
|
36
|
+
"react-dom": "^19.1.0",
|
|
37
|
+
"vite": "^6.0.7"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "^19.1.0",
|
|
41
|
+
"react-dom": "^19.1.0"
|
|
42
|
+
}
|
|
43
|
+
}
|