UNPKG

@carbon/icons-angular

Version:

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

169 lines (166 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 WirelessCheckoutComponent = /** @class */ (function () { function WirelessCheckoutComponent() { this.focusable = false; } __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutComponent.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutComponent.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WirelessCheckoutComponent.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutComponent.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WirelessCheckoutComponent.prototype, "focusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutComponent.prototype, "innerClass", void 0); __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutComponent.prototype, "size", void 0); WirelessCheckoutComponent = __decorate([ Component({ selector: "ibm-icon-wireless-checkout", template: "\n <svg\n ibmIconWirelessCheckout\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 " }) ], WirelessCheckoutComponent); return WirelessCheckoutComponent; }()); var WirelessCheckoutDirective = /** @class */ (function () { function WirelessCheckoutDirective(elementRef) { this.elementRef = elementRef; this.isFocusable = false; this.icons = { "32": { metadata: { "moduleName": "WirelessCheckout32", "filepath": "wireless-checkout/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": "M18,28V26A10,10,0,0,0,28,16h2A12,12,0,0,1,18,28Z" } }, { "elem": "path", "attrs": { "d": "M18,23V21a5,5,0,0,0,5-5h2A7,7,0,0,1,18,23Z" } }, { "elem": "path", "attrs": { "d": "M27,11H21V7a3,3,0,0,0-3-3H12A3,3,0,0,0,9,7v4H3a1,1,0,0,0-1,1.15L3.88,24.3a2,2,0,0,0,2,1.7H15V24H5.86L4.17,13H27ZM11,7a1,1,0,0,1,1-1h6a1,1,0,0,1,1,1v4H11Z" } }], "name": "wireless-checkout", "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=\"M18,28V26A10,10,0,0,0,28,16h2A12,12,0,0,1,18,28Z\"></path><path d=\"M18,23V21a5,5,0,0,0,5-5h2A7,7,0,0,1,18,23Z\"></path><path d=\"M27,11H21V7a3,3,0,0,0-3-3H12A3,3,0,0,0,9,7v4H3a1,1,0,0,0-1,1.15L3.88,24.3a2,2,0,0,0,2,1.7H15V24H5.86L4.17,13H27ZM11,7a1,1,0,0,1,1-1h6a1,1,0,0,1,1,1v4H11Z\"></path></svg>" }, "24": { metadata: { "moduleName": "WirelessCheckout24", "filepath": "wireless-checkout/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": "M18,28V26A10,10,0,0,0,28,16h2A12,12,0,0,1,18,28Z" } }, { "elem": "path", "attrs": { "d": "M18,23V21a5,5,0,0,0,5-5h2A7,7,0,0,1,18,23Z" } }, { "elem": "path", "attrs": { "d": "M27,11H21V7a3,3,0,0,0-3-3H12A3,3,0,0,0,9,7v4H3a1,1,0,0,0-1,1.15L3.88,24.3a2,2,0,0,0,2,1.7H15V24H5.86L4.17,13H27ZM11,7a1,1,0,0,1,1-1h6a1,1,0,0,1,1,1v4H11Z" } }], "name": "wireless-checkout", "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=\"M18,28V26A10,10,0,0,0,28,16h2A12,12,0,0,1,18,28Z\"></path><path d=\"M18,23V21a5,5,0,0,0,5-5h2A7,7,0,0,1,18,23Z\"></path><path d=\"M27,11H21V7a3,3,0,0,0-3-3H12A3,3,0,0,0,9,7v4H3a1,1,0,0,0-1,1.15L3.88,24.3a2,2,0,0,0,2,1.7H15V24H5.86L4.17,13H27ZM11,7a1,1,0,0,1,1-1h6a1,1,0,0,1,1,1v4H11Z\"></path></svg>" }, "20": { metadata: { "moduleName": "WirelessCheckout20", "filepath": "wireless-checkout/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": "M18,28V26A10,10,0,0,0,28,16h2A12,12,0,0,1,18,28Z" } }, { "elem": "path", "attrs": { "d": "M18,23V21a5,5,0,0,0,5-5h2A7,7,0,0,1,18,23Z" } }, { "elem": "path", "attrs": { "d": "M27,11H21V7a3,3,0,0,0-3-3H12A3,3,0,0,0,9,7v4H3a1,1,0,0,0-1,1.15L3.88,24.3a2,2,0,0,0,2,1.7H15V24H5.86L4.17,13H27ZM11,7a1,1,0,0,1,1-1h6a1,1,0,0,1,1,1v4H11Z" } }], "name": "wireless-checkout", "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=\"M18,28V26A10,10,0,0,0,28,16h2A12,12,0,0,1,18,28Z\"></path><path d=\"M18,23V21a5,5,0,0,0,5-5h2A7,7,0,0,1,18,23Z\"></path><path d=\"M27,11H21V7a3,3,0,0,0-3-3H12A3,3,0,0,0,9,7v4H3a1,1,0,0,0-1,1.15L3.88,24.3a2,2,0,0,0,2,1.7H15V24H5.86L4.17,13H27ZM11,7a1,1,0,0,1,1-1h6a1,1,0,0,1,1,1v4H11Z\"></path></svg>" }, "16": { metadata: { "moduleName": "WirelessCheckout16", "filepath": "wireless-checkout/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": "M18,28V26A10,10,0,0,0,28,16h2A12,12,0,0,1,18,28Z" } }, { "elem": "path", "attrs": { "d": "M18,23V21a5,5,0,0,0,5-5h2A7,7,0,0,1,18,23Z" } }, { "elem": "path", "attrs": { "d": "M27,11H21V7a3,3,0,0,0-3-3H12A3,3,0,0,0,9,7v4H3a1,1,0,0,0-1,1.15L3.88,24.3a2,2,0,0,0,2,1.7H15V24H5.86L4.17,13H27ZM11,7a1,1,0,0,1,1-1h6a1,1,0,0,1,1,1v4H11Z" } }], "name": "wireless-checkout", "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=\"M18,28V26A10,10,0,0,0,28,16h2A12,12,0,0,1,18,28Z\"></path><path d=\"M18,23V21a5,5,0,0,0,5-5h2A7,7,0,0,1,18,23Z\"></path><path d=\"M27,11H21V7a3,3,0,0,0-3-3H12A3,3,0,0,0,9,7v4H3a1,1,0,0,0-1,1.15L3.88,24.3a2,2,0,0,0,2,1.7H15V24H5.86L4.17,13H27ZM11,7a1,1,0,0,1,1-1h6a1,1,0,0,1,1,1v4H11Z\"></path></svg>" }, }; } WirelessCheckoutDirective_1 = WirelessCheckoutDirective; WirelessCheckoutDirective.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; WirelessCheckoutDirective_1.titleIdCounter++; title.setAttribute("id", "wireless-checkout-" + WirelessCheckoutDirective_1.titleIdCounter); svg.appendChild(title); svg.setAttribute("aria-labelledby", "wireless-checkout-" + WirelessCheckoutDirective_1.titleIdCounter); } }; var WirelessCheckoutDirective_1; WirelessCheckoutDirective.titleIdCounter = 0; WirelessCheckoutDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutDirective.prototype, "ariaLabel", void 0); __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutDirective.prototype, "ariaLabelledby", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WirelessCheckoutDirective.prototype, "ariaHidden", void 0); __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutDirective.prototype, "title", void 0); __decorate([ Input(), __metadata("design:type", Boolean) ], WirelessCheckoutDirective.prototype, "isFocusable", void 0); __decorate([ Input(), __metadata("design:type", String) ], WirelessCheckoutDirective.prototype, "size", void 0); WirelessCheckoutDirective = WirelessCheckoutDirective_1 = __decorate([ Directive({ selector: "[ibmIconWirelessCheckout]" }), __metadata("design:paramtypes", [ElementRef]) ], WirelessCheckoutDirective); return WirelessCheckoutDirective; }()); var WirelessCheckoutModule = /** @class */ (function () { function WirelessCheckoutModule() { } WirelessCheckoutModule = __decorate([ NgModule({ declarations: [ WirelessCheckoutComponent, WirelessCheckoutDirective, ], exports: [ WirelessCheckoutComponent, WirelessCheckoutDirective, ] }) ], WirelessCheckoutModule); return WirelessCheckoutModule; }()); export { WirelessCheckoutComponent, WirelessCheckoutDirective, WirelessCheckoutModule };