@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 9.29 kB
JavaScript
var c=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?c(...e):typeof e=="object"?Object.keys(e).map((r,a)=>e[a]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var y=(t,e)=>c({[`${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:r,invalid:a,hover:s,focus:d,checked:u,active:l,selected:h,disabled:x,indeterminate:p,loading:E,empty:b,readonly:z,highlighted:P,...O}=e;return c({"k-valid":r,"k-invalid":a,"k-hover":s,"k-focus":d,"k-checked":u,"k-active":l,"k-selected":h,"k-disabled":x,"k-indeterminate":p&&!u,"k-loading":E,"k-empty":b,"k-readonly":z,"k-highlighted":P},Object.keys(O).reduce((m,v)=>(v.startsWith("k-")?m[v]=O[v]:m[`k-${v}`]=O[v],m),{}))};function X(t,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(a=>[`k-${a}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},N={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},k={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},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"},C={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 ye,jsx as Y}from"react/jsx-runtime";var U="k-font-icon",he=[],be={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]},ve={},I=t=>{let{size:e,themeColor:r,icon:a,rotate:s,flip:d,...u}=t;return a?Y("span",{...u,className:c(t.className,U,y(U,{size:e}),{[`k-i-${a}`]:a,[`k-color-${r}`]:r,[`k-rotate-${s}`]:s,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):Y(ye,{})};I.states=he;I.options=be;I.className=U;I.defaultOptions=ve;var Z=I;import{Fragment as Ce,jsx as L}from"react/jsx-runtime";var H="k-svg-icon",Ne=[],ke={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:[f.outline,f.solid,f.duotone]},D={viewBox:"0 0 24 24",variant:f.outline},M=t=>{let{size:e,themeColor:r,rotate:a,flip:s,viewBox:d=D.viewBox,variant:u=D.variant,icon:l,...h}=t;if(!l)return L(Ce,{});if(l==="none")return L("span",{...h,className:c(t.className,H,y("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let x=typeof l=="object"&&l.name&&l.name,p=typeof l=="object"?u&&l.variants?.[u]||l.variants?.outline||l.content:void 0;return L("span",{...h,className:c(t.className,H,y("k-icon",{size:e}),{[`k-svg-i-${x}`]:x,[`k-color-${r}`]:r,[`k-rotate-${a}`]:a,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:L("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof l=="object"?l.viewBox:d,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:l?void 0:t.children})})};M.states=Ne;M.options=ke;M.className=H;M.defaultOptions=D;var F=M;import*as V from"@progress/kendo-svg-icons";var ee="icon",te="icons";import{useContext as Oe}from"react";import{createContext as Se}from"react";var oe=Se({iconsType:"svg"});import{Fragment as ne,jsx as w}from"react/jsx-runtime";var R="k-icon",Te=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Be=[],Ie={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:[f.outline,f.solid,f.duotone]},K={viewBox:"0 0 24 24",type:"svg",variant:f.outline},g=t=>{let{iconsType:e}=Oe(oe),{size:r,themeColor:a,icon:s,type:d=e||K.type,rotate:u,flip:l,viewBox:h=K.viewBox,variant:x=K.variant,...p}=t;if(!s)return w(ne,{});if((e||d)==="svg"){if(s==="none")return w(F,{...p,className:c(t.className,R),icon:s,size:r,variant:x});let b=V[s]?s:Te(`${s}-icon`);return V[b]?w(F,{...p,className:c(t.className,R),icon:V[b],size:r,themeColor:a,rotate:u,flip:l,viewBox:h,variant:x}):w(ne,{})}return w(Z,{...p,className:c(t.className,R),icon:s,size:r,themeColor:a,rotate:u,flip:l})};g.states=Be;g.options=Ie;g.defaultOptions=K;g.className=R;g.moduleName=ee;g.folderName=te;g.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 q="button",re=q;import{Fragment as se,jsx as T,jsxs as ie}from"react/jsx-runtime";var A="k-button",Me=["icon-button"],we=[C.hover,C.focus,C.active,C.selected,C.disabled,C.generating],Ae={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[N.undefined,N.none,N.small,N.medium,N.large,N.full],fillMode:[k.undefined,k.solid,k.flat,k.outline,k.clear,k.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},W={showArrow:!1,arrowIconName:"chevron-down"},i=t=>{let{as:e="button",size:r,rounded:a,fillMode:s,themeColor:d,showArrow:u=W.showArrow,arrowIconName:l=W.arrowIconName,variant:h,hover:x,focus:p,active:E,selected:b,disabled:z,togglable:P,ariaDisabled:O,icon:m,iconSize:v,text:_,iconClassName:me,className:pe,...fe}=t,ge=m!=null,xe=t.children!==void 0;return ie(e,{className:c(pe,A,X(A,h),y(A,{size:r,rounded:a,fillMode:s,themeColor:d}),Q(A,{hover:x,focus:p,active:E,disabled:z||O,selected:b}),{"k-icon-button":!_&&!xe&&ge}),"aria-pressed":P?b?"true":"false":void 0,...fe,"aria-disabled":O?"true":void 0,disabled:z||void 0,children:[typeof m=="string"&&m&&T(g,{className:c(me,"k-button-icon"),icon:m,size:v}),m&&typeof m!="string"&&T(se,{children:m}),_?ie(se,{children:[_&&T("span",{className:"k-button-text",children:_}),t.children]}):t.children&&T("span",{className:"k-button-text",children:t.children}),u&&T("span",{className:"k-menu-button-arrow k-button-arrow",children:T(g,{icon:l})})]})};i.states=we;i.options=Ae;i.variants=Me;i.className=A;i.defaultOptions=W;i.moduleName=q;i.folderName=re;i.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 Ee}from"react/jsx-runtime";var ae=t=>Ee(i,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as ze}from"react/jsx-runtime";var le=t=>ze(i,{icon:"folder",children:"Button",...t});import{jsx as _e}from"react/jsx-runtime";var ce=t=>_e(i,{children:"Button",...t});import{jsx as j}from"react/jsx-runtime";var Le=i.options,Re=i.states,Ke={...i.defaultOptions,variant:"text"},$e=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Ge=[],B=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return j(ae,{...r,icon:"star"});case"icon-and-text":return j(le,{...r,icon:"star",children:"Button"});default:return j(ce,{...r,children:"Button"})}};B.options=Le;B.states=Re;B.variants=$e;B.defaultOptions=Ke;B.modifiers=Ge;B.className=i.className;var J="suggestion",de=J;import{jsx as $,jsxs as He}from"react/jsx-runtime";var G="k-suggestion-group",Pe=[],Ue={},ue={layout:"scrollable",scrollingPosition:"start"},S=t=>{let{layout:e=ue.layout,scrollingPosition:r,...a}=t,s=$("div",{...a,className:c(G,{"k-suggestion-group-scrollable":e=="scrollable",[`${G}-scrollable-start`]:r==="start"||r==="both",[`${G}-scrollable-end`]:r==="end"||r==="both"},t.className),role:"group",children:e==="scrollable"||e==="scrollButtons"?$("div",{className:"k-suggestions-scroll",children:t.children}):t.children});return e=="scrollButtons"?He("div",{className:"k-suggestion-scrollwrap",children:[$(i,{fillMode:"flat",icon:"chevron-left",size:"xsmall","aria-label":"Scroll left"}),s,$(i,{fillMode:"flat",icon:"chevron-right",size:"xsmall","aria-label":"Scroll right"})]}):s};S.states=Pe;S.options=Ue;S.className=G;S.defaultOptions=ue;S.moduleName=J;S.folderName=de;var Yt=S;export{G as SUGGESTIONGROUP_CLASSNAME,S as SuggestionGroup,Yt as default};