UNPKG

@carbon/icons-angular

Version:

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

177 lines (172 loc) 14.8 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('@angular/core'), require('@carbon/icon-helpers')) : typeof define === 'function' && define.amd ? define(['exports', 'tslib', '@angular/core', '@carbon/icon-helpers'], factory) : (global = global || self, factory((global.CarbonIconsAngular = global.CarbonIconsAngular || {}, global.CarbonIconsAngular.HeatMap = {}), global.tslib, global.ng.core, global.CarbonIconHelpers)); }(this, (function (exports, tslib, core, iconHelpers) { 'use strict'; var HeatMapComponent = /** @class */ (function () { function HeatMapComponent() { this.focusable = false; } tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapComponent.prototype, "ariaLabel", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapComponent.prototype, "ariaLabelledby", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], HeatMapComponent.prototype, "ariaHidden", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapComponent.prototype, "title", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], HeatMapComponent.prototype, "focusable", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapComponent.prototype, "innerClass", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapComponent.prototype, "size", void 0); HeatMapComponent = tslib.__decorate([ core.Component({ selector: "ibm-icon-heat-map", template: "\n <svg\n ibmIconHeatMap\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 " }) ], HeatMapComponent); return HeatMapComponent; }()); var HeatMapDirective = /** @class */ (function () { function HeatMapDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "HeatMap32", "filepath": "heat-map/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": "M20 18H22V20H20zM28 16H30V18H28zM14 6H16V8H14zM16 22H12V16a2.0023 2.0023 0 00-2-2H4a2.0023 2.0023 0 00-2 2v6a2.0023 2.0023 0 002 2h6v4a2.0023 2.0023 0 002 2h4a2.0023 2.0023 0 002-2V24A2.0023 2.0023 0 0016 22zM4 22V16h6v6zm8 6V24h4v4zM28 30H24a2.0021 2.0021 0 01-2-2V24a2.0021 2.0021 0 012-2h4a2.0021 2.0021 0 012 2v4A2.0021 2.0021 0 0128 30zm-4-6v4h4V24zM28 2H22a2.0023 2.0023 0 00-2 2v6H18a2.0023 2.0023 0 00-2 2v2a2.0023 2.0023 0 002 2h2a2.0023 2.0023 0 002-2V12h6a2.0023 2.0023 0 002-2V4A2.0023 2.0023 0 0028 2zM18 14V12h2v2zm4-4V4h6v6zM8 10H4A2.0021 2.0021 0 012 8V4A2.0021 2.0021 0 014 2H8a2.0021 2.0021 0 012 2V8A2.0021 2.0021 0 018 10zM4 4V8H8V4z" } }], "name": "heat-map", "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=\"M20 18H22V20H20zM28 16H30V18H28zM14 6H16V8H14zM16 22H12V16a2.0023 2.0023 0 00-2-2H4a2.0023 2.0023 0 00-2 2v6a2.0023 2.0023 0 002 2h6v4a2.0023 2.0023 0 002 2h4a2.0023 2.0023 0 002-2V24A2.0023 2.0023 0 0016 22zM4 22V16h6v6zm8 6V24h4v4zM28 30H24a2.0021 2.0021 0 01-2-2V24a2.0021 2.0021 0 012-2h4a2.0021 2.0021 0 012 2v4A2.0021 2.0021 0 0128 30zm-4-6v4h4V24zM28 2H22a2.0023 2.0023 0 00-2 2v6H18a2.0023 2.0023 0 00-2 2v2a2.0023 2.0023 0 002 2h2a2.0023 2.0023 0 002-2V12h6a2.0023 2.0023 0 002-2V4A2.0023 2.0023 0 0028 2zM18 14V12h2v2zm4-4V4h6v6zM8 10H4A2.0021 2.0021 0 012 8V4A2.0021 2.0021 0 014 2H8a2.0021 2.0021 0 012 2V8A2.0021 2.0021 0 018 10zM4 4V8H8V4z\"></path></svg>" }, "24": { metadata: { "moduleName": "HeatMap24", "filepath": "heat-map/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": "M20 18H22V20H20zM28 16H30V18H28zM14 6H16V8H14zM16 22H12V16a2.0023 2.0023 0 00-2-2H4a2.0023 2.0023 0 00-2 2v6a2.0023 2.0023 0 002 2h6v4a2.0023 2.0023 0 002 2h4a2.0023 2.0023 0 002-2V24A2.0023 2.0023 0 0016 22zM4 22V16h6v6zm8 6V24h4v4zM28 30H24a2.0021 2.0021 0 01-2-2V24a2.0021 2.0021 0 012-2h4a2.0021 2.0021 0 012 2v4A2.0021 2.0021 0 0128 30zm-4-6v4h4V24zM28 2H22a2.0023 2.0023 0 00-2 2v6H18a2.0023 2.0023 0 00-2 2v2a2.0023 2.0023 0 002 2h2a2.0023 2.0023 0 002-2V12h6a2.0023 2.0023 0 002-2V4A2.0023 2.0023 0 0028 2zM18 14V12h2v2zm4-4V4h6v6zM8 10H4A2.0021 2.0021 0 012 8V4A2.0021 2.0021 0 014 2H8a2.0021 2.0021 0 012 2V8A2.0021 2.0021 0 018 10zM4 4V8H8V4z" } }], "name": "heat-map", "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=\"M20 18H22V20H20zM28 16H30V18H28zM14 6H16V8H14zM16 22H12V16a2.0023 2.0023 0 00-2-2H4a2.0023 2.0023 0 00-2 2v6a2.0023 2.0023 0 002 2h6v4a2.0023 2.0023 0 002 2h4a2.0023 2.0023 0 002-2V24A2.0023 2.0023 0 0016 22zM4 22V16h6v6zm8 6V24h4v4zM28 30H24a2.0021 2.0021 0 01-2-2V24a2.0021 2.0021 0 012-2h4a2.0021 2.0021 0 012 2v4A2.0021 2.0021 0 0128 30zm-4-6v4h4V24zM28 2H22a2.0023 2.0023 0 00-2 2v6H18a2.0023 2.0023 0 00-2 2v2a2.0023 2.0023 0 002 2h2a2.0023 2.0023 0 002-2V12h6a2.0023 2.0023 0 002-2V4A2.0023 2.0023 0 0028 2zM18 14V12h2v2zm4-4V4h6v6zM8 10H4A2.0021 2.0021 0 012 8V4A2.0021 2.0021 0 014 2H8a2.0021 2.0021 0 012 2V8A2.0021 2.0021 0 018 10zM4 4V8H8V4z\"></path></svg>" }, "20": { metadata: { "moduleName": "HeatMap20", "filepath": "heat-map/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": "M20 18H22V20H20zM28 16H30V18H28zM14 6H16V8H14zM16 22H12V16a2.0023 2.0023 0 00-2-2H4a2.0023 2.0023 0 00-2 2v6a2.0023 2.0023 0 002 2h6v4a2.0023 2.0023 0 002 2h4a2.0023 2.0023 0 002-2V24A2.0023 2.0023 0 0016 22zM4 22V16h6v6zm8 6V24h4v4zM28 30H24a2.0021 2.0021 0 01-2-2V24a2.0021 2.0021 0 012-2h4a2.0021 2.0021 0 012 2v4A2.0021 2.0021 0 0128 30zm-4-6v4h4V24zM28 2H22a2.0023 2.0023 0 00-2 2v6H18a2.0023 2.0023 0 00-2 2v2a2.0023 2.0023 0 002 2h2a2.0023 2.0023 0 002-2V12h6a2.0023 2.0023 0 002-2V4A2.0023 2.0023 0 0028 2zM18 14V12h2v2zm4-4V4h6v6zM8 10H4A2.0021 2.0021 0 012 8V4A2.0021 2.0021 0 014 2H8a2.0021 2.0021 0 012 2V8A2.0021 2.0021 0 018 10zM4 4V8H8V4z" } }], "name": "heat-map", "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=\"M20 18H22V20H20zM28 16H30V18H28zM14 6H16V8H14zM16 22H12V16a2.0023 2.0023 0 00-2-2H4a2.0023 2.0023 0 00-2 2v6a2.0023 2.0023 0 002 2h6v4a2.0023 2.0023 0 002 2h4a2.0023 2.0023 0 002-2V24A2.0023 2.0023 0 0016 22zM4 22V16h6v6zm8 6V24h4v4zM28 30H24a2.0021 2.0021 0 01-2-2V24a2.0021 2.0021 0 012-2h4a2.0021 2.0021 0 012 2v4A2.0021 2.0021 0 0128 30zm-4-6v4h4V24zM28 2H22a2.0023 2.0023 0 00-2 2v6H18a2.0023 2.0023 0 00-2 2v2a2.0023 2.0023 0 002 2h2a2.0023 2.0023 0 002-2V12h6a2.0023 2.0023 0 002-2V4A2.0023 2.0023 0 0028 2zM18 14V12h2v2zm4-4V4h6v6zM8 10H4A2.0021 2.0021 0 012 8V4A2.0021 2.0021 0 014 2H8a2.0021 2.0021 0 012 2V8A2.0021 2.0021 0 018 10zM4 4V8H8V4z\"></path></svg>" }, "16": { metadata: { "moduleName": "HeatMap16", "filepath": "heat-map/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": "M20 18H22V20H20zM28 16H30V18H28zM14 6H16V8H14zM16 22H12V16a2.0023 2.0023 0 00-2-2H4a2.0023 2.0023 0 00-2 2v6a2.0023 2.0023 0 002 2h6v4a2.0023 2.0023 0 002 2h4a2.0023 2.0023 0 002-2V24A2.0023 2.0023 0 0016 22zM4 22V16h6v6zm8 6V24h4v4zM28 30H24a2.0021 2.0021 0 01-2-2V24a2.0021 2.0021 0 012-2h4a2.0021 2.0021 0 012 2v4A2.0021 2.0021 0 0128 30zm-4-6v4h4V24zM28 2H22a2.0023 2.0023 0 00-2 2v6H18a2.0023 2.0023 0 00-2 2v2a2.0023 2.0023 0 002 2h2a2.0023 2.0023 0 002-2V12h6a2.0023 2.0023 0 002-2V4A2.0023 2.0023 0 0028 2zM18 14V12h2v2zm4-4V4h6v6zM8 10H4A2.0021 2.0021 0 012 8V4A2.0021 2.0021 0 014 2H8a2.0021 2.0021 0 012 2V8A2.0021 2.0021 0 018 10zM4 4V8H8V4z" } }], "name": "heat-map", "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=\"M20 18H22V20H20zM28 16H30V18H28zM14 6H16V8H14zM16 22H12V16a2.0023 2.0023 0 00-2-2H4a2.0023 2.0023 0 00-2 2v6a2.0023 2.0023 0 002 2h6v4a2.0023 2.0023 0 002 2h4a2.0023 2.0023 0 002-2V24A2.0023 2.0023 0 0016 22zM4 22V16h6v6zm8 6V24h4v4zM28 30H24a2.0021 2.0021 0 01-2-2V24a2.0021 2.0021 0 012-2h4a2.0021 2.0021 0 012 2v4A2.0021 2.0021 0 0128 30zm-4-6v4h4V24zM28 2H22a2.0023 2.0023 0 00-2 2v6H18a2.0023 2.0023 0 00-2 2v2a2.0023 2.0023 0 002 2h2a2.0023 2.0023 0 002-2V12h6a2.0023 2.0023 0 002-2V4A2.0023 2.0023 0 0028 2zM18 14V12h2v2zm4-4V4h6v6zM8 10H4A2.0021 2.0021 0 012 8V4A2.0021 2.0021 0 014 2H8a2.0021 2.0021 0 012 2V8A2.0021 2.0021 0 018 10zM4 4V8H8V4z\"></path></svg>" }, }; } HeatMapDirective_1 = HeatMapDirective; HeatMapDirective.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 = iconHelpers.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; HeatMapDirective_1.titleIdCounter++; title.setAttribute("id", "heat-map-" + HeatMapDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "heat-map-" + HeatMapDirective_1.titleIdCounter); } }; var HeatMapDirective_1; HeatMapDirective.titleIdCounter = 0; HeatMapDirective.ctorParameters = function () { return [ { type: core.ElementRef } ]; }; tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapDirective.prototype, "ariaLabel", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapDirective.prototype, "ariaLabelledby", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], HeatMapDirective.prototype, "ariaHidden", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapDirective.prototype, "title", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], HeatMapDirective.prototype, "isFocusable", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], HeatMapDirective.prototype, "size", void 0); HeatMapDirective = HeatMapDirective_1 = tslib.__decorate([ core.Directive({ selector: "[ibmIconHeatMap]" }), tslib.__metadata("design:paramtypes", [core.ElementRef]) ], HeatMapDirective); return HeatMapDirective; }()); var HeatMapModule = /** @class */ (function () { function HeatMapModule() { } HeatMapModule = tslib.__decorate([ core.NgModule({ declarations: [ HeatMapComponent, HeatMapDirective, ], exports: [ HeatMapComponent, HeatMapDirective, ] }) ], HeatMapModule); return HeatMapModule; }()); exports.HeatMapComponent = HeatMapComponent; exports.HeatMapDirective = HeatMapDirective; exports.HeatMapModule = HeatMapModule; Object.defineProperty(exports, '__esModule', { value: true }); })));