UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 14.6 kB
var ze=Object.create;var X=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty;var Fe=(e,t)=>{for(var o in t)X(e,o,{get:t[o],enumerable:!0})},le=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $e(t))!Ue.call(e,s)&&s!==o&&X(e,s,{get:()=>t[s],enumerable:!(r=He(t,s))||r.enumerable});return e};var Xe=(e,t,o)=>(o=e!=null?ze(De(e)):{},le(t||!e||!e.__esModule?X(o,"default",{value:e,enumerable:!0}):o,e)),Ve=e=>le(X({},"__esModule",{value:!0}),e);var Nt={};Fe(Nt,{PROMPT_BOX_CLASSNAME:()=>k,PromptBox:()=>E,default:()=>Tt});module.exports=Ve(Nt);var l=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?l(...t):typeof t=="object"?Object.keys(t).map((o,r)=>t[r]||t[o]&&o||null).filter(o=>o!==null).join(" "):t).filter(t=>!!t).join(" ");var T=(e,t)=>l({[`${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"}),pe=(e,t)=>{let{valid:o,invalid:r,hover:s,focus:u,checked:d,active:p,selected:B,disabled:f,indeterminate:x,loading:b,empty:g,readonly:P,highlighted:K,...C}=t;return l({"k-valid":o,"k-invalid":r,"k-hover":s,"k-focus":u,"k-checked":d,"k-active":p,"k-selected":B,"k-disabled":f,"k-indeterminate":x&&!d,"k-loading":b,"k-empty":g,"k-readonly":P,"k-highlighted":K},Object.keys(C).reduce((c,I)=>(I.startsWith("k-")?c[I]=C[I]:c[`k-${I}`]=C[I],c),{}))};function ue(e,t){if(!t)return{};let o=Array.isArray(t)?t:[t];return Object.fromEntries(o.map(r=>[`k-${r}`,!0]))}var a={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},_={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},v={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},O={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},n={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 de=require("react/jsx-runtime"),Q="k-input-inner",Ge=[],Je={},V={type:"text",autocomplete:"off",value:"",placeholder:""},R=e=>{let{value:t=V.value,type:o=V.type,placeholder:r=V.placeholder,autocomplete:s=V.autocomplete,disabled:u,readOnly:d,...p}=e;return(0,de.jsx)("input",{...p,type:o,className:l(e.className,Q,T(Q,e)),placeholder:r,autoComplete:s,defaultValue:t,disabled:u||void 0,readOnly:d||void 0})};R.states=Ge;R.options=Je;R.className=Q;var me=require("react/jsx-runtime"),Y="k-input-inner",qe=[],We={},ce={value:"",placeholder:""},z=e=>{let{value:t=ce.value,placeholder:o=ce.placeholder,rows:r,disabled:s,...u}=e;return(0,me.jsx)("textarea",{...u,className:l(e.className,Y,T(Y,e)),placeholder:o,rows:r,defaultValue:t,disabled:s||void 0})};z.states=qe;z.options=We;z.className=Y;var Z="prompt-box",fe=Z;var H=require("react/jsx-runtime"),j="k-font-icon",Qe=[],Ye={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info]},Ze={},$=e=>{let{size:t,themeColor:o,icon:r,rotate:s,flip:u,...d}=e;return r?(0,H.jsx)("span",{...d,className:l(e.className,j,T(j,{size:t}),{[`k-i-${r}`]:r,[`k-color-${o}`]:o,[`k-rotate-${s}`]:s,"k-flip-h":u==="h"||u==="both","k-flip-v":u==="v"||u==="both"}),"aria-hidden":"true"}):(0,H.jsx)(H.Fragment,{})};$.states=Qe;$.options=Ye;$.className=j;$.defaultOptions=Ze;var xe=$;var A=require("react/jsx-runtime"),ee="k-svg-icon",je=[],et={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[O.outline,O.solid,O.duotone]},te={viewBox:"0 0 24 24",variant:O.outline},D=e=>{var b,g;let{size:t,themeColor:o,rotate:r,flip:s,viewBox:u=te.viewBox,variant:d=te.variant,icon:p,...B}=e;if(!p)return(0,A.jsx)(A.Fragment,{});if(p==="none")return(0,A.jsx)("span",{...B,className:l(e.className,ee,T("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let f=typeof p=="object"&&p.name&&p.name,x=typeof p=="object"?d&&((b=p.variants)==null?void 0:b[d])||((g=p.variants)==null?void 0:g.outline)||p.content:void 0;return(0,A.jsx)("span",{...B,className:l(e.className,ee,T("k-icon",{size:t}),{[`k-svg-i-${f}`]:f,[`k-color-${o}`]:o,[`k-rotate-${r}`]:r,"k-flip-h":s==="h"||s==="both","k-flip-v":s==="v"||s==="both"}),"aria-hidden":"true",children:(0,A.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof p=="object"?p.viewBox:u,dangerouslySetInnerHTML:x!==void 0?{__html:x}:void 0,children:p?void 0:e.children})})};D.states=je;D.options=et;D.className=ee;D.defaultOptions=te;var oe=D;var ne=Xe(require("@progress/kendo-svg-icons"));var be="icon",he="icons";var Te=require("react");var ge=require("react"),ve=(0,ge.createContext)({iconsType:"svg"});var M=require("react/jsx-runtime"),G="k-icon",tt=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),ot=[],nt={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[O.outline,O.solid,O.duotone]},J={viewBox:"0 0 24 24",type:"svg",variant:O.outline},S=e=>{let{iconsType:t}=(0,Te.useContext)(ve),{size:o,themeColor:r,icon:s,type:u=t||J.type,rotate:d,flip:p,viewBox:B=J.viewBox,variant:f=J.variant,...x}=e;if(!s)return(0,M.jsx)(M.Fragment,{});if((t||u)==="svg"){if(s==="none")return(0,M.jsx)(oe,{...x,className:l(e.className,G),icon:s,size:o,variant:f});let g=ne[s]?s:tt(`${s}-icon`);return ne[g]?(0,M.jsx)(oe,{...x,className:l(e.className,G),icon:ne[g],size:o,themeColor:r,rotate:d,flip:p,viewBox:B,variant:f}):(0,M.jsx)(M.Fragment,{})}return(0,M.jsx)(xe,{...x,className:l(e.className,G),icon:s,size:o,themeColor:r,rotate:d,flip:p})};S.states=ot;S.options=nt;S.defaultOptions=J;S.className=G;S.moduleName=be;S.folderName=he;S.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 ae="button",Ne=ae;var h=require("react/jsx-runtime"),U="k-button",at=["icon-button"],rt=[N.hover,N.focus,N.active,N.selected,N.disabled,N.generating],st={size:[a.undefined,a.xsmall,a.small,a.medium,a.large],rounded:[_.undefined,_.none,_.small,_.medium,_.large,_.full],fillMode:[v.undefined,v.solid,v.flat,v.outline,v.clear,v.link],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info,n.inverse]},re={showArrow:!1,arrowIconName:"chevron-down"},i=e=>{let{as:t="button",size:o,rounded:r,fillMode:s,themeColor:u,showArrow:d=re.showArrow,arrowIconName:p=re.arrowIconName,variant:B,hover:f,focus:x,active:b,selected:g,disabled:P,togglable:K,ariaDisabled:C,icon:c,iconSize:I,text:F,iconClassName:Pe,className:Le,...we}=e,Ke=c!=null,Re=e.children!==void 0;return(0,h.jsxs)(t,{className:l(Le,U,ue(U,B),T(U,{size:o,rounded:r,fillMode:s,themeColor:u}),pe(U,{hover:f,focus:x,active:b,disabled:P||C,selected:g}),{"k-icon-button":!F&&!Re&&Ke}),"aria-pressed":K?g?"true":"false":void 0,...we,"aria-disabled":C?"true":void 0,disabled:P||void 0,children:[typeof c=="string"&&c&&(0,h.jsx)(S,{className:l(Pe,"k-button-icon"),icon:c,size:I}),c&&typeof c!="string"&&(0,h.jsx)(h.Fragment,{children:c}),F?(0,h.jsxs)(h.Fragment,{children:[F&&(0,h.jsx)("span",{className:"k-button-text",children:F}),e.children]}):e.children&&(0,h.jsx)("span",{className:"k-button-text",children:e.children}),d&&(0,h.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,h.jsx)(S,{icon:p})})]})};i.states=rt;i.options=st;i.variants=at;i.className=U;i.defaultOptions=re;i.moduleName=ae;i.folderName=Ne;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 ke=require("react/jsx-runtime"),q=e=>(0,ke.jsx)(i,{icon:"folder",...e,"aria-label":e["aria-label"]||"Folder",children:void 0});var Be=require("react/jsx-runtime"),ye=e=>(0,Be.jsx)(i,{icon:"folder",children:"Button",...e});var Se=require("react/jsx-runtime"),Oe=e=>(0,Se.jsx)(i,{children:"Button",...e});var W=require("react/jsx-runtime"),it=i.options,lt=i.states,pt={...i.defaultOptions,variant:"text"},ut=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],dt=[],L=e=>{let{variant:t,...o}=e;switch(t){case"icon-only":return(0,W.jsx)(q,{...o,icon:"star"});case"icon-and-text":return(0,W.jsx)(ye,{...o,icon:"star",children:"Button"});default:return(0,W.jsx)(Oe,{...o,children:"Button"})}};L.options=it;L.states=lt;L.variants=ut;L.defaultOptions=pt;L.modifiers=dt;L.className=i.className;var se="speech-to-text-button",Me=se;var Ie=require("react/jsx-runtime"),Ee="k-speech-to-text-button",Ce={icon:"microphone"},m=e=>{let{listening:t=!1,icon:o=Ce.icon,...r}=e;return(0,Ie.jsx)(i,{...r,icon:t?"stop":o,className:l(e.className,Ee,{"k-listening":t}),"aria-pressed":t?"true":"false","aria-label":t?"Stop listening":"Start listening"})};m.states=i.states;m.options=i.options;m.className=Ee;m.defaultOptions=Ce;m.moduleName=se;m.folderName=Me;m.ariaSpec={selector:".k-speech-to-text-button",rules:[{selector:".k-button.k-speech-to-text-button",attribute:"role=button or nodeName=button",usage:"If the used element is not <button>, explicitly set its role to button."},{selector:".k-button.k-speech-to-text-button",attribute:"aria-pressed",usage:"Announces the toggle behaviour of the button."},{selector:".k-button.k-speech-to-text-button",attribute:"aria-label",usage:"Accessible name for the speech-to-text button."}]};var ct=require("react/jsx-runtime");var mt=require("react/jsx-runtime");var Ae=require("react/jsx-runtime"),ft=i.states,_e={...i.defaultOptions,variant:"normal"},xt={...i.options,fillMode:i.options.fillMode.filter(e=>e!=="clear"&&e!=="link")},bt=[],ht=[{name:"normal",title:"Normal"},{name:"listening",title:"Listening"}],w=e=>{let{variant:t,...o}={..._e,...e},r={};return t==="listening"&&(r.listening=!0),(0,Ae.jsx)(m,{...o,...r})};w.options=xt;w.states=ft;w.variants=ht;w.defaultOptions=_e;w.modifiers=bt;w.className=m.className;var y=require("react/jsx-runtime"),k="k-prompt-box",gt=[N.hover,N.focus,N.disabled],vt={fillMode:[v.undefined,v.solid,v.flat,v.outline]},ie={lineMode:"auto",isExpanded:!1},E=e=>{let{fillMode:t,lineMode:o=ie.lineMode,startAffix:r,endAffix:s,header:u,isExpanded:d=ie.isExpanded,className:p,children:B,value:f,placeholder:x,generating:b,hover:g,focus:P,disabled:K,...C}=e,c=o==="multi"||o==="auto"&&d;return(0,y.jsxs)("div",{...C,className:l(p,"k-input",k,{[`${k}-singleline`]:o==="single",[`${k}-multiline`]:c,[`k-input-${t}`]:t,"k-hover":g,"k-focus":P,"k-disabled":K}),children:[u&&(0,y.jsx)("div",{className:`${k}-header`,children:u}),(0,y.jsxs)("div",{className:`${k}-content`,children:[r&&(0,y.jsx)("div",{className:`${k}-affix`,children:r}),o==="single"?(0,y.jsx)(R,{value:f,placeholder:x,className:`${k}-input`,type:"text","aria-label":"Prompt input"}):(0,y.jsx)(z,{value:f,placeholder:x,className:`${k}-textarea`,rows:o==="multi"||d?3:1,"aria-label":"Prompt input","aria-multiline":"true"}),(0,y.jsxs)("div",{className:`${k}-affix`,children:[s,(0,y.jsx)(m,{size:"small",fillMode:"flat",rounded:"full"}),(0,y.jsx)(q,{icon:b?"stop":"arrow-up",size:"small",rounded:"full",active:b,disabled:!f&&!b,className:l({"k-generating":b}),"aria-label":b?"Stop generating":"Send prompt","aria-live":"polite"})]})]}),B]})};E.states=gt;E.options=vt;E.className=k;E.defaultOptions=ie;E.moduleName=Z;E.folderName=fe;E.ariaSpec={selector:".k-prompt-box",rules:[{selector:".k-prompt-box-singleline .k-prompt-box-input",attribute:"nodeName=input",usage:"Ensures the input field has the proper textbox role."},{selector:".k-prompt-box-singleline .k-prompt-box-input",attribute:"aria-label",usage:"Provides an accessible label for the single-line input."},{selector:".k-prompt-box-multiline .k-prompt-box-textarea",attribute:"nodeName=textarea",usage:"Ensures the textarea has the proper textbox role."},{selector:".k-prompt-box-multiline .k-prompt-box-textarea",attribute:"aria-label",usage:"Provides an accessible label for the textarea."},{selector:".k-prompt-box-multiline .k-prompt-box-textarea",attribute:"aria-multiline=true",usage:"Indicates the textarea supports multiple lines of text."},{selector:".k-prompt-box:not(.k-prompt-box-singleline):not(.k-prompt-box-multiline) .k-prompt-box-textarea",attribute:"nodeName=textarea",usage:"Ensures the auto-mode textarea has the proper textbox role."},{selector:".k-prompt-box:not(.k-prompt-box-singleline):not(.k-prompt-box-multiline) .k-prompt-box-textarea",attribute:"aria-label",usage:"Provides an accessible label for the auto-mode textarea."},{selector:".k-prompt-box:not(.k-prompt-box-singleline):not(.k-prompt-box-multiline) .k-prompt-box-textarea",attribute:"aria-multiline=true",usage:"Indicates the auto-mode textarea supports multiple lines of text."},{selector:".k-prompt-box-affix .k-button:not(.k-speech-to-text-button)",attribute:"aria-label",usage:"The send/stop button is labelled to indicate its current action."},{selector:".k-prompt-box-affix .k-button:not(.k-speech-to-text-button)",attribute:"aria-live=polite",usage:"Announces the change in status of the send/stop button."}]};var Tt=E;