UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 10.5 kB
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:F,...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":F},Object.keys(M).reduce((x,C)=>(C.startsWith("k-")?x[C]=M[C]:x[`k-${C}`]=M[C],x),{}))};function Z(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 j}from"react/jsx-runtime";var P="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?j("span",{...u,className:a(t.className,P,v(P,{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"}):j(ye,{})};O.states=he;O.options=ve;O.className=P;O.defaultOptions=Ne;var ee=O;import{Fragment as Ce,jsx as K}from"react/jsx-runtime";var G="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]},V={viewBox:"0 0 24 24",variant:N.outline},B=t=>{let{size:e,themeColor:i,rotate:d,flip:s,viewBox:c=V.viewBox,variant:u=V.variant,icon:l,...h}=t;if(!l)return K(Ce,{});if(l==="none")return K("span",{...h,className:a(t.className,G,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,G,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=G;B.defaultOptions=V;var q=B;import*as W from"@progress/kendo-svg-icons";var te="icon",oe="icons";import{useContext as Te}from"react";import{createContext as Me}from"react";var ne=Me({iconsType:"svg"});import{Fragment as ie,jsx as A}from"react/jsx-runtime";var $="k-icon",ze=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Ie=[],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(ne),{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(ie,{});if((e||c)==="svg"){if(s==="none")return A(q,{...g,className:a(t.className,$),icon:s,size:i,variant:p});let S=W[s]?s:ze(`${s}-icon`);return W[S]?A(q,{...g,className:a(t.className,$),icon:W[S],size:i,themeColor:d,rotate:u,flip:l,viewBox:h,variant:p}):A(ie,{})}return A(ee,{...g,className:a(t.className,$),icon:s,size:i,themeColor:d,rotate:u,flip:l})};y.states=Ie;y.options=Oe;y.defaultOptions=U;y.className=$;y.moduleName=te;y.folderName=oe;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 J="button",ae=J;import{Fragment as re,jsx as T,jsxs as se}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]},Q={showArrow:!1,arrowIconName:"chevron-down"},r=t=>{let{as:e="button",size:i,rounded:d,fillMode:s,themeColor:c,showArrow:u=Q.showArrow,arrowIconName:l=Q.arrowIconName,variant:h,hover:p,focus:g,active:E,selected:S,disabled:_,togglable:F,ariaDisabled:M,icon:x,iconSize:C,text:L,iconClassName:pe,className:fe,...ge}=t,xe=x!=null,be=t.children!==void 0;return se(e,{className:a(fe,w,Z(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":F?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(re,{children:x}),L?se(re,{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=Q;r.moduleName=J;r.folderName=ae;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 le=t=>Ee(r,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as _e}from"react/jsx-runtime";var de=t=>_e(r,{icon:"folder",children:"Button",...t});import{jsx as Le}from"react/jsx-runtime";var ce=t=>Le(r,{children:"Button",...t});import{jsx as X}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=[],z=t=>{let{variant:e,...i}=t;switch(e){case"icon-only":return X(le,{...i,icon:"star"});case"icon-and-text":return X(de,{...i,icon:"star",children:"Button"});default:return X(ce,{...i,children:"Button"})}};z.options=Re;z.states=Ke;z.variants=Ue;z.defaultOptions=$e;z.modifiers=He;z.className=r.className;var Y="signature",ue=Y;import{jsx as I,jsxs as me}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 me("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:[I("canvas",{className:"k-signature-canvas",role:"img","aria-label":"Signature",tabIndex:0}),me("div",{className:a("k-signature-actions","k-signature-actions-top"),children:[I(r,{className:a("k-signature-action","k-signature-maximize",p?"k-hidden":""),icon:"hyperlink-open",rounded:i,size:e,fillMode:"flat","aria-label":"Maximize"}),I(r,{className:a("k-signature-action","k-signature-minimize",p?"":"k-hidden"),icon:"hyperlink-open",rounded:i,size:e,fillMode:"flat","aria-label":"Minimize"})]}),I("div",{className:"k-signature-line"}),I("div",{className:a("k-signature-actions","k-signature-actions-bottom"),children:I(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=Y;k.folderName=ue;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 D=k;import{jsx as Ge}from"react/jsx-runtime";var io=t=>Ge(D,{...t});import{jsx as Ve}from"react/jsx-runtime";var lo=t=>Ve(D,{maximized:!0,...t});export{H as SIGNATURE_CLASSNAME,k as Signature,lo as SignatureMaximized,io as SignatureNormal};