import React__default from 'react';
import { D as DataListSort } from './DataListSort-es.js';
import { D as DataListOverflowFade } from './DataListOverflowFade-es.js';
import { u as useDataListContext } from './DataListContext-es.js';
import { g as getCompoundComponent } from './DataList.utils-es.js';
import { u as useResponsiveSizing } from './useResponsiveSizing-es.js';

function useShowHeader() {
    const { headerVisibility } = useDataListContext();
    if (headerVisibility === undefined)
        return true;
    const sizes = useResponsiveSizing();
    const sizeKeys = Object.keys(sizes);
    const showHeader = sizeKeys.reduce((previous, breakpoint) => {
        const isHeaderVisible = headerVisibility[breakpoint] || false;
        const isBreakpointTriggered = sizes[breakpoint];
        return previous || (isBreakpointTriggered && isHeaderVisible);
    }, false);
    return showHeader;
}

// This component is meant to capture the props of the DataList.Filters
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function DataListFilters(_) {
    return null;
}
/**
 * Renders the DataList.Filters component
 */
function InternalDataListFilters() {
    const { children: parentChildren } = useDataListContext();
    const showHeader = useShowHeader();
    const showSortButton = !showHeader;
    const component = getCompoundComponent(parentChildren, DataListFilters);
    if (!showSortButton && !component)
        return null;
    const children = component === null || component === void 0 ? void 0 : component.props.children;
    return (React__default.createElement(DataListOverflowFade, null,
        children && children,
        showSortButton && React__default.createElement(DataListSort, null)));
}

export { DataListFilters as D, InternalDataListFilters as I };
