UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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