UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 11.2 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var FaceDizzyComponent = /** @class */ (function () { function FaceDizzyComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], FaceDizzyComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], FaceDizzyComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyComponent.prototype, "size", void 0); FaceDizzyComponent = __decorate([ Component({ selector: "ibm-icon-face-dizzy", template: "\n <svg\n ibmIconFaceDizzy\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 " }) ], FaceDizzyComponent); return FaceDizzyComponent; }()); var FaceDizzyDirective = /** @class */ (function () { function FaceDizzyDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "FaceDizzy32", "filepath": "face--dizzy/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": "M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z" } }, { "elem": "path", "attrs": { "d": "M24.41 11L23 9.59 21 11.59 19 9.59 17.59 11 19.59 13 17.59 15 19 16.41 21 14.41 23 16.41 24.41 15 22.41 13 24.41 11zM14.41 11L13 9.59 11 11.59 9 9.59 7.59 11 9.59 13 7.59 15 9 16.41 11 14.41 13 16.41 14.41 15 12.41 13 14.41 11zM16 19a3 3 0 103 3 3 3 0 00-3-3z" } }], "name": "face--dizzy", "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=\"M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z\"></path><path d=\"M24.41 11L23 9.59 21 11.59 19 9.59 17.59 11 19.59 13 17.59 15 19 16.41 21 14.41 23 16.41 24.41 15 22.41 13 24.41 11zM14.41 11L13 9.59 11 11.59 9 9.59 7.59 11 9.59 13 7.59 15 9 16.41 11 14.41 13 16.41 14.41 15 12.41 13 14.41 11zM16 19a3 3 0 103 3 3 3 0 00-3-3z\"></path></svg>" }, "24": { metadata: { "moduleName": "FaceDizzy24", "filepath": "face--dizzy/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": "M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z" } }, { "elem": "path", "attrs": { "d": "M24.41 11L23 9.59 21 11.59 19 9.59 17.59 11 19.59 13 17.59 15 19 16.41 21 14.41 23 16.41 24.41 15 22.41 13 24.41 11zM14.41 11L13 9.59 11 11.59 9 9.59 7.59 11 9.59 13 7.59 15 9 16.41 11 14.41 13 16.41 14.41 15 12.41 13 14.41 11zM16 19a3 3 0 103 3 3 3 0 00-3-3z" } }], "name": "face--dizzy", "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=\"M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z\"></path><path d=\"M24.41 11L23 9.59 21 11.59 19 9.59 17.59 11 19.59 13 17.59 15 19 16.41 21 14.41 23 16.41 24.41 15 22.41 13 24.41 11zM14.41 11L13 9.59 11 11.59 9 9.59 7.59 11 9.59 13 7.59 15 9 16.41 11 14.41 13 16.41 14.41 15 12.41 13 14.41 11zM16 19a3 3 0 103 3 3 3 0 00-3-3z\"></path></svg>" }, "20": { metadata: { "moduleName": "FaceDizzy20", "filepath": "face--dizzy/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": "M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z" } }, { "elem": "path", "attrs": { "d": "M24.41 11L23 9.59 21 11.59 19 9.59 17.59 11 19.59 13 17.59 15 19 16.41 21 14.41 23 16.41 24.41 15 22.41 13 24.41 11zM14.41 11L13 9.59 11 11.59 9 9.59 7.59 11 9.59 13 7.59 15 9 16.41 11 14.41 13 16.41 14.41 15 12.41 13 14.41 11zM16 19a3 3 0 103 3 3 3 0 00-3-3z" } }], "name": "face--dizzy", "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=\"M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z\"></path><path d=\"M24.41 11L23 9.59 21 11.59 19 9.59 17.59 11 19.59 13 17.59 15 19 16.41 21 14.41 23 16.41 24.41 15 22.41 13 24.41 11zM14.41 11L13 9.59 11 11.59 9 9.59 7.59 11 9.59 13 7.59 15 9 16.41 11 14.41 13 16.41 14.41 15 12.41 13 14.41 11zM16 19a3 3 0 103 3 3 3 0 00-3-3z\"></path></svg>" }, "16": { metadata: { "moduleName": "FaceDizzy16", "filepath": "face--dizzy/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": "M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z" } }, { "elem": "path", "attrs": { "d": "M24.41 11L23 9.59 21 11.59 19 9.59 17.59 11 19.59 13 17.59 15 19 16.41 21 14.41 23 16.41 24.41 15 22.41 13 24.41 11zM14.41 11L13 9.59 11 11.59 9 9.59 7.59 11 9.59 13 7.59 15 9 16.41 11 14.41 13 16.41 14.41 15 12.41 13 14.41 11zM16 19a3 3 0 103 3 3 3 0 00-3-3z" } }], "name": "face--dizzy", "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=\"M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z\"></path><path d=\"M24.41 11L23 9.59 21 11.59 19 9.59 17.59 11 19.59 13 17.59 15 19 16.41 21 14.41 23 16.41 24.41 15 22.41 13 24.41 11zM14.41 11L13 9.59 11 11.59 9 9.59 7.59 11 9.59 13 7.59 15 9 16.41 11 14.41 13 16.41 14.41 15 12.41 13 14.41 11zM16 19a3 3 0 103 3 3 3 0 00-3-3z\"></path></svg>" }, }; } FaceDizzyDirective_1 = FaceDizzyDirective; FaceDizzyDirective.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; FaceDizzyDirective_1.titleIdCounter++; title.setAttribute("id", "face-dizzy-" + FaceDizzyDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "face-dizzy-" + FaceDizzyDirective_1.titleIdCounter); } }; var FaceDizzyDirective_1; FaceDizzyDirective.titleIdCounter = 0; FaceDizzyDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], FaceDizzyDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], FaceDizzyDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], FaceDizzyDirective.prototype, "size", void 0); FaceDizzyDirective = FaceDizzyDirective_1 = __decorate([ Directive({ selector: "[ibmIconFaceDizzy]" }), __metadata("design:paramtypes", [ElementRef]) ], FaceDizzyDirective); return FaceDizzyDirective; }()); var FaceDizzyModule = /** @class */ (function () { function FaceDizzyModule() { } FaceDizzyModule = __decorate([ NgModule({ declarations: [ FaceDizzyComponent, FaceDizzyDirective, ], exports: [ FaceDizzyComponent, FaceDizzyDirective, ] }) ], FaceDizzyModule); return FaceDizzyModule; }()); export { FaceDizzyComponent, FaceDizzyDirective, FaceDizzyModule };