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