@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 14.7 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var ChartAreaSmoothDirective_1;
let ChartAreaSmoothComponent = class ChartAreaSmoothComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], ChartAreaSmoothComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], ChartAreaSmoothComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothComponent.prototype, "size", void 0);
ChartAreaSmoothComponent = __decorate([
Component({
selector: "ibm-icon-chart-area-smooth",
template: `
<svg
ibmIconChartAreaSmooth
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], ChartAreaSmoothComponent);
let ChartAreaSmoothDirective = ChartAreaSmoothDirective_1 = class ChartAreaSmoothDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "ChartAreaSmooth32", "filepath": "chart--area-smooth/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,6.6143l-1.3152.4365A20.9218,20.9218,0,0,1,23,8c-1.7344,0-3.3225-.9072-5.0039-1.8682C16.1621,5.084,14.2656,4,12,4,9.123,4,5.9146,6.2061,4,7.772V2H2V28a2.0025,2.0025,0,0,0,2,2H30ZM4,20.2944C5.874,17.3765,9.56,13,12,13c1.6379,0,2.96,1.1016,4.36,2.2686C17.8965,16.5488,19.6379,18,22,18a9.4686,9.4686,0,0,0,6-2.5288v4.9556A13.0026,13.0026,0,0,1,22,22a13.8619,13.8619,0,0,1-4.6838-.9487A15.682,15.682,0,0,0,12,20c-2.927,0-6.0676,2.959-8,5.1577ZM12,6c1.7344,0,3.3225.9072,5.0039,1.8682C18.8379,8.916,20.7344,10,23,10a21.432,21.432,0,0,0,5-.6782v3.3213C27.3167,13.4463,24.9155,16,22,16c-1.6379,0-2.96-1.1016-4.36-2.2686C16.1035,12.4512,14.3621,11,12,11c-2.9358,0-6.0632,3.3394-8,5.8447V10.4238C5.5461,8.9658,9.2588,6,12,6ZM4.249,28C5.8623,25.9087,9.41,22,12,22a13.8619,13.8619,0,0,1,4.6838.9487A15.682,15.682,0,0,0,22,24a14.7362,14.7362,0,0,0,6-1.34V28Z" } }], "name": "chart--area-smooth", "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,6.6143l-1.3152.4365A20.9218,20.9218,0,0,1,23,8c-1.7344,0-3.3225-.9072-5.0039-1.8682C16.1621,5.084,14.2656,4,12,4,9.123,4,5.9146,6.2061,4,7.772V2H2V28a2.0025,2.0025,0,0,0,2,2H30ZM4,20.2944C5.874,17.3765,9.56,13,12,13c1.6379,0,2.96,1.1016,4.36,2.2686C17.8965,16.5488,19.6379,18,22,18a9.4686,9.4686,0,0,0,6-2.5288v4.9556A13.0026,13.0026,0,0,1,22,22a13.8619,13.8619,0,0,1-4.6838-.9487A15.682,15.682,0,0,0,12,20c-2.927,0-6.0676,2.959-8,5.1577ZM12,6c1.7344,0,3.3225.9072,5.0039,1.8682C18.8379,8.916,20.7344,10,23,10a21.432,21.432,0,0,0,5-.6782v3.3213C27.3167,13.4463,24.9155,16,22,16c-1.6379,0-2.96-1.1016-4.36-2.2686C16.1035,12.4512,14.3621,11,12,11c-2.9358,0-6.0632,3.3394-8,5.8447V10.4238C5.5461,8.9658,9.2588,6,12,6ZM4.249,28C5.8623,25.9087,9.41,22,12,22a13.8619,13.8619,0,0,1,4.6838.9487A15.682,15.682,0,0,0,22,24a14.7362,14.7362,0,0,0,6-1.34V28Z"></path></svg>`
},
"24": {
metadata: { "moduleName": "ChartAreaSmooth24", "filepath": "chart--area-smooth/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,6.6143l-1.3152.4365A20.9218,20.9218,0,0,1,23,8c-1.7344,0-3.3225-.9072-5.0039-1.8682C16.1621,5.084,14.2656,4,12,4,9.123,4,5.9146,6.2061,4,7.772V2H2V28a2.0025,2.0025,0,0,0,2,2H30ZM4,20.2944C5.874,17.3765,9.56,13,12,13c1.6379,0,2.96,1.1016,4.36,2.2686C17.8965,16.5488,19.6379,18,22,18a9.4686,9.4686,0,0,0,6-2.5288v4.9556A13.0026,13.0026,0,0,1,22,22a13.8619,13.8619,0,0,1-4.6838-.9487A15.682,15.682,0,0,0,12,20c-2.927,0-6.0676,2.959-8,5.1577ZM12,6c1.7344,0,3.3225.9072,5.0039,1.8682C18.8379,8.916,20.7344,10,23,10a21.432,21.432,0,0,0,5-.6782v3.3213C27.3167,13.4463,24.9155,16,22,16c-1.6379,0-2.96-1.1016-4.36-2.2686C16.1035,12.4512,14.3621,11,12,11c-2.9358,0-6.0632,3.3394-8,5.8447V10.4238C5.5461,8.9658,9.2588,6,12,6ZM4.249,28C5.8623,25.9087,9.41,22,12,22a13.8619,13.8619,0,0,1,4.6838.9487A15.682,15.682,0,0,0,22,24a14.7362,14.7362,0,0,0,6-1.34V28Z" } }], "name": "chart--area-smooth", "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,6.6143l-1.3152.4365A20.9218,20.9218,0,0,1,23,8c-1.7344,0-3.3225-.9072-5.0039-1.8682C16.1621,5.084,14.2656,4,12,4,9.123,4,5.9146,6.2061,4,7.772V2H2V28a2.0025,2.0025,0,0,0,2,2H30ZM4,20.2944C5.874,17.3765,9.56,13,12,13c1.6379,0,2.96,1.1016,4.36,2.2686C17.8965,16.5488,19.6379,18,22,18a9.4686,9.4686,0,0,0,6-2.5288v4.9556A13.0026,13.0026,0,0,1,22,22a13.8619,13.8619,0,0,1-4.6838-.9487A15.682,15.682,0,0,0,12,20c-2.927,0-6.0676,2.959-8,5.1577ZM12,6c1.7344,0,3.3225.9072,5.0039,1.8682C18.8379,8.916,20.7344,10,23,10a21.432,21.432,0,0,0,5-.6782v3.3213C27.3167,13.4463,24.9155,16,22,16c-1.6379,0-2.96-1.1016-4.36-2.2686C16.1035,12.4512,14.3621,11,12,11c-2.9358,0-6.0632,3.3394-8,5.8447V10.4238C5.5461,8.9658,9.2588,6,12,6ZM4.249,28C5.8623,25.9087,9.41,22,12,22a13.8619,13.8619,0,0,1,4.6838.9487A15.682,15.682,0,0,0,22,24a14.7362,14.7362,0,0,0,6-1.34V28Z"></path></svg>`
},
"20": {
metadata: { "moduleName": "ChartAreaSmooth20", "filepath": "chart--area-smooth/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,6.6143l-1.3152.4365A20.9218,20.9218,0,0,1,23,8c-1.7344,0-3.3225-.9072-5.0039-1.8682C16.1621,5.084,14.2656,4,12,4,9.123,4,5.9146,6.2061,4,7.772V2H2V28a2.0025,2.0025,0,0,0,2,2H30ZM4,20.2944C5.874,17.3765,9.56,13,12,13c1.6379,0,2.96,1.1016,4.36,2.2686C17.8965,16.5488,19.6379,18,22,18a9.4686,9.4686,0,0,0,6-2.5288v4.9556A13.0026,13.0026,0,0,1,22,22a13.8619,13.8619,0,0,1-4.6838-.9487A15.682,15.682,0,0,0,12,20c-2.927,0-6.0676,2.959-8,5.1577ZM12,6c1.7344,0,3.3225.9072,5.0039,1.8682C18.8379,8.916,20.7344,10,23,10a21.432,21.432,0,0,0,5-.6782v3.3213C27.3167,13.4463,24.9155,16,22,16c-1.6379,0-2.96-1.1016-4.36-2.2686C16.1035,12.4512,14.3621,11,12,11c-2.9358,0-6.0632,3.3394-8,5.8447V10.4238C5.5461,8.9658,9.2588,6,12,6ZM4.249,28C5.8623,25.9087,9.41,22,12,22a13.8619,13.8619,0,0,1,4.6838.9487A15.682,15.682,0,0,0,22,24a14.7362,14.7362,0,0,0,6-1.34V28Z" } }], "name": "chart--area-smooth", "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,6.6143l-1.3152.4365A20.9218,20.9218,0,0,1,23,8c-1.7344,0-3.3225-.9072-5.0039-1.8682C16.1621,5.084,14.2656,4,12,4,9.123,4,5.9146,6.2061,4,7.772V2H2V28a2.0025,2.0025,0,0,0,2,2H30ZM4,20.2944C5.874,17.3765,9.56,13,12,13c1.6379,0,2.96,1.1016,4.36,2.2686C17.8965,16.5488,19.6379,18,22,18a9.4686,9.4686,0,0,0,6-2.5288v4.9556A13.0026,13.0026,0,0,1,22,22a13.8619,13.8619,0,0,1-4.6838-.9487A15.682,15.682,0,0,0,12,20c-2.927,0-6.0676,2.959-8,5.1577ZM12,6c1.7344,0,3.3225.9072,5.0039,1.8682C18.8379,8.916,20.7344,10,23,10a21.432,21.432,0,0,0,5-.6782v3.3213C27.3167,13.4463,24.9155,16,22,16c-1.6379,0-2.96-1.1016-4.36-2.2686C16.1035,12.4512,14.3621,11,12,11c-2.9358,0-6.0632,3.3394-8,5.8447V10.4238C5.5461,8.9658,9.2588,6,12,6ZM4.249,28C5.8623,25.9087,9.41,22,12,22a13.8619,13.8619,0,0,1,4.6838.9487A15.682,15.682,0,0,0,22,24a14.7362,14.7362,0,0,0,6-1.34V28Z"></path></svg>`
},
"16": {
metadata: { "moduleName": "ChartAreaSmooth16", "filepath": "chart--area-smooth/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,6.6143l-1.3152.4365A20.9218,20.9218,0,0,1,23,8c-1.7344,0-3.3225-.9072-5.0039-1.8682C16.1621,5.084,14.2656,4,12,4,9.123,4,5.9146,6.2061,4,7.772V2H2V28a2.0025,2.0025,0,0,0,2,2H30ZM4,20.2944C5.874,17.3765,9.56,13,12,13c1.6379,0,2.96,1.1016,4.36,2.2686C17.8965,16.5488,19.6379,18,22,18a9.4686,9.4686,0,0,0,6-2.5288v4.9556A13.0026,13.0026,0,0,1,22,22a13.8619,13.8619,0,0,1-4.6838-.9487A15.682,15.682,0,0,0,12,20c-2.927,0-6.0676,2.959-8,5.1577ZM12,6c1.7344,0,3.3225.9072,5.0039,1.8682C18.8379,8.916,20.7344,10,23,10a21.432,21.432,0,0,0,5-.6782v3.3213C27.3167,13.4463,24.9155,16,22,16c-1.6379,0-2.96-1.1016-4.36-2.2686C16.1035,12.4512,14.3621,11,12,11c-2.9358,0-6.0632,3.3394-8,5.8447V10.4238C5.5461,8.9658,9.2588,6,12,6ZM4.249,28C5.8623,25.9087,9.41,22,12,22a13.8619,13.8619,0,0,1,4.6838.9487A15.682,15.682,0,0,0,22,24a14.7362,14.7362,0,0,0,6-1.34V28Z" } }], "name": "chart--area-smooth", "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,6.6143l-1.3152.4365A20.9218,20.9218,0,0,1,23,8c-1.7344,0-3.3225-.9072-5.0039-1.8682C16.1621,5.084,14.2656,4,12,4,9.123,4,5.9146,6.2061,4,7.772V2H2V28a2.0025,2.0025,0,0,0,2,2H30ZM4,20.2944C5.874,17.3765,9.56,13,12,13c1.6379,0,2.96,1.1016,4.36,2.2686C17.8965,16.5488,19.6379,18,22,18a9.4686,9.4686,0,0,0,6-2.5288v4.9556A13.0026,13.0026,0,0,1,22,22a13.8619,13.8619,0,0,1-4.6838-.9487A15.682,15.682,0,0,0,12,20c-2.927,0-6.0676,2.959-8,5.1577ZM12,6c1.7344,0,3.3225.9072,5.0039,1.8682C18.8379,8.916,20.7344,10,23,10a21.432,21.432,0,0,0,5-.6782v3.3213C27.3167,13.4463,24.9155,16,22,16c-1.6379,0-2.96-1.1016-4.36-2.2686C16.1035,12.4512,14.3621,11,12,11c-2.9358,0-6.0632,3.3394-8,5.8447V10.4238C5.5461,8.9658,9.2588,6,12,6ZM4.249,28C5.8623,25.9087,9.41,22,12,22a13.8619,13.8619,0,0,1,4.6838.9487A15.682,15.682,0,0,0,22,24a14.7362,14.7362,0,0,0,6-1.34V28Z"></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;
ChartAreaSmoothDirective_1.titleIdCounter++;
title.setAttribute("id", `chart-area-smooth-${ChartAreaSmoothDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `chart-area-smooth-${ChartAreaSmoothDirective_1.titleIdCounter}`);
}
}
};
ChartAreaSmoothDirective.titleIdCounter = 0;
ChartAreaSmoothDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], ChartAreaSmoothDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], ChartAreaSmoothDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], ChartAreaSmoothDirective.prototype, "size", void 0);
ChartAreaSmoothDirective = ChartAreaSmoothDirective_1 = __decorate([
Directive({
selector: "[ibmIconChartAreaSmooth]"
}),
__metadata("design:paramtypes", [ElementRef])
], ChartAreaSmoothDirective);
let ChartAreaSmoothModule = class ChartAreaSmoothModule {
};
ChartAreaSmoothModule = __decorate([
NgModule({
declarations: [
ChartAreaSmoothComponent,
ChartAreaSmoothDirective,
],
exports: [
ChartAreaSmoothComponent,
ChartAreaSmoothDirective,
]
})
], ChartAreaSmoothModule);
export { ChartAreaSmoothComponent, ChartAreaSmoothDirective, ChartAreaSmoothModule };