import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
import { getTranslation } from '@payloadcms/translations';
import React from 'react';
import { CloseModalButton } from '../../../elements/CloseModalButton/index.js';
import { DefaultListViewTabs } from '../../../elements/DefaultListViewTabs/index.js';
import { useListDrawerContext } from '../../../elements/ListDrawer/Provider.js';
import { DrawerRelationshipSelect } from '../../../elements/ListHeader/DrawerRelationshipSelect/index.js';
import { ListDrawerCreateNewDocButton } from '../../../elements/ListHeader/DrawerTitleActions/index.js';
import { ListHeader } from '../../../elements/ListHeader/index.js';
import { ListBulkUploadButton, ListCreateNewButton, ListEmptyTrashButton } from '../../../elements/ListHeader/TitleActions/index.js';
import { useConfig } from '../../../providers/Config/index.js';
import { useListQuery } from '../../../providers/ListQuery/index.js';
import { ListSelection } from '../ListSelection/index.js';
import './index.scss';
const drawerBaseClass = 'list-drawer';
/** @deprecated This prop will be removed in the next major version.
   *
   * Opening of the bulk upload modal is handled internally.
   *
   * Prefer `onBulkUploadSuccess` usage to handle the success of the bulk upload.
   */ /** @deprecated This prop will be removed in the next major version. */ export const CollectionListHeader = ({ className, collectionConfig, Description, disableBulkDelete, disableBulkEdit, hasCreatePermission, hasDeletePermission, hasTrashPermission, i18n, isBulkUploadEnabled, isTrashEnabled, newDocumentURL, onBulkUploadSuccess, openBulkUpload, smallBreak, viewType })=>{
    const { config, getEntityConfig } = useConfig();
    const { drawerSlug, isInDrawer, selectedOption } = useListDrawerContext();
    const isTrashRoute = viewType === 'trash';
    const { isGroupingBy } = useListQuery();
    if (isInDrawer) {
        return /*#__PURE__*/ _jsxDEV(ListHeader, {
            Actions: [
                /*#__PURE__*/ _jsxDEV(CloseModalButton, {
                    className: `${drawerBaseClass}__header-close`,
                    slug: drawerSlug
                }, "close-button", false, {
                    fileName: "src/views/List/ListHeader/index.tsx",
                    lineNumber: 81,
                    columnNumber: 11
                }, void 0)
            ],
            AfterListHeaderContent: /*#__PURE__*/ _jsxDEV(_Fragment, {
                children: [
                    Description,
                    /*#__PURE__*/ _jsxDEV(DrawerRelationshipSelect, {}, void 0, false, {
                        fileName: "src/views/List/ListHeader/index.tsx",
                        lineNumber: 90,
                        columnNumber: 14
                    }, void 0)
                ]
            }, void 0, true),
            className: `${drawerBaseClass}__header`,
            title: getTranslation(getEntityConfig({
                collectionSlug: selectedOption.value
            })?.labels?.plural, i18n),
            TitleActions: [
                /*#__PURE__*/ _jsxDEV(ListDrawerCreateNewDocButton, {
                    hasCreatePermission: hasCreatePermission
                }, "list-drawer-create-new-doc", false, {
                    fileName: "src/views/List/ListHeader/index.tsx",
                    lineNumber: 99,
                    columnNumber: 11
                }, void 0)
            ].filter(Boolean)
        }, void 0, false, {
            fileName: "src/views/List/ListHeader/index.tsx",
            lineNumber: 79,
            columnNumber: 7
        }, this);
    }
    return /*#__PURE__*/ _jsxDEV(ListHeader, {
        Actions: [
            !smallBreak && !isGroupingBy && /*#__PURE__*/ _jsxDEV(ListSelection, {
                collectionConfig: collectionConfig,
                disableBulkDelete: disableBulkDelete,
                disableBulkEdit: disableBulkEdit,
                hasDeletePermission: hasDeletePermission,
                hasTrashPermission: hasTrashPermission,
                label: getTranslation(collectionConfig?.labels?.plural, i18n),
                showSelectAllAcrossPages: !isGroupingBy,
                viewType: viewType
            }, "list-selection", false, {
                fileName: "src/views/List/ListHeader/index.tsx",
                lineNumber: 112,
                columnNumber: 11
            }, void 0),
            /*#__PURE__*/ _jsxDEV(DefaultListViewTabs, {
                collectionConfig: collectionConfig,
                config: config,
                viewType: viewType
            }, "default-list-actions", false, {
                fileName: "src/views/List/ListHeader/index.tsx",
                lineNumber: 124,
                columnNumber: 9
            }, void 0)
        ].filter(Boolean),
        AfterListHeaderContent: Description,
        className: className,
        title: getTranslation(collectionConfig?.labels?.plural, i18n),
        TitleActions: [
            hasCreatePermission && !isTrashRoute && /*#__PURE__*/ _jsxDEV(ListCreateNewButton, {
                collectionConfig: collectionConfig,
                hasCreatePermission: hasCreatePermission,
                newDocumentURL: newDocumentURL
            }, "list-header-create-new-doc", false, {
                fileName: "src/views/List/ListHeader/index.tsx",
                lineNumber: 136,
                columnNumber: 11
            }, void 0),
            hasCreatePermission && isBulkUploadEnabled && !isTrashRoute && /*#__PURE__*/ _jsxDEV(ListBulkUploadButton, {
                collectionSlug: collectionConfig.slug,
                hasCreatePermission: hasCreatePermission,
                isBulkUploadEnabled: isBulkUploadEnabled,
                onBulkUploadSuccess: onBulkUploadSuccess,
                openBulkUpload: openBulkUpload
            }, "list-header-bulk-upload", false, {
                fileName: "src/views/List/ListHeader/index.tsx",
                lineNumber: 144,
                columnNumber: 11
            }, void 0),
            hasDeletePermission && isTrashEnabled && viewType === 'trash' && /*#__PURE__*/ _jsxDEV(ListEmptyTrashButton, {
                collectionConfig: collectionConfig,
                hasDeletePermission: hasDeletePermission
            }, "list-header-empty-trash", false, {
                fileName: "src/views/List/ListHeader/index.tsx",
                lineNumber: 154,
                columnNumber: 11
            }, void 0)
        ].filter(Boolean)
    }, void 0, false, {
        fileName: "src/views/List/ListHeader/index.tsx",
        lineNumber: 109,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map