UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 9.67 kB
var c=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?c(...e):typeof e=="object"?Object.keys(e).map((r,s)=>e[s]||e[r]&&r||null).filter(r=>r!==null).join(" "):e).filter(e=>!!e).join(" ");var N=(t,e)=>c({[`${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"}),J=(t,e)=>{let{valid:r,invalid:s,hover:a,focus:d,checked:u,active:l,selected:g,disabled:h,indeterminate:p,loading:E,empty:v,readonly:L,highlighted:K,...B}=e;return c({"k-valid":r,"k-invalid":s,"k-hover":a,"k-focus":d,"k-checked":u,"k-active":l,"k-selected":g,"k-disabled":h,"k-indeterminate":p&&!u,"k-loading":E,"k-empty":v,"k-readonly":L,"k-highlighted":K},Object.keys(B).reduce((m,y)=>(y.startsWith("k-")?m[y]=B[y]:m[`k-${y}`]=B[y],m),{}))};function Q(t,e){if(!e)return{};let r=Array.isArray(e)?e:[e];return Object.fromEntries(r.map(s=>[`k-${s}`,!0]))}var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},k={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},C={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},f={undefined:void 0,outline:"outline",solid:"solid",duotone:"duotone"},o={undefined:void 0,inherit:"inherit",base:"base",primary:"primary",secondary:"secondary",tertiary:"tertiary",info:"info",success:"success",warning:"warning",error:"error",inverse:"inverse"},T={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 ve,jsx as X}from"react/jsx-runtime";var $="k-font-icon",he=[],ge={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info]},be={},M=t=>{let{size:e,themeColor:r,icon:s,rotate:a,flip:d,...u}=t;return s?X("span",{...u,className:c(t.className,$,N($,{size:e}),{[`k-i-${s}`]:s,[`k-color-${r}`]:r,[`k-rotate-${a}`]:a,"k-flip-h":d==="h"||d==="both","k-flip-v":d==="v"||d==="both"}),"aria-hidden":"true"}):X(ve,{})};M.states=he;M.options=ge;M.className=$;M.defaultOptions=be;var Y=M;import{Fragment as ke,jsx as _}from"react/jsx-runtime";var P="k-svg-icon",ye=[],Ne={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[f.outline,f.solid,f.duotone]},D={viewBox:"0 0 24 24",variant:f.outline},S=t=>{let{size:e,themeColor:r,rotate:s,flip:a,viewBox:d=D.viewBox,variant:u=D.variant,icon:l,...g}=t;if(!l)return _(ke,{});if(l==="none")return _("span",{...g,className:c(t.className,P,N("k-icon",{size:e}),"k-none"),"aria-hidden":"true"});let h=typeof l=="object"&&l.name&&l.name,p=typeof l=="object"?u&&l.variants?.[u]||l.variants?.outline||l.content:void 0;return _("span",{...g,className:c(t.className,P,N("k-icon",{size:e}),{[`k-svg-i-${h}`]:h,[`k-color-${r}`]:r,[`k-rotate-${s}`]:s,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="both"}),"aria-hidden":"true",children:_("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof l=="object"?l.viewBox:d,dangerouslySetInnerHTML:p!==void 0?{__html:p}:void 0,children:l?void 0:t.children})})};S.states=ye;S.options=Ne;S.className=P;S.defaultOptions=D;var H=S;import*as U from"@progress/kendo-svg-icons";var Z="icon",ee="icons";import{useContext as Te}from"react";import{createContext as Ce}from"react";var te=Ce({iconsType:"svg"});import{Fragment as oe,jsx as w}from"react/jsx-runtime";var R="k-icon",Be=t=>t.replace(/([-_][a-z0-9])/gi,e=>e.toUpperCase().replace("-","").replace("_","")),Ie=[],Oe={size:[n.undefined,n.xsmall,n.small,n.medium,n.large,n.xlarge,n.xxlarge,n.xxxlarge],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info],variant:[f.outline,f.solid,f.duotone]},F={viewBox:"0 0 24 24",type:"svg",variant:f.outline},x=t=>{let{iconsType:e}=Te(te),{size:r,themeColor:s,icon:a,type:d=e||F.type,rotate:u,flip:l,viewBox:g=F.viewBox,variant:h=F.variant,...p}=t;if(!a)return w(oe,{});if((e||d)==="svg"){if(a==="none")return w(H,{...p,className:c(t.className,R),icon:a,size:r,variant:h});let v=U[a]?a:Be(`${a}-icon`);return U[v]?w(H,{...p,className:c(t.className,R),icon:U[v],size:r,themeColor:s,rotate:u,flip:l,viewBox:g,variant:h}):w(oe,{})}return w(Y,{...p,className:c(t.className,R),icon:a,size:r,themeColor:s,rotate:u,flip:l})};x.states=Ie;x.options=Oe;x.defaultOptions=F;x.className=R;x.moduleName=Z;x.folderName=ee;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."}]};var V="button",ne=V;import{Fragment as re,jsx as I,jsxs as ie}from"react/jsx-runtime";var A="k-button",Me=["icon-button"],Se=[T.hover,T.focus,T.active,T.selected,T.disabled,T.generating],we={size:[n.undefined,n.xsmall,n.small,n.medium,n.large],rounded:[k.undefined,k.none,k.small,k.medium,k.large,k.full],fillMode:[C.undefined,C.solid,C.flat,C.outline,C.clear,C.link],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary,o.success,o.warning,o.error,o.info,o.inverse]},G={showArrow:!1,arrowIconName:"chevron-down"},i=t=>{let{as:e="button",size:r,rounded:s,fillMode:a,themeColor:d,showArrow:u=G.showArrow,arrowIconName:l=G.arrowIconName,variant:g,hover:h,focus:p,active:E,selected:v,disabled:L,togglable:K,ariaDisabled:B,icon:m,iconSize:y,text:z,iconClassName:ue,className:me,...pe}=t,fe=m!=null,xe=t.children!==void 0;return ie(e,{className:c(me,A,Q(A,g),N(A,{size:r,rounded:s,fillMode:a,themeColor:d}),J(A,{hover:h,focus:p,active:E,disabled:L||B,selected:v}),{"k-icon-button":!z&&!xe&&fe}),"aria-pressed":K?v?"true":"false":void 0,...pe,"aria-disabled":B?"true":void 0,disabled:L||void 0,children:[typeof m=="string"&&m&&I(x,{className:c(ue,"k-button-icon"),icon:m,size:y}),m&&typeof m!="string"&&I(re,{children:m}),z?ie(re,{children:[z&&I("span",{className:"k-button-text",children:z}),t.children]}):t.children&&I("span",{className:"k-button-text",children:t.children}),u&&I("span",{className:"k-menu-button-arrow k-button-arrow",children:I(x,{icon:l})})]})};i.states=Se;i.options=we;i.variants=Me;i.className=A;i.defaultOptions=G;i.moduleName=V;i.folderName=ne;i.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 Ae}from"react/jsx-runtime";var se=t=>Ae(i,{icon:"folder",...t,"aria-label":t["aria-label"]||"Folder",children:void 0});import{jsx as Ee}from"react/jsx-runtime";var ae=t=>Ee(i,{icon:"folder",children:"Button",...t});import{jsx as Le}from"react/jsx-runtime";var le=t=>Le(i,{children:"Button",...t});import{jsx as q}from"react/jsx-runtime";var ze=i.options,_e=i.states,Re={...i.defaultOptions,variant:"text"},Fe=[{name:"icon-only",title:"Icon Only"},{name:"icon-and-text",title:"Icon & Text"},{name:"text",title:"Text"}],Ke=[],O=t=>{let{variant:e,...r}=t;switch(e){case"icon-only":return q(se,{...r,icon:"star"});case"icon-and-text":return q(ae,{...r,icon:"star",children:"Button"});default:return q(le,{...r,children:"Button"})}};O.options=ze;O.states=_e;O.variants=Fe;O.defaultOptions=Re;O.modifiers=Ke;O.className=i.className;var W="filter",ce=W;import{jsx as j,jsxs as He}from"react/jsx-runtime";var de="k-filter",$e=[],Pe={},De={},b=t=>{let{children:e,expressionPreview:r,showApplyButton:s}=t;return He("div",{className:c(t.className,de),children:[j("ul",{className:"k-filter-container",role:"tree","aria-label":"Filter",children:j("li",{className:"k-filter-group-main",role:"treeitem",children:e})}),r,s&&j(i,{className:"k-filter-apply",children:"Apply"})]})};b.states=$e;b.options=Pe;b.defaultOptions=De;b.className=de;b.moduleName=W;b.folderName=ce;b.ariaSpec={selector:".k-filter",rules:[{selector:".k-filter-container",attribute:"role=tree",usage:"Describes the hierarchical structure of the Filter component."},{selector:".k-filter-container",attribute:"aria-label",usage:"Specifies a label for the Filter component."},{selector:".k-filter-group-main,.k-filter-item",attribute:"role=treeitem",usage:"Each FilterGroup and FilterExpression represent a separate treeitem in the Filter component structure."},{selector:".k-filter-lines",attribute:"role=group",usage:"Represents a group of items in the Filter component."},{selector:".k-toolbar",attribute:"role=toolbar",usage:"The role represents a collection of tools."},{selector:".k-toolbar",attribute:"aria-label",usage:"Specifies a label for the toolbar."}]};var Yt=b;export{de as FILTER_CLASSNAME,b as Filter,Yt as default};