UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

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