"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColumnFilterMenu = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const Panel_1 = tslib_1.__importDefault(require("../../../../components/Panel"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
const Flex_1 = require("../../../../components/Flex");
const ColumnFilterMenuItem = ({ active, onClick, icon, label, }) => {
    return (React.createElement(SimpleButton_1.default, { className: "twa:p-1 twa:w-full", variant: "text", tone: active ? 'info' : 'none', onClick: onClick },
        React.createElement(Flex_1.Box, { className: "twa:mr-2" }, icon),
        React.createElement(Flex_1.Box, { className: "twa:text-2" }, label)));
};
const ColumnFilterMenu = (props) => {
    return (React.createElement(Panel_1.default, { className: "twa:min-w-max" }, props.predicateDefs?.map((predicateDef, index) => {
        return (React.createElement(Flex_1.Flex, { className: "twa:mb-1", key: index, onMouseDownCapture: (e) => {
                e.stopPropagation();
            } },
            React.createElement(ColumnFilterMenuItem, { onClick: () => props.onPredicateChange({ operator: predicateDef.operator, args: [] }), icon: predicateDef.icon, label: predicateDef.label, active: props.predicate.operator === predicateDef.operator })));
    })));
};
exports.ColumnFilterMenu = ColumnFilterMenu;
