@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
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var WatsonHealthScalpelSelectDirective_1;
let WatsonHealthScalpelSelectComponent = class WatsonHealthScalpelSelectComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthScalpelSelectComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthScalpelSelectComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectComponent.prototype, "size", void 0);
WatsonHealthScalpelSelectComponent = __decorate([
Component({
selector: "ibm-icon-watson-health-scalpel-select",
template: `
<svg
ibmIconWatsonHealthScalpelSelect
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], WatsonHealthScalpelSelectComponent);
let WatsonHealthScalpelSelectDirective = WatsonHealthScalpelSelectDirective_1 = class WatsonHealthScalpelSelectDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "WatsonHealthScalpelSelect32", "filepath": "watson-health/scalpel--select/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.8281 7.1719a4.0941 4.0941 0 00-5.6562 0L.3433 30H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.8281a3.9984 3.9984 0 000-5.6562zM12.2928 20.8787l2.086-2.0859 2.8293 2.8294-2.0857 2.0862zM11.71 27.1211A2.9824 2.9824 0 019.5889 28H5.1714l5.7073-5.7072 2.83 2.83zm15.7037-15.707l-8.792 8.7939-2.8293-2.8292 8.7931-8.7929a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM15 2a2.9948 2.9948 0 00-2.8157 2H7.8156A2.9925 2.9925 0 104 7.8154v4.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8156 6h4.3686A2.9947 2.9947 0 1015 2zM5 16a1 1 0 111-1A1.0008 1.0008 0 015 16zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zM15 6a1 1 0 111-1A1.0008 1.0008 0 0115 6z" } }], "name": "scalpel--select", "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.8281 7.1719a4.0941 4.0941 0 00-5.6562 0L.3433 30H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.8281a3.9984 3.9984 0 000-5.6562zM12.2928 20.8787l2.086-2.0859 2.8293 2.8294-2.0857 2.0862zM11.71 27.1211A2.9824 2.9824 0 019.5889 28H5.1714l5.7073-5.7072 2.83 2.83zm15.7037-15.707l-8.792 8.7939-2.8293-2.8292 8.7931-8.7929a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM15 2a2.9948 2.9948 0 00-2.8157 2H7.8156A2.9925 2.9925 0 104 7.8154v4.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8156 6h4.3686A2.9947 2.9947 0 1015 2zM5 16a1 1 0 111-1A1.0008 1.0008 0 015 16zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zM15 6a1 1 0 111-1A1.0008 1.0008 0 0115 6z"></path></svg>`
},
"24": {
metadata: { "moduleName": "WatsonHealthScalpelSelect24", "filepath": "watson-health/scalpel--select/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.8281 7.1719a4.0941 4.0941 0 00-5.6562 0L.3433 30H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.8281a3.9984 3.9984 0 000-5.6562zM12.2928 20.8787l2.086-2.0859 2.8293 2.8294-2.0857 2.0862zM11.71 27.1211A2.9824 2.9824 0 019.5889 28H5.1714l5.7073-5.7072 2.83 2.83zm15.7037-15.707l-8.792 8.7939-2.8293-2.8292 8.7931-8.7929a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM15 2a2.9948 2.9948 0 00-2.8157 2H7.8156A2.9925 2.9925 0 104 7.8154v4.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8156 6h4.3686A2.9947 2.9947 0 1015 2zM5 16a1 1 0 111-1A1.0008 1.0008 0 015 16zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zM15 6a1 1 0 111-1A1.0008 1.0008 0 0115 6z" } }], "name": "scalpel--select", "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.8281 7.1719a4.0941 4.0941 0 00-5.6562 0L.3433 30H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.8281a3.9984 3.9984 0 000-5.6562zM12.2928 20.8787l2.086-2.0859 2.8293 2.8294-2.0857 2.0862zM11.71 27.1211A2.9824 2.9824 0 019.5889 28H5.1714l5.7073-5.7072 2.83 2.83zm15.7037-15.707l-8.792 8.7939-2.8293-2.8292 8.7931-8.7929a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM15 2a2.9948 2.9948 0 00-2.8157 2H7.8156A2.9925 2.9925 0 104 7.8154v4.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8156 6h4.3686A2.9947 2.9947 0 1015 2zM5 16a1 1 0 111-1A1.0008 1.0008 0 015 16zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zM15 6a1 1 0 111-1A1.0008 1.0008 0 0115 6z"></path></svg>`
},
"20": {
metadata: { "moduleName": "WatsonHealthScalpelSelect20", "filepath": "watson-health/scalpel--select/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.8281 7.1719a4.0941 4.0941 0 00-5.6562 0L.3433 30H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.8281a3.9984 3.9984 0 000-5.6562zM12.2928 20.8787l2.086-2.0859 2.8293 2.8294-2.0857 2.0862zM11.71 27.1211A2.9824 2.9824 0 019.5889 28H5.1714l5.7073-5.7072 2.83 2.83zm15.7037-15.707l-8.792 8.7939-2.8293-2.8292 8.7931-8.7929a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM15 2a2.9948 2.9948 0 00-2.8157 2H7.8156A2.9925 2.9925 0 104 7.8154v4.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8156 6h4.3686A2.9947 2.9947 0 1015 2zM5 16a1 1 0 111-1A1.0008 1.0008 0 015 16zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zM15 6a1 1 0 111-1A1.0008 1.0008 0 0115 6z" } }], "name": "scalpel--select", "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.8281 7.1719a4.0941 4.0941 0 00-5.6562 0L.3433 30H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.8281a3.9984 3.9984 0 000-5.6562zM12.2928 20.8787l2.086-2.0859 2.8293 2.8294-2.0857 2.0862zM11.71 27.1211A2.9824 2.9824 0 019.5889 28H5.1714l5.7073-5.7072 2.83 2.83zm15.7037-15.707l-8.792 8.7939-2.8293-2.8292 8.7931-8.7929a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM15 2a2.9948 2.9948 0 00-2.8157 2H7.8156A2.9925 2.9925 0 104 7.8154v4.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8156 6h4.3686A2.9947 2.9947 0 1015 2zM5 16a1 1 0 111-1A1.0008 1.0008 0 015 16zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zM15 6a1 1 0 111-1A1.0008 1.0008 0 0115 6z"></path></svg>`
},
"16": {
metadata: { "moduleName": "WatsonHealthScalpelSelect16", "filepath": "watson-health/scalpel--select/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.8281 7.1719a4.0941 4.0941 0 00-5.6562 0L.3433 30H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.8281a3.9984 3.9984 0 000-5.6562zM12.2928 20.8787l2.086-2.0859 2.8293 2.8294-2.0857 2.0862zM11.71 27.1211A2.9824 2.9824 0 019.5889 28H5.1714l5.7073-5.7072 2.83 2.83zm15.7037-15.707l-8.792 8.7939-2.8293-2.8292 8.7931-8.7929a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM15 2a2.9948 2.9948 0 00-2.8157 2H7.8156A2.9925 2.9925 0 104 7.8154v4.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8156 6h4.3686A2.9947 2.9947 0 1015 2zM5 16a1 1 0 111-1A1.0008 1.0008 0 015 16zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zM15 6a1 1 0 111-1A1.0008 1.0008 0 0115 6z" } }], "name": "scalpel--select", "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.8281 7.1719a4.0941 4.0941 0 00-5.6562 0L.3433 30H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.8281a3.9984 3.9984 0 000-5.6562zM12.2928 20.8787l2.086-2.0859 2.8293 2.8294-2.0857 2.0862zM11.71 27.1211A2.9824 2.9824 0 019.5889 28H5.1714l5.7073-5.7072 2.83 2.83zm15.7037-15.707l-8.792 8.7939-2.8293-2.8292 8.7931-8.7929a2.0473 2.0473 0 012.8282 0 1.9995 1.9995 0 010 2.8282zM15 2a2.9948 2.9948 0 00-2.8157 2H7.8156A2.9925 2.9925 0 104 7.8154v4.3687a3 3 0 102 0V7.8159A2.9959 2.9959 0 007.8156 6h4.3686A2.9947 2.9947 0 1015 2zM5 16a1 1 0 111-1A1.0008 1.0008 0 015 16zM5 6A1 1 0 116 5 1.0008 1.0008 0 015 6zM15 6a1 1 0 111-1A1.0008 1.0008 0 0115 6z"></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;
WatsonHealthScalpelSelectDirective_1.titleIdCounter++;
title.setAttribute("id", `watson-health-scalpel-select-${WatsonHealthScalpelSelectDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `watson-health-scalpel-select-${WatsonHealthScalpelSelectDirective_1.titleIdCounter}`);
}
}
};
WatsonHealthScalpelSelectDirective.titleIdCounter = 0;
WatsonHealthScalpelSelectDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthScalpelSelectDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthScalpelSelectDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelSelectDirective.prototype, "size", void 0);
WatsonHealthScalpelSelectDirective = WatsonHealthScalpelSelectDirective_1 = __decorate([
Directive({
selector: "[ibmIconWatsonHealthScalpelSelect]"
}),
__metadata("design:paramtypes", [ElementRef])
], WatsonHealthScalpelSelectDirective);
let WatsonHealthScalpelSelectModule = class WatsonHealthScalpelSelectModule {
};
WatsonHealthScalpelSelectModule = __decorate([
NgModule({
declarations: [
WatsonHealthScalpelSelectComponent,
WatsonHealthScalpelSelectDirective,
],
exports: [
WatsonHealthScalpelSelectComponent,
WatsonHealthScalpelSelectDirective,
]
})
], WatsonHealthScalpelSelectModule);
export { WatsonHealthScalpelSelectComponent, WatsonHealthScalpelSelectDirective, WatsonHealthScalpelSelectModule };