UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 9.64 kB
var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...e):typeof e=="object"?Object.keys(e).map((s,o)=>e[o]||e[s]&&s||null).filter(s=>s!==null).join(" "):e).filter(e=>!!e).join(" ");var z=(t,e)=>d({[`${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"}),W=(t,e)=>{let{valid:s,invalid:o,hover:a,focus:l,checked:p,active:n,selected:c,disabled:m,indeterminate:x,loading:q,empty:E,readonly:ae,highlighted:ie,...R}=e;return d({"k-valid":s,"k-invalid":o,"k-hover":a,"k-focus":l,"k-checked":p,"k-active":n,"k-selected":c,"k-disabled":m,"k-indeterminate":x&&!p,"k-loading":q,"k-empty":E,"k-readonly":ae,"k-highlighted":ie},Object.keys(R).reduce((w,C)=>(C.startsWith("k-")?w[C]=R[C]:w[`k-${C}`]=R[C],w),{}))};var i={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"};var b={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},r={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},_={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 pe}from"react/jsx-runtime";var v="k-pane",se=[],le={},B={resizable:!0,flex:!1},f=t=>{let{scrollable:e,flexBasis:s,flex:o=B.flex,collapsible:a,resizable:l=B.resizable,pinned:p,unpinned:n,tabbed:c,...m}=t;return pe("div",{...m,style:{flexBasis:s,...t.style},className:d(t.className,v,{[`${v}-static`]:s,[`${v}-flex`]:o,"k-scrollable":e,[`${v}-pinned`]:p,[`${v}-unpinned`]:n,[`${v}-tabbed`]:c}),role:"group",children:t.children})};f.states=se;f.options=le;f.className=v;f.defaultOptions=B;import{Fragment as fe,jsx as J}from"react/jsx-runtime";var K="k-font-icon",ce=[],de={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[r.undefined,r.base,r.primary,r.secondary,r.tertiary,r.success,r.warning,r.error,r.info]},me={},I=t=>{let{size:e,themeColor:s,icon:o,rotate:a,flip:l,...p}=t;return o?J("span",{...p,className:d(t.className,K,z(K,{size:e}),{[`k-i-${o}`]:o,[`k-color-${s}`]:s,[`k-rotate-${a}`]:a,"k-flip-h":l==="h"||l==="both","k-flip-v":l==="v"||l==="both"}),"aria-hidden":"true"}):J(fe,{})};I.states=ce;I.options=de;I.className=K;I.defaultOptions=me;var X=I;import{Fragment as be,jsx as A}from"react/jsx-runtime";var H="k-svg-icon",ue=[],xe={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[r.undefined,r.base,r.primary,r.secondary,r.tertiary,r.success,r.warning,r.error,r.info],variant:[b.outline,b.solid,b.duotone]},D={viewBox:"0 0 24 24",variant:b.outline},T=t=>{let{size:e,themeColor:s,rotate:o,flip:a,viewBox:l=D.viewBox,variant:p=D.variant,icon:n,...c}=t;if(!n)return A(be,{});if(n==="none")return A("span",{...c,className:d(t.className,H,z("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let m=typeof n=="object"&&n.name&&n.name,x=typeof n=="object"?p&&n.variants?.[p]||n.variants?.outline||n.content:void 0;return A("span",{...c,className:d(t.className,H,z("k-icon",{size:e}),{[`k-svg-i-${m}`]:m,[`k-color-${s}`]:s,[`k-rotate-${o}`]:o,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="both"}),"aria-hidden":"true",children:A("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof n=="object"?n.viewBox:l,dangerouslySetInnerHTML:x!==void 0?{__html:x}:void 0,children:n?void 0:t.children})})};T.states=ue;T.options=xe;T.className=H;T.defaultOptions=D;var F=T;import*as V from"@progress/kendo-svg-icons";var Q="icon",Y="icons";import{useContext as ge}from"react";import{createContext as he}from"react";var Z=he({iconsType:"svg"});import{Fragment as ee,jsx as L}from"react/jsx-runtime";var M="k-icon",ve=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Se=[],ye={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[r.undefined,r.base,r.primary,r.secondary,r.tertiary,r.success,r.warning,r.error,r.info],variant:[b.outline,b.solid,b.duotone]},O={viewBox:"0 0 24 24",type:"svg",variant:b.outline},h=t=>{let{iconsType:e}=ge(Z),{size:s,themeColor:o,icon:a,type:l=e||O.type,rotate:p,flip:n,viewBox:c=O.viewBox,variant:m=O.variant,...x}=t;if(!a)return L(ee,{});if((e||l)==="svg"){if(a==="none")return L(F,{...x,className:d(t.className,M),icon:a,size:s,variant:m});let E=V[a]?a:ve(`${a}-icon`);return V[E]?L(F,{...x,className:d(t.className,M),icon:V[E],size:s,themeColor:o,rotate:p,flip:n,viewBox:c,variant:m}):L(ee,{})}return L(X,{...x,className:d(t.className,M),icon:a,size:s,themeColor:o,rotate:p,flip:n})};h.states=Se;h.options=ye;h.defaultOptions=O;h.className=M;h.moduleName=Q;h.folderName=Y;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."}]};import{Fragment as te,jsx as S,jsxs as Ne}from"react/jsx-runtime";var y="k-splitbar",ke=[_.hover,_.focus],Pe={},G={orientation:"horizontal",draggable:!0},k=t=>{let{hover:e,focus:s,orientation:o=G.orientation,draggable:a=G.draggable,collapsePrev:l,collapseNext:p,ariaLabel:n,...c}=t;return Ne("div",{...c,className:d(t.className,y,W(y,{hover:e,focus:s}),{[`${y}-${o}`]:o,[`${y}-draggable-${o}`]:a,[`${y}-static-${o}`]:!a&&!l&&!p}),role:"separator","aria-label":n,...o==="horizontal"&&{"aria-orientation":"vertical"},"aria-keyshortcuts":"ArrowLeft ArrowRight ArrowUp ArrowDown",children:[l&&S(te,{children:S("div",{className:"k-collapse-prev",children:S(h,{icon:`chevron-${o==="horizontal"?"left":"up"}`,size:"xsmall"})})}),S("div",{className:"k-resize-handle","aria-hidden":"true"}),p&&S(te,{children:S("div",{className:"k-collapse-next",children:S(h,{icon:`chevron-${o==="horizontal"?"right":"down"}`,size:"xsmall"})})})]})};k.states=ke;k.options=Pe;k.className=y;k.defaultOptions=G;var U="splitter",oe=U;import{jsx as Ie,jsxs as Te}from"react/jsx-runtime";import{createElement as ze}from"react";var j="k-splitter",Ce={},ne={orientation:"horizontal"},u=t=>{let{orientation:e=ne.orientation,children:s,panes:o,...a}=t,l=[];return o&&o.forEach((p,n)=>{let c=o[n+1],m=p.props,x=c?.props;l.push(ze(f,{...m,key:n})),c&&l.push(Ie(k,{draggable:m.resizable!==!1&&x.resizable!==!1,collapsePrev:m.collapsible,collapseNext:x.collapsible,orientation:e,ariaLabel:"Pane separator"},`splitbar-${n}`))}),Te("div",{...a,className:d(t.className,j,{[`${j}-${e}`]:e},"k-splitter-flex"),children:[l,s]})};u.options=Ce;u.className=j;u.defaultOptions=ne;u.moduleName=U;u.folderName=oe;u.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."}]};import{jsx as Lt,jsxs as Et}from"react/jsx-runtime";import{jsx as P}from"react/jsx-runtime";import{createElement as $}from"react";var Le=u.options,Ee=u.states,re={...u.defaultOptions,variant:"horizontal",firstPaneProps:!0,secondPaneProps:!0},Ae=[{name:"horizontal",title:"Horizontal"},{name:"vertical",title:"Vertical"}],Me=[{name:"firstPaneProps",title:"Collapsible Left"},{name:"secondPaneProps",title:"Collapsible Right"}],N=t=>{let{variant:e,modifiers:s,...o}={...re,...t},a=c=>({collapsible:c,content:c?"Resizable and collapsible":"Resizable only"}),l=a(!0),p=a(!0),n={display:"flex",justifyContent:"center",alignItems:"center"};return Object.keys(s||{}).forEach(c=>{let m=s?.[c];switch(c){case"secondPaneProps":p=a(!!m);break;case"firstPaneProps":l=a(!!m);break;default:break}}),e==="vertical"?P(u,{style:{height:"238px"},...o,orientation:"vertical",panes:[$(f,{...l,flexBasis:"50%",style:n,key:"pane-1"},P("p",{children:l.content})),$(f,{...p,flexBasis:"50%",style:n,key:"pane-2"},P("p",{children:p.content}))]}):P(u,{style:{height:"238px"},...o,orientation:"horizontal",panes:[$(f,{...l,flexBasis:"50%",style:n,key:"pane-1"},P("p",{children:l.content})),$(f,{...p,flexBasis:"50%",style:n,key:"pane-2"},P("p",{children:p.content}))]})};N.options=Le;N.states=Ee;N.variants=Ae;N.defaultOptions=re;N.modifiers=Me;N.className=u.className;import{jsx as g,jsxs as Oe}from"react/jsx-runtime";var jt=t=>g(u,{panes:[g(f,{flexBasis:"20%",collapsible:!0,children:g("p",{children:"Collapsible pane - 20%"})},"pane-1"),Oe(f,{children:[g("p",{children:"Content"}),g("p",{children:"Content"}),g("p",{children:"Content"})]},"pane-2"),g(f,{flexBasis:"30%",collapsible:!0,children:g("p",{children:"Collapsible pane - 30%"})},"pane-3")],...t});export{jt as SplitterNormal};