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