UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 13.6 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var WatsonHealthEdgeEnhancement_02Directive_1; let WatsonHealthEdgeEnhancement_02Component = class WatsonHealthEdgeEnhancement_02Component { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Component.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Component.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthEdgeEnhancement_02Component.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Component.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthEdgeEnhancement_02Component.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Component.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Component.prototype, "size", void 0); WatsonHealthEdgeEnhancement_02Component = __decorate([ Component({ selector: "ibm-icon-watson-health-edge-enhancement-02", template: ` <svg ibmIconWatsonHealthEdgeEnhancement_02 [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], WatsonHealthEdgeEnhancement_02Component); let WatsonHealthEdgeEnhancement_02Directive = WatsonHealthEdgeEnhancement_02Directive_1 = class WatsonHealthEdgeEnhancement_02Directive { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WatsonHealthEdgeEnhancement_0232", "filepath": "watson-health/edge-enhancement--02/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 30H22V26a2.002 2.002 0 012-2h2V22H22V20h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H24v2h4zM28 16h2A14 14 0 0016 2V4A12 12 0 0128 16z" } }, { "elem": "path", "attrs": { "d": "M26 16A10 10 0 0016 6V16zM16 28A11.96 11.96 0 015.416 21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207 13.1207 0 014.19 18l-1.9677.4131A13.9173 13.9173 0 002.7 20.2993l-.0251.0083A13.9615 13.9615 0 0016 30zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646z" } }], "name": "edge-enhancement--02", "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 30H22V26a2.002 2.002 0 012-2h2V22H22V20h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H24v2h4zM28 16h2A14 14 0 0016 2V4A12 12 0 0128 16z"></path><path d="M26 16A10 10 0 0016 6V16zM16 28A11.96 11.96 0 015.416 21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207 13.1207 0 014.19 18l-1.9677.4131A13.9173 13.9173 0 002.7 20.2993l-.0251.0083A13.9615 13.9615 0 0016 30zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646z"></path></svg>` }, "24": { metadata: { "moduleName": "WatsonHealthEdgeEnhancement_0224", "filepath": "watson-health/edge-enhancement--02/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 30H22V26a2.002 2.002 0 012-2h2V22H22V20h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H24v2h4zM28 16h2A14 14 0 0016 2V4A12 12 0 0128 16z" } }, { "elem": "path", "attrs": { "d": "M26 16A10 10 0 0016 6V16zM16 28A11.96 11.96 0 015.416 21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207 13.1207 0 014.19 18l-1.9677.4131A13.9173 13.9173 0 002.7 20.2993l-.0251.0083A13.9615 13.9615 0 0016 30zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646z" } }], "name": "edge-enhancement--02", "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 30H22V26a2.002 2.002 0 012-2h2V22H22V20h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H24v2h4zM28 16h2A14 14 0 0016 2V4A12 12 0 0128 16z"></path><path d="M26 16A10 10 0 0016 6V16zM16 28A11.96 11.96 0 015.416 21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207 13.1207 0 014.19 18l-1.9677.4131A13.9173 13.9173 0 002.7 20.2993l-.0251.0083A13.9615 13.9615 0 0016 30zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646z"></path></svg>` }, "20": { metadata: { "moduleName": "WatsonHealthEdgeEnhancement_0220", "filepath": "watson-health/edge-enhancement--02/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 30H22V26a2.002 2.002 0 012-2h2V22H22V20h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H24v2h4zM28 16h2A14 14 0 0016 2V4A12 12 0 0128 16z" } }, { "elem": "path", "attrs": { "d": "M26 16A10 10 0 0016 6V16zM16 28A11.96 11.96 0 015.416 21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207 13.1207 0 014.19 18l-1.9677.4131A13.9173 13.9173 0 002.7 20.2993l-.0251.0083A13.9615 13.9615 0 0016 30zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646z" } }], "name": "edge-enhancement--02", "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 30H22V26a2.002 2.002 0 012-2h2V22H22V20h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H24v2h4zM28 16h2A14 14 0 0016 2V4A12 12 0 0128 16z"></path><path d="M26 16A10 10 0 0016 6V16zM16 28A11.96 11.96 0 015.416 21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207 13.1207 0 014.19 18l-1.9677.4131A13.9173 13.9173 0 002.7 20.2993l-.0251.0083A13.9615 13.9615 0 0016 30zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646z"></path></svg>` }, "16": { metadata: { "moduleName": "WatsonHealthEdgeEnhancement_0216", "filepath": "watson-health/edge-enhancement--02/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 30H22V26a2.002 2.002 0 012-2h2V22H22V20h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H24v2h4zM28 16h2A14 14 0 0016 2V4A12 12 0 0128 16z" } }, { "elem": "path", "attrs": { "d": "M26 16A10 10 0 0016 6V16zM16 28A11.96 11.96 0 015.416 21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207 13.1207 0 014.19 18l-1.9677.4131A13.9173 13.9173 0 002.7 20.2993l-.0251.0083A13.9615 13.9615 0 0016 30zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646z" } }], "name": "edge-enhancement--02", "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 30H22V26a2.002 2.002 0 012-2h2V22H22V20h4a2.0023 2.0023 0 012 2v2a2.0023 2.0023 0 01-2 2H24v2h4zM28 16h2A14 14 0 0016 2V4A12 12 0 0128 16z"></path><path d="M26 16A10 10 0 0016 6V16zM16 28A11.96 11.96 0 015.416 21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207 13.1207 0 014.19 18l-1.9677.4131A13.9173 13.9173 0 002.7 20.2993l-.0251.0083A13.9615 13.9615 0 0016 30zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646z"></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; WatsonHealthEdgeEnhancement_02Directive_1.titleIdCounter++; title.setAttribute("id", `watson-health-edge-enhancement-02-${WatsonHealthEdgeEnhancement_02Directive_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `watson-health-edge-enhancement-02-${WatsonHealthEdgeEnhancement_02Directive_1.titleIdCounter}`); } } }; WatsonHealthEdgeEnhancement_02Directive.titleIdCounter = 0; WatsonHealthEdgeEnhancement_02Directive.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Directive.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Directive.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthEdgeEnhancement_02Directive.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Directive.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WatsonHealthEdgeEnhancement_02Directive.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WatsonHealthEdgeEnhancement_02Directive.prototype, "size", void 0); WatsonHealthEdgeEnhancement_02Directive = WatsonHealthEdgeEnhancement_02Directive_1 = __decorate([ Directive({ selector: "[ibmIconWatsonHealthEdgeEnhancement_02]" }), __metadata("design:paramtypes", [ElementRef]) ], WatsonHealthEdgeEnhancement_02Directive); let WatsonHealthEdgeEnhancement_02Module = class WatsonHealthEdgeEnhancement_02Module { }; WatsonHealthEdgeEnhancement_02Module = __decorate([ NgModule({ declarations: [ WatsonHealthEdgeEnhancement_02Component, WatsonHealthEdgeEnhancement_02Directive, ], exports: [ WatsonHealthEdgeEnhancement_02Component, WatsonHealthEdgeEnhancement_02Directive, ] }) ], WatsonHealthEdgeEnhancement_02Module); export { WatsonHealthEdgeEnhancement_02Component, WatsonHealthEdgeEnhancement_02Directive, WatsonHealthEdgeEnhancement_02Module };