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;
};
/* eslint-disable no-use-before-define */
import React, { useCallback } from 'react';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { FluentTextField } from '../textField/FluentTextField';
import { makeStyles } from '@material-ui/core';
const useStyles = makeStyles((theme) => ({
    root: {
        '&[class*="MuiOutlinedInput-root"][class*="MuiOutlinedInput-marginDense"]': {
            padding: '4px 8px'
        }
    }
}));
export const FluentSelectMenu = (_a) => {
    var { data, id, onChange: onChangeProp, width = 300, 
    // displayProperty = 'label',
    autoCompleteProps, displayProperty } = _a, otherProps = __rest(_a, ["data", "id", "onChange", "width", "autoCompleteProps", "displayProperty"]);
    const classes = useStyles();
    // Modified onChange to work inside final-form Field component
    // Also works with a passed in onChange function if not in Field component
    const onChange = useCallback((e, value) => onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(value), [onChangeProp]);
    // return (
    //   <Autocomplete
    //     classes={{
    //       inputRoot: classes.root
    //     }}
    //     id={id}
    //     onChange={onChange}
    //     options={data}
    //     getOptionLabel={
    //       displayProperty
    //         ? option[displayProperty]
    //           ? option[displayProperty]
    //           : ''
    //         : option
    //     }
    //     style={{ width: width }}
    //     {...autoCompleteProps}
    //     renderInput={(params) => <FluentTextField {...otherProps} {...params} />}
    //   />
    // )
    return (React.createElement(Autocomplete, Object.assign({ classes: {
            inputRoot: classes.root
        }, id: id, onChange: onChange, options: data, getOptionLabel: (option) => displayProperty
            ? option[displayProperty]
                ? option[displayProperty]
                : ''
            : (option) => option, style: { width: width } }, autoCompleteProps, { renderInput: (params) => (React.createElement(FluentTextField, Object.assign({}, otherProps, params))) })));
};
//# sourceMappingURL=FluentSelectMenu.js.map