@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 14 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var WatsonHealthScalpelLassoDirective_1;
let WatsonHealthScalpelLassoComponent = class WatsonHealthScalpelLassoComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthScalpelLassoComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthScalpelLassoComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoComponent.prototype, "size", void 0);
WatsonHealthScalpelLassoComponent = __decorate([
Component({
selector: "ibm-icon-watson-health-scalpel-lasso",
template: `
<svg
ibmIconWatsonHealthScalpelLasso
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], WatsonHealthScalpelLassoComponent);
let WatsonHealthScalpelLassoDirective = WatsonHealthScalpelLassoDirective_1 = class WatsonHealthScalpelLassoDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "WatsonHealthScalpelLasso32", "filepath": "watson-health/scalpel--lasso/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.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM11 2H7a4.9843 4.9843 0 00-3.8633 8.1528A2.9586 2.9586 0 003 11a2.9945 2.9945 0 002 2.8154V14a2.0025 2.0025 0 01-2 2H2v2H3a4.0045 4.0045 0 004-4v-.1841A2.9959 2.9959 0 008.8157 12H11A5 5 0 0011 2zM6 12a1 1 0 111-1A1.0009 1.0009 0 016 12zm5-2H8.8157A2.974 2.974 0 004.394 8.4746 2.9908 2.9908 0 017 4h4a3 3 0 010 6z" } }], "name": "scalpel--lasso", "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.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM11 2H7a4.9843 4.9843 0 00-3.8633 8.1528A2.9586 2.9586 0 003 11a2.9945 2.9945 0 002 2.8154V14a2.0025 2.0025 0 01-2 2H2v2H3a4.0045 4.0045 0 004-4v-.1841A2.9959 2.9959 0 008.8157 12H11A5 5 0 0011 2zM6 12a1 1 0 111-1A1.0009 1.0009 0 016 12zm5-2H8.8157A2.974 2.974 0 004.394 8.4746 2.9908 2.9908 0 017 4h4a3 3 0 010 6z"></path></svg>`
},
"24": {
metadata: { "moduleName": "WatsonHealthScalpelLasso24", "filepath": "watson-health/scalpel--lasso/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.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM11 2H7a4.9843 4.9843 0 00-3.8633 8.1528A2.9586 2.9586 0 003 11a2.9945 2.9945 0 002 2.8154V14a2.0025 2.0025 0 01-2 2H2v2H3a4.0045 4.0045 0 004-4v-.1841A2.9959 2.9959 0 008.8157 12H11A5 5 0 0011 2zM6 12a1 1 0 111-1A1.0009 1.0009 0 016 12zm5-2H8.8157A2.974 2.974 0 004.394 8.4746 2.9908 2.9908 0 017 4h4a3 3 0 010 6z" } }], "name": "scalpel--lasso", "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.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM11 2H7a4.9843 4.9843 0 00-3.8633 8.1528A2.9586 2.9586 0 003 11a2.9945 2.9945 0 002 2.8154V14a2.0025 2.0025 0 01-2 2H2v2H3a4.0045 4.0045 0 004-4v-.1841A2.9959 2.9959 0 008.8157 12H11A5 5 0 0011 2zM6 12a1 1 0 111-1A1.0009 1.0009 0 016 12zm5-2H8.8157A2.974 2.974 0 004.394 8.4746 2.9908 2.9908 0 017 4h4a3 3 0 010 6z"></path></svg>`
},
"20": {
metadata: { "moduleName": "WatsonHealthScalpelLasso20", "filepath": "watson-health/scalpel--lasso/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.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM11 2H7a4.9843 4.9843 0 00-3.8633 8.1528A2.9586 2.9586 0 003 11a2.9945 2.9945 0 002 2.8154V14a2.0025 2.0025 0 01-2 2H2v2H3a4.0045 4.0045 0 004-4v-.1841A2.9959 2.9959 0 008.8157 12H11A5 5 0 0011 2zM6 12a1 1 0 111-1A1.0009 1.0009 0 016 12zm5-2H8.8157A2.974 2.974 0 004.394 8.4746 2.9908 2.9908 0 017 4h4a3 3 0 010 6z" } }], "name": "scalpel--lasso", "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.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM11 2H7a4.9843 4.9843 0 00-3.8633 8.1528A2.9586 2.9586 0 003 11a2.9945 2.9945 0 002 2.8154V14a2.0025 2.0025 0 01-2 2H2v2H3a4.0045 4.0045 0 004-4v-.1841A2.9959 2.9959 0 008.8157 12H11A5 5 0 0011 2zM6 12a1 1 0 111-1A1.0009 1.0009 0 016 12zm5-2H8.8157A2.974 2.974 0 004.394 8.4746 2.9908 2.9908 0 017 4h4a3 3 0 010 6z"></path></svg>`
},
"16": {
metadata: { "moduleName": "WatsonHealthScalpelLasso16", "filepath": "watson-health/scalpel--lasso/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.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM11 2H7a4.9843 4.9843 0 00-3.8633 8.1528A2.9586 2.9586 0 003 11a2.9945 2.9945 0 002 2.8154V14a2.0025 2.0025 0 01-2 2H2v2H3a4.0045 4.0045 0 004-4v-.1841A2.9959 2.9959 0 008.8157 12H11A5 5 0 0011 2zM6 12a1 1 0 111-1A1.0009 1.0009 0 016 12zm5-2H8.8157A2.974 2.974 0 004.394 8.4746 2.9908 2.9908 0 017 4h4a3 3 0 010 6z" } }], "name": "scalpel--lasso", "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.1338a4.0941 4.0941 0 00-5.6562 0L.3433 29.9619H9.5889a4.9682 4.9682 0 003.5356-1.4648L28.8281 12.79a3.9984 3.9984 0 000-5.6562zM12.2928 20.8406l2.086-2.0858 2.8293 2.8293L15.1224 23.67zM11.71 27.083a2.9824 2.9824 0 01-2.1215.8789H5.1714l5.7073-5.7072 2.83 2.83zM27.4141 11.376L18.6221 20.17l-2.8293-2.8292 8.7931-8.7928a2.0471 2.0471 0 012.8282 0 1.9993 1.9993 0 010 2.8281zM11 2H7a4.9843 4.9843 0 00-3.8633 8.1528A2.9586 2.9586 0 003 11a2.9945 2.9945 0 002 2.8154V14a2.0025 2.0025 0 01-2 2H2v2H3a4.0045 4.0045 0 004-4v-.1841A2.9959 2.9959 0 008.8157 12H11A5 5 0 0011 2zM6 12a1 1 0 111-1A1.0009 1.0009 0 016 12zm5-2H8.8157A2.974 2.974 0 004.394 8.4746 2.9908 2.9908 0 017 4h4a3 3 0 010 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;
WatsonHealthScalpelLassoDirective_1.titleIdCounter++;
title.setAttribute("id", `watson-health-scalpel-lasso-${WatsonHealthScalpelLassoDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `watson-health-scalpel-lasso-${WatsonHealthScalpelLassoDirective_1.titleIdCounter}`);
}
}
};
WatsonHealthScalpelLassoDirective.titleIdCounter = 0;
WatsonHealthScalpelLassoDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthScalpelLassoDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], WatsonHealthScalpelLassoDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], WatsonHealthScalpelLassoDirective.prototype, "size", void 0);
WatsonHealthScalpelLassoDirective = WatsonHealthScalpelLassoDirective_1 = __decorate([
Directive({
selector: "[ibmIconWatsonHealthScalpelLasso]"
}),
__metadata("design:paramtypes", [ElementRef])
], WatsonHealthScalpelLassoDirective);
let WatsonHealthScalpelLassoModule = class WatsonHealthScalpelLassoModule {
};
WatsonHealthScalpelLassoModule = __decorate([
NgModule({
declarations: [
WatsonHealthScalpelLassoComponent,
WatsonHealthScalpelLassoDirective,
],
exports: [
WatsonHealthScalpelLassoComponent,
WatsonHealthScalpelLassoDirective,
]
})
], WatsonHealthScalpelLassoModule);
export { WatsonHealthScalpelLassoComponent, WatsonHealthScalpelLassoDirective, WatsonHealthScalpelLassoModule };