@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 12.4 kB
JavaScript
var Pe=Object.create;var q=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var $e=(t,e)=>{for(var o in e)q(t,o,{get:e[o],enumerable:!0})},ce=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of He(e))!Ke.call(t,a)&&a!==o&&q(t,a,{get:()=>e[a],enumerable:!(r=Re(e,a))||r.enumerable});return t};var Ue=(t,e,o)=>(o=t!=null?Pe(Ve(t)):{},ce(e||!t||!t.__esModule?q(o,"default",{value:t,enumerable:!0}):o,t)),De=t=>ce(q({},"__esModule",{value:!0}),t);var yt={};$e(yt,{InputDemo:()=>O,default:()=>It});module.exports=De(yt);var s=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?s(...e):typeof e=="object"?Object.keys(e).map((o,r)=>e[r]||e[o]&&o||null).filter(o=>o!==null).join(" "):e).filter(e=>!!e).join(" ");var k=(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"}),W=(t,e)=>{let{valid:o,invalid:r,hover:a,focus:c,checked:u,active:d,selected:N,disabled:b,indeterminate:f,loading:S,empty:g,readonly:F,highlighted:j,...w}=e;return s({"k-valid":o,"k-invalid":r,"k-hover":a,"k-focus":c,"k-checked":u,"k-active":d,"k-selected":N,"k-disabled":b,"k-indeterminate":f&&!u,"k-loading":S,"k-empty":g,"k-readonly":F,"k-highlighted":j},Object.keys(w).reduce((v,L)=>(L.startsWith("k-")?v[L]=w[L]:v[`k-${L}`]=w[L],v),{}))};function ue(t,e){if(!e)return{};let o=Array.isArray(e)?e:[e];return Object.fromEntries(o.map(r=>[`k-${r}`,!0]))}var i={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},x={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"},C={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"},l={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 ee="input",pe=ee;var me=require("react/jsx-runtime"),J="k-input",Fe=[l.hover,l.focus,l.valid,l.invalid,l.required,l.disabled,l.loading,l.readonly],Ge={size:[i.undefined,i.small,i.medium,i.large],rounded:[x.undefined,x.none,x.small,x.medium,x.large,x.full],fillMode:[I.undefined,I.solid,I.flat,I.outline]},qe={},y=t=>{let{hover:e,focus:o,disabled:r,invalid:a,valid:c,loading:u,readonly:d,size:N,rounded:b,fillMode:f,...S}=t;return(0,me.jsx)("span",{...S,className:s(t.className,J,k(J,{size:N,rounded:b,fillMode:f}),W(J,{hover:e,focus:o,disabled:r,invalid:a,valid:c,loading:u,readonly:d}))})};y.states=Fe;y.options=Ge;y.className=J;y.defaultOptions=qe;y.moduleName=ee;y.folderName=pe;var fe=require("react/jsx-runtime"),te="k-input-inner",We=[],Je={},Q={type:"text",autocomplete:"off",value:"",placeholder:""},E=t=>{let{value:e=Q.value,type:o=Q.type,placeholder:r=Q.placeholder,autocomplete:a=Q.autocomplete,disabled:c,readOnly:u,...d}=t;return(0,fe.jsx)("input",{...d,type:o,className:s(t.className,te,k(te,t)),placeholder:r,autoComplete:a,defaultValue:e,disabled:c||void 0,readOnly:u||void 0})};E.states=We;E.options=Je;E.className=te;var B=require("react/jsx-runtime"),Qe="k-input-prefix",Xe={direction:"horizontal"},xe=t=>{let{direction:e=Xe.direction,...o}=t;return t.children?(0,B.jsx)("span",{...o,className:s(Qe,t.className,{[`k-input-prefix-${e}`]:e}),children:t.children}):(0,B.jsx)(B.Fragment,{})};var _=require("react/jsx-runtime"),Ye="k-input-suffix",Ze={direction:"horizontal"},be=t=>{let{direction:e=Ze.direction,...o}=t;return t.children?(0,_.jsx)("span",{...o,className:s(Ye,t.className,{[`k-input-suffix-${e}`]:e}),children:t.children}):(0,_.jsx)(_.Fragment,{})};var he=require("react/jsx-runtime"),ge="k-input-separator",je={direction:"vertical"},oe=t=>{let{direction:e=je.direction,...o}=t;return(0,he.jsx)("span",{...o,className:s(ge,t.className,{[`${ge}-${e}`]:e})})};var P=require("react/jsx-runtime"),ne="k-font-icon",et=[],tt={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info]},ot={},R=t=>{let{size:e,themeColor:o,icon:r,rotate:a,flip:c,...u}=t;return r?(0,P.jsx)("span",{...u,className:s(t.className,ne,k(ne,{size:e}),{[`k-i-${r}`]:r,[`k-color-${o}`]:o,[`k-rotate-${a}`]:a,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):(0,P.jsx)(P.Fragment,{})};R.states=et;R.options=tt;R.className=ne;R.defaultOptions=ot;var Ne=R;var A=require("react/jsx-runtime"),ae="k-svg-icon",nt=[],at={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[C.outline,C.solid,C.duotone]},ie={viewBox:"0 0 24 24",variant:C.outline},H=t=>{var S,g;let{size:e,themeColor:o,rotate:r,flip:a,viewBox:c=ie.viewBox,variant:u=ie.variant,icon:d,...N}=t;if(!d)return(0,A.jsx)(A.Fragment,{});if(d==="none")return(0,A.jsx)("span",{...N,className:s(t.className,ae,k("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let b=typeof d=="object"&&d.name&&d.name,f=typeof d=="object"?u&&((S=d.variants)==null?void 0:S[u])||((g=d.variants)==null?void 0:g.outline)||d.content:void 0;return(0,A.jsx)("span",{...N,className:s(t.className,ae,k("k-icon",{size:e}),{[`k-svg-i-${b}`]:b,[`k-color-${o}`]:o,[`k-rotate-${r}`]:r,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="both"}),"aria-hidden":"true",children:(0,A.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof d=="object"?d.viewBox:c,dangerouslySetInnerHTML:f!==void 0?{__html:f}:void 0,children:d?void 0:t.children})})};H.states=nt;H.options=at;H.className=ae;H.defaultOptions=ie;var se=H;var re=Ue(require("@progress/kendo-svg-icons"));var ve="icon",Ie="icons";var ke=require("react");var ye=require("react"),Se=(0,ye.createContext)({iconsType:"svg"});var T=require("react/jsx-runtime"),X="k-icon",it=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),st=[],rt={size:[i.undefined,i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[C.outline,C.solid,C.duotone]},Y={viewBox:"0 0 24 24",type:"svg",variant:C.outline},m=t=>{let{iconsType:e}=(0,ke.useContext)(Se),{size:o,themeColor:r,icon:a,type:c=e||Y.type,rotate:u,flip:d,viewBox:N=Y.viewBox,variant:b=Y.variant,...f}=t;if(!a)return(0,T.jsx)(T.Fragment,{});if((e||c)==="svg"){if(a==="none")return(0,T.jsx)(se,{...f,className:s(t.className,X),icon:a,size:o,variant:b});let g=re[a]?a:it(`${a}-icon`);return re[g]?(0,T.jsx)(se,{...f,className:s(t.className,X),icon:re[g],size:o,themeColor:r,rotate:u,flip:d,viewBox:N,variant:b}):(0,T.jsx)(T.Fragment,{})}return(0,T.jsx)(Ne,{...f,className:s(t.className,X),icon:a,size:o,themeColor:r,rotate:u,flip:d})};m.states=st;m.options=rt;m.defaultOptions=Y;m.className=X;m.moduleName=ve;m.folderName=Ie;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 z=require("react/jsx-runtime"),Ce="k-clear-value",lt=[l.disabled,l.loading,l.readonly],dt={},V=t=>{let{disabled:e,loading:o,readonly:r,value:a}=t;return e||r||o||!a?(0,z.jsx)(z.Fragment,{}):(0,z.jsx)("span",{className:s(t.className,Ce),children:(0,z.jsx)(m,{icon:"x"})})};V.states=lt;V.options=dt;V.className=Ce;var K=require("react/jsx-runtime"),Me="k-input-validation-icon",ct=[l.valid,l.invalid,l.disabled,l.loading],ut={},$=t=>{let{valid:e,invalid:o,disabled:r,loading:a}=t,c=o?"warning-circle":"check-circle";return r||a||!!!(e||o)?(0,K.jsx)(K.Fragment,{}):(0,K.jsx)(m,{className:s(Me),icon:c})};$.states=ct;$.options=ut;$.className=Me;var U=require("react/jsx-runtime"),Te="k-input-loading-icon",pt=[l.disabled,l.loading],Z=t=>{let{disabled:e,loading:o}=t;return e||!o?(0,U.jsx)(U.Fragment,{}):(0,U.jsx)("span",{className:s(t.className,Te,"k-icon k-i-loading")})};Z.states=pt;Z.className=Te;var le="button",Oe=le;var h=require("react/jsx-runtime"),D="k-button",mt=["icon-button"],ft=[l.hover,l.focus,l.active,l.selected,l.disabled,l.generating],xt={size:[i.undefined,i.xsmall,i.small,i.medium,i.large],rounded:[x.undefined,x.none,x.small,x.medium,x.large,x.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]},de={showArrow:!1,arrowIconName:"chevron-down"},M=t=>{let{as:e="button",size:o,rounded:r,fillMode:a,themeColor:c,showArrow:u=de.showArrow,arrowIconName:d=de.arrowIconName,variant:N,hover:b,focus:f,active:S,selected:g,disabled:F,togglable:j,ariaDisabled:w,icon:v,iconSize:L,text:G,iconClassName:we,className:ze,...Ee}=t,Be=v!=null,_e=t.children!==void 0;return(0,h.jsxs)(e,{className:s(ze,D,ue(D,N),k(D,{size:o,rounded:r,fillMode:a,themeColor:c}),W(D,{hover:b,focus:f,active:S,disabled:F||w,selected:g}),{"k-icon-button":!G&&!_e&&Be}),"aria-pressed":j?g?"true":"false":void 0,...Ee,"aria-disabled":w?"true":void 0,disabled:F||void 0,children:[typeof v=="string"&&v&&(0,h.jsx)(m,{className:s(we,"k-button-icon"),icon:v,size:L}),v&&typeof v!="string"&&(0,h.jsx)(h.Fragment,{children:v}),G?(0,h.jsxs)(h.Fragment,{children:[G&&(0,h.jsx)("span",{className:"k-button-text",children:G}),t.children]}):t.children&&(0,h.jsx)("span",{className:"k-button-text",children:t.children}),u&&(0,h.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,h.jsx)(m,{icon:d})})]})};M.states=ft;M.options=xt;M.variants=mt;M.className=D;M.defaultOptions=de;M.moduleName=le;M.folderName=Oe;M.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 Ae=require("react/jsx-runtime"),Le=t=>(0,Ae.jsx)(M,{children:"Button",...t});var p=require("react/jsx-runtime"),bt=y.states,gt=y.defaultOptions,ht=y.options,Nt=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"},{name:"validation-icon",title:"Validation Icon"},{name:"separators",title:"Separators"}],vt=[],O=t=>{let{modifiers:e,valid:o,invalid:r,loading:a,disabled:c,readonly:u,...d}=t,N=e==null?void 0:e.prefix,b=e==null?void 0:e.suffix,f=e==null?void 0:e["clear-button"],S=e==null?void 0:e["validation-icon"],g=e==null?void 0:e.separators;return(0,p.jsxs)(y,{...d,valid:o,invalid:r,loading:a,disabled:c,readonly:u,style:{width:300},children:[N&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(xe,{children:(0,p.jsx)(m,{icon:"lock"})}),g&&(0,p.jsx)(oe,{})]}),(0,p.jsx)(E,{placeholder:"Placeholder",value:"Value"}),S&&(0,p.jsx)($,{valid:o,invalid:r,loading:a,disabled:c}),(0,p.jsx)(Z,{loading:a,disabled:c}),f&&(0,p.jsx)(V,{loading:a,disabled:c,readonly:u,value:"Value"}),b&&(0,p.jsxs)(p.Fragment,{children:[g&&(0,p.jsx)(oe,{}),(0,p.jsx)(be,{children:(0,p.jsx)(Le,{size:d.size,fillMode:"clear",children:"Send"})})]})]})};O.options=ht;O.states=bt;O.variants=vt;O.defaultOptions=gt;O.modifiers=Nt;O.className=y.className;var It=O;