UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 11.7 kB
var Ae=Object.create;var F=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var ke=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty;var Me=(e,t)=>{for(var i in t)F(e,i,{get:t[i],enumerable:!0})},ne=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ye(t))!Ne.call(e,a)&&a!==i&&F(e,a,{get:()=>t[a],enumerable:!(s=Ce(t,a))||s.enumerable});return e};var Ie=(e,t,i)=>(i=e!=null?Ae(ke(e)):{},ne(t||!e||!e.__esModule?F(i,"default",{value:e,enumerable:!0}):i,e)),Le=e=>ne(F({},"__esModule",{value:!0}),e);var We={};Me(We,{ChipListSelected:()=>je});module.exports=Le(We);var l=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?l(...t):typeof t=="object"?Object.keys(t).map((i,s)=>t[s]||t[i]&&i||null).filter(i=>i!==null).join(" "):t).filter(t=>!!t).join(" ");var f=(e,t)=>l({[`${e}-xs`]:t.size==="xsmall",[`${e}-sm`]:t.size==="small",[`${e}-md`]:t.size==="medium",[`${e}-lg`]:t.size==="large",[`${e}-xl`]:t.size==="xlarge",[`${e}-xxl`]:t.size==="xxlarge",[`${e}-xxxl`]:t.size==="xxxlarge"},{[`${e}-${t.fillMode}`]:t.fillMode},{[`${e}-${t.themeColor}`]:t.themeColor},{"k-rounded-sm":t.rounded==="small","k-rounded-md":t.rounded==="medium","k-rounded-lg":t.rounded==="large","k-rounded-full":t.rounded==="full","k-rounded-none":t.rounded==="none"}),ie=(e,t)=>{let{valid:i,invalid:s,hover:a,focus:c,checked:d,active:r,selected:k,disabled:g,indeterminate:x,loading:I,empty:b,readonly:S,highlighted:D,..._}=t;return l({"k-valid":i,"k-invalid":s,"k-hover":a,"k-focus":c,"k-checked":d,"k-active":r,"k-selected":k,"k-disabled":g,"k-indeterminate":x&&!d,"k-loading":I,"k-empty":b,"k-readonly":S,"k-highlighted":D},Object.keys(_).reduce((X,K)=>(K.startsWith("k-")?X[K]=_[K]:X[`k-${K}`]=_[K],X),{}))};var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},m={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},N={undefined:void 0,solid:"solid",flat:"flat",outline:"outline",clear:"clear",link:"link"},v={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"},u={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 w="chip",B=w;var ae=require("react/jsx-runtime"),J="k-chip-list",Oe=[],Se={size:[n.undefined,n.small,n.medium,n.large]},Ee={},A=e=>{let{size:t,multiselectable:i,ariaLabel:s,...a}=e;return(0,ae.jsx)("div",{...a,className:l(e.className,J,f(J,{size:t})),role:e.role||"listbox","aria-label":e.role==="none"?void 0:s||"chip list","aria-orientation":e.role==="none"?void 0:"horizontal","aria-multiselectable":i?"true":void 0,children:e.children})};A.states=Oe;A.options=Se;A.className=J;A.defaultOptions=Ee;A.moduleName=w;A.folderName=B;A.ariaSpec={selector:".k-chip-list",rules:[{selector:".k-chip-list",attribute:"role=listbox",usage:"Announces the list role of the chip list."},{selector:".k-chip-list",attribute:"aria-label or aria-labelledby",usage:"Adds label to the ChipList element. ListBox element requires an accessible name."},{selector:".k-chip-list",attribute:"aria-orientation=horizontal",usage:"Specifies the horizontal orientation of the chiplist."},{selector:".k-chip-list",attribute:"aria-multiselectable=true (when multiple selection)",usage:"Announces the multiple selection ability of the chiplist."},{selector:".k-chip-list .k-chip",attribute:"role=option",usage:"Announces the chip is an option inner component of the chip list."},{selector:".k-chip-list .k-chip.k-selected",attribute:"aria-selected=true",usage:"Announces the chip is selected."},{selector:".k-chip-list .k-chip:not(.k-selected)",attribute:"aria-selected=false",usage:"Announces the chip is not selected."},{selector:".k-chip-list .k-chip:has(.k-i-x-circle), .k-chip-list .k-chip:has(.k-svg-i-x-circle)",attribute:"aria-keyshortcuts=Enter Delete",usage:"Announces the Delete action along with the default Enter key."}]};var R=require("react/jsx-runtime"),j="k-font-icon",Te=[],ze={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]},_e={},H=e=>{let{size:t,themeColor:i,icon:s,rotate:a,flip:c,...d}=e;return s?(0,R.jsx)("span",{...d,className:l(e.className,j,f(j,{size:t}),{[`k-i-${s}`]:s,[`k-color-${i}`]:i,[`k-rotate-${a}`]:a,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):(0,R.jsx)(R.Fragment,{})};H.states=Te;H.options=ze;H.className=j;H.defaultOptions=_e;var se=H;var L=require("react/jsx-runtime"),W="k-svg-icon",Ke=[],we={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:[v.outline,v.solid,v.duotone]},Q={viewBox:"0 0 24 24",variant:v.outline},P=e=>{var I,b;let{size:t,themeColor:i,rotate:s,flip:a,viewBox:c=Q.viewBox,variant:d=Q.variant,icon:r,...k}=e;if(!r)return(0,L.jsx)(L.Fragment,{});if(r==="none")return(0,L.jsx)("span",{...k,className:l(e.className,W,f("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let g=typeof r=="object"&&r.name&&r.name,x=typeof r=="object"?d&&((I=r.variants)==null?void 0:I[d])||((b=r.variants)==null?void 0:b.outline)||r.content:void 0;return(0,L.jsx)("span",{...k,className:l(e.className,W,f("k-icon",{size:t}),{[`k-svg-i-${g}`]:g,[`k-color-${i}`]:i,[`k-rotate-${s}`]:s,"k-flip-h":a==="h"||a==="both","k-flip-v":a==="v"||a==="both"}),"aria-hidden":"true",children:(0,L.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof r=="object"?r.viewBox:c,dangerouslySetInnerHTML:x!==void 0?{__html:x}:void 0,children:r?void 0:e.children})})};P.states=Ke;P.options=we;P.className=W;P.defaultOptions=Q;var Y=P;var Z=Ie(require("@progress/kendo-svg-icons"));var re="icon",le="icons";var pe=require("react");var ce=require("react"),de=(0,ce.createContext)({iconsType:"svg"});var C=require("react/jsx-runtime"),V="k-icon",Re=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),He=[],Pe={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:[v.outline,v.solid,v.duotone]},U={viewBox:"0 0 24 24",type:"svg",variant:v.outline},h=e=>{let{iconsType:t}=(0,pe.useContext)(de),{size:i,themeColor:s,icon:a,type:c=t||U.type,rotate:d,flip:r,viewBox:k=U.viewBox,variant:g=U.variant,...x}=e;if(!a)return(0,C.jsx)(C.Fragment,{});if((t||c)==="svg"){if(a==="none")return(0,C.jsx)(Y,{...x,className:l(e.className,V),icon:a,size:i,variant:g});let b=Z[a]?a:Re(`${a}-icon`);return Z[b]?(0,C.jsx)(Y,{...x,className:l(e.className,V),icon:Z[b],size:i,themeColor:s,rotate:d,flip:r,viewBox:k,variant:g}):(0,C.jsx)(C.Fragment,{})}return(0,C.jsx)(se,{...x,className:l(e.className,V),icon:a,size:i,themeColor:s,rotate:d,flip:r})};h.states=He;h.options=Pe;h.defaultOptions=U;h.className=V;h.moduleName=re;h.folderName=le;h.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 ee="avatar",me=ee;var oe=require("react/jsx-runtime"),$="k-avatar";var $e=[u.hover,u.focus,u.active,u.selected,u.disabled],De={size:[n.undefined,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[N.undefined,N.solid,N.outline],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary]},te={type:"text",border:!1},p=e=>{let{size:t,rounded:i,fillMode:s,themeColor:a,type:c=te.type,border:d=te.border,...r}=e;return(0,oe.jsx)("div",{...r,className:l(e.className,$,f($,{size:t,rounded:i,fillMode:s,themeColor:a}),{[`${$}-bordered`]:d}),children:(0,oe.jsx)("span",{className:`${$}-${c}`,children:e.children})})};p.states=$e;p.options=De;p.className=$;p.defaultOptions=te;p.moduleName=ee;p.folderName=me;p.ariaSpec={selector:".k-avatar",rules:[{selector:".k-avatar img",attribute:"alt",usage:"Images inside Avatar must have alt text for screen readers."}]};var O=p;var fe=require("react/jsx-runtime"),ue=e=>(0,fe.jsx)(O,{type:"icon",...e});var xe=require("react/jsx-runtime"),he=e=>(0,xe.jsx)(O,{type:"text",...e});var ge=require("react/jsx-runtime"),ve=e=>(0,ge.jsx)(O,{type:"image",...e});var Fe=require("react/jsx-runtime");var E=require("react/jsx-runtime"),Be=p.options,Ve=p.states,Ue={...p.defaultOptions,variant:"image"},Ge=[{name:"image",title:"Image"},{name:"icon",title:"Icon Avatar"},{name:"text",title:"Text Avatar"}],qe=[],T=e=>{let{variant:t,...i}=e;switch(t){case"icon":return(0,E.jsx)(ue,{...i,children:(0,E.jsx)(h,{icon:"star"})});case"text":return(0,E.jsx)(he,{...i,children:"JO"});default:return(0,E.jsx)(ve,{...i,children:(0,E.jsx)("img",{src:"https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg"})})}};T.options=Be;T.states=Ve;T.variants=Ge;T.defaultOptions=Ue;T.modifiers=qe;T.className=p.className;var y=require("react/jsx-runtime"),G="k-chip",Xe=[u.hover,u.focus,u.active,u.selected,u.disabled],Je={size:[n.undefined,n.small,n.medium,n.large],rounded:[m.undefined,m.none,m.small,m.medium,m.large,m.full],fillMode:[N.undefined,N.solid,N.outline],themeColor:[o.undefined,o.base,o.success,o.warning,o.error,o.info]},be={avatarImage:"/packages/html/assets/avatar.jpg"},M=e=>{let{size:t,rounded:i,fillMode:s,themeColor:a,text:c,icon:d,actions:r,showAvatar:k,avatarImage:g=be.avatarImage,hover:x,focus:I,active:b,selected:S,disabled:D,..._}=e;return(0,y.jsxs)("div",{..._,className:l(e.className,G,f(G,{size:t,rounded:i,fillMode:s,themeColor:a}),ie(G,{hover:x,focus:I,active:b,disabled:D,selected:S})),role:e.role||"button","aria-pressed":e.role==="option"?void 0:S?"true":"false",...e.role==="option"&&S!==void 0&&{"aria-selected":S?"true":"false"},"aria-disabled":D?"true":void 0,children:[d&&(0,y.jsx)(h,{className:"k-chip-icon",icon:d,size:"small"}),k&&(0,y.jsx)(p,{className:"k-chip-avatar",type:"image",children:(0,y.jsx)("img",{src:g,alt:""})}),(0,y.jsx)("span",{className:"k-chip-content",children:e.children?e.children:c&&(0,y.jsx)("span",{className:"k-chip-label",children:c})}),r&&(0,y.jsx)("span",{className:"k-chip-actions",children:r})]})};M.states=Xe;M.options=Je;M.className=G;M.defaultOptions=be;M.moduleName=w;M.folderName=B;M.ariaSpec={selector:".k-chip",rules:[{selector:"*:not(.k-chip-list) > .k-chip",attribute:"role=button",usage:"Announces that the chip acts as a button when standalone."},{selector:"*:not(.k-chip-list) > .k-chip.k-selected",attribute:"aria-pressed=true",usage:"Announces that the Chip has been selected."},{selector:"*:not(.k-chip-list) > .k-chip:not(.k-selected)",attribute:"aria-pressed=false",usage:"Announces that the Chip has not been selected."},{selector:".k-chip",attribute:"aria-disabled=true (when disabled)",usage:"Announces that the Chip is disabled."}]};var q=M;var z=require("react/jsx-runtime"),je=e=>(0,z.jsxs)(A,{...e,children:[(0,z.jsx)(q,{role:"option",text:"Chip 1",selected:!0}),(0,z.jsx)(q,{role:"option","aria-selected":"false",text:"Chip 2"}),(0,z.jsx)(q,{role:"option","aria-selected":"false",text:"Chip 3"})]});