import clsx from 'clsx'; import commonClasses from './common.styles.module.css'; import classes from './MRT_BottomToolbar.module.css'; import { Box, type BoxProps } from '@mantine/core'; import { useMediaQuery } from '@mantine/hooks'; import { MRT_ProgressBar } from './MRT_ProgressBar'; import { MRT_TablePagination } from './MRT_TablePagination'; import { MRT_ToolbarAlertBanner } from './MRT_ToolbarAlertBanner'; import { MRT_ToolbarDropZone } from './MRT_ToolbarDropZone'; import { type MRT_RowData, type MRT_TableInstance } from '../../types'; import { parseFromValuesOrFunc } from '../../utils/utils'; interface Props extends BoxProps { table: MRT_TableInstance; } export const MRT_BottomToolbar = ({ table, ...rest }: Props) => { 'use no memo'; const { getState, options: { enablePagination, mantineBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table; const { isFullScreen } = getState(); const isMobile = useMediaQuery('(max-width: 720px)'); const toolbarProps = { ...parseFromValuesOrFunc(mantineBottomToolbarProps, { table, }), ...rest, }; const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions; return ( { if (node) { bottomToolbarRef.current = node; if (toolbarProps?.ref) { toolbarProps.ref.current = node; } } }} > {positionToolbarAlertBanner === 'bottom' && ( )} {['both', 'bottom'].includes(positionToolbarDropZone ?? '') && ( )} {renderBottomToolbarCustomActions ? ( renderBottomToolbarCustomActions({ table }) ) : ( )} {enablePagination && ['both', 'bottom'].includes(positionPagination ?? '') && ( )} ); };