UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 8.73 kB
var l=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...e):typeof e=="object"?Object.keys(e).map((r,d)=>e[d]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var y=(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"}),W=(t,e)=>{let{valid:r,invalid:d,hover:s,focus:c,checked:u,active:a,selected:h,disabled:g,indeterminate:p,loading:A,empty:b,readonly:_,highlighted:R,...C}=e;return l({"k-valid":r,"k-invalid":d,"k-hover":s,"k-focus":c,"k-checked":u,"k-active":a,"k-selected":h,"k-disabled":g,"k-indeterminate":p&&!u,"k-loading":A,"k-empty":b,"k-readonly":_,"k-highlighted":R},Object.keys(C).reduce((m,v)=>(v.startsWith("k-")?m[v]=C[v]:m[`k-${v}`]=C[v],m),{}))};function j(t,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(d=>[`k-${d}`,!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"},B={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"},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"};import{Fragment as he,jsx as J}from"react/jsx-runtime";var $="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]},ge={},O=t=>{let{size:e,themeColor:r,icon:d,rotate:s,flip:c,...u}=t;return d?J("span",{...u,className:l(t.className,$,y($,{size:e}),{[`k-i-${d}`]:d,[`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"}):J(he,{})};O.states=fe;O.options=xe;O.className=$;O.defaultOptions=ge;var Q=O;import{Fragment as ye,jsx as K}from"react/jsx-runtime";var H="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]},F={viewBox:"0 0 24 24",variant:f.outline},I=t=>{let{size:e,themeColor:r,rotate:d,flip:s,viewBox:c=F.viewBox,variant:u=F.variant,icon:a,...h}=t;if(!a)return K(ye,{});if(a==="none")return K("span",{...h,className:l(t.className,H,y("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let g=typeof a=="object"&&a.name&&a.name,p=typeof a=="object"?u&&a.variants?.[u]||a.variants?.outline||a.content:void 0;return K("span",{...h,className:l(t.className,H,y("k-icon",{size:e}),{[`k-svg-i-${g}`]:g,[`k-color-${r}`]:r,[`k-rotate-${d}`]:d,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:K("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})})};I.states=be;I.options=ve;I.className=H;I.defaultOptions=F;var U=I;import*as D from"@progress/kendo-svg-icons";var X="icon",Y="icons";import{useContext as Be}from"react";import{createContext as Ne}from"react";var Z=Ne({iconsType:"svg"});import{Fragment as ee,jsx as M}from"react/jsx-runtime";var L="k-icon",ke=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Ce=[],Se={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]},P={viewBox:"0 0 24 24",type:"svg",variant:f.outline},x=t=>{let{iconsType:e}=Be(Z),{size:r,themeColor:d,icon:s,type:c=e||P.type,rotate:u,flip:a,viewBox:h=P.viewBox,variant:g=P.variant,...p}=t;if(!s)return M(ee,{});if((e||c)==="svg"){if(s==="none")return M(U,{...p,className:l(t.className,L),icon:s,size:r,variant:g});let b=D[s]?s:ke(`${s}-icon`);return D[b]?M(U,{...p,className:l(t.className,L),icon:D[b],size:r,themeColor:d,rotate:u,flip:a,viewBox:h,variant:g}):M(ee,{})}return M(Q,{...p,className:l(t.className,L),icon:s,size:r,themeColor:d,rotate:u,flip:a})};x.states=Ce;x.options=Se;x.defaultOptions=P;x.className=L;x.moduleName=X;x.folderName=Y;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 V="button",te=V;import{Fragment as oe,jsx as S,jsxs as ne}from"react/jsx-runtime";var w="k-button",Te=["icon-button"],Oe=[k.hover,k.focus,k.active,k.selected,k.disabled,k.generating],Ie={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:[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]},G={showArrow:!1,arrowIconName:"chevron-down"},i=t=>{let{as:e="button",size:r,rounded:d,fillMode:s,themeColor:c,showArrow:u=G.showArrow,arrowIconName:a=G.arrowIconName,variant:h,hover:g,focus:p,active:A,selected:b,disabled:_,togglable:R,ariaDisabled:C,icon:m,iconSize:v,text:E,iconClassName:de,className:ce,...ue}=t,me=m!=null,pe=t.children!==void 0;return ne(e,{className:l(ce,w,j(w,h),y(w,{size:r,rounded:d,fillMode:s,themeColor:c}),W(w,{hover:g,focus:p,active:A,disabled:_||C,selected:b}),{"k-icon-button":!E&&!pe&&me}),"aria-pressed":R?b?"true":"false":void 0,...ue,"aria-disabled":C?"true":void 0,disabled:_||void 0,children:[typeof m=="string"&&m&&S(x,{className:l(de,"k-button-icon"),icon:m,size:v}),m&&typeof m!="string"&&S(oe,{children:m}),E?ne(oe,{children:[E&&S("span",{className:"k-button-text",children:E}),t.children]}):t.children&&S("span",{className:"k-button-text",children:t.children}),u&&S("span",{className:"k-menu-button-arrow k-button-arrow",children:S(x,{icon:a})})]})};i.states=Oe;i.options=Ie;i.variants=Te;i.className=w;i.defaultOptions=G;i.moduleName=V;i.folderName=te;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."}]};import{jsx as Me}from"react/jsx-runtime";var re=t=>Me(i,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as we}from"react/jsx-runtime";var ie=t=>we(i,{icon:"folder",children:"Button",...t});import{jsx as ze}from"react/jsx-runtime";var se=t=>ze(i,{children:"Button",...t});import{jsx as q}from"react/jsx-runtime";var Ae=i.options,_e=i.states,Ee={...i.defaultOptions,variant:"text"},Ke=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Le=[],T=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return q(re,{...r,icon:"star"});case"icon-and-text":return q(ie,{...r,icon:"star",children:"Button"});default:return q(se,{...r,children:"Button"})}};T.options=Ae;T.states=_e;T.variants=Ke;T.defaultOptions=Ee;T.modifiers=Le;T.className=i.className;import{jsx as Pe}from"react/jsx-runtime";var ae="k-prompt-send",le={generating:!1},z=t=>{let{generating:e=le.generating,...r}=t;return Pe(i,{...r,className:l(t.className,ae,{"k-generating":e}),icon:e?"stop-sm":"paper-plane",active:e,fillMode:"flat","aria-label":e?"Stop generating":"Send prompt"})};z.states=i.states;z.options=i.options;z.className=ae;z.defaultOptions=le;var Wt=z;export{z as PromptSendButton,Wt as default};