@defra/interactive-map 0.0.39-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.
Files changed (84) hide show
  1. package/dist/css/index.css +1 -1
  2. package/dist/esm/im-core.js +1 -1
  3. package/dist/esm/im-shell.js +1 -1
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api.md +4 -4
  7. package/docs/plugins/draw.md +1 -1
  8. package/package.json +1 -1
  9. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
  10. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
  11. package/plugins/beta/map-styles/dist/umd/index.js +1 -1
  12. package/plugins/datasets/dist/esm/esriLayerAdapter.js +1 -1
  13. package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
  14. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  15. package/plugins/datasets/dist/umd/im-datasets-esri-adapter.js +1 -1
  16. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  17. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  18. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +2 -3
  19. package/plugins/datasets/src/adapters/esri/registry/esriDataset.js +1 -1
  20. package/plugins/datasets/src/adapters/loadLayerAdapter.js +1 -1
  21. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +1 -3
  22. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +3 -3
  23. package/plugins/datasets/src/initialise/initialiseDatasets.js +0 -1
  24. package/plugins/datasets/src/registry/dataset.js +2 -3
  25. package/plugins/datasets/src/registry/datasetRegistry.js +0 -3
  26. package/plugins/datasets/src/registry/datasetRegistry.test.js +1 -1
  27. package/plugins/datasets/src/registry/globalDataset.js +0 -3
  28. package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
  29. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  30. package/plugins/draw/src/DrawInit.jsx +2 -2
  31. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +1 -1
  32. package/plugins/draw/src/adapters/maplibre/modes/drawMode/pointerHandlers.js +1 -1
  33. package/plugins/draw/src/adapters/maplibre/modes/drawMode/pointerHandlers.test.js +1 -1
  34. package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/keyboardHandlers.js +1 -1
  35. package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexOperations.js +3 -3
  36. package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexOperations.test.js +1 -1
  37. package/plugins/draw/src/adapters/maplibre/modes/editVertexMode.test.js +1 -1
  38. package/plugins/draw/src/adapters/openlayers/draw/DrawMode.js +1 -0
  39. package/plugins/draw/src/adapters/openlayers/draw/DrawMode.test.js +15 -1
  40. package/plugins/draw/src/adapters/openlayers/draw/drawInput.js +17 -3
  41. package/plugins/draw/src/adapters/openlayers/draw/drawInput.test.js +47 -3
  42. package/plugins/draw/src/adapters/openlayers/edit/EditMode.js +1 -1
  43. package/plugins/draw/src/adapters/openlayers/edit/EditMode.test.js +1 -1
  44. package/plugins/draw/src/adapters/openlayers/edit/keyboardHandler.test.js +1 -1
  45. package/plugins/draw/src/adapters/openlayers/edit/nudge.js +2 -2
  46. package/plugins/draw/src/adapters/openlayers/edit/nudge.test.js +2 -2
  47. package/plugins/draw/src/events.js +4 -4
  48. package/plugins/draw/src/events.test.js +1 -1
  49. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  50. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  51. package/plugins/interact/dist/umd/index.js +1 -1
  52. package/plugins/interact/src/hooks/useCrossHairVisibility.js +12 -4
  53. package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +88 -1
  54. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  55. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  56. package/plugins/search/src/Search.jsx +5 -2
  57. package/sonar-project.properties +7 -1
  58. package/src/App/components/Attributions/Attributions.module.scss +10 -0
  59. package/src/App/components/Hints/Hints.jsx +7 -2
  60. package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +2 -3
  61. package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +3 -6
  62. package/src/App/components/{MoveControl/MoveControl.jsx → MoveControls/MoveControls.jsx} +10 -10
  63. package/src/App/components/{MoveControl/MoveControl.module.scss → MoveControls/MoveControls.module.scss} +24 -24
  64. package/src/App/components/{MoveControl/MoveControl.test.jsx → MoveControls/MoveControls.test.jsx} +48 -48
  65. package/src/App/components/Viewport/Viewport.jsx +9 -1
  66. package/src/App/components/Viewport/Viewport.test.jsx +11 -0
  67. package/src/App/initialiseApp.js +11 -8
  68. package/src/App/initialiseApp.test.js +15 -3
  69. package/src/App/layout/Layout.jsx +3 -1
  70. package/src/App/registry/keyboardShortcutRegistry.js +25 -13
  71. package/src/App/registry/keyboardShortcutRegistry.test.js +49 -32
  72. package/src/App/registry/pluginRegistry.js +1 -2
  73. package/src/App/registry/pluginRegistry.test.js +4 -3
  74. package/src/App/store/AppProvider.jsx +3 -2
  75. package/src/InteractiveMap/InteractiveMap.js +8 -2
  76. package/src/InteractiveMap/InteractiveMap.test.js +20 -3
  77. package/src/config/appConfig.js +17 -15
  78. package/src/config/appConfig.test.js +22 -22
  79. package/src/config/defaults.js +3 -1
  80. package/src/config/mergeConfig.js +7 -0
  81. package/src/config/mergeConfig.test.js +20 -0
  82. package/src/scss/main.scss +1 -1
  83. package/src/test-utils.js +5 -0
  84. 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
  })
@@ -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/MoveControl/MoveControl.module';
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} [enableMoveControl=true]
701
- * Whether the move control is displayed — a button that reveals directional pan,
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 enableMoveControl is enabled.
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 app is fullscreen.
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()).