"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@material-ui/core"),r=require("../../../../constants.js"),n=require("../../../../segment-config/useSegmentConfig.js"),i=require("../../../../../../utils/index.js"),o=require("../../../../../Select/index.js"),a=t.makeStyles((function(e){return{metricsForm:{width:"calc(100% - 32px)","& .MuiInputBase-root":{"&:hover $primaryText":{color:e.palette.primary.text1},"&:hover $primaryIcon":{color:e.palette.primary.text1},"&:focused $primaryIcon":{color:e.palette.primary.main}}},metricsSelect:{"&:before":{borderBottom:"none !important"},"&:after":{borderBottom:"none !important"}},primaryText:{fontWeight:500,fontSize:"12px",lineHeight:"14px",letterSpacing:"0.4px",color:e.palette.primary.text7,overflow:"hidden",textOverflow:"ellipsis"},primaryIcon:{color:e.palette.primary.text6},metricsMenuPaper:{backgroundColor:e.palette.background.b9,maxHeight:"calc(100% - 300px)",top:"150px !important"},valueLabel:{display:"-webkit-box",alignItems:"center",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflowWrap:"break-word",fontWeight:500,fontSize:"12px",lineHeight:"14px",letterSpacing:"0.4px",overflow:"hidden",whiteSpace:"normal"}}})),l=function(e){var t=r.METRICS_LIST.find((function(t){return t.key===e}));if(!t)return"";var n=t.unitType?" (".concat(i.getUnitDisplay(t.unitType,t.to),")"):"";return t.label+n};exports.MetricsSelect=function(i){var c=i.isTooltipVisible,s=i.currentValue,p=i.metricsKeys,u=i.onChange,m=i.setIsMenuOpen,x=a(),d=n.useSegmentConfig().defaultMetricKey,f=r.METRICS_LIST.filter((function(e){return!p.includes(e.key)}));return null!=d&&s===d?e.jsx(t.Tooltip,{title:c?l(s):"",children:e.jsx(t.Typography,{className:x.valueLabel,children:l(s)})}):e.jsx(t.FormControl,{className:x.metricsForm,children:e.jsx(o,{"data-testid":"".concat("MetricsSelect","_select_").concat(s),className:x.metricsSelect,classes:{select:x.primaryText,icon:x.primaryIcon},MenuProps:{paper:x.metricsMenuPaper},value:s,renderValue:function(r){return e.jsx(t.Tooltip,{title:c?l(r):"",children:e.jsx(t.Typography,{className:x.valueLabel,children:l(r)})})},onOpen:function(){return m(!0)},onClose:function(){return m(!1)},onChange:function(e){return u(e.target.value)},children:f.map((function(r){return e.jsx(t.MenuItem,{"data-testid":"".concat("MetricsSelect","_option_").concat(r.key,"MenuItem"),value:r.key,children:r.label},r.key)}))})})};
//# sourceMappingURL=MetricsSelect.js.map
