"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 PaymentsStyledComponents_1 = require("./PaymentsStyledComponents");
var PaymentsTextComponents_1 = require("./PaymentsTextComponents");
var PaymentsRadio_1 = require("./PaymentsRadio");
var elements_1 = require("@joincivil/elements");
var input_1 = require("../input");
var PaymentsAmount = /** @class */ (function (_super) {
    __extends(PaymentsAmount, _super);
    function PaymentsAmount(props) {
        var _this = _super.call(this, props) || this;
        _this.handleShowInput = function () {
            _this.setState({ showInput: true });
        };
        _this.handleCheckBox = function () {
            _this.setState({
                shouldPublicizeChecked: !_this.state.shouldPublicizeChecked,
                shouldPublicize: !_this.state.shouldPublicize,
            });
        };
        _this.handleRadioSelection = function (name, value) {
            _this.setState({ usdToSpend: value });
        };
        _this.handleAmountInput = function (name, value) {
            _this.setState({ usdToSpend: value });
        };
        _this.state = {
            showInput: false,
            shouldPublicizeChecked: false,
            shouldPublicize: true,
            usdToSpend: 0,
        };
        return _this;
    }
    PaymentsAmount.prototype.render = function () {
        var _this = this;
        var disableNext = this.state.usdToSpend === 0;
        return (React.createElement(React.Fragment, null,
            React.createElement(PaymentsStyledComponents_1.PaymentDirectionsStyled, null,
                React.createElement(PaymentsTextComponents_1.SelectPaymentAmountText, null)),
            React.createElement(elements_1.RadioInput, { onChange: this.handleRadioSelection, label: "", name: "SuggestedAmounts" }, this.props.suggestedAmounts.map(function (item, i) { return (React.createElement(PaymentsRadio_1.PaymentsRadio, { value: item.amount, key: i },
                "$",
                item.amount,
                React.createElement("span", null, "USD"))); })),
            React.createElement(PaymentsStyledComponents_1.PaymentAmountUserInput, null, this.state.showInput ? (React.createElement(elements_1.CurrencyInput, { icon: React.createElement(React.Fragment, null, "$"), name: "CurrencyInput", onChange: this.handleAmountInput })) : (React.createElement(PaymentsStyledComponents_1.PaymentGhostBtn, { onClick: this.handleShowInput },
                React.createElement(PaymentsTextComponents_1.EnterCustomAmountText, null)))),
            React.createElement(PaymentsStyledComponents_1.PaymentAmountUserOptions, null,
                React.createElement(input_1.Checkbox, { id: "shouldPublicize", onClick: this.handleCheckBox, checked: this.state.shouldPublicizeChecked, size: input_1.CheckboxSizes.SMALL }),
                React.createElement("label", { htmlFor: "shouldPublicize" },
                    React.createElement(PaymentsTextComponents_1.PublicizeUserText, null))),
            React.createElement(PaymentsStyledComponents_1.PaymentBtn, { onClick: function () { return _this.props.handleAmount(_this.state.usdToSpend, _this.state.shouldPublicize); }, disabled: disableNext }, "Next")));
    };
    return PaymentsAmount;
}(React.Component));
exports.PaymentsAmount = PaymentsAmount;
//# sourceMappingURL=PaymentsAmount.js.map