UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 10.9 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var WorkspaceImportComponent = /** @class */ (function () { function WorkspaceImportComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WorkspaceImportComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WorkspaceImportComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportComponent.prototype, "size", void 0); WorkspaceImportComponent = __decorate([ Component({ selector: "ibm-icon-workspace-import", template: "\n <svg\n ibmIconWorkspaceImport\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 " }) ], WorkspaceImportComponent); return WorkspaceImportComponent; }()); var WorkspaceImportDirective = /** @class */ (function () { function WorkspaceImportDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WorkspaceImport32", "filepath": "workspace--import/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": "M27 6v5H17V6H27m0-2H17a2 2 0 00-2 2v5a2 2 0 002 2H27a2 2 0 002-2V6a2 2 0 00-2-2zM12 25H6V17h6V15H6a2 2 0 00-2 2v8a2 2 0 002 2h6zM30 20L16.828 20 19.414 17.414 18 16 13 21 18 26 19.414 24.586 16.828 22 30 22 30 20zM11 6v5H6V6h5m0-2H6A2 2 0 004 6v5a2 2 0 002 2h5a2 2 0 002-2V6a2 2 0 00-2-2z" } }], "name": "workspace--import", "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=\"M27 6v5H17V6H27m0-2H17a2 2 0 00-2 2v5a2 2 0 002 2H27a2 2 0 002-2V6a2 2 0 00-2-2zM12 25H6V17h6V15H6a2 2 0 00-2 2v8a2 2 0 002 2h6zM30 20L16.828 20 19.414 17.414 18 16 13 21 18 26 19.414 24.586 16.828 22 30 22 30 20zM11 6v5H6V6h5m0-2H6A2 2 0 004 6v5a2 2 0 002 2h5a2 2 0 002-2V6a2 2 0 00-2-2z\"></path></svg>" }, "24": { metadata: { "moduleName": "WorkspaceImport24", "filepath": "workspace--import/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": "M27 6v5H17V6H27m0-2H17a2 2 0 00-2 2v5a2 2 0 002 2H27a2 2 0 002-2V6a2 2 0 00-2-2zM12 25H6V17h6V15H6a2 2 0 00-2 2v8a2 2 0 002 2h6zM30 20L16.828 20 19.414 17.414 18 16 13 21 18 26 19.414 24.586 16.828 22 30 22 30 20zM11 6v5H6V6h5m0-2H6A2 2 0 004 6v5a2 2 0 002 2h5a2 2 0 002-2V6a2 2 0 00-2-2z" } }], "name": "workspace--import", "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=\"M27 6v5H17V6H27m0-2H17a2 2 0 00-2 2v5a2 2 0 002 2H27a2 2 0 002-2V6a2 2 0 00-2-2zM12 25H6V17h6V15H6a2 2 0 00-2 2v8a2 2 0 002 2h6zM30 20L16.828 20 19.414 17.414 18 16 13 21 18 26 19.414 24.586 16.828 22 30 22 30 20zM11 6v5H6V6h5m0-2H6A2 2 0 004 6v5a2 2 0 002 2h5a2 2 0 002-2V6a2 2 0 00-2-2z\"></path></svg>" }, "20": { metadata: { "moduleName": "WorkspaceImport20", "filepath": "workspace--import/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": "M27 6v5H17V6H27m0-2H17a2 2 0 00-2 2v5a2 2 0 002 2H27a2 2 0 002-2V6a2 2 0 00-2-2zM12 25H6V17h6V15H6a2 2 0 00-2 2v8a2 2 0 002 2h6zM30 20L16.828 20 19.414 17.414 18 16 13 21 18 26 19.414 24.586 16.828 22 30 22 30 20zM11 6v5H6V6h5m0-2H6A2 2 0 004 6v5a2 2 0 002 2h5a2 2 0 002-2V6a2 2 0 00-2-2z" } }], "name": "workspace--import", "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=\"M27 6v5H17V6H27m0-2H17a2 2 0 00-2 2v5a2 2 0 002 2H27a2 2 0 002-2V6a2 2 0 00-2-2zM12 25H6V17h6V15H6a2 2 0 00-2 2v8a2 2 0 002 2h6zM30 20L16.828 20 19.414 17.414 18 16 13 21 18 26 19.414 24.586 16.828 22 30 22 30 20zM11 6v5H6V6h5m0-2H6A2 2 0 004 6v5a2 2 0 002 2h5a2 2 0 002-2V6a2 2 0 00-2-2z\"></path></svg>" }, "16": { metadata: { "moduleName": "WorkspaceImport16", "filepath": "workspace--import/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": "M27 6v5H17V6H27m0-2H17a2 2 0 00-2 2v5a2 2 0 002 2H27a2 2 0 002-2V6a2 2 0 00-2-2zM12 25H6V17h6V15H6a2 2 0 00-2 2v8a2 2 0 002 2h6zM30 20L16.828 20 19.414 17.414 18 16 13 21 18 26 19.414 24.586 16.828 22 30 22 30 20zM11 6v5H6V6h5m0-2H6A2 2 0 004 6v5a2 2 0 002 2h5a2 2 0 002-2V6a2 2 0 00-2-2z" } }], "name": "workspace--import", "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=\"M27 6v5H17V6H27m0-2H17a2 2 0 00-2 2v5a2 2 0 002 2H27a2 2 0 002-2V6a2 2 0 00-2-2zM12 25H6V17h6V15H6a2 2 0 00-2 2v8a2 2 0 002 2h6zM30 20L16.828 20 19.414 17.414 18 16 13 21 18 26 19.414 24.586 16.828 22 30 22 30 20zM11 6v5H6V6h5m0-2H6A2 2 0 004 6v5a2 2 0 002 2h5a2 2 0 002-2V6a2 2 0 00-2-2z\"></path></svg>" }, }; } WorkspaceImportDirective_1 = WorkspaceImportDirective; WorkspaceImportDirective.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; WorkspaceImportDirective_1.titleIdCounter++; title.setAttribute("id", "workspace-import-" + WorkspaceImportDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "workspace-import-" + WorkspaceImportDirective_1.titleIdCounter); } }; var WorkspaceImportDirective_1; WorkspaceImportDirective.titleIdCounter = 0; WorkspaceImportDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WorkspaceImportDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WorkspaceImportDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WorkspaceImportDirective.prototype, "size", void 0); WorkspaceImportDirective = WorkspaceImportDirective_1 = __decorate([ Directive({ selector: "[ibmIconWorkspaceImport]" }), __metadata("design:paramtypes", [ElementRef]) ], WorkspaceImportDirective); return WorkspaceImportDirective; }()); var WorkspaceImportModule = /** @class */ (function () { function WorkspaceImportModule() { } WorkspaceImportModule = __decorate([ NgModule({ declarations: [ WorkspaceImportComponent, WorkspaceImportDirective, ], exports: [ WorkspaceImportComponent, WorkspaceImportDirective, ] }) ], WorkspaceImportModule); return WorkspaceImportModule; }()); export { WorkspaceImportComponent, WorkspaceImportDirective, WorkspaceImportModule };