UNPKG

@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
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var UserFavoriteAltComponent = /** @class */ (function () { function UserFavoriteAltComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], UserFavoriteAltComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], UserFavoriteAltComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltComponent.prototype, "size", void 0); UserFavoriteAltComponent = __decorate([ Component({ selector: "ibm-icon-user-favorite-alt", template: "\n <svg\n ibmIconUserFavoriteAlt\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 " }) ], UserFavoriteAltComponent); return UserFavoriteAltComponent; }()); var UserFavoriteAltDirective = /** @class */ (function () { function UserFavoriteAltDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "UserFavoriteAlt32", "filepath": "user--favorite--alt/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": "M28.7663 4.2558A4.2121 4.2121 0 0023 4.0321a4.2121 4.2121 0 00-5.7663.2237 4.319 4.319 0 000 6.0447L22.998 16.14 23 16.1376l.002.0019 5.7643-5.839A4.319 4.319 0 0028.7663 4.2558zM27.342 8.8948l-4.34 4.3973L23 13.29l-.002.002-4.34-4.3973a2.3085 2.3085 0 010-3.2338 2.2639 2.2639 0 013.1561 0l1.181 1.2074L23 6.8634l.0049.005 1.181-1.2074a2.2639 2.2639 0 013.1561 0A2.3085 2.3085 0 0127.342 8.8948zM16 30H14V25a3.0033 3.0033 0 00-3-3H7a3.0033 3.0033 0 00-3 3v5H2V25a5.0059 5.0059 0 015-5h4a5.0059 5.0059 0 015 5zM9 10a3 3 0 11-3 3 3 3 0 013-3M9 8a5 5 0 105 5A5 5 0 009 8z" } }], "name": "user--favorite--alt", "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=\"M28.7663 4.2558A4.2121 4.2121 0 0023 4.0321a4.2121 4.2121 0 00-5.7663.2237 4.319 4.319 0 000 6.0447L22.998 16.14 23 16.1376l.002.0019 5.7643-5.839A4.319 4.319 0 0028.7663 4.2558zM27.342 8.8948l-4.34 4.3973L23 13.29l-.002.002-4.34-4.3973a2.3085 2.3085 0 010-3.2338 2.2639 2.2639 0 013.1561 0l1.181 1.2074L23 6.8634l.0049.005 1.181-1.2074a2.2639 2.2639 0 013.1561 0A2.3085 2.3085 0 0127.342 8.8948zM16 30H14V25a3.0033 3.0033 0 00-3-3H7a3.0033 3.0033 0 00-3 3v5H2V25a5.0059 5.0059 0 015-5h4a5.0059 5.0059 0 015 5zM9 10a3 3 0 11-3 3 3 3 0 013-3M9 8a5 5 0 105 5A5 5 0 009 8z\"></path></svg>" }, "24": { metadata: { "moduleName": "UserFavoriteAlt24", "filepath": "user--favorite--alt/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": "M28.7663 4.2558A4.2121 4.2121 0 0023 4.0321a4.2121 4.2121 0 00-5.7663.2237 4.319 4.319 0 000 6.0447L22.998 16.14 23 16.1376l.002.0019 5.7643-5.839A4.319 4.319 0 0028.7663 4.2558zM27.342 8.8948l-4.34 4.3973L23 13.29l-.002.002-4.34-4.3973a2.3085 2.3085 0 010-3.2338 2.2639 2.2639 0 013.1561 0l1.181 1.2074L23 6.8634l.0049.005 1.181-1.2074a2.2639 2.2639 0 013.1561 0A2.3085 2.3085 0 0127.342 8.8948zM16 30H14V25a3.0033 3.0033 0 00-3-3H7a3.0033 3.0033 0 00-3 3v5H2V25a5.0059 5.0059 0 015-5h4a5.0059 5.0059 0 015 5zM9 10a3 3 0 11-3 3 3 3 0 013-3M9 8a5 5 0 105 5A5 5 0 009 8z" } }], "name": "user--favorite--alt", "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=\"M28.7663 4.2558A4.2121 4.2121 0 0023 4.0321a4.2121 4.2121 0 00-5.7663.2237 4.319 4.319 0 000 6.0447L22.998 16.14 23 16.1376l.002.0019 5.7643-5.839A4.319 4.319 0 0028.7663 4.2558zM27.342 8.8948l-4.34 4.3973L23 13.29l-.002.002-4.34-4.3973a2.3085 2.3085 0 010-3.2338 2.2639 2.2639 0 013.1561 0l1.181 1.2074L23 6.8634l.0049.005 1.181-1.2074a2.2639 2.2639 0 013.1561 0A2.3085 2.3085 0 0127.342 8.8948zM16 30H14V25a3.0033 3.0033 0 00-3-3H7a3.0033 3.0033 0 00-3 3v5H2V25a5.0059 5.0059 0 015-5h4a5.0059 5.0059 0 015 5zM9 10a3 3 0 11-3 3 3 3 0 013-3M9 8a5 5 0 105 5A5 5 0 009 8z\"></path></svg>" }, "20": { metadata: { "moduleName": "UserFavoriteAlt20", "filepath": "user--favorite--alt/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": "M28.7663 4.2558A4.2121 4.2121 0 0023 4.0321a4.2121 4.2121 0 00-5.7663.2237 4.319 4.319 0 000 6.0447L22.998 16.14 23 16.1376l.002.0019 5.7643-5.839A4.319 4.319 0 0028.7663 4.2558zM27.342 8.8948l-4.34 4.3973L23 13.29l-.002.002-4.34-4.3973a2.3085 2.3085 0 010-3.2338 2.2639 2.2639 0 013.1561 0l1.181 1.2074L23 6.8634l.0049.005 1.181-1.2074a2.2639 2.2639 0 013.1561 0A2.3085 2.3085 0 0127.342 8.8948zM16 30H14V25a3.0033 3.0033 0 00-3-3H7a3.0033 3.0033 0 00-3 3v5H2V25a5.0059 5.0059 0 015-5h4a5.0059 5.0059 0 015 5zM9 10a3 3 0 11-3 3 3 3 0 013-3M9 8a5 5 0 105 5A5 5 0 009 8z" } }], "name": "user--favorite--alt", "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=\"M28.7663 4.2558A4.2121 4.2121 0 0023 4.0321a4.2121 4.2121 0 00-5.7663.2237 4.319 4.319 0 000 6.0447L22.998 16.14 23 16.1376l.002.0019 5.7643-5.839A4.319 4.319 0 0028.7663 4.2558zM27.342 8.8948l-4.34 4.3973L23 13.29l-.002.002-4.34-4.3973a2.3085 2.3085 0 010-3.2338 2.2639 2.2639 0 013.1561 0l1.181 1.2074L23 6.8634l.0049.005 1.181-1.2074a2.2639 2.2639 0 013.1561 0A2.3085 2.3085 0 0127.342 8.8948zM16 30H14V25a3.0033 3.0033 0 00-3-3H7a3.0033 3.0033 0 00-3 3v5H2V25a5.0059 5.0059 0 015-5h4a5.0059 5.0059 0 015 5zM9 10a3 3 0 11-3 3 3 3 0 013-3M9 8a5 5 0 105 5A5 5 0 009 8z\"></path></svg>" }, "16": { metadata: { "moduleName": "UserFavoriteAlt16", "filepath": "user--favorite--alt/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": "M28.7663 4.2558A4.2121 4.2121 0 0023 4.0321a4.2121 4.2121 0 00-5.7663.2237 4.319 4.319 0 000 6.0447L22.998 16.14 23 16.1376l.002.0019 5.7643-5.839A4.319 4.319 0 0028.7663 4.2558zM27.342 8.8948l-4.34 4.3973L23 13.29l-.002.002-4.34-4.3973a2.3085 2.3085 0 010-3.2338 2.2639 2.2639 0 013.1561 0l1.181 1.2074L23 6.8634l.0049.005 1.181-1.2074a2.2639 2.2639 0 013.1561 0A2.3085 2.3085 0 0127.342 8.8948zM16 30H14V25a3.0033 3.0033 0 00-3-3H7a3.0033 3.0033 0 00-3 3v5H2V25a5.0059 5.0059 0 015-5h4a5.0059 5.0059 0 015 5zM9 10a3 3 0 11-3 3 3 3 0 013-3M9 8a5 5 0 105 5A5 5 0 009 8z" } }], "name": "user--favorite--alt", "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=\"M28.7663 4.2558A4.2121 4.2121 0 0023 4.0321a4.2121 4.2121 0 00-5.7663.2237 4.319 4.319 0 000 6.0447L22.998 16.14 23 16.1376l.002.0019 5.7643-5.839A4.319 4.319 0 0028.7663 4.2558zM27.342 8.8948l-4.34 4.3973L23 13.29l-.002.002-4.34-4.3973a2.3085 2.3085 0 010-3.2338 2.2639 2.2639 0 013.1561 0l1.181 1.2074L23 6.8634l.0049.005 1.181-1.2074a2.2639 2.2639 0 013.1561 0A2.3085 2.3085 0 0127.342 8.8948zM16 30H14V25a3.0033 3.0033 0 00-3-3H7a3.0033 3.0033 0 00-3 3v5H2V25a5.0059 5.0059 0 015-5h4a5.0059 5.0059 0 015 5zM9 10a3 3 0 11-3 3 3 3 0 013-3M9 8a5 5 0 105 5A5 5 0 009 8z\"></path></svg>" }, }; } UserFavoriteAltDirective_1 = UserFavoriteAltDirective; UserFavoriteAltDirective.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; UserFavoriteAltDirective_1.titleIdCounter++; title.setAttribute("id", "user-favorite-alt-" + UserFavoriteAltDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "user-favorite-alt-" + UserFavoriteAltDirective_1.titleIdCounter); } }; var UserFavoriteAltDirective_1; UserFavoriteAltDirective.titleIdCounter = 0; UserFavoriteAltDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], UserFavoriteAltDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], UserFavoriteAltDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], UserFavoriteAltDirective.prototype, "size", void 0); UserFavoriteAltDirective = UserFavoriteAltDirective_1 = __decorate([ Directive({ selector: "[ibmIconUserFavoriteAlt]" }), __metadata("design:paramtypes", [ElementRef]) ], UserFavoriteAltDirective); return UserFavoriteAltDirective; }()); var UserFavoriteAltModule = /** @class */ (function () { function UserFavoriteAltModule() { } UserFavoriteAltModule = __decorate([ NgModule({ declarations: [ UserFavoriteAltComponent, UserFavoriteAltDirective, ], exports: [ UserFavoriteAltComponent, UserFavoriteAltDirective, ] }) ], UserFavoriteAltModule); return UserFavoriteAltModule; }()); export { UserFavoriteAltComponent, UserFavoriteAltDirective, UserFavoriteAltModule };