@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 9.19 kB
JavaScript
var i=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?i(...e):typeof e=="object"?Object.keys(e).map((r,a)=>e[a]||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:a,hover:s,focus:c,checked:u,active:d,selected:b,disabled:g,indeterminate:p,loading:E,empty:v,readonly:z,highlighted:D,...T}=e;return i({"k-valid":r,"k-invalid":a,"k-hover":s,"k-focus":c,"k-checked":u,"k-active":d,"k-selected":b,"k-disabled":g,"k-indeterminate":p&&!u,"k-loading":E,"k-empty":v,"k-readonly":z,"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(a=>[`k-${a}`,!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 Y}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:a,rotate:s,flip:c,...u}=t;return a?Y("span",{...u,className:i(t.className,P,N(P,{size:e}),{[`k-i-${a}`]:a,[`k-color-${r}`]:r,[`k-rotate-${s}`]:s,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):Y(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:a,flip:s,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-${a}`]:a,"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 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 H="k-icon",Te=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Se=[],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],variant:[f.outline,f.solid,f.duotone]},K={viewBox:"0 0 24 24",type:"svg",variant:f.outline},h=t=>{let{iconsType:e}=ke(te),{size:r,themeColor:a,icon:s,type:c=e||K.type,rotate:u,flip:d,viewBox:b=K.viewBox,variant:g=K.variant,...p}=t;if(!s)return A(oe,{});if((e||c)==="svg"){if(s==="none")return A(V,{...p,className:i(t.className,H),icon:s,size:r,variant:g});let v=G[s]?s:Te(`${s}-icon`);return G[v]?A(V,{...p,className:i(t.className,H),icon:G[v],size:r,themeColor:a,rotate:u,flip:d,viewBox:b,variant:g}):A(oe,{})}return A(Z,{...p,className:i(t.className,H),icon:s,size:r,themeColor:a,rotate:u,flip:d})};h.states=Se;h.options=Be;h.defaultOptions=K;h.className=H;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 S,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]},J={showArrow:!1,arrowIconName:"chevron-down"},l=t=>{let{as:e="button",size:r,rounded:a,fillMode:s,themeColor:c,showArrow:u=J.showArrow,arrowIconName:d=J.arrowIconName,variant:b,hover:g,focus:p,active:E,selected:v,disabled:z,togglable:D,ariaDisabled:T,icon:m,iconSize:y,text:L,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:a,fillMode:s,themeColor:c}),_(O,{hover:g,focus:p,active:E,disabled:z||T,selected:v}),{"k-icon-button":!L&&!fe&&pe}),"aria-pressed":D?v?"true":"false":void 0,...me,"aria-disabled":T?"true":void 0,disabled:z||void 0,children:[typeof m=="string"&&m&&S(h,{className:i(ce,"k-button-icon"),icon:m,size:y}),m&&typeof m!="string"&&S(re,{children:m}),L?ie(re,{children:[L&&S("span",{className:"k-button-text",children:L}),t.children]}):t.children&&S("span",{className:"k-button-text",children:t.children}),u&&S("span",{className:"k-menu-button-arrow k-button-arrow",children:S(h,{icon:d})})]})};l.states=Me;l.options=Ae;l.variants=Ie;l.className=O;l.defaultOptions=J;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 ae=t=>Oe(l,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as we}from"react/jsx-runtime";var se=t=>we(l,{icon:"folder",children:"Button",...t});import{jsx as Ee}from"react/jsx-runtime";var le=t=>Ee(l,{children:"Button",...t});import{jsx as X}from"react/jsx-runtime";var ze=l.options,Le=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"}],He=[],B=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return X(ae,{...r,icon:"star"});case"icon-and-text":return X(se,{...r,icon:"star",children:"Button"});default:return X(le,{...r,children:"Button"})}};B.options=ze;B.states=Le;B.variants=Re;B.defaultOptions=_e;B.modifiers=He;B.className=l.className;import{jsx as $e}from"react/jsx-runtime";var Ke="k-card-subtitle",de=t=>{let{...e}=t;return $e("div",{...e,className:i(t.className,Ke),children:t.children})};import{jsx as Pe}from"react/jsx-runtime";var W="k-card-title",De=[x.hover,x.focus],$=t=>{let{hover:e,focus:r,...a}=t;return Pe("div",{...a,className:i(t.className,W,_(W,{hover:e,focus:r})),children:t.children})};$.states=De;$.className=W;import{Fragment as Ue,jsx as w,jsxs as Ve}from"react/jsx-runtime";var Fe="k-card-header",ao=t=>{let{title:e,subtitle:r,details:a,...s}=t;return Ve("div",{...s,className:i(t.className,Fe),children:[e&&w($,{children:e}),r&&w(de,{children:r}),w(Ue,{children:t.children}),a&&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 CARDHEADER_CLASSNAME,ao as CardHeader};