var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React from 'react';
import { makeStyles, TextField } from '@material-ui/core';
import PropTypes from 'prop-types';
const useStyles = makeStyles((theme) => ({
    input: {
        borderRadius: 2,
        height: (props) => !props.multiline && !Array.isArray(props.value) && 32, // multiline or multiselect
        padding: (props) => !props.multiline && 0,
        paddingTop: (props) => props.multiline && '0 !important',
        paddingBottom: 10,
        marginTop: 3,
        '& .MuiFilledInput-inputMarginDense': {
            paddingTop: 8
        },
        '& .MuiInputAdornment-filled.MuiInputAdornment-positionStart:not(.MuiInputAdornment-hiddenLabel)': {
            marginTop: theme.spacing(0.5),
            marginLeft: theme.spacing(1)
        }
    },
    inputMultiline: {
        paddingTop: 0
    },
    formTextInput: {
        fontSize: 14
    },
    labelRoot: {
        fontSize: 14
    },
    FormControl: {
        display: 'none',
        marginTop: 0
    },
    root: {
        width: '100%',
        marginTop: 25,
        '& .MuiFormLabel-root': {
            marginTop: -30,
            marginLeft: -11
        },
        '& .MuiInputAdornment-root': {
            paddingLeft: theme.spacing(1)
        }
        //   '& .MuiInputAdornment-filled.MuiInputAdornment-positionStart:not(.MuiInputAdornment-hiddenLabel)' : {
        //     marginTop: 0
        // }
    },
    noLabel: {
        marginTop: theme.spacing(1)
    }
}));
export const AmbientTextField = (props) => {
    var _a, _b;
    const classes = useStyles(props);
    const { id, label, startAdornment, endAdornment, title = 'noTitle' } = props, InputProps = __rest(props, ["id", "label", "startAdornment", "endAdornment", "title"]);
    return (React.createElement("div", { className: label ? classes.root : classes.noLabel }, React.createElement(TextField, Object.assign({}, InputProps, { id: id, udprecordid: `udpRecord-FluentAmbientTextField-${title.replace(/\s/g, '')}-${(_a = props === null || props === void 0 ? void 0 : props.InputProps) === null || _a === void 0 ? void 0 : _a.type}`, variant: "filled", size: "small", margin: "dense", label: label, classes: { label: classes.label }, InputProps: Object.assign(Object.assign(Object.assign({ classes: Object.assign({ root: classes.input, input: classes.formTextInput, inputMultiline: classes.inputMultiline }, (_b = props.InputProps) === null || _b === void 0 ? void 0 : _b.classes) }, props.InputProps), startAdornment), endAdornment), InputLabelProps: {
            shrink: false,
            classes: {
                root: classes.labelRoot,
                focused: classes.labelFocused
            }
        } }))));
};
AmbientTextField.propTypes = {
    /**
     * id - textfield ID
     */
    id: PropTypes.string,
    /**
     * label - textField label
     */
    label: PropTypes.string,
    /**
     * startAdornment - icon placed at the beginning of the input
     */
    startAdornment: PropTypes.node,
    /**
     * endAdornment - icon placed at the end of the input
     */
    endAdornment: PropTypes.node
};
//# sourceMappingURL=AmbientTextField.js.map