@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 13.1 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var EarthEuropeAfricaDirective_1;
let EarthEuropeAfricaComponent = class EarthEuropeAfricaComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], EarthEuropeAfricaComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], EarthEuropeAfricaComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaComponent.prototype, "size", void 0);
EarthEuropeAfricaComponent = __decorate([
Component({
selector: "ibm-icon-earth-europe-africa",
template: `
<svg
ibmIconEarthEuropeAfrica
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], EarthEuropeAfricaComponent);
let EarthEuropeAfricaDirective = EarthEuropeAfricaDirective_1 = class EarthEuropeAfricaDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "EarthEuropeAfrica32", "filepath": "earth--europe-africa/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": "M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM4,16A11.96,11.96,0,0,1,8,7.0811V9a2,2,0,0,0,2,2h3.3818a2,2,0,0,0,1.7893-1.106L15.6182,9H18v4H13.2354a2,2,0,0,0-.8936.2109L9.1055,14.8291A2,2,0,0,0,8,16.6177v3.7055A2,2,0,0,0,9.2573,22.18l3.8487,1.54.6779,4.0664A12.0135,12.0135,0,0,1,4,16ZM15.8457,27.9922,14.894,22.28,10,20.3232v-3.705L13.2358,15H20V7H14.3818l-1,2H10V5.6235A11.9578,11.9578,0,0,1,27.3,12H22v4l.9224,3.8135L21,22.6973v4.1972A11.9083,11.9083,0,0,1,16,28C15.948,28,15.8977,27.9927,15.8457,27.9922ZM23,25.7266V23.3027l1.5859-2.3789a2.0027,2.0027,0,0,0,.2769-1.5957L24,15.877V14h3.8193A11.8409,11.8409,0,0,1,23,25.7266Z" } }], "name": "earth--europe-africa", "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="M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM4,16A11.96,11.96,0,0,1,8,7.0811V9a2,2,0,0,0,2,2h3.3818a2,2,0,0,0,1.7893-1.106L15.6182,9H18v4H13.2354a2,2,0,0,0-.8936.2109L9.1055,14.8291A2,2,0,0,0,8,16.6177v3.7055A2,2,0,0,0,9.2573,22.18l3.8487,1.54.6779,4.0664A12.0135,12.0135,0,0,1,4,16ZM15.8457,27.9922,14.894,22.28,10,20.3232v-3.705L13.2358,15H20V7H14.3818l-1,2H10V5.6235A11.9578,11.9578,0,0,1,27.3,12H22v4l.9224,3.8135L21,22.6973v4.1972A11.9083,11.9083,0,0,1,16,28C15.948,28,15.8977,27.9927,15.8457,27.9922ZM23,25.7266V23.3027l1.5859-2.3789a2.0027,2.0027,0,0,0,.2769-1.5957L24,15.877V14h3.8193A11.8409,11.8409,0,0,1,23,25.7266Z"></path></svg>`
},
"24": {
metadata: { "moduleName": "EarthEuropeAfrica24", "filepath": "earth--europe-africa/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": "M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM4,16A11.96,11.96,0,0,1,8,7.0811V9a2,2,0,0,0,2,2h3.3818a2,2,0,0,0,1.7893-1.106L15.6182,9H18v4H13.2354a2,2,0,0,0-.8936.2109L9.1055,14.8291A2,2,0,0,0,8,16.6177v3.7055A2,2,0,0,0,9.2573,22.18l3.8487,1.54.6779,4.0664A12.0135,12.0135,0,0,1,4,16ZM15.8457,27.9922,14.894,22.28,10,20.3232v-3.705L13.2358,15H20V7H14.3818l-1,2H10V5.6235A11.9578,11.9578,0,0,1,27.3,12H22v4l.9224,3.8135L21,22.6973v4.1972A11.9083,11.9083,0,0,1,16,28C15.948,28,15.8977,27.9927,15.8457,27.9922ZM23,25.7266V23.3027l1.5859-2.3789a2.0027,2.0027,0,0,0,.2769-1.5957L24,15.877V14h3.8193A11.8409,11.8409,0,0,1,23,25.7266Z" } }], "name": "earth--europe-africa", "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="M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM4,16A11.96,11.96,0,0,1,8,7.0811V9a2,2,0,0,0,2,2h3.3818a2,2,0,0,0,1.7893-1.106L15.6182,9H18v4H13.2354a2,2,0,0,0-.8936.2109L9.1055,14.8291A2,2,0,0,0,8,16.6177v3.7055A2,2,0,0,0,9.2573,22.18l3.8487,1.54.6779,4.0664A12.0135,12.0135,0,0,1,4,16ZM15.8457,27.9922,14.894,22.28,10,20.3232v-3.705L13.2358,15H20V7H14.3818l-1,2H10V5.6235A11.9578,11.9578,0,0,1,27.3,12H22v4l.9224,3.8135L21,22.6973v4.1972A11.9083,11.9083,0,0,1,16,28C15.948,28,15.8977,27.9927,15.8457,27.9922ZM23,25.7266V23.3027l1.5859-2.3789a2.0027,2.0027,0,0,0,.2769-1.5957L24,15.877V14h3.8193A11.8409,11.8409,0,0,1,23,25.7266Z"></path></svg>`
},
"20": {
metadata: { "moduleName": "EarthEuropeAfrica20", "filepath": "earth--europe-africa/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": "M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM4,16A11.96,11.96,0,0,1,8,7.0811V9a2,2,0,0,0,2,2h3.3818a2,2,0,0,0,1.7893-1.106L15.6182,9H18v4H13.2354a2,2,0,0,0-.8936.2109L9.1055,14.8291A2,2,0,0,0,8,16.6177v3.7055A2,2,0,0,0,9.2573,22.18l3.8487,1.54.6779,4.0664A12.0135,12.0135,0,0,1,4,16ZM15.8457,27.9922,14.894,22.28,10,20.3232v-3.705L13.2358,15H20V7H14.3818l-1,2H10V5.6235A11.9578,11.9578,0,0,1,27.3,12H22v4l.9224,3.8135L21,22.6973v4.1972A11.9083,11.9083,0,0,1,16,28C15.948,28,15.8977,27.9927,15.8457,27.9922ZM23,25.7266V23.3027l1.5859-2.3789a2.0027,2.0027,0,0,0,.2769-1.5957L24,15.877V14h3.8193A11.8409,11.8409,0,0,1,23,25.7266Z" } }], "name": "earth--europe-africa", "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="M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM4,16A11.96,11.96,0,0,1,8,7.0811V9a2,2,0,0,0,2,2h3.3818a2,2,0,0,0,1.7893-1.106L15.6182,9H18v4H13.2354a2,2,0,0,0-.8936.2109L9.1055,14.8291A2,2,0,0,0,8,16.6177v3.7055A2,2,0,0,0,9.2573,22.18l3.8487,1.54.6779,4.0664A12.0135,12.0135,0,0,1,4,16ZM15.8457,27.9922,14.894,22.28,10,20.3232v-3.705L13.2358,15H20V7H14.3818l-1,2H10V5.6235A11.9578,11.9578,0,0,1,27.3,12H22v4l.9224,3.8135L21,22.6973v4.1972A11.9083,11.9083,0,0,1,16,28C15.948,28,15.8977,27.9927,15.8457,27.9922ZM23,25.7266V23.3027l1.5859-2.3789a2.0027,2.0027,0,0,0,.2769-1.5957L24,15.877V14h3.8193A11.8409,11.8409,0,0,1,23,25.7266Z"></path></svg>`
},
"16": {
metadata: { "moduleName": "EarthEuropeAfrica16", "filepath": "earth--europe-africa/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": "M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM4,16A11.96,11.96,0,0,1,8,7.0811V9a2,2,0,0,0,2,2h3.3818a2,2,0,0,0,1.7893-1.106L15.6182,9H18v4H13.2354a2,2,0,0,0-.8936.2109L9.1055,14.8291A2,2,0,0,0,8,16.6177v3.7055A2,2,0,0,0,9.2573,22.18l3.8487,1.54.6779,4.0664A12.0135,12.0135,0,0,1,4,16ZM15.8457,27.9922,14.894,22.28,10,20.3232v-3.705L13.2358,15H20V7H14.3818l-1,2H10V5.6235A11.9578,11.9578,0,0,1,27.3,12H22v4l.9224,3.8135L21,22.6973v4.1972A11.9083,11.9083,0,0,1,16,28C15.948,28,15.8977,27.9927,15.8457,27.9922ZM23,25.7266V23.3027l1.5859-2.3789a2.0027,2.0027,0,0,0,.2769-1.5957L24,15.877V14h3.8193A11.8409,11.8409,0,0,1,23,25.7266Z" } }], "name": "earth--europe-africa", "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="M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM4,16A11.96,11.96,0,0,1,8,7.0811V9a2,2,0,0,0,2,2h3.3818a2,2,0,0,0,1.7893-1.106L15.6182,9H18v4H13.2354a2,2,0,0,0-.8936.2109L9.1055,14.8291A2,2,0,0,0,8,16.6177v3.7055A2,2,0,0,0,9.2573,22.18l3.8487,1.54.6779,4.0664A12.0135,12.0135,0,0,1,4,16ZM15.8457,27.9922,14.894,22.28,10,20.3232v-3.705L13.2358,15H20V7H14.3818l-1,2H10V5.6235A11.9578,11.9578,0,0,1,27.3,12H22v4l.9224,3.8135L21,22.6973v4.1972A11.9083,11.9083,0,0,1,16,28C15.948,28,15.8977,27.9927,15.8457,27.9922ZM23,25.7266V23.3027l1.5859-2.3789a2.0027,2.0027,0,0,0,.2769-1.5957L24,15.877V14h3.8193A11.8409,11.8409,0,0,1,23,25.7266Z"></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;
EarthEuropeAfricaDirective_1.titleIdCounter++;
title.setAttribute("id", `earth-europe-africa-${EarthEuropeAfricaDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `earth-europe-africa-${EarthEuropeAfricaDirective_1.titleIdCounter}`);
}
}
};
EarthEuropeAfricaDirective.titleIdCounter = 0;
EarthEuropeAfricaDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], EarthEuropeAfricaDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], EarthEuropeAfricaDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], EarthEuropeAfricaDirective.prototype, "size", void 0);
EarthEuropeAfricaDirective = EarthEuropeAfricaDirective_1 = __decorate([
Directive({
selector: "[ibmIconEarthEuropeAfrica]"
}),
__metadata("design:paramtypes", [ElementRef])
], EarthEuropeAfricaDirective);
let EarthEuropeAfricaModule = class EarthEuropeAfricaModule {
};
EarthEuropeAfricaModule = __decorate([
NgModule({
declarations: [
EarthEuropeAfricaComponent,
EarthEuropeAfricaDirective,
],
exports: [
EarthEuropeAfricaComponent,
EarthEuropeAfricaDirective,
]
})
], EarthEuropeAfricaModule);
export { EarthEuropeAfricaComponent, EarthEuropeAfricaDirective, EarthEuropeAfricaModule };