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