'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 __());
    };
})();
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Dropdown, SplitButton as BSSplitButton } from 'react-bootstrap';
import { Button } from './Button';
import lang from '../../lang/common/index-en_US';
var SplitToggle = BSSplitButton['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('split-button', className);
        var splitDecoratorClassNames = classnames('split-button-decorator', "split-button-decorator-" + bsStyle);
        return (React.createElement(Dropdown, { id: id || Date.now().toString(), className: splitButtonClassNames, disabled: disabled || (buttonDisabled && splitToggleDisabled), "data-test-automation-id": testAutomationId },
            React.createElement("div", { className: splitDecoratorClassNames },
                React.createElement(Button, { className: "split-button-btn", bsStyle: bsStyle, disabled: disabled || buttonDisabled, onClick: onClick }, title)),
            React.createElement(SplitToggle, { bsStyle: bsStyle, "data-test-automation-id": "splitToggle", className: "split-button-dropdown-toggle", "aria-label": splitToggleLabel }),
            React.createElement(Dropdown.Menu, null, children)));
    };
    SplitButton.propTypes = {
        children: PropTypes.node.isRequired,
        id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
        testAutomationId: PropTypes.string,
        className: PropTypes.string,
        bsStyle: PropTypes.string,
        disabled: PropTypes.bool,
        buttonDisabled: PropTypes.bool,
        splitToggleDisabled: PropTypes.bool,
        splitToggleLabel: PropTypes.string,
        title: PropTypes.string,
        onClick: PropTypes.func
    };
    SplitButton.defaultProps = {
        id: null,
        testAutomationId: 'splitButton',
        className: null,
        bsStyle: 'primary',
        disabled: false,
        buttonDisabled: false,
        splitToggleDisabled: false,
        get splitToggleLabel() {
            return lang.MORE_OPTIONS;
        },
        title: '',
        onClick: null
    };
    return SplitButton;
}(React.Component));
export { SplitButton };
//# sourceMappingURL=SplitButton.js.map