@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
177 lines (172 loc) • 13.7 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('/core'), require('@carbon/icon-helpers')) :
typeof define === 'function' && define.amd ? define(['exports', 'tslib', '/core', '@carbon/icon-helpers'], factory) :
(global = global || self, factory((global.CarbonIconsAngular = global.CarbonIconsAngular || {}, global.CarbonIconsAngular.NoodleBowl = {}), global.tslib, global.ng.core, global.CarbonIconHelpers));
}(this, (function (exports, tslib, core, iconHelpers) { 'use strict';
var NoodleBowlComponent = /** @class */ (function () {
function NoodleBowlComponent() {
this.focusable = false;
}
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlComponent.prototype, "ariaLabel", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlComponent.prototype, "ariaLabelledby", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", Boolean)
], NoodleBowlComponent.prototype, "ariaHidden", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlComponent.prototype, "title", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", Boolean)
], NoodleBowlComponent.prototype, "focusable", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlComponent.prototype, "innerClass", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlComponent.prototype, "size", void 0);
NoodleBowlComponent = tslib.__decorate([
core.Component({
selector: "ibm-icon-noodle-bowl",
template: "\n <svg\n ibmIconNoodleBowl\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 "
})
], NoodleBowlComponent);
return NoodleBowlComponent;
}());
var NoodleBowlDirective = /** @class */ (function () {
function NoodleBowlDirective(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "NoodleBowl32", "filepath": "noodle-bowl/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": "M11.4141,15l-8-8L2,8.4141,8.5859,15H2v1a14,14,0,0,0,28,0V15ZM16,28A12.0166,12.0166,0,0,1,4.0415,17h23.917A12.0166,12.0166,0,0,1,16,28Z" } }, { "elem": "path", "attrs": { "d": "M22,8a5.0049,5.0049,0,0,0-1.5708.2554A8.0242,8.0242,0,0,0,14,5,7.9364,7.9364,0,0,0,9.0938,6.68L4.4141,2,3,3.4141,9.05,9.4648l.707-.7075A5.96,5.96,0,0,1,14,7a6.02,6.02,0,0,1,4.6875,2.2642,5.06,5.06,0,0,0-.59.61A2.9892,2.9892,0,0,1,15.7544,11H12v2h3.7544a4.98,4.98,0,0,0,3.9033-1.8745A3,3,0,0,1,25,13h2A5.0059,5.0059,0,0,0,22,8Z" } }], "name": "noodle-bowl", "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=\"M11.4141,15l-8-8L2,8.4141,8.5859,15H2v1a14,14,0,0,0,28,0V15ZM16,28A12.0166,12.0166,0,0,1,4.0415,17h23.917A12.0166,12.0166,0,0,1,16,28Z\"></path><path d=\"M22,8a5.0049,5.0049,0,0,0-1.5708.2554A8.0242,8.0242,0,0,0,14,5,7.9364,7.9364,0,0,0,9.0938,6.68L4.4141,2,3,3.4141,9.05,9.4648l.707-.7075A5.96,5.96,0,0,1,14,7a6.02,6.02,0,0,1,4.6875,2.2642,5.06,5.06,0,0,0-.59.61A2.9892,2.9892,0,0,1,15.7544,11H12v2h3.7544a4.98,4.98,0,0,0,3.9033-1.8745A3,3,0,0,1,25,13h2A5.0059,5.0059,0,0,0,22,8Z\"></path></svg>"
},
"24": {
metadata: { "moduleName": "NoodleBowl24", "filepath": "noodle-bowl/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": "M11.4141,15l-8-8L2,8.4141,8.5859,15H2v1a14,14,0,0,0,28,0V15ZM16,28A12.0166,12.0166,0,0,1,4.0415,17h23.917A12.0166,12.0166,0,0,1,16,28Z" } }, { "elem": "path", "attrs": { "d": "M22,8a5.0049,5.0049,0,0,0-1.5708.2554A8.0242,8.0242,0,0,0,14,5,7.9364,7.9364,0,0,0,9.0938,6.68L4.4141,2,3,3.4141,9.05,9.4648l.707-.7075A5.96,5.96,0,0,1,14,7a6.02,6.02,0,0,1,4.6875,2.2642,5.06,5.06,0,0,0-.59.61A2.9892,2.9892,0,0,1,15.7544,11H12v2h3.7544a4.98,4.98,0,0,0,3.9033-1.8745A3,3,0,0,1,25,13h2A5.0059,5.0059,0,0,0,22,8Z" } }], "name": "noodle-bowl", "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=\"M11.4141,15l-8-8L2,8.4141,8.5859,15H2v1a14,14,0,0,0,28,0V15ZM16,28A12.0166,12.0166,0,0,1,4.0415,17h23.917A12.0166,12.0166,0,0,1,16,28Z\"></path><path d=\"M22,8a5.0049,5.0049,0,0,0-1.5708.2554A8.0242,8.0242,0,0,0,14,5,7.9364,7.9364,0,0,0,9.0938,6.68L4.4141,2,3,3.4141,9.05,9.4648l.707-.7075A5.96,5.96,0,0,1,14,7a6.02,6.02,0,0,1,4.6875,2.2642,5.06,5.06,0,0,0-.59.61A2.9892,2.9892,0,0,1,15.7544,11H12v2h3.7544a4.98,4.98,0,0,0,3.9033-1.8745A3,3,0,0,1,25,13h2A5.0059,5.0059,0,0,0,22,8Z\"></path></svg>"
},
"20": {
metadata: { "moduleName": "NoodleBowl20", "filepath": "noodle-bowl/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": "M11.4141,15l-8-8L2,8.4141,8.5859,15H2v1a14,14,0,0,0,28,0V15ZM16,28A12.0166,12.0166,0,0,1,4.0415,17h23.917A12.0166,12.0166,0,0,1,16,28Z" } }, { "elem": "path", "attrs": { "d": "M22,8a5.0049,5.0049,0,0,0-1.5708.2554A8.0242,8.0242,0,0,0,14,5,7.9364,7.9364,0,0,0,9.0938,6.68L4.4141,2,3,3.4141,9.05,9.4648l.707-.7075A5.96,5.96,0,0,1,14,7a6.02,6.02,0,0,1,4.6875,2.2642,5.06,5.06,0,0,0-.59.61A2.9892,2.9892,0,0,1,15.7544,11H12v2h3.7544a4.98,4.98,0,0,0,3.9033-1.8745A3,3,0,0,1,25,13h2A5.0059,5.0059,0,0,0,22,8Z" } }], "name": "noodle-bowl", "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=\"M11.4141,15l-8-8L2,8.4141,8.5859,15H2v1a14,14,0,0,0,28,0V15ZM16,28A12.0166,12.0166,0,0,1,4.0415,17h23.917A12.0166,12.0166,0,0,1,16,28Z\"></path><path d=\"M22,8a5.0049,5.0049,0,0,0-1.5708.2554A8.0242,8.0242,0,0,0,14,5,7.9364,7.9364,0,0,0,9.0938,6.68L4.4141,2,3,3.4141,9.05,9.4648l.707-.7075A5.96,5.96,0,0,1,14,7a6.02,6.02,0,0,1,4.6875,2.2642,5.06,5.06,0,0,0-.59.61A2.9892,2.9892,0,0,1,15.7544,11H12v2h3.7544a4.98,4.98,0,0,0,3.9033-1.8745A3,3,0,0,1,25,13h2A5.0059,5.0059,0,0,0,22,8Z\"></path></svg>"
},
"16": {
metadata: { "moduleName": "NoodleBowl16", "filepath": "noodle-bowl/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": "M11.4141,15l-8-8L2,8.4141,8.5859,15H2v1a14,14,0,0,0,28,0V15ZM16,28A12.0166,12.0166,0,0,1,4.0415,17h23.917A12.0166,12.0166,0,0,1,16,28Z" } }, { "elem": "path", "attrs": { "d": "M22,8a5.0049,5.0049,0,0,0-1.5708.2554A8.0242,8.0242,0,0,0,14,5,7.9364,7.9364,0,0,0,9.0938,6.68L4.4141,2,3,3.4141,9.05,9.4648l.707-.7075A5.96,5.96,0,0,1,14,7a6.02,6.02,0,0,1,4.6875,2.2642,5.06,5.06,0,0,0-.59.61A2.9892,2.9892,0,0,1,15.7544,11H12v2h3.7544a4.98,4.98,0,0,0,3.9033-1.8745A3,3,0,0,1,25,13h2A5.0059,5.0059,0,0,0,22,8Z" } }], "name": "noodle-bowl", "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=\"M11.4141,15l-8-8L2,8.4141,8.5859,15H2v1a14,14,0,0,0,28,0V15ZM16,28A12.0166,12.0166,0,0,1,4.0415,17h23.917A12.0166,12.0166,0,0,1,16,28Z\"></path><path d=\"M22,8a5.0049,5.0049,0,0,0-1.5708.2554A8.0242,8.0242,0,0,0,14,5,7.9364,7.9364,0,0,0,9.0938,6.68L4.4141,2,3,3.4141,9.05,9.4648l.707-.7075A5.96,5.96,0,0,1,14,7a6.02,6.02,0,0,1,4.6875,2.2642,5.06,5.06,0,0,0-.59.61A2.9892,2.9892,0,0,1,15.7544,11H12v2h3.7544a4.98,4.98,0,0,0,3.9033-1.8745A3,3,0,0,1,25,13h2A5.0059,5.0059,0,0,0,22,8Z\"></path></svg>"
},
};
}
NoodleBowlDirective_1 = NoodleBowlDirective;
NoodleBowlDirective.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 = iconHelpers.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;
NoodleBowlDirective_1.titleIdCounter++;
title.setAttribute("id", "noodle-bowl-" + NoodleBowlDirective_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "noodle-bowl-" + NoodleBowlDirective_1.titleIdCounter);
}
};
var NoodleBowlDirective_1;
NoodleBowlDirective.titleIdCounter = 0;
NoodleBowlDirective.ctorParameters = function () { return [
{ type: core.ElementRef }
]; };
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlDirective.prototype, "ariaLabel", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlDirective.prototype, "ariaLabelledby", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", Boolean)
], NoodleBowlDirective.prototype, "ariaHidden", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlDirective.prototype, "title", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", Boolean)
], NoodleBowlDirective.prototype, "isFocusable", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], NoodleBowlDirective.prototype, "size", void 0);
NoodleBowlDirective = NoodleBowlDirective_1 = tslib.__decorate([
core.Directive({
selector: "[ibmIconNoodleBowl]"
}),
tslib.__metadata("design:paramtypes", [core.ElementRef])
], NoodleBowlDirective);
return NoodleBowlDirective;
}());
var NoodleBowlModule = /** @class */ (function () {
function NoodleBowlModule() {
}
NoodleBowlModule = tslib.__decorate([
core.NgModule({
declarations: [
NoodleBowlComponent,
NoodleBowlDirective,
],
exports: [
NoodleBowlComponent,
NoodleBowlDirective,
]
})
], NoodleBowlModule);
return NoodleBowlModule;
}());
exports.NoodleBowlComponent = NoodleBowlComponent;
exports.NoodleBowlDirective = NoodleBowlDirective;
exports.NoodleBowlModule = NoodleBowlModule;
Object.defineProperty(exports, '__esModule', { value: true });
})));