UNPKG

@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
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var CategoryAndComponent = /** @class */ (function () { function CategoryAndComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], CategoryAndComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], CategoryAndComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CategoryAndComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], CategoryAndComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CategoryAndComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], CategoryAndComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], CategoryAndComponent.prototype, "size", void 0); CategoryAndComponent = __decorate([ Component({ selector: "ibm-icon-category-and", template: "\n <svg\n ibmIconCategoryAnd\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 " }) ], CategoryAndComponent); return CategoryAndComponent; }()); var CategoryAndDirective = /** @class */ (function () { function CategoryAndDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "CategoryAnd32", "filepath": "category--and/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": "M4 30V26H15v4h2V26H28v4h2V26a2 2 0 00-2-2H17V19H15v5H4a2 2 0 00-2 2v4zM20.6953 13.9858A10.08 10.08 0 0021.9463 10H23V8H20V9a9.2634 9.2634 0 01-.6641 3.2705L16.6511 8.8816a5.1261 5.1261 0 002.1436-2.3694A3.2522 3.2522 0 0018.6062 3.81a3.38 3.38 0 00-2.2391-1.7056 3.4688 3.4688 0 00-4.2223 2.1186c-.5044 1.5518.4406 3.1158 1.2612 4.1077A4.7255 4.7255 0 0011.06 13.1587 4.4526 4.4526 0 0015.4268 17h.0058a5.7844 5.7844 0 003.9717-1.4233L20.532 17h2.5519zM14.047 4.8413A1.3224 1.3224 0 0115.4141 4a2.41 2.41 0 01.5214.0581 1.4018 1.4018 0 01.9111.7022 1.2493 1.2493 0 01.0791 1.042A3.6871 3.6871 0 0115.2441 7.395C14.5831 6.6816 13.8087 5.5732 14.047 4.8413zM15.4316 15h-.0039a2.4432 2.4432 0 01-2.3916-2.1509 2.8261 2.8261 0 011.81-3.0249l3.3115 4.1787A3.8853 3.8853 0 0115.4316 15z" } }], "name": "category--and", "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=\"M4 30V26H15v4h2V26H28v4h2V26a2 2 0 00-2-2H17V19H15v5H4a2 2 0 00-2 2v4zM20.6953 13.9858A10.08 10.08 0 0021.9463 10H23V8H20V9a9.2634 9.2634 0 01-.6641 3.2705L16.6511 8.8816a5.1261 5.1261 0 002.1436-2.3694A3.2522 3.2522 0 0018.6062 3.81a3.38 3.38 0 00-2.2391-1.7056 3.4688 3.4688 0 00-4.2223 2.1186c-.5044 1.5518.4406 3.1158 1.2612 4.1077A4.7255 4.7255 0 0011.06 13.1587 4.4526 4.4526 0 0015.4268 17h.0058a5.7844 5.7844 0 003.9717-1.4233L20.532 17h2.5519zM14.047 4.8413A1.3224 1.3224 0 0115.4141 4a2.41 2.41 0 01.5214.0581 1.4018 1.4018 0 01.9111.7022 1.2493 1.2493 0 01.0791 1.042A3.6871 3.6871 0 0115.2441 7.395C14.5831 6.6816 13.8087 5.5732 14.047 4.8413zM15.4316 15h-.0039a2.4432 2.4432 0 01-2.3916-2.1509 2.8261 2.8261 0 011.81-3.0249l3.3115 4.1787A3.8853 3.8853 0 0115.4316 15z\"></path></svg>" }, "24": { metadata: { "moduleName": "CategoryAnd24", "filepath": "category--and/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": "M4 30V26H15v4h2V26H28v4h2V26a2 2 0 00-2-2H17V19H15v5H4a2 2 0 00-2 2v4zM20.6953 13.9858A10.08 10.08 0 0021.9463 10H23V8H20V9a9.2634 9.2634 0 01-.6641 3.2705L16.6511 8.8816a5.1261 5.1261 0 002.1436-2.3694A3.2522 3.2522 0 0018.6062 3.81a3.38 3.38 0 00-2.2391-1.7056 3.4688 3.4688 0 00-4.2223 2.1186c-.5044 1.5518.4406 3.1158 1.2612 4.1077A4.7255 4.7255 0 0011.06 13.1587 4.4526 4.4526 0 0015.4268 17h.0058a5.7844 5.7844 0 003.9717-1.4233L20.532 17h2.5519zM14.047 4.8413A1.3224 1.3224 0 0115.4141 4a2.41 2.41 0 01.5214.0581 1.4018 1.4018 0 01.9111.7022 1.2493 1.2493 0 01.0791 1.042A3.6871 3.6871 0 0115.2441 7.395C14.5831 6.6816 13.8087 5.5732 14.047 4.8413zM15.4316 15h-.0039a2.4432 2.4432 0 01-2.3916-2.1509 2.8261 2.8261 0 011.81-3.0249l3.3115 4.1787A3.8853 3.8853 0 0115.4316 15z" } }], "name": "category--and", "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=\"M4 30V26H15v4h2V26H28v4h2V26a2 2 0 00-2-2H17V19H15v5H4a2 2 0 00-2 2v4zM20.6953 13.9858A10.08 10.08 0 0021.9463 10H23V8H20V9a9.2634 9.2634 0 01-.6641 3.2705L16.6511 8.8816a5.1261 5.1261 0 002.1436-2.3694A3.2522 3.2522 0 0018.6062 3.81a3.38 3.38 0 00-2.2391-1.7056 3.4688 3.4688 0 00-4.2223 2.1186c-.5044 1.5518.4406 3.1158 1.2612 4.1077A4.7255 4.7255 0 0011.06 13.1587 4.4526 4.4526 0 0015.4268 17h.0058a5.7844 5.7844 0 003.9717-1.4233L20.532 17h2.5519zM14.047 4.8413A1.3224 1.3224 0 0115.4141 4a2.41 2.41 0 01.5214.0581 1.4018 1.4018 0 01.9111.7022 1.2493 1.2493 0 01.0791 1.042A3.6871 3.6871 0 0115.2441 7.395C14.5831 6.6816 13.8087 5.5732 14.047 4.8413zM15.4316 15h-.0039a2.4432 2.4432 0 01-2.3916-2.1509 2.8261 2.8261 0 011.81-3.0249l3.3115 4.1787A3.8853 3.8853 0 0115.4316 15z\"></path></svg>" }, "20": { metadata: { "moduleName": "CategoryAnd20", "filepath": "category--and/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": "M4 30V26H15v4h2V26H28v4h2V26a2 2 0 00-2-2H17V19H15v5H4a2 2 0 00-2 2v4zM20.6953 13.9858A10.08 10.08 0 0021.9463 10H23V8H20V9a9.2634 9.2634 0 01-.6641 3.2705L16.6511 8.8816a5.1261 5.1261 0 002.1436-2.3694A3.2522 3.2522 0 0018.6062 3.81a3.38 3.38 0 00-2.2391-1.7056 3.4688 3.4688 0 00-4.2223 2.1186c-.5044 1.5518.4406 3.1158 1.2612 4.1077A4.7255 4.7255 0 0011.06 13.1587 4.4526 4.4526 0 0015.4268 17h.0058a5.7844 5.7844 0 003.9717-1.4233L20.532 17h2.5519zM14.047 4.8413A1.3224 1.3224 0 0115.4141 4a2.41 2.41 0 01.5214.0581 1.4018 1.4018 0 01.9111.7022 1.2493 1.2493 0 01.0791 1.042A3.6871 3.6871 0 0115.2441 7.395C14.5831 6.6816 13.8087 5.5732 14.047 4.8413zM15.4316 15h-.0039a2.4432 2.4432 0 01-2.3916-2.1509 2.8261 2.8261 0 011.81-3.0249l3.3115 4.1787A3.8853 3.8853 0 0115.4316 15z" } }], "name": "category--and", "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=\"M4 30V26H15v4h2V26H28v4h2V26a2 2 0 00-2-2H17V19H15v5H4a2 2 0 00-2 2v4zM20.6953 13.9858A10.08 10.08 0 0021.9463 10H23V8H20V9a9.2634 9.2634 0 01-.6641 3.2705L16.6511 8.8816a5.1261 5.1261 0 002.1436-2.3694A3.2522 3.2522 0 0018.6062 3.81a3.38 3.38 0 00-2.2391-1.7056 3.4688 3.4688 0 00-4.2223 2.1186c-.5044 1.5518.4406 3.1158 1.2612 4.1077A4.7255 4.7255 0 0011.06 13.1587 4.4526 4.4526 0 0015.4268 17h.0058a5.7844 5.7844 0 003.9717-1.4233L20.532 17h2.5519zM14.047 4.8413A1.3224 1.3224 0 0115.4141 4a2.41 2.41 0 01.5214.0581 1.4018 1.4018 0 01.9111.7022 1.2493 1.2493 0 01.0791 1.042A3.6871 3.6871 0 0115.2441 7.395C14.5831 6.6816 13.8087 5.5732 14.047 4.8413zM15.4316 15h-.0039a2.4432 2.4432 0 01-2.3916-2.1509 2.8261 2.8261 0 011.81-3.0249l3.3115 4.1787A3.8853 3.8853 0 0115.4316 15z\"></path></svg>" }, "16": { metadata: { "moduleName": "CategoryAnd16", "filepath": "category--and/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": "M4 30V26H15v4h2V26H28v4h2V26a2 2 0 00-2-2H17V19H15v5H4a2 2 0 00-2 2v4zM20.6953 13.9858A10.08 10.08 0 0021.9463 10H23V8H20V9a9.2634 9.2634 0 01-.6641 3.2705L16.6511 8.8816a5.1261 5.1261 0 002.1436-2.3694A3.2522 3.2522 0 0018.6062 3.81a3.38 3.38 0 00-2.2391-1.7056 3.4688 3.4688 0 00-4.2223 2.1186c-.5044 1.5518.4406 3.1158 1.2612 4.1077A4.7255 4.7255 0 0011.06 13.1587 4.4526 4.4526 0 0015.4268 17h.0058a5.7844 5.7844 0 003.9717-1.4233L20.532 17h2.5519zM14.047 4.8413A1.3224 1.3224 0 0115.4141 4a2.41 2.41 0 01.5214.0581 1.4018 1.4018 0 01.9111.7022 1.2493 1.2493 0 01.0791 1.042A3.6871 3.6871 0 0115.2441 7.395C14.5831 6.6816 13.8087 5.5732 14.047 4.8413zM15.4316 15h-.0039a2.4432 2.4432 0 01-2.3916-2.1509 2.8261 2.8261 0 011.81-3.0249l3.3115 4.1787A3.8853 3.8853 0 0115.4316 15z" } }], "name": "category--and", "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=\"M4 30V26H15v4h2V26H28v4h2V26a2 2 0 00-2-2H17V19H15v5H4a2 2 0 00-2 2v4zM20.6953 13.9858A10.08 10.08 0 0021.9463 10H23V8H20V9a9.2634 9.2634 0 01-.6641 3.2705L16.6511 8.8816a5.1261 5.1261 0 002.1436-2.3694A3.2522 3.2522 0 0018.6062 3.81a3.38 3.38 0 00-2.2391-1.7056 3.4688 3.4688 0 00-4.2223 2.1186c-.5044 1.5518.4406 3.1158 1.2612 4.1077A4.7255 4.7255 0 0011.06 13.1587 4.4526 4.4526 0 0015.4268 17h.0058a5.7844 5.7844 0 003.9717-1.4233L20.532 17h2.5519zM14.047 4.8413A1.3224 1.3224 0 0115.4141 4a2.41 2.41 0 01.5214.0581 1.4018 1.4018 0 01.9111.7022 1.2493 1.2493 0 01.0791 1.042A3.6871 3.6871 0 0115.2441 7.395C14.5831 6.6816 13.8087 5.5732 14.047 4.8413zM15.4316 15h-.0039a2.4432 2.4432 0 01-2.3916-2.1509 2.8261 2.8261 0 011.81-3.0249l3.3115 4.1787A3.8853 3.8853 0 0115.4316 15z\"></path></svg>" }, }; } CategoryAndDirective_1 = CategoryAndDirective; CategoryAndDirective.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; CategoryAndDirective_1.titleIdCounter++; title.setAttribute("id", "category-and-" + CategoryAndDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "category-and-" + CategoryAndDirective_1.titleIdCounter); } }; var CategoryAndDirective_1; CategoryAndDirective.titleIdCounter = 0; CategoryAndDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], CategoryAndDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], CategoryAndDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CategoryAndDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], CategoryAndDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], CategoryAndDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], CategoryAndDirective.prototype, "size", void 0); CategoryAndDirective = CategoryAndDirective_1 = __decorate([ Directive({ selector: "[ibmIconCategoryAnd]" }), __metadata("design:paramtypes", [ElementRef]) ], CategoryAndDirective); return CategoryAndDirective; }()); var CategoryAndModule = /** @class */ (function () { function CategoryAndModule() { } CategoryAndModule = __decorate([ NgModule({ declarations: [ CategoryAndComponent, CategoryAndDirective, ], exports: [ CategoryAndComponent, CategoryAndDirective, ] }) ], CategoryAndModule); return CategoryAndModule; }()); export { CategoryAndComponent, CategoryAndDirective, CategoryAndModule };