UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 11.2 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var ReflectVerticalComponent = /** @class */ (function () { function ReflectVerticalComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ReflectVerticalComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ReflectVerticalComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalComponent.prototype, "size", void 0); ReflectVerticalComponent = __decorate([ Component({ selector: "ibm-icon-reflect-vertical", template: "\n <svg\n ibmIconReflectVertical\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 " }) ], ReflectVerticalComponent); return ReflectVerticalComponent; }()); var ReflectVerticalDirective = /** @class */ (function () { function ReflectVerticalDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "ReflectVertical32", "filepath": "reflect--vertical/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": "M16.79,19.386l7,9A1,1,0,0,1,23,30H9a1,1,0,0,1-.79-1.614l7-9a1,1,0,0,1,1.5791,0Z" } }, { "elem": "path", "attrs": { "d": "M15 2H17V30H15z", "transform": "rotate(-90 16 16)" } }, { "elem": "path", "attrs": { "d": "M16,13a1.001,1.001,0,0,1-.79-.386l-7-9A1,1,0,0,1,9,2H23a1,1,0,0,1,.79,1.614l-7,9A1.001,1.001,0,0,1,16,13ZM11.0444,4,16,10.3711,20.9556,4Z" } }], "name": "reflect--vertical", "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=\"M16.79,19.386l7,9A1,1,0,0,1,23,30H9a1,1,0,0,1-.79-1.614l7-9a1,1,0,0,1,1.5791,0Z\"></path><path d=\"M15 2H17V30H15z\" transform=\"rotate(-90 16 16)\"></path><path d=\"M16,13a1.001,1.001,0,0,1-.79-.386l-7-9A1,1,0,0,1,9,2H23a1,1,0,0,1,.79,1.614l-7,9A1.001,1.001,0,0,1,16,13ZM11.0444,4,16,10.3711,20.9556,4Z\"></path></svg>" }, "24": { metadata: { "moduleName": "ReflectVertical24", "filepath": "reflect--vertical/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": "M16.79,19.386l7,9A1,1,0,0,1,23,30H9a1,1,0,0,1-.79-1.614l7-9a1,1,0,0,1,1.5791,0Z" } }, { "elem": "path", "attrs": { "d": "M15 2H17V30H15z", "transform": "rotate(-90 16 16)" } }, { "elem": "path", "attrs": { "d": "M16,13a1.001,1.001,0,0,1-.79-.386l-7-9A1,1,0,0,1,9,2H23a1,1,0,0,1,.79,1.614l-7,9A1.001,1.001,0,0,1,16,13ZM11.0444,4,16,10.3711,20.9556,4Z" } }], "name": "reflect--vertical", "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=\"M16.79,19.386l7,9A1,1,0,0,1,23,30H9a1,1,0,0,1-.79-1.614l7-9a1,1,0,0,1,1.5791,0Z\"></path><path d=\"M15 2H17V30H15z\" transform=\"rotate(-90 16 16)\"></path><path d=\"M16,13a1.001,1.001,0,0,1-.79-.386l-7-9A1,1,0,0,1,9,2H23a1,1,0,0,1,.79,1.614l-7,9A1.001,1.001,0,0,1,16,13ZM11.0444,4,16,10.3711,20.9556,4Z\"></path></svg>" }, "20": { metadata: { "moduleName": "ReflectVertical20", "filepath": "reflect--vertical/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": "M16.79,19.386l7,9A1,1,0,0,1,23,30H9a1,1,0,0,1-.79-1.614l7-9a1,1,0,0,1,1.5791,0Z" } }, { "elem": "path", "attrs": { "d": "M15 2H17V30H15z", "transform": "rotate(-90 16 16)" } }, { "elem": "path", "attrs": { "d": "M16,13a1.001,1.001,0,0,1-.79-.386l-7-9A1,1,0,0,1,9,2H23a1,1,0,0,1,.79,1.614l-7,9A1.001,1.001,0,0,1,16,13ZM11.0444,4,16,10.3711,20.9556,4Z" } }], "name": "reflect--vertical", "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=\"M16.79,19.386l7,9A1,1,0,0,1,23,30H9a1,1,0,0,1-.79-1.614l7-9a1,1,0,0,1,1.5791,0Z\"></path><path d=\"M15 2H17V30H15z\" transform=\"rotate(-90 16 16)\"></path><path d=\"M16,13a1.001,1.001,0,0,1-.79-.386l-7-9A1,1,0,0,1,9,2H23a1,1,0,0,1,.79,1.614l-7,9A1.001,1.001,0,0,1,16,13ZM11.0444,4,16,10.3711,20.9556,4Z\"></path></svg>" }, "16": { metadata: { "moduleName": "ReflectVertical16", "filepath": "reflect--vertical/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": "M16.79,19.386l7,9A1,1,0,0,1,23,30H9a1,1,0,0,1-.79-1.614l7-9a1,1,0,0,1,1.5791,0Z" } }, { "elem": "path", "attrs": { "d": "M15 2H17V30H15z", "transform": "rotate(-90 16 16)" } }, { "elem": "path", "attrs": { "d": "M16,13a1.001,1.001,0,0,1-.79-.386l-7-9A1,1,0,0,1,9,2H23a1,1,0,0,1,.79,1.614l-7,9A1.001,1.001,0,0,1,16,13ZM11.0444,4,16,10.3711,20.9556,4Z" } }], "name": "reflect--vertical", "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=\"M16.79,19.386l7,9A1,1,0,0,1,23,30H9a1,1,0,0,1-.79-1.614l7-9a1,1,0,0,1,1.5791,0Z\"></path><path d=\"M15 2H17V30H15z\" transform=\"rotate(-90 16 16)\"></path><path d=\"M16,13a1.001,1.001,0,0,1-.79-.386l-7-9A1,1,0,0,1,9,2H23a1,1,0,0,1,.79,1.614l-7,9A1.001,1.001,0,0,1,16,13ZM11.0444,4,16,10.3711,20.9556,4Z\"></path></svg>" }, }; } ReflectVerticalDirective_1 = ReflectVerticalDirective; ReflectVerticalDirective.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; ReflectVerticalDirective_1.titleIdCounter++; title.setAttribute("id", "reflect-vertical-" + ReflectVerticalDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "reflect-vertical-" + ReflectVerticalDirective_1.titleIdCounter); } }; var ReflectVerticalDirective_1; ReflectVerticalDirective.titleIdCounter = 0; ReflectVerticalDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ReflectVerticalDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ReflectVerticalDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ReflectVerticalDirective.prototype, "size", void 0); ReflectVerticalDirective = ReflectVerticalDirective_1 = __decorate([ Directive({ selector: "[ibmIconReflectVertical]" }), __metadata("design:paramtypes", [ElementRef]) ], ReflectVerticalDirective); return ReflectVerticalDirective; }()); var ReflectVerticalModule = /** @class */ (function () { function ReflectVerticalModule() { } ReflectVerticalModule = __decorate([ NgModule({ declarations: [ ReflectVerticalComponent, ReflectVerticalDirective, ], exports: [ ReflectVerticalComponent, ReflectVerticalDirective, ] }) ], ReflectVerticalModule); return ReflectVerticalModule; }()); export { ReflectVerticalComponent, ReflectVerticalDirective, ReflectVerticalModule };