"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _formFields = require("../../constants/formFields");
var _FormField = _interopRequireDefault(require("../FormField/FormField"));
require("./RegistrationForm.css");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function RegistrationForm(_ref) {
  let _ref$title = _ref.title,
    title = _ref$title === void 0 ? 'Inscription' : _ref$title,
    _ref$description = _ref.description,
    description = _ref$description === void 0 ? 'Remplissez le formulaire pour enregistrer vos informations.' : _ref$description,
    formValues = _ref.formValues,
    fieldErrors = _ref.fieldErrors,
    isSubmitDisabled = _ref.isSubmitDisabled,
    onChange = _ref.onChange,
    onSubmit = _ref.onSubmit;
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
    className: "register-form",
    onSubmit: onSubmit,
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
      children: title
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
      children: description
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      className: "field-grid",
      children: _formFields.REGISTRATION_FIELDS.map(field => /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormField.default, {
        label: field.label,
        name: field.name,
        type: field.type,
        placeholder: field.placeholder,
        testId: field.testId,
        errorTestId: field.errorTestId,
        value: formValues[field.name],
        error: fieldErrors[field.name],
        onChange: onChange
      }, field.name))
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
      type: "submit",
      "data-testid": "submit",
      disabled: isSubmitDisabled,
      children: "Enregistrer"
    })]
  });
}
var _default = exports.default = RegistrationForm;