@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 12.9 kB
JavaScript
var Ee=Object.create;var $=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty;var De=(e,t)=>{for(var o in t)$(e,o,{get:t[o],enumerable:!0})},ie=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ze(t))!Ue.call(e,s)&&s!==o&&$(e,s,{get:()=>t[s],enumerable:!(r=_e(t,s))||r.enumerable});return e};var Ke=(e,t,o)=>(o=e!=null?Ee(we(e)):{},ie(t||!e||!e.__esModule?$(o,"default",{value:e,enumerable:!0}):o,e)),Re=e=>ie($({},"__esModule",{value:!0}),e);var lt={};De(lt,{UPLOAD_CLASSNAME:()=>W,Upload:()=>T,default:()=>rt});module.exports=Re(lt);var d=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?d(...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 B=(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"}),_=(e,t)=>{let{valid:o,invalid:r,hover:s,focus:u,checked:p,active:i,selected:g,disabled:f,indeterminate:N,loading:O,empty:v,readonly:R,highlighted:Z,...E}=t;return d({"k-valid":o,"k-invalid":r,"k-hover":s,"k-focus":u,"k-checked":p,"k-active":i,"k-selected":g,"k-disabled":f,"k-indeterminate":N&&!p,"k-loading":O,"k-empty":v,"k-readonly":R,"k-highlighted":Z},Object.keys(E).reduce((x,A)=>(A.startsWith("k-")?x[A]=E[A]:x[`k-${A}`]=E[A],x),{}))};function re(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"},M={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},I={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},y={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"},b={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 J="action-buttons",le=J;var ce=require("react/jsx-runtime"),H="k-actions",Pe=[],$e={},Q={alignment:"start",orientation:"horizontal"},S=e=>{let{alignment:t=Q.alignment,orientation:o=Q.orientation,...r}=e;return(0,ce.jsx)("div",{...r,className:d(H,{[`${H}-${t}`]:t,[`${H}-${o}`]:o},e.className),children:e.children})};S.states=Pe;S.options=$e;S.className=H;S.defaultOptions=Q;S.moduleName=J;S.folderName=le;var de=S;var w=require("react/jsx-runtime"),X="k-font-icon",He=[],Fe={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]},Ve={},U=e=>{let{size:t,themeColor:o,icon:r,rotate:s,flip:u,...p}=e;return r?(0,w.jsx)("span",{...p,className:d(e.className,X,B(X,{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,w.jsx)(w.Fragment,{})};U.states=He;U.options=Fe;U.className=X;U.defaultOptions=Ve;var ue=U;var L=require("react/jsx-runtime"),Y="k-svg-icon",Ge=[],qe={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:[y.outline,y.solid,y.duotone]},j={viewBox:"0 0 24 24",variant:y.outline},D=e=>{var O,v;let{size:t,themeColor:o,rotate:r,flip:s,viewBox:u=j.viewBox,variant:p=j.variant,icon:i,...g}=e;if(!i)return(0,L.jsx)(L.Fragment,{});if(i==="none")return(0,L.jsx)("span",{...g,className:d(e.className,Y,B("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let f=typeof i=="object"&&i.name&&i.name,N=typeof i=="object"?p&&((O=i.variants)==null?void 0:O[p])||((v=i.variants)==null?void 0:v.outline)||i.content:void 0;return(0,L.jsx)("span",{...g,className:d(e.className,Y,B("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,L.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof i=="object"?i.viewBox:u,dangerouslySetInnerHTML:N!==void 0?{__html:N}:void 0,children:i?void 0:e.children})})};D.states=Ge;D.options=qe;D.className=Y;D.defaultOptions=j;var ee=D;var te=Ke(require("@progress/kendo-svg-icons"));var pe="icon",me="icons";var xe=require("react");var fe=require("react"),he=(0,fe.createContext)({iconsType:"svg"});var k=require("react/jsx-runtime"),F="k-icon",We=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),Ze=[],Je={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:[y.outline,y.solid,y.duotone]},V={viewBox:"0 0 24 24",type:"svg",variant:y.outline},m=e=>{let{iconsType:t}=(0,xe.useContext)(he),{size:o,themeColor:r,icon:s,type:u=t||V.type,rotate:p,flip:i,viewBox:g=V.viewBox,variant:f=V.variant,...N}=e;if(!s)return(0,k.jsx)(k.Fragment,{});if((t||u)==="svg"){if(s==="none")return(0,k.jsx)(ee,{...N,className:d(e.className,F),icon:s,size:o,variant:f});let v=te[s]?s:We(`${s}-icon`);return te[v]?(0,k.jsx)(ee,{...N,className:d(e.className,F),icon:te[v],size:o,themeColor:r,rotate:p,flip:i,viewBox:g,variant:f}):(0,k.jsx)(k.Fragment,{})}return(0,k.jsx)(ue,{...N,className:d(e.className,F),icon:s,size:o,themeColor:r,rotate:p,flip:i})};m.states=Ze;m.options=Je;m.defaultOptions=V;m.className=F;m.moduleName=pe;m.folderName=me;m.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 oe="button",be=oe;var h=require("react/jsx-runtime"),K="k-button",Qe=["icon-button"],Xe=[b.hover,b.focus,b.active,b.selected,b.disabled,b.generating],Ye={size:[a.undefined,a.xsmall,a.small,a.medium,a.large],rounded:[M.undefined,M.none,M.small,M.medium,M.large,M.full],fillMode:[I.undefined,I.solid,I.flat,I.outline,I.clear,I.link],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info,n.inverse]},ne={showArrow:!1,arrowIconName:"chevron-down"},l=e=>{let{as:t="button",size:o,rounded:r,fillMode:s,themeColor:u,showArrow:p=ne.showArrow,arrowIconName:i=ne.arrowIconName,variant:g,hover:f,focus:N,active:O,selected:v,disabled:R,togglable:Z,ariaDisabled:E,icon:x,iconSize:A,text:P,iconClassName:Be,className:Me,...Ie}=e,Se=x!=null,Le=e.children!==void 0;return(0,h.jsxs)(t,{className:d(Me,K,re(K,g),B(K,{size:o,rounded:r,fillMode:s,themeColor:u}),_(K,{hover:f,focus:N,active:O,disabled:R||E,selected:v}),{"k-icon-button":!P&&!Le&&Se}),"aria-pressed":Z?v?"true":"false":void 0,...Ie,"aria-disabled":E?"true":void 0,disabled:R||void 0,children:[typeof x=="string"&&x&&(0,h.jsx)(m,{className:d(Be,"k-button-icon"),icon:x,size:A}),x&&typeof x!="string"&&(0,h.jsx)(h.Fragment,{children:x}),P?(0,h.jsxs)(h.Fragment,{children:[P&&(0,h.jsx)("span",{className:"k-button-text",children:P}),e.children]}):e.children&&(0,h.jsx)("span",{className:"k-button-text",children:e.children}),p&&(0,h.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,h.jsx)(m,{icon:i})})]})};l.states=Xe;l.options=Ye;l.variants=Qe;l.className=K;l.defaultOptions=ne;l.moduleName=oe;l.folderName=be;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 Ne=require("react/jsx-runtime"),ge=e=>(0,Ne.jsx)(l,{icon:"folder",...e,"aria-label":e["aria-label"]||"Folder",children:void 0});var ye=require("react/jsx-runtime"),ve=e=>(0,ye.jsx)(l,{icon:"folder",children:"Button",...e});var Te=require("react/jsx-runtime"),ke=e=>(0,Te.jsx)(l,{children:"Button",...e});var G=require("react/jsx-runtime"),je=l.options,et=l.states,tt={...l.defaultOptions,variant:"text"},ot=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],nt=[],z=e=>{let{variant:t,...o}=e;switch(t){case"icon-only":return(0,G.jsx)(ge,{...o,icon:"star"});case"icon-and-text":return(0,G.jsx)(ve,{...o,icon:"star",children:"Button"});default:return(0,G.jsx)(ke,{...o,children:"Button"})}};z.options=je;z.states=et;z.variants=ot;z.defaultOptions=tt;z.modifiers=nt;z.className=l.className;var c=require("react/jsx-runtime"),ae="k-upload-dropzone",at=[b.hover],q=e=>{let{hover:t,status:o,disabled:r,hasFiles:s,filesId:u,...p}=e,i;switch(o){case"uploading":i=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(m,{icon:"upload"}),"Uploading..."]});break;case"done":i=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(m,{icon:"check"}),"Done"]});break;case"failed":i=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(m,{icon:"exclamation-circle"}),"Done"]});break;default:i=(0,c.jsx)(c.Fragment,{});break}return(0,c.jsxs)("div",{...p,className:d(e.className,ae,"k-dropzone",_(ae,{hover:t})),children:[(0,c.jsxs)("div",{className:"k-upload-button-wrap",children:[(0,c.jsx)(l,{className:"k-upload-button","aria-disabled":r?"true":"false",...s&&u?{"aria-controls":u}:{},children:"Select files..."}),(0,c.jsx)("input",{id:"upload-input",className:"k-hidden",tabIndex:-1,"aria-hidden":"true"})]}),(0,c.jsx)("span",{className:d("k-dropzone-hint",{"k-hidden":o!=="upload"}),children:"Drop files here to upload"}),o!=="upload"&&(0,c.jsx)("span",{className:"k-upload-status",children:i})]})};q.states=at;q.className=ae;var se="upload",Ce=se;var C=require("react/jsx-runtime"),W="k-upload",st=[b.hover,b.disabled],it={},Ae={actionsLayout:"end"},Oe="upload-files-list",T=e=>{let{async:t,empty:o,actions:r,actionsLayout:s=Ae.actionsLayout,hover:u,status:p,disabled:i,...g}=e,f=!!e.children;return(0,C.jsxs)("div",{...g,className:d(e.className,W,_(W,{disabled:i}),{"k-upload-async":t,"k-upload-empty":o}),children:[(0,C.jsx)(q,{status:p,hover:u,disabled:i,hasFiles:f,filesId:Oe}),f&&(0,C.jsx)("ul",{className:"k-upload-files",role:"list",id:Oe,children:e.children}),r&&f&&(0,C.jsxs)(de,{alignment:s,orientation:"horizontal",children:[(0,C.jsx)(l,{className:"k-clear-selected",children:"Clear"}),(0,C.jsx)(l,{themeColor:"primary",className:"k-upload-selected",children:"Upload"})]})]})};T.states=st;T.options=it;T.className=W;T.defaultOptions=Ae;T.moduleName=se;T.folderName=Ce;T.ariaSpec={selector:".k-upload",rules:[{selector:".k-upload .k-upload-button",attribute:"aria-disabled",usage:"Announces the disabled state of the upload button."},{selector:".k-upload .k-upload-button",attribute:"aria-controls (when present)",usage:"Creates the relationship between the button and the list of selected files when the list is present."},{selector:".k-upload input",attribute:"tabindex=-1",usage:"Assures that the input element inside the upload is not focusable."},{selector:".k-upload input",attribute:"aria-hidden=true",usage:"The input needs to be hidden from screen readers."},{selector:".k-upload-files",attribute:"role=list",usage:"Explicitly sets the UL role to list."},{selector:".k-upload-files",attribute:"id",usage:"Unique and deterministic id linked to the button aria-controls attribute."},{selector:".k-upload-files .k-file",attribute:"role=listitem",usage:"Explicitly sets the LI role to listitem."},{selector:".k-upload .k-file .k-file-validation-message",attribute:"aria-live=polite",usage:"Announces the change in the upload status of the file."},{selector:".k-upload .k-upload-actions .k-upload-action",attribute:"aria-label",usage:"Provides accessible names for the file action buttons."},{selector:".k-upload .k-upload-actions .k-upload-action",attribute:"tabindex=-1",usage:"The list file action buttons are not focusable elements."}]};var rt=T;