UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 7.57 kB
var l=(...o)=>o.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...e):typeof e=="object"?Object.keys(e).map((r,a)=>e[a]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var y=(o,e)=>l({[`${o}-xs`]:e.size==="xsmall",[`${o}-sm`]:e.size==="small",[`${o}-md`]:e.size==="medium",[`${o}-lg`]:e.size==="large",[`${o}-xl`]:e.size==="xlarge",[`${o}-xxl`]:e.size==="xxlarge",[`${o}-xxxl`]:e.size==="xxxlarge"},{[`${o}-${e.fillMode}`]:e.fillMode},{[`${o}-${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"}),D=(o,e)=>{let{valid:r,invalid:a,hover:i,focus:d,checked:c,active:s,selected:h,disabled:g,indeterminate:m,loading:z,empty:b,readonly:B,highlighted:$,...T}=e;return l({"k-valid":r,"k-invalid":a,"k-hover":i,"k-focus":d,"k-checked":c,"k-active":s,"k-selected":h,"k-disabled":g,"k-indeterminate":m&&!c,"k-loading":z,"k-empty":b,"k-readonly":B,"k-highlighted":$},Object.keys(T).reduce((u,v)=>(v.startsWith("k-")?u[v]=T[v]:u[`k-${v}`]=T[v],u),{}))};function G(o,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(a=>[`k-${a}`,!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"},k={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},p={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},t={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},C={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 de,jsx as j}from"react/jsx-runtime";var R="k-font-icon",se=[],ae={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info]},le={},O=o=>{let{size:e,themeColor:r,icon:a,rotate:i,flip:d,...c}=o;return a?j("span",{...c,className:l(o.className,R,y(R,{size:e}),{[`k-i-${a}`]:a,[`k-color-${r}`]:r,[`k-rotate-${i}`]:i,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):j(de,{})};O.states=se;O.options=ae;O.className=R;O.defaultOptions=le;var q=O;import{Fragment as me,jsx as _}from"react/jsx-runtime";var K="k-svg-icon",ce=[],ue={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info],variant:[p.outline,p.solid,p.duotone]},H={viewBox:"0 0 24 24",variant:p.outline},S=o=>{let{size:e,themeColor:r,rotate:a,flip:i,viewBox:d=H.viewBox,variant:c=H.variant,icon:s,...h}=o;if(!s)return _(me,{});if(s==="none")return _("span",{...h,className:l(o.className,K,y("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let g=typeof s=="object"&&s.name&&s.name,m=typeof s=="object"?c&&s.variants?.[c]||s.variants?.outline||s.content:void 0;return _("span",{...h,className:l(o.className,K,y("k-icon",{size:e}),{[`k-svg-i-${g}`]:g,[`k-color-${r}`]:r,[`k-rotate-${a}`]:a,"k-flip-h":i==="h"||i==="both","k-flip-v":i==="v"||i==="both"}),"aria-hidden":"true",children:_("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof s=="object"?s.viewBox:d,dangerouslySetInnerHTML:m!==void 0?{__html:m}:void 0,children:s?void 0:o.children})})};S.states=ce;S.options=ue;S.className=K;S.defaultOptions=H;var F=S;import*as P from"@progress/kendo-svg-icons";var W="icon",J="icons";import{useContext as fe}from"react";import{createContext as pe}from"react";var Q=pe({iconsType:"svg"});import{Fragment as X,jsx as w}from"react/jsx-runtime";var E="k-icon",xe=o=>o.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),ge=[],he={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info],variant:[p.outline,p.solid,p.duotone]},L={viewBox:"0 0 24 24",type:"svg",variant:p.outline},f=o=>{let{iconsType:e}=fe(Q),{size:r,themeColor:a,icon:i,type:d=e||L.type,rotate:c,flip:s,viewBox:h=L.viewBox,variant:g=L.variant,...m}=o;if(!i)return w(X,{});if((e||d)==="svg"){if(i==="none")return w(F,{...m,className:l(o.className,E),icon:i,size:r,variant:g});let b=P[i]?i:xe(`${i}-icon`);return P[b]?w(F,{...m,className:l(o.className,E),icon:P[b],size:r,themeColor:a,rotate:c,flip:s,viewBox:h,variant:g}):w(X,{})}return w(q,{...m,className:l(o.className,E),icon:i,size:r,themeColor:a,rotate:c,flip:s})};f.states=ge;f.options=he;f.defaultOptions=L;f.className=E;f.moduleName=W;f.folderName=J;f.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 U="button",Y=U;import{Fragment as Z,jsx as I,jsxs as ee}from"react/jsx-runtime";var M="k-button",be=["icon-button"],ve=[C.hover,C.focus,C.active,C.selected,C.disabled,C.generating],ye={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:[k.undefined,k.solid,k.flat,k.outline,k.clear,k.link],themeColor:[t.undefined,t.base,t.primary,t.secondary,t.tertiary,t.success,t.warning,t.error,t.info,t.inverse]},V={showArrow:!1,arrowIconName:"chevron-down"},x=o=>{let{as:e="button",size:r,rounded:a,fillMode:i,themeColor:d,showArrow:c=V.showArrow,arrowIconName:s=V.arrowIconName,variant:h,hover:g,focus:m,active:z,selected:b,disabled:B,togglable:$,ariaDisabled:T,icon:u,iconSize:v,text:A,iconClassName:te,className:oe,...ne}=o,re=u!=null,ie=o.children!==void 0;return ee(e,{className:l(oe,M,G(M,h),y(M,{size:r,rounded:a,fillMode:i,themeColor:d}),D(M,{hover:g,focus:m,active:z,disabled:B||T,selected:b}),{"k-icon-button":!A&&!ie&&re}),"aria-pressed":$?b?"true":"false":void 0,...ne,"aria-disabled":T?"true":void 0,disabled:B||void 0,children:[typeof u=="string"&&u&&I(f,{className:l(te,"k-button-icon"),icon:u,size:v}),u&&typeof u!="string"&&I(Z,{children:u}),A?ee(Z,{children:[A&&I("span",{className:"k-button-text",children:A}),o.children]}):o.children&&I("span",{className:"k-button-text",children:o.children}),c&&I("span",{className:"k-menu-button-arrow k-button-arrow",children:I(f,{icon:s})})]})};x.states=ve;x.options=ye;x.variants=be;x.className=M;x.defaultOptions=V;x.moduleName=U;x.folderName=Y;x.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 Ne}from"react/jsx-runtime";var st=o=>Ne(x,{children:"Button",...o});export{st as TextButton};