@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 9.14 kB
JavaScript
var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...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 N=(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:i,hover:a,focus:c,checked:u,active:l,selected:b,disabled:h,indeterminate:p,loading:E,empty:v,readonly:L,highlighted:H,...S}=e;return d({"k-valid":r,"k-invalid":i,"k-hover":a,"k-focus":c,"k-checked":u,"k-active":l,"k-selected":b,"k-disabled":h,"k-indeterminate":p&&!u,"k-loading":E,"k-empty":v,"k-readonly":L,"k-highlighted":H},Object.keys(S).reduce((m,y)=>(y.startsWith("k-")?m[y]=S[y]:m[`k-${y}`]=S[y],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"},k={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},C={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"},g={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 ve,jsx as Q}from"react/jsx-runtime";var F="k-font-icon",he=[],ge={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]},be={},w=t=>{let{size:e,themeColor:r,icon:i,rotate:a,flip:c,...u}=t;return i?Q("span",{...u,className:d(t.className,F,N(F,{size:e}),{[`k-i-${i}`]:i,[`k-color-${r}`]:r,[`k-rotate-${a}`]:a,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):Q(ve,{})};w.states=he;w.options=ge;w.className=F;w.defaultOptions=be;var Y=w;import{Fragment as ke,jsx as K}from"react/jsx-runtime";var D="k-svg-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],variant:[f.outline,f.solid,f.duotone]},U={viewBox:"0 0 24 24",variant:f.outline},z=t=>{let{size:e,themeColor:r,rotate:i,flip:a,viewBox:c=U.viewBox,variant:u=U.variant,icon:l,...b}=t;if(!l)return K(ke,{});if(l==="none")return K("span",{...b,className:d(t.className,D,N("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:d(t.className,D,N("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:c,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:l?void 0:t.children})})};z.states=ye;z.options=Ne;z.className=D;z.defaultOptions=U;var V=z;import*as W from"@progress/kendo-svg-icons";var ee="icon",te="icons";import{useContext as Se}from"react";import{createContext as Ce}from"react";var oe=Ce({iconsType:"svg"});import{Fragment as ne,jsx as O}from"react/jsx-runtime";var $="k-icon",Be=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Te=[],Ie={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]},P={viewBox:"0 0 24 24",type:"svg",variant:f.outline},x=t=>{let{iconsType:e}=Se(oe),{size:r,themeColor:i,icon:a,type:c=e||P.type,rotate:u,flip:l,viewBox:b=P.viewBox,variant:h=P.variant,...p}=t;if(!a)return O(ne,{});if((e||c)==="svg"){if(a==="none")return O(V,{...p,className:d(t.className,$),icon:a,size:r,variant:h});let v=W[a]?a:Be(`${a}-icon`);return W[v]?O(V,{...p,className:d(t.className,$),icon:W[v],size:r,themeColor:i,rotate:u,flip:l,viewBox:b,variant:h}):O(ne,{})}return O(Y,{...p,className:d(t.className,$),icon:a,size:r,themeColor:i,rotate:u,flip:l})};x.states=Te;x.options=Ie;x.defaultOptions=P;x.className=$;x.moduleName=ee;x.folderName=te;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 G="button",re=G;import{Fragment as se,jsx as B,jsxs as ae}from"react/jsx-runtime";var M="k-button",we=["icon-button"],ze=[g.hover,g.focus,g.active,g.selected,g.disabled,g.generating],Oe={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[k.undefined,k.none,k.small,k.medium,k.large,k.full],fillMode:[C.undefined,C.solid,C.flat,C.outline,C.clear,C.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:i,fillMode:a,themeColor:c,showArrow:u=q.showArrow,arrowIconName:l=q.arrowIconName,variant:b,hover:h,focus:p,active:E,selected:v,disabled:L,togglable:H,ariaDisabled:S,icon:m,iconSize:y,text:_,iconClassName:ue,className:me,...pe}=t,fe=m!=null,xe=t.children!==void 0;return ae(e,{className:d(me,M,j(M,b),N(M,{size:r,rounded:i,fillMode:a,themeColor:c}),R(M,{hover:h,focus:p,active:E,disabled:L||S,selected:v}),{"k-icon-button":!_&&!xe&&fe}),"aria-pressed":H?v?"true":"false":void 0,...pe,"aria-disabled":S?"true":void 0,disabled:L||void 0,children:[typeof m=="string"&&m&&B(x,{className:d(ue,"k-button-icon"),icon:m,size:y}),m&&typeof m!="string"&&B(se,{children:m}),_?ae(se,{children:[_&&B("span",{className:"k-button-text",children:_}),t.children]}):t.children&&B("span",{className:"k-button-text",children:t.children}),u&&B("span",{className:"k-menu-button-arrow k-button-arrow",children:B(x,{icon:l})})]})};s.states=ze;s.options=Oe;s.variants=we;s.className=M;s.defaultOptions=q;s.moduleName=G;s.folderName=re;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 Me}from"react/jsx-runtime";var ie=t=>Me(s,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as Ae}from"react/jsx-runtime";var le=t=>Ae(s,{icon:"folder",children:"Button",...t});import{jsx as Ee}from"react/jsx-runtime";var de=t=>Ee(s,{children:"Button",...t});import{jsx as Z}from"react/jsx-runtime";var Le=s.options,_e=s.states,Re={...s.defaultOptions,variant:"text"},Ke=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],$e=[],T=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return Z(ie,{...r,icon:"star"});case"icon-and-text":return Z(le,{...r,icon:"star",children:"Button"});default:return Z(de,{...r,children:"Button"})}};T.options=Le;T.states=_e;T.variants=Ke;T.defaultOptions=Re;T.modifiers=$e;T.className=s.className;import{Fragment as De,jsx as I,jsxs as X}from"react/jsx-runtime";var J="k-wizard-step",Pe=[g.focus],He={},Fe=X(De,{children:[I("span",{className:"k-wizard-buttons-left",children:I("span",{className:"k-wizard-pager",children:"Step 2 of 3"})}),X("span",{className:"k-wizard-buttons-right",children:[I(s,{children:"Previous"}),I(s,{themeColor:"primary",children:"Next"})]})]}),ce={buttons:Fe},A=t=>{let{focus:e,buttons:r=ce.buttons,stepLabel:i,...a}=t;return X("div",{...a,className:d(t.className,J,R(J,{focus:e})),role:"tabpanel","aria-label":i||"Step",tabIndex:0,children:[I("div",{className:"k-wizard-content",children:t.children}),r&&I("div",{className:"k-wizard-buttons",children:r})]})};A.states=Pe;A.options=He;A.className=J;A.defaultOptions=ce;var Xt=A;export{J as WIZZARDSTEP_CLASSNAME,A as WizardStep,Xt as default};