@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 16.1 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var WatsonHealthEdgeEnhancementDirective_1;
let WatsonHealthEdgeEnhancementComponent = class WatsonHealthEdgeEnhancementComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthEdgeEnhancementComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthEdgeEnhancementComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementComponent.prototype, "size", void 0);
WatsonHealthEdgeEnhancementComponent = __decorate([
Component({
selector: "ibm-icon-watson-health-edge-enhancement",
template: `
<svg
ibmIconWatsonHealthEdgeEnhancement
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], WatsonHealthEdgeEnhancementComponent);
let WatsonHealthEdgeEnhancementDirective = WatsonHealthEdgeEnhancementDirective_1 = class WatsonHealthEdgeEnhancementDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "WatsonHealthEdgeEnhancement32", "filepath": "watson-health/edge-enhancement/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": "M11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM16 26A10 10 0 0016 6h0z" } }, { "elem": "path", "attrs": { "d": "M30,16A14,14,0,0,0,16,2V4a11.9933,11.9933,0,0,1,4.0493,23.2847c-.1682.06-.334.1294-.5044.1821-.2512.0771-.51.1362-.7683.1973-.1262.03-.25.0693-.3772.0952-.2908.0591-.5884.0976-.8862.1352-.1.0122-.1983.0342-.2988.044A12.0015,12.0015,0,0,1,5.416,21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207,13.1207,0,0,1,4.19,18l-1.9677.4131A13.9173,13.9173,0,0,0,2.7,20.2993l-.0251.0083A13.9615,13.9615,0,0,0,16,30q.7134,0,1.415-.0713c.135-.0137.2654-.042.3995-.06.3286-.0424.6574-.0839.9814-.1494.18-.0366.3533-.0908.5308-.1338.2685-.0659.5383-.125.8027-.2065.2463-.0762.4831-.1724.7234-.2612.18-.0664.3635-.1211.5412-.1953l-.0009-.0025A14.0015,14.0015,0,0,0,30,16Z" } }], "name": "edge-enhancement", "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="M11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM16 26A10 10 0 0016 6h0z"></path><path d="M30,16A14,14,0,0,0,16,2V4a11.9933,11.9933,0,0,1,4.0493,23.2847c-.1682.06-.334.1294-.5044.1821-.2512.0771-.51.1362-.7683.1973-.1262.03-.25.0693-.3772.0952-.2908.0591-.5884.0976-.8862.1352-.1.0122-.1983.0342-.2988.044A12.0015,12.0015,0,0,1,5.416,21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207,13.1207,0,0,1,4.19,18l-1.9677.4131A13.9173,13.9173,0,0,0,2.7,20.2993l-.0251.0083A13.9615,13.9615,0,0,0,16,30q.7134,0,1.415-.0713c.135-.0137.2654-.042.3995-.06.3286-.0424.6574-.0839.9814-.1494.18-.0366.3533-.0908.5308-.1338.2685-.0659.5383-.125.8027-.2065.2463-.0762.4831-.1724.7234-.2612.18-.0664.3635-.1211.5412-.1953l-.0009-.0025A14.0015,14.0015,0,0,0,30,16Z"></path></svg>`
},
"24": {
metadata: { "moduleName": "WatsonHealthEdgeEnhancement24", "filepath": "watson-health/edge-enhancement/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": "M11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM16 26A10 10 0 0016 6h0z" } }, { "elem": "path", "attrs": { "d": "M30,16A14,14,0,0,0,16,2V4a11.9933,11.9933,0,0,1,4.0493,23.2847c-.1682.06-.334.1294-.5044.1821-.2512.0771-.51.1362-.7683.1973-.1262.03-.25.0693-.3772.0952-.2908.0591-.5884.0976-.8862.1352-.1.0122-.1983.0342-.2988.044A12.0015,12.0015,0,0,1,5.416,21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207,13.1207,0,0,1,4.19,18l-1.9677.4131A13.9173,13.9173,0,0,0,2.7,20.2993l-.0251.0083A13.9615,13.9615,0,0,0,16,30q.7134,0,1.415-.0713c.135-.0137.2654-.042.3995-.06.3286-.0424.6574-.0839.9814-.1494.18-.0366.3533-.0908.5308-.1338.2685-.0659.5383-.125.8027-.2065.2463-.0762.4831-.1724.7234-.2612.18-.0664.3635-.1211.5412-.1953l-.0009-.0025A14.0015,14.0015,0,0,0,30,16Z" } }], "name": "edge-enhancement", "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="M11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM16 26A10 10 0 0016 6h0z"></path><path d="M30,16A14,14,0,0,0,16,2V4a11.9933,11.9933,0,0,1,4.0493,23.2847c-.1682.06-.334.1294-.5044.1821-.2512.0771-.51.1362-.7683.1973-.1262.03-.25.0693-.3772.0952-.2908.0591-.5884.0976-.8862.1352-.1.0122-.1983.0342-.2988.044A12.0015,12.0015,0,0,1,5.416,21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207,13.1207,0,0,1,4.19,18l-1.9677.4131A13.9173,13.9173,0,0,0,2.7,20.2993l-.0251.0083A13.9615,13.9615,0,0,0,16,30q.7134,0,1.415-.0713c.135-.0137.2654-.042.3995-.06.3286-.0424.6574-.0839.9814-.1494.18-.0366.3533-.0908.5308-.1338.2685-.0659.5383-.125.8027-.2065.2463-.0762.4831-.1724.7234-.2612.18-.0664.3635-.1211.5412-.1953l-.0009-.0025A14.0015,14.0015,0,0,0,30,16Z"></path></svg>`
},
"20": {
metadata: { "moduleName": "WatsonHealthEdgeEnhancement20", "filepath": "watson-health/edge-enhancement/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": "M11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM16 26A10 10 0 0016 6h0z" } }, { "elem": "path", "attrs": { "d": "M30,16A14,14,0,0,0,16,2V4a11.9933,11.9933,0,0,1,4.0493,23.2847c-.1682.06-.334.1294-.5044.1821-.2512.0771-.51.1362-.7683.1973-.1262.03-.25.0693-.3772.0952-.2908.0591-.5884.0976-.8862.1352-.1.0122-.1983.0342-.2988.044A12.0015,12.0015,0,0,1,5.416,21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207,13.1207,0,0,1,4.19,18l-1.9677.4131A13.9173,13.9173,0,0,0,2.7,20.2993l-.0251.0083A13.9615,13.9615,0,0,0,16,30q.7134,0,1.415-.0713c.135-.0137.2654-.042.3995-.06.3286-.0424.6574-.0839.9814-.1494.18-.0366.3533-.0908.5308-.1338.2685-.0659.5383-.125.8027-.2065.2463-.0762.4831-.1724.7234-.2612.18-.0664.3635-.1211.5412-.1953l-.0009-.0025A14.0015,14.0015,0,0,0,30,16Z" } }], "name": "edge-enhancement", "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="M11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM16 26A10 10 0 0016 6h0z"></path><path d="M30,16A14,14,0,0,0,16,2V4a11.9933,11.9933,0,0,1,4.0493,23.2847c-.1682.06-.334.1294-.5044.1821-.2512.0771-.51.1362-.7683.1973-.1262.03-.25.0693-.3772.0952-.2908.0591-.5884.0976-.8862.1352-.1.0122-.1983.0342-.2988.044A12.0015,12.0015,0,0,1,5.416,21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207,13.1207,0,0,1,4.19,18l-1.9677.4131A13.9173,13.9173,0,0,0,2.7,20.2993l-.0251.0083A13.9615,13.9615,0,0,0,16,30q.7134,0,1.415-.0713c.135-.0137.2654-.042.3995-.06.3286-.0424.6574-.0839.9814-.1494.18-.0366.3533-.0908.5308-.1338.2685-.0659.5383-.125.8027-.2065.2463-.0762.4831-.1724.7234-.2612.18-.0664.3635-.1211.5412-.1953l-.0009-.0025A14.0015,14.0015,0,0,0,30,16Z"></path></svg>`
},
"16": {
metadata: { "moduleName": "WatsonHealthEdgeEnhancement16", "filepath": "watson-health/edge-enhancement/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": "M11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM16 26A10 10 0 0016 6h0z" } }, { "elem": "path", "attrs": { "d": "M30,16A14,14,0,0,0,16,2V4a11.9933,11.9933,0,0,1,4.0493,23.2847c-.1682.06-.334.1294-.5044.1821-.2512.0771-.51.1362-.7683.1973-.1262.03-.25.0693-.3772.0952-.2908.0591-.5884.0976-.8862.1352-.1.0122-.1983.0342-.2988.044A12.0015,12.0015,0,0,1,5.416,21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207,13.1207,0,0,1,4.19,18l-1.9677.4131A13.9173,13.9173,0,0,0,2.7,20.2993l-.0251.0083A13.9615,13.9615,0,0,0,16,30q.7134,0,1.415-.0713c.135-.0137.2654-.042.3995-.06.3286-.0424.6574-.0839.9814-.1494.18-.0366.3533-.0908.5308-.1338.2685-.0659.5383-.125.8027-.2065.2463-.0762.4831-.1724.7234-.2612.18-.0664.3635-.1211.5412-.1953l-.0009-.0025A14.0015,14.0015,0,0,0,30,16Z" } }], "name": "edge-enhancement", "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="M11.8164 4.7646L11.1328 2.887A13.976 13.976 0 006.9507 5.3278L8.2358 6.8593A11.9729 11.9729 0 0111.8164 4.7646zM5.5913 10L3.86 9a14.14 14.14 0 00-1.6382 4.5872l1.9677.3469A12.1519 12.1519 0 015.5913 10zM16 26A10 10 0 0016 6h0z"></path><path d="M30,16A14,14,0,0,0,16,2V4a11.9933,11.9933,0,0,1,4.0493,23.2847c-.1682.06-.334.1294-.5044.1821-.2512.0771-.51.1362-.7683.1973-.1262.03-.25.0693-.3772.0952-.2908.0591-.5884.0976-.8862.1352-.1.0122-.1983.0342-.2988.044A12.0015,12.0015,0,0,1,5.416,21.6548c-.0664-.127-.133-.2534-.1953-.3843-.0547-.1123-.106-.227-.1572-.3413A13.1207,13.1207,0,0,1,4.19,18l-1.9677.4131A13.9173,13.9173,0,0,0,2.7,20.2993l-.0251.0083A13.9615,13.9615,0,0,0,16,30q.7134,0,1.415-.0713c.135-.0137.2654-.042.3995-.06.3286-.0424.6574-.0839.9814-.1494.18-.0366.3533-.0908.5308-.1338.2685-.0659.5383-.125.8027-.2065.2463-.0762.4831-.1724.7234-.2612.18-.0664.3635-.1211.5412-.1953l-.0009-.0025A14.0015,14.0015,0,0,0,30,16Z"></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;
WatsonHealthEdgeEnhancementDirective_1.titleIdCounter++;
title.setAttribute("id", `watson-health-edge-enhancement-${WatsonHealthEdgeEnhancementDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `watson-health-edge-enhancement-${WatsonHealthEdgeEnhancementDirective_1.titleIdCounter}`);
}
}
};
WatsonHealthEdgeEnhancementDirective.titleIdCounter = 0;
WatsonHealthEdgeEnhancementDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthEdgeEnhancementDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthEdgeEnhancementDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthEdgeEnhancementDirective.prototype, "size", void 0);
WatsonHealthEdgeEnhancementDirective = WatsonHealthEdgeEnhancementDirective_1 = __decorate([
Directive({
selector: "[ibmIconWatsonHealthEdgeEnhancement]"
}),
__metadata("design:paramtypes", [ElementRef])
], WatsonHealthEdgeEnhancementDirective);
let WatsonHealthEdgeEnhancementModule = class WatsonHealthEdgeEnhancementModule {
};
WatsonHealthEdgeEnhancementModule = __decorate([
NgModule({
declarations: [
WatsonHealthEdgeEnhancementComponent,
WatsonHealthEdgeEnhancementDirective,
],
exports: [
WatsonHealthEdgeEnhancementComponent,
WatsonHealthEdgeEnhancementDirective,
]
})
], WatsonHealthEdgeEnhancementModule);
export { WatsonHealthEdgeEnhancementComponent, WatsonHealthEdgeEnhancementDirective, WatsonHealthEdgeEnhancementModule };