@defra/interactive-map 0.0.60-alpha → 0.0.61-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/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/button-definition.md +11 -0
- package/docs/api/context.md +2 -0
- package/docs/plugins/draw.md +26 -0
- package/package.json +1 -1
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/DrawInit.jsx +3 -0
- package/plugins/draw/src/DrawInit.test.jsx +16 -0
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +19 -3
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +27 -0
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +10 -2
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +14 -0
- package/plugins/draw/src/defaults.js +4 -0
- package/plugins/draw/src/hooks/useSnapMinZoom.js +29 -0
- package/plugins/draw/src/hooks/useSnapMinZoom.test.js +82 -0
- package/plugins/draw/src/manifest.js +4 -1
- package/plugins/draw/src/manifest.test.js +15 -2
- package/plugins/draw/src/utils/snapMinZoom.js +8 -0
- package/plugins/draw/src/utils/snapMinZoom.test.js +22 -0
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/map-key/src/manifest.js +1 -1
- package/src/App/components/MapButton/MapButton.jsx +20 -2
- package/src/App/components/MapButton/MapButton.module.scss +15 -1
- package/src/App/components/MapButton/MapButton.test.jsx +21 -3
- package/src/App/components/Tooltip/Tooltip.jsx +29 -11
- package/src/App/components/Tooltip/Tooltip.test.jsx +45 -3
- package/src/App/components/Viewport/MapController.jsx +2 -0
- package/src/App/components/Viewport/MapController.test.jsx +3 -0
- package/src/App/hooks/useUserMoveTracking.js +65 -0
- package/src/App/hooks/useUserMoveTracking.test.js +99 -0
- package/src/App/renderer/mapButtons.js +1 -0
- package/src/App/renderer/mapButtons.test.js +8 -0
- package/src/App/store/mapActionsMap.js +2 -1
- package/src/App/store/mapActionsMap.test.js +6 -0
- package/src/App/store/mapReducer.js +2 -0
- package/src/App/store/mapReducer.test.js +1 -0
- package/src/scss/settings/_colors.scss +4 -0
- package/src/types.js +4 -0
|
@@ -174,6 +174,14 @@ describe('mapButtons module', () => {
|
|
|
174
174
|
expect(render(baseBtn).props.isBusy).toBeUndefined()
|
|
175
175
|
})
|
|
176
176
|
|
|
177
|
+
it('evaluates description, a string or a function of the context', () => {
|
|
178
|
+
const evaluate = jest.fn((prop) => (typeof prop === 'function' ? prop() : prop))
|
|
179
|
+
const fromFunction = SlotButton({ buttonId: 'id', config: { ...baseBtn, description: () => 'Zoom in' }, appState, appConfig, evaluateProp: evaluate })
|
|
180
|
+
expect(fromFunction.props.description).toBe('Zoom in')
|
|
181
|
+
const fromString = SlotButton({ buttonId: 'id', config: { ...baseBtn, description: 'Fixed' }, appState, appConfig, evaluateProp: evaluate })
|
|
182
|
+
expect(fromString.props.description).toBe('Fixed')
|
|
183
|
+
})
|
|
184
|
+
|
|
177
185
|
it.each([
|
|
178
186
|
[{ slot: 'right-top', open: false }, 'dialog'],
|
|
179
187
|
[{ slot: 'right-top', open: false, dismissible: false }, 'region'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generic reducer action that shallow-merges the payload into state.
|
|
3
|
-
* Shared by MAP_MOVE, MAP_MOVE_END and MAP_FIRST_IDLE.
|
|
3
|
+
* Shared by MAP_MOVE_START, MAP_MOVE, MAP_MOVE_END and MAP_FIRST_IDLE.
|
|
4
4
|
*/
|
|
5
5
|
const mergePayload = (state, payload) => ({
|
|
6
6
|
...state,
|
|
@@ -68,6 +68,7 @@ const removeMarker = (state, payload) => {
|
|
|
68
68
|
|
|
69
69
|
export const actionsMap = {
|
|
70
70
|
SET_MAP_READY: setMapReady,
|
|
71
|
+
MAP_MOVE_START: mergePayload,
|
|
71
72
|
MAP_MOVE: mergePayload,
|
|
72
73
|
MAP_MOVE_END: mergePayload,
|
|
73
74
|
MAP_FIRST_IDLE: mergePayload,
|
|
@@ -27,6 +27,12 @@ describe('actionsMap', () => {
|
|
|
27
27
|
})
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
+
test('MAP_MOVE_START merges payload into state', () => {
|
|
31
|
+
const payload = { isUserMove: true }
|
|
32
|
+
const result = actionsMap.MAP_MOVE_START(state, payload)
|
|
33
|
+
expect(result).toEqual({ ...state, ...payload })
|
|
34
|
+
})
|
|
35
|
+
|
|
30
36
|
test('MAP_MOVE merges payload into state', () => {
|
|
31
37
|
const payload = { center: [10, 20] }
|
|
32
38
|
const result = actionsMap.MAP_MOVE(state, payload)
|
|
@@ -31,6 +31,8 @@ export const initialState = (config) => {
|
|
|
31
31
|
resolution: null,
|
|
32
32
|
isAtMaxZoom: null,
|
|
33
33
|
isAtMinZoom: null,
|
|
34
|
+
// Whether the user started the latest move, rather than code (useUserMoveTracking)
|
|
35
|
+
isUserMove: false,
|
|
34
36
|
|
|
35
37
|
// Full target marker state
|
|
36
38
|
crossHair: {
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
--pressed-button-foreground-color: #ffffff;
|
|
18
18
|
--pressed-button-border-color: #0b0c0c;
|
|
19
19
|
--pressed-button-background-color: #0b0c0c;
|
|
20
|
+
--disabled-pressed-button-foreground-color: #ffffff;
|
|
21
|
+
--disabled-pressed-button-background-color: #9d9e9e;
|
|
20
22
|
|
|
21
23
|
// Scrollable content
|
|
22
24
|
--scrollable-outline: 3px solid #ffdd00;
|
|
@@ -68,6 +70,8 @@
|
|
|
68
70
|
--pressed-button-foreground-color: #0b0c0c;
|
|
69
71
|
--pressed-button-border-color: #ffffff;
|
|
70
72
|
--pressed-button-background-color: #ffffff;
|
|
73
|
+
--disabled-pressed-button-foreground-color: #383f43;
|
|
74
|
+
--disabled-pressed-button-background-color: #888c8e;
|
|
71
75
|
|
|
72
76
|
// Content
|
|
73
77
|
--content-border-color: #505a5f;
|
package/src/types.js
CHANGED
|
@@ -194,6 +194,10 @@
|
|
|
194
194
|
* opens or expands a custom control rendered elsewhere by the plugin. Text or a function
|
|
195
195
|
* returning the id.
|
|
196
196
|
*
|
|
197
|
+
* @property {string | ((context: PluginContext) => string | undefined)} [description]
|
|
198
|
+
* Extra information read by screen readers after the label, set with aria-describedby. Text or a
|
|
199
|
+
* function returning the text; no description when it returns nothing.
|
|
200
|
+
*
|
|
197
201
|
* @property {ButtonBreakpointConfig} [desktop]
|
|
198
202
|
* Desktop breakpoint configuration.
|
|
199
203
|
*
|