"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[6502],{32754:function(e,r,a){a.r(r);var s=a(29439),t=a(72791),n=a(57678),u=a(40584),i=a(80184);function l(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:NaN,a=Number(arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN),s=Number(e),t=Number(r);if(isNaN(a))return{err:!0,errMsg:"Value must be a number"};if(isNaN(s)&&isNaN(t))return{err:!1,errMsg:""};if(!isNaN(s)&&isNaN(t)){var n=a<s,u="";return n&&(u="Value must be greater than "+s),{err:n,errMsg:u}}if(isNaN(s)&&!isNaN(t)){var i=a>t,l="";return i&&(l="Value must be less than "+t),{err:i,errMsg:l}}return a<s||a>t?{err:!0,errMsg:"Value must be between "+s+" and "+t}:{err:!1,errMsg:""}}r.default=function(e){var r=t.useState(e.options.value),a=(0,s.Z)(r,2),o=a[0],N=a[1],b=t.useState(!1),v=(0,s.Z)(b,2),m=v[0],c=v[1],d=t.useState(""),f=(0,s.Z)(d,2),p=f[0],g=f[1],h=e.options,M=h.min,x=h.max,k=t.useCallback((function(r){var a,s=r.target;(N(s.value),l(s.value,M,x).err)||(null===(a=e.callbacks)||void 0===a||a.on_change(Number(s.value)))}),[M,x]);t.useEffect((function(){N(e.options.value)}),[e.options.value]),t.useEffect((function(){var e=l(o,M,x),r=e.err,a=e.errMsg;c(r),g(a)}),[o,M,x]);var C=t.useMemo(u.Z,[]);return(0,i.jsxs)(n.xu,{children:[e.options.label&&(0,i.jsx)(n.xv,{as:"label",htmlFor:C,lineHeight:1.5,disabled:e.options.disabled,children:e.options.label}),(0,i.jsx)(n.II,{id:C,type:"number",value:o,min:e.options.min,max:e.options.max,step:e.options.step,disabled:e.options.disabled,onChange:k,error:m,errorMessage:p})]})}}}]);
//# sourceMappingURL=NumberInput.6f969505.chunk.js.map