UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 8.8 kB
var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...e):typeof e=="object"?Object.keys(e).map((r,s)=>e[s]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var y=(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:r,invalid:s,hover:a,focus:c,checked:u,active:l,selected:h,disabled:g,indeterminate:p,loading:w,empty:b,readonly:A,highlighted:$,...T}=e;return d({"k-valid":r,"k-invalid":s,"k-hover":a,"k-focus":c,"k-checked":u,"k-active":l,"k-selected":h,"k-disabled":g,"k-indeterminate":p&&!u,"k-loading":w,"k-empty":b,"k-readonly":A,"k-highlighted":$},Object.keys(T).reduce((m,v)=>(v.startsWith("k-")?m[v]=T[v]:m[`k-${v}`]=T[v],m),{}))};function j(t,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(s=>[`k-${s}`,!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"},C={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"},k={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 be,jsx as J}from"react/jsx-runtime";var K="k-font-icon",xe=[],ge={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]},he={},I=t=>{let{size:e,themeColor:r,icon:s,rotate:a,flip:c,...u}=t;return s?J("span",{...u,className:d(t.className,K,y(K,{size:e}),{[`k-i-${s}`]:s,[`k-color-${r}`]:r,[`k-rotate-${a}`]:a,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):J(be,{})};I.states=xe;I.options=ge;I.className=K;I.defaultOptions=he;var Q=I;import{Fragment as Ne,jsx as L}from"react/jsx-runtime";var H="k-svg-icon",ve=[],ye={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]},P={viewBox:"0 0 24 24",variant:f.outline},S=t=>{let{size:e,themeColor:r,rotate:s,flip:a,viewBox:c=P.viewBox,variant:u=P.variant,icon:l,...h}=t;if(!l)return L(Ne,{});if(l==="none")return L("span",{...h,className:d(t.className,H,y("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let g=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:d(t.className,H,y("k-icon",{size:e}),{[`k-svg-i-${g}`]:g,[`k-color-${r}`]:r,[`k-rotate-${s}`]:s,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="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:c,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:l?void 0:t.children})})};S.states=ve;S.options=ye;S.className=H;S.defaultOptions=P;var D=S;import*as U from"@progress/kendo-svg-icons";var X="icon",Y="icons";import{useContext as ke}from"react";import{createContext as Ce}from"react";var Z=Ce({iconsType:"svg"});import{Fragment as ee,jsx as z}from"react/jsx-runtime";var _="k-icon",Te=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Be=[],Oe={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]},R={viewBox:"0 0 24 24",type:"svg",variant:f.outline},x=t=>{let{iconsType:e}=ke(Z),{size:r,themeColor:s,icon:a,type:c=e||R.type,rotate:u,flip:l,viewBox:h=R.viewBox,variant:g=R.variant,...p}=t;if(!a)return z(ee,{});if((e||c)==="svg"){if(a==="none")return z(D,{...p,className:d(t.className,_),icon:a,size:r,variant:g});let b=U[a]?a:Te(`${a}-icon`);return U[b]?z(D,{...p,className:d(t.className,_),icon:U[b],size:r,themeColor:s,rotate:u,flip:l,viewBox:h,variant:g}):z(ee,{})}return z(Q,{...p,className:d(t.className,_),icon:a,size:r,themeColor:s,rotate:u,flip:l})};x.states=Be;x.options=Oe;x.defaultOptions=R;x.className=_;x.moduleName=X;x.folderName=Y;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 V="button",te=V;import{Fragment as oe,jsx as B,jsxs as ne}from"react/jsx-runtime";var M="k-button",Ie=["icon-button"],Se=[k.hover,k.focus,k.active,k.selected,k.disabled,k.generating],ze={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:[C.undefined,C.solid,C.flat,C.outline,C.clear,C.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},G={showArrow:!1,arrowIconName:"chevron-down"},i=t=>{let{as:e="button",size:r,rounded:s,fillMode:a,themeColor:c,showArrow:u=G.showArrow,arrowIconName:l=G.arrowIconName,variant:h,hover:g,focus:p,active:w,selected:b,disabled:A,togglable:$,ariaDisabled:T,icon:m,iconSize:v,text:E,iconClassName:ce,className:ue,...me}=t,pe=m!=null,fe=t.children!==void 0;return ne(e,{className:d(ue,M,j(M,h),y(M,{size:r,rounded:s,fillMode:a,themeColor:c}),W(M,{hover:g,focus:p,active:w,disabled:A||T,selected:b}),{"k-icon-button":!E&&!fe&&pe}),"aria-pressed":$?b?"true":"false":void 0,...me,"aria-disabled":T?"true":void 0,disabled:A||void 0,children:[typeof m=="string"&&m&&B(x,{className:d(ce,"k-button-icon"),icon:m,size:v}),m&&typeof m!="string"&&B(oe,{children:m}),E?ne(oe,{children:[E&&B("span",{className:"k-button-text",children:E}),t.children]}):t.children&&B("span",{className:"k-button-text",children:t.children}),u&&B("span",{className:"k-menu-button-arrow k-button-arrow",children:B(x,{icon:l})})]})};i.states=Se;i.options=ze;i.variants=Ie;i.className=M;i.defaultOptions=G;i.moduleName=V;i.folderName=te;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 Me}from"react/jsx-runtime";var re=t=>Me(i,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as we}from"react/jsx-runtime";var ie=t=>we(i,{icon:"folder",children:"Button",...t});import{jsx as Ae}from"react/jsx-runtime";var se=t=>Ae(i,{children:"Button",...t});import{jsx as q}from"react/jsx-runtime";var Ee=i.options,Le=i.states,_e={...i.defaultOptions,variant:"text"},Re=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Fe=[],O=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return q(re,{...r,icon:"star"});case"icon-and-text":return q(ie,{...r,icon:"star",children:"Button"});default:return q(se,{...r,children:"Button"})}};O.options=Ee;O.states=Le;O.variants=Re;O.defaultOptions=_e;O.modifiers=Fe;O.className=i.className;import{jsx as ae}from"react/jsx-runtime";var le="k-calendar-footer",$e={size:[n.undefined,n.small,n.medium,n.large]},de={calendarFooterText:"Tuesday, October 12, 2021"},F=t=>{let{size:e,calendarFooterText:r=de.calendarFooterText,...s}=t;return ae("div",{...s,className:d(t.className,le),children:ae(i,{size:e,fillMode:"flat",themeColor:"primary",className:"k-calendar-nav-today",children:r})})};F.options=$e;F.className=le;F.defaultOptions=de;var qt=F;export{F as CalendarFooter,qt as default};