"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("react/jsx-runtime"),a=require("react"),s=require("classnames"),i=require("../Text/Text.js"),l=require("./Switch.scss.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=c(e),o=c(t),u=c(s),d=["onChange","disabled","size","className","inputRef","checked","onLabel","offLabel","testId","disableOffState"];function b(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 f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){n.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p={medium:16,small:14},m={medium:l.medium,small:l.small},j=function(e){var t=e.label,a=e.active,s=e.size,c=e.disabled,n=a?"T1":"T6";return t?r.jsx(i.Text,{size:p[s],color:c?"T6":n,className:l.label,children:t}):null},h=a.forwardRef((function(e,t){var s=e.onChange,i=e.disabled,c=e.size,n=void 0===c?"medium":c,b=e.className,p=e.inputRef,h=e.checked,O=e.onLabel,v=e.offLabel,y=e.testId,x=e.disableOffState,g=o.default(e,d),P=a.useCallback((function(e){return null==s?void 0:s(e.target.checked,e)}),[s]);return r.jsxs("label",f(f({className:u.default(l.root,m[n],!!h&&l.checked,i&&l.disabled,x&&l.alwaysChecked,b),"data-testid":y,ref:t},g),{},{children:[r.jsx(j,{label:v,active:!x||!h,size:n,disabled:i}),r.jsxs("div",{className:l.track,children:[r.jsx("input",{type:"checkbox",className:l.input,checked:!!h,onChange:P,ref:p,disabled:i}),r.jsx("div",{className:l.thumb})]}),r.jsx(j,{label:O,active:!x||!!h,size:n,disabled:i})]}))}));exports.Switch=h;
//# sourceMappingURL=Switch.js.map
