UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 11.3 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var RestaurantFineComponent = /** @class */ (function () { function RestaurantFineComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], RestaurantFineComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], RestaurantFineComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineComponent.prototype, "size", void 0); RestaurantFineComponent = __decorate([ Component({ selector: "ibm-icon-restaurant-fine", template: "\n <svg\n ibmIconRestaurantFine\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 " }) ], RestaurantFineComponent); return RestaurantFineComponent; }()); var RestaurantFineDirective = /** @class */ (function () { function RestaurantFineDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "RestaurantFine32", "filepath": "restaurant--fine/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 11.0005v-8a1 1 0 00-1-1H19a1 1 0 00-1 1v8A6.0039 6.0039 0 0023 16.91V28H19v2H29V28H25V16.91A6.0039 6.0039 0 0030 11.0005zm-10 0V4h8v7.0005a4 4 0 11-8 0zM12 2v9.02a3.9644 3.9644 0 01-3.96 3.96A4.0052 4.0052 0 014 11.02V2H2v9.02a5.9888 5.9888 0 005 5.8652V30H9V16.8953A5.9646 5.9646 0 0014 11.02V2z" } }, { "elem": "path", "attrs": { "d": "M7 2H9V11.98H7z" } }], "name": "restaurant--fine", "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 11.0005v-8a1 1 0 00-1-1H19a1 1 0 00-1 1v8A6.0039 6.0039 0 0023 16.91V28H19v2H29V28H25V16.91A6.0039 6.0039 0 0030 11.0005zm-10 0V4h8v7.0005a4 4 0 11-8 0zM12 2v9.02a3.9644 3.9644 0 01-3.96 3.96A4.0052 4.0052 0 014 11.02V2H2v9.02a5.9888 5.9888 0 005 5.8652V30H9V16.8953A5.9646 5.9646 0 0014 11.02V2z\"></path><path d=\"M7 2H9V11.98H7z\"></path></svg>" }, "24": { metadata: { "moduleName": "RestaurantFine24", "filepath": "restaurant--fine/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 11.0005v-8a1 1 0 00-1-1H19a1 1 0 00-1 1v8A6.0039 6.0039 0 0023 16.91V28H19v2H29V28H25V16.91A6.0039 6.0039 0 0030 11.0005zm-10 0V4h8v7.0005a4 4 0 11-8 0zM12 2v9.02a3.9644 3.9644 0 01-3.96 3.96A4.0052 4.0052 0 014 11.02V2H2v9.02a5.9888 5.9888 0 005 5.8652V30H9V16.8953A5.9646 5.9646 0 0014 11.02V2z" } }, { "elem": "path", "attrs": { "d": "M7 2H9V11.98H7z" } }], "name": "restaurant--fine", "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 11.0005v-8a1 1 0 00-1-1H19a1 1 0 00-1 1v8A6.0039 6.0039 0 0023 16.91V28H19v2H29V28H25V16.91A6.0039 6.0039 0 0030 11.0005zm-10 0V4h8v7.0005a4 4 0 11-8 0zM12 2v9.02a3.9644 3.9644 0 01-3.96 3.96A4.0052 4.0052 0 014 11.02V2H2v9.02a5.9888 5.9888 0 005 5.8652V30H9V16.8953A5.9646 5.9646 0 0014 11.02V2z\"></path><path d=\"M7 2H9V11.98H7z\"></path></svg>" }, "20": { metadata: { "moduleName": "RestaurantFine20", "filepath": "restaurant--fine/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 11.0005v-8a1 1 0 00-1-1H19a1 1 0 00-1 1v8A6.0039 6.0039 0 0023 16.91V28H19v2H29V28H25V16.91A6.0039 6.0039 0 0030 11.0005zm-10 0V4h8v7.0005a4 4 0 11-8 0zM12 2v9.02a3.9644 3.9644 0 01-3.96 3.96A4.0052 4.0052 0 014 11.02V2H2v9.02a5.9888 5.9888 0 005 5.8652V30H9V16.8953A5.9646 5.9646 0 0014 11.02V2z" } }, { "elem": "path", "attrs": { "d": "M7 2H9V11.98H7z" } }], "name": "restaurant--fine", "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 11.0005v-8a1 1 0 00-1-1H19a1 1 0 00-1 1v8A6.0039 6.0039 0 0023 16.91V28H19v2H29V28H25V16.91A6.0039 6.0039 0 0030 11.0005zm-10 0V4h8v7.0005a4 4 0 11-8 0zM12 2v9.02a3.9644 3.9644 0 01-3.96 3.96A4.0052 4.0052 0 014 11.02V2H2v9.02a5.9888 5.9888 0 005 5.8652V30H9V16.8953A5.9646 5.9646 0 0014 11.02V2z\"></path><path d=\"M7 2H9V11.98H7z\"></path></svg>" }, "16": { metadata: { "moduleName": "RestaurantFine16", "filepath": "restaurant--fine/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 11.0005v-8a1 1 0 00-1-1H19a1 1 0 00-1 1v8A6.0039 6.0039 0 0023 16.91V28H19v2H29V28H25V16.91A6.0039 6.0039 0 0030 11.0005zm-10 0V4h8v7.0005a4 4 0 11-8 0zM12 2v9.02a3.9644 3.9644 0 01-3.96 3.96A4.0052 4.0052 0 014 11.02V2H2v9.02a5.9888 5.9888 0 005 5.8652V30H9V16.8953A5.9646 5.9646 0 0014 11.02V2z" } }, { "elem": "path", "attrs": { "d": "M7 2H9V11.98H7z" } }], "name": "restaurant--fine", "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 11.0005v-8a1 1 0 00-1-1H19a1 1 0 00-1 1v8A6.0039 6.0039 0 0023 16.91V28H19v2H29V28H25V16.91A6.0039 6.0039 0 0030 11.0005zm-10 0V4h8v7.0005a4 4 0 11-8 0zM12 2v9.02a3.9644 3.9644 0 01-3.96 3.96A4.0052 4.0052 0 014 11.02V2H2v9.02a5.9888 5.9888 0 005 5.8652V30H9V16.8953A5.9646 5.9646 0 0014 11.02V2z\"></path><path d=\"M7 2H9V11.98H7z\"></path></svg>" }, }; } RestaurantFineDirective_1 = RestaurantFineDirective; RestaurantFineDirective.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; RestaurantFineDirective_1.titleIdCounter++; title.setAttribute("id", "restaurant-fine-" + RestaurantFineDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "restaurant-fine-" + RestaurantFineDirective_1.titleIdCounter); } }; var RestaurantFineDirective_1; RestaurantFineDirective.titleIdCounter = 0; RestaurantFineDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], RestaurantFineDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], RestaurantFineDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], RestaurantFineDirective.prototype, "size", void 0); RestaurantFineDirective = RestaurantFineDirective_1 = __decorate([ Directive({ selector: "[ibmIconRestaurantFine]" }), __metadata("design:paramtypes", [ElementRef]) ], RestaurantFineDirective); return RestaurantFineDirective; }()); var RestaurantFineModule = /** @class */ (function () { function RestaurantFineModule() { } RestaurantFineModule = __decorate([ NgModule({ declarations: [ RestaurantFineComponent, RestaurantFineDirective, ], exports: [ RestaurantFineComponent, RestaurantFineDirective, ] }) ], RestaurantFineModule); return RestaurantFineModule; }()); export { RestaurantFineComponent, RestaurantFineDirective, RestaurantFineModule };