UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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