@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
169 lines (166 loc) • 11.1 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var PartnershipComponent = /** @class */ (function () {
function PartnershipComponent() {
this.focusable = false;
}
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PartnershipComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PartnershipComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipComponent.prototype, "size", void 0);
PartnershipComponent = __decorate([
Component({
selector: "ibm-icon-partnership",
template: "\n <svg\n ibmIconPartnership\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 "
})
], PartnershipComponent);
return PartnershipComponent;
}());
var PartnershipDirective = /** @class */ (function () {
function PartnershipDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "Partnership32", "filepath": "partnership/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": "M8 9a4 4 0 114-4A4 4 0 018 9zM8 3a2 2 0 102 2A2 2 0 008 3zM24 9a4 4 0 114-4A4 4 0 0124 9zm0-6a2 2 0 102 2A2 2 0 0024 3zM26 30H22a2 2 0 01-2-2V21h2v7h4V19h2V13a1 1 0 00-1-1H20.58L16 20l-4.58-8H5a1 1 0 00-1 1v6H6v9h4V21h2v7a2 2 0 01-2 2H6a2 2 0 01-2-2V21a2 2 0 01-2-2V13a3 3 0 013-3h7.58L16 16l3.42-6H27a3 3 0 013 3v6a2 2 0 01-2 2v7A2 2 0 0126 30z" } }], "name": "partnership", "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=\"M8 9a4 4 0 114-4A4 4 0 018 9zM8 3a2 2 0 102 2A2 2 0 008 3zM24 9a4 4 0 114-4A4 4 0 0124 9zm0-6a2 2 0 102 2A2 2 0 0024 3zM26 30H22a2 2 0 01-2-2V21h2v7h4V19h2V13a1 1 0 00-1-1H20.58L16 20l-4.58-8H5a1 1 0 00-1 1v6H6v9h4V21h2v7a2 2 0 01-2 2H6a2 2 0 01-2-2V21a2 2 0 01-2-2V13a3 3 0 013-3h7.58L16 16l3.42-6H27a3 3 0 013 3v6a2 2 0 01-2 2v7A2 2 0 0126 30z\"></path></svg>"
},
"24": {
metadata: { "moduleName": "Partnership24", "filepath": "partnership/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": "M8 9a4 4 0 114-4A4 4 0 018 9zM8 3a2 2 0 102 2A2 2 0 008 3zM24 9a4 4 0 114-4A4 4 0 0124 9zm0-6a2 2 0 102 2A2 2 0 0024 3zM26 30H22a2 2 0 01-2-2V21h2v7h4V19h2V13a1 1 0 00-1-1H20.58L16 20l-4.58-8H5a1 1 0 00-1 1v6H6v9h4V21h2v7a2 2 0 01-2 2H6a2 2 0 01-2-2V21a2 2 0 01-2-2V13a3 3 0 013-3h7.58L16 16l3.42-6H27a3 3 0 013 3v6a2 2 0 01-2 2v7A2 2 0 0126 30z" } }], "name": "partnership", "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=\"M8 9a4 4 0 114-4A4 4 0 018 9zM8 3a2 2 0 102 2A2 2 0 008 3zM24 9a4 4 0 114-4A4 4 0 0124 9zm0-6a2 2 0 102 2A2 2 0 0024 3zM26 30H22a2 2 0 01-2-2V21h2v7h4V19h2V13a1 1 0 00-1-1H20.58L16 20l-4.58-8H5a1 1 0 00-1 1v6H6v9h4V21h2v7a2 2 0 01-2 2H6a2 2 0 01-2-2V21a2 2 0 01-2-2V13a3 3 0 013-3h7.58L16 16l3.42-6H27a3 3 0 013 3v6a2 2 0 01-2 2v7A2 2 0 0126 30z\"></path></svg>"
},
"20": {
metadata: { "moduleName": "Partnership20", "filepath": "partnership/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": "M8 9a4 4 0 114-4A4 4 0 018 9zM8 3a2 2 0 102 2A2 2 0 008 3zM24 9a4 4 0 114-4A4 4 0 0124 9zm0-6a2 2 0 102 2A2 2 0 0024 3zM26 30H22a2 2 0 01-2-2V21h2v7h4V19h2V13a1 1 0 00-1-1H20.58L16 20l-4.58-8H5a1 1 0 00-1 1v6H6v9h4V21h2v7a2 2 0 01-2 2H6a2 2 0 01-2-2V21a2 2 0 01-2-2V13a3 3 0 013-3h7.58L16 16l3.42-6H27a3 3 0 013 3v6a2 2 0 01-2 2v7A2 2 0 0126 30z" } }], "name": "partnership", "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=\"M8 9a4 4 0 114-4A4 4 0 018 9zM8 3a2 2 0 102 2A2 2 0 008 3zM24 9a4 4 0 114-4A4 4 0 0124 9zm0-6a2 2 0 102 2A2 2 0 0024 3zM26 30H22a2 2 0 01-2-2V21h2v7h4V19h2V13a1 1 0 00-1-1H20.58L16 20l-4.58-8H5a1 1 0 00-1 1v6H6v9h4V21h2v7a2 2 0 01-2 2H6a2 2 0 01-2-2V21a2 2 0 01-2-2V13a3 3 0 013-3h7.58L16 16l3.42-6H27a3 3 0 013 3v6a2 2 0 01-2 2v7A2 2 0 0126 30z\"></path></svg>"
},
"16": {
metadata: { "moduleName": "Partnership16", "filepath": "partnership/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": "M8 9a4 4 0 114-4A4 4 0 018 9zM8 3a2 2 0 102 2A2 2 0 008 3zM24 9a4 4 0 114-4A4 4 0 0124 9zm0-6a2 2 0 102 2A2 2 0 0024 3zM26 30H22a2 2 0 01-2-2V21h2v7h4V19h2V13a1 1 0 00-1-1H20.58L16 20l-4.58-8H5a1 1 0 00-1 1v6H6v9h4V21h2v7a2 2 0 01-2 2H6a2 2 0 01-2-2V21a2 2 0 01-2-2V13a3 3 0 013-3h7.58L16 16l3.42-6H27a3 3 0 013 3v6a2 2 0 01-2 2v7A2 2 0 0126 30z" } }], "name": "partnership", "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=\"M8 9a4 4 0 114-4A4 4 0 018 9zM8 3a2 2 0 102 2A2 2 0 008 3zM24 9a4 4 0 114-4A4 4 0 0124 9zm0-6a2 2 0 102 2A2 2 0 0024 3zM26 30H22a2 2 0 01-2-2V21h2v7h4V19h2V13a1 1 0 00-1-1H20.58L16 20l-4.58-8H5a1 1 0 00-1 1v6H6v9h4V21h2v7a2 2 0 01-2 2H6a2 2 0 01-2-2V21a2 2 0 01-2-2V13a3 3 0 013-3h7.58L16 16l3.42-6H27a3 3 0 013 3v6a2 2 0 01-2 2v7A2 2 0 0126 30z\"></path></svg>"
},
};
}
PartnershipDirective_1 = PartnershipDirective;
PartnershipDirective.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;
PartnershipDirective_1.titleIdCounter++;
title.setAttribute("id", "partnership-" + PartnershipDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "partnership-" + PartnershipDirective_1.titleIdCounter);
}
};
var PartnershipDirective_1;
PartnershipDirective.titleIdCounter = 0;
PartnershipDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PartnershipDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PartnershipDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PartnershipDirective.prototype, "size", void 0);
PartnershipDirective = PartnershipDirective_1 = __decorate([
Directive({
selector: "[ibmIconPartnership]"
}),
__metadata("design:paramtypes", [ElementRef])
], PartnershipDirective);
return PartnershipDirective;
}());
var PartnershipModule = /** @class */ (function () {
function PartnershipModule() {
}
PartnershipModule = __decorate([
NgModule({
declarations: [
PartnershipComponent,
PartnershipDirective,
],
exports: [
PartnershipComponent,
PartnershipDirective,
]
})
], PartnershipModule);
return PartnershipModule;
}());
export { PartnershipComponent, PartnershipDirective, PartnershipModule };