UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 14 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var ChartPointComponent = /** @class */ (function () { function ChartPointComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], ChartPointComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ChartPointComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ChartPointComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ChartPointComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ChartPointComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ChartPointComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], ChartPointComponent.prototype, "size", void 0); ChartPointComponent = __decorate([ Component({ selector: "ibm-icon-chart-point", template: "\n <svg\n ibmIconChartPoint\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 " }) ], ChartPointComponent); return ChartPointComponent; }()); var ChartPointDirective = /** @class */ (function () { function ChartPointDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "ChartPoint32", "filepath": "chart--point/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,30H4a2.0023,2.0023,0,0,1-2-2V2H4V28H30Z" } }, { "elem": "circle", "attrs": { "cx": "9", "cy": "6", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "9", "cy": "22", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "18", "cy": "14", "r": "3" } }, { "elem": "path", "attrs": { "d": "M9,17a3,3,0,1,1,3-3A3.0033,3.0033,0,0,1,9,17Zm0-4a1,1,0,1,0,1,1A1.001,1.001,0,0,0,9,13Z" } }, { "elem": "circle", "attrs": { "cx": "27", "cy": "6", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "27", "cy": "22", "r": "3" } }, { "elem": "path", "attrs": { "d": "M27 17a3 3 0 113-3A3.0033 3.0033 0 0127 17zm0-4a1 1 0 101 1A1.001 1.001 0 0027 13zM18 26a3 3 0 113-3A3.0033 3.0033 0 0118 26zm0-4a1 1 0 101 1A1.001 1.001 0 0018 22zM18 8a3 3 0 113-3A3.0033 3.0033 0 0118 8zm0-4a1 1 0 101 1A1.001 1.001 0 0018 4z" } }], "name": "chart--point", "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,30H4a2.0023,2.0023,0,0,1-2-2V2H4V28H30Z\"></path><circle cx=\"9\" cy=\"6\" r=\"3\"></circle><circle cx=\"9\" cy=\"22\" r=\"3\"></circle><circle cx=\"18\" cy=\"14\" r=\"3\"></circle><path d=\"M9,17a3,3,0,1,1,3-3A3.0033,3.0033,0,0,1,9,17Zm0-4a1,1,0,1,0,1,1A1.001,1.001,0,0,0,9,13Z\"></path><circle cx=\"27\" cy=\"6\" r=\"3\"></circle><circle cx=\"27\" cy=\"22\" r=\"3\"></circle><path d=\"M27 17a3 3 0 113-3A3.0033 3.0033 0 0127 17zm0-4a1 1 0 101 1A1.001 1.001 0 0027 13zM18 26a3 3 0 113-3A3.0033 3.0033 0 0118 26zm0-4a1 1 0 101 1A1.001 1.001 0 0018 22zM18 8a3 3 0 113-3A3.0033 3.0033 0 0118 8zm0-4a1 1 0 101 1A1.001 1.001 0 0018 4z\"></path></svg>" }, "24": { metadata: { "moduleName": "ChartPoint24", "filepath": "chart--point/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,30H4a2.0023,2.0023,0,0,1-2-2V2H4V28H30Z" } }, { "elem": "circle", "attrs": { "cx": "9", "cy": "6", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "9", "cy": "22", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "18", "cy": "14", "r": "3" } }, { "elem": "path", "attrs": { "d": "M9,17a3,3,0,1,1,3-3A3.0033,3.0033,0,0,1,9,17Zm0-4a1,1,0,1,0,1,1A1.001,1.001,0,0,0,9,13Z" } }, { "elem": "circle", "attrs": { "cx": "27", "cy": "6", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "27", "cy": "22", "r": "3" } }, { "elem": "path", "attrs": { "d": "M27 17a3 3 0 113-3A3.0033 3.0033 0 0127 17zm0-4a1 1 0 101 1A1.001 1.001 0 0027 13zM18 26a3 3 0 113-3A3.0033 3.0033 0 0118 26zm0-4a1 1 0 101 1A1.001 1.001 0 0018 22zM18 8a3 3 0 113-3A3.0033 3.0033 0 0118 8zm0-4a1 1 0 101 1A1.001 1.001 0 0018 4z" } }], "name": "chart--point", "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,30H4a2.0023,2.0023,0,0,1-2-2V2H4V28H30Z\"></path><circle cx=\"9\" cy=\"6\" r=\"3\"></circle><circle cx=\"9\" cy=\"22\" r=\"3\"></circle><circle cx=\"18\" cy=\"14\" r=\"3\"></circle><path d=\"M9,17a3,3,0,1,1,3-3A3.0033,3.0033,0,0,1,9,17Zm0-4a1,1,0,1,0,1,1A1.001,1.001,0,0,0,9,13Z\"></path><circle cx=\"27\" cy=\"6\" r=\"3\"></circle><circle cx=\"27\" cy=\"22\" r=\"3\"></circle><path d=\"M27 17a3 3 0 113-3A3.0033 3.0033 0 0127 17zm0-4a1 1 0 101 1A1.001 1.001 0 0027 13zM18 26a3 3 0 113-3A3.0033 3.0033 0 0118 26zm0-4a1 1 0 101 1A1.001 1.001 0 0018 22zM18 8a3 3 0 113-3A3.0033 3.0033 0 0118 8zm0-4a1 1 0 101 1A1.001 1.001 0 0018 4z\"></path></svg>" }, "20": { metadata: { "moduleName": "ChartPoint20", "filepath": "chart--point/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,30H4a2.0023,2.0023,0,0,1-2-2V2H4V28H30Z" } }, { "elem": "circle", "attrs": { "cx": "9", "cy": "6", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "9", "cy": "22", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "18", "cy": "14", "r": "3" } }, { "elem": "path", "attrs": { "d": "M9,17a3,3,0,1,1,3-3A3.0033,3.0033,0,0,1,9,17Zm0-4a1,1,0,1,0,1,1A1.001,1.001,0,0,0,9,13Z" } }, { "elem": "circle", "attrs": { "cx": "27", "cy": "6", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "27", "cy": "22", "r": "3" } }, { "elem": "path", "attrs": { "d": "M27 17a3 3 0 113-3A3.0033 3.0033 0 0127 17zm0-4a1 1 0 101 1A1.001 1.001 0 0027 13zM18 26a3 3 0 113-3A3.0033 3.0033 0 0118 26zm0-4a1 1 0 101 1A1.001 1.001 0 0018 22zM18 8a3 3 0 113-3A3.0033 3.0033 0 0118 8zm0-4a1 1 0 101 1A1.001 1.001 0 0018 4z" } }], "name": "chart--point", "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,30H4a2.0023,2.0023,0,0,1-2-2V2H4V28H30Z\"></path><circle cx=\"9\" cy=\"6\" r=\"3\"></circle><circle cx=\"9\" cy=\"22\" r=\"3\"></circle><circle cx=\"18\" cy=\"14\" r=\"3\"></circle><path d=\"M9,17a3,3,0,1,1,3-3A3.0033,3.0033,0,0,1,9,17Zm0-4a1,1,0,1,0,1,1A1.001,1.001,0,0,0,9,13Z\"></path><circle cx=\"27\" cy=\"6\" r=\"3\"></circle><circle cx=\"27\" cy=\"22\" r=\"3\"></circle><path d=\"M27 17a3 3 0 113-3A3.0033 3.0033 0 0127 17zm0-4a1 1 0 101 1A1.001 1.001 0 0027 13zM18 26a3 3 0 113-3A3.0033 3.0033 0 0118 26zm0-4a1 1 0 101 1A1.001 1.001 0 0018 22zM18 8a3 3 0 113-3A3.0033 3.0033 0 0118 8zm0-4a1 1 0 101 1A1.001 1.001 0 0018 4z\"></path></svg>" }, "16": { metadata: { "moduleName": "ChartPoint16", "filepath": "chart--point/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,30H4a2.0023,2.0023,0,0,1-2-2V2H4V28H30Z" } }, { "elem": "circle", "attrs": { "cx": "9", "cy": "6", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "9", "cy": "22", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "18", "cy": "14", "r": "3" } }, { "elem": "path", "attrs": { "d": "M9,17a3,3,0,1,1,3-3A3.0033,3.0033,0,0,1,9,17Zm0-4a1,1,0,1,0,1,1A1.001,1.001,0,0,0,9,13Z" } }, { "elem": "circle", "attrs": { "cx": "27", "cy": "6", "r": "3" } }, { "elem": "circle", "attrs": { "cx": "27", "cy": "22", "r": "3" } }, { "elem": "path", "attrs": { "d": "M27 17a3 3 0 113-3A3.0033 3.0033 0 0127 17zm0-4a1 1 0 101 1A1.001 1.001 0 0027 13zM18 26a3 3 0 113-3A3.0033 3.0033 0 0118 26zm0-4a1 1 0 101 1A1.001 1.001 0 0018 22zM18 8a3 3 0 113-3A3.0033 3.0033 0 0118 8zm0-4a1 1 0 101 1A1.001 1.001 0 0018 4z" } }], "name": "chart--point", "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,30H4a2.0023,2.0023,0,0,1-2-2V2H4V28H30Z\"></path><circle cx=\"9\" cy=\"6\" r=\"3\"></circle><circle cx=\"9\" cy=\"22\" r=\"3\"></circle><circle cx=\"18\" cy=\"14\" r=\"3\"></circle><path d=\"M9,17a3,3,0,1,1,3-3A3.0033,3.0033,0,0,1,9,17Zm0-4a1,1,0,1,0,1,1A1.001,1.001,0,0,0,9,13Z\"></path><circle cx=\"27\" cy=\"6\" r=\"3\"></circle><circle cx=\"27\" cy=\"22\" r=\"3\"></circle><path d=\"M27 17a3 3 0 113-3A3.0033 3.0033 0 0127 17zm0-4a1 1 0 101 1A1.001 1.001 0 0027 13zM18 26a3 3 0 113-3A3.0033 3.0033 0 0118 26zm0-4a1 1 0 101 1A1.001 1.001 0 0018 22zM18 8a3 3 0 113-3A3.0033 3.0033 0 0118 8zm0-4a1 1 0 101 1A1.001 1.001 0 0018 4z\"></path></svg>" }, }; } ChartPointDirective_1 = ChartPointDirective; ChartPointDirective.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; ChartPointDirective_1.titleIdCounter++; title.setAttribute("id", "chart-point-" + ChartPointDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "chart-point-" + ChartPointDirective_1.titleIdCounter); } }; var ChartPointDirective_1; ChartPointDirective.titleIdCounter = 0; ChartPointDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], ChartPointDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ChartPointDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ChartPointDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ChartPointDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ChartPointDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ChartPointDirective.prototype, "size", void 0); ChartPointDirective = ChartPointDirective_1 = __decorate([ Directive({ selector: "[ibmIconChartPoint]" }), __metadata("design:paramtypes", [ElementRef]) ], ChartPointDirective); return ChartPointDirective; }()); var ChartPointModule = /** @class */ (function () { function ChartPointModule() { } ChartPointModule = __decorate([ NgModule({ declarations: [ ChartPointComponent, ChartPointDirective, ], exports: [ ChartPointComponent, ChartPointDirective, ] }) ], ChartPointModule); return ChartPointModule; }()); export { ChartPointComponent, ChartPointDirective, ChartPointModule };