import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { tasty, MenuTrigger, Menu, CalendarIcon } from '@cube-dev/ui-kit';
import { FilterOutlined, MoreOutlined } from '@ant-design/icons';
import { ListMemberButton } from './ListMemberButton';
const OptionButtonElement = tasty(ListMemberButton, {
    'aria-label': 'Options',
    icon: _jsx(MoreOutlined, {}),
    styles: {
        color: {
            '': '#dark-04',
            hovered: '#dark',
        },
        fill: {
            '': '#clear',
            hovered: '#white.3',
        },
        gridColumns: 'auto',
        placeContent: 'center',
        radius: '1r right',
        margin: '-.75x -1.5x -.75x 0',
        ButtonIcon: { fontSize: '16px' },
    },
});
export function ListMemberOptionButton(props) {
    const { member, type, onAddFilter, onAddDateRange } = props;
    function onAction(action) {
        switch (action) {
            case 'filter':
                onAddFilter?.(member.name);
                break;
            case 'date-range':
                onAddDateRange?.(member.name);
                break;
        }
    }
    const disabledKeys = [];
    if (!onAddFilter) {
        disabledKeys.push('filter');
    }
    if (!onAddDateRange) {
        disabledKeys.push('date-range');
    }
    return (_jsxs(MenuTrigger, { children: [_jsx(OptionButtonElement, { "data-member": type }), _jsxs(Menu, { disabledKeys: disabledKeys, onAction: onAction, children: [_jsx(Menu.Item, { icon: _jsx(FilterOutlined, {}), children: "Add filter" }, "filter"), _jsx(Menu.Item, { icon: _jsx(CalendarIcon, {}), children: "Add date range" }, "date-range")] })] }));
}
//# sourceMappingURL=ListMemberOptionButton.js.map