@legion-ui-kit/react-core
Version:
<div align="center"> <img height="108" width="116" src="https://legion.digitaltelkom.id/favicon.svg?v=4643a71fb65fa61a5f2b266b769ea7b1" /> <h1 align="center">Legion UI Kit - React Core</h1> </div>
3 lines (2 loc) • 1.09 kB
JavaScript
import{jsxs as e,jsx as l}from"react/jsx-runtime";import{useId as s}from"react";import t from"classnames";import a from"./styles.module.scss.js";import{kebabCase as i}from"../../helpers/typography.js";import{SWITCH_DEFAULT_PROPS as o,INPUT_TYPE as m,SWITCH_LABEL_POSITION as r,SWITCH_TYPE as c}from"./Switch.constant.js";const d=d=>{const{className:n,disabled:p,fieldClassName:y,fieldStyle:h,id:b,inputClassName:f,inputStyle:N,label:g,labelClassName:u,labelPosition:_=o.labelPosition,labelStyle:w,size:S=o.size,style:j,toggleClassName:C,toggleStyle:x,type:v=o.type,...z}=d,P=s(),k=b||`legion_switch_${i(P)}`,F=v===c.multiple?m.checkbox:m.radio,$=_===r.left,q=t(a.legion_switch,n,a[S],{[a.disabled]:!!p,[a.left_label]:$}),A=t(a.switch_toggle,C),B=t(a.switch_field,y),D=t(a.switch_label,u);return e("div",{className:q,style:j,children:[e("div",{className:B,style:h,children:[l("input",{className:f,id:k,type:F,disabled:p,style:N,...z}),l("span",{className:A,style:x})]}),g&&l("label",{htmlFor:k,className:D,style:w,children:g})]})};export{d as default};
//# sourceMappingURL=index.js.map