UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 10.3 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var HumidityComponent = /** @class */ (function () { function HumidityComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], HumidityComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], HumidityComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], HumidityComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], HumidityComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], HumidityComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], HumidityComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], HumidityComponent.prototype, "size", void 0); HumidityComponent = __decorate([ Component({ selector: "ibm-icon-humidity", template: "\n <svg\n ibmIconHumidity\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 " }) ], HumidityComponent); return HumidityComponent; }()); var HumidityDirective = /** @class */ (function () { function HumidityDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "Humidity32", "filepath": "humidity/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": "M23.4761,13.9932,16.8472,3.4365a1.04,1.04,0,0,0-1.6944,0L8.4941,14.0444A9.9861,9.9861,0,0,0,7,19a9,9,0,0,0,18,0A10.0632,10.0632,0,0,0,23.4761,13.9932ZM16,26.0005a7.0089,7.0089,0,0,1-7-7,7.978,7.978,0,0,1,1.2183-3.9438l.935-1.4888L21.2271,23.6411A6.9772,6.9772,0,0,1,16,26.0005Z" } }], "name": "humidity", "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=\"M23.4761,13.9932,16.8472,3.4365a1.04,1.04,0,0,0-1.6944,0L8.4941,14.0444A9.9861,9.9861,0,0,0,7,19a9,9,0,0,0,18,0A10.0632,10.0632,0,0,0,23.4761,13.9932ZM16,26.0005a7.0089,7.0089,0,0,1-7-7,7.978,7.978,0,0,1,1.2183-3.9438l.935-1.4888L21.2271,23.6411A6.9772,6.9772,0,0,1,16,26.0005Z\"></path></svg>" }, "24": { metadata: { "moduleName": "Humidity24", "filepath": "humidity/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": "M23.4761,13.9932,16.8472,3.4365a1.04,1.04,0,0,0-1.6944,0L8.4941,14.0444A9.9861,9.9861,0,0,0,7,19a9,9,0,0,0,18,0A10.0632,10.0632,0,0,0,23.4761,13.9932ZM16,26.0005a7.0089,7.0089,0,0,1-7-7,7.978,7.978,0,0,1,1.2183-3.9438l.935-1.4888L21.2271,23.6411A6.9772,6.9772,0,0,1,16,26.0005Z" } }], "name": "humidity", "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=\"M23.4761,13.9932,16.8472,3.4365a1.04,1.04,0,0,0-1.6944,0L8.4941,14.0444A9.9861,9.9861,0,0,0,7,19a9,9,0,0,0,18,0A10.0632,10.0632,0,0,0,23.4761,13.9932ZM16,26.0005a7.0089,7.0089,0,0,1-7-7,7.978,7.978,0,0,1,1.2183-3.9438l.935-1.4888L21.2271,23.6411A6.9772,6.9772,0,0,1,16,26.0005Z\"></path></svg>" }, "20": { metadata: { "moduleName": "Humidity20", "filepath": "humidity/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": "M23.4761,13.9932,16.8472,3.4365a1.04,1.04,0,0,0-1.6944,0L8.4941,14.0444A9.9861,9.9861,0,0,0,7,19a9,9,0,0,0,18,0A10.0632,10.0632,0,0,0,23.4761,13.9932ZM16,26.0005a7.0089,7.0089,0,0,1-7-7,7.978,7.978,0,0,1,1.2183-3.9438l.935-1.4888L21.2271,23.6411A6.9772,6.9772,0,0,1,16,26.0005Z" } }], "name": "humidity", "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=\"M23.4761,13.9932,16.8472,3.4365a1.04,1.04,0,0,0-1.6944,0L8.4941,14.0444A9.9861,9.9861,0,0,0,7,19a9,9,0,0,0,18,0A10.0632,10.0632,0,0,0,23.4761,13.9932ZM16,26.0005a7.0089,7.0089,0,0,1-7-7,7.978,7.978,0,0,1,1.2183-3.9438l.935-1.4888L21.2271,23.6411A6.9772,6.9772,0,0,1,16,26.0005Z\"></path></svg>" }, "16": { metadata: { "moduleName": "Humidity16", "filepath": "humidity/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": "M23.4761,13.9932,16.8472,3.4365a1.04,1.04,0,0,0-1.6944,0L8.4941,14.0444A9.9861,9.9861,0,0,0,7,19a9,9,0,0,0,18,0A10.0632,10.0632,0,0,0,23.4761,13.9932ZM16,26.0005a7.0089,7.0089,0,0,1-7-7,7.978,7.978,0,0,1,1.2183-3.9438l.935-1.4888L21.2271,23.6411A6.9772,6.9772,0,0,1,16,26.0005Z" } }], "name": "humidity", "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=\"M23.4761,13.9932,16.8472,3.4365a1.04,1.04,0,0,0-1.6944,0L8.4941,14.0444A9.9861,9.9861,0,0,0,7,19a9,9,0,0,0,18,0A10.0632,10.0632,0,0,0,23.4761,13.9932ZM16,26.0005a7.0089,7.0089,0,0,1-7-7,7.978,7.978,0,0,1,1.2183-3.9438l.935-1.4888L21.2271,23.6411A6.9772,6.9772,0,0,1,16,26.0005Z\"></path></svg>" }, }; } HumidityDirective_1 = HumidityDirective; HumidityDirective.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; HumidityDirective_1.titleIdCounter++; title.setAttribute("id", "humidity-" + HumidityDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "humidity-" + HumidityDirective_1.titleIdCounter); } }; var HumidityDirective_1; HumidityDirective.titleIdCounter = 0; HumidityDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], HumidityDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], HumidityDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], HumidityDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], HumidityDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], HumidityDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], HumidityDirective.prototype, "size", void 0); HumidityDirective = HumidityDirective_1 = __decorate([ Directive({ selector: "[ibmIconHumidity]" }), __metadata("design:paramtypes", [ElementRef]) ], HumidityDirective); return HumidityDirective; }()); var HumidityModule = /** @class */ (function () { function HumidityModule() { } HumidityModule = __decorate([ NgModule({ declarations: [ HumidityComponent, HumidityDirective, ], exports: [ HumidityComponent, HumidityDirective, ] }) ], HumidityModule); return HumidityModule; }()); export { HumidityComponent, HumidityDirective, HumidityModule };