UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 10.7 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var BatteryChargingComponent = /** @class */ (function () { function BatteryChargingComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], BatteryChargingComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], BatteryChargingComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingComponent.prototype, "size", void 0); BatteryChargingComponent = __decorate([ Component({ selector: "ibm-icon-battery-charging", template: "\n <svg\n ibmIconBatteryCharging\n [size]=\"size\"\n [ariaLabel]=\"ariaLabel\"\n [ariaLabelledby]=\"ariaLabelledby\"\n [ariaHidden]=\"ariaHidden\"\n [title]=\"title\"\n [isFocusable]=\"focusable\"\n [attr.class]=\"innerClass\">\n </svg>\n " }) ], BatteryChargingComponent); return BatteryChargingComponent; }()); var BatteryChargingDirective = /** @class */ (function () { function BatteryChargingDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "BatteryCharging32", "filepath": "battery--charging/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": "M27 11H26V10a2 2 0 00-2-2H20v2h4v3h3v6H24v3H19v2h5a2 2 0 002-2V21h1a2 2 0 002-2V13A2 2 0 0027 11zM11 22H6V10h6V8H6a2 2 0 00-2 2V22a2 2 0 002 2h5z" } }, { "elem": "path", "attrs": { "d": "M14.81 23.58L13.19 22.42 17.06 17 9.37 17 16.22 8.38 17.78 9.62 13.51 15 20.94 15 14.81 23.58z" } }], "name": "battery--charging", "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=\"M27 11H26V10a2 2 0 00-2-2H20v2h4v3h3v6H24v3H19v2h5a2 2 0 002-2V21h1a2 2 0 002-2V13A2 2 0 0027 11zM11 22H6V10h6V8H6a2 2 0 00-2 2V22a2 2 0 002 2h5z\"></path><path d=\"M14.81 23.58L13.19 22.42 17.06 17 9.37 17 16.22 8.38 17.78 9.62 13.51 15 20.94 15 14.81 23.58z\"></path></svg>" }, "24": { metadata: { "moduleName": "BatteryCharging24", "filepath": "battery--charging/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": "M27 11H26V10a2 2 0 00-2-2H20v2h4v3h3v6H24v3H19v2h5a2 2 0 002-2V21h1a2 2 0 002-2V13A2 2 0 0027 11zM11 22H6V10h6V8H6a2 2 0 00-2 2V22a2 2 0 002 2h5z" } }, { "elem": "path", "attrs": { "d": "M14.81 23.58L13.19 22.42 17.06 17 9.37 17 16.22 8.38 17.78 9.62 13.51 15 20.94 15 14.81 23.58z" } }], "name": "battery--charging", "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=\"M27 11H26V10a2 2 0 00-2-2H20v2h4v3h3v6H24v3H19v2h5a2 2 0 002-2V21h1a2 2 0 002-2V13A2 2 0 0027 11zM11 22H6V10h6V8H6a2 2 0 00-2 2V22a2 2 0 002 2h5z\"></path><path d=\"M14.81 23.58L13.19 22.42 17.06 17 9.37 17 16.22 8.38 17.78 9.62 13.51 15 20.94 15 14.81 23.58z\"></path></svg>" }, "20": { metadata: { "moduleName": "BatteryCharging20", "filepath": "battery--charging/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": "M27 11H26V10a2 2 0 00-2-2H20v2h4v3h3v6H24v3H19v2h5a2 2 0 002-2V21h1a2 2 0 002-2V13A2 2 0 0027 11zM11 22H6V10h6V8H6a2 2 0 00-2 2V22a2 2 0 002 2h5z" } }, { "elem": "path", "attrs": { "d": "M14.81 23.58L13.19 22.42 17.06 17 9.37 17 16.22 8.38 17.78 9.62 13.51 15 20.94 15 14.81 23.58z" } }], "name": "battery--charging", "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=\"M27 11H26V10a2 2 0 00-2-2H20v2h4v3h3v6H24v3H19v2h5a2 2 0 002-2V21h1a2 2 0 002-2V13A2 2 0 0027 11zM11 22H6V10h6V8H6a2 2 0 00-2 2V22a2 2 0 002 2h5z\"></path><path d=\"M14.81 23.58L13.19 22.42 17.06 17 9.37 17 16.22 8.38 17.78 9.62 13.51 15 20.94 15 14.81 23.58z\"></path></svg>" }, "16": { metadata: { "moduleName": "BatteryCharging16", "filepath": "battery--charging/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": "M27 11H26V10a2 2 0 00-2-2H20v2h4v3h3v6H24v3H19v2h5a2 2 0 002-2V21h1a2 2 0 002-2V13A2 2 0 0027 11zM11 22H6V10h6V8H6a2 2 0 00-2 2V22a2 2 0 002 2h5z" } }, { "elem": "path", "attrs": { "d": "M14.81 23.58L13.19 22.42 17.06 17 9.37 17 16.22 8.38 17.78 9.62 13.51 15 20.94 15 14.81 23.58z" } }], "name": "battery--charging", "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=\"M27 11H26V10a2 2 0 00-2-2H20v2h4v3h3v6H24v3H19v2h5a2 2 0 002-2V21h1a2 2 0 002-2V13A2 2 0 0027 11zM11 22H6V10h6V8H6a2 2 0 00-2 2V22a2 2 0 002 2h5z\"></path><path d=\"M14.81 23.58L13.19 22.42 17.06 17 9.37 17 16.22 8.38 17.78 9.62 13.51 15 20.94 15 14.81 23.58z\"></path></svg>" }, }; } BatteryChargingDirective_1 = BatteryChargingDirective; BatteryChargingDirective.prototype.ngAfterViewInit = function () { var svg = this.elementRef.nativeElement; svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); var icon = this.icons[this.size]; var domParser = new DOMParser(); var rawSVG = icon.svg; var svgElement = domParser.parseFromString(rawSVG, "image/svg+xml").documentElement; var 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; } var 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() }); var attrKeys = Object.keys(attributes); for (var i = 0; i < attrKeys.length; i++) { var key = attrKeys[i]; var value = attributes[key]; if (key === "title") { continue; } if (value) { svg.setAttribute(key, value); } } if (attributes.title) { var title = document.createElement("title"); title.textContent = attributes.title; BatteryChargingDirective_1.titleIdCounter++; title.setAttribute("id", "battery-charging-" + BatteryChargingDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "battery-charging-" + BatteryChargingDirective_1.titleIdCounter); } }; var BatteryChargingDirective_1; BatteryChargingDirective.titleIdCounter = 0; BatteryChargingDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], BatteryChargingDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], BatteryChargingDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], BatteryChargingDirective.prototype, "size", void 0); BatteryChargingDirective = BatteryChargingDirective_1 = __decorate([ Directive({ selector: "[ibmIconBatteryCharging]" }), __metadata("design:paramtypes", [ElementRef]) ], BatteryChargingDirective); return BatteryChargingDirective; }()); var BatteryChargingModule = /** @class */ (function () { function BatteryChargingModule() { } BatteryChargingModule = __decorate([ NgModule({ declarations: [ BatteryChargingComponent, BatteryChargingDirective, ], exports: [ BatteryChargingComponent, BatteryChargingDirective, ] }) ], BatteryChargingModule); return BatteryChargingModule; }()); export { BatteryChargingComponent, BatteryChargingDirective, BatteryChargingModule };