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