@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 2.92 kB
JavaScript
var l=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...e):typeof e=="object"?Object.keys(e).map((o,r)=>e[r]||e[o]&&o||null).filter(o=>o!==null).join(" "):e).filter(e=>!!e).join(" ");var M=(t,e)=>l({[`${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"}),C=(t,e)=>{let{valid:o,invalid:r,hover:d,focus:c,checked:i,active:s,selected:m,disabled:u,indeterminate:v,loading:x,empty:k,readonly:E,highlighted:T,...f}=e;return l({"k-valid":o,"k-invalid":r,"k-hover":d,"k-focus":c,"k-checked":i,"k-active":s,"k-selected":m,"k-disabled":u,"k-indeterminate":v&&!i,"k-loading":x,"k-empty":k,"k-readonly":E,"k-highlighted":T},Object.keys(f).reduce((P,h)=>(h.startsWith("k-")?P[h]=f[h]:P[`k-${h}`]=f[h],P),{}))};var g={xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"};var n={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"};import{jsx as R}from"react/jsx-runtime";var O=t=>R("tr",{children:t.children});import{jsx as $}from"react/jsx-runtime";var A="k-colorpalette-tile",N=[n.hover,n.focus,n.selected],K={},y=t=>{let{color:e,tileSize:o,hover:r,focus:d,selected:c,...i}=t,s={backgroundColor:e,width:o?o+"px":"",height:o?o+"px":""};return $("td",{...i,className:l(t.className,A,C(A,{hover:r,focus:d,selected:c})),style:s})};y.states=N;y.options=K;y.className=A;var z="color-palette",S="colorpalette";import{jsx as p}from"react/jsx-runtime";var b="k-colorpalette",_=[n.disabled],w={size:[g.small,g.medium,g.large]},L={columns:10,size:g.medium},a=t=>{let{size:e=L.size,palette:o,columns:r=L.columns,tileSize:d,disabled:c,...i}=t,s=[];if(o){let m=r||o.columns,u=o.colors?o.colors:o;Array.isArray(u)&&Array.from({length:Math.ceil(u.length/m)},(v,x)=>{let k=[];u.slice(x*m,(x+1)*m).map((T,f)=>{k.push(p(y,{color:T,tileSize:d},f))});let E=p(O,{children:k},x);s.push(E)})}return p("div",{...i,className:l(t.className,b,C(b,{disabled:c}),M(b,{size:e})),children:p("table",{className:"k-colorpalette-table",children:p("tbody",{children:s.length>0?s:t.children})})})};a.states=_;a.options=w;a.className=b;a.defaultOptions=L;a.moduleName=z;a.folderName=S;var oe=a;export{b as COLORPALETTE_CLASSNAME,a as ColorPalette,oe as default};