UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 15.2 kB
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:p,active:u,selected:b,disabled:h,indeterminate:f,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":p,"k-active":u,"k-selected":b,"k-disabled":h,"k-indeterminate":f&&!p,"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 Se(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"},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"},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",ke=le;var U="input",J=U;import{jsx as je}from"react/jsx-runtime";var W="k-input",Qe=[a.hover,a.focus,a.valid,a.invalid,a.required,a.disabled,a.loading,a.readonly],Ye={size:[n.undefined,n.small,n.medium,n.large],rounded:[c.undefined,c.none,c.small,c.medium,c.large,c.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},Ze={},I=e=>{let{hover:t,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u,size:b,rounded:h,fillMode:f,...v}=e;return je("span",{...v,className:i(e.className,W,N(W,{size:b,rounded:h,fillMode:f}),R(W,{hover:t,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u}))})};I.states=Qe;I.options=Ye;I.className=W;I.defaultOptions=Ze;I.moduleName=U;I.folderName=J;import{jsx as nt}from"react/jsx-runtime";var Q="k-picker",et=[a.hover,a.focus,a.valid,a.invalid,a.required,a.disabled,a.loading,a.readonly],tt={size:[n.undefined,n.small,n.medium,n.large],rounded:[c.undefined,c.none,c.small,c.medium,c.large,c.full],fillMode:[m.undefined,m.solid,m.flat,m.outline]},ot={},_=e=>{let{hover:t,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u,size:b,rounded:h,fillMode:f,...v}=e;return nt("span",{...v,className:i(e.className,Q,N(Q,{size:b,rounded:h,fillMode:f}),R(Q,{hover:t,focus:o,disabled:l,invalid:s,valid:d,loading:p,readonly:u})),children:e.children})};_.states=et;_.options=tt;_.className=Q;_.defaultOptions=ot;_.moduleName=U;_.folderName=J;import{Fragment as rt,jsx as Me}from"react/jsx-runtime";var de="k-font-icon",at=[],st={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]},it={},D=e=>{let{size:t,themeColor:o,icon:l,rotate:s,flip:d,...p}=e;return l?Me("span",{...p,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"}):Me(rt,{})};D.states=at;D.options=st;D.className=de;D.defaultOptions=it;var Oe=D;import{Fragment as ut,jsx as Y}from"react/jsx-runtime";var ue="k-svg-icon",lt=[],dt={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]},ce={viewBox:"0 0 24 24",variant:M.outline},F=e=>{let{size:t,themeColor:o,rotate:l,flip:s,viewBox:d=ce.viewBox,variant:p=ce.variant,icon:u,...b}=e;if(!u)return Y(ut,{});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,f=typeof u=="object"?p&&u.variants?.[p]||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:f!==void 0?{__html:f}:void 0,children:u?void 0:e.children})})};F.states=lt;F.options=dt;F.className=ue;F.defaultOptions=ce;var pe=F;import*as me from"@progress/kendo-svg-icons";var Ce="icon",Le="icons";import{useContext as pt}from"react";import{createContext as ct}from"react";var Ee=ct({iconsType:"svg"});import{Fragment as Ae,jsx as X}from"react/jsx-runtime";var Z="k-icon",mt=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),ft=[],xt={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},x=e=>{let{iconsType:t}=pt(Ee),{size:o,themeColor:l,icon:s,type:d=t||j.type,rotate:p,flip:u,viewBox:b=j.viewBox,variant:h=j.variant,...f}=e;if(!s)return X(Ae,{});if((t||d)==="svg"){if(s==="none")return X(pe,{...f,className:i(e.className,Z),icon:s,size:o,variant:h});let y=me[s]?s:mt(`${s}-icon`);return me[y]?X(pe,{...f,className:i(e.className,Z),icon:me[y],size:o,themeColor:l,rotate:p,flip:u,viewBox:b,variant:h}):X(Ae,{})}return X(Oe,{...f,className:i(e.className,Z),icon:s,size:o,themeColor:l,rotate:p,flip:u})};x.states=ft;x.options=xt;x.defaultOptions=j;x.className=Z;x.moduleName=Ce;x.folderName=Le;x.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 Nt,jsx as fe}from"react/jsx-runtime";var we="k-clear-value",bt=[a.disabled,a.loading,a.readonly],ht={},A=e=>{let{disabled:t,loading:o,readonly:l,value:s}=e;return t||l||o||!s?fe(Nt,{}):fe("span",{className:i(e.className,we),children:fe(x,{icon:"x"})})};A.states=bt;A.options=ht;A.className=we;import{jsx as vt}from"react/jsx-runtime";var xe="k-input-inner",gt=[],It={},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:p,...u}=e;return vt("input",{...u,type:o,className:i(e.className,xe,N(xe,e)),placeholder:l,autoComplete:s,defaultValue:t,disabled:d||void 0,readOnly:p||void 0})};w.states=gt;w.options=It;w.className=xe;import{jsx as ze,jsxs as St}from"react/jsx-runtime";var be="k-input-inner",yt=[],Tt={},he=e=>{let{value:t,placeholder:o,showValue:l,valueIcon:s,valueIconName:d,...p}=e;return St("span",{...p,className:i(e.className,be,N(be,e)),children:[s,!s&&d&&ze(x,{className:"k-input-value-icon",icon:d}),l&&!t&&o,l&&t&&ze("span",{className:"k-input-value-text",children:t})]})};he.states=yt;he.options=Tt;he.className=be;import{jsx as Ot}from"react/jsx-runtime";var Ne="k-input-inner",kt=[],Mt={},Pe={value:"",placeholder:""},ge=e=>{let{value:t=Pe.value,placeholder:o=Pe.placeholder,rows:l,disabled:s,...d}=e;return Ot("textarea",{...d,className:i(e.className,Ne,N(Ne,e)),placeholder:o,rows:l,defaultValue:t,disabled:s||void 0})};ge.states=kt;ge.options=Mt;ge.className=Ne;import{Fragment as Lt,jsx as Be}from"react/jsx-runtime";var Re="k-input-loading-icon",Ct=[a.disabled,a.loading],H=e=>{let{disabled:t,loading:o}=e;return t||!o?Be(Lt,{}):Be("span",{className:i(e.className,Re,"k-icon k-i-loading")})};H.states=Ct;H.className=Re;import{Fragment as wt,jsx as _e}from"react/jsx-runtime";var He="k-input-validation-icon",Et=[a.valid,a.invalid,a.disabled,a.loading],At={},z=e=>{let{valid:t,invalid:o,disabled:l,loading:s}=e,d=o?"warning-circle":"check-circle";return l||s||!!!(t||o)?_e(wt,{}):_e(x,{className:i(He),icon:d})};z.states=Et;z.options=At;z.className=He;import{Fragment as Bt,jsx as Ke}from"react/jsx-runtime";var zt="k-input-prefix",Pt={direction:"horizontal"},te=e=>{let{direction:t=Pt.direction,...o}=e;return e.children?Ke("span",{...o,className:i(zt,e.className,{[`k-input-prefix-${t}`]:t}),children:e.children}):Ke(Bt,{})};import{Fragment as Ht,jsx as Ve}from"react/jsx-runtime";var Rt="k-input-suffix",_t={direction:"horizontal"},oe=e=>{let{direction:t=_t.direction,...o}=e;return e.children?Ve("span",{...o,className:i(Rt,e.className,{[`k-input-suffix-${t}`]:t}),children:e.children}):Ve(Ht,{})};import{jsx as hn}from"react/jsx-runtime";import{jsx as vn}from"react/jsx-runtime";import{jsx as Vt}from"react/jsx-runtime";var $e="k-input-separator",Kt={direction:"vertical"},K=e=>{let{direction:t=Kt.direction,...o}=e;return Vt("span",{...o,className:i($e,e.className,{[`${$e}-${t}`]:t})})};var Ie="button",Ue=Ie;import{Fragment as De,jsx as V,jsxs as Fe}from"react/jsx-runtime";var q="k-button",$t=["icon-button"],Ut=[a.hover,a.focus,a.active,a.selected,a.disabled,a.generating],Dt={size:[n.undefined,n.xsmall,n.small,n.medium,n.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]},ve={showArrow:!1,arrowIconName:"chevron-down"},O=e=>{let{as:t="button",size:o,rounded:l,fillMode:s,themeColor:d,showArrow:p=ve.showArrow,arrowIconName:u=ve.arrowIconName,variant:b,hover:h,focus:f,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 Fe(t,{className:i(ae,q,Se(q,b),N(q,{size:o,rounded:l,fillMode:s,themeColor:d}),R(q,{hover:h,focus:f,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(x,{className:i(G,"k-button-icon"),icon:g,size:T}),g&&typeof g!="string"&&V(De,{children:g}),k?Fe(De,{children:[k&&V("span",{className:"k-button-text",children:k}),e.children]}):e.children&&V("span",{className:"k-button-text",children:e.children}),p&&V("span",{className:"k-menu-button-arrow k-button-arrow",children:V(x,{icon:u})})]})};O.states=Ut;O.options=Dt;O.variants=$t;O.className=q;O.defaultOptions=ve;O.moduleName=Ie;O.folderName=Ue;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 Ft}from"react/jsx-runtime";var Xe=e=>Ft(O,{children:"Button",...e});import{Fragment as qe,jsx as C,jsxs as ye}from"react/jsx-runtime";var Xt=I.states,qt=I.defaultOptions,Gt=I.options,Jt=[{name:"prefix",title:"Prefix"},{name:"suffix",title:"Suffix"},{name:"clear-button",title:"`Clear` Button"},{name:"validation-icon",title:"Validation Icon"},{name:"separators",title:"Separators"}],Wt=[],$=e=>{let{modifiers:t,valid:o,invalid:l,loading:s,disabled:d,readonly:p,...u}=e,b=t?.prefix,h=t?.suffix,f=t?.["clear-button"],v=t?.["validation-icon"],y=t?.separators;return ye(I,{...u,valid:o,invalid:l,loading:s,disabled:d,readonly:p,style:{width:300},children:[b&&ye(qe,{children:[C(te,{children:C(x,{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}),f&&C(A,{loading:s,disabled:d,readonly:p,value:"Value"}),h&&ye(qe,{children:[y&&C(K,{}),C(oe,{children:C(Xe,{size:u.size,fillMode:"clear",children:"Send"})})]})]})};$.options=Gt;$.states=Xt;$.variants=Wt;$.defaultOptions=qt;$.modifiers=Jt;$.className=I.className;import{Fragment as Ge,jsx as L,jsxs as Te}from"react/jsx-runtime";var Je="k-textbox",Qt=[a.hover,a.focus,a.valid,a.invalid,a.required,a.disabled,a.loading,a.readonly],Yt={size:[n.undefined,n.small,n.medium,n.large],rounded:[c.undefined,c.none,c.small,c.medium,c.large,c.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:p=ne.showValidationIcon,prefix:u,suffix:b,type:h,value:f,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,Je),children:[u&&Te(Ge,{children:[L(te,{children:u}),s&&L(K,{})]}),L(w,{id:ae,placeholder:v,value:f,type:h,disabled:k,"aria-label":se,"aria-describedby":ie,"aria-invalid":S?"true":void 0}),p&&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:f}),b&&Te(Ge,{children:[s&&L(K,{}),L(oe,{children:b})]})]})};E.states=Qt;E.options=Yt;E.className=Je;E.defaultOptions=ne;E.moduleName=le;E.folderName=ke;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 We=E;import{jsx as Zt}from"react/jsx-runtime";var ba=e=>Zt(We,{...e});export{ba as TextboxNormal};