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 __());
    };
})();
import React from 'react';
import PropTypes from 'prop-types';
import classnames from '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('rc-switcher__item', {
            'rc-switcher__item_selected': this.context.selectedId === id
        });
        return (React.createElement("button", { "data-test-automation-id": testAutomationId, className: className, onClick: this.onClick, "aria-label": label }, children));
    };
    SwitcherItem.contextTypes = {
        selectedId: PropTypes.string.isRequired,
        onItemClick: PropTypes.func.isRequired
    };
    SwitcherItem.propTypes = {
        id: PropTypes.string.isRequired,
        testAutomationId: PropTypes.string,
        label: PropTypes.string.isRequired
    };
    SwitcherItem.defaultProps = {
        testAutomationId: null
    };
    return SwitcherItem;
}(React.PureComponent));
export { SwitcherItem };
//# sourceMappingURL=SwitcherItem.js.map