UNPKG

@carbon/icons-angular

Version:

Angular components for icons in digital and software products using the Carbon Design System

169 lines (166 loc) 12.7 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var CheckmarkFilledWarningComponent = /** @class */ (function () { function CheckmarkFilledWarningComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CheckmarkFilledWarningComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CheckmarkFilledWarningComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningComponent.prototype, "size", void 0); CheckmarkFilledWarningComponent = __decorate([ Component({ selector: "ibm-icon-checkmark-filled-warning", template: "\n <svg\n ibmIconCheckmarkFilledWarning\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 " }) ], CheckmarkFilledWarningComponent); return CheckmarkFilledWarningComponent; }()); var CheckmarkFilledWarningDirective = /** @class */ (function () { function CheckmarkFilledWarningDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "CheckmarkFilledWarning32", "filepath": "checkmark--filled--warning/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": "M14,2a12,12,0,1,0,3.3928,23.5059l3.9246-7.8492A2.9846,2.9846,0,0,1,24,16h1.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": { "d": "M27.38,28H20.6178L24,21.2358ZM24,18a1,1,0,0,0-.8947.5527l-5,10A1.0005,1.0005,0,0,0,19,30H29a1,1,0,0,0,.9214-1.3892L24.8946,18.5527A1,1,0,0,0,24,18Z" } }, { "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--warning", "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=\"M14,2a12,12,0,1,0,3.3928,23.5059l3.9246-7.8492A2.9846,2.9846,0,0,1,24,16h1.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 d=\"M27.38,28H20.6178L24,21.2358ZM24,18a1,1,0,0,0-.8947.5527l-5,10A1.0005,1.0005,0,0,0,19,30H29a1,1,0,0,0,.9214-1.3892L24.8946,18.5527A1,1,0,0,0,24,18Z\"></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": "CheckmarkFilledWarning24", "filepath": "checkmark--filled--warning/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": "M14,2a12,12,0,1,0,3.3928,23.5059l3.9246-7.8492A2.9846,2.9846,0,0,1,24,16h1.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": { "d": "M27.38,28H20.6178L24,21.2358ZM24,18a1,1,0,0,0-.8947.5527l-5,10A1.0005,1.0005,0,0,0,19,30H29a1,1,0,0,0,.9214-1.3892L24.8946,18.5527A1,1,0,0,0,24,18Z" } }, { "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--warning", "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=\"M14,2a12,12,0,1,0,3.3928,23.5059l3.9246-7.8492A2.9846,2.9846,0,0,1,24,16h1.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 d=\"M27.38,28H20.6178L24,21.2358ZM24,18a1,1,0,0,0-.8947.5527l-5,10A1.0005,1.0005,0,0,0,19,30H29a1,1,0,0,0,.9214-1.3892L24.8946,18.5527A1,1,0,0,0,24,18Z\"></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": "CheckmarkFilledWarning20", "filepath": "checkmark--filled--warning/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": "M14,2a12,12,0,1,0,3.3928,23.5059l3.9246-7.8492A2.9846,2.9846,0,0,1,24,16h1.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": { "d": "M27.38,28H20.6178L24,21.2358ZM24,18a1,1,0,0,0-.8947.5527l-5,10A1.0005,1.0005,0,0,0,19,30H29a1,1,0,0,0,.9214-1.3892L24.8946,18.5527A1,1,0,0,0,24,18Z" } }, { "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--warning", "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=\"M14,2a12,12,0,1,0,3.3928,23.5059l3.9246-7.8492A2.9846,2.9846,0,0,1,24,16h1.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 d=\"M27.38,28H20.6178L24,21.2358ZM24,18a1,1,0,0,0-.8947.5527l-5,10A1.0005,1.0005,0,0,0,19,30H29a1,1,0,0,0,.9214-1.3892L24.8946,18.5527A1,1,0,0,0,24,18Z\"></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": "CheckmarkFilledWarning16", "filepath": "checkmark--filled--warning/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": "M14,2a12,12,0,1,0,3.3928,23.5059l3.9246-7.8492A2.9846,2.9846,0,0,1,24,16h1.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": { "d": "M27.38,28H20.6178L24,21.2358ZM24,18a1,1,0,0,0-.8947.5527l-5,10A1.0005,1.0005,0,0,0,19,30H29a1,1,0,0,0,.9214-1.3892L24.8946,18.5527A1,1,0,0,0,24,18Z" } }, { "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--warning", "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=\"M14,2a12,12,0,1,0,3.3928,23.5059l3.9246-7.8492A2.9846,2.9846,0,0,1,24,16h1.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 d=\"M27.38,28H20.6178L24,21.2358ZM24,18a1,1,0,0,0-.8947.5527l-5,10A1.0005,1.0005,0,0,0,19,30H29a1,1,0,0,0,.9214-1.3892L24.8946,18.5527A1,1,0,0,0,24,18Z\"></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>" }, }; } CheckmarkFilledWarningDirective_1 = CheckmarkFilledWarningDirective; CheckmarkFilledWarningDirective.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; CheckmarkFilledWarningDirective_1.titleIdCounter++; title.setAttribute("id", "checkmark-filled-warning-" + CheckmarkFilledWarningDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "checkmark-filled-warning-" + CheckmarkFilledWarningDirective_1.titleIdCounter); } }; var CheckmarkFilledWarningDirective_1; CheckmarkFilledWarningDirective.titleIdCounter = 0; CheckmarkFilledWarningDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CheckmarkFilledWarningDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CheckmarkFilledWarningDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], CheckmarkFilledWarningDirective.prototype, "size", void 0); CheckmarkFilledWarningDirective = CheckmarkFilledWarningDirective_1 = __decorate([ Directive({ selector: "[ibmIconCheckmarkFilledWarning]" }), __metadata("design:paramtypes", [ElementRef]) ], CheckmarkFilledWarningDirective); return CheckmarkFilledWarningDirective; }()); var CheckmarkFilledWarningModule = /** @class */ (function () { function CheckmarkFilledWarningModule() { } CheckmarkFilledWarningModule = __decorate([ NgModule({ declarations: [ CheckmarkFilledWarningComponent, CheckmarkFilledWarningDirective, ], exports: [ CheckmarkFilledWarningComponent, CheckmarkFilledWarningDirective, ] }) ], CheckmarkFilledWarningModule); return CheckmarkFilledWarningModule; }()); export { CheckmarkFilledWarningComponent, CheckmarkFilledWarningDirective, CheckmarkFilledWarningModule };