import { a as __rest, _ as __assign } from '../tslib.es6-20a2a300.js';
import { jsxs, jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import Icon from './Icon.js';
import Input from './Input.js';
import InputLabel from './InputLabel.js';
import FormHelperText from './FormHelperText.js';
import { a as withStyles } from '../withStyles-99aeb25b.js';
import { F as FormControl } from '../FormControl-1f6cf8f3.js';
import '../icons/ArrowRight.js';
import '../icons/ArrowRightCircle.js';
import '../icons/Check.js';
import '../icons/CheckCircle.js';
import '../icons/ChevronRight.js';
import '../icons/CrossCircle.js';
import '../icons/DollarSign.js';
import '../icons/InfoCircle.js';
import '../icons/Link.js';
import '../icons/TriangleUp.js';
import '../icons/TriangleDown.js';
import '../icons/TriangleLeft.js';
import '../icons/Copy.js';
import '../icons/SortUp.js';
import '../icons/Cross.js';
import '../icons/Search.js';
import '../icons/Range.js';
import '../theme/colors.js';
import '../makeStyles-c9a99c7a.js';
import '../defaultTheme-49a26576.js';
import '../Input-d5c36a50.js';
import '../clsx.m-6243b874.js';
import '../formControlState-da4d15f8.js';
import '../FormControlContext-64eed5c2.js';
import '../capitalize-5d3e9aac.js';
import '../useForkRef-4ff8cc89.js';
import '../deprecatedPropType-0232df1e.js';
import '../refType-5cc24a92.js';
import '../hoist-non-react-statics.cjs-b718ab87.js';
import './Typography.js';
import '../_commonjsHelpers-57e89916.js';
import '../theme/fontSize.js';
import '../theme/fontWeight.js';
import '../theme/fontFamily.js';
import '../theme/lineHeight.js';
import '../Typography-649a8eff.js';
import '../createStyles-16423e9e.js';
import '../useFormControl-dc7cf5d6.js';
import '../Box-581dc061.js';
import '../styled-339d0187.js';

var FormControlBox = withStyles(function (theme) { return ({
    root: {
        "& label + .MuiInput-formControl": {
            marginTop: theme.spacing(3.5)
        }
    }
}); })(FormControl);
var TextField = forwardRef(function (_a, ref) {
    var id = _a.id, label = _a.label, helperText = _a.helperText, error = _a.error, _b = _a.type, type = _b === void 0 ? "text" : _b, inputProps = _a.inputProps, props = __rest(_a, ["id", "label", "helperText", "error", "type", "inputProps"]);
    var formControlProps = __assign({ ref: ref, fullWidth: props.fullWidth, onChange: props.onChange, onBlur: props.onBlur, required: props.required }, props);
    return (jsxs(FormControlBox, __assign({ error: !!error }, formControlProps, { children: [label && jsx(InputLabel, __assign({ htmlFor: id }, { children: label }), void 0), jsx(Input, __assign({ id: id, "aria-describedby": id + "-text", type: type }, inputProps), void 0), helperText && error && (jsx(FormHelperText, { id: id + "-text", text: helperText, startAdornment: jsx(Icon, { iconKey: "infoCircle", color: "inversePrimary", size: "xs" }, void 0) }, void 0))] }), void 0));
});

export { TextField as default };
