'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import { useModal } from '@faceless-ui/modal';
import { useRouter } from 'next/navigation.js';
import React from 'react';
import { useBulkUpload } from '../../../elements/BulkUpload/index.js';
import { useTranslation } from '../../../providers/Translation/index.js';
import { Button } from '../../Button/index.js';
export function ListBulkUploadButton({ collectionSlug, hasCreatePermission, isBulkUploadEnabled, onBulkUploadSuccess, openBulkUpload: openBulkUploadFromProps }) /**
   * @deprecated This prop will be removed in the next major version.
   *
   * Prefer using `onBulkUploadSuccess`
   */ {
    const { drawerSlug: bulkUploadDrawerSlug, setCollectionSlug, setOnSuccess } = useBulkUpload();
    const { t } = useTranslation();
    const { openModal } = useModal();
    const router = useRouter();
    const openBulkUpload = React.useCallback(()=>{
        if (typeof openBulkUploadFromProps === 'function') {
            openBulkUploadFromProps();
        } else {
            setCollectionSlug(collectionSlug);
            openModal(bulkUploadDrawerSlug);
            setOnSuccess(()=>{
                if (typeof onBulkUploadSuccess === 'function') {
                    onBulkUploadSuccess();
                } else {
                    router.refresh();
                }
            });
        }
    }, [
        router,
        collectionSlug,
        bulkUploadDrawerSlug,
        openModal,
        setCollectionSlug,
        setOnSuccess,
        onBulkUploadSuccess,
        openBulkUploadFromProps
    ]);
    if (!hasCreatePermission || !isBulkUploadEnabled) {
        return null;
    }
    return /*#__PURE__*/ _jsxDEV(Button, {
        "aria-label": t('upload:bulkUpload'),
        buttonStyle: "pill",
        onClick: openBulkUpload,
        size: "small",
        children: t('upload:bulkUpload')
    }, "bulk-upload-button", false, {
        fileName: "src/elements/ListHeader/TitleActions/ListBulkUploadButton.tsx",
        lineNumber: 65,
        columnNumber: 5
    }, this);
}

//# sourceMappingURL=ListBulkUploadButton.js.map