UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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