UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 12.6 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var TemperatureFrigidDirective_1; let TemperatureFrigidComponent = class TemperatureFrigidComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], TemperatureFrigidComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], TemperatureFrigidComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidComponent.prototype, "size", void 0); TemperatureFrigidComponent = __decorate([ Component({ selector: "ibm-icon-temperature-frigid", template: ` <svg ibmIconTemperatureFrigid [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], TemperatureFrigidComponent); let TemperatureFrigidDirective = TemperatureFrigidDirective_1 = class TemperatureFrigidDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "TemperatureFrigid32", "filepath": "temperature--frigid/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.167 16.89L21.72 13 27.167 9.109 29.684 9.948 30.316 8.051 28 7.279 28 5 26 5 26 7.485 21 11.057 21 5.367 23.555 3.664 22.445 2 20 3.63 17.555 2 16.445 3.664 19 5.367 19 11.057 16 8.914 16 11.372 18.28 13 16 14.628 16 17.086 19 14.943 19 21.703 22.445 24 23.555 22.336 21 20.633 21 14.943 26 18.515 26 21 28 21 28 18.721 30.316 17.948 29.684 16.051 27.167 16.89zM12 23a3 3 0 01-6 0z" } }, { "elem": "path", "attrs": { "d": "M13,17.2617V6A4,4,0,0,0,5,6V17.2617a7,7,0,1,0,8,0ZM9,28a4.9965,4.9965,0,0,1-2.499-9.3252L7,18.3857V6a2,2,0,0,1,4,0V18.3857l.499.2891A4.9965,4.9965,0,0,1,9,28Z" } }], "name": "temperature--frigid", "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.167 16.89L21.72 13 27.167 9.109 29.684 9.948 30.316 8.051 28 7.279 28 5 26 5 26 7.485 21 11.057 21 5.367 23.555 3.664 22.445 2 20 3.63 17.555 2 16.445 3.664 19 5.367 19 11.057 16 8.914 16 11.372 18.28 13 16 14.628 16 17.086 19 14.943 19 21.703 22.445 24 23.555 22.336 21 20.633 21 14.943 26 18.515 26 21 28 21 28 18.721 30.316 17.948 29.684 16.051 27.167 16.89zM12 23a3 3 0 01-6 0z"></path><path d="M13,17.2617V6A4,4,0,0,0,5,6V17.2617a7,7,0,1,0,8,0ZM9,28a4.9965,4.9965,0,0,1-2.499-9.3252L7,18.3857V6a2,2,0,0,1,4,0V18.3857l.499.2891A4.9965,4.9965,0,0,1,9,28Z"></path></svg>` }, "24": { metadata: { "moduleName": "TemperatureFrigid24", "filepath": "temperature--frigid/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.167 16.89L21.72 13 27.167 9.109 29.684 9.948 30.316 8.051 28 7.279 28 5 26 5 26 7.485 21 11.057 21 5.367 23.555 3.664 22.445 2 20 3.63 17.555 2 16.445 3.664 19 5.367 19 11.057 16 8.914 16 11.372 18.28 13 16 14.628 16 17.086 19 14.943 19 21.703 22.445 24 23.555 22.336 21 20.633 21 14.943 26 18.515 26 21 28 21 28 18.721 30.316 17.948 29.684 16.051 27.167 16.89zM12 23a3 3 0 01-6 0z" } }, { "elem": "path", "attrs": { "d": "M13,17.2617V6A4,4,0,0,0,5,6V17.2617a7,7,0,1,0,8,0ZM9,28a4.9965,4.9965,0,0,1-2.499-9.3252L7,18.3857V6a2,2,0,0,1,4,0V18.3857l.499.2891A4.9965,4.9965,0,0,1,9,28Z" } }], "name": "temperature--frigid", "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.167 16.89L21.72 13 27.167 9.109 29.684 9.948 30.316 8.051 28 7.279 28 5 26 5 26 7.485 21 11.057 21 5.367 23.555 3.664 22.445 2 20 3.63 17.555 2 16.445 3.664 19 5.367 19 11.057 16 8.914 16 11.372 18.28 13 16 14.628 16 17.086 19 14.943 19 21.703 22.445 24 23.555 22.336 21 20.633 21 14.943 26 18.515 26 21 28 21 28 18.721 30.316 17.948 29.684 16.051 27.167 16.89zM12 23a3 3 0 01-6 0z"></path><path d="M13,17.2617V6A4,4,0,0,0,5,6V17.2617a7,7,0,1,0,8,0ZM9,28a4.9965,4.9965,0,0,1-2.499-9.3252L7,18.3857V6a2,2,0,0,1,4,0V18.3857l.499.2891A4.9965,4.9965,0,0,1,9,28Z"></path></svg>` }, "20": { metadata: { "moduleName": "TemperatureFrigid20", "filepath": "temperature--frigid/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.167 16.89L21.72 13 27.167 9.109 29.684 9.948 30.316 8.051 28 7.279 28 5 26 5 26 7.485 21 11.057 21 5.367 23.555 3.664 22.445 2 20 3.63 17.555 2 16.445 3.664 19 5.367 19 11.057 16 8.914 16 11.372 18.28 13 16 14.628 16 17.086 19 14.943 19 21.703 22.445 24 23.555 22.336 21 20.633 21 14.943 26 18.515 26 21 28 21 28 18.721 30.316 17.948 29.684 16.051 27.167 16.89zM12 23a3 3 0 01-6 0z" } }, { "elem": "path", "attrs": { "d": "M13,17.2617V6A4,4,0,0,0,5,6V17.2617a7,7,0,1,0,8,0ZM9,28a4.9965,4.9965,0,0,1-2.499-9.3252L7,18.3857V6a2,2,0,0,1,4,0V18.3857l.499.2891A4.9965,4.9965,0,0,1,9,28Z" } }], "name": "temperature--frigid", "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.167 16.89L21.72 13 27.167 9.109 29.684 9.948 30.316 8.051 28 7.279 28 5 26 5 26 7.485 21 11.057 21 5.367 23.555 3.664 22.445 2 20 3.63 17.555 2 16.445 3.664 19 5.367 19 11.057 16 8.914 16 11.372 18.28 13 16 14.628 16 17.086 19 14.943 19 21.703 22.445 24 23.555 22.336 21 20.633 21 14.943 26 18.515 26 21 28 21 28 18.721 30.316 17.948 29.684 16.051 27.167 16.89zM12 23a3 3 0 01-6 0z"></path><path d="M13,17.2617V6A4,4,0,0,0,5,6V17.2617a7,7,0,1,0,8,0ZM9,28a4.9965,4.9965,0,0,1-2.499-9.3252L7,18.3857V6a2,2,0,0,1,4,0V18.3857l.499.2891A4.9965,4.9965,0,0,1,9,28Z"></path></svg>` }, "16": { metadata: { "moduleName": "TemperatureFrigid16", "filepath": "temperature--frigid/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.167 16.89L21.72 13 27.167 9.109 29.684 9.948 30.316 8.051 28 7.279 28 5 26 5 26 7.485 21 11.057 21 5.367 23.555 3.664 22.445 2 20 3.63 17.555 2 16.445 3.664 19 5.367 19 11.057 16 8.914 16 11.372 18.28 13 16 14.628 16 17.086 19 14.943 19 21.703 22.445 24 23.555 22.336 21 20.633 21 14.943 26 18.515 26 21 28 21 28 18.721 30.316 17.948 29.684 16.051 27.167 16.89zM12 23a3 3 0 01-6 0z" } }, { "elem": "path", "attrs": { "d": "M13,17.2617V6A4,4,0,0,0,5,6V17.2617a7,7,0,1,0,8,0ZM9,28a4.9965,4.9965,0,0,1-2.499-9.3252L7,18.3857V6a2,2,0,0,1,4,0V18.3857l.499.2891A4.9965,4.9965,0,0,1,9,28Z" } }], "name": "temperature--frigid", "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.167 16.89L21.72 13 27.167 9.109 29.684 9.948 30.316 8.051 28 7.279 28 5 26 5 26 7.485 21 11.057 21 5.367 23.555 3.664 22.445 2 20 3.63 17.555 2 16.445 3.664 19 5.367 19 11.057 16 8.914 16 11.372 18.28 13 16 14.628 16 17.086 19 14.943 19 21.703 22.445 24 23.555 22.336 21 20.633 21 14.943 26 18.515 26 21 28 21 28 18.721 30.316 17.948 29.684 16.051 27.167 16.89zM12 23a3 3 0 01-6 0z"></path><path d="M13,17.2617V6A4,4,0,0,0,5,6V17.2617a7,7,0,1,0,8,0ZM9,28a4.9965,4.9965,0,0,1-2.499-9.3252L7,18.3857V6a2,2,0,0,1,4,0V18.3857l.499.2891A4.9965,4.9965,0,0,1,9,28Z"></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; TemperatureFrigidDirective_1.titleIdCounter++; title.setAttribute("id", `temperature-frigid-${TemperatureFrigidDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `temperature-frigid-${TemperatureFrigidDirective_1.titleIdCounter}`); } } }; TemperatureFrigidDirective.titleIdCounter = 0; TemperatureFrigidDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], TemperatureFrigidDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], TemperatureFrigidDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], TemperatureFrigidDirective.prototype, "size", void 0); TemperatureFrigidDirective = TemperatureFrigidDirective_1 = __decorate([ Directive({ selector: "[ibmIconTemperatureFrigid]" }), __metadata("design:paramtypes", [ElementRef]) ], TemperatureFrigidDirective); let TemperatureFrigidModule = class TemperatureFrigidModule { }; TemperatureFrigidModule = __decorate([ NgModule({ declarations: [ TemperatureFrigidComponent, TemperatureFrigidDirective, ], exports: [ TemperatureFrigidComponent, TemperatureFrigidDirective, ] }) ], TemperatureFrigidModule); export { TemperatureFrigidComponent, TemperatureFrigidDirective, TemperatureFrigidModule };