UNPKG

@carbon/icons-angular

Version:

Angular components for icons in digital and software products using the Carbon Design System

174 lines (171 loc) 11 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var NotificationOffDirective_1; let NotificationOffComponent = class NotificationOffComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], NotificationOffComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], NotificationOffComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], NotificationOffComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], NotificationOffComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], NotificationOffComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], NotificationOffComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], NotificationOffComponent.prototype, "size", void 0); NotificationOffComponent = __decorate([ Component({ selector: "ibm-icon-notification-off", template: ` <svg ibmIconNotificationOff [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], NotificationOffComponent); let NotificationOffDirective = NotificationOffDirective_1 = class NotificationOffDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "NotificationOff32", "filepath": "notification--off/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": "M5 23V21.4l2.7-2.7A.91.91 0 008 18V13A8 8 0 0121 6.76l1.44-1.43A9.79 9.79 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2zM26 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 28zm11-5H10.42l13-13A8.06 8.06 0 0124 13v5a.91.91 0 00.3.7L27 21.4z" } }], "name": "notification--off", "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="M5 23V21.4l2.7-2.7A.91.91 0 008 18V13A8 8 0 0121 6.76l1.44-1.43A9.79 9.79 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2zM26 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 28zm11-5H10.42l13-13A8.06 8.06 0 0124 13v5a.91.91 0 00.3.7L27 21.4z"></path></svg>` }, "24": { metadata: { "moduleName": "NotificationOff24", "filepath": "notification--off/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": "M5 23V21.4l2.7-2.7A.91.91 0 008 18V13A8 8 0 0121 6.76l1.44-1.43A9.79 9.79 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2zM26 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 28zm11-5H10.42l13-13A8.06 8.06 0 0124 13v5a.91.91 0 00.3.7L27 21.4z" } }], "name": "notification--off", "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="M5 23V21.4l2.7-2.7A.91.91 0 008 18V13A8 8 0 0121 6.76l1.44-1.43A9.79 9.79 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2zM26 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 28zm11-5H10.42l13-13A8.06 8.06 0 0124 13v5a.91.91 0 00.3.7L27 21.4z"></path></svg>` }, "20": { metadata: { "moduleName": "NotificationOff20", "filepath": "notification--off/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": "M5 23V21.4l2.7-2.7A.91.91 0 008 18V13A8 8 0 0121 6.76l1.44-1.43A9.79 9.79 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2zM26 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 28zm11-5H10.42l13-13A8.06 8.06 0 0124 13v5a.91.91 0 00.3.7L27 21.4z" } }], "name": "notification--off", "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="M5 23V21.4l2.7-2.7A.91.91 0 008 18V13A8 8 0 0121 6.76l1.44-1.43A9.79 9.79 0 0017 3V1H15V3A10.15 10.15 0 006 13v4.6L3.3 20.3A.91.91 0 003 21v2zM26 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 28zm11-5H10.42l13-13A8.06 8.06 0 0124 13v5a.91.91 0 00.3.7L27 21.4z"></path></svg>` }, "16": { metadata: { "moduleName": "NotificationOff16", "filepath": "notification--off/16.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 16 16", "fill": "currentColor", "width": 16, "height": 16 }, "content": [{ "elem": "path", "attrs": { "d": "M2.5 11.5v-.8l1.3-1.4C3.9 9.3 4 9.1 4 9V6.5c0-2.2 1.8-4 4-4 .9 0 1.8.3 2.5.9l.7-.7C10.5 2 9.5 1.6 8.5 1.5v-1h-1v1C5 1.8 3 3.9 3 6.5v2.3l-1.4 1.3c-.1.1-.2.2-.1.4v1H2.5zM13 8.8V6.5c0-.8-.2-1.6-.5-2.2L15 1.7 14.3 1 1 14.3 1.7 15l2.5-2.5h1.3C5.5 13.9 6.6 15 8 15s2.5-1.1 2.5-2.5H14c.3 0 .5-.2.5-.4 0 0 0 0 0-.1v-1.5c0-.1-.1-.3-.1-.4L13 8.8zM8 14c-.8 0-1.5-.7-1.5-1.5h3C9.5 13.3 8.8 14 8 14zM13.5 11.5H5.2L11.7 5C11.9 5.5 12 6 12 6.5V9c0 .1.1.3.1.4l1.4 1.3V11.5z" } }], "name": "notification--off", "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 16 16" aria-hidden="true"><path d="M2.5 11.5v-.8l1.3-1.4C3.9 9.3 4 9.1 4 9V6.5c0-2.2 1.8-4 4-4 .9 0 1.8.3 2.5.9l.7-.7C10.5 2 9.5 1.6 8.5 1.5v-1h-1v1C5 1.8 3 3.9 3 6.5v2.3l-1.4 1.3c-.1.1-.2.2-.1.4v1H2.5zM13 8.8V6.5c0-.8-.2-1.6-.5-2.2L15 1.7 14.3 1 1 14.3 1.7 15l2.5-2.5h1.3C5.5 13.9 6.6 15 8 15s2.5-1.1 2.5-2.5H14c.3 0 .5-.2.5-.4 0 0 0 0 0-.1v-1.5c0-.1-.1-.3-.1-.4L13 8.8zM8 14c-.8 0-1.5-.7-1.5-1.5h3C9.5 13.3 8.8 14 8 14zM13.5 11.5H5.2L11.7 5C11.9 5.5 12 6 12 6.5V9c0 .1.1.3.1.4l1.4 1.3V11.5z"></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; NotificationOffDirective_1.titleIdCounter++; title.setAttribute("id", `notification-off-${NotificationOffDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `notification-off-${NotificationOffDirective_1.titleIdCounter}`); } } }; NotificationOffDirective.titleIdCounter = 0; NotificationOffDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], NotificationOffDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], NotificationOffDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], NotificationOffDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], NotificationOffDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], NotificationOffDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], NotificationOffDirective.prototype, "size", void 0); NotificationOffDirective = NotificationOffDirective_1 = __decorate([ Directive({ selector: "[ibmIconNotificationOff]" }), __metadata("design:paramtypes", [ElementRef]) ], NotificationOffDirective); let NotificationOffModule = class NotificationOffModule { }; NotificationOffModule = __decorate([ NgModule({ declarations: [ NotificationOffComponent, NotificationOffDirective, ], exports: [ NotificationOffComponent, NotificationOffDirective, ] }) ], NotificationOffModule); export { NotificationOffComponent, NotificationOffDirective, NotificationOffModule };