UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 9.33 kB
var c=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?c(...e):typeof e=="object"?Object.keys(e).map((r,i)=>e[i]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var y=(t,e)=>c({[`${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"}),W=(t,e)=>{let{valid:r,invalid:i,hover:a,focus:d,checked:u,active:l,selected:b,disabled:h,indeterminate:p,loading:A,empty:T,readonly:w,highlighted:P,...C}=e;return c({"k-valid":r,"k-invalid":i,"k-hover":a,"k-focus":d,"k-checked":u,"k-active":l,"k-selected":b,"k-disabled":h,"k-indeterminate":p&&!u,"k-loading":A,"k-empty":T,"k-readonly":w,"k-highlighted":P},Object.keys(C).reduce((m,v)=>(v.startsWith("k-")?m[v]=C[v]:m[`k-${v}`]=C[v],m),{}))};function j(t,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(i=>[`k-${i}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},N={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"},f={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"},k={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 Te,jsx as J}from"react/jsx-runtime";var H="k-font-icon",he=[],be={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]},ge={},E=t=>{let{size:e,themeColor:r,icon:i,rotate:a,flip:d,...u}=t;return i?J("span",{...u,className:c(t.className,H,y(H,{size:e}),{[`k-i-${i}`]:i,[`k-color-${r}`]:r,[`k-rotate-${a}`]:a,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):J(Te,{})};E.states=he;E.options=be;E.className=H;E.defaultOptions=ge;var Q=E;import{Fragment as Ne,jsx as K}from"react/jsx-runtime";var $="k-svg-icon",ve=[],ye={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:[f.outline,f.solid,f.duotone]},U={viewBox:"0 0 24 24",variant:f.outline},_=t=>{let{size:e,themeColor:r,rotate:i,flip:a,viewBox:d=U.viewBox,variant:u=U.variant,icon:l,...b}=t;if(!l)return K(Ne,{});if(l==="none")return K("span",{...b,className:c(t.className,$,y("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let h=typeof l=="object"&&l.name&&l.name,p=typeof l=="object"?u&&l.variants?.[u]||l.variants?.outline||l.content:void 0;return K("span",{...b,className:c(t.className,$,y("k-icon",{size:e}),{[`k-svg-i-${h}`]:h,[`k-color-${r}`]:r,[`k-rotate-${i}`]:i,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="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:d,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:l?void 0:t.children})})};_.states=ve;_.options=ye;_.className=$;_.defaultOptions=U;var F=_;import*as D from"@progress/kendo-svg-icons";var Y="icon",Z="icons";import{useContext as ke}from"react";import{createContext as Be}from"react";var ee=Be({iconsType:"svg"});import{Fragment as te,jsx as M}from"react/jsx-runtime";var L="k-icon",Ce=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Se=[],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:[f.outline,f.solid,f.duotone]},R={viewBox:"0 0 24 24",type:"svg",variant:f.outline},x=t=>{let{iconsType:e}=ke(ee),{size:r,themeColor:i,icon:a,type:d=e||R.type,rotate:u,flip:l,viewBox:b=R.viewBox,variant:h=R.variant,...p}=t;if(!a)return M(te,{});if((e||d)==="svg"){if(a==="none")return M(F,{...p,className:c(t.className,L),icon:a,size:r,variant:h});let T=D[a]?a:Ce(`${a}-icon`);return D[T]?M(F,{...p,className:c(t.className,L),icon:D[T],size:r,themeColor:i,rotate:u,flip:l,viewBox:b,variant:h}):M(te,{})}return M(Q,{...p,className:c(t.className,L),icon:a,size:r,themeColor:i,rotate:u,flip:l})};x.states=Se;x.options=Oe;x.defaultOptions=R;x.className=L;x.moduleName=Y;x.folderName=Z;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."}]};var V="button",oe=V;import{Fragment as ne,jsx as S,jsxs as re}from"react/jsx-runtime";var I="k-button",Ee=["icon-button"],_e=[k.hover,k.focus,k.active,k.selected,k.disabled,k.generating],Me={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[N.undefined,N.none,N.small,N.medium,N.large,N.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]},G={showArrow:!1,arrowIconName:"chevron-down"},s=t=>{let{as:e="button",size:r,rounded:i,fillMode:a,themeColor:d,showArrow:u=G.showArrow,arrowIconName:l=G.arrowIconName,variant:b,hover:h,focus:p,active:A,selected:T,disabled:w,togglable:P,ariaDisabled:C,icon:m,iconSize:v,text:z,iconClassName:ue,className:me,...pe}=t,fe=m!=null,xe=t.children!==void 0;return re(e,{className:c(me,I,j(I,b),y(I,{size:r,rounded:i,fillMode:a,themeColor:d}),W(I,{hover:h,focus:p,active:A,disabled:w||C,selected:T}),{"k-icon-button":!z&&!xe&&fe}),"aria-pressed":P?T?"true":"false":void 0,...pe,"aria-disabled":C?"true":void 0,disabled:w||void 0,children:[typeof m=="string"&&m&&S(x,{className:c(ue,"k-button-icon"),icon:m,size:v}),m&&typeof m!="string"&&S(ne,{children:m}),z?re(ne,{children:[z&&S("span",{className:"k-button-text",children:z}),t.children]}):t.children&&S("span",{className:"k-button-text",children:t.children}),u&&S("span",{className:"k-menu-button-arrow k-button-arrow",children:S(x,{icon:l})})]})};s.states=_e;s.options=Me;s.variants=Ee;s.className=I;s.defaultOptions=G;s.moduleName=V;s.folderName=oe;s.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 Ie}from"react/jsx-runtime";var se=t=>Ie(s,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as Ae}from"react/jsx-runtime";var ie=t=>Ae(s,{icon:"folder",children:"Button",...t});import{jsx as we}from"react/jsx-runtime";var ae=t=>we(s,{children:"Button",...t});import{jsx as X}from"react/jsx-runtime";var ze=s.options,Ke=s.states,Le={...s.defaultOptions,variant:"text"},Re=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Pe=[],O=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return X(se,{...r,icon:"star"});case"icon-and-text":return X(ie,{...r,icon:"star",children:"Button"});default:return X(ae,{...r,children:"Button"})}};O.options=ze;O.states=Ke;O.variants=Re;O.defaultOptions=Le;O.modifiers=Pe;O.className=s.className;var q="speech-to-text-button",le=q;import{jsx as He}from"react/jsx-runtime";var ce="k-speech-to-text-button",de={icon:"microphone"},g=t=>{let{listening:e=!1,icon:r=de.icon,...i}=t;return He(s,{...i,icon:e?"stop":r,className:c(t.className,ce,{"k-listening":e}),"aria-pressed":e?"true":"false","aria-label":e?"Stop listening":"Start listening"})};g.states=s.states;g.options=s.options;g.className=ce;g.defaultOptions=de;g.moduleName=q;g.folderName=le;g.ariaSpec={selector:".k-speech-to-text-button",rules:[{selector:".k-button.k-speech-to-text-button",attribute:"role=button or nodeName=button",usage:"If the used element is not <button>, explicitly set its role to button."},{selector:".k-button.k-speech-to-text-button",attribute:"aria-pressed",usage:"Announces the toggle behaviour of the button."},{selector:".k-button.k-speech-to-text-button",attribute:"aria-label",usage:"Accessible name for the speech-to-text button."}]};var Yt=g;export{ce as SPEECH_TO_TEXT_BUTTON_CLASSNAME,g as SpeechToTextButton,Yt as default};