UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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