react-simple-formkit 1.1.16 → 1.3.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 +5 -5
- package/dist/react-simple-formkit.js +4 -4
- package/dist/react-simple-formkit.mjs +286 -275
- package/dist/react-simple-formkit.umd.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# React Simple FormKit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Configuration is simple, fast, and efficient. There are also many other tools available for different special scenarios.
|
|
4
|
+
|
|
5
|
+
# Examples
|
|
6
|
+
|
|
7
|
+
- https://codesandbox.io/p/sandbox/react-simple-formkit-examples-rhmhjj
|
|
4
8
|
|
|
5
9
|
# Peer dependencies
|
|
6
10
|
|
|
@@ -338,10 +342,6 @@ return (
|
|
|
338
342
|
)
|
|
339
343
|
```
|
|
340
344
|
|
|
341
|
-
# Examples
|
|
342
|
-
|
|
343
|
-
- https://codesandbox.io/p/sandbox/react-simple-formkit-examples-rhmhjj
|
|
344
|
-
|
|
345
345
|
# Contact
|
|
346
346
|
|
|
347
347
|
For any ideas or issues, please get in touch with me at anhhuy2000@gmail.com
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react");var z={exports:{}},I={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Z;function
|
|
9
|
+
*/var Z;function se(){if(Z)return I;Z=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(l,u,i){var E=null;if(i!==void 0&&(E=""+i),u.key!==void 0&&(E=""+u.key),"key"in u){i={};for(var d in u)d!=="key"&&(i[d]=u[d])}else i=u;return u=i.ref,{$$typeof:a,type:l,key:E,ref:u!==void 0?u:null,props:i}}return I.Fragment=s,I.jsx=o,I.jsxs=o,I}var $={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Q;function
|
|
17
|
+
*/var Q;function oe(){return Q||(Q=1,process.env.NODE_ENV!=="production"&&function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case V:return"Profiler";case A:return"StrictMode";case G:return"Suspense";case W:return"SuspenseList";case U: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 M:return(e.displayName||"Context")+".Provider";case y:return(e._context.displayName||"Context")+".Consumer";case L:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return r=e.displayName||null,r!==null?r:a(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return a(e(r))}catch{}}return null}function s(e){return""+e}function o(e){try{s(e);var r=!1}catch{r=!0}if(r){r=console;var c=r.error,k=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",k),s(e)}}function l(e){if(e===h)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=a(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function u(){var e=F.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function E(e){if(D.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function d(e,r){function c(){J||(J=!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))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function b(){var e=a(this.type);return t[e]||(t[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 v(e,r,c,k,C,w,X,B){return c=w.ref,e={$$typeof:N,type:e,key:r,props:w,_owner:C},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:b}):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:X}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function p(e,r,c,k,C,w,X,B){var _=r.children;if(_!==void 0)if(k)if(Y(_)){for(k=0;k<_.length;k++)m(_[k]);Object.freeze&&Object.freeze(_)}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 m(_);if(D.call(r,"key")){_=a(e);var x=Object.keys(r).filter(function(ae){return ae!=="key"});k=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",S[_+k]||(x=0<x.length?"{"+x.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,k,_,x,_),S[_+k]=!0)}if(_=null,c!==void 0&&(o(c),_=""+c),E(r)&&(o(r.key),_=""+r.key),"key"in r){c={};for(var H in r)H!=="key"&&(c[H]=r[H])}else c=r;return _&&d(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),v(e,_,w,C,u(),c,X,B)}function m(e){typeof e=="object"&&e!==null&&e.$$typeof===N&&e._store&&(e._store.validated=1)}var T=n,N=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),M=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),j=Symbol.for("react.client.reference"),F=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,Y=Array.isArray,P=console.createTask?console.createTask:function(){return null};T={"react-stack-bottom-frame":function(e){return e()}};var J,t={},f=T["react-stack-bottom-frame"].bind(T,i)(),R=P(l(i)),S={};$.Fragment=h,$.jsx=function(e,r,c,k,C){var w=1e4>F.recentlyCreatedOwnerStacks++;return p(e,r,c,!1,k,C,w?Error("react-stack-top-frame"):f,w?P(l(e)):R)},$.jsxs=function(e,r,c,k,C){var w=1e4>F.recentlyCreatedOwnerStacks++;return p(e,r,c,!0,k,C,w?Error("react-stack-top-frame"):f,w?P(l(e)):R)}}()),$}var K;function ce(){return K||(K=1,process.env.NODE_ENV==="production"?z.exports=se():z.exports=oe()),z.exports}var ee=ce();const te=n.createContext({}),ue=()=>n.useContext(te),le=({id:a,form:s,method:o,action:l,children:u,onSubmit:i=()=>{},onInput:E=()=>{},onChange:d=()=>{},numberFields:b=[],className:v,...p})=>(n.useEffect(()=>s.actions.registerOnchange(d),[d]),ee.jsx(te.Provider,{value:s,children:ee.jsx("form",{id:a,ref:s==null?void 0:s.ref,action:l,method:o,className:v,onSubmit:m=>{o||m.preventDefault();const T=s.actions.loadFormValues();i(T)},onInput:m=>{if(m.target.tagName==="FORM"){const T=s.actions.loadFormValues();s.actions.setFormState(T)}else E(m)},onChange:()=>{const m=s.actions.loadFormValues();s.actions.setFormState(m)},onReset:m=>{s&&(m.preventDefault(),s.actions.reset())},...p,children:u},s==null?void 0:s.lastReloadedAt)})),ie=({name:a,render:s=({ref:o,name:l,defaultValue:u,value:i,setValue:E})=>null})=>{const o=n.useRef(),l=ue(),u=l.actions.getDefaultValues()[a],[i,E]=n.useState(u),d=n.useCallback((b,{shouldDirty:v=!1}={})=>{l.actions.setFormState(p=>({...p,[a]:b}),{shouldDirty:v}),E(b)},[E,l.actions.setFormState]);return n.useEffect(()=>l.subscribe(a,(v,{shouldDirty:p=!0,shouldOnChange:m=!0}={})=>{E(v),l.actions.setFormState(T=>({...T,[a]:v}),{shouldDirty:p,shouldOnChange:m}),o.current&&typeof o.current.dispatchEvent=="function"&&m&&o.current.dispatchEvent(new Event("change"))}),[]),s({ref:o,name:a,defaultValue:u,value:i,setValue:d})},fe=(a,s)=>{let o=!1;return Object.keys(s).forEach(l=>{if(!(l in a)||o)return;const u=s[l],i=a[l];(typeof u=="object"||u!==i)&&(o=!0)}),o},re=a=>(typeof a.setCustomValidity=="function"&&a.setCustomValidity(""),!a||typeof a.checkValidity!="function"||a.checkValidity()?null:a.validationMessage),ne=()=>{const[a,s]=n.useState({}),o=n.useMemo(()=>Object.values(a).filter(Boolean).length>0,[a]),l=n.useCallback((d,b)=>{s(v=>v[d]===b?v:{...v,[d]:b})},[]),u=n.useCallback(d=>{s(b=>({...b,...d}))},[]),i=n.useCallback(d=>{s(b=>b[d]?{...b,[d]:""}:b)},[]),E=n.useCallback(()=>{s({})},[]);return{isError:o,errors:a,changeError:l,changeErrors:u,clearError:i,clearErrors:E}},de=()=>{const[a,s]=n.useState(),o=n.useCallback(()=>s(new Date().toString()),[]);return[a,o]},be=()=>{const[,a]=n.useState({});return n.useCallback(()=>a({}),[])},Ee=[],me=({numberFields:a=Ee,defaultValues:s={}}={})=>{const{changeError:o,errors:l,changeErrors:u,clearError:i,clearErrors:E,isError:d}=ne(),[b,v]=n.useState(!1),[p,m]=de(),T=be(),N=n.useRef(new Set),g=n.useRef({}),h=n.useRef(s),A=n.useRef({}),V=n.useRef(()=>{}),y=n.useRef(),M=n.useCallback((t,{shouldDirty:f=!0,shouldOnChange:R=!0}={})=>{let S=t;typeof t=="function"&&(S=t(g.current)),[...N.current].forEach(c=>{g.current[c]!==S[c]&&T()}),g.current=S;let r=b;f&&(r=fe(g.current,h.current),r!==b&&v(r)),R&&V.current(g.current)},[b]),L=n.useCallback(()=>{v(!1),E();const t=A.current;Object.keys(t).forEach(f=>{const R=t[f];R(h.current[f],{shouldDirty:!1,shouldOnChange:!1})}),y.current&&y.current.reset(),m()},[E]),G=n.useCallback((t,f)=>{const R=A.current;return R[t]=f,()=>{delete R[t],delete g.current[t],delete h.current[t]}},[]),W=n.useCallback(t=>(V.current=t,()=>V.current=()=>{})),q=n.useCallback(t=>re(t.target),[]),O=n.useCallback(t=>t?g.current[t]:g.current,[]),U=n.useCallback(()=>h.current,[]),j=n.useCallback(()=>{setTimeout(()=>y.current.dispatchEvent(new Event("input",{bubbles:!0})))},[]),F=n.useCallback(t=>{const f=re(t.target);f?o(t.target.name,f):o(t.target.name,null)},[o]),D=n.useCallback((t,f,{shouldDirty:R=!0,shouldOnChange:S=!0}={})=>{const e=A.current;switch(typeof t){case"string":{const r=e[t];if(!r)throw new Error(`${t} is uncontrolled, please use Controller for it!`);r(f,{shouldDirty:R,shouldOnChange:S}),S&&j()}break;case"object":Object.entries(t).forEach(([r,c])=>{const k=e[r];if(!k)throw new Error(`${r} is uncontrolled, please use Controller for it!`);k(c,{shouldDirty:R,shouldOnChange:S})}),S&&j();default:return}},[j]),Y=n.useCallback(()=>{const t=Object.fromEntries(new FormData(y.current)),f=A.current;return Object.keys(f).map(R=>{t[R]=g.current[R]}),a.forEach(R=>t.hasOwnProperty(R)&&(t[R]=+t[R])),t},[]),P=t=>(N.current.add(t),t==="data"?O():O()[t]),J=n.useMemo(()=>({setValue:D,instantChange:j,getDefaultValues:U,getFormState:O,setFormState:M,changeError:o,changeErrors:u,clearError:i,clearErrors:E,loadFormValues:Y,checkValidity:F,getFieldValidity:q,registerOnchange:W,reload:m,reset:L,watch:P}),[D,j,U,O,M,o,u,i,Y,q,F,W,m,L,P]);return n.useEffect(()=>{if(y.current){const t=Y();h.current=t,g.current=t}return()=>{h.current={},g.current={},v(!1),E()}},[p]),n.useLayoutEffect(()=>{y.current&&[...y.current.querySelectorAll("[name]")].forEach(f=>{f.defaultValue||(f.defaultValue=s[f.name])})},[p]),{ref:y,lastReloadedAt:p,isDirty:b,isError:d,errors:l,numberFields:a,subscribe:G,actions:J}};exports.Controller=ie;exports.Form=le;exports.useForm=me;exports.useValidateForm=ne;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ue, { createContext as le, useContext as ie, useEffect as K,
|
|
2
|
-
var
|
|
1
|
+
import ue, { createContext as le, useContext as ie, useEffect as K, useRef as x, useState as L, useCallback as p, useMemo as ae, useLayoutEffect as fe } from "react";
|
|
2
|
+
var X = { exports: {} }, $ = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -10,28 +10,28 @@ var G = { exports: {} }, Y = {};
|
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
12
|
var ee;
|
|
13
|
-
function
|
|
14
|
-
if (ee) return
|
|
13
|
+
function de() {
|
|
14
|
+
if (ee) return $;
|
|
15
15
|
ee = 1;
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
for (var
|
|
22
|
-
|
|
23
|
-
} else
|
|
24
|
-
return
|
|
25
|
-
$$typeof:
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
29
|
-
props:
|
|
16
|
+
var n = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
|
|
17
|
+
function a(u, c, l) {
|
|
18
|
+
var E = null;
|
|
19
|
+
if (l !== void 0 && (E = "" + l), c.key !== void 0 && (E = "" + c.key), "key" in c) {
|
|
20
|
+
l = {};
|
|
21
|
+
for (var f in c)
|
|
22
|
+
f !== "key" && (l[f] = c[f]);
|
|
23
|
+
} else l = c;
|
|
24
|
+
return c = l.ref, {
|
|
25
|
+
$$typeof: n,
|
|
26
|
+
type: u,
|
|
27
|
+
key: E,
|
|
28
|
+
ref: c !== void 0 ? c : null,
|
|
29
|
+
props: l
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return $.Fragment = o, $.jsx = a, $.jsxs = a, $;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var M = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -42,124 +42,124 @@ var I = {};
|
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
44
|
var re;
|
|
45
|
-
function
|
|
45
|
+
function Ee() {
|
|
46
46
|
return re || (re = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
-
function
|
|
47
|
+
function n(e) {
|
|
48
48
|
if (e == null) return null;
|
|
49
49
|
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof ===
|
|
50
|
+
return e.$$typeof === j ? null : e.displayName || e.name || null;
|
|
51
51
|
if (typeof e == "string") return e;
|
|
52
52
|
switch (e) {
|
|
53
53
|
case k:
|
|
54
54
|
return "Fragment";
|
|
55
|
-
case
|
|
55
|
+
case D:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case F:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case
|
|
59
|
+
case B:
|
|
60
60
|
return "Suspense";
|
|
61
61
|
case q:
|
|
62
62
|
return "SuspenseList";
|
|
63
|
-
case
|
|
63
|
+
case z:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
66
|
if (typeof e == "object")
|
|
67
67
|
switch (typeof e.tag == "number" && console.error(
|
|
68
68
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
69
|
), e.$$typeof) {
|
|
70
|
-
case
|
|
70
|
+
case g:
|
|
71
71
|
return "Portal";
|
|
72
|
-
case
|
|
72
|
+
case W:
|
|
73
73
|
return (e.displayName || "Context") + ".Provider";
|
|
74
|
-
case
|
|
74
|
+
case w:
|
|
75
75
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case
|
|
77
|
-
var
|
|
78
|
-
return e = e.displayName, e || (e =
|
|
76
|
+
case U:
|
|
77
|
+
var r = e.render;
|
|
78
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
+
case J:
|
|
80
|
+
return r = e.displayName || null, r !== null ? r : n(e.type) || "Memo";
|
|
79
81
|
case A:
|
|
80
|
-
|
|
81
|
-
case C:
|
|
82
|
-
n = e._payload, e = e._init;
|
|
82
|
+
r = e._payload, e = e._init;
|
|
83
83
|
try {
|
|
84
|
-
return
|
|
84
|
+
return n(e(r));
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function o(e) {
|
|
91
91
|
return "" + e;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function a(e) {
|
|
94
94
|
try {
|
|
95
|
-
|
|
96
|
-
var
|
|
95
|
+
o(e);
|
|
96
|
+
var r = !1;
|
|
97
97
|
} catch {
|
|
98
|
-
|
|
98
|
+
r = !0;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
return
|
|
104
|
-
|
|
100
|
+
if (r) {
|
|
101
|
+
r = console;
|
|
102
|
+
var s = r.error, R = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
+
return s.call(
|
|
104
|
+
r,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
|
|
107
|
-
),
|
|
106
|
+
R
|
|
107
|
+
), o(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function u(e) {
|
|
111
111
|
if (e === k) return "<>";
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
112
|
+
if (typeof e == "object" && e !== null && e.$$typeof === A)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
|
-
var
|
|
116
|
-
return
|
|
115
|
+
var r = n(e);
|
|
116
|
+
return r ? "<" + r + ">" : "<...>";
|
|
117
117
|
} catch {
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
var e =
|
|
121
|
+
function c() {
|
|
122
|
+
var e = P.A;
|
|
123
123
|
return e === null ? null : e.getOwner();
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function l() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
if (
|
|
130
|
-
var
|
|
131
|
-
if (
|
|
128
|
+
function E(e) {
|
|
129
|
+
if (Y.call(e, "key")) {
|
|
130
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
+
if (r && r.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
133
|
return e.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
function
|
|
137
|
-
|
|
135
|
+
function f(e, r) {
|
|
136
|
+
function s() {
|
|
137
|
+
G || (G = !0, console.error(
|
|
138
138
|
"%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)",
|
|
139
|
-
|
|
139
|
+
r
|
|
140
140
|
));
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
get:
|
|
142
|
+
s.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
+
get: s,
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
var e =
|
|
149
|
-
return
|
|
147
|
+
function d() {
|
|
148
|
+
var e = n(this.type);
|
|
149
|
+
return t[e] || (t[e] = !0, console.error(
|
|
150
150
|
"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."
|
|
151
151
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
155
|
-
$$typeof:
|
|
153
|
+
function _(e, r, s, R, O, y, H, Z) {
|
|
154
|
+
return s = y.ref, e = {
|
|
155
|
+
$$typeof: V,
|
|
156
156
|
type: e,
|
|
157
|
-
key:
|
|
158
|
-
props:
|
|
159
|
-
_owner:
|
|
160
|
-
}, (
|
|
157
|
+
key: r,
|
|
158
|
+
props: y,
|
|
159
|
+
_owner: O
|
|
160
|
+
}, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
161
|
enumerable: !1,
|
|
162
|
-
get:
|
|
162
|
+
get: d
|
|
163
163
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
@@ -182,288 +182,299 @@ function de() {
|
|
|
182
182
|
value: Z
|
|
183
183
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
var v =
|
|
185
|
+
function T(e, r, s, R, O, y, H, Z) {
|
|
186
|
+
var v = r.children;
|
|
187
187
|
if (v !== void 0)
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
190
|
-
for (
|
|
191
|
-
|
|
188
|
+
if (R)
|
|
189
|
+
if (I(v)) {
|
|
190
|
+
for (R = 0; R < v.length; R++)
|
|
191
|
+
b(v[R]);
|
|
192
192
|
Object.freeze && Object.freeze(v);
|
|
193
193
|
} else
|
|
194
194
|
console.error(
|
|
195
195
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
196
|
);
|
|
197
|
-
else
|
|
198
|
-
if (
|
|
199
|
-
v =
|
|
200
|
-
var
|
|
197
|
+
else b(v);
|
|
198
|
+
if (Y.call(r, "key")) {
|
|
199
|
+
v = n(e);
|
|
200
|
+
var N = Object.keys(r).filter(function(ce) {
|
|
201
201
|
return ce !== "key";
|
|
202
202
|
});
|
|
203
|
-
|
|
203
|
+
R = 0 < N.length ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}", S[v + R] || (N = 0 < N.length ? "{" + N.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
204
|
`A props object containing a "key" prop is being spread into JSX:
|
|
205
205
|
let props = %s;
|
|
206
206
|
<%s {...props} />
|
|
207
207
|
React keys must be passed directly to JSX without using spread:
|
|
208
208
|
let props = %s;
|
|
209
209
|
<%s key={someKey} {...props} />`,
|
|
210
|
-
|
|
210
|
+
R,
|
|
211
211
|
v,
|
|
212
|
-
|
|
212
|
+
N,
|
|
213
213
|
v
|
|
214
|
-
),
|
|
214
|
+
), S[v + R] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (v = null,
|
|
217
|
-
|
|
218
|
-
for (var Q in
|
|
219
|
-
Q !== "key" && (
|
|
220
|
-
} else
|
|
221
|
-
return v &&
|
|
222
|
-
|
|
216
|
+
if (v = null, s !== void 0 && (a(s), v = "" + s), E(r) && (a(r.key), v = "" + r.key), "key" in r) {
|
|
217
|
+
s = {};
|
|
218
|
+
for (var Q in r)
|
|
219
|
+
Q !== "key" && (s[Q] = r[Q]);
|
|
220
|
+
} else s = r;
|
|
221
|
+
return v && f(
|
|
222
|
+
s,
|
|
223
223
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
-
),
|
|
224
|
+
), _(
|
|
225
225
|
e,
|
|
226
226
|
v,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
y,
|
|
228
|
+
O,
|
|
229
|
+
c(),
|
|
230
|
+
s,
|
|
231
231
|
H,
|
|
232
232
|
Z
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
typeof e == "object" && e !== null && e.$$typeof ===
|
|
235
|
+
function b(e) {
|
|
236
|
+
typeof e == "object" && e !== null && e.$$typeof === V && e._store && (e._store.validated = 1);
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var h = ue, V = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), F = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), W = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), B = Symbol.for("react.suspense"), q = Symbol.for("react.suspense_list"), J = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), z = Symbol.for("react.activity"), j = Symbol.for("react.client.reference"), P = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, I = Array.isArray, C = console.createTask ? console.createTask : function() {
|
|
239
239
|
return null;
|
|
240
240
|
};
|
|
241
|
-
|
|
241
|
+
h = {
|
|
242
242
|
"react-stack-bottom-frame": function(e) {
|
|
243
243
|
return e();
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
)(),
|
|
250
|
-
|
|
251
|
-
var
|
|
252
|
-
return
|
|
246
|
+
var G, t = {}, i = h["react-stack-bottom-frame"].bind(
|
|
247
|
+
h,
|
|
248
|
+
l
|
|
249
|
+
)(), m = C(u(l)), S = {};
|
|
250
|
+
M.Fragment = k, M.jsx = function(e, r, s, R, O) {
|
|
251
|
+
var y = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return T(
|
|
253
253
|
e,
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
r,
|
|
255
|
+
s,
|
|
256
256
|
!1,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
R,
|
|
258
|
+
O,
|
|
259
|
+
y ? Error("react-stack-top-frame") : i,
|
|
260
|
+
y ? C(u(e)) : m
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
return
|
|
262
|
+
}, M.jsxs = function(e, r, s, R, O) {
|
|
263
|
+
var y = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return T(
|
|
265
265
|
e,
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
r,
|
|
267
|
+
s,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
R,
|
|
270
|
+
O,
|
|
271
|
+
y ? Error("react-stack-top-frame") : i,
|
|
272
|
+
y ? C(u(e)) : m
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
|
-
}()),
|
|
275
|
+
}()), M;
|
|
276
276
|
}
|
|
277
277
|
var te;
|
|
278
|
-
function
|
|
279
|
-
return te || (te = 1, process.env.NODE_ENV === "production" ?
|
|
278
|
+
function be() {
|
|
279
|
+
return te || (te = 1, process.env.NODE_ENV === "production" ? X.exports = de() : X.exports = Ee()), X.exports;
|
|
280
280
|
}
|
|
281
|
-
var ne =
|
|
282
|
-
const se = le({}),
|
|
283
|
-
id:
|
|
284
|
-
form:
|
|
285
|
-
method:
|
|
286
|
-
action:
|
|
287
|
-
children:
|
|
288
|
-
onSubmit:
|
|
281
|
+
var ne = be();
|
|
282
|
+
const se = le({}), me = () => ie(se), he = ({
|
|
283
|
+
id: n,
|
|
284
|
+
form: o,
|
|
285
|
+
method: a,
|
|
286
|
+
action: u,
|
|
287
|
+
children: c,
|
|
288
|
+
onSubmit: l = () => {
|
|
289
289
|
},
|
|
290
|
-
onInput:
|
|
290
|
+
onInput: E = () => {
|
|
291
291
|
},
|
|
292
|
-
onChange:
|
|
292
|
+
onChange: f = () => {
|
|
293
293
|
},
|
|
294
|
-
numberFields:
|
|
295
|
-
className:
|
|
296
|
-
...
|
|
297
|
-
}) => (K(() =>
|
|
294
|
+
numberFields: d = [],
|
|
295
|
+
className: _,
|
|
296
|
+
...T
|
|
297
|
+
}) => (K(() => o.actions.registerOnchange(f), [f]), /* @__PURE__ */ ne.jsx(se.Provider, { value: o, children: /* @__PURE__ */ ne.jsx(
|
|
298
298
|
"form",
|
|
299
299
|
{
|
|
300
|
-
id:
|
|
301
|
-
ref:
|
|
302
|
-
action:
|
|
303
|
-
method:
|
|
304
|
-
className:
|
|
305
|
-
onSubmit: (
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
|
|
300
|
+
id: n,
|
|
301
|
+
ref: o == null ? void 0 : o.ref,
|
|
302
|
+
action: u,
|
|
303
|
+
method: a,
|
|
304
|
+
className: _,
|
|
305
|
+
onSubmit: (b) => {
|
|
306
|
+
a || b.preventDefault();
|
|
307
|
+
const h = o.actions.loadFormValues();
|
|
308
|
+
l(h);
|
|
309
309
|
},
|
|
310
|
-
onInput: (
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
313
|
-
|
|
310
|
+
onInput: (b) => {
|
|
311
|
+
if (b.target.tagName === "FORM") {
|
|
312
|
+
const h = o.actions.loadFormValues();
|
|
313
|
+
o.actions.setFormState(h);
|
|
314
314
|
} else
|
|
315
|
-
b
|
|
315
|
+
E(b);
|
|
316
316
|
},
|
|
317
317
|
onChange: () => {
|
|
318
|
-
const
|
|
319
|
-
|
|
318
|
+
const b = o.actions.loadFormValues();
|
|
319
|
+
o.actions.setFormState(b);
|
|
320
320
|
},
|
|
321
|
-
onReset: (
|
|
322
|
-
|
|
321
|
+
onReset: (b) => {
|
|
322
|
+
o && (b.preventDefault(), o.actions.reset());
|
|
323
323
|
},
|
|
324
|
-
...
|
|
325
|
-
children:
|
|
324
|
+
...T,
|
|
325
|
+
children: c
|
|
326
326
|
},
|
|
327
|
-
|
|
328
|
-
) })),
|
|
329
|
-
const
|
|
330
|
-
(
|
|
331
|
-
|
|
327
|
+
o == null ? void 0 : o.lastReloadedAt
|
|
328
|
+
) })), Se = ({ name: n, render: o = ({ ref: a, name: u, defaultValue: c, value: l, setValue: E }) => null }) => {
|
|
329
|
+
const a = x(), u = me(), c = u.actions.getDefaultValues()[n], [l, E] = L(c), f = p(
|
|
330
|
+
(d, { shouldDirty: _ = !1 } = {}) => {
|
|
331
|
+
u.actions.setFormState((T) => ({ ...T, [n]: d }), { shouldDirty: _ }), E(d);
|
|
332
332
|
},
|
|
333
|
-
[
|
|
333
|
+
[E, u.actions.setFormState]
|
|
334
334
|
);
|
|
335
|
-
return K(() =>
|
|
336
|
-
|
|
337
|
-
})
|
|
338
|
-
},
|
|
339
|
-
let
|
|
340
|
-
return Object.keys(
|
|
341
|
-
if (!(
|
|
342
|
-
const
|
|
343
|
-
(typeof
|
|
344
|
-
}),
|
|
345
|
-
}, oe = (
|
|
346
|
-
const [
|
|
347
|
-
|
|
348
|
-
}, []),
|
|
349
|
-
|
|
350
|
-
}, []),
|
|
351
|
-
|
|
352
|
-
}, []),
|
|
353
|
-
|
|
335
|
+
return K(() => u.subscribe(n, (_, { shouldDirty: T = !0, shouldOnChange: b = !0 } = {}) => {
|
|
336
|
+
E(_), u.actions.setFormState((h) => ({ ...h, [n]: _ }), { shouldDirty: T, shouldOnChange: b }), a.current && typeof a.current.dispatchEvent == "function" && b && a.current.dispatchEvent(new Event("change"));
|
|
337
|
+
}), []), o({ ref: a, name: n, defaultValue: c, value: l, setValue: f });
|
|
338
|
+
}, Re = (n, o) => {
|
|
339
|
+
let a = !1;
|
|
340
|
+
return Object.keys(o).forEach((u) => {
|
|
341
|
+
if (!(u in n) || a) return;
|
|
342
|
+
const c = o[u], l = n[u];
|
|
343
|
+
(typeof c == "object" || c !== l) && (a = !0);
|
|
344
|
+
}), a;
|
|
345
|
+
}, oe = (n) => (typeof n.setCustomValidity == "function" && n.setCustomValidity(""), !n || typeof n.checkValidity != "function" || n.checkValidity() ? null : n.validationMessage), pe = () => {
|
|
346
|
+
const [n, o] = L({}), a = ae(() => Object.values(n).filter(Boolean).length > 0, [n]), u = p((f, d) => {
|
|
347
|
+
o((_) => _[f] === d ? _ : { ..._, [f]: d });
|
|
348
|
+
}, []), c = p((f) => {
|
|
349
|
+
o((d) => ({ ...d, ...f }));
|
|
350
|
+
}, []), l = p((f) => {
|
|
351
|
+
o((d) => d[f] ? { ...d, [f]: "" } : d);
|
|
352
|
+
}, []), E = p(() => {
|
|
353
|
+
o({});
|
|
354
354
|
}, []);
|
|
355
|
-
return { isError:
|
|
356
|
-
},
|
|
357
|
-
const [
|
|
358
|
-
return [
|
|
359
|
-
},
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
355
|
+
return { isError: a, errors: n, changeError: u, changeErrors: c, clearError: l, clearErrors: E };
|
|
356
|
+
}, _e = () => {
|
|
357
|
+
const [n, o] = L(), a = p(() => o((/* @__PURE__ */ new Date()).toString()), []);
|
|
358
|
+
return [n, a];
|
|
359
|
+
}, ve = () => {
|
|
360
|
+
const [, n] = L({});
|
|
361
|
+
return p(() => n({}), []);
|
|
362
|
+
}, ge = [], ke = ({ numberFields: n = ge, defaultValues: o = {} } = {}) => {
|
|
363
|
+
const { changeError: a, errors: u, changeErrors: c, clearError: l, clearErrors: E, isError: f } = pe(), [d, _] = L(!1), [T, b] = _e(), h = ve(), V = x(/* @__PURE__ */ new Set()), g = x({}), k = x(o), F = x({}), D = x(() => {
|
|
364
|
+
}), w = x(), W = p(
|
|
365
|
+
(t, { shouldDirty: i = !0, shouldOnChange: m = !0 } = {}) => {
|
|
366
|
+
let S = t;
|
|
367
|
+
typeof t == "function" && (S = t(g.current)), [...V.current].forEach((s) => {
|
|
368
|
+
g.current[s] !== S[s] && h();
|
|
369
|
+
}), g.current = S;
|
|
370
|
+
let r = d;
|
|
371
|
+
i && (r = Re(g.current, k.current), r !== d && _(r)), m && D.current(g.current);
|
|
367
372
|
},
|
|
368
|
-
[
|
|
369
|
-
),
|
|
370
|
-
|
|
371
|
-
const t =
|
|
372
|
-
Object.keys(t).forEach((
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
}),
|
|
376
|
-
}, [
|
|
377
|
-
const
|
|
378
|
-
return
|
|
379
|
-
delete
|
|
373
|
+
[d]
|
|
374
|
+
), U = p(() => {
|
|
375
|
+
_(!1), E();
|
|
376
|
+
const t = F.current;
|
|
377
|
+
Object.keys(t).forEach((i) => {
|
|
378
|
+
const m = t[i];
|
|
379
|
+
m(k.current[i], { shouldDirty: !1, shouldOnChange: !1 });
|
|
380
|
+
}), w.current && w.current.reset(), b();
|
|
381
|
+
}, [E]), B = p((t, i) => {
|
|
382
|
+
const m = F.current;
|
|
383
|
+
return m[t] = i, () => {
|
|
384
|
+
delete m[t], delete g.current[t], delete k.current[t];
|
|
380
385
|
};
|
|
381
|
-
}, []),
|
|
382
|
-
})),
|
|
383
|
-
setTimeout(() =>
|
|
384
|
-
}, []),
|
|
386
|
+
}, []), q = p((t) => (D.current = t, () => D.current = () => {
|
|
387
|
+
})), J = p((t) => oe(t.target), []), A = p((t) => t ? g.current[t] : g.current, []), z = p(() => k.current, []), j = p(() => {
|
|
388
|
+
setTimeout(() => w.current.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
389
|
+
}, []), P = p(
|
|
385
390
|
(t) => {
|
|
386
|
-
const
|
|
387
|
-
|
|
391
|
+
const i = oe(t.target);
|
|
392
|
+
i ? a(t.target.name, i) : a(t.target.name, null);
|
|
388
393
|
},
|
|
389
|
-
[
|
|
390
|
-
),
|
|
391
|
-
(t,
|
|
392
|
-
const
|
|
394
|
+
[a]
|
|
395
|
+
), Y = p(
|
|
396
|
+
(t, i, { shouldDirty: m = !0, shouldOnChange: S = !0 } = {}) => {
|
|
397
|
+
const e = F.current;
|
|
393
398
|
switch (typeof t) {
|
|
394
399
|
case "string":
|
|
395
400
|
{
|
|
396
|
-
const
|
|
397
|
-
if (!
|
|
401
|
+
const r = e[t];
|
|
402
|
+
if (!r)
|
|
398
403
|
throw new Error(`${t} is uncontrolled, please use Controller for it!`);
|
|
399
|
-
|
|
404
|
+
r(i, { shouldDirty: m, shouldOnChange: S }), S && j();
|
|
400
405
|
}
|
|
401
406
|
break;
|
|
402
407
|
case "object":
|
|
403
|
-
Object.entries(t).forEach(([
|
|
404
|
-
const
|
|
405
|
-
if (!
|
|
406
|
-
throw new Error(`${
|
|
407
|
-
|
|
408
|
-
}),
|
|
408
|
+
Object.entries(t).forEach(([r, s]) => {
|
|
409
|
+
const R = e[r];
|
|
410
|
+
if (!R)
|
|
411
|
+
throw new Error(`${r} is uncontrolled, please use Controller for it!`);
|
|
412
|
+
R(s, { shouldDirty: m, shouldOnChange: S });
|
|
413
|
+
}), S && j();
|
|
409
414
|
default:
|
|
410
415
|
return;
|
|
411
416
|
}
|
|
412
417
|
},
|
|
413
|
-
[
|
|
414
|
-
),
|
|
415
|
-
const t = Object.fromEntries(new FormData(
|
|
416
|
-
return Object.keys(
|
|
417
|
-
t[
|
|
418
|
-
}),
|
|
419
|
-
}, []),
|
|
418
|
+
[j]
|
|
419
|
+
), I = p(() => {
|
|
420
|
+
const t = Object.fromEntries(new FormData(w.current)), i = F.current;
|
|
421
|
+
return Object.keys(i).map((m) => {
|
|
422
|
+
t[m] = g.current[m];
|
|
423
|
+
}), n.forEach((m) => t.hasOwnProperty(m) && (t[m] = +t[m])), t;
|
|
424
|
+
}, []), C = (t) => (V.current.add(t), t === "data" ? A() : A()[t]), G = ae(
|
|
420
425
|
() => ({
|
|
421
|
-
setValue:
|
|
422
|
-
instantChange:
|
|
423
|
-
getDefaultValues:
|
|
424
|
-
getFormState:
|
|
425
|
-
setFormState:
|
|
426
|
-
changeError:
|
|
427
|
-
changeErrors:
|
|
428
|
-
clearError:
|
|
429
|
-
clearErrors:
|
|
430
|
-
loadFormValues:
|
|
431
|
-
checkValidity:
|
|
432
|
-
getFieldValidity:
|
|
433
|
-
registerOnchange:
|
|
434
|
-
reload:
|
|
435
|
-
reset:
|
|
426
|
+
setValue: Y,
|
|
427
|
+
instantChange: j,
|
|
428
|
+
getDefaultValues: z,
|
|
429
|
+
getFormState: A,
|
|
430
|
+
setFormState: W,
|
|
431
|
+
changeError: a,
|
|
432
|
+
changeErrors: c,
|
|
433
|
+
clearError: l,
|
|
434
|
+
clearErrors: E,
|
|
435
|
+
loadFormValues: I,
|
|
436
|
+
checkValidity: P,
|
|
437
|
+
getFieldValidity: J,
|
|
438
|
+
registerOnchange: q,
|
|
439
|
+
reload: b,
|
|
440
|
+
reset: U,
|
|
441
|
+
watch: C
|
|
436
442
|
}),
|
|
437
443
|
[
|
|
438
|
-
|
|
444
|
+
Y,
|
|
445
|
+
j,
|
|
446
|
+
z,
|
|
439
447
|
A,
|
|
448
|
+
W,
|
|
449
|
+
a,
|
|
450
|
+
c,
|
|
451
|
+
l,
|
|
452
|
+
I,
|
|
453
|
+
J,
|
|
454
|
+
P,
|
|
440
455
|
q,
|
|
456
|
+
b,
|
|
441
457
|
U,
|
|
442
|
-
|
|
443
|
-
r,
|
|
444
|
-
d,
|
|
445
|
-
s,
|
|
446
|
-
N,
|
|
447
|
-
W,
|
|
448
|
-
C,
|
|
449
|
-
L,
|
|
450
|
-
g,
|
|
451
|
-
M
|
|
458
|
+
C
|
|
452
459
|
]
|
|
453
460
|
);
|
|
454
461
|
return K(() => {
|
|
455
|
-
if (
|
|
456
|
-
const t =
|
|
457
|
-
|
|
462
|
+
if (w.current) {
|
|
463
|
+
const t = I();
|
|
464
|
+
k.current = t, g.current = t;
|
|
458
465
|
}
|
|
459
466
|
return () => {
|
|
460
|
-
|
|
467
|
+
k.current = {}, g.current = {}, _(!1), E();
|
|
461
468
|
};
|
|
462
|
-
}, [
|
|
469
|
+
}, [T]), fe(() => {
|
|
470
|
+
w.current && [...w.current.querySelectorAll("[name]")].forEach((i) => {
|
|
471
|
+
i.defaultValue || (i.defaultValue = o[i.name]);
|
|
472
|
+
});
|
|
473
|
+
}, [T]), { ref: w, lastReloadedAt: T, isDirty: d, isError: f, errors: u, numberFields: n, subscribe: B, actions: G };
|
|
463
474
|
};
|
|
464
475
|
export {
|
|
465
|
-
|
|
466
|
-
|
|
476
|
+
Se as Controller,
|
|
477
|
+
he as Form,
|
|
467
478
|
ke as useForm,
|
|
468
|
-
|
|
479
|
+
pe as useValidateForm
|
|
469
480
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(S,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],n):(S=typeof globalThis<"u"?globalThis:S||self,n(S.Name={},S.React))})(this,function(S,n){"use strict";var W={exports:{}},V={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var q;function
|
|
9
|
+
*/var q;function se(){if(q)return V;q=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(l,u,i){var E=null;if(i!==void 0&&(E=""+i),u.key!==void 0&&(E=""+u.key),"key"in u){i={};for(var d in u)d!=="key"&&(i[d]=u[d])}else i=u;return u=i.ref,{$$typeof:a,type:l,key:E,ref:u!==void 0?u:null,props:i}}return V.Fragment=s,V.jsx=o,V.jsxs=o,V}var D={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var $;function
|
|
17
|
+
*/var $;function oe(){return $||($=1,process.env.NODE_ENV!=="production"&&function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case I:return"Profiler";case F:return"StrictMode";case H:return"Suspense";case z:return"SuspenseList";case X: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 T:return"Portal";case U:return(e.displayName||"Context")+".Provider";case w:return(e._context.displayName||"Context")+".Consumer";case J:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return t=e.displayName||null,t!==null?t:a(e.type)||"Memo";case j:t=e._payload,e=e._init;try{return a(e(t))}catch{}}return null}function s(e){return""+e}function o(e){try{s(e);var t=!1}catch{t=!0}if(t){t=console;var c=t.error,k=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",k),s(e)}}function l(e){if(e===y)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var t=a(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function u(){var e=P.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function E(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 d(e,t){function c(){B||(B=!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))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function b(){var e=a(this.type);return r[e]||(r[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,c,k,O,C,Z,Q){return c=C.ref,e={$$typeof:Y,type:e,key:t,props:C,_owner:O},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:b}):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:Z}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function _(e,t,c,k,O,C,Z,Q){var v=t.children;if(v!==void 0)if(k)if(L(v)){for(k=0;k<v.length;k++)m(v[k]);Object.freeze&&Object.freeze(v)}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 m(v);if(M.call(t,"key")){v=a(e);var N=Object.keys(t).filter(function(Re){return Re!=="key"});k=0<N.length?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}",g[v+k]||(N=0<N.length?"{"+N.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,k,v,N,v),g[v+k]=!0)}if(v=null,c!==void 0&&(o(c),v=""+c),E(t)&&(o(t.key),v=""+t.key),"key"in t){c={};for(var K in t)K!=="key"&&(c[K]=t[K])}else c=t;return v&&d(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),p(e,v,C,O,u(),c,Z,Q)}function m(e){typeof e=="object"&&e!==null&&e.$$typeof===Y&&e._store&&(e._store.validated=1)}var h=n,Y=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),U=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),A=Symbol.for("react.client.reference"),P=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,L=Array.isArray,x=console.createTask?console.createTask:function(){return null};h={"react-stack-bottom-frame":function(e){return e()}};var B,r={},f=h["react-stack-bottom-frame"].bind(h,i)(),R=x(l(i)),g={};D.Fragment=y,D.jsx=function(e,t,c,k,O){var C=1e4>P.recentlyCreatedOwnerStacks++;return _(e,t,c,!1,k,O,C?Error("react-stack-top-frame"):f,C?x(l(e)):R)},D.jsxs=function(e,t,c,k,O){var C=1e4>P.recentlyCreatedOwnerStacks++;return _(e,t,c,!0,k,O,C?Error("react-stack-top-frame"):f,C?x(l(e)):R)}}()),D}var ee;function ce(){return ee||(ee=1,process.env.NODE_ENV==="production"?W.exports=se():W.exports=oe()),W.exports}var te=ce();const re=n.createContext({}),ue=()=>n.useContext(re),le=({id:a,form:s,method:o,action:l,children:u,onSubmit:i=()=>{},onInput:E=()=>{},onChange:d=()=>{},numberFields:b=[],className:p,..._})=>(n.useEffect(()=>s.actions.registerOnchange(d),[d]),te.jsx(re.Provider,{value:s,children:te.jsx("form",{id:a,ref:s==null?void 0:s.ref,action:l,method:o,className:p,onSubmit:m=>{o||m.preventDefault();const h=s.actions.loadFormValues();i(h)},onInput:m=>{if(m.target.tagName==="FORM"){const h=s.actions.loadFormValues();s.actions.setFormState(h)}else E(m)},onChange:()=>{const m=s.actions.loadFormValues();s.actions.setFormState(m)},onReset:m=>{s&&(m.preventDefault(),s.actions.reset())},..._,children:u},s==null?void 0:s.lastReloadedAt)})),ie=({name:a,render:s=({ref:o,name:l,defaultValue:u,value:i,setValue:E})=>null})=>{const o=n.useRef(),l=ue(),u=l.actions.getDefaultValues()[a],[i,E]=n.useState(u),d=n.useCallback((b,{shouldDirty:p=!1}={})=>{l.actions.setFormState(_=>({..._,[a]:b}),{shouldDirty:p}),E(b)},[E,l.actions.setFormState]);return n.useEffect(()=>l.subscribe(a,(p,{shouldDirty:_=!0,shouldOnChange:m=!0}={})=>{E(p),l.actions.setFormState(h=>({...h,[a]:p}),{shouldDirty:_,shouldOnChange:m}),o.current&&typeof o.current.dispatchEvent=="function"&&m&&o.current.dispatchEvent(new Event("change"))}),[]),s({ref:o,name:a,defaultValue:u,value:i,setValue:d})},fe=(a,s)=>{let o=!1;return Object.keys(s).forEach(l=>{if(!(l in a)||o)return;const u=s[l],i=a[l];(typeof u=="object"||u!==i)&&(o=!0)}),o},ne=a=>(typeof a.setCustomValidity=="function"&&a.setCustomValidity(""),!a||typeof a.checkValidity!="function"||a.checkValidity()?null:a.validationMessage),ae=()=>{const[a,s]=n.useState({}),o=n.useMemo(()=>Object.values(a).filter(Boolean).length>0,[a]),l=n.useCallback((d,b)=>{s(p=>p[d]===b?p:{...p,[d]:b})},[]),u=n.useCallback(d=>{s(b=>({...b,...d}))},[]),i=n.useCallback(d=>{s(b=>b[d]?{...b,[d]:""}:b)},[]),E=n.useCallback(()=>{s({})},[]);return{isError:o,errors:a,changeError:l,changeErrors:u,clearError:i,clearErrors:E}},de=()=>{const[a,s]=n.useState(),o=n.useCallback(()=>s(new Date().toString()),[]);return[a,o]},be=()=>{const[,a]=n.useState({});return n.useCallback(()=>a({}),[])},Ee=[],me=({numberFields:a=Ee,defaultValues:s={}}={})=>{const{changeError:o,errors:l,changeErrors:u,clearError:i,clearErrors:E,isError:d}=ae(),[b,p]=n.useState(!1),[_,m]=de(),h=be(),Y=n.useRef(new Set),T=n.useRef({}),y=n.useRef(s),F=n.useRef({}),I=n.useRef(()=>{}),w=n.useRef(),U=n.useCallback((r,{shouldDirty:f=!0,shouldOnChange:R=!0}={})=>{let g=r;typeof r=="function"&&(g=r(T.current)),[...Y.current].forEach(c=>{T.current[c]!==g[c]&&h()}),T.current=g;let t=b;f&&(t=fe(T.current,y.current),t!==b&&p(t)),R&&I.current(T.current)},[b]),J=n.useCallback(()=>{p(!1),E();const r=F.current;Object.keys(r).forEach(f=>{const R=r[f];R(y.current[f],{shouldDirty:!1,shouldOnChange:!1})}),w.current&&w.current.reset(),m()},[E]),H=n.useCallback((r,f)=>{const R=F.current;return R[r]=f,()=>{delete R[r],delete T.current[r],delete y.current[r]}},[]),z=n.useCallback(r=>(I.current=r,()=>I.current=()=>{})),G=n.useCallback(r=>ne(r.target),[]),j=n.useCallback(r=>r?T.current[r]:T.current,[]),X=n.useCallback(()=>y.current,[]),A=n.useCallback(()=>{setTimeout(()=>w.current.dispatchEvent(new Event("input",{bubbles:!0})))},[]),P=n.useCallback(r=>{const f=ne(r.target);f?o(r.target.name,f):o(r.target.name,null)},[o]),M=n.useCallback((r,f,{shouldDirty:R=!0,shouldOnChange:g=!0}={})=>{const e=F.current;switch(typeof r){case"string":{const t=e[r];if(!t)throw new Error(`${r} is uncontrolled, please use Controller for it!`);t(f,{shouldDirty:R,shouldOnChange:g}),g&&A()}break;case"object":Object.entries(r).forEach(([t,c])=>{const k=e[t];if(!k)throw new Error(`${t} is uncontrolled, please use Controller for it!`);k(c,{shouldDirty:R,shouldOnChange:g})}),g&&A();default:return}},[A]),L=n.useCallback(()=>{const r=Object.fromEntries(new FormData(w.current)),f=F.current;return Object.keys(f).map(R=>{r[R]=T.current[R]}),a.forEach(R=>r.hasOwnProperty(R)&&(r[R]=+r[R])),r},[]),x=r=>(Y.current.add(r),r==="data"?j():j()[r]),B=n.useMemo(()=>({setValue:M,instantChange:A,getDefaultValues:X,getFormState:j,setFormState:U,changeError:o,changeErrors:u,clearError:i,clearErrors:E,loadFormValues:L,checkValidity:P,getFieldValidity:G,registerOnchange:z,reload:m,reset:J,watch:x}),[M,A,X,j,U,o,u,i,L,G,P,z,m,J,x]);return n.useEffect(()=>{if(w.current){const r=L();y.current=r,T.current=r}return()=>{y.current={},T.current={},p(!1),E()}},[_]),n.useLayoutEffect(()=>{w.current&&[...w.current.querySelectorAll("[name]")].forEach(f=>{f.defaultValue||(f.defaultValue=s[f.name])})},[_]),{ref:w,lastReloadedAt:_,isDirty:b,isError:d,errors:l,numberFields:a,subscribe:H,actions:B}};S.Controller=ie,S.Form=le,S.useForm=me,S.useValidateForm=ae,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|