@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 14.9 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var TwoPersonLiftDirective_1;
let TwoPersonLiftComponent = class TwoPersonLiftComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], TwoPersonLiftComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], TwoPersonLiftComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftComponent.prototype, "size", void 0);
TwoPersonLiftComponent = __decorate([
Component({
selector: "ibm-icon-two-person-lift",
template: `
<svg
ibmIconTwoPersonLift
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], TwoPersonLiftComponent);
let TwoPersonLiftDirective = TwoPersonLiftDirective_1 = class TwoPersonLiftDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "TwoPersonLift32", "filepath": "two-person-lift/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": "M26.96 30l-1.9215-6.7253a1.0008 1.0008 0 01.3369-1.0554L29.874 18.62 28.52 13.2014l-2.7382 3.4234A1.0026 1.0026 0 0125 17H20V15h4.52l3.6993-4.6248a1 1 0 011.7509.3824l2 8a.9989.9989 0 01-.3447 1.0232l-4.48 3.5845 1.7389 6.0854zM23 5.5A3.5 3.5 0 1126.5 9 3.5042 3.5042 0 0123 5.5zm2 0A1.5 1.5 0 1026.5 4 1.5017 1.5017 0 0025 5.5z" } }, { "elem": "path", "attrs": { "d": "M20.0039,19A2.0039,2.0039,0,0,1,18,16.9961V15.0039A2.0039,2.0039,0,0,1,20.0039,13H22V10H10v3h1.9961A2.0039,2.0039,0,0,1,14,15.0039v1.9922A2.0039,2.0039,0,0,1,11.9961,19H10v3H22V19Z" } }, { "elem": "path", "attrs": { "d": "M5.04 30l1.9215-6.7253a1.0013 1.0013 0 00-.3369-1.0555L2.126 18.62l1.3545-5.4185 2.7382 3.4234A1.0026 1.0026 0 007 17h5V15H7.4805L3.7812 10.3752a1 1 0 00-1.7509.3824l-2 8A.9989.9989 0 00.375 19.7808l4.4805 3.5844-1.739 6.0855zM5.5 9A3.5 3.5 0 119 5.5 3.5042 3.5042 0 015.5 9zm0-5A1.5 1.5 0 107 5.5 1.5017 1.5017 0 005.5 4z" } }], "name": "two-person-lift", "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="M26.96 30l-1.9215-6.7253a1.0008 1.0008 0 01.3369-1.0554L29.874 18.62 28.52 13.2014l-2.7382 3.4234A1.0026 1.0026 0 0125 17H20V15h4.52l3.6993-4.6248a1 1 0 011.7509.3824l2 8a.9989.9989 0 01-.3447 1.0232l-4.48 3.5845 1.7389 6.0854zM23 5.5A3.5 3.5 0 1126.5 9 3.5042 3.5042 0 0123 5.5zm2 0A1.5 1.5 0 1026.5 4 1.5017 1.5017 0 0025 5.5z"></path><path d="M20.0039,19A2.0039,2.0039,0,0,1,18,16.9961V15.0039A2.0039,2.0039,0,0,1,20.0039,13H22V10H10v3h1.9961A2.0039,2.0039,0,0,1,14,15.0039v1.9922A2.0039,2.0039,0,0,1,11.9961,19H10v3H22V19Z"></path><path d="M5.04 30l1.9215-6.7253a1.0013 1.0013 0 00-.3369-1.0555L2.126 18.62l1.3545-5.4185 2.7382 3.4234A1.0026 1.0026 0 007 17h5V15H7.4805L3.7812 10.3752a1 1 0 00-1.7509.3824l-2 8A.9989.9989 0 00.375 19.7808l4.4805 3.5844-1.739 6.0855zM5.5 9A3.5 3.5 0 119 5.5 3.5042 3.5042 0 015.5 9zm0-5A1.5 1.5 0 107 5.5 1.5017 1.5017 0 005.5 4z"></path></svg>`
},
"24": {
metadata: { "moduleName": "TwoPersonLift24", "filepath": "two-person-lift/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": "M26.96 30l-1.9215-6.7253a1.0008 1.0008 0 01.3369-1.0554L29.874 18.62 28.52 13.2014l-2.7382 3.4234A1.0026 1.0026 0 0125 17H20V15h4.52l3.6993-4.6248a1 1 0 011.7509.3824l2 8a.9989.9989 0 01-.3447 1.0232l-4.48 3.5845 1.7389 6.0854zM23 5.5A3.5 3.5 0 1126.5 9 3.5042 3.5042 0 0123 5.5zm2 0A1.5 1.5 0 1026.5 4 1.5017 1.5017 0 0025 5.5z" } }, { "elem": "path", "attrs": { "d": "M20.0039,19A2.0039,2.0039,0,0,1,18,16.9961V15.0039A2.0039,2.0039,0,0,1,20.0039,13H22V10H10v3h1.9961A2.0039,2.0039,0,0,1,14,15.0039v1.9922A2.0039,2.0039,0,0,1,11.9961,19H10v3H22V19Z" } }, { "elem": "path", "attrs": { "d": "M5.04 30l1.9215-6.7253a1.0013 1.0013 0 00-.3369-1.0555L2.126 18.62l1.3545-5.4185 2.7382 3.4234A1.0026 1.0026 0 007 17h5V15H7.4805L3.7812 10.3752a1 1 0 00-1.7509.3824l-2 8A.9989.9989 0 00.375 19.7808l4.4805 3.5844-1.739 6.0855zM5.5 9A3.5 3.5 0 119 5.5 3.5042 3.5042 0 015.5 9zm0-5A1.5 1.5 0 107 5.5 1.5017 1.5017 0 005.5 4z" } }], "name": "two-person-lift", "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="M26.96 30l-1.9215-6.7253a1.0008 1.0008 0 01.3369-1.0554L29.874 18.62 28.52 13.2014l-2.7382 3.4234A1.0026 1.0026 0 0125 17H20V15h4.52l3.6993-4.6248a1 1 0 011.7509.3824l2 8a.9989.9989 0 01-.3447 1.0232l-4.48 3.5845 1.7389 6.0854zM23 5.5A3.5 3.5 0 1126.5 9 3.5042 3.5042 0 0123 5.5zm2 0A1.5 1.5 0 1026.5 4 1.5017 1.5017 0 0025 5.5z"></path><path d="M20.0039,19A2.0039,2.0039,0,0,1,18,16.9961V15.0039A2.0039,2.0039,0,0,1,20.0039,13H22V10H10v3h1.9961A2.0039,2.0039,0,0,1,14,15.0039v1.9922A2.0039,2.0039,0,0,1,11.9961,19H10v3H22V19Z"></path><path d="M5.04 30l1.9215-6.7253a1.0013 1.0013 0 00-.3369-1.0555L2.126 18.62l1.3545-5.4185 2.7382 3.4234A1.0026 1.0026 0 007 17h5V15H7.4805L3.7812 10.3752a1 1 0 00-1.7509.3824l-2 8A.9989.9989 0 00.375 19.7808l4.4805 3.5844-1.739 6.0855zM5.5 9A3.5 3.5 0 119 5.5 3.5042 3.5042 0 015.5 9zm0-5A1.5 1.5 0 107 5.5 1.5017 1.5017 0 005.5 4z"></path></svg>`
},
"20": {
metadata: { "moduleName": "TwoPersonLift20", "filepath": "two-person-lift/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": "M26.96 30l-1.9215-6.7253a1.0008 1.0008 0 01.3369-1.0554L29.874 18.62 28.52 13.2014l-2.7382 3.4234A1.0026 1.0026 0 0125 17H20V15h4.52l3.6993-4.6248a1 1 0 011.7509.3824l2 8a.9989.9989 0 01-.3447 1.0232l-4.48 3.5845 1.7389 6.0854zM23 5.5A3.5 3.5 0 1126.5 9 3.5042 3.5042 0 0123 5.5zm2 0A1.5 1.5 0 1026.5 4 1.5017 1.5017 0 0025 5.5z" } }, { "elem": "path", "attrs": { "d": "M20.0039,19A2.0039,2.0039,0,0,1,18,16.9961V15.0039A2.0039,2.0039,0,0,1,20.0039,13H22V10H10v3h1.9961A2.0039,2.0039,0,0,1,14,15.0039v1.9922A2.0039,2.0039,0,0,1,11.9961,19H10v3H22V19Z" } }, { "elem": "path", "attrs": { "d": "M5.04 30l1.9215-6.7253a1.0013 1.0013 0 00-.3369-1.0555L2.126 18.62l1.3545-5.4185 2.7382 3.4234A1.0026 1.0026 0 007 17h5V15H7.4805L3.7812 10.3752a1 1 0 00-1.7509.3824l-2 8A.9989.9989 0 00.375 19.7808l4.4805 3.5844-1.739 6.0855zM5.5 9A3.5 3.5 0 119 5.5 3.5042 3.5042 0 015.5 9zm0-5A1.5 1.5 0 107 5.5 1.5017 1.5017 0 005.5 4z" } }], "name": "two-person-lift", "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="M26.96 30l-1.9215-6.7253a1.0008 1.0008 0 01.3369-1.0554L29.874 18.62 28.52 13.2014l-2.7382 3.4234A1.0026 1.0026 0 0125 17H20V15h4.52l3.6993-4.6248a1 1 0 011.7509.3824l2 8a.9989.9989 0 01-.3447 1.0232l-4.48 3.5845 1.7389 6.0854zM23 5.5A3.5 3.5 0 1126.5 9 3.5042 3.5042 0 0123 5.5zm2 0A1.5 1.5 0 1026.5 4 1.5017 1.5017 0 0025 5.5z"></path><path d="M20.0039,19A2.0039,2.0039,0,0,1,18,16.9961V15.0039A2.0039,2.0039,0,0,1,20.0039,13H22V10H10v3h1.9961A2.0039,2.0039,0,0,1,14,15.0039v1.9922A2.0039,2.0039,0,0,1,11.9961,19H10v3H22V19Z"></path><path d="M5.04 30l1.9215-6.7253a1.0013 1.0013 0 00-.3369-1.0555L2.126 18.62l1.3545-5.4185 2.7382 3.4234A1.0026 1.0026 0 007 17h5V15H7.4805L3.7812 10.3752a1 1 0 00-1.7509.3824l-2 8A.9989.9989 0 00.375 19.7808l4.4805 3.5844-1.739 6.0855zM5.5 9A3.5 3.5 0 119 5.5 3.5042 3.5042 0 015.5 9zm0-5A1.5 1.5 0 107 5.5 1.5017 1.5017 0 005.5 4z"></path></svg>`
},
"16": {
metadata: { "moduleName": "TwoPersonLift16", "filepath": "two-person-lift/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": "M26.96 30l-1.9215-6.7253a1.0008 1.0008 0 01.3369-1.0554L29.874 18.62 28.52 13.2014l-2.7382 3.4234A1.0026 1.0026 0 0125 17H20V15h4.52l3.6993-4.6248a1 1 0 011.7509.3824l2 8a.9989.9989 0 01-.3447 1.0232l-4.48 3.5845 1.7389 6.0854zM23 5.5A3.5 3.5 0 1126.5 9 3.5042 3.5042 0 0123 5.5zm2 0A1.5 1.5 0 1026.5 4 1.5017 1.5017 0 0025 5.5z" } }, { "elem": "path", "attrs": { "d": "M20.0039,19A2.0039,2.0039,0,0,1,18,16.9961V15.0039A2.0039,2.0039,0,0,1,20.0039,13H22V10H10v3h1.9961A2.0039,2.0039,0,0,1,14,15.0039v1.9922A2.0039,2.0039,0,0,1,11.9961,19H10v3H22V19Z" } }, { "elem": "path", "attrs": { "d": "M5.04 30l1.9215-6.7253a1.0013 1.0013 0 00-.3369-1.0555L2.126 18.62l1.3545-5.4185 2.7382 3.4234A1.0026 1.0026 0 007 17h5V15H7.4805L3.7812 10.3752a1 1 0 00-1.7509.3824l-2 8A.9989.9989 0 00.375 19.7808l4.4805 3.5844-1.739 6.0855zM5.5 9A3.5 3.5 0 119 5.5 3.5042 3.5042 0 015.5 9zm0-5A1.5 1.5 0 107 5.5 1.5017 1.5017 0 005.5 4z" } }], "name": "two-person-lift", "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="M26.96 30l-1.9215-6.7253a1.0008 1.0008 0 01.3369-1.0554L29.874 18.62 28.52 13.2014l-2.7382 3.4234A1.0026 1.0026 0 0125 17H20V15h4.52l3.6993-4.6248a1 1 0 011.7509.3824l2 8a.9989.9989 0 01-.3447 1.0232l-4.48 3.5845 1.7389 6.0854zM23 5.5A3.5 3.5 0 1126.5 9 3.5042 3.5042 0 0123 5.5zm2 0A1.5 1.5 0 1026.5 4 1.5017 1.5017 0 0025 5.5z"></path><path d="M20.0039,19A2.0039,2.0039,0,0,1,18,16.9961V15.0039A2.0039,2.0039,0,0,1,20.0039,13H22V10H10v3h1.9961A2.0039,2.0039,0,0,1,14,15.0039v1.9922A2.0039,2.0039,0,0,1,11.9961,19H10v3H22V19Z"></path><path d="M5.04 30l1.9215-6.7253a1.0013 1.0013 0 00-.3369-1.0555L2.126 18.62l1.3545-5.4185 2.7382 3.4234A1.0026 1.0026 0 007 17h5V15H7.4805L3.7812 10.3752a1 1 0 00-1.7509.3824l-2 8A.9989.9989 0 00.375 19.7808l4.4805 3.5844-1.739 6.0855zM5.5 9A3.5 3.5 0 119 5.5 3.5042 3.5042 0 015.5 9zm0-5A1.5 1.5 0 107 5.5 1.5017 1.5017 0 005.5 4z"></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;
TwoPersonLiftDirective_1.titleIdCounter++;
title.setAttribute("id", `two-person-lift-${TwoPersonLiftDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `two-person-lift-${TwoPersonLiftDirective_1.titleIdCounter}`);
}
}
};
TwoPersonLiftDirective.titleIdCounter = 0;
TwoPersonLiftDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], TwoPersonLiftDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], TwoPersonLiftDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TwoPersonLiftDirective.prototype, "size", void 0);
TwoPersonLiftDirective = TwoPersonLiftDirective_1 = __decorate([
Directive({
selector: "[ibmIconTwoPersonLift]"
}),
__metadata("design:paramtypes", [ElementRef])
], TwoPersonLiftDirective);
let TwoPersonLiftModule = class TwoPersonLiftModule {
};
TwoPersonLiftModule = __decorate([
NgModule({
declarations: [
TwoPersonLiftComponent,
TwoPersonLiftDirective,
],
exports: [
TwoPersonLiftComponent,
TwoPersonLiftDirective,
]
})
], TwoPersonLiftModule);
export { TwoPersonLiftComponent, TwoPersonLiftDirective, TwoPersonLiftModule };