@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 12.9 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var WatsonHealthAiStatusDirective_1;
let WatsonHealthAiStatusComponent = class WatsonHealthAiStatusComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthAiStatusComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthAiStatusComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusComponent.prototype, "size", void 0);
WatsonHealthAiStatusComponent = __decorate([
Component({
selector: "ibm-icon-watson-health-ai-status",
template: `
<svg
ibmIconWatsonHealthAiStatus
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], WatsonHealthAiStatusComponent);
let WatsonHealthAiStatusDirective = WatsonHealthAiStatusDirective_1 = class WatsonHealthAiStatusDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "WatsonHealthAiStatus32", "filepath": "watson-health/ai-status/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 24H21V26H11zM13 28H19V30H13zM23.04 16a9.4858 9.4858 0 01-1.8623 2.1426C20.1069 19.1348 19 20.1611 19 22h2c0-.9194.5264-1.45 1.5352-2.3857A9.9838 9.9838 0 0025.2756 16zM20 14a1 1 0 01-.8945-.5527L17.3818 10H14V8h4a1 1 0 01.8945.5527L20 10.7639l3.1055-6.2112a1.0416 1.0416 0 011.789 0L26.6182 8H30v2H26a1 1 0 01-.8945-.5527L24 7.2361l-3.1055 6.2112A1 1 0 0120 14z" } }, { "elem": "path", "attrs": { "d": "M10.8145,18.1406A7.1851,7.1851,0,0,1,8,12a8.0092,8.0092,0,0,1,8-8V2A10.0111,10.0111,0,0,0,6,12a9.1793,9.1793,0,0,0,3.46,7.6162C10.4717,20.5508,11,21.0815,11,22h2C13,20.16,11.8892,19.1338,10.8145,18.1406Z" } }], "name": "ai-status", "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 24H21V26H11zM13 28H19V30H13zM23.04 16a9.4858 9.4858 0 01-1.8623 2.1426C20.1069 19.1348 19 20.1611 19 22h2c0-.9194.5264-1.45 1.5352-2.3857A9.9838 9.9838 0 0025.2756 16zM20 14a1 1 0 01-.8945-.5527L17.3818 10H14V8h4a1 1 0 01.8945.5527L20 10.7639l3.1055-6.2112a1.0416 1.0416 0 011.789 0L26.6182 8H30v2H26a1 1 0 01-.8945-.5527L24 7.2361l-3.1055 6.2112A1 1 0 0120 14z"></path><path d="M10.8145,18.1406A7.1851,7.1851,0,0,1,8,12a8.0092,8.0092,0,0,1,8-8V2A10.0111,10.0111,0,0,0,6,12a9.1793,9.1793,0,0,0,3.46,7.6162C10.4717,20.5508,11,21.0815,11,22h2C13,20.16,11.8892,19.1338,10.8145,18.1406Z"></path></svg>`
},
"24": {
metadata: { "moduleName": "WatsonHealthAiStatus24", "filepath": "watson-health/ai-status/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 24H21V26H11zM13 28H19V30H13zM23.04 16a9.4858 9.4858 0 01-1.8623 2.1426C20.1069 19.1348 19 20.1611 19 22h2c0-.9194.5264-1.45 1.5352-2.3857A9.9838 9.9838 0 0025.2756 16zM20 14a1 1 0 01-.8945-.5527L17.3818 10H14V8h4a1 1 0 01.8945.5527L20 10.7639l3.1055-6.2112a1.0416 1.0416 0 011.789 0L26.6182 8H30v2H26a1 1 0 01-.8945-.5527L24 7.2361l-3.1055 6.2112A1 1 0 0120 14z" } }, { "elem": "path", "attrs": { "d": "M10.8145,18.1406A7.1851,7.1851,0,0,1,8,12a8.0092,8.0092,0,0,1,8-8V2A10.0111,10.0111,0,0,0,6,12a9.1793,9.1793,0,0,0,3.46,7.6162C10.4717,20.5508,11,21.0815,11,22h2C13,20.16,11.8892,19.1338,10.8145,18.1406Z" } }], "name": "ai-status", "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 24H21V26H11zM13 28H19V30H13zM23.04 16a9.4858 9.4858 0 01-1.8623 2.1426C20.1069 19.1348 19 20.1611 19 22h2c0-.9194.5264-1.45 1.5352-2.3857A9.9838 9.9838 0 0025.2756 16zM20 14a1 1 0 01-.8945-.5527L17.3818 10H14V8h4a1 1 0 01.8945.5527L20 10.7639l3.1055-6.2112a1.0416 1.0416 0 011.789 0L26.6182 8H30v2H26a1 1 0 01-.8945-.5527L24 7.2361l-3.1055 6.2112A1 1 0 0120 14z"></path><path d="M10.8145,18.1406A7.1851,7.1851,0,0,1,8,12a8.0092,8.0092,0,0,1,8-8V2A10.0111,10.0111,0,0,0,6,12a9.1793,9.1793,0,0,0,3.46,7.6162C10.4717,20.5508,11,21.0815,11,22h2C13,20.16,11.8892,19.1338,10.8145,18.1406Z"></path></svg>`
},
"20": {
metadata: { "moduleName": "WatsonHealthAiStatus20", "filepath": "watson-health/ai-status/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 24H21V26H11zM13 28H19V30H13zM23.04 16a9.4858 9.4858 0 01-1.8623 2.1426C20.1069 19.1348 19 20.1611 19 22h2c0-.9194.5264-1.45 1.5352-2.3857A9.9838 9.9838 0 0025.2756 16zM20 14a1 1 0 01-.8945-.5527L17.3818 10H14V8h4a1 1 0 01.8945.5527L20 10.7639l3.1055-6.2112a1.0416 1.0416 0 011.789 0L26.6182 8H30v2H26a1 1 0 01-.8945-.5527L24 7.2361l-3.1055 6.2112A1 1 0 0120 14z" } }, { "elem": "path", "attrs": { "d": "M10.8145,18.1406A7.1851,7.1851,0,0,1,8,12a8.0092,8.0092,0,0,1,8-8V2A10.0111,10.0111,0,0,0,6,12a9.1793,9.1793,0,0,0,3.46,7.6162C10.4717,20.5508,11,21.0815,11,22h2C13,20.16,11.8892,19.1338,10.8145,18.1406Z" } }], "name": "ai-status", "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 24H21V26H11zM13 28H19V30H13zM23.04 16a9.4858 9.4858 0 01-1.8623 2.1426C20.1069 19.1348 19 20.1611 19 22h2c0-.9194.5264-1.45 1.5352-2.3857A9.9838 9.9838 0 0025.2756 16zM20 14a1 1 0 01-.8945-.5527L17.3818 10H14V8h4a1 1 0 01.8945.5527L20 10.7639l3.1055-6.2112a1.0416 1.0416 0 011.789 0L26.6182 8H30v2H26a1 1 0 01-.8945-.5527L24 7.2361l-3.1055 6.2112A1 1 0 0120 14z"></path><path d="M10.8145,18.1406A7.1851,7.1851,0,0,1,8,12a8.0092,8.0092,0,0,1,8-8V2A10.0111,10.0111,0,0,0,6,12a9.1793,9.1793,0,0,0,3.46,7.6162C10.4717,20.5508,11,21.0815,11,22h2C13,20.16,11.8892,19.1338,10.8145,18.1406Z"></path></svg>`
},
"16": {
metadata: { "moduleName": "WatsonHealthAiStatus16", "filepath": "watson-health/ai-status/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 24H21V26H11zM13 28H19V30H13zM23.04 16a9.4858 9.4858 0 01-1.8623 2.1426C20.1069 19.1348 19 20.1611 19 22h2c0-.9194.5264-1.45 1.5352-2.3857A9.9838 9.9838 0 0025.2756 16zM20 14a1 1 0 01-.8945-.5527L17.3818 10H14V8h4a1 1 0 01.8945.5527L20 10.7639l3.1055-6.2112a1.0416 1.0416 0 011.789 0L26.6182 8H30v2H26a1 1 0 01-.8945-.5527L24 7.2361l-3.1055 6.2112A1 1 0 0120 14z" } }, { "elem": "path", "attrs": { "d": "M10.8145,18.1406A7.1851,7.1851,0,0,1,8,12a8.0092,8.0092,0,0,1,8-8V2A10.0111,10.0111,0,0,0,6,12a9.1793,9.1793,0,0,0,3.46,7.6162C10.4717,20.5508,11,21.0815,11,22h2C13,20.16,11.8892,19.1338,10.8145,18.1406Z" } }], "name": "ai-status", "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 24H21V26H11zM13 28H19V30H13zM23.04 16a9.4858 9.4858 0 01-1.8623 2.1426C20.1069 19.1348 19 20.1611 19 22h2c0-.9194.5264-1.45 1.5352-2.3857A9.9838 9.9838 0 0025.2756 16zM20 14a1 1 0 01-.8945-.5527L17.3818 10H14V8h4a1 1 0 01.8945.5527L20 10.7639l3.1055-6.2112a1.0416 1.0416 0 011.789 0L26.6182 8H30v2H26a1 1 0 01-.8945-.5527L24 7.2361l-3.1055 6.2112A1 1 0 0120 14z"></path><path d="M10.8145,18.1406A7.1851,7.1851,0,0,1,8,12a8.0092,8.0092,0,0,1,8-8V2A10.0111,10.0111,0,0,0,6,12a9.1793,9.1793,0,0,0,3.46,7.6162C10.4717,20.5508,11,21.0815,11,22h2C13,20.16,11.8892,19.1338,10.8145,18.1406Z"></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;
WatsonHealthAiStatusDirective_1.titleIdCounter++;
title.setAttribute("id", `watson-health-ai-status-${WatsonHealthAiStatusDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `watson-health-ai-status-${WatsonHealthAiStatusDirective_1.titleIdCounter}`);
}
}
};
WatsonHealthAiStatusDirective.titleIdCounter = 0;
WatsonHealthAiStatusDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthAiStatusDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthAiStatusDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthAiStatusDirective.prototype, "size", void 0);
WatsonHealthAiStatusDirective = WatsonHealthAiStatusDirective_1 = __decorate([
Directive({
selector: "[ibmIconWatsonHealthAiStatus]"
}),
__metadata("design:paramtypes", [ElementRef])
], WatsonHealthAiStatusDirective);
let WatsonHealthAiStatusModule = class WatsonHealthAiStatusModule {
};
WatsonHealthAiStatusModule = __decorate([
NgModule({
declarations: [
WatsonHealthAiStatusComponent,
WatsonHealthAiStatusDirective,
],
exports: [
WatsonHealthAiStatusComponent,
WatsonHealthAiStatusDirective,
]
})
], WatsonHealthAiStatusModule);
export { WatsonHealthAiStatusComponent, WatsonHealthAiStatusDirective, WatsonHealthAiStatusModule };