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