@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 9.54 kB
JavaScript
var n=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?n(...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 w=(t,e)=>n({[`${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.fillMode}-${e.themeColor}`]:e.fillMode&&e.themeColor},{[`${t}-${e.themeColor}`]:e.themeColor&&e.fillMode===void 0},{"k-rounded-sm":e.rounded==="small","k-rounded-md":e.rounded==="medium","k-rounded-lg":e.rounded==="large","k-rounded-full":e.rounded==="full"}),N=(t,e)=>{let{valid:o,invalid:r,hover:c,focus:m,checked:l,active:x,selected:h,disabled:b,indeterminate:S,loading:A,empty:R,readonly:K,highlighted:P,...g}=e;return n({"k-valid":o,"k-invalid":r,"k-hover":c,"k-focus":m,"k-checked":l,"k-active":x,"k-selected":h,"k-disabled":b,"k-indeterminate":S&&!l,"k-loading":A,"k-empty":R,"k-readonly":K,"k-highlighted":P},Object.keys(g).reduce((y,E)=>(E.startsWith("k-")?y[E]=g[E]:y[`k-${E}`]=g[E],y),{}))};var i={xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},M={small:"small",medium:"medium",large:"large",full:"full"};var s={inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",dark:"dark",light:"light",inverse:"inverse"},p={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 _="treeview",$=_;import{jsx as D}from"react/jsx-runtime";import{createElement as se}from"react";var q="k-treeview",Ee=[],Ne={size:[i.small,i.medium,i.large]},ne={size:i.medium},f=t=>{let{size:e=ne.size,children:o,dir:r,...c}=t,m=[];return o&&(Array.isArray(o)?o.map((l,x)=>{l.type===a&&m.push(se(a,{...l.props,dir:r,key:x})),l.type===d&&m.push(se(d,{...l.props,dir:r,key:x}))}):(o.type===a&&m.push(D(a,{...o.props,dir:r})),o.type===d&&m.push(D(d,{...o.props,dir:r})))),D("div",{...c,dir:r,className:n(t.className,q,w(q,{size:e})),children:D(d,{className:"k-treeview-lines",dir:r,children:m})})};f.states=Ee;f.options=Ne;f.className=q;f.defaultOptions=ne;f.moduleName=_;f.folderName=$;var I="checkbox",L=I;import{jsx as le}from"react/jsx-runtime";var F="k-checkbox",Ie=[p.hover,p.focus,p.valid,p.invalid,p.required,p.disabled,p.checked,p.indeterminate],ge={size:[i.small,i.medium,i.large],rounded:[M.small,M.medium,M.large,M.full]},Q={size:i.medium,rounded:M.medium},v=t=>{let{id:e,checked:o,indeterminate:r,hover:c,focus:m,disabled:l,invalid:x,valid:h,required:b,size:S=Q.size,rounded:A=Q.rounded,...R}=t;return le("span",{className:"k-checkbox-wrap",children:le("input",{...R,id:e,type:"checkbox",defaultChecked:o,required:b,className:n(t.className,F,w(F,{size:S,rounded:A}),N(F,{hover:c,focus:m,disabled:l,invalid:x,valid:h,indeterminate:r,checked:o}))})})};v.states=Ie;v.options=ge;v.className=F;v.defaultOptions=Q;v.moduleName=I;v.folderName=L;import{jsx as Oe}from"react/jsx-runtime";var ae="k-checkbox-list",Me=[],Le={},me={layout:"vertical"},k=t=>{let{layout:e=me.layout,...o}=t;return Oe("ul",{...o,className:n(t.className,ae,{[`k-list-${e}`]:e}),children:t.children})};k.states=Me;k.options=Le;k.className=ae;k.defaultOptions=me;k.moduleName=I;k.folderName=L;import{jsx as Ke}from"react/jsx-runtime";var ce="k-checkbox-list-item",Se=[],Ae={},Re={},T=t=>{let{...e}=t;return Ke("li",{...e,className:n(t.className,ce),children:t.children})};T.states=Se;T.options=Ae;T.className=ce;T.defaultOptions=Re;T.moduleName=I;T.folderName=L;import{Fragment as At,jsx as St,jsxs as Rt}from"react/jsx-runtime";import{Fragment as Gt,jsx as zt,jsxs as Bt}from"react/jsx-runtime";import{Fragment as Xt,jsx as Ft,jsxs as Vt}from"react/jsx-runtime";import{Fragment as Qt,jsx as qt,jsxs as Yt}from"react/jsx-runtime";import{jsx as to}from"react/jsx-runtime";import{jsx as so}from"react/jsx-runtime";import{Fragment as Ge,jsx as pe}from"react/jsx-runtime";var Z="k-font-icon",_e=[],He={size:[i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[s.base,s.primary,s.secondary,s.tertiary,s.success,s.warning,s.error,s.info,s.light,s.dark]},ze={},H=t=>{let{size:e,themeColor:o,icon:r,rotate:c,flip:m,...l}=t;return r?pe("span",{...l,className:n(t.className,Z,w(Z,{size:e}),{[`k-i-${r}`]:r,[`k-color-${o}`]:o,[`k-rotate-${c}`]:c,"k-flip-h":m==="h"||m==="both","k-flip-v":m==="v"||m==="both"})}):pe(Ge,{})};H.states=_e;H.options=He;H.className=Z;H.defaultOptions=ze;var de=H;import{Fragment as $e,jsx as X}from"react/jsx-runtime";var j="k-svg-icon",Be=[],Pe={size:[i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[s.base,s.primary,s.secondary,s.tertiary,s.success,s.warning,s.error,s.info,s.light,s.dark]},xe={viewBox:"0 0 24 24"},z=t=>{let{size:e,themeColor:o,rotate:r,flip:c,viewBox:m=xe.viewBox,icon:l,...x}=t;if(!l)return X($e,{});l==="none"&&{...x,className:n(t.className,j,"k-none")};let h=typeof l=="object"&&l.name&&l.name;return X("span",{...x,className:n(t.className,j,w("k-icon",{size:e}),{[`k-svg-i-${h}`]:h,[`k-color-${o}`]:o,[`k-rotate-${r}`]:r,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),children:X("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof l=="object"?l.viewBox:m,dangerouslySetInnerHTML:typeof l=="object"?{__html:l.content}:void 0,children:l?void 0:t.children})})};z.states=Be;z.options=Pe;z.className=j;z.defaultOptions=xe;var ee=z;import*as te from"@progress/kendo-svg-icons";var he="icon",fe="icons";import{Fragment as ue,jsx as G}from"react/jsx-runtime";var V="k-icon",De=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Fe=[],Xe={size:[i.xsmall,i.small,i.medium,i.large,i.xlarge,i.xxlarge,i.xxxlarge],themeColor:[s.base,s.primary,s.secondary,s.tertiary,s.success,s.warning,s.error,s.info,s.light,s.dark]},oe={viewBox:"0 0 24 24",type:"svg"},C=t=>{let{size:e,themeColor:o,icon:r,type:c=oe.type,rotate:m,flip:l,viewBox:x=oe.viewBox,...h}=t;if(!r)return G(ue,{});if(c==="svg"){if(r==="none")return G(ee,{...h,className:n(t.className,V),icon:r,size:e});let b=te[r]?r:De(`${r}-icon`);return te[b]?G(ee,{...h,className:n(t.className,V),icon:te[b],size:e,themeColor:o,rotate:m,flip:l,viewBox:x}):G(ue,{})}return G(de,{...h,className:n(t.className,V),icon:r,size:e,themeColor:o,rotate:m,flip:l})};C.states=Fe;C.options=Xe;C.defaultOptions=oe;C.className=V;C.moduleName=he;C.folderName=fe;import{jsx as ve}from"react/jsx-runtime";import{createElement as Ue}from"react";var Ve="k-treeview-group",d=t=>{let{children:e,dir:o}=t,r=[];return e&&(Array.isArray(e)?e.map((c,m)=>{c.type===B&&r.push(Ue(B,{...c.props,dir:o,key:m}))}):e.type===B&&r.push(ve(B,{...e.props,dir:o}))),ve("ul",{className:n(t.className,Ve),children:r})};import{jsx as Ce,jsxs as qe}from"react/jsx-runtime";var re="k-treeview-leaf",We=[p.hover,p.focus,p.selected],Je={},U=t=>{let{text:e,showIcon:o,icon:r,hover:c,focus:m,selected:l,...x}=t;return qe("span",{...x,className:n(t.className,re,N(re,{hover:c,focus:m,selected:l})),children:[o&&Ce(C,{icon:r}),Ce("span",{className:"k-treeview-leaf-text",children:e})]})};U.states=We;U.options=Je;U.className=re;var be=U;import{Fragment as et,jsx as O,jsxs as we}from"react/jsx-runtime";import{createElement as je}from"react";var ke="k-treeview-item",Qe=[p.hover,p.focus,p.selected,p.disabled],Ye={},Ze={},a=t=>{let{leafClassName:e,children:o,hasChildren:r,expanded:c,text:m,showIcon:l,icon:x,showCheckbox:h,checked:b,hover:S,focus:A,selected:R,disabled:K,top:P,bottom:g,dir:y,...E}=t,ie=r||o,W=[];return o&&(Array.isArray(o)?o.map((J,ye)=>{J.type===d&&W.push(je(d,{...J.props,dir:y,key:ye},J.props.children))}):o.type===d&&W.push(O(d,{...o.props,dir:y,children:o.props.children}))),we("li",{...E,className:n(t.className,ke),children:[we("span",{className:n({"k-treeview-top":P,"k-treeview-bot":g,"k-treeview-mid":!P&&!g}),children:[ie&&O("span",{className:n("k-treeview-toggle",N("k-treeview-toggle",{disabled:K})),children:O(C,{icon:c?"caret-alt-down":y==="rtl"?"caret-alt-left":"caret-alt-right"})}),h&&O(v,{checked:b,disabled:K}),O(be,{className:n(e,N(e,{disabled:K})),text:m,showIcon:l,icon:x,hover:S,focus:A,selected:R})]}),c&&ie&&O(et,{children:W})]})};a.states=Qe;a.options=Ye;a.className=ke;a.defaultOptions=Ze;a.moduleName=_;a.folderName=$;var B=a;import{jsx as tr}from"react/jsx-runtime";import{jsx as sr,jsxs as nr}from"react/jsx-runtime";import{jsx as cr,jsxs as pr}from"react/jsx-runtime";import{jsx as fr,jsxs as ur}from"react/jsx-runtime";import{jsx as u,jsxs as Te}from"react/jsx-runtime";var Lr=t=>u(f,{children:[u(a,{top:!0,text:"Root 1",showCheckbox:!0},"treeview-item-1"),u(a,{text:"Root 2",showCheckbox:!0,expanded:!0,children:Te(d,{children:[u(a,{top:!0,text:"Child 2.1",showCheckbox:!0}),u(a,{text:"Child 2.2",showCheckbox:!0,children:u(d,{children:u(a,{bottom:!0,text:"Child 2.2.1"})})}),u(a,{bottom:!0,text:"Child 2.3",showCheckbox:!0})]})},"treeview-item-2"),Te(a,{bottom:!0,text:"Root 3",showCheckbox:!0,children:[u(a,{top:!0,text:"Child 3.1"}),u(a,{text:"Child 3.2"}),u(a,{bottom:!0,text:"Child 3.3"})]},"treeview-item-3")],...t});export{Lr as TreeviewCheckboxes};