@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:f,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":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(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 ye="masked-textbox",ke="maskedtextbox";var $="input",G=$;import{jsx as je}from"react/jsx-runtime";var J="k-input",Qe=[a.hover,a.focus,a.valid,a.invalid,a.required,a.disabled,a.loading,a.readonly],Ye={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]},Ze={},v=e=>{let{hover:t,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u,size:h,rounded:N,fillMode:f,...y}=e;return je("span",{...y,className:i(e.className,J,g(J,{size:h,rounded:N,fillMode:f}),B(J,{hover:t,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u}))})};v.states=Qe;v.options=Ye;v.className=J;v.defaultOptions=Ze;v.moduleName=$;v.folderName=G;import{jsx as nt}from"react/jsx-runtime";var W="k-picker",et=[a.hover,a.focus,a.valid,a.invalid,a.required,a.disabled,a.loading,a.readonly],tt={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]},ot={},R=e=>{let{hover:t,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u,size:h,rounded:N,fillMode:f,...y}=e;return nt("span",{...y,className:i(e.className,W,g(W,{size:h,rounded:N,fillMode:f}),B(W,{hover:t,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u})),children:e.children})};R.states=et;R.options=tt;R.className=W;R.defaultOptions=ot;R.moduleName=$;R.folderName=G;import{Fragment as rt,jsx as Me}from"react/jsx-runtime";var se="k-font-icon",at=[],st={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]},it={},U=e=>{let{size:t,themeColor:o,icon:l,rotate:s,flip:d,...p}=e;return l?Me("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"}):Me(rt,{})};U.states=at;U.options=st;U.className=se;U.defaultOptions=it;var Se=U;import{Fragment as ut,jsx as Q}from"react/jsx-runtime";var ie="k-svg-icon",lt=[],dt={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(ut,{});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,f=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:f!==void 0?{__html:f}:void 0,children:u?void 0:e.children})})};F.states=lt;F.options=dt;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 pt}from"react";import{createContext as ct}from"react";var Oe=ct({iconsType:"svg"});import{Fragment as Ee,jsx as X}from"react/jsx-runtime";var Y="k-icon",mt=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),ft=[],xt={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=e=>{let{iconsType:t}=pt(Oe),{size:o,themeColor:l,icon:s,type:d=t||Z.type,rotate:p,flip:u,viewBox:h=Z.viewBox,variant:N=Z.variant,...f}=e;if(!s)return X(Ee,{});if((t||d)==="svg"){if(s==="none")return X(le,{...f,className:i(e.className,Y),icon:s,size:o,variant:N});let I=de[s]?s:mt(`${s}-icon`);return de[I]?X(le,{...f,className:i(e.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(e.className,Y),icon:s,size:o,themeColor:l,rotate:p,flip:u})};b.states=ft;b.options=xt;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 Nt,jsx as ue}from"react/jsx-runtime";var Le="k-clear-value",bt=[a.disabled,a.loading,a.readonly],ht={},A=e=>{let{disabled:t,loading:o,readonly:l,value:s}=e;return t||l||o||!s?ue(Nt,{}):ue("span",{className:i(e.className,Le),children:ue(b,{icon:"x"})})};A.states=bt;A.options=ht;A.className=Le;import{jsx as It}from"react/jsx-runtime";var ce="k-input-inner",gt=[],vt={},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 It("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=gt;w.options=vt;w.className=ce;import{jsx as Ae,jsxs as Mt}from"react/jsx-runtime";var pe="k-input-inner",yt=[],kt={},me=e=>{let{value:t,placeholder:o,showValue:l,valueIcon:s,valueIconName:d,...p}=e;return Mt("span",{...p,className:i(e.className,pe,g(pe,e)),children:[s,!s&&d&&Ae(b,{className:"k-input-value-icon",icon:d}),l&&!t&&o,l&&t&&Ae("span",{className:"k-input-value-text",children:t})]})};me.states=yt;me.options=kt;me.className=pe;import{jsx as Ct}from"react/jsx-runtime";var fe="k-input-inner",St=[],Tt={},we={value:"",placeholder:""},xe=e=>{let{value:t=we.value,placeholder:o=we.placeholder,rows:l,disabled:s,...d}=e;return Ct("textarea",{...d,className:i(e.className,fe,g(fe,e)),placeholder:o,rows:l,defaultValue:t,disabled:s||void 0})};xe.states=St;xe.options=Tt;xe.className=fe;import{Fragment as Et,jsx as ze}from"react/jsx-runtime";var Pe="k-input-loading-icon",Ot=[a.disabled,a.loading],_=e=>{let{disabled:t,loading:o}=e;return t||!o?ze(Et,{}):ze("span",{className:i(e.className,Pe,"k-icon k-i-loading")})};_.states=Ot;_.className=Pe;import{Fragment as wt,jsx as Be}from"react/jsx-runtime";var Re="k-input-validation-icon",Lt=[a.valid,a.invalid,a.disabled,a.loading],At={},z=e=>{let{valid:t,invalid:o,disabled:l,loading:s}=e,d=o?"warning-circle":"check-circle";return l||s||!!!(t||o)?Be(wt,{}):Be(b,{className:i(Re),icon:d})};z.states=Lt;z.options=At;z.className=Re;import{Fragment as Bt,jsx as _e}from"react/jsx-runtime";var zt="k-input-prefix",Pt={direction:"horizontal"},ee=e=>{let{direction:t=Pt.direction,...o}=e;return e.children?_e("span",{...o,className:i(zt,e.className,{[`k-input-prefix-${t}`]:t}),children:e.children}):_e(Bt,{})};import{Fragment as Ht,jsx as He}from"react/jsx-runtime";var Rt="k-input-suffix",_t={direction:"horizontal"},te=e=>{let{direction:t=_t.direction,...o}=e;return e.children?He("span",{...o,className:i(Rt,e.className,{[`k-input-suffix-${t}`]:t}),children:e.children}):He(Ht,{})};import{jsx as hn}from"react/jsx-runtime";import{jsx as In}from"react/jsx-runtime";import{jsx as Vt}from"react/jsx-runtime";var Ke="k-input-separator",Kt={direction:"vertical"},H=e=>{let{direction:t=Kt.direction,...o}=e;return Vt("span",{...o,className:i(Ke,e.className,{[`${Ke}-${t}`]:t})})};var be="button",Ve=be;import{Fragment as De,jsx as K,jsxs as $e}from"react/jsx-runtime";var q="k-button",Dt=["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]},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:f,active:y,selected:I,disabled:O,togglable:D,ariaDisabled:k,icon:x,iconSize:M,text:P,iconClassName:oe,className:ne,...ae}=e,Je=x!=null,We=e.children!==void 0;return $e(t,{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&&!We&&Je}),"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}),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(b,{icon:u})})]})};T.states=$t;T.options=Ut;T.variants=Dt;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 Ft}from"react/jsx-runtime";var Ue=e=>Ft(T,{children:"Button",...e});import{Fragment as Fe,jsx as C,jsxs as Ne}from"react/jsx-runtime";var Xt=v.states,qt=v.defaultOptions,Gt=v.options,Jt=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"},{name:"validation-icon",title:"Validation Icon"},{name:"separators",title:"Separators"}],Wt=[],V=e=>{let{modifiers:t,valid:o,invalid:l,loading:s,disabled:d,readonly:p,...u}=e,h=t?.prefix,N=t?.suffix,f=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(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=Gt;V.states=Xt;V.variants=Wt;V.defaultOptions=qt;V.modifiers=Jt;V.className=v.className;import{Fragment as Xe,jsx as E,jsxs as ge}from"react/jsx-runtime";var qe="k-maskedtextbox",Qt=[a.hover,a.focus,a.valid,a.invalid,a.required,a.disabled,a.loading,a.readonly],Yt={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:f,focus:y,valid:I,invalid:O,required:D,loading:k,disabled:x,readonly:M,id:P,"aria-label":oe,"aria-describedby":ne,...ae}=e;return ge(v,{...ae,size:t,rounded:o,fillMode:l,hover:f,focus:y,valid:I,invalid:O,required:D,loading:k,disabled:x,readonly:M,className:i(e.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=Qt;L.options=Yt;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 Ge=L;import{jsx as Zt}from"react/jsx-runtime";var ba=e=>Zt(Ge,{"aria-label":e["aria-label"]||"Disabled masked textbox",...e,disabled:!0});export{ba as MaskedTextboxDisabled};