UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 13 kB
var Le=Object.create;var H=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var ze=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var De=(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 Re(t))!Ke.call(e,r)&&r!==n&&H(e,r,{get:()=>t[r],enumerable:!(s=Pe(t,r))||s.enumerable});return e};var Ue=(e,t,n)=>(n=e!=null?Le(ze(e)):{},re(t||!e||!e.__esModule?H(n,"default",{value:e,enumerable:!0}):n,e)),He=e=>re(H({},"__esModule",{value:!0}),e);var ct={};De(ct,{SplitButtonDisabled:()=>ut});module.exports=He(ct);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:w,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":w,"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"),G="k-font-icon",$e=[],Fe={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]},Ve={},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,G,T(G,{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=$e;z.options=Fe;z.className=G;z.defaultOptions=Ve;var le=z;var L=require("react/jsx-runtime"),q="k-svg-icon",Ge=[],qe={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]},J={viewBox:"0 0 24 24",variant:M.outline},K=e=>{var y,N;let{size:t,themeColor:n,rotate:s,flip:r,viewBox:u=J.viewBox,variant:c=J.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,q,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,q,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=Ge;K.options=qe;K.className=q;K.defaultOptions=J;var W=K;var X=Ue(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",Je=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),We=[],Xe={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)(W,{...x,className:l(e.className,$),icon:r,size:n,variant:b});let N=X[r]?r:Je(`${r}-icon`);return X[N]?(0,A.jsx)(W,{...x,className:l(e.className,$),icon:X[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=We;C.options=Xe;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 Q="button",fe=Q;var g=require("react/jsx-runtime"),D="k-button",Qe=["icon-button"],Ye=[h.hover,h.focus,h.active,h.selected,h.disabled,h.generating],Ze={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]},Y={showArrow:!1,arrowIconName:"chevron-down"},d=e=>{let{as:t="button",size:n,rounded:s,fillMode:r,themeColor:u,showArrow:c=Y.showArrow,arrowIconName:a=Y.arrowIconName,variant:v,hover:b,focus:x,active:y,selected:N,disabled:w,togglable:E,ariaDisabled:I,icon:p,iconSize:_,text:U,iconClassName:Ie,className:Be,...we}=e,Ee=p!=null,_e=e.children!==void 0;return(0,g.jsxs)(t,{className:l(Be,D,ae(D,v),T(D,{size:n,rounded:s,fillMode:r,themeColor:u}),se(D,{hover:b,focus:x,active:y,disabled:w||I,selected:N}),{"k-icon-button":!U&&!_e&&Ee}),"aria-pressed":E?N?"true":"false":void 0,...we,"aria-disabled":I?"true":void 0,disabled:w||void 0,children:[typeof p=="string"&&p&&(0,g.jsx)(C,{className:l(Ie,"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=Ye;d.options=Ze;d.variants=Qe;d.className=D;d.defaultOptions=Y;d.moduleName=Q;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"),je=d.options,et=d.states,tt={...d.defaultOptions,variant:"text"},ot=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],nt=[],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=je;P.states=et;P.variants=ot;P.defaultOptions=tt;P.modifiers=nt;P.className=d.className;var Z="popup",ye=Z;var ee=require("react/jsx-runtime"),Me="k-animation-container",it=[],rt={},j={positionMode:"absolute",shown:!0},B=e=>{let{positionMode:t=j.positionMode,shown:n=j.shown,animationStyle:s,offset:r,...u}=e;return(0,ee.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,ee.jsx)("div",{className:"k-child-animation-container",style:s,children:e.children})})};B.states=it;B.options=rt;B.className=Me;B.defaultOptions=j;B.moduleName=Z;B.folderName=ye;var te="popup",Ce=te;var oe=require("react/jsx-runtime"),Te="k-popup",st=[],at={},Ae={positionMode:"absolute"},O=e=>{let{offset:t,positionMode:n=Ae.positionMode,animationStyle:s,containerClassName:r,containerRole:u,containerAriaLabel:c,...a}=e;return(0,oe.jsx)(B,{positionMode:n,offset:t,animationStyle:s,className:r,role:u,"aria-label":c,children:(0,oe.jsx)("div",{...a,className:l(e.className,Te),children:e.children})})};O.states=st;O.options=at;O.className=Te;O.defaultOptions=Ae;O.moduleName=te;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 ne="split-button",Oe=ne;var k=require("react/jsx-runtime"),ie="k-split-button",lt=[h.hover,h.focus,h.active,h.selected,h.disabled],dt={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:w,opened:E,popupId:I,...p}=e;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)("div",{...p,className:l(e.className,ie,"k-button-group",T(ie,{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&&w&&(0,k.jsx)(O,{className:"k-menu-popup",children:w})]})};S.states=lt;S.options=dt;S.className=ie;S.defaultOptions=ke;S.moduleName=ne;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 Se=require("react/jsx-runtime"),ut=e=>(0,Se.jsx)(S,{children:"Button",disabled:!0,...e});