react-simple-formkit 1.0.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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 n=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"),a=Symbol.for("react.fragment");function b(f,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:f,key:E,ref:c!==void 0?c:null,props:s}}return D.Fragment=a,D.jsx=b,D.jsxs=b,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 a(e){return""+e}function b(e){try{a(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),a(e)}}function f(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 E(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 y[e]||(y[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,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 _=r.children;if(_!==void 0)if(k)if(p(_)){for(k=0;k<_.length;k++)l(_[k]);Object.freeze&&Object.freeze(_)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(_);if(t.call(r,"key")){_=o(e);var w=Object.keys(r).filter(function(ue){return ue!=="key"});k=0<w.length?"{key: someKey, "+w.join(": ..., ")+": ...}":"{key: someKey}",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,_,w,_),V[_+k]=!0)}if(_=null,i!==void 0&&(b(i),_=""+i),E(r)&&(b(r.key),_=""+r.key),"key"in r){i={};for(var H in r)H!=="key"&&(i[H]=r[H])}else i=r;return _&&u(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,_,S,C,c(),i,X,B)}function l(e){typeof e=="object"&&e!==null&&e.$$typeof===j&&e._store&&(e._store.validated=1)}var v=n,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=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,t=Object.prototype.hasOwnProperty,p=Array.isArray,d=console.createTask?console.createTask:function(){return null};v={"react-stack-bottom-frame":function(e){return e()}};var g,y={},O=v["react-stack-bottom-frame"].bind(v,s)(),J=d(f(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"):O,S?d(f(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"):O,S?d(f(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=n.createContext({}),de=()=>n.useContext(ae),be=(o,a)=>{let b=!1;return Object.keys(a).forEach(f=>{if(!(f in o)||b)return;const c=a[f],s=o[f];(typeof c=="object"||c!==s)&&(b=!0)}),b},ne=o=>(typeof o.setCustomValidity=="function"&&o.setCustomValidity(null),!o||typeof o.checkValidity!="function"||o.checkValidity()?null:o.validationMessage),oe=({id:o,form:a,method:b,action:f,children:c,onSubmit:s=()=>{},onInput:E=()=>{},onChange:u=()=>{},numberFields:R=[],className:m,...T})=>(n.useEffect(()=>a.actions.registerOnchange(u),[u]),te.jsx(ae.Provider,{value:a,children:te.jsx("form",{ref:a==null?void 0:a.ref,action:f,className:m,onSubmit:l=>{b||l.preventDefault();const v=a.actions.loadFormValues();s(v)},onInput:l=>{if(l.target.tagName==="FORM"){const v=a.actions.loadFormValues();a.actions.setFormState(v)}else E(l)},onChange:()=>{const l=a.actions.loadFormValues();a.actions.setFormState(l)},...T,children:c})})),se=({name:o,defaultValue:a,render:b=({ref:f,name:c,defaultValue:s,value:E,setValue:u})=>null})=>{const[f,c]=n.useState(a),s=de(),E=n.useRef(),u=n.useCallback((R,{shouldDirty:m=!1}={})=>{s.actions.setFormState(T=>({...T,[o]:R}),{shouldDirty:m}),c(R)},[c,s.actions.setFormState]);return n.useEffect(()=>(s.actions.setFormState(m=>({...m,[o]:a}),{shouldDirty:!1}),s.subscribe(o,(m,{shouldDirty:T=!0,shouldOnChange:l=!0}={})=>{c(m),s.actions.setFormState(v=>({...v,[o]:m}),{shouldDirty:T,shouldOnChange:l}),E.current&&typeof E.current.dispatchEvent=="function"&&l&&E.current.dispatchEvent(new Event("change"))})),[]),b({ref:E,name:o,defaultValue:a,value:f,setValue:u})},Q=()=>{const[o,a]=n.useState({}),b=n.useMemo(()=>Object.values(o).filter(Boolean).length>0,[o]),f=n.useCallback((u,R)=>{a(m=>m[u]===R?m:{...m,[u]:R})},[]),c=n.useCallback(u=>{a(R=>({...R,...u}))},[]),s=n.useCallback(u=>{a(R=>R[u]?{...R,[u]:""}:R)},[]),E=n.useCallback(()=>{a({})},[]);return{isError:b,errors:o,changeError:f,changeErrors:c,clearError:s,clearErrors:E}},Z={defaultValues:{},numberFields:[]},ce=(o=Z)=>{const{defaultValues:a=Z.defaultValues,numberFields:b=Z.numberFields}=o,{changeError:f,errors:c,changeErrors:s,clearError:E,clearErrors:u,isError:R}=Q(),[m,T]=n.useState(!1),l=n.useRef({}),v=n.useRef(a),j=n.useRef({}),x=n.useRef(()=>{}),h=n.useRef(),I=n.useCallback((t,{shouldDirty:p=!0,shouldOnChange:d=!0}={})=>{let g=t;typeof t=="function"&&(g=t(l.current)),l.current=g;let y=m;p&&(y=be(l.current,v.current),y!==m&&T(y)),d&&x.current(l.current)},[m]),$=n.useCallback(()=>{T(!1),u();const t=j.current;Object.values(t).forEach(d=>d("")),h.current.reset(),l.current=v.current},[u]),G=n.useCallback((t,p)=>{const d=j.current;return d[t]=p,()=>d[t]=null},[]),M=n.useCallback(t=>(x.current=t,()=>x.current=()=>{})),L=n.useCallback(t=>ne(t.target),[]),W=n.useCallback(t=>t?l.current[t]:l.current,[]),U=n.useCallback(()=>v.current,[]),F=n.useCallback(()=>{setTimeout(()=>h.current.dispatchEvent(new Event("input",{bubbles:!0})))},[]),P=n.useCallback(t=>{const p=ne(t.target);p?f(t.target.name,p):f(t.target.name,null)},[f]),q=n.useCallback((t,p,{shouldDirty:d=!0,shouldOnChange:g=!0}={})=>{const y=j.current;switch(typeof t){case"string":{const O=y[t];if(!O)throw new Error(`${t} is uncontrolled, please use Controller for it!`);O(p,{shouldDirty:d,shouldOnChange:g}),g&&F()}break;case"object":Object.entries(t).forEach(([O,J])=>{const V=y[O];if(!V)throw new Error(`${O} is uncontrolled, please use Controller for it!`);V(J,{shouldDirty:d,shouldOnChange:g})}),g&&F();default:return}},[F]),A=n.useCallback(()=>{const t=Object.fromEntries(new FormData(h.current)),p=j.current;return Object.keys(p).map(d=>{t[d]=l.current[d]}),b.forEach(d=>t.hasOwnProperty(d)&&(t[d]=+t[d])),t},[]),N=n.useMemo(()=>({setValue:q,instantChange:F,getDefaultValues:U,getFormState:W,setFormState:I,changeError:f,changeErrors:s,clearError:E,clearErrors:u,loadFormValues:A,checkValidity:P,getFieldValidity:L,registerOnchange:M,reset:$}),[q,F,U,W,I,f,s,E,A,L,P,M,$]);return n.useEffect(()=>{if(h.current){const t=A();v.current={...t,...a},l.current={...t,...a}}},[]),{ref:h,isDirty:m,isError:R,errors:c,numberFields:b,subscribe:G,actions:N}},me={Form:oe,Controller:se,useForm:ce,useValidateForm:Q};exports.Controller=se;exports.Form=oe;exports.default=me;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
|
|
12
|
+
var re;
|
|
13
13
|
function me() {
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
for (var
|
|
22
|
-
|
|
23
|
-
} else
|
|
24
|
-
return
|
|
25
|
-
$$typeof:
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
29
|
-
props:
|
|
14
|
+
if (re) return Y;
|
|
15
|
+
re = 1;
|
|
16
|
+
var o = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
17
|
+
function d(i, s, a) {
|
|
18
|
+
var E = null;
|
|
19
|
+
if (a !== void 0 && (E = "" + a), s.key !== void 0 && (E = "" + 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
|
+
type: i,
|
|
27
|
+
key: E,
|
|
28
|
+
ref: s !== void 0 ? s : null,
|
|
29
|
+
props: a
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return Y.Fragment = n, Y.jsx = d, Y.jsxs = d, Y;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var I = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -41,419 +41,419 @@ 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 Ee() {
|
|
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 h:
|
|
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 d(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
|
|
111
|
-
if (
|
|
112
|
-
if (typeof
|
|
110
|
+
function i(e) {
|
|
111
|
+
if (e === h) 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 E(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
|
+
g || (g = !0, console.error(
|
|
138
138
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
-
|
|
139
|
+
r
|
|
140
140
|
));
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
get:
|
|
142
|
+
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
+
get: l,
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
var
|
|
149
|
-
return y[
|
|
147
|
+
function b() {
|
|
148
|
+
var e = o(this.type);
|
|
149
|
+
return y[e] || (y[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 m(r,
|
|
154
|
-
return
|
|
155
|
-
$$typeof:
|
|
156
|
-
type:
|
|
157
|
-
key:
|
|
158
|
-
props:
|
|
159
|
-
_owner:
|
|
160
|
-
}, (
|
|
153
|
+
function m(e, r, l, R, j, S, B, H) {
|
|
154
|
+
return l = S.ref, e = {
|
|
155
|
+
$$typeof: w,
|
|
156
|
+
type: e,
|
|
157
|
+
key: r,
|
|
158
|
+
props: S,
|
|
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 k(r,
|
|
186
|
-
var
|
|
187
|
-
if (
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
190
|
-
for (
|
|
191
|
-
|
|
192
|
-
Object.freeze && Object.freeze(
|
|
185
|
+
function k(e, r, l, R, j, S, B, H) {
|
|
186
|
+
var p = r.children;
|
|
187
|
+
if (p !== void 0)
|
|
188
|
+
if (R)
|
|
189
|
+
if (T(p)) {
|
|
190
|
+
for (R = 0; R < p.length; R++)
|
|
191
|
+
u(p[R]);
|
|
192
|
+
Object.freeze && Object.freeze(p);
|
|
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(p);
|
|
198
|
+
if (t.call(r, "key")) {
|
|
199
|
+
p = 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[p + 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
|
+
R,
|
|
210
211
|
p,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
), Y[_ + p] = !0);
|
|
212
|
+
A,
|
|
213
|
+
p
|
|
214
|
+
), D[p + R] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
for (var
|
|
219
|
-
|
|
220
|
-
} else
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
typeof
|
|
216
|
+
if (p = null, l !== void 0 && (d(l), p = "" + l), E(r) && (d(r.key), p = "" + 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 p && c(
|
|
222
|
+
l,
|
|
223
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
224
|
), m(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
e,
|
|
226
|
+
p,
|
|
227
|
+
S,
|
|
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 v = ie, w = Symbol.for("react.transitional.element"), P = Symbol.for("react.portal"), h = 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 = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, t = Object.prototype.hasOwnProperty, T = Array.isArray, f = console.createTask ? console.createTask : function() {
|
|
239
239
|
return null;
|
|
240
240
|
};
|
|
241
|
-
|
|
242
|
-
"react-stack-bottom-frame": function(
|
|
243
|
-
return
|
|
241
|
+
v = {
|
|
242
|
+
"react-stack-bottom-frame": function(e) {
|
|
243
|
+
return e();
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
)(),
|
|
250
|
-
|
|
251
|
-
var
|
|
246
|
+
var g, y = {}, O = v["react-stack-bottom-frame"].bind(
|
|
247
|
+
v,
|
|
248
|
+
a
|
|
249
|
+
)(), z = f(i(a)), D = {};
|
|
250
|
+
I.Fragment = h, I.jsx = function(e, r, l, R, j) {
|
|
251
|
+
var S = 1e4 > V.recentlyCreatedOwnerStacks++;
|
|
252
252
|
return k(
|
|
253
|
+
e,
|
|
253
254
|
r,
|
|
254
|
-
|
|
255
|
-
i,
|
|
255
|
+
l,
|
|
256
256
|
!1,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
R,
|
|
258
|
+
j,
|
|
259
|
+
S ? Error("react-stack-top-frame") : O,
|
|
260
|
+
S ? f(i(e)) : z
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var
|
|
262
|
+
}, I.jsxs = function(e, r, l, R, j) {
|
|
263
|
+
var S = 1e4 > V.recentlyCreatedOwnerStacks++;
|
|
264
264
|
return k(
|
|
265
|
+
e,
|
|
265
266
|
r,
|
|
266
|
-
|
|
267
|
-
i,
|
|
267
|
+
l,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
R,
|
|
270
|
+
j,
|
|
271
|
+
S ? Error("react-stack-top-frame") : O,
|
|
272
|
+
S ? f(i(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 = me() : G.exports = Ee()), G.exports;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
282
|
-
const
|
|
283
|
-
let
|
|
284
|
-
return Object.keys(
|
|
285
|
-
if (!(
|
|
286
|
-
const
|
|
287
|
-
(typeof
|
|
288
|
-
}),
|
|
289
|
-
},
|
|
290
|
-
id:
|
|
291
|
-
form:
|
|
292
|
-
method:
|
|
293
|
-
action:
|
|
294
|
-
children:
|
|
295
|
-
onSubmit:
|
|
281
|
+
var oe = be();
|
|
282
|
+
const ce = fe({}), Re = () => de(ce), pe = (o, n) => {
|
|
283
|
+
let d = !1;
|
|
284
|
+
return Object.keys(n).forEach((i) => {
|
|
285
|
+
if (!(i in o) || d) return;
|
|
286
|
+
const s = n[i], a = o[i];
|
|
287
|
+
(typeof s == "object" || s !== a) && (d = !0);
|
|
288
|
+
}), d;
|
|
289
|
+
}, ae = (o) => (typeof o.setCustomValidity == "function" && o.setCustomValidity(null), !o || typeof o.checkValidity != "function" || o.checkValidity() ? null : o.validationMessage), _e = ({
|
|
290
|
+
id: o,
|
|
291
|
+
form: n,
|
|
292
|
+
method: d,
|
|
293
|
+
action: i,
|
|
294
|
+
children: s,
|
|
295
|
+
onSubmit: a = () => {
|
|
296
296
|
},
|
|
297
|
-
onInput:
|
|
297
|
+
onInput: E = () => {
|
|
298
298
|
},
|
|
299
|
-
onChange:
|
|
299
|
+
onChange: c = () => {
|
|
300
300
|
},
|
|
301
|
-
numberFields:
|
|
301
|
+
numberFields: b = [],
|
|
302
302
|
className: m,
|
|
303
303
|
...k
|
|
304
|
-
}) => (
|
|
304
|
+
}) => (K(() => n.actions.registerOnchange(c), [c]), /* @__PURE__ */ oe.jsx(ce.Provider, { value: n, children: /* @__PURE__ */ oe.jsx(
|
|
305
305
|
"form",
|
|
306
306
|
{
|
|
307
|
-
ref:
|
|
308
|
-
action:
|
|
307
|
+
ref: n == null ? void 0 : n.ref,
|
|
308
|
+
action: i,
|
|
309
309
|
className: m,
|
|
310
|
-
onSubmit: (
|
|
311
|
-
|
|
312
|
-
const
|
|
313
|
-
|
|
310
|
+
onSubmit: (u) => {
|
|
311
|
+
d || u.preventDefault();
|
|
312
|
+
const v = n.actions.loadFormValues();
|
|
313
|
+
a(v);
|
|
314
314
|
},
|
|
315
|
-
onInput: (
|
|
316
|
-
if (
|
|
317
|
-
const
|
|
318
|
-
|
|
315
|
+
onInput: (u) => {
|
|
316
|
+
if (u.target.tagName === "FORM") {
|
|
317
|
+
const v = n.actions.loadFormValues();
|
|
318
|
+
n.actions.setFormState(v);
|
|
319
319
|
} else
|
|
320
|
-
|
|
320
|
+
E(u);
|
|
321
321
|
},
|
|
322
322
|
onChange: () => {
|
|
323
|
-
const
|
|
324
|
-
|
|
323
|
+
const u = n.actions.loadFormValues();
|
|
324
|
+
n.actions.setFormState(u);
|
|
325
325
|
},
|
|
326
326
|
...k,
|
|
327
|
-
children:
|
|
327
|
+
children: s
|
|
328
328
|
}
|
|
329
|
-
) })),
|
|
330
|
-
const [
|
|
331
|
-
(
|
|
332
|
-
|
|
329
|
+
) })), ve = ({ name: o, defaultValue: n, render: d = ({ ref: i, name: s, defaultValue: a, value: E, setValue: c }) => null }) => {
|
|
330
|
+
const [i, s] = ee(n), a = Re(), E = F(), c = _(
|
|
331
|
+
(b, { shouldDirty: m = !1 } = {}) => {
|
|
332
|
+
a.actions.setFormState((k) => ({ ...k, [o]: b }), { shouldDirty: m }), s(b);
|
|
333
333
|
},
|
|
334
|
-
[
|
|
334
|
+
[s, a.actions.setFormState]
|
|
335
335
|
);
|
|
336
|
-
return
|
|
337
|
-
|
|
338
|
-
})), []),
|
|
339
|
-
},
|
|
340
|
-
const [
|
|
341
|
-
|
|
342
|
-
}, []),
|
|
343
|
-
|
|
344
|
-
}, []),
|
|
345
|
-
|
|
346
|
-
}, []),
|
|
347
|
-
|
|
336
|
+
return K(() => (a.actions.setFormState((m) => ({ ...m, [o]: n }), { shouldDirty: !1 }), a.subscribe(o, (m, { shouldDirty: k = !0, shouldOnChange: u = !0 } = {}) => {
|
|
337
|
+
s(m), a.actions.setFormState((v) => ({ ...v, [o]: m }), { shouldDirty: k, shouldOnChange: u }), E.current && typeof E.current.dispatchEvent == "function" && u && E.current.dispatchEvent(new Event("change"));
|
|
338
|
+
})), []), d({ ref: E, name: o, defaultValue: n, value: i, setValue: c });
|
|
339
|
+
}, ue = () => {
|
|
340
|
+
const [o, n] = ee({}), d = se(() => Object.values(o).filter(Boolean).length > 0, [o]), i = _((c, b) => {
|
|
341
|
+
n((m) => m[c] === b ? m : { ...m, [c]: b });
|
|
342
|
+
}, []), s = _((c) => {
|
|
343
|
+
n((b) => ({ ...b, ...c }));
|
|
344
|
+
}, []), a = _((c) => {
|
|
345
|
+
n((b) => b[c] ? { ...b, [c]: "" } : b);
|
|
346
|
+
}, []), E = _(() => {
|
|
347
|
+
n({});
|
|
348
348
|
}, []);
|
|
349
|
-
return { isError:
|
|
350
|
-
},
|
|
349
|
+
return { isError: d, errors: o, changeError: i, changeErrors: s, clearError: a, clearErrors: E };
|
|
350
|
+
}, Q = {
|
|
351
351
|
defaultValues: {},
|
|
352
352
|
numberFields: []
|
|
353
|
-
},
|
|
354
|
-
const { defaultValues:
|
|
355
|
-
}),
|
|
356
|
-
(
|
|
357
|
-
let
|
|
358
|
-
typeof
|
|
353
|
+
}, Te = (o = Q) => {
|
|
354
|
+
const { defaultValues: n = Q.defaultValues, numberFields: d = Q.numberFields } = o, { changeError: i, errors: s, changeErrors: a, clearError: E, clearErrors: c, isError: b } = ue(), [m, k] = ee(!1), u = F({}), v = F(n), w = F({}), P = F(() => {
|
|
355
|
+
}), h = F(), $ = _(
|
|
356
|
+
(t, { shouldDirty: T = !0, shouldOnChange: f = !0 } = {}) => {
|
|
357
|
+
let g = t;
|
|
358
|
+
typeof t == "function" && (g = t(u.current)), u.current = g;
|
|
359
359
|
let y = m;
|
|
360
|
-
|
|
360
|
+
T && (y = pe(u.current, v.current), y !== m && k(y)), f && P.current(u.current);
|
|
361
361
|
},
|
|
362
362
|
[m]
|
|
363
|
-
),
|
|
364
|
-
k(!1),
|
|
365
|
-
const
|
|
366
|
-
Object.values(
|
|
367
|
-
}, [
|
|
368
|
-
const
|
|
369
|
-
return
|
|
370
|
-
}, []),
|
|
371
|
-
})),
|
|
372
|
-
setTimeout(() =>
|
|
373
|
-
}, []),
|
|
374
|
-
(
|
|
375
|
-
const
|
|
376
|
-
|
|
363
|
+
), M = _(() => {
|
|
364
|
+
k(!1), c();
|
|
365
|
+
const t = w.current;
|
|
366
|
+
Object.values(t).forEach((f) => f("")), h.current.reset(), u.current = v.current;
|
|
367
|
+
}, [c]), X = _((t, T) => {
|
|
368
|
+
const f = w.current;
|
|
369
|
+
return f[t] = T, () => f[t] = null;
|
|
370
|
+
}, []), L = _((t) => (P.current = t, () => P.current = () => {
|
|
371
|
+
})), W = _((t) => ae(t.target), []), U = _((t) => t ? u.current[t] : u.current, []), q = _(() => v.current, []), x = _(() => {
|
|
372
|
+
setTimeout(() => h.current.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
373
|
+
}, []), C = _(
|
|
374
|
+
(t) => {
|
|
375
|
+
const T = ae(t.target);
|
|
376
|
+
T ? i(t.target.name, T) : i(t.target.name, null);
|
|
377
377
|
},
|
|
378
|
-
[
|
|
379
|
-
),
|
|
380
|
-
(
|
|
381
|
-
const y =
|
|
382
|
-
switch (typeof
|
|
378
|
+
[i]
|
|
379
|
+
), J = _(
|
|
380
|
+
(t, T, { shouldDirty: f = !0, shouldOnChange: g = !0 } = {}) => {
|
|
381
|
+
const y = w.current;
|
|
382
|
+
switch (typeof t) {
|
|
383
383
|
case "string":
|
|
384
384
|
{
|
|
385
|
-
const
|
|
386
|
-
if (!
|
|
387
|
-
throw new Error(`${
|
|
388
|
-
|
|
385
|
+
const O = y[t];
|
|
386
|
+
if (!O)
|
|
387
|
+
throw new Error(`${t} is uncontrolled, please use Controller for it!`);
|
|
388
|
+
O(T, { shouldDirty: f, shouldOnChange: g }), g && x();
|
|
389
389
|
}
|
|
390
390
|
break;
|
|
391
391
|
case "object":
|
|
392
|
-
Object.entries(
|
|
393
|
-
const
|
|
394
|
-
if (!
|
|
395
|
-
throw new Error(`${
|
|
396
|
-
|
|
397
|
-
}),
|
|
392
|
+
Object.entries(t).forEach(([O, z]) => {
|
|
393
|
+
const D = y[O];
|
|
394
|
+
if (!D)
|
|
395
|
+
throw new Error(`${O} is uncontrolled, please use Controller for it!`);
|
|
396
|
+
D(z, { shouldDirty: f, shouldOnChange: g });
|
|
397
|
+
}), g && x();
|
|
398
398
|
default:
|
|
399
399
|
return;
|
|
400
400
|
}
|
|
401
401
|
},
|
|
402
|
-
[
|
|
403
|
-
),
|
|
404
|
-
const
|
|
405
|
-
return Object.keys(
|
|
406
|
-
|
|
407
|
-
}),
|
|
408
|
-
}, []),
|
|
402
|
+
[x]
|
|
403
|
+
), N = _(() => {
|
|
404
|
+
const t = Object.fromEntries(new FormData(h.current)), T = w.current;
|
|
405
|
+
return Object.keys(T).map((f) => {
|
|
406
|
+
t[f] = u.current[f];
|
|
407
|
+
}), d.forEach((f) => t.hasOwnProperty(f) && (t[f] = +t[f])), t;
|
|
408
|
+
}, []), V = se(
|
|
409
409
|
() => ({
|
|
410
|
-
setValue:
|
|
411
|
-
instantChange:
|
|
412
|
-
getDefaultValues:
|
|
413
|
-
getFormState:
|
|
414
|
-
setFormState:
|
|
415
|
-
changeError:
|
|
416
|
-
changeErrors:
|
|
417
|
-
clearError:
|
|
418
|
-
clearErrors:
|
|
419
|
-
loadFormValues:
|
|
420
|
-
checkValidity:
|
|
421
|
-
getFieldValidity:
|
|
422
|
-
registerOnchange:
|
|
423
|
-
reset:
|
|
410
|
+
setValue: J,
|
|
411
|
+
instantChange: x,
|
|
412
|
+
getDefaultValues: q,
|
|
413
|
+
getFormState: U,
|
|
414
|
+
setFormState: $,
|
|
415
|
+
changeError: i,
|
|
416
|
+
changeErrors: a,
|
|
417
|
+
clearError: E,
|
|
418
|
+
clearErrors: c,
|
|
419
|
+
loadFormValues: N,
|
|
420
|
+
checkValidity: C,
|
|
421
|
+
getFieldValidity: W,
|
|
422
|
+
registerOnchange: L,
|
|
423
|
+
reset: M
|
|
424
424
|
}),
|
|
425
425
|
[
|
|
426
|
-
z,
|
|
427
|
-
A,
|
|
428
426
|
J,
|
|
427
|
+
x,
|
|
429
428
|
q,
|
|
430
|
-
M,
|
|
431
|
-
f,
|
|
432
|
-
s,
|
|
433
|
-
b,
|
|
434
|
-
V,
|
|
435
429
|
U,
|
|
430
|
+
$,
|
|
431
|
+
i,
|
|
432
|
+
a,
|
|
433
|
+
E,
|
|
436
434
|
N,
|
|
437
435
|
W,
|
|
438
|
-
|
|
436
|
+
C,
|
|
437
|
+
L,
|
|
438
|
+
M
|
|
439
439
|
]
|
|
440
440
|
);
|
|
441
|
-
return
|
|
442
|
-
if (
|
|
443
|
-
const
|
|
444
|
-
|
|
441
|
+
return K(() => {
|
|
442
|
+
if (h.current) {
|
|
443
|
+
const t = N();
|
|
444
|
+
v.current = { ...t, ...n }, u.current = { ...t, ...n };
|
|
445
445
|
}
|
|
446
|
-
}, []), { ref:
|
|
447
|
-
},
|
|
448
|
-
Form:
|
|
449
|
-
Controller:
|
|
450
|
-
useForm:
|
|
451
|
-
useValidateForm:
|
|
446
|
+
}, []), { ref: h, isDirty: m, isError: b, errors: s, numberFields: d, subscribe: X, actions: V };
|
|
447
|
+
}, ge = {
|
|
448
|
+
Form: _e,
|
|
449
|
+
Controller: ve,
|
|
450
|
+
useForm: Te,
|
|
451
|
+
useValidateForm: ue
|
|
452
452
|
};
|
|
453
453
|
export {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
454
|
+
ve as Controller,
|
|
455
|
+
_e as Form,
|
|
456
|
+
ge as default,
|
|
457
|
+
Te as useForm,
|
|
458
|
+
ue as useValidateForm
|
|
459
459
|
};
|
|
@@ -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 b(f,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:f,key:E,ref:c!==void 0?c:null,props:s}}return A.Fragment=a,A.jsx=b,A.jsxs=b,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 b(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 f(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,j,h,K,q){return i=h.ref,e={$$typeof:F,type:e,key:t,props:h,_owner:j},(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,j,h,K,q){var _=t.children;if(_!==void 0)if(k)if(v(_)){for(k=0;k<_.length;k++)l(_[k]);Object.freeze&&Object.freeze(_)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(_);if(n.call(t,"key")){_=o(e);var P=Object.keys(t).filter(function(Ee){return Ee!=="key"});k=0<P.length?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}",I[_+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,_,P,_),I[_+k]=!0)}if(_=null,i!==void 0&&(b(i),_=""+i),E(t)&&(b(t.key),_=""+t.key),"key"in t){i={};for(var $ in t)$!=="key"&&(i[$]=t[$])}else i=t;return _&&u(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,_,h,j,c(),i,K,q)}function l(e){typeof e=="object"&&e!==null&&e.$$typeof===F&&e._store&&(e._store.validated=1)}var p=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=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,n=Object.prototype.hasOwnProperty,v=Array.isArray,d=console.createTask?console.createTask:function(){return null};p={"react-stack-bottom-frame":function(e){return e()}};var S,O={},C=p["react-stack-bottom-frame"].bind(p,s)(),B=d(f(s)),I={};x.Fragment=y,x.jsx=function(e,t,i,k,j){var h=1e4>Y.recentlyCreatedOwnerStacks++;return g(e,t,i,!1,k,j,h?Error("react-stack-top-frame"):C,h?d(f(e)):B)},x.jsxs=function(e,t,i,k,j){var h=1e4>Y.recentlyCreatedOwnerStacks++;return g(e,t,i,!0,k,j,h?Error("react-stack-top-frame"):C,h?d(f(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 b=!1;return Object.keys(a).forEach(f=>{if(!(f in o)||b)return;const c=a[f],s=o[f];(typeof c=="object"||c!==s)&&(b=!0)}),b},oe=o=>(typeof o.setCustomValidity=="function"&&o.setCustomValidity(null),!o||typeof o.checkValidity!="function"||o.checkValidity()?null:o.validationMessage),se=({id:o,form:a,method:b,action:f,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:f,className:m,onSubmit:l=>{b||l.preventDefault();const p=a.actions.loadFormValues();s(p)},onInput:l=>{if(l.target.tagName==="FORM"){const p=a.actions.loadFormValues();a.actions.setFormState(p)}else E(l)},onChange:()=>{const l=a.actions.loadFormValues();a.actions.setFormState(l)},...g,children:c})})),ce=({name:o,defaultValue:a,render:b=({ref:f,name:c,defaultValue:s,value:E,setValue:u})=>null})=>{const[f,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(p=>({...p,[o]:m}),{shouldDirty:g,shouldOnChange:l}),E.current&&typeof E.current.dispatchEvent=="function"&&l&&E.current.dispatchEvent(new Event("change"))})),[]),b({ref:E,name:o,defaultValue:a,value:f,setValue:u})},H=()=>{const[o,a]=r.useState({}),b=r.useMemo(()=>Object.values(o).filter(Boolean).length>0,[o]),f=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:b,errors:o,changeError:f,changeErrors:c,clearError:s,clearErrors:E}},Z={defaultValues:{},numberFields:[]},ue=(o=Z)=>{const{defaultValues:a=Z.defaultValues,numberFields:b=Z.numberFields}=o,{changeError:f,errors:c,changeErrors:s,clearError:E,clearErrors:u,isError:R}=H(),[m,g]=r.useState(!1),l=r.useRef({}),p=r.useRef(a),F=r.useRef({}),N=r.useRef(()=>{}),y=r.useRef(),L=r.useCallback((n,{shouldDirty:v=!0,shouldOnChange:d=!0}={})=>{let S=n;typeof n=="function"&&(S=n(l.current)),l.current=S;let O=m;v&&(O=be(l.current,p.current),O!==m&&g(O)),d&&N.current(l.current)},[m]),W=r.useCallback(()=>{g(!1),u();const n=F.current;Object.values(n).forEach(d=>d("")),y.current.reset(),l.current=p.current},[u]),Q=r.useCallback((n,v)=>{const d=F.current;return d[n]=v,()=>d[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(()=>p.current,[]),w=r.useCallback(()=>{setTimeout(()=>y.current.dispatchEvent(new Event("input",{bubbles:!0})))},[]),V=r.useCallback(n=>{const v=oe(n.target);v?f(n.target.name,v):f(n.target.name,null)},[f]),X=r.useCallback((n,v,{shouldDirty:d=!0,shouldOnChange:S=!0}={})=>{const O=F.current;switch(typeof n){case"string":{const C=O[n];if(!C)throw new Error(`${n} is uncontrolled, please use Controller for it!`);C(v,{shouldDirty:d,shouldOnChange:S}),S&&w()}break;case"object":Object.entries(n).forEach(([C,B])=>{const I=O[C];if(!I)throw new Error(`${C} is uncontrolled, please use Controller for it!`);I(B,{shouldDirty:d,shouldOnChange:S})}),S&&w();default:return}},[w]),D=r.useCallback(()=>{const n=Object.fromEntries(new FormData(y.current)),v=F.current;return Object.keys(v).map(d=>{n[d]=l.current[d]}),b.forEach(d=>n.hasOwnProperty(d)&&(n[d]=+n[d])),n},[]),Y=r.useMemo(()=>({setValue:X,instantChange:w,getDefaultValues:G,getFormState:z,setFormState:L,changeError:f,changeErrors:s,clearError:E,clearErrors:u,loadFormValues:D,checkValidity:V,getFieldValidity:J,registerOnchange:U,reset:W}),[X,w,G,z,L,f,s,E,D,J,V,U,W]);return r.useEffect(()=>{if(y.current){const n=D();p.current={...n,...a},l.current={...n,...a}}},[]),{ref:y,isDirty:m,isError:R,errors:c,numberFields:b,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"}})});
|