@spectrum-web-components/icon
Version:
`<sp-icon>` renders an icon to the page. By default the `name` attribute will pair with separately registered icon sets to deliver the icons. When not present, `<sp-icon>` will subsequently check for its `src` attribute which could populate the icon via a
5 lines (4 loc) • 1.4 kB
JavaScript
;var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var r=(l,s,e,i)=>{for(var t=i>1?void 0:i?a(s,e):s,o=l.length-1,u;o>=0;o--)(u=l[o])&&(t=(i?u(s,e,t):u(t))||t);return i&&t&&n(s,e,t),t};import{html as d,SpectrumElement as p}from"@spectrum-web-components/base";import{property as c,state as m}from"@spectrum-web-components/base/src/decorators.js";import{SystemResolutionController as b,systemResolverUpdatedSymbol as h}from"@spectrum-web-components/reactive-controllers/src/SystemContextResolution.js";import x from"./icon.css.js";export class IconBase extends p{constructor(){super(...arguments);this.unsubscribeSystemContext=null;this.spectrumVersion=1;this.label="";this.systemResolver=new b(this)}static get styles(){return[x]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeSystemContext&&(this.unsubscribeSystemContext(),this.unsubscribeSystemContext=null)}update(e){e.has("label")&&(this.label?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true")),e.has(h)&&(this.spectrumVersion=this.systemResolver.system==="spectrum-two"?2:1),super.update(e)}render(){return d`
<slot></slot>
`}}r([m()],IconBase.prototype,"spectrumVersion",2),r([c({reflect:!0})],IconBase.prototype,"label",2),r([c({reflect:!0})],IconBase.prototype,"size",2);
//# sourceMappingURL=IconBase.js.map