UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 7.92 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,n)=>e[n]||e[i]&&i||null).filter(i=>i!==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"}),G=(t,e)=>{let{valid:i,invalid:n,hover:s,focus:c,checked:p,active:a,selected:d,disabled:m,indeterminate:u,loading:V,empty:I,readonly:ee,highlighted:te,...E}=e;return l({"k-valid":i,"k-invalid":n,"k-hover":s,"k-focus":c,"k-checked":p,"k-active":a,"k-selected":d,"k-disabled":m,"k-indeterminate":u&&!p,"k-loading":V,"k-empty":I,"k-readonly":ee,"k-highlighted":te},Object.keys(E).reduce((M,k)=>(k.startsWith("k-")?M[k]=E[k]:M[`k-${k}`]=E[k],M),{}))};var r={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"},o={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},O={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{jsx as re}from"react/jsx-runtime";var b="k-pane",oe=[],ne={},$={resizable:!0,flex:!1},v=t=>{let{scrollable:e,flexBasis:i,flex:n=$.flex,collapsible:s,resizable:c=$.resizable,pinned:p,unpinned:a,tabbed:d,...m}=t;return re("div",{...m,style:{flexBasis:i,...t.style},className:l(t.className,b,{[`${b}-static`]:i,[`${b}-flex`]:n,"k-scrollable":e,[`${b}-pinned`]:p,[`${b}-unpinned`]:a,[`${b}-tabbed`]:d}),role:"group",children:t.children})};v.states=oe;v.options=ne;v.className=b;v.defaultOptions=$;import{Fragment as le,jsx as U}from"react/jsx-runtime";var R="k-font-icon",ae=[],ie={size:[r.undefined,r.xsmall,r.small,r.medium,r.large,r.xlarge,r.xxlarge,r.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info]},se={},C=t=>{let{size:e,themeColor:i,icon:n,rotate:s,flip:c,...p}=t;return n?U("span",{...p,className:l(t.className,R,N(R,{size:e}),{[`k-i-${n}`]:n,[`k-color-${i}`]:i,[`k-rotate-${s}`]:s,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):U(le,{})};C.states=ae;C.options=ie;C.className=R;C.defaultOptions=se;var j=C;import{Fragment as de,jsx as P}from"react/jsx-runtime";var _="k-svg-icon",ce=[],pe={size:[r.undefined,r.xsmall,r.small,r.medium,r.large,r.xlarge,r.xxlarge,r.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[f.outline,f.solid,f.duotone]},w={viewBox:"0 0 24 24",variant:f.outline},z=t=>{let{size:e,themeColor:i,rotate:n,flip:s,viewBox:c=w.viewBox,variant:p=w.variant,icon:a,...d}=t;if(!a)return P(de,{});if(a==="none")return P("span",{...d,className:l(t.className,_,N("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let m=typeof a=="object"&&a.name&&a.name,u=typeof a=="object"?p&&a.variants?.[p]||a.variants?.outline||a.content:void 0;return P("span",{...d,className:l(t.className,_,N("k-icon",{size:e}),{[`k-svg-i-${m}`]:m,[`k-color-${i}`]:i,[`k-rotate-${n}`]:n,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:P("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof a=="object"?a.viewBox:c,dangerouslySetInnerHTML:u!==void 0?{__html:u}:void 0,children:a?void 0:t.children})})};z.states=ce;z.options=pe;z.className=_;z.defaultOptions=w;var K=z;import*as H from"@progress/kendo-svg-icons";var q="icon",W="icons";import{useContext as ue}from"react";import{createContext as me}from"react";var J=me({iconsType:"svg"});import{Fragment as X,jsx as T}from"react/jsx-runtime";var L="k-icon",fe=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),xe=[],be={size:[r.undefined,r.xsmall,r.small,r.medium,r.large,r.xlarge,r.xxlarge,r.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[f.outline,f.solid,f.duotone]},A={viewBox:"0 0 24 24",type:"svg",variant:f.outline},x=t=>{let{iconsType:e}=ue(J),{size:i,themeColor:n,icon:s,type:c=e||A.type,rotate:p,flip:a,viewBox:d=A.viewBox,variant:m=A.variant,...u}=t;if(!s)return T(X,{});if((e||c)==="svg"){if(s==="none")return T(K,{...u,className:l(t.className,L),icon:s,size:i,variant:m});let I=H[s]?s:fe(`${s}-icon`);return H[I]?T(K,{...u,className:l(t.className,L),icon:H[I],size:i,themeColor:n,rotate:p,flip:a,viewBox:d,variant:m}):T(X,{})}return T(j,{...u,className:l(t.className,L),icon:s,size:i,themeColor:n,rotate:p,flip:a})};x.states=xe;x.options=be;x.defaultOptions=A;x.className=L;x.moduleName=q;x.folderName=W;x.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 Q,jsx as g,jsxs as ve}from"react/jsx-runtime";var S="k-splitbar",ge=[O.hover,O.focus],he={},B={orientation:"horizontal",draggable:!0},y=t=>{let{hover:e,focus:i,orientation:n=B.orientation,draggable:s=B.draggable,collapsePrev:c,collapseNext:p,ariaLabel:a,...d}=t;return ve("div",{...d,className:l(t.className,S,G(S,{hover:e,focus:i}),{[`${S}-${n}`]:n,[`${S}-draggable-${n}`]:s,[`${S}-static-${n}`]:!s&&!c&&!p}),role:"separator","aria-label":a,...n==="horizontal"&&{"aria-orientation":"vertical"},"aria-keyshortcuts":"ArrowLeft ArrowRight ArrowUp ArrowDown",children:[c&&g(Q,{children:g("div",{className:"k-collapse-prev",children:g(x,{icon:`chevron-${n==="horizontal"?"left":"up"}`,size:"xsmall"})})}),g("div",{className:"k-resize-handle","aria-hidden":"true"}),p&&g(Q,{children:g("div",{className:"k-collapse-next",children:g(x,{icon:`chevron-${n==="horizontal"?"right":"down"}`,size:"xsmall"})})})]})};y.states=ge;y.options=he;y.className=S;y.defaultOptions=B;var D="splitter",Y=D;import{jsx as ke,jsxs as Ne}from"react/jsx-runtime";import{createElement as ye}from"react";var F="k-splitter",Se={},Z={orientation:"horizontal"},h=t=>{let{orientation:e=Z.orientation,children:i,panes:n,...s}=t,c=[];return n&&n.forEach((p,a)=>{let d=n[a+1],m=p.props,u=d?.props;c.push(ye(v,{...m,key:a})),d&&c.push(ke(y,{draggable:m.resizable!==!1&&u.resizable!==!1,collapsePrev:m.collapsible,collapseNext:u.collapsible,orientation:e,ariaLabel:"Pane separator"},`splitbar-${a}`))}),Ne("div",{...s,className:l(t.className,F,{[`${F}-${e}`]:e},"k-splitter-flex"),children:[c,i]})};h.options=Se;h.className=F;h.defaultOptions=Z;h.moduleName=D;h.folderName=Y;h.ariaSpec={selector:".k-splitter",rules:[{selector:".k-pane",attribute:"role=group",usage:"Sets the proper role for the Splitter pane."},{selector:".k-splitbar",attribute:"role=separator",usage:"Sets the proper role for the Splitter split-bar element."},{selector:".k-splitbar",attribute:"aria-label",usage:"An accessible name for the separator."},{selector:".k-splitbar-horizontal",attribute:"aria-orientation=vertical",usage:"When a splitbar separates two panes horizontally, its aria-orientation must be explicitly set to vertical."},{selector:".k-splitbar",attribute:"aria-keyshortcuts",usage:"Announces available keyboard shortcuts."}]};var ft=h;export{h as Splitter,ft as default};