UNPKG

carbon-components-angular

Version:
60 lines (57 loc) 2.17 kB
/*! * * Neutrino v0.0.0 | content-switcher.component.js * * Copyright 2014, 2018 IBM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Component, Input, ContentChildren, QueryList, Output, EventEmitter } from "@angular/core"; import { ContentSwitcherOption } from "./content-switcher-option.directive"; /** * * */ var ContentSwitcher = /** @class */ (function () { function ContentSwitcher() { this.label = "content switcher"; this.selected = new EventEmitter(); } ContentSwitcher.prototype.ngAfterViewInit = function () { var _this = this; this.options.forEach(function (option) { option.selected.subscribe(function (_) { var active = option; _this.options.forEach(function (option) { if (option !== active) { option.active = false; } }); _this.selected.emit(active); }); }); }; ContentSwitcher.decorators = [ { type: Component, args: [{ selector: "ibm-content-switcher", template: "\n\t\t<div\n\t\t\t[attr.aria-label]=\"label\"\n\t\t\tclass=\"bx--content-switcher\"\n\t\t\trole=\"tablist\">\n\t\t\t<ng-content></ng-content>\n\t\t</div>\n\t" },] }, ]; ContentSwitcher.propDecorators = { label: [{ type: Input }], selected: [{ type: Output }], options: [{ type: ContentChildren, args: [ContentSwitcherOption,] }] }; return ContentSwitcher; }()); export { ContentSwitcher }; //# sourceMappingURL=content-switcher.component.js.map