UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 13.8 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var WatsonHealthMammogramDirective_1; let WatsonHealthMammogramComponent = class WatsonHealthMammogramComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthMammogramComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthMammogramComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramComponent.prototype, "size", void 0); WatsonHealthMammogramComponent = __decorate([ Component({ selector: "ibm-icon-watson-health-mammogram", template: ` <svg ibmIconWatsonHealthMammogram [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], WatsonHealthMammogramComponent); let WatsonHealthMammogramDirective = WatsonHealthMammogramDirective_1 = class WatsonHealthMammogramDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonHealthMammogram32", "filepath": "watson-health/mammogram/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": "M25 32L32 32 32 25 30 25 30 30 25 30 25 32zM25 27H22V17h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 27zm-1-2h1a1.0006 1.0006 0 001-1V20a1.0006 1.0006 0 00-1-1H24zM20 27H14V23a2.002 2.002 0 012-2h2V19H14V17h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H16v2h4zM25 15H22V5h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 15zm-1-2h1a1.0009 1.0009 0 001-1V8a1.0009 1.0009 0 00-1-1H24zM18 5H14V7h4V9H15v2h3v2H14v2h4a2.0027 2.0027 0 002-2V7A2.0023 2.0023 0 0018 5zM10 27H8V23.9541C3.2847 23.5117 2 19.9443 2 18c0-3.0146 2.082-4.5015 3.9189-5.814C7.5723 11.0054 9 9.9854 9 8V5h2V8c0 3.0146-2.082 4.5015-3.9189 5.814C5.4277 14.9946 4 16.0146 4 18c.0054.4033.1914 4 5 4a1 1 0 011 1zM7 0L0 0 0 7 2 7 2 2 7 2 7 0z" } }], "name": "mammogram", "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="M25 32L32 32 32 25 30 25 30 30 25 30 25 32zM25 27H22V17h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 27zm-1-2h1a1.0006 1.0006 0 001-1V20a1.0006 1.0006 0 00-1-1H24zM20 27H14V23a2.002 2.002 0 012-2h2V19H14V17h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H16v2h4zM25 15H22V5h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 15zm-1-2h1a1.0009 1.0009 0 001-1V8a1.0009 1.0009 0 00-1-1H24zM18 5H14V7h4V9H15v2h3v2H14v2h4a2.0027 2.0027 0 002-2V7A2.0023 2.0023 0 0018 5zM10 27H8V23.9541C3.2847 23.5117 2 19.9443 2 18c0-3.0146 2.082-4.5015 3.9189-5.814C7.5723 11.0054 9 9.9854 9 8V5h2V8c0 3.0146-2.082 4.5015-3.9189 5.814C5.4277 14.9946 4 16.0146 4 18c.0054.4033.1914 4 5 4a1 1 0 011 1zM7 0L0 0 0 7 2 7 2 2 7 2 7 0z"></path></svg>` }, "24": { metadata: { "moduleName": "WatsonHealthMammogram24", "filepath": "watson-health/mammogram/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": "M25 32L32 32 32 25 30 25 30 30 25 30 25 32zM25 27H22V17h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 27zm-1-2h1a1.0006 1.0006 0 001-1V20a1.0006 1.0006 0 00-1-1H24zM20 27H14V23a2.002 2.002 0 012-2h2V19H14V17h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H16v2h4zM25 15H22V5h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 15zm-1-2h1a1.0009 1.0009 0 001-1V8a1.0009 1.0009 0 00-1-1H24zM18 5H14V7h4V9H15v2h3v2H14v2h4a2.0027 2.0027 0 002-2V7A2.0023 2.0023 0 0018 5zM10 27H8V23.9541C3.2847 23.5117 2 19.9443 2 18c0-3.0146 2.082-4.5015 3.9189-5.814C7.5723 11.0054 9 9.9854 9 8V5h2V8c0 3.0146-2.082 4.5015-3.9189 5.814C5.4277 14.9946 4 16.0146 4 18c.0054.4033.1914 4 5 4a1 1 0 011 1zM7 0L0 0 0 7 2 7 2 2 7 2 7 0z" } }], "name": "mammogram", "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="M25 32L32 32 32 25 30 25 30 30 25 30 25 32zM25 27H22V17h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 27zm-1-2h1a1.0006 1.0006 0 001-1V20a1.0006 1.0006 0 00-1-1H24zM20 27H14V23a2.002 2.002 0 012-2h2V19H14V17h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H16v2h4zM25 15H22V5h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 15zm-1-2h1a1.0009 1.0009 0 001-1V8a1.0009 1.0009 0 00-1-1H24zM18 5H14V7h4V9H15v2h3v2H14v2h4a2.0027 2.0027 0 002-2V7A2.0023 2.0023 0 0018 5zM10 27H8V23.9541C3.2847 23.5117 2 19.9443 2 18c0-3.0146 2.082-4.5015 3.9189-5.814C7.5723 11.0054 9 9.9854 9 8V5h2V8c0 3.0146-2.082 4.5015-3.9189 5.814C5.4277 14.9946 4 16.0146 4 18c.0054.4033.1914 4 5 4a1 1 0 011 1zM7 0L0 0 0 7 2 7 2 2 7 2 7 0z"></path></svg>` }, "20": { metadata: { "moduleName": "WatsonHealthMammogram20", "filepath": "watson-health/mammogram/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": "M25 32L32 32 32 25 30 25 30 30 25 30 25 32zM25 27H22V17h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 27zm-1-2h1a1.0006 1.0006 0 001-1V20a1.0006 1.0006 0 00-1-1H24zM20 27H14V23a2.002 2.002 0 012-2h2V19H14V17h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H16v2h4zM25 15H22V5h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 15zm-1-2h1a1.0009 1.0009 0 001-1V8a1.0009 1.0009 0 00-1-1H24zM18 5H14V7h4V9H15v2h3v2H14v2h4a2.0027 2.0027 0 002-2V7A2.0023 2.0023 0 0018 5zM10 27H8V23.9541C3.2847 23.5117 2 19.9443 2 18c0-3.0146 2.082-4.5015 3.9189-5.814C7.5723 11.0054 9 9.9854 9 8V5h2V8c0 3.0146-2.082 4.5015-3.9189 5.814C5.4277 14.9946 4 16.0146 4 18c.0054.4033.1914 4 5 4a1 1 0 011 1zM7 0L0 0 0 7 2 7 2 2 7 2 7 0z" } }], "name": "mammogram", "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="M25 32L32 32 32 25 30 25 30 30 25 30 25 32zM25 27H22V17h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 27zm-1-2h1a1.0006 1.0006 0 001-1V20a1.0006 1.0006 0 00-1-1H24zM20 27H14V23a2.002 2.002 0 012-2h2V19H14V17h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H16v2h4zM25 15H22V5h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 15zm-1-2h1a1.0009 1.0009 0 001-1V8a1.0009 1.0009 0 00-1-1H24zM18 5H14V7h4V9H15v2h3v2H14v2h4a2.0027 2.0027 0 002-2V7A2.0023 2.0023 0 0018 5zM10 27H8V23.9541C3.2847 23.5117 2 19.9443 2 18c0-3.0146 2.082-4.5015 3.9189-5.814C7.5723 11.0054 9 9.9854 9 8V5h2V8c0 3.0146-2.082 4.5015-3.9189 5.814C5.4277 14.9946 4 16.0146 4 18c.0054.4033.1914 4 5 4a1 1 0 011 1zM7 0L0 0 0 7 2 7 2 2 7 2 7 0z"></path></svg>` }, "16": { metadata: { "moduleName": "WatsonHealthMammogram16", "filepath": "watson-health/mammogram/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": "M25 32L32 32 32 25 30 25 30 30 25 30 25 32zM25 27H22V17h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 27zm-1-2h1a1.0006 1.0006 0 001-1V20a1.0006 1.0006 0 00-1-1H24zM20 27H14V23a2.002 2.002 0 012-2h2V19H14V17h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H16v2h4zM25 15H22V5h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 15zm-1-2h1a1.0009 1.0009 0 001-1V8a1.0009 1.0009 0 00-1-1H24zM18 5H14V7h4V9H15v2h3v2H14v2h4a2.0027 2.0027 0 002-2V7A2.0023 2.0023 0 0018 5zM10 27H8V23.9541C3.2847 23.5117 2 19.9443 2 18c0-3.0146 2.082-4.5015 3.9189-5.814C7.5723 11.0054 9 9.9854 9 8V5h2V8c0 3.0146-2.082 4.5015-3.9189 5.814C5.4277 14.9946 4 16.0146 4 18c.0054.4033.1914 4 5 4a1 1 0 011 1zM7 0L0 0 0 7 2 7 2 2 7 2 7 0z" } }], "name": "mammogram", "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="M25 32L32 32 32 25 30 25 30 30 25 30 25 32zM25 27H22V17h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 27zm-1-2h1a1.0006 1.0006 0 001-1V20a1.0006 1.0006 0 00-1-1H24zM20 27H14V23a2.002 2.002 0 012-2h2V19H14V17h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H16v2h4zM25 15H22V5h3a3.0033 3.0033 0 013 3v4A3.0033 3.0033 0 0125 15zm-1-2h1a1.0009 1.0009 0 001-1V8a1.0009 1.0009 0 00-1-1H24zM18 5H14V7h4V9H15v2h3v2H14v2h4a2.0027 2.0027 0 002-2V7A2.0023 2.0023 0 0018 5zM10 27H8V23.9541C3.2847 23.5117 2 19.9443 2 18c0-3.0146 2.082-4.5015 3.9189-5.814C7.5723 11.0054 9 9.9854 9 8V5h2V8c0 3.0146-2.082 4.5015-3.9189 5.814C5.4277 14.9946 4 16.0146 4 18c.0054.4033.1914 4 5 4a1 1 0 011 1zM7 0L0 0 0 7 2 7 2 2 7 2 7 0z"></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; WatsonHealthMammogramDirective_1.titleIdCounter++; title.setAttribute("id", `watson-health-mammogram-${WatsonHealthMammogramDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `watson-health-mammogram-${WatsonHealthMammogramDirective_1.titleIdCounter}`); } } }; WatsonHealthMammogramDirective.titleIdCounter = 0; WatsonHealthMammogramDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthMammogramDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthMammogramDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthMammogramDirective.prototype, "size", void 0); WatsonHealthMammogramDirective = WatsonHealthMammogramDirective_1 = __decorate([ Directive({ selector: "[ibmIconWatsonHealthMammogram]" }), __metadata("design:paramtypes", [ElementRef]) ], WatsonHealthMammogramDirective); let WatsonHealthMammogramModule = class WatsonHealthMammogramModule { }; WatsonHealthMammogramModule = __decorate([ NgModule({ declarations: [ WatsonHealthMammogramComponent, WatsonHealthMammogramDirective, ], exports: [ WatsonHealthMammogramComponent, WatsonHealthMammogramDirective, ] }) ], WatsonHealthMammogramModule); export { WatsonHealthMammogramComponent, WatsonHealthMammogramDirective, WatsonHealthMammogramModule };