UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 loc) 9.63 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var Mp4Component = /** @class */ (function () { function Mp4Component() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], Mp4Component.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], Mp4Component.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], Mp4Component.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], Mp4Component.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], Mp4Component.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], Mp4Component.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], Mp4Component.prototype, "size", void 0); Mp4Component = __decorate([ Component({ selector: "ibm-icon-mp4", template: "\n <svg\n ibmIconMp4\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 " }) ], Mp4Component); return Mp4Component; }()); var Mp4Directive = /** @class */ (function () { function Mp4Directive(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "Mp432", "filepath": "MP4/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": "M28 10v8h0V10m1-1H27v8H24V9H22V19h5v4h2V19h1V17H29V9zM14 23H12V9h6a2 2 0 012 2v5a2 2 0 01-2 2H14zm0-7h4V11H14zM8 9L6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9z" } }], "name": "MP4", "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=\"M28 10v8h0V10m1-1H27v8H24V9H22V19h5v4h2V19h1V17H29V9zM14 23H12V9h6a2 2 0 012 2v5a2 2 0 01-2 2H14zm0-7h4V11H14zM8 9L6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9z\"></path></svg>" }, "24": { metadata: { "moduleName": "Mp424", "filepath": "MP4/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": "M28 10v8h0V10m1-1H27v8H24V9H22V19h5v4h2V19h1V17H29V9zM14 23H12V9h6a2 2 0 012 2v5a2 2 0 01-2 2H14zm0-7h4V11H14zM8 9L6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9z" } }], "name": "MP4", "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=\"M28 10v8h0V10m1-1H27v8H24V9H22V19h5v4h2V19h1V17H29V9zM14 23H12V9h6a2 2 0 012 2v5a2 2 0 01-2 2H14zm0-7h4V11H14zM8 9L6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9z\"></path></svg>" }, "20": { metadata: { "moduleName": "Mp420", "filepath": "MP4/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": "M28 10v8h0V10m1-1H27v8H24V9H22V19h5v4h2V19h1V17H29V9zM14 23H12V9h6a2 2 0 012 2v5a2 2 0 01-2 2H14zm0-7h4V11H14zM8 9L6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9z" } }], "name": "MP4", "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=\"M28 10v8h0V10m1-1H27v8H24V9H22V19h5v4h2V19h1V17H29V9zM14 23H12V9h6a2 2 0 012 2v5a2 2 0 01-2 2H14zm0-7h4V11H14zM8 9L6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9z\"></path></svg>" }, "16": { metadata: { "moduleName": "Mp416", "filepath": "MP4/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": "M28 10v8h0V10m1-1H27v8H24V9H22V19h5v4h2V19h1V17H29V9zM14 23H12V9h6a2 2 0 012 2v5a2 2 0 01-2 2H14zm0-7h4V11H14zM8 9L6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9z" } }], "name": "MP4", "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=\"M28 10v8h0V10m1-1H27v8H24V9H22V19h5v4h2V19h1V17H29V9zM14 23H12V9h6a2 2 0 012 2v5a2 2 0 01-2 2H14zm0-7h4V11H14zM8 9L6.49 14 6 15.98 5.54 14 4 9 2 9 2 23 4 23 4 15 3.84 13 4.42 15 6 19.63 7.58 15 8.16 13 8 15 8 23 10 23 10 9 8 9z\"></path></svg>" }, }; } Mp4Directive_1 = Mp4Directive; Mp4Directive.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; Mp4Directive_1.titleIdCounter++; title.setAttribute("id", "mp4-" + Mp4Directive_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "mp4-" + Mp4Directive_1.titleIdCounter); } }; var Mp4Directive_1; Mp4Directive.titleIdCounter = 0; Mp4Directive.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], Mp4Directive.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], Mp4Directive.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], Mp4Directive.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], Mp4Directive.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], Mp4Directive.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], Mp4Directive.prototype, "size", void 0); Mp4Directive = Mp4Directive_1 = __decorate([ Directive({ selector: "[ibmIconMp4]" }), __metadata("design:paramtypes", [ElementRef]) ], Mp4Directive); return Mp4Directive; }()); var Mp4Module = /** @class */ (function () { function Mp4Module() { } Mp4Module = __decorate([ NgModule({ declarations: [ Mp4Component, Mp4Directive, ], exports: [ Mp4Component, Mp4Directive, ] }) ], Mp4Module); return Mp4Module; }()); export { Mp4Component, Mp4Directive, Mp4Module };