@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 10.3 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var NotificationOffFilledDirective_1;
let NotificationOffFilledComponent = class NotificationOffFilledComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], NotificationOffFilledComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], NotificationOffFilledComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledComponent.prototype, "size", void 0);
NotificationOffFilledComponent = __decorate([
Component({
selector: "ibm-icon-notification-off-filled",
template: `
<svg
ibmIconNotificationOffFilled
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], NotificationOffFilledComponent);
let NotificationOffFilledDirective = NotificationOffFilledDirective_1 = class NotificationOffFilledDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "NotificationOffFilled32", "filepath": "notification--off--filled/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": "M26 17.6V13a10 10 0 00-1.09-4.5L30 3.41 28.59 2 2 28.59 3.41 30l5-5H11a5 5 0 0010 0h7a.94.94 0 001-1V21a.91.91 0 00-.3-.7zM16 28a3 3 0 01-3-3h6A3 3 0 0116 28zM21.63 4.72A9.78 9.78 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2.34z" } }], "name": "notification--off--filled", "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="M26 17.6V13a10 10 0 00-1.09-4.5L30 3.41 28.59 2 2 28.59 3.41 30l5-5H11a5 5 0 0010 0h7a.94.94 0 001-1V21a.91.91 0 00-.3-.7zM16 28a3 3 0 01-3-3h6A3 3 0 0116 28zM21.63 4.72A9.78 9.78 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2.34z"></path></svg>`
},
"24": {
metadata: { "moduleName": "NotificationOffFilled24", "filepath": "notification--off--filled/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": "M26 17.6V13a10 10 0 00-1.09-4.5L30 3.41 28.59 2 2 28.59 3.41 30l5-5H11a5 5 0 0010 0h7a.94.94 0 001-1V21a.91.91 0 00-.3-.7zM16 28a3 3 0 01-3-3h6A3 3 0 0116 28zM21.63 4.72A9.78 9.78 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2.34z" } }], "name": "notification--off--filled", "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="M26 17.6V13a10 10 0 00-1.09-4.5L30 3.41 28.59 2 2 28.59 3.41 30l5-5H11a5 5 0 0010 0h7a.94.94 0 001-1V21a.91.91 0 00-.3-.7zM16 28a3 3 0 01-3-3h6A3 3 0 0116 28zM21.63 4.72A9.78 9.78 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2.34z"></path></svg>`
},
"20": {
metadata: { "moduleName": "NotificationOffFilled20", "filepath": "notification--off--filled/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": "M26 17.6V13a10 10 0 00-1.09-4.5L30 3.41 28.59 2 2 28.59 3.41 30l5-5H11a5 5 0 0010 0h7a.94.94 0 001-1V21a.91.91 0 00-.3-.7zM16 28a3 3 0 01-3-3h6A3 3 0 0116 28zM21.63 4.72A9.78 9.78 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2.34z" } }], "name": "notification--off--filled", "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="M26 17.6V13a10 10 0 00-1.09-4.5L30 3.41 28.59 2 2 28.59 3.41 30l5-5H11a5 5 0 0010 0h7a.94.94 0 001-1V21a.91.91 0 00-.3-.7zM16 28a3 3 0 01-3-3h6A3 3 0 0116 28zM21.63 4.72A9.78 9.78 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2.34z"></path></svg>`
},
"16": {
metadata: { "moduleName": "NotificationOffFilled16", "filepath": "notification--off--filled/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": "M26 17.6V13a10 10 0 00-1.09-4.5L30 3.41 28.59 2 2 28.59 3.41 30l5-5H11a5 5 0 0010 0h7a.94.94 0 001-1V21a.91.91 0 00-.3-.7zM16 28a3 3 0 01-3-3h6A3 3 0 0116 28zM21.63 4.72A9.78 9.78 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2.34z" } }], "name": "notification--off--filled", "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="M26 17.6V13a10 10 0 00-1.09-4.5L30 3.41 28.59 2 2 28.59 3.41 30l5-5H11a5 5 0 0010 0h7a.94.94 0 001-1V21a.91.91 0 00-.3-.7zM16 28a3 3 0 01-3-3h6A3 3 0 0116 28zM21.63 4.72A9.78 9.78 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2.34z"></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;
NotificationOffFilledDirective_1.titleIdCounter++;
title.setAttribute("id", `notification-off-filled-${NotificationOffFilledDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `notification-off-filled-${NotificationOffFilledDirective_1.titleIdCounter}`);
}
}
};
NotificationOffFilledDirective.titleIdCounter = 0;
NotificationOffFilledDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], NotificationOffFilledDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], NotificationOffFilledDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], NotificationOffFilledDirective.prototype, "size", void 0);
NotificationOffFilledDirective = NotificationOffFilledDirective_1 = __decorate([
Directive({
selector: "[ibmIconNotificationOffFilled]"
}),
__metadata("design:paramtypes", [ElementRef])
], NotificationOffFilledDirective);
let NotificationOffFilledModule = class NotificationOffFilledModule {
};
NotificationOffFilledModule = __decorate([
NgModule({
declarations: [
NotificationOffFilledComponent,
NotificationOffFilledDirective,
],
exports: [
NotificationOffFilledComponent,
NotificationOffFilledDirective,
]
})
], NotificationOffFilledModule);
export { NotificationOffFilledComponent, NotificationOffFilledDirective, NotificationOffFilledModule };