UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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