UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 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 WatsonHealthScalpelCursorDirective_1; let WatsonHealthScalpelCursorComponent = class WatsonHealthScalpelCursorComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthScalpelCursorComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthScalpelCursorComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorComponent.prototype, "size", void 0); WatsonHealthScalpelCursorComponent = __decorate([ Component({ selector: "ibm-icon-watson-health-scalpel-cursor", template: ` <svg ibmIconWatsonHealthScalpelCursor [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], WatsonHealthScalpelCursorComponent); let WatsonHealthScalpelCursorDirective = WatsonHealthScalpelCursorDirective_1 = class WatsonHealthScalpelCursorDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonHealthScalpelCursor32", "filepath": "watson-health/scalpel--cursor/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": "M28.8281 7.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM13 4L4 4 4 13 6 13 6 6 13 6 13 4z" } }], "name": "scalpel--cursor", "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="M28.8281 7.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM13 4L4 4 4 13 6 13 6 6 13 6 13 4z"></path></svg>` }, "24": { metadata: { "moduleName": "WatsonHealthScalpelCursor24", "filepath": "watson-health/scalpel--cursor/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": "M28.8281 7.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM13 4L4 4 4 13 6 13 6 6 13 6 13 4z" } }], "name": "scalpel--cursor", "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="M28.8281 7.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM13 4L4 4 4 13 6 13 6 6 13 6 13 4z"></path></svg>` }, "20": { metadata: { "moduleName": "WatsonHealthScalpelCursor20", "filepath": "watson-health/scalpel--cursor/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": "M28.8281 7.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM13 4L4 4 4 13 6 13 6 6 13 6 13 4z" } }], "name": "scalpel--cursor", "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="M28.8281 7.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM13 4L4 4 4 13 6 13 6 6 13 6 13 4z"></path></svg>` }, "16": { metadata: { "moduleName": "WatsonHealthScalpelCursor16", "filepath": "watson-health/scalpel--cursor/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": "M28.8281 7.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM13 4L4 4 4 13 6 13 6 6 13 6 13 4z" } }], "name": "scalpel--cursor", "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="M28.8281 7.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM13 4L4 4 4 13 6 13 6 6 13 6 13 4z"></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; WatsonHealthScalpelCursorDirective_1.titleIdCounter++; title.setAttribute("id", `watson-health-scalpel-cursor-${WatsonHealthScalpelCursorDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `watson-health-scalpel-cursor-${WatsonHealthScalpelCursorDirective_1.titleIdCounter}`); } } }; WatsonHealthScalpelCursorDirective.titleIdCounter = 0; WatsonHealthScalpelCursorDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthScalpelCursorDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthScalpelCursorDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthScalpelCursorDirective.prototype, "size", void 0); WatsonHealthScalpelCursorDirective = WatsonHealthScalpelCursorDirective_1 = __decorate([ Directive({ selector: "[ibmIconWatsonHealthScalpelCursor]" }), __metadata("design:paramtypes", [ElementRef]) ], WatsonHealthScalpelCursorDirective); let WatsonHealthScalpelCursorModule = class WatsonHealthScalpelCursorModule { }; WatsonHealthScalpelCursorModule = __decorate([ NgModule({ declarations: [ WatsonHealthScalpelCursorComponent, WatsonHealthScalpelCursorDirective, ], exports: [ WatsonHealthScalpelCursorComponent, WatsonHealthScalpelCursorDirective, ] }) ], WatsonHealthScalpelCursorModule); export { WatsonHealthScalpelCursorComponent, WatsonHealthScalpelCursorDirective, WatsonHealthScalpelCursorModule };