@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 15.5 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var RainScatteredNightDirective_1;
let RainScatteredNightComponent = class RainScatteredNightComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RainScatteredNightComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RainScatteredNightComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightComponent.prototype, "size", void 0);
RainScatteredNightComponent = __decorate([
Component({
selector: "ibm-icon-rain-scattered-night",
template: `
<svg
ibmIconRainScatteredNight
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], RainScatteredNightComponent);
let RainScatteredNightDirective = RainScatteredNightDirective_1 = class RainScatteredNightDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "RainScatteredNight32", "filepath": "rain--scattered--night/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": "M8.5084 32a1.0115 1.0115 0 01-.4485-.1055.9986.9986 0 01-.4486-1.3418l1.4934-3a1.0025 1.0025 0 011.7943.8945l-1.4934 3A1.0015 1.0015 0 018.5084 32zM29.8442 13.0347a1.5184 1.5184 0 00-1.2309-.8658 5.3587 5.3587 0 01-3.4094-1.7163 6.4648 6.4648 0 01-1.285-6.393 1.6031 1.6031 0 00-.3-1.5459 1.4535 1.4535 0 00-1.3594-.4922l-.0191.0029a7.8549 7.8549 0 00-6.1054 6.48A7.3725 7.3725 0 0013.5 8a7.5511 7.5511 0 00-7.1494 5.2441A5.9926 5.9926 0 008 25h7.3818L14.106 27.5527a1 1 0 101.7885.8946L17.6177 25H19a5.9549 5.9549 0 005.88-7.1455 7.5 7.5 0 004.8672-3.3A1.5381 1.5381 0 0029.8442 13.0347zM19 23H8a3.9926 3.9926 0 01-.6733-7.9292l.663-.1128.1456-.6562a5.496 5.496 0 0110.7294 0l.1456.6562.6626.1128A3.9925 3.9925 0 0119 23zm5.1509-7.0479a5.9639 5.9639 0 00-3.5015-2.708A7.5076 7.5076 0 0018.0286 9.55a6.01 6.01 0 013.77-5.334 8.4581 8.4581 0 001.9395 7.5972A7.4007 7.4007 0 0027.64 14.041 5.4392 5.4392 0 0124.1509 15.9521z" } }], "name": "rain--scattered--night", "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="M8.5084 32a1.0115 1.0115 0 01-.4485-.1055.9986.9986 0 01-.4486-1.3418l1.4934-3a1.0025 1.0025 0 011.7943.8945l-1.4934 3A1.0015 1.0015 0 018.5084 32zM29.8442 13.0347a1.5184 1.5184 0 00-1.2309-.8658 5.3587 5.3587 0 01-3.4094-1.7163 6.4648 6.4648 0 01-1.285-6.393 1.6031 1.6031 0 00-.3-1.5459 1.4535 1.4535 0 00-1.3594-.4922l-.0191.0029a7.8549 7.8549 0 00-6.1054 6.48A7.3725 7.3725 0 0013.5 8a7.5511 7.5511 0 00-7.1494 5.2441A5.9926 5.9926 0 008 25h7.3818L14.106 27.5527a1 1 0 101.7885.8946L17.6177 25H19a5.9549 5.9549 0 005.88-7.1455 7.5 7.5 0 004.8672-3.3A1.5381 1.5381 0 0029.8442 13.0347zM19 23H8a3.9926 3.9926 0 01-.6733-7.9292l.663-.1128.1456-.6562a5.496 5.496 0 0110.7294 0l.1456.6562.6626.1128A3.9925 3.9925 0 0119 23zm5.1509-7.0479a5.9639 5.9639 0 00-3.5015-2.708A7.5076 7.5076 0 0018.0286 9.55a6.01 6.01 0 013.77-5.334 8.4581 8.4581 0 001.9395 7.5972A7.4007 7.4007 0 0027.64 14.041 5.4392 5.4392 0 0124.1509 15.9521z"></path></svg>`
},
"24": {
metadata: { "moduleName": "RainScatteredNight24", "filepath": "rain--scattered--night/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": "M8.5084 32a1.0115 1.0115 0 01-.4485-.1055.9986.9986 0 01-.4486-1.3418l1.4934-3a1.0025 1.0025 0 011.7943.8945l-1.4934 3A1.0015 1.0015 0 018.5084 32zM29.8442 13.0347a1.5184 1.5184 0 00-1.2309-.8658 5.3587 5.3587 0 01-3.4094-1.7163 6.4648 6.4648 0 01-1.285-6.393 1.6031 1.6031 0 00-.3-1.5459 1.4535 1.4535 0 00-1.3594-.4922l-.0191.0029a7.8549 7.8549 0 00-6.1054 6.48A7.3725 7.3725 0 0013.5 8a7.5511 7.5511 0 00-7.1494 5.2441A5.9926 5.9926 0 008 25h7.3818L14.106 27.5527a1 1 0 101.7885.8946L17.6177 25H19a5.9549 5.9549 0 005.88-7.1455 7.5 7.5 0 004.8672-3.3A1.5381 1.5381 0 0029.8442 13.0347zM19 23H8a3.9926 3.9926 0 01-.6733-7.9292l.663-.1128.1456-.6562a5.496 5.496 0 0110.7294 0l.1456.6562.6626.1128A3.9925 3.9925 0 0119 23zm5.1509-7.0479a5.9639 5.9639 0 00-3.5015-2.708A7.5076 7.5076 0 0018.0286 9.55a6.01 6.01 0 013.77-5.334 8.4581 8.4581 0 001.9395 7.5972A7.4007 7.4007 0 0027.64 14.041 5.4392 5.4392 0 0124.1509 15.9521z" } }], "name": "rain--scattered--night", "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="M8.5084 32a1.0115 1.0115 0 01-.4485-.1055.9986.9986 0 01-.4486-1.3418l1.4934-3a1.0025 1.0025 0 011.7943.8945l-1.4934 3A1.0015 1.0015 0 018.5084 32zM29.8442 13.0347a1.5184 1.5184 0 00-1.2309-.8658 5.3587 5.3587 0 01-3.4094-1.7163 6.4648 6.4648 0 01-1.285-6.393 1.6031 1.6031 0 00-.3-1.5459 1.4535 1.4535 0 00-1.3594-.4922l-.0191.0029a7.8549 7.8549 0 00-6.1054 6.48A7.3725 7.3725 0 0013.5 8a7.5511 7.5511 0 00-7.1494 5.2441A5.9926 5.9926 0 008 25h7.3818L14.106 27.5527a1 1 0 101.7885.8946L17.6177 25H19a5.9549 5.9549 0 005.88-7.1455 7.5 7.5 0 004.8672-3.3A1.5381 1.5381 0 0029.8442 13.0347zM19 23H8a3.9926 3.9926 0 01-.6733-7.9292l.663-.1128.1456-.6562a5.496 5.496 0 0110.7294 0l.1456.6562.6626.1128A3.9925 3.9925 0 0119 23zm5.1509-7.0479a5.9639 5.9639 0 00-3.5015-2.708A7.5076 7.5076 0 0018.0286 9.55a6.01 6.01 0 013.77-5.334 8.4581 8.4581 0 001.9395 7.5972A7.4007 7.4007 0 0027.64 14.041 5.4392 5.4392 0 0124.1509 15.9521z"></path></svg>`
},
"20": {
metadata: { "moduleName": "RainScatteredNight20", "filepath": "rain--scattered--night/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": "M8.5084 32a1.0115 1.0115 0 01-.4485-.1055.9986.9986 0 01-.4486-1.3418l1.4934-3a1.0025 1.0025 0 011.7943.8945l-1.4934 3A1.0015 1.0015 0 018.5084 32zM29.8442 13.0347a1.5184 1.5184 0 00-1.2309-.8658 5.3587 5.3587 0 01-3.4094-1.7163 6.4648 6.4648 0 01-1.285-6.393 1.6031 1.6031 0 00-.3-1.5459 1.4535 1.4535 0 00-1.3594-.4922l-.0191.0029a7.8549 7.8549 0 00-6.1054 6.48A7.3725 7.3725 0 0013.5 8a7.5511 7.5511 0 00-7.1494 5.2441A5.9926 5.9926 0 008 25h7.3818L14.106 27.5527a1 1 0 101.7885.8946L17.6177 25H19a5.9549 5.9549 0 005.88-7.1455 7.5 7.5 0 004.8672-3.3A1.5381 1.5381 0 0029.8442 13.0347zM19 23H8a3.9926 3.9926 0 01-.6733-7.9292l.663-.1128.1456-.6562a5.496 5.496 0 0110.7294 0l.1456.6562.6626.1128A3.9925 3.9925 0 0119 23zm5.1509-7.0479a5.9639 5.9639 0 00-3.5015-2.708A7.5076 7.5076 0 0018.0286 9.55a6.01 6.01 0 013.77-5.334 8.4581 8.4581 0 001.9395 7.5972A7.4007 7.4007 0 0027.64 14.041 5.4392 5.4392 0 0124.1509 15.9521z" } }], "name": "rain--scattered--night", "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="M8.5084 32a1.0115 1.0115 0 01-.4485-.1055.9986.9986 0 01-.4486-1.3418l1.4934-3a1.0025 1.0025 0 011.7943.8945l-1.4934 3A1.0015 1.0015 0 018.5084 32zM29.8442 13.0347a1.5184 1.5184 0 00-1.2309-.8658 5.3587 5.3587 0 01-3.4094-1.7163 6.4648 6.4648 0 01-1.285-6.393 1.6031 1.6031 0 00-.3-1.5459 1.4535 1.4535 0 00-1.3594-.4922l-.0191.0029a7.8549 7.8549 0 00-6.1054 6.48A7.3725 7.3725 0 0013.5 8a7.5511 7.5511 0 00-7.1494 5.2441A5.9926 5.9926 0 008 25h7.3818L14.106 27.5527a1 1 0 101.7885.8946L17.6177 25H19a5.9549 5.9549 0 005.88-7.1455 7.5 7.5 0 004.8672-3.3A1.5381 1.5381 0 0029.8442 13.0347zM19 23H8a3.9926 3.9926 0 01-.6733-7.9292l.663-.1128.1456-.6562a5.496 5.496 0 0110.7294 0l.1456.6562.6626.1128A3.9925 3.9925 0 0119 23zm5.1509-7.0479a5.9639 5.9639 0 00-3.5015-2.708A7.5076 7.5076 0 0018.0286 9.55a6.01 6.01 0 013.77-5.334 8.4581 8.4581 0 001.9395 7.5972A7.4007 7.4007 0 0027.64 14.041 5.4392 5.4392 0 0124.1509 15.9521z"></path></svg>`
},
"16": {
metadata: { "moduleName": "RainScatteredNight16", "filepath": "rain--scattered--night/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": "M8.5084 32a1.0115 1.0115 0 01-.4485-.1055.9986.9986 0 01-.4486-1.3418l1.4934-3a1.0025 1.0025 0 011.7943.8945l-1.4934 3A1.0015 1.0015 0 018.5084 32zM29.8442 13.0347a1.5184 1.5184 0 00-1.2309-.8658 5.3587 5.3587 0 01-3.4094-1.7163 6.4648 6.4648 0 01-1.285-6.393 1.6031 1.6031 0 00-.3-1.5459 1.4535 1.4535 0 00-1.3594-.4922l-.0191.0029a7.8549 7.8549 0 00-6.1054 6.48A7.3725 7.3725 0 0013.5 8a7.5511 7.5511 0 00-7.1494 5.2441A5.9926 5.9926 0 008 25h7.3818L14.106 27.5527a1 1 0 101.7885.8946L17.6177 25H19a5.9549 5.9549 0 005.88-7.1455 7.5 7.5 0 004.8672-3.3A1.5381 1.5381 0 0029.8442 13.0347zM19 23H8a3.9926 3.9926 0 01-.6733-7.9292l.663-.1128.1456-.6562a5.496 5.496 0 0110.7294 0l.1456.6562.6626.1128A3.9925 3.9925 0 0119 23zm5.1509-7.0479a5.9639 5.9639 0 00-3.5015-2.708A7.5076 7.5076 0 0018.0286 9.55a6.01 6.01 0 013.77-5.334 8.4581 8.4581 0 001.9395 7.5972A7.4007 7.4007 0 0027.64 14.041 5.4392 5.4392 0 0124.1509 15.9521z" } }], "name": "rain--scattered--night", "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="M8.5084 32a1.0115 1.0115 0 01-.4485-.1055.9986.9986 0 01-.4486-1.3418l1.4934-3a1.0025 1.0025 0 011.7943.8945l-1.4934 3A1.0015 1.0015 0 018.5084 32zM29.8442 13.0347a1.5184 1.5184 0 00-1.2309-.8658 5.3587 5.3587 0 01-3.4094-1.7163 6.4648 6.4648 0 01-1.285-6.393 1.6031 1.6031 0 00-.3-1.5459 1.4535 1.4535 0 00-1.3594-.4922l-.0191.0029a7.8549 7.8549 0 00-6.1054 6.48A7.3725 7.3725 0 0013.5 8a7.5511 7.5511 0 00-7.1494 5.2441A5.9926 5.9926 0 008 25h7.3818L14.106 27.5527a1 1 0 101.7885.8946L17.6177 25H19a5.9549 5.9549 0 005.88-7.1455 7.5 7.5 0 004.8672-3.3A1.5381 1.5381 0 0029.8442 13.0347zM19 23H8a3.9926 3.9926 0 01-.6733-7.9292l.663-.1128.1456-.6562a5.496 5.496 0 0110.7294 0l.1456.6562.6626.1128A3.9925 3.9925 0 0119 23zm5.1509-7.0479a5.9639 5.9639 0 00-3.5015-2.708A7.5076 7.5076 0 0018.0286 9.55a6.01 6.01 0 013.77-5.334 8.4581 8.4581 0 001.9395 7.5972A7.4007 7.4007 0 0027.64 14.041 5.4392 5.4392 0 0124.1509 15.9521z"></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;
RainScatteredNightDirective_1.titleIdCounter++;
title.setAttribute("id", `rain-scattered-night-${RainScatteredNightDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `rain-scattered-night-${RainScatteredNightDirective_1.titleIdCounter}`);
}
}
};
RainScatteredNightDirective.titleIdCounter = 0;
RainScatteredNightDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RainScatteredNightDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RainScatteredNightDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredNightDirective.prototype, "size", void 0);
RainScatteredNightDirective = RainScatteredNightDirective_1 = __decorate([
Directive({
selector: "[ibmIconRainScatteredNight]"
}),
__metadata("design:paramtypes", [ElementRef])
], RainScatteredNightDirective);
let RainScatteredNightModule = class RainScatteredNightModule {
};
RainScatteredNightModule = __decorate([
NgModule({
declarations: [
RainScatteredNightComponent,
RainScatteredNightDirective,
],
exports: [
RainScatteredNightComponent,
RainScatteredNightDirective,
]
})
], RainScatteredNightModule);
export { RainScatteredNightComponent, RainScatteredNightDirective, RainScatteredNightModule };