react-simple-formkit 1.1.1 → 1.1.3
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 a=require("react");var z={exports:{}}
|
|
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"),n=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=n,$.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 N: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 P:return"Portal";case F: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 n(e){return""+e}function f(e){try{n(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),n(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=A.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(){t||(t=!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 m(){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:m}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value: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++)R(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 R(v);if(D.call(r,"key")){v=s(e);var x=Object.keys(r).filter(function(ue){return ue!=="key"});k=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",y[v+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} />`,k,v,
|
|
22
|
+
<%s key={someKey} {...props} />`,k,v,x,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 R(e){typeof e=="object"&&e!==null&&e.$$typeof===g&&e._store&&(e._store.validated=1)}var p=a,g=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),F=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"),A=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 t,_={},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>A.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>A.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,n)=>{let f=!1;return Object.keys(n).forEach(i=>{if(!(i in s)||f)return;const u=n[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:n,method:f,action:i,children:u,onSubmit:o=()=>{},onInput:E=()=>{},onChange:l=()=>{},numberFields:m=[],className:d,...T})=>(a.useEffect(()=>n.actions.registerOnchange(l),[l]),te.jsx(ae.Provider,{value:n,children:te.jsx("form",{ref:n==null?void 0:n.ref,action:i,className:d,onSubmit:R=>{f||R.preventDefault();const p=n.actions.loadFormValues();o(p)},onInput:R=>{if(R.target.tagName==="FORM"){const p=n.actions.loadFormValues();n.actions.setFormState(p)}else E(R)},onChange:()=>{const R=n.actions.loadFormValues();n.actions.setFormState(R)},onReset:R=>{n&&(R.preventDefault(),n.actions.reset())},...T,children:u},n==null?void 0:n.lastReloadedAt)})),oe=({name:s,defaultValue:n,render:f=({ref:i,name:u,defaultValue:o,value:E,setValue:l})=>null})=>{const[i,u]=a.useState(n),o=de(),E=a.useRef(),l=a.useCallback((m,{shouldDirty:d=!1}={})=>{o.actions.setFormState(T=>({...T,[s]:m}),{shouldDirty:d}),u(m)},[u,o.actions.setFormState]);return a.useEffect(()=>(o.actions.setFormState(d=>({...d,[s]:n}),{shouldDirty:!1}),o.subscribe(s,(d,{shouldDirty:T=!0,shouldOnChange:R=!0}={})=>{u(d),o.actions.setFormState(p=>({...p,[s]:d}),{shouldDirty:T,shouldOnChange:R}),E.current&&typeof E.current.dispatchEvent=="function"&&R&&E.current.dispatchEvent(new Event("change"))})),[]),f({ref:E,name:s,defaultValue:n,value:i,setValue:l})},Q=()=>{const[s,n]=a.useState({}),f=a.useMemo(()=>Object.values(s).filter(Boolean).length>0,[s]),i=a.useCallback((l,m)=>{n(d=>d[l]===m?d:{...d,[l]:m})},[]),u=a.useCallback(l=>{n(m=>({...m,...l}))},[]),o=a.useCallback(l=>{n(m=>m[l]?{...m,[l]:""}:m)},[]),E=a.useCallback(()=>{n({})},[]);return{isError:f,errors:s,changeError:i,changeErrors:u,clearError:o,clearErrors:E}},Z={defaultValues:{},numberFields:[]},ce=(s=Z)=>{const{defaultValues:n=Z.defaultValues,numberFields:f=Z.numberFields}=s,{changeError:i,errors:u,changeErrors:o,clearError:E,clearErrors:l,isError:m}=Q(),[d,T]=a.useState(!1),[R,p]=a.useState(null),g=a.useRef({}),P=a.useRef(n),C=a.useRef({}),N=a.useRef(()=>{}),O=a.useRef(),L=a.useCallback((t,{shouldDirty:_=!0,shouldOnChange:b=!0}={})=>{let S=t;typeof t=="function"&&(S=t(g.current)),g.current=S;let y=d;_&&(y=be(g.current,P.current),y!==d&&T(y)),b&&N.current(g.current)},[d]),F=a.useCallback(()=>p(new Date().toDateString()),[]),W=a.useCallback(()=>{T(!1),l();const t=C.current;Object.values(t).forEach(b=>b("")),O.current&&O.current.reset(),F()},[l]),G=a.useCallback((t,_)=>{const b=C.current;return b[t]=_,()=>b[t]=null},[]),U=a.useCallback(t=>(N.current=t,()=>N.current=()=>{})),q=a.useCallback(t=>ne(t.target),[]),V=a.useCallback(t=>t?g.current[t]:g.current,[]),J=a.useCallback(()=>P.current,[]),w=a.useCallback((t,{shouldDirty:_=!0}={})=>{setTimeout(()=>O.current.dispatchEvent(new Event("input",{bubbles:!0})))},[]),A=a.useCallback(t=>{const _=ne(t.target);_?i(t.target.name,_):i(t.target.name,null)},[i]),D=a.useCallback((t,_,{shouldDirty:b=!0,shouldOnChange:S=!0}={})=>{const y=C.current;switch(typeof t){case"string":{const e=y[t];if(!e)throw new Error(`${t} is uncontrolled, please use Controller for it!`);e(_,{shouldDirty:b,shouldOnChange:S}),S&&w()}break;case"object":Object.entries(t).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 t=Object.fromEntries(new FormData(O.current)),_=C.current;return Object.keys(_).map(b=>{t[b]=g.current[b]}),f.forEach(b=>t.hasOwnProperty(b)&&(t[b]=+t[b])),t},[]),I=a.useMemo(()=>({setValue:D,instantChange:w,getDefaultValues:J,getFormState:V,setFormState:L,changeError:i,changeErrors:o,clearError:E,clearErrors:l,loadFormValues:Y,checkValidity:A,getFieldValidity:q,registerOnchange:U,reload:F,reset:W}),[D,w,J,V,L,i,o,E,Y,q,A,U,F,W]);return a.useEffect(()=>{if(O.current){const t=Y();P.current={...t,...n},g.current={...t,...n}}},[F]),{ref:O,lastReloadedAt:R,isDirty:d,isError:m,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 C, 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
|
|
@@ -11,27 +11,27 @@ var G = { exports: {} }, Y = {};
|
|
|
11
11
|
*/
|
|
12
12
|
var re;
|
|
13
13
|
function Ee() {
|
|
14
|
-
if (re) return
|
|
14
|
+
if (re) return M;
|
|
15
15
|
re = 1;
|
|
16
16
|
var o = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
17
|
-
function i(
|
|
18
|
-
var
|
|
19
|
-
if (a !== void 0 && (
|
|
17
|
+
function i(l, c, a) {
|
|
18
|
+
var E = null;
|
|
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:
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
26
|
+
type: l,
|
|
27
|
+
key: E,
|
|
28
|
+
ref: c !== void 0 ? c : null,
|
|
29
29
|
props: a
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return M.Fragment = n, 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 V:
|
|
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 N:
|
|
71
71
|
return "Portal";
|
|
72
|
-
case
|
|
72
|
+
case A:
|
|
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));
|
|
@@ -99,17 +99,17 @@ function me() {
|
|
|
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
|
-
|
|
106
|
+
p
|
|
107
107
|
), n(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,46 +118,46 @@ function me() {
|
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
var e =
|
|
121
|
+
function c() {
|
|
122
|
+
var e = F.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
|
-
function
|
|
129
|
-
if (
|
|
128
|
+
function E(e) {
|
|
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
|
+
t || (t = !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
147
|
function b() {
|
|
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, h, H, Z) {
|
|
154
|
+
return s = h.ref, e = {
|
|
155
|
+
$$typeof: k,
|
|
156
156
|
type: e,
|
|
157
157
|
key: r,
|
|
158
158
|
props: h,
|
|
159
|
-
_owner:
|
|
160
|
-
}, (
|
|
159
|
+
_owner: w
|
|
160
|
+
}, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
161
|
enumerable: !1,
|
|
162
162
|
get: b
|
|
163
163
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
@@ -174,289 +174,291 @@ function me() {
|
|
|
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 g(e, r,
|
|
185
|
+
function g(e, r, s, p, w, h, H, Z) {
|
|
186
186
|
var v = r.children;
|
|
187
187
|
if (v !== void 0)
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
190
|
-
for (
|
|
191
|
-
|
|
188
|
+
if (p)
|
|
189
|
+
if (I(v)) {
|
|
190
|
+
for (p = 0; p < v.length; p++)
|
|
191
|
+
m(v[p]);
|
|
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 (
|
|
197
|
+
else m(v);
|
|
198
|
+
if (Y.call(r, "key")) {
|
|
199
199
|
v = o(e);
|
|
200
|
-
var
|
|
200
|
+
var P = Object.keys(r).filter(function(le) {
|
|
201
201
|
return le !== "key";
|
|
202
202
|
});
|
|
203
|
-
|
|
203
|
+
p = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", y[v + p] || (P = 0 < P.length ? "{" + P.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
|
+
p,
|
|
211
211
|
v,
|
|
212
|
-
|
|
212
|
+
P,
|
|
213
213
|
v
|
|
214
|
-
),
|
|
214
|
+
), y[v + p] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (v = null,
|
|
217
|
-
|
|
218
|
-
for (var
|
|
219
|
-
|
|
220
|
-
} else
|
|
221
|
-
return v &&
|
|
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
|
h,
|
|
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 m(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"), N = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), W = Symbol.for("react.consumer"), A = 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"), F = 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 t, _ = {}, d = T["react-stack-bottom-frame"].bind(
|
|
247
|
+
T,
|
|
248
248
|
a
|
|
249
|
-
)(),
|
|
250
|
-
|
|
251
|
-
var h = 1e4 >
|
|
249
|
+
)(), S = $(l(a)), y = {};
|
|
250
|
+
L.Fragment = O, L.jsx = function(e, r, s, p, w) {
|
|
251
|
+
var h = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
252
252
|
return g(
|
|
253
253
|
e,
|
|
254
254
|
r,
|
|
255
|
-
|
|
255
|
+
s,
|
|
256
256
|
!1,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
h ? Error("react-stack-top-frame") :
|
|
260
|
-
h ?
|
|
257
|
+
p,
|
|
258
|
+
w,
|
|
259
|
+
h ? Error("react-stack-top-frame") : d,
|
|
260
|
+
h ? $(l(e)) : S
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var h = 1e4 >
|
|
262
|
+
}, L.jsxs = function(e, r, s, p, w) {
|
|
263
|
+
var h = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
264
264
|
return g(
|
|
265
265
|
e,
|
|
266
266
|
r,
|
|
267
|
-
|
|
267
|
+
s,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
h ? Error("react-stack-top-frame") :
|
|
272
|
-
h ?
|
|
269
|
+
p,
|
|
270
|
+
w,
|
|
271
|
+
h ? Error("react-stack-top-frame") : d,
|
|
272
|
+
h ? $(l(e)) : S
|
|
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 = Ee() : 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),
|
|
281
|
+
var oe = me();
|
|
282
|
+
const ce = fe({}), Re = () => de(ce), pe = (o, n) => {
|
|
283
283
|
let i = !1;
|
|
284
|
-
return Object.keys(n).forEach((
|
|
285
|
-
if (!(
|
|
286
|
-
const
|
|
287
|
-
(typeof
|
|
284
|
+
return Object.keys(n).forEach((l) => {
|
|
285
|
+
if (!(l in o) || i) return;
|
|
286
|
+
const c = n[l], a = o[l];
|
|
287
|
+
(typeof c == "object" || c !== a) && (i = !0);
|
|
288
288
|
}), i;
|
|
289
|
-
}, ae = (o) => {
|
|
290
|
-
var i;
|
|
291
|
-
const n = ((i = o.validity) == null ? void 0 : i.customError) && Object.values(o.validity).filter(Boolean).length === 1;
|
|
292
|
-
return !o || typeof o.checkValidity != "function" || o.checkValidity() || n ? null : o.validationMessage;
|
|
293
|
-
}, _e = ({
|
|
289
|
+
}, ae = (o) => (typeof o.setCustomValidity == "function" && o.setCustomValidity(""), !o || typeof o.checkValidity != "function" || o.checkValidity() ? null : o.validationMessage), ve = ({
|
|
294
290
|
id: o,
|
|
295
291
|
form: n,
|
|
296
292
|
method: i,
|
|
297
|
-
action:
|
|
298
|
-
children:
|
|
293
|
+
action: l,
|
|
294
|
+
children: c,
|
|
299
295
|
onSubmit: a = () => {
|
|
300
296
|
},
|
|
301
|
-
onInput:
|
|
297
|
+
onInput: E = () => {
|
|
302
298
|
},
|
|
303
|
-
onChange:
|
|
299
|
+
onChange: u = () => {
|
|
304
300
|
},
|
|
305
301
|
numberFields: b = [],
|
|
306
|
-
className:
|
|
302
|
+
className: f,
|
|
307
303
|
...g
|
|
308
|
-
}) => (
|
|
304
|
+
}) => (ee(() => n.actions.registerOnchange(u), [u]), /* @__PURE__ */ oe.jsx(ce.Provider, { value: n, children: /* @__PURE__ */ oe.jsx(
|
|
309
305
|
"form",
|
|
310
306
|
{
|
|
311
307
|
ref: n == null ? void 0 : n.ref,
|
|
312
|
-
action:
|
|
313
|
-
className:
|
|
314
|
-
onSubmit: (
|
|
315
|
-
i ||
|
|
316
|
-
const
|
|
317
|
-
a(
|
|
308
|
+
action: l,
|
|
309
|
+
className: f,
|
|
310
|
+
onSubmit: (m) => {
|
|
311
|
+
i || m.preventDefault();
|
|
312
|
+
const T = n.actions.loadFormValues();
|
|
313
|
+
a(T);
|
|
318
314
|
},
|
|
319
|
-
onInput: (
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
n.actions.setFormState(
|
|
315
|
+
onInput: (m) => {
|
|
316
|
+
if (m.target.tagName === "FORM") {
|
|
317
|
+
const T = n.actions.loadFormValues();
|
|
318
|
+
n.actions.setFormState(T);
|
|
323
319
|
} else
|
|
324
|
-
m
|
|
320
|
+
E(m);
|
|
325
321
|
},
|
|
326
322
|
onChange: () => {
|
|
327
|
-
const
|
|
328
|
-
n.actions.setFormState(
|
|
323
|
+
const m = n.actions.loadFormValues();
|
|
324
|
+
n.actions.setFormState(m);
|
|
325
|
+
},
|
|
326
|
+
onReset: (m) => {
|
|
327
|
+
n && (m.preventDefault(), n.actions.reset());
|
|
329
328
|
},
|
|
330
329
|
...g,
|
|
331
|
-
children:
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
330
|
+
children: c
|
|
331
|
+
},
|
|
332
|
+
n == null ? void 0 : n.lastReloadedAt
|
|
333
|
+
) })), _e = ({ name: o, defaultValue: n, render: i = ({ ref: l, name: c, defaultValue: a, value: E, setValue: u }) => null }) => {
|
|
334
|
+
const [l, c] = X(n), a = Re(), E = C(), u = R(
|
|
335
|
+
(b, { shouldDirty: f = !1 } = {}) => {
|
|
336
|
+
a.actions.setFormState((g) => ({ ...g, [o]: b }), { shouldDirty: f }), c(b);
|
|
337
337
|
},
|
|
338
|
-
[
|
|
338
|
+
[c, a.actions.setFormState]
|
|
339
339
|
);
|
|
340
|
-
return
|
|
341
|
-
|
|
342
|
-
})), []), i({ ref:
|
|
340
|
+
return ee(() => (a.actions.setFormState((f) => ({ ...f, [o]: n }), { shouldDirty: !1 }), a.subscribe(o, (f, { shouldDirty: g = !0, shouldOnChange: m = !0 } = {}) => {
|
|
341
|
+
c(f), a.actions.setFormState((T) => ({ ...T, [o]: f }), { shouldDirty: g, shouldOnChange: m }), E.current && typeof E.current.dispatchEvent == "function" && m && E.current.dispatchEvent(new Event("change"));
|
|
342
|
+
})), []), i({ ref: E, name: o, defaultValue: n, value: l, setValue: u });
|
|
343
343
|
}, ue = () => {
|
|
344
|
-
const [o, n] =
|
|
345
|
-
n((
|
|
346
|
-
}, []),
|
|
347
|
-
n((b) => ({ ...b, ...
|
|
348
|
-
}, []), a =
|
|
349
|
-
n((b) => b[
|
|
350
|
-
}, []),
|
|
344
|
+
const [o, n] = X({}), i = se(() => Object.values(o).filter(Boolean).length > 0, [o]), l = R((u, b) => {
|
|
345
|
+
n((f) => f[u] === b ? f : { ...f, [u]: b });
|
|
346
|
+
}, []), c = R((u) => {
|
|
347
|
+
n((b) => ({ ...b, ...u }));
|
|
348
|
+
}, []), a = R((u) => {
|
|
349
|
+
n((b) => b[u] ? { ...b, [u]: "" } : b);
|
|
350
|
+
}, []), E = R(() => {
|
|
351
351
|
n({});
|
|
352
352
|
}, []);
|
|
353
|
-
return { isError: i, errors: o, changeError:
|
|
354
|
-
},
|
|
353
|
+
return { isError: i, errors: o, changeError: l, changeErrors: c, clearError: a, clearErrors: E };
|
|
354
|
+
}, K = {
|
|
355
355
|
defaultValues: {},
|
|
356
356
|
numberFields: []
|
|
357
|
-
}, Te = (o =
|
|
358
|
-
const { defaultValues: n =
|
|
359
|
-
}),
|
|
360
|
-
(t, { shouldDirty:
|
|
361
|
-
let
|
|
362
|
-
typeof t == "function" && (
|
|
363
|
-
let
|
|
364
|
-
|
|
357
|
+
}, Te = (o = K) => {
|
|
358
|
+
const { defaultValues: n = K.defaultValues, numberFields: i = K.numberFields } = o, { changeError: l, errors: c, changeErrors: a, clearError: E, clearErrors: u, isError: b } = ue(), [f, g] = X(!1), [m, T] = X(null), k = C({}), N = C(n), O = C({}), V = C(() => {
|
|
359
|
+
}), j = C(), W = R(
|
|
360
|
+
(t, { shouldDirty: _ = !0, shouldOnChange: d = !0 } = {}) => {
|
|
361
|
+
let S = t;
|
|
362
|
+
typeof t == "function" && (S = t(k.current)), k.current = S;
|
|
363
|
+
let y = f;
|
|
364
|
+
_ && (y = pe(k.current, N.current), y !== f && g(y)), d && V.current(k.current);
|
|
365
365
|
},
|
|
366
|
-
[
|
|
367
|
-
),
|
|
368
|
-
g(!1),
|
|
369
|
-
const t =
|
|
370
|
-
Object.values(t).forEach((d) => d("")),
|
|
371
|
-
}, [
|
|
372
|
-
const d =
|
|
373
|
-
return d[t] =
|
|
374
|
-
}, []),
|
|
375
|
-
})),
|
|
376
|
-
setTimeout(() =>
|
|
377
|
-
}, []),
|
|
366
|
+
[f]
|
|
367
|
+
), A = R(() => T((/* @__PURE__ */ new Date()).toDateString()), []), U = R(() => {
|
|
368
|
+
g(!1), u();
|
|
369
|
+
const t = O.current;
|
|
370
|
+
Object.values(t).forEach((d) => d("")), j.current && j.current.reset(), A();
|
|
371
|
+
}, [u]), B = R((t, _) => {
|
|
372
|
+
const d = O.current;
|
|
373
|
+
return d[t] = _, () => d[t] = null;
|
|
374
|
+
}, []), q = R((t) => (V.current = t, () => V.current = () => {
|
|
375
|
+
})), J = R((t) => ae(t.target), []), D = R((t) => t ? k.current[t] : k.current, []), z = R(() => N.current, []), x = R((t, { shouldDirty: _ = !0 } = {}) => {
|
|
376
|
+
setTimeout(() => j.current.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
377
|
+
}, []), F = R(
|
|
378
378
|
(t) => {
|
|
379
|
-
const
|
|
380
|
-
|
|
379
|
+
const _ = ae(t.target);
|
|
380
|
+
_ ? l(t.target.name, _) : l(t.target.name, null);
|
|
381
381
|
},
|
|
382
|
-
[
|
|
383
|
-
),
|
|
384
|
-
(t,
|
|
385
|
-
const
|
|
382
|
+
[l]
|
|
383
|
+
), Y = R(
|
|
384
|
+
(t, _, { shouldDirty: d = !0, shouldOnChange: S = !0 } = {}) => {
|
|
385
|
+
const y = O.current;
|
|
386
386
|
switch (typeof t) {
|
|
387
387
|
case "string":
|
|
388
388
|
{
|
|
389
|
-
const
|
|
390
|
-
if (!
|
|
389
|
+
const e = y[t];
|
|
390
|
+
if (!e)
|
|
391
391
|
throw new Error(`${t} is uncontrolled, please use Controller for it!`);
|
|
392
|
-
|
|
392
|
+
e(_, { shouldDirty: d, shouldOnChange: S }), S && x();
|
|
393
393
|
}
|
|
394
394
|
break;
|
|
395
395
|
case "object":
|
|
396
|
-
Object.entries(t).forEach(([
|
|
397
|
-
const
|
|
398
|
-
if (!
|
|
399
|
-
throw new Error(`${
|
|
400
|
-
|
|
401
|
-
}),
|
|
396
|
+
Object.entries(t).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: S });
|
|
401
|
+
}), S && x();
|
|
402
402
|
default:
|
|
403
403
|
return;
|
|
404
404
|
}
|
|
405
405
|
},
|
|
406
406
|
[x]
|
|
407
|
-
),
|
|
408
|
-
const t = Object.fromEntries(new FormData(
|
|
409
|
-
return Object.keys(
|
|
410
|
-
t[d] =
|
|
407
|
+
), I = R(() => {
|
|
408
|
+
const t = Object.fromEntries(new FormData(j.current)), _ = O.current;
|
|
409
|
+
return Object.keys(_).map((d) => {
|
|
410
|
+
t[d] = k.current[d];
|
|
411
411
|
}), i.forEach((d) => t.hasOwnProperty(d) && (t[d] = +t[d])), t;
|
|
412
|
-
}, []),
|
|
412
|
+
}, []), $ = se(
|
|
413
413
|
() => ({
|
|
414
|
-
setValue:
|
|
414
|
+
setValue: Y,
|
|
415
415
|
instantChange: x,
|
|
416
|
-
getDefaultValues:
|
|
417
|
-
getFormState:
|
|
418
|
-
setFormState:
|
|
419
|
-
changeError:
|
|
416
|
+
getDefaultValues: z,
|
|
417
|
+
getFormState: D,
|
|
418
|
+
setFormState: W,
|
|
419
|
+
changeError: l,
|
|
420
420
|
changeErrors: a,
|
|
421
|
-
clearError:
|
|
422
|
-
clearErrors:
|
|
423
|
-
loadFormValues:
|
|
424
|
-
checkValidity:
|
|
425
|
-
getFieldValidity:
|
|
426
|
-
registerOnchange:
|
|
427
|
-
|
|
421
|
+
clearError: E,
|
|
422
|
+
clearErrors: u,
|
|
423
|
+
loadFormValues: I,
|
|
424
|
+
checkValidity: F,
|
|
425
|
+
getFieldValidity: J,
|
|
426
|
+
registerOnchange: q,
|
|
427
|
+
reload: A,
|
|
428
|
+
reset: U
|
|
428
429
|
}),
|
|
429
430
|
[
|
|
430
|
-
|
|
431
|
+
Y,
|
|
431
432
|
x,
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
$,
|
|
435
|
-
f,
|
|
436
|
-
a,
|
|
437
|
-
m,
|
|
438
|
-
N,
|
|
433
|
+
z,
|
|
434
|
+
D,
|
|
439
435
|
W,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
436
|
+
l,
|
|
437
|
+
a,
|
|
438
|
+
E,
|
|
439
|
+
I,
|
|
440
|
+
J,
|
|
441
|
+
F,
|
|
442
|
+
q,
|
|
443
|
+
A,
|
|
444
|
+
U
|
|
443
445
|
]
|
|
444
446
|
);
|
|
445
|
-
return
|
|
446
|
-
if (
|
|
447
|
-
const t =
|
|
448
|
-
|
|
447
|
+
return ee(() => {
|
|
448
|
+
if (j.current) {
|
|
449
|
+
const t = I();
|
|
450
|
+
N.current = { ...t, ...n }, k.current = { ...t, ...n };
|
|
449
451
|
}
|
|
450
|
-
}, []), { ref:
|
|
452
|
+
}, [A]), { ref: j, lastReloadedAt: m, isDirty: f, isError: b, errors: c, numberFields: i, subscribe: B, actions: $ };
|
|
451
453
|
}, ke = {
|
|
452
|
-
Form:
|
|
453
|
-
Controller:
|
|
454
|
+
Form: ve,
|
|
455
|
+
Controller: _e,
|
|
454
456
|
useForm: Te,
|
|
455
457
|
useValidateForm: ue
|
|
456
458
|
};
|
|
457
459
|
export {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
+
_e as Controller,
|
|
461
|
+
ve as Form,
|
|
460
462
|
ke as default,
|
|
461
463
|
Te as useForm,
|
|
462
464
|
ue as useValidateForm
|
|
@@ -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:{}},N={};/**
|
|
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 N;ee=1;var s=Symbol.for("react.transitional.element"),a=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 N.Fragment=a,N.jsx=f,N.jsxs=f,N}var V={};/**
|
|
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 Y: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 D:return"Portal";case A: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 a(e){return""+e}function f(e){try{a(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),a(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=P.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(){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)",t))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function m(){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:g,type:e,key:t,props:y,_owner:w},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:m}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function S(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++)R(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 R(p);if(M.call(t,"key")){p=s(e);var x=Object.keys(t).filter(function(me){return me!=="key"});k=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",C[p+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} />`,k,
|
|
22
|
+
<%s key={someKey} {...props} />`,k,p,x,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 R(e){typeof e=="object"&&e!==null&&e.$$typeof===g&&e._store&&(e._store.validated=1)}var _=r,g=Symbol.for("react.transitional.element"),D=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),A=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"),P=_.__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 n,v={},b=_["react-stack-bottom-frame"].bind(_,o)(),h=W(i(o)),C={};V.Fragment=O,V.jsx=function(e,t,c,k,w){var y=1e4>P.recentlyCreatedOwnerStacks++;return S(e,t,c,!1,k,w,y?Error("react-stack-top-frame"):b,y?W(i(e)):h)},V.jsxs=function(e,t,c,k,w){var y=1e4>P.recentlyCreatedOwnerStacks++;return S(e,t,c,!0,k,w,y?Error("react-stack-top-frame"):b,y?W(i(e)):h)}}()),V}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,a)=>{let f=!1;return Object.keys(a).forEach(i=>{if(!(i in s)||f)return;const l=a[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:a,method:f,action:i,children:l,onSubmit:o=()=>{},onInput:E=()=>{},onChange:u=()=>{},numberFields:m=[],className:d,...S})=>(r.useEffect(()=>a.actions.registerOnchange(u),[u]),ne.jsx(ae.Provider,{value:a,children:ne.jsx("form",{ref:a==null?void 0:a.ref,action:i,className:d,onSubmit:R=>{f||R.preventDefault();const _=a.actions.loadFormValues();o(_)},onInput:R=>{if(R.target.tagName==="FORM"){const _=a.actions.loadFormValues();a.actions.setFormState(_)}else E(R)},onChange:()=>{const R=a.actions.loadFormValues();a.actions.setFormState(R)},onReset:R=>{a&&(R.preventDefault(),a.actions.reset())},...S,children:l},a==null?void 0:a.lastReloadedAt)})),ce=({name:s,defaultValue:a,render:f=({ref:i,name:l,defaultValue:o,value:E,setValue:u})=>null})=>{const[i,l]=r.useState(a),o=de(),E=r.useRef(),u=r.useCallback((m,{shouldDirty:d=!1}={})=>{o.actions.setFormState(S=>({...S,[s]:m}),{shouldDirty:d}),l(m)},[l,o.actions.setFormState]);return r.useEffect(()=>(o.actions.setFormState(d=>({...d,[s]:a}),{shouldDirty:!1}),o.subscribe(s,(d,{shouldDirty:S=!0,shouldOnChange:R=!0}={})=>{l(d),o.actions.setFormState(_=>({..._,[s]:d}),{shouldDirty:S,shouldOnChange:R}),E.current&&typeof E.current.dispatchEvent=="function"&&R&&E.current.dispatchEvent(new Event("change"))})),[]),f({ref:E,name:s,defaultValue:a,value:i,setValue:u})},H=()=>{const[s,a]=r.useState({}),f=r.useMemo(()=>Object.values(s).filter(Boolean).length>0,[s]),i=r.useCallback((u,m)=>{a(d=>d[u]===m?d:{...d,[u]:m})},[]),l=r.useCallback(u=>{a(m=>({...m,...u}))},[]),o=r.useCallback(u=>{a(m=>m[u]?{...m,[u]:""}:m)},[]),E=r.useCallback(()=>{a({})},[]);return{isError:f,errors:s,changeError:i,changeErrors:l,clearError:o,clearErrors:E}},Z={defaultValues:{},numberFields:[]},le=(s=Z)=>{const{defaultValues:a=Z.defaultValues,numberFields:f=Z.numberFields}=s,{changeError:i,errors:l,changeErrors:o,clearError:E,clearErrors:u,isError:m}=H(),[d,S]=r.useState(!1),[R,_]=r.useState(null),g=r.useRef({}),D=r.useRef(a),O=r.useRef({}),Y=r.useRef(()=>{}),j=r.useRef(),J=r.useCallback((n,{shouldDirty:v=!0,shouldOnChange:b=!0}={})=>{let h=n;typeof n=="function"&&(h=n(g.current)),g.current=h;let C=d;v&&(C=be(g.current,D.current),C!==d&&S(C)),b&&Y.current(g.current)},[d]),A=r.useCallback(()=>_(new Date().toDateString()),[]),z=r.useCallback(()=>{S(!1),u();const n=O.current;Object.values(n).forEach(b=>b("")),j.current&&j.current.reset(),A()},[u]),Q=r.useCallback((n,v)=>{const b=O.current;return b[n]=v,()=>b[n]=null},[]),G=r.useCallback(n=>(Y.current=n,()=>Y.current=()=>{})),X=r.useCallback(n=>se(n.target),[]),I=r.useCallback(n=>n?g.current[n]:g.current,[]),B=r.useCallback(()=>D.current,[]),F=r.useCallback((n,{shouldDirty:v=!0}={})=>{setTimeout(()=>j.current.dispatchEvent(new Event("input",{bubbles:!0})))},[]),P=r.useCallback(n=>{const v=se(n.target);v?i(n.target.name,v):i(n.target.name,null)},[i]),M=r.useCallback((n,v,{shouldDirty:b=!0,shouldOnChange:h=!0}={})=>{const C=O.current;switch(typeof n){case"string":{const e=C[n];if(!e)throw new Error(`${n} is uncontrolled, please use Controller for it!`);e(v,{shouldDirty:b,shouldOnChange:h}),h&&F()}break;case"object":Object.entries(n).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 n=Object.fromEntries(new FormData(j.current)),v=O.current;return Object.keys(v).map(b=>{n[b]=g.current[b]}),f.forEach(b=>n.hasOwnProperty(b)&&(n[b]=+n[b])),n},[]),W=r.useMemo(()=>({setValue:M,instantChange:F,getDefaultValues:B,getFormState:I,setFormState:J,changeError:i,changeErrors:o,clearError:E,clearErrors:u,loadFormValues:L,checkValidity:P,getFieldValidity:X,registerOnchange:G,reload:A,reset:z}),[M,F,B,I,J,i,o,E,L,X,P,G,A,z]);return r.useEffect(()=>{if(j.current){const n=L();D.current={...n,...a},g.current={...n,...a}}},[A]),{ref:j,lastReloadedAt:R,isDirty:d,isError:m,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"}})});
|