@progress/kendo-themes-html
Version:
A collection of HTML helpers used for developing Kendo UI themes
2 lines (1 loc) • 10.2 kB
JavaScript
var Ae=Object.create;var D=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)D(e,a,{get:t[a],enumerable:!0})},te=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ce(t))!ke.call(e,r)&&r!==a&&D(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)):{},te(t||!e||!e.__esModule?D(a,"default",{value:e,enumerable:!0}):a,e)),Ie=e=>te(D({},"__esModule",{value:!0}),e);var qe={};Ne(qe,{ChipActions:()=>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"}),oe=(e,t)=>{let{valid:a,invalid:i,hover:r,focus:c,checked:d,active:s,selected:b,disabled:x,indeterminate:h,loading:I,empty:g,readonly:S,highlighted:P,..._}=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":I,"k-empty":g,"k-readonly":S,"k-highlighted":P},Object.keys(_).reduce((U,L)=>(L.startsWith("k-")?U[L]=_[L]:U[`k-${L}`]=_[L],U),{}))};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 R=require("react/jsx-runtime"),G="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={},w=e=>{let{size:t,themeColor:a,icon:i,rotate:r,flip:c,...d}=e;return i?(0,R.jsx)("span",{...d,className:l(e.className,G,A(G,{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,R.jsx)(R.Fragment,{})};w.states=Oe;w.options=Ee;w.className=G;w.defaultOptions=Se;var ne=w;var O=require("react/jsx-runtime"),X="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]},q={viewBox:"0 0 24 24",variant:v.outline},K=e=>{var I,g;let{size:t,themeColor:a,rotate:i,flip:r,viewBox:c=q.viewBox,variant:d=q.variant,icon:s,...b}=e;if(!s)return(0,O.jsx)(O.Fragment,{});if(s==="none")return(0,O.jsx)("span",{...b,className:l(e.className,X,A("k-icon",{size:t}),"k-none"),"aria-hidden":"true"});let x=typeof s=="object"&&s.name&&s.name,h=typeof s=="object"?d&&((I=s.variants)==null?void 0:I[d])||((g=s.variants)==null?void 0:g.outline)||s.content:void 0;return(0,O.jsx)("span",{...b,className:l(e.className,X,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,O.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})})};K.states=Te;K.options=ze;K.className=X;K.defaultOptions=q;var J=K;var j=Me(require("@progress/kendo-svg-icons"));var ae="icon",re="icons";var le=require("react");var ie=require("react"),se=(0,ie.createContext)({iconsType:"svg"});var y=require("react/jsx-runtime"),V="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]},F={viewBox:"0 0 24 24",type:"svg",variant:v.outline},m=e=>{let{iconsType:t}=(0,le.useContext)(se),{size:a,themeColor:i,icon:r,type:c=t||F.type,rotate:d,flip:s,viewBox:b=F.viewBox,variant:x=F.variant,...h}=e;if(!r)return(0,y.jsx)(y.Fragment,{});if((t||c)==="svg"){if(r==="none")return(0,y.jsx)(J,{...h,className:l(e.className,V),icon:r,size:a,variant:x});let g=j[r]?r:_e(`${r}-icon`);return j[g]?(0,y.jsx)(J,{...h,className:l(e.className,V),icon:j[g],size:a,themeColor:i,rotate:d,flip:s,viewBox:b,variant:x}):(0,y.jsx)(y.Fragment,{})}return(0,y.jsx)(ne,{...h,className:l(e.className,V),icon:r,size:a,themeColor:i,rotate:d,flip:s})};m.states=Le;m.options=Re;m.defaultOptions=F;m.className=V;m.moduleName=ae;m.folderName=re;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 W="avatar",ce=W;var Y=require("react/jsx-runtime"),H="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]},Q={type:"text",border:!1},p=e=>{let{size:t,rounded:a,fillMode:i,themeColor:r,type:c=Q.type,border:d=Q.border,...s}=e;return(0,Y.jsx)("div",{...s,className:l(e.className,H,A(H,{size:t,rounded:a,fillMode:i,themeColor:r}),{[`${H}-bordered`]:d}),children:(0,Y.jsx)("span",{className:`${H}-${c}`,children:e.children})})};p.states=we;p.options=Ke;p.className=H;p.defaultOptions=Q;p.moduleName=W;p.folderName=ce;p.ariaSpec={selector:".k-avatar",rules:[{selector:".k-avatar img",attribute:"alt",usage:"Images inside Avatar must have alt text for screen readers."}]};var E=p;var me=require("react/jsx-runtime"),de=e=>(0,me.jsx)(E,{type:"icon",...e});var ue=require("react/jsx-runtime"),pe=e=>(0,ue.jsx)(E,{type:"text",...e});var he=require("react/jsx-runtime"),fe=e=>(0,he.jsx)(E,{type:"image",...e});var He=require("react/jsx-runtime");var T=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=[],z=e=>{let{variant:t,...a}=e;switch(t){case"icon":return(0,T.jsx)(de,{...a,children:(0,T.jsx)(m,{icon:"star"})});case"text":return(0,T.jsx)(pe,{...a,children:"JO"});default:return(0,T.jsx)(fe,{...a,children:(0,T.jsx)("img",{src:"https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg"})})}};z.options=$e;z.states=Pe;z.variants=Ve;z.defaultOptions=De;z.modifiers=Fe;z.className=p.className;var Z="chip",ve=Z;var C=require("react/jsx-runtime"),B="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]},xe={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=xe.avatarImage,hover:h,focus:I,active:g,selected:S,disabled:P,..._}=e;return(0,C.jsxs)("div",{..._,className:l(e.className,B,A(B,{size:t,rounded:a,fillMode:i,themeColor:r}),oe(B,{hover:h,focus:I,active:g,disabled:P,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":P?"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=B;N.defaultOptions=xe;N.moduleName=Z;N.folderName=ve;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 ge=N;var $=require("react/jsx-runtime"),Ge="k-chip-action";var ee=e=>{let{type:t,...a}=e,i;switch(t){case"remove":i=(0,$.jsx)(m,{icon:"x-circle",size:"small"});break;case"more":i=(0,$.jsx)(m,{icon:"more-vertical",size:"small"});break;default:return(0,$.jsx)(m,{icon:t,size:"small"})}return(0,$.jsx)("span",{...a,className:l(e.className,Ge,`k-chip-${t}-action`),children:i})};var M=require("react/jsx-runtime"),Xe=e=>(0,M.jsx)(ge,{text:"All actions",actions:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ee,{type:"more"}),(0,M.jsx)(ee,{type:"remove"})]}),...e});