UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 15.9 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var ThunderstormScatteredDirective_1; let ThunderstormScatteredComponent = class ThunderstormScatteredComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ThunderstormScatteredComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ThunderstormScatteredComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredComponent.prototype, "size", void 0); ThunderstormScatteredComponent = __decorate([ Component({ selector: "ibm-icon-thunderstorm-scattered", template: ` <svg ibmIconThunderstormScattered [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], ThunderstormScatteredComponent); let ThunderstormScatteredDirective = ThunderstormScatteredDirective_1 = class ThunderstormScatteredDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "ThunderstormScattered32", "filepath": "thunderstorm--scattered/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": "M13.338 30L11.602 29 13.889 25 10 25 13.993 18 15.73 19 13.446 23 17.337 23 13.338 30z" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25V23a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23v2a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11Zm-4.0732,3.4893a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z" } }, { "elem": "path", "attrs": { "d": "M26.732 16.233H29.732V18.233H26.732z", "transform": "rotate(-135 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M29 10H32V12H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M20 0H22V3H20z" } }, { "elem": "path", "attrs": { "d": "M12.268 3.768H15.268V5.768H12.268z", "transform": "rotate(-135 13.768 4.768)" } }], "name": "thunderstorm--scattered", "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="M13.338 30L11.602 29 13.889 25 10 25 13.993 18 15.73 19 13.446 23 17.337 23 13.338 30z"></path><path d="M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25V23a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23v2a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11Zm-4.0732,3.4893a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z"></path><path d="M26.732 16.233H29.732V18.233H26.732z" transform="rotate(-135 28.232 17.233)"></path><path d="M29 10H32V12H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M20 0H22V3H20z"></path><path d="M12.268 3.768H15.268V5.768H12.268z" transform="rotate(-135 13.768 4.768)"></path></svg>` }, "24": { metadata: { "moduleName": "ThunderstormScattered24", "filepath": "thunderstorm--scattered/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": "M13.338 30L11.602 29 13.889 25 10 25 13.993 18 15.73 19 13.446 23 17.337 23 13.338 30z" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25V23a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23v2a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11Zm-4.0732,3.4893a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z" } }, { "elem": "path", "attrs": { "d": "M26.732 16.233H29.732V18.233H26.732z", "transform": "rotate(-135 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M29 10H32V12H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M20 0H22V3H20z" } }, { "elem": "path", "attrs": { "d": "M12.268 3.768H15.268V5.768H12.268z", "transform": "rotate(-135 13.768 4.768)" } }], "name": "thunderstorm--scattered", "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="M13.338 30L11.602 29 13.889 25 10 25 13.993 18 15.73 19 13.446 23 17.337 23 13.338 30z"></path><path d="M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25V23a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23v2a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11Zm-4.0732,3.4893a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z"></path><path d="M26.732 16.233H29.732V18.233H26.732z" transform="rotate(-135 28.232 17.233)"></path><path d="M29 10H32V12H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M20 0H22V3H20z"></path><path d="M12.268 3.768H15.268V5.768H12.268z" transform="rotate(-135 13.768 4.768)"></path></svg>` }, "20": { metadata: { "moduleName": "ThunderstormScattered20", "filepath": "thunderstorm--scattered/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": "M13.338 30L11.602 29 13.889 25 10 25 13.993 18 15.73 19 13.446 23 17.337 23 13.338 30z" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25V23a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23v2a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11Zm-4.0732,3.4893a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z" } }, { "elem": "path", "attrs": { "d": "M26.732 16.233H29.732V18.233H26.732z", "transform": "rotate(-135 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M29 10H32V12H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M20 0H22V3H20z" } }, { "elem": "path", "attrs": { "d": "M12.268 3.768H15.268V5.768H12.268z", "transform": "rotate(-135 13.768 4.768)" } }], "name": "thunderstorm--scattered", "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="M13.338 30L11.602 29 13.889 25 10 25 13.993 18 15.73 19 13.446 23 17.337 23 13.338 30z"></path><path d="M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25V23a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23v2a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11Zm-4.0732,3.4893a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z"></path><path d="M26.732 16.233H29.732V18.233H26.732z" transform="rotate(-135 28.232 17.233)"></path><path d="M29 10H32V12H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M20 0H22V3H20z"></path><path d="M12.268 3.768H15.268V5.768H12.268z" transform="rotate(-135 13.768 4.768)"></path></svg>` }, "16": { metadata: { "moduleName": "ThunderstormScattered16", "filepath": "thunderstorm--scattered/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": "M13.338 30L11.602 29 13.889 25 10 25 13.993 18 15.73 19 13.446 23 17.337 23 13.338 30z" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25V23a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23v2a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11Zm-4.0732,3.4893a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z" } }, { "elem": "path", "attrs": { "d": "M26.732 16.233H29.732V18.233H26.732z", "transform": "rotate(-135 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M29 10H32V12H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M20 0H22V3H20z" } }, { "elem": "path", "attrs": { "d": "M12.268 3.768H15.268V5.768H12.268z", "transform": "rotate(-135 13.768 4.768)" } }], "name": "thunderstorm--scattered", "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="M13.338 30L11.602 29 13.889 25 10 25 13.993 18 15.73 19 13.446 23 17.337 23 13.338 30z"></path><path d="M27,11A5.9955,5.9955,0,0,0,15.6335,8.3311,7.3494,7.3494,0,0,0,13.5,8a7.5509,7.5509,0,0,0-7.1492,5.2441A5.9926,5.9926,0,0,0,8,25V23a3.9925,3.9925,0,0,1-.6731-7.9292L7.99,14.958l.1458-.6562a5.496,5.496,0,0,1,10.7294,0l.1458.6562.6626.1128A3.9925,3.9925,0,0,1,19,23v2a5.9853,5.9853,0,0,0,5.2163-8.9463A5.9941,5.9941,0,0,0,27,11Zm-4.0732,3.4893a5.96,5.96,0,0,0-2.2776-1.2452,7.5157,7.5157,0,0,0-3.1853-4.0688,3.9869,3.9869,0,1,1,5.4629,5.314Z"></path><path d="M26.732 16.233H29.732V18.233H26.732z" transform="rotate(-135 28.232 17.233)"></path><path d="M29 10H32V12H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M20 0H22V3H20z"></path><path d="M12.268 3.768H15.268V5.768H12.268z" transform="rotate(-135 13.768 4.768)"></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; ThunderstormScatteredDirective_1.titleIdCounter++; title.setAttribute("id", `thunderstorm-scattered-${ThunderstormScatteredDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `thunderstorm-scattered-${ThunderstormScatteredDirective_1.titleIdCounter}`); } } }; ThunderstormScatteredDirective.titleIdCounter = 0; ThunderstormScatteredDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ThunderstormScatteredDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ThunderstormScatteredDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ThunderstormScatteredDirective.prototype, "size", void 0); ThunderstormScatteredDirective = ThunderstormScatteredDirective_1 = __decorate([ Directive({ selector: "[ibmIconThunderstormScattered]" }), __metadata("design:paramtypes", [ElementRef]) ], ThunderstormScatteredDirective); let ThunderstormScatteredModule = class ThunderstormScatteredModule { }; ThunderstormScatteredModule = __decorate([ NgModule({ declarations: [ ThunderstormScatteredComponent, ThunderstormScatteredDirective, ], exports: [ ThunderstormScatteredComponent, ThunderstormScatteredDirective, ] }) ], ThunderstormScatteredModule); export { ThunderstormScatteredComponent, ThunderstormScatteredDirective, ThunderstormScatteredModule };