import React, { useEffect } from 'react';
import { getToolbarCollectionFeaturesInitializers } from '../../state/getToolbarCollectionFeaturesInitializers';
import { ToolbarCollectionContentAutoSizer } from '../ToolbarCollectionContentAutoSizer';
import { GridPlaceholderStates } from './GridPlaceholderStates';
import { CollectionCard } from '../CollectionCard';
import { ToolbarCollection, } from '../ToolbarCollection';
import { observer } from 'mobx-react-lite';
import { useToolbarCollectionSyncProps } from '../ToolbarCollection/useToolbarCollectionSyncProps';
import { GridSingleGridContent } from './GridSingleGridContent';
function _Grid(props) {
    const { state, dragAndDrop, renderError, errorState = renderError &&
        ((err, { isOnline, retry }) => renderError?.({ err, isOnline, retry })), emptyState, noResultsState, cardProps, dataHook, exportModal, sections, } = props;
    const { toolbar } = state;
    useToolbarCollectionSyncProps({
        ...props,
        state: state.toolbar,
        isUsingDragAndDrop: !!dragAndDrop,
        isUsingBulkActionsToolbar: false,
        isUsingHorizontalScroll: false,
        isUsingFolders: false,
        isUsingTableVirtualization: false,
    });
    useEffect(() => state.init({
        featuresInitializers: getToolbarCollectionFeaturesInitializers(props),
    }), []);
    return (React.createElement(CollectionCard, { errorState: false, state: toolbar, dataHook: dataHook, ...cardProps },
        React.createElement(ToolbarCollection, { ...props, sticky: true, state: toolbar },
            React.createElement(GridPlaceholderStates, { state: state.toolbar, errorState: errorState, emptyState: emptyState, noResultsState: noResultsState },
                React.createElement(ToolbarCollectionContentAutoSizer, null, sections ? (React.createElement(sections.GridSections, { ...props, renderSection: sections.renderSection, state: state })) : (React.createElement(GridSingleGridContent, { ...props, state: state }))))),
        exportModal ?? toolbar.featuredComponents.exportModal.value));
}
export const Grid = observer(_Grid);
//# sourceMappingURL=Grid.js.map