"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 rebass_1 = require("rebass");
const Panel_1 = tslib_1.__importDefault(require("../../../../components/Panel"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../../../components/SimpleButton"));
const ColumnFilterMenuItem = ({ active, onClick, icon, label, }) => {
    return (React.createElement(SimpleButton_1.default, { p: 1, variant: "text", width: "100%", tone: active ? 'info' : 'none', onClick: onClick },
        React.createElement(rebass_1.Box, { mr: 2 }, icon),
        React.createElement(rebass_1.Box, { fontSize: 2 }, label)));
};
const ColumnFilterMenu = (props) => {
    return (React.createElement(Panel_1.default, { minWidth: "max-content" }, props.predicateDefs?.map((predicateDef, index) => {
        return (React.createElement(rebass_1.Flex, { 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;
