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