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