BasemapPicker
Chooses the basemap: a three-across grid of previews as a radio group, one
tile for each basemap the host offers (useBasemaps).
This is a function exported by @mapcairn/map, checked against version 0.2.0.
Signature
import { BasemapPicker } from "@mapcairn/map";
function BasemapPicker(input: BasemapPickerProps): JSX.Element;
Description
Each tile is a native radio input, visually hidden and drawn through its
label. Native radios give one tab stop for the group, arrow keys that move
and select in one step (wrapping at the ends and following the writing
direction) and the radio role in every screen reader, with no script. The
selected tile has an accent outline and a check badge, so selection never
relies on colour. A preview that fails to load gives way to the basemap's
swatch, as a basemap with no preview does, with the name still visible. The
picker never follows the interface theme itself: a host's dark basemap is
an ordinary choice, as the others are, and what shows as chosen is the
value the host passes.
Parameters
{ value, onChange }input(BasemapPickerProps)
Returns
JSX.Element
Remarks
For a basemap that has no preview image, no preview is requested:
the tile shows the same frame with a plain colour swatch, the basemap's own
swatch colour or else the light default's land colour.
A basemap marked unavailable (useBasemapAvailability, which the host
sets when every tile of it failed) has the words "Not available right
now" inside its label, so they are part of the radio's name, and its
radio is natively disabled, so the arrow keys skip it, unless it is the
chosen one. While any basemap is marked, a "Try again" button under the
group clears every mark, so the map judges a basemap again when it is
chosen, and moves focus to the chosen radio, because the button goes.
See also
Source: packages/map/src/panels/BasemapPicker/BasemapPicker.tsx:81