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); }
import { TextInput, View } from 'react-native';
import { Typography } from '../../../core/components/Typography/Typography';
import FormLabel from '../../elements/FormLabel';
import { ElementID, PageID, ComponentID } from '../../enums';
import { useStyles } from './styles';
/***
 * category: Form
 * component: Input
 */

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