"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("prop-types"),a=require("@material-ui/core"),i=require("lodash"),u=require("react/jsx-runtime");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(e),d=s(r),n=i.debounce((function(e){e()}),1500);function o(e){var r=e.radius,i=e.editable,s=e.onChange,d=e.classes,o=e["data-testid"],c=t.useState(r),f=l.default(c,2),p=f[0],m=f[1],b=t.useState(null),h=l.default(b,2),q=h[0],v=h[1];t.useEffect((function(){m(r)}),[r]);return u.jsx(a.Tooltip,{title:i?"":"To make radius active select Subject Well.",children:u.jsx(a.TextField,{"data-testid":o,type:"number",label:"Radius (miles)",value:p,disabled:!i,onChange:function(e){var t=e.target.value;!Number.isFinite(+t)||+t<0?v("Incorrect radius"):(v(null),n((function(){s(+t)}))),m(t)},error:!!q,helperText:q,className:d.formControl})})}o.propTypes={radius:d.default.number.isRequired,editable:d.default.bool.isRequired,onChange:d.default.func.isRequired,classes:d.default.shape({}).isRequired,"data-testid":d.default.string},o.defaultProps={"data-testid":"RadiusInput"};var c=a.withStyles({formControl:{width:130,marginLeft:10,marginTop:8}})(o);module.exports=c;
//# sourceMappingURL=RadiusInput.js.map
