Polaris Index Table - How to implement 'select all' when pagination is used?

How do I implement the ‘select all’ functionality when using pagination in an index table? When I set the property ‘hasMoreItems={true}’ to the index table, the button is displaying, but it is not properly selecting all the items that are available (only the ones that are currently displayed). I would like to select all available items so I am wondering if it is possible to access/override the ‘Select all 50+ products’ button. I can’t seem to find any info in the documentation on the matter or any example implementations of an index table with pagination.

Here is a screenshot of the ‘Select all 50+ products’ button I would like to have access to:

Commenting because I am facing the same issue.

I know this post is 2 years old but here’s an example for Polaris React

not sure how the new polaris does it tho