UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 14.5 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var MostlyCloudyNightDirective_1; let MostlyCloudyNightComponent = class MostlyCloudyNightComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MostlyCloudyNightComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MostlyCloudyNightComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightComponent.prototype, "size", void 0); MostlyCloudyNightComponent = __decorate([ Component({ selector: "ibm-icon-mostly-cloudy-night", template: ` <svg ibmIconMostlyCloudyNight [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], MostlyCloudyNightComponent); let MostlyCloudyNightDirective = MostlyCloudyNightDirective_1 = class MostlyCloudyNightDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "MostlyCloudyNight32", "filepath": "mostly-cloudy--night/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": "M29.8438,15.0347a1.5169,1.5169,0,0,0-1.23-.8658,5.3547,5.3547,0,0,1-3.4094-1.7158A6.4653,6.4653,0,0,1,23.918,6.0605a1.6025,1.6025,0,0,0-.2989-1.5459,1.4543,1.4543,0,0,0-1.36-.4931l-.0191.0039a7.927,7.927,0,0,0-6.22,7.4307A7.3638,7.3638,0,0,0,13.5,11a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,28H19a5.9771,5.9771,0,0,0,5.6147-8.0884,7.5054,7.5054,0,0,0,5.1324-3.3569A1.5372,1.5372,0,0,0,29.8438,15.0347ZM19,26H8a3.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,26Zm4.4653-8.001h-.0217a5.9581,5.9581,0,0,0-2.7942-1.7549,7.5068,7.5068,0,0,0-2.6008-3.6767c-.01-.1016-.0361-.1978-.041-.3008a6.078,6.078,0,0,1,3.7907-6.05,8.4577,8.4577,0,0,0,1.94,7.5967A7.4007,7.4007,0,0,0,27.64,16.041,5.4286,5.4286,0,0,1,23.4653,17.999Z" } }], "name": "mostly-cloudy--night", "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="M29.8438,15.0347a1.5169,1.5169,0,0,0-1.23-.8658,5.3547,5.3547,0,0,1-3.4094-1.7158A6.4653,6.4653,0,0,1,23.918,6.0605a1.6025,1.6025,0,0,0-.2989-1.5459,1.4543,1.4543,0,0,0-1.36-.4931l-.0191.0039a7.927,7.927,0,0,0-6.22,7.4307A7.3638,7.3638,0,0,0,13.5,11a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,28H19a5.9771,5.9771,0,0,0,5.6147-8.0884,7.5054,7.5054,0,0,0,5.1324-3.3569A1.5372,1.5372,0,0,0,29.8438,15.0347ZM19,26H8a3.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,26Zm4.4653-8.001h-.0217a5.9581,5.9581,0,0,0-2.7942-1.7549,7.5068,7.5068,0,0,0-2.6008-3.6767c-.01-.1016-.0361-.1978-.041-.3008a6.078,6.078,0,0,1,3.7907-6.05,8.4577,8.4577,0,0,0,1.94,7.5967A7.4007,7.4007,0,0,0,27.64,16.041,5.4286,5.4286,0,0,1,23.4653,17.999Z"></path></svg>` }, "24": { metadata: { "moduleName": "MostlyCloudyNight24", "filepath": "mostly-cloudy--night/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": "M29.8438,15.0347a1.5169,1.5169,0,0,0-1.23-.8658,5.3547,5.3547,0,0,1-3.4094-1.7158A6.4653,6.4653,0,0,1,23.918,6.0605a1.6025,1.6025,0,0,0-.2989-1.5459,1.4543,1.4543,0,0,0-1.36-.4931l-.0191.0039a7.927,7.927,0,0,0-6.22,7.4307A7.3638,7.3638,0,0,0,13.5,11a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,28H19a5.9771,5.9771,0,0,0,5.6147-8.0884,7.5054,7.5054,0,0,0,5.1324-3.3569A1.5372,1.5372,0,0,0,29.8438,15.0347ZM19,26H8a3.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,26Zm4.4653-8.001h-.0217a5.9581,5.9581,0,0,0-2.7942-1.7549,7.5068,7.5068,0,0,0-2.6008-3.6767c-.01-.1016-.0361-.1978-.041-.3008a6.078,6.078,0,0,1,3.7907-6.05,8.4577,8.4577,0,0,0,1.94,7.5967A7.4007,7.4007,0,0,0,27.64,16.041,5.4286,5.4286,0,0,1,23.4653,17.999Z" } }], "name": "mostly-cloudy--night", "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="M29.8438,15.0347a1.5169,1.5169,0,0,0-1.23-.8658,5.3547,5.3547,0,0,1-3.4094-1.7158A6.4653,6.4653,0,0,1,23.918,6.0605a1.6025,1.6025,0,0,0-.2989-1.5459,1.4543,1.4543,0,0,0-1.36-.4931l-.0191.0039a7.927,7.927,0,0,0-6.22,7.4307A7.3638,7.3638,0,0,0,13.5,11a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,28H19a5.9771,5.9771,0,0,0,5.6147-8.0884,7.5054,7.5054,0,0,0,5.1324-3.3569A1.5372,1.5372,0,0,0,29.8438,15.0347ZM19,26H8a3.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,26Zm4.4653-8.001h-.0217a5.9581,5.9581,0,0,0-2.7942-1.7549,7.5068,7.5068,0,0,0-2.6008-3.6767c-.01-.1016-.0361-.1978-.041-.3008a6.078,6.078,0,0,1,3.7907-6.05,8.4577,8.4577,0,0,0,1.94,7.5967A7.4007,7.4007,0,0,0,27.64,16.041,5.4286,5.4286,0,0,1,23.4653,17.999Z"></path></svg>` }, "20": { metadata: { "moduleName": "MostlyCloudyNight20", "filepath": "mostly-cloudy--night/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": "M29.8438,15.0347a1.5169,1.5169,0,0,0-1.23-.8658,5.3547,5.3547,0,0,1-3.4094-1.7158A6.4653,6.4653,0,0,1,23.918,6.0605a1.6025,1.6025,0,0,0-.2989-1.5459,1.4543,1.4543,0,0,0-1.36-.4931l-.0191.0039a7.927,7.927,0,0,0-6.22,7.4307A7.3638,7.3638,0,0,0,13.5,11a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,28H19a5.9771,5.9771,0,0,0,5.6147-8.0884,7.5054,7.5054,0,0,0,5.1324-3.3569A1.5372,1.5372,0,0,0,29.8438,15.0347ZM19,26H8a3.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,26Zm4.4653-8.001h-.0217a5.9581,5.9581,0,0,0-2.7942-1.7549,7.5068,7.5068,0,0,0-2.6008-3.6767c-.01-.1016-.0361-.1978-.041-.3008a6.078,6.078,0,0,1,3.7907-6.05,8.4577,8.4577,0,0,0,1.94,7.5967A7.4007,7.4007,0,0,0,27.64,16.041,5.4286,5.4286,0,0,1,23.4653,17.999Z" } }], "name": "mostly-cloudy--night", "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="M29.8438,15.0347a1.5169,1.5169,0,0,0-1.23-.8658,5.3547,5.3547,0,0,1-3.4094-1.7158A6.4653,6.4653,0,0,1,23.918,6.0605a1.6025,1.6025,0,0,0-.2989-1.5459,1.4543,1.4543,0,0,0-1.36-.4931l-.0191.0039a7.927,7.927,0,0,0-6.22,7.4307A7.3638,7.3638,0,0,0,13.5,11a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,28H19a5.9771,5.9771,0,0,0,5.6147-8.0884,7.5054,7.5054,0,0,0,5.1324-3.3569A1.5372,1.5372,0,0,0,29.8438,15.0347ZM19,26H8a3.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,26Zm4.4653-8.001h-.0217a5.9581,5.9581,0,0,0-2.7942-1.7549,7.5068,7.5068,0,0,0-2.6008-3.6767c-.01-.1016-.0361-.1978-.041-.3008a6.078,6.078,0,0,1,3.7907-6.05,8.4577,8.4577,0,0,0,1.94,7.5967A7.4007,7.4007,0,0,0,27.64,16.041,5.4286,5.4286,0,0,1,23.4653,17.999Z"></path></svg>` }, "16": { metadata: { "moduleName": "MostlyCloudyNight16", "filepath": "mostly-cloudy--night/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": "M29.8438,15.0347a1.5169,1.5169,0,0,0-1.23-.8658,5.3547,5.3547,0,0,1-3.4094-1.7158A6.4653,6.4653,0,0,1,23.918,6.0605a1.6025,1.6025,0,0,0-.2989-1.5459,1.4543,1.4543,0,0,0-1.36-.4931l-.0191.0039a7.927,7.927,0,0,0-6.22,7.4307A7.3638,7.3638,0,0,0,13.5,11a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,28H19a5.9771,5.9771,0,0,0,5.6147-8.0884,7.5054,7.5054,0,0,0,5.1324-3.3569A1.5372,1.5372,0,0,0,29.8438,15.0347ZM19,26H8a3.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,26Zm4.4653-8.001h-.0217a5.9581,5.9581,0,0,0-2.7942-1.7549,7.5068,7.5068,0,0,0-2.6008-3.6767c-.01-.1016-.0361-.1978-.041-.3008a6.078,6.078,0,0,1,3.7907-6.05,8.4577,8.4577,0,0,0,1.94,7.5967A7.4007,7.4007,0,0,0,27.64,16.041,5.4286,5.4286,0,0,1,23.4653,17.999Z" } }], "name": "mostly-cloudy--night", "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="M29.8438,15.0347a1.5169,1.5169,0,0,0-1.23-.8658,5.3547,5.3547,0,0,1-3.4094-1.7158A6.4653,6.4653,0,0,1,23.918,6.0605a1.6025,1.6025,0,0,0-.2989-1.5459,1.4543,1.4543,0,0,0-1.36-.4931l-.0191.0039a7.927,7.927,0,0,0-6.22,7.4307A7.3638,7.3638,0,0,0,13.5,11a7.5511,7.5511,0,0,0-7.1494,5.2441A5.9926,5.9926,0,0,0,8,28H19a5.9771,5.9771,0,0,0,5.6147-8.0884,7.5054,7.5054,0,0,0,5.1324-3.3569A1.5372,1.5372,0,0,0,29.8438,15.0347ZM19,26H8a3.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,26Zm4.4653-8.001h-.0217a5.9581,5.9581,0,0,0-2.7942-1.7549,7.5068,7.5068,0,0,0-2.6008-3.6767c-.01-.1016-.0361-.1978-.041-.3008a6.078,6.078,0,0,1,3.7907-6.05,8.4577,8.4577,0,0,0,1.94,7.5967A7.4007,7.4007,0,0,0,27.64,16.041,5.4286,5.4286,0,0,1,23.4653,17.999Z"></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; MostlyCloudyNightDirective_1.titleIdCounter++; title.setAttribute("id", `mostly-cloudy-night-${MostlyCloudyNightDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `mostly-cloudy-night-${MostlyCloudyNightDirective_1.titleIdCounter}`); } } }; MostlyCloudyNightDirective.titleIdCounter = 0; MostlyCloudyNightDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MostlyCloudyNightDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MostlyCloudyNightDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyNightDirective.prototype, "size", void 0); MostlyCloudyNightDirective = MostlyCloudyNightDirective_1 = __decorate([ Directive({ selector: "[ibmIconMostlyCloudyNight]" }), __metadata("design:paramtypes", [ElementRef]) ], MostlyCloudyNightDirective); let MostlyCloudyNightModule = class MostlyCloudyNightModule { }; MostlyCloudyNightModule = __decorate([ NgModule({ declarations: [ MostlyCloudyNightComponent, MostlyCloudyNightDirective, ], exports: [ MostlyCloudyNightComponent, MostlyCloudyNightDirective, ] }) ], MostlyCloudyNightModule); export { MostlyCloudyNightComponent, MostlyCloudyNightDirective, MostlyCloudyNightModule };