import { _ as __assign, a as __rest } from '../tslib.es6-faad35dc.js';
import { jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { styled } from '@mui/material/styles';
import MuiTextField from '@mui/material/TextField';
import colors from '../theme/colors.js';
import EndAdornment from './EndAdornment.js';
import { formCommonStyles, getPadding, getFontSize } from './Input.js';
import '@mui/material/Box';
import '@mui/material/InputAdornment';
import './Icon.js';
import '../icons/ArrowLeft.js';
import '../icons/ArrowRight.js';
import '../icons/CloseCircle.js';
import '../icons/InfoCircle.js';
import '../icons/ErrorCircle.js';
import '../icons/Attention.js';
import '../icons/HelpCircle.js';
import '../icons/Document.js';
import '../icons/DocumentText.js';
import '../icons/Lock.js';
import '../icons/Delete.js';
import '../icons/Users.js';
import '../icons/Stakefish.js';
import '../icons/Sound.js';
import '../icons/Beacon.js';
import '../icons/TriangleRight.js';
import '../icons/TriangleLeft.js';
import '../icons/TriangleUp.js';
import '../icons/TriangleDown.js';
import '../icons/Sent.js';
import '../icons/Download.js';
import '../icons/Faster.js';
import '../icons/Slower.js';
import '../icons/Usb.js';
import '../icons/Key.js';
import '../icons/Edit.js';
import '../icons/Expand.js';
import '../icons/Collapse.js';
import '../icons/Success.js';
import '../icons/SuccessCircle.js';
import '../icons/Fail.js';
import '../icons/Desktop.js';
import '../icons/Mobile.js';
import '../icons/Loading.js';
import '../icons/Upload.js';
import '../icons/Check.js';
import '../icons/ChevronLeft.js';
import '../icons/ChevronRight.js';
import '../icons/Plus.js';
import '../icons/Minus.js';
import '../icons/Globe.js';
import '../icons/Link.js';
import '../icons/Copy.js';
import '../icons/Medium.js';
import '../icons/Twitter.js';
import '../icons/Telegram.js';
import '../icons/Eth.js';
import '../icons/Sort.js';
import '../icons/Close.js';
import '../icons/DollarSign.js';
import '../icons/Search.js';
import '../icons/Range.js';
import '../icons/Instagram.js';
import '../icons/LinkedIn.js';
import '../icons/Reddit.js';
import '../icons/YouTube.js';
import '../icons/Chrome.js';
import '../icons/CloudConnect.js';
import '../icons/Update.js';
import '../icons/Menu.js';
import '../icons/Settings.js';
import './Button.js';
import '../clsx.m-6243b874.js';
import '@mui/material/Button';
import '@mui/material/Input';
import '../theme/borders.js';
import '../theme/typography.js';

var StyledTextField = styled(MuiTextField)(function (_a) {
    var _b;
    var size = _a.size, error = _a.error, $append = _a.$append, theme = _a.theme;
    return _b = {
            "& .MuiInputBase-root": __assign(__assign({}, formCommonStyles), { padding: getPadding({ size: size, theme: theme, $append: $append }), fontSize: getFontSize({ size: size, theme: theme }) }),
            "& .MuiFormHelperText-root": {
                fontSize: theme.typography.fontSizeXs3,
                fontWeight: theme.typography.fontWeightMedium,
                color: error ? colors.text.negative : colors.text.secondary
            }
        },
        _b[theme.breakpoints.down("sm")] = {
            "& .MuiFormHelperText-root": {
                fontSize: theme.typography.fontSizeXs4,
                lineHeight: theme.typography.lineHeightXs4
            }
        },
        _b;
});
var TextField = forwardRef(function (_a, ref) {
    var _b = _a.color, color = _b === void 0 ? "secondary" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, error = _a.error, disabled = _a.disabled, InputProps = _a.InputProps, actionButtonProps = _a.actionButtonProps, props = __rest(_a, ["color", "size", "error", "disabled", "InputProps", "actionButtonProps"]);
    var inputProps = (function () {
        if (InputProps) {
            var endAdornment = InputProps.endAdornment, rest = __rest(InputProps, ["endAdornment"]);
            return { endAdornment: endAdornment, InputProps: rest };
        }
        return undefined;
    })();
    return (jsx(StyledTextField, __assign({ ref: ref, size: size, "$append": Boolean(error || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.endAdornment) || actionButtonProps), InputProps: __assign(__assign({}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.InputProps), { error: error, color: color, disabled: disabled, endAdornment: (jsx(EndAdornment, { size: size, error: error, actionButtonProps: actionButtonProps, endAdornment: inputProps === null || inputProps === void 0 ? void 0 : inputProps.endAdornment }, void 0)) }) }, props, { variant: "filled" }), void 0));
});

export { TextField as default };
