UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 14.1 kB
var ye=Object.create;var q=Object.defineProperty;var Ne=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var Ce=(t,e)=>{for(var o in e)q(t,o,{get:e[o],enumerable:!0})},re=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Se(e))!Te.call(t,r)&&r!==o&&q(t,r,{get:()=>e[r],enumerable:!(i=Ne(e,r))||i.enumerable});return t};var Ie=(t,e,o)=>(o=t!=null?ye(we(t)):{},re(e||!t||!t.__esModule?q(o,"default",{value:t,enumerable:!0}):o,t)),Be=t=>re(q({},"__esModule",{value:!0}),t);var je={};Ce(je,{Slider:()=>I,default:()=>We});module.exports=Be(je);var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...e):typeof e=="object"?Object.keys(e).map((o,i)=>e[i]||e[o]&&o||null).filter(o=>o!==null).join(" "):e).filter(e=>!!e).join(" ");var A=(t,e)=>d({[`${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"}),_=(t,e)=>{let{valid:o,invalid:i,hover:r,focus:c,checked:p,active:s,selected:y,disabled:v,indeterminate:u,loading:x,empty:f,readonly:M,highlighted:R,...w}=e;return d({"k-valid":o,"k-invalid":i,"k-hover":r,"k-focus":c,"k-checked":p,"k-active":s,"k-selected":y,"k-disabled":v,"k-indeterminate":u&&!p,"k-loading":x,"k-empty":f,"k-readonly":M,"k-highlighted":R},Object.keys(w).reduce((m,T)=>(T.startsWith("k-")?m[T]=w[T]:m[`k-${T}`]=w[T],m),{}))};function ie(t,e){if(!e)return{};let o=Array.isArray(e)?e:[e];return Object.fromEntries(o.map(i=>[`k-${i}`,!0]))}var a={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},E={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},z={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},N={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"},h={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 P=require("react/jsx-runtime"),Q="k-font-icon",Oe=[],Me={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info]},Ae={},H=t=>{let{size:e,themeColor:o,icon:i,rotate:r,flip:c,...p}=t;return i?(0,P.jsx)("span",{...p,className:d(t.className,Q,A(Q,{size:e}),{[`k-i-${i}`]:i,[`k-color-${o}`]:o,[`k-rotate-${r}`]:r,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):(0,P.jsx)(P.Fragment,{})};H.states=Oe;H.options=Me;H.className=Q;H.defaultOptions=Ae;var se=H;var L=require("react/jsx-runtime"),X="k-svg-icon",Ee=[],ze={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[N.outline,N.solid,N.duotone]},Y={viewBox:"0 0 24 24",variant:N.outline},F=t=>{var x,f;let{size:e,themeColor:o,rotate:i,flip:r,viewBox:c=Y.viewBox,variant:p=Y.variant,icon:s,...y}=t;if(!s)return(0,L.jsx)(L.Fragment,{});if(s==="none")return(0,L.jsx)("span",{...y,className:d(t.className,X,A("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let v=typeof s=="object"&&s.name&&s.name,u=typeof s=="object"?p&&((x=s.variants)==null?void 0:x[p])||((f=s.variants)==null?void 0:f.outline)||s.content:void 0;return(0,L.jsx)("span",{...y,className:d(t.className,X,A("k-icon",{size:e}),{[`k-svg-i-${v}`]:v,[`k-color-${o}`]:o,[`k-rotate-${i}`]:i,"k-flip-h":r==="h"||r==="both","k-flip-v":r==="v"||r==="both"}),"aria-hidden":"true",children:(0,L.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof s=="object"?s.viewBox:c,dangerouslySetInnerHTML:u!==void 0?{__html:u}:void 0,children:s?void 0:t.children})})};F.states=Ee;F.options=ze;F.className=X;F.defaultOptions=Y;var Z=F;var ee=Ie(require("@progress/kendo-svg-icons"));var le="icon",de="icons";var me=require("react");var ce=require("react"),ue=(0,ce.createContext)({iconsType:"svg"});var C=require("react/jsx-runtime"),W="k-icon",Le=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Re=[],_e={size:[a.undefined,a.xsmall,a.small,a.medium,a.large,a.xlarge,a.xxlarge,a.xxxlarge],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info],variant:[N.outline,N.solid,N.duotone]},j={viewBox:"0 0 24 24",type:"svg",variant:N.outline},S=t=>{let{iconsType:e}=(0,me.useContext)(ue),{size:o,themeColor:i,icon:r,type:c=e||j.type,rotate:p,flip:s,viewBox:y=j.viewBox,variant:v=j.variant,...u}=t;if(!r)return(0,C.jsx)(C.Fragment,{});if((e||c)==="svg"){if(r==="none")return(0,C.jsx)(Z,{...u,className:d(t.className,W),icon:r,size:o,variant:v});let f=ee[r]?r:Le(`${r}-icon`);return ee[f]?(0,C.jsx)(Z,{...u,className:d(t.className,W),icon:ee[f],size:o,themeColor:i,rotate:p,flip:s,viewBox:y,variant:v}):(0,C.jsx)(C.Fragment,{})}return(0,C.jsx)(se,{...u,className:d(t.className,W),icon:r,size:o,themeColor:i,rotate:p,flip:s})};S.states=Re;S.options=_e;S.defaultOptions=j;S.className=W;S.moduleName=le;S.folderName=de;S.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 te="button",pe=te;var g=require("react/jsx-runtime"),V="k-button",Ke=["icon-button"],De=[h.hover,h.focus,h.active,h.selected,h.disabled,h.generating],$e={size:[a.undefined,a.xsmall,a.small,a.medium,a.large],rounded:[E.undefined,E.none,E.small,E.medium,E.large,E.full],fillMode:[z.undefined,z.solid,z.flat,z.outline,z.clear,z.link],themeColor:[n.undefined,n.base,n.primary,n.secondary,n.tertiary,n.success,n.warning,n.error,n.info,n.inverse]},ne={showArrow:!1,arrowIconName:"chevron-down"},l=t=>{let{as:e="button",size:o,rounded:i,fillMode:r,themeColor:c,showArrow:p=ne.showArrow,arrowIconName:s=ne.arrowIconName,variant:y,hover:v,focus:u,active:x,selected:f,disabled:M,togglable:R,ariaDisabled:w,icon:m,iconSize:T,text:B,iconClassName:O,className:ae,...G}=t,D=m!=null,$=t.children!==void 0;return(0,g.jsxs)(e,{className:d(ae,V,ie(V,y),A(V,{size:o,rounded:i,fillMode:r,themeColor:c}),_(V,{hover:v,focus:u,active:x,disabled:M||w,selected:f}),{"k-icon-button":!B&&!$&&D}),"aria-pressed":R?f?"true":"false":void 0,...G,"aria-disabled":w?"true":void 0,disabled:M||void 0,children:[typeof m=="string"&&m&&(0,g.jsx)(S,{className:d(O,"k-button-icon"),icon:m,size:T}),m&&typeof m!="string"&&(0,g.jsx)(g.Fragment,{children:m}),B?(0,g.jsxs)(g.Fragment,{children:[B&&(0,g.jsx)("span",{className:"k-button-text",children:B}),t.children]}):t.children&&(0,g.jsx)("span",{className:"k-button-text",children:t.children}),p&&(0,g.jsx)("span",{className:"k-menu-button-arrow k-button-arrow",children:(0,g.jsx)(S,{icon:s})})]})};l.states=De;l.options=$e;l.variants=Ke;l.className=V;l.defaultOptions=ne;l.moduleName=te;l.folderName=pe;l.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 he=require("react/jsx-runtime"),fe=t=>(0,he.jsx)(l,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});var be=require("react/jsx-runtime"),ge=t=>(0,be.jsx)(l,{icon:"folder",children:"Button",...t});var xe=require("react/jsx-runtime"),ve=t=>(0,xe.jsx)(l,{children:"Button",...t});var J=require("react/jsx-runtime"),Pe=l.options,He=l.states,Fe={...l.defaultOptions,variant:"text"},Ve=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Ue=[],K=t=>{let{variant:e,...o}=t;switch(e){case"icon-only":return(0,J.jsx)(fe,{...o,icon:"star"});case"icon-and-text":return(0,J.jsx)(ge,{...o,icon:"star",children:"Button"});default:return(0,J.jsx)(ve,{...o,children:"Button"})}};K.options=Pe;K.states=He;K.variants=Ve;K.defaultOptions=Fe;K.modifiers=Ue;K.className=l.className;var oe="slider",ke=oe;var k=require("react/jsx-runtime"),U="k-slider",Ge=[h.hover,h.focus,h.active,h.disabled,h.readonly],qe={},b={type:"single",orientation:"horizontal",gradientType:"1d",readonly:!1,disabled:!1,handlePosition:"end",showButtons:!0,showTicks:!0,value:50,min:0,max:100},I=t=>{let{type:e=b.type,orientation:o=b.orientation,gradientType:i=b.gradientType,readonly:r=b.readonly,disabled:c=b.disabled,handlePosition:p=b.handlePosition,showButtons:s=b.showButtons,showTicks:y=b.showTicks,value:v=b.value,min:u=b.min,max:x=b.max,startValue:f,endValue:M,hover:R,focus:w,active:m,trackStyle:T,dir:B,...O}=t,G=(()=>{if(e==="gradient"&&i==="2d")return"undefined";if(o==="vertical")return"vertical"})(),D,$;return o==="horizontal"?(D=B==="rtl"?"chevron-left":"chevron-right",$=B==="rtl"?"chevron-right":"chevron-left"):o==="vertical"&&(D="chevron-up",$="chevron-down"),(0,k.jsxs)("div",{...O,className:d(U,t.className,_(U,{readonly:r,disabled:c}),{[`k-slider-${o}`]:o,"k-colorgradient-slider":e==="gradient"}),dir:B,children:[s&&(0,k.jsx)(l,{className:"k-button-decrease",rounded:"full",icon:$,tabIndex:-1,title:"Decrease"}),(0,k.jsxs)("div",{className:"k-slider-track-wrap",children:[y&&(0,k.jsx)("ul",{className:"k-reset k-slider-items","aria-hidden":"true",children:t.children}),(0,k.jsxs)("div",{className:"k-slider-track",style:T,children:[(0,k.jsx)("div",{className:"k-slider-selection"}),e==="range"&&(0,k.jsx)("span",{className:d("k-draghandle","k-draghandle-start",_(U,{hover:R,focus:w,active:m})),role:"slider",tabIndex:c?void 0:0,"aria-valuenow":f??u,"aria-valuemin":u,"aria-valuemax":M??x,"aria-orientation":G,"aria-disabled":c?"true":void 0,"aria-readonly":r?"true":void 0,"aria-label":O["aria-label"]?`${O["aria-label"]} start`:"Range start"}),(0,k.jsx)("span",{className:d("k-draghandle",`k-draghandle-${p}`,_(U,{hover:R,focus:w,active:m})),role:"slider",tabIndex:c?void 0:0,"aria-valuenow":e==="range"?M??x:v,"aria-valuemin":e==="range"?f??u:u,"aria-valuemax":x,"aria-orientation":G,"aria-disabled":c?"true":void 0,"aria-readonly":r?"true":void 0,"aria-label":e==="range"?O["aria-label"]?`${O["aria-label"]} end`:"Range end":O["aria-label"]})]})]}),s&&(0,k.jsx)(l,{className:"k-button-increase",rounded:"full",icon:D,tabIndex:-1,title:"Increase"})]})};I.states=Ge;I.options=qe;I.className=U;I.defaultOptions=b;I.moduleName=oe;I.folderName=ke;I.ariaSpec={selector:".k-slider",rules:[{selector:".k-slider .k-draghandle:not(.k-hsv-draghandle)",attribute:"role=slider",usage:"Sets the proper role for Slider."},{selector:".k-slider .k-draghandle:not(.k-hsv-draghandle)",attribute:"aria-label or aria-labelledby or title",usage:"The Slider needs an accessible name to be assigned to it."},{selector:".k-slider .k-draghandle:not(.k-hsv-draghandle)",attribute:"aria-invalid=true (when invalid)",usage:"Rendered only when the Slider is in a form and announces the invalid state."},{selector:".k-slider .k-draghandle:not(.k-hsv-draghandle)",attribute:"aria-valuenow",usage:"Specifies the currently selected value in the Slider."},{selector:".k-slider .k-draghandle:not(.k-hsv-draghandle)",attribute:"aria-valuemin",usage:"Specifies the minimum available value in the Slider."},{selector:".k-slider .k-draghandle:not(.k-hsv-draghandle)",attribute:"aria-valuemax",usage:"Specifies the maximum available value in the Slider."},{selector:".k-slider .k-draghandle:not(.k-hsv-draghandle)",attribute:"aria-valuetext (when has text alternative)",usage:"Specifies a human-readable text alternative to the numeric value. Provided by consuming applications."},{selector:".k-slider:not(.k-disabled) .k-draghandle:not(.k-hsv-draghandle)",attribute:"tabindex=0",usage:"The element must be focusable. Disabled sliders are removed from tab order."},{selector:".k-slider-vertical .k-draghandle",attribute:"aria-orientation=vertical (when vertical)",usage:"Present only when slider is vertical."},{selector:".k-slider.k-disabled .k-draghandle:not(.k-hsv-draghandle)",attribute:"aria-disabled=true",usage:"Rendered only when the Slider is disabled."},{selector:".k-slider.k-readonly .k-draghandle",attribute:"aria-readonly=true (when readonly)",usage:"Rendered only when the Slider is readonly. Readonly sliders remain focusable but their value cannot be changed."},{selector:".k-slider .k-button",attribute:"tabindex=-1",usage:"Excludes the buttons from the natural tab order. Keyboard users use arrow keys on the drag handle."},{selector:".k-slider .k-button",attribute:"title",usage:'Provides a tooltip describing the button action (e.g., "Decrease" or "Increase").'},{selector:".k-slider .k-slider-items",attribute:"aria-hidden=true",usage:"Hides the tick list from assistive technologies. Tick values are redundant with the drag handle value attributes."},{selector:".k-slider .k-tick",attribute:"role=presentation",usage:"Removes semantic meaning from individual tick elements. Ticks are visual-only markers."},{selector:".k-slider .k-tick",attribute:"title",usage:"Represents the value associated with the respective tick."}]};var We=I;