import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Space, tasty, Text, TooltipProvider, ViewIcon, CubeIcon } from '@cube-dev/ui-kit';
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { ChevronIcon } from '../icons/ChevronIcon';
import { NonPublicIcon } from '../icons/NonPublicIcon';
import { ListButton } from './ListButton';
import { MemberBadge } from './Badge';
const CubeListButton = tasty(ListButton, {
    styles: {
        radius: 0,
        color: {
            '': '#dark',
            missing: '#danger-text',
        },
        flow: 'column',
        placeContent: 'space-between',
    },
});
export function ListCube({ name, title, description, type = 'cube', stats, rightIcon = 'arrow', isMissing, isDisabled, isPrivate, isSelected, onItemSelect, }) {
    return (_jsx(TooltipProvider, { title: _jsxs(_Fragment, { children: [_jsx("b", { children: title || name }), description ? _jsxs(_Fragment, { children: [" \u2013 ", description] }) : undefined] }), width: "max-content", placement: "right", children: _jsxs(CubeListButton, { qa: `Playground-${name}`, icon: isMissing ? (_jsx(QuestionCircleOutlined, { style: { color: 'var(--danger-text-color)' } })) : type === 'cube' ? (_jsx(CubeIcon, { color: "#purple" })) : (_jsx(ViewIcon, { color: "#purple" })), type: isSelected ? 'outline' : 'clear', isDisabled: isDisabled, mods: { selected: isSelected, missing: isMissing }, rightIcon: !isMissing ? (rightIcon === 'arrow' ? (_jsx(ChevronIcon, { direction: !isSelected ? 'right' : 'top', style: { color: 'var(--purple-color)' } })) : rightIcon === 'plus' ? (_jsx(PlusOutlined, { style: { color: 'var(--purple-color)' } })) : undefined) : undefined, onPress: () => !isMissing && onItemSelect?.(), children: [_jsx(Text, { ellipsis: true, children: name }), stats && (_jsxs(Space, { gap: ".5x", children: [stats.measures?.length ? (_jsx(MemberBadge, { type: "measure", children: stats.measures.length })) : undefined, stats.dimensions?.length ? (_jsx(MemberBadge, { type: "dimension", children: stats.dimensions.length })) : undefined, stats?.timeDimensions?.length ? (_jsx(MemberBadge, { type: "timeDimension", children: stats.timeDimensions.length })) : undefined, stats.segments?.length ? (_jsx(MemberBadge, { type: "segment", children: stats.segments.length })) : undefined, stats.filters?.length ? (_jsx(MemberBadge, { type: "filter", children: stats.filters.length })) : undefined] })), isPrivate ? _jsx(NonPublicIcon, { type: "cube" }) : undefined] }) }));
}
//# sourceMappingURL=ListCube.js.map