@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 2.8 kB
JavaScript
var n=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?n(...e):typeof e=="object"?Object.keys(e).map((l,s)=>e[s]||e[l]&&l||null).filter(l=>l!==null).join(" "):e).filter(e=>!!e).join(" ");var m=(t,e)=>n({[`${t}-xs`]:e.size==="xsmall",[`${t}-sm`]:e.size==="small",[`${t}-md`]:e.size==="medium",[`${t}-lg`]:e.size==="large",[`${t}-xl`]:e.size==="xlarge",[`${t}-xxl`]:e.size==="xxlarge",[`${t}-xxxl`]:e.size==="xxxlarge"},{[`${t}-${e.fillMode}`]:e.fillMode},{[`${t}-${e.fillMode}-${e.themeColor}`]:e.fillMode&&e.themeColor},{[`${t}-${e.themeColor}`]:e.themeColor&&e.fillMode===void 0},{"k-rounded-sm":e.rounded==="small","k-rounded-md":e.rounded==="medium","k-rounded-lg":e.rounded==="large","k-rounded-full":e.rounded==="full"}),M=(t,e)=>{let{valid:l,invalid:s,hover:x,focus:g,checked:u,active:k,selected:b,disabled:p,indeterminate:y,loading:N,empty:L,readonly:A,highlighted:O,...S}=e;return n({"k-valid":l,"k-invalid":s,"k-hover":x,"k-focus":g,"k-checked":u,"k-active":k,"k-selected":b,"k-disabled":p,"k-indeterminate":y&&!u,"k-loading":N,"k-empty":L,"k-readonly":A,"k-highlighted":O},Object.keys(S).reduce((w,r)=>(r.startsWith("k-")?w[r]=S[r]:w[`k-${r}`]=S[r],w),{}))};var d={xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},o={small:"small",medium:"medium",large:"large",full:"full"};var c={open:"open",hover:"hover",focus:"focus",active:"active",selected:"selected",disabled:"disabled",valid:"valid",invalid:"invalid",loading:"loading",required:"required",empty:"empty",indeterminate:"indeterminate",checked:"checked",readonly:"readonly",highlighted:"highlighted",generating:"generating",expanded:"expanded"};var v="switch",R=v;import{jsx as h,jsxs as $}from"react/jsx-runtime";var a="k-switch",E=[c.hover,c.focus,c.disabled,c.checked],C={size:[d.small,d.medium,d.large],trackRounded:[o.small,o.medium,o.large,o.full],thumbRounded:[o.small,o.medium,o.large,o.full]},f={size:d.medium,trackRounded:o.full,thumbRounded:o.full},i=t=>{let{checked:e,onLabel:l,offLabel:s,size:x=f.size,trackRounded:g=f.trackRounded,thumbRounded:u=f.thumbRounded,hover:k,focus:b,disabled:p,...y}=t;return $("span",{...y,className:n(t.className,a,m(a,{size:x}),M(a,{hover:k,focus:b,disabled:p}),{[`${a}-on`]:e,[`${a}-off`]:!e}),children:[$("span",{className:n("k-switch-track",m(a,{rounded:g})),children:[l&&h("span",{className:"k-switch-label-on",children:l}),s&&h("span",{className:"k-switch-label-off",children:s})]}),h("span",{className:"k-switch-thumb-wrap",children:h("span",{className:n("k-switch-thumb",m(a,{rounded:u}))})})]})};i.states=E;i.options=C;i.className=a;i.defaultOptions=f;i.moduleName=v;i.folderName=R;var z=i;import{jsx as K}from"react/jsx-runtime";var Q=t=>K(z,{...t,onLabel:"On",offLabel:"Off"});export{Q as SwitchNormal};