UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 9.7 kB
var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...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 b=(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"}),R=(t,e)=>{let{valid:r,invalid:a,hover:i,focus:c,checked:m,active:l,selected:N,disabled:g,indeterminate:f,loading:z,empty:k,readonly:E,highlighted:P,...C}=e;return d({"k-valid":r,"k-invalid":a,"k-hover":i,"k-focus":c,"k-checked":m,"k-active":l,"k-selected":N,"k-disabled":g,"k-indeterminate":f&&!m,"k-loading":z,"k-empty":k,"k-readonly":E,"k-highlighted":P},Object.keys(C).reduce((p,B)=>(B.startsWith("k-")?p[B]=C[B]:p[`k-${B}`]=C[B],p),{}))};function Y(t,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"},T={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},u={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"},v={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"};var F="button",Z=F;import{jsx as ve}from"react/jsx-runtime";var S="k-button-group",he=[v.disabled],ge={fillMode:[u.undefined,u.solid,u.flat,u.outline,u.clear,u.link]},be={},y=t=>{let{fillMode:e,disabled:r,stretched:a,...i}=t;return ve("div",{role:"group",...i,className:d(t.className,S,b(S,{fillMode:e}),R(S,{disabled:r}),{[`${S}-stretched`]:a}),...r&&{"aria-disabled":"true"},children:t.children})};y.states=he;y.options=ge;y.className=S;y.defaultOptions=be;y.moduleName=F;y.folderName=Z;y.ariaSpec={selector:".k-button-group",rules:[{selector:".k-button-group:not(.k-split-button)",attribute:"role=group",usage:"Sets the proper role for the group of buttons."},{selector:".k-button-group.k-disabled",attribute:"aria-disabled=true",usage:"The attribute is rendered only when the entire button group is disabled."},{selector:".k-button-group:not(.k-split-button):not(.k-scheduler-navigation):not(.k-zoom-control) .k-button",attribute:"aria-pressed (when selected)",usage:"Specifies the current state of the ButtonGroup. Only the selected button within the group will have this attribute set to true."}]};import{Fragment as Be,jsx as j}from"react/jsx-runtime";var H="k-font-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]},ke={},I=t=>{let{size:e,themeColor:r,icon:a,rotate:i,flip:c,...m}=t;return a?j("span",{...m,className:d(t.className,H,b(H,{size:e}),{[`k-i-${a}`]:a,[`k-color-${r}`]:r,[`k-rotate-${i}`]:i,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):j(Be,{})};I.states=ye;I.options=Ne;I.className=H;I.defaultOptions=ke;var ee=I;import{Fragment as Oe,jsx as K}from"react/jsx-runtime";var D="k-svg-icon",Te=[],Ce={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},w=t=>{let{size:e,themeColor:r,rotate:a,flip:i,viewBox:c=V.viewBox,variant:m=V.variant,icon:l,...N}=t;if(!l)return K(Oe,{});if(l==="none")return K("span",{...N,className:d(t.className,D,b("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let g=typeof l=="object"&&l.name&&l.name,f=typeof l=="object"?m&&l.variants?.[m]||l.variants?.outline||l.content:void 0;return K("span",{...N,className:d(t.className,D,b("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:K("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof l=="object"?l.viewBox:c,dangerouslySetInnerHTML:f!==void 0?{__html:f}:void 0,children:l?void 0:t.children})})};w.states=Te;w.options=Ce;w.className=D;w.defaultOptions=V;var q=w;import*as W from"@progress/kendo-svg-icons";var te="icon",oe="icons";import{useContext as Se}from"react";import{createContext as Me}from"react";var ne=Me({iconsType:"svg"});import{Fragment as re,jsx as A}from"react/jsx-runtime";var U="k-icon",Ie=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),we=[],Ae={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]},G={viewBox:"0 0 24 24",type:"svg",variant:x.outline},h=t=>{let{iconsType:e}=Se(ne),{size:r,themeColor:a,icon:i,type:c=e||G.type,rotate:m,flip:l,viewBox:N=G.viewBox,variant:g=G.variant,...f}=t;if(!i)return A(re,{});if((e||c)==="svg"){if(i==="none")return A(q,{...f,className:d(t.className,U),icon:i,size:r,variant:g});let k=W[i]?i:Ie(`${i}-icon`);return W[k]?A(q,{...f,className:d(t.className,U),icon:W[k],size:r,themeColor:a,rotate:m,flip:l,viewBox:N,variant:g}):A(re,{})}return A(ee,{...f,className:d(t.className,U),icon:i,size:r,themeColor:a,rotate:m,flip:l})};h.states=we;h.options=Ae;h.defaultOptions=G;h.className=U;h.moduleName=te;h.folderName=oe;h.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",se=J;import{Fragment as ie,jsx as O,jsxs as ae}from"react/jsx-runtime";var _="k-button",_e=["icon-button"],ze=[v.hover,v.focus,v.active,v.selected,v.disabled,v.generating],Ee={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[T.undefined,T.none,T.small,T.medium,T.large,T.full],fillMode:[u.undefined,u.solid,u.flat,u.outline,u.clear,u.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"},s=t=>{let{as:e="button",size:r,rounded:a,fillMode:i,themeColor:c,showArrow:m=Q.showArrow,arrowIconName:l=Q.arrowIconName,variant:N,hover:g,focus:f,active:z,selected:k,disabled:E,togglable:P,ariaDisabled:C,icon:p,iconSize:B,text:L,iconClassName:ce,className:me,...pe}=t,fe=p!=null,xe=t.children!==void 0;return ae(e,{className:d(me,_,Y(_,N),b(_,{size:r,rounded:a,fillMode:i,themeColor:c}),R(_,{hover:g,focus:f,active:z,disabled:E||C,selected:k}),{"k-icon-button":!L&&!xe&&fe}),"aria-pressed":P?k?"true":"false":void 0,...pe,"aria-disabled":C?"true":void 0,disabled:E||void 0,children:[typeof p=="string"&&p&&O(h,{className:d(ce,"k-button-icon"),icon:p,size:B}),p&&typeof p!="string"&&O(ie,{children:p}),L?ae(ie,{children:[L&&O("span",{className:"k-button-text",children:L}),t.children]}):t.children&&O("span",{className:"k-button-text",children:t.children}),m&&O("span",{className:"k-menu-button-arrow k-button-arrow",children:O(h,{icon:l})})]})};s.states=ze;s.options=Ee;s.variants=_e;s.className=_;s.defaultOptions=Q;s.moduleName=J;s.folderName=se;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 Le}from"react/jsx-runtime";var le=t=>Le(s,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as Re}from"react/jsx-runtime";var de=t=>Re(s,{icon:"folder",children:"Button",...t});import{jsx as Ke}from"react/jsx-runtime";var ue=t=>Ke(s,{children:"Button",...t});import{jsx as X}from"react/jsx-runtime";var Ue=s.options,Ge=s.states,$e={...s.defaultOptions,variant:"text"},Pe=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Fe=[],M=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return X(le,{...r,icon:"star"});case"icon-and-text":return X(de,{...r,icon:"star",children:"Button"});default:return X(ue,{...r,children:"Button"})}};M.options=Ue;M.states=Ge;M.variants=Pe;M.defaultOptions=$e;M.modifiers=Fe;M.className=s.className;import{Fragment as He,jsx as $,jsxs as De}from"react/jsx-runtime";var no=t=>$(y,{children:De(He,{children:[$(s,{className:"k-group-start",...t,children:"First"}),$(s,{...t,children:"Middle"}),$(s,{className:"k-group-end",...t,children:"Last"})]})});export{no as TextButtonGroup};