@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 8.86 kB
JavaScript
var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...e):typeof e=="object"?Object.keys(e).map((r,i)=>e[i]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var y=(t,e)=>d({[`${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"}),X=(t,e)=>{let{valid:r,invalid:i,hover:s,focus:c,checked:u,active:a,selected:g,disabled:h,indeterminate:p,loading:A,empty:b,readonly:z,highlighted:$,...T}=e;return d({"k-valid":r,"k-invalid":i,"k-hover":s,"k-focus":c,"k-checked":u,"k-active":a,"k-selected":g,"k-disabled":h,"k-indeterminate":p&&!u,"k-loading":A,"k-empty":b,"k-readonly":z,"k-highlighted":$},Object.keys(T).reduce((m,v)=>(v.startsWith("k-")?m[v]=T[v]:m[`k-${v}`]=T[v],m),{}))};function j(t,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(i=>[`k-${i}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},N={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},k={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},f={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"},C={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 K={};function J(t){return K[t]=(K[t]||0)+1,`k-${t}-${K[t]}`}import{Fragment as ge,jsx as Q}from"react/jsx-runtime";var H="k-font-icon",fe=[],xe={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]},he={},O=t=>{let{size:e,themeColor:r,icon:i,rotate:s,flip:c,...u}=t;return i?Q("span",{...u,className:d(t.className,H,y(H,{size:e}),{[`k-i-${i}`]:i,[`k-color-${r}`]:r,[`k-rotate-${s}`]:s,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):Q(ge,{})};O.states=fe;O.options=xe;O.className=H;O.defaultOptions=he;var Y=O;import{Fragment as ye,jsx as _}from"react/jsx-runtime";var F="k-svg-icon",be=[],ve={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:[f.outline,f.solid,f.duotone]},D={viewBox:"0 0 24 24",variant:f.outline},M=t=>{let{size:e,themeColor:r,rotate:i,flip:s,viewBox:c=D.viewBox,variant:u=D.variant,icon:a,...g}=t;if(!a)return _(ye,{});if(a==="none")return _("span",{...g,className:d(t.className,F,y("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let h=typeof a=="object"&&a.name&&a.name,p=typeof a=="object"?u&&a.variants?.[u]||a.variants?.outline||a.content:void 0;return _("span",{...g,className:d(t.className,F,y("k-icon",{size:e}),{[`k-svg-i-${h}`]:h,[`k-color-${r}`]:r,[`k-rotate-${i}`]:i,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:_("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})})};M.states=be;M.options=ve;M.className=F;M.defaultOptions=D;var U=M;import*as V from"@progress/kendo-svg-icons";var Z="icon",ee="icons";import{useContext as ke}from"react";import{createContext as Ne}from"react";var te=Ne({iconsType:"svg"});import{Fragment as oe,jsx as S}from"react/jsx-runtime";var L="k-icon",Ce=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Te=[],Be={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:[f.outline,f.solid,f.duotone]},R={viewBox:"0 0 24 24",type:"svg",variant:f.outline},x=t=>{let{iconsType:e}=ke(te),{size:r,themeColor:i,icon:s,type:c=e||R.type,rotate:u,flip:a,viewBox:g=R.viewBox,variant:h=R.variant,...p}=t;if(!s)return S(oe,{});if((e||c)==="svg"){if(s==="none")return S(U,{...p,className:d(t.className,L),icon:s,size:r,variant:h});let b=V[s]?s:Ce(`${s}-icon`);return V[b]?S(U,{...p,className:d(t.className,L),icon:V[b],size:r,themeColor:i,rotate:u,flip:a,viewBox:g,variant:h}):S(oe,{})}return S(Y,{...p,className:d(t.className,L),icon:s,size:r,themeColor:i,rotate:u,flip:a})};x.states=Te;x.options=Be;x.defaultOptions=R;x.className=L;x.moduleName=Z;x.folderName=ee;x.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 G="button",ne=G;import{Fragment as re,jsx as B,jsxs as ie}from"react/jsx-runtime";var w="k-button",Ie=["icon-button"],Oe=[C.hover,C.focus,C.active,C.selected,C.disabled,C.generating],Me={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[N.undefined,N.none,N.small,N.medium,N.large,N.full],fillMode:[k.undefined,k.solid,k.flat,k.outline,k.clear,k.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},q={showArrow:!1,arrowIconName:"chevron-down"},l=t=>{let{as:e="button",size:r,rounded:i,fillMode:s,themeColor:c,showArrow:u=q.showArrow,arrowIconName:a=q.arrowIconName,variant:g,hover:h,focus:p,active:A,selected:b,disabled:z,togglable:$,ariaDisabled:T,icon:m,iconSize:v,text:E,iconClassName:de,className:ce,...ue}=t,me=m!=null,pe=t.children!==void 0;return ie(e,{className:d(ce,w,j(w,g),y(w,{size:r,rounded:i,fillMode:s,themeColor:c}),X(w,{hover:h,focus:p,active:A,disabled:z||T,selected:b}),{"k-icon-button":!E&&!pe&&me}),"aria-pressed":$?b?"true":"false":void 0,...ue,"aria-disabled":T?"true":void 0,disabled:z||void 0,children:[typeof m=="string"&&m&&B(x,{className:d(de,"k-button-icon"),icon:m,size:v}),m&&typeof m!="string"&&B(re,{children:m}),E?ie(re,{children:[E&&B("span",{className:"k-button-text",children:E}),t.children]}):t.children&&B("span",{className:"k-button-text",children:t.children}),u&&B("span",{className:"k-menu-button-arrow k-button-arrow",children:B(x,{icon:a})})]})};l.states=Oe;l.options=Me;l.variants=Ie;l.className=w;l.defaultOptions=q;l.moduleName=G;l.folderName=ne;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."}]};import{jsx as Se}from"react/jsx-runtime";var se=t=>Se(l,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as we}from"react/jsx-runtime";var P=t=>we(l,{icon:"folder",children:"Button",...t});import{jsx as Ae}from"react/jsx-runtime";var ae=t=>Ae(l,{children:"Button",...t});import{jsx as W}from"react/jsx-runtime";var ze=l.options,Ee=l.states,_e={...l.defaultOptions,variant:"text"},Le=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Re=[],I=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return W(se,{...r,icon:"star"});case"icon-and-text":return W(P,{...r,icon:"star",children:"Button"});default:return W(ae,{...r,children:"Button"})}};I.options=ze;I.states=Ee;I.variants=Le;I.defaultOptions=_e;I.modifiers=Re;I.className=l.className;import{jsx as le,jsxs as $e}from"react/jsx-runtime";var Pe="k-prompt-expander",qt=t=>{let{title:e,children:r,expanded:i,...s}=t,c=J("prompt-expander-content");return $e("div",{...s,className:d(t.className,Pe),children:[le(P,{fillMode:"flat",icon:i?"chevron-up":"chevron-down","aria-expanded":i?"true":"false","aria-controls":i?c:void 0,children:e}),i&&le("div",{className:"k-prompt-expander-content",id:c,children:r})]})};export{Pe as PROMPTEXPANDER_CLASSNAME,qt as PromptExpander};