UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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