"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 __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var DashboardStyledComponents_1 = require("./DashboardStyledComponents");
var DashboardTextComponents_1 = require("./DashboardTextComponents");
var input_1 = require("../input");
var icons_1 = require("../icons");
var BalanceType;
(function (BalanceType) {
    BalanceType[BalanceType["AVAILABLE_BALANCE"] = 0] = "AVAILABLE_BALANCE";
    BalanceType[BalanceType["TOKEN_VOTING_BALANCE"] = 1] = "TOKEN_VOTING_BALANCE";
})(BalanceType = exports.BalanceType || (exports.BalanceType = {}));
exports.TransferTokenBalance = function (props) {
    return (React.createElement(DashboardStyledComponents_1.StyledTransferTokenBalance, null,
        React.createElement("span", null, props.label),
        React.createElement("span", null, props.cvl)));
};
exports.TransferTokenDropdownSelected = function (props) {
    return (React.createElement(DashboardStyledComponents_1.StyledTransferTokenDropdown, null,
        props.label,
        React.createElement(DashboardStyledComponents_1.StyledDropdownArrow, null,
            React.createElement(icons_1.DropdownArrow, null))));
};
var DashboardTransferTokenForm = /** @class */ (function (_super) {
    __extends(DashboardTransferTokenForm, _super);
    function DashboardTransferTokenForm(props) {
        var _this = _super.call(this, props) || this;
        _this.onClick = function (value) {
            if (value === BalanceType.AVAILABLE_BALANCE) {
                _this.setState({
                    dropdownValue: React.createElement(exports.TransferTokenBalance, { cvl: _this.props.cvlAvailableBalance, label: React.createElement(DashboardTextComponents_1.BalanceLabelText, null) }),
                    fromValue: React.createElement(exports.TransferTokenBalance, { cvl: _this.props.cvlVotingBalance, label: React.createElement(DashboardTextComponents_1.VotingBalanceLabelText, null) }),
                });
            }
            else {
                _this.setState({
                    dropdownValue: React.createElement(exports.TransferTokenBalance, { cvl: _this.props.cvlVotingBalance, label: React.createElement(DashboardTextComponents_1.VotingBalanceLabelText, null) }),
                    fromValue: React.createElement(exports.TransferTokenBalance, { cvl: _this.props.cvlAvailableBalance, label: React.createElement(DashboardTextComponents_1.BalanceLabelText, null) }),
                });
            }
            _this.props.renderTransferBalance(value);
        };
        _this.state = {
            dropdownValue: React.createElement(exports.TransferTokenBalance, { cvl: _this.props.cvlAvailableBalance, label: React.createElement(DashboardTextComponents_1.BalanceLabelText, null) }),
            fromValue: React.createElement(exports.TransferTokenBalance, { cvl: _this.props.cvlVotingBalance, label: React.createElement(DashboardTextComponents_1.VotingBalanceLabelText, null) }),
        };
        return _this;
    }
    DashboardTransferTokenForm.prototype.render = function () {
        var _this = this;
        return (React.createElement(DashboardStyledComponents_1.StyledTransferTokenForm, null,
            React.createElement(DashboardTextComponents_1.TransferTokenText, null),
            React.createElement(DashboardStyledComponents_1.StyledTransferTokenFormGroup, null,
                React.createElement(DashboardStyledComponents_1.StyledTransferTokenFormElement, null,
                    React.createElement("label", null, "From"),
                    React.createElement(input_1.Dropdown, { position: "left", target: React.createElement(exports.TransferTokenDropdownSelected, { label: this.state.dropdownValue }) },
                        React.createElement(input_1.DropdownGroup, null,
                            React.createElement(input_1.DropdownItem, null,
                                React.createElement("button", { onClick: function () { return _this.onClick(BalanceType.AVAILABLE_BALANCE); } },
                                    React.createElement(exports.TransferTokenBalance, { cvl: this.props.cvlAvailableBalance, label: React.createElement(DashboardTextComponents_1.BalanceLabelText, null) }))),
                            React.createElement(input_1.DropdownItem, null,
                                React.createElement("button", { onClick: function () { return _this.onClick(BalanceType.TOKEN_VOTING_BALANCE); } },
                                    React.createElement(exports.TransferTokenBalance, { cvl: this.props.cvlVotingBalance, label: React.createElement(DashboardTextComponents_1.VotingBalanceLabelText, null) })))))),
                React.createElement(DashboardStyledComponents_1.StyledTransferTokenFormElement, null,
                    React.createElement("label", null, "To"),
                    React.createElement(DashboardStyledComponents_1.StyledFromBalance, null, this.state.fromValue)),
                this.props.children,
                React.createElement(DashboardTextComponents_1.MetaMaskPopUpText, null))));
    };
    return DashboardTransferTokenForm;
}(React.Component));
exports.DashboardTransferTokenForm = DashboardTransferTokenForm;
//# sourceMappingURL=DashboardTransferTokenForm.js.map