import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
function SelectWithTitle(param) {
    let { title, defaultValue, onChange, options, fieldNames } = param;
    const [open, setOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
    const timerRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        style: {
            alignItems: 'center',
            display: 'flex',
            justifyContent: 'space-between'
        },
        onClick: (e)=>{
            e.stopPropagation();
            setOpen((v)=>!v);
        },
        onMouseLeave: ()=>{
            timerRef.current = setTimeout(()=>{
                setOpen(false);
            }, 200);
        },
        children: [
            title,
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Select, {
                open: open,
                popupMatchSelectWidth: false,
                variant: "borderless",
                defaultValue: defaultValue,
                onChange: onChange,
                fieldNames: fieldNames,
                options: options,
                style: {
                    textAlign: 'right',
                    minWidth: 100
                },
                onMouseEnter: ()=>{
                    clearTimeout(timerRef.current);
                }
            })
        ]
    });
}
export { SelectWithTitle };
