"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
var _Typography = require("../../../core/components/Typography/Typography");
var _FormLabel = _interopRequireDefault(require("../../elements/FormLabel"));
var _enums = require("../../enums");
var _styles = require("./styles");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
/***
 * category: Form
 * component: Input
 */

function FormInput({
  value,
  optional,
  maxLength,
  pageId = _enums.PageID.WildCardPage,
  elementId = _enums.ElementID.WildCardElement,
  componentId = _enums.ComponentID.WildCardComponent,
  editable = true,
  ...props
}) {
  const {
    styles,
    theme
  } = (0, _styles.useStyles)();
  return /*#__PURE__*/React.createElement(_reactNative.View, {
    style: styles.inputContainer
  }, /*#__PURE__*/React.createElement(_reactNative.View, {
    style: styles.labelContainer
  }, /*#__PURE__*/React.createElement(_FormLabel.default, {
    optional: optional,
    pageId: pageId,
    elementId: elementId,
    componentId: componentId
  }), maxLength && /*#__PURE__*/React.createElement(_Typography.Typography.Caption, {
    style: styles.inputLength
  }, value === null || value === void 0 ? void 0 : value.length, "/", maxLength)), /*#__PURE__*/React.createElement(_reactNative.TextInput, _extends({}, props, {
    value: value,
    editable: editable,
    style: [styles.input, !editable && styles.inputDisabled],
    maxLength: maxLength,
    placeholderTextColor: theme.colors.baseShade3
  })));
}
var _default = exports.default = FormInput;
//# sourceMappingURL=FormInput.js.map