"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"),l=require("@material-ui/core"),r=require("./style.css.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(i),c=l.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}}})),n=a.forwardRef((function(a,i){var o,n,d=a.title,b=a.leftLabel,p=a.rightLabel,h=a.checked,u=a.onChange,m=a.disabled,f=a.size,g=a.className,x=a.rightLabelTooltip,w=a.leftLabelTooltip,y=a.customClasses,L=a["data-testid"],j=c(),k=b&&p,C=y.root,D=y.track,v=y.switchBase,B=e.__rest(y,["root","track","switchBase"]);return t.jsxs("div",{className:g,children:[d&&t.jsx("div",{className:r.switchControlTitle,children:d}),t.jsxs(l.Grid,{component:"label",container:!0,alignItems:"center",spacing:0,children:[b&&t.jsx(l.Grid,{item:!0,children:t.jsx(l.Tooltip,{title:w,children:t.jsx(l.Typography,{variant:"body2",className:s.default(j.label,"small"===f&&j.labelSmall,(!h||!p)&&!m&&j.activeLabel,m&&j.disabledLabel),children:b})})}),t.jsx(l.Grid,{item:!0,children:t.jsx(l.Switch,{"data-testid":"".concat(L,"_switch_").concat(h),ref:i,checked:h,onChange:u,color:"primary",disabled:m,classes:e.__assign({root:s.default(j.root,C),switchBase:s.default((o={},o[j.switchBase]=k||h&&!m,o[j.switchBaseDisabled]=m&&(k||h),o[j.switchBaseDisabledNoLabels]=!k&&m&&!h,o),v),track:s.default((n={},n[j.track]=k||h&&!m,n[j.trackDisabled]=m&&(k||h),n[j.trackDisabledNoLabels]=!k&&m&&!h,n),D)},B),size:f})}),p&&t.jsx(l.Grid,{item:!0,children:t.jsx(l.Tooltip,{title:x,children:t.jsx(l.Typography,{variant:"body2",className:s.default(j.label,"small"===f&&j.labelSmall,(h||!b)&&!m&&j.activeLabel,m&&j.disabledLabel),children:p})})})]})]})}));n.defaultProps={title:"",leftLabel:"",rightLabel:"",disabled:!1,size:"medium",className:"",customClasses:{},rightLabelTooltip:"",leftLabelTooltip:"","data-testid":"SwitchControlComponent"},exports.SwitchControlComponent=n,exports.default=n;
