@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 7.32 kB
JavaScript
var l=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...e):typeof e=="object"?Object.keys(e).map((s,a)=>e[a]||e[s]&&s||null).filter(s=>s!==null).join(" "):e).filter(e=>!!e).join(" ");var x=(t,e)=>l({[`${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"}),G=(t,e)=>{let{valid:s,invalid:a,hover:r,focus:d,checked:c,active:i,selected:p,disabled:g,indeterminate:f,loading:H,empty:O,readonly:Z,highlighted:ee,..._}=e;return l({"k-valid":s,"k-invalid":a,"k-hover":r,"k-focus":d,"k-checked":c,"k-active":i,"k-selected":p,"k-disabled":g,"k-indeterminate":f&&!c,"k-loading":H,"k-empty":O,"k-readonly":Z,"k-highlighted":ee},Object.keys(_).reduce((L,b)=>(b.startsWith("k-")?L[b]=_[b]:L[`k-${b}`]=_[b],L),{}))};var o={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"};var m={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},n={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 re,jsx as F}from"react/jsx-runtime";var I="k-font-icon",te=[],oe={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info]},ne={},v=t=>{let{size:e,themeColor:s,icon:a,rotate:r,flip:d,...c}=t;return a?F("span",{...c,className:l(t.className,I,x(I,{size:e}),{[`k-i-${a}`]:a,[`k-color-${s}`]:s,[`k-rotate-${r}`]:r,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):F(re,{})};v.states=te;v.options=oe;v.className=I;v.defaultOptions=ne;var P=v;import{Fragment as ae,jsx as E}from"react/jsx-runtime";var A="k-svg-icon",se=[],ie={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[m.outline,m.solid,m.duotone]},z={viewBox:"0 0 24 24",variant:m.outline},S=t=>{let{size:e,themeColor:s,rotate:a,flip:r,viewBox:d=z.viewBox,variant:c=z.variant,icon:i,...p}=t;if(!i)return E(ae,{});if(i==="none")return E("span",{...p,className:l(t.className,A,x("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let g=typeof i=="object"&&i.name&&i.name,f=typeof i=="object"?c&&i.variants?.[c]||i.variants?.outline||i.content:void 0;return E("span",{...p,className:l(t.className,A,x("k-icon",{size:e}),{[`k-svg-i-${g}`]:g,[`k-color-${s}`]:s,[`k-rotate-${a}`]:a,"k-flip-h":r==="h"||r==="both","k-flip-v":r==="v"||r==="both"}),"aria-hidden":"true",children:E("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof i=="object"?i.viewBox:d,dangerouslySetInnerHTML:f!==void 0?{__html:f}:void 0,children:i?void 0:t.children})})};S.states=se;S.options=ie;S.className=A;S.defaultOptions=z;var B=S;import*as R from"@progress/kendo-svg-icons";var U="icon",V="icons";import{useContext as de}from"react";import{createContext as le}from"react";var j=le({iconsType:"svg"});import{Fragment as q,jsx as y}from"react/jsx-runtime";var k="k-icon",ce=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),me=[],ue={size:[o.undefined,o.xsmall,o.small,o.medium,o.large,o.xlarge,o.xxlarge,o.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[m.outline,m.solid,m.duotone]},T={viewBox:"0 0 24 24",type:"svg",variant:m.outline},u=t=>{let{iconsType:e}=de(j),{size:s,themeColor:a,icon:r,type:d=e||T.type,rotate:c,flip:i,viewBox:p=T.viewBox,variant:g=T.variant,...f}=t;if(!r)return y(q,{});if((e||d)==="svg"){if(r==="none")return y(B,{...f,className:l(t.className,k),icon:r,size:s,variant:g});let O=R[r]?r:ce(`${r}-icon`);return R[O]?y(B,{...f,className:l(t.className,k),icon:R[O],size:s,themeColor:a,rotate:c,flip:i,viewBox:p,variant:g}):y(q,{})}return y(P,{...f,className:l(t.className,k),icon:r,size:s,themeColor:a,rotate:c,flip:i})};u.states=me;u.options=ue;u.defaultOptions=T;u.className=k;u.moduleName=U;u.folderName=V;u.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="segmented-control",W=w,J="segmented-control-button",Q="segmented-control";import{jsx as X,jsxs as xe}from"react/jsx-runtime";var K="k-segmented-control-button",pe=[C.selected,C.hover,C.focus,C.disabled],fe={},ge={},h=t=>{let{hover:e,focus:s,selected:a,disabled:r,icon:d,text:c,iconClassName:i,...p}=t;return xe("button",{...p,className:l(t.className,K,G(K,{hover:e,focus:s,disabled:r,selected:a})),"aria-pressed":a?"true":"false","aria-disabled":r?"true":void 0,children:[d&&X(u,{className:l(i,"k-segmented-control-button-icon"),icon:d}),(c||t.children)&&X("span",{className:"k-segmented-control-button-text",children:c||t.children})]})};h.states=pe;h.options=fe;h.className=K;h.defaultOptions=ge;h.moduleName=J;h.folderName=Q;var D=h;import{jsx as be,jsxs as Ce}from"react/jsx-runtime";var M="k-segmented-control",he=[],Ne={size:[o.undefined,o.small,o.medium,o.large]},N=t=>{let{size:e,stretched:s,children:a,thumbStyles:r,...d}=t;return Ce("div",{...d,className:l(t.className,M,x(M,{size:e}),{[`${M}-stretched`]:s}),role:"group",children:[be("div",{className:"k-segmented-control-thumb","aria-hidden":"true",style:r}),a]})};N.states=he;N.options=Ne;N.className=M;N.moduleName=w;N.folderName=W;N.ariaSpec={selector:".k-segmented-control",rules:[{selector:".k-segmented-control",attribute:"role=group",usage:"Sets the proper role for the group of buttons."},{selector:".k-segmented-control-button",attribute:"role=button or nodeName=button",usage:"Each button must have the appropriate button role."},{selector:".k-segmented-control-button.k-selected",attribute:"aria-pressed=true",usage:"Only the selected button within the group will have this attribute set to true."},{selector:".k-segmented-control-button.k-disabled",attribute:"aria-disabled=true",usage:"Indicates that the button is disabled and cannot be interacted with."},{selector:".k-segmented-control-thumb",attribute:"aria-hidden=true",usage:"The thumb is purely decorative and should be hidden from screen readers."}]};var Y=N;import{Fragment as ve,jsx as $,jsxs as Se}from"react/jsx-runtime";var ut=t=>$(Y,{...t,children:Se(ve,{children:[$(D,{icon:"search",selected:!0,children:"Option 1"}),$(D,{icon:"sparkles",children:"Option 2"})]})});export{ut as SegmentedControlNormal};