import { __assign, __rest } from "tslib";
import React, { useContext, useState } from 'react';
import classNames from 'classnames';
import Input from '../input/input';
import { ConfigContext } from '../config-provider/config-context';
import { getPrefixCls } from '../_utils/general';
function Autocomplete(props) {
    var customisedCls = props.prefixCls, value = props.value, className = props.className, style = props.style, children = props.children, otherProps = __rest(props, ["prefixCls", "value", "className", "style", "children"]);
    var configContext = useContext(ConfigContext);
    var prefixCls = getPrefixCls('autocomplete', configContext.prefixCls, customisedCls);
    var cls = classNames(prefixCls, className);
    var _a = useState(value), inputVal = _a[0], setInputVal = _a[1];
    var _b = useState([]), suggestions = _b[0], setSuggestions = _b[1];
    console.log(suggestions);
    var inputOnChange = function (e) {
        var value = e.target.value.trim();
        setInputVal(value);
        if (value && props.options) {
            var result = props.options(value);
            setSuggestions(result);
        }
        else {
            setSuggestions([]);
        }
    };
    var onSelect = function () { };
    return (React.createElement("div", { className: cls, style: style },
        React.createElement(Input, __assign({}, otherProps, { onSelect: onSelect, value: inputVal, onChange: inputOnChange })),
        children));
}
Autocomplete.displayName = 'Autocomplete';
export default Autocomplete;
//# sourceMappingURL=index.js.map