UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 10.2 kB
var Ae=Object.create;var P=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var be=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var Ne=(e,t)=>{for(var a in t)P(e,a,{get:t[a],enumerable:!0})},ee=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ce(t))!ke.call(e,r)&&r!==a&&P(e,r,{get:()=>t[r],enumerable:!(i=ye(t,r))||i.enumerable});return e};var Me=(e,t,a)=>(a=e!=null?Ae(be(e)):{},ee(t||!e||!e.__esModule?P(a,"default",{value:e,enumerable:!0}):a,e)),Ie=e=>ee(P({},"__esModule",{value:!0}),e);var qe={};Ne(qe,{ChipRemovable:()=>Xe});module.exports=Ie(qe);var l=(...e)=>e.filter(t=>t!==!0&&!!t).map(t=>Array.isArray(t)?l(...t):typeof t=="object"?Object.keys(t).map((a,i)=>t[i]||t[a]&&a||null).filter(a=>a!==null).join(" "):t).filter(t=>!!t).join(" ");var A=(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"}),te=(e,t)=>{let{valid:a,invalid:i,hover:r,focus:c,checked:d,active:s,selected:b,disabled:x,indeterminate:h,loading:M,empty:g,readonly:E,highlighted:$,...z}=t;return l({"k-valid":a,"k-invalid":i,"k-hover":r,"k-focus":c,"k-checked":d,"k-active":s,"k-selected":b,"k-disabled":x,"k-indeterminate":h&&!d,"k-loading":M,"k-empty":g,"k-readonly":E,"k-highlighted":$},Object.keys(z).reduce((B,_)=>(_.startsWith("k-")?B[_]=z[_]:B[`k-${_}`]=z[_],B),{}))};var n={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},u={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"},k={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"},f={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 L=require("react/jsx-runtime"),U="k-font-icon",Oe=[],Ee={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]},Se={},R=e=>{let{size:t,themeColor:a,icon:i,rotate:r,flip:c,...d}=e;return i?(0,L.jsx)("span",{...d,className:l(e.className,U,A(U,{size:t}),{[`k-i-${i}`]:i,[`k-color-${a}`]:a,[`k-rotate-${r}`]:r,"k-flip-h":c==="h"||c==="both","k-flip-v":c==="v"||c==="both"}),"aria-hidden":"true"}):(0,L.jsx)(L.Fragment,{})};R.states=Oe;R.options=Ee;R.className=U;R.defaultOptions=Se;var oe=R;var I=require("react/jsx-runtime"),G="k-svg-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],variant:[v.outline,v.solid,v.duotone]},X={viewBox:"0 0 24 24",variant:v.outline},w=e=>{var M,g;let{size:t,themeColor:a,rotate:i,flip:r,viewBox:c=X.viewBox,variant:d=X.variant,icon:s,...b}=e;if(!s)return(0,I.jsx)(I.Fragment,{});if(s==="none")return(0,I.jsx)("span",{...b,className:l(e.className,G,A("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let x=typeof s=="object"&&s.name&&s.name,h=typeof s=="object"?d&&((M=s.variants)==null?void 0:M[d])||((g=s.variants)==null?void 0:g.outline)||s.content:void 0;return(0,I.jsx)("span",{...b,className:l(e.className,G,A("k-icon",{size:t}),{[`k-svg-i-${x}`]:x,[`k-color-${a}`]:a,[`k-rotate-${i}`]:i,"k-flip-h":r==="h"||r==="both","k-flip-v":r==="v"||r==="both"}),"aria-hidden":"true",children:(0,I.jsx)("svg",{"aria-hidden":!0,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:typeof s=="object"?s.viewBox:c,dangerouslySetInnerHTML:h!==void 0?{__html:h}:void 0,children:s?void 0:e.children})})};w.states=Te;w.options=ze;w.className=G;w.defaultOptions=X;var q=w;var J=Me(require("@progress/kendo-svg-icons"));var ne="icon",ae="icons";var se=require("react");var re=require("react"),ie=(0,re.createContext)({iconsType:"svg"});var y=require("react/jsx-runtime"),D="k-icon",_e=e=>e.replace(/([-_][a-z0-9])/gi,t=>t.toUpperCase().replace("-","").replace("_","")),Le=[],Re={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]},V={viewBox:"0 0 24 24",type:"svg",variant:v.outline},m=e=>{let{iconsType:t}=(0,se.useContext)(ie),{size:a,themeColor:i,icon:r,type:c=t||V.type,rotate:d,flip:s,viewBox:b=V.viewBox,variant:x=V.variant,...h}=e;if(!r)return(0,y.jsx)(y.Fragment,{});if((t||c)==="svg"){if(r==="none")return(0,y.jsx)(q,{...h,className:l(e.className,D),icon:r,size:a,variant:x});let g=J[r]?r:_e(`${r}-icon`);return J[g]?(0,y.jsx)(q,{...h,className:l(e.className,D),icon:J[g],size:a,themeColor:i,rotate:d,flip:s,viewBox:b,variant:x}):(0,y.jsx)(y.Fragment,{})}return(0,y.jsx)(oe,{...h,className:l(e.className,D),icon:r,size:a,themeColor:i,rotate:d,flip:s})};m.states=Le;m.options=Re;m.defaultOptions=V;m.className=D;m.moduleName=ne;m.folderName=ae;m.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 j="avatar",le=j;var Q=require("react/jsx-runtime"),K="k-avatar";var we=[f.hover,f.focus,f.active,f.selected,f.disabled],Ke={size:[n.undefined,n.small,n.medium,n.large],rounded:[u.undefined,u.none,u.small,u.medium,u.large,u.full],fillMode:[k.undefined,k.solid,k.outline],themeColor:[o.undefined,o.base,o.primary,o.secondary,o.tertiary]},W={type:"text",border:!1},p=e=>{let{size:t,rounded:a,fillMode:i,themeColor:r,type:c=W.type,border:d=W.border,...s}=e;return(0,Q.jsx)("div",{...s,className:l(e.className,K,A(K,{size:t,rounded:a,fillMode:i,themeColor:r}),{[`${K}-bordered`]:d}),children:(0,Q.jsx)("span",{className:`${K}-${c}`,children:e.children})})};p.states=we;p.options=Ke;p.className=K;p.defaultOptions=W;p.moduleName=j;p.folderName=le;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 de=require("react/jsx-runtime"),ce=e=>(0,de.jsx)(O,{type:"icon",...e});var pe=require("react/jsx-runtime"),me=e=>(0,pe.jsx)(O,{type:"text",...e});var fe=require("react/jsx-runtime"),ue=e=>(0,fe.jsx)(O,{type:"image",...e});var He=require("react/jsx-runtime");var S=require("react/jsx-runtime"),$e=p.options,Pe=p.states,De={...p.defaultOptions,variant:"image"},Ve=[{name:"image",title:"Image"},{name:"icon",title:"Icon Avatar"},{name:"text",title:"Text Avatar"}],Fe=[],T=e=>{let{variant:t,...a}=e;switch(t){case"icon":return(0,S.jsx)(ce,{...a,children:(0,S.jsx)(m,{icon:"star"})});case"text":return(0,S.jsx)(me,{...a,children:"JO"});default:return(0,S.jsx)(ue,{...a,children:(0,S.jsx)("img",{src:"https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg"})})}};T.options=$e;T.states=Pe;T.variants=Ve;T.defaultOptions=De;T.modifiers=Fe;T.className=p.className;var Y="chip",he=Y;var C=require("react/jsx-runtime"),F="k-chip",Be=[f.hover,f.focus,f.active,f.selected,f.disabled],Ue={size:[n.undefined,n.small,n.medium,n.large],rounded:[u.undefined,u.none,u.small,u.medium,u.large,u.full],fillMode:[k.undefined,k.solid,k.outline],themeColor:[o.undefined,o.base,o.success,o.warning,o.error,o.info]},ve={avatarImage:"/packages/html/assets/avatar.jpg"},N=e=>{let{size:t,rounded:a,fillMode:i,themeColor:r,text:c,icon:d,actions:s,showAvatar:b,avatarImage:x=ve.avatarImage,hover:h,focus:M,active:g,selected:E,disabled:$,...z}=e;return(0,C.jsxs)("div",{...z,className:l(e.className,F,A(F,{size:t,rounded:a,fillMode:i,themeColor:r}),te(F,{hover:h,focus:M,active:g,disabled:$,selected:E})),role:e.role||"button","aria-pressed":e.role==="option"?void 0:E?"true":"false",...e.role==="option"&&E!==void 0&&{"aria-selected":E?"true":"false"},"aria-disabled":$?"true":void 0,children:[d&&(0,C.jsx)(m,{className:"k-chip-icon",icon:d,size:"small"}),b&&(0,C.jsx)(p,{className:"k-chip-avatar",type:"image",children:(0,C.jsx)("img",{src:x,alt:""})}),(0,C.jsx)("span",{className:"k-chip-content",children:e.children?e.children:c&&(0,C.jsx)("span",{className:"k-chip-label",children:c})}),s&&(0,C.jsx)("span",{className:"k-chip-actions",children:s})]})};N.states=Be;N.options=Ue;N.className=F;N.defaultOptions=ve;N.moduleName=Y;N.folderName=he;N.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 xe=N;var H=require("react/jsx-runtime"),Ge="k-chip-action";var ge=e=>{let{type:t,...a}=e,i;switch(t){case"remove":i=(0,H.jsx)(m,{icon:"x-circle",size:"small"});break;case"more":i=(0,H.jsx)(m,{icon:"more-vertical",size:"small"});break;default:return(0,H.jsx)(m,{icon:t,size:"small"})}return(0,H.jsx)("span",{...a,className:l(e.className,Ge,`k-chip-${t}-action`),children:i})};var Z=require("react/jsx-runtime"),Xe=e=>(0,Z.jsx)(xe,{text:"Removable",...e,actions:(0,Z.jsx)(ge,{type:"remove"})});