"use strict";

import React from 'react';
import { View, Text, TextInput, StyleSheet } from 'react-native';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const InputWrapper = ({
  children
}) => {
  return /*#__PURE__*/_jsx(View, {
    style: styles.inputWrapper,
    children: children
  });
};
const Label = ({
  children
}) => /*#__PURE__*/_jsx(Text, {
  style: styles.label,
  children: children
});
const StyledInput = ({
  color,
  error,
  ...props
}) => /*#__PURE__*/_jsx(TextInput, {
  style: [styles.input, {
    borderColor: error ? 'red' : color || '#0052CD',
    backgroundColor: '#F5F7F9'
  }],
  ...props
});
const HelperText = ({
  children,
  error
}) => /*#__PURE__*/_jsx(Text, {
  style: [styles.helperText, {
    color: error ? 'red' : '#8c8c8c'
  }],
  children: children
});
const InputWithLabel = ({
  label,
  color,
  helperText,
  error,
  ...rest
}) => {
  return /*#__PURE__*/_jsxs(InputWrapper, {
    children: [label && /*#__PURE__*/_jsx(Label, {
      children: label
    }), /*#__PURE__*/_jsx(StyledInput, {
      color: color,
      error: error,
      ...rest
    }), helperText && /*#__PURE__*/_jsx(HelperText, {
      error: error,
      children: helperText
    })]
  });
};
const styles = 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
  }
});
export default InputWithLabel;
//# sourceMappingURL=StyledInput.js.map