UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 10.3 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var NextFilledComponent = /** @class */ (function () { function NextFilledComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], NextFilledComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], NextFilledComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], NextFilledComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], NextFilledComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], NextFilledComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], NextFilledComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], NextFilledComponent.prototype, "size", void 0); NextFilledComponent = __decorate([ Component({ selector: "ibm-icon-next-filled", template: "\n <svg\n ibmIconNextFilled\n [size]=\"size\"\n [ariaLabel]=\"ariaLabel\"\n [ariaLabelledby]=\"ariaLabelledby\"\n [ariaHidden]=\"ariaHidden\"\n [title]=\"title\"\n [isFocusable]=\"focusable\"\n [attr.class]=\"innerClass\">\n </svg>\n " }) ], NextFilledComponent); return NextFilledComponent; }()); var NextFilledDirective = /** @class */ (function () { function NextFilledDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "NextFilled32", "filepath": "next--filled/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,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm6-1H20.15L14.57,9.3926,16,8l8,8-8,8-1.43-1.4272L20.15,17H8Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M16 8L14.57 9.393 20.15 15 8 15 8 17 20.15 17 14.57 22.573 16 24 24 16 16 8z", "data-icon-path": "inner-path" } }], "name": "next--filled", "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,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm6-1H20.15L14.57,9.3926,16,8l8,8-8,8-1.43-1.4272L20.15,17H8Z\"></path><path fill=\"none\" d=\"M16 8L14.57 9.393 20.15 15 8 15 8 17 20.15 17 14.57 22.573 16 24 24 16 16 8z\" data-icon-path=\"inner-path\"></path></svg>" }, "24": { metadata: { "moduleName": "NextFilled24", "filepath": "next--filled/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,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm6-1H20.15L14.57,9.3926,16,8l8,8-8,8-1.43-1.4272L20.15,17H8Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M16 8L14.57 9.393 20.15 15 8 15 8 17 20.15 17 14.57 22.573 16 24 24 16 16 8z", "data-icon-path": "inner-path" } }], "name": "next--filled", "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,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm6-1H20.15L14.57,9.3926,16,8l8,8-8,8-1.43-1.4272L20.15,17H8Z\"></path><path fill=\"none\" d=\"M16 8L14.57 9.393 20.15 15 8 15 8 17 20.15 17 14.57 22.573 16 24 24 16 16 8z\" data-icon-path=\"inner-path\"></path></svg>" }, "20": { metadata: { "moduleName": "NextFilled20", "filepath": "next--filled/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,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm6-1H20.15L14.57,9.3926,16,8l8,8-8,8-1.43-1.4272L20.15,17H8Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M16 8L14.57 9.393 20.15 15 8 15 8 17 20.15 17 14.57 22.573 16 24 24 16 16 8z", "data-icon-path": "inner-path" } }], "name": "next--filled", "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,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm6-1H20.15L14.57,9.3926,16,8l8,8-8,8-1.43-1.4272L20.15,17H8Z\"></path><path fill=\"none\" d=\"M16 8L14.57 9.393 20.15 15 8 15 8 17 20.15 17 14.57 22.573 16 24 24 16 16 8z\" data-icon-path=\"inner-path\"></path></svg>" }, "16": { metadata: { "moduleName": "NextFilled16", "filepath": "next--filled/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,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm6-1H20.15L14.57,9.3926,16,8l8,8-8,8-1.43-1.4272L20.15,17H8Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M16 8L14.57 9.393 20.15 15 8 15 8 17 20.15 17 14.57 22.573 16 24 24 16 16 8z", "data-icon-path": "inner-path" } }], "name": "next--filled", "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,16A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm6-1H20.15L14.57,9.3926,16,8l8,8-8,8-1.43-1.4272L20.15,17H8Z\"></path><path fill=\"none\" d=\"M16 8L14.57 9.393 20.15 15 8 15 8 17 20.15 17 14.57 22.573 16 24 24 16 16 8z\" data-icon-path=\"inner-path\"></path></svg>" }, }; } NextFilledDirective_1 = NextFilledDirective; NextFilledDirective.prototype.ngAfterViewInit = function () { var svg = this.elementRef.nativeElement; svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); var icon = this.icons[this.size]; var domParser = new DOMParser(); var rawSVG = icon.svg; var svgElement = domParser.parseFromString(rawSVG, "image/svg+xml").documentElement; var 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; } var 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() }); var attrKeys = Object.keys(attributes); for (var i = 0; i < attrKeys.length; i++) { var key = attrKeys[i]; var value = attributes[key]; if (key === "title") { continue; } if (value) { svg.setAttribute(key, value); } } if (attributes.title) { var title = document.createElement("title"); title.textContent = attributes.title; NextFilledDirective_1.titleIdCounter++; title.setAttribute("id", "next-filled-" + NextFilledDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "next-filled-" + NextFilledDirective_1.titleIdCounter); } }; var NextFilledDirective_1; NextFilledDirective.titleIdCounter = 0; NextFilledDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], NextFilledDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], NextFilledDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], NextFilledDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], NextFilledDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], NextFilledDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], NextFilledDirective.prototype, "size", void 0); NextFilledDirective = NextFilledDirective_1 = __decorate([ Directive({ selector: "[ibmIconNextFilled]" }), __metadata("design:paramtypes", [ElementRef]) ], NextFilledDirective); return NextFilledDirective; }()); var NextFilledModule = /** @class */ (function () { function NextFilledModule() { } NextFilledModule = __decorate([ NgModule({ declarations: [ NextFilledComponent, NextFilledDirective, ], exports: [ NextFilledComponent, NextFilledDirective, ] }) ], NextFilledModule); return NextFilledModule; }()); export { NextFilledComponent, NextFilledDirective, NextFilledModule };