"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.FormFieldInput = exports.EDITABLE_INPUT_ELEMENTS = void 0;
var _react = _interopRequireDefault(require("react"));
var _fields = require("../../fields");
var _Url = require("../../fields/Url");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/FormFieldInput/FormFieldInput.tsx";
const EDITABLE_INPUT_ELEMENTS = exports.EDITABLE_INPUT_ELEMENTS = {
  dropdown: _fields.Dropdown,
  checkbox: _fields.Checkbox,
  shortText: _fields.ShortText,
  longText: _fields.LongText,
  date: _fields.DateInput,
  dateTime: _fields.DateTime,
  integer: _fields.Number,
  decimal: _fields.Number,
  url: _Url.Url
};
const INPUT_ELEMENTS = {
  ...EDITABLE_INPUT_ELEMENTS,
  files: () => null,
  // not supported
  multiSelect: () => null // not supported
};
const FormFieldInput = ({
  dataHook,
  state,
  schema,
  initialValue,
  onChange,
  inputRef
}) => {
  if (INPUT_ELEMENTS.hasOwnProperty(schema.type)) {
    const FieldInput = INPUT_ELEMENTS[schema.type];
    return /*#__PURE__*/_react.default.createElement(FieldInput, {
      dataHook: dataHook,
      state: state,
      initialValue: initialValue,
      schema: schema,
      onChange: newValue => onChange(newValue),
      inputRef: inputRef,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 59,
        columnNumber: 7
      }
    });
  }
  return null;
};
exports.FormFieldInput = FormFieldInput;
//# sourceMappingURL=FormFieldInput.js.map