@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
177 lines (172 loc) • 11.1 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.Select_02 = {}), global.tslib, global.ng.core, global.CarbonIconHelpers));
}(this, (function (exports, tslib, core, iconHelpers) { 'use strict';
var Select_02Component = /** @class */ (function () {
function Select_02Component() {
this.focusable = false;
}
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Component.prototype, "ariaLabel", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Component.prototype, "ariaLabelledby", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", Boolean)
], Select_02Component.prototype, "ariaHidden", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Component.prototype, "title", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", Boolean)
], Select_02Component.prototype, "focusable", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Component.prototype, "innerClass", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Component.prototype, "size", void 0);
Select_02Component = tslib.__decorate([
core.Component({
selector: "ibm-icon-select-02",
template: "\n <svg\n ibmIconSelect_02\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 "
})
], Select_02Component);
return Select_02Component;
}());
var Select_02Directive = /** @class */ (function () {
function Select_02Directive(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "Select_0232", "filepath": "select--02/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": "M12 6L8 6 8 2 6 2 6 6 2 6 2 8 6 8 6 12 8 12 8 8 12 8 12 6zM30 10V4H24V6H16V8h8v2h2V24H24v2H10V24H8V16H6v8H4v6h6V28H24v2h6V24H28V10zM8 28H6V26H8zm20 0H26V26h2zM26 6h2V8H26z" } }], "name": "select--02", "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=\"M12 6L8 6 8 2 6 2 6 6 2 6 2 8 6 8 6 12 8 12 8 8 12 8 12 6zM30 10V4H24V6H16V8h8v2h2V24H24v2H10V24H8V16H6v8H4v6h6V28H24v2h6V24H28V10zM8 28H6V26H8zm20 0H26V26h2zM26 6h2V8H26z\"></path></svg>"
},
"24": {
metadata: { "moduleName": "Select_0224", "filepath": "select--02/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": "M12 6L8 6 8 2 6 2 6 6 2 6 2 8 6 8 6 12 8 12 8 8 12 8 12 6zM30 10V4H24V6H16V8h8v2h2V24H24v2H10V24H8V16H6v8H4v6h6V28H24v2h6V24H28V10zM8 28H6V26H8zm20 0H26V26h2zM26 6h2V8H26z" } }], "name": "select--02", "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=\"M12 6L8 6 8 2 6 2 6 6 2 6 2 8 6 8 6 12 8 12 8 8 12 8 12 6zM30 10V4H24V6H16V8h8v2h2V24H24v2H10V24H8V16H6v8H4v6h6V28H24v2h6V24H28V10zM8 28H6V26H8zm20 0H26V26h2zM26 6h2V8H26z\"></path></svg>"
},
"20": {
metadata: { "moduleName": "Select_0220", "filepath": "select--02/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": "M12 6L8 6 8 2 6 2 6 6 2 6 2 8 6 8 6 12 8 12 8 8 12 8 12 6zM30 10V4H24V6H16V8h8v2h2V24H24v2H10V24H8V16H6v8H4v6h6V28H24v2h6V24H28V10zM8 28H6V26H8zm20 0H26V26h2zM26 6h2V8H26z" } }], "name": "select--02", "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=\"M12 6L8 6 8 2 6 2 6 6 2 6 2 8 6 8 6 12 8 12 8 8 12 8 12 6zM30 10V4H24V6H16V8h8v2h2V24H24v2H10V24H8V16H6v8H4v6h6V28H24v2h6V24H28V10zM8 28H6V26H8zm20 0H26V26h2zM26 6h2V8H26z\"></path></svg>"
},
"16": {
metadata: { "moduleName": "Select_0216", "filepath": "select--02/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": "M12 6L8 6 8 2 6 2 6 6 2 6 2 8 6 8 6 12 8 12 8 8 12 8 12 6zM30 10V4H24V6H16V8h8v2h2V24H24v2H10V24H8V16H6v8H4v6h6V28H24v2h6V24H28V10zM8 28H6V26H8zm20 0H26V26h2zM26 6h2V8H26z" } }], "name": "select--02", "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=\"M12 6L8 6 8 2 6 2 6 6 2 6 2 8 6 8 6 12 8 12 8 8 12 8 12 6zM30 10V4H24V6H16V8h8v2h2V24H24v2H10V24H8V16H6v8H4v6h6V28H24v2h6V24H28V10zM8 28H6V26H8zm20 0H26V26h2zM26 6h2V8H26z\"></path></svg>"
},
};
}
Select_02Directive_1 = Select_02Directive;
Select_02Directive.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;
Select_02Directive_1.titleIdCounter++;
title.setAttribute("id", "select-02-" + Select_02Directive_1.titleIdCounter);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", "select-02-" + Select_02Directive_1.titleIdCounter);
}
};
var Select_02Directive_1;
Select_02Directive.titleIdCounter = 0;
Select_02Directive.ctorParameters = function () { return [
{ type: core.ElementRef }
]; };
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Directive.prototype, "ariaLabel", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Directive.prototype, "ariaLabelledby", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", Boolean)
], Select_02Directive.prototype, "ariaHidden", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Directive.prototype, "title", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", Boolean)
], Select_02Directive.prototype, "isFocusable", void 0);
tslib.__decorate([
core.Input(),
tslib.__metadata("design:type", String)
], Select_02Directive.prototype, "size", void 0);
Select_02Directive = Select_02Directive_1 = tslib.__decorate([
core.Directive({
selector: "[ibmIconSelect_02]"
}),
tslib.__metadata("design:paramtypes", [core.ElementRef])
], Select_02Directive);
return Select_02Directive;
}());
var Select_02Module = /** @class */ (function () {
function Select_02Module() {
}
Select_02Module = tslib.__decorate([
core.NgModule({
declarations: [
Select_02Component,
Select_02Directive,
],
exports: [
Select_02Component,
Select_02Directive,
]
})
], Select_02Module);
return Select_02Module;
}());
exports.Select_02Component = Select_02Component;
exports.Select_02Directive = Select_02Directive;
exports.Select_02Module = Select_02Module;
Object.defineProperty(exports, '__esModule', { value: true });
})));