"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var prop_types_1 = __importDefault(require("prop-types"));
var classnames_1 = __importDefault(require("classnames"));
var SwitcherItem = /** @class */ (function (_super) {
    __extends(SwitcherItem, _super);
    function SwitcherItem() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onClick = function () {
            _this.context.onItemClick(_this.props.id);
        };
        return _this;
    }
    SwitcherItem.prototype.render = function () {
        var _a = this.props, children = _a.children, id = _a.id, label = _a.label, testAutomationId = _a.testAutomationId;
        var className = classnames_1.default('rc-switcher__item', {
            'rc-switcher__item_selected': this.context.selectedId === id
        });
        return (react_1.default.createElement("button", { "data-test-automation-id": testAutomationId, className: className, onClick: this.onClick, "aria-label": label }, children));
    };
    SwitcherItem.contextTypes = {
        selectedId: prop_types_1.default.string.isRequired,
        onItemClick: prop_types_1.default.func.isRequired
    };
    SwitcherItem.propTypes = {
        id: prop_types_1.default.string.isRequired,
        testAutomationId: prop_types_1.default.string,
        label: prop_types_1.default.string.isRequired
    };
    SwitcherItem.defaultProps = {
        testAutomationId: null
    };
    return SwitcherItem;
}(react_1.default.PureComponent));
exports.SwitcherItem = SwitcherItem;
//# sourceMappingURL=SwitcherItem.js.map