@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 18.2 kB
JavaScript
var a=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?a(...t):typeof t=="object"?Object.keys(t).map((o,i)=>t[i]||t[o]&&o||null).filter(o=>o!==null).join(" "):t).filter(t=>!!t).join(" ");var O=(e,t)=>a({[`${e}-xs`]:t.size==="xsmall",[`${e}-sm`]:t.size==="small",[`${e}-md`]:t.size==="medium",[`${e}-lg`]:t.size==="large",[`${e}-xl`]:t.size==="xlarge",[`${e}-xxl`]:t.size==="xxlarge",[`${e}-xxxl`]:t.size==="xxxlarge"},{[`${e}-${t.fillMode}`]:t.fillMode},{[`${e}-${t.themeColor}`]:t.themeColor},{"k-rounded-sm":t.rounded==="small","k-rounded-md":t.rounded==="medium","k-rounded-lg":t.rounded==="large","k-rounded-full":t.rounded==="full","k-rounded-none":t.rounded==="none"}),R=(e,t)=>{let{valid:o,invalid:i,hover:s,focus:l,checked:m,active:c,selected:v,disabled:h,indeterminate:p,loading:I,empty:M,readonly:w,highlighted:P,...L}=t;return a({"k-valid":o,"k-invalid":i,"k-hover":s,"k-focus":l,"k-checked":m,"k-active":c,"k-selected":v,"k-disabled":h,"k-indeterminate":p&&!m,"k-loading":I,"k-empty":M,"k-readonly":w,"k-highlighted":P},Object.keys(L).reduce((b,g)=>(g.startsWith("k-")?b[g]=L[g]:b[`k-${g}`]=L[g],b),{}))};function ke(e,t){if(!t)return{};let o=Array.isArray(t)?t:[t];return Object.fromEntries(o.map(i=>[`k-${i}`,!0]))}var r={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"},B={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},S={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},n={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},f={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{Fragment as at,jsx as Ae}from"react/jsx-runtime";var re="k-font-icon",ot=[],nt={size:[r.undefined,r.xsmall,r.small,r.medium,r.large,r.xlarge,r.xxlarge,r.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info]},rt={},G=e=>{let{size:t,themeColor:o,icon:i,rotate:s,flip:l,...m}=e;return i?Ae("span",{...m,className:a(e.className,re,O(re,{size:t}),{[`k-i-${i}`]:i,[`k-color-${o}`]:o,[`k-rotate-${s}`]:s,"k-flip-h":l==="h"||l==="both","k-flip-v":l==="v"||l==="both"}),"aria-hidden":"true"}):Ae(at,{})};G.states=ot;G.options=nt;G.className=re;G.defaultOptions=rt;var Ee=G;import{Fragment as lt,jsx as j}from"react/jsx-runtime";var ae="k-svg-icon",st=[],it={size:[r.undefined,r.xsmall,r.small,r.medium,r.large,r.xlarge,r.xxlarge,r.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[S.outline,S.solid,S.duotone]},se={viewBox:"0 0 24 24",variant:S.outline},J=e=>{let{size:t,themeColor:o,rotate:i,flip:s,viewBox:l=se.viewBox,variant:m=se.variant,icon:c,...v}=e;if(!c)return j(lt,{});if(c==="none")return j("span",{...v,className:a(e.className,ae,O("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let h=typeof c=="object"&&c.name&&c.name,p=typeof c=="object"?m&&c.variants?.[m]||c.variants?.outline||c.content:void 0;return j("span",{...v,className:a(e.className,ae,O("k-icon",{size:t}),{[`k-svg-i-${h}`]:h,[`k-color-${o}`]:o,[`k-rotate-${i}`]:i,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:j("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof c=="object"?c.viewBox:l,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:c?void 0:e.children})})};J.states=st;J.options=it;J.className=ae;J.defaultOptions=se;var ie=J;import*as le from"@progress/kendo-svg-icons";var Le="icon",Se="icons";import{useContext as ct}from"react";import{createContext as mt}from"react";var ye=mt({iconsType:"svg"});import{Fragment as Oe,jsx as X}from"react/jsx-runtime";var ee="k-icon",ut=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),pt=[],dt={size:[r.undefined,r.xsmall,r.small,r.medium,r.large,r.xlarge,r.xxlarge,r.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[S.outline,S.solid,S.duotone]},te={viewBox:"0 0 24 24",type:"svg",variant:S.outline},x=e=>{let{iconsType:t}=ct(ye),{size:o,themeColor:i,icon:s,type:l=t||te.type,rotate:m,flip:c,viewBox:v=te.viewBox,variant:h=te.variant,...p}=e;if(!s)return X(Oe,{});if((t||l)==="svg"){if(s==="none")return X(ie,{...p,className:a(e.className,ee),icon:s,size:o,variant:h});let M=le[s]?s:ut(`${s}-icon`);return le[M]?X(ie,{...p,className:a(e.className,ee),icon:le[M],size:o,themeColor:i,rotate:m,flip:c,viewBox:v,variant:h}):X(Oe,{})}return X(Ee,{...p,className:a(e.className,ee),icon:s,size:o,themeColor:i,rotate:m,flip:c})};x.states=pt;x.options=dt;x.defaultOptions=te;x.className=ee;x.moduleName=Le;x.folderName=Se;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."}]};var k="menu",A=k;import{jsx as q,jsxs as Ce}from"react/jsx-runtime";var me="k-menu-item",ft=[f.hover,f.focus,f.active,f.selected,f.disabled],xt={},we={iconPosition:"before"},N=e=>{let{hover:t,focus:o,active:i,selected:s,disabled:l,icon:m,text:c,first:v,last:h,showArrow:p,arrowIconName:I,iconPosition:M=we.iconPosition,dir:w,children:P,expanded:L,...b}=e,g=I;return g||(g=w==="rtl"?"chevron-left":"chevron-right"),Ce("li",{...b,className:a(e.className,me,"k-item",R(me,{focus:o,disabled:l,hover:t,active:i,selected:s}),{"k-first":v,"k-last":h}),role:"menuitem",...p&&{"aria-haspopup":"menu"},...p&&{"aria-expanded":L?"true":"false"},...l&&{"aria-disabled":"true"},...o&&{tabIndex:0},children:[Ce("span",{className:a("k-link k-menu-link"),children:[m&&M==="before"&&q(x,{className:"k-menu-link-icon",icon:m}),q("span",{className:"k-menu-link-text",children:c}),m&&M==="after"&&q(x,{className:"k-menu-link-icon",icon:m}),p&&q("span",{className:"k-menu-expand-arrow","aria-hidden":"true",children:q(x,{icon:g})})]}),P]})};N.states=ft;N.options=xt;N.className=me;N.defaultOptions=we;N.moduleName=k;N.folderName=A;import{jsx as Q,jsxs as Te}from"react/jsx-runtime";var ce="k-menu-item",Mt=[f.hover,f.focus,f.active,f.selected,f.disabled],bt={},ue={dir:"ltr",iconPosition:"before"},E=e=>{let{hover:t,focus:o,active:i,selected:s,disabled:l,icon:m,text:c,first:v,last:h,showArrow:p,arrowIconName:I,iconPosition:M=ue.iconPosition,dir:w=ue.dir,children:P,popup:L,expanded:b,...g}=e,T=I;return T||(T=w==="rtl"?"chevron-left":"chevron-right"),Te("li",{role:"menuitem",...g,className:a(e.className,ce,"k-item",R(ce,{focus:o,disabled:l}),{"k-first":v,"k-last":h}),...p&&{"aria-haspopup":"menu"},...p&&{"aria-expanded":b?"true":"false"},...l&&{"aria-disabled":"true"},...o&&{tabIndex:0},children:[Te("span",{className:a("k-link k-menu-link",R("k-menu-link",{hover:t,active:i,selected:s,disabled:l})),children:[m&&M==="before"&&Q(x,{className:"k-menu-link-icon",icon:m}),Q("span",{className:"k-menu-link-text",children:c}),m&&M==="after"&&Q(x,{className:"k-menu-link-icon",icon:m}),p&&Q("span",{className:"k-menu-expand-arrow","aria-hidden":"true",children:Q(x,{icon:T})})]}),P,L]})};E.states=Mt;E.options=bt;E.className=ce;E.defaultOptions=ue;E.moduleName=k;E.folderName=A;var pe="button",_e=pe;import{Fragment as Pe,jsx as D,jsxs as Re}from"react/jsx-runtime";var Y="k-button",Nt=["icon-button"],ht=[f.hover,f.focus,f.active,f.selected,f.disabled,f.generating],It={size:[r.undefined,r.xsmall,r.small,r.medium,r.large],rounded:[K.undefined,K.none,K.small,K.medium,K.large,K.full],fillMode:[B.undefined,B.solid,B.flat,B.outline,B.clear,B.link],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info,n.inverse]},de={showArrow:!1,arrowIconName:"chevron-down"},u=e=>{let{as:t="button",size:o,rounded:i,fillMode:s,themeColor:l,showArrow:m=de.showArrow,arrowIconName:c=de.arrowIconName,variant:v,hover:h,focus:p,active:I,selected:M,disabled:w,togglable:P,ariaDisabled:L,icon:b,iconSize:g,text:T,iconClassName:Ye,className:Ze,...je}=e,et=b!=null,tt=e.children!==void 0;return Re(t,{className:a(Ze,Y,ke(Y,v),O(Y,{size:o,rounded:i,fillMode:s,themeColor:l}),R(Y,{hover:h,focus:p,active:I,disabled:w||L,selected:M}),{"k-icon-button":!T&&!tt&&et}),"aria-pressed":P?M?"true":"false":void 0,...je,"aria-disabled":L?"true":void 0,disabled:w||void 0,children:[typeof b=="string"&&b&&D(x,{className:a(Ye,"k-button-icon"),icon:b,size:g}),b&&typeof b!="string"&&D(Pe,{children:b}),T?Re(Pe,{children:[T&&D("span",{className:"k-button-text",children:T}),e.children]}):e.children&&D("span",{className:"k-button-text",children:e.children}),m&&D("span",{className:"k-menu-button-arrow k-button-arrow",children:D(x,{icon:c})})]})};u.states=ht;u.options=It;u.variants=Nt;u.className=Y;u.defaultOptions=de;u.moduleName=pe;u.folderName=_e;u.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 vt}from"react/jsx-runtime";var Ke=e=>vt(u,{icon:"folder",...e,"aria-label":e["aria-label"]||"Folder",children:void 0});import{jsx as gt}from"react/jsx-runtime";var Be=e=>gt(u,{icon:"folder",children:"Button",...e});import{jsx as kt}from"react/jsx-runtime";var Ue=e=>kt(u,{children:"Button",...e});import{jsx as fe}from"react/jsx-runtime";var At=u.options,Et=u.states,Lt={...u.defaultOptions,variant:"text"},St=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],yt=[],$=e=>{let{variant:t,...o}=e;switch(t){case"icon-only":return fe(Ke,{...o,icon:"star"});case"icon-and-text":return fe(Be,{...o,icon:"star",children:"Button"});default:return fe(Ue,{...o,children:"Button"})}};$.options=At;$.states=Et;$.variants=St;$.defaultOptions=Lt;$.modifiers=yt;$.className=u.className;import{jsx as Tt}from"react/jsx-runtime";var ze="k-menu-scroll-wrapper",Ot=[],Ct={},wt={},U=e=>{let{className:t,children:o,orientation:i,...s}=e;return Tt("div",{...s,className:a(t,ze,{"k-menu-scroll-wrapper-vertical":i==="vertical"}),children:o})};U.states=Ot;U.options=Ct;U.className=ze;U.defaultOptions=wt;U.moduleName=k;U.folderName=A;var He=U;import{Fragment as xe,jsx as z,jsxs as oe}from"react/jsx-runtime";var Me="k-menu",_t=[],Pt={},ne={orientation:"horizontal",header:!0,scrollButtonsPosition:"around"},d=e=>{let{children:t,orientation:o=ne.orientation,header:i=ne.header,scrollable:s,scrollButtonsPosition:l=ne.scrollButtonsPosition,wrapperStyles:m,dir:c,popup:v,contextMenu:h,...p}=e,I={horizontal:{prev:c!=="rtl"?"left":"right",next:c!=="rtl"?"right":"left"},vertical:{prev:"up",next:"down"}},M=z("ul",{dir:c,...p,className:a(e.className,"k-reset",Me,{[`${Me}-${o}`]:o,"k-header":i}),role:h?"menu":"menubar",...o==="vertical"&&{"aria-orientation":"vertical"},children:t});return oe(xe,{children:[s?oe(He,{orientation:o,style:m,dir:e.dir,children:[l==="start"&&oe(xe,{children:[z(u,{fillMode:"flat",icon:`chevron-${I[o].prev}`,className:"k-menu-scroll-button k-menu-scroll-button-prev",tabIndex:-1,"aria-label":"Scroll previous"}),z(u,{fillMode:"flat",icon:`chevron-${I[o].next}`,className:"k-menu-scroll-button k-menu-scroll-button-next",tabIndex:-1,"aria-label":"Scroll next"})]}),l==="around"&&z(u,{fillMode:"flat",icon:`chevron-${I[o].prev}`,className:"k-menu-scroll-button k-menu-scroll-button-prev",tabIndex:-1,"aria-label":"Scroll previous"}),M,l==="end"&&oe(xe,{children:[z(u,{fillMode:"flat",icon:`chevron-${I[o].prev}`,className:"k-menu-scroll-button k-menu-scroll-button-prev",tabIndex:-1,"aria-label":"Scroll previous"}),z(u,{fillMode:"flat",icon:`chevron-${I[o].next}`,className:"k-menu-scroll-button k-menu-scroll-button-next",tabIndex:-1,"aria-label":"Scroll next"})]}),l==="around"&&z(u,{fillMode:"flat",icon:`chevron-${I[o].next}`,className:"k-menu-scroll-button k-menu-scroll-button-next",tabIndex:-1,"aria-label":"Scroll next"})]}):M,v]})};d.states=_t;d.options=Pt;d.className=Me;d.defaultOptions=ne;d.moduleName=k;d.folderName=A;d.ariaSpec={selector:".k-menu",rules:[{selector:".k-menu:not(.k-context-menu)",attribute:"role=menubar",usage:"Announces the Menu menubar role."},{selector:".k-menu.k-menu-vertical",attribute:"aria-orientation=vertical",usage:"Announces the Menu orientation when vertical."},{selector:".k-menu-item",attribute:"role=menuitem",usage:"Announces the Menu item role."},{selector:".k-menu-item",attribute:"aria-haspopup=menu (when present)",usage:"Indicates a popup menu is associated with the item."},{selector:".k-menu-item",attribute:"aria-expanded=true/false (when present)",usage:"Indicates whether the submenu is expanded."},{selector:".k-menu-item.k-disabled",attribute:"aria-disabled=true",usage:"Informs assistive technologies that a Menu item is disabled."},{selector:".k-menu-expand-arrow",attribute:"aria-hidden=true",usage:"Expand arrow elements are hidden from assistive technologies."},{selector:".k-menu-popup .k-menu-group",attribute:"role=menu",usage:"The role of the nested menu displayed in a popup."},{selector:".k-menu-scroll-button",attribute:"tabindex=-1",usage:"Scroll buttons are removed from the tab sequence."},{selector:".k-menu-scroll-button",attribute:"aria-label",usage:"Scroll buttons have an accessible label."},{selector:".k-menu-item.k-focus",attribute:"tabindex=0",usage:"The focused item has tabindex 0."},{selector:".k-menu-item",attribute:"aria-controls=ul.k-menu-group id (when present)",usage:"Points to the ID of the submenu. Only present when the item controls a submenu element."},{selector:".k-menu-popup .k-menu-group",attribute:"id",usage:"Each nested menu has a deterministic id linked to the parent aria-controls."}]};import{jsx as Rt}from"react/jsx-runtime";var be="k-separator",De={orientation:"horizontal"},F=e=>{let{orientation:t=De.orientation,...o}=e;return Rt("li",{...o,className:a(e.className,"k-item",be,{[`${be}-${t}`]:t}),role:"separator"})};F.className=be;F.defaultOptions=De;F.moduleName=k;F.folderName=A;import{Fragment as Rn,jsx as Kn}from"react/jsx-runtime";import{jsx as zt}from"react/jsx-runtime";var Ne="k-menu-group",Kt=[],Bt={size:[r.undefined,r.small,r.medium,r.large]},Ut={},C=e=>{let{children:t,size:o,...i}=e;return zt("ul",{role:"menu",...i,className:a(e.className,Ne,O(Ne,{size:o})),children:t})};C.states=Kt;C.options=Bt;C.className=Ne;C.defaultOptions=Ut;C.moduleName=k;C.folderName=A;import{Fragment as Ht,jsx as V,jsxs as Dt}from"react/jsx-runtime";var he=e=>V(d,{children:Dt(Ht,{children:[V(N,{first:!0,text:"Item 1"}),V(N,{showArrow:!0,arrowIconName:"chevron-down",text:"Item 2"}),V(N,{showArrow:!0,arrowIconName:"chevron-down",text:"Item 3"}),V(N,{text:"Item 4"}),V(N,{last:!0,text:"Item 5"})]}),...e});var Ie="popup",$e=Ie;import{jsx as Fe}from"react/jsx-runtime";var Ve="k-animation-container",$t=[],Ft={},ve={positionMode:"absolute",shown:!0},_=e=>{let{positionMode:t=ve.positionMode,shown:o=ve.shown,animationStyle:i,offset:s,...l}=e;return Fe("div",{...l,style:{...s,...e.style},className:a(e.className,Ve,{"k-animation-container-shown":o,"k-animation-container-fixed":t==="fixed"}),children:Fe("div",{className:"k-child-animation-container",style:i,children:e.children})})};_.states=$t;_.options=Ft;_.className=Ve;_.defaultOptions=ve;_.moduleName=Ie;_.folderName=$e;var ge="popup",We=ge;import{jsx as Ge}from"react/jsx-runtime";var Je="k-popup",Vt=[],Wt={},Xe={positionMode:"absolute"},y=e=>{let{offset:t,positionMode:o=Xe.positionMode,animationStyle:i,containerClassName:s,containerRole:l,containerAriaLabel:m,...c}=e;return Ge(_,{positionMode:o,offset:t,animationStyle:i,className:s,role:l,"aria-label":m,children:Ge("div",{...c,className:a(e.className,Je),children:e.children})})};y.states=Vt;y.options=Wt;y.className=Je;y.defaultOptions=Xe;y.moduleName=ge;y.folderName=We;y.ariaSpec={selector:".k-popup",rules:[{selector:".k-animation-container",attribute:"role (when appended to body)",usage:'Container gets role="region" when appended to document body. Popup is a building block \u2014 ARIA semantics come from consuming components.'}]};import{Fragment as ur,jsx as mr,jsxs as cr}from"react/jsx-runtime";import{Fragment as Mr,jsx as xr,jsxs as br}from"react/jsx-runtime";import{Fragment as gr,jsx as vr,jsxs as kr}from"react/jsx-runtime";import{Fragment as yr,jsx as Sr,jsxs as Or}from"react/jsx-runtime";import{jsx as H,jsxs as Qt}from"react/jsx-runtime";var Gt={...d.options,scrollable:{type:"boolean"}},Jt=d.states,qe={...d.defaultOptions,variant:"horizontal"},Xt=[{name:"horizontal",title:"Horizontal"},{name:"vertical",title:"Vertical"}],qt=[{name:"opened",title:"Opened"}],W=e=>{let{variant:t,modifiers:o,...i}={...qe,...e},s={},l=t==="vertical"?{left:"200px",top:"30px"}:{left:"90px",top:"auto"};return Object.keys(o||{}).forEach(m=>{m==="opened"&&(s.opened=!!o?.[m],s.popup=o?.[m]?H(y,{className:"k-menu-popup",offset:l,children:Qt(C,{children:[H(E,{text:"Item 1"}),H(E,{text:"Item 2"}),H(F,{}),H(E,{text:"Item 3"})]})}):null)}),t==="vertical"?H(he,{...i,...s,orientation:"vertical",style:{width:"200px"}}):H(he,{...i,...s})};W.options=Gt;W.states=Jt;W.variants=Xt;W.defaultOptions=qe;W.modifiers=qt;W.className=d.className;import{jsx as eo}from"react/jsx-runtime";var Qe="k-spreadsheet-menu",Yt=[],Zt={},jt={},Z=e=>{let{children:t,...o}=e;return eo(d,{...o,className:a(e.className,Qe),children:t})};Z.states=Yt;Z.options=Zt;Z.className=Qe;Z.defaultOptions=jt;var na=Z;export{Qe as SPREADSHEETMENU_CLASSNAME,Z as SpreadsheetMenu,na as default};