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