UNPKG

@carbon/icons-angular

Version:

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

177 lines (172 loc) 14.4 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.SnowHeavy = {}), global.tslib, global.ng.core, global.CarbonIconHelpers)); }(this, (function (exports, tslib, core, iconHelpers) { 'use strict'; var SnowHeavyComponent = /** @class */ (function () { function SnowHeavyComponent() { this.focusable = false; } tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyComponent.prototype, "ariaLabel", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyComponent.prototype, "ariaLabelledby", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], SnowHeavyComponent.prototype, "ariaHidden", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyComponent.prototype, "title", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], SnowHeavyComponent.prototype, "focusable", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyComponent.prototype, "innerClass", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyComponent.prototype, "size", void 0); SnowHeavyComponent = tslib.__decorate([ core.Component({ selector: "ibm-icon-snow-heavy", template: "\n <svg\n ibmIconSnowHeavy\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 " }) ], SnowHeavyComponent); return SnowHeavyComponent; }()); var SnowHeavyDirective = /** @class */ (function () { function SnowHeavyDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "SnowHeavy32", "filepath": "snow--heavy/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": "M4 26H6V28H4zM6 28H8V30H6zM8 30H10V32H8zM8 26H10V28H8zM4 30H6V32H4zM8 18H10V20H8zM10 20H12V22H10zM12 22H14V24H12zM12 18H14V20H12zM8 22H10V24H8zM18 18H20V20H18zM20 20H22V22H20zM22 22H24V24H22zM22 18H24V20H22zM18 22H20V24H18zM14 26H16V28H14zM16 28H18V30H16zM18 30H20V32H18zM18 26H20V28H18zM14 30H16V32H14z" } }, { "elem": "path", "attrs": { "d": "M24.8008,9.1362a8.9943,8.9943,0,0,0-17.6006,0A6.4957,6.4957,0,0,0,6,21.4985v-2.26A4.4943,4.4943,0,0,1,8.144,11.019l.8155-.0639.0991-.812a6.9938,6.9938,0,0,1,13.8838,0l.0986.812.8154.0639A4.4944,4.4944,0,0,1,26,19.2383v2.26A6.4958,6.4958,0,0,0,24.8008,9.1362Z" } }], "name": "snow--heavy", "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=\"M4 26H6V28H4zM6 28H8V30H6zM8 30H10V32H8zM8 26H10V28H8zM4 30H6V32H4zM8 18H10V20H8zM10 20H12V22H10zM12 22H14V24H12zM12 18H14V20H12zM8 22H10V24H8zM18 18H20V20H18zM20 20H22V22H20zM22 22H24V24H22zM22 18H24V20H22zM18 22H20V24H18zM14 26H16V28H14zM16 28H18V30H16zM18 30H20V32H18zM18 26H20V28H18zM14 30H16V32H14z\"></path><path d=\"M24.8008,9.1362a8.9943,8.9943,0,0,0-17.6006,0A6.4957,6.4957,0,0,0,6,21.4985v-2.26A4.4943,4.4943,0,0,1,8.144,11.019l.8155-.0639.0991-.812a6.9938,6.9938,0,0,1,13.8838,0l.0986.812.8154.0639A4.4944,4.4944,0,0,1,26,19.2383v2.26A6.4958,6.4958,0,0,0,24.8008,9.1362Z\"></path></svg>" }, "24": { metadata: { "moduleName": "SnowHeavy24", "filepath": "snow--heavy/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": "M4 26H6V28H4zM6 28H8V30H6zM8 30H10V32H8zM8 26H10V28H8zM4 30H6V32H4zM8 18H10V20H8zM10 20H12V22H10zM12 22H14V24H12zM12 18H14V20H12zM8 22H10V24H8zM18 18H20V20H18zM20 20H22V22H20zM22 22H24V24H22zM22 18H24V20H22zM18 22H20V24H18zM14 26H16V28H14zM16 28H18V30H16zM18 30H20V32H18zM18 26H20V28H18zM14 30H16V32H14z" } }, { "elem": "path", "attrs": { "d": "M24.8008,9.1362a8.9943,8.9943,0,0,0-17.6006,0A6.4957,6.4957,0,0,0,6,21.4985v-2.26A4.4943,4.4943,0,0,1,8.144,11.019l.8155-.0639.0991-.812a6.9938,6.9938,0,0,1,13.8838,0l.0986.812.8154.0639A4.4944,4.4944,0,0,1,26,19.2383v2.26A6.4958,6.4958,0,0,0,24.8008,9.1362Z" } }], "name": "snow--heavy", "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=\"M4 26H6V28H4zM6 28H8V30H6zM8 30H10V32H8zM8 26H10V28H8zM4 30H6V32H4zM8 18H10V20H8zM10 20H12V22H10zM12 22H14V24H12zM12 18H14V20H12zM8 22H10V24H8zM18 18H20V20H18zM20 20H22V22H20zM22 22H24V24H22zM22 18H24V20H22zM18 22H20V24H18zM14 26H16V28H14zM16 28H18V30H16zM18 30H20V32H18zM18 26H20V28H18zM14 30H16V32H14z\"></path><path d=\"M24.8008,9.1362a8.9943,8.9943,0,0,0-17.6006,0A6.4957,6.4957,0,0,0,6,21.4985v-2.26A4.4943,4.4943,0,0,1,8.144,11.019l.8155-.0639.0991-.812a6.9938,6.9938,0,0,1,13.8838,0l.0986.812.8154.0639A4.4944,4.4944,0,0,1,26,19.2383v2.26A6.4958,6.4958,0,0,0,24.8008,9.1362Z\"></path></svg>" }, "20": { metadata: { "moduleName": "SnowHeavy20", "filepath": "snow--heavy/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": "M4 26H6V28H4zM6 28H8V30H6zM8 30H10V32H8zM8 26H10V28H8zM4 30H6V32H4zM8 18H10V20H8zM10 20H12V22H10zM12 22H14V24H12zM12 18H14V20H12zM8 22H10V24H8zM18 18H20V20H18zM20 20H22V22H20zM22 22H24V24H22zM22 18H24V20H22zM18 22H20V24H18zM14 26H16V28H14zM16 28H18V30H16zM18 30H20V32H18zM18 26H20V28H18zM14 30H16V32H14z" } }, { "elem": "path", "attrs": { "d": "M24.8008,9.1362a8.9943,8.9943,0,0,0-17.6006,0A6.4957,6.4957,0,0,0,6,21.4985v-2.26A4.4943,4.4943,0,0,1,8.144,11.019l.8155-.0639.0991-.812a6.9938,6.9938,0,0,1,13.8838,0l.0986.812.8154.0639A4.4944,4.4944,0,0,1,26,19.2383v2.26A6.4958,6.4958,0,0,0,24.8008,9.1362Z" } }], "name": "snow--heavy", "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=\"M4 26H6V28H4zM6 28H8V30H6zM8 30H10V32H8zM8 26H10V28H8zM4 30H6V32H4zM8 18H10V20H8zM10 20H12V22H10zM12 22H14V24H12zM12 18H14V20H12zM8 22H10V24H8zM18 18H20V20H18zM20 20H22V22H20zM22 22H24V24H22zM22 18H24V20H22zM18 22H20V24H18zM14 26H16V28H14zM16 28H18V30H16zM18 30H20V32H18zM18 26H20V28H18zM14 30H16V32H14z\"></path><path d=\"M24.8008,9.1362a8.9943,8.9943,0,0,0-17.6006,0A6.4957,6.4957,0,0,0,6,21.4985v-2.26A4.4943,4.4943,0,0,1,8.144,11.019l.8155-.0639.0991-.812a6.9938,6.9938,0,0,1,13.8838,0l.0986.812.8154.0639A4.4944,4.4944,0,0,1,26,19.2383v2.26A6.4958,6.4958,0,0,0,24.8008,9.1362Z\"></path></svg>" }, "16": { metadata: { "moduleName": "SnowHeavy16", "filepath": "snow--heavy/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": "M4 26H6V28H4zM6 28H8V30H6zM8 30H10V32H8zM8 26H10V28H8zM4 30H6V32H4zM8 18H10V20H8zM10 20H12V22H10zM12 22H14V24H12zM12 18H14V20H12zM8 22H10V24H8zM18 18H20V20H18zM20 20H22V22H20zM22 22H24V24H22zM22 18H24V20H22zM18 22H20V24H18zM14 26H16V28H14zM16 28H18V30H16zM18 30H20V32H18zM18 26H20V28H18zM14 30H16V32H14z" } }, { "elem": "path", "attrs": { "d": "M24.8008,9.1362a8.9943,8.9943,0,0,0-17.6006,0A6.4957,6.4957,0,0,0,6,21.4985v-2.26A4.4943,4.4943,0,0,1,8.144,11.019l.8155-.0639.0991-.812a6.9938,6.9938,0,0,1,13.8838,0l.0986.812.8154.0639A4.4944,4.4944,0,0,1,26,19.2383v2.26A6.4958,6.4958,0,0,0,24.8008,9.1362Z" } }], "name": "snow--heavy", "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=\"M4 26H6V28H4zM6 28H8V30H6zM8 30H10V32H8zM8 26H10V28H8zM4 30H6V32H4zM8 18H10V20H8zM10 20H12V22H10zM12 22H14V24H12zM12 18H14V20H12zM8 22H10V24H8zM18 18H20V20H18zM20 20H22V22H20zM22 22H24V24H22zM22 18H24V20H22zM18 22H20V24H18zM14 26H16V28H14zM16 28H18V30H16zM18 30H20V32H18zM18 26H20V28H18zM14 30H16V32H14z\"></path><path d=\"M24.8008,9.1362a8.9943,8.9943,0,0,0-17.6006,0A6.4957,6.4957,0,0,0,6,21.4985v-2.26A4.4943,4.4943,0,0,1,8.144,11.019l.8155-.0639.0991-.812a6.9938,6.9938,0,0,1,13.8838,0l.0986.812.8154.0639A4.4944,4.4944,0,0,1,26,19.2383v2.26A6.4958,6.4958,0,0,0,24.8008,9.1362Z\"></path></svg>" }, }; } SnowHeavyDirective_1 = SnowHeavyDirective; SnowHeavyDirective.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; SnowHeavyDirective_1.titleIdCounter++; title.setAttribute("id", "snow-heavy-" + SnowHeavyDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "snow-heavy-" + SnowHeavyDirective_1.titleIdCounter); } }; var SnowHeavyDirective_1; SnowHeavyDirective.titleIdCounter = 0; SnowHeavyDirective.ctorParameters = function () { return [ { type: core.ElementRef } ]; }; tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyDirective.prototype, "ariaLabel", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyDirective.prototype, "ariaLabelledby", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], SnowHeavyDirective.prototype, "ariaHidden", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyDirective.prototype, "title", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], SnowHeavyDirective.prototype, "isFocusable", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], SnowHeavyDirective.prototype, "size", void 0); SnowHeavyDirective = SnowHeavyDirective_1 = tslib.__decorate([ core.Directive({ selector: "[ibmIconSnowHeavy]" }), tslib.__metadata("design:paramtypes", [core.ElementRef]) ], SnowHeavyDirective); return SnowHeavyDirective; }()); var SnowHeavyModule = /** @class */ (function () { function SnowHeavyModule() { } SnowHeavyModule = tslib.__decorate([ core.NgModule({ declarations: [ SnowHeavyComponent, SnowHeavyDirective, ], exports: [ SnowHeavyComponent, SnowHeavyDirective, ] }) ], SnowHeavyModule); return SnowHeavyModule; }()); exports.SnowHeavyComponent = SnowHeavyComponent; exports.SnowHeavyDirective = SnowHeavyDirective; exports.SnowHeavyModule = SnowHeavyModule; Object.defineProperty(exports, '__esModule', { value: true }); })));