UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 11.4 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var VirtualPrivateCloudAltDirective_1; let VirtualPrivateCloudAltComponent = class VirtualPrivateCloudAltComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], VirtualPrivateCloudAltComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], VirtualPrivateCloudAltComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltComponent.prototype, "size", void 0); VirtualPrivateCloudAltComponent = __decorate([ Component({ selector: "ibm-icon-virtual-private-cloud-alt", template: ` <svg ibmIconVirtualPrivateCloudAlt [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], VirtualPrivateCloudAltComponent); let VirtualPrivateCloudAltDirective = VirtualPrivateCloudAltDirective_1 = class VirtualPrivateCloudAltDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "VirtualPrivateCloudAlt32", "filepath": "virtual-private-cloud--alt/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": "M23.4141,22,10,8.5859V2H2v8H8.5859L22,23.4141V30h8V22ZM8,8H4V4H8ZM28,28H24V24h4Z" } }, { "elem": "path", "attrs": { "d": "M30 6a3.9915 3.9915 0 00-7.8579-1H13V7h9.1421A3.9945 3.9945 0 0025 9.8579V19h2V9.8579A3.9962 3.9962 0 0030 6zM26 8a2 2 0 112-2A2.0023 2.0023 0 0126 8zM19 25H9.8579A3.9945 3.9945 0 007 22.1421V13H5v9.1421A3.9915 3.9915 0 109.8579 27H19zM6 28a2 2 0 112-2A2.0023 2.0023 0 016 28z" } }], "name": "virtual-private-cloud--alt", "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="M23.4141,22,10,8.5859V2H2v8H8.5859L22,23.4141V30h8V22ZM8,8H4V4H8ZM28,28H24V24h4Z"></path><path d="M30 6a3.9915 3.9915 0 00-7.8579-1H13V7h9.1421A3.9945 3.9945 0 0025 9.8579V19h2V9.8579A3.9962 3.9962 0 0030 6zM26 8a2 2 0 112-2A2.0023 2.0023 0 0126 8zM19 25H9.8579A3.9945 3.9945 0 007 22.1421V13H5v9.1421A3.9915 3.9915 0 109.8579 27H19zM6 28a2 2 0 112-2A2.0023 2.0023 0 016 28z"></path></svg>` }, "24": { metadata: { "moduleName": "VirtualPrivateCloudAlt24", "filepath": "virtual-private-cloud--alt/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": "M23.4141,22,10,8.5859V2H2v8H8.5859L22,23.4141V30h8V22ZM8,8H4V4H8ZM28,28H24V24h4Z" } }, { "elem": "path", "attrs": { "d": "M30 6a3.9915 3.9915 0 00-7.8579-1H13V7h9.1421A3.9945 3.9945 0 0025 9.8579V19h2V9.8579A3.9962 3.9962 0 0030 6zM26 8a2 2 0 112-2A2.0023 2.0023 0 0126 8zM19 25H9.8579A3.9945 3.9945 0 007 22.1421V13H5v9.1421A3.9915 3.9915 0 109.8579 27H19zM6 28a2 2 0 112-2A2.0023 2.0023 0 016 28z" } }], "name": "virtual-private-cloud--alt", "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="M23.4141,22,10,8.5859V2H2v8H8.5859L22,23.4141V30h8V22ZM8,8H4V4H8ZM28,28H24V24h4Z"></path><path d="M30 6a3.9915 3.9915 0 00-7.8579-1H13V7h9.1421A3.9945 3.9945 0 0025 9.8579V19h2V9.8579A3.9962 3.9962 0 0030 6zM26 8a2 2 0 112-2A2.0023 2.0023 0 0126 8zM19 25H9.8579A3.9945 3.9945 0 007 22.1421V13H5v9.1421A3.9915 3.9915 0 109.8579 27H19zM6 28a2 2 0 112-2A2.0023 2.0023 0 016 28z"></path></svg>` }, "20": { metadata: { "moduleName": "VirtualPrivateCloudAlt20", "filepath": "virtual-private-cloud--alt/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": "M23.4141,22,10,8.5859V2H2v8H8.5859L22,23.4141V30h8V22ZM8,8H4V4H8ZM28,28H24V24h4Z" } }, { "elem": "path", "attrs": { "d": "M30 6a3.9915 3.9915 0 00-7.8579-1H13V7h9.1421A3.9945 3.9945 0 0025 9.8579V19h2V9.8579A3.9962 3.9962 0 0030 6zM26 8a2 2 0 112-2A2.0023 2.0023 0 0126 8zM19 25H9.8579A3.9945 3.9945 0 007 22.1421V13H5v9.1421A3.9915 3.9915 0 109.8579 27H19zM6 28a2 2 0 112-2A2.0023 2.0023 0 016 28z" } }], "name": "virtual-private-cloud--alt", "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="M23.4141,22,10,8.5859V2H2v8H8.5859L22,23.4141V30h8V22ZM8,8H4V4H8ZM28,28H24V24h4Z"></path><path d="M30 6a3.9915 3.9915 0 00-7.8579-1H13V7h9.1421A3.9945 3.9945 0 0025 9.8579V19h2V9.8579A3.9962 3.9962 0 0030 6zM26 8a2 2 0 112-2A2.0023 2.0023 0 0126 8zM19 25H9.8579A3.9945 3.9945 0 007 22.1421V13H5v9.1421A3.9915 3.9915 0 109.8579 27H19zM6 28a2 2 0 112-2A2.0023 2.0023 0 016 28z"></path></svg>` }, "16": { metadata: { "moduleName": "VirtualPrivateCloudAlt16", "filepath": "virtual-private-cloud--alt/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": "M23.4141,22,10,8.5859V2H2v8H8.5859L22,23.4141V30h8V22ZM8,8H4V4H8ZM28,28H24V24h4Z" } }, { "elem": "path", "attrs": { "d": "M30 6a3.9915 3.9915 0 00-7.8579-1H13V7h9.1421A3.9945 3.9945 0 0025 9.8579V19h2V9.8579A3.9962 3.9962 0 0030 6zM26 8a2 2 0 112-2A2.0023 2.0023 0 0126 8zM19 25H9.8579A3.9945 3.9945 0 007 22.1421V13H5v9.1421A3.9915 3.9915 0 109.8579 27H19zM6 28a2 2 0 112-2A2.0023 2.0023 0 016 28z" } }], "name": "virtual-private-cloud--alt", "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="M23.4141,22,10,8.5859V2H2v8H8.5859L22,23.4141V30h8V22ZM8,8H4V4H8ZM28,28H24V24h4Z"></path><path d="M30 6a3.9915 3.9915 0 00-7.8579-1H13V7h9.1421A3.9945 3.9945 0 0025 9.8579V19h2V9.8579A3.9962 3.9962 0 0030 6zM26 8a2 2 0 112-2A2.0023 2.0023 0 0126 8zM19 25H9.8579A3.9945 3.9945 0 007 22.1421V13H5v9.1421A3.9915 3.9915 0 109.8579 27H19zM6 28a2 2 0 112-2A2.0023 2.0023 0 016 28z"></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; VirtualPrivateCloudAltDirective_1.titleIdCounter++; title.setAttribute("id", `virtual-private-cloud-alt-${VirtualPrivateCloudAltDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `virtual-private-cloud-alt-${VirtualPrivateCloudAltDirective_1.titleIdCounter}`); } } }; VirtualPrivateCloudAltDirective.titleIdCounter = 0; VirtualPrivateCloudAltDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], VirtualPrivateCloudAltDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], VirtualPrivateCloudAltDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], VirtualPrivateCloudAltDirective.prototype, "size", void 0); VirtualPrivateCloudAltDirective = VirtualPrivateCloudAltDirective_1 = __decorate([ Directive({ selector: "[ibmIconVirtualPrivateCloudAlt]" }), __metadata("design:paramtypes", [ElementRef]) ], VirtualPrivateCloudAltDirective); let VirtualPrivateCloudAltModule = class VirtualPrivateCloudAltModule { }; VirtualPrivateCloudAltModule = __decorate([ NgModule({ declarations: [ VirtualPrivateCloudAltComponent, VirtualPrivateCloudAltDirective, ], exports: [ VirtualPrivateCloudAltComponent, VirtualPrivateCloudAltDirective, ] }) ], VirtualPrivateCloudAltModule); export { VirtualPrivateCloudAltComponent, VirtualPrivateCloudAltDirective, VirtualPrivateCloudAltModule };