@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
169 lines (166 loc) • 14.1 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var PersonFavoriteComponent = /** @class */ (function () {
function PersonFavoriteComponent() {
this.focusable = false;
}
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PersonFavoriteComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PersonFavoriteComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteComponent.prototype, "size", void 0);
PersonFavoriteComponent = __decorate([
Component({
selector: "ibm-icon-person-favorite",
template: "\n <svg\n ibmIconPersonFavorite\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 "
})
], PersonFavoriteComponent);
return PersonFavoriteComponent;
}());
var PersonFavoriteDirective = /** @class */ (function () {
function PersonFavoriteDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "PersonFavorite32", "filepath": "person--favorite/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": "M10 31H6a2.0059 2.0059 0 01-2-2V22a2.0059 2.0059 0 01-2-2V14a2.9465 2.9465 0 013-3h6a2.9465 2.9465 0 013 3v6a2.0059 2.0059 0 01-2 2v7A2.0059 2.0059 0 0110 31zM5 13a.9448.9448 0 00-1 1v6H6v9h4V20h2V14a.9448.9448 0 00-1-1zM8 10a4 4 0 114-4A4.0045 4.0045 0 018 10zM8 4a2 2 0 102 2A2.002 2.002 0 008 4zM28.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.8948z" } }], "name": "person--favorite", "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=\"M10 31H6a2.0059 2.0059 0 01-2-2V22a2.0059 2.0059 0 01-2-2V14a2.9465 2.9465 0 013-3h6a2.9465 2.9465 0 013 3v6a2.0059 2.0059 0 01-2 2v7A2.0059 2.0059 0 0110 31zM5 13a.9448.9448 0 00-1 1v6H6v9h4V20h2V14a.9448.9448 0 00-1-1zM8 10a4 4 0 114-4A4.0045 4.0045 0 018 10zM8 4a2 2 0 102 2A2.002 2.002 0 008 4zM28.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.8948z\"></path></svg>"
},
"24": {
metadata: { "moduleName": "PersonFavorite24", "filepath": "person--favorite/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": "M10 31H6a2.0059 2.0059 0 01-2-2V22a2.0059 2.0059 0 01-2-2V14a2.9465 2.9465 0 013-3h6a2.9465 2.9465 0 013 3v6a2.0059 2.0059 0 01-2 2v7A2.0059 2.0059 0 0110 31zM5 13a.9448.9448 0 00-1 1v6H6v9h4V20h2V14a.9448.9448 0 00-1-1zM8 10a4 4 0 114-4A4.0045 4.0045 0 018 10zM8 4a2 2 0 102 2A2.002 2.002 0 008 4zM28.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.8948z" } }], "name": "person--favorite", "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=\"M10 31H6a2.0059 2.0059 0 01-2-2V22a2.0059 2.0059 0 01-2-2V14a2.9465 2.9465 0 013-3h6a2.9465 2.9465 0 013 3v6a2.0059 2.0059 0 01-2 2v7A2.0059 2.0059 0 0110 31zM5 13a.9448.9448 0 00-1 1v6H6v9h4V20h2V14a.9448.9448 0 00-1-1zM8 10a4 4 0 114-4A4.0045 4.0045 0 018 10zM8 4a2 2 0 102 2A2.002 2.002 0 008 4zM28.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.8948z\"></path></svg>"
},
"20": {
metadata: { "moduleName": "PersonFavorite20", "filepath": "person--favorite/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": "M10 31H6a2.0059 2.0059 0 01-2-2V22a2.0059 2.0059 0 01-2-2V14a2.9465 2.9465 0 013-3h6a2.9465 2.9465 0 013 3v6a2.0059 2.0059 0 01-2 2v7A2.0059 2.0059 0 0110 31zM5 13a.9448.9448 0 00-1 1v6H6v9h4V20h2V14a.9448.9448 0 00-1-1zM8 10a4 4 0 114-4A4.0045 4.0045 0 018 10zM8 4a2 2 0 102 2A2.002 2.002 0 008 4zM28.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.8948z" } }], "name": "person--favorite", "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=\"M10 31H6a2.0059 2.0059 0 01-2-2V22a2.0059 2.0059 0 01-2-2V14a2.9465 2.9465 0 013-3h6a2.9465 2.9465 0 013 3v6a2.0059 2.0059 0 01-2 2v7A2.0059 2.0059 0 0110 31zM5 13a.9448.9448 0 00-1 1v6H6v9h4V20h2V14a.9448.9448 0 00-1-1zM8 10a4 4 0 114-4A4.0045 4.0045 0 018 10zM8 4a2 2 0 102 2A2.002 2.002 0 008 4zM28.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.8948z\"></path></svg>"
},
"16": {
metadata: { "moduleName": "PersonFavorite16", "filepath": "person--favorite/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": "M10 31H6a2.0059 2.0059 0 01-2-2V22a2.0059 2.0059 0 01-2-2V14a2.9465 2.9465 0 013-3h6a2.9465 2.9465 0 013 3v6a2.0059 2.0059 0 01-2 2v7A2.0059 2.0059 0 0110 31zM5 13a.9448.9448 0 00-1 1v6H6v9h4V20h2V14a.9448.9448 0 00-1-1zM8 10a4 4 0 114-4A4.0045 4.0045 0 018 10zM8 4a2 2 0 102 2A2.002 2.002 0 008 4zM28.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.8948z" } }], "name": "person--favorite", "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=\"M10 31H6a2.0059 2.0059 0 01-2-2V22a2.0059 2.0059 0 01-2-2V14a2.9465 2.9465 0 013-3h6a2.9465 2.9465 0 013 3v6a2.0059 2.0059 0 01-2 2v7A2.0059 2.0059 0 0110 31zM5 13a.9448.9448 0 00-1 1v6H6v9h4V20h2V14a.9448.9448 0 00-1-1zM8 10a4 4 0 114-4A4.0045 4.0045 0 018 10zM8 4a2 2 0 102 2A2.002 2.002 0 008 4zM28.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.8948z\"></path></svg>"
},
};
}
PersonFavoriteDirective_1 = PersonFavoriteDirective;
PersonFavoriteDirective.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;
PersonFavoriteDirective_1.titleIdCounter++;
title.setAttribute("id", "person-favorite-" + PersonFavoriteDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "person-favorite-" + PersonFavoriteDirective_1.titleIdCounter);
}
};
var PersonFavoriteDirective_1;
PersonFavoriteDirective.titleIdCounter = 0;
PersonFavoriteDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PersonFavoriteDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], PersonFavoriteDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], PersonFavoriteDirective.prototype, "size", void 0);
PersonFavoriteDirective = PersonFavoriteDirective_1 = __decorate([
Directive({
selector: "[ibmIconPersonFavorite]"
}),
__metadata("design:paramtypes", [ElementRef])
], PersonFavoriteDirective);
return PersonFavoriteDirective;
}());
var PersonFavoriteModule = /** @class */ (function () {
function PersonFavoriteModule() {
}
PersonFavoriteModule = __decorate([
NgModule({
declarations: [
PersonFavoriteComponent,
PersonFavoriteDirective,
],
exports: [
PersonFavoriteComponent,
PersonFavoriteDirective,
]
})
], PersonFavoriteModule);
return PersonFavoriteModule;
}());
export { PersonFavoriteComponent, PersonFavoriteDirective, PersonFavoriteModule };