@defra/interactive-map 0.0.38-alpha → 0.0.40-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api.md +4 -4
- package/docs/plugins/draw.md +1 -1
- package/package.json +1 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/index.js +1 -1
- package/plugins/datasets/dist/esm/esriLayerAdapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-esri-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +2 -3
- package/plugins/datasets/src/adapters/esri/registry/esriDataset.js +1 -1
- package/plugins/datasets/src/adapters/loadLayerAdapter.js +1 -1
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +1 -3
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +3 -3
- package/plugins/datasets/src/initialise/initialiseDatasets.js +0 -1
- package/plugins/datasets/src/registry/dataset.js +5 -4
- package/plugins/datasets/src/registry/datasetRegistry.js +30 -27
- package/plugins/datasets/src/registry/datasetRegistry.test.js +26 -19
- package/plugins/datasets/src/registry/globalDataset.js +0 -3
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/src/DrawInit.jsx +2 -2
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +1 -1
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/pointerHandlers.js +1 -1
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/pointerHandlers.test.js +1 -1
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/keyboardHandlers.js +1 -1
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexOperations.js +3 -3
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexOperations.test.js +1 -1
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode.test.js +1 -1
- package/plugins/draw/src/adapters/openlayers/draw/DrawMode.js +1 -0
- package/plugins/draw/src/adapters/openlayers/draw/DrawMode.test.js +15 -1
- package/plugins/draw/src/adapters/openlayers/draw/drawInput.js +17 -3
- package/plugins/draw/src/adapters/openlayers/draw/drawInput.test.js +47 -3
- package/plugins/draw/src/adapters/openlayers/edit/EditMode.js +1 -1
- package/plugins/draw/src/adapters/openlayers/edit/EditMode.test.js +1 -1
- package/plugins/draw/src/adapters/openlayers/edit/keyboardHandler.test.js +1 -1
- package/plugins/draw/src/adapters/openlayers/edit/nudge.js +2 -2
- package/plugins/draw/src/adapters/openlayers/edit/nudge.test.js +2 -2
- package/plugins/draw/src/events.js +4 -4
- package/plugins/draw/src/events.test.js +1 -1
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/interact/src/hooks/useCrossHairVisibility.js +12 -4
- package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +88 -1
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/src/Search.jsx +5 -2
- package/sonar-project.properties +7 -1
- package/src/App/components/Attributions/Attributions.module.scss +10 -0
- package/src/App/components/Hints/Hints.jsx +7 -2
- package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +2 -3
- package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +3 -6
- package/src/App/components/{MoveControl/MoveControl.jsx → MoveControls/MoveControls.jsx} +10 -10
- package/src/App/components/{MoveControl/MoveControl.module.scss → MoveControls/MoveControls.module.scss} +24 -24
- package/src/App/components/{MoveControl/MoveControl.test.jsx → MoveControls/MoveControls.test.jsx} +48 -48
- package/src/App/components/Viewport/Viewport.jsx +9 -1
- package/src/App/components/Viewport/Viewport.test.jsx +11 -0
- package/src/App/initialiseApp.js +11 -8
- package/src/App/initialiseApp.test.js +15 -3
- package/src/App/layout/Layout.jsx +3 -1
- package/src/App/registry/keyboardShortcutRegistry.js +25 -13
- package/src/App/registry/keyboardShortcutRegistry.test.js +49 -32
- package/src/App/registry/pluginRegistry.js +1 -2
- package/src/App/registry/pluginRegistry.test.js +4 -3
- package/src/App/store/AppProvider.jsx +3 -2
- package/src/InteractiveMap/InteractiveMap.js +8 -2
- package/src/InteractiveMap/InteractiveMap.test.js +20 -3
- package/src/config/appConfig.js +17 -15
- package/src/config/appConfig.test.js +22 -22
- package/src/config/defaults.js +3 -1
- package/src/config/mergeConfig.js +7 -0
- package/src/config/mergeConfig.test.js +20 -0
- package/src/scss/main.scss +1 -1
- package/src/test-utils.js +5 -0
- package/src/types.js +14 -6
|
@@ -40,4 +40,24 @@ describe('mergeConfig', () => {
|
|
|
40
40
|
expect(warnSpy).not.toHaveBeenCalled()
|
|
41
41
|
warnSpy.mockRestore()
|
|
42
42
|
})
|
|
43
|
+
|
|
44
|
+
it('sanitises hasExitButton to false for mapOnly behaviour', () => {
|
|
45
|
+
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {})
|
|
46
|
+
const result = mergeConfig({ behaviour: 'mapOnly', hasExitButton: true })
|
|
47
|
+
expect(result.hasExitButton).toBe(false)
|
|
48
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("hasExitButton has no effect when behaviour is 'mapOnly'"))
|
|
49
|
+
warnSpy.mockRestore()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('leaves hasExitButton alone for non-mapOnly behaviours', () => {
|
|
53
|
+
const result = mergeConfig({ behaviour: 'buttonFirst', hasExitButton: true })
|
|
54
|
+
expect(result.hasExitButton).toBe(true)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('does not warn when hasExitButton is already false for mapOnly', () => {
|
|
58
|
+
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {})
|
|
59
|
+
mergeConfig({ behaviour: 'mapOnly', hasExitButton: false })
|
|
60
|
+
expect(warnSpy).not.toHaveBeenCalled()
|
|
61
|
+
warnSpy.mockRestore()
|
|
62
|
+
})
|
|
43
63
|
})
|
package/src/scss/main.scss
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
@use '../App/components/Markers/Markers.module';
|
|
32
32
|
@use '../App/components/Viewport/Features.module';
|
|
33
33
|
@use '../App/components/Actions/Actions.module';
|
|
34
|
-
@use '../App/components/
|
|
34
|
+
@use '../App/components/MoveControls/MoveControls.module';
|
|
35
35
|
|
|
36
36
|
// Components that dont have a corresponding React Component
|
|
37
37
|
@use 'components';
|
package/src/test-utils.js
CHANGED
|
@@ -32,6 +32,11 @@ export const createMockRegistries = (overrides = {}) => {
|
|
|
32
32
|
registeredPlugins: [],
|
|
33
33
|
registerPlugin: jest.fn(),
|
|
34
34
|
clear: jest.fn()
|
|
35
|
+
},
|
|
36
|
+
keyboardShortcutRegistry: {
|
|
37
|
+
registerKeyboardShortcut: jest.fn(),
|
|
38
|
+
setProviderSupportedShortcuts: jest.fn(),
|
|
39
|
+
getKeyboardShortcuts: jest.fn(() => [])
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
}
|
package/src/types.js
CHANGED
|
@@ -697,8 +697,8 @@
|
|
|
697
697
|
* @property {boolean} [enableFullscreen=false]
|
|
698
698
|
* Whether a toggle fullscreen button is displayed.
|
|
699
699
|
*
|
|
700
|
-
* @property {boolean} [
|
|
701
|
-
* Whether the move
|
|
700
|
+
* @property {boolean} [enableMoveControls=true]
|
|
701
|
+
* Whether the move controls are displayed — a button that reveals directional pan,
|
|
702
702
|
* zoom, and step-size buttons, providing a non-dragging alternative to panning
|
|
703
703
|
* and zooming the map (WCAG 2.5.7). Unlike enableZoomControls, it remains visible
|
|
704
704
|
* when the interface type is 'touch'. When enabled, enableZoomControls' buttons
|
|
@@ -706,7 +706,7 @@
|
|
|
706
706
|
*
|
|
707
707
|
* @property {boolean} [enableZoomControls=true]
|
|
708
708
|
* Whether zoom control buttons are displayed. Not displayed when the interface
|
|
709
|
-
* type is 'touch', or when
|
|
709
|
+
* type is 'touch', or when enableMoveControls is enabled.
|
|
710
710
|
*
|
|
711
711
|
* @property {[number, number, number, number]} [extent]
|
|
712
712
|
* Initial extent [minX, minY, maxX, maxY]. Equivalent to bounds; use whichever matches your map provider's terminology.
|
|
@@ -722,16 +722,24 @@
|
|
|
722
722
|
* In `mapOnly` behaviour the Back button is hidden when there is no browser history to go back to.
|
|
723
723
|
*
|
|
724
724
|
* @property {boolean} [hasExitButton=false]
|
|
725
|
-
* Whether an exit map button is displayed when the
|
|
725
|
+
* Whether an exit map button is displayed. Only shown when the behaviour is `buttonFirst`
|
|
726
|
+
* or `hybrid` and the map is fullscreen - `mapOnly` has no launcher button or history entry
|
|
727
|
+
* to exit back to, so the exit button is never shown there.
|
|
726
728
|
*
|
|
727
729
|
* @property {number | null} [hybridWidth]
|
|
728
730
|
* Optional breakpoint (in pixels) for hybrid behaviour. Defaults to 'maxMobileWidth' when not set.
|
|
729
731
|
*
|
|
730
732
|
* @property {string} [keyboardHintText]
|
|
731
|
-
* HTML string providing keyboard shortcut instructions for accessibility users.
|
|
733
|
+
* HTML string providing keyboard shortcut instructions for accessibility users, announced via aria-describedby whenever the map viewport gains focus.
|
|
734
|
+
*
|
|
735
|
+
* @property {string} [mapHintText]
|
|
736
|
+
* Visually hidden text, rendered immediately before the map for screen reader users, explaining that it must be focused before keyboard commands work. Prefixed with mapLabel, so multiple maps on one page can be told apart.
|
|
732
737
|
*
|
|
733
738
|
* @property {string} [mapLabel='Interactive map']
|
|
734
|
-
* Accessible label for the map, announced by screen readers.
|
|
739
|
+
* Accessible label for the map, announced by screen readers. Also prefixed onto mapHintText, so give each map on a page a distinct label.
|
|
740
|
+
*
|
|
741
|
+
* @property {string} [moveControlsHintText]
|
|
742
|
+
* Visually hidden text describing the move controls button, appended to keyboardHintText when enableMoveControls is true.
|
|
735
743
|
*
|
|
736
744
|
* @property {MapProviderDescriptor} [mapProvider]
|
|
737
745
|
* A factory function that returns a map provider instance (e.g. maplibreProvider()).
|