import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { forwardRef } from 'react';
import Button from '../Button';
import { useElement, useI18n } from '../../hooks';
import InfoDialog from '../Dialog/InfoDialog';
import NoValue from '../NoValue';
const CompactList = forwardRef(function CompactList({ count, onDialogOpen, onDialogClose, progress, heading, content, ...restProps }, ref) {
    const t = useI18n();
    const [target, setTarget] = useElement(null);
    return (_jsx("div", { ...restProps, ref: ref, children: count === 0 ? (_jsx(NoValue, {})) : (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'link', onClick: (e) => {
                        if (onDialogOpen && !target)
                            onDialogOpen();
                        setTarget(e.currentTarget);
                    }, children: t('number_of_items', [count], { count }) }), target && (_jsx(InfoDialog, { heading: heading, progress: progress, target: target, onDismiss: () => {
                        if (onDialogClose)
                            onDialogClose();
                        setTarget(null);
                    }, children: content }))] })) }));
});
export default CompactList;
//# sourceMappingURL=CompactList.js.map