@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 15.9 kB
JavaScript
var a=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?a(...t):typeof t=="object"?Object.keys(t).map((o,l)=>t[l]||t[o]&&o||null).filter(o=>o!==null).join(" "):t).filter(t=>!!t).join(" ");var N=(e,t)=>a({[`${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"}),L=(e,t)=>{let{valid:o,invalid:l,hover:i,focus:c,checked:u,active:d,selected:x,disabled:h,indeterminate:b,loading:I,empty:y,readonly:A,highlighted:H,...O}=t;return a({"k-valid":o,"k-invalid":l,"k-hover":i,"k-focus":c,"k-checked":u,"k-active":d,"k-selected":x,"k-disabled":h,"k-indeterminate":b&&!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 Te(e,t){if(!t)return{};let o=Array.isArray(t)?t:[t];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",Me=de;var B="input",W=B;import{jsx as et}from"react/jsx-runtime";var Q="k-input",Ye=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled,r.loading,r.readonly],Ze={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]},je={},v=e=>{let{hover:t,focus:o,disabled:l,invalid:i,valid:c,loading:u,readonly:d,size:x,rounded:h,fillMode:b,...I}=e;return et("span",{...I,className:a(e.className,Q,N(Q,{size:x,rounded:h,fillMode:b}),L(Q,{hover:t,focus:o,disabled:l,invalid:i,valid:c,loading:u,readonly:d}))})};v.states=Ye;v.options=Ze;v.className=Q;v.defaultOptions=je;v.moduleName=B;v.folderName=W;import{jsx as at}from"react/jsx-runtime";var Y="k-picker",tt=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled,r.loading,r.readonly],ot={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]},nt={},z=e=>{let{hover:t,focus:o,disabled:l,invalid:i,valid:c,loading:u,readonly:d,size:x,rounded:h,fillMode:b,...I}=e;return at("span",{...I,className:a(e.className,Y,N(Y,{size:x,rounded:h,fillMode:b}),L(Y,{hover:t,focus:o,disabled:l,invalid:i,valid:c,loading:u,readonly:d})),children:e.children})};z.states=tt;z.options=ot;z.className=Y;z.defaultOptions=nt;z.moduleName=B;z.folderName=W;import{Fragment as lt,jsx as Oe}from"react/jsx-runtime";var ce="k-font-icon",rt=[],it={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]},st={},K=e=>{let{size:t,themeColor:o,icon:l,rotate:i,flip:c,...u}=e;return l?Oe("span",{...u,className:a(e.className,ce,N(ce,{size:t}),{[`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"}):Oe(lt,{})};K.states=rt;K.options=it;K.className=ce;K.defaultOptions=st;var Ce=K;import{Fragment as ut,jsx as Z}from"react/jsx-runtime";var ue="k-svg-icon",dt=[],ct={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=e=>{let{size:t,themeColor:o,rotate:l,flip:i,viewBox:c=pe.viewBox,variant:u=pe.variant,icon:d,...x}=e;if(!d)return Z(ut,{});if(d==="none")return Z("span",{...x,className:a(e.className,ue,N("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let h=typeof d=="object"&&d.name&&d.name,b=typeof d=="object"?u&&d.variants?.[u]||d.variants?.outline||d.content:void 0;return Z("span",{...x,className:a(e.className,ue,N("k-icon",{size:t}),{[`k-svg-i-${h}`]:h,[`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:b!==void 0?{__html:b}:void 0,children:d?void 0:e.children})})};V.states=dt;V.options=ct;V.className=ue;V.defaultOptions=pe;var me=V;import*as fe from"@progress/kendo-svg-icons";var Ae="icon",Ee="icons";import{useContext as mt}from"react";import{createContext as pt}from"react";var Le=pt({iconsType:"svg"});import{Fragment as ze,jsx as $}from"react/jsx-runtime";var j="k-icon",ft=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),xt=[],bt={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},f=e=>{let{iconsType:t}=mt(Le),{size:o,themeColor:l,icon:i,type:c=t||ee.type,rotate:u,flip:d,viewBox:x=ee.viewBox,variant:h=ee.variant,...b}=e;if(!i)return $(ze,{});if((t||c)==="svg"){if(i==="none")return $(me,{...b,className:a(e.className,j),icon:i,size:o,variant:h});let y=fe[i]?i:ft(`${i}-icon`);return fe[y]?$(me,{...b,className:a(e.className,j),icon:fe[y],size:o,themeColor:l,rotate:u,flip:d,viewBox:x,variant:h}):$(ze,{})}return $(Ce,{...b,className:a(e.className,j),icon:i,size:o,themeColor:l,rotate:u,flip:d})};f.states=xt;f.options=bt;f.defaultOptions=ee;f.className=j;f.moduleName=Ae;f.folderName=Ee;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 gt,jsx as xe}from"react/jsx-runtime";var we="k-clear-value",ht=[r.disabled,r.loading,r.readonly],Nt={},U=e=>{let{disabled:t,loading:o,readonly:l,value:i}=e;return t||l||o||!i?xe(gt,{}):xe("span",{className:a(e.className,we),children:xe(f,{icon:"x"})})};U.states=ht;U.options=Nt;U.className=we;import{jsx as yt}from"react/jsx-runtime";var be="k-input-inner",vt=[],It={},te={type:"text",autocomplete:"off",value:"",placeholder:""},D=e=>{let{value:t=te.value,type:o=te.type,placeholder:l=te.placeholder,autocomplete:i=te.autocomplete,disabled:c,readOnly:u,...d}=e;return yt("input",{...d,type:o,className:a(e.className,be,N(be,e)),placeholder:l,autoComplete:i,defaultValue:t,disabled:c||void 0,readOnly:u||void 0})};D.states=vt;D.options=It;D.className=be;import{jsx as Re,jsxs as Tt}from"react/jsx-runtime";var he="k-input-inner",kt=[],St={},Ne=e=>{let{value:t,placeholder:o,showValue:l,valueIcon:i,valueIconName:c,...u}=e;return Tt("span",{...u,className:a(e.className,he,N(he,e)),children:[i,!i&&c&&Re(f,{className:"k-input-value-icon",icon:c}),l&&!t&&o,l&&t&&Re("span",{className:"k-input-value-text",children:t})]})};Ne.states=kt;Ne.options=St;Ne.className=he;import{jsx as Ct}from"react/jsx-runtime";var ge="k-input-inner",Mt=[],Ot={},Pe={value:"",placeholder:""},F=e=>{let{value:t=Pe.value,placeholder:o=Pe.placeholder,rows:l,disabled:i,...c}=e;return Ct("textarea",{...c,className:a(e.className,ge,N(ge,e)),placeholder:o,rows:l,defaultValue:t,disabled:i||void 0})};F.states=Mt;F.options=Ot;F.className=ge;import{Fragment as Et,jsx as _e}from"react/jsx-runtime";var He="k-input-loading-icon",At=[r.disabled,r.loading],oe=e=>{let{disabled:t,loading:o}=e;return t||!o?_e(Et,{}):_e("span",{className:a(e.className,He,"k-icon k-i-loading")})};oe.states=At;oe.className=He;import{Fragment as wt,jsx as Be}from"react/jsx-runtime";var Ke="k-input-validation-icon",Lt=[r.valid,r.invalid,r.disabled,r.loading],zt={},q=e=>{let{valid:t,invalid:o,disabled:l,loading:i}=e,c=o?"warning-circle":"check-circle";return l||i||!!!(t||o)?Be(wt,{}):Be(f,{className:a(Ke),icon:c})};q.states=Lt;q.options=zt;q.className=Ke;import{Fragment as _t,jsx as Ve}from"react/jsx-runtime";var Rt="k-input-prefix",Pt={direction:"horizontal"},ne=e=>{let{direction:t=Pt.direction,...o}=e;return e.children?Ve("span",{...o,className:a(Rt,e.className,{[`k-input-prefix-${t}`]:t}),children:e.children}):Ve(_t,{})};import{Fragment as Kt,jsx as $e}from"react/jsx-runtime";var Ht="k-input-suffix",Bt={direction:"horizontal"},ae=e=>{let{direction:t=Bt.direction,...o}=e;return e.children?$e("span",{...o,className:a(Ht,e.className,{[`k-input-suffix-${t}`]:t}),children:e.children}):$e(Kt,{})};import{jsx as Nn}from"react/jsx-runtime";import{jsx as yn}from"react/jsx-runtime";import{jsx as $t}from"react/jsx-runtime";var Ue="k-input-separator",Vt={direction:"vertical"},w=e=>{let{direction:t=Vt.direction,...o}=e;return $t("span",{...o,className:a(Ue,e.className,{[`${Ue}-${t}`]:t})})};var ve="button",De=ve;import{Fragment as Fe,jsx as R,jsxs as qe}from"react/jsx-runtime";var G="k-button",Ut=["icon-button"],Dt=[r.hover,r.focus,r.active,r.selected,r.disabled,r.generating],Ft={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=e=>{let{as:t="button",size:o,rounded:l,fillMode:i,themeColor:c,showArrow:u=Ie.showArrow,arrowIconName:d=Ie.arrowIconName,variant:x,hover:h,focus:b,active:I,selected:y,disabled:A,togglable:H,ariaDisabled:O,icon:g,iconSize:k,text:E,iconClassName:J,className:re,...ie}=e,se=g!=null,le=e.children!==void 0;return qe(t,{className:a(re,G,Te(G,x),N(G,{size:o,rounded:l,fillMode:i,themeColor:c}),L(G,{hover:h,focus:b,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(f,{className:a(J,"k-button-icon"),icon:g,size:k}),g&&typeof g!="string"&&R(Fe,{children:g}),E?qe(Fe,{children:[E&&R("span",{className:"k-button-text",children:E}),e.children]}):e.children&&R("span",{className:"k-button-text",children:e.children}),u&&R("span",{className:"k-menu-button-arrow k-button-arrow",children:R(f,{icon:d})})]})};T.states=Dt;T.options=Ft;T.variants=Ut;T.className=G;T.defaultOptions=Ie;T.moduleName=ve;T.folderName=De;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 qt}from"react/jsx-runtime";var Ge=e=>qt(T,{children:"Button",...e});import{Fragment as Xe,jsx as M,jsxs as ye}from"react/jsx-runtime";var Gt=v.states,Xt=v.defaultOptions,Jt=v.options,Wt=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"},{name:"validation-icon",title:"Validation Icon"},{name:"separators",title:"Separators"}],Qt=[],P=e=>{let{modifiers:t,valid:o,invalid:l,loading:i,disabled:c,readonly:u,...d}=e,x=t?.prefix,h=t?.suffix,b=t?.["clear-button"],I=t?.["validation-icon"],y=t?.separators;return ye(v,{...d,valid:o,invalid:l,loading:i,disabled:c,readonly:u,style:{width:300},children:[x&&ye(Xe,{children:[M(ne,{children:M(f,{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}),b&&M(U,{loading:i,disabled:c,readonly:u,value:"Value"}),h&&ye(Xe,{children:[y&&M(w,{}),M(ae,{children:M(Ge,{size:d.size,fillMode:"clear",children:"Send"})})]})]})};P.options=Jt;P.states=Gt;P.variants=Qt;P.defaultOptions=Xt;P.modifiers=Wt;P.className=v.className;import{Fragment as Je,jsx as X,jsxs as ke}from"react/jsx-runtime";var We="k-textarea",Yt=[r.hover,r.focus,r.valid,r.invalid,r.required,r.disabled],Zt={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=e=>{let{size:t,rounded:o,fillMode:l,prefixSeparator:i=_.prefixSeparator,suffixSeparator:c=_.prefixSeparator,affixesOrientation:u=_.affixesOrientation,flow:d=_.flow,resize:x=_.resize,prefix:h,suffix:b,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}=e;return ke(v,{...le,size:t,rounded:o,fillMode:l,hover:H,focus:O,valid:g,invalid:k,required:E,disabled:J,className:a(e.className,We,{"!k-flex-col":d==="vertical","!k-flex-row":d==="horizontal"}),children:[h&&ke(Je,{children:[X(ne,{className:a({"!k-align-items-start":d===u}),direction:u,children:h}),i&&X(w,{direction:d==="horizontal"?"vertical":"horizontal"})]}),X(F,{className:a("!k-overflow-auto",{"!k-flex-none":d==="vertical","k-resize-x":x==="x","k-resize-y":x==="y","k-resize":x==="both","k-resize-none":x==="none"}),value:y,placeholder:A,rows:I,disabled:J,id:re,"aria-label":ie,"aria-describedby":se,"aria-invalid":k?"true":void 0}),b&&ke(Je,{children:[c&&X(w,{direction:d==="horizontal"?"vertical":"horizontal"}),X(ae,{className:a({"!k-align-items-start":d===u}),direction:u,children:b})]})]})};C.states=Yt;C.options=Zt;C.className=We;C.defaultOptions=_;C.moduleName=de;C.folderName=Me;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 Qe=C;import{Fragment as jt,jsx as Se}from"react/jsx-runtime";var Na=e=>Se(Qe,{prefix:Se(jt,{children:Se(f,{icon:"comment"})}),...e});export{Na as TextareaPrefix};