@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 12.3 kB
JavaScript
var n=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?n(...t):typeof t=="object"?Object.keys(t).map((a,i)=>t[i]||t[a]&&a||null).filter(a=>a!==null).join(" "):t).filter(t=>!!t).join(" ");var x=(e,t)=>n({[`${e}-xs`]:t.size==="xsmall",[`${e}-sm`]:t.size==="small",[`${e}-md`]:t.size==="medium",[`${e}-lg`]:t.size==="large",[`${e}-xl`]:t.size==="xlarge",[`${e}-xxl`]:t.size==="xxlarge",[`${e}-xxxl`]:t.size==="xxxlarge"},{[`${e}-${t.fillMode}`]:t.fillMode},{[`${e}-${t.fillMode}-${t.themeColor}`]:t.fillMode&&t.themeColor},{[`${e}-${t.themeColor}`]:t.themeColor&&t.fillMode===void 0},{"k-rounded-sm":t.rounded==="small","k-rounded-md":t.rounded==="medium","k-rounded-lg":t.rounded==="large","k-rounded-full":t.rounded==="full"}),z=(e,t)=>{let{valid:a,invalid:i,hover:c,focus:p,checked:l,active:m,selected:f,disabled:h,indeterminate:b,loading:M,empty:C,readonly:S,highlighted:T,...k}=t;return n({"k-valid":a,"k-invalid":i,"k-hover":c,"k-focus":p,"k-checked":l,"k-active":m,"k-selected":f,"k-disabled":h,"k-indeterminate":b&&!l,"k-loading":M,"k-empty":C,"k-readonly":S,"k-highlighted":T},Object.keys(k).reduce((O,v)=>(v.startsWith("k-")?O[v]=k[v]:O[`k-${v}`]=k[v],O),{}))};function fe(e,t){if(!t)return{};let a=Array.isArray(t)?t:[t];return Object.fromEntries(a.map(i=>[`k-${i}`,!0]))}var s={xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},d={small:"small",medium:"medium",large:"large",full:"full"},u={solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},o={inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",dark:"dark",light:"light",inverse:"inverse"},r={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"};var Q="textarea",xe=Q;var w="input",U=w;import{jsx as qe}from"react/jsx-runtime";var V="k-input",Fe=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled,r.loading,r.readonly],De={size:[s.small,s.medium,s.large],rounded:[d.small,d.medium,d.large,d.full],fillMode:[u.solid,u.flat,u.outline]},F={size:s.medium,rounded:s.medium,fillMode:u.solid},I=e=>{let{hover:t,focus:a,disabled:i,invalid:c,valid:p,loading:l,readonly:m,size:f=F.size,rounded:h=F.rounded,fillMode:b=F.fillMode,...M}=e;return qe("span",{...M,className:n(e.className,V,x(V,{size:f,rounded:h,fillMode:b}),z(V,{hover:t,focus:a,disabled:i,invalid:c,valid:p,loading:l,readonly:m}))})};I.states=Fe;I.options=De;I.className=V;I.defaultOptions=F;I.moduleName=w;I.folderName=U;import{jsx as Je}from"react/jsx-runtime";var D="k-picker",Ge=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled,r.loading,r.readonly],Xe={size:[s.small,s.medium,s.large],rounded:[d.small,d.medium,d.large,d.full],fillMode:[u.solid,u.flat,u.outline]},q={size:s.medium,rounded:d.medium,fillMode:u.solid},L=e=>{let{hover:t,focus:a,disabled:i,invalid:c,valid:p,loading:l,readonly:m,size:f=q.size,rounded:h=q.rounded,fillMode:b=q.fillMode,...M}=e;return Je("span",{...M,className:n(e.className,D,x(D,{size:f,rounded:h,fillMode:b}),z(D,{hover:t,focus:a,disabled:i,invalid:c,valid:p,loading:l,readonly:m})),children:e.children})};L.states=Ge;L.options=Xe;L.className=D;L.defaultOptions=q;L.moduleName=w;L.folderName=U;import{Fragment as Ze,jsx as Ne}from"react/jsx-runtime";var Y="k-font-icon",We=[],Qe={size:[s.xsmall,s.small,s.medium,s.large,s.xlarge,s.xxlarge,s.xxxlarge],themeColor:[o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.light,o.dark]},Ye={},_=e=>{let{size:t,themeColor:a,icon:i,rotate:c,flip:p,...l}=e;return i?Ne("span",{...l,className:n(e.className,Y,x(Y,{size:t}),{[`k-i-${i}`]:i,[`k-color-${a}`]:a,[`k-rotate-${c}`]:c,"k-flip-h":p==="h"||p==="both","k-flip-v":p==="v"||p==="both"})}):Ne(Ze,{})};_.states=We;_.options=Qe;_.className=Y;_.defaultOptions=Ye;var he=_;import{Fragment as tt,jsx as G}from"react/jsx-runtime";var Z="k-svg-icon",je=[],et={size:[s.xsmall,s.small,s.medium,s.large,s.xlarge,s.xxlarge,s.xxxlarge],themeColor:[o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.light,o.dark]},Ie={viewBox:"0 0 24 24"},R=e=>{let{size:t,themeColor:a,rotate:i,flip:c,viewBox:p=Ie.viewBox,icon:l,...m}=e;if(!l)return G(tt,{});l==="none"&&{...m,className:n(e.className,Z,"k-none")};let f=typeof l=="object"&&l.name&&l.name;return G("span",{...m,className:n(e.className,Z,x("k-icon",{size:t}),{[`k-svg-i-${f}`]:f,[`k-color-${a}`]:a,[`k-rotate-${i}`]:i,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),children:G("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof l=="object"?l.viewBox:p,dangerouslySetInnerHTML:typeof l=="object"?{__html:l.content}:void 0,children:l?void 0:e.children})})};R.states=je;R.options=et;R.className=Z;R.defaultOptions=Ie;var j=R;import*as ee from"@progress/kendo-svg-icons";var ge="icon",be="icons";import{Fragment as Me,jsx as H}from"react/jsx-runtime";var X="k-icon",ot=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),nt=[],at={size:[s.xsmall,s.small,s.medium,s.large,s.xlarge,s.xxlarge,s.xxxlarge],themeColor:[o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.light,o.dark]},te={viewBox:"0 0 24 24",type:"svg"},N=e=>{let{size:t,themeColor:a,icon:i,type:c=te.type,rotate:p,flip:l,viewBox:m=te.viewBox,...f}=e;if(!i)return H(Me,{});if(c==="svg"){if(i==="none")return H(j,{...f,className:n(e.className,X),icon:i,size:t});let h=ee[i]?i:ot(`${i}-icon`);return ee[h]?H(j,{...f,className:n(e.className,X),icon:ee[h],size:t,themeColor:a,rotate:p,flip:l,viewBox:m}):H(Me,{})}return H(he,{...f,className:n(e.className,X),icon:i,size:t,themeColor:a,rotate:p,flip:l})};N.states=nt;N.options=at;N.defaultOptions=te;N.className=X;N.moduleName=ge;N.folderName=be;import{Fragment as it,jsx as oe}from"react/jsx-runtime";var ve="k-clear-value",st=[r.disabled,r.loading,r.readonly],rt={},ne=e=>{let{disabled:t,loading:a,readonly:i,value:c}=e;return t||i||a||!c?oe(it,{}):oe("span",{className:n(e.className,ve),children:oe(N,{icon:"x"})})};ne.states=st;ne.options=rt;ne.className=ve;import{jsx as pt}from"react/jsx-runtime";var ae="k-input-inner",lt=[],ct={},J={type:"text",autocomplete:"off",value:"",placeholder:""},se=e=>{let{value:t=J.value,type:a=J.type,placeholder:i=J.placeholder,autocomplete:c=J.autocomplete,...p}=e;return pt("input",{...p,type:a,className:n(e.className,ae,x(ae,e)),placeholder:i,autoComplete:c,defaultValue:t})};se.states=lt;se.options=ct;se.className=ae;import{jsx as ye,jsxs as mt}from"react/jsx-runtime";var re="k-input-inner",dt=[],ut={},ie=e=>{let{value:t,placeholder:a,showValue:i,valueIcon:c,valueIconName:p,...l}=e;return mt("span",{...l,className:n(e.className,re,x(re,e)),children:[c,!c&&p&&ye(N,{className:"k-input-value-icon",icon:p}),i&&!t&&a,i&&t&&ye("span",{className:"k-input-value-text",children:t})]})};ie.states=dt;ie.options=ut;ie.className=re;import{jsx as Nt}from"react/jsx-runtime";var le="k-input-inner",ft=[],xt={},Te={value:"",placeholder:""},P=e=>{let{value:t=Te.value,placeholder:a=Te.placeholder,rows:i,...c}=e;return Nt("textarea",{...c,className:n(e.className,le,x(le,e)),placeholder:a,rows:i,defaultValue:t})};P.states=ft;P.options=xt;P.className=le;import{Fragment as It,jsx as Se}from"react/jsx-runtime";var ke="k-input-loading-icon",ht=[r.disabled,r.loading],Oe=e=>{let{disabled:t,loading:a}=e;return t||!a?Se(It,{}):Se("span",{className:n(e.className,ke,"k-icon k-i-loading")})};Oe.states=ht;Oe.className=ke;import{Fragment as Mt,jsx as Ae}from"react/jsx-runtime";var Ee="k-input-validation-icon",gt=[r.valid,r.invalid,r.disabled,r.loading],bt={},ce=e=>{let{valid:t,invalid:a,disabled:i,loading:c}=e,p=a?"warning-circle":"check-circle";return i||c||!!!(t||a)?Ae(Mt,{}):Ae(N,{className:n(Ee),icon:p})};ce.states=gt;ce.options=bt;ce.className=Ee;import{Fragment as Tt,jsx as ze}from"react/jsx-runtime";var vt="k-input-prefix",yt={direction:"horizontal"},Le=e=>{let{direction:t=yt.direction,...a}=e;return e.children?ze("span",{...a,className:n(vt,e.className,{[`k-input-prefix-${t}`]:t}),children:e.children}):ze(Tt,{})};import{Fragment as Ot,jsx as Ce}from"react/jsx-runtime";var St="k-input-suffix",kt={direction:"horizontal"},we=e=>{let{direction:t=kt.direction,...a}=e;return e.children?Ce("span",{...a,className:n(St,e.className,{[`k-input-suffix-${t}`]:t}),children:e.children}):Ce(Ot,{})};import{jsx as Wo}from"react/jsx-runtime";import{jsx as jo}from"react/jsx-runtime";import{jsx as Et}from"react/jsx-runtime";var _e="k-input-separator",At={direction:"vertical"},pe=e=>{let{direction:t=At.direction,...a}=e;return Et("span",{...a,className:n(_e,e.className,{[`${_e}-${t}`]:t})})};import{Fragment as Re,jsx as B,jsxs as de}from"react/jsx-runtime";var He="k-textarea",zt=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled],Lt={size:[s.small,s.medium,s.large],rounded:[d.small,d.medium,d.large,d.full],fillMode:[u.solid,u.flat,u.outline]},y={size:I.defaultOptions.size,rounded:I.defaultOptions.rounded,fillMode:I.defaultOptions.fillMode,flow:"vertical",affixesOrientation:"horizontal",resize:"both",prefixSeparator:!0,suffixSeparator:!0},A=e=>{let{size:t=y.size,rounded:a=y.rounded,fillMode:i=y.fillMode,prefixSeparator:c=y.prefixSeparator,suffixSeparator:p=y.prefixSeparator,affixesOrientation:l=y.affixesOrientation,flow:m=y.flow,resize:f=y.resize,prefix:h,suffix:b,rows:M,value:C,placeholder:S,hover:T,focus:k,valid:O,invalid:v,required:W,disabled:Ue,...Ve}=e;return de(I,{...Ve,size:t,rounded:a,fillMode:i,hover:T,focus:k,valid:O,invalid:v,required:W,disabled:Ue,className:n(e.className,He,{"!k-flex-col":m==="vertical","!k-flex-row":m==="horizontal"}),children:[h&&de(Re,{children:[B(Le,{className:n({"!k-align-items-start":m===l}),direction:l,children:h}),c&&B(pe,{direction:m==="horizontal"?"vertical":"horizontal"})]}),B(P,{className:n("!k-overflow-auto",{"!k-flex-none":m==="vertical","k-resize-x":f==="x","k-resize-y":f==="y","k-resize":f==="both","k-resize-none":f==="none"}),value:C,placeholder:S,rows:M}),b&&de(Re,{children:[p&&B(pe,{direction:m==="horizontal"?"vertical":"horizontal"}),B(we,{className:n({"!k-align-items-start":m===l}),direction:l,children:b})]})]})};A.states=zt;A.options=Lt;A.className=He;A.defaultOptions=y;A.moduleName=Q;A.folderName=xe;var Pe=A;var ue="button",Be=ue;import{Fragment as Rt,jsx as K,jsxs as Ke}from"react/jsx-runtime";var $="k-button",Ct=["icon-button"],wt=[r.hover,r.focus,r.active,r.selected,r.disabled,r.generating],_t={size:[s.small,s.medium,s.large],rounded:[d.small,d.medium,d.large,d.full],fillMode:[u.solid,u.flat,u.outline,u.clear,u.link],themeColor:[o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.light,o.dark,o.inverse]},E={size:s.medium,rounded:d.medium,fillMode:u.solid,themeColor:o.base,showArrow:!1,arrowIconName:"caret-alt-down"},g=e=>{let{size:t=E.size,rounded:a=E.rounded,fillMode:i=E.fillMode,themeColor:c=E.themeColor,showArrow:p=E.showArrow,arrowIconName:l=E.arrowIconName,variant:m,hover:f,focus:h,active:b,selected:M,disabled:C,icon:S,text:T,iconClassName:k,...O}=e,v=S!==void 0,W=e.children!==void 0;return Ke("button",{...O,className:n(e.className,$,fe($,m),x($,{size:t,rounded:a,fillMode:i,themeColor:c}),z($,{hover:f,focus:h,active:b,disabled:C,selected:M}),{"k-icon-button":!T&&!W&&v}),children:[S&&K(N,{className:n(k,"k-button-icon"),icon:S}),T?Ke(Rt,{children:[T&&K("span",{className:"k-button-text",children:T}),e.children]}):e.children&&K("span",{className:"k-button-text",children:e.children}),p&&K("span",{className:"k-menu-button-arrow k-button-arrow",children:K(N,{icon:l})})]})};g.states=wt;g.options=_t;g.variants=Ct;g.className=$;g.defaultOptions=E;g.moduleName=ue;g.folderName=Be;import{jsx as Ht}from"react/jsx-runtime";var $e=e=>Ht(g,{icon:"folder",...e,children:void 0});import{jsx as Rn}from"react/jsx-runtime";import{jsx as Kn}from"react/jsx-runtime";import{Fragment as Pt,jsx as me}from"react/jsx-runtime";var Jn=e=>me(Pe,{suffix:me(Pt,{children:me($e,{icon:"volume-up",fillMode:"clear"})}),...e});export{Jn as TextareaSuffix};