UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 14.1 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var WatsonHealthBrushPolygonDirective_1; let WatsonHealthBrushPolygonComponent = class WatsonHealthBrushPolygonComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthBrushPolygonComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthBrushPolygonComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonComponent.prototype, "size", void 0); WatsonHealthBrushPolygonComponent = __decorate([ Component({ selector: "ibm-icon-watson-health-brush-polygon", template: ` <svg ibmIconWatsonHealthBrushPolygon [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], WatsonHealthBrushPolygonComponent); let WatsonHealthBrushPolygonDirective = WatsonHealthBrushPolygonDirective_1 = class WatsonHealthBrushPolygonDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonHealthBrushPolygon32", "filepath": "watson-health/brush-polygon/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": "M28.8281 3.1719a4.0941 4.0941 0 00-5.6562 0L4.05 22.292A6.9537 6.9537 0 002 27.2412V30H4.7559a6.9523 6.9523 0 004.95-2.05L28.8281 8.8286a3.999 3.999 0 000-5.6567zM10.91 18.26l2.8286 2.8286L11.6172 23.21 8.7886 20.3818zM8.2915 26.5356A4.9665 4.9665 0 014.7559 28H4v-.7588a4.9669 4.9669 0 011.4644-3.5351l1.91-1.91 2.8286 2.8281zM27.4141 7.4141L15.1528 19.6748l-2.8286-2.8286 12.2617-12.26a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM14 2a2.9948 2.9948 0 00-2.8157 2H7.8157A2.9925 2.9925 0 104 7.8154v3.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8157 6h3.3686A2.9947 2.9947 0 1014 2zM5 15a1 1 0 111-1A1.0008 1.0008 0 015 15zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zm9 0a1 1 0 111-1A1.0008 1.0008 0 0114 6z" } }], "name": "brush-polygon", "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="M28.8281 3.1719a4.0941 4.0941 0 00-5.6562 0L4.05 22.292A6.9537 6.9537 0 002 27.2412V30H4.7559a6.9523 6.9523 0 004.95-2.05L28.8281 8.8286a3.999 3.999 0 000-5.6567zM10.91 18.26l2.8286 2.8286L11.6172 23.21 8.7886 20.3818zM8.2915 26.5356A4.9665 4.9665 0 014.7559 28H4v-.7588a4.9669 4.9669 0 011.4644-3.5351l1.91-1.91 2.8286 2.8281zM27.4141 7.4141L15.1528 19.6748l-2.8286-2.8286 12.2617-12.26a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM14 2a2.9948 2.9948 0 00-2.8157 2H7.8157A2.9925 2.9925 0 104 7.8154v3.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8157 6h3.3686A2.9947 2.9947 0 1014 2zM5 15a1 1 0 111-1A1.0008 1.0008 0 015 15zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zm9 0a1 1 0 111-1A1.0008 1.0008 0 0114 6z"></path></svg>` }, "24": { metadata: { "moduleName": "WatsonHealthBrushPolygon24", "filepath": "watson-health/brush-polygon/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": "M28.8281 3.1719a4.0941 4.0941 0 00-5.6562 0L4.05 22.292A6.9537 6.9537 0 002 27.2412V30H4.7559a6.9523 6.9523 0 004.95-2.05L28.8281 8.8286a3.999 3.999 0 000-5.6567zM10.91 18.26l2.8286 2.8286L11.6172 23.21 8.7886 20.3818zM8.2915 26.5356A4.9665 4.9665 0 014.7559 28H4v-.7588a4.9669 4.9669 0 011.4644-3.5351l1.91-1.91 2.8286 2.8281zM27.4141 7.4141L15.1528 19.6748l-2.8286-2.8286 12.2617-12.26a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM14 2a2.9948 2.9948 0 00-2.8157 2H7.8157A2.9925 2.9925 0 104 7.8154v3.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8157 6h3.3686A2.9947 2.9947 0 1014 2zM5 15a1 1 0 111-1A1.0008 1.0008 0 015 15zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zm9 0a1 1 0 111-1A1.0008 1.0008 0 0114 6z" } }], "name": "brush-polygon", "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="M28.8281 3.1719a4.0941 4.0941 0 00-5.6562 0L4.05 22.292A6.9537 6.9537 0 002 27.2412V30H4.7559a6.9523 6.9523 0 004.95-2.05L28.8281 8.8286a3.999 3.999 0 000-5.6567zM10.91 18.26l2.8286 2.8286L11.6172 23.21 8.7886 20.3818zM8.2915 26.5356A4.9665 4.9665 0 014.7559 28H4v-.7588a4.9669 4.9669 0 011.4644-3.5351l1.91-1.91 2.8286 2.8281zM27.4141 7.4141L15.1528 19.6748l-2.8286-2.8286 12.2617-12.26a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM14 2a2.9948 2.9948 0 00-2.8157 2H7.8157A2.9925 2.9925 0 104 7.8154v3.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8157 6h3.3686A2.9947 2.9947 0 1014 2zM5 15a1 1 0 111-1A1.0008 1.0008 0 015 15zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zm9 0a1 1 0 111-1A1.0008 1.0008 0 0114 6z"></path></svg>` }, "20": { metadata: { "moduleName": "WatsonHealthBrushPolygon20", "filepath": "watson-health/brush-polygon/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": "M28.8281 3.1719a4.0941 4.0941 0 00-5.6562 0L4.05 22.292A6.9537 6.9537 0 002 27.2412V30H4.7559a6.9523 6.9523 0 004.95-2.05L28.8281 8.8286a3.999 3.999 0 000-5.6567zM10.91 18.26l2.8286 2.8286L11.6172 23.21 8.7886 20.3818zM8.2915 26.5356A4.9665 4.9665 0 014.7559 28H4v-.7588a4.9669 4.9669 0 011.4644-3.5351l1.91-1.91 2.8286 2.8281zM27.4141 7.4141L15.1528 19.6748l-2.8286-2.8286 12.2617-12.26a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM14 2a2.9948 2.9948 0 00-2.8157 2H7.8157A2.9925 2.9925 0 104 7.8154v3.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8157 6h3.3686A2.9947 2.9947 0 1014 2zM5 15a1 1 0 111-1A1.0008 1.0008 0 015 15zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zm9 0a1 1 0 111-1A1.0008 1.0008 0 0114 6z" } }], "name": "brush-polygon", "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="M28.8281 3.1719a4.0941 4.0941 0 00-5.6562 0L4.05 22.292A6.9537 6.9537 0 002 27.2412V30H4.7559a6.9523 6.9523 0 004.95-2.05L28.8281 8.8286a3.999 3.999 0 000-5.6567zM10.91 18.26l2.8286 2.8286L11.6172 23.21 8.7886 20.3818zM8.2915 26.5356A4.9665 4.9665 0 014.7559 28H4v-.7588a4.9669 4.9669 0 011.4644-3.5351l1.91-1.91 2.8286 2.8281zM27.4141 7.4141L15.1528 19.6748l-2.8286-2.8286 12.2617-12.26a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM14 2a2.9948 2.9948 0 00-2.8157 2H7.8157A2.9925 2.9925 0 104 7.8154v3.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8157 6h3.3686A2.9947 2.9947 0 1014 2zM5 15a1 1 0 111-1A1.0008 1.0008 0 015 15zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zm9 0a1 1 0 111-1A1.0008 1.0008 0 0114 6z"></path></svg>` }, "16": { metadata: { "moduleName": "WatsonHealthBrushPolygon16", "filepath": "watson-health/brush-polygon/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": "M28.8281 3.1719a4.0941 4.0941 0 00-5.6562 0L4.05 22.292A6.9537 6.9537 0 002 27.2412V30H4.7559a6.9523 6.9523 0 004.95-2.05L28.8281 8.8286a3.999 3.999 0 000-5.6567zM10.91 18.26l2.8286 2.8286L11.6172 23.21 8.7886 20.3818zM8.2915 26.5356A4.9665 4.9665 0 014.7559 28H4v-.7588a4.9669 4.9669 0 011.4644-3.5351l1.91-1.91 2.8286 2.8281zM27.4141 7.4141L15.1528 19.6748l-2.8286-2.8286 12.2617-12.26a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM14 2a2.9948 2.9948 0 00-2.8157 2H7.8157A2.9925 2.9925 0 104 7.8154v3.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8157 6h3.3686A2.9947 2.9947 0 1014 2zM5 15a1 1 0 111-1A1.0008 1.0008 0 015 15zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zm9 0a1 1 0 111-1A1.0008 1.0008 0 0114 6z" } }], "name": "brush-polygon", "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="M28.8281 3.1719a4.0941 4.0941 0 00-5.6562 0L4.05 22.292A6.9537 6.9537 0 002 27.2412V30H4.7559a6.9523 6.9523 0 004.95-2.05L28.8281 8.8286a3.999 3.999 0 000-5.6567zM10.91 18.26l2.8286 2.8286L11.6172 23.21 8.7886 20.3818zM8.2915 26.5356A4.9665 4.9665 0 014.7559 28H4v-.7588a4.9669 4.9669 0 011.4644-3.5351l1.91-1.91 2.8286 2.8281zM27.4141 7.4141L15.1528 19.6748l-2.8286-2.8286 12.2617-12.26a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM14 2a2.9948 2.9948 0 00-2.8157 2H7.8157A2.9925 2.9925 0 104 7.8154v3.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8157 6h3.3686A2.9947 2.9947 0 1014 2zM5 15a1 1 0 111-1A1.0008 1.0008 0 015 15zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zm9 0a1 1 0 111-1A1.0008 1.0008 0 0114 6z"></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; WatsonHealthBrushPolygonDirective_1.titleIdCounter++; title.setAttribute("id", `watson-health-brush-polygon-${WatsonHealthBrushPolygonDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `watson-health-brush-polygon-${WatsonHealthBrushPolygonDirective_1.titleIdCounter}`); } } }; WatsonHealthBrushPolygonDirective.titleIdCounter = 0; WatsonHealthBrushPolygonDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthBrushPolygonDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthBrushPolygonDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthBrushPolygonDirective.prototype, "size", void 0); WatsonHealthBrushPolygonDirective = WatsonHealthBrushPolygonDirective_1 = __decorate([ Directive({ selector: "[ibmIconWatsonHealthBrushPolygon]" }), __metadata("design:paramtypes", [ElementRef]) ], WatsonHealthBrushPolygonDirective); let WatsonHealthBrushPolygonModule = class WatsonHealthBrushPolygonModule { }; WatsonHealthBrushPolygonModule = __decorate([ NgModule({ declarations: [ WatsonHealthBrushPolygonComponent, WatsonHealthBrushPolygonDirective, ], exports: [ WatsonHealthBrushPolygonComponent, WatsonHealthBrushPolygonDirective, ] }) ], WatsonHealthBrushPolygonModule); export { WatsonHealthBrushPolygonComponent, WatsonHealthBrushPolygonDirective, WatsonHealthBrushPolygonModule };