'use strict';

var React = require('react');
var Text = require('./Text-cjs.js');
var Glimmer = require('./Glimmer-cjs.js');

var styles = {"results":"_9wfZRG5vXI8-","spinning":"_7A1FU9kI3mY-"};

const DATALIST_TOTALCOUNT_TEST_ID = "ATL-DataList-TotalCount";
function DataListTotalCountContainer({ children }) {
    return (React.createElement("div", { className: styles.results, "data-testid": DATALIST_TOTALCOUNT_TEST_ID }, children));
}
function DataListTotalCount({ totalCount, loading, }) {
    if (totalCount === null && loading) {
        return (React.createElement(DataListTotalCountContainer, null,
            React.createElement(Glimmer.Glimmer, { size: "auto", shape: "rectangle" })));
    }
    if (typeof totalCount === "number") {
        return (React.createElement(DataListTotalCountContainer, null,
            React.createElement(Text.Text, { variation: "subdued" },
                "(",
                totalCount.toLocaleString(),
                " ",
                totalCount == 1 ? "result" : "results",
                ")")));
    }
    return null;
}

exports.DATALIST_TOTALCOUNT_TEST_ID = DATALIST_TOTALCOUNT_TEST_ID;
exports.DataListTotalCount = DataListTotalCount;
