UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 11.1 kB
var Ne=Object.create;var U=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var Te=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},Y=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Me(e))!Ce.call(t,i)&&i!==r&&U(t,i,{get:()=>e[i],enumerable:!(s=ke(e,i))||s.enumerable});return t};var we=(t,e,r)=>(r=t!=null?Ne(Be(t)):{},Y(e||!t||!t.__esModule?U(r,"default",{value:t,enumerable:!0}):r,t)),Oe=t=>Y(U({},"__esModule",{value:!0}),t);var je={};Te(je,{MENUBUTTON_CLASSNAME:()=>X,MenuButton:()=>C,default:()=>We});module.exports=Oe(je);var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...e):typeof e=="object"?Object.keys(e).map((r,s)=>e[s]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var O=(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"}),Z=(t,e)=>{let{valid:r,invalid:s,hover:i,focus:u,checked:c,active:a,selected:y,disabled:b,indeterminate:f,loading:N,empty:g,readonly:A,highlighted:z,...T}=e;return d({"k-valid":r,"k-invalid":s,"k-hover":i,"k-focus":u,"k-checked":c,"k-active":a,"k-selected":y,"k-disabled":b,"k-indeterminate":f&&!c,"k-loading":N,"k-empty":g,"k-readonly":A,"k-highlighted":z},Object.keys(T).reduce((v,w)=>(w.startsWith("k-")?v[w]=T[w]:v[`k-${w}`]=T[w],v),{}))};function ee(t,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(s=>[`k-${s}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},m={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},p={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},k={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"},x={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 E=require("react/jsx-runtime"),D="k-font-icon",Ie=[],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]},Se={},_=t=>{let{size:e,themeColor:r,icon:s,rotate:i,flip:u,...c}=t;return s?(0,E.jsx)("span",{...c,className:d(t.className,D,O(D,{size:e}),{[`k-i-${s}`]:s,[`k-color-${r}`]:r,[`k-rotate-${i}`]:i,"k-flip-h":u==="h"||u==="both","k-flip-v":u==="v"||u==="both"}),"aria-hidden":"true"}):(0,E.jsx)(E.Fragment,{})};_.states=Ie;_.options=Ae;_.className=D;_.defaultOptions=Se;var te=_;var I=require("react/jsx-runtime"),F="k-svg-icon",ze=[],Ee={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:[k.outline,k.solid,k.duotone]},V={viewBox:"0 0 24 24",variant:k.outline},L=t=>{var N,g;let{size:e,themeColor:r,rotate:s,flip:i,viewBox:u=V.viewBox,variant:c=V.variant,icon:a,...y}=t;if(!a)return(0,I.jsx)(I.Fragment,{});if(a==="none")return(0,I.jsx)("span",{...y,className:d(t.className,F,O("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let b=typeof a=="object"&&a.name&&a.name,f=typeof a=="object"?c&&((N=a.variants)==null?void 0:N[c])||((g=a.variants)==null?void 0:g.outline)||a.content:void 0;return(0,I.jsx)("span",{...y,className:d(t.className,F,O("k-icon",{size:e}),{[`k-svg-i-${b}`]:b,[`k-color-${r}`]:r,[`k-rotate-${s}`]:s,"k-flip-h":i==="h"||i==="both","k-flip-v":i==="v"||i==="both"}),"aria-hidden":"true",children:(0,I.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof a=="object"?a.viewBox:u,dangerouslySetInnerHTML:f!==void 0?{__html:f}:void 0,children:a?void 0:t.children})})};L.states=ze;L.options=Ee;L.className=F;L.defaultOptions=V;var G=L;var q=we(require("@progress/kendo-svg-icons"));var oe="icon",ne="icons";var se=require("react");var re=require("react"),ie=(0,re.createContext)({iconsType:"svg"});var B=require("react/jsx-runtime"),$="k-icon",_e=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Le=[],Ke={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:[k.outline,k.solid,k.duotone]},H={viewBox:"0 0 24 24",type:"svg",variant:k.outline},M=t=>{let{iconsType:e}=(0,se.useContext)(ie),{size:r,themeColor:s,icon:i,type:u=e||H.type,rotate:c,flip:a,viewBox:y=H.viewBox,variant:b=H.variant,...f}=t;if(!i)return(0,B.jsx)(B.Fragment,{});if((e||u)==="svg"){if(i==="none")return(0,B.jsx)(G,{...f,className:d(t.className,$),icon:i,size:r,variant:b});let g=q[i]?i:_e(`${i}-icon`);return q[g]?(0,B.jsx)(G,{...f,className:d(t.className,$),icon:q[g],size:r,themeColor:s,rotate:c,flip:a,viewBox:y,variant:b}):(0,B.jsx)(B.Fragment,{})}return(0,B.jsx)(te,{...f,className:d(t.className,$),icon:i,size:r,themeColor:s,rotate:c,flip:a})};M.states=Le;M.options=Ke;M.defaultOptions=H;M.className=$;M.moduleName=oe;M.folderName=ne;M.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="button",ae=W;var h=require("react/jsx-runtime"),K="k-button",Re=["icon-button"],Ue=[x.hover,x.focus,x.active,x.selected,x.disabled,x.generating],$e={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[p.undefined,p.solid,p.flat,p.outline,p.clear,p.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},j={showArrow:!1,arrowIconName:"chevron-down"},l=t=>{let{as:e="button",size:r,rounded:s,fillMode:i,themeColor:u,showArrow:c=j.showArrow,arrowIconName:a=j.arrowIconName,variant:y,hover:b,focus:f,active:N,selected:g,disabled:A,togglable:z,ariaDisabled:T,icon:v,iconSize:w,text:R,iconClassName:he,className:be,...ge}=t,ve=v!=null,ye=t.children!==void 0;return(0,h.jsxs)(e,{className:d(be,K,ee(K,y),O(K,{size:r,rounded:s,fillMode:i,themeColor:u}),Z(K,{hover:b,focus:f,active:N,disabled:A||T,selected:g}),{"k-icon-button":!R&&!ye&&ve}),"aria-pressed":z?g?"true":"false":void 0,...ge,"aria-disabled":T?"true":void 0,disabled:A||void 0,children:[typeof v=="string"&&v&&(0,h.jsx)(M,{className:d(he,"k-button-icon"),icon:v,size:w}),v&&typeof v!="string"&&(0,h.jsx)(h.Fragment,{children:v}),R?(0,h.jsxs)(h.Fragment,{children:[R&&(0,h.jsx)("span",{className:"k-button-text",children:R}),t.children]}):t.children&&(0,h.jsx)("span",{className:"k-button-text",children:t.children}),c&&(0,h.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,h.jsx)(M,{icon:a})})]})};l.states=Ue;l.options=$e;l.variants=Re;l.className=K;l.defaultOptions=j;l.moduleName=W;l.folderName=ae;l.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."}]};var de=require("react/jsx-runtime"),le=t=>(0,de.jsx)(l,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});var ce=require("react/jsx-runtime"),ue=t=>(0,ce.jsx)(l,{icon:"folder",children:"Button",...t});var pe=require("react/jsx-runtime"),me=t=>(0,pe.jsx)(l,{children:"Button",...t});var P=require("react/jsx-runtime"),He=l.options,Pe=l.states,De={...l.defaultOptions,variant:"text"},Fe=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Ve=[],S=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return(0,P.jsx)(le,{...r,icon:"star"});case"icon-and-text":return(0,P.jsx)(ue,{...r,icon:"star",children:"Button"});default:return(0,P.jsx)(me,{...r,children:"Button"})}};S.options=He;S.states=Pe;S.variants=Fe;S.defaultOptions=De;S.modifiers=Ve;S.className=l.className;var J="menu-button",fe=J;var xe=require("react/jsx-runtime"),X="k-menu-button",Ge=[x.hover,x.focus,x.active,x.selected,x.disabled],qe={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[p.undefined,p.solid,p.flat,p.outline,p.clear,p.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},Q={showArrow:!0,arrowIconName:"chevron-down"},C=t=>{let{size:e,rounded:r,fillMode:s,themeColor:i,hover:u,focus:c,active:a,selected:y,disabled:b,icon:f,text:N,showArrow:g=Q.showArrow,arrowIconName:A=Q.arrowIconName,expanded:z,...T}=t;return(0,xe.jsx)(l,{...T,className:d(t.className,X),text:N,size:e,rounded:r,fillMode:s,themeColor:i,hover:u,focus:c,active:a,selected:y,disabled:b,ariaDisabled:b||void 0,icon:f,showArrow:g,arrowIconName:A,"aria-expanded":z?"true":"false",...!N&&f&&!t["aria-label"]&&{"aria-label":"Menu"}})};C.states=Ge;C.options=qe;C.className=X;C.defaultOptions=Q;C.moduleName=J;C.folderName=fe;C.ariaSpec={selector:".k-menu-button",rules:[{selector:".k-menu-button",attribute:"role=button or nodeName=button",usage:"Omitted if the button DOM element is used."},{selector:".k-menu-button",attribute:"aria-label (when icon-only)",usage:"Required when no text is visible in the button."},{selector:".k-menu-button",attribute:"aria-expanded=true/false",usage:"Announces the state of the popup visibility."},{selector:".k-menu-button",attribute:"aria-controls=.k-menu-group id (when open)",usage:"Points to the popup element. Builds a relationship between the button and the popup."},{selector:".k-menu-button.k-disabled",attribute:"aria-disabled=true",usage:"Rendered only when the button is disabled."},{selector:".k-menu-group",attribute:"role=list",usage:"Announces the list role of the popup."},{selector:".k-menu-item",attribute:"role=listitem",usage:"Announces the listitem role of the popup items."}]};var We=C;