UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 13.3 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var WatsonMachineLearningComponent = /** @class */ (function () { function WatsonMachineLearningComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonMachineLearningComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonMachineLearningComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningComponent.prototype, "size", void 0); WatsonMachineLearningComponent = __decorate([ Component({ selector: "ibm-icon-watson-machine-learning", template: "\n <svg\n ibmIconWatsonMachineLearning\n [size]=\"size\"\n [ariaLabel]=\"ariaLabel\"\n [ariaLabelledby]=\"ariaLabelledby\"\n [ariaHidden]=\"ariaHidden\"\n [title]=\"title\"\n [isFocusable]=\"focusable\"\n [attr.class]=\"innerClass\">\n </svg>\n " }) ], WatsonMachineLearningComponent); return WatsonMachineLearningComponent; }()); var WatsonMachineLearningDirective = /** @class */ (function () { function WatsonMachineLearningDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonMachineLearning32", "filepath": "watson--machine-learning/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": "M22 26H20V17.76l-3.23 3.88a1 1 0 01-1.54 0L12 17.76V26H10V15a1 1 0 01.66-.94 1 1 0 011.11.3L16 19.44l4.23-5.08a1 1 0 011.11-.3A1 1 0 0122 15zM4.16 14.65l-3-1.75a.76.76 0 10-.76 1.32L3.4 16a.76.76 0 10.76-1.31zM8.29 10.52a.73.73 0 001 .27.75.75 0 00.28-1l-1.74-3a.76.76 0 10-1.32.76zM16 9a.76.76 0 00.76-.76V4.76a.76.76 0 10-1.52 0V8.25A.76.76 0 0016 9zM22.68 10.79a.75.75 0 00.37.11.76.76 0 00.66-.38l1.75-3a.76.76 0 00-1.32-.76l-1.74 3A.75.75 0 0022.68 10.79zM31.9 13.18a.76.76 0 00-1-.28l-3 1.75A.76.76 0 0028.6 16l3-1.74A.77.77 0 0031.9 13.18z" } }], "name": "watson--machine-learning", "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=\"M22 26H20V17.76l-3.23 3.88a1 1 0 01-1.54 0L12 17.76V26H10V15a1 1 0 01.66-.94 1 1 0 011.11.3L16 19.44l4.23-5.08a1 1 0 011.11-.3A1 1 0 0122 15zM4.16 14.65l-3-1.75a.76.76 0 10-.76 1.32L3.4 16a.76.76 0 10.76-1.31zM8.29 10.52a.73.73 0 001 .27.75.75 0 00.28-1l-1.74-3a.76.76 0 10-1.32.76zM16 9a.76.76 0 00.76-.76V4.76a.76.76 0 10-1.52 0V8.25A.76.76 0 0016 9zM22.68 10.79a.75.75 0 00.37.11.76.76 0 00.66-.38l1.75-3a.76.76 0 00-1.32-.76l-1.74 3A.75.75 0 0022.68 10.79zM31.9 13.18a.76.76 0 00-1-.28l-3 1.75A.76.76 0 0028.6 16l3-1.74A.77.77 0 0031.9 13.18z\"></path></svg>" }, "24": { metadata: { "moduleName": "WatsonMachineLearning24", "filepath": "watson--machine-learning/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": "M22 26H20V17.76l-3.23 3.88a1 1 0 01-1.54 0L12 17.76V26H10V15a1 1 0 01.66-.94 1 1 0 011.11.3L16 19.44l4.23-5.08a1 1 0 011.11-.3A1 1 0 0122 15zM4.16 14.65l-3-1.75a.76.76 0 10-.76 1.32L3.4 16a.76.76 0 10.76-1.31zM8.29 10.52a.73.73 0 001 .27.75.75 0 00.28-1l-1.74-3a.76.76 0 10-1.32.76zM16 9a.76.76 0 00.76-.76V4.76a.76.76 0 10-1.52 0V8.25A.76.76 0 0016 9zM22.68 10.79a.75.75 0 00.37.11.76.76 0 00.66-.38l1.75-3a.76.76 0 00-1.32-.76l-1.74 3A.75.75 0 0022.68 10.79zM31.9 13.18a.76.76 0 00-1-.28l-3 1.75A.76.76 0 0028.6 16l3-1.74A.77.77 0 0031.9 13.18z" } }], "name": "watson--machine-learning", "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=\"M22 26H20V17.76l-3.23 3.88a1 1 0 01-1.54 0L12 17.76V26H10V15a1 1 0 01.66-.94 1 1 0 011.11.3L16 19.44l4.23-5.08a1 1 0 011.11-.3A1 1 0 0122 15zM4.16 14.65l-3-1.75a.76.76 0 10-.76 1.32L3.4 16a.76.76 0 10.76-1.31zM8.29 10.52a.73.73 0 001 .27.75.75 0 00.28-1l-1.74-3a.76.76 0 10-1.32.76zM16 9a.76.76 0 00.76-.76V4.76a.76.76 0 10-1.52 0V8.25A.76.76 0 0016 9zM22.68 10.79a.75.75 0 00.37.11.76.76 0 00.66-.38l1.75-3a.76.76 0 00-1.32-.76l-1.74 3A.75.75 0 0022.68 10.79zM31.9 13.18a.76.76 0 00-1-.28l-3 1.75A.76.76 0 0028.6 16l3-1.74A.77.77 0 0031.9 13.18z\"></path></svg>" }, "20": { metadata: { "moduleName": "WatsonMachineLearning20", "filepath": "watson--machine-learning/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": "M22 26H20V17.76l-3.23 3.88a1 1 0 01-1.54 0L12 17.76V26H10V15a1 1 0 01.66-.94 1 1 0 011.11.3L16 19.44l4.23-5.08a1 1 0 011.11-.3A1 1 0 0122 15zM4.16 14.65l-3-1.75a.76.76 0 10-.76 1.32L3.4 16a.76.76 0 10.76-1.31zM8.29 10.52a.73.73 0 001 .27.75.75 0 00.28-1l-1.74-3a.76.76 0 10-1.32.76zM16 9a.76.76 0 00.76-.76V4.76a.76.76 0 10-1.52 0V8.25A.76.76 0 0016 9zM22.68 10.79a.75.75 0 00.37.11.76.76 0 00.66-.38l1.75-3a.76.76 0 00-1.32-.76l-1.74 3A.75.75 0 0022.68 10.79zM31.9 13.18a.76.76 0 00-1-.28l-3 1.75A.76.76 0 0028.6 16l3-1.74A.77.77 0 0031.9 13.18z" } }], "name": "watson--machine-learning", "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=\"M22 26H20V17.76l-3.23 3.88a1 1 0 01-1.54 0L12 17.76V26H10V15a1 1 0 01.66-.94 1 1 0 011.11.3L16 19.44l4.23-5.08a1 1 0 011.11-.3A1 1 0 0122 15zM4.16 14.65l-3-1.75a.76.76 0 10-.76 1.32L3.4 16a.76.76 0 10.76-1.31zM8.29 10.52a.73.73 0 001 .27.75.75 0 00.28-1l-1.74-3a.76.76 0 10-1.32.76zM16 9a.76.76 0 00.76-.76V4.76a.76.76 0 10-1.52 0V8.25A.76.76 0 0016 9zM22.68 10.79a.75.75 0 00.37.11.76.76 0 00.66-.38l1.75-3a.76.76 0 00-1.32-.76l-1.74 3A.75.75 0 0022.68 10.79zM31.9 13.18a.76.76 0 00-1-.28l-3 1.75A.76.76 0 0028.6 16l3-1.74A.77.77 0 0031.9 13.18z\"></path></svg>" }, "16": { metadata: { "moduleName": "WatsonMachineLearning16", "filepath": "watson--machine-learning/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": "M22 26H20V17.76l-3.23 3.88a1 1 0 01-1.54 0L12 17.76V26H10V15a1 1 0 01.66-.94 1 1 0 011.11.3L16 19.44l4.23-5.08a1 1 0 011.11-.3A1 1 0 0122 15zM4.16 14.65l-3-1.75a.76.76 0 10-.76 1.32L3.4 16a.76.76 0 10.76-1.31zM8.29 10.52a.73.73 0 001 .27.75.75 0 00.28-1l-1.74-3a.76.76 0 10-1.32.76zM16 9a.76.76 0 00.76-.76V4.76a.76.76 0 10-1.52 0V8.25A.76.76 0 0016 9zM22.68 10.79a.75.75 0 00.37.11.76.76 0 00.66-.38l1.75-3a.76.76 0 00-1.32-.76l-1.74 3A.75.75 0 0022.68 10.79zM31.9 13.18a.76.76 0 00-1-.28l-3 1.75A.76.76 0 0028.6 16l3-1.74A.77.77 0 0031.9 13.18z" } }], "name": "watson--machine-learning", "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=\"M22 26H20V17.76l-3.23 3.88a1 1 0 01-1.54 0L12 17.76V26H10V15a1 1 0 01.66-.94 1 1 0 011.11.3L16 19.44l4.23-5.08a1 1 0 011.11-.3A1 1 0 0122 15zM4.16 14.65l-3-1.75a.76.76 0 10-.76 1.32L3.4 16a.76.76 0 10.76-1.31zM8.29 10.52a.73.73 0 001 .27.75.75 0 00.28-1l-1.74-3a.76.76 0 10-1.32.76zM16 9a.76.76 0 00.76-.76V4.76a.76.76 0 10-1.52 0V8.25A.76.76 0 0016 9zM22.68 10.79a.75.75 0 00.37.11.76.76 0 00.66-.38l1.75-3a.76.76 0 00-1.32-.76l-1.74 3A.75.75 0 0022.68 10.79zM31.9 13.18a.76.76 0 00-1-.28l-3 1.75A.76.76 0 0028.6 16l3-1.74A.77.77 0 0031.9 13.18z\"></path></svg>" }, }; } WatsonMachineLearningDirective_1 = WatsonMachineLearningDirective; WatsonMachineLearningDirective.prototype.ngAfterViewInit = function () { var svg = this.elementRef.nativeElement; svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); var icon = this.icons[this.size]; var domParser = new DOMParser(); var rawSVG = icon.svg; var svgElement = domParser.parseFromString(rawSVG, "image/svg+xml").documentElement; var 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; } var 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() }); var attrKeys = Object.keys(attributes); for (var i = 0; i < attrKeys.length; i++) { var key = attrKeys[i]; var value = attributes[key]; if (key === "title") { continue; } if (value) { svg.setAttribute(key, value); } } if (attributes.title) { var title = document.createElement("title"); title.textContent = attributes.title; WatsonMachineLearningDirective_1.titleIdCounter++; title.setAttribute("id", "watson-machine-learning-" + WatsonMachineLearningDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "watson-machine-learning-" + WatsonMachineLearningDirective_1.titleIdCounter); } }; var WatsonMachineLearningDirective_1; WatsonMachineLearningDirective.titleIdCounter = 0; WatsonMachineLearningDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonMachineLearningDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonMachineLearningDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonMachineLearningDirective.prototype, "size", void 0); WatsonMachineLearningDirective = WatsonMachineLearningDirective_1 = __decorate([ Directive({ selector: "[ibmIconWatsonMachineLearning]" }), __metadata("design:paramtypes", [ElementRef]) ], WatsonMachineLearningDirective); return WatsonMachineLearningDirective; }()); var WatsonMachineLearningModule = /** @class */ (function () { function WatsonMachineLearningModule() { } WatsonMachineLearningModule = __decorate([ NgModule({ declarations: [ WatsonMachineLearningComponent, WatsonMachineLearningDirective, ], exports: [ WatsonMachineLearningComponent, WatsonMachineLearningDirective, ] }) ], WatsonMachineLearningModule); return WatsonMachineLearningModule; }()); export { WatsonMachineLearningComponent, WatsonMachineLearningDirective, WatsonMachineLearningModule };