@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
169 lines (166 loc) • 11.7 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var PedestrianComponent = /** @class */ (function () {
function PedestrianComponent() {
this.focusable = false;
}
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PedestrianComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PedestrianComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianComponent.prototype, "size", void 0);
PedestrianComponent = __decorate([
Component({
selector: "ibm-icon-pedestrian",
template: "\n <svg\n ibmIconPedestrian\n [size]=\"size\"\n [ariaLabel]=\"ariaLabel\"\n [ariaLabelledby]=\"ariaLabelledby\"\n [ariaHidden]=\"ariaHidden\"\n [title]=\"title\"\n [isFocusable]=\"focusable\"\n [attr.class]=\"innerClass\">\n </svg>\n "
})
], PedestrianComponent);
return PedestrianComponent;
}());
var PedestrianDirective = /** @class */ (function () {
function PedestrianDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "Pedestrian32", "filepath": "pedestrian/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": "M21.6772,14l-1.2456-3.1143A2.9861,2.9861,0,0,0,17.646,9H13.5542a3.0018,3.0018,0,0,0-1.5439.4277L7,12.4336V18H9V13.5664l3-1.8V23.6973L8.5383,28.8906,10.2024,30,14,24.3027V11h3.646a.9949.9949,0,0,1,.9282.6289L20.3228,16H26V14Z" } }, { "elem": "path", "attrs": { "d": "M17.051 18.316L19 24.162 19 30 21 30 21 23.838 18.949 17.684 17.051 18.316zM16.5 8A3.5 3.5 0 1120 4.5 3.5042 3.5042 0 0116.5 8zm0-5A1.5 1.5 0 1018 4.5 1.5017 1.5017 0 0016.5 3z" } }], "name": "pedestrian", "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=\"M21.6772,14l-1.2456-3.1143A2.9861,2.9861,0,0,0,17.646,9H13.5542a3.0018,3.0018,0,0,0-1.5439.4277L7,12.4336V18H9V13.5664l3-1.8V23.6973L8.5383,28.8906,10.2024,30,14,24.3027V11h3.646a.9949.9949,0,0,1,.9282.6289L20.3228,16H26V14Z\"></path><path d=\"M17.051 18.316L19 24.162 19 30 21 30 21 23.838 18.949 17.684 17.051 18.316zM16.5 8A3.5 3.5 0 1120 4.5 3.5042 3.5042 0 0116.5 8zm0-5A1.5 1.5 0 1018 4.5 1.5017 1.5017 0 0016.5 3z\"></path></svg>"
},
"24": {
metadata: { "moduleName": "Pedestrian24", "filepath": "pedestrian/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": "M21.6772,14l-1.2456-3.1143A2.9861,2.9861,0,0,0,17.646,9H13.5542a3.0018,3.0018,0,0,0-1.5439.4277L7,12.4336V18H9V13.5664l3-1.8V23.6973L8.5383,28.8906,10.2024,30,14,24.3027V11h3.646a.9949.9949,0,0,1,.9282.6289L20.3228,16H26V14Z" } }, { "elem": "path", "attrs": { "d": "M17.051 18.316L19 24.162 19 30 21 30 21 23.838 18.949 17.684 17.051 18.316zM16.5 8A3.5 3.5 0 1120 4.5 3.5042 3.5042 0 0116.5 8zm0-5A1.5 1.5 0 1018 4.5 1.5017 1.5017 0 0016.5 3z" } }], "name": "pedestrian", "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=\"M21.6772,14l-1.2456-3.1143A2.9861,2.9861,0,0,0,17.646,9H13.5542a3.0018,3.0018,0,0,0-1.5439.4277L7,12.4336V18H9V13.5664l3-1.8V23.6973L8.5383,28.8906,10.2024,30,14,24.3027V11h3.646a.9949.9949,0,0,1,.9282.6289L20.3228,16H26V14Z\"></path><path d=\"M17.051 18.316L19 24.162 19 30 21 30 21 23.838 18.949 17.684 17.051 18.316zM16.5 8A3.5 3.5 0 1120 4.5 3.5042 3.5042 0 0116.5 8zm0-5A1.5 1.5 0 1018 4.5 1.5017 1.5017 0 0016.5 3z\"></path></svg>"
},
"20": {
metadata: { "moduleName": "Pedestrian20", "filepath": "pedestrian/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": "M21.6772,14l-1.2456-3.1143A2.9861,2.9861,0,0,0,17.646,9H13.5542a3.0018,3.0018,0,0,0-1.5439.4277L7,12.4336V18H9V13.5664l3-1.8V23.6973L8.5383,28.8906,10.2024,30,14,24.3027V11h3.646a.9949.9949,0,0,1,.9282.6289L20.3228,16H26V14Z" } }, { "elem": "path", "attrs": { "d": "M17.051 18.316L19 24.162 19 30 21 30 21 23.838 18.949 17.684 17.051 18.316zM16.5 8A3.5 3.5 0 1120 4.5 3.5042 3.5042 0 0116.5 8zm0-5A1.5 1.5 0 1018 4.5 1.5017 1.5017 0 0016.5 3z" } }], "name": "pedestrian", "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=\"M21.6772,14l-1.2456-3.1143A2.9861,2.9861,0,0,0,17.646,9H13.5542a3.0018,3.0018,0,0,0-1.5439.4277L7,12.4336V18H9V13.5664l3-1.8V23.6973L8.5383,28.8906,10.2024,30,14,24.3027V11h3.646a.9949.9949,0,0,1,.9282.6289L20.3228,16H26V14Z\"></path><path d=\"M17.051 18.316L19 24.162 19 30 21 30 21 23.838 18.949 17.684 17.051 18.316zM16.5 8A3.5 3.5 0 1120 4.5 3.5042 3.5042 0 0116.5 8zm0-5A1.5 1.5 0 1018 4.5 1.5017 1.5017 0 0016.5 3z\"></path></svg>"
},
"16": {
metadata: { "moduleName": "Pedestrian16", "filepath": "pedestrian/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": "M21.6772,14l-1.2456-3.1143A2.9861,2.9861,0,0,0,17.646,9H13.5542a3.0018,3.0018,0,0,0-1.5439.4277L7,12.4336V18H9V13.5664l3-1.8V23.6973L8.5383,28.8906,10.2024,30,14,24.3027V11h3.646a.9949.9949,0,0,1,.9282.6289L20.3228,16H26V14Z" } }, { "elem": "path", "attrs": { "d": "M17.051 18.316L19 24.162 19 30 21 30 21 23.838 18.949 17.684 17.051 18.316zM16.5 8A3.5 3.5 0 1120 4.5 3.5042 3.5042 0 0116.5 8zm0-5A1.5 1.5 0 1018 4.5 1.5017 1.5017 0 0016.5 3z" } }], "name": "pedestrian", "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=\"M21.6772,14l-1.2456-3.1143A2.9861,2.9861,0,0,0,17.646,9H13.5542a3.0018,3.0018,0,0,0-1.5439.4277L7,12.4336V18H9V13.5664l3-1.8V23.6973L8.5383,28.8906,10.2024,30,14,24.3027V11h3.646a.9949.9949,0,0,1,.9282.6289L20.3228,16H26V14Z\"></path><path d=\"M17.051 18.316L19 24.162 19 30 21 30 21 23.838 18.949 17.684 17.051 18.316zM16.5 8A3.5 3.5 0 1120 4.5 3.5042 3.5042 0 0116.5 8zm0-5A1.5 1.5 0 1018 4.5 1.5017 1.5017 0 0016.5 3z\"></path></svg>"
},
};
}
PedestrianDirective_1 = PedestrianDirective;
PedestrianDirective.prototype.ngAfterViewInit = function () {
var svg = this.elementRef.nativeElement;
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
var icon = this.icons[this.size];
var domParser = new DOMParser();
var rawSVG = icon.svg;
var svgElement = domParser.parseFromString(rawSVG, "image/svg+xml").documentElement;
var 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;
}
var 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()
});
var attrKeys = Object.keys(attributes);
for (var i = 0; i < attrKeys.length; i++) {
var key = attrKeys[i];
var value = attributes[key];
if (key === "title") {
continue;
}
if (value) {
svg.setAttribute(key, value);
}
}
if (attributes.title) {
var title = document.createElement("title");
title.textContent = attributes.title;
PedestrianDirective_1.titleIdCounter++;
title.setAttribute("id", "pedestrian-" + PedestrianDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "pedestrian-" + PedestrianDirective_1.titleIdCounter);
}
};
var PedestrianDirective_1;
PedestrianDirective.titleIdCounter = 0;
PedestrianDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PedestrianDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PedestrianDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PedestrianDirective.prototype, "size", void 0);
PedestrianDirective = PedestrianDirective_1 = __decorate([
Directive({
selector: "[ibmIconPedestrian]"
}),
__metadata("design:paramtypes", [ElementRef])
], PedestrianDirective);
return PedestrianDirective;
}());
var PedestrianModule = /** @class */ (function () {
function PedestrianModule() {
}
PedestrianModule = __decorate([
NgModule({
declarations: [
PedestrianComponent,
PedestrianDirective,
],
exports: [
PedestrianComponent,
PedestrianDirective,
]
})
], PedestrianModule);
return PedestrianModule;
}());
export { PedestrianComponent, PedestrianDirective, PedestrianModule };