@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 l=(...o)=>o.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...e):typeof e=="object"?Object.keys(e).map((i,a)=>e[a]||e[i]&&i||null).filter(i=>i!==null).join(" "):e).filter(e=>!!e).join(" ");var y=(o,e)=>l({[`${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:a,hover:s,focus:c,checked:d,active:r,selected:h,disabled:g,indeterminate:p,loading:B,empty:b,readonly:E,highlighted:P,...S}=e;return l({"k-valid":i,"k-invalid":a,"k-hover":s,"k-focus":c,"k-checked":d,"k-active":r,"k-selected":h,"k-disabled":g,"k-indeterminate":p&&!d,"k-loading":B,"k-empty":b,"k-readonly":E,"k-highlighted":P},Object.keys(S).reduce((u,v)=>(v.startsWith("k-")?u[v]=S[v]:u[`k-${v}`]=S[v],u),{}))};function X(o,e){if(!e)return{};let i=Array.isArray(e)?e:[e];return Object.fromEntries(i.map(a=>[`k-${a}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},N={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"},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 fe,jsx as W}from"react/jsx-runtime";var K="k-font-icon",ue=[],me={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]},pe={},M=o=>{let{size:e,themeColor:i,icon:a,rotate:s,flip:c,...d}=o;return a?W("span",{...d,className:l(o.className,K,y(K,{size:e}),{[`k-i-${a}`]:a,[`k-color-${i}`]:i,[`k-rotate-${s}`]:s,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):W(fe,{})};M.states=ue;M.options=me;M.className=K;M.defaultOptions=pe;var Q=M;import{Fragment as he,jsx as _}from"react/jsx-runtime";var H="k-svg-icon",xe=[],ge={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:[f.outline,f.solid,f.duotone]},F={viewBox:"0 0 24 24",variant:f.outline},O=o=>{let{size:e,themeColor:i,rotate:a,flip:s,viewBox:c=F.viewBox,variant:d=F.variant,icon:r,...h}=o;if(!r)return _(he,{});if(r==="none")return _("span",{...h,className:l(o.className,H,y("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let g=typeof r=="object"&&r.name&&r.name,p=typeof r=="object"?d&&r.variants?.[d]||r.variants?.outline||r.content:void 0;return _("span",{...h,className:l(o.className,H,y("k-icon",{size:e}),{[`k-svg-i-${g}`]:g,[`k-color-${i}`]:i,[`k-rotate-${a}`]:a,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:_("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof r=="object"?r.viewBox:c,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:r?void 0:o.children})})};O.states=xe;O.options=ge;O.className=H;O.defaultOptions=F;var U=O;import*as D from"@progress/kendo-svg-icons";var Y="icon",Z="icons";import{useContext as ve}from"react";import{createContext as be}from"react";var ee=be({iconsType:"svg"});import{Fragment as te,jsx as I}from"react/jsx-runtime";var R="k-icon",ye=o=>o.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Ne=[],ke={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:[f.outline,f.solid,f.duotone]},$={viewBox:"0 0 24 24",type:"svg",variant:f.outline},x=o=>{let{iconsType:e}=ve(ee),{size:i,themeColor:a,icon:s,type:c=e||$.type,rotate:d,flip:r,viewBox:h=$.viewBox,variant:g=$.variant,...p}=o;if(!s)return I(te,{});if((e||c)==="svg"){if(s==="none")return I(U,{...p,className:l(o.className,R),icon:s,size:i,variant:g});let b=D[s]?s:ye(`${s}-icon`);return D[b]?I(U,{...p,className:l(o.className,R),icon:D[b],size:i,themeColor:a,rotate:d,flip:r,viewBox:h,variant:g}):I(te,{})}return I(Q,{...p,className:l(o.className,R),icon:s,size:i,themeColor:a,rotate:d,flip:r})};x.states=Ne;x.options=ke;x.defaultOptions=$;x.className=R;x.moduleName=Y;x.folderName=Z;x.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 V="button",oe=V;import{Fragment as ne,jsx as T,jsxs as ie}from"react/jsx-runtime";var w="k-button",Ce=["icon-button"],Se=[C.hover,C.focus,C.active,C.selected,C.disabled,C.generating],Te={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[N.undefined,N.none,N.small,N.medium,N.large,N.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"},m=o=>{let{as:e="button",size:i,rounded:a,fillMode:s,themeColor:c,showArrow:d=G.showArrow,arrowIconName:r=G.arrowIconName,variant:h,hover:g,focus:p,active:B,selected:b,disabled:E,togglable:P,ariaDisabled:S,icon:u,iconSize:v,text:L,iconClassName:ae,className:re,...le}=o,ce=u!=null,de=o.children!==void 0;return ie(e,{className:l(re,w,X(w,h),y(w,{size:i,rounded:a,fillMode:s,themeColor:c}),J(w,{hover:g,focus:p,active:B,disabled:E||S,selected:b}),{"k-icon-button":!L&&!de&&ce}),"aria-pressed":P?b?"true":"false":void 0,...le,"aria-disabled":S?"true":void 0,disabled:E||void 0,children:[typeof u=="string"&&u&&T(x,{className:l(ae,"k-button-icon"),icon:u,size:v}),u&&typeof u!="string"&&T(ne,{children:u}),L?ie(ne,{children:[L&&T("span",{className:"k-button-text",children:L}),o.children]}):o.children&&T("span",{className:"k-button-text",children:o.children}),d&&T("span",{className:"k-menu-button-arrow k-button-arrow",children:T(x,{icon:r})})]})};m.states=Se;m.options=Te;m.variants=Ce;m.className=w;m.defaultOptions=G;m.moduleName=V;m.folderName=oe;m.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{Fragment as we,jsx as A,jsxs as q}from"react/jsx-runtime";var se="k-pane-scrollable",Me=[],Oe={},Ie=q(we,{children:[A(m,{fillMode:"flat",size:"xsmall",icon:"pin","aria-label":"Pin pane"}),A(m,{fillMode:"flat",size:"xsmall",icon:"more-vertical","aria-label":"More actions"})]}),j={actions:Ie,title:"Title"},z=o=>{let{actions:e=j.actions,title:i=j.title,children:a,...s}=o;return q("div",{...s,className:l(o.className,se),children:[q("div",{className:"k-pane-header",children:[A("span",{className:"k-pane-title",children:i}),A("div",{className:"k-pane-actions",children:e})]}),A("div",{className:"k-pane-content",children:a})]})};z.states=Me;z.options=Oe;z.className=se;z.defaultOptions=j;var xt=z;export{se as PANESCROLLABLE_CLASSNAME,z as PaneScrollable,xt as default};