vdk-components
Version:
React component library built with TypeScript and SCSS
3 lines (2 loc) • 690 B
JavaScript
;var e=require("react/jsx-runtime");exports.Switch=function(s){var a=s.checked,c=void 0!==a&&a,i=s.disabled,l=void 0!==i&&i,t=s.loading,n=void 0!==t&&t,d=s.label,h=s.onChange,o=s.className,r=["switch",c?"switch--checked":"",l?"switch--disabled":"",n?"switch--loading":"",void 0===o?"":o].filter(Boolean).join(" ");return e.jsxs("label",{className:r,children:[e.jsx("input",{type:"checkbox",checked:c,disabled:l||n,onChange:function(e){l||n||!h||h(e.target.checked)},className:"switch__input"}),e.jsx("span",{className:"switch__slider"}),d&&e.jsx("span",{className:"switch__label",children:d}),n&&e.jsx("span",{className:"switch__loader"})]})};
//# sourceMappingURL=index.js.map