UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 15.3 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 g=(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"}),B=(t,e)=>{let{valid:o,invalid:l,hover:s,focus:d,checked:p,active:u,selected:h,disabled:N,indeterminate:f,loading:y,empty:I,readonly:O,highlighted:D,...k}=e;return i({"k-valid":o,"k-invalid":l,"k-hover":s,"k-focus":d,"k-checked":p,"k-active":u,"k-selected":h,"k-disabled":N,"k-indeterminate":f&&!p,"k-loading":y,"k-empty":I,"k-readonly":O,"k-highlighted":D},Object.keys(k).reduce((x,M)=>(M.startsWith("k-")?x[M]=k[M]:x[`k-${M}`]=k[M],x),{}))};function Ie(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"},S={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 ye="masked-textbox",ke="maskedtextbox";var $="input",G=$;import{jsx as Ze}from"react/jsx-runtime";var J="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={},v=t=>{let{hover:e,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u,size:h,rounded:N,fillMode:f,...y}=t;return Ze("span",{...y,className:i(t.className,J,g(J,{size:h,rounded:N,fillMode:f}),B(J,{hover:e,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u}))})};v.states=We;v.options=Qe;v.className=J;v.defaultOptions=Ye;v.moduleName=$;v.folderName=G;import{jsx as ot}from"react/jsx-runtime";var W="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={},R=t=>{let{hover:e,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u,size:h,rounded:N,fillMode:f,...y}=t;return ot("span",{...y,className:i(t.className,W,g(W,{size:h,rounded:N,fillMode:f}),B(W,{hover:e,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u})),children:t.children})};R.states=je;R.options=et;R.className=W;R.defaultOptions=tt;R.moduleName=$;R.folderName=G;import{Fragment as it,jsx as Me}from"react/jsx-runtime";var se="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={},U=t=>{let{size:e,themeColor:o,icon:l,rotate:s,flip:d,...p}=t;return l?Me("span",{...p,className:i(t.className,se,g(se,{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,{})};U.states=nt;U.options=at;U.className=se;U.defaultOptions=st;var Se=U;import{Fragment as dt,jsx as Q}from"react/jsx-runtime";var ie="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:[S.outline,S.solid,S.duotone]},re={viewBox:"0 0 24 24",variant:S.outline},F=t=>{let{size:e,themeColor:o,rotate:l,flip:s,viewBox:d=re.viewBox,variant:p=re.variant,icon:u,...h}=t;if(!u)return Q(dt,{});if(u==="none")return Q("span",{...h,className:i(t.className,ie,g("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let N=typeof u=="object"&&u.name&&u.name,f=typeof u=="object"?p&&u.variants?.[p]||u.variants?.outline||u.content:void 0;return Q("span",{...h,className:i(t.className,ie,g("k-icon",{size:e}),{[`k-svg-i-${N}`]:N,[`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:Q("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=ie;F.defaultOptions=re;var le=F;import*as de from"@progress/kendo-svg-icons";var Te="icon",Ce="icons";import{useContext as ct}from"react";import{createContext as ut}from"react";var Oe=ut({iconsType:"svg"});import{Fragment as Ee,jsx as X}from"react/jsx-runtime";var Y="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:[S.outline,S.solid,S.duotone]},Z={viewBox:"0 0 24 24",type:"svg",variant:S.outline},b=t=>{let{iconsType:e}=ct(Oe),{size:o,themeColor:l,icon:s,type:d=e||Z.type,rotate:p,flip:u,viewBox:h=Z.viewBox,variant:N=Z.variant,...f}=t;if(!s)return X(Ee,{});if((e||d)==="svg"){if(s==="none")return X(le,{...f,className:i(t.className,Y),icon:s,size:o,variant:N});let I=de[s]?s:pt(`${s}-icon`);return de[I]?X(le,{...f,className:i(t.className,Y),icon:de[I],size:o,themeColor:l,rotate:p,flip:u,viewBox:h,variant:N}):X(Ee,{})}return X(Se,{...f,className:i(t.className,Y),icon:s,size:o,themeColor:l,rotate:p,flip:u})};b.states=mt;b.options=ft;b.defaultOptions=Z;b.className=Y;b.moduleName=Te;b.folderName=Ce;b.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 ue}from"react/jsx-runtime";var Le="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?ue(ht,{}):ue("span",{className:i(t.className,Le),children:ue(b,{icon:"x"})})};A.states=xt;A.options=bt;A.className=Le;import{jsx as vt}from"react/jsx-runtime";var ce="k-input-inner",Nt=[],gt={},j={type:"text",autocomplete:"off",value:"",placeholder:""},w=t=>{let{value:e=j.value,type:o=j.type,placeholder:l=j.placeholder,autocomplete:s=j.autocomplete,disabled:d,readOnly:p,...u}=t;return vt("input",{...u,type:o,className:i(t.className,ce,g(ce,t)),placeholder:l,autoComplete:s,defaultValue:e,disabled:d||void 0,readOnly:p||void 0})};w.states=Nt;w.options=gt;w.className=ce;import{jsx as Ae,jsxs as kt}from"react/jsx-runtime";var pe="k-input-inner",It=[],yt={},me=t=>{let{value:e,placeholder:o,showValue:l,valueIcon:s,valueIconName:d,...p}=t;return kt("span",{...p,className:i(t.className,pe,g(pe,t)),children:[s,!s&&d&&Ae(b,{className:"k-input-value-icon",icon:d}),l&&!e&&o,l&&e&&Ae("span",{className:"k-input-value-text",children:e})]})};me.states=It;me.options=yt;me.className=pe;import{jsx as Tt}from"react/jsx-runtime";var fe="k-input-inner",Mt=[],St={},we={value:"",placeholder:""},xe=t=>{let{value:e=we.value,placeholder:o=we.placeholder,rows:l,disabled:s,...d}=t;return Tt("textarea",{...d,className:i(t.className,fe,g(fe,t)),placeholder:o,rows:l,defaultValue:e,disabled:s||void 0})};xe.states=Mt;xe.options=St;xe.className=fe;import{Fragment as Ot,jsx as ze}from"react/jsx-runtime";var Pe="k-input-loading-icon",Ct=[a.disabled,a.loading],_=t=>{let{disabled:e,loading:o}=t;return e||!o?ze(Ot,{}):ze("span",{className:i(t.className,Pe,"k-icon k-i-loading")})};_.states=Ct;_.className=Pe;import{Fragment as At,jsx as Be}from"react/jsx-runtime";var Re="k-input-validation-icon",Et=[a.valid,a.invalid,a.disabled,a.loading],Lt={},z=t=>{let{valid:e,invalid:o,disabled:l,loading:s}=t,d=o?"warning-circle":"check-circle";return l||s||!!!(e||o)?Be(At,{}):Be(b,{className:i(Re),icon:d})};z.states=Et;z.options=Lt;z.className=Re;import{Fragment as Pt,jsx as _e}from"react/jsx-runtime";var wt="k-input-prefix",zt={direction:"horizontal"},ee=t=>{let{direction:e=zt.direction,...o}=t;return t.children?_e("span",{...o,className:i(wt,t.className,{[`k-input-prefix-${e}`]:e}),children:t.children}):_e(Pt,{})};import{Fragment as _t,jsx as He}from"react/jsx-runtime";var Bt="k-input-suffix",Rt={direction:"horizontal"},te=t=>{let{direction:e=Rt.direction,...o}=t;return t.children?He("span",{...o,className:i(Bt,t.className,{[`k-input-suffix-${e}`]:e}),children:t.children}):He(_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 Ke="k-input-separator",Ht={direction:"vertical"},H=t=>{let{direction:e=Ht.direction,...o}=t;return Kt("span",{...o,className:i(Ke,t.className,{[`${Ke}-${e}`]:e})})};var be="button",Ve=be;import{Fragment as De,jsx as K,jsxs as $e}from"react/jsx-runtime";var q="k-button",Vt=["icon-button"],Dt=[a.hover,a.focus,a.active,a.selected,a.disabled,a.generating],$t={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]},he={showArrow:!1,arrowIconName:"chevron-down"},T=t=>{let{as:e="button",size:o,rounded:l,fillMode:s,themeColor:d,showArrow:p=he.showArrow,arrowIconName:u=he.arrowIconName,variant:h,hover:N,focus:f,active:y,selected:I,disabled:O,togglable:D,ariaDisabled:k,icon:x,iconSize:M,text:P,iconClassName:oe,className:ne,...ae}=t,Ge=x!=null,Je=t.children!==void 0;return $e(e,{className:i(ne,q,Ie(q,h),g(q,{size:o,rounded:l,fillMode:s,themeColor:d}),B(q,{hover:N,focus:f,active:y,disabled:O||k,selected:I}),{"k-icon-button":!P&&!Je&&Ge}),"aria-pressed":D?I?"true":"false":void 0,...ae,"aria-disabled":k?"true":void 0,disabled:O||void 0,children:[typeof x=="string"&&x&&K(b,{className:i(oe,"k-button-icon"),icon:x,size:M}),x&&typeof x!="string"&&K(De,{children:x}),P?$e(De,{children:[P&&K("span",{className:"k-button-text",children:P}),t.children]}):t.children&&K("span",{className:"k-button-text",children:t.children}),p&&K("span",{className:"k-menu-button-arrow k-button-arrow",children:K(b,{icon:u})})]})};T.states=Dt;T.options=$t;T.variants=Vt;T.className=q;T.defaultOptions=he;T.moduleName=be;T.folderName=Ve;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 Ut}from"react/jsx-runtime";var Ue=t=>Ut(T,{children:"Button",...t});import{Fragment as Fe,jsx as C,jsxs as Ne}from"react/jsx-runtime";var Ft=v.states,Xt=v.defaultOptions,qt=v.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=[],V=t=>{let{modifiers:e,valid:o,invalid:l,loading:s,disabled:d,readonly:p,...u}=t,h=e?.prefix,N=e?.suffix,f=e?.["clear-button"],y=e?.["validation-icon"],I=e?.separators;return Ne(v,{...u,valid:o,invalid:l,loading:s,disabled:d,readonly:p,style:{width:300},children:[h&&Ne(Fe,{children:[C(ee,{children:C(b,{icon:"lock"})}),I&&C(H,{})]}),C(w,{placeholder:"Placeholder",value:"Value"}),y&&C(z,{valid:o,invalid:l,loading:s,disabled:d}),C(_,{loading:s,disabled:d}),f&&C(A,{loading:s,disabled:d,readonly:p,value:"Value"}),N&&Ne(Fe,{children:[I&&C(H,{}),C(te,{children:C(Ue,{size:u.size,fillMode:"clear",children:"Send"})})]})]})};V.options=qt;V.states=Ft;V.variants=Jt;V.defaultOptions=Xt;V.modifiers=Gt;V.className=v.className;import{Fragment as Xe,jsx as E,jsxs as ge}from"react/jsx-runtime";var qe="k-maskedtextbox",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]},ve={showClearButton:!0,separators:!0},L=t=>{let{size:e,rounded:o,fillMode:l,separators:s=ve.separators,showClearButton:d=ve.showClearButton,prefix:p,suffix:u,value:h,placeholder:N,hover:f,focus:y,valid:I,invalid:O,required:D,loading:k,disabled:x,readonly:M,id:P,"aria-label":oe,"aria-describedby":ne,...ae}=t;return ge(v,{...ae,size:e,rounded:o,fillMode:l,hover:f,focus:y,valid:I,invalid:O,required:D,loading:k,disabled:x,readonly:M,className:i(t.className,qe),children:[p&&ge(Xe,{children:[E(ee,{children:p}),s&&E(H,{})]}),E(w,{id:P,placeholder:N,value:h,disabled:x,"aria-label":oe,"aria-describedby":ne,"aria-invalid":O?"true":void 0}),E(z,{valid:I,invalid:O,loading:k,disabled:x}),E(_,{loading:k,disabled:x}),d&&E(A,{loading:k,disabled:x,readonly:M,value:h}),u&&ge(Xe,{children:[s&&E(H,{}),E(te,{children:u})]})]})};L.states=Wt;L.options=Qt;L.className=qe;L.defaultOptions=ve;L.moduleName=ye;L.folderName=ke;L.ariaSpec={selector:".k-maskedtextbox",rules:[{selector:".k-maskedtextbox > .k-input-inner",attribute:"role=textbox or nodeName=input",usage:"Describes the role of the component."},{selector:".k-maskedtextbox > .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-maskedtextbox > .k-input-inner",attribute:"aria-placeholder (when has mask)",usage:"Announces the mask or placeholder for the component."},{selector:".k-maskedtextbox > .k-input-inner",attribute:"aria-invalid=true (when invalid)",usage:"Rendered when the MaskedTextBox is in an invalid state."},{selector:".k-maskedtextbox > .k-input-inner",attribute:"aria-describedby (when has hint or error)",usage:"Points to the hint or error message."},{selector:".k-maskedtextbox.k-disabled > .k-input-inner",attribute:"disabled=disabled or aria-disabled=true",usage:"Rendered when the MaskedTextBox is disabled."}]};var ca=L;export{qe as MASKEDTEXTBOX_CLASSNAME,L as MaskedTextbox,ca as default};