UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 11.5 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var SysProvisionComponent = /** @class */ (function () { function SysProvisionComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], SysProvisionComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], SysProvisionComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], SysProvisionComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], SysProvisionComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], SysProvisionComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], SysProvisionComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], SysProvisionComponent.prototype, "size", void 0); SysProvisionComponent = __decorate([ Component({ selector: "ibm-icon-sys-provision", template: "\n <svg\n ibmIconSysProvision\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 " }) ], SysProvisionComponent); return SysProvisionComponent; }()); var SysProvisionDirective = /** @class */ (function () { function SysProvisionDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "SysProvision32", "filepath": "sys-provision/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": "M21 20L21 30 30 25 21 20z" } }, { "elem": "circle", "attrs": { "cx": "14", "cy": "14", "r": "2" } }, { "elem": "path", "attrs": { "d": "M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z" } }, { "elem": "path", "attrs": { "d": "M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z" } }], "name": "sys-provision", "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=\"M21 20L21 30 30 25 21 20z\"></path><circle cx=\"14\" cy=\"14\" r=\"2\"></circle><path d=\"M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z\"></path><path d=\"M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z\"></path></svg>" }, "24": { metadata: { "moduleName": "SysProvision24", "filepath": "sys-provision/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": "M21 20L21 30 30 25 21 20z" } }, { "elem": "circle", "attrs": { "cx": "14", "cy": "14", "r": "2" } }, { "elem": "path", "attrs": { "d": "M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z" } }, { "elem": "path", "attrs": { "d": "M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z" } }], "name": "sys-provision", "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=\"M21 20L21 30 30 25 21 20z\"></path><circle cx=\"14\" cy=\"14\" r=\"2\"></circle><path d=\"M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z\"></path><path d=\"M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z\"></path></svg>" }, "20": { metadata: { "moduleName": "SysProvision20", "filepath": "sys-provision/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": "M21 20L21 30 30 25 21 20z" } }, { "elem": "circle", "attrs": { "cx": "14", "cy": "14", "r": "2" } }, { "elem": "path", "attrs": { "d": "M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z" } }, { "elem": "path", "attrs": { "d": "M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z" } }], "name": "sys-provision", "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=\"M21 20L21 30 30 25 21 20z\"></path><circle cx=\"14\" cy=\"14\" r=\"2\"></circle><path d=\"M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z\"></path><path d=\"M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z\"></path></svg>" }, "16": { metadata: { "moduleName": "SysProvision16", "filepath": "sys-provision/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": "M21 20L21 30 30 25 21 20z" } }, { "elem": "circle", "attrs": { "cx": "14", "cy": "14", "r": "2" } }, { "elem": "path", "attrs": { "d": "M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z" } }, { "elem": "path", "attrs": { "d": "M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z" } }], "name": "sys-provision", "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=\"M21 20L21 30 30 25 21 20z\"></path><circle cx=\"14\" cy=\"14\" r=\"2\"></circle><path d=\"M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z\"></path><path d=\"M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z\"></path></svg>" }, }; } SysProvisionDirective_1 = SysProvisionDirective; SysProvisionDirective.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; SysProvisionDirective_1.titleIdCounter++; title.setAttribute("id", "sys-provision-" + SysProvisionDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "sys-provision-" + SysProvisionDirective_1.titleIdCounter); } }; var SysProvisionDirective_1; SysProvisionDirective.titleIdCounter = 0; SysProvisionDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], SysProvisionDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], SysProvisionDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], SysProvisionDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], SysProvisionDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], SysProvisionDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], SysProvisionDirective.prototype, "size", void 0); SysProvisionDirective = SysProvisionDirective_1 = __decorate([ Directive({ selector: "[ibmIconSysProvision]" }), __metadata("design:paramtypes", [ElementRef]) ], SysProvisionDirective); return SysProvisionDirective; }()); var SysProvisionModule = /** @class */ (function () { function SysProvisionModule() { } SysProvisionModule = __decorate([ NgModule({ declarations: [ SysProvisionComponent, SysProvisionDirective, ], exports: [ SysProvisionComponent, SysProvisionDirective, ] }) ], SysProvisionModule); return SysProvisionModule; }()); export { SysProvisionComponent, SysProvisionDirective, SysProvisionModule };