batches: implement and use MultiSelectContext
Created by: LawnGnome
This PR adds a React context that manages selection state across a paginated list of... well, whatevers, as long as they're identified by a string ID. (I briefly flirted with making it generic, but, uh, generic context providers and React are not best friends.)
I've ported BatchChangeChangesets
and friends to use it, and it seems OK. Most importantly, we can now reuse it on the preview page and get the same behaviour.
Most of the new code is unit tests, although there's a small increase in code size just because of the context and state boilerplate. It'll (probably) be worth it in the long run.
Closes #23382 (closed).