@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
169 lines (166 loc) • 10.6 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var CheckmarkFilledComponent = /** @class */ (function () {
function CheckmarkFilledComponent() {
this.focusable = false;
}
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CheckmarkFilledComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CheckmarkFilledComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledComponent.prototype, "size", void 0);
CheckmarkFilledComponent = __decorate([
Component({
selector: "ibm-icon-checkmark-filled",
template: "\n <svg\n ibmIconCheckmarkFilled\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 "
})
], CheckmarkFilledComponent);
return CheckmarkFilledComponent;
}());
var CheckmarkFilledDirective = /** @class */ (function () {
function CheckmarkFilledDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "CheckmarkFilled32", "filepath": "checkmark--filled/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,14,0,0,0,16,2ZM14,21.5908l-5-5L10.5906,15,14,18.4092,21.41,11l1.5957,1.5859Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M14 21.591L9 16.591 10.591 15 14 18.409 21.41 11 23.005 12.585 14 21.591z", "data-icon-path": "inner-path" } }], "name": "checkmark--filled", "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,14,0,0,0,16,2ZM14,21.5908l-5-5L10.5906,15,14,18.4092,21.41,11l1.5957,1.5859Z\"></path><path fill=\"none\" d=\"M14 21.591L9 16.591 10.591 15 14 18.409 21.41 11 23.005 12.585 14 21.591z\" data-icon-path=\"inner-path\"></path></svg>"
},
"24": {
metadata: { "moduleName": "CheckmarkFilled24", "filepath": "checkmark--filled/24.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 24 24", "fill": "currentColor", "width": 24, "height": 24 }, "content": [{ "elem": "path", "attrs": { "d": "M12,1C6,1,1,6,1,12s5,11,11,11s11-4.9,11-11S18.1,1,12,1z M10.4,16.3l-3.9-3.9l1.3-1.2l2.7,2.7l5.8-5.8l1.3,1.3L10.4,16.3z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M10.4,16.3l-3.9-3.9l1.3-1.2l2.7,2.7l5.8-5.8l1.3,1.3L10.4,16.3z", "data-icon-path": "inner-path", "opacity": "0" } }], "name": "checkmark--filled", "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 24 24\" aria-hidden=\"true\"><path d=\"M12,1C6,1,1,6,1,12s5,11,11,11s11-4.9,11-11S18.1,1,12,1z M10.4,16.3l-3.9-3.9l1.3-1.2l2.7,2.7l5.8-5.8l1.3,1.3L10.4,16.3z\"></path><path fill=\"none\" d=\"M10.4,16.3l-3.9-3.9l1.3-1.2l2.7,2.7l5.8-5.8l1.3,1.3L10.4,16.3z\" data-icon-path=\"inner-path\" opacity=\"0\"></path></svg>"
},
"20": {
metadata: { "moduleName": "CheckmarkFilled20", "filepath": "checkmark--filled/20.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 20 20", "fill": "currentColor", "width": 20, "height": 20 }, "content": [{ "elem": "path", "attrs": { "d": "M10,1c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4,9-9S15,1,10,1z M8.7,13.5l-3.2-3.2l1-1l2.2,2.2l4.8-4.8l1,1L8.7,13.5z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M8.7,13.5l-3.2-3.2l1-1l2.2,2.2l4.8-4.8l1,1L8.7,13.5z", "data-icon-path": "inner-path", "opacity": "0" } }], "name": "checkmark--filled", "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 20 20\" aria-hidden=\"true\"><path d=\"M10,1c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4,9-9S15,1,10,1z M8.7,13.5l-3.2-3.2l1-1l2.2,2.2l4.8-4.8l1,1L8.7,13.5z\"></path><path fill=\"none\" d=\"M8.7,13.5l-3.2-3.2l1-1l2.2,2.2l4.8-4.8l1,1L8.7,13.5z\" data-icon-path=\"inner-path\" opacity=\"0\"></path></svg>"
},
"16": {
metadata: { "moduleName": "CheckmarkFilled16", "filepath": "checkmark--filled/16.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 16 16", "fill": "currentColor", "width": 16, "height": 16 }, "content": [{ "elem": "path", "attrs": { "d": "M8,1C4.1,1,1,4.1,1,8c0,3.9,3.1,7,7,7s7-3.1,7-7C15,4.1,11.9,1,8,1z M7,11L4.3,8.3l0.9-0.8L7,9.3l4-3.9l0.9,0.8L7,11z" } }, { "elem": "path", "attrs": { "d": "M7,11L4.3,8.3l0.9-0.8L7,9.3l4-3.9l0.9,0.8L7,11z", "data-icon-path": "inner-path", "opacity": "0" } }], "name": "checkmark--filled", "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 16 16\" aria-hidden=\"true\"><path d=\"M8,1C4.1,1,1,4.1,1,8c0,3.9,3.1,7,7,7s7-3.1,7-7C15,4.1,11.9,1,8,1z M7,11L4.3,8.3l0.9-0.8L7,9.3l4-3.9l0.9,0.8L7,11z\"></path><path d=\"M7,11L4.3,8.3l0.9-0.8L7,9.3l4-3.9l0.9,0.8L7,11z\" data-icon-path=\"inner-path\" opacity=\"0\"></path></svg>"
},
};
}
CheckmarkFilledDirective_1 = CheckmarkFilledDirective;
CheckmarkFilledDirective.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;
CheckmarkFilledDirective_1.titleIdCounter++;
title.setAttribute("id", "checkmark-filled-" + CheckmarkFilledDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "checkmark-filled-" + CheckmarkFilledDirective_1.titleIdCounter);
}
};
var CheckmarkFilledDirective_1;
CheckmarkFilledDirective.titleIdCounter = 0;
CheckmarkFilledDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CheckmarkFilledDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CheckmarkFilledDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CheckmarkFilledDirective.prototype, "size", void 0);
CheckmarkFilledDirective = CheckmarkFilledDirective_1 = __decorate([
Directive({
selector: "[ibmIconCheckmarkFilled]"
}),
__metadata("design:paramtypes", [ElementRef])
], CheckmarkFilledDirective);
return CheckmarkFilledDirective;
}());
var CheckmarkFilledModule = /** @class */ (function () {
function CheckmarkFilledModule() {
}
CheckmarkFilledModule = __decorate([
NgModule({
declarations: [
CheckmarkFilledComponent,
CheckmarkFilledDirective,
],
exports: [
CheckmarkFilledComponent,
CheckmarkFilledDirective,
]
})
], CheckmarkFilledModule);
return CheckmarkFilledModule;
}());
export { CheckmarkFilledComponent, CheckmarkFilledDirective, CheckmarkFilledModule };