UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 6.79 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 g=(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"}),P=(t,e)=>{let{valid:i,invalid:s,hover:a,focus:c,checked:d,active:r,selected:p,disabled:x,indeterminate:b,loading:H,empty:B,readonly:W,highlighted:Q,...M}=e;return l({"k-valid":i,"k-invalid":s,"k-hover":a,"k-focus":c,"k-checked":d,"k-active":r,"k-selected":p,"k-disabled":x,"k-indeterminate":b&&!d,"k-loading":H,"k-empty":B,"k-readonly":W,"k-highlighted":Q},Object.keys(M).reduce((L,h)=>(h.startsWith("k-")?L[h]=M[h]:L[`k-${h}`]=M[h],L),{}))};var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"};var m={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 te,jsx as F}from"react/jsx-runtime";var O="k-font-icon",Y=[],Z={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]},ee={},y=t=>{let{size:e,themeColor:i,icon:s,rotate:a,flip:c,...d}=t;return s?F("span",{...d,className:l(t.className,O,g(O,{size:e}),{[`k-i-${s}`]:s,[`k-color-${i}`]:i,[`k-rotate-${a}`]:a,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):F(te,{})};y.states=Y;y.options=Z;y.className=O;y.defaultOptions=ee;var D=y;import{Fragment as ae,jsx as C}from"react/jsx-runtime";var T="k-svg-icon",oe=[],ne={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:[m.outline,m.solid,m.duotone]},w={viewBox:"0 0 24 24",variant:m.outline},k=t=>{let{size:e,themeColor:i,rotate:s,flip:a,viewBox:c=w.viewBox,variant:d=w.variant,icon:r,...p}=t;if(!r)return C(ae,{});if(r==="none")return C("span",{...p,className:l(t.className,T,g("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let x=typeof r=="object"&&r.name&&r.name,b=typeof r=="object"?d&&r.variants?.[d]||r.variants?.outline||r.content:void 0;return C("span",{...p,className:l(t.className,T,g("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:C("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof r=="object"?r.viewBox:c,dangerouslySetInnerHTML:b!==void 0?{__html:b}:void 0,children:r?void 0:t.children})})};k.states=oe;k.options=ne;k.className=T;k.defaultOptions=w;var z=k;import*as A from"@progress/kendo-svg-icons";var U="icon",V="icons";import{useContext as ie}from"react";import{createContext as re}from"react";var G=re({iconsType:"svg"});import{Fragment as q,jsx as N}from"react/jsx-runtime";var S="k-icon",se=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),le=[],de={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:[m.outline,m.solid,m.duotone]},I={viewBox:"0 0 24 24",type:"svg",variant:m.outline},u=t=>{let{iconsType:e}=ie(G),{size:i,themeColor:s,icon:a,type:c=e||I.type,rotate:d,flip:r,viewBox:p=I.viewBox,variant:x=I.variant,...b}=t;if(!a)return N(q,{});if((e||c)==="svg"){if(a==="none")return N(z,{...b,className:l(t.className,S),icon:a,size:i,variant:x});let B=A[a]?a:se(`${a}-icon`);return A[B]?N(z,{...b,className:l(t.className,S),icon:A[B],size:i,themeColor:s,rotate:d,flip:r,viewBox:p,variant:x}):N(q,{})}return N(D,{...b,className:l(t.className,S),icon:a,size:i,themeColor:s,rotate:d,flip:r})};u.states=le;u.options=de;u.defaultOptions=I;u.className=S;u.moduleName=U;u.folderName=V;u.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 _="bubble",J=_;import{jsx as E,jsxs as me}from"react/jsx-runtime";var $="k-bubble",ce=[v.hover,v.active,v.selected,v.focus],R={expandable:!1,expanded:!1},f=t=>{let{content:e,hover:i,active:s,focus:a,selected:c,expandable:d=R.expandable,expanded:r=R.expanded,...p}=t;return me("div",{...p,className:l(t.className,$,P($,{hover:i,active:s,focus:a,selected:c}),{"k-bubble-expandable":d},{"k-expanded":r}),tabIndex:0,children:[E("div",{className:"k-bubble-content",children:e??t.children}),d&&E("span",{className:"k-bubble-expandable-indicator",role:"button","aria-label":r?"Show less":"Show more",tabIndex:0,children:r?E(u,{icon:"chevron-up"}):E(u,{icon:"chevron-down"})})]})};f.states=ce;f.className=$;f.defaultOptions=R;f.moduleName=_;f.folderName=J;f.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."}]};import{jsx as Ye}from"react/jsx-runtime";import{jsx as ot}from"react/jsx-runtime";import{jsx as it}from"react/jsx-runtime";import{jsx as K,jsxs as j}from"react/jsx-runtime";var ue="k-chat-bubble",ht=t=>{let{typing:e,content:i,files:s,...a}=t;return j(f,{...a,className:l(t.className,ue),children:[e?j("div",{className:"k-typing-indicator",tabIndex:-1,children:[K("span",{}),K("span",{}),K("span",{})]}):i,s]})};export{ht as ChatBubble};