UNPKG

@carbon/icons-angular

Version:

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

177 lines (172 loc) 14.1 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('@angular/core'), require('@carbon/icon-helpers')) : typeof define === 'function' && define.amd ? define(['exports', 'tslib', '@angular/core', '@carbon/icon-helpers'], factory) : (global = global || self, factory((global.CarbonIconsAngular = global.CarbonIconsAngular || {}, global.CarbonIconsAngular.WatsonHealthTextAnnotationToggle = {}), global.tslib, global.ng.core, global.CarbonIconHelpers)); }(this, (function (exports, tslib, core, iconHelpers) { 'use strict'; var WatsonHealthTextAnnotationToggleComponent = /** @class */ (function () { function WatsonHealthTextAnnotationToggleComponent() { this.focusable = false; } tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleComponent.prototype, "ariaLabel", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleComponent.prototype, "ariaLabelledby", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], WatsonHealthTextAnnotationToggleComponent.prototype, "ariaHidden", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleComponent.prototype, "title", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], WatsonHealthTextAnnotationToggleComponent.prototype, "focusable", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleComponent.prototype, "innerClass", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleComponent.prototype, "size", void 0); WatsonHealthTextAnnotationToggleComponent = tslib.__decorate([ core.Component({ selector: "ibm-icon-watson-health-text-annotation-toggle", template: "\n <svg\n ibmIconWatsonHealthTextAnnotationToggle\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 " }) ], WatsonHealthTextAnnotationToggleComponent); return WatsonHealthTextAnnotationToggleComponent; }()); var WatsonHealthTextAnnotationToggleDirective = /** @class */ (function () { function WatsonHealthTextAnnotationToggleDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonHealthTextAnnotationToggle32", "filepath": "watson-health/text-annotation-toggle/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.537 13.76L26.24 10.463a1.5862 1.5862 0 00-2.24 0L10 24.4674V30h5.5326L29.537 16a1.5862 1.5862 0 000-2.24zM14.7042 28H12V25.2958l9.4409-9.4409 2.7042 2.7042zM25.5591 17.145L22.855 14.4409l2.2672-2.2672 2.7042 2.7042zM11 17L13 17 13 10 16 10 16 8 8 8 8 10 11 10 11 17z" } }, { "elem": "path", "attrs": { "d": "M8,20H4V4H20V8h2V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2H8Z" } }], "name": "text-annotation-toggle", "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.537 13.76L26.24 10.463a1.5862 1.5862 0 00-2.24 0L10 24.4674V30h5.5326L29.537 16a1.5862 1.5862 0 000-2.24zM14.7042 28H12V25.2958l9.4409-9.4409 2.7042 2.7042zM25.5591 17.145L22.855 14.4409l2.2672-2.2672 2.7042 2.7042zM11 17L13 17 13 10 16 10 16 8 8 8 8 10 11 10 11 17z\"></path><path d=\"M8,20H4V4H20V8h2V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2H8Z\"></path></svg>" }, "24": { metadata: { "moduleName": "WatsonHealthTextAnnotationToggle24", "filepath": "watson-health/text-annotation-toggle/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.537 13.76L26.24 10.463a1.5862 1.5862 0 00-2.24 0L10 24.4674V30h5.5326L29.537 16a1.5862 1.5862 0 000-2.24zM14.7042 28H12V25.2958l9.4409-9.4409 2.7042 2.7042zM25.5591 17.145L22.855 14.4409l2.2672-2.2672 2.7042 2.7042zM11 17L13 17 13 10 16 10 16 8 8 8 8 10 11 10 11 17z" } }, { "elem": "path", "attrs": { "d": "M8,20H4V4H20V8h2V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2H8Z" } }], "name": "text-annotation-toggle", "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.537 13.76L26.24 10.463a1.5862 1.5862 0 00-2.24 0L10 24.4674V30h5.5326L29.537 16a1.5862 1.5862 0 000-2.24zM14.7042 28H12V25.2958l9.4409-9.4409 2.7042 2.7042zM25.5591 17.145L22.855 14.4409l2.2672-2.2672 2.7042 2.7042zM11 17L13 17 13 10 16 10 16 8 8 8 8 10 11 10 11 17z\"></path><path d=\"M8,20H4V4H20V8h2V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2H8Z\"></path></svg>" }, "20": { metadata: { "moduleName": "WatsonHealthTextAnnotationToggle20", "filepath": "watson-health/text-annotation-toggle/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.537 13.76L26.24 10.463a1.5862 1.5862 0 00-2.24 0L10 24.4674V30h5.5326L29.537 16a1.5862 1.5862 0 000-2.24zM14.7042 28H12V25.2958l9.4409-9.4409 2.7042 2.7042zM25.5591 17.145L22.855 14.4409l2.2672-2.2672 2.7042 2.7042zM11 17L13 17 13 10 16 10 16 8 8 8 8 10 11 10 11 17z" } }, { "elem": "path", "attrs": { "d": "M8,20H4V4H20V8h2V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2H8Z" } }], "name": "text-annotation-toggle", "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.537 13.76L26.24 10.463a1.5862 1.5862 0 00-2.24 0L10 24.4674V30h5.5326L29.537 16a1.5862 1.5862 0 000-2.24zM14.7042 28H12V25.2958l9.4409-9.4409 2.7042 2.7042zM25.5591 17.145L22.855 14.4409l2.2672-2.2672 2.7042 2.7042zM11 17L13 17 13 10 16 10 16 8 8 8 8 10 11 10 11 17z\"></path><path d=\"M8,20H4V4H20V8h2V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2H8Z\"></path></svg>" }, "16": { metadata: { "moduleName": "WatsonHealthTextAnnotationToggle16", "filepath": "watson-health/text-annotation-toggle/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.537 13.76L26.24 10.463a1.5862 1.5862 0 00-2.24 0L10 24.4674V30h5.5326L29.537 16a1.5862 1.5862 0 000-2.24zM14.7042 28H12V25.2958l9.4409-9.4409 2.7042 2.7042zM25.5591 17.145L22.855 14.4409l2.2672-2.2672 2.7042 2.7042zM11 17L13 17 13 10 16 10 16 8 8 8 8 10 11 10 11 17z" } }, { "elem": "path", "attrs": { "d": "M8,20H4V4H20V8h2V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2H8Z" } }], "name": "text-annotation-toggle", "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.537 13.76L26.24 10.463a1.5862 1.5862 0 00-2.24 0L10 24.4674V30h5.5326L29.537 16a1.5862 1.5862 0 000-2.24zM14.7042 28H12V25.2958l9.4409-9.4409 2.7042 2.7042zM25.5591 17.145L22.855 14.4409l2.2672-2.2672 2.7042 2.7042zM11 17L13 17 13 10 16 10 16 8 8 8 8 10 11 10 11 17z\"></path><path d=\"M8,20H4V4H20V8h2V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2H8Z\"></path></svg>" }, }; } WatsonHealthTextAnnotationToggleDirective_1 = WatsonHealthTextAnnotationToggleDirective; WatsonHealthTextAnnotationToggleDirective.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 = iconHelpers.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; WatsonHealthTextAnnotationToggleDirective_1.titleIdCounter++; title.setAttribute("id", "watson-health-text-annotation-toggle-" + WatsonHealthTextAnnotationToggleDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "watson-health-text-annotation-toggle-" + WatsonHealthTextAnnotationToggleDirective_1.titleIdCounter); } }; var WatsonHealthTextAnnotationToggleDirective_1; WatsonHealthTextAnnotationToggleDirective.titleIdCounter = 0; WatsonHealthTextAnnotationToggleDirective.ctorParameters = function () { return [ { type: core.ElementRef } ]; }; tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleDirective.prototype, "ariaLabel", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleDirective.prototype, "ariaLabelledby", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], WatsonHealthTextAnnotationToggleDirective.prototype, "ariaHidden", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleDirective.prototype, "title", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", Boolean) ], WatsonHealthTextAnnotationToggleDirective.prototype, "isFocusable", void 0); tslib.__decorate([ core.Input(), tslib.__metadata("design:type", String) ], WatsonHealthTextAnnotationToggleDirective.prototype, "size", void 0); WatsonHealthTextAnnotationToggleDirective = WatsonHealthTextAnnotationToggleDirective_1 = tslib.__decorate([ core.Directive({ selector: "[ibmIconWatsonHealthTextAnnotationToggle]" }), tslib.__metadata("design:paramtypes", [core.ElementRef]) ], WatsonHealthTextAnnotationToggleDirective); return WatsonHealthTextAnnotationToggleDirective; }()); var WatsonHealthTextAnnotationToggleModule = /** @class */ (function () { function WatsonHealthTextAnnotationToggleModule() { } WatsonHealthTextAnnotationToggleModule = tslib.__decorate([ core.NgModule({ declarations: [ WatsonHealthTextAnnotationToggleComponent, WatsonHealthTextAnnotationToggleDirective, ], exports: [ WatsonHealthTextAnnotationToggleComponent, WatsonHealthTextAnnotationToggleDirective, ] }) ], WatsonHealthTextAnnotationToggleModule); return WatsonHealthTextAnnotationToggleModule; }()); exports.WatsonHealthTextAnnotationToggleComponent = WatsonHealthTextAnnotationToggleComponent; exports.WatsonHealthTextAnnotationToggleDirective = WatsonHealthTextAnnotationToggleDirective; exports.WatsonHealthTextAnnotationToggleModule = WatsonHealthTextAnnotationToggleModule; Object.defineProperty(exports, '__esModule', { value: true }); })));