UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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