import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Space, tasty } from '@cube-dev/ui-kit';
import { useEvent } from '../hooks';
import { FilterLabel } from './FilterLabel';
import { FilterOptionsButton } from './FilterOptionsButton';
const SegmentFilterWrapper = tasty(Space, {
    qa: 'SegmentFilter',
    styles: {
        gap: '1x',
        flow: 'row wrap',
        placeItems: 'start',
        radius: true,
        fill: {
            '': '#clear',
            ':has(>[data-qa="FilterOptionsButton"][data-is-hovered])': '#light',
        },
        margin: '-.5x',
        padding: '.5x',
        width: 'max-content',
    },
});
export function SegmentFilter(props) {
    const { member, cubeName, cubeTitle, memberName, memberTitle, memberViewType, name, isMissing, isCompact, onRemove, } = props;
    const onAction = useEvent((key) => {
        switch (key) {
            case 'remove':
                onRemove();
                break;
            default:
                break;
        }
    });
    return (_jsxs(SegmentFilterWrapper, { children: [_jsx(FilterOptionsButton, { type: "dateRange", onAction: onAction }), _jsx(FilterLabel, { isCompact: isCompact, isMissing: isMissing, memberName: memberName, memberTitle: memberTitle, cubeName: cubeName, cubeTitle: cubeTitle, memberViewType: memberViewType, type: "filter", member: "segment", name: name })] }));
}
//# sourceMappingURL=SegmentFilter.js.map