@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 9.38 kB
JavaScript
var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...e):typeof e=="object"?Object.keys(e).map((a,l)=>e[l]||e[a]&&a||null).filter(a=>a!==null).join(" "):e).filter(e=>!!e).join(" ");var k=(t,e)=>d({[`${t}-xs`]:e.size==="xsmall",[`${t}-sm`]:e.size==="small",[`${t}-md`]:e.size==="medium",[`${t}-lg`]:e.size==="large",[`${t}-xl`]:e.size==="xlarge",[`${t}-xxl`]:e.size==="xxlarge",[`${t}-xxxl`]:e.size==="xxxlarge"},{[`${t}-${e.fillMode}`]:e.fillMode},{[`${t}-${e.themeColor}`]:e.themeColor},{"k-rounded-sm":e.rounded==="small","k-rounded-md":e.rounded==="medium","k-rounded-lg":e.rounded==="large","k-rounded-full":e.rounded==="full","k-rounded-none":e.rounded==="none"}),K=(t,e)=>{let{valid:a,invalid:l,hover:s,focus:c,checked:u,active:r,selected:b,disabled:h,indeterminate:f,loading:E,empty:y,readonly:L,highlighted:P,...B}=e;return d({"k-valid":a,"k-invalid":l,"k-hover":s,"k-focus":c,"k-checked":u,"k-active":r,"k-selected":b,"k-disabled":h,"k-indeterminate":f&&!u,"k-loading":E,"k-empty":y,"k-readonly":L,"k-highlighted":P},Object.keys(B).reduce((p,N)=>(N.startsWith("k-")?p[N]=B[N]:p[`k-${N}`]=B[N],p),{}))};function X(t,e){if(!e)return{};let a=Array.isArray(e)?e:[e];return Object.fromEntries(a.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"},I={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},x={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},o={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},g={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"};import{Fragment as ve,jsx as Y}from"react/jsx-runtime";var F="k-font-icon",he=[],ge={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info]},be={},S=t=>{let{size:e,themeColor:a,icon:l,rotate:s,flip:c,...u}=t;return l?Y("span",{...u,className:d(t.className,F,k(F,{size:e}),{[`k-i-${l}`]:l,[`k-color-${a}`]:a,[`k-rotate-${s}`]:s,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):Y(ve,{})};S.states=he;S.options=ge;S.className=F;S.defaultOptions=be;var ee=S;import{Fragment as ke,jsx as R}from"react/jsx-runtime";var H="k-svg-icon",ye=[],Ne={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[x.outline,x.solid,x.duotone]},V={viewBox:"0 0 24 24",variant:x.outline},z=t=>{let{size:e,themeColor:a,rotate:l,flip:s,viewBox:c=V.viewBox,variant:u=V.variant,icon:r,...b}=t;if(!r)return R(ke,{});if(r==="none")return R("span",{...b,className:d(t.className,H,k("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let h=typeof r=="object"&&r.name&&r.name,f=typeof r=="object"?u&&r.variants?.[u]||r.variants?.outline||r.content:void 0;return R("span",{...b,className:d(t.className,H,k("k-icon",{size:e}),{[`k-svg-i-${h}`]:h,[`k-color-${a}`]:a,[`k-rotate-${l}`]:l,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:R("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof r=="object"?r.viewBox:c,dangerouslySetInnerHTML:f!==void 0?{__html:f}:void 0,children:r?void 0:t.children})})};z.states=ye;z.options=Ne;z.className=H;z.defaultOptions=V;var G=z;import*as q from"@progress/kendo-svg-icons";var te="icon",oe="icons";import{useContext as Ie}from"react";import{createContext as Ce}from"react";var ne=Ce({iconsType:"svg"});import{Fragment as ae,jsx as w}from"react/jsx-runtime";var D="k-icon",Be=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Te=[],Oe={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[x.outline,x.solid,x.duotone]},$={viewBox:"0 0 24 24",type:"svg",variant:x.outline},m=t=>{let{iconsType:e}=Ie(ne),{size:a,themeColor:l,icon:s,type:c=e||$.type,rotate:u,flip:r,viewBox:b=$.viewBox,variant:h=$.variant,...f}=t;if(!s)return w(ae,{});if((e||c)==="svg"){if(s==="none")return w(G,{...f,className:d(t.className,D),icon:s,size:a,variant:h});let y=q[s]?s:Be(`${s}-icon`);return q[y]?w(G,{...f,className:d(t.className,D),icon:q[y],size:a,themeColor:l,rotate:u,flip:r,viewBox:b,variant:h}):w(ae,{})}return w(ee,{...f,className:d(t.className,D),icon:s,size:a,themeColor:l,rotate:u,flip:r})};m.states=Te;m.options=Oe;m.defaultOptions=$;m.className=D;m.moduleName=te;m.folderName=oe;m.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."}]};var W="button",re=W;import{Fragment as se,jsx as T,jsxs as ie}from"react/jsx-runtime";var M="k-button",Se=["icon-button"],ze=[g.hover,g.focus,g.active,g.selected,g.disabled,g.generating],we={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:[I.undefined,I.solid,I.flat,I.outline,I.clear,I.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},Z={showArrow:!1,arrowIconName:"chevron-down"},i=t=>{let{as:e="button",size:a,rounded:l,fillMode:s,themeColor:c,showArrow:u=Z.showArrow,arrowIconName:r=Z.arrowIconName,variant:b,hover:h,focus:f,active:E,selected:y,disabled:L,togglable:P,ariaDisabled:B,icon:p,iconSize:N,text:_,iconClassName:ue,className:me,...pe}=t,fe=p!=null,xe=t.children!==void 0;return ie(e,{className:d(me,M,X(M,b),k(M,{size:a,rounded:l,fillMode:s,themeColor:c}),K(M,{hover:h,focus:f,active:E,disabled:L||B,selected:y}),{"k-icon-button":!_&&!xe&&fe}),"aria-pressed":P?y?"true":"false":void 0,...pe,"aria-disabled":B?"true":void 0,disabled:L||void 0,children:[typeof p=="string"&&p&&T(m,{className:d(ue,"k-button-icon"),icon:p,size:N}),p&&typeof p!="string"&&T(se,{children:p}),_?ie(se,{children:[_&&T("span",{className:"k-button-text",children:_}),t.children]}):t.children&&T("span",{className:"k-button-text",children:t.children}),u&&T("span",{className:"k-menu-button-arrow k-button-arrow",children:T(m,{icon:r})})]})};i.states=ze;i.options=we;i.variants=Se;i.className=M;i.defaultOptions=Z;i.moduleName=W;i.folderName=re;i.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 Me}from"react/jsx-runtime";var le=t=>Me(i,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as Ae}from"react/jsx-runtime";var de=t=>Ae(i,{icon:"folder",children:"Button",...t});import{jsx as Ee}from"react/jsx-runtime";var ce=t=>Ee(i,{children:"Button",...t});import{jsx as j}from"react/jsx-runtime";var Le=i.options,_e=i.states,Ke={...i.defaultOptions,variant:"text"},Re=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],De=[],O=t=>{let{variant:e,...a}=t;switch(e){case"icon-only":return j(le,{...a,icon:"star"});case"icon-and-text":return j(de,{...a,icon:"star",children:"Button"});default:return j(ce,{...a,children:"Button"})}};O.options=Le;O.states=_e;O.variants=Re;O.defaultOptions=Ke;O.modifiers=De;O.className=i.className;import{Fragment as U,jsx as v,jsxs as A}from"react/jsx-runtime";var J="k-upload-dropzone",$e=[g.hover],Q=t=>{let{hover:e,status:a,disabled:l,hasFiles:s,filesId:c,...u}=t,r;switch(a){case"uploading":r=A(U,{children:[v(m,{icon:"upload"}),"Uploading..."]});break;case"done":r=A(U,{children:[v(m,{icon:"check"}),"Done"]});break;case"failed":r=A(U,{children:[v(m,{icon:"exclamation-circle"}),"Done"]});break;default:r=v(U,{});break}return A("div",{...u,className:d(t.className,J,"k-dropzone",K(J,{hover:e})),children:[A("div",{className:"k-upload-button-wrap",children:[v(i,{className:"k-upload-button","aria-disabled":l?"true":"false",...s&&c?{"aria-controls":c}:{},children:"Select files..."}),v("input",{id:"upload-input",className:"k-hidden",tabIndex:-1,"aria-hidden":"true"})]}),v("span",{className:d("k-dropzone-hint",{"k-hidden":a!=="upload"}),children:"Drop files here to upload"}),a!=="upload"&&v("span",{className:"k-upload-status",children:r})]})};Q.states=$e;Q.className=J;var Zt=Q;export{J as UPLOADDROPZONE_CLASSNAME,Q as UploadDropzone,Zt as default};