"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),o=require("prop-types"),n=require("@material-ui/core"),a=require("@material-ui/icons"),i=require("../IconButton/index.js"),l=require("react/jsx-runtime");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=s(e),c=s(t),p=s(o);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){u.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function h(e){var t=e.classes,o=e["data-testid"],a=e.iconButtonStyle,i=e.color,s=e.disableRipple,u=e.className,p=e.IconElement,d=e.IconButtonComponent,h=e.disabled,m=e.iconButtonProps,b=e.children,g=e.anchorOrigin,O=e.transformOrigin,y=e.marginThreshold,v=e.menuProps,P=e.tooltipProps,j=e.paperClassName,B=r.useState(null),T=c.default(B,2),x=T[0],C=T[1],w=!!x,q=r.useState(!1),I=c.default(q,2),N=I[0],S=I[1];r.useEffect((function(){var e;return w&&setTimeout((function(){e=S(w)}),500),function(){e&&clearTimeout(e)}}),[w]);var E=function(e){e.stopPropagation(),C(null),S(!1)},R=l.jsx(d,f(f({"aria-label":"IconMenu","aria-owns":w?"icon-menu":void 0,"aria-haspopup":"true","data-testid":o,onClick:function(e){e.stopPropagation(),e.preventDefault(),C(e.currentTarget)},classes:{root:t.iconButton},className:u,style:a,color:i,disableRipple:s,disabled:h},m),{},{children:p}));return l.jsxs(l.Fragment,{children:[P?l.jsx(n.Tooltip,f(f({},P),{},{children:R})):R,l.jsx(n.Menu,f(f({id:"icon-menu",anchorEl:x,open:w,MenuListProps:{"data-testid":"".concat(o,"Dropdown")},disableAutoFocus:!N,autoFocus:N,onClose:E,onClick:E,anchorOrigin:g,transformOrigin:O,classes:{paper:t.paper},elevation:0,marginThreshold:y,PaperProps:{className:t[j]}},v),{},{children:b}))]})}h.propTypes={children:p.default.oneOfType([p.default.string,p.default.node,p.default.array]),classes:p.default.shape({iconButton:p.default.string,paper:p.default.string}),className:p.default.string,color:p.default.string,IconElement:p.default.element,IconButtonComponent:p.default.any,iconButtonStyle:p.default.shape({}),anchorOrigin:p.default.shape({horizontal:p.default.oneOf(["left","center","right"]),vertical:p.default.oneOf(["top","center","bottom"])}),transformOrigin:p.default.shape({horizontal:p.default.oneOf(["left","center","right"]),vertical:p.default.oneOf(["top","center","bottom"])}),disableRipple:p.default.bool,"data-testid":p.default.string,marginThreshold:p.default.number,disabled:p.default.bool,tooltipProps:p.default.shape({}),menuProps:p.default.shape({}),iconButtonProps:p.default.shape({}),paperClassName:p.default.string},h.defaultProps={children:void 0,classes:{},className:void 0,color:void 0,"data-testid":void 0,IconElement:l.jsx(a.MoreVert,{}),iconButtonStyle:void 0,IconButtonComponent:i,disableRipple:!1,anchorOrigin:{horizontal:"right",vertical:"top"},transformOrigin:{horizontal:"right",vertical:"bottom"},marginThreshold:void 0,disabled:!1,tooltipProps:void 0,menuProps:{},iconButtonProps:{},paperClassName:""};var m=n.withStyles((function(e){return{iconButton:{borderRadius:8,padding:"10px",color:e.palette.primary.text6,"&:hover":{color:e.palette.primary.text1,backgroundColor:"rgba(255, 255, 255, 0.16)"},"& .MuiTouchRipple-child":{borderRadius:8},paper:{}}}}))(h);module.exports=m;
//# sourceMappingURL=index.js.map
