UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 10.5 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var AlarmSubtractDirective_1; let AlarmSubtractComponent = class AlarmSubtractComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], AlarmSubtractComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], AlarmSubtractComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractComponent.prototype, "size", void 0); AlarmSubtractComponent = __decorate([ Component({ selector: "ibm-icon-alarm-subtract", template: ` <svg ibmIconAlarmSubtract [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], AlarmSubtractComponent); let AlarmSubtractDirective = AlarmSubtractDirective_1 = class AlarmSubtractDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "AlarmSubtract32", "filepath": "alarm--subtract/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": "M16,28A11,11,0,1,1,27,17,11,11,0,0,1,16,28ZM16,8a9,9,0,1,0,9,9A9,9,0,0,0,16,8Z" } }, { "elem": "path", "attrs": { "d": "M3.96 5.5H9.030000000000001V7.5H3.96z", "transform": "rotate(-45.06 6.502 6.497)" } }, { "elem": "path", "attrs": { "d": "M24.5 3.96H26.5V9.030000000000001H24.5z", "transform": "rotate(-44.94 25.5 6.498)" } }, { "elem": "path", "attrs": { "d": "M11 16H21V18H11z" } }], "name": "alarm--subtract", "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="M16,28A11,11,0,1,1,27,17,11,11,0,0,1,16,28ZM16,8a9,9,0,1,0,9,9A9,9,0,0,0,16,8Z"></path><path d="M3.96 5.5H9.030000000000001V7.5H3.96z" transform="rotate(-45.06 6.502 6.497)"></path><path d="M24.5 3.96H26.5V9.030000000000001H24.5z" transform="rotate(-44.94 25.5 6.498)"></path><path d="M11 16H21V18H11z"></path></svg>` }, "24": { metadata: { "moduleName": "AlarmSubtract24", "filepath": "alarm--subtract/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": "M16,28A11,11,0,1,1,27,17,11,11,0,0,1,16,28ZM16,8a9,9,0,1,0,9,9A9,9,0,0,0,16,8Z" } }, { "elem": "path", "attrs": { "d": "M3.96 5.5H9.030000000000001V7.5H3.96z", "transform": "rotate(-45.06 6.502 6.497)" } }, { "elem": "path", "attrs": { "d": "M24.5 3.96H26.5V9.030000000000001H24.5z", "transform": "rotate(-44.94 25.5 6.498)" } }, { "elem": "path", "attrs": { "d": "M11 16H21V18H11z" } }], "name": "alarm--subtract", "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="M16,28A11,11,0,1,1,27,17,11,11,0,0,1,16,28ZM16,8a9,9,0,1,0,9,9A9,9,0,0,0,16,8Z"></path><path d="M3.96 5.5H9.030000000000001V7.5H3.96z" transform="rotate(-45.06 6.502 6.497)"></path><path d="M24.5 3.96H26.5V9.030000000000001H24.5z" transform="rotate(-44.94 25.5 6.498)"></path><path d="M11 16H21V18H11z"></path></svg>` }, "20": { metadata: { "moduleName": "AlarmSubtract20", "filepath": "alarm--subtract/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": "M16,28A11,11,0,1,1,27,17,11,11,0,0,1,16,28ZM16,8a9,9,0,1,0,9,9A9,9,0,0,0,16,8Z" } }, { "elem": "path", "attrs": { "d": "M3.96 5.5H9.030000000000001V7.5H3.96z", "transform": "rotate(-45.06 6.502 6.497)" } }, { "elem": "path", "attrs": { "d": "M24.5 3.96H26.5V9.030000000000001H24.5z", "transform": "rotate(-44.94 25.5 6.498)" } }, { "elem": "path", "attrs": { "d": "M11 16H21V18H11z" } }], "name": "alarm--subtract", "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="M16,28A11,11,0,1,1,27,17,11,11,0,0,1,16,28ZM16,8a9,9,0,1,0,9,9A9,9,0,0,0,16,8Z"></path><path d="M3.96 5.5H9.030000000000001V7.5H3.96z" transform="rotate(-45.06 6.502 6.497)"></path><path d="M24.5 3.96H26.5V9.030000000000001H24.5z" transform="rotate(-44.94 25.5 6.498)"></path><path d="M11 16H21V18H11z"></path></svg>` }, "16": { metadata: { "moduleName": "AlarmSubtract16", "filepath": "alarm--subtract/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": "M16,28A11,11,0,1,1,27,17,11,11,0,0,1,16,28ZM16,8a9,9,0,1,0,9,9A9,9,0,0,0,16,8Z" } }, { "elem": "path", "attrs": { "d": "M3.96 5.5H9.030000000000001V7.5H3.96z", "transform": "rotate(-45.06 6.502 6.497)" } }, { "elem": "path", "attrs": { "d": "M24.5 3.96H26.5V9.030000000000001H24.5z", "transform": "rotate(-44.94 25.5 6.498)" } }, { "elem": "path", "attrs": { "d": "M11 16H21V18H11z" } }], "name": "alarm--subtract", "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="M16,28A11,11,0,1,1,27,17,11,11,0,0,1,16,28ZM16,8a9,9,0,1,0,9,9A9,9,0,0,0,16,8Z"></path><path d="M3.96 5.5H9.030000000000001V7.5H3.96z" transform="rotate(-45.06 6.502 6.497)"></path><path d="M24.5 3.96H26.5V9.030000000000001H24.5z" transform="rotate(-44.94 25.5 6.498)"></path><path d="M11 16H21V18H11z"></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; AlarmSubtractDirective_1.titleIdCounter++; title.setAttribute("id", `alarm-subtract-${AlarmSubtractDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `alarm-subtract-${AlarmSubtractDirective_1.titleIdCounter}`); } } }; AlarmSubtractDirective.titleIdCounter = 0; AlarmSubtractDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], AlarmSubtractDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], AlarmSubtractDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], AlarmSubtractDirective.prototype, "size", void 0); AlarmSubtractDirective = AlarmSubtractDirective_1 = __decorate([ Directive({ selector: "[ibmIconAlarmSubtract]" }), __metadata("design:paramtypes", [ElementRef]) ], AlarmSubtractDirective); let AlarmSubtractModule = class AlarmSubtractModule { }; AlarmSubtractModule = __decorate([ NgModule({ declarations: [ AlarmSubtractComponent, AlarmSubtractDirective, ], exports: [ AlarmSubtractComponent, AlarmSubtractDirective, ] }) ], AlarmSubtractModule); export { AlarmSubtractComponent, AlarmSubtractDirective, AlarmSubtractModule };