UNPKG

@carbon/icons-angular

Version:

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

174 lines (171 loc) 11.1 kB
import { __decorate, __metadata } from 'tslib'; import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core'; import { getAttributes } from '@carbon/icon-helpers'; var ViewOffFilledDirective_1; let ViewOffFilledComponent = class ViewOffFilledComponent { constructor() { this.focusable = false; } }; __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ViewOffFilledComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ViewOffFilledComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledComponent.prototype, "size", void 0); ViewOffFilledComponent = __decorate([ Component({ selector: "ibm-icon-view-off-filled", template: ` <svg ibmIconViewOffFilled [size]="size" [ariaLabel]="ariaLabel" [ariaLabelledby]="ariaLabelledby" [ariaHidden]="ariaHidden" [title]="title" [isFocusable]="focusable" [attr.class]="innerClass"> </svg> ` }) ], ViewOffFilledComponent); let ViewOffFilledDirective = ViewOffFilledDirective_1 = class ViewOffFilledDirective { constructor(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "ViewOffFilled32", "filepath": "view--off--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": "M30.94 15.66a16.4 16.4 0 00-5.73-7.45L30 3.41 28.59 2 2 28.59 3.41 30l5.1-5.09A15.38 15.38 0 0016 27 16.69 16.69 0 0030.94 16.34 1 1 0 0030.94 15.66zM16 22.5a6.46 6.46 0 01-3.83-1.26L14 19.43A4 4 0 0019.43 14l1.81-1.81A6.49 6.49 0 0116 22.5zM4.53 21.81l5-5A6.84 6.84 0 019.5 16 6.51 6.51 0 0116 9.5a6.84 6.84 0 01.79.05l3.78-3.77A14.39 14.39 0 0016 5 16.69 16.69 0 001.06 15.66a1 1 0 000 .68A15.86 15.86 0 004.53 21.81z" } }], "name": "view--off--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="M30.94 15.66a16.4 16.4 0 00-5.73-7.45L30 3.41 28.59 2 2 28.59 3.41 30l5.1-5.09A15.38 15.38 0 0016 27 16.69 16.69 0 0030.94 16.34 1 1 0 0030.94 15.66zM16 22.5a6.46 6.46 0 01-3.83-1.26L14 19.43A4 4 0 0019.43 14l1.81-1.81A6.49 6.49 0 0116 22.5zM4.53 21.81l5-5A6.84 6.84 0 019.5 16 6.51 6.51 0 0116 9.5a6.84 6.84 0 01.79.05l3.78-3.77A14.39 14.39 0 0016 5 16.69 16.69 0 001.06 15.66a1 1 0 000 .68A15.86 15.86 0 004.53 21.81z"></path></svg>` }, "24": { metadata: { "moduleName": "ViewOffFilled24", "filepath": "view--off--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": "M30.94 15.66a16.4 16.4 0 00-5.73-7.45L30 3.41 28.59 2 2 28.59 3.41 30l5.1-5.09A15.38 15.38 0 0016 27 16.69 16.69 0 0030.94 16.34 1 1 0 0030.94 15.66zM16 22.5a6.46 6.46 0 01-3.83-1.26L14 19.43A4 4 0 0019.43 14l1.81-1.81A6.49 6.49 0 0116 22.5zM4.53 21.81l5-5A6.84 6.84 0 019.5 16 6.51 6.51 0 0116 9.5a6.84 6.84 0 01.79.05l3.78-3.77A14.39 14.39 0 0016 5 16.69 16.69 0 001.06 15.66a1 1 0 000 .68A15.86 15.86 0 004.53 21.81z" } }], "name": "view--off--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="M30.94 15.66a16.4 16.4 0 00-5.73-7.45L30 3.41 28.59 2 2 28.59 3.41 30l5.1-5.09A15.38 15.38 0 0016 27 16.69 16.69 0 0030.94 16.34 1 1 0 0030.94 15.66zM16 22.5a6.46 6.46 0 01-3.83-1.26L14 19.43A4 4 0 0019.43 14l1.81-1.81A6.49 6.49 0 0116 22.5zM4.53 21.81l5-5A6.84 6.84 0 019.5 16 6.51 6.51 0 0116 9.5a6.84 6.84 0 01.79.05l3.78-3.77A14.39 14.39 0 0016 5 16.69 16.69 0 001.06 15.66a1 1 0 000 .68A15.86 15.86 0 004.53 21.81z"></path></svg>` }, "20": { metadata: { "moduleName": "ViewOffFilled20", "filepath": "view--off--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": "M30.94 15.66a16.4 16.4 0 00-5.73-7.45L30 3.41 28.59 2 2 28.59 3.41 30l5.1-5.09A15.38 15.38 0 0016 27 16.69 16.69 0 0030.94 16.34 1 1 0 0030.94 15.66zM16 22.5a6.46 6.46 0 01-3.83-1.26L14 19.43A4 4 0 0019.43 14l1.81-1.81A6.49 6.49 0 0116 22.5zM4.53 21.81l5-5A6.84 6.84 0 019.5 16 6.51 6.51 0 0116 9.5a6.84 6.84 0 01.79.05l3.78-3.77A14.39 14.39 0 0016 5 16.69 16.69 0 001.06 15.66a1 1 0 000 .68A15.86 15.86 0 004.53 21.81z" } }], "name": "view--off--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="M30.94 15.66a16.4 16.4 0 00-5.73-7.45L30 3.41 28.59 2 2 28.59 3.41 30l5.1-5.09A15.38 15.38 0 0016 27 16.69 16.69 0 0030.94 16.34 1 1 0 0030.94 15.66zM16 22.5a6.46 6.46 0 01-3.83-1.26L14 19.43A4 4 0 0019.43 14l1.81-1.81A6.49 6.49 0 0116 22.5zM4.53 21.81l5-5A6.84 6.84 0 019.5 16 6.51 6.51 0 0116 9.5a6.84 6.84 0 01.79.05l3.78-3.77A14.39 14.39 0 0016 5 16.69 16.69 0 001.06 15.66a1 1 0 000 .68A15.86 15.86 0 004.53 21.81z"></path></svg>` }, "16": { metadata: { "moduleName": "ViewOffFilled16", "filepath": "view--off--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": "M30.94 15.66a16.4 16.4 0 00-5.73-7.45L30 3.41 28.59 2 2 28.59 3.41 30l5.1-5.09A15.38 15.38 0 0016 27 16.69 16.69 0 0030.94 16.34 1 1 0 0030.94 15.66zM16 22.5a6.46 6.46 0 01-3.83-1.26L14 19.43A4 4 0 0019.43 14l1.81-1.81A6.49 6.49 0 0116 22.5zM4.53 21.81l5-5A6.84 6.84 0 019.5 16 6.51 6.51 0 0116 9.5a6.84 6.84 0 01.79.05l3.78-3.77A14.39 14.39 0 0016 5 16.69 16.69 0 001.06 15.66a1 1 0 000 .68A15.86 15.86 0 004.53 21.81z" } }], "name": "view--off--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="M30.94 15.66a16.4 16.4 0 00-5.73-7.45L30 3.41 28.59 2 2 28.59 3.41 30l5.1-5.09A15.38 15.38 0 0016 27 16.69 16.69 0 0030.94 16.34 1 1 0 0030.94 15.66zM16 22.5a6.46 6.46 0 01-3.83-1.26L14 19.43A4 4 0 0019.43 14l1.81-1.81A6.49 6.49 0 0116 22.5zM4.53 21.81l5-5A6.84 6.84 0 019.5 16 6.51 6.51 0 0116 9.5a6.84 6.84 0 01.79.05l3.78-3.77A14.39 14.39 0 0016 5 16.69 16.69 0 001.06 15.66a1 1 0 000 .68A15.86 15.86 0 004.53 21.81z"></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; ViewOffFilledDirective_1.titleIdCounter++; title.setAttribute("id", `view-off-filled-${ViewOffFilledDirective_1.titleIdCounter}`); svg.appendChild(title); svg.setAttribute("aria-labelledby", `view-off-filled-${ViewOffFilledDirective_1.titleIdCounter}`); } } }; ViewOffFilledDirective.titleIdCounter = 0; ViewOffFilledDirective.ctorParameters = () => [ { type: ElementRef } ]; __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ViewOffFilledDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], ViewOffFilledDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], ViewOffFilledDirective.prototype, "size", void 0); ViewOffFilledDirective = ViewOffFilledDirective_1 = __decorate([ Directive({ selector: "[ibmIconViewOffFilled]" }), __metadata("design:paramtypes", [ElementRef]) ], ViewOffFilledDirective); let ViewOffFilledModule = class ViewOffFilledModule { }; ViewOffFilledModule = __decorate([ NgModule({ declarations: [ ViewOffFilledComponent, ViewOffFilledDirective, ], exports: [ ViewOffFilledComponent, ViewOffFilledDirective, ] }) ], ViewOffFilledModule); export { ViewOffFilledComponent, ViewOffFilledDirective, ViewOffFilledModule };