UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 16.2 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var SnowScatteredDirective_1; let SnowScatteredComponent = class SnowScatteredComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], SnowScatteredComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], SnowScatteredComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredComponent.prototype, "size", void 0); SnowScatteredComponent = __decorate([ Component({ selector: "ibm-icon-snow-scattered", template: ` <svg ibmIconSnowScattered [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], SnowScatteredComponent); let SnowScatteredDirective = SnowScatteredDirective_1 = class SnowScatteredDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "SnowScattered32", "filepath": "snow--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": "M2 26H4V28H2zM4 28H6V30H4zM6 30H8V32H6zM6 26H8V28H6zM2 30H4V32H2zM20 26H22V28H20zM22 28H24V30H22zM24 30H26V32H24zM24 26H26V28H24zM20 30H22V32H20zM11 26H13V28H11zM13 28H15V30H13zM15 30H17V32H15zM15 26H17V28H15zM11 30H13V32H11zM20 0H22V3H20zM29 10.001H32V12.001H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M26.732 16.233H29.732V18.233H26.732z", "transform": "rotate(-135 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M12.268 3.768H15.268V5.768H12.268z", "transform": "rotate(-135 13.768 4.768)" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9852,5.9852,0,0,0,16.1431,7.5083,7.3737,7.3737,0,0,0,13.5,7a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,24H19a5.9672,5.9672,0,0,0,5.5667-8.2A5.9722,5.9722,0,0,0,27,11ZM19,22H8a3.9926,3.9926,0,0,1-.6733-7.9292l.663-.1128.1456-.6562a5.496,5.496,0,0,1,10.7294,0l.1456.6562.6626.1128A3.9925,3.9925,0,0,1,19,22Zm4.5222-7.9131a5.9592,5.9592,0,0,0-2.8728-1.8428,7.5212,7.5212,0,0,0-2.7224-3.78,3.9869,3.9869,0,1,1,5.5952,5.6225Z" } }], "name": "snow--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="M2 26H4V28H2zM4 28H6V30H4zM6 30H8V32H6zM6 26H8V28H6zM2 30H4V32H2zM20 26H22V28H20zM22 28H24V30H22zM24 30H26V32H24zM24 26H26V28H24zM20 30H22V32H20zM11 26H13V28H11zM13 28H15V30H13zM15 30H17V32H15zM15 26H17V28H15zM11 30H13V32H11zM20 0H22V3H20zM29 10.001H32V12.001H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M26.732 16.233H29.732V18.233H26.732z" transform="rotate(-135 28.232 17.233)"></path><path d="M12.268 3.768H15.268V5.768H12.268z" transform="rotate(-135 13.768 4.768)"></path><path d="M27,11A5.9852,5.9852,0,0,0,16.1431,7.5083,7.3737,7.3737,0,0,0,13.5,7a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,24H19a5.9672,5.9672,0,0,0,5.5667-8.2A5.9722,5.9722,0,0,0,27,11ZM19,22H8a3.9926,3.9926,0,0,1-.6733-7.9292l.663-.1128.1456-.6562a5.496,5.496,0,0,1,10.7294,0l.1456.6562.6626.1128A3.9925,3.9925,0,0,1,19,22Zm4.5222-7.9131a5.9592,5.9592,0,0,0-2.8728-1.8428,7.5212,7.5212,0,0,0-2.7224-3.78,3.9869,3.9869,0,1,1,5.5952,5.6225Z"></path></svg>` }, "24": { metadata: { "moduleName": "SnowScattered24", "filepath": "snow--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": "M2 26H4V28H2zM4 28H6V30H4zM6 30H8V32H6zM6 26H8V28H6zM2 30H4V32H2zM20 26H22V28H20zM22 28H24V30H22zM24 30H26V32H24zM24 26H26V28H24zM20 30H22V32H20zM11 26H13V28H11zM13 28H15V30H13zM15 30H17V32H15zM15 26H17V28H15zM11 30H13V32H11zM20 0H22V3H20zM29 10.001H32V12.001H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M26.732 16.233H29.732V18.233H26.732z", "transform": "rotate(-135 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M12.268 3.768H15.268V5.768H12.268z", "transform": "rotate(-135 13.768 4.768)" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9852,5.9852,0,0,0,16.1431,7.5083,7.3737,7.3737,0,0,0,13.5,7a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,24H19a5.9672,5.9672,0,0,0,5.5667-8.2A5.9722,5.9722,0,0,0,27,11ZM19,22H8a3.9926,3.9926,0,0,1-.6733-7.9292l.663-.1128.1456-.6562a5.496,5.496,0,0,1,10.7294,0l.1456.6562.6626.1128A3.9925,3.9925,0,0,1,19,22Zm4.5222-7.9131a5.9592,5.9592,0,0,0-2.8728-1.8428,7.5212,7.5212,0,0,0-2.7224-3.78,3.9869,3.9869,0,1,1,5.5952,5.6225Z" } }], "name": "snow--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="M2 26H4V28H2zM4 28H6V30H4zM6 30H8V32H6zM6 26H8V28H6zM2 30H4V32H2zM20 26H22V28H20zM22 28H24V30H22zM24 30H26V32H24zM24 26H26V28H24zM20 30H22V32H20zM11 26H13V28H11zM13 28H15V30H13zM15 30H17V32H15zM15 26H17V28H15zM11 30H13V32H11zM20 0H22V3H20zM29 10.001H32V12.001H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M26.732 16.233H29.732V18.233H26.732z" transform="rotate(-135 28.232 17.233)"></path><path d="M12.268 3.768H15.268V5.768H12.268z" transform="rotate(-135 13.768 4.768)"></path><path d="M27,11A5.9852,5.9852,0,0,0,16.1431,7.5083,7.3737,7.3737,0,0,0,13.5,7a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,24H19a5.9672,5.9672,0,0,0,5.5667-8.2A5.9722,5.9722,0,0,0,27,11ZM19,22H8a3.9926,3.9926,0,0,1-.6733-7.9292l.663-.1128.1456-.6562a5.496,5.496,0,0,1,10.7294,0l.1456.6562.6626.1128A3.9925,3.9925,0,0,1,19,22Zm4.5222-7.9131a5.9592,5.9592,0,0,0-2.8728-1.8428,7.5212,7.5212,0,0,0-2.7224-3.78,3.9869,3.9869,0,1,1,5.5952,5.6225Z"></path></svg>` }, "20": { metadata: { "moduleName": "SnowScattered20", "filepath": "snow--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": "M2 26H4V28H2zM4 28H6V30H4zM6 30H8V32H6zM6 26H8V28H6zM2 30H4V32H2zM20 26H22V28H20zM22 28H24V30H22zM24 30H26V32H24zM24 26H26V28H24zM20 30H22V32H20zM11 26H13V28H11zM13 28H15V30H13zM15 30H17V32H15zM15 26H17V28H15zM11 30H13V32H11zM20 0H22V3H20zM29 10.001H32V12.001H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M26.732 16.233H29.732V18.233H26.732z", "transform": "rotate(-135 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M12.268 3.768H15.268V5.768H12.268z", "transform": "rotate(-135 13.768 4.768)" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9852,5.9852,0,0,0,16.1431,7.5083,7.3737,7.3737,0,0,0,13.5,7a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,24H19a5.9672,5.9672,0,0,0,5.5667-8.2A5.9722,5.9722,0,0,0,27,11ZM19,22H8a3.9926,3.9926,0,0,1-.6733-7.9292l.663-.1128.1456-.6562a5.496,5.496,0,0,1,10.7294,0l.1456.6562.6626.1128A3.9925,3.9925,0,0,1,19,22Zm4.5222-7.9131a5.9592,5.9592,0,0,0-2.8728-1.8428,7.5212,7.5212,0,0,0-2.7224-3.78,3.9869,3.9869,0,1,1,5.5952,5.6225Z" } }], "name": "snow--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="M2 26H4V28H2zM4 28H6V30H4zM6 30H8V32H6zM6 26H8V28H6zM2 30H4V32H2zM20 26H22V28H20zM22 28H24V30H22zM24 30H26V32H24zM24 26H26V28H24zM20 30H22V32H20zM11 26H13V28H11zM13 28H15V30H13zM15 30H17V32H15zM15 26H17V28H15zM11 30H13V32H11zM20 0H22V3H20zM29 10.001H32V12.001H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M26.732 16.233H29.732V18.233H26.732z" transform="rotate(-135 28.232 17.233)"></path><path d="M12.268 3.768H15.268V5.768H12.268z" transform="rotate(-135 13.768 4.768)"></path><path d="M27,11A5.9852,5.9852,0,0,0,16.1431,7.5083,7.3737,7.3737,0,0,0,13.5,7a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,24H19a5.9672,5.9672,0,0,0,5.5667-8.2A5.9722,5.9722,0,0,0,27,11ZM19,22H8a3.9926,3.9926,0,0,1-.6733-7.9292l.663-.1128.1456-.6562a5.496,5.496,0,0,1,10.7294,0l.1456.6562.6626.1128A3.9925,3.9925,0,0,1,19,22Zm4.5222-7.9131a5.9592,5.9592,0,0,0-2.8728-1.8428,7.5212,7.5212,0,0,0-2.7224-3.78,3.9869,3.9869,0,1,1,5.5952,5.6225Z"></path></svg>` }, "16": { metadata: { "moduleName": "SnowScattered16", "filepath": "snow--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": "M2 26H4V28H2zM4 28H6V30H4zM6 30H8V32H6zM6 26H8V28H6zM2 30H4V32H2zM20 26H22V28H20zM22 28H24V30H22zM24 30H26V32H24zM24 26H26V28H24zM20 30H22V32H20zM11 26H13V28H11zM13 28H15V30H13zM15 30H17V32H15zM15 26H17V28H15zM11 30H13V32H11zM20 0H22V3H20zM29 10.001H32V12.001H29z" } }, { "elem": "path", "attrs": { "d": "M26.732 3.768H29.732V5.768H26.732z", "transform": "rotate(-45 28.232 4.768)" } }, { "elem": "path", "attrs": { "d": "M26.732 16.233H29.732V18.233H26.732z", "transform": "rotate(-135 28.232 17.233)" } }, { "elem": "path", "attrs": { "d": "M12.268 3.768H15.268V5.768H12.268z", "transform": "rotate(-135 13.768 4.768)" } }, { "elem": "path", "attrs": { "d": "M27,11A5.9852,5.9852,0,0,0,16.1431,7.5083,7.3737,7.3737,0,0,0,13.5,7a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,24H19a5.9672,5.9672,0,0,0,5.5667-8.2A5.9722,5.9722,0,0,0,27,11ZM19,22H8a3.9926,3.9926,0,0,1-.6733-7.9292l.663-.1128.1456-.6562a5.496,5.496,0,0,1,10.7294,0l.1456.6562.6626.1128A3.9925,3.9925,0,0,1,19,22Zm4.5222-7.9131a5.9592,5.9592,0,0,0-2.8728-1.8428,7.5212,7.5212,0,0,0-2.7224-3.78,3.9869,3.9869,0,1,1,5.5952,5.6225Z" } }], "name": "snow--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="M2 26H4V28H2zM4 28H6V30H4zM6 30H8V32H6zM6 26H8V28H6zM2 30H4V32H2zM20 26H22V28H20zM22 28H24V30H22zM24 30H26V32H24zM24 26H26V28H24zM20 30H22V32H20zM11 26H13V28H11zM13 28H15V30H13zM15 30H17V32H15zM15 26H17V28H15zM11 30H13V32H11zM20 0H22V3H20zM29 10.001H32V12.001H29z"></path><path d="M26.732 3.768H29.732V5.768H26.732z" transform="rotate(-45 28.232 4.768)"></path><path d="M26.732 16.233H29.732V18.233H26.732z" transform="rotate(-135 28.232 17.233)"></path><path d="M12.268 3.768H15.268V5.768H12.268z" transform="rotate(-135 13.768 4.768)"></path><path d="M27,11A5.9852,5.9852,0,0,0,16.1431,7.5083,7.3737,7.3737,0,0,0,13.5,7a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,24H19a5.9672,5.9672,0,0,0,5.5667-8.2A5.9722,5.9722,0,0,0,27,11ZM19,22H8a3.9926,3.9926,0,0,1-.6733-7.9292l.663-.1128.1456-.6562a5.496,5.496,0,0,1,10.7294,0l.1456.6562.6626.1128A3.9925,3.9925,0,0,1,19,22Zm4.5222-7.9131a5.9592,5.9592,0,0,0-2.8728-1.8428,7.5212,7.5212,0,0,0-2.7224-3.78,3.9869,3.9869,0,1,1,5.5952,5.6225Z"></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; SnowScatteredDirective_1.titleIdCounter++; title.setAttribute("id", `snow-scattered-${SnowScatteredDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `snow-scattered-${SnowScatteredDirective_1.titleIdCounter}`); } } }; SnowScatteredDirective.titleIdCounter = 0; SnowScatteredDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], SnowScatteredDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], SnowScatteredDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], SnowScatteredDirective.prototype, "size", void 0); SnowScatteredDirective = SnowScatteredDirective_1 = __decorate([ Directive({ selector: "[ibmIconSnowScattered]" }), __metadata("design:paramtypes", [ElementRef]) ], SnowScatteredDirective); let SnowScatteredModule = class SnowScatteredModule { }; SnowScatteredModule = __decorate([ NgModule({ declarations: [ SnowScatteredComponent, SnowScatteredDirective, ], exports: [ SnowScatteredComponent, SnowScatteredDirective, ] }) ], SnowScatteredModule); export { SnowScatteredComponent, SnowScatteredDirective, SnowScatteredModule };