UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 17.9 kB
var i=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?i(...t):typeof t=="object"?Object.keys(t).map((o,r)=>t[r]||t[o]&&o||null).filter(o=>o!==null).join(" "):t).filter(t=>!!t).join(" ");var I=(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"}),_=(e,t)=>{let{valid:o,invalid:r,hover:s,focus:d,checked:p,active:u,selected:h,disabled:x,indeterminate:b,loading:T,empty:S,readonly:B,highlighted:A,...C}=t;return i({"k-valid":o,"k-invalid":r,"k-hover":s,"k-focus":d,"k-checked":p,"k-active":u,"k-selected":h,"k-disabled":x,"k-indeterminate":b&&!p,"k-loading":T,"k-empty":S,"k-readonly":B,"k-highlighted":A},Object.keys(C).reduce((g,v)=>(v.startsWith("k-")?g[v]=C[v]:g[`k-${v}`]=C[v],g),{}))};function Ce(e,t){if(!t)return{};let o=Array.isArray(t)?t:[t];return Object.fromEntries(o.map(r=>[`k-${r}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},m={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},c={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},M={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},l={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 F="input",W=F;import{jsx as dt}from"react/jsx-runtime";var Q="k-input",st=[a.hover,a.focus,a.valid,a.invalid,a.required,a.disabled,a.loading,a.readonly],rt={size:[n.undefined,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[c.undefined,c.solid,c.flat,c.outline]},lt={},y=e=>{let{hover:t,focus:o,disabled:r,invalid:s,valid:d,loading:p,readonly:u,size:h,rounded:x,fillMode:b,...T}=e;return dt("span",{...T,className:i(e.className,Q,I(Q,{size:h,rounded:x,fillMode:b}),_(Q,{hover:t,focus:o,disabled:r,invalid:s,valid:d,loading:p,readonly:u}))})};y.states=st;y.options=rt;y.className=Q;y.defaultOptions=lt;y.moduleName=F;y.folderName=W;import{jsx as mt}from"react/jsx-runtime";var Y="k-picker",ut=[a.hover,a.focus,a.valid,a.invalid,a.required,a.disabled,a.loading,a.readonly],ct={size:[n.undefined,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[c.undefined,c.solid,c.flat,c.outline]},pt={},H=e=>{let{hover:t,focus:o,disabled:r,invalid:s,valid:d,loading:p,readonly:u,size:h,rounded:x,fillMode:b,...T}=e;return mt("span",{...T,className:i(e.className,Y,I(Y,{size:h,rounded:x,fillMode:b}),_(Y,{hover:t,focus:o,disabled:r,invalid:s,valid:d,loading:p,readonly:u})),children:e.children})};H.states=ut;H.options=ct;H.className=Y;H.defaultOptions=pt;H.moduleName=F;H.folderName=W;import{Fragment as Nt,jsx as Le}from"react/jsx-runtime";var ue="k-font-icon",ft=[],xt={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[l.undefined,l.base,l.primary,l.secondary,l.tertiary,l.success,l.warning,l.error,l.info]},bt={},X=e=>{let{size:t,themeColor:o,icon:r,rotate:s,flip:d,...p}=e;return r?Le("span",{...p,className:i(e.className,ue,I(ue,{size:t}),{[`k-i-${r}`]:r,[`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"}):Le(Nt,{})};X.states=ft;X.options=xt;X.className=ue;X.defaultOptions=bt;var Ee=X;import{Fragment as It,jsx as Z}from"react/jsx-runtime";var ce="k-svg-icon",ht=[],gt={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[l.undefined,l.base,l.primary,l.secondary,l.tertiary,l.success,l.warning,l.error,l.info],variant:[M.outline,M.solid,M.duotone]},pe={viewBox:"0 0 24 24",variant:M.outline},q=e=>{let{size:t,themeColor:o,rotate:r,flip:s,viewBox:d=pe.viewBox,variant:p=pe.variant,icon:u,...h}=e;if(!u)return Z(It,{});if(u==="none")return Z("span",{...h,className:i(e.className,ce,I("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let x=typeof u=="object"&&u.name&&u.name,b=typeof u=="object"?p&&u.variants?.[p]||u.variants?.outline||u.content:void 0;return Z("span",{...h,className:i(e.className,ce,I("k-icon",{size:t}),{[`k-svg-i-${x}`]:x,[`k-color-${o}`]:o,[`k-rotate-${r}`]:r,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:Z("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof u=="object"?u.viewBox:d,dangerouslySetInnerHTML:b!==void 0?{__html:b}:void 0,children:u?void 0:e.children})})};q.states=ht;q.options=gt;q.className=ce;q.defaultOptions=pe;var me=q;import*as fe from"@progress/kendo-svg-icons";var Be="icon",Ae="icons";import{useContext as yt}from"react";import{createContext as vt}from"react";var we=vt({iconsType:"svg"});import{Fragment as ze,jsx as G}from"react/jsx-runtime";var j="k-icon",Tt=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),St=[],Mt={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[l.undefined,l.base,l.primary,l.secondary,l.tertiary,l.success,l.warning,l.error,l.info],variant:[M.outline,M.solid,M.duotone]},ee={viewBox:"0 0 24 24",type:"svg",variant:M.outline},N=e=>{let{iconsType:t}=yt(we),{size:o,themeColor:r,icon:s,type:d=t||ee.type,rotate:p,flip:u,viewBox:h=ee.viewBox,variant:x=ee.variant,...b}=e;if(!s)return G(ze,{});if((t||d)==="svg"){if(s==="none")return G(me,{...b,className:i(e.className,j),icon:s,size:o,variant:x});let S=fe[s]?s:Tt(`${s}-icon`);return fe[S]?G(me,{...b,className:i(e.className,j),icon:fe[S],size:o,themeColor:r,rotate:p,flip:u,viewBox:h,variant:x}):G(ze,{})}return G(Ee,{...b,className:i(e.className,j),icon:s,size:o,themeColor:r,rotate:p,flip:u})};N.states=St;N.options=Mt;N.defaultOptions=ee;N.className=j;N.moduleName=Be;N.folderName=Ae;N.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 Ct,jsx as xe}from"react/jsx-runtime";var Pe="k-clear-value",kt=[a.disabled,a.loading,a.readonly],Ot={},z=e=>{let{disabled:t,loading:o,readonly:r,value:s}=e;return t||r||o||!s?xe(Ct,{}):xe("span",{className:i(e.className,Pe),children:xe(N,{icon:"x"})})};z.states=kt;z.options=Ot;z.className=Pe;import{jsx as Bt}from"react/jsx-runtime";var be="k-input-inner",Lt=[],Et={},te={type:"text",autocomplete:"off",value:"",placeholder:""},P=e=>{let{value:t=te.value,type:o=te.type,placeholder:r=te.placeholder,autocomplete:s=te.autocomplete,disabled:d,readOnly:p,...u}=e;return Bt("input",{...u,type:o,className:i(e.className,be,I(be,e)),placeholder:r,autoComplete:s,defaultValue:t,disabled:d||void 0,readOnly:p||void 0})};P.states=Lt;P.options=Et;P.className=be;import{jsx as Re,jsxs as zt}from"react/jsx-runtime";var Ne="k-input-inner",At=[],wt={},he=e=>{let{value:t,placeholder:o,showValue:r,valueIcon:s,valueIconName:d,...p}=e;return zt("span",{...p,className:i(e.className,Ne,I(Ne,e)),children:[s,!s&&d&&Re(N,{className:"k-input-value-icon",icon:d}),r&&!t&&o,r&&t&&Re("span",{className:"k-input-value-text",children:t})]})};he.states=At;he.options=wt;he.className=Ne;import{jsx as _t}from"react/jsx-runtime";var ge="k-input-inner",Pt=[],Rt={},_e={value:"",placeholder:""},Ie=e=>{let{value:t=_e.value,placeholder:o=_e.placeholder,rows:r,disabled:s,...d}=e;return _t("textarea",{...d,className:i(e.className,ge,I(ge,e)),placeholder:o,rows:r,defaultValue:t,disabled:s||void 0})};Ie.states=Pt;Ie.options=Rt;Ie.className=ge;import{Fragment as Kt,jsx as He}from"react/jsx-runtime";var Ke="k-input-loading-icon",Ht=[a.disabled,a.loading],K=e=>{let{disabled:t,loading:o}=e;return t||!o?He(Kt,{}):He("span",{className:i(e.className,Ke,"k-icon k-i-loading")})};K.states=Ht;K.className=Ke;import{Fragment as Dt,jsx as Ue}from"react/jsx-runtime";var Ve="k-input-validation-icon",Ut=[a.valid,a.invalid,a.disabled,a.loading],Vt={},R=e=>{let{valid:t,invalid:o,disabled:r,loading:s}=e,d=o?"warning-circle":"check-circle";return r||s||!!!(t||o)?Ue(Dt,{}):Ue(N,{className:i(Ve),icon:d})};R.states=Ut;R.options=Vt;R.className=Ve;import{Fragment as Xt,jsx as De}from"react/jsx-runtime";var $t="k-input-prefix",Ft={direction:"horizontal"},oe=e=>{let{direction:t=Ft.direction,...o}=e;return e.children?De("span",{...o,className:i($t,e.className,{[`k-input-prefix-${t}`]:t}),children:e.children}):De(Xt,{})};import{Fragment as Jt,jsx as $e}from"react/jsx-runtime";var qt="k-input-suffix",Gt={direction:"horizontal"},ne=e=>{let{direction:t=Gt.direction,...o}=e;return e.children?$e("span",{...o,className:i(qt,e.className,{[`k-input-suffix-${t}`]:t}),children:e.children}):$e(Jt,{})};import{jsx as Un}from"react/jsx-runtime";import{jsx as Qt}from"react/jsx-runtime";var Wt="k-input-suffix-text",Fe=e=>{let{children:t,...o}=e;return Qt("span",{...o,className:i(Wt,e.className),children:t})};import{jsx as Zt}from"react/jsx-runtime";var Xe="k-input-separator",Yt={direction:"vertical"},U=e=>{let{direction:t=Yt.direction,...o}=e;return Zt("span",{...o,className:i(Xe,e.className,{[`${Xe}-${t}`]:t})})};var ve="button",qe=ve;import{Fragment as Ge,jsx as V,jsxs as Je}from"react/jsx-runtime";var J="k-button",jt=["icon-button"],eo=[a.hover,a.focus,a.active,a.selected,a.disabled,a.generating],to={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[c.undefined,c.solid,c.flat,c.outline,c.clear,c.link],themeColor:[l.undefined,l.base,l.primary,l.secondary,l.tertiary,l.success,l.warning,l.error,l.info,l.inverse]},ye={showArrow:!1,arrowIconName:"chevron-down"},f=e=>{let{as:t="button",size:o,rounded:r,fillMode:s,themeColor:d,showArrow:p=ye.showArrow,arrowIconName:u=ye.arrowIconName,variant:h,hover:x,focus:b,active:T,selected:S,disabled:B,togglable:A,ariaDisabled:C,icon:g,iconSize:v,text:w,iconClassName:se,className:re,...le}=e,de=g!=null,it=e.children!==void 0;return Je(t,{className:i(re,J,Ce(J,h),I(J,{size:o,rounded:r,fillMode:s,themeColor:d}),_(J,{hover:x,focus:b,active:T,disabled:B||C,selected:S}),{"k-icon-button":!w&&!it&&de}),"aria-pressed":A?S?"true":"false":void 0,...le,"aria-disabled":C?"true":void 0,disabled:B||void 0,children:[typeof g=="string"&&g&&V(N,{className:i(se,"k-button-icon"),icon:g,size:v}),g&&typeof g!="string"&&V(Ge,{children:g}),w?Je(Ge,{children:[w&&V("span",{className:"k-button-text",children:w}),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(N,{icon:u})})]})};f.states=eo;f.options=to;f.variants=jt;f.className=J;f.defaultOptions=ye;f.moduleName=ve;f.folderName=qe;f.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 oo}from"react/jsx-runtime";var ae=e=>oo(f,{children:"Button",...e});import{Fragment as We,jsx as k,jsxs as Te}from"react/jsx-runtime";var no=y.states,ao=y.defaultOptions,io=y.options,so=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"},{name:"validation-icon",title:"Validation Icon"},{name:"separators",title:"Separators"}],ro=[],D=e=>{let{modifiers:t,valid:o,invalid:r,loading:s,disabled:d,readonly:p,...u}=e,h=t?.prefix,x=t?.suffix,b=t?.["clear-button"],T=t?.["validation-icon"],S=t?.separators;return Te(y,{...u,valid:o,invalid:r,loading:s,disabled:d,readonly:p,style:{width:300},children:[h&&Te(We,{children:[k(oe,{children:k(N,{icon:"lock"})}),S&&k(U,{})]}),k(P,{placeholder:"Placeholder",value:"Value"}),T&&k(R,{valid:o,invalid:r,loading:s,disabled:d}),k(K,{loading:s,disabled:d}),b&&k(z,{loading:s,disabled:d,readonly:p,value:"Value"}),x&&Te(We,{children:[S&&k(U,{}),k(ne,{children:k(ae,{size:u.size,fillMode:"clear",children:"Send"})})]})]})};D.options=io;D.states=no;D.variants=ro;D.defaultOptions=ao;D.modifiers=so;D.className=y.className;import{jsx as lo}from"react/jsx-runtime";var Qe=e=>lo(f,{icon:"folder",...e,"aria-label":e["aria-label"]||"Folder",children:void 0});import{jsx as uo}from"react/jsx-runtime";var Ye=e=>uo(f,{icon:"folder",children:"Button",...e});import{jsx as Se}from"react/jsx-runtime";var co=f.options,po=f.states,mo={...f.defaultOptions,variant:"text"},fo=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],xo=[],$=e=>{let{variant:t,...o}=e;switch(t){case"icon-only":return Se(Qe,{...o,icon:"star"});case"icon-and-text":return Se(Ye,{...o,icon:"star",children:"Button"});default:return Se(ae,{...o,children:"Button"})}};$.options=co;$.states=po;$.variants=fo;$.defaultOptions=mo;$.modifiers=xo;$.className=f.className;import{jsx as Ze,jsxs as Io}from"react/jsx-runtime";var je="k-spin-button",ho=[],go={size:[n.undefined,n.small,n.medium,n.large],fillMode:[c.undefined,c.solid,c.flat,c.outline,c.clear,c.link]},Me={increaseLabel:"Increase value",decreaseLabel:"Decrease value"},L=e=>{let{size:t,fillMode:o,disabled:r,increaseLabel:s=Me.increaseLabel,decreaseLabel:d=Me.decreaseLabel,...p}=e;return Io("span",{...p,className:i(je,e.className),children:[Ze(f,{className:"k-spinner-increase",icon:"chevron-up",size:t,fillMode:o,disabled:r,"aria-label":s}),Ze(f,{className:"k-spinner-decrease",icon:"chevron-down",size:t,fillMode:o,disabled:r,"aria-label":d})]})};L.states=ho;L.options=go;L.className=je;L.defaultOptions=Me;L.moduleName=null;L.folderName=null;var et="numeric-textbox",tt="numerictextbox";import{Fragment as ot,jsx as O,jsxs as ke}from"react/jsx-runtime";var nt="k-numerictextbox",vo=[a.hover,a.focus,a.valid,a.invalid,a.loading,a.required,a.disabled,a.readonly],yo={size:[n.undefined,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[c.undefined,c.solid,c.flat,c.outline]},ie={showSpinButton:!0,showClearButton:!0,separators:!0},E=e=>{let{size:t,rounded:o,fillMode:r,separators:s=ie.separators,showClearButton:d=ie.showClearButton,showSpinButton:p=ie.showSpinButton,prefix:u,suffix:h,value:x,placeholder:b,hover:T,focus:S,valid:B,invalid:A,required:C,loading:g,disabled:v,readonly:w,id:se,"aria-label":re,"aria-describedby":le,...de}=e;return ke(y,{...de,size:t,rounded:o,fillMode:r,hover:T,focus:S,valid:B,invalid:A,required:C,loading:g,disabled:v,readonly:w,className:i(e.className,nt),children:[u&&ke(ot,{children:[O(oe,{children:u}),s&&O(U,{})]}),O(P,{id:se,placeholder:b,value:x,role:"spinbutton",disabled:v,"aria-label":re,"aria-describedby":le,"aria-invalid":A?"true":void 0}),O(R,{valid:B,invalid:A,loading:g,disabled:v}),O(K,{loading:g,disabled:v}),d&&O(z,{loading:g,disabled:v,readonly:w,value:x}),h&&ke(ot,{children:[s&&O(U,{}),O(ne,{children:h})]}),p&&O(L,{className:"k-input-spinner",size:t,fillMode:r,disabled:v})]})};E.states=vo;E.options=yo;E.className=nt;E.defaultOptions=ie;E.moduleName=et;E.folderName=tt;E.ariaSpec={selector:".k-numerictextbox",rules:[{selector:".k-numerictextbox > .k-input-inner",attribute:"role=spinbutton",usage:"Announces the spin button capabilities of the NumericTextBox."},{selector:".k-numerictextbox > .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-numerictextbox > .k-input-inner",attribute:"aria-valuenow (when has value)",usage:"Announces the current value of the component."},{selector:".k-numerictextbox > .k-input-inner",attribute:"aria-valuemin (when has min)",usage:"Announces the minimum allowed value."},{selector:".k-numerictextbox > .k-input-inner",attribute:"aria-valuemax (when has max)",usage:"Announces the maximum allowed value."},{selector:".k-numerictextbox > .k-input-inner",attribute:"aria-invalid=true (when invalid)",usage:"Rendered when the NumericTextBox is in an invalid state."},{selector:".k-numerictextbox > .k-input-inner",attribute:"aria-describedby (when has hint or error)",usage:"Points to the hint or error message."},{selector:".k-numerictextbox.k-disabled > .k-input-inner",attribute:"disabled=disabled or aria-disabled=true",usage:"Rendered when the NumericTextBox is disabled."},{selector:".k-numerictextbox .k-spin-button > .k-button",attribute:"role=button or nodeName=button",usage:"Describes the role of the spin buttons."},{selector:".k-numerictextbox .k-spin-button > .k-button",attribute:"aria-label",usage:"The button element requires discernible text."},{selector:".k-numerictextbox.k-disabled .k-spin-button > .k-button",attribute:"disabled=disabled or aria-disabled=true",usage:"Rendered when the NumericTextBox is disabled."}]};var at=E;import{Fragment as To,jsx as Oe}from"react/jsx-runtime";var fi=e=>Oe(at,{suffix:Oe(To,{children:Oe(Fe,{children:"mm"})}),...e});export{fi as NumericTextboxSuffix};