@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 15 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var TemperatureHotDirective_1;
let TemperatureHotComponent = class TemperatureHotComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], TemperatureHotComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], TemperatureHotComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotComponent.prototype, "size", void 0);
TemperatureHotComponent = __decorate([
Component({
selector: "ibm-icon-temperature-hot",
template: `
<svg
ibmIconTemperatureHot
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], TemperatureHotComponent);
let TemperatureHotDirective = TemperatureHotDirective_1 = class TemperatureHotDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "TemperatureHot32", "filepath": "temperature--hot/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": "M24.121 19.121H26.121V23.121H24.121z", "transform": "rotate(-45 25.121 21.121)" } }, { "elem": "path", "attrs": { "d": "M26 13H30V15H26z" } }, { "elem": "path", "attrs": { "d": "M23.121 5.879H27.121V7.879H23.121z", "transform": "rotate(-45 25.121 6.879)" } }, { "elem": "path", "attrs": { "d": "M17 2H19V6H17zM18 8a6.0365 6.0365 0 00-1 .09v2.0518A3.9567 3.9567 0 0118 10a4 4 0 010 8v2A6 6 0 0018 8zM10 20.1839V7H8V20.1839a3 3 0 102 0z" } }, { "elem": "path", "attrs": { "d": "M14,18.1377V7A5,5,0,0,0,4,7V18.1377A6.9894,6.9894,0,1,0,16,23,6.9411,6.9411,0,0,0,14,18.1377ZM9,28a5.0057,5.0057,0,0,1-5-5,4.9164,4.9164,0,0,1,1.0747-3.06c.094-.12.1953-.2329.2993-.3437.0518-.0547.1009-.1113.1548-.1636.11-.1064.2271-.2051.3462-.3013.0425-.0346.0815-.0727.125-.1059V7a3,3,0,0,1,6,0V19.0254c.0437.0332.0828.0718.1255.1064.1189.0962.2361.1944.3454.3008.0542.0523.1038.1094.1556.1641.1037.11.205.2236.2988.3432A4.9146,4.9146,0,0,1,14,23,5.0057,5.0057,0,0,1,9,28Z" } }], "name": "temperature--hot", "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="M24.121 19.121H26.121V23.121H24.121z" transform="rotate(-45 25.121 21.121)"></path><path d="M26 13H30V15H26z"></path><path d="M23.121 5.879H27.121V7.879H23.121z" transform="rotate(-45 25.121 6.879)"></path><path d="M17 2H19V6H17zM18 8a6.0365 6.0365 0 00-1 .09v2.0518A3.9567 3.9567 0 0118 10a4 4 0 010 8v2A6 6 0 0018 8zM10 20.1839V7H8V20.1839a3 3 0 102 0z"></path><path d="M14,18.1377V7A5,5,0,0,0,4,7V18.1377A6.9894,6.9894,0,1,0,16,23,6.9411,6.9411,0,0,0,14,18.1377ZM9,28a5.0057,5.0057,0,0,1-5-5,4.9164,4.9164,0,0,1,1.0747-3.06c.094-.12.1953-.2329.2993-.3437.0518-.0547.1009-.1113.1548-.1636.11-.1064.2271-.2051.3462-.3013.0425-.0346.0815-.0727.125-.1059V7a3,3,0,0,1,6,0V19.0254c.0437.0332.0828.0718.1255.1064.1189.0962.2361.1944.3454.3008.0542.0523.1038.1094.1556.1641.1037.11.205.2236.2988.3432A4.9146,4.9146,0,0,1,14,23,5.0057,5.0057,0,0,1,9,28Z"></path></svg>`
},
"24": {
metadata: { "moduleName": "TemperatureHot24", "filepath": "temperature--hot/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": "M24.121 19.121H26.121V23.121H24.121z", "transform": "rotate(-45 25.121 21.121)" } }, { "elem": "path", "attrs": { "d": "M26 13H30V15H26z" } }, { "elem": "path", "attrs": { "d": "M23.121 5.879H27.121V7.879H23.121z", "transform": "rotate(-45 25.121 6.879)" } }, { "elem": "path", "attrs": { "d": "M17 2H19V6H17zM18 8a6.0365 6.0365 0 00-1 .09v2.0518A3.9567 3.9567 0 0118 10a4 4 0 010 8v2A6 6 0 0018 8zM10 20.1839V7H8V20.1839a3 3 0 102 0z" } }, { "elem": "path", "attrs": { "d": "M14,18.1377V7A5,5,0,0,0,4,7V18.1377A6.9894,6.9894,0,1,0,16,23,6.9411,6.9411,0,0,0,14,18.1377ZM9,28a5.0057,5.0057,0,0,1-5-5,4.9164,4.9164,0,0,1,1.0747-3.06c.094-.12.1953-.2329.2993-.3437.0518-.0547.1009-.1113.1548-.1636.11-.1064.2271-.2051.3462-.3013.0425-.0346.0815-.0727.125-.1059V7a3,3,0,0,1,6,0V19.0254c.0437.0332.0828.0718.1255.1064.1189.0962.2361.1944.3454.3008.0542.0523.1038.1094.1556.1641.1037.11.205.2236.2988.3432A4.9146,4.9146,0,0,1,14,23,5.0057,5.0057,0,0,1,9,28Z" } }], "name": "temperature--hot", "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="M24.121 19.121H26.121V23.121H24.121z" transform="rotate(-45 25.121 21.121)"></path><path d="M26 13H30V15H26z"></path><path d="M23.121 5.879H27.121V7.879H23.121z" transform="rotate(-45 25.121 6.879)"></path><path d="M17 2H19V6H17zM18 8a6.0365 6.0365 0 00-1 .09v2.0518A3.9567 3.9567 0 0118 10a4 4 0 010 8v2A6 6 0 0018 8zM10 20.1839V7H8V20.1839a3 3 0 102 0z"></path><path d="M14,18.1377V7A5,5,0,0,0,4,7V18.1377A6.9894,6.9894,0,1,0,16,23,6.9411,6.9411,0,0,0,14,18.1377ZM9,28a5.0057,5.0057,0,0,1-5-5,4.9164,4.9164,0,0,1,1.0747-3.06c.094-.12.1953-.2329.2993-.3437.0518-.0547.1009-.1113.1548-.1636.11-.1064.2271-.2051.3462-.3013.0425-.0346.0815-.0727.125-.1059V7a3,3,0,0,1,6,0V19.0254c.0437.0332.0828.0718.1255.1064.1189.0962.2361.1944.3454.3008.0542.0523.1038.1094.1556.1641.1037.11.205.2236.2988.3432A4.9146,4.9146,0,0,1,14,23,5.0057,5.0057,0,0,1,9,28Z"></path></svg>`
},
"20": {
metadata: { "moduleName": "TemperatureHot20", "filepath": "temperature--hot/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": "M24.121 19.121H26.121V23.121H24.121z", "transform": "rotate(-45 25.121 21.121)" } }, { "elem": "path", "attrs": { "d": "M26 13H30V15H26z" } }, { "elem": "path", "attrs": { "d": "M23.121 5.879H27.121V7.879H23.121z", "transform": "rotate(-45 25.121 6.879)" } }, { "elem": "path", "attrs": { "d": "M17 2H19V6H17zM18 8a6.0365 6.0365 0 00-1 .09v2.0518A3.9567 3.9567 0 0118 10a4 4 0 010 8v2A6 6 0 0018 8zM10 20.1839V7H8V20.1839a3 3 0 102 0z" } }, { "elem": "path", "attrs": { "d": "M14,18.1377V7A5,5,0,0,0,4,7V18.1377A6.9894,6.9894,0,1,0,16,23,6.9411,6.9411,0,0,0,14,18.1377ZM9,28a5.0057,5.0057,0,0,1-5-5,4.9164,4.9164,0,0,1,1.0747-3.06c.094-.12.1953-.2329.2993-.3437.0518-.0547.1009-.1113.1548-.1636.11-.1064.2271-.2051.3462-.3013.0425-.0346.0815-.0727.125-.1059V7a3,3,0,0,1,6,0V19.0254c.0437.0332.0828.0718.1255.1064.1189.0962.2361.1944.3454.3008.0542.0523.1038.1094.1556.1641.1037.11.205.2236.2988.3432A4.9146,4.9146,0,0,1,14,23,5.0057,5.0057,0,0,1,9,28Z" } }], "name": "temperature--hot", "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="M24.121 19.121H26.121V23.121H24.121z" transform="rotate(-45 25.121 21.121)"></path><path d="M26 13H30V15H26z"></path><path d="M23.121 5.879H27.121V7.879H23.121z" transform="rotate(-45 25.121 6.879)"></path><path d="M17 2H19V6H17zM18 8a6.0365 6.0365 0 00-1 .09v2.0518A3.9567 3.9567 0 0118 10a4 4 0 010 8v2A6 6 0 0018 8zM10 20.1839V7H8V20.1839a3 3 0 102 0z"></path><path d="M14,18.1377V7A5,5,0,0,0,4,7V18.1377A6.9894,6.9894,0,1,0,16,23,6.9411,6.9411,0,0,0,14,18.1377ZM9,28a5.0057,5.0057,0,0,1-5-5,4.9164,4.9164,0,0,1,1.0747-3.06c.094-.12.1953-.2329.2993-.3437.0518-.0547.1009-.1113.1548-.1636.11-.1064.2271-.2051.3462-.3013.0425-.0346.0815-.0727.125-.1059V7a3,3,0,0,1,6,0V19.0254c.0437.0332.0828.0718.1255.1064.1189.0962.2361.1944.3454.3008.0542.0523.1038.1094.1556.1641.1037.11.205.2236.2988.3432A4.9146,4.9146,0,0,1,14,23,5.0057,5.0057,0,0,1,9,28Z"></path></svg>`
},
"16": {
metadata: { "moduleName": "TemperatureHot16", "filepath": "temperature--hot/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": "M24.121 19.121H26.121V23.121H24.121z", "transform": "rotate(-45 25.121 21.121)" } }, { "elem": "path", "attrs": { "d": "M26 13H30V15H26z" } }, { "elem": "path", "attrs": { "d": "M23.121 5.879H27.121V7.879H23.121z", "transform": "rotate(-45 25.121 6.879)" } }, { "elem": "path", "attrs": { "d": "M17 2H19V6H17zM18 8a6.0365 6.0365 0 00-1 .09v2.0518A3.9567 3.9567 0 0118 10a4 4 0 010 8v2A6 6 0 0018 8zM10 20.1839V7H8V20.1839a3 3 0 102 0z" } }, { "elem": "path", "attrs": { "d": "M14,18.1377V7A5,5,0,0,0,4,7V18.1377A6.9894,6.9894,0,1,0,16,23,6.9411,6.9411,0,0,0,14,18.1377ZM9,28a5.0057,5.0057,0,0,1-5-5,4.9164,4.9164,0,0,1,1.0747-3.06c.094-.12.1953-.2329.2993-.3437.0518-.0547.1009-.1113.1548-.1636.11-.1064.2271-.2051.3462-.3013.0425-.0346.0815-.0727.125-.1059V7a3,3,0,0,1,6,0V19.0254c.0437.0332.0828.0718.1255.1064.1189.0962.2361.1944.3454.3008.0542.0523.1038.1094.1556.1641.1037.11.205.2236.2988.3432A4.9146,4.9146,0,0,1,14,23,5.0057,5.0057,0,0,1,9,28Z" } }], "name": "temperature--hot", "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="M24.121 19.121H26.121V23.121H24.121z" transform="rotate(-45 25.121 21.121)"></path><path d="M26 13H30V15H26z"></path><path d="M23.121 5.879H27.121V7.879H23.121z" transform="rotate(-45 25.121 6.879)"></path><path d="M17 2H19V6H17zM18 8a6.0365 6.0365 0 00-1 .09v2.0518A3.9567 3.9567 0 0118 10a4 4 0 010 8v2A6 6 0 0018 8zM10 20.1839V7H8V20.1839a3 3 0 102 0z"></path><path d="M14,18.1377V7A5,5,0,0,0,4,7V18.1377A6.9894,6.9894,0,1,0,16,23,6.9411,6.9411,0,0,0,14,18.1377ZM9,28a5.0057,5.0057,0,0,1-5-5,4.9164,4.9164,0,0,1,1.0747-3.06c.094-.12.1953-.2329.2993-.3437.0518-.0547.1009-.1113.1548-.1636.11-.1064.2271-.2051.3462-.3013.0425-.0346.0815-.0727.125-.1059V7a3,3,0,0,1,6,0V19.0254c.0437.0332.0828.0718.1255.1064.1189.0962.2361.1944.3454.3008.0542.0523.1038.1094.1556.1641.1037.11.205.2236.2988.3432A4.9146,4.9146,0,0,1,14,23,5.0057,5.0057,0,0,1,9,28Z"></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;
TemperatureHotDirective_1.titleIdCounter++;
title.setAttribute("id", `temperature-hot-${TemperatureHotDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `temperature-hot-${TemperatureHotDirective_1.titleIdCounter}`);
}
}
};
TemperatureHotDirective.titleIdCounter = 0;
TemperatureHotDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], TemperatureHotDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], TemperatureHotDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], TemperatureHotDirective.prototype, "size", void 0);
TemperatureHotDirective = TemperatureHotDirective_1 = __decorate([
Directive({
selector: "[ibmIconTemperatureHot]"
}),
__metadata("design:paramtypes", [ElementRef])
], TemperatureHotDirective);
let TemperatureHotModule = class TemperatureHotModule {
};
TemperatureHotModule = __decorate([
NgModule({
declarations: [
TemperatureHotComponent,
TemperatureHotDirective,
],
exports: [
TemperatureHotComponent,
TemperatureHotDirective,
]
})
], TemperatureHotModule);
export { TemperatureHotComponent, TemperatureHotDirective, TemperatureHotModule };