import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/objectWithoutProperties";import{jsxs as r,jsx as a}from"react/jsx-runtime";import{forwardRef as i,useCallback as c}from"react";import s from"classnames";import{Text as l}from"../Text/Text.js";import o from"./Switch.scss.js";var n=["onChange","disabled","size","className","inputRef","checked","onLabel","offLabel","testId","disableOffState"];function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function m(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?d(Object(a),!0).forEach((function(r){e(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):d(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var b={medium:16,small:14},f={medium:o.medium,small:o.small},p=function(e){var t=e.label,r=e.active,i=e.size,c=e.disabled;return t?a(l,{size:b[i],color:c?"T6":r?"T1":"T6",className:o.label,children:t}):null},u=i((function(e,i){var l=e.onChange,d=e.disabled,b=e.size,u=void 0===b?"medium":b,h=e.className,O=e.inputRef,j=e.checked,v=e.onLabel,y=e.offLabel,g=e.testId,P=e.disableOffState,k=t(e,n),w=c((function(e){return null==l?void 0:l(e.target.checked,e)}),[l]);return r("label",m(m({className:s(o.root,f[u],!!j&&o.checked,d&&o.disabled,P&&o.alwaysChecked,h),"data-testid":g,ref:i},k),{},{children:[a(p,{label:y,active:!P||!j,size:u,disabled:d}),r("div",{className:o.track,children:[a("input",{type:"checkbox",className:o.input,checked:!!j,onChange:w,ref:O,disabled:d}),a("div",{className:o.thumb})]}),a(p,{label:v,active:!P||!!j,size:u,disabled:d})]}))}));export{u as Switch};
//# sourceMappingURL=Switch.js.map
