UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 10.4 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var CloseOutlineComponent = /** @class */ (function () { function CloseOutlineComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CloseOutlineComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CloseOutlineComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineComponent.prototype, "size", void 0); CloseOutlineComponent = __decorate([ Component({ selector: "ibm-icon-close-outline", template: "\n <svg\n ibmIconCloseOutline\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 " }) ], CloseOutlineComponent); return CloseOutlineComponent; }()); var CloseOutlineDirective = /** @class */ (function () { function CloseOutlineDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "CloseOutline32", "filepath": "close--outline/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,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,12,12\tS22.6,28,16,28z" } }, { "elem": "path", "attrs": { "d": "M21.4 23L16 17.6 10.6 23 9 21.4 14.4 16 9 10.6 10.6 9 16 14.4 21.4 9 23 10.6 17.6 16 23 21.4z" } }], "name": "close--outline", "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,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,12,12\tS22.6,28,16,28z\"></path><path d=\"M21.4 23L16 17.6 10.6 23 9 21.4 14.4 16 9 10.6 10.6 9 16 14.4 21.4 9 23 10.6 17.6 16 23 21.4z\"></path></svg>" }, "24": { metadata: { "moduleName": "CloseOutline24", "filepath": "close--outline/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,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,12,12\tS22.6,28,16,28z" } }, { "elem": "path", "attrs": { "d": "M21.4 23L16 17.6 10.6 23 9 21.4 14.4 16 9 10.6 10.6 9 16 14.4 21.4 9 23 10.6 17.6 16 23 21.4z" } }], "name": "close--outline", "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,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,12,12\tS22.6,28,16,28z\"></path><path d=\"M21.4 23L16 17.6 10.6 23 9 21.4 14.4 16 9 10.6 10.6 9 16 14.4 21.4 9 23 10.6 17.6 16 23 21.4z\"></path></svg>" }, "20": { metadata: { "moduleName": "CloseOutline20", "filepath": "close--outline/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,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,12,12\tS22.6,28,16,28z" } }, { "elem": "path", "attrs": { "d": "M21.4 23L16 17.6 10.6 23 9 21.4 14.4 16 9 10.6 10.6 9 16 14.4 21.4 9 23 10.6 17.6 16 23 21.4z" } }], "name": "close--outline", "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,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,12,12\tS22.6,28,16,28z\"></path><path d=\"M21.4 23L16 17.6 10.6 23 9 21.4 14.4 16 9 10.6 10.6 9 16 14.4 21.4 9 23 10.6 17.6 16 23 21.4z\"></path></svg>" }, "16": { metadata: { "moduleName": "CloseOutline16", "filepath": "close--outline/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,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,12,12\tS22.6,28,16,28z" } }, { "elem": "path", "attrs": { "d": "M21.4 23L16 17.6 10.6 23 9 21.4 14.4 16 9 10.6 10.6 9 16 14.4 21.4 9 23 10.6 17.6 16 23 21.4z" } }], "name": "close--outline", "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,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,12,12\tS22.6,28,16,28z\"></path><path d=\"M21.4 23L16 17.6 10.6 23 9 21.4 14.4 16 9 10.6 10.6 9 16 14.4 21.4 9 23 10.6 17.6 16 23 21.4z\"></path></svg>" }, }; } CloseOutlineDirective_1 = CloseOutlineDirective; CloseOutlineDirective.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; CloseOutlineDirective_1.titleIdCounter++; title.setAttribute("id", "close-outline-" + CloseOutlineDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "close-outline-" + CloseOutlineDirective_1.titleIdCounter); } }; var CloseOutlineDirective_1; CloseOutlineDirective.titleIdCounter = 0; CloseOutlineDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CloseOutlineDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CloseOutlineDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], CloseOutlineDirective.prototype, "size", void 0); CloseOutlineDirective = CloseOutlineDirective_1 = __decorate([ Directive({ selector: "[ibmIconCloseOutline]" }), __metadata("design:paramtypes", [ElementRef]) ], CloseOutlineDirective); return CloseOutlineDirective; }()); var CloseOutlineModule = /** @class */ (function () { function CloseOutlineModule() { } CloseOutlineModule = __decorate([ NgModule({ declarations: [ CloseOutlineComponent, CloseOutlineDirective, ], exports: [ CloseOutlineComponent, CloseOutlineDirective, ] }) ], CloseOutlineModule); return CloseOutlineModule; }()); export { CloseOutlineComponent, CloseOutlineDirective, CloseOutlineModule };