UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 5.95 kB
var a=(...o)=>o.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?a(...e):typeof e=="object"?Object.keys(e).map((i,l)=>e[l]||e[i]&&i||null).filter(i=>i!==null).join(" "):e).filter(e=>!!e).join(" ");var f=(o,e)=>a({[`${o}-xs`]:e.size==="xsmall",[`${o}-sm`]:e.size==="small",[`${o}-md`]:e.size==="medium",[`${o}-lg`]:e.size==="large",[`${o}-xl`]:e.size==="xlarge",[`${o}-xxl`]:e.size==="xxlarge",[`${o}-xxxl`]:e.size==="xxxlarge"},{[`${o}-${e.fillMode}`]:e.fillMode},{[`${o}-${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"});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"},t={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"};var w={calloutMap:{top:"n",bottom:"s",left:"w",right:"e"},orientationMap:{vertical:"vstack",horizontal:"hstack"}};var T={};function $(o){return T[o]=(T[o]||0)+1,`k-${o}-${T[o]}`}import{Fragment as J,jsx as R}from"react/jsx-runtime";var I="k-font-icon",j=[],U={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info]},q={},v=o=>{let{size:e,themeColor:i,icon:l,rotate:r,flip:c,...d}=o;return l?R("span",{...d,className:a(o.className,I,f(I,{size:e}),{[`k-i-${l}`]:l,[`k-color-${i}`]:i,[`k-rotate-${r}`]:r,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):R(J,{})};v.states=j;v.options=U;v.className=I;v.defaultOptions=q;var P=v;import{Fragment as Q,jsx as C}from"react/jsx-runtime";var M="k-svg-icon",X=[],W={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info],variant:[m.outline,m.solid,m.duotone]},S={viewBox:"0 0 24 24",variant:m.outline},b=o=>{let{size:e,themeColor:i,rotate:l,flip:r,viewBox:c=S.viewBox,variant:d=S.variant,icon:s,...x}=o;if(!s)return C(Q,{});if(s==="none")return C("span",{...x,className:a(o.className,M,f("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let h=typeof s=="object"&&s.name&&s.name,g=typeof s=="object"?d&&s.variants?.[d]||s.variants?.outline||s.content:void 0;return C("span",{...x,className:a(o.className,M,f("k-icon",{size:e}),{[`k-svg-i-${h}`]:h,[`k-color-${i}`]:i,[`k-rotate-${l}`]:l,"k-flip-h":r==="h"||r==="both","k-flip-v":r==="v"||r==="both"}),"aria-hidden":"true",children:C("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof s=="object"?s.viewBox:c,dangerouslySetInnerHTML:g!==void 0?{__html:g}:void 0,children:s?void 0:o.children})})};b.states=X;b.options=W;b.className=M;b.defaultOptions=S;var L=b;import*as E from"@progress/kendo-svg-icons";var B="icon",H="icons";import{useContext as Z}from"react";import{createContext as Y}from"react";var F=Y({iconsType:"svg"});import{Fragment as D,jsx as k}from"react/jsx-runtime";var N="k-icon",ee=o=>o.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),te=[],oe={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info],variant:[m.outline,m.solid,m.duotone]},O={viewBox:"0 0 24 24",type:"svg",variant:m.outline},u=o=>{let{iconsType:e}=Z(F),{size:i,themeColor:l,icon:r,type:c=e||O.type,rotate:d,flip:s,viewBox:x=O.viewBox,variant:h=O.variant,...g}=o;if(!r)return k(D,{});if((e||c)==="svg"){if(r==="none")return k(L,{...g,className:a(o.className,N),icon:r,size:i,variant:h});let _=E[r]?r:ee(`${r}-icon`);return E[_]?k(L,{...g,className:a(o.className,N),icon:E[_],size:i,themeColor:l,rotate:d,flip:s,viewBox:x,variant:h}):k(D,{})}return k(P,{...g,className:a(o.className,N),icon:r,size:i,themeColor:l,rotate:d,flip:s})};u.states=te;u.options=oe;u.defaultOptions=O;u.className=N;u.moduleName=B;u.folderName=H;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 z="tooltip",K=z;import{jsx as y,jsxs as V}from"react/jsx-runtime";var A="k-tooltip",ne=[],ie={themeColor:[t.undefined,t.base,t.inverse,t.info,t.success,t.warning,t.error]},G={closable:!1},p=o=>{let{closable:e=G.closable,callout:i,themeColor:l,title:r,content:c,icon:d,id:s=$("tooltip"),...x}=o;return V("div",{...x,className:a(o.className,A,f(A,{themeColor:l}),{"k-tooltip-closable":e}),role:"tooltip",id:s,children:[d&&y(u,{className:"k-tooltip-icon",icon:d}),V("div",{className:"k-tooltip-content",children:[r&&y("div",{className:"k-tooltip-title",children:r}),c]}),e&&y("div",{className:"k-tooltip-button",role:"button","aria-label":"Close",tabIndex:0,children:y(u,{icon:"x"})}),i&&y("div",{className:a("k-callout",{[`k-callout-${w.calloutMap[i]||i}`]:i})})]})};p.states=ne;p.options=ie;p.className=A;p.defaultOptions=G;p.moduleName=z;p.folderName=K;p.ariaSpec={selector:".k-tooltip",implicitRole:"tooltip",rules:[{selector:".k-tooltip",attribute:"role=tooltip",usage:"Specifies the tooltip role of the tooltip container."},{selector:".k-tooltip",attribute:"id",usage:"The element needs an id to be associated with the aria-describedby attribute of the trigger element."},{selector:".k-tooltip .k-tooltip-button",attribute:"role=button",usage:"The close button needs an explicit button role."},{selector:".k-tooltip .k-tooltip-button",attribute:"aria-label",usage:"The close button needs an accessible name."}]};var De=p;export{A as TOOLTIP_CLASSNAME,p as Tooltip,De as default};