UNPKG

@carbon/icons-angular

Version:

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

177 lines (172 loc) 13.8 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('@angular/core'), require('@carbon/icon-helpers')) : typeof define === 'function' && define.amd ? define(['exports', 'tslib', '@angular/core', '@carbon/icon-helpers'], factory) : (global = global || self, factory((global.CarbonIconsAngular = global.CarbonIconsAngular || {}, global.CarbonIconsAngular.DriverAnalysis = {}), global.tslib, global.ng.core, global.CarbonIconHelpers)); }(this, (function (exports, tslib, core, iconHelpers) { 'use strict'; var DriverAnalysisComponent = /** @class */ (function () { function DriverAnalysisComponent() { this.focusable = false; } tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisComponent.prototype, "ariaLabel", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisComponent.prototype, "ariaLabelledby", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], DriverAnalysisComponent.prototype, "ariaHidden", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisComponent.prototype, "title", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], DriverAnalysisComponent.prototype, "focusable", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisComponent.prototype, "innerClass", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisComponent.prototype, "size", void 0); DriverAnalysisComponent = tslib.__decorate([ core.Component({ selector: "ibm-icon-driver-analysis", template: "\n <svg\n ibmIconDriverAnalysis\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 " }) ], DriverAnalysisComponent); return DriverAnalysisComponent; }()); var DriverAnalysisDirective = /** @class */ (function () { function DriverAnalysisDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "DriverAnalysis32", "filepath": "driver-analysis/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": "circle", "attrs": { "cx": "22", "cy": "16", "r": "2" } }, { "elem": "path", "attrs": { "d": "M30,15H27.91A6.0048,6.0048,0,0,0,22,10l-.022.001A9.9833,9.9833,0,0,0,4.0508,15H2v2H4.0508A9.9833,9.9833,0,0,0,21.978,21.999L22,22a6.0048,6.0048,0,0,0,5.91-5H30ZM14,8a7.9769,7.9769,0,0,1,5.7383,2.4463A6.0152,6.0152,0,0,0,16.0891,15H6.0693A8.0073,8.0073,0,0,1,14,8Zm0,16a8.0073,8.0073,0,0,1-7.9307-7h10.02a6.0152,6.0152,0,0,0,3.6492,4.5537A7.9769,7.9769,0,0,1,14,24Zm8-4a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,22,20Z" } }], "name": "driver-analysis", "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\"><circle cx=\"22\" cy=\"16\" r=\"2\"></circle><path d=\"M30,15H27.91A6.0048,6.0048,0,0,0,22,10l-.022.001A9.9833,9.9833,0,0,0,4.0508,15H2v2H4.0508A9.9833,9.9833,0,0,0,21.978,21.999L22,22a6.0048,6.0048,0,0,0,5.91-5H30ZM14,8a7.9769,7.9769,0,0,1,5.7383,2.4463A6.0152,6.0152,0,0,0,16.0891,15H6.0693A8.0073,8.0073,0,0,1,14,8Zm0,16a8.0073,8.0073,0,0,1-7.9307-7h10.02a6.0152,6.0152,0,0,0,3.6492,4.5537A7.9769,7.9769,0,0,1,14,24Zm8-4a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,22,20Z\"></path></svg>" }, "24": { metadata: { "moduleName": "DriverAnalysis24", "filepath": "driver-analysis/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": "circle", "attrs": { "cx": "22", "cy": "16", "r": "2" } }, { "elem": "path", "attrs": { "d": "M30,15H27.91A6.0048,6.0048,0,0,0,22,10l-.022.001A9.9833,9.9833,0,0,0,4.0508,15H2v2H4.0508A9.9833,9.9833,0,0,0,21.978,21.999L22,22a6.0048,6.0048,0,0,0,5.91-5H30ZM14,8a7.9769,7.9769,0,0,1,5.7383,2.4463A6.0152,6.0152,0,0,0,16.0891,15H6.0693A8.0073,8.0073,0,0,1,14,8Zm0,16a8.0073,8.0073,0,0,1-7.9307-7h10.02a6.0152,6.0152,0,0,0,3.6492,4.5537A7.9769,7.9769,0,0,1,14,24Zm8-4a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,22,20Z" } }], "name": "driver-analysis", "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\"><circle cx=\"22\" cy=\"16\" r=\"2\"></circle><path d=\"M30,15H27.91A6.0048,6.0048,0,0,0,22,10l-.022.001A9.9833,9.9833,0,0,0,4.0508,15H2v2H4.0508A9.9833,9.9833,0,0,0,21.978,21.999L22,22a6.0048,6.0048,0,0,0,5.91-5H30ZM14,8a7.9769,7.9769,0,0,1,5.7383,2.4463A6.0152,6.0152,0,0,0,16.0891,15H6.0693A8.0073,8.0073,0,0,1,14,8Zm0,16a8.0073,8.0073,0,0,1-7.9307-7h10.02a6.0152,6.0152,0,0,0,3.6492,4.5537A7.9769,7.9769,0,0,1,14,24Zm8-4a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,22,20Z\"></path></svg>" }, "20": { metadata: { "moduleName": "DriverAnalysis20", "filepath": "driver-analysis/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": "circle", "attrs": { "cx": "22", "cy": "16", "r": "2" } }, { "elem": "path", "attrs": { "d": "M30,15H27.91A6.0048,6.0048,0,0,0,22,10l-.022.001A9.9833,9.9833,0,0,0,4.0508,15H2v2H4.0508A9.9833,9.9833,0,0,0,21.978,21.999L22,22a6.0048,6.0048,0,0,0,5.91-5H30ZM14,8a7.9769,7.9769,0,0,1,5.7383,2.4463A6.0152,6.0152,0,0,0,16.0891,15H6.0693A8.0073,8.0073,0,0,1,14,8Zm0,16a8.0073,8.0073,0,0,1-7.9307-7h10.02a6.0152,6.0152,0,0,0,3.6492,4.5537A7.9769,7.9769,0,0,1,14,24Zm8-4a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,22,20Z" } }], "name": "driver-analysis", "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\"><circle cx=\"22\" cy=\"16\" r=\"2\"></circle><path d=\"M30,15H27.91A6.0048,6.0048,0,0,0,22,10l-.022.001A9.9833,9.9833,0,0,0,4.0508,15H2v2H4.0508A9.9833,9.9833,0,0,0,21.978,21.999L22,22a6.0048,6.0048,0,0,0,5.91-5H30ZM14,8a7.9769,7.9769,0,0,1,5.7383,2.4463A6.0152,6.0152,0,0,0,16.0891,15H6.0693A8.0073,8.0073,0,0,1,14,8Zm0,16a8.0073,8.0073,0,0,1-7.9307-7h10.02a6.0152,6.0152,0,0,0,3.6492,4.5537A7.9769,7.9769,0,0,1,14,24Zm8-4a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,22,20Z\"></path></svg>" }, "16": { metadata: { "moduleName": "DriverAnalysis16", "filepath": "driver-analysis/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": "circle", "attrs": { "cx": "22", "cy": "16", "r": "2" } }, { "elem": "path", "attrs": { "d": "M30,15H27.91A6.0048,6.0048,0,0,0,22,10l-.022.001A9.9833,9.9833,0,0,0,4.0508,15H2v2H4.0508A9.9833,9.9833,0,0,0,21.978,21.999L22,22a6.0048,6.0048,0,0,0,5.91-5H30ZM14,8a7.9769,7.9769,0,0,1,5.7383,2.4463A6.0152,6.0152,0,0,0,16.0891,15H6.0693A8.0073,8.0073,0,0,1,14,8Zm0,16a8.0073,8.0073,0,0,1-7.9307-7h10.02a6.0152,6.0152,0,0,0,3.6492,4.5537A7.9769,7.9769,0,0,1,14,24Zm8-4a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,22,20Z" } }], "name": "driver-analysis", "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\"><circle cx=\"22\" cy=\"16\" r=\"2\"></circle><path d=\"M30,15H27.91A6.0048,6.0048,0,0,0,22,10l-.022.001A9.9833,9.9833,0,0,0,4.0508,15H2v2H4.0508A9.9833,9.9833,0,0,0,21.978,21.999L22,22a6.0048,6.0048,0,0,0,5.91-5H30ZM14,8a7.9769,7.9769,0,0,1,5.7383,2.4463A6.0152,6.0152,0,0,0,16.0891,15H6.0693A8.0073,8.0073,0,0,1,14,8Zm0,16a8.0073,8.0073,0,0,1-7.9307-7h10.02a6.0152,6.0152,0,0,0,3.6492,4.5537A7.9769,7.9769,0,0,1,14,24Zm8-4a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,22,20Z\"></path></svg>" }, }; } DriverAnalysisDirective_1 = DriverAnalysisDirective; DriverAnalysisDirective.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 = iconHelpers.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; DriverAnalysisDirective_1.titleIdCounter++; title.setAttribute("id", "driver-analysis-" + DriverAnalysisDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "driver-analysis-" + DriverAnalysisDirective_1.titleIdCounter); } }; var DriverAnalysisDirective_1; DriverAnalysisDirective.titleIdCounter = 0; DriverAnalysisDirective.ctorParameters = function () { return [ { type: core.ElementRef } ]; }; tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisDirective.prototype, "ariaLabel", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisDirective.prototype, "ariaLabelledby", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], DriverAnalysisDirective.prototype, "ariaHidden", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisDirective.prototype, "title", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], DriverAnalysisDirective.prototype, "isFocusable", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], DriverAnalysisDirective.prototype, "size", void 0); DriverAnalysisDirective = DriverAnalysisDirective_1 = tslib.__decorate([ core.Directive({ selector: "[ibmIconDriverAnalysis]" }), tslib.__metadata("design:paramtypes", [core.ElementRef]) ], DriverAnalysisDirective); return DriverAnalysisDirective; }()); var DriverAnalysisModule = /** @class */ (function () { function DriverAnalysisModule() { } DriverAnalysisModule = tslib.__decorate([ core.NgModule({ declarations: [ DriverAnalysisComponent, DriverAnalysisDirective, ], exports: [ DriverAnalysisComponent, DriverAnalysisDirective, ] }) ], DriverAnalysisModule); return DriverAnalysisModule; }()); exports.DriverAnalysisComponent = DriverAnalysisComponent; exports.DriverAnalysisDirective = DriverAnalysisDirective; exports.DriverAnalysisModule = DriverAnalysisModule; Object.defineProperty(exports, '__esModule', { value: true }); })));