import React, { useEffect } from 'react';
import { ToolbarCollectionContentAutoSizer } from '../ToolbarCollectionContentAutoSizer';
import { observer } from 'mobx-react-lite';
import { useGridBaseSyncProps } from './useGridBaseSyncProps';
import { getToolbarCollectionFeaturesInitializers } from '../../state/getToolbarCollectionFeaturesInitializers';
import { GridFoldersSectionsGroup } from './GridFoldersSectionsGroup';
import { CollectionCard } from '../CollectionCard';
import { ToolbarCollection, } from '../ToolbarCollection';
import { GridFoldersPlaceholderStates } from './GridFoldersPlaceholderStates';
import { minimalRequiredWdsRuntimeCheck } from '../../minimalRequiredWdsRuntimeCheck';
import { useToolbarCollectionSyncProps } from '../ToolbarCollection/useToolbarCollectionSyncProps';
function _GridFolders(props) {
    const { state, exportModal, dataHook, cardProps, emptyState, noResultsState, renderError, errorState = renderError &&
        ((err, { isOnline, retry }) => renderError?.({ err, isOnline, retry })), } = props;
    const { toolbar } = state;
    if (process.env.NODE_ENV !== 'production') {
        // https://github.com/wix-private/wix-design-systems/pull/13091/files#diff-0befb17e7fa12b244a3efce19b067187b39d3a96d4f7e62a59f4f0fd876dc37cR102
        minimalRequiredWdsRuntimeCheck({
            required: '^1.89.0',
            requiredBy: 'WixPatterns/GridFolders',
        });
    }
    useToolbarCollectionSyncProps({
        ...props,
        state: state.toolbar,
        isUsingDragAndDrop: false,
        isUsingBulkActionsToolbar: false,
        isUsingHorizontalScroll: false,
        isUsingFolders: true,
        isUsingTableVirtualization: false,
    });
    useGridBaseSyncProps({ ...props, state: state.items });
    useGridBaseSyncProps({
        ...props,
        renderAddItem: props.renderFolderAddItem,
        state: state.folders,
    });
    useEffect(() => state.init({
        featuresInitializers: getToolbarCollectionFeaturesInitializers(props),
    }), []);
    return (React.createElement(CollectionCard, { errorState: false, state: toolbar, dataHook: dataHook, ...cardProps },
        React.createElement(ToolbarCollection, { ...props, state: toolbar },
            React.createElement(GridFoldersPlaceholderStates, { state: state, emptyState: emptyState, noResultsState: noResultsState, errorState: errorState },
                React.createElement(ToolbarCollectionContentAutoSizer, null,
                    React.createElement(GridFoldersSectionsGroup, { ...props })))),
        exportModal ?? toolbar.featuredComponents.exportModal.value));
}
export const GridFolders = observer(_GridFolders);
//# sourceMappingURL=GridFolders.js.map