'use client';
import React, { Fragment } from 'react';
import { SelectAllStatus, useSelection } from '../../providers/SelectionProvider/index.js';
import { useTranslation } from '../../providers/Translation/index.js';
const baseClass = 'list-selection';
export const ListSelection = ({ label })=>{
    const { count, selectAll, toggleAll, totalDocs } = useSelection();
    const { t } = useTranslation();
    if (count === 0) {
        return null;
    }
    return /*#__PURE__*/ React.createElement("div", {
        className: baseClass
    }, /*#__PURE__*/ React.createElement("span", null, t('general:selectedCount', {
        count,
        label
    })), selectAll !== SelectAllStatus.AllAvailable && /*#__PURE__*/ React.createElement(Fragment, null, ' ', "—", /*#__PURE__*/ React.createElement("button", {
        "aria-label": t('general:selectAll', {
            count,
            label
        }),
        className: `${baseClass}__button`,
        onClick: ()=>toggleAll(true),
        type: "button"
    }, t('general:selectAll', {
        count: totalDocs,
        label
    }))));
};

//# sourceMappingURL=index.js.map