@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
169 lines (166 loc) • 14.3 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var QuadrantPlotComponent = /** @class */ (function () {
function QuadrantPlotComponent() {
this.focusable = false;
}
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], QuadrantPlotComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], QuadrantPlotComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotComponent.prototype, "size", void 0);
QuadrantPlotComponent = __decorate([
Component({
selector: "ibm-icon-quadrant-plot",
template: "\n <svg\n ibmIconQuadrantPlot\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 "
})
], QuadrantPlotComponent);
return QuadrantPlotComponent;
}());
var QuadrantPlotDirective = /** @class */ (function () {
function QuadrantPlotDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "QuadrantPlot32", "filepath": "quadrant-plot/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 15L17 15 17 2 15 2 15 15 2 15 2 17 15 17 15 30 17 30 17 17 30 17 30 15z" } }, { "elem": "path", "attrs": { "d": "M5 30a3 3 0 113-3A3.0033 3.0033 0 015 30zm0-4a1 1 0 101 1A1.001 1.001 0 005 26zM8 8a3 3 0 113-3A3.0033 3.0033 0 018 8zM8 4A1 1 0 109 5 1.001 1.001 0 008 4zM22 13a3 3 0 113-3A3.0033 3.0033 0 0122 13zm0-4a1 1 0 101 1A1.001 1.001 0 0022 9z" } }, { "elem": "circle", "attrs": { "cx": "11", "cy": "11", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "11", "cy": "21", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "21", "cy": "21", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "22", "cy": "28", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "28", "cy": "24", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "4", "cy": "11", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "28", "cy": "4", "r": "2" } }], "name": "quadrant-plot", "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 15L17 15 17 2 15 2 15 15 2 15 2 17 15 17 15 30 17 30 17 17 30 17 30 15z\"></path><path d=\"M5 30a3 3 0 113-3A3.0033 3.0033 0 015 30zm0-4a1 1 0 101 1A1.001 1.001 0 005 26zM8 8a3 3 0 113-3A3.0033 3.0033 0 018 8zM8 4A1 1 0 109 5 1.001 1.001 0 008 4zM22 13a3 3 0 113-3A3.0033 3.0033 0 0122 13zm0-4a1 1 0 101 1A1.001 1.001 0 0022 9z\"></path><circle cx=\"11\" cy=\"11\" r=\"2\"></circle><circle cx=\"11\" cy=\"21\" r=\"2\"></circle><circle cx=\"21\" cy=\"21\" r=\"2\"></circle><circle cx=\"22\" cy=\"28\" r=\"2\"></circle><circle cx=\"28\" cy=\"24\" r=\"2\"></circle><circle cx=\"4\" cy=\"11\" r=\"2\"></circle><circle cx=\"28\" cy=\"4\" r=\"2\"></circle></svg>"
},
"24": {
metadata: { "moduleName": "QuadrantPlot24", "filepath": "quadrant-plot/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 15L17 15 17 2 15 2 15 15 2 15 2 17 15 17 15 30 17 30 17 17 30 17 30 15z" } }, { "elem": "path", "attrs": { "d": "M5 30a3 3 0 113-3A3.0033 3.0033 0 015 30zm0-4a1 1 0 101 1A1.001 1.001 0 005 26zM8 8a3 3 0 113-3A3.0033 3.0033 0 018 8zM8 4A1 1 0 109 5 1.001 1.001 0 008 4zM22 13a3 3 0 113-3A3.0033 3.0033 0 0122 13zm0-4a1 1 0 101 1A1.001 1.001 0 0022 9z" } }, { "elem": "circle", "attrs": { "cx": "11", "cy": "11", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "11", "cy": "21", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "21", "cy": "21", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "22", "cy": "28", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "28", "cy": "24", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "4", "cy": "11", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "28", "cy": "4", "r": "2" } }], "name": "quadrant-plot", "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 15L17 15 17 2 15 2 15 15 2 15 2 17 15 17 15 30 17 30 17 17 30 17 30 15z\"></path><path d=\"M5 30a3 3 0 113-3A3.0033 3.0033 0 015 30zm0-4a1 1 0 101 1A1.001 1.001 0 005 26zM8 8a3 3 0 113-3A3.0033 3.0033 0 018 8zM8 4A1 1 0 109 5 1.001 1.001 0 008 4zM22 13a3 3 0 113-3A3.0033 3.0033 0 0122 13zm0-4a1 1 0 101 1A1.001 1.001 0 0022 9z\"></path><circle cx=\"11\" cy=\"11\" r=\"2\"></circle><circle cx=\"11\" cy=\"21\" r=\"2\"></circle><circle cx=\"21\" cy=\"21\" r=\"2\"></circle><circle cx=\"22\" cy=\"28\" r=\"2\"></circle><circle cx=\"28\" cy=\"24\" r=\"2\"></circle><circle cx=\"4\" cy=\"11\" r=\"2\"></circle><circle cx=\"28\" cy=\"4\" r=\"2\"></circle></svg>"
},
"20": {
metadata: { "moduleName": "QuadrantPlot20", "filepath": "quadrant-plot/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 15L17 15 17 2 15 2 15 15 2 15 2 17 15 17 15 30 17 30 17 17 30 17 30 15z" } }, { "elem": "path", "attrs": { "d": "M5 30a3 3 0 113-3A3.0033 3.0033 0 015 30zm0-4a1 1 0 101 1A1.001 1.001 0 005 26zM8 8a3 3 0 113-3A3.0033 3.0033 0 018 8zM8 4A1 1 0 109 5 1.001 1.001 0 008 4zM22 13a3 3 0 113-3A3.0033 3.0033 0 0122 13zm0-4a1 1 0 101 1A1.001 1.001 0 0022 9z" } }, { "elem": "circle", "attrs": { "cx": "11", "cy": "11", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "11", "cy": "21", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "21", "cy": "21", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "22", "cy": "28", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "28", "cy": "24", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "4", "cy": "11", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "28", "cy": "4", "r": "2" } }], "name": "quadrant-plot", "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 15L17 15 17 2 15 2 15 15 2 15 2 17 15 17 15 30 17 30 17 17 30 17 30 15z\"></path><path d=\"M5 30a3 3 0 113-3A3.0033 3.0033 0 015 30zm0-4a1 1 0 101 1A1.001 1.001 0 005 26zM8 8a3 3 0 113-3A3.0033 3.0033 0 018 8zM8 4A1 1 0 109 5 1.001 1.001 0 008 4zM22 13a3 3 0 113-3A3.0033 3.0033 0 0122 13zm0-4a1 1 0 101 1A1.001 1.001 0 0022 9z\"></path><circle cx=\"11\" cy=\"11\" r=\"2\"></circle><circle cx=\"11\" cy=\"21\" r=\"2\"></circle><circle cx=\"21\" cy=\"21\" r=\"2\"></circle><circle cx=\"22\" cy=\"28\" r=\"2\"></circle><circle cx=\"28\" cy=\"24\" r=\"2\"></circle><circle cx=\"4\" cy=\"11\" r=\"2\"></circle><circle cx=\"28\" cy=\"4\" r=\"2\"></circle></svg>"
},
"16": {
metadata: { "moduleName": "QuadrantPlot16", "filepath": "quadrant-plot/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 15L17 15 17 2 15 2 15 15 2 15 2 17 15 17 15 30 17 30 17 17 30 17 30 15z" } }, { "elem": "path", "attrs": { "d": "M5 30a3 3 0 113-3A3.0033 3.0033 0 015 30zm0-4a1 1 0 101 1A1.001 1.001 0 005 26zM8 8a3 3 0 113-3A3.0033 3.0033 0 018 8zM8 4A1 1 0 109 5 1.001 1.001 0 008 4zM22 13a3 3 0 113-3A3.0033 3.0033 0 0122 13zm0-4a1 1 0 101 1A1.001 1.001 0 0022 9z" } }, { "elem": "circle", "attrs": { "cx": "11", "cy": "11", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "11", "cy": "21", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "21", "cy": "21", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "22", "cy": "28", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "28", "cy": "24", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "4", "cy": "11", "r": "2" } }, { "elem": "circle", "attrs": { "cx": "28", "cy": "4", "r": "2" } }], "name": "quadrant-plot", "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 15L17 15 17 2 15 2 15 15 2 15 2 17 15 17 15 30 17 30 17 17 30 17 30 15z\"></path><path d=\"M5 30a3 3 0 113-3A3.0033 3.0033 0 015 30zm0-4a1 1 0 101 1A1.001 1.001 0 005 26zM8 8a3 3 0 113-3A3.0033 3.0033 0 018 8zM8 4A1 1 0 109 5 1.001 1.001 0 008 4zM22 13a3 3 0 113-3A3.0033 3.0033 0 0122 13zm0-4a1 1 0 101 1A1.001 1.001 0 0022 9z\"></path><circle cx=\"11\" cy=\"11\" r=\"2\"></circle><circle cx=\"11\" cy=\"21\" r=\"2\"></circle><circle cx=\"21\" cy=\"21\" r=\"2\"></circle><circle cx=\"22\" cy=\"28\" r=\"2\"></circle><circle cx=\"28\" cy=\"24\" r=\"2\"></circle><circle cx=\"4\" cy=\"11\" r=\"2\"></circle><circle cx=\"28\" cy=\"4\" r=\"2\"></circle></svg>"
},
};
}
QuadrantPlotDirective_1 = QuadrantPlotDirective;
QuadrantPlotDirective.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;
QuadrantPlotDirective_1.titleIdCounter++;
title.setAttribute("id", "quadrant-plot-" + QuadrantPlotDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "quadrant-plot-" + QuadrantPlotDirective_1.titleIdCounter);
}
};
var QuadrantPlotDirective_1;
QuadrantPlotDirective.titleIdCounter = 0;
QuadrantPlotDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], QuadrantPlotDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], QuadrantPlotDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QuadrantPlotDirective.prototype, "size", void 0);
QuadrantPlotDirective = QuadrantPlotDirective_1 = __decorate([
Directive({
selector: "[ibmIconQuadrantPlot]"
}),
__metadata("design:paramtypes", [ElementRef])
], QuadrantPlotDirective);
return QuadrantPlotDirective;
}());
var QuadrantPlotModule = /** @class */ (function () {
function QuadrantPlotModule() {
}
QuadrantPlotModule = __decorate([
NgModule({
declarations: [
QuadrantPlotComponent,
QuadrantPlotDirective,
],
exports: [
QuadrantPlotComponent,
QuadrantPlotDirective,
]
})
], QuadrantPlotModule);
return QuadrantPlotModule;
}());
export { QuadrantPlotComponent, QuadrantPlotDirective, QuadrantPlotModule };