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