import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from "react";
import { InputList } from "../../../index";
import { Button } from "../../button";
export default function StringListFilter({ selectedView, setFilters, handleClose, filterGroups, }) {
    const [tags, setTags] = useState([]);
    const selectedGroup = filterGroups.find(g => g.name === selectedView);
    const handleApply = () => {
        if (tags.length > 0) {
            setFilters(prev => [
                ...prev.filter(f => f.name !== selectedView),
                {
                    name: selectedView,
                    placeholder: selectedGroup?.placeholder,
                    value: tags,
                    type: "stringList"
                }
            ]);
        }
        handleClose();
    };
    return (_jsxs("div", { className: "p-2 space-y-3", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputList, { value: tags, onChange: setTags, placeholder: selectedGroup?.placeholder || `Add ${selectedView}...`, autoFocus: true }) }), _jsxs("div", { className: "flex gap-2 justify-end", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: handleClose, children: "Cancel" }), _jsx(Button, { size: "sm", onClick: handleApply, disabled: tags.length === 0, children: "Apply" })] })] }));
}
//# sourceMappingURL=StringListFilter.js.map