UNPKG

@carbon/icons-angular

Version:

Angular components for icons in digital and software products using the Carbon Design System

174 lines (171 loc) 14.6 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var LogoYelpDirective_1; let LogoYelpComponent = class LogoYelpComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], LogoYelpComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoYelpComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], LogoYelpComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoYelpComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], LogoYelpComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoYelpComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoYelpComponent.prototype, "size", void 0); LogoYelpComponent = __decorate([ Component({ selector: "ibm-icon-logo-yelp", template: ` <svg ibmIconLogoYelp [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], LogoYelpComponent); let LogoYelpDirective = LogoYelpDirective_1 = class LogoYelpDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "LogoYelp32", "filepath": "logo--yelp/32.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 32 32", "fill": "currentColor", "width": 32, "height": 32 }, "content": [{ "elem": "path", "attrs": { "fill-rule": "evenodd", "d": "M9.09 15.2458l4.6706 2.2777a1.0706 1.0706 0 01-.21 2.0011L8.5087 20.7818a1.0729 1.0729 0 01-1.3241-.921 9.2173 9.2173 0 01.4213-3.9965A1.0706 1.0706 0 019.09 15.2458zM10.96 24.8605l3.4763-3.8613a1.0707 1.0707 0 011.8657.7537l-.1814 5.1945a1.072 1.072 0 01-1.2491 1.0192A9.3014 9.3014 0 0111.1488 26.46 1.0713 1.0713 0 0110.96 24.8605zM19.2025 19.7222l4.9412 1.6058a1.0713 1.0713 0 01.6363 1.4794 9.3022 9.3022 0 01-2.4707 3.1663 1.072 1.072 0 01-1.5914-.2581l-2.7543-4.4078A1.0707 1.0707 0 0119.2025 19.7222zM24.2273 16.57l-4.9948 1.4321A1.0706 1.0706 0 0118.05 16.3742l2.906-4.3078A1.0706 1.0706 0 0122.55 11.86 9.2168 9.2168 0 0124.9135 15.11 1.0729 1.0729 0 0124.2273 16.57zM12.5561 4.45a14.9542 14.9542 0 00-2.5676.9459 1.07 1.07 0 00-.4636 1.5013l4.8819 8.4557a1.0707 1.0707 0 001.9979-.5353V5.0534A1.07 1.07 0 0015.2526 3.985 14.9577 14.9577 0 0012.5561 4.45z" } }], "name": "logo--yelp", "size": 32 }, "size": 32 }, svg: `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><path fill-rule="evenodd" d="M9.09 15.2458l4.6706 2.2777a1.0706 1.0706 0 01-.21 2.0011L8.5087 20.7818a1.0729 1.0729 0 01-1.3241-.921 9.2173 9.2173 0 01.4213-3.9965A1.0706 1.0706 0 019.09 15.2458zM10.96 24.8605l3.4763-3.8613a1.0707 1.0707 0 011.8657.7537l-.1814 5.1945a1.072 1.072 0 01-1.2491 1.0192A9.3014 9.3014 0 0111.1488 26.46 1.0713 1.0713 0 0110.96 24.8605zM19.2025 19.7222l4.9412 1.6058a1.0713 1.0713 0 01.6363 1.4794 9.3022 9.3022 0 01-2.4707 3.1663 1.072 1.072 0 01-1.5914-.2581l-2.7543-4.4078A1.0707 1.0707 0 0119.2025 19.7222zM24.2273 16.57l-4.9948 1.4321A1.0706 1.0706 0 0118.05 16.3742l2.906-4.3078A1.0706 1.0706 0 0122.55 11.86 9.2168 9.2168 0 0124.9135 15.11 1.0729 1.0729 0 0124.2273 16.57zM12.5561 4.45a14.9542 14.9542 0 00-2.5676.9459 1.07 1.07 0 00-.4636 1.5013l4.8819 8.4557a1.0707 1.0707 0 001.9979-.5353V5.0534A1.07 1.07 0 0015.2526 3.985 14.9577 14.9577 0 0012.5561 4.45z"></path></svg>` }, "24": { metadata: { "moduleName": "LogoYelp24", "filepath": "logo--yelp/24.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 32 32", "fill": "currentColor", "width": 24, "height": 24 }, "content": [{ "elem": "path", "attrs": { "fill-rule": "evenodd", "d": "M9.09 15.2458l4.6706 2.2777a1.0706 1.0706 0 01-.21 2.0011L8.5087 20.7818a1.0729 1.0729 0 01-1.3241-.921 9.2173 9.2173 0 01.4213-3.9965A1.0706 1.0706 0 019.09 15.2458zM10.96 24.8605l3.4763-3.8613a1.0707 1.0707 0 011.8657.7537l-.1814 5.1945a1.072 1.072 0 01-1.2491 1.0192A9.3014 9.3014 0 0111.1488 26.46 1.0713 1.0713 0 0110.96 24.8605zM19.2025 19.7222l4.9412 1.6058a1.0713 1.0713 0 01.6363 1.4794 9.3022 9.3022 0 01-2.4707 3.1663 1.072 1.072 0 01-1.5914-.2581l-2.7543-4.4078A1.0707 1.0707 0 0119.2025 19.7222zM24.2273 16.57l-4.9948 1.4321A1.0706 1.0706 0 0118.05 16.3742l2.906-4.3078A1.0706 1.0706 0 0122.55 11.86 9.2168 9.2168 0 0124.9135 15.11 1.0729 1.0729 0 0124.2273 16.57zM12.5561 4.45a14.9542 14.9542 0 00-2.5676.9459 1.07 1.07 0 00-.4636 1.5013l4.8819 8.4557a1.0707 1.0707 0 001.9979-.5353V5.0534A1.07 1.07 0 0015.2526 3.985 14.9577 14.9577 0 0012.5561 4.45z" } }], "name": "logo--yelp", "size": 24 }, "size": 24 }, svg: `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="24" height="24" viewBox="0 0 32 32" aria-hidden="true"><path fill-rule="evenodd" d="M9.09 15.2458l4.6706 2.2777a1.0706 1.0706 0 01-.21 2.0011L8.5087 20.7818a1.0729 1.0729 0 01-1.3241-.921 9.2173 9.2173 0 01.4213-3.9965A1.0706 1.0706 0 019.09 15.2458zM10.96 24.8605l3.4763-3.8613a1.0707 1.0707 0 011.8657.7537l-.1814 5.1945a1.072 1.072 0 01-1.2491 1.0192A9.3014 9.3014 0 0111.1488 26.46 1.0713 1.0713 0 0110.96 24.8605zM19.2025 19.7222l4.9412 1.6058a1.0713 1.0713 0 01.6363 1.4794 9.3022 9.3022 0 01-2.4707 3.1663 1.072 1.072 0 01-1.5914-.2581l-2.7543-4.4078A1.0707 1.0707 0 0119.2025 19.7222zM24.2273 16.57l-4.9948 1.4321A1.0706 1.0706 0 0118.05 16.3742l2.906-4.3078A1.0706 1.0706 0 0122.55 11.86 9.2168 9.2168 0 0124.9135 15.11 1.0729 1.0729 0 0124.2273 16.57zM12.5561 4.45a14.9542 14.9542 0 00-2.5676.9459 1.07 1.07 0 00-.4636 1.5013l4.8819 8.4557a1.0707 1.0707 0 001.9979-.5353V5.0534A1.07 1.07 0 0015.2526 3.985 14.9577 14.9577 0 0012.5561 4.45z"></path></svg>` }, "20": { metadata: { "moduleName": "LogoYelp20", "filepath": "logo--yelp/20.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 32 32", "fill": "currentColor", "width": 20, "height": 20 }, "content": [{ "elem": "path", "attrs": { "fill-rule": "evenodd", "d": "M9.09 15.2458l4.6706 2.2777a1.0706 1.0706 0 01-.21 2.0011L8.5087 20.7818a1.0729 1.0729 0 01-1.3241-.921 9.2173 9.2173 0 01.4213-3.9965A1.0706 1.0706 0 019.09 15.2458zM10.96 24.8605l3.4763-3.8613a1.0707 1.0707 0 011.8657.7537l-.1814 5.1945a1.072 1.072 0 01-1.2491 1.0192A9.3014 9.3014 0 0111.1488 26.46 1.0713 1.0713 0 0110.96 24.8605zM19.2025 19.7222l4.9412 1.6058a1.0713 1.0713 0 01.6363 1.4794 9.3022 9.3022 0 01-2.4707 3.1663 1.072 1.072 0 01-1.5914-.2581l-2.7543-4.4078A1.0707 1.0707 0 0119.2025 19.7222zM24.2273 16.57l-4.9948 1.4321A1.0706 1.0706 0 0118.05 16.3742l2.906-4.3078A1.0706 1.0706 0 0122.55 11.86 9.2168 9.2168 0 0124.9135 15.11 1.0729 1.0729 0 0124.2273 16.57zM12.5561 4.45a14.9542 14.9542 0 00-2.5676.9459 1.07 1.07 0 00-.4636 1.5013l4.8819 8.4557a1.0707 1.0707 0 001.9979-.5353V5.0534A1.07 1.07 0 0015.2526 3.985 14.9577 14.9577 0 0012.5561 4.45z" } }], "name": "logo--yelp", "size": 20 }, "size": 20 }, svg: `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="20" height="20" viewBox="0 0 32 32" aria-hidden="true"><path fill-rule="evenodd" d="M9.09 15.2458l4.6706 2.2777a1.0706 1.0706 0 01-.21 2.0011L8.5087 20.7818a1.0729 1.0729 0 01-1.3241-.921 9.2173 9.2173 0 01.4213-3.9965A1.0706 1.0706 0 019.09 15.2458zM10.96 24.8605l3.4763-3.8613a1.0707 1.0707 0 011.8657.7537l-.1814 5.1945a1.072 1.072 0 01-1.2491 1.0192A9.3014 9.3014 0 0111.1488 26.46 1.0713 1.0713 0 0110.96 24.8605zM19.2025 19.7222l4.9412 1.6058a1.0713 1.0713 0 01.6363 1.4794 9.3022 9.3022 0 01-2.4707 3.1663 1.072 1.072 0 01-1.5914-.2581l-2.7543-4.4078A1.0707 1.0707 0 0119.2025 19.7222zM24.2273 16.57l-4.9948 1.4321A1.0706 1.0706 0 0118.05 16.3742l2.906-4.3078A1.0706 1.0706 0 0122.55 11.86 9.2168 9.2168 0 0124.9135 15.11 1.0729 1.0729 0 0124.2273 16.57zM12.5561 4.45a14.9542 14.9542 0 00-2.5676.9459 1.07 1.07 0 00-.4636 1.5013l4.8819 8.4557a1.0707 1.0707 0 001.9979-.5353V5.0534A1.07 1.07 0 0015.2526 3.985 14.9577 14.9577 0 0012.5561 4.45z"></path></svg>` }, "16": { metadata: { "moduleName": "LogoYelp16", "filepath": "logo--yelp/16.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 32 32", "fill": "currentColor", "width": 16, "height": 16 }, "content": [{ "elem": "path", "attrs": { "fill-rule": "evenodd", "d": "M9.09 15.2458l4.6706 2.2777a1.0706 1.0706 0 01-.21 2.0011L8.5087 20.7818a1.0729 1.0729 0 01-1.3241-.921 9.2173 9.2173 0 01.4213-3.9965A1.0706 1.0706 0 019.09 15.2458zM10.96 24.8605l3.4763-3.8613a1.0707 1.0707 0 011.8657.7537l-.1814 5.1945a1.072 1.072 0 01-1.2491 1.0192A9.3014 9.3014 0 0111.1488 26.46 1.0713 1.0713 0 0110.96 24.8605zM19.2025 19.7222l4.9412 1.6058a1.0713 1.0713 0 01.6363 1.4794 9.3022 9.3022 0 01-2.4707 3.1663 1.072 1.072 0 01-1.5914-.2581l-2.7543-4.4078A1.0707 1.0707 0 0119.2025 19.7222zM24.2273 16.57l-4.9948 1.4321A1.0706 1.0706 0 0118.05 16.3742l2.906-4.3078A1.0706 1.0706 0 0122.55 11.86 9.2168 9.2168 0 0124.9135 15.11 1.0729 1.0729 0 0124.2273 16.57zM12.5561 4.45a14.9542 14.9542 0 00-2.5676.9459 1.07 1.07 0 00-.4636 1.5013l4.8819 8.4557a1.0707 1.0707 0 001.9979-.5353V5.0534A1.07 1.07 0 0015.2526 3.985 14.9577 14.9577 0 0012.5561 4.45z" } }], "name": "logo--yelp", "size": 16 }, "size": 16 }, svg: `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="16" height="16" viewBox="0 0 32 32" aria-hidden="true"><path fill-rule="evenodd" d="M9.09 15.2458l4.6706 2.2777a1.0706 1.0706 0 01-.21 2.0011L8.5087 20.7818a1.0729 1.0729 0 01-1.3241-.921 9.2173 9.2173 0 01.4213-3.9965A1.0706 1.0706 0 019.09 15.2458zM10.96 24.8605l3.4763-3.8613a1.0707 1.0707 0 011.8657.7537l-.1814 5.1945a1.072 1.072 0 01-1.2491 1.0192A9.3014 9.3014 0 0111.1488 26.46 1.0713 1.0713 0 0110.96 24.8605zM19.2025 19.7222l4.9412 1.6058a1.0713 1.0713 0 01.6363 1.4794 9.3022 9.3022 0 01-2.4707 3.1663 1.072 1.072 0 01-1.5914-.2581l-2.7543-4.4078A1.0707 1.0707 0 0119.2025 19.7222zM24.2273 16.57l-4.9948 1.4321A1.0706 1.0706 0 0118.05 16.3742l2.906-4.3078A1.0706 1.0706 0 0122.55 11.86 9.2168 9.2168 0 0124.9135 15.11 1.0729 1.0729 0 0124.2273 16.57zM12.5561 4.45a14.9542 14.9542 0 00-2.5676.9459 1.07 1.07 0 00-.4636 1.5013l4.8819 8.4557a1.0707 1.0707 0 001.9979-.5353V5.0534A1.07 1.07 0 0015.2526 3.985 14.9577 14.9577 0 0012.5561 4.45z"></path></svg>` }, }; } ngAfterViewInit() { const svg = this.elementRef.nativeElement; svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); const icon = this.icons[this.size]; const domParser = new DOMParser(); const rawSVG = icon.svg; const svgElement = domParser.parseFromString(rawSVG, "image/svg+xml").documentElement; let node = svgElement.firstChild; while (node) { // importNode makes a clone of the node // this ensures we keep looping over the nodes in the parsed document svg.appendChild(svg.ownerDocument.importNode(node, true)); node = node.nextSibling; } const attributes = getAttributes({ width: icon.metadata.descriptor.attrs.height, height: icon.metadata.descriptor.attrs.height, viewBox: icon.metadata.descriptor.attrs.viewBox, title: this.title, "aria-label": this.ariaLabel, "aria-labelledby": this.ariaLabelledby, "aria-hidden": this.ariaHidden, focusable: this.isFocusable.toString() }); const attrKeys = Object.keys(attributes); for (let i = 0; i < attrKeys.length; i++) { const key = attrKeys[i]; const value = attributes[key]; if (key === "title") { continue; } if (value) { svg.setAttribute(key, value); } } if (attributes.title) { const title = document.createElement("title"); title.textContent = attributes.title; LogoYelpDirective_1.titleIdCounter++; title.setAttribute("id", `logo-yelp-${LogoYelpDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `logo-yelp-${LogoYelpDirective_1.titleIdCounter}`); } } }; LogoYelpDirective.titleIdCounter = 0; LogoYelpDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], LogoYelpDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoYelpDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], LogoYelpDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoYelpDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], LogoYelpDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoYelpDirective.prototype, "size", void 0); LogoYelpDirective = LogoYelpDirective_1 = __decorate([ Directive({ selector: "[ibmIconLogoYelp]" }), __metadata("design:paramtypes", [ElementRef]) ], LogoYelpDirective); let LogoYelpModule = class LogoYelpModule { }; LogoYelpModule = __decorate([ NgModule({ declarations: [ LogoYelpComponent, LogoYelpDirective, ], exports: [ LogoYelpComponent, LogoYelpDirective, ] }) ], LogoYelpModule); export { LogoYelpComponent, LogoYelpDirective, LogoYelpModule };