UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 17.1 kB
var st=Object.create;var ie=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var dt=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var ct=(t,e)=>{for(var o in e)ie(t,o,{get:e[o],enumerable:!0})},we=(t,e,o,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of lt(e))!ut.call(t,n)&&n!==o&&ie(t,n,{get:()=>e[n],enumerable:!(l=rt(e,n))||l.enumerable});return t};var pt=(t,e,o)=>(o=t!=null?st(dt(t)):{},we(e||!t||!t.__esModule?ie(o,"default",{value:t,enumerable:!0}):o,t)),mt=t=>we(ie({},"__esModule",{value:!0}),t);var lo={};ct(lo,{TextboxSuffix:()=>ro});module.exports=mt(lo);var s=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?s(...e):typeof e=="object"?Object.keys(e).map((o,l)=>e[l]||e[o]&&o||null).filter(o=>o!==null).join(" "):e).filter(e=>!!e).join(" ");var I=(t,e)=>s({[`${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"}),K=(t,e)=>{let{valid:o,invalid:l,hover:n,focus:d,checked:p,active:u,selected:N,disabled:g,indeterminate:f,loading:y,empty:T,readonly:_,highlighted:H,...C}=e;return s({"k-valid":o,"k-invalid":l,"k-hover":n,"k-focus":d,"k-checked":p,"k-active":u,"k-selected":N,"k-disabled":g,"k-indeterminate":f&&!p,"k-loading":y,"k-empty":T,"k-readonly":_,"k-highlighted":H},Object.keys(C).reduce((S,O)=>(O.startsWith("k-")?S[O]=C[O]:S[`k-${O}`]=C[O],S),{}))};function ze(t,e){if(!e)return{};let o=Array.isArray(e)?e:[e];return Object.fromEntries(o.map(l=>[`k-${l}`,!0]))}var a={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"},m={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},E={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},r={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},i={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 Ie="textbox",Pe=Ie;var J="input",se=J;var Re=require("react/jsx-runtime"),re="k-input",ft=[i.hover,i.focus,i.valid,i.invalid,i.required,i.disabled,i.loading,i.readonly],xt={size:[a.undefined,a.small,a.medium,a.large],rounded:[c.undefined,c.none,c.small,c.medium,c.large,c.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},bt={},k=t=>{let{hover:e,focus:o,disabled:l,invalid:n,valid:d,loading:p,readonly:u,size:N,rounded:g,fillMode:f,...y}=t;return(0,Re.jsx)("span",{...y,className:s(t.className,re,I(re,{size:N,rounded:g,fillMode:f}),K(re,{hover:e,focus:o,disabled:l,invalid:n,valid:d,loading:p,readonly:u}))})};k.states=ft;k.options=xt;k.className=re;k.defaultOptions=bt;k.moduleName=J;k.folderName=se;var _e=require("react/jsx-runtime"),le="k-picker",ht=[i.hover,i.focus,i.valid,i.invalid,i.required,i.disabled,i.loading,i.readonly],Nt={size:[a.undefined,a.small,a.medium,a.large],rounded:[c.undefined,c.none,c.small,c.medium,c.large,c.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},gt={},V=t=>{let{hover:e,focus:o,disabled:l,invalid:n,valid:d,loading:p,readonly:u,size:N,rounded:g,fillMode:f,...y}=t;return(0,_e.jsx)("span",{...y,className:s(t.className,le,I(le,{size:N,rounded:g,fillMode:f}),K(le,{hover:e,focus:o,disabled:l,invalid:n,valid:d,loading:p,readonly:u})),children:t.children})};V.states=ht;V.options=Nt;V.className=le;V.defaultOptions=gt;V.moduleName=J;V.folderName=se;var W=require("react/jsx-runtime"),ve="k-font-icon",It=[],vt={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[r.undefined,r.base,r.primary,r.secondary,r.tertiary,r.success,r.warning,r.error,r.info]},yt={},Q=t=>{let{size:e,themeColor:o,icon:l,rotate:n,flip:d,...p}=t;return l?(0,W.jsx)("span",{...p,className:s(t.className,ve,I(ve,{size:e}),{[`k-i-${l}`]:l,[`k-color-${o}`]:o,[`k-rotate-${n}`]:n,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):(0,W.jsx)(W.Fragment,{})};Q.states=It;Q.options=vt;Q.className=ve;Q.defaultOptions=yt;var He=Q;var w=require("react/jsx-runtime"),ye="k-svg-icon",Tt=[],St={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[r.undefined,r.base,r.primary,r.secondary,r.tertiary,r.success,r.warning,r.error,r.info],variant:[E.outline,E.solid,E.duotone]},Te={viewBox:"0 0 24 24",variant:E.outline},Y=t=>{var y,T;let{size:e,themeColor:o,rotate:l,flip:n,viewBox:d=Te.viewBox,variant:p=Te.variant,icon:u,...N}=t;if(!u)return(0,w.jsx)(w.Fragment,{});if(u==="none")return(0,w.jsx)("span",{...N,className:s(t.className,ye,I("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let g=typeof u=="object"&&u.name&&u.name,f=typeof u=="object"?p&&((y=u.variants)==null?void 0:y[p])||((T=u.variants)==null?void 0:T.outline)||u.content:void 0;return(0,w.jsx)("span",{...N,className:s(t.className,ye,I("k-icon",{size:e}),{[`k-svg-i-${g}`]:g,[`k-color-${o}`]:o,[`k-rotate-${l}`]:l,"k-flip-h":n==="h"||n==="both","k-flip-v":n==="v"||n==="both"}),"aria-hidden":"true",children:(0,w.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof u=="object"?u.viewBox:d,dangerouslySetInnerHTML:f!==void 0?{__html:f}:void 0,children:u?void 0:t.children})})};Y.states=Tt;Y.options=St;Y.className=ye;Y.defaultOptions=Te;var Se=Y;var ke=pt(require("@progress/kendo-svg-icons"));var Ke="icon",Ve="icons";var Ue=require("react");var $e=require("react"),De=(0,$e.createContext)({iconsType:"svg"});var A=require("react/jsx-runtime"),de="k-icon",kt=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Mt=[],Ot={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[r.undefined,r.base,r.primary,r.secondary,r.tertiary,r.success,r.warning,r.error,r.info],variant:[E.outline,E.solid,E.duotone]},ue={viewBox:"0 0 24 24",type:"svg",variant:E.outline},b=t=>{let{iconsType:e}=(0,Ue.useContext)(De),{size:o,themeColor:l,icon:n,type:d=e||ue.type,rotate:p,flip:u,viewBox:N=ue.viewBox,variant:g=ue.variant,...f}=t;if(!n)return(0,A.jsx)(A.Fragment,{});if((e||d)==="svg"){if(n==="none")return(0,A.jsx)(Se,{...f,className:s(t.className,de),icon:n,size:o,variant:g});let T=ke[n]?n:kt(`${n}-icon`);return ke[T]?(0,A.jsx)(Se,{...f,className:s(t.className,de),icon:ke[T],size:o,themeColor:l,rotate:p,flip:u,viewBox:N,variant:g}):(0,A.jsx)(A.Fragment,{})}return(0,A.jsx)(He,{...f,className:s(t.className,de),icon:n,size:o,themeColor:l,rotate:p,flip:u})};b.states=Mt;b.options=Ot;b.defaultOptions=ue;b.className=de;b.moduleName=Ke;b.folderName=Ve;b.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 $=require("react/jsx-runtime"),Fe="k-clear-value",Ct=[i.disabled,i.loading,i.readonly],Lt={},z=t=>{let{disabled:e,loading:o,readonly:l,value:n}=t;return e||l||o||!n?(0,$.jsx)($.Fragment,{}):(0,$.jsx)("span",{className:s(t.className,Fe),children:(0,$.jsx)(b,{icon:"x"})})};z.states=Ct;z.options=Lt;z.className=Fe;var Xe=require("react/jsx-runtime"),Me="k-input-inner",Et=[],At={},ce={type:"text",autocomplete:"off",value:"",placeholder:""},P=t=>{let{value:e=ce.value,type:o=ce.type,placeholder:l=ce.placeholder,autocomplete:n=ce.autocomplete,disabled:d,readOnly:p,...u}=t;return(0,Xe.jsx)("input",{...u,type:o,className:s(t.className,Me,I(Me,t)),placeholder:l,autoComplete:n,defaultValue:e,disabled:d||void 0,readOnly:p||void 0})};P.states=Et;P.options=At;P.className=Me;var Z=require("react/jsx-runtime"),Oe="k-input-inner",Bt=[],wt={},Ce=t=>{let{value:e,placeholder:o,showValue:l,valueIcon:n,valueIconName:d,...p}=t;return(0,Z.jsxs)("span",{...p,className:s(t.className,Oe,I(Oe,t)),children:[n,!n&&d&&(0,Z.jsx)(b,{className:"k-input-value-icon",icon:d}),l&&!e&&o,l&&e&&(0,Z.jsx)("span",{className:"k-input-value-text",children:e})]})};Ce.states=Bt;Ce.options=wt;Ce.className=Oe;var Ge=require("react/jsx-runtime"),Le="k-input-inner",zt=[],Pt={},qe={value:"",placeholder:""},Ee=t=>{let{value:e=qe.value,placeholder:o=qe.placeholder,rows:l,disabled:n,...d}=t;return(0,Ge.jsx)("textarea",{...d,className:s(t.className,Le,I(Le,t)),placeholder:o,rows:l,defaultValue:e,disabled:n||void 0})};Ee.states=zt;Ee.options=Pt;Ee.className=Le;var j=require("react/jsx-runtime"),Je="k-input-loading-icon",Rt=[i.disabled,i.loading],D=t=>{let{disabled:e,loading:o}=t;return e||!o?(0,j.jsx)(j.Fragment,{}):(0,j.jsx)("span",{className:s(t.className,Je,"k-icon k-i-loading")})};D.states=Rt;D.className=Je;var ee=require("react/jsx-runtime"),We="k-input-validation-icon",_t=[i.valid,i.invalid,i.disabled,i.loading],Ht={},R=t=>{let{valid:e,invalid:o,disabled:l,loading:n}=t,d=o?"warning-circle":"check-circle";return l||n||!!!(e||o)?(0,ee.jsx)(ee.Fragment,{}):(0,ee.jsx)(b,{className:s(We),icon:d})};R.states=_t;R.options=Ht;R.className=We;var te=require("react/jsx-runtime"),Kt="k-input-prefix",Vt={direction:"horizontal"},pe=t=>{let{direction:e=Vt.direction,...o}=t;return t.children?(0,te.jsx)("span",{...o,className:s(Kt,t.className,{[`k-input-prefix-${e}`]:e}),children:t.children}):(0,te.jsx)(te.Fragment,{})};var oe=require("react/jsx-runtime"),$t="k-input-suffix",Dt={direction:"horizontal"},me=t=>{let{direction:e=Dt.direction,...o}=t;return t.children?(0,oe.jsx)("span",{...o,className:s($t,t.className,{[`k-input-suffix-${e}`]:e}),children:t.children}):(0,oe.jsx)(oe.Fragment,{})};var Ut=require("react/jsx-runtime");var Ft=require("react/jsx-runtime");var Ye=require("react/jsx-runtime"),Qe="k-input-separator",Xt={direction:"vertical"},U=t=>{let{direction:e=Xt.direction,...o}=t;return(0,Ye.jsx)("span",{...o,className:s(Qe,t.className,{[`${Qe}-${e}`]:e})})};var Ae="button",Ze=Ae;var M=require("react/jsx-runtime"),ne="k-button",qt=["icon-button"],Gt=[i.hover,i.focus,i.active,i.selected,i.disabled,i.generating],Jt={size:[a.undefined,a.xsmall,a.small,a.medium,a.large],rounded:[c.undefined,c.none,c.small,c.medium,c.large,c.full],fillMode:[m.undefined,m.solid,m.flat,m.outline,m.clear,m.link],themeColor:[r.undefined,r.base,r.primary,r.secondary,r.tertiary,r.success,r.warning,r.error,r.info,r.inverse]},Be={showArrow:!1,arrowIconName:"chevron-down"},x=t=>{let{as:e="button",size:o,rounded:l,fillMode:n,themeColor:d,showArrow:p=Be.showArrow,arrowIconName:u=Be.arrowIconName,variant:N,hover:g,focus:f,active:y,selected:T,disabled:_,togglable:H,ariaDisabled:C,icon:S,iconSize:O,text:L,iconClassName:ae,className:be,...he}=t,Ne=S!=null,ge=t.children!==void 0;return(0,M.jsxs)(e,{className:s(be,ne,ze(ne,N),I(ne,{size:o,rounded:l,fillMode:n,themeColor:d}),K(ne,{hover:g,focus:f,active:y,disabled:_||C,selected:T}),{"k-icon-button":!L&&!ge&&Ne}),"aria-pressed":H?T?"true":"false":void 0,...he,"aria-disabled":C?"true":void 0,disabled:_||void 0,children:[typeof S=="string"&&S&&(0,M.jsx)(b,{className:s(ae,"k-button-icon"),icon:S,size:O}),S&&typeof S!="string"&&(0,M.jsx)(M.Fragment,{children:S}),L?(0,M.jsxs)(M.Fragment,{children:[L&&(0,M.jsx)("span",{className:"k-button-text",children:L}),t.children]}):t.children&&(0,M.jsx)("span",{className:"k-button-text",children:t.children}),p&&(0,M.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,M.jsx)(b,{icon:u})})]})};x.states=Gt;x.options=Jt;x.variants=qt;x.className=ne;x.defaultOptions=Be;x.moduleName=Ae;x.folderName=Ze;x.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 je=require("react/jsx-runtime"),F=t=>(0,je.jsx)(x,{children:"Button",...t});var h=require("react/jsx-runtime"),Wt=k.states,Qt=k.defaultOptions,Yt=k.options,Zt=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"},{name:"validation-icon",title:"Validation Icon"},{name:"separators",title:"Separators"}],jt=[],X=t=>{let{modifiers:e,valid:o,invalid:l,loading:n,disabled:d,readonly:p,...u}=t,N=e==null?void 0:e.prefix,g=e==null?void 0:e.suffix,f=e==null?void 0:e["clear-button"],y=e==null?void 0:e["validation-icon"],T=e==null?void 0:e.separators;return(0,h.jsxs)(k,{...u,valid:o,invalid:l,loading:n,disabled:d,readonly:p,style:{width:300},children:[N&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(pe,{children:(0,h.jsx)(b,{icon:"lock"})}),T&&(0,h.jsx)(U,{})]}),(0,h.jsx)(P,{placeholder:"Placeholder",value:"Value"}),y&&(0,h.jsx)(R,{valid:o,invalid:l,loading:n,disabled:d}),(0,h.jsx)(D,{loading:n,disabled:d}),f&&(0,h.jsx)(z,{loading:n,disabled:d,readonly:p,value:"Value"}),g&&(0,h.jsxs)(h.Fragment,{children:[T&&(0,h.jsx)(U,{}),(0,h.jsx)(me,{children:(0,h.jsx)(F,{size:u.size,fillMode:"clear",children:"Send"})})]})]})};X.options=Yt;X.states=Wt;X.variants=jt;X.defaultOptions=Qt;X.modifiers=Zt;X.className=k.className;var v=require("react/jsx-runtime"),et="k-textbox",eo=[i.hover,i.focus,i.valid,i.invalid,i.required,i.disabled,i.loading,i.readonly],to={size:[a.undefined,a.small,a.medium,a.large],rounded:[c.undefined,c.none,c.small,c.medium,c.large,c.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},fe={showClearButton:!0,showValidationIcon:!0,separators:!0},B=t=>{let{size:e,rounded:o,fillMode:l,separators:n=fe.separators,showClearButton:d=fe.showClearButton,showValidationIcon:p=fe.showValidationIcon,prefix:u,suffix:N,type:g,value:f,placeholder:y,hover:T,focus:_,valid:H,invalid:C,required:S,loading:O,disabled:L,readonly:ae,id:be,"aria-label":he,"aria-describedby":Ne,...ge}=t;return(0,v.jsxs)(k,{...ge,size:e,rounded:o,fillMode:l,hover:T,focus:_,valid:H,invalid:C,required:S,loading:O,disabled:L,readonly:ae,className:s(t.className,et),children:[u&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(pe,{children:u}),n&&(0,v.jsx)(U,{})]}),(0,v.jsx)(P,{id:be,placeholder:y,value:f,type:g,disabled:L,"aria-label":he,"aria-describedby":Ne,"aria-invalid":C?"true":void 0}),p&&(0,v.jsx)(R,{valid:H,invalid:C,loading:O,disabled:L}),(0,v.jsx)(D,{loading:O,disabled:L}),d&&(0,v.jsx)(z,{loading:O,disabled:L,readonly:ae,value:f}),N&&(0,v.jsxs)(v.Fragment,{children:[n&&(0,v.jsx)(U,{}),(0,v.jsx)(me,{children:N})]})]})};B.states=eo;B.options=to;B.className=et;B.defaultOptions=fe;B.moduleName=Ie;B.folderName=Pe;B.ariaSpec={selector:".k-textbox",rules:[{selector:".k-textbox > .k-input-inner",attribute:"role=textbox or nodeName=input",usage:"Describes the role of the component."},{selector:".k-textbox > .k-input-inner",attribute:"label for or aria-label or aria-labelledby (when has accessible name)",usage:"The input requires an accessible name (provided by consuming app)."},{selector:".k-textbox > .k-input-inner",attribute:"aria-invalid=true (when invalid)",usage:"Rendered when the TextBox is in an invalid state."},{selector:".k-textbox > .k-input-inner",attribute:"aria-describedby (when has hint or error)",usage:"Points to the hint or error message for the input."},{selector:".k-textbox.k-disabled > .k-input-inner",attribute:"disabled=disabled or aria-disabled=true",usage:"Rendered when the TextBox is disabled."}]};var tt=B;var nt=require("react/jsx-runtime"),ot=t=>(0,nt.jsx)(x,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});var it=require("react/jsx-runtime"),at=t=>(0,it.jsx)(x,{icon:"folder",children:"Button",...t});var xe=require("react/jsx-runtime"),oo=x.options,no=x.states,ao={...x.defaultOptions,variant:"text"},io=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],so=[],q=t=>{let{variant:e,...o}=t;switch(e){case"icon-only":return(0,xe.jsx)(ot,{...o,icon:"star"});case"icon-and-text":return(0,xe.jsx)(at,{...o,icon:"star",children:"Button"});default:return(0,xe.jsx)(F,{...o,children:"Button"})}};q.options=oo;q.states=no;q.variants=io;q.defaultOptions=ao;q.modifiers=so;q.className=x.className;var G=require("react/jsx-runtime"),ro=t=>(0,G.jsx)(tt,{suffix:(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(F,{fillMode:"clear",children:"Send"})}),...t});