import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from 'react'; import PropTypes from 'prop-types'; import { useGridSelector } from '../hooks/utils/useGridSelector'; import { gridTopLevelRowCountSelector } from '../hooks/features/rows/gridRowsSelector'; import { selectedGridRowsCountSelector } from '../hooks/features/selection/gridSelectionSelector'; import { gridVisibleTopLevelRowCountSelector } from '../hooks/features/filter/gridFilterSelector'; import { useGridApiContext } from '../hooks/utils/useGridApiContext'; import { GridRowCount } from './GridRowCount'; import { GridSelectedRowCount } from './GridSelectedRowCount'; import { GridFooterContainer } from './containers/GridFooterContainer'; import { useGridRootProps } from '../hooks/utils/useGridRootProps'; import { jsx as _jsx } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(props, ref) { var _rootProps$components; const apiRef = useGridApiContext(); const rootProps = useGridRootProps(); const totalTopLevelRowCount = useGridSelector(apiRef, gridTopLevelRowCountSelector); const selectedRowCount = useGridSelector(apiRef, selectedGridRowsCountSelector); const visibleTopLevelRowCount = useGridSelector(apiRef, gridVisibleTopLevelRowCountSelector); const selectedRowCountElement = !rootProps.hideFooterSelectedRowCount && selectedRowCount > 0 ? /*#__PURE__*/_jsx(GridSelectedRowCount, { selectedRowCount: selectedRowCount }) : /*#__PURE__*/_jsx("div", {}); const rowCountElement = !rootProps.hideFooterRowCount && !rootProps.pagination ? /*#__PURE__*/_jsx(GridRowCount, { rowCount: totalTopLevelRowCount, visibleRowCount: visibleTopLevelRowCount }) : null; const paginationElement = rootProps.pagination && !rootProps.hideFooterPagination && rootProps.components.Pagination && /*#__PURE__*/_jsx(rootProps.components.Pagination, _extends({}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.pagination)); return /*#__PURE__*/_jsxs(GridFooterContainer, _extends({ ref: ref }, props, { children: [selectedRowCountElement, rowCountElement, paginationElement] })); }); process.env.NODE_ENV !== "production" ? GridFooter.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the TypeScript types and run "yarn proptypes" | // ---------------------------------------------------------------------- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]) } : void 0; export { GridFooter };