import React__default from 'react';
import { T as Typography } from './Typography-es.js';
import { B as Button } from './Button-es.js';
import 'classnames';

var styles = {"header":"nrNh3feibg8-","spinning":"rcoGBsZN55M-"};

function ComboboxContentHeader(props) {
    const hasSelected = props.selectedCount > 0;
    const actionLabel = hasSelected ? "Clear" : "Select all";
    const label = getLabel(hasSelected, props.selectedCount, props.subjectNoun);
    const handleSelectAll = hasSelected ? props.onClearAll : props.onSelectAll;
    const showAction = hasSelected || props.hasOptionsVisible;
    return (React__default.createElement("div", { className: styles.header, "data-testid": "ATL-Combobox-Header" },
        React__default.createElement(Typography, { textColor: "heading", fontWeight: "semiBold" }, label),
        showAction && (React__default.createElement(Button, { size: "small", label: actionLabel, type: "tertiary", onClick: handleSelectAll }))));
}
function getLabel(hasSelected, count, subjectNoun) {
    if (hasSelected) {
        return `${count} selected`;
    }
    if (subjectNoun) {
        return `Select ${subjectNoun}`;
    }
    return "Select";
}

export { ComboboxContentHeader as C };
