UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 11.1 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var WatsonHealthPointerTextComponent = /** @class */ (function () { function WatsonHealthPointerTextComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthPointerTextComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthPointerTextComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextComponent.prototype, "size", void 0); WatsonHealthPointerTextComponent = __decorate([ Component({ selector: "ibm-icon-watson-health-pointer-text", template: "\n <svg\n ibmIconWatsonHealthPointerText\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 " }) ], WatsonHealthPointerTextComponent); return WatsonHealthPointerTextComponent; }()); var WatsonHealthPointerTextDirective = /** @class */ (function () { function WatsonHealthPointerTextDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonHealthPointerText32", "filepath": "watson-health/pointer-text/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": "M13.71 12.29L7.41 6 13 6 13 4 4 4 4 13 6 13 6 7.41 12.29 13.71 13.71 12.29zM28 30H12a2 2 0 01-2-2V18h2V28H28V12H18V10H28a2 2 0 012 2V28A2 2 0 0128 30z" } }, { "elem": "path", "attrs": { "d": "M22,15H17v2h5v2H18a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V17A2,2,0,0,0,22,15Zm0,8H18V21h4Z" } }], "name": "pointer-text", "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=\"M13.71 12.29L7.41 6 13 6 13 4 4 4 4 13 6 13 6 7.41 12.29 13.71 13.71 12.29zM28 30H12a2 2 0 01-2-2V18h2V28H28V12H18V10H28a2 2 0 012 2V28A2 2 0 0128 30z\"></path><path d=\"M22,15H17v2h5v2H18a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V17A2,2,0,0,0,22,15Zm0,8H18V21h4Z\"></path></svg>" }, "24": { metadata: { "moduleName": "WatsonHealthPointerText24", "filepath": "watson-health/pointer-text/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": "M13.71 12.29L7.41 6 13 6 13 4 4 4 4 13 6 13 6 7.41 12.29 13.71 13.71 12.29zM28 30H12a2 2 0 01-2-2V18h2V28H28V12H18V10H28a2 2 0 012 2V28A2 2 0 0128 30z" } }, { "elem": "path", "attrs": { "d": "M22,15H17v2h5v2H18a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V17A2,2,0,0,0,22,15Zm0,8H18V21h4Z" } }], "name": "pointer-text", "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=\"M13.71 12.29L7.41 6 13 6 13 4 4 4 4 13 6 13 6 7.41 12.29 13.71 13.71 12.29zM28 30H12a2 2 0 01-2-2V18h2V28H28V12H18V10H28a2 2 0 012 2V28A2 2 0 0128 30z\"></path><path d=\"M22,15H17v2h5v2H18a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V17A2,2,0,0,0,22,15Zm0,8H18V21h4Z\"></path></svg>" }, "20": { metadata: { "moduleName": "WatsonHealthPointerText20", "filepath": "watson-health/pointer-text/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": "M13.71 12.29L7.41 6 13 6 13 4 4 4 4 13 6 13 6 7.41 12.29 13.71 13.71 12.29zM28 30H12a2 2 0 01-2-2V18h2V28H28V12H18V10H28a2 2 0 012 2V28A2 2 0 0128 30z" } }, { "elem": "path", "attrs": { "d": "M22,15H17v2h5v2H18a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V17A2,2,0,0,0,22,15Zm0,8H18V21h4Z" } }], "name": "pointer-text", "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=\"M13.71 12.29L7.41 6 13 6 13 4 4 4 4 13 6 13 6 7.41 12.29 13.71 13.71 12.29zM28 30H12a2 2 0 01-2-2V18h2V28H28V12H18V10H28a2 2 0 012 2V28A2 2 0 0128 30z\"></path><path d=\"M22,15H17v2h5v2H18a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V17A2,2,0,0,0,22,15Zm0,8H18V21h4Z\"></path></svg>" }, "16": { metadata: { "moduleName": "WatsonHealthPointerText16", "filepath": "watson-health/pointer-text/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": "M13.71 12.29L7.41 6 13 6 13 4 4 4 4 13 6 13 6 7.41 12.29 13.71 13.71 12.29zM28 30H12a2 2 0 01-2-2V18h2V28H28V12H18V10H28a2 2 0 012 2V28A2 2 0 0128 30z" } }, { "elem": "path", "attrs": { "d": "M22,15H17v2h5v2H18a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V17A2,2,0,0,0,22,15Zm0,8H18V21h4Z" } }], "name": "pointer-text", "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=\"M13.71 12.29L7.41 6 13 6 13 4 4 4 4 13 6 13 6 7.41 12.29 13.71 13.71 12.29zM28 30H12a2 2 0 01-2-2V18h2V28H28V12H18V10H28a2 2 0 012 2V28A2 2 0 0128 30z\"></path><path d=\"M22,15H17v2h5v2H18a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V17A2,2,0,0,0,22,15Zm0,8H18V21h4Z\"></path></svg>" }, }; } WatsonHealthPointerTextDirective_1 = WatsonHealthPointerTextDirective; WatsonHealthPointerTextDirective.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; WatsonHealthPointerTextDirective_1.titleIdCounter++; title.setAttribute("id", "watson-health-pointer-text-" + WatsonHealthPointerTextDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "watson-health-pointer-text-" + WatsonHealthPointerTextDirective_1.titleIdCounter); } }; var WatsonHealthPointerTextDirective_1; WatsonHealthPointerTextDirective.titleIdCounter = 0; WatsonHealthPointerTextDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthPointerTextDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthPointerTextDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthPointerTextDirective.prototype, "size", void 0); WatsonHealthPointerTextDirective = WatsonHealthPointerTextDirective_1 = __decorate([ Directive({ selector: "[ibmIconWatsonHealthPointerText]" }), __metadata("design:paramtypes", [ElementRef]) ], WatsonHealthPointerTextDirective); return WatsonHealthPointerTextDirective; }()); var WatsonHealthPointerTextModule = /** @class */ (function () { function WatsonHealthPointerTextModule() { } WatsonHealthPointerTextModule = __decorate([ NgModule({ declarations: [ WatsonHealthPointerTextComponent, WatsonHealthPointerTextDirective, ], exports: [ WatsonHealthPointerTextComponent, WatsonHealthPointerTextDirective, ] }) ], WatsonHealthPointerTextModule); return WatsonHealthPointerTextModule; }()); export { WatsonHealthPointerTextComponent, WatsonHealthPointerTextDirective, WatsonHealthPointerTextModule };