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