UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 14.2 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var MostlyCloudyDirective_1; let MostlyCloudyComponent = class MostlyCloudyComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MostlyCloudyComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MostlyCloudyComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyComponent.prototype, "size", void 0); MostlyCloudyComponent = __decorate([ Component({ selector: "ibm-icon-mostly-cloudy", template: ` <svg ibmIconMostlyCloudy [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], MostlyCloudyComponent); let MostlyCloudyDirective = MostlyCloudyDirective_1 = class MostlyCloudyDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "MostlyCloudy32", "filepath": "mostly-cloudy/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.743,18.6872A6.05,6.05,0,0,0,22.8,17.6006a5.9977,5.9977,0,1,0-10.7334-4.4444,7.5568,7.5568,0,0,0-5.7158,5.0879A5.9926,5.9926,0,0,0,8,30H19a5.9854,5.9854,0,0,0,2.743-11.3128ZM18,10a4.0042,4.0042,0,0,1,4,4,3.9613,3.9613,0,0,1-.8,2.3994,4.0122,4.0122,0,0,1-.94.8917,7.5416,7.5416,0,0,0-6.1339-4.2395A3.9985,3.9985,0,0,1,18,10Zm1,18H8a3.9928,3.9928,0,0,1-.6729-7.93L7.99,19.958l.1456-.6562a5.4958,5.4958,0,0,1,10.729,0l.1464.6562.6622.1123A3.9928,3.9928,0,0,1,19,28Z", "transform": "translate(0 .005)" } }, { "elem": "path", "attrs": { "d": "M26 13.005H30V15.005H26z" } }, { "elem": "path", "attrs": { "d": "M23.071 5.929H27.071V7.929H23.071z", "transform": "rotate(-45 25.077 6.931)" } }, { "elem": "path", "attrs": { "d": "M17 2.005H19V6.005H17z" } }, { "elem": "path", "attrs": { "d": "M9.929 4.929H11.929V8.929H9.929z", "transform": "rotate(-45 10.935 6.931)" } }], "name": "mostly-cloudy", "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.743,18.6872A6.05,6.05,0,0,0,22.8,17.6006a5.9977,5.9977,0,1,0-10.7334-4.4444,7.5568,7.5568,0,0,0-5.7158,5.0879A5.9926,5.9926,0,0,0,8,30H19a5.9854,5.9854,0,0,0,2.743-11.3128ZM18,10a4.0042,4.0042,0,0,1,4,4,3.9613,3.9613,0,0,1-.8,2.3994,4.0122,4.0122,0,0,1-.94.8917,7.5416,7.5416,0,0,0-6.1339-4.2395A3.9985,3.9985,0,0,1,18,10Zm1,18H8a3.9928,3.9928,0,0,1-.6729-7.93L7.99,19.958l.1456-.6562a5.4958,5.4958,0,0,1,10.729,0l.1464.6562.6622.1123A3.9928,3.9928,0,0,1,19,28Z" transform="translate(0 .005)"></path><path d="M26 13.005H30V15.005H26z"></path><path d="M23.071 5.929H27.071V7.929H23.071z" transform="rotate(-45 25.077 6.931)"></path><path d="M17 2.005H19V6.005H17z"></path><path d="M9.929 4.929H11.929V8.929H9.929z" transform="rotate(-45 10.935 6.931)"></path></svg>` }, "24": { metadata: { "moduleName": "MostlyCloudy24", "filepath": "mostly-cloudy/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.743,18.6872A6.05,6.05,0,0,0,22.8,17.6006a5.9977,5.9977,0,1,0-10.7334-4.4444,7.5568,7.5568,0,0,0-5.7158,5.0879A5.9926,5.9926,0,0,0,8,30H19a5.9854,5.9854,0,0,0,2.743-11.3128ZM18,10a4.0042,4.0042,0,0,1,4,4,3.9613,3.9613,0,0,1-.8,2.3994,4.0122,4.0122,0,0,1-.94.8917,7.5416,7.5416,0,0,0-6.1339-4.2395A3.9985,3.9985,0,0,1,18,10Zm1,18H8a3.9928,3.9928,0,0,1-.6729-7.93L7.99,19.958l.1456-.6562a5.4958,5.4958,0,0,1,10.729,0l.1464.6562.6622.1123A3.9928,3.9928,0,0,1,19,28Z", "transform": "translate(0 .005)" } }, { "elem": "path", "attrs": { "d": "M26 13.005H30V15.005H26z" } }, { "elem": "path", "attrs": { "d": "M23.071 5.929H27.071V7.929H23.071z", "transform": "rotate(-45 25.077 6.931)" } }, { "elem": "path", "attrs": { "d": "M17 2.005H19V6.005H17z" } }, { "elem": "path", "attrs": { "d": "M9.929 4.929H11.929V8.929H9.929z", "transform": "rotate(-45 10.935 6.931)" } }], "name": "mostly-cloudy", "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.743,18.6872A6.05,6.05,0,0,0,22.8,17.6006a5.9977,5.9977,0,1,0-10.7334-4.4444,7.5568,7.5568,0,0,0-5.7158,5.0879A5.9926,5.9926,0,0,0,8,30H19a5.9854,5.9854,0,0,0,2.743-11.3128ZM18,10a4.0042,4.0042,0,0,1,4,4,3.9613,3.9613,0,0,1-.8,2.3994,4.0122,4.0122,0,0,1-.94.8917,7.5416,7.5416,0,0,0-6.1339-4.2395A3.9985,3.9985,0,0,1,18,10Zm1,18H8a3.9928,3.9928,0,0,1-.6729-7.93L7.99,19.958l.1456-.6562a5.4958,5.4958,0,0,1,10.729,0l.1464.6562.6622.1123A3.9928,3.9928,0,0,1,19,28Z" transform="translate(0 .005)"></path><path d="M26 13.005H30V15.005H26z"></path><path d="M23.071 5.929H27.071V7.929H23.071z" transform="rotate(-45 25.077 6.931)"></path><path d="M17 2.005H19V6.005H17z"></path><path d="M9.929 4.929H11.929V8.929H9.929z" transform="rotate(-45 10.935 6.931)"></path></svg>` }, "20": { metadata: { "moduleName": "MostlyCloudy20", "filepath": "mostly-cloudy/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.743,18.6872A6.05,6.05,0,0,0,22.8,17.6006a5.9977,5.9977,0,1,0-10.7334-4.4444,7.5568,7.5568,0,0,0-5.7158,5.0879A5.9926,5.9926,0,0,0,8,30H19a5.9854,5.9854,0,0,0,2.743-11.3128ZM18,10a4.0042,4.0042,0,0,1,4,4,3.9613,3.9613,0,0,1-.8,2.3994,4.0122,4.0122,0,0,1-.94.8917,7.5416,7.5416,0,0,0-6.1339-4.2395A3.9985,3.9985,0,0,1,18,10Zm1,18H8a3.9928,3.9928,0,0,1-.6729-7.93L7.99,19.958l.1456-.6562a5.4958,5.4958,0,0,1,10.729,0l.1464.6562.6622.1123A3.9928,3.9928,0,0,1,19,28Z", "transform": "translate(0 .005)" } }, { "elem": "path", "attrs": { "d": "M26 13.005H30V15.005H26z" } }, { "elem": "path", "attrs": { "d": "M23.071 5.929H27.071V7.929H23.071z", "transform": "rotate(-45 25.077 6.931)" } }, { "elem": "path", "attrs": { "d": "M17 2.005H19V6.005H17z" } }, { "elem": "path", "attrs": { "d": "M9.929 4.929H11.929V8.929H9.929z", "transform": "rotate(-45 10.935 6.931)" } }], "name": "mostly-cloudy", "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.743,18.6872A6.05,6.05,0,0,0,22.8,17.6006a5.9977,5.9977,0,1,0-10.7334-4.4444,7.5568,7.5568,0,0,0-5.7158,5.0879A5.9926,5.9926,0,0,0,8,30H19a5.9854,5.9854,0,0,0,2.743-11.3128ZM18,10a4.0042,4.0042,0,0,1,4,4,3.9613,3.9613,0,0,1-.8,2.3994,4.0122,4.0122,0,0,1-.94.8917,7.5416,7.5416,0,0,0-6.1339-4.2395A3.9985,3.9985,0,0,1,18,10Zm1,18H8a3.9928,3.9928,0,0,1-.6729-7.93L7.99,19.958l.1456-.6562a5.4958,5.4958,0,0,1,10.729,0l.1464.6562.6622.1123A3.9928,3.9928,0,0,1,19,28Z" transform="translate(0 .005)"></path><path d="M26 13.005H30V15.005H26z"></path><path d="M23.071 5.929H27.071V7.929H23.071z" transform="rotate(-45 25.077 6.931)"></path><path d="M17 2.005H19V6.005H17z"></path><path d="M9.929 4.929H11.929V8.929H9.929z" transform="rotate(-45 10.935 6.931)"></path></svg>` }, "16": { metadata: { "moduleName": "MostlyCloudy16", "filepath": "mostly-cloudy/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.743,18.6872A6.05,6.05,0,0,0,22.8,17.6006a5.9977,5.9977,0,1,0-10.7334-4.4444,7.5568,7.5568,0,0,0-5.7158,5.0879A5.9926,5.9926,0,0,0,8,30H19a5.9854,5.9854,0,0,0,2.743-11.3128ZM18,10a4.0042,4.0042,0,0,1,4,4,3.9613,3.9613,0,0,1-.8,2.3994,4.0122,4.0122,0,0,1-.94.8917,7.5416,7.5416,0,0,0-6.1339-4.2395A3.9985,3.9985,0,0,1,18,10Zm1,18H8a3.9928,3.9928,0,0,1-.6729-7.93L7.99,19.958l.1456-.6562a5.4958,5.4958,0,0,1,10.729,0l.1464.6562.6622.1123A3.9928,3.9928,0,0,1,19,28Z", "transform": "translate(0 .005)" } }, { "elem": "path", "attrs": { "d": "M26 13.005H30V15.005H26z" } }, { "elem": "path", "attrs": { "d": "M23.071 5.929H27.071V7.929H23.071z", "transform": "rotate(-45 25.077 6.931)" } }, { "elem": "path", "attrs": { "d": "M17 2.005H19V6.005H17z" } }, { "elem": "path", "attrs": { "d": "M9.929 4.929H11.929V8.929H9.929z", "transform": "rotate(-45 10.935 6.931)" } }], "name": "mostly-cloudy", "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.743,18.6872A6.05,6.05,0,0,0,22.8,17.6006a5.9977,5.9977,0,1,0-10.7334-4.4444,7.5568,7.5568,0,0,0-5.7158,5.0879A5.9926,5.9926,0,0,0,8,30H19a5.9854,5.9854,0,0,0,2.743-11.3128ZM18,10a4.0042,4.0042,0,0,1,4,4,3.9613,3.9613,0,0,1-.8,2.3994,4.0122,4.0122,0,0,1-.94.8917,7.5416,7.5416,0,0,0-6.1339-4.2395A3.9985,3.9985,0,0,1,18,10Zm1,18H8a3.9928,3.9928,0,0,1-.6729-7.93L7.99,19.958l.1456-.6562a5.4958,5.4958,0,0,1,10.729,0l.1464.6562.6622.1123A3.9928,3.9928,0,0,1,19,28Z" transform="translate(0 .005)"></path><path d="M26 13.005H30V15.005H26z"></path><path d="M23.071 5.929H27.071V7.929H23.071z" transform="rotate(-45 25.077 6.931)"></path><path d="M17 2.005H19V6.005H17z"></path><path d="M9.929 4.929H11.929V8.929H9.929z" transform="rotate(-45 10.935 6.931)"></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; MostlyCloudyDirective_1.titleIdCounter++; title.setAttribute("id", `mostly-cloudy-${MostlyCloudyDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `mostly-cloudy-${MostlyCloudyDirective_1.titleIdCounter}`); } } }; MostlyCloudyDirective.titleIdCounter = 0; MostlyCloudyDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MostlyCloudyDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], MostlyCloudyDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], MostlyCloudyDirective.prototype, "size", void 0); MostlyCloudyDirective = MostlyCloudyDirective_1 = __decorate([ Directive({ selector: "[ibmIconMostlyCloudy]" }), __metadata("design:paramtypes", [ElementRef]) ], MostlyCloudyDirective); let MostlyCloudyModule = class MostlyCloudyModule { }; MostlyCloudyModule = __decorate([ NgModule({ declarations: [ MostlyCloudyComponent, MostlyCloudyDirective, ], exports: [ MostlyCloudyComponent, MostlyCloudyDirective, ] }) ], MostlyCloudyModule); export { MostlyCloudyComponent, MostlyCloudyDirective, MostlyCloudyModule };