UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 6.41 kB
var l=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...e):typeof e=="object"?Object.keys(e).map((i,s)=>e[s]||e[i]&&i||null).filter(i=>i!==null).join(" "):e).filter(e=>!!e).join(" ");var h=(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"}),F=(t,e)=>{let{valid:i,invalid:s,hover:a,focus:d,checked:c,active:r,selected:p,disabled:x,indeterminate:f,loading:H,empty:N,readonly:q,highlighted:J,...O}=e;return l({"k-valid":i,"k-invalid":s,"k-hover":a,"k-focus":d,"k-checked":c,"k-active":r,"k-selected":p,"k-disabled":x,"k-indeterminate":f&&!c,"k-loading":H,"k-empty":N,"k-readonly":q,"k-highlighted":J},Object.keys(O).reduce((E,g)=>(g.startsWith("k-")?E[g]=O[g]:E[`k-${g}`]=O[g],E),{}))};var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"};var u={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},o={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},v={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 Y,jsx as K}from"react/jsx-runtime";var T="k-font-icon",W=[],X={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info]},Q={},y=t=>{let{size:e,themeColor:i,icon:s,rotate:a,flip:d,...c}=t;return s?K("span",{...c,className:l(t.className,T,h(T,{size:e}),{[`k-i-${s}`]:s,[`k-color-${i}`]:i,[`k-rotate-${a}`]:a,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):K(Y,{})};y.states=W;y.options=X;y.className=T;y.defaultOptions=Q;var D=y;import{Fragment as te,jsx as S}from"react/jsx-runtime";var L="k-svg-icon",Z=[],ee={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[u.outline,u.solid,u.duotone]},z={viewBox:"0 0 24 24",variant:u.outline},k=t=>{let{size:e,themeColor:i,rotate:s,flip:a,viewBox:d=z.viewBox,variant:c=z.variant,icon:r,...p}=t;if(!r)return S(te,{});if(r==="none")return S("span",{...p,className:l(t.className,L,h("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let x=typeof r=="object"&&r.name&&r.name,f=typeof r=="object"?c&&r.variants?.[c]||r.variants?.outline||r.content:void 0;return S("span",{...p,className:l(t.className,L,h("k-icon",{size:e}),{[`k-svg-i-${x}`]:x,[`k-color-${i}`]:i,[`k-rotate-${s}`]:s,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="both"}),"aria-hidden":"true",children:S("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof r=="object"?r.viewBox:d,dangerouslySetInnerHTML:f!==void 0?{__html:f}:void 0,children:r?void 0:t.children})})};k.states=Z;k.options=ee;k.className=L;k.defaultOptions=z;var A=k;import*as _ from"@progress/kendo-svg-icons";var P="icon",U="icons";import{useContext as ne}from"react";import{createContext as oe}from"react";var V=oe({iconsType:"svg"});import{Fragment as G,jsx as C}from"react/jsx-runtime";var I="k-icon",re=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),ae=[],ie={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[u.outline,u.solid,u.duotone]},B={viewBox:"0 0 24 24",type:"svg",variant:u.outline},m=t=>{let{iconsType:e}=ne(V),{size:i,themeColor:s,icon:a,type:d=e||B.type,rotate:c,flip:r,viewBox:p=B.viewBox,variant:x=B.variant,...f}=t;if(!a)return C(G,{});if((e||d)==="svg"){if(a==="none")return C(A,{...f,className:l(t.className,I),icon:a,size:i,variant:x});let N=_[a]?a:re(`${a}-icon`);return _[N]?C(A,{...f,className:l(t.className,I),icon:_[N],size:i,themeColor:s,rotate:c,flip:r,viewBox:p,variant:x}):C(G,{})}return C(D,{...f,className:l(t.className,I),icon:a,size:i,themeColor:s,rotate:c,flip:r})};m.states=ae;m.options=ie;m.defaultOptions=B;m.className=I;m.moduleName=P;m.folderName=U;m.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."}]};var w="bubble",j=w;import{jsx as M,jsxs as le}from"react/jsx-runtime";var $="k-bubble",se=[v.hover,v.active,v.selected,v.focus],R={expandable:!1,expanded:!1},b=t=>{let{content:e,hover:i,active:s,focus:a,selected:d,expandable:c=R.expandable,expanded:r=R.expanded,...p}=t;return le("div",{...p,className:l(t.className,$,F($,{hover:i,active:s,focus:a,selected:d}),{"k-bubble-expandable":c},{"k-expanded":r}),tabIndex:0,children:[M("div",{className:"k-bubble-content",children:e??t.children}),c&&M("span",{className:"k-bubble-expandable-indicator",role:"button","aria-label":r?"Show less":"Show more",tabIndex:0,children:r?M(m,{icon:"chevron-up"}):M(m,{icon:"chevron-down"})})]})};b.states=se;b.className=$;b.defaultOptions=R;b.moduleName=w;b.folderName=j;b.ariaSpec={selector:".k-bubble",rules:[{selector:".k-bubble",attribute:"tabindex=0",usage:"The Chat bubble must be focusable."},{selector:".k-bubble-expandable-indicator",attribute:"role=button",usage:"The expandable indicator must have an appropriate role."},{selector:".k-bubble-expandable-indicator",attribute:"aria-label or title",usage:"The expandable indicator must be properly labelled."},{selector:".k-bubble-expandable-indicator",attribute:"tabindex=0",usage:"The expandable indicator must be part of the page tabsequence."}]};var Ve=b;export{$ as BUBBLE_CLASSNAME,b as Bubble,Ve as default};