UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 15.7 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var ThunderstormSevereDirective_1; let ThunderstormSevereComponent = class ThunderstormSevereComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ThunderstormSevereComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ThunderstormSevereComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereComponent.prototype, "size", void 0); ThunderstormSevereComponent = __decorate([ Component({ selector: "ibm-icon-thunderstorm-severe", template: ` <svg ibmIconThunderstormSevere [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], ThunderstormSevereComponent); let ThunderstormSevereDirective = ThunderstormSevereDirective_1 = class ThunderstormSevereDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "ThunderstormSevere32", "filepath": "thunderstorm--severe/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": "M21 30a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 0121 30zM9 32a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 019 32zM15.901 30.496L14.165 29.504 17.309 24 11.31 24 16.165 15.504 17.901 16.496 14.756 22 20.757 22 15.901 30.496zM27.9516 15A4.399 4.399 0 0128 15.5 4.5049 4.5049 0 0123.5 20H23v2h.5A6.5075 6.5075 0 0030 15.5c0-.17-.0312-.333-.0444-.5z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M25.75,8h-1.5V4h1.5ZM25,9a1,1,0,1,0,1,1A1,1,0,0,0,25,9Z" } }, { "elem": "path", "attrs": { "d": "M31.9115 11.9355L25.6283.3706a.7181.7181 0 00-1.2568 0L18.0883 11.9355A.72.72 0 0018.72 13H31.28A.72.72 0 0031.9115 11.9355zM24.25 4h1.5V8h-1.5zM25 11a1 1 0 111-1A1 1 0 0125 11zM8.144 11.019l.8154-.0639.0991-.812a6.9863 6.9863 0 019.97-5.45L20 2.9468A8.9777 8.9777 0 007.2 9.1362 6.4929 6.4929 0 007.43 21.9043L6.1059 24.5527a1 1 0 101.7885.8946l2-4a1 1 0 00-.4471-1.3418A.9786.9786 0 009 20.01V20H8.5a4.4975 4.4975 0 01-.3559-8.981z" } }], "name": "thunderstorm--severe", "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="M21 30a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 0121 30zM9 32a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 019 32zM15.901 30.496L14.165 29.504 17.309 24 11.31 24 16.165 15.504 17.901 16.496 14.756 22 20.757 22 15.901 30.496zM27.9516 15A4.399 4.399 0 0128 15.5 4.5049 4.5049 0 0123.5 20H23v2h.5A6.5075 6.5075 0 0030 15.5c0-.17-.0312-.333-.0444-.5z"></path><path fill="none" d="M25.75,8h-1.5V4h1.5ZM25,9a1,1,0,1,0,1,1A1,1,0,0,0,25,9Z"></path><path d="M31.9115 11.9355L25.6283.3706a.7181.7181 0 00-1.2568 0L18.0883 11.9355A.72.72 0 0018.72 13H31.28A.72.72 0 0031.9115 11.9355zM24.25 4h1.5V8h-1.5zM25 11a1 1 0 111-1A1 1 0 0125 11zM8.144 11.019l.8154-.0639.0991-.812a6.9863 6.9863 0 019.97-5.45L20 2.9468A8.9777 8.9777 0 007.2 9.1362 6.4929 6.4929 0 007.43 21.9043L6.1059 24.5527a1 1 0 101.7885.8946l2-4a1 1 0 00-.4471-1.3418A.9786.9786 0 009 20.01V20H8.5a4.4975 4.4975 0 01-.3559-8.981z"></path></svg>` }, "24": { metadata: { "moduleName": "ThunderstormSevere24", "filepath": "thunderstorm--severe/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": "M21 30a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 0121 30zM9 32a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 019 32zM15.901 30.496L14.165 29.504 17.309 24 11.31 24 16.165 15.504 17.901 16.496 14.756 22 20.757 22 15.901 30.496zM27.9516 15A4.399 4.399 0 0128 15.5 4.5049 4.5049 0 0123.5 20H23v2h.5A6.5075 6.5075 0 0030 15.5c0-.17-.0312-.333-.0444-.5z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M25.75,8h-1.5V4h1.5ZM25,9a1,1,0,1,0,1,1A1,1,0,0,0,25,9Z" } }, { "elem": "path", "attrs": { "d": "M31.9115 11.9355L25.6283.3706a.7181.7181 0 00-1.2568 0L18.0883 11.9355A.72.72 0 0018.72 13H31.28A.72.72 0 0031.9115 11.9355zM24.25 4h1.5V8h-1.5zM25 11a1 1 0 111-1A1 1 0 0125 11zM8.144 11.019l.8154-.0639.0991-.812a6.9863 6.9863 0 019.97-5.45L20 2.9468A8.9777 8.9777 0 007.2 9.1362 6.4929 6.4929 0 007.43 21.9043L6.1059 24.5527a1 1 0 101.7885.8946l2-4a1 1 0 00-.4471-1.3418A.9786.9786 0 009 20.01V20H8.5a4.4975 4.4975 0 01-.3559-8.981z" } }], "name": "thunderstorm--severe", "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="M21 30a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 0121 30zM9 32a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 019 32zM15.901 30.496L14.165 29.504 17.309 24 11.31 24 16.165 15.504 17.901 16.496 14.756 22 20.757 22 15.901 30.496zM27.9516 15A4.399 4.399 0 0128 15.5 4.5049 4.5049 0 0123.5 20H23v2h.5A6.5075 6.5075 0 0030 15.5c0-.17-.0312-.333-.0444-.5z"></path><path fill="none" d="M25.75,8h-1.5V4h1.5ZM25,9a1,1,0,1,0,1,1A1,1,0,0,0,25,9Z"></path><path d="M31.9115 11.9355L25.6283.3706a.7181.7181 0 00-1.2568 0L18.0883 11.9355A.72.72 0 0018.72 13H31.28A.72.72 0 0031.9115 11.9355zM24.25 4h1.5V8h-1.5zM25 11a1 1 0 111-1A1 1 0 0125 11zM8.144 11.019l.8154-.0639.0991-.812a6.9863 6.9863 0 019.97-5.45L20 2.9468A8.9777 8.9777 0 007.2 9.1362 6.4929 6.4929 0 007.43 21.9043L6.1059 24.5527a1 1 0 101.7885.8946l2-4a1 1 0 00-.4471-1.3418A.9786.9786 0 009 20.01V20H8.5a4.4975 4.4975 0 01-.3559-8.981z"></path></svg>` }, "20": { metadata: { "moduleName": "ThunderstormSevere20", "filepath": "thunderstorm--severe/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": "M21 30a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 0121 30zM9 32a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 019 32zM15.901 30.496L14.165 29.504 17.309 24 11.31 24 16.165 15.504 17.901 16.496 14.756 22 20.757 22 15.901 30.496zM27.9516 15A4.399 4.399 0 0128 15.5 4.5049 4.5049 0 0123.5 20H23v2h.5A6.5075 6.5075 0 0030 15.5c0-.17-.0312-.333-.0444-.5z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M25.75,8h-1.5V4h1.5ZM25,9a1,1,0,1,0,1,1A1,1,0,0,0,25,9Z" } }, { "elem": "path", "attrs": { "d": "M31.9115 11.9355L25.6283.3706a.7181.7181 0 00-1.2568 0L18.0883 11.9355A.72.72 0 0018.72 13H31.28A.72.72 0 0031.9115 11.9355zM24.25 4h1.5V8h-1.5zM25 11a1 1 0 111-1A1 1 0 0125 11zM8.144 11.019l.8154-.0639.0991-.812a6.9863 6.9863 0 019.97-5.45L20 2.9468A8.9777 8.9777 0 007.2 9.1362 6.4929 6.4929 0 007.43 21.9043L6.1059 24.5527a1 1 0 101.7885.8946l2-4a1 1 0 00-.4471-1.3418A.9786.9786 0 009 20.01V20H8.5a4.4975 4.4975 0 01-.3559-8.981z" } }], "name": "thunderstorm--severe", "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="M21 30a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 0121 30zM9 32a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 019 32zM15.901 30.496L14.165 29.504 17.309 24 11.31 24 16.165 15.504 17.901 16.496 14.756 22 20.757 22 15.901 30.496zM27.9516 15A4.399 4.399 0 0128 15.5 4.5049 4.5049 0 0123.5 20H23v2h.5A6.5075 6.5075 0 0030 15.5c0-.17-.0312-.333-.0444-.5z"></path><path fill="none" d="M25.75,8h-1.5V4h1.5ZM25,9a1,1,0,1,0,1,1A1,1,0,0,0,25,9Z"></path><path d="M31.9115 11.9355L25.6283.3706a.7181.7181 0 00-1.2568 0L18.0883 11.9355A.72.72 0 0018.72 13H31.28A.72.72 0 0031.9115 11.9355zM24.25 4h1.5V8h-1.5zM25 11a1 1 0 111-1A1 1 0 0125 11zM8.144 11.019l.8154-.0639.0991-.812a6.9863 6.9863 0 019.97-5.45L20 2.9468A8.9777 8.9777 0 007.2 9.1362 6.4929 6.4929 0 007.43 21.9043L6.1059 24.5527a1 1 0 101.7885.8946l2-4a1 1 0 00-.4471-1.3418A.9786.9786 0 009 20.01V20H8.5a4.4975 4.4975 0 01-.3559-8.981z"></path></svg>` }, "16": { metadata: { "moduleName": "ThunderstormSevere16", "filepath": "thunderstorm--severe/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": "M21 30a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 0121 30zM9 32a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 019 32zM15.901 30.496L14.165 29.504 17.309 24 11.31 24 16.165 15.504 17.901 16.496 14.756 22 20.757 22 15.901 30.496zM27.9516 15A4.399 4.399 0 0128 15.5 4.5049 4.5049 0 0123.5 20H23v2h.5A6.5075 6.5075 0 0030 15.5c0-.17-.0312-.333-.0444-.5z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M25.75,8h-1.5V4h1.5ZM25,9a1,1,0,1,0,1,1A1,1,0,0,0,25,9Z" } }, { "elem": "path", "attrs": { "d": "M31.9115 11.9355L25.6283.3706a.7181.7181 0 00-1.2568 0L18.0883 11.9355A.72.72 0 0018.72 13H31.28A.72.72 0 0031.9115 11.9355zM24.25 4h1.5V8h-1.5zM25 11a1 1 0 111-1A1 1 0 0125 11zM8.144 11.019l.8154-.0639.0991-.812a6.9863 6.9863 0 019.97-5.45L20 2.9468A8.9777 8.9777 0 007.2 9.1362 6.4929 6.4929 0 007.43 21.9043L6.1059 24.5527a1 1 0 101.7885.8946l2-4a1 1 0 00-.4471-1.3418A.9786.9786 0 009 20.01V20H8.5a4.4975 4.4975 0 01-.3559-8.981z" } }], "name": "thunderstorm--severe", "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="M21 30a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 0121 30zM9 32a1 1 0 01-.8944-1.4474l2-4.0005a1 1 0 111.7887.8947l-2 4A.9981.9981 0 019 32zM15.901 30.496L14.165 29.504 17.309 24 11.31 24 16.165 15.504 17.901 16.496 14.756 22 20.757 22 15.901 30.496zM27.9516 15A4.399 4.399 0 0128 15.5 4.5049 4.5049 0 0123.5 20H23v2h.5A6.5075 6.5075 0 0030 15.5c0-.17-.0312-.333-.0444-.5z"></path><path fill="none" d="M25.75,8h-1.5V4h1.5ZM25,9a1,1,0,1,0,1,1A1,1,0,0,0,25,9Z"></path><path d="M31.9115 11.9355L25.6283.3706a.7181.7181 0 00-1.2568 0L18.0883 11.9355A.72.72 0 0018.72 13H31.28A.72.72 0 0031.9115 11.9355zM24.25 4h1.5V8h-1.5zM25 11a1 1 0 111-1A1 1 0 0125 11zM8.144 11.019l.8154-.0639.0991-.812a6.9863 6.9863 0 019.97-5.45L20 2.9468A8.9777 8.9777 0 007.2 9.1362 6.4929 6.4929 0 007.43 21.9043L6.1059 24.5527a1 1 0 101.7885.8946l2-4a1 1 0 00-.4471-1.3418A.9786.9786 0 009 20.01V20H8.5a4.4975 4.4975 0 01-.3559-8.981z"></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; ThunderstormSevereDirective_1.titleIdCounter++; title.setAttribute("id", `thunderstorm-severe-${ThunderstormSevereDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `thunderstorm-severe-${ThunderstormSevereDirective_1.titleIdCounter}`); } } }; ThunderstormSevereDirective.titleIdCounter = 0; ThunderstormSevereDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ThunderstormSevereDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ThunderstormSevereDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormSevereDirective.prototype, "size", void 0); ThunderstormSevereDirective = ThunderstormSevereDirective_1 = __decorate([ Directive({ selector: "[ibmIconThunderstormSevere]" }), __metadata("design:paramtypes", [ElementRef]) ], ThunderstormSevereDirective); let ThunderstormSevereModule = class ThunderstormSevereModule { }; ThunderstormSevereModule = __decorate([ NgModule({ declarations: [ ThunderstormSevereComponent, ThunderstormSevereDirective, ], exports: [ ThunderstormSevereComponent, ThunderstormSevereDirective, ] }) ], ThunderstormSevereModule); export { ThunderstormSevereComponent, ThunderstormSevereDirective, ThunderstormSevereModule };