'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 react_bootstrap_1 = require("react-bootstrap");
var Button_1 = require("./Button");
var index_en_US_1 = __importDefault(require("../../lang/common/index-en_US"));
var SplitToggle = react_bootstrap_1.SplitButton['Toggle']; // TODO (UIA-78226) WMC fix react-bootstrap typings
var SplitButton = /** @class */ (function (_super) {
    __extends(SplitButton, _super);
    function SplitButton() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SplitButton.prototype.render = function () {
        var _a = this.props, id = _a.id, testAutomationId = _a.testAutomationId, className = _a.className, bsStyle = _a.bsStyle, disabled = _a.disabled, buttonDisabled = _a.buttonDisabled, splitToggleDisabled = _a.splitToggleDisabled, splitToggleLabel = _a.splitToggleLabel, title = _a.title, onClick = _a.onClick, children = _a.children;
        var splitButtonClassNames = classnames_1.default('split-button', className);
        var splitDecoratorClassNames = classnames_1.default('split-button-decorator', "split-button-decorator-" + bsStyle);
        return (react_1.default.createElement(react_bootstrap_1.Dropdown, { id: id || Date.now().toString(), className: splitButtonClassNames, disabled: disabled || (buttonDisabled && splitToggleDisabled), "data-test-automation-id": testAutomationId },
            react_1.default.createElement("div", { className: splitDecoratorClassNames },
                react_1.default.createElement(Button_1.Button, { className: "split-button-btn", bsStyle: bsStyle, disabled: disabled || buttonDisabled, onClick: onClick }, title)),
            react_1.default.createElement(SplitToggle, { bsStyle: bsStyle, "data-test-automation-id": "splitToggle", className: "split-button-dropdown-toggle", "aria-label": splitToggleLabel }),
            react_1.default.createElement(react_bootstrap_1.Dropdown.Menu, null, children)));
    };
    SplitButton.propTypes = {
        children: prop_types_1.default.node.isRequired,
        id: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.number]),
        testAutomationId: prop_types_1.default.string,
        className: prop_types_1.default.string,
        bsStyle: prop_types_1.default.string,
        disabled: prop_types_1.default.bool,
        buttonDisabled: prop_types_1.default.bool,
        splitToggleDisabled: prop_types_1.default.bool,
        splitToggleLabel: prop_types_1.default.string,
        title: prop_types_1.default.string,
        onClick: prop_types_1.default.func
    };
    SplitButton.defaultProps = {
        id: null,
        testAutomationId: 'splitButton',
        className: null,
        bsStyle: 'primary',
        disabled: false,
        buttonDisabled: false,
        splitToggleDisabled: false,
        get splitToggleLabel() {
            return index_en_US_1.default.MORE_OPTIONS;
        },
        title: '',
        onClick: null
    };
    return SplitButton;
}(react_1.default.Component));
exports.SplitButton = SplitButton;
//# sourceMappingURL=SplitButton.js.map