@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 10.2 kB
JavaScript
var i=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?i(...e):typeof e=="object"?Object.keys(e).map((s,r)=>e[r]||e[s]&&s||null).filter(s=>s!==null).join(" "):e).filter(e=>!!e).join(" ");var T=(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.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"}),K=(t,e)=>{let{valid:s,invalid:r,hover:m,focus:l,checked:a,active:p,selected:d,disabled:h,indeterminate:k,loading:b,empty:G,readonly:_,highlighted:v,...B}=e;return i({"k-valid":s,"k-invalid":r,"k-hover":m,"k-focus":l,"k-checked":a,"k-active":p,"k-selected":d,"k-disabled":h,"k-indeterminate":k&&!a,"k-loading":b,"k-empty":G,"k-readonly":_,"k-highlighted":v},Object.keys(B).reduce((L,A)=>(A.startsWith("k-")?L[A]=B[A]:L[`k-${A}`]=B[A],L),{}))};function ie(t,e){if(!e)return{};let s=Array.isArray(e)?e:[e];return Object.fromEntries(s.map(r=>[`k-${r}`,!0]))}var n={xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},y={small:"small",medium:"medium",large:"large",full:"full"},g={solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},o={inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",dark:"dark",light:"light",inverse:"inverse"},N={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"};import{Fragment as ae,jsx as M,jsxs as q}from"react/jsx-runtime";var Be=[N.focus],J=t=>{let{type:e,focus:s,separator:r,...m}=t,l,a=["00","01","02","03","04","05","06","07","08","09"];switch(e){case"dd":l="Day";break;case"HH":l="Hour";break;case"mm":l="Minute";break;case"ss":l="Second";break;case"SSS":l="Millisecond",a=["000","001","002","003","004","005","006","007","008","009"];break;case"tt":l="AM/PM",a=["AM","PM"];break;default:l="Column Name";break}let p=a.map(d=>M(ae,{children:M("li",{className:"k-item",children:M("span",{children:d})})}));return q(ae,{children:[r&&M("div",{className:"k-time-separator",children:":"}),q("div",{...m,className:i(t.className,"k-time-list-wrapper",K("k-time-list-wrapper",{focus:s})),children:[M("span",{className:"k-title",children:l}),M("div",{className:"k-time-list",children:q("div",{className:"k-content k-scrollable k-time-container",children:[M("ul",{className:"k-reset",style:{transform:"translateY(97px)"},children:p}),M("div",{className:"k-scrollable-placeholder"})]})})]})]})};J.states=Be;import{jsx as Ie,jsxs as He}from"react/jsx-runtime";var Le="k-time-header",D=t=>{let{title:e,...s}=t;return He("div",{...s,className:i(t.className,Le),children:[e!=null&&Ie("span",{className:"k-title",children:e}),t.children]})};var X="action-buttons",le=X;import{jsx as Re}from"react/jsx-runtime";var U="k-actions",Pe=[],we={},W={alignment:"start",orientation:"horizontal"},u=t=>{let{alignment:e=W.alignment,orientation:s=W.orientation,...r}=t;return Re("div",{...r,className:i(U,{[`${U}-${e}`]:e,[`${U}-${s}`]:s},t.className),children:t.children})};u.states=Pe;u.options=we;u.className=U;u.defaultOptions=W;u.moduleName=X;u.folderName=le;import{Fragment as Ue,jsx as me}from"react/jsx-runtime";var Y="k-font-icon",ze=[],Ke={size:[n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.light,o.dark]},De={},I=t=>{let{size:e,themeColor:s,icon:r,rotate:m,flip:l,...a}=t;return r?me("span",{...a,className:i(t.className,Y,T(Y,{size:e}),{[`k-i-${r}`]:r,[`k-color-${s}`]:s,[`k-rotate-${m}`]:m,"k-flip-h":l==="h"||l==="both","k-flip-v":l==="v"||l==="both"})}):me(Ue,{})};I.states=ze;I.options=Ke;I.className=Y;I.defaultOptions=De;var ce=I;import{Fragment as Ve,jsx as $}from"react/jsx-runtime";var Q="k-svg-icon",$e=[],Fe={size:[n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.light,o.dark]},de={viewBox:"0 0 24 24"},H=t=>{let{size:e,themeColor:s,rotate:r,flip:m,viewBox:l=de.viewBox,icon:a,...p}=t;if(!a)return $(Ve,{});a==="none"&&{...p,className:i(t.className,Q,"k-none")};let d=typeof a=="object"&&a.name&&a.name;return $("span",{...p,className:i(t.className,Q,T("k-icon",{size:e}),{[`k-svg-i-${d}`]:d,[`k-color-${s}`]:s,[`k-rotate-${r}`]:r,"k-flip-h":m==="h"||m==="both","k-flip-v":m==="v"||m==="both"}),children:$("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof a=="object"?a.viewBox:l,dangerouslySetInnerHTML:typeof a=="object"?{__html:a.content}:void 0,children:a?void 0:t.children})})};H.states=$e;H.options=Fe;H.className=Q;H.defaultOptions=de;var Z=H;import*as j from"@progress/kendo-svg-icons";var pe="icon",ue="icons";import{Fragment as fe,jsx as P}from"react/jsx-runtime";var F="k-icon",Ge=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),qe=[],Je={size:[n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.light,o.dark]},ee={viewBox:"0 0 24 24",type:"svg"},x=t=>{let{size:e,themeColor:s,icon:r,type:m=ee.type,rotate:l,flip:a,viewBox:p=ee.viewBox,...d}=t;if(!r)return P(fe,{});if(m==="svg"){if(r==="none")return P(Z,{...d,className:i(t.className,F),icon:r,size:e});let h=j[r]?r:Ge(`${r}-icon`);return j[h]?P(Z,{...d,className:i(t.className,F),icon:j[h],size:e,themeColor:s,rotate:l,flip:a,viewBox:p}):P(fe,{})}return P(ce,{...d,className:i(t.className,F),icon:r,size:e,themeColor:s,rotate:l,flip:a})};x.states=qe;x.options=Je;x.defaultOptions=ee;x.className=F;x.moduleName=pe;x.folderName=ue;var te="button",Ne=te;import{Fragment as Qe,jsx as w,jsxs as xe}from"react/jsx-runtime";var R="k-button",Xe=["icon-button"],We=[N.hover,N.focus,N.active,N.selected,N.disabled,N.generating],Ye={size:[n.small,n.medium,n.large],rounded:[y.small,y.medium,y.large,y.full],fillMode:[g.solid,g.flat,g.outline,g.clear,g.link],themeColor:[o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.light,o.dark,o.inverse]},C={size:n.medium,rounded:y.medium,fillMode:g.solid,themeColor:o.base,showArrow:!1,arrowIconName:"caret-alt-down"},c=t=>{let{size:e=C.size,rounded:s=C.rounded,fillMode:r=C.fillMode,themeColor:m=C.themeColor,showArrow:l=C.showArrow,arrowIconName:a=C.arrowIconName,variant:p,hover:d,focus:h,active:k,selected:b,disabled:G,icon:_,text:v,iconClassName:B,...L}=t,A=_!==void 0,_e=t.children!==void 0;return xe("button",{...L,className:i(t.className,R,ie(R,p),T(R,{size:e,rounded:s,fillMode:r,themeColor:m}),K(R,{hover:d,focus:h,active:k,disabled:G,selected:b}),{"k-icon-button":!v&&!_e&&A}),children:[_&&w(x,{className:i(B,"k-button-icon"),icon:_}),v?xe(Qe,{children:[v&&w("span",{className:"k-button-text",children:v}),t.children]}):t.children&&w("span",{className:"k-button-text",children:t.children}),l&&w("span",{className:"k-menu-button-arrow k-button-arrow",children:w(x,{icon:a})})]})};c.states=We;c.options=Ye;c.variants=Xe;c.className=R;c.defaultOptions=C;c.moduleName=te;c.folderName=Ne;import{jsx as Qt}from"react/jsx-runtime";import{jsx as to}from"react/jsx-runtime";import{jsx as ro}from"react/jsx-runtime";import{jsx as ho,jsxs as To}from"react/jsx-runtime";var oe="popup",he=oe;import{jsx as Te}from"react/jsx-runtime";var Me="k-animation-container",Ze=[],je={},Se={positionMode:"absolute"},S=t=>{let{positionMode:e=Se.positionMode,animationStyle:s,offset:r,...m}=t;return Te("div",{...m,style:{...r,...t.style},className:i(t.className,Me,"k-animation-container-shown",{"k-animation-container-fixed":e==="fixed"}),children:Te("div",{className:"k-child-animation-container",style:s,children:t.children})})};S.states=Ze;S.options=je;S.className=Me;S.defaultOptions=Se;S.moduleName=oe;S.folderName=he;var ne="popup",Ae=ne;import{jsx as ge}from"react/jsx-runtime";var Ce="k-popup",et=[],tt={},Oe={positionMode:"absolute"},f=t=>{let{offset:e,positionMode:s=Oe.positionMode,animationStyle:r,...m}=t;return ge(S,{positionMode:s,offset:e,animationStyle:r,children:ge("div",{...m,className:i(t.className,Ce),children:t.children})})};f.states=et;f.options=tt;f.className=Ce;f.defaultOptions=Oe;f.moduleName=ne;f.folderName=Ae;import{Fragment as Fo,jsx as Uo,jsxs as $o}from"react/jsx-runtime";import{Fragment as jo,jsx as Qo,jsxs as Zo}from"react/jsx-runtime";var ke="time-selector",be="timeselector";import{Fragment as se,jsx as z,jsxs as ve}from"react/jsx-runtime";var re="k-timeselector",ot=[],nt={size:[n.small,n.medium,n.large]},ye={size:n.medium},O=t=>{let{size:e=ye.size,header:s,fastSelection:r,columns:m,focusedColumn:l,...a}=t,p=m.map(function(d,h){let k=!1,b=!0;return d===l&&(k=!0),(h===0||d==="tt")&&(b=!1),z(se,{children:z(J,{type:d,focus:k,separator:b})})});return ve("div",{...a,className:i(t.className,re,T(re,{size:e})),children:[z(se,{children:s}),z(se,{children:r}),ve("div",{className:"k-time-list-container",children:[z("span",{className:"k-time-highlight"}),p]})]})};O.states=ot;O.options=nt;O.className=re;O.defaultOptions=ye;O.moduleName=ke;O.folderName=be;var V=O;import{Fragment as st,jsx as E,jsxs as Ee}from"react/jsx-runtime";var An=t=>E(f,{children:Ee(st,{children:[E(V,{columns:["HH"],header:E(D,{title:"10",children:E(c,{fillMode:"flat",className:"k-time-now",children:"Now"})})}),Ee(u,{alignment:"stretched",className:"k-time-footer",children:[E(c,{className:"k-time-cancel",children:"Cancel"}),E(c,{themeColor:"primary",className:"k-time-accept",children:"Set"})]})]}),...t});export{An as TimeSelectorHour};