"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),a=require("react"),r=require("lodash"),t=require("@material-ui/core"),i=require("@material-ui/icons/Search"),o=require("@material-ui/icons/Close"),s=require("prop-types"),n=require("classnames"),l=require("react/jsx-runtime");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(e),d=c(i),p=c(o),h=c(s),f=c(n),m=t.makeStyles((function(e){return{root:{display:"flex",alignItems:"center",height:30,paddingLeft:19,borderRadius:30,boxShadow:"none","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(e.palette.primary.main)}},input:{flex:1,fontFamily:"Roboto",fontSize:14,fontWeight:200},searchIcon:{height:16,width:16,color:e.palette.primary.contrastText,marginRight:9},closeIcon:{height:16,width:16,margin:"0 10px",color:e.palette.primary.text6,cursor:"pointer"}}}));function x(e){var i=e.handleSearch,o=e.className,s=m(),n=a.useState(""),c=u.default(n,2),h=c[0],x=c[1],g=a.useCallback(r.debounce(i,500),[]);return l.jsxs(t.Paper,{className:f.default(s.root,o),children:[l.jsx(d.default,{className:s.searchIcon}),l.jsx(t.InputBase,{className:s.input,placeholder:"Search ...",value:h,inputProps:{"aria-label":"search"},onChange:function(e){return a=e.target.value,x(a),void g(a);var a}}),h&&l.jsx(p.default,{className:s.closeIcon,onClick:function(){i(""),x("")}})]})}x.propTypes={handleSearch:h.default.func.isRequired,className:h.default.string},x.defaultProps={className:""},module.exports=x;
