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 { Button } from '../../Button';
import { Block } from '../../Block';
var instanceCounter = 0;
var TimeAmPmEditor = /** @class */ (function (_super) {
    __extends(TimeAmPmEditor, _super);
    function TimeAmPmEditor(props, ctx) {
        var _this = _super.call(this, props, ctx) || this;
        _this.handleToggleAmPM = function () {
            var _a = _this.props, isAm = _a.isAm, onAmPmChange = _a.onAmPmChange;
            onAmPmChange(!isAm);
        };
        _this.getTitle = function () {
            var _a = _this.props, isAm = _a.isAm, enableAMTitle = _a.enableAMTitle, enablePMTitle = _a.enablePMTitle;
            return isAm ? enablePMTitle : enableAMTitle;
        };
        _this.instanceId = instanceCounter++;
        return _this;
    }
    TimeAmPmEditor.prototype.render = function () {
        var _a = this.props, isAm = _a.isAm, amPmSwitcherLabel = _a.amPmSwitcherLabel, amLabel = _a.amLabel, pmLabel = _a.pmLabel;
        var descriptionId = "amPmSwitcherDescription-" + this.instanceId;
        return (React.createElement(Block, { className: "rc-datepicker-am-pm-button", testAutomationId: "amPmSwitcher" },
            React.createElement("p", { className: "sr-only", id: descriptionId }, this.getTitle()),
            React.createElement("div", { className: "text-center time-text" },
                React.createElement(Button, { testAutomationId: "amPmSwitchButton", onClick: this.handleToggleAmPM, bsStyle: "primary", "aria-label": amPmSwitcherLabel, title: this.getTitle(), "aria-describedby": descriptionId }, isAm ? amLabel : pmLabel))));
    };
    TimeAmPmEditor.propTypes = {
        isAm: PropTypes.bool.isRequired,
        onAmPmChange: PropTypes.func.isRequired,
        amLabel: PropTypes.string.isRequired,
        pmLabel: PropTypes.string.isRequired,
        amPmSwitcherLabel: PropTypes.string.isRequired,
        enablePMTitle: PropTypes.string.isRequired,
        enableAMTitle: PropTypes.string.isRequired
    };
    return TimeAmPmEditor;
}(React.PureComponent));
export { TimeAmPmEditor };
//# sourceMappingURL=TimeAmPmEditor.js.map