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