import React from "react";
import { Input } from "../input/Input";
import { Button } from "../button/Button";
export const TermSearch = ({ className, termValue, setTermValue, pushTerm, allTerms, type, label, placeholder, labelStyle, name, color, icon, size, iconSize, tipContent, removeFilterItem, }) => {
    const emptyOrWhitespace = /^\s*$/;
    const disabled = emptyOrWhitespace.test(termValue) ||
        allTerms.includes(termValue);
    return (React.createElement(React.Fragment, null,
        React.createElement("div", { className: className + " term-input" },
            React.createElement(Input, { type: type, label: label, placeholder: placeholder, labelStyle: labelStyle, name: name, value: termValue, setValue: setTermValue, tipContent: tipContent, onKeyDown: (e) => e.keyCode === 13 &&
                    !disabled &&
                    // eslint-disable-next-line @typescript-eslint/no-explicit-any
                    pushTerm(termValue) }),
            React.createElement(Button, { primary: true, disabled: disabled, color: color, icon: icon, iconOnly: true, iconSize: iconSize, size: size, 
                // eslint-disable-next-line @typescript-eslint/no-explicit-any
                onClick: () => pushTerm(termValue), label: "Add Term" })),
        allTerms.length
            ? (React.createElement("div", { className: "term-block" },
                React.createElement("ul", { className: "active-search-terms" }, allTerms.map((term, index) => (React.createElement("li", { key: index },
                    React.createElement("span", null,
                        term,
                        React.createElement("span", { onClick: () => removeFilterItem(name, term) }, "\u00D7"))))))))
            : null));
};
