@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 17.8 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((o,i)=>t[i]||t[o]&&o||null).filter(o=>o!==null).join(" "):t).filter(t=>!!t).join(" ");var g=(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.themeColor}`]:t.themeColor},{"k-rounded-sm":t.rounded==="small","k-rounded-md":t.rounded==="medium","k-rounded-lg":t.rounded==="large","k-rounded-full":t.rounded==="full","k-rounded-none":t.rounded==="none"}),A=(e,t)=>{let{valid:o,invalid:i,hover:a,focus:d,checked:c,active:p,selected:x,disabled:b,indeterminate:h,loading:T,empty:S,readonly:K,highlighted:H,...L}=t;return r({"k-valid":o,"k-invalid":i,"k-hover":a,"k-focus":d,"k-checked":c,"k-active":p,"k-selected":x,"k-disabled":b,"k-indeterminate":h&&!c,"k-loading":T,"k-empty":S,"k-readonly":K,"k-highlighted":H},Object.keys(L).reduce((v,k)=>(k.startsWith("k-")?v[k]=L[k]:v[`k-${k}`]=L[k],v),{}))};function _e(e,t){if(!t)return{};let o=Array.isArray(t)?t:[t];return Object.fromEntries(o.map(i=>[`k-${i}`,!0]))}var s={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},u={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},m={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},C={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},l={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",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 xe="floating-label",ze=xe;import{jsx as mt,jsxs as Re}from"react/jsx-runtime";var be="k-floating-label-container",pt=[n.hover,n.focus,n.valid,n.invalid,n.empty,n.disabled],ct={},ut={},M=e=>{let{hover:t,focus:o,disabled:i,invalid:a,valid:d,empty:c,label:p,optional:x,...b}=e;return Re("span",{...b,className:r(e.className,be,A(be,{hover:t,focus:o,disabled:i,empty:c,valid:d,invalid:a})),children:[e.children,p&&Re("label",{className:"k-floating-label",children:[p,x&&mt("span",{className:"k-label-optional",children:"(Optional)"})]})]})};M.states=pt;M.options=ct;M.className=be;M.defaultOptions=ut;M.moduleName=xe;M.folderName=ze;var he="textbox",Ke=he;var q="input",ee=q;import{jsx as ht}from"react/jsx-runtime";var te="k-input",ft=[n.hover,n.focus,n.valid,n.invalid,n.required,n.disabled,n.loading,n.readonly],xt={size:[s.undefined,s.small,s.medium,s.large],rounded:[u.undefined,u.none,u.small,u.medium,u.large,u.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},bt={},I=e=>{let{hover:t,focus:o,disabled:i,invalid:a,valid:d,loading:c,readonly:p,size:x,rounded:b,fillMode:h,...T}=e;return ht("span",{...T,className:r(e.className,te,g(te,{size:x,rounded:b,fillMode:h}),A(te,{hover:t,focus:o,disabled:i,invalid:a,valid:d,loading:c,readonly:p}))})};I.states=ft;I.options=xt;I.className=te;I.defaultOptions=bt;I.moduleName=q;I.folderName=ee;import{jsx as It}from"react/jsx-runtime";var oe="k-picker",Nt=[n.hover,n.focus,n.valid,n.invalid,n.required,n.disabled,n.loading,n.readonly],gt={size:[s.undefined,s.small,s.medium,s.large],rounded:[u.undefined,u.none,u.small,u.medium,u.large,u.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},vt={},F=e=>{let{hover:t,focus:o,disabled:i,invalid:a,valid:d,loading:c,readonly:p,size:x,rounded:b,fillMode:h,...T}=e;return It("span",{...T,className:r(e.className,oe,g(oe,{size:x,rounded:b,fillMode:h}),A(oe,{hover:t,focus:o,disabled:i,invalid:a,valid:d,loading:c,readonly:p})),children:e.children})};F.states=Nt;F.options=gt;F.className=oe;F.defaultOptions=vt;F.moduleName=q;F.folderName=ee;import{Fragment as kt,jsx as He}from"react/jsx-runtime";var Ne="k-font-icon",yt=[],Tt={size:[s.undefined,s.xsmall,s.small,s.medium,s.large,s.xlarge,s.xxlarge,s.xxxlarge],themeColor:[l.undefined,l.base,l.primary,l.secondary,l.tertiary,l.success,l.warning,l.error,l.info]},St={},J=e=>{let{size:t,themeColor:o,icon:i,rotate:a,flip:d,...c}=e;return i?He("span",{...c,className:r(e.className,Ne,g(Ne,{size:t}),{[`k-i-${i}`]:i,[`k-color-${o}`]:o,[`k-rotate-${a}`]:a,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):He(kt,{})};J.states=yt;J.options=Tt;J.className=Ne;J.defaultOptions=St;var Fe=J;import{Fragment as Ot,jsx as ne}from"react/jsx-runtime";var ge="k-svg-icon",Mt=[],Lt={size:[s.undefined,s.xsmall,s.small,s.medium,s.large,s.xlarge,s.xxlarge,s.xxxlarge],themeColor:[l.undefined,l.base,l.primary,l.secondary,l.tertiary,l.success,l.warning,l.error,l.info],variant:[C.outline,C.solid,C.duotone]},ve={viewBox:"0 0 24 24",variant:C.outline},W=e=>{let{size:t,themeColor:o,rotate:i,flip:a,viewBox:d=ve.viewBox,variant:c=ve.variant,icon:p,...x}=e;if(!p)return ne(Ot,{});if(p==="none")return ne("span",{...x,className:r(e.className,ge,g("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let b=typeof p=="object"&&p.name&&p.name,h=typeof p=="object"?c&&p.variants?.[c]||p.variants?.outline||p.content:void 0;return ne("span",{...x,className:r(e.className,ge,g("k-icon",{size:t}),{[`k-svg-i-${b}`]:b,[`k-color-${o}`]:o,[`k-rotate-${i}`]:i,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="both"}),"aria-hidden":"true",children:ne("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof p=="object"?p.viewBox:d,dangerouslySetInnerHTML:h!==void 0?{__html:h}:void 0,children:p?void 0:e.children})})};W.states=Mt;W.options=Lt;W.className=ge;W.defaultOptions=ve;var Ie=W;import*as ye from"@progress/kendo-svg-icons";var Ve="icon",De="icons";import{useContext as Et}from"react";import{createContext as Ct}from"react";var Ue=Ct({iconsType:"svg"});import{Fragment as $e,jsx as Q}from"react/jsx-runtime";var ae="k-icon",At=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),Bt=[],wt={size:[s.undefined,s.xsmall,s.small,s.medium,s.large,s.xlarge,s.xxlarge,s.xxxlarge],themeColor:[l.undefined,l.base,l.primary,l.secondary,l.tertiary,l.success,l.warning,l.error,l.info],variant:[C.outline,C.solid,C.duotone]},se={viewBox:"0 0 24 24",type:"svg",variant:C.outline},f=e=>{let{iconsType:t}=Et(Ue),{size:o,themeColor:i,icon:a,type:d=t||se.type,rotate:c,flip:p,viewBox:x=se.viewBox,variant:b=se.variant,...h}=e;if(!a)return Q($e,{});if((t||d)==="svg"){if(a==="none")return Q(Ie,{...h,className:r(e.className,ae),icon:a,size:o,variant:b});let S=ye[a]?a:At(`${a}-icon`);return ye[S]?Q(Ie,{...h,className:r(e.className,ae),icon:ye[S],size:o,themeColor:i,rotate:c,flip:p,viewBox:x,variant:b}):Q($e,{})}return Q(Fe,{...h,className:r(e.className,ae),icon:a,size:o,themeColor:i,rotate:c,flip:p})};f.states=Bt;f.options=wt;f.defaultOptions=se;f.className=ae;f.moduleName=Ve;f.folderName=De;f.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 zt,jsx as Te}from"react/jsx-runtime";var Ge="k-clear-value",Pt=[n.disabled,n.loading,n.readonly],_t={},w=e=>{let{disabled:t,loading:o,readonly:i,value:a}=e;return t||i||o||!a?Te(zt,{}):Te("span",{className:r(e.className,Ge),children:Te(f,{icon:"x"})})};w.states=Pt;w.options=_t;w.className=Ge;import{jsx as Ht}from"react/jsx-runtime";var Se="k-input-inner",Rt=[],Kt={},ie={type:"text",autocomplete:"off",value:"",placeholder:""},P=e=>{let{value:t=ie.value,type:o=ie.type,placeholder:i=ie.placeholder,autocomplete:a=ie.autocomplete,disabled:d,readOnly:c,...p}=e;return Ht("input",{...p,type:o,className:r(e.className,Se,g(Se,e)),placeholder:i,autoComplete:a,defaultValue:t,disabled:d||void 0,readOnly:c||void 0})};P.states=Rt;P.options=Kt;P.className=Se;import{jsx as Xe,jsxs as Dt}from"react/jsx-runtime";var ke="k-input-inner",Ft=[],Vt={},Me=e=>{let{value:t,placeholder:o,showValue:i,valueIcon:a,valueIconName:d,...c}=e;return Dt("span",{...c,className:r(e.className,ke,g(ke,e)),children:[a,!a&&d&&Xe(f,{className:"k-input-value-icon",icon:d}),i&&!t&&o,i&&t&&Xe("span",{className:"k-input-value-text",children:t})]})};Me.states=Ft;Me.options=Vt;Me.className=ke;import{jsx as Gt}from"react/jsx-runtime";var Le="k-input-inner",Ut=[],$t={},qe={value:"",placeholder:""},Oe=e=>{let{value:t=qe.value,placeholder:o=qe.placeholder,rows:i,disabled:a,...d}=e;return Gt("textarea",{...d,className:r(e.className,Le,g(Le,e)),placeholder:o,rows:i,defaultValue:t,disabled:a||void 0})};Oe.states=Ut;Oe.options=$t;Oe.className=Le;import{Fragment as qt,jsx as Je}from"react/jsx-runtime";var We="k-input-loading-icon",Xt=[n.disabled,n.loading],V=e=>{let{disabled:t,loading:o}=e;return t||!o?Je(qt,{}):Je("span",{className:r(e.className,We,"k-icon k-i-loading")})};V.states=Xt;V.className=We;import{Fragment as Qt,jsx as Qe}from"react/jsx-runtime";var Ye="k-input-validation-icon",Jt=[n.valid,n.invalid,n.disabled,n.loading],Wt={},_=e=>{let{valid:t,invalid:o,disabled:i,loading:a}=e,d=o?"warning-circle":"check-circle";return i||a||!!!(t||o)?Qe(Qt,{}):Qe(f,{className:r(Ye),icon:d})};_.states=Jt;_.options=Wt;_.className=Ye;import{Fragment as jt,jsx as Ze}from"react/jsx-runtime";var Yt="k-input-prefix",Zt={direction:"horizontal"},re=e=>{let{direction:t=Zt.direction,...o}=e;return e.children?Ze("span",{...o,className:r(Yt,e.className,{[`k-input-prefix-${t}`]:t}),children:e.children}):Ze(jt,{})};import{Fragment as oo,jsx as je}from"react/jsx-runtime";var eo="k-input-suffix",to={direction:"horizontal"},le=e=>{let{direction:t=to.direction,...o}=e;return e.children?je("span",{...o,className:r(eo,e.className,{[`k-input-suffix-${t}`]:t}),children:e.children}):je(oo,{})};import{jsx as na}from"react/jsx-runtime";import{jsx as ra}from"react/jsx-runtime";import{jsx as ao}from"react/jsx-runtime";var et="k-input-separator",no={direction:"vertical"},D=e=>{let{direction:t=no.direction,...o}=e;return ao("span",{...o,className:r(et,e.className,{[`${et}-${t}`]:t})})};var Ce="button",tt=Ce;import{Fragment as ot,jsx as U,jsxs as nt}from"react/jsx-runtime";var Y="k-button",so=["icon-button"],io=[n.hover,n.focus,n.active,n.selected,n.disabled,n.generating],ro={size:[s.undefined,s.xsmall,s.small,s.medium,s.large],rounded:[u.undefined,u.none,u.small,u.medium,u.large,u.full],fillMode:[m.undefined,m.solid,m.flat,m.outline,m.clear,m.link],themeColor:[l.undefined,l.base,l.primary,l.secondary,l.tertiary,l.success,l.warning,l.error,l.info,l.inverse]},Ee={showArrow:!1,arrowIconName:"chevron-down"},N=e=>{let{as:t="button",size:o,rounded:i,fillMode:a,themeColor:d,showArrow:c=Ee.showArrow,arrowIconName:p=Ee.arrowIconName,variant:x,hover:b,focus:h,active:T,selected:S,disabled:K,togglable:H,ariaDisabled:L,icon:v,iconSize:k,text:O,iconClassName:j,className:ce,...ue}=e,me=v!=null,fe=e.children!==void 0;return nt(t,{className:r(ce,Y,_e(Y,x),g(Y,{size:o,rounded:i,fillMode:a,themeColor:d}),A(Y,{hover:b,focus:h,active:T,disabled:K||L,selected:S}),{"k-icon-button":!O&&!fe&&me}),"aria-pressed":H?S?"true":"false":void 0,...ue,"aria-disabled":L?"true":void 0,disabled:K||void 0,children:[typeof v=="string"&&v&&U(f,{className:r(j,"k-button-icon"),icon:v,size:k}),v&&typeof v!="string"&&U(ot,{children:v}),O?nt(ot,{children:[O&&U("span",{className:"k-button-text",children:O}),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(f,{icon:p})})]})};N.states=io;N.options=ro;N.variants=so;N.className=Y;N.defaultOptions=Ee;N.moduleName=Ce;N.folderName=tt;N.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 lo}from"react/jsx-runtime";var z=e=>lo(N,{children:"Button",...e});import{Fragment as at,jsx as E,jsxs as Ae}from"react/jsx-runtime";var po=I.states,co=I.defaultOptions,uo=I.options,mo=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"},{name:"validation-icon",title:"Validation Icon"},{name:"separators",title:"Separators"}],fo=[],$=e=>{let{modifiers:t,valid:o,invalid:i,loading:a,disabled:d,readonly:c,...p}=e,x=t?.prefix,b=t?.suffix,h=t?.["clear-button"],T=t?.["validation-icon"],S=t?.separators;return Ae(I,{...p,valid:o,invalid:i,loading:a,disabled:d,readonly:c,style:{width:300},children:[x&&Ae(at,{children:[E(re,{children:E(f,{icon:"lock"})}),S&&E(D,{})]}),E(P,{placeholder:"Placeholder",value:"Value"}),T&&E(_,{valid:o,invalid:i,loading:a,disabled:d}),E(V,{loading:a,disabled:d}),h&&E(w,{loading:a,disabled:d,readonly:c,value:"Value"}),b&&Ae(at,{children:[S&&E(D,{}),E(le,{children:E(z,{size:p.size,fillMode:"clear",children:"Send"})})]})]})};$.options=uo;$.states=po;$.variants=fo;$.defaultOptions=co;$.modifiers=mo;$.className=I.className;import{Fragment as st,jsx as B,jsxs as Be}from"react/jsx-runtime";var it="k-textbox",xo=[n.hover,n.focus,n.valid,n.invalid,n.required,n.disabled,n.loading,n.readonly],bo={size:[s.undefined,s.small,s.medium,s.large],rounded:[u.undefined,u.none,u.small,u.medium,u.large,u.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},de={showClearButton:!0,showValidationIcon:!0,separators:!0},y=e=>{let{size:t,rounded:o,fillMode:i,separators:a=de.separators,showClearButton:d=de.showClearButton,showValidationIcon:c=de.showValidationIcon,prefix:p,suffix:x,type:b,value:h,placeholder:T,hover:S,focus:K,valid:H,invalid:L,required:v,loading:k,disabled:O,readonly:j,id:ce,"aria-label":ue,"aria-describedby":me,...fe}=e;return Be(I,{...fe,size:t,rounded:o,fillMode:i,hover:S,focus:K,valid:H,invalid:L,required:v,loading:k,disabled:O,readonly:j,className:r(e.className,it),children:[p&&Be(st,{children:[B(re,{children:p}),a&&B(D,{})]}),B(P,{id:ce,placeholder:T,value:h,type:b,disabled:O,"aria-label":ue,"aria-describedby":me,"aria-invalid":L?"true":void 0}),c&&B(_,{valid:H,invalid:L,loading:k,disabled:O}),B(V,{loading:k,disabled:O}),d&&B(w,{loading:k,disabled:O,readonly:j,value:h}),x&&Be(st,{children:[a&&B(D,{}),B(le,{children:x})]})]})};y.states=xo;y.options=bo;y.className=it;y.defaultOptions=de;y.moduleName=he;y.folderName=Ke;y.ariaSpec={selector:".k-textbox",rules:[{selector:".k-textbox > .k-input-inner",attribute:"role=textbox or nodeName=input",usage:"Describes the role of the component."},{selector:".k-textbox > .k-input-inner",attribute:"label for or aria-label or aria-labelledby (when has accessible name)",usage:"The input requires an accessible name (provided by consuming app)."},{selector:".k-textbox > .k-input-inner",attribute:"aria-invalid=true (when invalid)",usage:"Rendered when the TextBox is in an invalid state."},{selector:".k-textbox > .k-input-inner",attribute:"aria-describedby (when has hint or error)",usage:"Points to the hint or error message for the input."},{selector:".k-textbox.k-disabled > .k-input-inner",attribute:"disabled=disabled or aria-disabled=true",usage:"Rendered when the TextBox is disabled."}]};var Z=y;import{jsx as ho}from"react/jsx-runtime";var pe=e=>ho(Z,{...e});import{Fragment as ls,jsx as rs}from"react/jsx-runtime";import{jsx as No}from"react/jsx-runtime";var rt=e=>No(N,{icon:"folder",...e,"aria-label":e["aria-label"]||"Folder",children:void 0});import{jsx as go}from"react/jsx-runtime";var lt=e=>go(N,{icon:"folder",children:"Button",...e});import{jsx as we}from"react/jsx-runtime";var vo=N.options,Io=N.states,yo={...N.defaultOptions,variant:"text"},To=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],So=[],G=e=>{let{variant:t,...o}=e;switch(t){case"icon-only":return we(rt,{...o,icon:"star"});case"icon-and-text":return we(lt,{...o,icon:"star",children:"Button"});default:return we(z,{...o,children:"Button"})}};G.options=vo;G.states=Io;G.variants=To;G.defaultOptions=yo;G.modifiers=So;G.className=N.className;import{Fragment as ws,jsx as Bs}from"react/jsx-runtime";import{jsx as Rs}from"react/jsx-runtime";import{jsx as Pe}from"react/jsx-runtime";var ko=y.states,Mo=y.defaultOptions,Lo=y.options,Oo=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"}],Co=[],X=e=>{let{modifiers:t,...o}=e,i={};return Object.keys(t||{}).forEach(a=>{switch(a){case"prefix":i.prefix=t?.[a]?Pe(f,{icon:"lock"}):void 0;break;case"suffix":i.suffix=t?.[a]?Pe(z,{size:o.size,fillMode:"clear",children:"Send"}):void 0;break;case"clear-button":i.showClearButton=t?.[a];break;default:break}}),Pe(pe,{value:"Value",style:{width:300},...o,...i})};X.options=Lo;X.states=ko;X.variants=Co;X.defaultOptions=Mo;X.modifiers=Oo;X.className=y.className;import{jsx as dt}from"react/jsx-runtime";var Eo=M.options,Ao=[],Bo=M.states,wo=M.defaultOptions,Po=[],R=e=>dt(M,{label:"Floating Label",empty:!0,...e,children:dt(pe,{style:{width:"300px"},...e})});R.options=Eo;R.states=Bo;R.variants=Ao;R.defaultOptions=wo;R.modifiers=Po;R.className=M.className;var oi=R;export{R as FloatingLabelDemo,oi as default};