@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 12.2 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var LogoLivestreamDirective_1;
let LogoLivestreamComponent = class LogoLivestreamComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], LogoLivestreamComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], LogoLivestreamComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamComponent.prototype, "size", void 0);
LogoLivestreamComponent = __decorate([
Component({
selector: "ibm-icon-logo-livestream",
template: `
<svg
ibmIconLogoLivestream
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], LogoLivestreamComponent);
let LogoLivestreamDirective = LogoLivestreamDirective_1 = class LogoLivestreamDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "LogoLivestream32", "filepath": "logo--livestream/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": "M22.49 23.71h-.76c-2.26 0-4.52 0-6.78 0a3.12 3.12 0 01-2.41-1A14.91 14.91 0 0110 18.88c-1.3-2.6-2.54-5.22-3.82-7.82-.39-.8-.82-1.56-1.28-2.32A7.84 7.84 0 002 5.6c1.24 0 2.41 0 3.57 0a45.63 45.63 0 017 .61 8.09 8.09 0 016.34 5.09 48.51 48.51 0 012.17 7.36A26 26 0 0022.49 23.71zM28.1 26.38a2.93 2.93 0 01-2.74-2.64 42.08 42.08 0 01-.14-4.9 48 48 0 00-.61-7.58 3.75 3.75 0 00-.83-2h2.65c.54 0 .73.37.89.78A12.1 12.1 0 0128 13.28c.29 2.72.31 5.45.33 8.18a10.94 10.94 0 000 1.15c.09.78.4 1.1 1.17 1.08.5 0 .5-.06.5-.06v2.69A8.62 8.62 0 0128.1 26.38z" } }], "name": "logo--livestream", "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="M22.49 23.71h-.76c-2.26 0-4.52 0-6.78 0a3.12 3.12 0 01-2.41-1A14.91 14.91 0 0110 18.88c-1.3-2.6-2.54-5.22-3.82-7.82-.39-.8-.82-1.56-1.28-2.32A7.84 7.84 0 002 5.6c1.24 0 2.41 0 3.57 0a45.63 45.63 0 017 .61 8.09 8.09 0 016.34 5.09 48.51 48.51 0 012.17 7.36A26 26 0 0022.49 23.71zM28.1 26.38a2.93 2.93 0 01-2.74-2.64 42.08 42.08 0 01-.14-4.9 48 48 0 00-.61-7.58 3.75 3.75 0 00-.83-2h2.65c.54 0 .73.37.89.78A12.1 12.1 0 0128 13.28c.29 2.72.31 5.45.33 8.18a10.94 10.94 0 000 1.15c.09.78.4 1.1 1.17 1.08.5 0 .5-.06.5-.06v2.69A8.62 8.62 0 0128.1 26.38z"></path></svg>`
},
"24": {
metadata: { "moduleName": "LogoLivestream24", "filepath": "logo--livestream/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": "M22.49 23.71h-.76c-2.26 0-4.52 0-6.78 0a3.12 3.12 0 01-2.41-1A14.91 14.91 0 0110 18.88c-1.3-2.6-2.54-5.22-3.82-7.82-.39-.8-.82-1.56-1.28-2.32A7.84 7.84 0 002 5.6c1.24 0 2.41 0 3.57 0a45.63 45.63 0 017 .61 8.09 8.09 0 016.34 5.09 48.51 48.51 0 012.17 7.36A26 26 0 0022.49 23.71zM28.1 26.38a2.93 2.93 0 01-2.74-2.64 42.08 42.08 0 01-.14-4.9 48 48 0 00-.61-7.58 3.75 3.75 0 00-.83-2h2.65c.54 0 .73.37.89.78A12.1 12.1 0 0128 13.28c.29 2.72.31 5.45.33 8.18a10.94 10.94 0 000 1.15c.09.78.4 1.1 1.17 1.08.5 0 .5-.06.5-.06v2.69A8.62 8.62 0 0128.1 26.38z" } }], "name": "logo--livestream", "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="M22.49 23.71h-.76c-2.26 0-4.52 0-6.78 0a3.12 3.12 0 01-2.41-1A14.91 14.91 0 0110 18.88c-1.3-2.6-2.54-5.22-3.82-7.82-.39-.8-.82-1.56-1.28-2.32A7.84 7.84 0 002 5.6c1.24 0 2.41 0 3.57 0a45.63 45.63 0 017 .61 8.09 8.09 0 016.34 5.09 48.51 48.51 0 012.17 7.36A26 26 0 0022.49 23.71zM28.1 26.38a2.93 2.93 0 01-2.74-2.64 42.08 42.08 0 01-.14-4.9 48 48 0 00-.61-7.58 3.75 3.75 0 00-.83-2h2.65c.54 0 .73.37.89.78A12.1 12.1 0 0128 13.28c.29 2.72.31 5.45.33 8.18a10.94 10.94 0 000 1.15c.09.78.4 1.1 1.17 1.08.5 0 .5-.06.5-.06v2.69A8.62 8.62 0 0128.1 26.38z"></path></svg>`
},
"20": {
metadata: { "moduleName": "LogoLivestream20", "filepath": "logo--livestream/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": "M22.49 23.71h-.76c-2.26 0-4.52 0-6.78 0a3.12 3.12 0 01-2.41-1A14.91 14.91 0 0110 18.88c-1.3-2.6-2.54-5.22-3.82-7.82-.39-.8-.82-1.56-1.28-2.32A7.84 7.84 0 002 5.6c1.24 0 2.41 0 3.57 0a45.63 45.63 0 017 .61 8.09 8.09 0 016.34 5.09 48.51 48.51 0 012.17 7.36A26 26 0 0022.49 23.71zM28.1 26.38a2.93 2.93 0 01-2.74-2.64 42.08 42.08 0 01-.14-4.9 48 48 0 00-.61-7.58 3.75 3.75 0 00-.83-2h2.65c.54 0 .73.37.89.78A12.1 12.1 0 0128 13.28c.29 2.72.31 5.45.33 8.18a10.94 10.94 0 000 1.15c.09.78.4 1.1 1.17 1.08.5 0 .5-.06.5-.06v2.69A8.62 8.62 0 0128.1 26.38z" } }], "name": "logo--livestream", "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="M22.49 23.71h-.76c-2.26 0-4.52 0-6.78 0a3.12 3.12 0 01-2.41-1A14.91 14.91 0 0110 18.88c-1.3-2.6-2.54-5.22-3.82-7.82-.39-.8-.82-1.56-1.28-2.32A7.84 7.84 0 002 5.6c1.24 0 2.41 0 3.57 0a45.63 45.63 0 017 .61 8.09 8.09 0 016.34 5.09 48.51 48.51 0 012.17 7.36A26 26 0 0022.49 23.71zM28.1 26.38a2.93 2.93 0 01-2.74-2.64 42.08 42.08 0 01-.14-4.9 48 48 0 00-.61-7.58 3.75 3.75 0 00-.83-2h2.65c.54 0 .73.37.89.78A12.1 12.1 0 0128 13.28c.29 2.72.31 5.45.33 8.18a10.94 10.94 0 000 1.15c.09.78.4 1.1 1.17 1.08.5 0 .5-.06.5-.06v2.69A8.62 8.62 0 0128.1 26.38z"></path></svg>`
},
"16": {
metadata: { "moduleName": "LogoLivestream16", "filepath": "logo--livestream/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": "M22.49 23.71h-.76c-2.26 0-4.52 0-6.78 0a3.12 3.12 0 01-2.41-1A14.91 14.91 0 0110 18.88c-1.3-2.6-2.54-5.22-3.82-7.82-.39-.8-.82-1.56-1.28-2.32A7.84 7.84 0 002 5.6c1.24 0 2.41 0 3.57 0a45.63 45.63 0 017 .61 8.09 8.09 0 016.34 5.09 48.51 48.51 0 012.17 7.36A26 26 0 0022.49 23.71zM28.1 26.38a2.93 2.93 0 01-2.74-2.64 42.08 42.08 0 01-.14-4.9 48 48 0 00-.61-7.58 3.75 3.75 0 00-.83-2h2.65c.54 0 .73.37.89.78A12.1 12.1 0 0128 13.28c.29 2.72.31 5.45.33 8.18a10.94 10.94 0 000 1.15c.09.78.4 1.1 1.17 1.08.5 0 .5-.06.5-.06v2.69A8.62 8.62 0 0128.1 26.38z" } }], "name": "logo--livestream", "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="M22.49 23.71h-.76c-2.26 0-4.52 0-6.78 0a3.12 3.12 0 01-2.41-1A14.91 14.91 0 0110 18.88c-1.3-2.6-2.54-5.22-3.82-7.82-.39-.8-.82-1.56-1.28-2.32A7.84 7.84 0 002 5.6c1.24 0 2.41 0 3.57 0a45.63 45.63 0 017 .61 8.09 8.09 0 016.34 5.09 48.51 48.51 0 012.17 7.36A26 26 0 0022.49 23.71zM28.1 26.38a2.93 2.93 0 01-2.74-2.64 42.08 42.08 0 01-.14-4.9 48 48 0 00-.61-7.58 3.75 3.75 0 00-.83-2h2.65c.54 0 .73.37.89.78A12.1 12.1 0 0128 13.28c.29 2.72.31 5.45.33 8.18a10.94 10.94 0 000 1.15c.09.78.4 1.1 1.17 1.08.5 0 .5-.06.5-.06v2.69A8.62 8.62 0 0128.1 26.38z"></path></svg>`
},
};
}
ngAfterViewInit() {
const svg = this.elementRef.nativeElement;
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
const icon = this.icons[this.size];
const domParser = new DOMParser();
const rawSVG = icon.svg;
const svgElement = domParser.parseFromString(rawSVG, "image/svg+xml").documentElement;
let 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;
}
const 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()
});
const attrKeys = Object.keys(attributes);
for (let i = 0; i < attrKeys.length; i++) {
const key = attrKeys[i];
const value = attributes[key];
if (key === "title") {
continue;
}
if (value) {
svg.setAttribute(key, value);
}
}
if (attributes.title) {
const title = document.createElement("title");
title.textContent = attributes.title;
LogoLivestreamDirective_1.titleIdCounter++;
title.setAttribute("id", `logo-livestream-${LogoLivestreamDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `logo-livestream-${LogoLivestreamDirective_1.titleIdCounter}`);
}
}
};
LogoLivestreamDirective.titleIdCounter = 0;
LogoLivestreamDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], LogoLivestreamDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], LogoLivestreamDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], LogoLivestreamDirective.prototype, "size", void 0);
LogoLivestreamDirective = LogoLivestreamDirective_1 = __decorate([
Directive({
selector: "[ibmIconLogoLivestream]"
}),
__metadata("design:paramtypes", [ElementRef])
], LogoLivestreamDirective);
let LogoLivestreamModule = class LogoLivestreamModule {
};
LogoLivestreamModule = __decorate([
NgModule({
declarations: [
LogoLivestreamComponent,
LogoLivestreamDirective,
],
exports: [
LogoLivestreamComponent,
LogoLivestreamDirective,
]
})
], LogoLivestreamModule);
export { LogoLivestreamComponent, LogoLivestreamDirective, LogoLivestreamModule };