UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 14.7 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var WatsonHealthInteractiveSegmentationCursorDirective_1; let WatsonHealthInteractiveSegmentationCursorComponent = class WatsonHealthInteractiveSegmentationCursorComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthInteractiveSegmentationCursorComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthInteractiveSegmentationCursorComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorComponent.prototype, "size", void 0); WatsonHealthInteractiveSegmentationCursorComponent = __decorate([ Component({ selector: "ibm-icon-watson-health-interactive-segmentation-cursor", template: ` <svg ibmIconWatsonHealthInteractiveSegmentationCursor [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], WatsonHealthInteractiveSegmentationCursorComponent); let WatsonHealthInteractiveSegmentationCursorDirective = WatsonHealthInteractiveSegmentationCursorDirective_1 = class WatsonHealthInteractiveSegmentationCursorDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonHealthInteractiveSegmentationCursor32", "filepath": "watson-health/interactive-segmentation-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": "M29.4139,24,15.9989,10.5663a2.0473,2.0473,0,0,0-2.8281,0l-2.586,2.586a2.0023,2.0023,0,0,0,0,2.8283L23.9989,29.4145a2.0021,2.0021,0,0,0,2.8281,0l2.5869-2.5865a1.9993,1.9993,0,0,0,0-2.8283Zm-17.415-9.4335,2.5859-2.5859,3.5,3.5L15.498,18.0676l-3.5-3.5ZM25.413,28l-8.5009-8.5188,2.5867-2.587L28,25.4143Z" } }, { "elem": "path", "attrs": { "d": "M7.586 18.586H10.414V21.413999999999998H7.586z", "transform": "rotate(-45 9 20)" } }, { "elem": "path", "attrs": { "d": "M18.586 7.586H21.413999999999998V10.414H18.586z", "transform": "rotate(-45 20 9)" } }, { "elem": "path", "attrs": { "d": "M7.586 7.586H10.414V10.414H7.586z", "transform": "rotate(-45 9 9)" } }, { "elem": "path", "attrs": { "d": "M11 2L2 2 2 11 4 11 4 4 11 4 11 2z" } }], "name": "interactive-segmentation-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="M29.4139,24,15.9989,10.5663a2.0473,2.0473,0,0,0-2.8281,0l-2.586,2.586a2.0023,2.0023,0,0,0,0,2.8283L23.9989,29.4145a2.0021,2.0021,0,0,0,2.8281,0l2.5869-2.5865a1.9993,1.9993,0,0,0,0-2.8283Zm-17.415-9.4335,2.5859-2.5859,3.5,3.5L15.498,18.0676l-3.5-3.5ZM25.413,28l-8.5009-8.5188,2.5867-2.587L28,25.4143Z"></path><path d="M7.586 18.586H10.414V21.413999999999998H7.586z" transform="rotate(-45 9 20)"></path><path d="M18.586 7.586H21.413999999999998V10.414H18.586z" transform="rotate(-45 20 9)"></path><path d="M7.586 7.586H10.414V10.414H7.586z" transform="rotate(-45 9 9)"></path><path d="M11 2L2 2 2 11 4 11 4 4 11 4 11 2z"></path></svg>` }, "24": { metadata: { "moduleName": "WatsonHealthInteractiveSegmentationCursor24", "filepath": "watson-health/interactive-segmentation-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": "M29.4139,24,15.9989,10.5663a2.0473,2.0473,0,0,0-2.8281,0l-2.586,2.586a2.0023,2.0023,0,0,0,0,2.8283L23.9989,29.4145a2.0021,2.0021,0,0,0,2.8281,0l2.5869-2.5865a1.9993,1.9993,0,0,0,0-2.8283Zm-17.415-9.4335,2.5859-2.5859,3.5,3.5L15.498,18.0676l-3.5-3.5ZM25.413,28l-8.5009-8.5188,2.5867-2.587L28,25.4143Z" } }, { "elem": "path", "attrs": { "d": "M7.586 18.586H10.414V21.413999999999998H7.586z", "transform": "rotate(-45 9 20)" } }, { "elem": "path", "attrs": { "d": "M18.586 7.586H21.413999999999998V10.414H18.586z", "transform": "rotate(-45 20 9)" } }, { "elem": "path", "attrs": { "d": "M7.586 7.586H10.414V10.414H7.586z", "transform": "rotate(-45 9 9)" } }, { "elem": "path", "attrs": { "d": "M11 2L2 2 2 11 4 11 4 4 11 4 11 2z" } }], "name": "interactive-segmentation-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="M29.4139,24,15.9989,10.5663a2.0473,2.0473,0,0,0-2.8281,0l-2.586,2.586a2.0023,2.0023,0,0,0,0,2.8283L23.9989,29.4145a2.0021,2.0021,0,0,0,2.8281,0l2.5869-2.5865a1.9993,1.9993,0,0,0,0-2.8283Zm-17.415-9.4335,2.5859-2.5859,3.5,3.5L15.498,18.0676l-3.5-3.5ZM25.413,28l-8.5009-8.5188,2.5867-2.587L28,25.4143Z"></path><path d="M7.586 18.586H10.414V21.413999999999998H7.586z" transform="rotate(-45 9 20)"></path><path d="M18.586 7.586H21.413999999999998V10.414H18.586z" transform="rotate(-45 20 9)"></path><path d="M7.586 7.586H10.414V10.414H7.586z" transform="rotate(-45 9 9)"></path><path d="M11 2L2 2 2 11 4 11 4 4 11 4 11 2z"></path></svg>` }, "20": { metadata: { "moduleName": "WatsonHealthInteractiveSegmentationCursor20", "filepath": "watson-health/interactive-segmentation-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": "M29.4139,24,15.9989,10.5663a2.0473,2.0473,0,0,0-2.8281,0l-2.586,2.586a2.0023,2.0023,0,0,0,0,2.8283L23.9989,29.4145a2.0021,2.0021,0,0,0,2.8281,0l2.5869-2.5865a1.9993,1.9993,0,0,0,0-2.8283Zm-17.415-9.4335,2.5859-2.5859,3.5,3.5L15.498,18.0676l-3.5-3.5ZM25.413,28l-8.5009-8.5188,2.5867-2.587L28,25.4143Z" } }, { "elem": "path", "attrs": { "d": "M7.586 18.586H10.414V21.413999999999998H7.586z", "transform": "rotate(-45 9 20)" } }, { "elem": "path", "attrs": { "d": "M18.586 7.586H21.413999999999998V10.414H18.586z", "transform": "rotate(-45 20 9)" } }, { "elem": "path", "attrs": { "d": "M7.586 7.586H10.414V10.414H7.586z", "transform": "rotate(-45 9 9)" } }, { "elem": "path", "attrs": { "d": "M11 2L2 2 2 11 4 11 4 4 11 4 11 2z" } }], "name": "interactive-segmentation-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="M29.4139,24,15.9989,10.5663a2.0473,2.0473,0,0,0-2.8281,0l-2.586,2.586a2.0023,2.0023,0,0,0,0,2.8283L23.9989,29.4145a2.0021,2.0021,0,0,0,2.8281,0l2.5869-2.5865a1.9993,1.9993,0,0,0,0-2.8283Zm-17.415-9.4335,2.5859-2.5859,3.5,3.5L15.498,18.0676l-3.5-3.5ZM25.413,28l-8.5009-8.5188,2.5867-2.587L28,25.4143Z"></path><path d="M7.586 18.586H10.414V21.413999999999998H7.586z" transform="rotate(-45 9 20)"></path><path d="M18.586 7.586H21.413999999999998V10.414H18.586z" transform="rotate(-45 20 9)"></path><path d="M7.586 7.586H10.414V10.414H7.586z" transform="rotate(-45 9 9)"></path><path d="M11 2L2 2 2 11 4 11 4 4 11 4 11 2z"></path></svg>` }, "16": { metadata: { "moduleName": "WatsonHealthInteractiveSegmentationCursor16", "filepath": "watson-health/interactive-segmentation-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": "M29.4139,24,15.9989,10.5663a2.0473,2.0473,0,0,0-2.8281,0l-2.586,2.586a2.0023,2.0023,0,0,0,0,2.8283L23.9989,29.4145a2.0021,2.0021,0,0,0,2.8281,0l2.5869-2.5865a1.9993,1.9993,0,0,0,0-2.8283Zm-17.415-9.4335,2.5859-2.5859,3.5,3.5L15.498,18.0676l-3.5-3.5ZM25.413,28l-8.5009-8.5188,2.5867-2.587L28,25.4143Z" } }, { "elem": "path", "attrs": { "d": "M7.586 18.586H10.414V21.413999999999998H7.586z", "transform": "rotate(-45 9 20)" } }, { "elem": "path", "attrs": { "d": "M18.586 7.586H21.413999999999998V10.414H18.586z", "transform": "rotate(-45 20 9)" } }, { "elem": "path", "attrs": { "d": "M7.586 7.586H10.414V10.414H7.586z", "transform": "rotate(-45 9 9)" } }, { "elem": "path", "attrs": { "d": "M11 2L2 2 2 11 4 11 4 4 11 4 11 2z" } }], "name": "interactive-segmentation-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="M29.4139,24,15.9989,10.5663a2.0473,2.0473,0,0,0-2.8281,0l-2.586,2.586a2.0023,2.0023,0,0,0,0,2.8283L23.9989,29.4145a2.0021,2.0021,0,0,0,2.8281,0l2.5869-2.5865a1.9993,1.9993,0,0,0,0-2.8283Zm-17.415-9.4335,2.5859-2.5859,3.5,3.5L15.498,18.0676l-3.5-3.5ZM25.413,28l-8.5009-8.5188,2.5867-2.587L28,25.4143Z"></path><path d="M7.586 18.586H10.414V21.413999999999998H7.586z" transform="rotate(-45 9 20)"></path><path d="M18.586 7.586H21.413999999999998V10.414H18.586z" transform="rotate(-45 20 9)"></path><path d="M7.586 7.586H10.414V10.414H7.586z" transform="rotate(-45 9 9)"></path><path d="M11 2L2 2 2 11 4 11 4 4 11 4 11 2z"></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; WatsonHealthInteractiveSegmentationCursorDirective_1.titleIdCounter++; title.setAttribute("id", `watson-health-interactive-segmentation-cursor-${WatsonHealthInteractiveSegmentationCursorDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `watson-health-interactive-segmentation-cursor-${WatsonHealthInteractiveSegmentationCursorDirective_1.titleIdCounter}`); } } }; WatsonHealthInteractiveSegmentationCursorDirective.titleIdCounter = 0; WatsonHealthInteractiveSegmentationCursorDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthInteractiveSegmentationCursorDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthInteractiveSegmentationCursorDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthInteractiveSegmentationCursorDirective.prototype, "size", void 0); WatsonHealthInteractiveSegmentationCursorDirective = WatsonHealthInteractiveSegmentationCursorDirective_1 = __decorate([ Directive({ selector: "[ibmIconWatsonHealthInteractiveSegmentationCursor]" }), __metadata("design:paramtypes", [ElementRef]) ], WatsonHealthInteractiveSegmentationCursorDirective); let WatsonHealthInteractiveSegmentationCursorModule = class WatsonHealthInteractiveSegmentationCursorModule { }; WatsonHealthInteractiveSegmentationCursorModule = __decorate([ NgModule({ declarations: [ WatsonHealthInteractiveSegmentationCursorComponent, WatsonHealthInteractiveSegmentationCursorDirective, ], exports: [ WatsonHealthInteractiveSegmentationCursorComponent, WatsonHealthInteractiveSegmentationCursorDirective, ] }) ], WatsonHealthInteractiveSegmentationCursorModule); export { WatsonHealthInteractiveSegmentationCursorComponent, WatsonHealthInteractiveSegmentationCursorDirective, WatsonHealthInteractiveSegmentationCursorModule };