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 MisuseOutlineComponent = /** @class */ (function () { function MisuseOutlineComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MisuseOutlineComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MisuseOutlineComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineComponent.prototype, "size", void 0); MisuseOutlineComponent = __decorate([ Component({ selector: "ibm-icon-misuse-outline", template: "\n <svg\n ibmIconMisuseOutline\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 " }) ], MisuseOutlineComponent); return MisuseOutlineComponent; }()); var MisuseOutlineDirective = /** @class */ (function () { function MisuseOutlineDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "MisuseOutline32", "filepath": "misuse--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": "misuse--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": "MisuseOutline24", "filepath": "misuse--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": "misuse--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": "MisuseOutline20", "filepath": "misuse--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": "misuse--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": "MisuseOutline16", "filepath": "misuse--outline/16.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 16 16", "fill": "currentColor", "width": 16, "height": 16 }, "content": [{ "elem": "path", "attrs": { "d": "M8,1C4.1,1,1,4.1,1,8s3.1,7,7,7s7-3.1,7-7S11.9,1,8,1z M8,14c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S11.3,14,8,14z" } }, { "elem": "path", "attrs": { "d": "M10.7 11.5L8 8.8 5.3 11.5 4.5 10.7 7.2 8 4.5 5.3 5.3 4.5 8 7.2 10.7 4.5 11.5 5.3 8.8 8 11.5 10.7z" } }], "name": "misuse--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 16 16\" aria-hidden=\"true\"><path d=\"M8,1C4.1,1,1,4.1,1,8s3.1,7,7,7s7-3.1,7-7S11.9,1,8,1z M8,14c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S11.3,14,8,14z\"></path><path d=\"M10.7 11.5L8 8.8 5.3 11.5 4.5 10.7 7.2 8 4.5 5.3 5.3 4.5 8 7.2 10.7 4.5 11.5 5.3 8.8 8 11.5 10.7z\"></path></svg>" }, }; } MisuseOutlineDirective_1 = MisuseOutlineDirective; MisuseOutlineDirective.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; MisuseOutlineDirective_1.titleIdCounter++; title.setAttribute("id", "misuse-outline-" + MisuseOutlineDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "misuse-outline-" + MisuseOutlineDirective_1.titleIdCounter); } }; var MisuseOutlineDirective_1; MisuseOutlineDirective.titleIdCounter = 0; MisuseOutlineDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MisuseOutlineDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MisuseOutlineDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], MisuseOutlineDirective.prototype, "size", void 0); MisuseOutlineDirective = MisuseOutlineDirective_1 = __decorate([ Directive({ selector: "[ibmIconMisuseOutline]" }), __metadata("design:paramtypes", [ElementRef]) ], MisuseOutlineDirective); return MisuseOutlineDirective; }()); var MisuseOutlineModule = /** @class */ (function () { function MisuseOutlineModule() { } MisuseOutlineModule = __decorate([ NgModule({ declarations: [ MisuseOutlineComponent, MisuseOutlineDirective, ], exports: [ MisuseOutlineComponent, MisuseOutlineDirective, ] }) ], MisuseOutlineModule); return MisuseOutlineModule; }()); export { MisuseOutlineComponent, MisuseOutlineDirective, MisuseOutlineModule };