UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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