UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 9.49 kB
var l=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...e):typeof e=="object"?Object.keys(e).map((r,c)=>e[c]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var N=(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"}),L=(t,e)=>{let{valid:r,invalid:c,hover:i,focus:d,checked:u,active:a,selected:m,disabled:f,indeterminate:x,loading:A,empty:v,readonly:E,highlighted:H,...T}=e;return l({"k-valid":r,"k-invalid":c,"k-hover":i,"k-focus":d,"k-checked":u,"k-active":a,"k-selected":m,"k-disabled":f,"k-indeterminate":x&&!u,"k-loading":A,"k-empty":v,"k-readonly":E,"k-highlighted":H},Object.keys(T).reduce((p,y)=>(y.startsWith("k-")?p[y]=T[y]:p[`k-${y}`]=T[y],p),{}))};function j(t,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(c=>[`k-${c}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},k={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},C={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},g={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"},b={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"},J={calloutMap:{top:"n",bottom:"s",left:"w",right:"e"},orientationMap:{vertical:"vstack",horizontal:"hstack"}};import{Fragment as be,jsx as Q}from"react/jsx-runtime";var P="k-font-icon",xe=[],ge={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]},he={},S=t=>{let{size:e,themeColor:r,icon:c,rotate:i,flip:d,...u}=t;return c?Q("span",{...u,className:l(t.className,P,N(P,{size:e}),{[`k-i-${c}`]:c,[`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"}):Q(be,{})};S.states=xe;S.options=ge;S.className=P;S.defaultOptions=he;var X=S;import{Fragment as Ne,jsx as R}from"react/jsx-runtime";var F="k-svg-icon",ve=[],ye={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:[g.outline,g.solid,g.duotone]},D={viewBox:"0 0 24 24",variant:g.outline},M=t=>{let{size:e,themeColor:r,rotate:c,flip:i,viewBox:d=D.viewBox,variant:u=D.variant,icon:a,...m}=t;if(!a)return R(Ne,{});if(a==="none")return R("span",{...m,className:l(t.className,F,N("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let f=typeof a=="object"&&a.name&&a.name,x=typeof a=="object"?u&&a.variants?.[u]||a.variants?.outline||a.content:void 0;return R("span",{...m,className:l(t.className,F,N("k-icon",{size:e}),{[`k-svg-i-${f}`]:f,[`k-color-${r}`]:r,[`k-rotate-${c}`]:c,"k-flip-h":i==="h"||i==="both","k-flip-v":i==="v"||i==="both"}),"aria-hidden":"true",children:R("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof a=="object"?a.viewBox:d,dangerouslySetInnerHTML:x!==void 0?{__html:x}:void 0,children:a?void 0:t.children})})};M.states=ve;M.options=ye;M.className=F;M.defaultOptions=D;var G=M;import*as U from"@progress/kendo-svg-icons";var Y="icon",Z="icons";import{useContext as Ce}from"react";import{createContext as ke}from"react";var ee=ke({iconsType:"svg"});import{Fragment as te,jsx as w}from"react/jsx-runtime";var K="k-icon",Te=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Be=[],Oe={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:[g.outline,g.solid,g.duotone]},$={viewBox:"0 0 24 24",type:"svg",variant:g.outline},h=t=>{let{iconsType:e}=Ce(ee),{size:r,themeColor:c,icon:i,type:d=e||$.type,rotate:u,flip:a,viewBox:m=$.viewBox,variant:f=$.variant,...x}=t;if(!i)return w(te,{});if((e||d)==="svg"){if(i==="none")return w(G,{...x,className:l(t.className,K),icon:i,size:r,variant:f});let v=U[i]?i:Te(`${i}-icon`);return U[v]?w(G,{...x,className:l(t.className,K),icon:U[v],size:r,themeColor:c,rotate:u,flip:a,viewBox:m,variant:f}):w(te,{})}return w(X,{...x,className:l(t.className,K),icon:i,size:r,themeColor:c,rotate:u,flip:a})};h.states=Be;h.options=Oe;h.defaultOptions=$;h.className=K;h.moduleName=Y;h.folderName=Z;h.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 V="button",oe=V;import{Fragment as ne,jsx as B,jsxs as re}from"react/jsx-runtime";var z="k-button",Ie=["icon-button"],Se=[b.hover,b.focus,b.active,b.selected,b.disabled,b.generating],Me={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[k.undefined,k.none,k.small,k.medium,k.large,k.full],fillMode:[C.undefined,C.solid,C.flat,C.outline,C.clear,C.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},q={showArrow:!1,arrowIconName:"chevron-down"},s=t=>{let{as:e="button",size:r,rounded:c,fillMode:i,themeColor:d,showArrow:u=q.showArrow,arrowIconName:a=q.arrowIconName,variant:m,hover:f,focus:x,active:A,selected:v,disabled:E,togglable:H,ariaDisabled:T,icon:p,iconSize:y,text:_,iconClassName:de,className:ue,...me}=t,pe=p!=null,fe=t.children!==void 0;return re(e,{className:l(ue,z,j(z,m),N(z,{size:r,rounded:c,fillMode:i,themeColor:d}),L(z,{hover:f,focus:x,active:A,disabled:E||T,selected:v}),{"k-icon-button":!_&&!fe&&pe}),"aria-pressed":H?v?"true":"false":void 0,...me,"aria-disabled":T?"true":void 0,disabled:E||void 0,children:[typeof p=="string"&&p&&B(h,{className:l(de,"k-button-icon"),icon:p,size:y}),p&&typeof p!="string"&&B(ne,{children:p}),_?re(ne,{children:[_&&B("span",{className:"k-button-text",children:_}),t.children]}):t.children&&B("span",{className:"k-button-text",children:t.children}),u&&B("span",{className:"k-menu-button-arrow k-button-arrow",children:B(h,{icon:a})})]})};s.states=Se;s.options=Me;s.variants=Ie;s.className=z;s.defaultOptions=q;s.moduleName=V;s.folderName=oe;s.ariaSpec={selector:".k-button",rules:[{selector:".k-button",attribute:"role=button or nodeName=button",usage:"The button role is implicit from the native <button> element."},{selector:".k-button",attribute:"aria-label (when icon-only)",usage:"Required for icon-only buttons that have no visible text."},{selector:".k-button",attribute:"aria-pressed (when togglable)",usage:"Indicates the pressed state of a toggle button."},{selector:".k-button",attribute:"disabled (when disabled)",usage:"Rendered when the button is disabled."}]};import{jsx as we}from"react/jsx-runtime";var ie=t=>we(s,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as ze}from"react/jsx-runtime";var ae=t=>ze(s,{icon:"folder",children:"Button",...t});import{jsx as Ae}from"react/jsx-runtime";var se=t=>Ae(s,{children:"Button",...t});import{jsx as W}from"react/jsx-runtime";var Ee=s.options,_e=s.states,Le={...s.defaultOptions,variant:"text"},Re=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Ke=[],O=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return W(ie,{...r,icon:"star"});case"icon-and-text":return W(ae,{...r,icon:"star",children:"Button"});default:return W(se,{...r,children:"Button"})}};O.options=Ee;O.states=_e;O.variants=Re;O.defaultOptions=Le;O.modifiers=Ke;O.className=s.className;import{jsx as I,jsxs as ce}from"react/jsx-runtime";var $e="k-orgchart-node-group",He=[b.focus],le={orientation:"horizontal",buttonIcon:"plus"},Pe=t=>{let{title:e,subtitle:r,lineBottom:c,lineTop:i,button:d,buttonIcon:u=le.buttonIcon,focus:a,orientation:m=le.orientation,...f}=t;return ce("div",{...f,className:l(t.className,$e,"k-vstack","k-align-items-center"),role:"group",children:[i&&I("div",{className:"k-orgchart-line k-orgchart-line-v"}),ce("div",{className:l("k-orgchart-node-group-container","k-vstack",L("k-orgchart-node-group-container",{focus:a})),children:[e&&I("div",{className:"k-orgchart-node-group-title",children:e}),r&&I("div",{className:"k-orgchart-node-group-subtitle",children:r}),I("div",{className:l("k-orgchart-node-container",{[`k-${J.orientationMap[m]||m}`]:m}),role:"presentation",children:t.children})]}),c&&I("div",{className:"k-orgchart-line k-orgchart-line-v"}),d&&I(s,{className:"k-orgchart-button",icon:u,role:"presentation","aria-hidden":"true",tabIndex:-1})]})};Pe.states=He;export{$e as ORGCHARTNODEGROUP_CLASSNAME,Pe as OrgchartNodeGroup};