UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 17.9 kB
var pe=Object.create;var at=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var xe=(t,e)=>{for(var o in e)at(t,o,{get:e[o],enumerable:!0})},Tt=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of fe(e))!he.call(t,s)&&s!==o&&at(t,s,{get:()=>e[s],enumerable:!(n=ue(e,s))||n.enumerable});return t};var Ne=(t,e,o)=>(o=t!=null?pe(Ce(t)):{},Tt(e||!t||!t.__esModule?at(o,"default",{value:t,enumerable:!0}):o,t)),be=t=>Tt(at({},"__esModule",{value:!0}),t);var fo={};xe(fo,{CardDemo:()=>_,default:()=>uo});module.exports=be(fo);var r=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?r(...e):typeof e=="object"?Object.keys(e).map((o,n)=>e[n]||e[o]&&o||null).filter(o=>o!==null).join(" "):e).filter(e=>!!e).join(" ");var w=(t,e)=>r({[`${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"}),M=(t,e)=>{let{valid:o,invalid:n,hover:s,focus:m,checked:p,active:d,selected:B,disabled:E,indeterminate:k,loading:H,empty:y,readonly:ot,highlighted:ct,...W}=e;return r({"k-valid":o,"k-invalid":n,"k-hover":s,"k-focus":m,"k-checked":p,"k-active":d,"k-selected":B,"k-disabled":E,"k-indeterminate":k&&!p,"k-loading":H,"k-empty":y,"k-readonly":ot,"k-highlighted":ct},Object.keys(W).reduce((N,I)=>(I.startsWith("k-")?N[I]=W[I]:N[`k-${I}`]=W[I],N),{}))};function Lt(t,e){if(!e)return{};let o=Array.isArray(e)?e:[e];return Object.fromEntries(o.map(n=>[`k-${n}`,!0]))}var l={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},z={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},P={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},g={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"},u={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"},St={calloutMap:{top:"n",bottom:"s",left:"w",right:"e"},orientationMap:{vertical:"vstack",horizontal:"hstack"}};var Ot=require("react/jsx-runtime"),ve="k-card-callout",Et=t=>{let{callout:e,...o}=t;return(0,Ot.jsx)("span",{...o,className:r(t.className,ve,{[`k-callout-${St.calloutMap[e]||e}`]:e})})};var h="card",b=h;var F=require("react/jsx-runtime"),mt="k-card",Ae=[u.hover,u.focus,u.selected,u.disabled],ke={},ye={},f=t=>{let{orientation:e,callout:o,hover:n,focus:s,selected:m,disabled:p,...d}=t;return(0,F.jsxs)("div",{...d,className:r(t.className,mt,M(mt,{hover:n,focus:s,disabled:p,selected:m}),{[`k-card-${e}`]:e,"k-card-with-callout":o}),children:[o&&o!=="true"&&(0,F.jsx)(Et,{callout:o}),(0,F.jsx)(F.Fragment,{children:t.children})]})};f.states=Ae;f.options=ke;f.className=mt;f.defaultOptions=ye;f.moduleName=h;f.folderName=b;f.ariaSpec={selector:".k-card",rules:[{selector:".k-card-list .k-card",attribute:"role=listitem",usage:"When the card is located in a list, it should have the listitem role."},{selector:".k-card-list .k-card",attribute:"tabindex=0",usage:"The card component is focusable when navigatable."},{selector:".k-card-list .k-card",attribute:"aria-describedby=.k-card-title id",usage:"Associate the card to the title element."},{selector:".k-card-list .k-card",attribute:"aria-keyshortcuts=Enter",usage:"Announces the bound Enter key that enables navigation inside the card."}]};var Y=require("react/jsx-runtime"),pt="k-font-icon",Me=[],ge={size:[l.undefined,l.xsmall,l.small,l.medium,l.large,l.xlarge,l.xxlarge,l.xxxlarge],themeColor:[a.undefined,a.base,a.primary,a.secondary,a.tertiary,a.success,a.warning,a.error,a.info]},Te={},Q=t=>{let{size:e,themeColor:o,icon:n,rotate:s,flip:m,...p}=t;return n?(0,Y.jsx)("span",{...p,className:r(t.className,pt,w(pt,{size:e}),{[`k-i-${n}`]:n,[`k-color-${o}`]:o,[`k-rotate-${s}`]:s,"k-flip-h":m==="h"||m==="both","k-flip-v":m==="v"||m==="both"}),"aria-hidden":"true"}):(0,Y.jsx)(Y.Fragment,{})};Q.states=Me;Q.options=ge;Q.className=pt;Q.defaultOptions=Te;var Bt=Q;var U=require("react/jsx-runtime"),ut="k-svg-icon",Le=[],Se={size:[l.undefined,l.xsmall,l.small,l.medium,l.large,l.xlarge,l.xxlarge,l.xxxlarge],themeColor:[a.undefined,a.base,a.primary,a.secondary,a.tertiary,a.success,a.warning,a.error,a.info],variant:[g.outline,g.solid,g.duotone]},ft={viewBox:"0 0 24 24",variant:g.outline},Z=t=>{var H,y;let{size:e,themeColor:o,rotate:n,flip:s,viewBox:m=ft.viewBox,variant:p=ft.variant,icon:d,...B}=t;if(!d)return(0,U.jsx)(U.Fragment,{});if(d==="none")return(0,U.jsx)("span",{...B,className:r(t.className,ut,w("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let E=typeof d=="object"&&d.name&&d.name,k=typeof d=="object"?p&&((H=d.variants)==null?void 0:H[p])||((y=d.variants)==null?void 0:y.outline)||d.content:void 0;return(0,U.jsx)("span",{...B,className:r(t.className,ut,w("k-icon",{size:e}),{[`k-svg-i-${E}`]:E,[`k-color-${o}`]:o,[`k-rotate-${n}`]:n,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:(0,U.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof d=="object"?d.viewBox:m,dangerouslySetInnerHTML:k!==void 0?{__html:k}:void 0,children:d?void 0:t.children})})};Z.states=Le;Z.options=Se;Z.className=ut;Z.defaultOptions=ft;var Ct=Z;var ht=Ne(require("@progress/kendo-svg-icons"));var Dt="icon",Kt="icons";var Ht=require("react");var Rt=require("react"),_t=(0,Rt.createContext)({iconsType:"svg"});var O=require("react/jsx-runtime"),nt="k-icon",Ee=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Oe=[],Be={size:[l.undefined,l.xsmall,l.small,l.medium,l.large,l.xlarge,l.xxlarge,l.xxxlarge],themeColor:[a.undefined,a.base,a.primary,a.secondary,a.tertiary,a.success,a.warning,a.error,a.info],variant:[g.outline,g.solid,g.duotone]},st={viewBox:"0 0 24 24",type:"svg",variant:g.outline},T=t=>{let{iconsType:e}=(0,Ht.useContext)(_t),{size:o,themeColor:n,icon:s,type:m=e||st.type,rotate:p,flip:d,viewBox:B=st.viewBox,variant:E=st.variant,...k}=t;if(!s)return(0,O.jsx)(O.Fragment,{});if((e||m)==="svg"){if(s==="none")return(0,O.jsx)(Ct,{...k,className:r(t.className,nt),icon:s,size:o,variant:E});let y=ht[s]?s:Ee(`${s}-icon`);return ht[y]?(0,O.jsx)(Ct,{...k,className:r(t.className,nt),icon:ht[y],size:o,themeColor:n,rotate:p,flip:d,viewBox:B,variant:E}):(0,O.jsx)(O.Fragment,{})}return(0,O.jsx)(Bt,{...k,className:r(t.className,nt),icon:s,size:o,themeColor:n,rotate:p,flip:d})};T.states=Oe;T.options=Be;T.defaultOptions=st;T.className=nt;T.moduleName=Dt;T.folderName=Kt;T.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 xt="button",It=xt;var x=require("react/jsx-runtime"),j="k-button",De=["icon-button"],Ke=[u.hover,u.focus,u.active,u.selected,u.disabled,u.generating],Re={size:[l.undefined,l.xsmall,l.small,l.medium,l.large],rounded:[z.undefined,z.none,z.small,z.medium,z.large,z.full],fillMode:[P.undefined,P.solid,P.flat,P.outline,P.clear,P.link],themeColor:[a.undefined,a.base,a.primary,a.secondary,a.tertiary,a.success,a.warning,a.error,a.info,a.inverse]},Nt={showArrow:!1,arrowIconName:"chevron-down"},i=t=>{let{as:e="button",size:o,rounded:n,fillMode:s,themeColor:m,showArrow:p=Nt.showArrow,arrowIconName:d=Nt.arrowIconName,variant:B,hover:E,focus:k,active:H,selected:y,disabled:ot,togglable:ct,ariaDisabled:W,icon:N,iconSize:I,text:rt,iconClassName:ie,className:le,...de}=t,ce=N!=null,me=t.children!==void 0;return(0,x.jsxs)(e,{className:r(le,j,Lt(j,B),w(j,{size:o,rounded:n,fillMode:s,themeColor:m}),M(j,{hover:E,focus:k,active:H,disabled:ot||W,selected:y}),{"k-icon-button":!rt&&!me&&ce}),"aria-pressed":ct?y?"true":"false":void 0,...de,"aria-disabled":W?"true":void 0,disabled:ot||void 0,children:[typeof N=="string"&&N&&(0,x.jsx)(T,{className:r(ie,"k-button-icon"),icon:N,size:I}),N&&typeof N!="string"&&(0,x.jsx)(x.Fragment,{children:N}),rt?(0,x.jsxs)(x.Fragment,{children:[rt&&(0,x.jsx)("span",{className:"k-button-text",children:rt}),t.children]}):t.children&&(0,x.jsx)("span",{className:"k-button-text",children:t.children}),p&&(0,x.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,x.jsx)(T,{icon:d})})]})};i.states=Ke;i.options=Re;i.variants=De;i.className=j;i.defaultOptions=Nt;i.moduleName=xt;i.folderName=It;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."}]};var zt=require("react/jsx-runtime"),wt=t=>(0,zt.jsx)(i,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});var Ft=require("react/jsx-runtime"),Pt=t=>(0,Ft.jsx)(i,{icon:"folder",children:"Button",...t});var $t=require("react/jsx-runtime"),Ut=t=>(0,$t.jsx)(i,{children:"Button",...t});var it=require("react/jsx-runtime"),_e=i.options,He=i.states,Ie={...i.defaultOptions,variant:"text"},we=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],ze=[],G=t=>{let{variant:e,...o}=t;switch(e){case"icon-only":return(0,it.jsx)(wt,{...o,icon:"star"});case"icon-and-text":return(0,it.jsx)(Pt,{...o,icon:"star",children:"Button"});default:return(0,it.jsx)(Ut,{...o,children:"Button"})}};G.options=_e;G.states=He;G.variants=we;G.defaultOptions=Ie;G.modifiers=ze;G.className=i.className;var Wt=require("react/jsx-runtime"),Pe="k-card-subtitle",lt=t=>{let{...e}=t;return(0,Wt.jsx)("div",{...e,className:r(t.className,Pe),children:t.children})};var Gt=require("react/jsx-runtime"),bt="k-card-title",Fe=[u.hover,u.focus],$=t=>{let{hover:e,focus:o,...n}=t;return(0,Gt.jsx)("div",{...n,className:r(t.className,bt,M(bt,{hover:e,focus:o})),children:t.children})};$.states=Fe;$.className=bt;var L=require("react/jsx-runtime"),Ue="k-card-body",D=t=>{let{title:e,subtitle:o,details:n,...s}=t;return(0,L.jsxs)("div",{...s,className:r(t.className,Ue),children:[e&&(0,L.jsx)($,{children:e}),o&&(0,L.jsx)(lt,{children:o}),(0,L.jsx)(L.Fragment,{children:t.children}),n&&(0,L.jsx)("span",{className:"k-card-header-actions",children:(0,L.jsx)(i,{className:"k-card-details",icon:"more-vertical",fillMode:"flat","aria-label":"Card details"})})]})};var Vt=require("react/jsx-runtime"),$e="k-card-footer",vt=t=>{let{...e}=t;return(0,Vt.jsx)("div",{...e,className:r(t.className,$e),children:t.children})};var S=require("react/jsx-runtime"),We="k-card-header",tt=t=>{let{title:e,subtitle:o,details:n,...s}=t;return(0,S.jsxs)("div",{...s,className:r(t.className,We),children:[e&&(0,S.jsx)($,{children:e}),o&&(0,S.jsx)(lt,{children:o}),(0,S.jsx)(S.Fragment,{children:t.children}),n&&(0,S.jsx)("span",{className:"k-card-header-actions",children:(0,S.jsx)(i,{className:"k-card-details",icon:"more-vertical",fillMode:"flat","aria-label":"Card details"})})]})};var K=require("react/jsx-runtime"),qt="k-card-media",At=t=>{let{src:e,...o}=t;return(0,K.jsx)(K.Fragment,{children:e?(0,K.jsx)("img",{...o,className:r(t.className,qt),src:e}):(0,K.jsx)("span",{...o,className:r(t.className,qt),children:(0,K.jsx)(K.Fragment,{children:t.children})})})};var et=require("react/jsx-runtime"),kt="k-card-list",Ge=[],Ve={},qe={},R=t=>{let{...e}=t;return(0,et.jsx)("div",{...e,className:r(t.className,kt,M(kt,{})),role:"list",children:(0,et.jsx)(et.Fragment,{children:t.children})})};R.states=Ge;R.options=Ve;R.className=kt;R.defaultOptions=qe;R.moduleName=h;R.folderName=b;R.ariaSpec={selector:".k-card-list",rules:[{selector:".k-card-list",attribute:"role=list",usage:"The card list container announces its list role."},{selector:".k-card-list .k-card",attribute:"role=listitem",usage:"Each card in the list has the listitem role."},{selector:".k-card-list .k-card",attribute:"tabindex=0",usage:"The card is focusable when navigatable."},{selector:".k-card-list .k-card",attribute:"aria-describedby=.k-card-title id",usage:"Associate the card to its title element."},{selector:".k-card-list .k-card",attribute:"aria-keyshortcuts=Enter",usage:"Announces the Enter key for navigation inside the card."}]};var Xt=require("react/jsx-runtime"),Jt="k-card-group",Je=[],Xe={},Ye={},V=t=>{let{...e}=t;return(0,Xt.jsx)("div",{...e,className:r(t.className,Jt),children:t.children})};V.states=Je;V.options=Xe;V.className=Jt;V.defaultOptions=Ye;V.moduleName=h;V.folderName=b;var Yt=require("react/jsx-runtime"),yt="k-card-wrap",Qe=[u.focus,u.selected],Ze={},je={},q=t=>{let{focus:e,selected:o,...n}=t;return(0,Yt.jsx)("div",{...n,className:r(t.className,yt,M(yt,{focus:e,selected:o})),children:t.children})};q.states=Qe;q.options=Ze;q.className=yt;q.defaultOptions=je;q.moduleName=h;q.folderName=b;var Zt=require("react/jsx-runtime"),Qt="k-card-deck",to=[],eo={},oo={},J=t=>{let{...e}=t;return(0,Zt.jsx)("div",{...e,className:r(t.className,Qt),children:t.children})};J.states=to;J.options=eo;J.className=Qt;J.defaultOptions=oo;J.moduleName=h;J.folderName=b;var te=require("react/jsx-runtime"),jt="k-card-deck-scrollwrap",ro=[],ao={},no={},X=t=>{let{...e}=t;return(0,te.jsx)("div",{...e,className:r(t.className,jt),children:t.children})};X.states=ro;X.options=ao;X.className=jt;X.defaultOptions=no;X.moduleName=h;X.folderName=b;var Mt="action-buttons",ee=Mt;var oe=require("react/jsx-runtime"),dt="k-actions",so=[],io={},gt={alignment:"start",orientation:"horizontal"},C=t=>{let{alignment:e=gt.alignment,orientation:o=gt.orientation,...n}=t;return(0,oe.jsx)("div",{...n,className:r(dt,{[`${dt}-${e}`]:e,[`${dt}-${o}`]:o},t.className),children:t.children})};C.states=so;C.options=io;C.className=dt;C.defaultOptions=gt;C.moduleName=Mt;C.folderName=ee;var A=require("react/jsx-runtime"),re=t=>(0,A.jsx)(f,{orientation:"horizontal",children:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(D,{title:"Card Title",children:(0,A.jsx)("p",{children:"Some quick example text to build on the card title and make up the bulk of the card's content."})}),(0,A.jsxs)(C,{orientation:"vertical",className:"k-card-actions",children:[(0,A.jsx)(i,{fillMode:"flat",themeColor:"primary",children:"Action 1"}),(0,A.jsx)(i,{fillMode:"flat",themeColor:"primary",children:"Action 2"})]})]}),...t});var ae=require("react/jsx-runtime");var v=require("react/jsx-runtime"),ne=t=>(0,v.jsx)(f,{orientation:"vertical",children:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(tt,{children:"Card Header"}),(0,v.jsx)(D,{children:(0,v.jsx)("p",{children:"Some quick example text to build on the card title and make up the bulk of the card's content."})}),(0,v.jsxs)(C,{className:"k-card-actions",children:[(0,v.jsx)(i,{fillMode:"flat",themeColor:"primary",children:"Action 1"}),(0,v.jsx)(i,{fillMode:"flat",themeColor:"primary",children:"Action 2"})]})]}),...t});var c=require("react/jsx-runtime"),lo=f.options,co=f.states,se={...f.defaultOptions,variant:"vertical"},mo=[{name:"vertical",title:"Vertical"},{name:"horizontal",title:"Horizontal"}],po=[{name:"media",title:"Card with Media"},{name:"header",title:"Card with Header"},{name:"footer",title:"Card with Footer"}],_=t=>{let{variant:e,modifiers:o,...n}={...se,...t},s=!1,m=!1,p=!1;return Object.keys(o||{}).forEach(d=>{switch(d){case"media":{s=!!(o!=null&&o[d]);break}case"header":{m=!!(o!=null&&o[d]);break}case"footer":{p=!!(o!=null&&o[d]);break}}}),e==="horizontal"?(0,c.jsxs)(re,{style:{maxWidth:"420px"},...n,children:[s&&(0,c.jsx)(At,{src:"https://demos.telerik.com/kendo-ui/content/web/cards/rome.jpg"}),(0,c.jsxs)("div",{children:[m&&(0,c.jsx)(tt,{title:"Header Title",subtitle:"Header Subtitle"}),(0,c.jsx)(D,{title:"Title",subtitle:"Subtitle",children:(0,c.jsx)("p",{children:"Some quick example text to build on the card title and make up the bulk of the card's content."})}),p&&(0,c.jsx)(vt,{children:"Card Footer"})]}),(m||p)&&(0,c.jsx)("span",{className:"k-separator k-separator-vertical"}),(0,c.jsxs)(C,{orientation:"vertical",alignment:"stretched",className:"k-card-actions",children:[(0,c.jsx)(i,{fillMode:"flat",themeColor:"primary",children:"Button"}),(0,c.jsx)(i,{fillMode:"flat",themeColor:"primary",children:"Button"})]})]}):(0,c.jsxs)(ne,{style:{maxHeight:"450px",width:"300px"},...n,children:[m&&(0,c.jsx)(tt,{title:"Header Title",subtitle:"Header Subtitle"}),s&&(0,c.jsx)(At,{src:"https://demos.telerik.com/kendo-ui/content/web/cards/rome.jpg"}),(0,c.jsx)(D,{title:"Title",subtitle:"Subtitle",children:(0,c.jsx)("p",{children:"Some quick example text to build on the card title and make up the bulk of the card's content."})}),p&&(0,c.jsx)(vt,{children:"Card Footer"}),(0,c.jsxs)(C,{className:"k-card-actions",children:[(0,c.jsx)(i,{fillMode:"flat",themeColor:"primary",children:"Button"}),(0,c.jsx)(i,{fillMode:"flat",themeColor:"primary",children:"Button"})]})]})};_.options=lo;_.states=co;_.variants=mo;_.defaultOptions=se;_.modifiers=po;_.className=f.className;var uo=_;