@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
169 lines (166 loc) • 13.8 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var QueuedComponent = /** @class */ (function () {
function QueuedComponent() {
this.focusable = false;
}
__decorate([
Input(),
__metadata("design:type", String)
], QueuedComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QueuedComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], QueuedComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QueuedComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], QueuedComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QueuedComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QueuedComponent.prototype, "size", void 0);
QueuedComponent = __decorate([
Component({
selector: "ibm-icon-queued",
template: "\n <svg\n ibmIconQueued\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 "
})
], QueuedComponent);
return QueuedComponent;
}());
var QueuedDirective = /** @class */ (function () {
function QueuedDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "Queued32", "filepath": "queued/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": "M22 20H30V22H22zM22 24H30V26H22zM22 28H30V30H22zM18 24H20V26H18zM18 20H20V22H18zM18 28H20V30H18zM6.8149 8.293A12.0777 12.0777 0 0110.0068 5.62L9.0079 3.89A14.0845 14.0845 0 005.2841 7.0083zM25.1851 8.293l1.5308-1.2847A14.0845 14.0845 0 0022.9921 3.89l-.9989 1.73A12.0777 12.0777 0 0125.1851 8.293zM4.7366 11.9l-1.8772-.6831A13.9019 13.9019 0 002 16H4A11.917 11.917 0 014.7366 11.9zM6.8149 23.707A11.9975 11.9975 0 014.7366 20.1l-1.8772.6831a13.99 13.99 0 002.4247 4.209zM27.2634 11.9A11.917 11.917 0 0128 16h2a13.8971 13.8971 0 00-.8594-4.7827zM13.9182 27.8066A11.8894 11.8894 0 0110.0068 26.38l-.9989 1.73a13.8673 13.8673 0 004.5633 1.664zM13.9182 4.1934a11.3012 11.3012 0 014.1636 0l.347-1.9678a13.187 13.187 0 00-4.8576 0z" } }], "name": "queued", "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=\"M22 20H30V22H22zM22 24H30V26H22zM22 28H30V30H22zM18 24H20V26H18zM18 20H20V22H18zM18 28H20V30H18zM6.8149 8.293A12.0777 12.0777 0 0110.0068 5.62L9.0079 3.89A14.0845 14.0845 0 005.2841 7.0083zM25.1851 8.293l1.5308-1.2847A14.0845 14.0845 0 0022.9921 3.89l-.9989 1.73A12.0777 12.0777 0 0125.1851 8.293zM4.7366 11.9l-1.8772-.6831A13.9019 13.9019 0 002 16H4A11.917 11.917 0 014.7366 11.9zM6.8149 23.707A11.9975 11.9975 0 014.7366 20.1l-1.8772.6831a13.99 13.99 0 002.4247 4.209zM27.2634 11.9A11.917 11.917 0 0128 16h2a13.8971 13.8971 0 00-.8594-4.7827zM13.9182 27.8066A11.8894 11.8894 0 0110.0068 26.38l-.9989 1.73a13.8673 13.8673 0 004.5633 1.664zM13.9182 4.1934a11.3012 11.3012 0 014.1636 0l.347-1.9678a13.187 13.187 0 00-4.8576 0z\"></path></svg>"
},
"24": {
metadata: { "moduleName": "Queued24", "filepath": "queued/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": "M22 20H30V22H22zM22 24H30V26H22zM22 28H30V30H22zM18 24H20V26H18zM18 20H20V22H18zM18 28H20V30H18zM6.8149 8.293A12.0777 12.0777 0 0110.0068 5.62L9.0079 3.89A14.0845 14.0845 0 005.2841 7.0083zM25.1851 8.293l1.5308-1.2847A14.0845 14.0845 0 0022.9921 3.89l-.9989 1.73A12.0777 12.0777 0 0125.1851 8.293zM4.7366 11.9l-1.8772-.6831A13.9019 13.9019 0 002 16H4A11.917 11.917 0 014.7366 11.9zM6.8149 23.707A11.9975 11.9975 0 014.7366 20.1l-1.8772.6831a13.99 13.99 0 002.4247 4.209zM27.2634 11.9A11.917 11.917 0 0128 16h2a13.8971 13.8971 0 00-.8594-4.7827zM13.9182 27.8066A11.8894 11.8894 0 0110.0068 26.38l-.9989 1.73a13.8673 13.8673 0 004.5633 1.664zM13.9182 4.1934a11.3012 11.3012 0 014.1636 0l.347-1.9678a13.187 13.187 0 00-4.8576 0z" } }], "name": "queued", "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=\"M22 20H30V22H22zM22 24H30V26H22zM22 28H30V30H22zM18 24H20V26H18zM18 20H20V22H18zM18 28H20V30H18zM6.8149 8.293A12.0777 12.0777 0 0110.0068 5.62L9.0079 3.89A14.0845 14.0845 0 005.2841 7.0083zM25.1851 8.293l1.5308-1.2847A14.0845 14.0845 0 0022.9921 3.89l-.9989 1.73A12.0777 12.0777 0 0125.1851 8.293zM4.7366 11.9l-1.8772-.6831A13.9019 13.9019 0 002 16H4A11.917 11.917 0 014.7366 11.9zM6.8149 23.707A11.9975 11.9975 0 014.7366 20.1l-1.8772.6831a13.99 13.99 0 002.4247 4.209zM27.2634 11.9A11.917 11.917 0 0128 16h2a13.8971 13.8971 0 00-.8594-4.7827zM13.9182 27.8066A11.8894 11.8894 0 0110.0068 26.38l-.9989 1.73a13.8673 13.8673 0 004.5633 1.664zM13.9182 4.1934a11.3012 11.3012 0 014.1636 0l.347-1.9678a13.187 13.187 0 00-4.8576 0z\"></path></svg>"
},
"20": {
metadata: { "moduleName": "Queued20", "filepath": "queued/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": "M22 20H30V22H22zM22 24H30V26H22zM22 28H30V30H22zM18 24H20V26H18zM18 20H20V22H18zM18 28H20V30H18zM6.8149 8.293A12.0777 12.0777 0 0110.0068 5.62L9.0079 3.89A14.0845 14.0845 0 005.2841 7.0083zM25.1851 8.293l1.5308-1.2847A14.0845 14.0845 0 0022.9921 3.89l-.9989 1.73A12.0777 12.0777 0 0125.1851 8.293zM4.7366 11.9l-1.8772-.6831A13.9019 13.9019 0 002 16H4A11.917 11.917 0 014.7366 11.9zM6.8149 23.707A11.9975 11.9975 0 014.7366 20.1l-1.8772.6831a13.99 13.99 0 002.4247 4.209zM27.2634 11.9A11.917 11.917 0 0128 16h2a13.8971 13.8971 0 00-.8594-4.7827zM13.9182 27.8066A11.8894 11.8894 0 0110.0068 26.38l-.9989 1.73a13.8673 13.8673 0 004.5633 1.664zM13.9182 4.1934a11.3012 11.3012 0 014.1636 0l.347-1.9678a13.187 13.187 0 00-4.8576 0z" } }], "name": "queued", "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=\"M22 20H30V22H22zM22 24H30V26H22zM22 28H30V30H22zM18 24H20V26H18zM18 20H20V22H18zM18 28H20V30H18zM6.8149 8.293A12.0777 12.0777 0 0110.0068 5.62L9.0079 3.89A14.0845 14.0845 0 005.2841 7.0083zM25.1851 8.293l1.5308-1.2847A14.0845 14.0845 0 0022.9921 3.89l-.9989 1.73A12.0777 12.0777 0 0125.1851 8.293zM4.7366 11.9l-1.8772-.6831A13.9019 13.9019 0 002 16H4A11.917 11.917 0 014.7366 11.9zM6.8149 23.707A11.9975 11.9975 0 014.7366 20.1l-1.8772.6831a13.99 13.99 0 002.4247 4.209zM27.2634 11.9A11.917 11.917 0 0128 16h2a13.8971 13.8971 0 00-.8594-4.7827zM13.9182 27.8066A11.8894 11.8894 0 0110.0068 26.38l-.9989 1.73a13.8673 13.8673 0 004.5633 1.664zM13.9182 4.1934a11.3012 11.3012 0 014.1636 0l.347-1.9678a13.187 13.187 0 00-4.8576 0z\"></path></svg>"
},
"16": {
metadata: { "moduleName": "Queued16", "filepath": "queued/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": "M22 20H30V22H22zM22 24H30V26H22zM22 28H30V30H22zM18 24H20V26H18zM18 20H20V22H18zM18 28H20V30H18zM6.8149 8.293A12.0777 12.0777 0 0110.0068 5.62L9.0079 3.89A14.0845 14.0845 0 005.2841 7.0083zM25.1851 8.293l1.5308-1.2847A14.0845 14.0845 0 0022.9921 3.89l-.9989 1.73A12.0777 12.0777 0 0125.1851 8.293zM4.7366 11.9l-1.8772-.6831A13.9019 13.9019 0 002 16H4A11.917 11.917 0 014.7366 11.9zM6.8149 23.707A11.9975 11.9975 0 014.7366 20.1l-1.8772.6831a13.99 13.99 0 002.4247 4.209zM27.2634 11.9A11.917 11.917 0 0128 16h2a13.8971 13.8971 0 00-.8594-4.7827zM13.9182 27.8066A11.8894 11.8894 0 0110.0068 26.38l-.9989 1.73a13.8673 13.8673 0 004.5633 1.664zM13.9182 4.1934a11.3012 11.3012 0 014.1636 0l.347-1.9678a13.187 13.187 0 00-4.8576 0z" } }], "name": "queued", "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=\"M22 20H30V22H22zM22 24H30V26H22zM22 28H30V30H22zM18 24H20V26H18zM18 20H20V22H18zM18 28H20V30H18zM6.8149 8.293A12.0777 12.0777 0 0110.0068 5.62L9.0079 3.89A14.0845 14.0845 0 005.2841 7.0083zM25.1851 8.293l1.5308-1.2847A14.0845 14.0845 0 0022.9921 3.89l-.9989 1.73A12.0777 12.0777 0 0125.1851 8.293zM4.7366 11.9l-1.8772-.6831A13.9019 13.9019 0 002 16H4A11.917 11.917 0 014.7366 11.9zM6.8149 23.707A11.9975 11.9975 0 014.7366 20.1l-1.8772.6831a13.99 13.99 0 002.4247 4.209zM27.2634 11.9A11.917 11.917 0 0128 16h2a13.8971 13.8971 0 00-.8594-4.7827zM13.9182 27.8066A11.8894 11.8894 0 0110.0068 26.38l-.9989 1.73a13.8673 13.8673 0 004.5633 1.664zM13.9182 4.1934a11.3012 11.3012 0 014.1636 0l.347-1.9678a13.187 13.187 0 00-4.8576 0z\"></path></svg>"
},
};
}
QueuedDirective_1 = QueuedDirective;
QueuedDirective.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;
QueuedDirective_1.titleIdCounter++;
title.setAttribute("id", "queued-" + QueuedDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "queued-" + QueuedDirective_1.titleIdCounter);
}
};
var QueuedDirective_1;
QueuedDirective.titleIdCounter = 0;
QueuedDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], QueuedDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QueuedDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], QueuedDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QueuedDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], QueuedDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], QueuedDirective.prototype, "size", void 0);
QueuedDirective = QueuedDirective_1 = __decorate([
Directive({
selector: "[ibmIconQueued]"
}),
__metadata("design:paramtypes", [ElementRef])
], QueuedDirective);
return QueuedDirective;
}());
var QueuedModule = /** @class */ (function () {
function QueuedModule() {
}
QueuedModule = __decorate([
NgModule({
declarations: [
QueuedComponent,
QueuedDirective,
],
exports: [
QueuedComponent,
QueuedDirective,
]
})
], QueuedModule);
return QueuedModule;
}());
export { QueuedComponent, QueuedDirective, QueuedModule };