@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 8.24 kB
JavaScript
var s=(...o)=>o.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?s(...e):typeof e=="object"?Object.keys(e).map((i,l)=>e[l]||e[i]&&i||null).filter(i=>i!==null).join(" "):e).filter(e=>!!e).join(" ");var N=(o,e)=>s({[`${o}-xs`]:e.size==="xsmall",[`${o}-sm`]:e.size==="small",[`${o}-md`]:e.size==="medium",[`${o}-lg`]:e.size==="large",[`${o}-xl`]:e.size==="xlarge",[`${o}-xxl`]:e.size==="xxlarge",[`${o}-xxxl`]:e.size==="xxxlarge"},{[`${o}-${e.fillMode}`]:e.fillMode},{[`${o}-${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"}),j=(o,e)=>{let{valid:i,invalid:l,hover:r,focus:c,checked:u,active:a,selected:h,disabled:x,indeterminate:f,loading:A,empty:b,readonly:B,highlighted:H,...T}=e;return s({"k-valid":i,"k-invalid":l,"k-hover":r,"k-focus":c,"k-checked":u,"k-active":a,"k-selected":h,"k-disabled":x,"k-indeterminate":f&&!u,"k-loading":A,"k-empty":b,"k-readonly":B,"k-highlighted":H},Object.keys(T).reduce((m,v)=>(v.startsWith("k-")?m[v]=T[v]:m[`k-${v}`]=T[v],m),{}))};function q(o,e){if(!e)return{};let i=Array.isArray(e)?e:[e];return Object.fromEntries(i.map(l=>[`k-${l}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},y={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"},p={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},t={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},C={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 me,jsx as W}from"react/jsx-runtime";var K="k-font-icon",de=[],ce={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info]},ue={},O=o=>{let{size:e,themeColor:i,icon:l,rotate:r,flip:c,...u}=o;return l?W("span",{...u,className:s(o.className,K,N(K,{size:e}),{[`k-i-${l}`]:l,[`k-color-${i}`]:i,[`k-rotate-${r}`]:r,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):W(me,{})};O.states=de;O.options=ce;O.className=K;O.defaultOptions=ue;var J=O;import{Fragment as ge,jsx as _}from"react/jsx-runtime";var P="k-svg-icon",fe=[],pe={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info],variant:[p.outline,p.solid,p.duotone]},F={viewBox:"0 0 24 24",variant:p.outline},w=o=>{let{size:e,themeColor:i,rotate:l,flip:r,viewBox:c=F.viewBox,variant:u=F.variant,icon:a,...h}=o;if(!a)return _(ge,{});if(a==="none")return _("span",{...h,className:s(o.className,P,N("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let x=typeof a=="object"&&a.name&&a.name,f=typeof a=="object"?u&&a.variants?.[u]||a.variants?.outline||a.content:void 0;return _("span",{...h,className:s(o.className,P,N("k-icon",{size:e}),{[`k-svg-i-${x}`]:x,[`k-color-${i}`]:i,[`k-rotate-${l}`]:l,"k-flip-h":r==="h"||r==="both","k-flip-v":r==="v"||r==="both"}),"aria-hidden":"true",children:_("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof a=="object"?a.viewBox:c,dangerouslySetInnerHTML:f!==void 0?{__html:f}:void 0,children:a?void 0:o.children})})};w.states=fe;w.options=pe;w.className=P;w.defaultOptions=F;var U=w;import*as V from"@progress/kendo-svg-icons";var Q="icon",X="icons";import{useContext as he}from"react";import{createContext as xe}from"react";var Y=xe({iconsType:"svg"});import{Fragment as Z,jsx as S}from"react/jsx-runtime";var L="k-icon",be=o=>o.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),ve=[],Ne={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info],variant:[p.outline,p.solid,p.duotone]},R={viewBox:"0 0 24 24",type:"svg",variant:p.outline},g=o=>{let{iconsType:e}=he(Y),{size:i,themeColor:l,icon:r,type:c=e||R.type,rotate:u,flip:a,viewBox:h=R.viewBox,variant:x=R.variant,...f}=o;if(!r)return S(Z,{});if((e||c)==="svg"){if(r==="none")return S(U,{...f,className:s(o.className,L),icon:r,size:i,variant:x});let b=V[r]?r:be(`${r}-icon`);return V[b]?S(U,{...f,className:s(o.className,L),icon:V[b],size:i,themeColor:l,rotate:u,flip:a,viewBox:h,variant:x}):S(Z,{})}return S(J,{...f,className:s(o.className,L),icon:r,size:i,themeColor:l,rotate:u,flip:a})};g.states=ve;g.options=Ne;g.defaultOptions=R;g.className=L;g.moduleName=Q;g.folderName=X;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 D="button",ee=D;import{Fragment as te,jsx as M,jsxs as oe}from"react/jsx-runtime";var I="k-button",ye=["icon-button"],ke=[C.hover,C.focus,C.active,C.selected,C.disabled,C.generating],Ce={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[y.undefined,y.none,y.small,y.medium,y.large,y.full],fillMode:[k.undefined,k.solid,k.flat,k.outline,k.clear,k.link],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info,t.inverse]},G={showArrow:!1,arrowIconName:"chevron-down"},d=o=>{let{as:e="button",size:i,rounded:l,fillMode:r,themeColor:c,showArrow:u=G.showArrow,arrowIconName:a=G.arrowIconName,variant:h,hover:x,focus:f,active:A,selected:b,disabled:B,togglable:H,ariaDisabled:T,icon:m,iconSize:v,text:E,iconClassName:ie,className:re,...ae}=o,se=m!=null,le=o.children!==void 0;return oe(e,{className:s(re,I,q(I,h),N(I,{size:i,rounded:l,fillMode:r,themeColor:c}),j(I,{hover:x,focus:f,active:A,disabled:B||T,selected:b}),{"k-icon-button":!E&&!le&&se}),"aria-pressed":H?b?"true":"false":void 0,...ae,"aria-disabled":T?"true":void 0,disabled:B||void 0,children:[typeof m=="string"&&m&&M(g,{className:s(ie,"k-button-icon"),icon:m,size:v}),m&&typeof m!="string"&&M(te,{children:m}),E?oe(te,{children:[E&&M("span",{className:"k-button-text",children:E}),o.children]}):o.children&&M("span",{className:"k-button-text",children:o.children}),u&&M("span",{className:"k-menu-button-arrow k-button-arrow",children:M(g,{icon:a})})]})};d.states=ke;d.options=Ce;d.variants=ye;d.className=I;d.defaultOptions=G;d.moduleName=D;d.folderName=ee;d.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 $,jsxs as we}from"react/jsx-runtime";var ne="k-navigator",Te=[],Me={},Oe={},z=o=>{let{...e}=o;return we("div",{...e,className:s(o.className,ne),children:[$(d,{className:"k-navigator-n",icon:"chevron-up",fillMode:"flat",rounded:"full",size:null,"aria-label":"Pan north"}),$(d,{className:"k-navigator-e",icon:"chevron-right",fillMode:"flat",rounded:"full",size:null,"aria-label":"Pan east"}),$(d,{className:"k-navigator-s",icon:"chevron-down",fillMode:"flat",rounded:"full",size:null,"aria-label":"Pan south"}),$(d,{className:"k-navigator-w",icon:"chevron-left",fillMode:"flat",rounded:"full",size:null,"aria-label":"Pan west"})]})};z.states=Te;z.options=Me;z.className=ne;z.defaultOptions=Oe;var ft=z;export{ne as NAVIGATOR_CLASSNAME,z as Navigator,ft as default};