@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
169 lines (166 loc) • 13.2 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var CheckmarkFilledErrorComponent = /** @class */ (function () {
function CheckmarkFilledErrorComponent() {
this.focusable = false;
}
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CheckmarkFilledErrorComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CheckmarkFilledErrorComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorComponent.prototype, "size", void 0);
CheckmarkFilledErrorComponent = __decorate([
Component({
selector: "ibm-icon-checkmark-filled-error",
template: "\n <svg\n ibmIconCheckmarkFilledError\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 "
})
], CheckmarkFilledErrorComponent);
return CheckmarkFilledErrorComponent;
}());
var CheckmarkFilledErrorDirective = /** @class */ (function () {
function CheckmarkFilledErrorDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "CheckmarkFilledError32", "filepath": "checkmark--filled--error/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": "M30,24a6,6,0,1,0-6,6A6.0066,6.0066,0,0,0,30,24Zm-2,0a3.9521,3.9521,0,0,1-.5669,2.019L21.981,20.5669A3.9529,3.9529,0,0,1,24,20,4.0045,4.0045,0,0,1,28,24Zm-8,0a3.9521,3.9521,0,0,1,.5669-2.019l5.4521,5.4521A3.9529,3.9529,0,0,1,24,28,4.0045,4.0045,0,0,1,20,24Z" } }, { "elem": "path", "attrs": { "d": "M14,2a12,12,0,1,0,2,23.82V24a8,8,0,0,1,8-8h1.82A11.9348,11.9348,0,0,0,14,2ZM12,18.5908l-4-4L9.5908,13,12,15.4092,17.4092,10,19,11.5908Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M12 18.591L8 14.591 9.591 13 12 15.409 17.409 10 19 11.591 12 18.591z" } }], "name": "checkmark--filled--error", "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=\"M30,24a6,6,0,1,0-6,6A6.0066,6.0066,0,0,0,30,24Zm-2,0a3.9521,3.9521,0,0,1-.5669,2.019L21.981,20.5669A3.9529,3.9529,0,0,1,24,20,4.0045,4.0045,0,0,1,28,24Zm-8,0a3.9521,3.9521,0,0,1,.5669-2.019l5.4521,5.4521A3.9529,3.9529,0,0,1,24,28,4.0045,4.0045,0,0,1,20,24Z\"></path><path d=\"M14,2a12,12,0,1,0,2,23.82V24a8,8,0,0,1,8-8h1.82A11.9348,11.9348,0,0,0,14,2ZM12,18.5908l-4-4L9.5908,13,12,15.4092,17.4092,10,19,11.5908Z\"></path><path fill=\"none\" d=\"M12 18.591L8 14.591 9.591 13 12 15.409 17.409 10 19 11.591 12 18.591z\"></path></svg>"
},
"24": {
metadata: { "moduleName": "CheckmarkFilledError24", "filepath": "checkmark--filled--error/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": "M30,24a6,6,0,1,0-6,6A6.0066,6.0066,0,0,0,30,24Zm-2,0a3.9521,3.9521,0,0,1-.5669,2.019L21.981,20.5669A3.9529,3.9529,0,0,1,24,20,4.0045,4.0045,0,0,1,28,24Zm-8,0a3.9521,3.9521,0,0,1,.5669-2.019l5.4521,5.4521A3.9529,3.9529,0,0,1,24,28,4.0045,4.0045,0,0,1,20,24Z" } }, { "elem": "path", "attrs": { "d": "M14,2a12,12,0,1,0,2,23.82V24a8,8,0,0,1,8-8h1.82A11.9348,11.9348,0,0,0,14,2ZM12,18.5908l-4-4L9.5908,13,12,15.4092,17.4092,10,19,11.5908Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M12 18.591L8 14.591 9.591 13 12 15.409 17.409 10 19 11.591 12 18.591z" } }], "name": "checkmark--filled--error", "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=\"M30,24a6,6,0,1,0-6,6A6.0066,6.0066,0,0,0,30,24Zm-2,0a3.9521,3.9521,0,0,1-.5669,2.019L21.981,20.5669A3.9529,3.9529,0,0,1,24,20,4.0045,4.0045,0,0,1,28,24Zm-8,0a3.9521,3.9521,0,0,1,.5669-2.019l5.4521,5.4521A3.9529,3.9529,0,0,1,24,28,4.0045,4.0045,0,0,1,20,24Z\"></path><path d=\"M14,2a12,12,0,1,0,2,23.82V24a8,8,0,0,1,8-8h1.82A11.9348,11.9348,0,0,0,14,2ZM12,18.5908l-4-4L9.5908,13,12,15.4092,17.4092,10,19,11.5908Z\"></path><path fill=\"none\" d=\"M12 18.591L8 14.591 9.591 13 12 15.409 17.409 10 19 11.591 12 18.591z\"></path></svg>"
},
"20": {
metadata: { "moduleName": "CheckmarkFilledError20", "filepath": "checkmark--filled--error/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": "M30,24a6,6,0,1,0-6,6A6.0066,6.0066,0,0,0,30,24Zm-2,0a3.9521,3.9521,0,0,1-.5669,2.019L21.981,20.5669A3.9529,3.9529,0,0,1,24,20,4.0045,4.0045,0,0,1,28,24Zm-8,0a3.9521,3.9521,0,0,1,.5669-2.019l5.4521,5.4521A3.9529,3.9529,0,0,1,24,28,4.0045,4.0045,0,0,1,20,24Z" } }, { "elem": "path", "attrs": { "d": "M14,2a12,12,0,1,0,2,23.82V24a8,8,0,0,1,8-8h1.82A11.9348,11.9348,0,0,0,14,2ZM12,18.5908l-4-4L9.5908,13,12,15.4092,17.4092,10,19,11.5908Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M12 18.591L8 14.591 9.591 13 12 15.409 17.409 10 19 11.591 12 18.591z" } }], "name": "checkmark--filled--error", "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=\"M30,24a6,6,0,1,0-6,6A6.0066,6.0066,0,0,0,30,24Zm-2,0a3.9521,3.9521,0,0,1-.5669,2.019L21.981,20.5669A3.9529,3.9529,0,0,1,24,20,4.0045,4.0045,0,0,1,28,24Zm-8,0a3.9521,3.9521,0,0,1,.5669-2.019l5.4521,5.4521A3.9529,3.9529,0,0,1,24,28,4.0045,4.0045,0,0,1,20,24Z\"></path><path d=\"M14,2a12,12,0,1,0,2,23.82V24a8,8,0,0,1,8-8h1.82A11.9348,11.9348,0,0,0,14,2ZM12,18.5908l-4-4L9.5908,13,12,15.4092,17.4092,10,19,11.5908Z\"></path><path fill=\"none\" d=\"M12 18.591L8 14.591 9.591 13 12 15.409 17.409 10 19 11.591 12 18.591z\"></path></svg>"
},
"16": {
metadata: { "moduleName": "CheckmarkFilledError16", "filepath": "checkmark--filled--error/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": "M30,24a6,6,0,1,0-6,6A6.0066,6.0066,0,0,0,30,24Zm-2,0a3.9521,3.9521,0,0,1-.5669,2.019L21.981,20.5669A3.9529,3.9529,0,0,1,24,20,4.0045,4.0045,0,0,1,28,24Zm-8,0a3.9521,3.9521,0,0,1,.5669-2.019l5.4521,5.4521A3.9529,3.9529,0,0,1,24,28,4.0045,4.0045,0,0,1,20,24Z" } }, { "elem": "path", "attrs": { "d": "M14,2a12,12,0,1,0,2,23.82V24a8,8,0,0,1,8-8h1.82A11.9348,11.9348,0,0,0,14,2ZM12,18.5908l-4-4L9.5908,13,12,15.4092,17.4092,10,19,11.5908Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M12 18.591L8 14.591 9.591 13 12 15.409 17.409 10 19 11.591 12 18.591z" } }], "name": "checkmark--filled--error", "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=\"M30,24a6,6,0,1,0-6,6A6.0066,6.0066,0,0,0,30,24Zm-2,0a3.9521,3.9521,0,0,1-.5669,2.019L21.981,20.5669A3.9529,3.9529,0,0,1,24,20,4.0045,4.0045,0,0,1,28,24Zm-8,0a3.9521,3.9521,0,0,1,.5669-2.019l5.4521,5.4521A3.9529,3.9529,0,0,1,24,28,4.0045,4.0045,0,0,1,20,24Z\"></path><path d=\"M14,2a12,12,0,1,0,2,23.82V24a8,8,0,0,1,8-8h1.82A11.9348,11.9348,0,0,0,14,2ZM12,18.5908l-4-4L9.5908,13,12,15.4092,17.4092,10,19,11.5908Z\"></path><path fill=\"none\" d=\"M12 18.591L8 14.591 9.591 13 12 15.409 17.409 10 19 11.591 12 18.591z\"></path></svg>"
},
};
}
CheckmarkFilledErrorDirective_1 = CheckmarkFilledErrorDirective;
CheckmarkFilledErrorDirective.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;
CheckmarkFilledErrorDirective_1.titleIdCounter++;
title.setAttribute("id", "checkmark-filled-error-" + CheckmarkFilledErrorDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "checkmark-filled-error-" + CheckmarkFilledErrorDirective_1.titleIdCounter);
}
};
var CheckmarkFilledErrorDirective_1;
CheckmarkFilledErrorDirective.titleIdCounter = 0;
CheckmarkFilledErrorDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CheckmarkFilledErrorDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CheckmarkFilledErrorDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledErrorDirective.prototype, "size", void 0);
CheckmarkFilledErrorDirective = CheckmarkFilledErrorDirective_1 = __decorate([
Directive({
selector: "[ibmIconCheckmarkFilledError]"
}),
__metadata("design:paramtypes", [ElementRef])
], CheckmarkFilledErrorDirective);
return CheckmarkFilledErrorDirective;
}());
var CheckmarkFilledErrorModule = /** @class */ (function () {
function CheckmarkFilledErrorModule() {
}
CheckmarkFilledErrorModule = __decorate([
NgModule({
declarations: [
CheckmarkFilledErrorComponent,
CheckmarkFilledErrorDirective,
],
exports: [
CheckmarkFilledErrorComponent,
CheckmarkFilledErrorDirective,
]
})
], CheckmarkFilledErrorModule);
return CheckmarkFilledErrorModule;
}());
export { CheckmarkFilledErrorComponent, CheckmarkFilledErrorDirective, CheckmarkFilledErrorModule };