@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
169 lines (166 loc) • 14.6 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var LogoOpenshiftComponent = /** @class */ (function () {
function LogoOpenshiftComponent() {
this.focusable = false;
}
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], LogoOpenshiftComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], LogoOpenshiftComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftComponent.prototype, "size", void 0);
LogoOpenshiftComponent = __decorate([
Component({
selector: "ibm-icon-logo-openshift",
template: "\n <svg\n ibmIconLogoOpenshift\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 "
})
], LogoOpenshiftComponent);
return LogoOpenshiftComponent;
}());
var LogoOpenshiftDirective = /** @class */ (function () {
function LogoOpenshiftDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "LogoOpenshift32", "filepath": "logo--openshift/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.4612,15.7968A12.1352,12.1352,0,0,0,25.2821,11.48L29,10.13a11.9879,11.9879,0,0,0-1.0281-1.7382l-1.7431.635a11.9884,11.9884,0,0,0-21.71,7.9129l1.7477-.6412a12.19,12.19,0,0,0,.3309,1.9846L2.8838,19.6384A12.1451,12.1451,0,0,0,4.7565,23.7l1.9663-.7163.0026.0039a11.8856,11.8856,0,0,0,4.67,3.8909A12.013,12.013,0,0,0,27.34,21.0743a11.8725,11.8725,0,0,0,1.08-5.992Zm-2.92,3.4967a7.8,7.8,0,0,1-10.3533,3.7744,7.7207,7.7207,0,0,1-2.2714-1.6128l-1.9846.7235a7.84,7.84,0,0,1-2.0742-3.9895l.0009-.0008,3.7242-1.3566a7.8175,7.8175,0,0,1-.1232-2.0653l-1.7517.6362A7.7729,7.7729,0,0,1,19.7645,8.94h.0067a7.7442,7.7442,0,0,1,2.2646,1.615L23.78,9.921a7.8014,7.8014,0,0,1,1.229,1.6558l-3.71,1.3595a7.8245,7.8245,0,0,1,.9766,4.3882l1.9685-.7151A7.6714,7.6714,0,0,1,23.5411,19.2935Z" } }], "name": "logo--openshift", "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.4612,15.7968A12.1352,12.1352,0,0,0,25.2821,11.48L29,10.13a11.9879,11.9879,0,0,0-1.0281-1.7382l-1.7431.635a11.9884,11.9884,0,0,0-21.71,7.9129l1.7477-.6412a12.19,12.19,0,0,0,.3309,1.9846L2.8838,19.6384A12.1451,12.1451,0,0,0,4.7565,23.7l1.9663-.7163.0026.0039a11.8856,11.8856,0,0,0,4.67,3.8909A12.013,12.013,0,0,0,27.34,21.0743a11.8725,11.8725,0,0,0,1.08-5.992Zm-2.92,3.4967a7.8,7.8,0,0,1-10.3533,3.7744,7.7207,7.7207,0,0,1-2.2714-1.6128l-1.9846.7235a7.84,7.84,0,0,1-2.0742-3.9895l.0009-.0008,3.7242-1.3566a7.8175,7.8175,0,0,1-.1232-2.0653l-1.7517.6362A7.7729,7.7729,0,0,1,19.7645,8.94h.0067a7.7442,7.7442,0,0,1,2.2646,1.615L23.78,9.921a7.8014,7.8014,0,0,1,1.229,1.6558l-3.71,1.3595a7.8245,7.8245,0,0,1,.9766,4.3882l1.9685-.7151A7.6714,7.6714,0,0,1,23.5411,19.2935Z\"></path></svg>"
},
"24": {
metadata: { "moduleName": "LogoOpenshift24", "filepath": "logo--openshift/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.4612,15.7968A12.1352,12.1352,0,0,0,25.2821,11.48L29,10.13a11.9879,11.9879,0,0,0-1.0281-1.7382l-1.7431.635a11.9884,11.9884,0,0,0-21.71,7.9129l1.7477-.6412a12.19,12.19,0,0,0,.3309,1.9846L2.8838,19.6384A12.1451,12.1451,0,0,0,4.7565,23.7l1.9663-.7163.0026.0039a11.8856,11.8856,0,0,0,4.67,3.8909A12.013,12.013,0,0,0,27.34,21.0743a11.8725,11.8725,0,0,0,1.08-5.992Zm-2.92,3.4967a7.8,7.8,0,0,1-10.3533,3.7744,7.7207,7.7207,0,0,1-2.2714-1.6128l-1.9846.7235a7.84,7.84,0,0,1-2.0742-3.9895l.0009-.0008,3.7242-1.3566a7.8175,7.8175,0,0,1-.1232-2.0653l-1.7517.6362A7.7729,7.7729,0,0,1,19.7645,8.94h.0067a7.7442,7.7442,0,0,1,2.2646,1.615L23.78,9.921a7.8014,7.8014,0,0,1,1.229,1.6558l-3.71,1.3595a7.8245,7.8245,0,0,1,.9766,4.3882l1.9685-.7151A7.6714,7.6714,0,0,1,23.5411,19.2935Z" } }], "name": "logo--openshift", "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.4612,15.7968A12.1352,12.1352,0,0,0,25.2821,11.48L29,10.13a11.9879,11.9879,0,0,0-1.0281-1.7382l-1.7431.635a11.9884,11.9884,0,0,0-21.71,7.9129l1.7477-.6412a12.19,12.19,0,0,0,.3309,1.9846L2.8838,19.6384A12.1451,12.1451,0,0,0,4.7565,23.7l1.9663-.7163.0026.0039a11.8856,11.8856,0,0,0,4.67,3.8909A12.013,12.013,0,0,0,27.34,21.0743a11.8725,11.8725,0,0,0,1.08-5.992Zm-2.92,3.4967a7.8,7.8,0,0,1-10.3533,3.7744,7.7207,7.7207,0,0,1-2.2714-1.6128l-1.9846.7235a7.84,7.84,0,0,1-2.0742-3.9895l.0009-.0008,3.7242-1.3566a7.8175,7.8175,0,0,1-.1232-2.0653l-1.7517.6362A7.7729,7.7729,0,0,1,19.7645,8.94h.0067a7.7442,7.7442,0,0,1,2.2646,1.615L23.78,9.921a7.8014,7.8014,0,0,1,1.229,1.6558l-3.71,1.3595a7.8245,7.8245,0,0,1,.9766,4.3882l1.9685-.7151A7.6714,7.6714,0,0,1,23.5411,19.2935Z\"></path></svg>"
},
"20": {
metadata: { "moduleName": "LogoOpenshift20", "filepath": "logo--openshift/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.4612,15.7968A12.1352,12.1352,0,0,0,25.2821,11.48L29,10.13a11.9879,11.9879,0,0,0-1.0281-1.7382l-1.7431.635a11.9884,11.9884,0,0,0-21.71,7.9129l1.7477-.6412a12.19,12.19,0,0,0,.3309,1.9846L2.8838,19.6384A12.1451,12.1451,0,0,0,4.7565,23.7l1.9663-.7163.0026.0039a11.8856,11.8856,0,0,0,4.67,3.8909A12.013,12.013,0,0,0,27.34,21.0743a11.8725,11.8725,0,0,0,1.08-5.992Zm-2.92,3.4967a7.8,7.8,0,0,1-10.3533,3.7744,7.7207,7.7207,0,0,1-2.2714-1.6128l-1.9846.7235a7.84,7.84,0,0,1-2.0742-3.9895l.0009-.0008,3.7242-1.3566a7.8175,7.8175,0,0,1-.1232-2.0653l-1.7517.6362A7.7729,7.7729,0,0,1,19.7645,8.94h.0067a7.7442,7.7442,0,0,1,2.2646,1.615L23.78,9.921a7.8014,7.8014,0,0,1,1.229,1.6558l-3.71,1.3595a7.8245,7.8245,0,0,1,.9766,4.3882l1.9685-.7151A7.6714,7.6714,0,0,1,23.5411,19.2935Z" } }], "name": "logo--openshift", "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.4612,15.7968A12.1352,12.1352,0,0,0,25.2821,11.48L29,10.13a11.9879,11.9879,0,0,0-1.0281-1.7382l-1.7431.635a11.9884,11.9884,0,0,0-21.71,7.9129l1.7477-.6412a12.19,12.19,0,0,0,.3309,1.9846L2.8838,19.6384A12.1451,12.1451,0,0,0,4.7565,23.7l1.9663-.7163.0026.0039a11.8856,11.8856,0,0,0,4.67,3.8909A12.013,12.013,0,0,0,27.34,21.0743a11.8725,11.8725,0,0,0,1.08-5.992Zm-2.92,3.4967a7.8,7.8,0,0,1-10.3533,3.7744,7.7207,7.7207,0,0,1-2.2714-1.6128l-1.9846.7235a7.84,7.84,0,0,1-2.0742-3.9895l.0009-.0008,3.7242-1.3566a7.8175,7.8175,0,0,1-.1232-2.0653l-1.7517.6362A7.7729,7.7729,0,0,1,19.7645,8.94h.0067a7.7442,7.7442,0,0,1,2.2646,1.615L23.78,9.921a7.8014,7.8014,0,0,1,1.229,1.6558l-3.71,1.3595a7.8245,7.8245,0,0,1,.9766,4.3882l1.9685-.7151A7.6714,7.6714,0,0,1,23.5411,19.2935Z\"></path></svg>"
},
"16": {
metadata: { "moduleName": "LogoOpenshift16", "filepath": "logo--openshift/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.4612,15.7968A12.1352,12.1352,0,0,0,25.2821,11.48L29,10.13a11.9879,11.9879,0,0,0-1.0281-1.7382l-1.7431.635a11.9884,11.9884,0,0,0-21.71,7.9129l1.7477-.6412a12.19,12.19,0,0,0,.3309,1.9846L2.8838,19.6384A12.1451,12.1451,0,0,0,4.7565,23.7l1.9663-.7163.0026.0039a11.8856,11.8856,0,0,0,4.67,3.8909A12.013,12.013,0,0,0,27.34,21.0743a11.8725,11.8725,0,0,0,1.08-5.992Zm-2.92,3.4967a7.8,7.8,0,0,1-10.3533,3.7744,7.7207,7.7207,0,0,1-2.2714-1.6128l-1.9846.7235a7.84,7.84,0,0,1-2.0742-3.9895l.0009-.0008,3.7242-1.3566a7.8175,7.8175,0,0,1-.1232-2.0653l-1.7517.6362A7.7729,7.7729,0,0,1,19.7645,8.94h.0067a7.7442,7.7442,0,0,1,2.2646,1.615L23.78,9.921a7.8014,7.8014,0,0,1,1.229,1.6558l-3.71,1.3595a7.8245,7.8245,0,0,1,.9766,4.3882l1.9685-.7151A7.6714,7.6714,0,0,1,23.5411,19.2935Z" } }], "name": "logo--openshift", "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.4612,15.7968A12.1352,12.1352,0,0,0,25.2821,11.48L29,10.13a11.9879,11.9879,0,0,0-1.0281-1.7382l-1.7431.635a11.9884,11.9884,0,0,0-21.71,7.9129l1.7477-.6412a12.19,12.19,0,0,0,.3309,1.9846L2.8838,19.6384A12.1451,12.1451,0,0,0,4.7565,23.7l1.9663-.7163.0026.0039a11.8856,11.8856,0,0,0,4.67,3.8909A12.013,12.013,0,0,0,27.34,21.0743a11.8725,11.8725,0,0,0,1.08-5.992Zm-2.92,3.4967a7.8,7.8,0,0,1-10.3533,3.7744,7.7207,7.7207,0,0,1-2.2714-1.6128l-1.9846.7235a7.84,7.84,0,0,1-2.0742-3.9895l.0009-.0008,3.7242-1.3566a7.8175,7.8175,0,0,1-.1232-2.0653l-1.7517.6362A7.7729,7.7729,0,0,1,19.7645,8.94h.0067a7.7442,7.7442,0,0,1,2.2646,1.615L23.78,9.921a7.8014,7.8014,0,0,1,1.229,1.6558l-3.71,1.3595a7.8245,7.8245,0,0,1,.9766,4.3882l1.9685-.7151A7.6714,7.6714,0,0,1,23.5411,19.2935Z\"></path></svg>"
},
};
}
LogoOpenshiftDirective_1 = LogoOpenshiftDirective;
LogoOpenshiftDirective.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;
LogoOpenshiftDirective_1.titleIdCounter++;
title.setAttribute("id", "logo-openshift-" + LogoOpenshiftDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "logo-openshift-" + LogoOpenshiftDirective_1.titleIdCounter);
}
};
var LogoOpenshiftDirective_1;
LogoOpenshiftDirective.titleIdCounter = 0;
LogoOpenshiftDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], LogoOpenshiftDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], LogoOpenshiftDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoOpenshiftDirective.prototype, "size", void 0);
LogoOpenshiftDirective = LogoOpenshiftDirective_1 = __decorate([
Directive({
selector: "[ibmIconLogoOpenshift]"
}),
__metadata("design:paramtypes", [ElementRef])
], LogoOpenshiftDirective);
return LogoOpenshiftDirective;
}());
var LogoOpenshiftModule = /** @class */ (function () {
function LogoOpenshiftModule() {
}
LogoOpenshiftModule = __decorate([
NgModule({
declarations: [
LogoOpenshiftComponent,
LogoOpenshiftDirective,
],
exports: [
LogoOpenshiftComponent,
LogoOpenshiftDirective,
]
})
], LogoOpenshiftModule);
return LogoOpenshiftModule;
}());
export { LogoOpenshiftComponent, LogoOpenshiftDirective, LogoOpenshiftModule };