UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 10.1 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var Network_3Component = /** @class */ (function () { function Network_3Component() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], Network_3Component.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], Network_3Component.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], Network_3Component.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], Network_3Component.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], Network_3Component.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], Network_3Component.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], Network_3Component.prototype, "size", void 0); Network_3Component = __decorate([ Component({ selector: "ibm-icon-network-3", template: "\n <svg\n ibmIconNetwork_3\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 " }) ], Network_3Component); return Network_3Component; }()); var Network_3Directive = /** @class */ (function () { function Network_3Directive(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "Network_332", "filepath": "network--3/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 30H22V22h8zm-6-2h4V24H24zM20 27H8A6 6 0 018 15h2v2H8a4 4 0 000 8H20z" } }, { "elem": "path", "attrs": { "d": "M20,20H12V12h8Zm-6-2h4V14H14Z" } }, { "elem": "path", "attrs": { "d": "M24 17H22V15h2a4 4 0 000-8H12V5H24a6 6 0 010 12zM10 10H2V2h8zM4 8H8V4H4z" } }], "name": "network--3", "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 30H22V22h8zm-6-2h4V24H24zM20 27H8A6 6 0 018 15h2v2H8a4 4 0 000 8H20z\"></path><path d=\"M20,20H12V12h8Zm-6-2h4V14H14Z\"></path><path d=\"M24 17H22V15h2a4 4 0 000-8H12V5H24a6 6 0 010 12zM10 10H2V2h8zM4 8H8V4H4z\"></path></svg>" }, "24": { metadata: { "moduleName": "Network_324", "filepath": "network--3/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 30H22V22h8zm-6-2h4V24H24zM20 27H8A6 6 0 018 15h2v2H8a4 4 0 000 8H20z" } }, { "elem": "path", "attrs": { "d": "M20,20H12V12h8Zm-6-2h4V14H14Z" } }, { "elem": "path", "attrs": { "d": "M24 17H22V15h2a4 4 0 000-8H12V5H24a6 6 0 010 12zM10 10H2V2h8zM4 8H8V4H4z" } }], "name": "network--3", "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 30H22V22h8zm-6-2h4V24H24zM20 27H8A6 6 0 018 15h2v2H8a4 4 0 000 8H20z\"></path><path d=\"M20,20H12V12h8Zm-6-2h4V14H14Z\"></path><path d=\"M24 17H22V15h2a4 4 0 000-8H12V5H24a6 6 0 010 12zM10 10H2V2h8zM4 8H8V4H4z\"></path></svg>" }, "20": { metadata: { "moduleName": "Network_320", "filepath": "network--3/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 30H22V22h8zm-6-2h4V24H24zM20 27H8A6 6 0 018 15h2v2H8a4 4 0 000 8H20z" } }, { "elem": "path", "attrs": { "d": "M20,20H12V12h8Zm-6-2h4V14H14Z" } }, { "elem": "path", "attrs": { "d": "M24 17H22V15h2a4 4 0 000-8H12V5H24a6 6 0 010 12zM10 10H2V2h8zM4 8H8V4H4z" } }], "name": "network--3", "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 30H22V22h8zm-6-2h4V24H24zM20 27H8A6 6 0 018 15h2v2H8a4 4 0 000 8H20z\"></path><path d=\"M20,20H12V12h8Zm-6-2h4V14H14Z\"></path><path d=\"M24 17H22V15h2a4 4 0 000-8H12V5H24a6 6 0 010 12zM10 10H2V2h8zM4 8H8V4H4z\"></path></svg>" }, "16": { metadata: { "moduleName": "Network_316", "filepath": "network--3/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 30H22V22h8zm-6-2h4V24H24zM20 27H8A6 6 0 018 15h2v2H8a4 4 0 000 8H20z" } }, { "elem": "path", "attrs": { "d": "M20,20H12V12h8Zm-6-2h4V14H14Z" } }, { "elem": "path", "attrs": { "d": "M24 17H22V15h2a4 4 0 000-8H12V5H24a6 6 0 010 12zM10 10H2V2h8zM4 8H8V4H4z" } }], "name": "network--3", "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 30H22V22h8zm-6-2h4V24H24zM20 27H8A6 6 0 018 15h2v2H8a4 4 0 000 8H20z\"></path><path d=\"M20,20H12V12h8Zm-6-2h4V14H14Z\"></path><path d=\"M24 17H22V15h2a4 4 0 000-8H12V5H24a6 6 0 010 12zM10 10H2V2h8zM4 8H8V4H4z\"></path></svg>" }, }; } Network_3Directive_1 = Network_3Directive; Network_3Directive.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; Network_3Directive_1.titleIdCounter++; title.setAttribute("id", "network-3-" + Network_3Directive_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "network-3-" + Network_3Directive_1.titleIdCounter); } }; var Network_3Directive_1; Network_3Directive.titleIdCounter = 0; Network_3Directive.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], Network_3Directive.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], Network_3Directive.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], Network_3Directive.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], Network_3Directive.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], Network_3Directive.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], Network_3Directive.prototype, "size", void 0); Network_3Directive = Network_3Directive_1 = __decorate([ Directive({ selector: "[ibmIconNetwork_3]" }), __metadata("design:paramtypes", [ElementRef]) ], Network_3Directive); return Network_3Directive; }()); var Network_3Module = /** @class */ (function () { function Network_3Module() { } Network_3Module = __decorate([ NgModule({ declarations: [ Network_3Component, Network_3Directive, ], exports: [ Network_3Component, Network_3Directive, ] }) ], Network_3Module); return Network_3Module; }()); export { Network_3Component, Network_3Directive, Network_3Module };