UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 9.54 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var DirectionUTurnComponent = /** @class */ (function () { function DirectionUTurnComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], DirectionUTurnComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], DirectionUTurnComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnComponent.prototype, "size", void 0); DirectionUTurnComponent = __decorate([ Component({ selector: "ibm-icon-direction-u-turn", template: "\n <svg\n ibmIconDirectionUTurn\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 " }) ], DirectionUTurnComponent); return DirectionUTurnComponent; }()); var DirectionUTurnDirective = /** @class */ (function () { function DirectionUTurnDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "DirectionUTurn32", "filepath": "direction--u-turn/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": "M26.5859,19.5859,22,24.1719V8a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,8V28H8V8H20V24.1719l-4.5859-4.586L14,21l7,7,7-7Z" } }], "name": "direction--u-turn", "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=\"M26.5859,19.5859,22,24.1719V8a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,8V28H8V8H20V24.1719l-4.5859-4.586L14,21l7,7,7-7Z\"></path></svg>" }, "24": { metadata: { "moduleName": "DirectionUTurn24", "filepath": "direction--u-turn/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": "M26.5859,19.5859,22,24.1719V8a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,8V28H8V8H20V24.1719l-4.5859-4.586L14,21l7,7,7-7Z" } }], "name": "direction--u-turn", "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=\"M26.5859,19.5859,22,24.1719V8a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,8V28H8V8H20V24.1719l-4.5859-4.586L14,21l7,7,7-7Z\"></path></svg>" }, "20": { metadata: { "moduleName": "DirectionUTurn20", "filepath": "direction--u-turn/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": "M26.5859,19.5859,22,24.1719V8a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,8V28H8V8H20V24.1719l-4.5859-4.586L14,21l7,7,7-7Z" } }], "name": "direction--u-turn", "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=\"M26.5859,19.5859,22,24.1719V8a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,8V28H8V8H20V24.1719l-4.5859-4.586L14,21l7,7,7-7Z\"></path></svg>" }, "16": { metadata: { "moduleName": "DirectionUTurn16", "filepath": "direction--u-turn/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": "M26.5859,19.5859,22,24.1719V8a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,8V28H8V8H20V24.1719l-4.5859-4.586L14,21l7,7,7-7Z" } }], "name": "direction--u-turn", "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=\"M26.5859,19.5859,22,24.1719V8a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,8V28H8V8H20V24.1719l-4.5859-4.586L14,21l7,7,7-7Z\"></path></svg>" }, }; } DirectionUTurnDirective_1 = DirectionUTurnDirective; DirectionUTurnDirective.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; DirectionUTurnDirective_1.titleIdCounter++; title.setAttribute("id", "direction-u-turn-" + DirectionUTurnDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "direction-u-turn-" + DirectionUTurnDirective_1.titleIdCounter); } }; var DirectionUTurnDirective_1; DirectionUTurnDirective.titleIdCounter = 0; DirectionUTurnDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], DirectionUTurnDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], DirectionUTurnDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], DirectionUTurnDirective.prototype, "size", void 0); DirectionUTurnDirective = DirectionUTurnDirective_1 = __decorate([ Directive({ selector: "[ibmIconDirectionUTurn]" }), __metadata("design:paramtypes", [ElementRef]) ], DirectionUTurnDirective); return DirectionUTurnDirective; }()); var DirectionUTurnModule = /** @class */ (function () { function DirectionUTurnModule() { } DirectionUTurnModule = __decorate([ NgModule({ declarations: [ DirectionUTurnComponent, DirectionUTurnDirective, ], exports: [ DirectionUTurnComponent, DirectionUTurnDirective, ] }) ], DirectionUTurnModule); return DirectionUTurnModule; }()); export { DirectionUTurnComponent, DirectionUTurnDirective, DirectionUTurnModule };