UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 11.8 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var UserXRayComponent = /** @class */ (function () { function UserXRayComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], UserXRayComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserXRayComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], UserXRayComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserXRayComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], UserXRayComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserXRayComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserXRayComponent.prototype, "size", void 0); UserXRayComponent = __decorate([ Component({ selector: "ibm-icon-user-x-ray", template: "\n <svg\n ibmIconUserXRay\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 " }) ], UserXRayComponent); return UserXRayComponent; }()); var UserXRayDirective = /** @class */ (function () { function UserXRayDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "UserXRay32", "filepath": "user--x-ray/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": { "fill": "none", "d": "M28 9L28 7 25 7 25 5 23 5 23 7 20 7 20 9 23 9 23 12 20 12 20 14 23 14 23 16 25 16 25 14 28 14 28 12 25 12 25 9 28 9z" } }, { "elem": "path", "attrs": { "d": "M31 3H17a1 1 0 00-1 1V17a1 1 0 001 1H31a1 1 0 001-1V4A1 1 0 0031 3zM28 9H25v3h3v2H25v2H23V14H20V12h3V9H20V7h3V5h2V7h3zM15 30H13V26a2.9465 2.9465 0 00-3-3H6a2.9465 2.9465 0 00-3 3v4H1V26a4.9514 4.9514 0 015-5h4a4.9514 4.9514 0 015 5zM8 11a3 3 0 010 6 3 3 0 010-6M8 9A5 5 0 008 19 5 5 0 008 9z" } }], "name": "user--x-ray", "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 fill=\"none\" d=\"M28 9L28 7 25 7 25 5 23 5 23 7 20 7 20 9 23 9 23 12 20 12 20 14 23 14 23 16 25 16 25 14 28 14 28 12 25 12 25 9 28 9z\"></path><path d=\"M31 3H17a1 1 0 00-1 1V17a1 1 0 001 1H31a1 1 0 001-1V4A1 1 0 0031 3zM28 9H25v3h3v2H25v2H23V14H20V12h3V9H20V7h3V5h2V7h3zM15 30H13V26a2.9465 2.9465 0 00-3-3H6a2.9465 2.9465 0 00-3 3v4H1V26a4.9514 4.9514 0 015-5h4a4.9514 4.9514 0 015 5zM8 11a3 3 0 010 6 3 3 0 010-6M8 9A5 5 0 008 19 5 5 0 008 9z\"></path></svg>" }, "24": { metadata: { "moduleName": "UserXRay24", "filepath": "user--x-ray/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": { "fill": "none", "d": "M28 9L28 7 25 7 25 5 23 5 23 7 20 7 20 9 23 9 23 12 20 12 20 14 23 14 23 16 25 16 25 14 28 14 28 12 25 12 25 9 28 9z" } }, { "elem": "path", "attrs": { "d": "M31 3H17a1 1 0 00-1 1V17a1 1 0 001 1H31a1 1 0 001-1V4A1 1 0 0031 3zM28 9H25v3h3v2H25v2H23V14H20V12h3V9H20V7h3V5h2V7h3zM15 30H13V26a2.9465 2.9465 0 00-3-3H6a2.9465 2.9465 0 00-3 3v4H1V26a4.9514 4.9514 0 015-5h4a4.9514 4.9514 0 015 5zM8 11a3 3 0 010 6 3 3 0 010-6M8 9A5 5 0 008 19 5 5 0 008 9z" } }], "name": "user--x-ray", "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 fill=\"none\" d=\"M28 9L28 7 25 7 25 5 23 5 23 7 20 7 20 9 23 9 23 12 20 12 20 14 23 14 23 16 25 16 25 14 28 14 28 12 25 12 25 9 28 9z\"></path><path d=\"M31 3H17a1 1 0 00-1 1V17a1 1 0 001 1H31a1 1 0 001-1V4A1 1 0 0031 3zM28 9H25v3h3v2H25v2H23V14H20V12h3V9H20V7h3V5h2V7h3zM15 30H13V26a2.9465 2.9465 0 00-3-3H6a2.9465 2.9465 0 00-3 3v4H1V26a4.9514 4.9514 0 015-5h4a4.9514 4.9514 0 015 5zM8 11a3 3 0 010 6 3 3 0 010-6M8 9A5 5 0 008 19 5 5 0 008 9z\"></path></svg>" }, "20": { metadata: { "moduleName": "UserXRay20", "filepath": "user--x-ray/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": { "fill": "none", "d": "M28 9L28 7 25 7 25 5 23 5 23 7 20 7 20 9 23 9 23 12 20 12 20 14 23 14 23 16 25 16 25 14 28 14 28 12 25 12 25 9 28 9z" } }, { "elem": "path", "attrs": { "d": "M31 3H17a1 1 0 00-1 1V17a1 1 0 001 1H31a1 1 0 001-1V4A1 1 0 0031 3zM28 9H25v3h3v2H25v2H23V14H20V12h3V9H20V7h3V5h2V7h3zM15 30H13V26a2.9465 2.9465 0 00-3-3H6a2.9465 2.9465 0 00-3 3v4H1V26a4.9514 4.9514 0 015-5h4a4.9514 4.9514 0 015 5zM8 11a3 3 0 010 6 3 3 0 010-6M8 9A5 5 0 008 19 5 5 0 008 9z" } }], "name": "user--x-ray", "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 fill=\"none\" d=\"M28 9L28 7 25 7 25 5 23 5 23 7 20 7 20 9 23 9 23 12 20 12 20 14 23 14 23 16 25 16 25 14 28 14 28 12 25 12 25 9 28 9z\"></path><path d=\"M31 3H17a1 1 0 00-1 1V17a1 1 0 001 1H31a1 1 0 001-1V4A1 1 0 0031 3zM28 9H25v3h3v2H25v2H23V14H20V12h3V9H20V7h3V5h2V7h3zM15 30H13V26a2.9465 2.9465 0 00-3-3H6a2.9465 2.9465 0 00-3 3v4H1V26a4.9514 4.9514 0 015-5h4a4.9514 4.9514 0 015 5zM8 11a3 3 0 010 6 3 3 0 010-6M8 9A5 5 0 008 19 5 5 0 008 9z\"></path></svg>" }, "16": { metadata: { "moduleName": "UserXRay16", "filepath": "user--x-ray/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": { "fill": "none", "d": "M28 9L28 7 25 7 25 5 23 5 23 7 20 7 20 9 23 9 23 12 20 12 20 14 23 14 23 16 25 16 25 14 28 14 28 12 25 12 25 9 28 9z" } }, { "elem": "path", "attrs": { "d": "M31 3H17a1 1 0 00-1 1V17a1 1 0 001 1H31a1 1 0 001-1V4A1 1 0 0031 3zM28 9H25v3h3v2H25v2H23V14H20V12h3V9H20V7h3V5h2V7h3zM15 30H13V26a2.9465 2.9465 0 00-3-3H6a2.9465 2.9465 0 00-3 3v4H1V26a4.9514 4.9514 0 015-5h4a4.9514 4.9514 0 015 5zM8 11a3 3 0 010 6 3 3 0 010-6M8 9A5 5 0 008 19 5 5 0 008 9z" } }], "name": "user--x-ray", "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 fill=\"none\" d=\"M28 9L28 7 25 7 25 5 23 5 23 7 20 7 20 9 23 9 23 12 20 12 20 14 23 14 23 16 25 16 25 14 28 14 28 12 25 12 25 9 28 9z\"></path><path d=\"M31 3H17a1 1 0 00-1 1V17a1 1 0 001 1H31a1 1 0 001-1V4A1 1 0 0031 3zM28 9H25v3h3v2H25v2H23V14H20V12h3V9H20V7h3V5h2V7h3zM15 30H13V26a2.9465 2.9465 0 00-3-3H6a2.9465 2.9465 0 00-3 3v4H1V26a4.9514 4.9514 0 015-5h4a4.9514 4.9514 0 015 5zM8 11a3 3 0 010 6 3 3 0 010-6M8 9A5 5 0 008 19 5 5 0 008 9z\"></path></svg>" }, }; } UserXRayDirective_1 = UserXRayDirective; UserXRayDirective.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; UserXRayDirective_1.titleIdCounter++; title.setAttribute("id", "user-x-ray-" + UserXRayDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "user-x-ray-" + UserXRayDirective_1.titleIdCounter); } }; var UserXRayDirective_1; UserXRayDirective.titleIdCounter = 0; UserXRayDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], UserXRayDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserXRayDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], UserXRayDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserXRayDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], UserXRayDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserXRayDirective.prototype, "size", void 0); UserXRayDirective = UserXRayDirective_1 = __decorate([ Directive({ selector: "[ibmIconUserXRay]" }), __metadata("design:paramtypes", [ElementRef]) ], UserXRayDirective); return UserXRayDirective; }()); var UserXRayModule = /** @class */ (function () { function UserXRayModule() { } UserXRayModule = __decorate([ NgModule({ declarations: [ UserXRayComponent, UserXRayDirective, ], exports: [ UserXRayComponent, UserXRayDirective, ] }) ], UserXRayModule); return UserXRayModule; }()); export { UserXRayComponent, UserXRayDirective, UserXRayModule };