@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 10.3 kB
JavaScript
var a=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?a(...e):typeof e=="object"?Object.keys(e).map((i,d)=>e[d]||e[i]&&i||null).filter(i=>i!==null).join(" "):e).filter(e=>!!e).join(" ");var v=(t,e)=>a({[`${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"}),R=(t,e)=>{let{valid:i,invalid:d,hover:s,focus:c,checked:u,active:l,selected:h,disabled:p,indeterminate:g,loading:E,empty:S,readonly:_,highlighted:D,...M}=e;return a({"k-valid":i,"k-invalid":d,"k-hover":s,"k-focus":c,"k-checked":u,"k-active":l,"k-selected":h,"k-disabled":p,"k-indeterminate":g&&!u,"k-loading":E,"k-empty":S,"k-readonly":_,"k-highlighted":D},Object.keys(M).reduce((x,C)=>(C.startsWith("k-")?x[C]=M[C]:x[`k-${C}`]=M[C],x),{}))};function Y(t,e){if(!e)return{};let i=Array.isArray(e)?e:[e];return Object.fromEntries(i.map(d=>[`k-${d}`,!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"},b={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},N={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"},f={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 ye,jsx as Z}from"react/jsx-runtime";var F="k-font-icon",he=[],ve={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]},Ne={},O=t=>{let{size:e,themeColor:i,icon:d,rotate:s,flip:c,...u}=t;return d?Z("span",{...u,className:a(t.className,F,v(F,{size:e}),{[`k-i-${d}`]:d,[`k-color-${i}`]:i,[`k-rotate-${s}`]:s,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):Z(ye,{})};O.states=he;O.options=ve;O.className=F;O.defaultOptions=Ne;var j=O;import{Fragment as Ce,jsx as K}from"react/jsx-runtime";var P="k-svg-icon",ke=[],Se={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:[N.outline,N.solid,N.duotone]},G={viewBox:"0 0 24 24",variant:N.outline},B=t=>{let{size:e,themeColor:i,rotate:d,flip:s,viewBox:c=G.viewBox,variant:u=G.variant,icon:l,...h}=t;if(!l)return K(Ce,{});if(l==="none")return K("span",{...h,className:a(t.className,P,v("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let p=typeof l=="object"&&l.name&&l.name,g=typeof l=="object"?u&&l.variants?.[u]||l.variants?.outline||l.content:void 0;return K("span",{...h,className:a(t.className,P,v("k-icon",{size:e}),{[`k-svg-i-${p}`]:p,[`k-color-${i}`]:i,[`k-rotate-${d}`]:d,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:K("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof l=="object"?l.viewBox:c,dangerouslySetInnerHTML:g!==void 0?{__html:g}:void 0,children:l?void 0:t.children})})};B.states=ke;B.options=Se;B.className=P;B.defaultOptions=G;var V=B;import*as q from"@progress/kendo-svg-icons";var ee="icon",te="icons";import{useContext as Te}from"react";import{createContext as Me}from"react";var oe=Me({iconsType:"svg"});import{Fragment as ne,jsx as A}from"react/jsx-runtime";var $="k-icon",Ie=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),ze=[],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:[N.outline,N.solid,N.duotone]},U={viewBox:"0 0 24 24",type:"svg",variant:N.outline},y=t=>{let{iconsType:e}=Te(oe),{size:i,themeColor:d,icon:s,type:c=e||U.type,rotate:u,flip:l,viewBox:h=U.viewBox,variant:p=U.variant,...g}=t;if(!s)return A(ne,{});if((e||c)==="svg"){if(s==="none")return A(V,{...g,className:a(t.className,$),icon:s,size:i,variant:p});let S=q[s]?s:Ie(`${s}-icon`);return q[S]?A(V,{...g,className:a(t.className,$),icon:q[S],size:i,themeColor:d,rotate:u,flip:l,viewBox:h,variant:p}):A(ne,{})}return A(j,{...g,className:a(t.className,$),icon:s,size:i,themeColor:d,rotate:u,flip:l})};y.states=ze;y.options=Oe;y.defaultOptions=U;y.className=$;y.moduleName=ee;y.folderName=te;y.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",ie=W;import{Fragment as ae,jsx as T,jsxs as re}from"react/jsx-runtime";var w="k-button",Be=["icon-button"],Ae=[f.hover,f.focus,f.active,f.selected,f.disabled,f.generating],we={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:[b.undefined,b.solid,b.flat,b.outline,b.clear,b.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},J={showArrow:!1,arrowIconName:"chevron-down"},r=t=>{let{as:e="button",size:i,rounded:d,fillMode:s,themeColor:c,showArrow:u=J.showArrow,arrowIconName:l=J.arrowIconName,variant:h,hover:p,focus:g,active:E,selected:S,disabled:_,togglable:D,ariaDisabled:M,icon:x,iconSize:C,text:L,iconClassName:pe,className:fe,...ge}=t,xe=x!=null,be=t.children!==void 0;return re(e,{className:a(fe,w,Y(w,h),v(w,{size:i,rounded:d,fillMode:s,themeColor:c}),R(w,{hover:p,focus:g,active:E,disabled:_||M,selected:S}),{"k-icon-button":!L&&!be&&xe}),"aria-pressed":D?S?"true":"false":void 0,...ge,"aria-disabled":M?"true":void 0,disabled:_||void 0,children:[typeof x=="string"&&x&&T(y,{className:a(pe,"k-button-icon"),icon:x,size:C}),x&&typeof x!="string"&&T(ae,{children:x}),L?re(ae,{children:[L&&T("span",{className:"k-button-text",children:L}),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(y,{icon:l})})]})};r.states=Ae;r.options=we;r.variants=Be;r.className=w;r.defaultOptions=J;r.moduleName=W;r.folderName=ie;r.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 Ee}from"react/jsx-runtime";var se=t=>Ee(r,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as _e}from"react/jsx-runtime";var le=t=>_e(r,{icon:"folder",children:"Button",...t});import{jsx as Le}from"react/jsx-runtime";var de=t=>Le(r,{children:"Button",...t});import{jsx as Q}from"react/jsx-runtime";var Re=r.options,Ke=r.states,$e={...r.defaultOptions,variant:"text"},Ue=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],He=[],I=t=>{let{variant:e,...i}=t;switch(e){case"icon-only":return Q(se,{...i,icon:"star"});case"icon-and-text":return Q(le,{...i,icon:"star",children:"Button"});default:return Q(de,{...i,children:"Button"})}};I.options=Re;I.states=Ke;I.variants=Ue;I.defaultOptions=$e;I.modifiers=He;I.className=r.className;var X="signature",ce=X;import{jsx as z,jsxs as ue}from"react/jsx-runtime";var H="k-signature",De=[f.hover,f.focus,f.valid,f.invalid,f.disabled],Fe={size:[n.undefined,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[b.undefined,b.solid,b.flat,b.outline]},Pe={},k=t=>{let{size:e,rounded:i,fillMode:d,hover:s,focus:c,valid:u,invalid:l,disabled:h,maximized:p,...g}=t;return ue("div",{...g,className:a(t.className,H,"k-input",v(H,{size:e}),v("k-input",{fillMode:d,rounded:i}),R(H,{hover:s,focus:c,valid:u,invalid:l,disabled:h}),{"k-signature-maximized":p}),children:[z("canvas",{className:"k-signature-canvas",role:"img","aria-label":"Signature",tabIndex:0}),ue("div",{className:a("k-signature-actions","k-signature-actions-top"),children:[z(r,{className:a("k-signature-action","k-signature-maximize",p?"k-hidden":""),icon:"hyperlink-open",rounded:i,size:e,fillMode:"flat","aria-label":"Maximize"}),z(r,{className:a("k-signature-action","k-signature-minimize",p?"":"k-hidden"),icon:"hyperlink-open",rounded:i,size:e,fillMode:"flat","aria-label":"Minimize"})]}),z("div",{className:"k-signature-line"}),z("div",{className:a("k-signature-actions","k-signature-actions-bottom"),children:z(r,{className:a("k-signature-action","k-signature-clear"),icon:"x",rounded:t.rounded,size:t.size,fillMode:"flat","aria-label":"Clear"})})]})};k.states=De;k.options=Fe;k.className=H;k.defaultOptions=Pe;k.moduleName=X;k.folderName=ce;k.ariaSpec={selector:".k-signature",rules:[{selector:".k-signature-canvas",attribute:"role=img",usage:"Sets canvas role to img."},{selector:".k-signature-canvas",attribute:"aria-label",usage:"Announces the purpose of the Signature."},{selector:".k-signature-action",attribute:"nodeName=button",usage:"Renders action as a button element."},{selector:".k-signature-action",attribute:"aria-label",usage:"Announces the purpose of the action button."}]};var me=k;import{jsx as Ge}from"react/jsx-runtime";var no=t=>Ge(me,{...t});export{no as SignatureNormal};