UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 9.74 kB
var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...e):typeof e=="object"?Object.keys(e).map((a,l)=>e[l]||e[a]&&a||null).filter(a=>a!==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"}),Q=(t,e)=>{let{valid:a,invalid:l,hover:s,focus:c,checked:u,active:i,selected:x,disabled:f,indeterminate:m,loading:C,empty:v,readonly:L,highlighted:P,...B}=e;return d({"k-valid":a,"k-invalid":l,"k-hover":s,"k-focus":c,"k-checked":u,"k-active":i,"k-selected":x,"k-disabled":f,"k-indeterminate":m&&!u,"k-loading":C,"k-empty":v,"k-readonly":L,"k-highlighted":P},Object.keys(B).reduce((p,b)=>(b.startsWith("k-")?p[b]=B[b]:p[`k-${b}`]=B[b],p),{}))};function X(t,e){if(!e)return{};let a=Array.isArray(e)?e:[e];return Object.fromEntries(a.map(l=>[`k-${l}`,!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"},h={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"},T={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"};var D={};function Y(t){return D[t]=(D[t]||0)+1,`k-${t}-${D[t]}`}import{Fragment as Ne,jsx as Z}from"react/jsx-runtime";var F="k-font-icon",ve=[],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]},ye={},z=t=>{let{size:e,themeColor:a,icon:l,rotate:s,flip:c,...u}=t;return l?Z("span",{...u,className:d(t.className,F,y(F,{size:e}),{[`k-i-${l}`]:l,[`k-color-${a}`]:a,[`k-rotate-${s}`]:s,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):Z(Ne,{})};z.states=ve;z.options=be;z.className=F;z.defaultOptions=ye;var ee=z;import{Fragment as Ce,jsx as R}from"react/jsx-runtime";var V="k-svg-icon",ke=[],Te={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:[h.outline,h.solid,h.duotone]},U={viewBox:"0 0 24 24",variant:h.outline},O=t=>{let{size:e,themeColor:a,rotate:l,flip:s,viewBox:c=U.viewBox,variant:u=U.variant,icon:i,...x}=t;if(!i)return R(Ce,{});if(i==="none")return R("span",{...x,className:d(t.className,V,y("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let f=typeof i=="object"&&i.name&&i.name,m=typeof i=="object"?u&&i.variants?.[u]||i.variants?.outline||i.content:void 0;return R("span",{...x,className:d(t.className,V,y("k-icon",{size:e}),{[`k-svg-i-${f}`]:f,[`k-color-${a}`]:a,[`k-rotate-${l}`]:l,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:R("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof i=="object"?i.viewBox:c,dangerouslySetInnerHTML:m!==void 0?{__html:m}:void 0,children:i?void 0:t.children})})};O.states=ke;O.options=Te;O.className=V;O.defaultOptions=U;var G=O;import*as q from"@progress/kendo-svg-icons";var te="icon",oe="icons";import{useContext as Ie}from"react";import{createContext as Be}from"react";var ne=Be({iconsType:"svg"});import{Fragment as ae,jsx as M}from"react/jsx-runtime";var $="k-icon",we=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),ze=[],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:[h.outline,h.solid,h.duotone]},H={viewBox:"0 0 24 24",type:"svg",variant:h.outline},g=t=>{let{iconsType:e}=Ie(ne),{size:a,themeColor:l,icon:s,type:c=e||H.type,rotate:u,flip:i,viewBox:x=H.viewBox,variant:f=H.variant,...m}=t;if(!s)return M(ae,{});if((e||c)==="svg"){if(s==="none")return M(G,{...m,className:d(t.className,$),icon:s,size:a,variant:f});let v=q[s]?s:we(`${s}-icon`);return q[v]?M(G,{...m,className:d(t.className,$),icon:q[v],size:a,themeColor:l,rotate:u,flip:i,viewBox:x,variant:f}):M(ae,{})}return M(ee,{...m,className:d(t.className,$),icon:s,size:a,themeColor:l,rotate:u,flip:i})};g.states=ze;g.options=Oe;g.defaultOptions=H;g.className=$;g.moduleName=te;g.folderName=oe;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 W="button",re=W;import{Fragment as ie,jsx as I,jsxs as se}from"react/jsx-runtime";var S="k-button",Me=["icon-button"],Se=[T.hover,T.focus,T.active,T.selected,T.disabled,T.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]},j={showArrow:!1,arrowIconName:"chevron-down"},r=t=>{let{as:e="button",size:a,rounded:l,fillMode:s,themeColor:c,showArrow:u=j.showArrow,arrowIconName:i=j.arrowIconName,variant:x,hover:f,focus:m,active:C,selected:v,disabled:L,togglable:P,ariaDisabled:B,icon:p,iconSize:b,text:_,iconClassName:pe,className:fe,...xe}=t,he=p!=null,ge=t.children!==void 0;return se(e,{className:d(fe,S,X(S,x),y(S,{size:a,rounded:l,fillMode:s,themeColor:c}),Q(S,{hover:f,focus:m,active:C,disabled:L||B,selected:v}),{"k-icon-button":!_&&!ge&&he}),"aria-pressed":P?v?"true":"false":void 0,...xe,"aria-disabled":B?"true":void 0,disabled:L||void 0,children:[typeof p=="string"&&p&&I(g,{className:d(pe,"k-button-icon"),icon:p,size:b}),p&&typeof p!="string"&&I(ie,{children:p}),_?se(ie,{children:[_&&I("span",{className:"k-button-text",children:_}),t.children]}):t.children&&I("span",{className:"k-button-text",children:t.children}),u&&I("span",{className:"k-menu-button-arrow k-button-arrow",children:I(g,{icon:i})})]})};r.states=Se;r.options=Ae;r.variants=Me;r.className=S;r.defaultOptions=j;r.moduleName=W;r.folderName=re;r.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 le=t=>Ee(r,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as Le}from"react/jsx-runtime";var de=t=>Le(r,{icon:"folder",children:"Button",...t});import{jsx as _e}from"react/jsx-runtime";var ce=t=>_e(r,{children:"Button",...t});import{jsx as J}from"react/jsx-runtime";var Re=r.options,$e=r.states,He={...r.defaultOptions,variant:"text"},Ke=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Pe=[],w=t=>{let{variant:e,...a}=t;switch(e){case"icon-only":return J(le,{...a,icon:"star"});case"icon-and-text":return J(de,{...a,icon:"star",children:"Button"});default:return J(ce,{...a,children:"Button"})}};w.options=Re;w.states=$e;w.variants=Ke;w.defaultOptions=He;w.modifiers=Pe;w.className=r.className;import{jsx as A,jsxs as ue}from"react/jsx-runtime";var me="k-calendar-header",De={size:[n.undefined,n.small,n.medium,n.large]},E={calendarTitleText:"October 2021",showToday:!0,showNavigationButtons:!0,orientation:"horizontal"},K=t=>{let{calendarTitleText:e=E.calendarTitleText,showToday:a=E.showToday,showNavigationButtons:l=E.showNavigationButtons,orientation:s=E.orientation,size:c,calendarView:u,dir:i,titleId:x,...f}=t,m=i==="rtl"?"chevron-right":"chevron-left",C=i==="rtl"?"chevron-left":"chevron-right",v=x||Y("calendar-title");return ue("div",{...f,className:d(t.className,me,{"k-vstack":s==="vertical"}),children:[A(r,{disabled:u==="century",className:"k-calendar-title",text:e,size:c,fillMode:"flat",themeColor:"primary",id:v,tabIndex:-1,"aria-label":`Navigate to parent view: ${e}`,...u==="century"?{"aria-disabled":"true"}:{}}),A("span",{className:"k-spacer"}),ue("span",{className:"k-calendar-nav",children:[l&&A(r,{className:"k-calendar-nav-prev",icon:m,size:c,fillMode:"flat",tabIndex:-1,"aria-label":"Navigate to previous view"}),a&&A(r,{size:c,fillMode:"flat",className:"k-calendar-nav-today",tabIndex:-1,children:"Today"}),l&&A(r,{className:"k-calendar-nav-next",icon:C,size:c,fillMode:"flat",tabIndex:-1,"aria-label":"Navigate to next view"})]})]})};K.options=De;K.className=me;K.defaultOptions=E;var Qt=K;export{K as CalendarHeader,Qt as default};