@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 4.37 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,a)=>e[a]||e[o]&&o||null).filter(o=>o!==null).join(" "):e).filter(e=>!!e).join(" ");var L=(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.themeColor}`]:e.themeColor},{"k-rounded-sm":e.rounded==="small","k-rounded-md":e.rounded==="medium","k-rounded-lg":e.rounded==="large","k-rounded-full":e.rounded==="full","k-rounded-none":e.rounded==="none"}),y=(t,e)=>{let{valid:o,invalid:a,hover:c,focus:n,checked:i,active:s,selected:u,disabled:m,indeterminate:A,loading:b,empty:k,readonly:T,highlighted:P,...f}=e;return l({"k-valid":o,"k-invalid":a,"k-hover":c,"k-focus":n,"k-checked":i,"k-active":s,"k-selected":u,"k-disabled":m,"k-indeterminate":A&&!i,"k-loading":b,"k-empty":k,"k-readonly":T,"k-highlighted":P},Object.keys(f).reduce((v,h)=>(h.startsWith("k-")?v[h]=f[h]:v[`k-${h}`]=f[h],v),{}))};var p={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"};var d={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 z}from"react/jsx-runtime";var R=t=>z("tr",{role:"row",children:t.children});import{jsx as $}from"react/jsx-runtime";var E="k-colorpalette-tile",N=[d.hover,d.focus,d.selected],K={},g=t=>{let{color:e,tileSize:o,hover:a,focus:c,selected:n,...i}=t,s={backgroundColor:e,width:o?o+"px":"",height:o?o+"px":""};return $("td",{...i,role:"gridcell","aria-label":e,"aria-selected":n?"true":void 0,className:l(t.className,E,y(E,{hover:a,focus:c,selected:n})),style:s})};g.states=N;g.options=K;g.className=E;var M="color-palette",O="colorpalette";import{jsx as x}from"react/jsx-runtime";var C="k-colorpalette",w=[d.disabled],_={size:[p.undefined,p.small,p.medium,p.large]},S={columns:10},r=t=>{let{size:e,palette:o,columns:a=S.columns,tileSize:c,disabled:n,...i}=t,s=[];if(o){let u=a||o.columns,m=o.colors?o.colors:o;Array.isArray(m)&&Array.from({length:Math.ceil(m.length/u)},(A,b)=>{let k=[];m.slice(b*u,(b+1)*u).map((P,f)=>{k.push(x(g,{color:P,tileSize:c},f))});let T=x(R,{children:k},b);s.push(T)})}return x("div",{...i,role:"grid","aria-label":"Color palette",tabIndex:0,"aria-disabled":n?"true":void 0,className:l(t.className,C,y(C,{disabled:n}),L(C,{size:e})),children:x("table",{className:"k-colorpalette-table",role:"none",children:x("tbody",{children:s.length>0?s:t.children})})})};r.states=w;r.options=_;r.className=C;r.defaultOptions=S;r.moduleName=M;r.folderName=O;r.ariaSpec={selector:".k-colorpalette",rules:[{selector:".k-colorpalette",attribute:"role=grid",usage:"The focusable wrapper announces its role as a grid."},{selector:".k-colorpalette",attribute:"aria-label or aria-labelledby",usage:"The component needs an accessible name including the currently selected value."},{selector:".k-colorpalette",attribute:"aria-activedescendant",usage:"Points to the focused cell in the table."},{selector:".k-colorpalette",attribute:"tabindex=0",usage:"The element must be focusable."},{selector:".k-colorpalette.k-disabled",attribute:"aria-disabled=true",usage:"Rendered only when the ColorPalette is disabled."},{selector:".k-colorpalette-table",attribute:"role=none or role=presentation",usage:"Negates the default role of the table element."},{selector:".k-colorpalette-table>tbody>tr",attribute:"role=row",usage:"Required as the semantic role of the parent table has been removed."},{selector:".k-colorpalette-tile",attribute:"role=gridcell",usage:"Required as the semantic role of the parent table has been removed."},{selector:".k-colorpalette-tile",attribute:"aria-label or title",usage:"The text representation of the color value for the current cell."},{selector:".k-colorpalette-tile.k-selected",attribute:"aria-selected=true",usage:"Present on the currently selected cell."}]};var re=r;export{C as COLORPALETTE_CLASSNAME,r as ColorPalette,re as default};