import{__rest as o,__assign as r}from'./../../ext-esm/tslib/tslib.es6.js';import{jsx as t}from"react/jsx-runtime";import a from"prop-types";import i from"classnames";import{makeStyles as e,Tooltip as n,IconButton as l}from"@material-ui/core";import{useState as s}from"react";var c=e((function(o){return{root:{borderRadius:"8px !important",color:o.palette.primary.text6,padding:6,"&:hover":{color:"#FFFFFF",backgroundColor:"rgba(255, 255, 255, 0.16)",backdropFilter:"blur(2px)","&.MuiIconButton-colorPrimary":{color:o.palette.primary.light}},"&:active":{color:"#FFFFFF","&.MuiIconButton-colorPrimary":{color:o.palette.primary.light}},"&.Mui-disabled":{pointerEvents:"all",opacity:.4,color:"#FFFFFF",backgroundColor:"transparent","&.MuiIconButton-colorPrimary":{color:o.palette.primary.main}},"& .MuiSvgIcon-root":{color:"inherit",fontSize:"inherit"},"& .MuiTouchRipple-child":{borderRadius:8,backgroundColor:"rgba(255, 255, 255, 0.16)"}},colorPrimary:{color:o.palette.primary.main},sizeSmall:{fontSize:20,padding:6,height:32,width:32,"& .i-icon, & .i-icon > svg":{width:20,height:20}},sizeLarge:{"&.MuiButtonBase-root":{padding:8}},contained:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(2px)","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.16)"}},containedDisabled:{"&.MuiButtonBase-root":{backgroundColor:"rgba(255, 255, 255, 0.08)"}},transparent:{color:o.palette.primary.contrastText,backgroundColor:"rgba(255, 255, 255, 0.2)","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}},transparentDisabled:{"&.MuiButtonBase-root":{backgroundColor:"rgba(255, 255, 255, 0.1)"}},tooltipPopper:{"& .MuiTooltip-tooltip":{backgroundColor:function(r){return"transparent"===r.variant?"rgba(255, 255, 255, 0.2)":o.palette.background.b9}}},active:{"&.MuiButtonBase-root":{color:o.palette.primary.main,backgroundColor:"rgba(255, 255, 255, 0.12)","&.MuiIconButton-colorPrimary":{color:o.palette.primary.main},"&.transparent":{color:o.palette.primary.contrastText,backgroundColor:"rgba(255, 255, 255, 0.2)"}}}}})),p=function(a){var e,p,d,u,m,b=a.tooltipProps,g=void 0===b?{title:"",classes:{}}:b,v=a.isActive,y=a.className,F=o(a,["tooltipProps","isActive","className"]),f=F.size,h=F.variant,P=F.classes,k=void 0===P?{}:P,B=F["data-testid"],z=c({variant:h}),C=s(!1),M=C[0],x=C[1],S=r(r({},k),{root:i(k.root,z.root,(e={},e[z.sizeLarge]="large"===f,e[z.contained]="contained"===h,e[z.transparent]="transparent"===h,e)),disabled:i(k.disabled,(p={},p[z.containedDisabled]="contained"===h,p[z.transparentDisabled]="transparent"===h,p)),colorPrimary:i(k.colorPrimary,z.colorPrimary),sizeSmall:i(k.sizeSmall,z.sizeSmall)});return g.title?t(n,r({open:M},g,{classes:r(r({},g.classes),{popper:i(z.tooltipPopper,null===(m=g.classes)||void 0===m?void 0:m.popper)})},{children:t(l,r({"data-testid":"".concat(B,"_").concat(g.title),classes:S,className:i(y,(d={},d[z.active]=v,d),h),onPointerOver:function(){return x(!0)},onPointerOut:function(){return x(!1)}},F))})):t(l,r({"data-testid":B,classes:S,className:i(y,(u={},u[z.active]=v,u),h)},F))},d={isActive:a.bool,size:a.oneOf(["small","medium","large"]),variant:a.oneOf(["default","contained","transparent"]),tooltipProps:a.shape({title:a.node,classes:a.shape({popper:a.string})}),classes:a.shape({root:a.string,disabled:a.string,colorPrimary:a.string,sizeSmall:a.string}),disabled:a.bool,"data-testid":a.string};p.propTypes=d,p.defaultProps={isActive:!1,size:"medium",variant:"default",tooltipProps:{title:""},disabled:!1,"data-testid":"IconButton"};export{p as default};
