"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),a=require("react"),i=require("classnames"),s=require("@material-ui/core"),l=require("./style.css.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(i),n=s.makeStyles((function(e){return{root:{width:60,height:40,padding:13,"&.MuiSwitch-sizeSmall":{width:52,height:36,padding:13},"& .MuiSwitch-switchBase":{padding:10}},switchBase:{padding:10,color:"#03BCD4","&.MuiIconButton-root:hover":{backgroundColor:"rgba(3, 188, 212, 0.08)"}},switchBaseDisabled:{color:"#196069 !important"},track:{backgroundColor:"#196069 !important",opacity:"1 !important",border:"none"},trackDisabled:{backgroundColor:"#223D40 !important",opacity:"1 !important",border:"none"},switchBaseDisabledNoLabels:{color:"#545454 !important"},trackDisabledNoLabels:{backgroundColor:"#3D3D3D !important",opacity:"1 !important",border:"none"},label:{display:"flex",justifyContent:"center",flexDirection:"column",fontSize:"16px",lineHeight:"22px",color:e.palette.primary.text7,margin:"8px 0px",cursor:"pointer"},labelSmall:{fontSize:"14px",lineHeight:"20px"},disabledLabel:{cursor:"default",color:"#808080"},activeLabel:{color:e.palette.primary.text1}}})),c=a.forwardRef((function(a,i){var r,c,d=a.title,b=a.leftLabel,p=a.rightLabel,h=a.checked,u=a.onChange,m=a.disabled,g=a.size,_=a.className,f=a.rightLabelTooltip,x=a.leftLabelTooltip,w=a.customClasses,y=a["data-testid"],L=n(),j=b&&p,k=w.root,C=w.track,D=w.switchBase,v=e.__rest(w,["root","track","switchBase"]);return t.jsxs("div",e.__assign({className:_},{children:[d&&t.jsx("div",e.__assign({className:l.switchControlTitle},{children:d})),t.jsxs(s.Grid,e.__assign({component:"label",container:!0,alignItems:"center",spacing:0},{children:[b&&t.jsx(s.Grid,e.__assign({item:!0},{children:t.jsx(s.Tooltip,e.__assign({title:x},{children:t.jsx(s.Typography,e.__assign({variant:"body2",className:o.default(L.label,"small"===g&&L.labelSmall,(!h||!p)&&!m&&L.activeLabel,m&&L.disabledLabel)},{children:b}))}))})),t.jsx(s.Grid,e.__assign({item:!0},{children:t.jsx(s.Switch,{"data-testid":"".concat(y,"_switch_").concat(h),ref:i,checked:h,onChange:u,color:"primary",disabled:m,classes:e.__assign({root:o.default(L.root,k),switchBase:o.default((r={},r[L.switchBase]=j||h&&!m,r[L.switchBaseDisabled]=m&&(j||h),r[L.switchBaseDisabledNoLabels]=!j&&m&&!h,r),D),track:o.default((c={},c[L.track]=j||h&&!m,c[L.trackDisabled]=m&&(j||h),c[L.trackDisabledNoLabels]=!j&&m&&!h,c),C)},v),size:g})})),p&&t.jsx(s.Grid,e.__assign({item:!0},{children:t.jsx(s.Tooltip,e.__assign({title:f},{children:t.jsx(s.Typography,e.__assign({variant:"body2",className:o.default(L.label,"small"===g&&L.labelSmall,(h||!b)&&!m&&L.activeLabel,m&&L.disabledLabel)},{children:p}))}))}))]}))]}))}));c.defaultProps={title:"",leftLabel:"",rightLabel:"",disabled:!1,size:"medium",className:"",customClasses:{},rightLabelTooltip:"",leftLabelTooltip:"","data-testid":"SwitchControlComponent"},exports.SwitchControlComponent=c,exports.default=c;
