import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Button } from "../../button";
import { Input } from "../../input";
export default function TextFilter({ selectedView, textValue, setTextValue, setFilters, handleClose, filterGroups, }) {
    const handleTextFilterAdd = () => {
        setFilters((prev) => {
            return [
                ...prev,
                {
                    name: selectedView || "",
                    placeholder: filterGroups.find(group => group.name === selectedView)?.placeholder,
                    value: [{ value: textValue, label: textValue }],
                    type: "text",
                }
            ];
        });
        handleClose();
    };
    return (_jsxs("div", { className: "p-2 flex flex-col gap-1", children: [_jsx("div", { className: "flex items-center p-1.5 text-xs text-muted", children: _jsx("span", { children: filterGroups.find(group => group.name === selectedView)?.placeholder }) }), _jsx(Input, { autoFocus: true, type: "text", size: "sm", value: textValue, onChange: setTextValue, onKeyDown: (e) => e.key === "Enter" && handleTextFilterAdd(), placeholder: "Enter text..." }), _jsx("div", { className: "mt-2 p-2 border-t", children: _jsxs("div", { className: "flex gap-2 justify-end", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: handleClose, children: "Cancel" }), _jsx(Button, { size: "sm", onClick: handleTextFilterAdd, disabled: !textValue.trim(), children: "Apply" })] }) })] }));
}
//# sourceMappingURL=TextFilter.js.map