UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 12.8 kB
var Wt=Object.create;var W=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var Jt=(t,e)=>{for(var o in e)W(t,o,{get:e[o],enumerable:!0})},mt=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Gt(e))!qt.call(t,a)&&a!==o&&W(t,a,{get:()=>e[a],enumerable:!(s=Vt(e,a))||s.enumerable});return t};var Xt=(t,e,o)=>(o=t!=null?Wt(Yt(t)):{},mt(e||!t||!t.__esModule?W(o,"default",{value:t,enumerable:!0}):o,t)),Qt=t=>mt(W({},"__esModule",{value:!0}),t);var we={};Jt(we,{DialogDemo:()=>B,default:()=>Ee});module.exports=Qt(we);var l=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?l(...e):typeof e=="object"?Object.keys(e).map((o,s)=>e[s]||e[o]&&o||null).filter(o=>o!==null).join(" "):e).filter(e=>!!e).join(" ");var L=(t,e)=>l({[`${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"}),ut=(t,e)=>{let{valid:o,invalid:s,hover:a,focus:c,checked:m,active:d,selected:N,disabled:p,indeterminate:h,loading:E,empty:b,readonly:U,highlighted:J,...K}=e;return l({"k-valid":o,"k-invalid":s,"k-hover":a,"k-focus":c,"k-checked":m,"k-active":d,"k-selected":N,"k-disabled":p,"k-indeterminate":h&&!m,"k-loading":E,"k-empty":b,"k-readonly":U,"k-highlighted":J},Object.keys(K).reduce((x,w)=>(w.startsWith("k-")?x[w]=K[w]:x[`k-${w}`]=K[w],x),{}))};function pt(t,e){if(!e)return{};let o=Array.isArray(e)?e:[e];return Object.fromEntries(o.map(s=>[`k-${s}`,!0]))}var i={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},_={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"},v={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"},D={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 X={};function Q(t){return X[t]=(X[t]||0)+1,`k-${t}-${X[t]}`}var Z="action-buttons",ft=Z;var gt=require("react/jsx-runtime"),V="k-actions",Zt=[],jt={},j={alignment:"start",orientation:"horizontal"},k=t=>{let{alignment:e=j.alignment,orientation:o=j.orientation,...s}=t;return(0,gt.jsx)("div",{...s,className:l(V,{[`${V}-${e}`]:e,[`${V}-${o}`]:o},t.className),children:t.children})};k.states=Zt;k.options=jt;k.className=V;k.defaultOptions=j;k.moduleName=Z;k.folderName=ft;var z=require("react/jsx-runtime"),tt="k-font-icon",te=[],ee={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]},oe={},H=t=>{let{size:e,themeColor:o,icon:s,rotate:a,flip:c,...m}=t;return s?(0,z.jsx)("span",{...m,className:l(t.className,tt,L(tt,{size:e}),{[`k-i-${s}`]:s,[`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,z.jsx)(z.Fragment,{})};H.states=te;H.options=ee;H.className=tt;H.defaultOptions=oe;var xt=H;var S=require("react/jsx-runtime"),et="k-svg-icon",ne=[],ie={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:[v.outline,v.solid,v.duotone]},ot={viewBox:"0 0 24 24",variant:v.outline},P=t=>{var E,b;let{size:e,themeColor:o,rotate:s,flip:a,viewBox:c=ot.viewBox,variant:m=ot.variant,icon:d,...N}=t;if(!d)return(0,S.jsx)(S.Fragment,{});if(d==="none")return(0,S.jsx)("span",{...N,className:l(t.className,et,L("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let p=typeof d=="object"&&d.name&&d.name,h=typeof d=="object"?m&&((E=d.variants)==null?void 0:E[m])||((b=d.variants)==null?void 0:b.outline)||d.content:void 0;return(0,S.jsx)("span",{...N,className:l(t.className,et,L("k-icon",{size:e}),{[`k-svg-i-${p}`]:p,[`k-color-${o}`]:o,[`k-rotate-${s}`]:s,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="both"}),"aria-hidden":"true",children:(0,S.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof d=="object"?d.viewBox:c,dangerouslySetInnerHTML:h!==void 0?{__html:h}:void 0,children:d?void 0:t.children})})};P.states=ne;P.options=ie;P.className=et;P.defaultOptions=ot;var nt=P;var it=Xt(require("@progress/kendo-svg-icons"));var Nt="icon",ht="icons";var yt=require("react");var bt=require("react"),vt=(0,bt.createContext)({iconsType:"svg"});var A=require("react/jsx-runtime"),G="k-icon",ae=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),re=[],se={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:[v.outline,v.solid,v.duotone]},Y={viewBox:"0 0 24 24",type:"svg",variant:v.outline},y=t=>{let{iconsType:e}=(0,yt.useContext)(vt),{size:o,themeColor:s,icon:a,type:c=e||Y.type,rotate:m,flip:d,viewBox:N=Y.viewBox,variant:p=Y.variant,...h}=t;if(!a)return(0,A.jsx)(A.Fragment,{});if((e||c)==="svg"){if(a==="none")return(0,A.jsx)(nt,{...h,className:l(t.className,G),icon:a,size:o,variant:p});let b=it[a]?a:ae(`${a}-icon`);return it[b]?(0,A.jsx)(nt,{...h,className:l(t.className,G),icon:it[b],size:o,themeColor:s,rotate:m,flip:d,viewBox:N,variant:p}):(0,A.jsx)(A.Fragment,{})}return(0,A.jsx)(xt,{...h,className:l(t.className,G),icon:a,size:o,themeColor:s,rotate:m,flip:d})};y.states=re;y.options=se;y.defaultOptions=Y;y.className=G;y.moduleName=Nt;y.folderName=ht;y.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 at="button",Ot=at;var f=require("react/jsx-runtime"),$="k-button",le=["icon-button"],de=[D.hover,D.focus,D.active,D.selected,D.disabled,D.generating],ce={size:[i.undefined,i.xsmall,i.small,i.medium,i.large],rounded:[_.undefined,_.none,_.small,_.medium,_.large,_.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]},rt={showArrow:!1,arrowIconName:"chevron-down"},r=t=>{let{as:e="button",size:o,rounded:s,fillMode:a,themeColor:c,showArrow:m=rt.showArrow,arrowIconName:d=rt.arrowIconName,variant:N,hover:p,focus:h,active:E,selected:b,disabled:U,togglable:J,ariaDisabled:K,icon:x,iconSize:w,text:F,iconClassName:Ht,className:Pt,...$t}=t,Ut=x!=null,Ft=t.children!==void 0;return(0,f.jsxs)(e,{className:l(Pt,$,pt($,N),L($,{size:o,rounded:s,fillMode:a,themeColor:c}),ut($,{hover:p,focus:h,active:E,disabled:U||K,selected:b}),{"k-icon-button":!F&&!Ft&&Ut}),"aria-pressed":J?b?"true":"false":void 0,...$t,"aria-disabled":K?"true":void 0,disabled:U||void 0,children:[typeof x=="string"&&x&&(0,f.jsx)(y,{className:l(Ht,"k-button-icon"),icon:x,size:w}),x&&typeof x!="string"&&(0,f.jsx)(f.Fragment,{children:x}),F?(0,f.jsxs)(f.Fragment,{children:[F&&(0,f.jsx)("span",{className:"k-button-text",children:F}),t.children]}):t.children&&(0,f.jsx)("span",{className:"k-button-text",children:t.children}),m&&(0,f.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,f.jsx)(y,{icon:d})})]})};r.states=de;r.options=ce;r.variants=le;r.className=$;r.defaultOptions=rt;r.moduleName=at;r.folderName=Ot;r.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 Ct=require("react/jsx-runtime"),At=t=>(0,Ct.jsx)(r,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});var Mt=require("react/jsx-runtime"),kt=t=>(0,Mt.jsx)(r,{icon:"folder",children:"Button",...t});var Bt=require("react/jsx-runtime"),Tt=t=>(0,Bt.jsx)(r,{children:"Button",...t});var q=require("react/jsx-runtime"),me=r.options,ue=r.states,pe={...r.defaultOptions,variant:"text"},fe=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],ge=[],R=t=>{let{variant:e,...o}=t;switch(e){case"icon-only":return(0,q.jsx)(At,{...o,icon:"star"});case"icon-and-text":return(0,q.jsx)(kt,{...o,icon:"star",children:"Button"});default:return(0,q.jsx)(Tt,{...o,children:"Button"})}};R.options=me;R.states=ue;R.variants=fe;R.defaultOptions=pe;R.modifiers=ge;R.className=r.className;var st="window",Et=st;var Lt=require("react/jsx-runtime"),wt="k-window-content",xe=[],Ne={},he={},M=t=>{let{children:e,...o}=t;return(0,Lt.jsx)("div",{...o,className:l(wt,t.className),children:e})};M.states=xe;M.options=Ne;M.className=wt;M.defaultOptions=he;M.moduleName=st;M.folderName=Et;var lt="dialog",_t=lt;var dt="overlay",It=dt;var St=require("react/jsx-runtime"),Dt="k-overlay",be=[],ve={},ye={},T=t=>{let{...e}=t;return(0,St.jsx)("div",{...e,className:l(t.className,Dt),children:t.children})};T.states=be;T.options=ve;T.className=Dt;T.defaultOptions=ye;T.moduleName=dt;T.folderName=It;var u=require("react/jsx-runtime"),Kt="k-dialog",Oe=[],Ae={},ct={actionButtonsAlign:"stretched",modal:!0},g=t=>{let{title:e,actions:o,actionButtons:s,actionButtonsAlign:a=ct.actionButtonsAlign,modal:c=ct.modal,...m}=t,d=e!==void 0?Q("dialog-titlebar"):void 0,N=Q("dialog-content");return(0,u.jsxs)("div",{className:"k-dialog-wrapper",children:[c&&(0,u.jsx)(T,{}),(0,u.jsxs)("div",{...m,className:l(t.className,Kt,"k-window"),role:"dialog","aria-labelledby":d,"aria-describedby":N,...c&&{"aria-modal":"true"},children:[(e!==void 0||o)&&(0,u.jsxs)("div",{className:"k-window-titlebar k-dialog-titlebar",id:d,children:[e!==void 0&&(0,u.jsx)("span",{className:"k-window-title k-dialog-title",children:e}),o&&(0,u.jsx)(u.Fragment,{children:(0,u.jsx)("div",{className:"k-window-titlebar-actions k-dialog-titlebar-actions",children:o.map(p=>(0,u.jsx)(r,{icon:p,fillMode:"flat",size:"xsmall",className:"k-window-titlebar-action k-dialog-titlebar-action","aria-label":p},p))})})]}),(0,u.jsx)(M,{className:"k-dialog-content",id:N,children:t.children}),s&&(0,u.jsx)(k,{alignment:a,className:"k-window-actions k-dialog-actions",children:s})]})]})};g.states=Oe;g.options=Ae;g.className=Kt;g.defaultOptions=ct;g.moduleName=lt;g.folderName=_t;g.ariaSpec={selector:".k-dialog",rules:[{selector:".k-dialog",attribute:"role=dialog or role=alertdialog",usage:"Announces the dialog or alertdialog role of the component."},{selector:".k-dialog",attribute:"aria-labelledby",usage:"Associate the title of the dialog."},{selector:".k-dialog",attribute:"aria-describedby",usage:"Associate the dialog content to the wrap element."},{selector:".k-overlay + .k-dialog",attribute:"aria-modal=true",usage:"Announces that the dialog is modal. Attribute is added only when the dialog is modal."}]};var Rt=g;var O=require("react/jsx-runtime"),zt=t=>(0,O.jsx)(Rt,{title:"Title",children:(0,O.jsx)(O.Fragment,{children:"Dialog content"}),actionButtons:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(r,{children:"Action"}),(0,O.jsx)(r,{themeColor:"primary",children:"Primary"})]}),actions:["x"],...t});var C=require("react/jsx-runtime"),Ce=g.options,ke=[],Me=g.states,Te=g.defaultOptions,Be=[],B=t=>(0,C.jsx)(zt,{style:{width:"350px",height:"215px"},...t,title:"Please confirm",actions:["x"],actionButtonsAlign:"stretched",actionButtons:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(r,{children:"No"}),(0,C.jsx)(r,{themeColor:"primary",children:"Yes"})]}),children:(0,C.jsx)("p",{style:{margin:"36px",textAlign:"center"},children:"Are you sure you want to continue?"})});B.options=Ce;B.states=Me;B.variants=ke;B.defaultOptions=Te;B.modifiers=Be;B.className=g.className;var Ee=B;