"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const InputWrapper = ({
  children
}) => {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    style: styles.inputWrapper,
    children: children
  });
};
const Label = ({
  children
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
  style: styles.label,
  children: children
});
const StyledInput = ({
  color,
  error,
  ...props
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
  style: [styles.input, {
    borderColor: error ? 'red' : color || '#0052CD',
    backgroundColor: '#F5F7F9'
  }],
  ...props
});
const HelperText = ({
  children,
  error
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
  style: [styles.helperText, {
    color: error ? 'red' : '#8c8c8c'
  }],
  children: children
});
const InputWithLabel = ({
  label,
  color,
  helperText,
  error,
  ...rest
}) => {
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(InputWrapper, {
    children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, {
      children: label
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledInput, {
      color: color,
      error: error,
      ...rest
    }), helperText && /*#__PURE__*/(0, _jsxRuntime.jsx)(HelperText, {
      error: error,
      children: helperText
    })]
  });
};
const styles = _reactNative.StyleSheet.create({
  inputWrapper: {
    flexDirection: 'column',
    width: '100%',
    justifyContent: 'flex-start',
    alignItems: 'flex-start',
    position: 'relative',
    height: 48,
    borderRadius: 15,
    paddingHorizontal: 16
  },
  label: {
    fontSize: 14,
    color: '#8c8c8c',
    marginBottom: 4,
    marginLeft: 8
  },
  input: {
    width: '100%',
    padding: 12,
    paddingHorizontal: 16,
    borderRadius: 12,
    fontSize: 16,
    borderWidth: 1
  },
  helperText: {
    fontSize: 12,
    marginTop: 4,
    marginLeft: 8,
    position: 'absolute',
    top: 42
  }
});
var _default = exports.default = InputWithLabel;
//# sourceMappingURL=StyledInput.js.map