UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 9.94 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var DragVerticalComponent = /** @class */ (function () { function DragVerticalComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], DragVerticalComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], DragVerticalComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], DragVerticalComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], DragVerticalComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], DragVerticalComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], DragVerticalComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], DragVerticalComponent.prototype, "size", void 0); DragVerticalComponent = __decorate([ Component({ selector: "ibm-icon-drag-vertical", template: "\n <svg\n ibmIconDragVertical\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 " }) ], DragVerticalComponent); return DragVerticalComponent; }()); var DragVerticalDirective = /** @class */ (function () { function DragVerticalDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "DragVertical32", "filepath": "drag--vertical/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": "M4 20L15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20zM11 7L12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7z" } }], "name": "drag--vertical", "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=\"M4 20L15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20zM11 7L12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7z\"></path></svg>" }, "24": { metadata: { "moduleName": "DragVertical24", "filepath": "drag--vertical/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": "M4 20L15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20zM11 7L12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7z" } }], "name": "drag--vertical", "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=\"M4 20L15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20zM11 7L12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7z\"></path></svg>" }, "20": { metadata: { "moduleName": "DragVertical20", "filepath": "drag--vertical/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": "M4 20L15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20zM11 7L12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7z" } }], "name": "drag--vertical", "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=\"M4 20L15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20zM11 7L12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7z\"></path></svg>" }, "16": { metadata: { "moduleName": "DragVertical16", "filepath": "drag--vertical/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": "M4 20L15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20zM11 7L12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7z" } }], "name": "drag--vertical", "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=\"M4 20L15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20zM11 7L12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7z\"></path></svg>" }, }; } DragVerticalDirective_1 = DragVerticalDirective; DragVerticalDirective.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; DragVerticalDirective_1.titleIdCounter++; title.setAttribute("id", "drag-vertical-" + DragVerticalDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "drag-vertical-" + DragVerticalDirective_1.titleIdCounter); } }; var DragVerticalDirective_1; DragVerticalDirective.titleIdCounter = 0; DragVerticalDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], DragVerticalDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], DragVerticalDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], DragVerticalDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], DragVerticalDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], DragVerticalDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], DragVerticalDirective.prototype, "size", void 0); DragVerticalDirective = DragVerticalDirective_1 = __decorate([ Directive({ selector: "[ibmIconDragVertical]" }), __metadata("design:paramtypes", [ElementRef]) ], DragVerticalDirective); return DragVerticalDirective; }()); var DragVerticalModule = /** @class */ (function () { function DragVerticalModule() { } DragVerticalModule = __decorate([ NgModule({ declarations: [ DragVerticalComponent, DragVerticalDirective, ], exports: [ DragVerticalComponent, DragVerticalDirective, ] }) ], DragVerticalModule); return DragVerticalModule; }()); export { DragVerticalComponent, DragVerticalDirective, DragVerticalModule };