@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 15.8 kB
JavaScript
var a=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?a(...e):typeof e=="object"?Object.keys(e).map((o,l)=>e[l]||e[o]&&o||null).filter(o=>o!==null).join(" "):e).filter(e=>!!e).join(" ");var N=(t,e)=>a({[`${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"}),L=(t,e)=>{let{valid:o,invalid:l,hover:i,focus:c,checked:u,active:d,selected:f,disabled:b,indeterminate:x,loading:I,empty:y,readonly:A,highlighted:H,...O}=e;return a({"k-valid":o,"k-invalid":l,"k-hover":i,"k-focus":c,"k-checked":u,"k-active":d,"k-selected":f,"k-disabled":b,"k-indeterminate":x&&!u,"k-loading":I,"k-empty":y,"k-readonly":A,"k-highlighted":H},Object.keys(O).reduce((g,k)=>(k.startsWith("k-")?g[k]=O[k]:g[`k-${k}`]=O[k],g),{}))};function Se(t,e){if(!e)return{};let o=Array.isArray(e)?e:[e];return Object.fromEntries(o.map(l=>[`k-${l}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},p={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"},S={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},s={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",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 de="textarea",Te=de;var B="input",W=B;import{jsx as Ze}from"react/jsx-runtime";var Q="k-input",We=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled,r.loading,r.readonly],Qe={size:[n.undefined,n.small,n.medium,n.large],rounded:[p.undefined,p.none,p.small,p.medium,p.large,p.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},Ye={},v=t=>{let{hover:e,focus:o,disabled:l,invalid:i,valid:c,loading:u,readonly:d,size:f,rounded:b,fillMode:x,...I}=t;return Ze("span",{...I,className:a(t.className,Q,N(Q,{size:f,rounded:b,fillMode:x}),L(Q,{hover:e,focus:o,disabled:l,invalid:i,valid:c,loading:u,readonly:d}))})};v.states=We;v.options=Qe;v.className=Q;v.defaultOptions=Ye;v.moduleName=B;v.folderName=W;import{jsx as ot}from"react/jsx-runtime";var Y="k-picker",je=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled,r.loading,r.readonly],et={size:[n.undefined,n.small,n.medium,n.large],rounded:[p.undefined,p.none,p.small,p.medium,p.large,p.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},tt={},z=t=>{let{hover:e,focus:o,disabled:l,invalid:i,valid:c,loading:u,readonly:d,size:f,rounded:b,fillMode:x,...I}=t;return ot("span",{...I,className:a(t.className,Y,N(Y,{size:f,rounded:b,fillMode:x}),L(Y,{hover:e,focus:o,disabled:l,invalid:i,valid:c,loading:u,readonly:d})),children:t.children})};z.states=je;z.options=et;z.className=Y;z.defaultOptions=tt;z.moduleName=B;z.folderName=W;import{Fragment as it,jsx as Me}from"react/jsx-runtime";var ce="k-font-icon",nt=[],at={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[s.undefined,s.base,s.primary,s.secondary,s.tertiary,s.success,s.warning,s.error,s.info]},rt={},K=t=>{let{size:e,themeColor:o,icon:l,rotate:i,flip:c,...u}=t;return l?Me("span",{...u,className:a(t.className,ce,N(ce,{size:e}),{[`k-i-${l}`]:l,[`k-color-${o}`]:o,[`k-rotate-${i}`]:i,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):Me(it,{})};K.states=nt;K.options=at;K.className=ce;K.defaultOptions=rt;var Oe=K;import{Fragment as dt,jsx as Z}from"react/jsx-runtime";var ue="k-svg-icon",st=[],lt={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[s.undefined,s.base,s.primary,s.secondary,s.tertiary,s.success,s.warning,s.error,s.info],variant:[S.outline,S.solid,S.duotone]},pe={viewBox:"0 0 24 24",variant:S.outline},V=t=>{let{size:e,themeColor:o,rotate:l,flip:i,viewBox:c=pe.viewBox,variant:u=pe.variant,icon:d,...f}=t;if(!d)return Z(dt,{});if(d==="none")return Z("span",{...f,className:a(t.className,ue,N("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let b=typeof d=="object"&&d.name&&d.name,x=typeof d=="object"?u&&d.variants?.[u]||d.variants?.outline||d.content:void 0;return Z("span",{...f,className:a(t.className,ue,N("k-icon",{size:e}),{[`k-svg-i-${b}`]:b,[`k-color-${o}`]:o,[`k-rotate-${l}`]:l,"k-flip-h":i==="h"||i==="both","k-flip-v":i==="v"||i==="both"}),"aria-hidden":"true",children:Z("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof d=="object"?d.viewBox:c,dangerouslySetInnerHTML:x!==void 0?{__html:x}:void 0,children:d?void 0:t.children})})};V.states=st;V.options=lt;V.className=ue;V.defaultOptions=pe;var me=V;import*as fe from"@progress/kendo-svg-icons";var Ce="icon",Ae="icons";import{useContext as ut}from"react";import{createContext as ct}from"react";var Ee=ct({iconsType:"svg"});import{Fragment as Le,jsx as $}from"react/jsx-runtime";var j="k-icon",pt=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),mt=[],ft={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[s.undefined,s.base,s.primary,s.secondary,s.tertiary,s.success,s.warning,s.error,s.info],variant:[S.outline,S.solid,S.duotone]},ee={viewBox:"0 0 24 24",type:"svg",variant:S.outline},h=t=>{let{iconsType:e}=ut(Ee),{size:o,themeColor:l,icon:i,type:c=e||ee.type,rotate:u,flip:d,viewBox:f=ee.viewBox,variant:b=ee.variant,...x}=t;if(!i)return $(Le,{});if((e||c)==="svg"){if(i==="none")return $(me,{...x,className:a(t.className,j),icon:i,size:o,variant:b});let y=fe[i]?i:pt(`${i}-icon`);return fe[y]?$(me,{...x,className:a(t.className,j),icon:fe[y],size:o,themeColor:l,rotate:u,flip:d,viewBox:f,variant:b}):$(Le,{})}return $(Oe,{...x,className:a(t.className,j),icon:i,size:o,themeColor:l,rotate:u,flip:d})};h.states=mt;h.options=ft;h.defaultOptions=ee;h.className=j;h.moduleName=Ce;h.folderName=Ae;h.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 ht,jsx as xe}from"react/jsx-runtime";var ze="k-clear-value",xt=[r.disabled,r.loading,r.readonly],bt={},U=t=>{let{disabled:e,loading:o,readonly:l,value:i}=t;return e||l||o||!i?xe(ht,{}):xe("span",{className:a(t.className,ze),children:xe(h,{icon:"x"})})};U.states=xt;U.options=bt;U.className=ze;import{jsx as vt}from"react/jsx-runtime";var be="k-input-inner",Nt=[],gt={},te={type:"text",autocomplete:"off",value:"",placeholder:""},D=t=>{let{value:e=te.value,type:o=te.type,placeholder:l=te.placeholder,autocomplete:i=te.autocomplete,disabled:c,readOnly:u,...d}=t;return vt("input",{...d,type:o,className:a(t.className,be,N(be,t)),placeholder:l,autoComplete:i,defaultValue:e,disabled:c||void 0,readOnly:u||void 0})};D.states=Nt;D.options=gt;D.className=be;import{jsx as we,jsxs as kt}from"react/jsx-runtime";var he="k-input-inner",It=[],yt={},Ne=t=>{let{value:e,placeholder:o,showValue:l,valueIcon:i,valueIconName:c,...u}=t;return kt("span",{...u,className:a(t.className,he,N(he,t)),children:[i,!i&&c&&we(h,{className:"k-input-value-icon",icon:c}),l&&!e&&o,l&&e&&we("span",{className:"k-input-value-text",children:e})]})};Ne.states=It;Ne.options=yt;Ne.className=he;import{jsx as Mt}from"react/jsx-runtime";var ge="k-input-inner",St=[],Tt={},Re={value:"",placeholder:""},F=t=>{let{value:e=Re.value,placeholder:o=Re.placeholder,rows:l,disabled:i,...c}=t;return Mt("textarea",{...c,className:a(t.className,ge,N(ge,t)),placeholder:o,rows:l,defaultValue:e,disabled:i||void 0})};F.states=St;F.options=Tt;F.className=ge;import{Fragment as Ct,jsx as Pe}from"react/jsx-runtime";var _e="k-input-loading-icon",Ot=[r.disabled,r.loading],oe=t=>{let{disabled:e,loading:o}=t;return e||!o?Pe(Ct,{}):Pe("span",{className:a(t.className,_e,"k-icon k-i-loading")})};oe.states=Ot;oe.className=_e;import{Fragment as Lt,jsx as He}from"react/jsx-runtime";var Be="k-input-validation-icon",At=[r.valid,r.invalid,r.disabled,r.loading],Et={},q=t=>{let{valid:e,invalid:o,disabled:l,loading:i}=t,c=o?"warning-circle":"check-circle";return l||i||!!!(e||o)?He(Lt,{}):He(h,{className:a(Be),icon:c})};q.states=At;q.options=Et;q.className=Be;import{Fragment as Rt,jsx as Ke}from"react/jsx-runtime";var zt="k-input-prefix",wt={direction:"horizontal"},ne=t=>{let{direction:e=wt.direction,...o}=t;return t.children?Ke("span",{...o,className:a(zt,t.className,{[`k-input-prefix-${e}`]:e}),children:t.children}):Ke(Rt,{})};import{Fragment as Ht,jsx as Ve}from"react/jsx-runtime";var Pt="k-input-suffix",_t={direction:"horizontal"},ae=t=>{let{direction:e=_t.direction,...o}=t;return t.children?Ve("span",{...o,className:a(Pt,t.className,{[`k-input-suffix-${e}`]:e}),children:t.children}):Ve(Ht,{})};import{jsx as xn}from"react/jsx-runtime";import{jsx as gn}from"react/jsx-runtime";import{jsx as Kt}from"react/jsx-runtime";var $e="k-input-separator",Bt={direction:"vertical"},w=t=>{let{direction:e=Bt.direction,...o}=t;return Kt("span",{...o,className:a($e,t.className,{[`${$e}-${e}`]:e})})};var ve="button",Ue=ve;import{Fragment as De,jsx as R,jsxs as Fe}from"react/jsx-runtime";var G="k-button",Vt=["icon-button"],$t=[r.hover,r.focus,r.active,r.selected,r.disabled,r.generating],Ut={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[p.undefined,p.none,p.small,p.medium,p.large,p.full],fillMode:[m.undefined,m.solid,m.flat,m.outline,m.clear,m.link],themeColor:[s.undefined,s.base,s.primary,s.secondary,s.tertiary,s.success,s.warning,s.error,s.info,s.inverse]},Ie={showArrow:!1,arrowIconName:"chevron-down"},T=t=>{let{as:e="button",size:o,rounded:l,fillMode:i,themeColor:c,showArrow:u=Ie.showArrow,arrowIconName:d=Ie.arrowIconName,variant:f,hover:b,focus:x,active:I,selected:y,disabled:A,togglable:H,ariaDisabled:O,icon:g,iconSize:k,text:E,iconClassName:J,className:re,...ie}=t,se=g!=null,le=t.children!==void 0;return Fe(e,{className:a(re,G,Se(G,f),N(G,{size:o,rounded:l,fillMode:i,themeColor:c}),L(G,{hover:b,focus:x,active:I,disabled:A||O,selected:y}),{"k-icon-button":!E&&!le&&se}),"aria-pressed":H?y?"true":"false":void 0,...ie,"aria-disabled":O?"true":void 0,disabled:A||void 0,children:[typeof g=="string"&&g&&R(h,{className:a(J,"k-button-icon"),icon:g,size:k}),g&&typeof g!="string"&&R(De,{children:g}),E?Fe(De,{children:[E&&R("span",{className:"k-button-text",children:E}),t.children]}):t.children&&R("span",{className:"k-button-text",children:t.children}),u&&R("span",{className:"k-menu-button-arrow k-button-arrow",children:R(h,{icon:d})})]})};T.states=$t;T.options=Ut;T.variants=Vt;T.className=G;T.defaultOptions=Ie;T.moduleName=ve;T.folderName=Ue;T.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 Dt}from"react/jsx-runtime";var qe=t=>Dt(T,{children:"Button",...t});import{Fragment as Ge,jsx as M,jsxs as ye}from"react/jsx-runtime";var Ft=v.states,qt=v.defaultOptions,Gt=v.options,Xt=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"},{name:"validation-icon",title:"Validation Icon"},{name:"separators",title:"Separators"}],Jt=[],P=t=>{let{modifiers:e,valid:o,invalid:l,loading:i,disabled:c,readonly:u,...d}=t,f=e?.prefix,b=e?.suffix,x=e?.["clear-button"],I=e?.["validation-icon"],y=e?.separators;return ye(v,{...d,valid:o,invalid:l,loading:i,disabled:c,readonly:u,style:{width:300},children:[f&&ye(Ge,{children:[M(ne,{children:M(h,{icon:"lock"})}),y&&M(w,{})]}),M(D,{placeholder:"Placeholder",value:"Value"}),I&&M(q,{valid:o,invalid:l,loading:i,disabled:c}),M(oe,{loading:i,disabled:c}),x&&M(U,{loading:i,disabled:c,readonly:u,value:"Value"}),b&&ye(Ge,{children:[y&&M(w,{}),M(ae,{children:M(qe,{size:d.size,fillMode:"clear",children:"Send"})})]})]})};P.options=Gt;P.states=Ft;P.variants=Jt;P.defaultOptions=qt;P.modifiers=Xt;P.className=v.className;import{Fragment as Xe,jsx as X,jsxs as ke}from"react/jsx-runtime";var Je="k-textarea",Wt=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled],Qt={size:[n.undefined,n.small,n.medium,n.large],rounded:[p.undefined,p.none,p.small,p.medium,p.large,p.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},_={flow:"vertical",affixesOrientation:"horizontal",resize:"both",prefixSeparator:!0,suffixSeparator:!0},C=t=>{let{size:e,rounded:o,fillMode:l,prefixSeparator:i=_.prefixSeparator,suffixSeparator:c=_.prefixSeparator,affixesOrientation:u=_.affixesOrientation,flow:d=_.flow,resize:f=_.resize,prefix:b,suffix:x,rows:I,value:y,placeholder:A,hover:H,focus:O,valid:g,invalid:k,required:E,disabled:J,id:re,"aria-label":ie,"aria-describedby":se,...le}=t;return ke(v,{...le,size:e,rounded:o,fillMode:l,hover:H,focus:O,valid:g,invalid:k,required:E,disabled:J,className:a(t.className,Je,{"!k-flex-col":d==="vertical","!k-flex-row":d==="horizontal"}),children:[b&&ke(Xe,{children:[X(ne,{className:a({"!k-align-items-start":d===u}),direction:u,children:b}),i&&X(w,{direction:d==="horizontal"?"vertical":"horizontal"})]}),X(F,{className:a("!k-overflow-auto",{"!k-flex-none":d==="vertical","k-resize-x":f==="x","k-resize-y":f==="y","k-resize":f==="both","k-resize-none":f==="none"}),value:y,placeholder:A,rows:I,disabled:J,id:re,"aria-label":ie,"aria-describedby":se,"aria-invalid":k?"true":void 0}),x&&ke(Xe,{children:[c&&X(w,{direction:d==="horizontal"?"vertical":"horizontal"}),X(ae,{className:a({"!k-align-items-start":d===u}),direction:u,children:x})]})]})};C.states=Wt;C.options=Qt;C.className=Je;C.defaultOptions=_;C.moduleName=de;C.folderName=Te;C.ariaSpec={selector:".k-textarea",rules:[{selector:".k-textarea > .k-input-inner",attribute:"role=textbox or nodeName=textarea",usage:"Describes the role of the component."},{selector:".k-textarea > .k-input-inner",attribute:"label for or aria-label or aria-labelledby (when has accessible name)",usage:"The textarea requires an accessible name (provided by consuming app)."},{selector:".k-textarea > .k-input-inner",attribute:"aria-multiline=true (when role=textbox)",usage:"Required on role=textbox to indicate multi-line behavior. Implicit on native <textarea>, so not needed there."},{selector:".k-textarea > .k-input-inner",attribute:"aria-invalid=true (when invalid)",usage:"Rendered only when the TextArea is in a form and announces the invalid state."},{selector:".k-textarea > .k-input-inner",attribute:"aria-describedby (when has hint or error)",usage:"Points to the hint or error message for the textarea."},{selector:".k-textarea.k-disabled > .k-input-inner",attribute:"disabled=disabled or aria-disabled=true",usage:"Rendered only when the TextArea is disabled."}]};var ua=C;export{Je as TEXTAREA_CLASSNAME,C as Textarea,ua as default};