UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 14.7 kB
var Re=Object.create;var $=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty;var Ke=(e,t)=>{for(var n in t)$(e,n,{get:t[n],enumerable:!0})},le=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of He(t))!Fe.call(e,r)&&r!==n&&$(e,r,{get:()=>t[r],enumerable:!(i=_e(t,r))||i.enumerable});return e};var Ve=(e,t,n)=>(n=e!=null?Re(De(e)):{},le(t||!e||!e.__esModule?$(n,"default",{value:e,enumerable:!0}):n,e)),Pe=e=>le($({},"__esModule",{value:!0}),e);var ct={};Ke(ct,{Calendar:()=>T,default:()=>dt});module.exports=Pe(ct);var d=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?d(...t):typeof t=="object"?Object.keys(t).map((n,i)=>t[i]||t[n]&&n||null).filter(n=>n!==null).join(" "):t).filter(t=>!!t).join(" ");var y=(e,t)=>d({[`${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"}),de=(e,t)=>{let{valid:n,invalid:i,hover:r,focus:c,checked:u,active:l,selected:h,disabled:m,indeterminate:p,loading:b,empty:x,readonly:V,highlighted:Q,...O}=t;return d({"k-valid":n,"k-invalid":i,"k-hover":r,"k-focus":c,"k-checked":u,"k-active":l,"k-selected":h,"k-disabled":m,"k-indeterminate":p&&!u,"k-loading":b,"k-empty":x,"k-readonly":V,"k-highlighted":Q},Object.keys(O).reduce((g,w)=>(w.startsWith("k-")?g[w]=O[w]:g[`k-${w}`]=O[w],g),{}))};function ce(e,t){if(!t)return{};let n=Array.isArray(t)?t:[t];return Object.fromEntries(n.map(i=>[`k-${i}`,!0]))}var o={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},A={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},z={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},v={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},a={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},M={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 X={};function U(e){return X[e]=(X[e]||0)+1,`k-${e}-${X[e]}`}var me=require("react/jsx-runtime"),ue="k-calendar-view",Y={orientation:"horizontal",calendarView:"month"},G=e=>{let{orientation:t=Y.orientation,calendarView:n=Y.calendarView,gridRole:i,ariaLabelledBy:r,...c}=e;return(0,me.jsx)("div",{...c,className:d(e.className,ue,`k-calendar-${n}view`,"k-align-items-start","k-justify-content-center",{"k-hstack":t==="horizontal","k-vstack":t==="vertical"}),...i?{role:"grid","aria-labelledby":r,tabIndex:0}:{},children:e.children})};G.className=ue;G.defaultOptions=Y;var S=require("react/jsx-runtime"),Z="k-font-icon",$e=[],Ue={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[a.undefined,a.base,a.primary,a.secondary,a.tertiary,a.success,a.warning,a.error,a.info]},Ge={},L=e=>{let{size:t,themeColor:n,icon:i,rotate:r,flip:c,...u}=e;return i?(0,S.jsx)("span",{...u,className:d(e.className,Z,y(Z,{size:t}),{[`k-i-${i}`]:i,[`k-color-${n}`]:n,[`k-rotate-${r}`]:r,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):(0,S.jsx)(S.Fragment,{})};L.states=$e;L.options=Ue;L.className=Z;L.defaultOptions=Ge;var pe=L;var I=require("react/jsx-runtime"),j="k-svg-icon",We=[],qe={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[a.undefined,a.base,a.primary,a.secondary,a.tertiary,a.success,a.warning,a.error,a.info],variant:[v.outline,v.solid,v.duotone]},ee={viewBox:"0 0 24 24",variant:v.outline},R=e=>{var b,x;let{size:t,themeColor:n,rotate:i,flip:r,viewBox:c=ee.viewBox,variant:u=ee.variant,icon:l,...h}=e;if(!l)return(0,I.jsx)(I.Fragment,{});if(l==="none")return(0,I.jsx)("span",{...h,className:d(e.className,j,y("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let m=typeof l=="object"&&l.name&&l.name,p=typeof l=="object"?u&&((b=l.variants)==null?void 0:b[u])||((x=l.variants)==null?void 0:x.outline)||l.content:void 0;return(0,I.jsx)("span",{...h,className:d(e.className,j,y("k-icon",{size:t}),{[`k-svg-i-${m}`]:m,[`k-color-${n}`]:n,[`k-rotate-${i}`]:i,"k-flip-h":r==="h"||r==="both","k-flip-v":r==="v"||r==="both"}),"aria-hidden":"true",children:(0,I.jsx)("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:e.children})})};R.states=We;R.options=qe;R.className=j;R.defaultOptions=ee;var te=R;var oe=Ve(require("@progress/kendo-svg-icons"));var fe="icon",he="icons";var ge=require("react");var be=require("react"),xe=(0,be.createContext)({iconsType:"svg"});var N=require("react/jsx-runtime"),W="k-icon",Je=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),Qe=[],Xe={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[a.undefined,a.base,a.primary,a.secondary,a.tertiary,a.success,a.warning,a.error,a.info],variant:[v.outline,v.solid,v.duotone]},q={viewBox:"0 0 24 24",type:"svg",variant:v.outline},k=e=>{let{iconsType:t}=(0,ge.useContext)(xe),{size:n,themeColor:i,icon:r,type:c=t||q.type,rotate:u,flip:l,viewBox:h=q.viewBox,variant:m=q.variant,...p}=e;if(!r)return(0,N.jsx)(N.Fragment,{});if((t||c)==="svg"){if(r==="none")return(0,N.jsx)(te,{...p,className:d(e.className,W),icon:r,size:n,variant:m});let x=oe[r]?r:Je(`${r}-icon`);return oe[x]?(0,N.jsx)(te,{...p,className:d(e.className,W),icon:oe[x],size:n,themeColor:i,rotate:u,flip:l,viewBox:h,variant:m}):(0,N.jsx)(N.Fragment,{})}return(0,N.jsx)(pe,{...p,className:d(e.className,W),icon:r,size:n,themeColor:i,rotate:u,flip:l})};k.states=Qe;k.options=Xe;k.defaultOptions=q;k.className=W;k.moduleName=fe;k.folderName=he;k.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 ne="button",ve=ne;var f=require("react/jsx-runtime"),_="k-button",Ye=["icon-button"],Ze=[M.hover,M.focus,M.active,M.selected,M.disabled,M.generating],je={size:[o.undefined,o.xsmall,o.small,o.medium,o.large],rounded:[A.undefined,A.none,A.small,A.medium,A.large,A.full],fillMode:[z.undefined,z.solid,z.flat,z.outline,z.clear,z.link],themeColor:[a.undefined,a.base,a.primary,a.secondary,a.tertiary,a.success,a.warning,a.error,a.info,a.inverse]},ae={showArrow:!1,arrowIconName:"chevron-down"},s=e=>{let{as:t="button",size:n,rounded:i,fillMode:r,themeColor:c,showArrow:u=ae.showArrow,arrowIconName:l=ae.arrowIconName,variant:h,hover:m,focus:p,active:b,selected:x,disabled:V,togglable:Q,ariaDisabled:O,icon:g,iconSize:w,text:P,iconClassName:Oe,className:Be,...Ee}=e,Se=g!=null,Le=e.children!==void 0;return(0,f.jsxs)(t,{className:d(Be,_,ce(_,h),y(_,{size:n,rounded:i,fillMode:r,themeColor:c}),de(_,{hover:m,focus:p,active:b,disabled:V||O,selected:x}),{"k-icon-button":!P&&!Le&&Se}),"aria-pressed":Q?x?"true":"false":void 0,...Ee,"aria-disabled":O?"true":void 0,disabled:V||void 0,children:[typeof g=="string"&&g&&(0,f.jsx)(k,{className:d(Oe,"k-button-icon"),icon:g,size:w}),g&&typeof g!="string"&&(0,f.jsx)(f.Fragment,{children:g}),P?(0,f.jsxs)(f.Fragment,{children:[P&&(0,f.jsx)("span",{className:"k-button-text",children:P}),e.children]}):e.children&&(0,f.jsx)("span",{className:"k-button-text",children:e.children}),u&&(0,f.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,f.jsx)(k,{icon:l})})]})};s.states=Ze;s.options=je;s.variants=Ye;s.className=_;s.defaultOptions=ae;s.moduleName=ne;s.folderName=ve;s.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."}]};var ye=require("react/jsx-runtime"),ke=e=>(0,ye.jsx)(s,{icon:"folder",...e,"aria-label":e["aria-label"]||"Folder",children:void 0});var Ce=require("react/jsx-runtime"),Ne=e=>(0,Ce.jsx)(s,{icon:"folder",children:"Button",...e});var we=require("react/jsx-runtime"),Te=e=>(0,we.jsx)(s,{children:"Button",...e});var J=require("react/jsx-runtime"),et=s.options,tt=s.states,ot={...s.defaultOptions,variant:"text"},nt=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],at=[],B=e=>{let{variant:t,...n}=e;switch(t){case"icon-only":return(0,J.jsx)(ke,{...n,icon:"star"});case"icon-and-text":return(0,J.jsx)(Ne,{...n,icon:"star",children:"Button"});default:return(0,J.jsx)(Te,{...n,children:"Button"})}};B.options=et;B.states=tt;B.variants=nt;B.defaultOptions=ot;B.modifiers=at;B.className=s.className;var C=require("react/jsx-runtime"),Ae="k-calendar-header",rt={size:[o.undefined,o.small,o.medium,o.large]},H={calendarTitleText:"October 2021",showToday:!0,showNavigationButtons:!0,orientation:"horizontal"},D=e=>{let{calendarTitleText:t=H.calendarTitleText,showToday:n=H.showToday,showNavigationButtons:i=H.showNavigationButtons,orientation:r=H.orientation,size:c,calendarView:u,dir:l,titleId:h,...m}=e,p=l==="rtl"?"chevron-right":"chevron-left",b=l==="rtl"?"chevron-left":"chevron-right",x=h||U("calendar-title");return(0,C.jsxs)("div",{...m,className:d(e.className,Ae,{"k-vstack":r==="vertical"}),children:[(0,C.jsx)(s,{disabled:u==="century",className:"k-calendar-title",text:t,size:c,fillMode:"flat",themeColor:"primary",id:x,tabIndex:-1,"aria-label":`Navigate to parent view: ${t}`,...u==="century"?{"aria-disabled":"true"}:{}}),(0,C.jsx)("span",{className:"k-spacer"}),(0,C.jsxs)("span",{className:"k-calendar-nav",children:[i&&(0,C.jsx)(s,{className:"k-calendar-nav-prev",icon:p,size:c,fillMode:"flat",tabIndex:-1,"aria-label":"Navigate to previous view"}),n&&(0,C.jsx)(s,{size:c,fillMode:"flat",className:"k-calendar-nav-today",tabIndex:-1,children:"Today"}),i&&(0,C.jsx)(s,{className:"k-calendar-nav-next",icon:b,size:c,fillMode:"flat",tabIndex:-1,"aria-label":"Navigate to next view"})]})]})};D.options=rt;D.className=Ae;D.defaultOptions=H;var re=require("react/jsx-runtime"),ze="k-calendar-footer",it={size:[o.undefined,o.small,o.medium,o.large]},Me={calendarFooterText:"Tuesday, October 12, 2021"},F=e=>{let{size:t,calendarFooterText:n=Me.calendarFooterText,...i}=e;return(0,re.jsx)("div",{...i,className:d(e.className,ze),children:(0,re.jsx)(s,{size:t,fillMode:"flat",themeColor:"primary",className:"k-calendar-nav-today",children:n})})};F.options=it;F.className=ze;F.defaultOptions=Me;var ie="calendar",Ie=ie;var E=require("react/jsx-runtime"),se="k-calendar",st=[],lt={size:[o.undefined,o.small,o.medium,o.large]},K={showCalendarHeader:!0,orientation:"horizontal",calendarView:"month",calendarTitleText:"October 2021"},T=e=>{let{size:t,orientation:n=K.orientation,calendarView:i=K.calendarView,calendarTitleText:r=K.calendarTitleText,showCalendarHeader:c=K.showCalendarHeader,showWeek:u,showCalendarFooter:l,calendarFooterText:h,dir:m,...p}=e,b=U("calendar-title");return(0,E.jsxs)("div",{...p,dir:m,className:d(e.className,se,y(se,{size:t}),{"k-week-number":u}),children:[c&&(0,E.jsx)(D,{calendarView:i,showToday:!l,calendarTitleText:r,orientation:n,size:t,dir:m,titleId:b}),(0,E.jsx)(G,{calendarView:i,orientation:n,gridRole:!0,ariaLabelledBy:b,children:e.children}),l&&(0,E.jsx)(F,{calendarFooterText:h,size:t})]})};T.states=st;T.options=lt;T.className=se;T.defaultOptions=K;T.moduleName=ie;T.folderName=Ie;T.ariaSpec={selector:".k-calendar:not(.k-calendar-infinite):not(.k-calendar-range)",rules:[{selector:".k-calendar:not(.k-calendar-infinite):not(.k-calendar-range) .k-calendar-view",attribute:"role=grid",usage:"Specifies the role of the Calendar view container."},{selector:".k-calendar:not(.k-calendar-infinite):not(.k-calendar-range) .k-calendar-view",attribute:"aria-labelledby",usage:"Pointing to the current view label (e.g. March 2022 or 2020-2029)."},{selector:".k-calendar:not(.k-calendar-infinite):not(.k-calendar-range) .k-calendar-view",attribute:"tabindex=0",usage:"Makes the grid focusable."},{selector:".k-calendar:not(.k-calendar-infinite):not(.k-calendar-range) .k-calendar-table",attribute:"role=none",usage:"Inner table has role removed \u2014 content belongs to the grid on the view."},{selector:".k-calendar-thead",attribute:"role=rowgroup",usage:"Groups header rows."},{selector:".k-calendar-tbody",attribute:"role=rowgroup",usage:"Groups body rows."},{selector:".k-calendar-tr",attribute:"role=row",usage:"Each row in the calendar table."},{selector:".k-calendar-thead .k-calendar-th",attribute:"role=columnheader",usage:"Column header for day names."},{selector:".k-calendar-thead .k-calendar-th",attribute:"scope=col",usage:"Specifies the header applies to a column."},{selector:".k-calendar-thead .k-calendar-th",attribute:"aria-label",usage:"Full name of the day of the week."},{selector:".k-calendar-td:not(.k-alt):not(.k-empty)",attribute:"role=gridcell",usage:"Date cells in the calendar body."},{selector:".k-calendar-td.k-selected",attribute:"aria-selected=true",usage:"Indicates the selected date."},{selector:".k-calendar-td.k-disabled",attribute:"aria-disabled=true",usage:"Indicates a disabled date."},{selector:".k-calendar-nav-next,.k-calendar-nav-prev",attribute:"tabindex=-1",usage:"Navigation buttons are not focusable."},{selector:".k-calendar-nav-next,.k-calendar-nav-prev",attribute:"aria-label",usage:"Describes the navigation button purpose."},{selector:".k-calendar-title",attribute:"tabindex=-1",usage:"Title button is not focusable."},{selector:".k-calendar-title",attribute:"aria-label",usage:"Describes the title button purpose."},{selector:".k-calendar-nav-today",attribute:"tabindex=-1",usage:"Today link/button is not focusable."}]};var dt=T;