UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 16.8 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var LogoPythonDirective_1; let LogoPythonComponent = class LogoPythonComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], LogoPythonComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoPythonComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], LogoPythonComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoPythonComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], LogoPythonComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoPythonComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoPythonComponent.prototype, "size", void 0); LogoPythonComponent = __decorate([ Component({ selector: "ibm-icon-logo-python", template: ` <svg ibmIconLogoPython [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], LogoPythonComponent); let LogoPythonDirective = LogoPythonDirective_1 = class LogoPythonDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "LogoPython32", "filepath": "logo--python/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": "M23.4882,9.14v2.9663a4.2843,4.2843,0,0,1-4.173,4.2352H12.6431a3.4077,3.4077,0,0,0-3.34,3.3945v6.3607c0,1.81,1.5742,2.8751,3.34,3.3945a11.1762,11.1762,0,0,0,6.6721,0c1.6817-.4869,3.34-1.4668,3.34-3.3945V23.55H15.983v-.8486H25.9951c1.9414,0,2.6648-1.3542,3.34-3.3867a11.4642,11.4642,0,0,0,0-6.7889c-.48-1.9327-1.3961-3.3867-3.34-3.3867ZM19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z" } }, { "elem": "path", "attrs": { "d": "M15.8351,2a19.0717,19.0717,0,0,0-3.192.2725c-2.8268.4994-3.34,1.5447-3.34,3.4723V8.2909h6.68V9.14H6.7962a4.1708,4.1708,0,0,0-4.173,3.3867,12.4855,12.4855,0,0,0,0,6.7889c.4748,1.9776,1.6088,3.3867,3.55,3.3867H8.47V19.65a4.2449,4.2449,0,0,1,4.173-4.15h6.6721a3.3654,3.3654,0,0,0,3.34-3.3944V5.745a3.729,3.729,0,0,0-3.34-3.4723A20.8377,20.8377,0,0,0,15.8351,2ZM12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z" } }], "name": "logo--python", "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="M23.4882,9.14v2.9663a4.2843,4.2843,0,0,1-4.173,4.2352H12.6431a3.4077,3.4077,0,0,0-3.34,3.3945v6.3607c0,1.81,1.5742,2.8751,3.34,3.3945a11.1762,11.1762,0,0,0,6.6721,0c1.6817-.4869,3.34-1.4668,3.34-3.3945V23.55H15.983v-.8486H25.9951c1.9414,0,2.6648-1.3542,3.34-3.3867a11.4642,11.4642,0,0,0,0-6.7889c-.48-1.9327-1.3961-3.3867-3.34-3.3867ZM19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z"></path><path fill="none" d="M19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z"></path><path d="M15.8351,2a19.0717,19.0717,0,0,0-3.192.2725c-2.8268.4994-3.34,1.5447-3.34,3.4723V8.2909h6.68V9.14H6.7962a4.1708,4.1708,0,0,0-4.173,3.3867,12.4855,12.4855,0,0,0,0,6.7889c.4748,1.9776,1.6088,3.3867,3.55,3.3867H8.47V19.65a4.2449,4.2449,0,0,1,4.173-4.15h6.6721a3.3654,3.3654,0,0,0,3.34-3.3944V5.745a3.729,3.729,0,0,0-3.34-3.4723A20.8377,20.8377,0,0,0,15.8351,2ZM12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z"></path><path fill="none" d="M12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z"></path></svg>` }, "24": { metadata: { "moduleName": "LogoPython24", "filepath": "logo--python/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": "M23.4882,9.14v2.9663a4.2843,4.2843,0,0,1-4.173,4.2352H12.6431a3.4077,3.4077,0,0,0-3.34,3.3945v6.3607c0,1.81,1.5742,2.8751,3.34,3.3945a11.1762,11.1762,0,0,0,6.6721,0c1.6817-.4869,3.34-1.4668,3.34-3.3945V23.55H15.983v-.8486H25.9951c1.9414,0,2.6648-1.3542,3.34-3.3867a11.4642,11.4642,0,0,0,0-6.7889c-.48-1.9327-1.3961-3.3867-3.34-3.3867ZM19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z" } }, { "elem": "path", "attrs": { "d": "M15.8351,2a19.0717,19.0717,0,0,0-3.192.2725c-2.8268.4994-3.34,1.5447-3.34,3.4723V8.2909h6.68V9.14H6.7962a4.1708,4.1708,0,0,0-4.173,3.3867,12.4855,12.4855,0,0,0,0,6.7889c.4748,1.9776,1.6088,3.3867,3.55,3.3867H8.47V19.65a4.2449,4.2449,0,0,1,4.173-4.15h6.6721a3.3654,3.3654,0,0,0,3.34-3.3944V5.745a3.729,3.729,0,0,0-3.34-3.4723A20.8377,20.8377,0,0,0,15.8351,2ZM12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z" } }], "name": "logo--python", "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="M23.4882,9.14v2.9663a4.2843,4.2843,0,0,1-4.173,4.2352H12.6431a3.4077,3.4077,0,0,0-3.34,3.3945v6.3607c0,1.81,1.5742,2.8751,3.34,3.3945a11.1762,11.1762,0,0,0,6.6721,0c1.6817-.4869,3.34-1.4668,3.34-3.3945V23.55H15.983v-.8486H25.9951c1.9414,0,2.6648-1.3542,3.34-3.3867a11.4642,11.4642,0,0,0,0-6.7889c-.48-1.9327-1.3961-3.3867-3.34-3.3867ZM19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z"></path><path fill="none" d="M19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z"></path><path d="M15.8351,2a19.0717,19.0717,0,0,0-3.192.2725c-2.8268.4994-3.34,1.5447-3.34,3.4723V8.2909h6.68V9.14H6.7962a4.1708,4.1708,0,0,0-4.173,3.3867,12.4855,12.4855,0,0,0,0,6.7889c.4748,1.9776,1.6088,3.3867,3.55,3.3867H8.47V19.65a4.2449,4.2449,0,0,1,4.173-4.15h6.6721a3.3654,3.3654,0,0,0,3.34-3.3944V5.745a3.729,3.729,0,0,0-3.34-3.4723A20.8377,20.8377,0,0,0,15.8351,2ZM12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z"></path><path fill="none" d="M12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z"></path></svg>` }, "20": { metadata: { "moduleName": "LogoPython20", "filepath": "logo--python/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": "M23.4882,9.14v2.9663a4.2843,4.2843,0,0,1-4.173,4.2352H12.6431a3.4077,3.4077,0,0,0-3.34,3.3945v6.3607c0,1.81,1.5742,2.8751,3.34,3.3945a11.1762,11.1762,0,0,0,6.6721,0c1.6817-.4869,3.34-1.4668,3.34-3.3945V23.55H15.983v-.8486H25.9951c1.9414,0,2.6648-1.3542,3.34-3.3867a11.4642,11.4642,0,0,0,0-6.7889c-.48-1.9327-1.3961-3.3867-3.34-3.3867ZM19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z" } }, { "elem": "path", "attrs": { "d": "M15.8351,2a19.0717,19.0717,0,0,0-3.192.2725c-2.8268.4994-3.34,1.5447-3.34,3.4723V8.2909h6.68V9.14H6.7962a4.1708,4.1708,0,0,0-4.173,3.3867,12.4855,12.4855,0,0,0,0,6.7889c.4748,1.9776,1.6088,3.3867,3.55,3.3867H8.47V19.65a4.2449,4.2449,0,0,1,4.173-4.15h6.6721a3.3654,3.3654,0,0,0,3.34-3.3944V5.745a3.729,3.729,0,0,0-3.34-3.4723A20.8377,20.8377,0,0,0,15.8351,2ZM12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z" } }], "name": "logo--python", "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="M23.4882,9.14v2.9663a4.2843,4.2843,0,0,1-4.173,4.2352H12.6431a3.4077,3.4077,0,0,0-3.34,3.3945v6.3607c0,1.81,1.5742,2.8751,3.34,3.3945a11.1762,11.1762,0,0,0,6.6721,0c1.6817-.4869,3.34-1.4668,3.34-3.3945V23.55H15.983v-.8486H25.9951c1.9414,0,2.6648-1.3542,3.34-3.3867a11.4642,11.4642,0,0,0,0-6.7889c-.48-1.9327-1.3961-3.3867-3.34-3.3867ZM19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z"></path><path fill="none" d="M19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z"></path><path d="M15.8351,2a19.0717,19.0717,0,0,0-3.192.2725c-2.8268.4994-3.34,1.5447-3.34,3.4723V8.2909h6.68V9.14H6.7962a4.1708,4.1708,0,0,0-4.173,3.3867,12.4855,12.4855,0,0,0,0,6.7889c.4748,1.9776,1.6088,3.3867,3.55,3.3867H8.47V19.65a4.2449,4.2449,0,0,1,4.173-4.15h6.6721a3.3654,3.3654,0,0,0,3.34-3.3944V5.745a3.729,3.729,0,0,0-3.34-3.4723A20.8377,20.8377,0,0,0,15.8351,2ZM12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z"></path><path fill="none" d="M12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z"></path></svg>` }, "16": { metadata: { "moduleName": "LogoPython16", "filepath": "logo--python/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": "M23.4882,9.14v2.9663a4.2843,4.2843,0,0,1-4.173,4.2352H12.6431a3.4077,3.4077,0,0,0-3.34,3.3945v6.3607c0,1.81,1.5742,2.8751,3.34,3.3945a11.1762,11.1762,0,0,0,6.6721,0c1.6817-.4869,3.34-1.4668,3.34-3.3945V23.55H15.983v-.8486H25.9951c1.9414,0,2.6648-1.3542,3.34-3.3867a11.4642,11.4642,0,0,0,0-6.7889c-.48-1.9327-1.3961-3.3867-3.34-3.3867ZM19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z" } }, { "elem": "path", "attrs": { "d": "M15.8351,2a19.0717,19.0717,0,0,0-3.192.2725c-2.8268.4994-3.34,1.5447-3.34,3.4723V8.2909h6.68V9.14H6.7962a4.1708,4.1708,0,0,0-4.173,3.3867,12.4855,12.4855,0,0,0,0,6.7889c.4748,1.9776,1.6088,3.3867,3.55,3.3867H8.47V19.65a4.2449,4.2449,0,0,1,4.173-4.15h6.6721a3.3654,3.3654,0,0,0,3.34-3.3944V5.745a3.729,3.729,0,0,0-3.34-3.4723A20.8377,20.8377,0,0,0,15.8351,2ZM12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z" } }], "name": "logo--python", "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="M23.4882,9.14v2.9663a4.2843,4.2843,0,0,1-4.173,4.2352H12.6431a3.4077,3.4077,0,0,0-3.34,3.3945v6.3607c0,1.81,1.5742,2.8751,3.34,3.3945a11.1762,11.1762,0,0,0,6.6721,0c1.6817-.4869,3.34-1.4668,3.34-3.3945V23.55H15.983v-.8486H25.9951c1.9414,0,2.6648-1.3542,3.34-3.3867a11.4642,11.4642,0,0,0,0-6.7889c-.48-1.9327-1.3961-3.3867-3.34-3.3867ZM19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z"></path><path fill="none" d="M19.7356,25.2476a1.2731,1.2731,0,1,1-1.2534,1.269A1.2607,1.2607,0,0,1,19.7356,25.2476Z"></path><path d="M15.8351,2a19.0717,19.0717,0,0,0-3.192.2725c-2.8268.4994-3.34,1.5447-3.34,3.4723V8.2909h6.68V9.14H6.7962a4.1708,4.1708,0,0,0-4.173,3.3867,12.4855,12.4855,0,0,0,0,6.7889c.4748,1.9776,1.6088,3.3867,3.55,3.3867H8.47V19.65a4.2449,4.2449,0,0,1,4.173-4.15h6.6721a3.3654,3.3654,0,0,0,3.34-3.3944V5.745a3.729,3.729,0,0,0-3.34-3.4723A20.8377,20.8377,0,0,0,15.8351,2ZM12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z"></path><path fill="none" d="M12.2226,4.0478a1.2731,1.2731,0,1,1-1.2534,1.2768A1.2675,1.2675,0,0,1,12.2226,4.0478Z"></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; LogoPythonDirective_1.titleIdCounter++; title.setAttribute("id", `logo-python-${LogoPythonDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `logo-python-${LogoPythonDirective_1.titleIdCounter}`); } } }; LogoPythonDirective.titleIdCounter = 0; LogoPythonDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], LogoPythonDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoPythonDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], LogoPythonDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoPythonDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], LogoPythonDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], LogoPythonDirective.prototype, "size", void 0); LogoPythonDirective = LogoPythonDirective_1 = __decorate([ Directive({ selector: "[ibmIconLogoPython]" }), __metadata("design:paramtypes", [ElementRef]) ], LogoPythonDirective); let LogoPythonModule = class LogoPythonModule { }; LogoPythonModule = __decorate([ NgModule({ declarations: [ LogoPythonComponent, LogoPythonDirective, ], exports: [ LogoPythonComponent, LogoPythonDirective, ] }) ], LogoPythonModule); export { LogoPythonComponent, LogoPythonDirective, LogoPythonModule };