import type { ReactNode } from "react"; import { useListContext, Translate } from "ra-core"; import { Card } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { BulkDeleteButton } from "@/components/admin/bulk-delete-button"; import { X } from "lucide-react"; import { BulkExportButton } from "./bulk-export-button"; /** * Default children for BulkActionsToolbar. Renders BulkExportButton and BulkDeleteButton. * * @internal */ export function BulkActionsToolbarChildren() { return ( <> > ); } /** * A sticky toolbar that appears when rows are selected in a DataTable. * * Shows the number of selected rows and provides bulk action buttons. Automatically hidden * when no rows are selected. Positioned at the bottom center of the screen. * * @see {@link https://marmelab.com/shadcn-admin-kit/docs/bulkactionstoolbar/ BulkActionsToolbar documentation} * * @example * import { BulkActionsToolbar, BulkDeleteButton } from '@/components/admin'; * * const CustomBulkToolbar = () => ( * * * * ); * * const PostList = () => ( * * }> * ... * * * ); */ export const BulkActionsToolbar = ({ children = , }: { children?: ReactNode; }) => { const { selectedIds, onUnselectItems } = useListContext(); if (!selectedIds?.length) { return null; } const handleUnselectAll = (e: React.MouseEvent) => { e.stopPropagation(); onUnselectItems(); }; return ( {selectedIds.length} rows selected {children} ); };