import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../../directives/evo-ui-class.directive";
export class EvoSwitcherComponent {
    constructor() {
        this.onItemSelection = new EventEmitter();
    }
    get selectedIndex() {
        return this._selectedIndex;
    }
    set selectedIndex(index) {
        this._selectedIndex = index > this.items.length ? this.items.length - 1 : index;
    }
    handleItemClick(index) {
        this.selectedIndex = index;
        this.onItemSelection.emit(index);
    }
}
EvoSwitcherComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EvoSwitcherComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
EvoSwitcherComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: EvoSwitcherComponent, selector: "evo-switcher", inputs: { items: "items", selectedIndex: "selectedIndex" }, outputs: { onItemSelection: "onItemSelection" }, ngImport: i0, template: "<div class=\"evo-switcher\">\n    <div class=\"evo-switcher__item\"\n         *ngFor=\"let item of items; let i = index;\"\n         [evoUiClass]=\"{selected: i === selectedIndex}\"\n         (click)=\"handleItemClick(i)\">{{ item }}\n    </div>\n</div>\n", styles: [".evo-switcher{position:relative;display:flex;flex-wrap:nowrap;box-sizing:border-box;height:30px;overflow:hidden;background:#FFFFFF;border:solid 1px #78909c;border-radius:30px}.evo-switcher__item{width:140px;padding:6px 0;color:#435b67;font-weight:600;font-size:14px;line-height:16px;cursor:pointer;transition:.2s}.evo-switcher__item_selected{width:140px;color:#fff;background:#435B67;border-radius:30px}@media (max-width: 768px){:host{display:block;width:100%;height:60px;overflow:hidden;box-shadow:0 1px #ededed}.evo-switcher{justify-content:left;box-sizing:content-box;height:60px;padding-bottom:20px;overflow-x:scroll;overflow-y:hidden;background:none;border:none;border-radius:0}.evo-switcher__item{position:relative;display:flex;align-items:center;width:auto;height:60px;margin-right:30px;padding:20px 0;color:#546e7a;font-weight:700;font-size:14px;font-family:var(--evo-font-secondary);white-space:nowrap;text-transform:uppercase;text-decoration:none;background:none;transition:none}.evo-switcher__item_selected{color:#f05023}.evo-switcher__item_selected:before{position:absolute;right:0;bottom:0;left:0;height:3px;background-color:#f05023;content:\"\"}}\n"], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.EvoUiClassDirective, selector: "[evoUiClass]", inputs: ["class", "evoUiClass"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EvoSwitcherComponent, decorators: [{
            type: Component,
            args: [{ selector: 'evo-switcher', template: "<div class=\"evo-switcher\">\n    <div class=\"evo-switcher__item\"\n         *ngFor=\"let item of items; let i = index;\"\n         [evoUiClass]=\"{selected: i === selectedIndex}\"\n         (click)=\"handleItemClick(i)\">{{ item }}\n    </div>\n</div>\n", styles: [".evo-switcher{position:relative;display:flex;flex-wrap:nowrap;box-sizing:border-box;height:30px;overflow:hidden;background:#FFFFFF;border:solid 1px #78909c;border-radius:30px}.evo-switcher__item{width:140px;padding:6px 0;color:#435b67;font-weight:600;font-size:14px;line-height:16px;cursor:pointer;transition:.2s}.evo-switcher__item_selected{width:140px;color:#fff;background:#435B67;border-radius:30px}@media (max-width: 768px){:host{display:block;width:100%;height:60px;overflow:hidden;box-shadow:0 1px #ededed}.evo-switcher{justify-content:left;box-sizing:content-box;height:60px;padding-bottom:20px;overflow-x:scroll;overflow-y:hidden;background:none;border:none;border-radius:0}.evo-switcher__item{position:relative;display:flex;align-items:center;width:auto;height:60px;margin-right:30px;padding:20px 0;color:#546e7a;font-weight:700;font-size:14px;font-family:var(--evo-font-secondary);white-space:nowrap;text-transform:uppercase;text-decoration:none;background:none;transition:none}.evo-switcher__item_selected{color:#f05023}.evo-switcher__item_selected:before{position:absolute;right:0;bottom:0;left:0;height:3px;background-color:#f05023;content:\"\"}}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { items: [{
                type: Input
            }], onItemSelection: [{
                type: Output
            }], selectedIndex: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZvLXN3aXRjaGVyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2V2by11aS1raXQvc3JjL2xpYi9jb21wb25lbnRzL2V2by1zd2l0Y2hlci9ldm8tc3dpdGNoZXIuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvZXZvLXVpLWtpdC9zcmMvbGliL2NvbXBvbmVudHMvZXZvLXN3aXRjaGVyL2V2by1zd2l0Y2hlci5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDOzs7O0FBUXZFLE1BQU0sT0FBTyxvQkFBb0I7SUFNN0I7UUFKVSxvQkFBZSxHQUF5QixJQUFJLFlBQVksRUFBRSxDQUFDO0lBTXJFLENBQUM7SUFFRCxJQUFJLGFBQWE7UUFDYixPQUFPLElBQUksQ0FBQyxjQUFjLENBQUM7SUFDL0IsQ0FBQztJQUVELElBQWEsYUFBYSxDQUFDLEtBQWE7UUFDcEMsSUFBSSxDQUFDLGNBQWMsR0FBRyxLQUFLLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDO0lBQ3BGLENBQUM7SUFFRCxlQUFlLENBQUMsS0FBYTtRQUN6QixJQUFJLENBQUMsYUFBYSxHQUFHLEtBQUssQ0FBQztRQUMzQixJQUFJLEN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