react-hook-form-chakra
Advanced tools
Comparing version
@@ -1,12 +0,5 @@ | ||
import Ie, { useState as pr, Children as hr, isValidElement as mr, cloneElement as br } from "react"; | ||
import { FormControl as gr, FormLabel as yr, FormErrorMessage as xr, FormHelperText as Er, Stack as De, Checkbox as Ae, InputGroup as Ne, InputLeftAddon as Sr, InputLeftElement as Cr, Input as Rr, InputRightElement as _r, InputRightAddon as jr, NumberInput as Tr, NumberInputField as Pr, NumberInputStepper as kr, NumberIncrementStepper as wr, NumberDecrementStepper as Or, PinInputField as Fr, HStack as Ir, PinInput as Dr, RadioGroup as Ar, Button as $e, Select as Nr, Slider as $r, SliderTrack as Wr, SliderFilledTrack as Vr, SliderThumb as Yr, Flex as Lr, Switch as Mr, Textarea as Ur } from "@chakra-ui/react"; | ||
import { useController as T, get as U, useFormState as We, useFormContext as Br } from "react-hook-form"; | ||
var a = {}, Gr = { | ||
get exports() { | ||
return a; | ||
}, | ||
set exports(i) { | ||
a = i; | ||
} | ||
}, L = {}; | ||
import De, { useState as hr, Children as mr, isValidElement as br, cloneElement as gr } from "react"; | ||
import { FormControl as yr, FormLabel as xr, FormErrorMessage as Er, FormHelperText as Sr, Stack as Ae, Checkbox as Ne, InputGroup as $e, InputLeftAddon as Cr, InputLeftElement as Rr, Input as _r, InputRightElement as jr, InputRightAddon as Tr, NumberInput as Pr, NumberInputField as kr, NumberInputStepper as wr, NumberIncrementStepper as Or, NumberDecrementStepper as Fr, PinInputField as Ir, HStack as Dr, PinInput as Ar, RadioGroup as Nr, Button as We, Select as $r, Slider as Wr, SliderTrack as Vr, SliderFilledTrack as Yr, SliderThumb as Lr, Flex as Mr, Switch as Ur, Textarea as Br } from "@chakra-ui/react"; | ||
import { useController as T, get as U, useFormState as Ve, useFormContext as Gr } from "react-hook-form"; | ||
var ie = { exports: {} }, L = {}; | ||
/** | ||
@@ -21,19 +14,19 @@ * @license React | ||
*/ | ||
var Oe; | ||
var Fe; | ||
function qr() { | ||
if (Oe) | ||
if (Fe) | ||
return L; | ||
Oe = 1; | ||
var i = Ie, n = Symbol.for("react.element"), s = Symbol.for("react.fragment"), f = Object.prototype.hasOwnProperty, d = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function l(p, u, y) { | ||
var m, x = {}, C = null, O = null; | ||
y !== void 0 && (C = "" + y), u.key !== void 0 && (C = "" + u.key), u.ref !== void 0 && (O = u.ref); | ||
Fe = 1; | ||
var l = De, n = Symbol.for("react.element"), i = Symbol.for("react.fragment"), f = Object.prototype.hasOwnProperty, d = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function s(p, u, x) { | ||
var m, g = {}, C = null, O = null; | ||
x !== void 0 && (C = "" + x), u.key !== void 0 && (C = "" + u.key), u.ref !== void 0 && (O = u.ref); | ||
for (m in u) | ||
f.call(u, m) && !h.hasOwnProperty(m) && (x[m] = u[m]); | ||
f.call(u, m) && !h.hasOwnProperty(m) && (g[m] = u[m]); | ||
if (p && p.defaultProps) | ||
for (m in u = p.defaultProps, u) | ||
x[m] === void 0 && (x[m] = u[m]); | ||
return { $$typeof: n, type: p, key: C, ref: O, props: x, _owner: d.current }; | ||
g[m] === void 0 && (g[m] = u[m]); | ||
return { $$typeof: n, type: p, key: C, ref: O, props: g, _owner: d.current }; | ||
} | ||
return L.Fragment = s, L.jsx = l, L.jsxs = l, L; | ||
return L.Fragment = i, L.jsx = s, L.jsxs = s, L; | ||
} | ||
@@ -50,7 +43,7 @@ var M = {}; | ||
*/ | ||
var Fe; | ||
var Ie; | ||
function Jr() { | ||
return Fe || (Fe = 1, process.env.NODE_ENV !== "production" && function() { | ||
var i = Ie, n = Symbol.for("react.element"), s = Symbol.for("react.portal"), f = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), p = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), A = Symbol.iterator, H = "@@iterator"; | ||
function ie(e) { | ||
return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && function() { | ||
var l = De, n = Symbol.for("react.element"), i = Symbol.for("react.portal"), f = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), p = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), A = Symbol.iterator, H = "@@iterator"; | ||
function se(e) { | ||
if (e === null || typeof e != "object") | ||
@@ -61,3 +54,3 @@ return null; | ||
} | ||
var F = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
var F = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function R(e) { | ||
@@ -74,18 +67,18 @@ { | ||
b !== "" && (r += "%s", t = t.concat([b])); | ||
var g = t.map(function(v) { | ||
var y = t.map(function(v) { | ||
return String(v); | ||
}); | ||
g.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, g); | ||
y.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, y); | ||
} | ||
} | ||
var W = !1, I = !1, X = !1, Ve = !1, Ye = !1, se; | ||
se = Symbol.for("react.module.reference"); | ||
function Le(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === f || e === h || Ye || e === d || e === y || e === m || Ve || e === O || W || I || X || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === x || e.$$typeof === l || e.$$typeof === p || e.$$typeof === u || // This needs to include all possible module reference object | ||
var W = !1, I = !1, X = !1, Ye = !1, Le = !1, le; | ||
le = Symbol.for("react.module.reference"); | ||
function Me(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === f || e === h || Le || e === d || e === x || e === m || Ye || e === O || W || I || X || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === g || e.$$typeof === s || e.$$typeof === p || e.$$typeof === u || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
// we don't know which Flight build this will end up being used | ||
// with. | ||
e.$$typeof === se || e.getModuleId !== void 0)); | ||
e.$$typeof === le || e.getModuleId !== void 0)); | ||
} | ||
function Me(e, r, t) { | ||
function Ue(e, r, t) { | ||
var o = e.displayName; | ||
@@ -97,3 +90,3 @@ if (o) | ||
} | ||
function le(e) { | ||
function ue(e) { | ||
return e.displayName || "Context"; | ||
@@ -111,3 +104,3 @@ } | ||
return "Fragment"; | ||
case s: | ||
case i: | ||
return "Portal"; | ||
@@ -118,3 +111,3 @@ case h: | ||
return "StrictMode"; | ||
case y: | ||
case x: | ||
return "Suspense"; | ||
@@ -128,15 +121,15 @@ case m: | ||
var r = e; | ||
return le(r) + ".Consumer"; | ||
case l: | ||
return ue(r) + ".Consumer"; | ||
case s: | ||
var t = e; | ||
return le(t._context) + ".Provider"; | ||
return ue(t._context) + ".Provider"; | ||
case u: | ||
return Me(e, e.render, "ForwardRef"); | ||
case x: | ||
return Ue(e, e.render, "ForwardRef"); | ||
case g: | ||
var o = e.displayName || null; | ||
return o !== null ? o : k(e.type) || "Memo"; | ||
case C: { | ||
var b = e, g = b._payload, v = b._init; | ||
var b = e, y = b._payload, v = b._init; | ||
try { | ||
return k(v(g)); | ||
return k(v(y)); | ||
} catch { | ||
@@ -149,14 +142,14 @@ return null; | ||
} | ||
var D = Object.assign, V = 0, ue, ce, fe, de, ve, pe, he; | ||
function me() { | ||
var D = Object.assign, V = 0, ce, fe, de, ve, pe, he, me; | ||
function be() { | ||
} | ||
me.__reactDisabledLog = !0; | ||
function Ue() { | ||
be.__reactDisabledLog = !0; | ||
function Be() { | ||
{ | ||
if (V === 0) { | ||
ue = console.log, ce = console.info, fe = console.warn, de = console.error, ve = console.group, pe = console.groupCollapsed, he = console.groupEnd; | ||
ce = console.log, fe = console.info, de = console.warn, ve = console.error, pe = console.group, he = console.groupCollapsed, me = console.groupEnd; | ||
var e = { | ||
configurable: !0, | ||
enumerable: !0, | ||
value: me, | ||
value: be, | ||
writable: !0 | ||
@@ -177,3 +170,3 @@ }; | ||
} | ||
function Be() { | ||
function Ge() { | ||
{ | ||
@@ -188,21 +181,21 @@ if (V--, V === 0) { | ||
log: D({}, e, { | ||
value: ue | ||
value: ce | ||
}), | ||
info: D({}, e, { | ||
value: ce | ||
value: fe | ||
}), | ||
warn: D({}, e, { | ||
value: fe | ||
value: de | ||
}), | ||
error: D({}, e, { | ||
value: de | ||
value: ve | ||
}), | ||
group: D({}, e, { | ||
value: ve | ||
value: pe | ||
}), | ||
groupCollapsed: D({}, e, { | ||
value: pe | ||
value: he | ||
}), | ||
groupEnd: D({}, e, { | ||
value: he | ||
value: me | ||
}) | ||
@@ -230,6 +223,6 @@ }); | ||
{ | ||
var Ge = typeof WeakMap == "function" ? WeakMap : Map; | ||
G = new Ge(); | ||
var qe = typeof WeakMap == "function" ? WeakMap : Map; | ||
G = new qe(); | ||
} | ||
function be(e, r) { | ||
function ge(e, r) { | ||
if (!e || ee) | ||
@@ -246,4 +239,4 @@ return ""; | ||
Error.prepareStackTrace = void 0; | ||
var g; | ||
g = Z.current, Z.current = null, Ue(); | ||
var y; | ||
y = Z.current, Z.current = null, Be(); | ||
try { | ||
@@ -301,11 +294,11 @@ if (r) { | ||
} finally { | ||
ee = !1, Z.current = g, Be(), Error.prepareStackTrace = b; | ||
ee = !1, Z.current = y, Ge(), Error.prepareStackTrace = b; | ||
} | ||
var $ = e ? e.displayName || e.name : "", we = $ ? B($) : ""; | ||
return typeof e == "function" && G.set(e, we), we; | ||
var $ = e ? e.displayName || e.name : "", Oe = $ ? B($) : ""; | ||
return typeof e == "function" && G.set(e, Oe), Oe; | ||
} | ||
function qe(e, r, t) { | ||
return be(e, !1); | ||
function Je(e, r, t) { | ||
return ge(e, !1); | ||
} | ||
function Je(e) { | ||
function ze(e) { | ||
var r = e.prototype; | ||
@@ -318,7 +311,7 @@ return !!(r && r.isReactComponent); | ||
if (typeof e == "function") | ||
return be(e, Je(e)); | ||
return ge(e, ze(e)); | ||
if (typeof e == "string") | ||
return B(e); | ||
switch (e) { | ||
case y: | ||
case x: | ||
return B("Suspense"); | ||
@@ -331,9 +324,9 @@ case m: | ||
case u: | ||
return qe(e.render); | ||
case x: | ||
return Je(e.render); | ||
case g: | ||
return q(e.type, r, t); | ||
case C: { | ||
var o = e, b = o._payload, g = o._init; | ||
var o = e, b = o._payload, y = o._init; | ||
try { | ||
return q(g(b), r, t); | ||
return q(y(b), r, t); | ||
} catch { | ||
@@ -345,15 +338,15 @@ } | ||
} | ||
var J = Object.prototype.hasOwnProperty, ge = {}, ye = F.ReactDebugCurrentFrame; | ||
var J = Object.prototype.hasOwnProperty, ye = {}, xe = F.ReactDebugCurrentFrame; | ||
function z(e) { | ||
if (e) { | ||
var r = e._owner, t = q(e.type, e._source, r ? r.type : null); | ||
ye.setExtraStackFrame(t); | ||
xe.setExtraStackFrame(t); | ||
} else | ||
ye.setExtraStackFrame(null); | ||
xe.setExtraStackFrame(null); | ||
} | ||
function ze(e, r, t, o, b) { | ||
function He(e, r, t, o, b) { | ||
{ | ||
var g = Function.call.bind(J); | ||
var y = Function.call.bind(J); | ||
for (var v in e) | ||
if (g(e, v)) { | ||
if (y(e, v)) { | ||
var c = void 0; | ||
@@ -369,11 +362,11 @@ try { | ||
} | ||
c && !(c instanceof Error) && (z(b), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", o || "React class", t, v, typeof c), z(null)), c instanceof Error && !(c.message in ge) && (ge[c.message] = !0, z(b), R("Failed %s type: %s", t, c.message), z(null)); | ||
c && !(c instanceof Error) && (z(b), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", o || "React class", t, v, typeof c), z(null)), c instanceof Error && !(c.message in ye) && (ye[c.message] = !0, z(b), R("Failed %s type: %s", t, c.message), z(null)); | ||
} | ||
} | ||
} | ||
var He = Array.isArray; | ||
var Ke = Array.isArray; | ||
function re(e) { | ||
return He(e); | ||
return Ke(e); | ||
} | ||
function Ke(e) { | ||
function Xe(e) { | ||
{ | ||
@@ -384,5 +377,5 @@ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object"; | ||
} | ||
function Xe(e) { | ||
function Ze(e) { | ||
try { | ||
return xe(e), !1; | ||
return Ee(e), !1; | ||
} catch { | ||
@@ -392,10 +385,10 @@ return !0; | ||
} | ||
function xe(e) { | ||
function Ee(e) { | ||
return "" + e; | ||
} | ||
function Ee(e) { | ||
if (Xe(e)) | ||
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), xe(e); | ||
function Se(e) { | ||
if (Ze(e)) | ||
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(e)), Ee(e); | ||
} | ||
var Y = F.ReactCurrentOwner, Ze = { | ||
var Y = F.ReactCurrentOwner, Qe = { | ||
key: !0, | ||
@@ -405,5 +398,5 @@ ref: !0, | ||
__source: !0 | ||
}, Se, Ce, te; | ||
}, Ce, Re, te; | ||
te = {}; | ||
function Qe(e) { | ||
function er(e) { | ||
if (J.call(e, "ref")) { | ||
@@ -416,3 +409,3 @@ var r = Object.getOwnPropertyDescriptor(e, "ref").get; | ||
} | ||
function er(e) { | ||
function rr(e) { | ||
if (J.call(e, "key")) { | ||
@@ -425,3 +418,3 @@ var r = Object.getOwnPropertyDescriptor(e, "key").get; | ||
} | ||
function rr(e, r) { | ||
function tr(e, r) { | ||
if (typeof e.ref == "string" && Y.current && r && Y.current.stateNode !== r) { | ||
@@ -432,6 +425,6 @@ var t = k(Y.current.type); | ||
} | ||
function tr(e, r) { | ||
function nr(e, r) { | ||
{ | ||
var t = function() { | ||
Se || (Se = !0, R("%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://reactjs.org/link/special-props)", r)); | ||
Ce || (Ce = !0, R("%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://reactjs.org/link/special-props)", r)); | ||
}; | ||
@@ -444,6 +437,6 @@ t.isReactWarning = !0, Object.defineProperty(e, "key", { | ||
} | ||
function nr(e, r) { | ||
function or(e, r) { | ||
{ | ||
var t = function() { | ||
Ce || (Ce = !0, R("%s: `ref` 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://reactjs.org/link/special-props)", r)); | ||
Re || (Re = !0, R("%s: `ref` 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://reactjs.org/link/special-props)", r)); | ||
}; | ||
@@ -456,3 +449,3 @@ t.isReactWarning = !0, Object.defineProperty(e, "ref", { | ||
} | ||
var or = function(e, r, t, o, b, g, v) { | ||
var ar = function(e, r, t, o, b, y, v) { | ||
var c = { | ||
@@ -467,3 +460,3 @@ // This tag allows us to uniquely identify this as a React Element | ||
// Record the component responsible for creating this element. | ||
_owner: g | ||
_owner: y | ||
}; | ||
@@ -487,27 +480,27 @@ return c._store = {}, Object.defineProperty(c._store, "validated", { | ||
}; | ||
function ar(e, r, t, o, b) { | ||
function ir(e, r, t, o, b) { | ||
{ | ||
var g, v = {}, c = null, _ = null; | ||
t !== void 0 && (Ee(t), c = "" + t), er(r) && (Ee(r.key), c = "" + r.key), Qe(r) && (_ = r.ref, rr(r, b)); | ||
for (g in r) | ||
J.call(r, g) && !Ze.hasOwnProperty(g) && (v[g] = r[g]); | ||
var y, v = {}, c = null, _ = null; | ||
t !== void 0 && (Se(t), c = "" + t), rr(r) && (Se(r.key), c = "" + r.key), er(r) && (_ = r.ref, tr(r, b)); | ||
for (y in r) | ||
J.call(r, y) && !Qe.hasOwnProperty(y) && (v[y] = r[y]); | ||
if (e && e.defaultProps) { | ||
var E = e.defaultProps; | ||
for (g in E) | ||
v[g] === void 0 && (v[g] = E[g]); | ||
for (y in E) | ||
v[y] === void 0 && (v[y] = E[y]); | ||
} | ||
if (c || _) { | ||
var S = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; | ||
c && tr(v, S), _ && nr(v, S); | ||
c && nr(v, S), _ && or(v, S); | ||
} | ||
return or(e, c, _, b, o, Y.current, v); | ||
return ar(e, c, _, b, o, Y.current, v); | ||
} | ||
} | ||
var ne = F.ReactCurrentOwner, Re = F.ReactDebugCurrentFrame; | ||
var ne = F.ReactCurrentOwner, _e = F.ReactDebugCurrentFrame; | ||
function N(e) { | ||
if (e) { | ||
var r = e._owner, t = q(e.type, e._source, r ? r.type : null); | ||
Re.setExtraStackFrame(t); | ||
_e.setExtraStackFrame(t); | ||
} else | ||
Re.setExtraStackFrame(null); | ||
_e.setExtraStackFrame(null); | ||
} | ||
@@ -519,3 +512,3 @@ var oe; | ||
} | ||
function _e() { | ||
function je() { | ||
{ | ||
@@ -532,3 +525,3 @@ if (ne.current) { | ||
} | ||
function ir(e) { | ||
function sr(e) { | ||
{ | ||
@@ -544,6 +537,6 @@ if (e !== void 0) { | ||
} | ||
var je = {}; | ||
function sr(e) { | ||
var Te = {}; | ||
function lr(e) { | ||
{ | ||
var r = _e(); | ||
var r = je(); | ||
if (!r) { | ||
@@ -558,3 +551,3 @@ var t = typeof e == "string" ? e : e.displayName || e.name; | ||
} | ||
function Te(e, r) { | ||
function Pe(e, r) { | ||
{ | ||
@@ -564,6 +557,6 @@ if (!e._store || e._store.validated || e.key != null) | ||
e._store.validated = !0; | ||
var t = sr(r); | ||
if (je[t]) | ||
var t = lr(r); | ||
if (Te[t]) | ||
return; | ||
je[t] = !0; | ||
Te[t] = !0; | ||
var o = ""; | ||
@@ -573,3 +566,3 @@ e && e._owner && e._owner !== ne.current && (o = " It was passed a child from " + k(e._owner.type) + "."), N(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, o), N(null); | ||
} | ||
function Pe(e, r) { | ||
function ke(e, r) { | ||
{ | ||
@@ -581,3 +574,3 @@ if (typeof e != "object") | ||
var o = e[t]; | ||
ae(o) && Te(o, r); | ||
ae(o) && Pe(o, r); | ||
} | ||
@@ -587,10 +580,10 @@ else if (ae(e)) | ||
else if (e) { | ||
var b = ie(e); | ||
var b = se(e); | ||
if (typeof b == "function" && b !== e.entries) | ||
for (var g = b.call(e), v; !(v = g.next()).done; ) | ||
ae(v.value) && Te(v.value, r); | ||
for (var y = b.call(e), v; !(v = y.next()).done; ) | ||
ae(v.value) && Pe(v.value, r); | ||
} | ||
} | ||
} | ||
function lr(e) { | ||
function ur(e) { | ||
{ | ||
@@ -605,3 +598,3 @@ var r = e.type; | ||
// Inner props are checked in the reconciler. | ||
r.$$typeof === x)) | ||
r.$$typeof === g)) | ||
t = r.propTypes; | ||
@@ -612,3 +605,3 @@ else | ||
var o = k(r); | ||
ze(t, e.props, "prop", o, e); | ||
He(t, e.props, "prop", o, e); | ||
} else if (r.PropTypes !== void 0 && !oe) { | ||
@@ -622,3 +615,3 @@ oe = !0; | ||
} | ||
function ur(e) { | ||
function cr(e) { | ||
{ | ||
@@ -635,14 +628,14 @@ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) { | ||
} | ||
function ke(e, r, t, o, b, g) { | ||
function we(e, r, t, o, b, y) { | ||
{ | ||
var v = Le(e); | ||
var v = Me(e); | ||
if (!v) { | ||
var c = ""; | ||
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); | ||
var _ = ir(b); | ||
_ ? c += _ : c += _e(); | ||
var _ = sr(b); | ||
_ ? c += _ : c += je(); | ||
var E; | ||
e === null ? E = "null" : re(e) ? E = "array" : e !== void 0 && e.$$typeof === n ? (E = "<" + (k(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, c); | ||
} | ||
var S = ar(e, r, t, b, g); | ||
var S = ir(e, r, t, b, y); | ||
if (S == null) | ||
@@ -656,3 +649,3 @@ return S; | ||
for (var $ = 0; $ < j.length; $++) | ||
Pe(j[$], e); | ||
ke(j[$], e); | ||
Object.freeze && Object.freeze(j); | ||
@@ -662,112 +655,111 @@ } else | ||
else | ||
Pe(j, e); | ||
ke(j, e); | ||
} | ||
return e === f ? ur(S) : lr(S), S; | ||
return e === f ? cr(S) : ur(S), S; | ||
} | ||
} | ||
function cr(e, r, t) { | ||
return ke(e, r, t, !0); | ||
} | ||
function fr(e, r, t) { | ||
return ke(e, r, t, !1); | ||
return we(e, r, t, !0); | ||
} | ||
var dr = fr, vr = cr; | ||
M.Fragment = f, M.jsx = dr, M.jsxs = vr; | ||
function dr(e, r, t) { | ||
return we(e, r, t, !1); | ||
} | ||
var vr = dr, pr = fr; | ||
M.Fragment = f, M.jsx = vr, M.jsxs = pr; | ||
}()), M; | ||
} | ||
(function(i) { | ||
process.env.NODE_ENV === "production" ? i.exports = qr() : i.exports = Jr(); | ||
})(Gr); | ||
const P = (i) => { | ||
const { children: n, name: s, control: f, label: d, labelProps: h, helperText: l, helperTextProps: p, errorMessageProps: u, ...y } = i, { fieldState: { isTouched: m }, formState: { errors: x } } = T({ name: s, control: f }), C = U(x, s, ""); | ||
return a.jsxs(gr, { isInvalid: !!C && m, ...y, children: [d && typeof d == "string" ? a.jsx(yr, { htmlFor: s, ...h, children: d }) : d, n, C && a.jsx(xr, { ...u, children: C.message }), l && typeof l == "string" ? a.jsx(Er, { ...p, children: l }) : l] }); | ||
}, zr = (i) => { | ||
const { name: n, label: s, control: f, children: d, stackProps: h, ...l } = i, { field: p } = T({ | ||
process.env.NODE_ENV === "production" ? ie.exports = qr() : ie.exports = Jr(); | ||
var a = ie.exports; | ||
const P = (l) => { | ||
const { children: n, name: i, control: f, label: d, labelProps: h, helperText: s, helperTextProps: p, errorMessageProps: u, ...x } = l, { formState: { errors: m } } = T({ name: i, control: f }), g = U(m, i, ""), C = !!(g != null && g.message); | ||
return a.jsxs(yr, { isInvalid: C, ...x, children: [d && typeof d == "string" ? a.jsx(xr, { htmlFor: i, ...h, children: d }) : d, n, a.jsx(Er, { ...u, children: g.message }), s && typeof s == "string" ? a.jsx(Sr, { ...p, children: s }) : s] }); | ||
}, zr = (l) => { | ||
const { name: n, label: i, control: f, children: d, stackProps: h, ...s } = l, { field: p } = T({ | ||
control: f, | ||
name: n | ||
}), [u, y] = pr(p.value || []), m = hr.map(d, (x) => mr(x) ? br(x, { checkboxValue: u, setCheckboxValue: y, control: f }) : x); | ||
return a.jsx(P, { name: n, label: s, control: f, ...l, children: a.jsx(De, { pl: 6, mt: 1, spacing: 1, ...h, children: m }) }); | ||
}), [u, x] = hr(p.value || []), m = mr.map(d, (g) => br(g) ? gr(g, { checkboxValue: u, setCheckboxValue: x, control: f }) : g); | ||
return a.jsx(P, { name: n, label: i, control: f, ...s, children: a.jsx(Ae, { pl: 6, mt: 1, spacing: 1, ...h, children: m }) }); | ||
}; | ||
zr.displayName = "CheckboxContainer"; | ||
const Hr = (i) => { | ||
const { name: n, control: s, label: f, children: d, checkboxValue: h, setCheckboxValue: l, onChange: p, value: u, ...y } = i; | ||
if (!l) | ||
const Hr = (l) => { | ||
const { name: n, control: i, label: f, children: d, checkboxValue: h, setCheckboxValue: s, onChange: p, value: u, ...x } = l; | ||
if (!s) | ||
throw new Error("CheckboxControl must be wrapped by CheckboxContainer. If you need an individual checkbox please use CheckboxSingle"); | ||
const { field: m, fieldState: { isTouched: x }, formState: { errors: C, isSubmitting: O } } = T({ name: n, control: s }), A = U(C, n, ""), H = m.value instanceof Array ? m.value.includes(i.value) : !1, { value: ie, onChange: F, ...R } = m, K = (W) => { | ||
const { field: m, fieldState: { isTouched: g }, formState: { errors: C, isSubmitting: O } } = T({ name: n, control: i }), A = U(C, n, ""), H = m.value instanceof Array ? m.value.includes(l.value) : !1, { value: se, onChange: F, ...R } = m, K = (W) => { | ||
let I = h ?? []; | ||
W.target.checked ? I = [...I, W.target.value] : I = I.filter((X) => X !== W.target.value), F(I), l && l(I); | ||
W.target.checked ? I = [...I, W.target.value] : I = I.filter((X) => X !== W.target.value), F(I), s && s(I); | ||
}; | ||
return a.jsxs(Ae, { isInvalid: !!A && x, isChecked: H, isDisabled: O, onChange: K, value: u, ...R, ...y, children: [f, d] }); | ||
return a.jsxs(Ne, { isInvalid: !!A && g, isChecked: H, isDisabled: O, onChange: K, value: u, ...R, ...x, children: [f, d] }); | ||
}; | ||
Hr.displayName = "CheckboxControl"; | ||
const Kr = (i) => { | ||
const { name: n, control: s, label: f, children: d, checkBoxProps: h, ...l } = i, { field: p, fieldState: { isTouched: u }, formState: { errors: y, isSubmitting: m } } = T({ name: n, control: s }), x = U(y, n, ""), C = p.value; | ||
return a.jsx(P, { name: n, control: s, ...l, children: a.jsxs(Ae, { ...p, id: n, isInvalid: !!x && u, isChecked: C, isDisabled: m, ...h, children: [f, d] }) }); | ||
const Kr = (l) => { | ||
const { name: n, control: i, label: f, children: d, checkBoxProps: h, ...s } = l, { field: p, fieldState: { isTouched: u }, formState: { errors: x, isSubmitting: m } } = T({ name: n, control: i }), g = U(x, n, ""), C = p.value; | ||
return a.jsx(P, { name: n, control: i, ...s, children: a.jsxs(Ne, { ...p, id: n, isInvalid: !!g && u, isChecked: C, isDisabled: m, ...h, children: [f, d] }) }); | ||
}; | ||
Kr.displayName = "CheckboxSingleControl"; | ||
const Xr = (i) => { | ||
const { name: n, control: s, label: f, inputProps: d, leftAddon: h, rightAddon: l, leftElement: p, rightElement: u, ...y } = i, { field: m, formState: { isSubmitting: x } } = T({ | ||
const Xr = (l) => { | ||
const { name: n, control: i, label: f, inputProps: d, leftAddon: h, rightAddon: s, leftElement: p, rightElement: u, ...x } = l, { field: m, formState: { isSubmitting: g } } = T({ | ||
name: n, | ||
control: s | ||
control: i | ||
}); | ||
return a.jsx(P, { name: n, control: s, label: f, ...y, children: a.jsxs(Ne, { children: [typeof h == "string" ? a.jsx(Sr, { children: h }) : h, typeof p == "string" ? a.jsx(Cr, { children: p }) : p, a.jsx(Rr, { ...m, id: n, isDisabled: x, ...d }), typeof u == "string" ? a.jsx(_r, { children: u }) : u, typeof l == "string" ? a.jsx(jr, { children: l }) : l] }) }); | ||
return a.jsx(P, { name: n, control: i, label: f, ...x, children: a.jsxs($e, { children: [typeof h == "string" ? a.jsx(Cr, { children: h }) : h, typeof p == "string" ? a.jsx(Rr, { children: p }) : p, a.jsx(_r, { ...m, id: n, isDisabled: g, ...d }), typeof u == "string" ? a.jsx(jr, { children: u }) : u, typeof s == "string" ? a.jsx(Tr, { children: s }) : s] }) }); | ||
}; | ||
Xr.displayName = "InputControl"; | ||
const Zr = (i) => { | ||
const { name: n, control: s, label: f, showStepper: d = !0, children: h, numberInputProps: l, ...p } = i, { field: u, fieldState: { isTouched: y }, formState: { isSubmitting: m, errors: x } } = T({ | ||
const Zr = (l) => { | ||
const { name: n, control: i, label: f, showStepper: d = !0, children: h, numberInputProps: s, ...p } = l, { field: u, fieldState: { isTouched: x }, formState: { isSubmitting: m, errors: g } } = T({ | ||
name: n, | ||
control: s | ||
}), C = U(x, n, ""), { ref: O, ...A } = u; | ||
return a.jsx(P, { name: n, control: s, label: f, ...p, children: a.jsxs(Ne, { children: ["=", a.jsxs(Tr, { ...A, id: n, isInvalid: !!C && y, isDisabled: m, ...l, children: [a.jsx(Pr, { name: n, ref: O }), d && a.jsxs(kr, { children: [a.jsx(wr, {}), a.jsx(Or, {})] }), h] }), "="] }) }); | ||
control: i | ||
}), C = U(g, n, ""), { ref: O, ...A } = u; | ||
return a.jsx(P, { name: n, control: i, label: f, ...p, children: a.jsxs($e, { children: ["=", a.jsxs(Pr, { ...A, id: n, isInvalid: !!C && x, isDisabled: m, ...s, children: [a.jsx(kr, { name: n, ref: O }), d && a.jsxs(wr, { children: [a.jsx(Or, {}), a.jsx(Fr, {})] }), h] }), "="] }) }); | ||
}; | ||
Zr.displayName = "NumberInputControl"; | ||
const at = (i) => { | ||
const { name: n, control: s, label: f, pinAmount: d, stackProps: h, pinInputProps: l, ...p } = i, { field: u, formState: { isSubmitting: y } } = T({ | ||
const at = (l) => { | ||
const { name: n, control: i, label: f, pinAmount: d, stackProps: h, pinInputProps: s, ...p } = l, { field: u, formState: { isSubmitting: x } } = T({ | ||
name: n, | ||
control: s | ||
}), m = Array(d).fill(null).map((x, C) => a.jsx(Fr, {}, C)); | ||
return a.jsx(P, { name: n, control: s, label: f, ...p, children: a.jsx(Ir, { ...h, children: a.jsx(Dr, { ...u, isDisabled: y, ...l, children: m }) }) }); | ||
}, it = (i) => { | ||
const { name: n, control: s, label: f, radioGroupProps: d, stackProps: h, children: l, ...p } = i, { field: u, formState: { isSubmitting: y } } = T({ | ||
control: i | ||
}), m = Array(d).fill(null).map((g, C) => a.jsx(Ir, {}, C)); | ||
return a.jsx(P, { name: n, control: i, label: f, ...p, children: a.jsx(Dr, { ...h, children: a.jsx(Ar, { ...u, isDisabled: x, ...s, children: m }) }) }); | ||
}, it = (l) => { | ||
const { name: n, control: i, label: f, radioGroupProps: d, stackProps: h, children: s, ...p } = l, { field: u, formState: { isSubmitting: x } } = T({ | ||
name: n, | ||
control: s | ||
control: i | ||
}); | ||
return a.jsx(P, { name: n, control: s, label: f, ...p, children: a.jsx(Ar, { ...u, isDisabled: y, ...d, children: a.jsx(De, { direction: "row", ...h, children: l }) }) }); | ||
}, st = (i) => { | ||
const { children: n, control: s, reset: f, ...d } = i, { isSubmitting: h, isDirty: l } = We({ control: s }); | ||
if (i.control && !i.reset) | ||
return a.jsx(P, { name: n, control: i, label: f, ...p, children: a.jsx(Nr, { ...u, isDisabled: x, ...d, children: a.jsx(Ae, { direction: "row", ...h, children: s }) }) }); | ||
}, st = (l) => { | ||
const { children: n, control: i, reset: f, ...d } = l, { isSubmitting: h, isDirty: s } = Ve({ control: i }); | ||
if (l.control && !l.reset) | ||
throw new Error('Missing prop "reset" required if not using FormProvider'); | ||
const p = i.control && i.reset ? i.reset : Br().reset; | ||
return a.jsx($e, { type: "reset", onClick: () => p(), isDisabled: h || !l, ...d, children: n }); | ||
}, Qr = (i) => { | ||
const { name: n, control: s, selectProps: f, children: d, ...h } = i, { field: l, formState: { isSubmitting: p } } = T({ | ||
const p = l.control && l.reset ? l.reset : Gr().reset; | ||
return a.jsx(We, { type: "reset", onClick: () => p(), isDisabled: h || !s, ...d, children: n }); | ||
}, Qr = (l) => { | ||
const { name: n, control: i, selectProps: f, children: d, ...h } = l, { field: s, formState: { isSubmitting: p } } = T({ | ||
name: n, | ||
control: s | ||
control: i | ||
}); | ||
return a.jsx(P, { name: n, control: s, ...h, children: a.jsx(Nr, { ...l, id: n, isDisabled: p, ...f, children: d }) }); | ||
return a.jsx(P, { name: n, control: i, ...h, children: a.jsx($r, { ...s, id: n, isDisabled: p, ...f, children: d }) }); | ||
}; | ||
Qr.displayName = "SelectControl"; | ||
const lt = (i) => { | ||
const { name: n, control: s, sliderProps: f, sliderTrackProps: d, sliderThumbProps: h, ...l } = i, { field: p, formState: { isSubmitting: u } } = T({ | ||
const lt = (l) => { | ||
const { name: n, control: i, sliderProps: f, sliderTrackProps: d, sliderThumbProps: h, ...s } = l, { field: p, formState: { isSubmitting: u } } = T({ | ||
name: n, | ||
control: s | ||
control: i | ||
}); | ||
return a.jsx(P, { name: n, control: s, ...l, children: a.jsxs($r, { ...p, id: n, isDisabled: u, ...f, children: [a.jsx(Wr, { ...d, children: a.jsx(Vr, {}) }), a.jsx(Yr, { ...h })] }) }); | ||
}, ut = (i) => { | ||
const { children: n, control: s, ...f } = i, { isSubmitting: d } = We({ control: s }); | ||
return a.jsx($e, { type: "submit", isLoading: d, ...f, children: n }); | ||
}, et = (i) => { | ||
const { name: n, control: s, label: f, switchProps: d, ...h } = i, { field: l, fieldState: { isTouched: p }, formState: { isSubmitting: u, errors: y } } = T({ | ||
return a.jsx(P, { name: n, control: i, ...s, children: a.jsxs(Wr, { ...p, id: n, isDisabled: u, ...f, children: [a.jsx(Vr, { ...d, children: a.jsx(Yr, {}) }), a.jsx(Lr, { ...h })] }) }); | ||
}, ut = (l) => { | ||
const { children: n, control: i, ...f } = l, { isSubmitting: d } = Ve({ control: i }); | ||
return a.jsx(We, { type: "submit", isLoading: d, ...f, children: n }); | ||
}, et = (l) => { | ||
const { name: n, control: i, label: f, switchProps: d, ...h } = l, { field: s, fieldState: { isTouched: p }, formState: { isSubmitting: u, errors: x } } = T({ | ||
name: n, | ||
control: s | ||
}), m = U(y, n, ""); | ||
return a.jsx(P, { name: n, control: s, label: f, as: Lr, alignItems: "center", ...h, children: a.jsx(Mr, { ...l, id: n, isInvalid: !!m && p, isChecked: l.value, isDisabled: u, ...d }) }); | ||
control: i | ||
}), m = U(x, n, ""); | ||
return a.jsx(P, { name: n, control: i, label: f, as: Mr, alignItems: "center", ...h, children: a.jsx(Ur, { ...s, id: n, isInvalid: !!m && p, isChecked: s.value, isDisabled: u, ...d }) }); | ||
}; | ||
et.displayName = "SwitchControl"; | ||
const rt = (i) => { | ||
const { name: n, control: s, textareaProps: f, ...d } = i, { field: h, formState: { isSubmitting: l } } = T({ | ||
const rt = (l) => { | ||
const { name: n, control: i, textareaProps: f, ...d } = l, { field: h, formState: { isSubmitting: s } } = T({ | ||
name: n, | ||
control: s | ||
control: i | ||
}); | ||
return a.jsx(P, { name: n, control: s, ...d, children: a.jsx(Ur, { ...h, id: n, isDisabled: l, ...f }) }); | ||
return a.jsx(P, { name: n, control: i, ...d, children: a.jsx(Br, { ...h, id: n, isDisabled: s, ...f }) }); | ||
}; | ||
@@ -774,0 +766,0 @@ rt.displayName = "TextareaControl"; |
@@ -5,3 +5,3 @@ { | ||
"author": "Crhistian Ramirez", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -58,3 +58,3 @@ "type": "module", | ||
"typescript": "^4.9.3", | ||
"vite": "^4.2.0", | ||
"vite": "^4.3.3", | ||
"yup": "^1.0.2" | ||
@@ -61,0 +61,0 @@ }, |
@@ -11,3 +11,3 @@ <div align="center"> | ||
## 🔥 Demo | ||
[Demo on CodeSandbox](https://codesandbox.io/p/sandbox/sharp-saha-0yl36k?selection=%5B%7B%22endColumn%22%3A21%2C%22endLineNumber%22%3A57%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A57%7D%5D&file=%2Fsrc%2FFormWithProvider.tsx) includes a demo with form provider (simpler but less performant, see [section below](#form-provider)) as well as usage without FormProvider (requires extra parameter [control](https://react-hook-form.com/api/useform/control/)) | ||
[Demo on CodeSandbox](https://codesandbox.io/p/sandbox/react-hook-form-chakra-0yl36k?file=%2Fsrc%2FFormWithProvider.tsx&selection=%5B%7B%22endColumn%22%3A1%2C%22endLineNumber%22%3A58%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A57%7D%5D) includes a demo with form provider (simpler but less performant, see [section below](#form-provider)) as well as usage without FormProvider (requires extra parameter [control](https://react-hook-form.com/api/useform/control/)) | ||
@@ -14,0 +14,0 @@ ## ⚙️ Installation |
Sorry, the diff of this file is not supported yet
63154
-0.18%1127
-0.7%