UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 12.6 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var ManagedSolutionsDirective_1; let ManagedSolutionsComponent = class ManagedSolutionsComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ManagedSolutionsComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ManagedSolutionsComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsComponent.prototype, "size", void 0); ManagedSolutionsComponent = __decorate([ Component({ selector: "ibm-icon-managed-solutions", template: ` <svg ibmIconManagedSolutions [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], ManagedSolutionsComponent); let ManagedSolutionsDirective = ManagedSolutionsDirective_1 = class ManagedSolutionsDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "ManagedSolutions32", "filepath": "managed-solutions/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": "M30 23L25 23 25 18 23 18 23 23 18 23 18 25 23 25 23 30 25 30 25 25 30 25 30 23z" } }, { "elem": "path", "attrs": { "d": "M24.1273,11.8394l1.1807.2136a5.7919,5.7919,0,0,1,2.6247,1.1445A5.4219,5.4219,0,0,1,29.9532,18h2.0293a7.5022,7.5022,0,0,0-6.15-7.8848,10.0067,10.0067,0,0,0-7.9387-7.9336,10.0025,10.0025,0,0,0-11.72,7.9336A7.5055,7.5055,0,0,0,.0576,18.4088,7.6841,7.6841,0,0,0,7.7725,25H14V23H7.6978a5.6323,5.6323,0,0,1-5.6024-4.4859,5.5064,5.5064,0,0,1,4.4338-6.4306l1.3488-.2441.2138-1.11a8.2061,8.2061,0,0,1,6.7427-6.6426,7.9714,7.9714,0,0,1,3.0138.13,8.1442,8.1442,0,0,1,6.0526,6.4464Z" } }], "name": "managed-solutions", "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="M30 23L25 23 25 18 23 18 23 23 18 23 18 25 23 25 23 30 25 30 25 25 30 25 30 23z"></path><path d="M24.1273,11.8394l1.1807.2136a5.7919,5.7919,0,0,1,2.6247,1.1445A5.4219,5.4219,0,0,1,29.9532,18h2.0293a7.5022,7.5022,0,0,0-6.15-7.8848,10.0067,10.0067,0,0,0-7.9387-7.9336,10.0025,10.0025,0,0,0-11.72,7.9336A7.5055,7.5055,0,0,0,.0576,18.4088,7.6841,7.6841,0,0,0,7.7725,25H14V23H7.6978a5.6323,5.6323,0,0,1-5.6024-4.4859,5.5064,5.5064,0,0,1,4.4338-6.4306l1.3488-.2441.2138-1.11a8.2061,8.2061,0,0,1,6.7427-6.6426,7.9714,7.9714,0,0,1,3.0138.13,8.1442,8.1442,0,0,1,6.0526,6.4464Z"></path></svg>` }, "24": { metadata: { "moduleName": "ManagedSolutions24", "filepath": "managed-solutions/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": "M30 23L25 23 25 18 23 18 23 23 18 23 18 25 23 25 23 30 25 30 25 25 30 25 30 23z" } }, { "elem": "path", "attrs": { "d": "M24.1273,11.8394l1.1807.2136a5.7919,5.7919,0,0,1,2.6247,1.1445A5.4219,5.4219,0,0,1,29.9532,18h2.0293a7.5022,7.5022,0,0,0-6.15-7.8848,10.0067,10.0067,0,0,0-7.9387-7.9336,10.0025,10.0025,0,0,0-11.72,7.9336A7.5055,7.5055,0,0,0,.0576,18.4088,7.6841,7.6841,0,0,0,7.7725,25H14V23H7.6978a5.6323,5.6323,0,0,1-5.6024-4.4859,5.5064,5.5064,0,0,1,4.4338-6.4306l1.3488-.2441.2138-1.11a8.2061,8.2061,0,0,1,6.7427-6.6426,7.9714,7.9714,0,0,1,3.0138.13,8.1442,8.1442,0,0,1,6.0526,6.4464Z" } }], "name": "managed-solutions", "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="M30 23L25 23 25 18 23 18 23 23 18 23 18 25 23 25 23 30 25 30 25 25 30 25 30 23z"></path><path d="M24.1273,11.8394l1.1807.2136a5.7919,5.7919,0,0,1,2.6247,1.1445A5.4219,5.4219,0,0,1,29.9532,18h2.0293a7.5022,7.5022,0,0,0-6.15-7.8848,10.0067,10.0067,0,0,0-7.9387-7.9336,10.0025,10.0025,0,0,0-11.72,7.9336A7.5055,7.5055,0,0,0,.0576,18.4088,7.6841,7.6841,0,0,0,7.7725,25H14V23H7.6978a5.6323,5.6323,0,0,1-5.6024-4.4859,5.5064,5.5064,0,0,1,4.4338-6.4306l1.3488-.2441.2138-1.11a8.2061,8.2061,0,0,1,6.7427-6.6426,7.9714,7.9714,0,0,1,3.0138.13,8.1442,8.1442,0,0,1,6.0526,6.4464Z"></path></svg>` }, "20": { metadata: { "moduleName": "ManagedSolutions20", "filepath": "managed-solutions/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": "M30 23L25 23 25 18 23 18 23 23 18 23 18 25 23 25 23 30 25 30 25 25 30 25 30 23z" } }, { "elem": "path", "attrs": { "d": "M24.1273,11.8394l1.1807.2136a5.7919,5.7919,0,0,1,2.6247,1.1445A5.4219,5.4219,0,0,1,29.9532,18h2.0293a7.5022,7.5022,0,0,0-6.15-7.8848,10.0067,10.0067,0,0,0-7.9387-7.9336,10.0025,10.0025,0,0,0-11.72,7.9336A7.5055,7.5055,0,0,0,.0576,18.4088,7.6841,7.6841,0,0,0,7.7725,25H14V23H7.6978a5.6323,5.6323,0,0,1-5.6024-4.4859,5.5064,5.5064,0,0,1,4.4338-6.4306l1.3488-.2441.2138-1.11a8.2061,8.2061,0,0,1,6.7427-6.6426,7.9714,7.9714,0,0,1,3.0138.13,8.1442,8.1442,0,0,1,6.0526,6.4464Z" } }], "name": "managed-solutions", "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="M30 23L25 23 25 18 23 18 23 23 18 23 18 25 23 25 23 30 25 30 25 25 30 25 30 23z"></path><path d="M24.1273,11.8394l1.1807.2136a5.7919,5.7919,0,0,1,2.6247,1.1445A5.4219,5.4219,0,0,1,29.9532,18h2.0293a7.5022,7.5022,0,0,0-6.15-7.8848,10.0067,10.0067,0,0,0-7.9387-7.9336,10.0025,10.0025,0,0,0-11.72,7.9336A7.5055,7.5055,0,0,0,.0576,18.4088,7.6841,7.6841,0,0,0,7.7725,25H14V23H7.6978a5.6323,5.6323,0,0,1-5.6024-4.4859,5.5064,5.5064,0,0,1,4.4338-6.4306l1.3488-.2441.2138-1.11a8.2061,8.2061,0,0,1,6.7427-6.6426,7.9714,7.9714,0,0,1,3.0138.13,8.1442,8.1442,0,0,1,6.0526,6.4464Z"></path></svg>` }, "16": { metadata: { "moduleName": "ManagedSolutions16", "filepath": "managed-solutions/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": "M30 23L25 23 25 18 23 18 23 23 18 23 18 25 23 25 23 30 25 30 25 25 30 25 30 23z" } }, { "elem": "path", "attrs": { "d": "M24.1273,11.8394l1.1807.2136a5.7919,5.7919,0,0,1,2.6247,1.1445A5.4219,5.4219,0,0,1,29.9532,18h2.0293a7.5022,7.5022,0,0,0-6.15-7.8848,10.0067,10.0067,0,0,0-7.9387-7.9336,10.0025,10.0025,0,0,0-11.72,7.9336A7.5055,7.5055,0,0,0,.0576,18.4088,7.6841,7.6841,0,0,0,7.7725,25H14V23H7.6978a5.6323,5.6323,0,0,1-5.6024-4.4859,5.5064,5.5064,0,0,1,4.4338-6.4306l1.3488-.2441.2138-1.11a8.2061,8.2061,0,0,1,6.7427-6.6426,7.9714,7.9714,0,0,1,3.0138.13,8.1442,8.1442,0,0,1,6.0526,6.4464Z" } }], "name": "managed-solutions", "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="M30 23L25 23 25 18 23 18 23 23 18 23 18 25 23 25 23 30 25 30 25 25 30 25 30 23z"></path><path d="M24.1273,11.8394l1.1807.2136a5.7919,5.7919,0,0,1,2.6247,1.1445A5.4219,5.4219,0,0,1,29.9532,18h2.0293a7.5022,7.5022,0,0,0-6.15-7.8848,10.0067,10.0067,0,0,0-7.9387-7.9336,10.0025,10.0025,0,0,0-11.72,7.9336A7.5055,7.5055,0,0,0,.0576,18.4088,7.6841,7.6841,0,0,0,7.7725,25H14V23H7.6978a5.6323,5.6323,0,0,1-5.6024-4.4859,5.5064,5.5064,0,0,1,4.4338-6.4306l1.3488-.2441.2138-1.11a8.2061,8.2061,0,0,1,6.7427-6.6426,7.9714,7.9714,0,0,1,3.0138.13,8.1442,8.1442,0,0,1,6.0526,6.4464Z"></path></svg>` }, }; } ngAfterViewInit() { const svg = this.elementRef.nativeElement; svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); const icon = this.icons[this.size]; const domParser = new DOMParser(); const rawSVG = icon.svg; const svgElement = domParser.parseFromString(rawSVG, "image/svg+xml").documentElement; let 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; } const 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() }); const attrKeys = Object.keys(attributes); for (let i = 0; i < attrKeys.length; i++) { const key = attrKeys[i]; const value = attributes[key]; if (key === "title") { continue; } if (value) { svg.setAttribute(key, value); } } if (attributes.title) { const title = document.createElement("title"); title.textContent = attributes.title; ManagedSolutionsDirective_1.titleIdCounter++; title.setAttribute("id", `managed-solutions-${ManagedSolutionsDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `managed-solutions-${ManagedSolutionsDirective_1.titleIdCounter}`); } } }; ManagedSolutionsDirective.titleIdCounter = 0; ManagedSolutionsDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ManagedSolutionsDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ManagedSolutionsDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ManagedSolutionsDirective.prototype, "size", void 0); ManagedSolutionsDirective = ManagedSolutionsDirective_1 = __decorate([ Directive({ selector: "[ibmIconManagedSolutions]" }), __metadata("design:paramtypes", [ElementRef]) ], ManagedSolutionsDirective); let ManagedSolutionsModule = class ManagedSolutionsModule { }; ManagedSolutionsModule = __decorate([ NgModule({ declarations: [ ManagedSolutionsComponent, ManagedSolutionsDirective, ], exports: [ ManagedSolutionsComponent, ManagedSolutionsDirective, ] }) ], ManagedSolutionsModule); export { ManagedSolutionsComponent, ManagedSolutionsDirective, ManagedSolutionsModule };