2019-06-25 09:43:49 -04:00
|
|
|
const classNames = require('classnames');
|
|
|
|
const PropTypes = require('prop-types');
|
|
|
|
const React = require('react');
|
|
|
|
import {Field} from 'formik';
|
|
|
|
|
|
|
|
const ValidationMessage = require('../forms/validation-message.jsx');
|
|
|
|
|
2019-08-01 15:40:46 -04:00
|
|
|
require('./input.scss');
|
2019-06-25 09:43:49 -04:00
|
|
|
require('../forms/input.scss');
|
|
|
|
require('../forms/row.scss');
|
|
|
|
|
|
|
|
const FormikInput = ({
|
|
|
|
className,
|
|
|
|
error,
|
2019-07-12 11:39:04 -04:00
|
|
|
validationClassName,
|
2019-07-26 13:55:46 -04:00
|
|
|
wrapperClassName,
|
2019-06-25 09:43:49 -04:00
|
|
|
...props
|
|
|
|
}) => (
|
2019-07-26 13:55:46 -04:00
|
|
|
<div
|
|
|
|
className={classNames(
|
|
|
|
'col-sm-9',
|
|
|
|
'row',
|
|
|
|
'row-with-tooltip',
|
|
|
|
wrapperClassName
|
|
|
|
)}
|
|
|
|
>
|
2019-06-25 09:43:49 -04:00
|
|
|
<Field
|
|
|
|
className={classNames(
|
|
|
|
'input',
|
|
|
|
className
|
|
|
|
)}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
{error && (
|
2019-07-12 11:39:04 -04:00
|
|
|
<ValidationMessage
|
|
|
|
className={validationClassName}
|
|
|
|
message={error}
|
|
|
|
/>
|
2019-06-25 09:43:49 -04:00
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
FormikInput.propTypes = {
|
|
|
|
className: PropTypes.string,
|
|
|
|
error: PropTypes.string,
|
2019-07-12 11:39:04 -04:00
|
|
|
type: PropTypes.string,
|
2019-07-26 13:56:46 -04:00
|
|
|
validationClassName: PropTypes.string,
|
2019-07-26 13:55:46 -04:00
|
|
|
wrapperClassName: PropTypes.string
|
2019-06-25 09:43:49 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = FormikInput;
|