@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 8.54 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((r,s)=>e[s]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var C=(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"}),A=(t,e)=>{let{valid:r,invalid:s,hover:i,focus:d,checked:c,active:a,selected:m,disabled:u,indeterminate:p,loading:M,empty:k,readonly:b,highlighted:te,...E}=e;return l({"k-valid":r,"k-invalid":s,"k-hover":i,"k-focus":d,"k-checked":c,"k-active":a,"k-selected":m,"k-disabled":u,"k-indeterminate":p&&!c,"k-loading":M,"k-empty":k,"k-readonly":b,"k-highlighted":te},Object.keys(E).reduce((_,I)=>(I.startsWith("k-")?_[I]=E[I]:_[`k-${I}`]=E[I],_),{}))};var o={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"};var f={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},n={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},x={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{Fragment as ie,jsx as U}from"react/jsx-runtime";var $="k-font-icon",ne=[],oe={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info]},ae={},S=t=>{let{size:e,themeColor:r,icon:s,rotate:i,flip:d,...c}=t;return s?U("span",{...c,className:l(t.className,$,C($,{size:e}),{[`k-i-${s}`]:s,[`k-color-${r}`]:r,[`k-rotate-${i}`]:i,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):U(ie,{})};S.states=ne;S.options=oe;S.className=$;S.defaultOptions=ae;var j=S;import{Fragment as le,jsx as O}from"react/jsx-runtime";var B="k-svg-icon",re=[],se={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[f.outline,f.solid,f.duotone]},H={viewBox:"0 0 24 24",variant:f.outline},g=t=>{let{size:e,themeColor:r,rotate:s,flip:i,viewBox:d=H.viewBox,variant:c=H.variant,icon:a,...m}=t;if(!a)return O(le,{});if(a==="none")return O("span",{...m,className:l(t.className,B,C("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let u=typeof a=="object"&&a.name&&a.name,p=typeof a=="object"?c&&a.variants?.[c]||a.variants?.outline||a.content:void 0;return O("span",{...m,className:l(t.className,B,C("k-icon",{size:e}),{[`k-svg-i-${u}`]:u,[`k-color-${r}`]:r,[`k-rotate-${s}`]:s,"k-flip-h":i==="h"||i==="both","k-flip-v":i==="v"||i==="both"}),"aria-hidden":"true",children:O("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof a=="object"?a.viewBox:d,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:a?void 0:t.children})})};g.states=re;g.options=se;g.className=B;g.defaultOptions=H;var P=g;import*as F from"@progress/kendo-svg-icons";var q="icon",J="icons";import{useContext as de}from"react";import{createContext as ce}from"react";var W=ce({iconsType:"svg"});import{Fragment as X,jsx as R}from"react/jsx-runtime";var z="k-icon",me=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),ue=[],pe={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[f.outline,f.solid,f.duotone]},L={viewBox:"0 0 24 24",type:"svg",variant:f.outline},y=t=>{let{iconsType:e}=de(W),{size:r,themeColor:s,icon:i,type:d=e||L.type,rotate:c,flip:a,viewBox:m=L.viewBox,variant:u=L.variant,...p}=t;if(!i)return R(X,{});if((e||d)==="svg"){if(i==="none")return R(P,{...p,className:l(t.className,z),icon:i,size:r,variant:u});let k=F[i]?i:me(`${i}-icon`);return F[k]?R(P,{...p,className:l(t.className,z),icon:F[k],size:r,themeColor:s,rotate:c,flip:a,viewBox:m,variant:u}):R(X,{})}return R(j,{...p,className:l(t.className,z),icon:i,size:r,themeColor:s,rotate:c,flip:a})};y.states=ue;y.options=pe;y.defaultOptions=L;y.className=z;y.moduleName=q;y.folderName=J;y.ariaSpec={selector:".k-icon, .k-svg-icon",rules:[{selector:".k-icon, .k-svg-icon",attribute:"aria-hidden=true",usage:"Hides the icon element and all its children from assistive technologies."}]};import{Fragment as xe,jsx as h,jsxs as he}from"react/jsx-runtime";var G="k-rating-item",fe=[x.hover,x.focus,x.selected,x.disabled],ge={},Z={iconType:"solid"},Q={name:"star",content:'<path d="M256 391.5 117.2 480 154 314.1 32 202.4 192.9 188 256 32l63.1 156L480 202.4 358 314.1 394.8 480z"></path>',viewBox:"0 0 512 512"},Y={name:"star-outline",content:'<path d="M480 202.4 319.1 188 256 32l-63.1 156L32 202.4l122 111.7L117.2 480 256 391.5 394.8 480 358 314.1zM256 353.6l-90.8 57.9 24-108.5-82.1-75.2 108.1-9.7L256 117.3l40.8 100.8 108.1 9.7-82.1 75.2 24.1 108.5z"></path>',viewBox:"0 0 512 512"},T=t=>{let{iconType:e=Z.iconType,hover:r,focus:s,selected:i,disabled:d,dir:c,...a}=t,m;switch(e){case"split":m=he(xe,{children:[h("span",{className:"k-rating-precision-complement",children:h(g,{className:"k-icon",icon:Y,size:"xlarge"})}),h("span",{className:"k-rating-precision-part",style:{clipPath:`inset(${c==="rtl"?"0px 0px 0px 50%":"0px 50% 0px 0px"})`},children:h(g,{className:"k-icon",icon:Q,size:"xlarge"})}),h("span",{style:{width:"24px",height:"24px",display:"block"}})]});break;case"outline":m=h(g,{className:"k-icon",icon:Y,size:"xlarge"});break;case"solid":m=h(g,{className:"k-icon",icon:Q,size:"xlarge"});break;default:return}return h("span",{...a,className:l(G,A(G,{hover:r,focus:s,selected:i,disabled:d})),dir:c,children:m})};T.states=fe;T.options=ge;T.className=G;T.defaultOptions=Z;var w=T;var D="rating",ee=D;import{jsx as N,jsxs as ye}from"react/jsx-runtime";var V="k-rating",ve=[x.disabled,x.readonly],be={},K={max:5,min:0},v=t=>{let{value:e,max:r=K.max,min:s=K.min,disabled:i,readonly:d,label:c,dir:a,...m}=t,u=[],p=Math.floor(e),M=e%1===.5,k=r-Math.ceil(e);for(let b=0;b<p;b++)u.push(N(w,{dir:a,iconType:"solid",selected:!0}));M&&u.push(N(w,{dir:a,iconType:"split",selected:!0}));for(let b=0;b<k;b++)u.push(N(w,{dir:a,iconType:"outline"}));return ye("span",{...m,className:l(t.className,V,A(V,{disabled:i,readonly:d})),dir:a,role:"slider",tabIndex:i?void 0:0,"aria-valuenow":e,"aria-valuemin":s,"aria-valuemax":r,"aria-disabled":i?"true":void 0,"aria-readonly":d?"true":void 0,children:[N("span",{className:"k-rating-container",children:u}),c&&N("span",{className:"k-rating-label",children:N("span",{children:c})})]})};v.states=ve;v.options=be;v.className=V;v.defaultOptions=K;v.moduleName=D;v.folderName=ee;v.ariaSpec={selector:".k-rating",rules:[{selector:".k-rating",attribute:"role=slider",usage:"Announces the slider role of the Rating element."},{selector:".k-rating",attribute:"aria-label or aria-labelledby or title",usage:"The Rating needs an accessible name to be assigned to it."},{selector:".k-rating",attribute:"aria-valuenow",usage:"Specifies the currently selected value in the Rating."},{selector:".k-rating",attribute:"aria-valuemin",usage:"Specifies the minimum available value in the Rating."},{selector:".k-rating",attribute:"aria-valuemax",usage:"Specifies the maximum available value in the Rating."},{selector:".k-rating:not(.k-disabled)",attribute:"tabindex=0",usage:"The element must be focusable. Disabled ratings are removed from tab order."},{selector:".k-rating.k-disabled",attribute:"aria-disabled=true",usage:"Rendered only when the Rating is disabled."},{selector:".k-rating.k-readonly",attribute:"aria-readonly=true (when readonly)",usage:"Rendered only when the Rating is readonly. Readonly ratings remain focusable but their value cannot be changed."}]};var rt=v;export{V as RATING_CLASSNAME,v as Rating,rt as default};