@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 16.5 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var RainScatteredDirective_1;
let RainScatteredComponent = class RainScatteredComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RainScatteredComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RainScatteredComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredComponent.prototype, "size", void 0);
RainScatteredComponent = __decorate([
Component({
selector: "ibm-icon-rain-scattered",
template: `
<svg
ibmIconRainScattered
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], RainScatteredComponent);
let RainScatteredDirective = RainScatteredDirective_1 = class RainScatteredDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "RainScattered32", "filepath": "rain--scattered/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.0127,1.0127,0,0,1-.4485-.1054.9986.9986,0,0,1-.4486-1.3418l1.4934-3.0005a1.0025,1.0025,0,0,1,1.7943.8945l-1.4934,3A1.0013,1.0013,0,0,1,8.5084,32Z" } }, { "elem": "path", "attrs": { "d": "M27.232 15.733H29.232V18.733H27.232z", "transform": "rotate(-45.009 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M29 10H32V12H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M20 0H22V3H20z" } }, { "elem": "path", "attrs": { "d": "M12.768 3.268H14.768V6.268H12.768z", "transform": "rotate(-45 13.768 4.768)" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25h7.3818L14.106,27.5527a1,1,0,1,0,1.7885.8946L17.6177,25H19a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11ZM19,23H8a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23Zm3.9268-8.5107a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z" } }], "name": "rain--scattered", "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.0127,1.0127,0,0,1-.4485-.1054.9986.9986,0,0,1-.4486-1.3418l1.4934-3.0005a1.0025,1.0025,0,0,1,1.7943.8945l-1.4934,3A1.0013,1.0013,0,0,1,8.5084,32Z"></path><path d="M27.232 15.733H29.232V18.733H27.232z" transform="rotate(-45.009 28.232 17.233)"></path><path d="M29 10H32V12H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M20 0H22V3H20z"></path><path d="M12.768 3.268H14.768V6.268H12.768z" transform="rotate(-45 13.768 4.768)"></path><path d="M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25h7.3818L14.106,27.5527a1,1,0,1,0,1.7885.8946L17.6177,25H19a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11ZM19,23H8a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23Zm3.9268-8.5107a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z"></path></svg>`
},
"24": {
metadata: { "moduleName": "RainScattered24", "filepath": "rain--scattered/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.0127,1.0127,0,0,1-.4485-.1054.9986.9986,0,0,1-.4486-1.3418l1.4934-3.0005a1.0025,1.0025,0,0,1,1.7943.8945l-1.4934,3A1.0013,1.0013,0,0,1,8.5084,32Z" } }, { "elem": "path", "attrs": { "d": "M27.232 15.733H29.232V18.733H27.232z", "transform": "rotate(-45.009 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M29 10H32V12H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M20 0H22V3H20z" } }, { "elem": "path", "attrs": { "d": "M12.768 3.268H14.768V6.268H12.768z", "transform": "rotate(-45 13.768 4.768)" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25h7.3818L14.106,27.5527a1,1,0,1,0,1.7885.8946L17.6177,25H19a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11ZM19,23H8a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23Zm3.9268-8.5107a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z" } }], "name": "rain--scattered", "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.0127,1.0127,0,0,1-.4485-.1054.9986.9986,0,0,1-.4486-1.3418l1.4934-3.0005a1.0025,1.0025,0,0,1,1.7943.8945l-1.4934,3A1.0013,1.0013,0,0,1,8.5084,32Z"></path><path d="M27.232 15.733H29.232V18.733H27.232z" transform="rotate(-45.009 28.232 17.233)"></path><path d="M29 10H32V12H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M20 0H22V3H20z"></path><path d="M12.768 3.268H14.768V6.268H12.768z" transform="rotate(-45 13.768 4.768)"></path><path d="M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25h7.3818L14.106,27.5527a1,1,0,1,0,1.7885.8946L17.6177,25H19a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11ZM19,23H8a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23Zm3.9268-8.5107a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z"></path></svg>`
},
"20": {
metadata: { "moduleName": "RainScattered20", "filepath": "rain--scattered/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.0127,1.0127,0,0,1-.4485-.1054.9986.9986,0,0,1-.4486-1.3418l1.4934-3.0005a1.0025,1.0025,0,0,1,1.7943.8945l-1.4934,3A1.0013,1.0013,0,0,1,8.5084,32Z" } }, { "elem": "path", "attrs": { "d": "M27.232 15.733H29.232V18.733H27.232z", "transform": "rotate(-45.009 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M29 10H32V12H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M20 0H22V3H20z" } }, { "elem": "path", "attrs": { "d": "M12.768 3.268H14.768V6.268H12.768z", "transform": "rotate(-45 13.768 4.768)" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25h7.3818L14.106,27.5527a1,1,0,1,0,1.7885.8946L17.6177,25H19a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11ZM19,23H8a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23Zm3.9268-8.5107a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z" } }], "name": "rain--scattered", "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.0127,1.0127,0,0,1-.4485-.1054.9986.9986,0,0,1-.4486-1.3418l1.4934-3.0005a1.0025,1.0025,0,0,1,1.7943.8945l-1.4934,3A1.0013,1.0013,0,0,1,8.5084,32Z"></path><path d="M27.232 15.733H29.232V18.733H27.232z" transform="rotate(-45.009 28.232 17.233)"></path><path d="M29 10H32V12H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M20 0H22V3H20z"></path><path d="M12.768 3.268H14.768V6.268H12.768z" transform="rotate(-45 13.768 4.768)"></path><path d="M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25h7.3818L14.106,27.5527a1,1,0,1,0,1.7885.8946L17.6177,25H19a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11ZM19,23H8a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23Zm3.9268-8.5107a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z"></path></svg>`
},
"16": {
metadata: { "moduleName": "RainScattered16", "filepath": "rain--scattered/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.0127,1.0127,0,0,1-.4485-.1054.9986.9986,0,0,1-.4486-1.3418l1.4934-3.0005a1.0025,1.0025,0,0,1,1.7943.8945l-1.4934,3A1.0013,1.0013,0,0,1,8.5084,32Z" } }, { "elem": "path", "attrs": { "d": "M27.232 15.733H29.232V18.733H27.232z", "transform": "rotate(-45.009 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M29 10H32V12H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M20 0H22V3H20z" } }, { "elem": "path", "attrs": { "d": "M12.768 3.268H14.768V6.268H12.768z", "transform": "rotate(-45 13.768 4.768)" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25h7.3818L14.106,27.5527a1,1,0,1,0,1.7885.8946L17.6177,25H19a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11ZM19,23H8a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23Zm3.9268-8.5107a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z" } }], "name": "rain--scattered", "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.0127,1.0127,0,0,1-.4485-.1054.9986.9986,0,0,1-.4486-1.3418l1.4934-3.0005a1.0025,1.0025,0,0,1,1.7943.8945l-1.4934,3A1.0013,1.0013,0,0,1,8.5084,32Z"></path><path d="M27.232 15.733H29.232V18.733H27.232z" transform="rotate(-45.009 28.232 17.233)"></path><path d="M29 10H32V12H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M20 0H22V3H20z"></path><path d="M12.768 3.268H14.768V6.268H12.768z" transform="rotate(-45 13.768 4.768)"></path><path d="M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25h7.3818L14.106,27.5527a1,1,0,1,0,1.7885.8946L17.6177,25H19a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11ZM19,23H8a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23Zm3.9268-8.5107a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z"></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;
RainScatteredDirective_1.titleIdCounter++;
title.setAttribute("id", `rain-scattered-${RainScatteredDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `rain-scattered-${RainScatteredDirective_1.titleIdCounter}`);
}
}
};
RainScatteredDirective.titleIdCounter = 0;
RainScatteredDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RainScatteredDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RainScatteredDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], RainScatteredDirective.prototype, "size", void 0);
RainScatteredDirective = RainScatteredDirective_1 = __decorate([
Directive({
selector: "[ibmIconRainScattered]"
}),
__metadata("design:paramtypes", [ElementRef])
], RainScatteredDirective);
let RainScatteredModule = class RainScatteredModule {
};
RainScatteredModule = __decorate([
NgModule({
declarations: [
RainScatteredComponent,
RainScatteredDirective,
],
exports: [
RainScatteredComponent,
RainScatteredDirective,
]
})
], RainScatteredModule);
export { RainScatteredComponent, RainScatteredDirective, RainScatteredModule };