"use strict";
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;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* @flow */
const React = __importStar(require("react"));
{
    AddressFormProps;
}
from;
'./types';
// import cx from 'classnames';
const Grid_1 = __importDefault(require("@material-ui/core/Grid"));
const prop_types_1 = __importDefault(require("prop-types"));
const get_1 = __importDefault(require("lodash/get"));
const withStyles_1 = __importDefault(require("components/hoc/withStyles"));
const ErrorBoundary_1 = __importDefault(require("components/hoc/ErrorBoundary"));
const TextField_1 = __importDefault(require("components/bosons/TextField"));
const styles_1 = __importDefault(require("./styles"));
class AddressForm extends React.Component {
    render() {
        const { classes, keys, labels, values, handleChange, handleBlur, errors, touched, } = this.props;
        return (React.createElement(ErrorBoundary_1.default, null,
            React.createElement("div", { className: classes.component },
                React.createElement(Grid_1.default, { container: true, spacing: 16 },
                    React.createElement(Grid_1.default, { item: true, xs: 12 },
                        React.createElement(TextField_1.default, { label: labels.street, placeholder: 'E.g: 80 Baker Street', name: keys.street, id: keys.street, value: get_1.default(values, keys.street), onChange: handleChange, onBlur: handleBlur, error: get_1.default(touched, keys.street) && get_1.default(errors, keys.street), showClearIcon: false })),
                    React.createElement(Grid_1.default, { item: true, xs: 12, sm: 6 },
                        React.createElement(TextField_1.default, { label: labels.city, placeholder: 'E.g: PORT ALBANY', name: keys.city, id: keys.city, value: get_1.default(values, keys.city), onChange: handleChange, onBlur: handleBlur, error: get_1.default(touched, keys.city) && get_1.default(errors, keys.city), showClearIcon: false })),
                    React.createElement(Grid_1.default, { item: true, xs: 12, sm: 6 },
                        React.createElement(TextField_1.default, { label: labels.state, placeholder: 'E.g: Western Australia', name: keys.state, id: keys.state, value: get_1.default(values, keys.state), onChange: handleChange, onBlur: handleBlur, error: get_1.default(touched, keys.state) && get_1.default(errors, keys.state), showClearIcon: false })),
                    React.createElement(Grid_1.default, { item: true, xs: 12, sm: 6 },
                        React.createElement(TextField_1.default, { label: labels.country, placeholder: 'E.g: Australia', name: keys.country, id: keys.country, value: get_1.default(values, keys.country), onChange: handleChange, onBlur: handleBlur, error: get_1.default(touched, keys.country) && get_1.default(errors, keys.country), showClearIcon: false })),
                    React.createElement(Grid_1.default, { item: true, xs: 12, sm: 6 },
                        React.createElement(TextField_1.default, { label: labels.postcode, placeholder: 'E.g: 6330', name: keys.postcode, id: keys.postcode, value: get_1.default(values, keys.postcode), onChange: handleChange, onBlur: handleBlur, error: get_1.default(touched, keys.postcode) && get_1.default(errors, keys.postcode), showClearIcon: false }))))));
    }
}
AddressForm.propTypes = {
    keys: prop_types_1.default.shape({
        street: prop_types_1.default.string,
        city: prop_types_1.default.string,
        state: prop_types_1.default.string,
        country: prop_types_1.default.string,
        postcode: prop_types_1.default.string,
    }),
    labels: prop_types_1.default.shape({
        street: prop_types_1.default.string,
        city: prop_types_1.default.string,
        state: prop_types_1.default.string,
        country: prop_types_1.default.string,
        postcode: prop_types_1.default.string,
    }),
    values: prop_types_1.default.object,
    errors: prop_types_1.default.object,
    touched: prop_types_1.default.object,
    handleChange: prop_types_1.default.func,
    handleBlur: prop_types_1.default.func,
    classes: prop_types_1.default.object,
};
AddressForm.defaultProps = {
    keys: {
        street: 'street',
        city: 'city',
        state: 'state',
        country: 'country',
        postcode: 'postcode',
    },
    labels: {
        street: 'Street Address',
        city: 'City',
        state: 'State/Province',
        country: 'Country',
        postcode: 'Postcode',
    },
};
exports.default = withStyles_1.default(styles_1.default)(AddressForm);
//# sourceMappingURL=index.js.map