import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { SoftFormControlLayout, } from '../form_control_layout';
import { SoftValidatableControl, } from '../validatable_control';
export const SoftFieldText = ({ id, name, placeholder, value, className, icon, isInvalid, inputRef, fullWidth, isLoading, compressed, prepend, append, ...rest }) => {
    const classes = classNames('softFieldText', className, {
        'softFieldText--withIcon': icon,
        'softFieldText--fullWidth': fullWidth,
        'softFieldText--compressed': compressed,
        'softFieldText--inGroup': prepend || append,
        'softFieldText-isLoading': isLoading,
    });
    return (React.createElement(SoftFormControlLayout, { icon: icon, fullWidth: fullWidth, isLoading: isLoading, compressed: compressed, prepend: prepend, append: append },
        React.createElement(SoftValidatableControl, { isInvalid: isInvalid },
            React.createElement("input", Object.assign({ type: "text", id: id, name: name, placeholder: placeholder, className: classes, value: value, ref: inputRef }, rest)))));
};
// @ts-ignore
SoftFieldText.propTypes = {
    name: PropTypes.string,
    id: PropTypes.string,
    placeholder: PropTypes.string,
    value: PropTypes.string,
    icon: PropTypes.string,
    isInvalid: PropTypes.bool,
    inputRef: PropTypes.func,
    fullWidth: PropTypes.bool,
    isLoading: PropTypes.bool,
    /**
     * when `true` creates a shorter height input
     */
    compressed: PropTypes.bool,
    /**
     * Creates an input group with element(s) coming before input
     */
    prepend: PropTypes.oneOfType([
        PropTypes.node,
        PropTypes.arrayOf(PropTypes.node),
    ]),
    /**
     * Creates an input group with element(s) coming after input
     */
    append: PropTypes.oneOfType([
        PropTypes.node,
        PropTypes.arrayOf(PropTypes.node),
    ]),
};
// @ts-ignore
SoftFieldText.defaultProps = {
    value: undefined,
    fullWidth: false,
    isLoading: false,
    compressed: false,
};
//# sourceMappingURL=SoftFieldText.js.map