UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 11.9 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var WatsonHealthErase_3DDirective_1; let WatsonHealthErase_3DComponent = class WatsonHealthErase_3DComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthErase_3DComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthErase_3DComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DComponent.prototype, "size", void 0); WatsonHealthErase_3DComponent = __decorate([ Component({ selector: "ibm-icon-watson-health-erase-3-d", template: ` <svg ibmIconWatsonHealthErase_3D [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], WatsonHealthErase_3DComponent); let WatsonHealthErase_3DDirective = WatsonHealthErase_3DDirective_1 = class WatsonHealthErase_3DDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonHealthErase_3D32", "filepath": "watson-health/erase--3D/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": { "d": "M30.4148 16.5132L22.488 8.5859a2.0014 2.0014 0 00-2.8291 0L5.6208 22.624a2.0024 2.0024 0 000 2.8291L10.1663 30h9.5908L30.4148 19.3413A2.001 2.001 0 0030.4148 16.5132zM18.929 28H10.9949l-3.96-3.9619 6.3123-6.3118 7.9276 7.9276zm3.76-3.76l-7.9276-7.9276L21.074 10l7.9267 7.9272zM11 12H8V2h3a3.0033 3.0033 0 013 3V9A3.0033 3.0033 0 0111 12zm-1-2h1a1.0009 1.0009 0 001-1V5a1.0009 1.0009 0 00-1-1H10zM4 2H0V4H4V6H1V8H4v2H0v2H4a2.0027 2.0027 0 002-2V4A2.0023 2.0023 0 004 2z" } }], "name": "erase--3D", "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 d="M30.4148 16.5132L22.488 8.5859a2.0014 2.0014 0 00-2.8291 0L5.6208 22.624a2.0024 2.0024 0 000 2.8291L10.1663 30h9.5908L30.4148 19.3413A2.001 2.001 0 0030.4148 16.5132zM18.929 28H10.9949l-3.96-3.9619 6.3123-6.3118 7.9276 7.9276zm3.76-3.76l-7.9276-7.9276L21.074 10l7.9267 7.9272zM11 12H8V2h3a3.0033 3.0033 0 013 3V9A3.0033 3.0033 0 0111 12zm-1-2h1a1.0009 1.0009 0 001-1V5a1.0009 1.0009 0 00-1-1H10zM4 2H0V4H4V6H1V8H4v2H0v2H4a2.0027 2.0027 0 002-2V4A2.0023 2.0023 0 004 2z"></path></svg>` }, "24": { metadata: { "moduleName": "WatsonHealthErase_3D24", "filepath": "watson-health/erase--3D/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": { "d": "M30.4148 16.5132L22.488 8.5859a2.0014 2.0014 0 00-2.8291 0L5.6208 22.624a2.0024 2.0024 0 000 2.8291L10.1663 30h9.5908L30.4148 19.3413A2.001 2.001 0 0030.4148 16.5132zM18.929 28H10.9949l-3.96-3.9619 6.3123-6.3118 7.9276 7.9276zm3.76-3.76l-7.9276-7.9276L21.074 10l7.9267 7.9272zM11 12H8V2h3a3.0033 3.0033 0 013 3V9A3.0033 3.0033 0 0111 12zm-1-2h1a1.0009 1.0009 0 001-1V5a1.0009 1.0009 0 00-1-1H10zM4 2H0V4H4V6H1V8H4v2H0v2H4a2.0027 2.0027 0 002-2V4A2.0023 2.0023 0 004 2z" } }], "name": "erase--3D", "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 d="M30.4148 16.5132L22.488 8.5859a2.0014 2.0014 0 00-2.8291 0L5.6208 22.624a2.0024 2.0024 0 000 2.8291L10.1663 30h9.5908L30.4148 19.3413A2.001 2.001 0 0030.4148 16.5132zM18.929 28H10.9949l-3.96-3.9619 6.3123-6.3118 7.9276 7.9276zm3.76-3.76l-7.9276-7.9276L21.074 10l7.9267 7.9272zM11 12H8V2h3a3.0033 3.0033 0 013 3V9A3.0033 3.0033 0 0111 12zm-1-2h1a1.0009 1.0009 0 001-1V5a1.0009 1.0009 0 00-1-1H10zM4 2H0V4H4V6H1V8H4v2H0v2H4a2.0027 2.0027 0 002-2V4A2.0023 2.0023 0 004 2z"></path></svg>` }, "20": { metadata: { "moduleName": "WatsonHealthErase_3D20", "filepath": "watson-health/erase--3D/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": { "d": "M30.4148 16.5132L22.488 8.5859a2.0014 2.0014 0 00-2.8291 0L5.6208 22.624a2.0024 2.0024 0 000 2.8291L10.1663 30h9.5908L30.4148 19.3413A2.001 2.001 0 0030.4148 16.5132zM18.929 28H10.9949l-3.96-3.9619 6.3123-6.3118 7.9276 7.9276zm3.76-3.76l-7.9276-7.9276L21.074 10l7.9267 7.9272zM11 12H8V2h3a3.0033 3.0033 0 013 3V9A3.0033 3.0033 0 0111 12zm-1-2h1a1.0009 1.0009 0 001-1V5a1.0009 1.0009 0 00-1-1H10zM4 2H0V4H4V6H1V8H4v2H0v2H4a2.0027 2.0027 0 002-2V4A2.0023 2.0023 0 004 2z" } }], "name": "erase--3D", "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 d="M30.4148 16.5132L22.488 8.5859a2.0014 2.0014 0 00-2.8291 0L5.6208 22.624a2.0024 2.0024 0 000 2.8291L10.1663 30h9.5908L30.4148 19.3413A2.001 2.001 0 0030.4148 16.5132zM18.929 28H10.9949l-3.96-3.9619 6.3123-6.3118 7.9276 7.9276zm3.76-3.76l-7.9276-7.9276L21.074 10l7.9267 7.9272zM11 12H8V2h3a3.0033 3.0033 0 013 3V9A3.0033 3.0033 0 0111 12zm-1-2h1a1.0009 1.0009 0 001-1V5a1.0009 1.0009 0 00-1-1H10zM4 2H0V4H4V6H1V8H4v2H0v2H4a2.0027 2.0027 0 002-2V4A2.0023 2.0023 0 004 2z"></path></svg>` }, "16": { metadata: { "moduleName": "WatsonHealthErase_3D16", "filepath": "watson-health/erase--3D/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": { "d": "M30.4148 16.5132L22.488 8.5859a2.0014 2.0014 0 00-2.8291 0L5.6208 22.624a2.0024 2.0024 0 000 2.8291L10.1663 30h9.5908L30.4148 19.3413A2.001 2.001 0 0030.4148 16.5132zM18.929 28H10.9949l-3.96-3.9619 6.3123-6.3118 7.9276 7.9276zm3.76-3.76l-7.9276-7.9276L21.074 10l7.9267 7.9272zM11 12H8V2h3a3.0033 3.0033 0 013 3V9A3.0033 3.0033 0 0111 12zm-1-2h1a1.0009 1.0009 0 001-1V5a1.0009 1.0009 0 00-1-1H10zM4 2H0V4H4V6H1V8H4v2H0v2H4a2.0027 2.0027 0 002-2V4A2.0023 2.0023 0 004 2z" } }], "name": "erase--3D", "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 d="M30.4148 16.5132L22.488 8.5859a2.0014 2.0014 0 00-2.8291 0L5.6208 22.624a2.0024 2.0024 0 000 2.8291L10.1663 30h9.5908L30.4148 19.3413A2.001 2.001 0 0030.4148 16.5132zM18.929 28H10.9949l-3.96-3.9619 6.3123-6.3118 7.9276 7.9276zm3.76-3.76l-7.9276-7.9276L21.074 10l7.9267 7.9272zM11 12H8V2h3a3.0033 3.0033 0 013 3V9A3.0033 3.0033 0 0111 12zm-1-2h1a1.0009 1.0009 0 001-1V5a1.0009 1.0009 0 00-1-1H10zM4 2H0V4H4V6H1V8H4v2H0v2H4a2.0027 2.0027 0 002-2V4A2.0023 2.0023 0 004 2z"></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; WatsonHealthErase_3DDirective_1.titleIdCounter++; title.setAttribute("id", `watson-health-erase-3-d-${WatsonHealthErase_3DDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `watson-health-erase-3-d-${WatsonHealthErase_3DDirective_1.titleIdCounter}`); } } }; WatsonHealthErase_3DDirective.titleIdCounter = 0; WatsonHealthErase_3DDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthErase_3DDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthErase_3DDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthErase_3DDirective.prototype, "size", void 0); WatsonHealthErase_3DDirective = WatsonHealthErase_3DDirective_1 = __decorate([ Directive({ selector: "[ibmIconWatsonHealthErase_3D]" }), __metadata("design:paramtypes", [ElementRef]) ], WatsonHealthErase_3DDirective); let WatsonHealthErase_3DModule = class WatsonHealthErase_3DModule { }; WatsonHealthErase_3DModule = __decorate([ NgModule({ declarations: [ WatsonHealthErase_3DComponent, WatsonHealthErase_3DDirective, ], exports: [ WatsonHealthErase_3DComponent, WatsonHealthErase_3DDirective, ] }) ], WatsonHealthErase_3DModule); export { WatsonHealthErase_3DComponent, WatsonHealthErase_3DDirective, WatsonHealthErase_3DModule };