UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 12.9 kB
var _e=Object.create;var H=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Re=Object.getPrototypeOf,ze=Object.prototype.hasOwnProperty;var Ke=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},re=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Pe(t))!ze.call(e,r)&&r!==n&&H(e,r,{get:()=>t[r],enumerable:!(s=Le(t,r))||s.enumerable});return e};var De=(e,t,n)=>(n=e!=null?_e(Re(e)):{},re(t||!e||!e.__esModule?H(n,"default",{value:e,enumerable:!0}):n,e)),Ue=e=>re(H({},"__esModule",{value:!0}),e);var ut={};Ke(ut,{SPLITBUTTON_CLASSNAME:()=>G,SplitButton:()=>S,default:()=>dt});module.exports=Ue(ut);var l=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?l(...t):typeof t=="object"?Object.keys(t).map((n,s)=>t[s]||t[n]&&n||null).filter(n=>n!==null).join(" "):t).filter(t=>!!t).join(" ");var T=(e,t)=>l({[`${e}-xs`]:t.size==="xsmall",[`${e}-sm`]:t.size==="small",[`${e}-md`]:t.size==="medium",[`${e}-lg`]:t.size==="large",[`${e}-xl`]:t.size==="xlarge",[`${e}-xxl`]:t.size==="xxlarge",[`${e}-xxxl`]:t.size==="xxxlarge"},{[`${e}-${t.fillMode}`]:t.fillMode},{[`${e}-${t.themeColor}`]:t.themeColor},{"k-rounded-sm":t.rounded==="small","k-rounded-md":t.rounded==="medium","k-rounded-lg":t.rounded==="large","k-rounded-full":t.rounded==="full","k-rounded-none":t.rounded==="none"}),se=(e,t)=>{let{valid:n,invalid:s,hover:r,focus:u,checked:c,active:a,selected:v,disabled:b,indeterminate:x,loading:y,empty:N,readonly:B,highlighted:E,...I}=t;return l({"k-valid":n,"k-invalid":s,"k-hover":r,"k-focus":u,"k-checked":c,"k-active":a,"k-selected":v,"k-disabled":b,"k-indeterminate":x&&!c,"k-loading":y,"k-empty":N,"k-readonly":B,"k-highlighted":E},Object.keys(I).reduce((p,_)=>(_.startsWith("k-")?p[_]=I[_]:p[`k-${_}`]=I[_],p),{}))};function ae(e,t){if(!t)return{};let n=Array.isArray(t)?t:[t];return Object.fromEntries(n.map(s=>[`k-${s}`,!0]))}var i={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"},f={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},M={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"},h={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 R=require("react/jsx-runtime"),q="k-font-icon",He=[],$e={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info]},Fe={},z=e=>{let{size:t,themeColor:n,icon:s,rotate:r,flip:u,...c}=e;return s?(0,R.jsx)("span",{...c,className:l(e.className,q,T(q,{size:t}),{[`k-i-${s}`]:s,[`k-color-${n}`]:n,[`k-rotate-${r}`]:r,"k-flip-h":u==="h"||u==="both","k-flip-v":u==="v"||u==="both"}),"aria-hidden":"true"}):(0,R.jsx)(R.Fragment,{})};z.states=He;z.options=$e;z.className=q;z.defaultOptions=Fe;var le=z;var L=require("react/jsx-runtime"),J="k-svg-icon",Ve=[],Ge={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[M.outline,M.solid,M.duotone]},W={viewBox:"0 0 24 24",variant:M.outline},K=e=>{var y,N;let{size:t,themeColor:n,rotate:s,flip:r,viewBox:u=W.viewBox,variant:c=W.variant,icon:a,...v}=e;if(!a)return(0,L.jsx)(L.Fragment,{});if(a==="none")return(0,L.jsx)("span",{...v,className:l(e.className,J,T("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let b=typeof a=="object"&&a.name&&a.name,x=typeof a=="object"?c&&((y=a.variants)==null?void 0:y[c])||((N=a.variants)==null?void 0:N.outline)||a.content:void 0;return(0,L.jsx)("span",{...v,className:l(e.className,J,T("k-icon",{size:t}),{[`k-svg-i-${b}`]:b,[`k-color-${n}`]:n,[`k-rotate-${s}`]:s,"k-flip-h":r==="h"||r==="both","k-flip-v":r==="v"||r==="both"}),"aria-hidden":"true",children:(0,L.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof a=="object"?a.viewBox:u,dangerouslySetInnerHTML:x!==void 0?{__html:x}:void 0,children:a?void 0:e.children})})};K.states=Ve;K.options=Ge;K.className=J;K.defaultOptions=W;var X=K;var Q=De(require("@progress/kendo-svg-icons"));var de="icon",ue="icons";var me=require("react");var ce=require("react"),pe=(0,ce.createContext)({iconsType:"svg"});var A=require("react/jsx-runtime"),$="k-icon",qe=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),Je=[],We={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[M.outline,M.solid,M.duotone]},F={viewBox:"0 0 24 24",type:"svg",variant:M.outline},C=e=>{let{iconsType:t}=(0,me.useContext)(pe),{size:n,themeColor:s,icon:r,type:u=t||F.type,rotate:c,flip:a,viewBox:v=F.viewBox,variant:b=F.variant,...x}=e;if(!r)return(0,A.jsx)(A.Fragment,{});if((t||u)==="svg"){if(r==="none")return(0,A.jsx)(X,{...x,className:l(e.className,$),icon:r,size:n,variant:b});let N=Q[r]?r:qe(`${r}-icon`);return Q[N]?(0,A.jsx)(X,{...x,className:l(e.className,$),icon:Q[N],size:n,themeColor:s,rotate:c,flip:a,viewBox:v,variant:b}):(0,A.jsx)(A.Fragment,{})}return(0,A.jsx)(le,{...x,className:l(e.className,$),icon:r,size:n,themeColor:s,rotate:c,flip:a})};C.states=Je;C.options=We;C.defaultOptions=F;C.className=$;C.moduleName=de;C.folderName=ue;C.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 Y="button",fe=Y;var g=require("react/jsx-runtime"),D="k-button",Xe=["icon-button"],Qe=[h.hover,h.focus,h.active,h.selected,h.disabled,h.generating],Ye={size:[i.undefined,i.xsmall,i.small,i.medium,i.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[f.undefined,f.solid,f.flat,f.outline,f.clear,f.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},Z={showArrow:!1,arrowIconName:"chevron-down"},d=e=>{let{as:t="button",size:n,rounded:s,fillMode:r,themeColor:u,showArrow:c=Z.showArrow,arrowIconName:a=Z.arrowIconName,variant:v,hover:b,focus:x,active:y,selected:N,disabled:B,togglable:E,ariaDisabled:I,icon:p,iconSize:_,text:U,iconClassName:Se,className:Ie,...we}=e,Be=p!=null,Ee=e.children!==void 0;return(0,g.jsxs)(t,{className:l(Ie,D,ae(D,v),T(D,{size:n,rounded:s,fillMode:r,themeColor:u}),se(D,{hover:b,focus:x,active:y,disabled:B||I,selected:N}),{"k-icon-button":!U&&!Ee&&Be}),"aria-pressed":E?N?"true":"false":void 0,...we,"aria-disabled":I?"true":void 0,disabled:B||void 0,children:[typeof p=="string"&&p&&(0,g.jsx)(C,{className:l(Se,"k-button-icon"),icon:p,size:_}),p&&typeof p!="string"&&(0,g.jsx)(g.Fragment,{children:p}),U?(0,g.jsxs)(g.Fragment,{children:[U&&(0,g.jsx)("span",{className:"k-button-text",children:U}),e.children]}):e.children&&(0,g.jsx)("span",{className:"k-button-text",children:e.children}),c&&(0,g.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,g.jsx)(C,{icon:a})})]})};d.states=Qe;d.options=Ye;d.variants=Xe;d.className=D;d.defaultOptions=Z;d.moduleName=Y;d.folderName=fe;d.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 xe=require("react/jsx-runtime"),be=e=>(0,xe.jsx)(d,{icon:"folder",...e,"aria-label":e["aria-label"]||"Folder",children:void 0});var ge=require("react/jsx-runtime"),he=e=>(0,ge.jsx)(d,{icon:"folder",children:"Button",...e});var ve=require("react/jsx-runtime"),Ne=e=>(0,ve.jsx)(d,{children:"Button",...e});var V=require("react/jsx-runtime"),Ze=d.options,je=d.states,et={...d.defaultOptions,variant:"text"},tt=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],ot=[],P=e=>{let{variant:t,...n}=e;switch(t){case"icon-only":return(0,V.jsx)(be,{...n,icon:"star"});case"icon-and-text":return(0,V.jsx)(he,{...n,icon:"star",children:"Button"});default:return(0,V.jsx)(Ne,{...n,children:"Button"})}};P.options=Ze;P.states=je;P.variants=tt;P.defaultOptions=et;P.modifiers=ot;P.className=d.className;var j="popup",ye=j;var te=require("react/jsx-runtime"),Me="k-animation-container",nt=[],it={},ee={positionMode:"absolute",shown:!0},w=e=>{let{positionMode:t=ee.positionMode,shown:n=ee.shown,animationStyle:s,offset:r,...u}=e;return(0,te.jsx)("div",{...u,style:{...r,...e.style},className:l(e.className,Me,{"k-animation-container-shown":n,"k-animation-container-fixed":t==="fixed"}),children:(0,te.jsx)("div",{className:"k-child-animation-container",style:s,children:e.children})})};w.states=nt;w.options=it;w.className=Me;w.defaultOptions=ee;w.moduleName=j;w.folderName=ye;var oe="popup",Ce=oe;var ne=require("react/jsx-runtime"),Te="k-popup",rt=[],st={},Ae={positionMode:"absolute"},O=e=>{let{offset:t,positionMode:n=Ae.positionMode,animationStyle:s,containerClassName:r,containerRole:u,containerAriaLabel:c,...a}=e;return(0,ne.jsx)(w,{positionMode:n,offset:t,animationStyle:s,className:r,role:u,"aria-label":c,children:(0,ne.jsx)("div",{...a,className:l(e.className,Te),children:e.children})})};O.states=rt;O.options=st;O.className=Te;O.defaultOptions=Ae;O.moduleName=oe;O.folderName=Ce;O.ariaSpec={selector:".k-popup",rules:[{selector:".k-animation-container",attribute:"role (when appended to body)",usage:'Container gets role="region" when appended to document body. Popup is a building block \u2014 ARIA semantics come from consuming components.'}]};var ie="split-button",Oe=ie;var k=require("react/jsx-runtime"),G="k-split-button",at=[h.hover,h.focus,h.active,h.selected,h.disabled],lt={size:[i.undefined,i.small,i.medium,i.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[f.undefined,f.solid,f.flat,f.outline,f.clear,f.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},ke={arrowIconName:"chevron-down"},S=e=>{let{size:t,rounded:n,fillMode:s,themeColor:r,hover:u,focus:c,active:a,selected:v,disabled:b,icon:x,text:y,arrowIconName:N=ke.arrowIconName,popup:B,opened:E,popupId:I,...p}=e;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)("div",{...p,className:l(e.className,G,"k-button-group",T(G,{rounded:n})),children:[(0,k.jsx)(d,{text:y,icon:x,size:t,rounded:n,fillMode:s,themeColor:r,hover:u,focus:c,active:a,selected:v,disabled:b,...!y&&!e.children&&x&&{"aria-label":"Action"},children:e.children}),(0,k.jsx)(d,{className:"k-split-button-arrow",icon:N,size:t,rounded:n,fillMode:s,disabled:b,ariaDisabled:b||void 0,"aria-label":"Toggle dropdown","aria-expanded":E?"true":"false","aria-controls":E?I:void 0,tabIndex:-1})]}),E&&B&&(0,k.jsx)(O,{className:"k-menu-popup",children:B})]})};S.states=at;S.options=lt;S.className=G;S.defaultOptions=ke;S.moduleName=ie;S.folderName=Oe;S.ariaSpec={selector:".k-split-button",rules:[{selector:".k-split-button-arrow",attribute:"role=button or nodeName=button",usage:"Omitted if the <button> DOM element is used."},{selector:".k-split-button-arrow",attribute:"aria-label",usage:"The attribute must be present when no text is initially visible in the button."},{selector:".k-split-button-arrow",attribute:"aria-expanded=true/false",usage:"Announces the state of the popup visibility."},{selector:".k-split-button-arrow",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-split-button-arrow",attribute:"tabindex=-1",usage:"The arrow button is removed from the tab sequence."},{selector:".k-split-button-arrow.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 dt=S;