UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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