UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 8.31 kB
var le=Object.create;var L=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var pe=(t,e)=>{for(var r in e)L(t,r,{get:e[r],enumerable:!0})},j=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ce(e))!me.call(t,i)&&i!==r&&L(t,i,{get:()=>e[i],enumerable:!(s=de(e,i))||s.enumerable});return t};var fe=(t,e,r)=>(r=t!=null?le(ue(t)):{},j(e||!t||!t.__esModule?L(r,"default",{value:t,enumerable:!0}):r,t)),xe=t=>j(L({},"__esModule",{value:!0}),t);var we={};pe(we,{TextButton:()=>Se});module.exports=xe(we);var l=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...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 C=(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"}),q=(t,e)=>{let{valid:r,invalid:s,hover:i,focus:c,checked:u,active:a,selected:y,disabled:b,indeterminate:p,loading:N,empty:f,readonly:_,highlighted:K,...w}=e;return l({"k-valid":r,"k-invalid":s,"k-hover":i,"k-focus":c,"k-checked":u,"k-active":a,"k-selected":y,"k-disabled":b,"k-indeterminate":p&&!u,"k-loading":N,"k-empty":f,"k-readonly":_,"k-highlighted":K},Object.keys(w).reduce((m,k)=>(k.startsWith("k-")?m[k]=w[k]:m[`k-${k}`]=w[k],m),{}))};function W(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"},T={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},I={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},x={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"},O={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 M=require("react/jsx-runtime"),H="k-font-icon",ge=[],he={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={},z=t=>{let{size:e,themeColor:r,icon:s,rotate:i,flip:c,...u}=t;return s?(0,M.jsx)("span",{...u,className:l(t.className,H,C(H,{size:e}),{[`k-i-${s}`]:s,[`k-color-${r}`]:r,[`k-rotate-${i}`]:i,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):(0,M.jsx)(M.Fragment,{})};z.states=ge;z.options=he;z.className=H;z.defaultOptions=be;var J=z;var S=require("react/jsx-runtime"),F="k-svg-icon",ve=[],ye={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:[x.outline,x.solid,x.duotone]},P={viewBox:"0 0 24 24",variant:x.outline},B=t=>{var N,f;let{size:e,themeColor:r,rotate:s,flip:i,viewBox:c=P.viewBox,variant:u=P.variant,icon:a,...y}=t;if(!a)return(0,S.jsx)(S.Fragment,{});if(a==="none")return(0,S.jsx)("span",{...y,className:l(t.className,F,C("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let b=typeof a=="object"&&a.name&&a.name,p=typeof a=="object"?u&&((N=a.variants)==null?void 0:N[u])||((f=a.variants)==null?void 0:f.outline)||a.content:void 0;return(0,S.jsx)("span",{...y,className:l(t.className,F,C("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,S.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof a=="object"?a.viewBox:c,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:a?void 0:t.children})})};B.states=ve;B.options=ye;B.className=F;B.defaultOptions=P;var U=B;var V=fe(require("@progress/kendo-svg-icons"));var Q="icon",X="icons";var ee=require("react");var Y=require("react"),Z=(0,Y.createContext)({iconsType:"svg"});var v=require("react/jsx-runtime"),$="k-icon",Ne=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),ke=[],Ce={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:[x.outline,x.solid,x.duotone]},R={viewBox:"0 0 24 24",type:"svg",variant:x.outline},g=t=>{let{iconsType:e}=(0,ee.useContext)(Z),{size:r,themeColor:s,icon:i,type:c=e||R.type,rotate:u,flip:a,viewBox:y=R.viewBox,variant:b=R.variant,...p}=t;if(!i)return(0,v.jsx)(v.Fragment,{});if((e||c)==="svg"){if(i==="none")return(0,v.jsx)(U,{...p,className:l(t.className,$),icon:i,size:r,variant:b});let f=V[i]?i:Ne(`${i}-icon`);return V[f]?(0,v.jsx)(U,{...p,className:l(t.className,$),icon:V[f],size:r,themeColor:s,rotate:u,flip:a,viewBox:y,variant:b}):(0,v.jsx)(v.Fragment,{})}return(0,v.jsx)(J,{...p,className:l(t.className,$),icon:i,size:r,themeColor:s,rotate:u,flip:a})};g.states=ke;g.options=Ce;g.defaultOptions=R;g.className=$;g.moduleName=Q;g.folderName=X;g.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 D="button",te=D;var d=require("react/jsx-runtime"),A="k-button",Te=["icon-button"],Ie=[O.hover,O.focus,O.active,O.selected,O.disabled,O.generating],Oe={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[T.undefined,T.none,T.small,T.medium,T.large,T.full],fillMode:[I.undefined,I.solid,I.flat,I.outline,I.clear,I.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},G={showArrow:!1,arrowIconName:"chevron-down"},h=t=>{let{as:e="button",size:r,rounded:s,fillMode:i,themeColor:c,showArrow:u=G.showArrow,arrowIconName:a=G.arrowIconName,variant:y,hover:b,focus:p,active:N,selected:f,disabled:_,togglable:K,ariaDisabled:w,icon:m,iconSize:k,text:E,iconClassName:ne,className:re,...ie}=t,se=m!=null,ae=t.children!==void 0;return(0,d.jsxs)(e,{className:l(re,A,W(A,y),C(A,{size:r,rounded:s,fillMode:i,themeColor:c}),q(A,{hover:b,focus:p,active:N,disabled:_||w,selected:f}),{"k-icon-button":!E&&!ae&&se}),"aria-pressed":K?f?"true":"false":void 0,...ie,"aria-disabled":w?"true":void 0,disabled:_||void 0,children:[typeof m=="string"&&m&&(0,d.jsx)(g,{className:l(ne,"k-button-icon"),icon:m,size:k}),m&&typeof m!="string"&&(0,d.jsx)(d.Fragment,{children:m}),E?(0,d.jsxs)(d.Fragment,{children:[E&&(0,d.jsx)("span",{className:"k-button-text",children:E}),t.children]}):t.children&&(0,d.jsx)("span",{className:"k-button-text",children:t.children}),u&&(0,d.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,d.jsx)(g,{icon:a})})]})};h.states=Ie;h.options=Oe;h.variants=Te;h.className=A;h.defaultOptions=G;h.moduleName=D;h.folderName=te;h.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 oe=require("react/jsx-runtime"),Se=t=>(0,oe.jsx)(h,{children:"Button",...t});