import { Button } from "@/components/ui/button";
import { Trash } from "lucide-react";
import type { RaRecord, UseBulkDeleteControllerParams } from "ra-core";
import { Translate, useBulkDeleteController } from "ra-core";
import { cn } from "@/lib/utils";
import type { ReactNode } from "react";
/**
* A button that deletes multiple selected records at once.
*
* Allows to delete selected records in a DataTable. Use within
* the bulkActionsButtons prop of DataTable or inside BulkActionsToolbar.
*
* @see {@link https://marmelab.com/shadcn-admin-kit/docs/bulkdeletebutton/ BulkDeleteButton documentation}
*
* @example
* import { BulkDeleteButton, BulkExportButton, DataTable, List } from '@/components/admin';
*
* export const PostList = () => (
*
*
*
*
* >
* }
* >
* ...
*
*
* );
*/
export const BulkDeleteButton = <
RecordType extends RaRecord = any,
MutationOptionsError = unknown,
>({
icon = defaultIcon,
label,
className,
...props
}: BulkDeleteButtonProps) => {
const { handleDelete, isPending } = useBulkDeleteController(props);
return (
);
};
export type BulkDeleteButtonProps<
RecordType extends RaRecord = any,
MutationOptionsError = unknown,
> = {
label?: string;
icon?: ReactNode;
} & React.ComponentPropsWithoutRef<"button"> &
UseBulkDeleteControllerParams;
const defaultIcon = ;