@mapcomponents/react-maplibre 0.1.66 → 0.1.68

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 (287) hide show
  1. package/.github/workflows/node_version_test.yml +1 -1
  2. package/.storybook/main.js +37 -31
  3. package/.storybook/preview.js +21 -0
  4. package/CHANGELOG.md +13 -0
  5. package/coverage/clover.xml +545 -472
  6. package/coverage/coverage-final.json +18 -17
  7. package/coverage/lcov-report/index.html +80 -80
  8. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +50 -26
  9. package/coverage/lcov-report/src/components/MapLibreMap/index.html +5 -5
  10. package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +30 -51
  11. package/coverage/lcov-report/src/components/MlCenterPosition/index.html +3 -3
  12. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
  13. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  14. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +1 -1
  15. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
  16. package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +1 -1
  17. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +1 -1
  18. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
  19. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  20. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  21. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +48 -105
  22. package/coverage/lcov-report/src/components/MlFollowGps/index.html +15 -15
  23. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +2 -2
  24. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  25. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +1 -1
  26. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +1 -1
  27. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +1 -1
  28. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +1 -1
  29. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +1 -1
  30. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
  31. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
  32. package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +1 -1
  33. package/coverage/lcov-report/src/components/MlGpxViewer/index.html +1 -1
  34. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
  35. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
  36. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  37. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  38. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +52 -40
  39. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +10 -10
  40. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +4 -4
  41. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
  42. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  43. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
  44. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  45. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  46. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  47. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  48. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  49. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  50. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  51. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  52. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +41 -113
  53. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +15 -15
  54. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  55. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  56. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  57. package/coverage/lcov-report/src/components/MlScaleReference/{MlScaleReference.js.html → MlScaleReference.tsx.html} +57 -36
  58. package/coverage/lcov-report/src/components/MlScaleReference/index.html +2 -2
  59. package/coverage/lcov-report/src/components/MlShareMapState/{MlShareMapState.js.html → MlShareMapState.tsx.html} +192 -84
  60. package/coverage/lcov-report/src/components/MlShareMapState/index.html +20 -20
  61. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +1 -1
  62. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +1 -1
  63. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +1 -1
  64. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +2 -2
  65. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +1 -1
  66. package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +2 -2
  67. package/coverage/lcov-report/src/components/MlSketchTool/index.html +1 -1
  68. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +1 -1
  69. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
  70. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  71. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreejsLayer.tsx.html +769 -0
  72. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +25 -10
  73. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
  74. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  75. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  76. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  77. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +22 -10
  78. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +13 -13
  79. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +11 -11
  80. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +11 -11
  81. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
  82. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
  83. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +27 -18
  84. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +11 -11
  85. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +72 -27
  86. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  87. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  88. package/coverage/lcov-report/src/contexts/index.html +1 -1
  89. package/coverage/lcov-report/src/hooks/index.html +21 -21
  90. package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
  91. package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
  92. package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
  93. package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
  94. package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +2 -2
  95. package/coverage/lcov-report/src/hooks/useGpx/index.html +1 -1
  96. package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +1 -1
  97. package/coverage/lcov-report/src/hooks/useLayer.ts.html +1 -1
  98. package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +9 -9
  99. package/coverage/lcov-report/src/hooks/useLayerFilter/index.html +1 -1
  100. package/coverage/lcov-report/src/hooks/useLayerFilter/useLayerFilter.ts.html +1 -1
  101. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +1 -1
  102. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +9 -6
  103. package/coverage/lcov-report/src/hooks/useMap.ts.html +2 -2
  104. package/coverage/lcov-report/src/hooks/useMapState.ts.html +8 -29
  105. package/coverage/lcov-report/src/hooks/useSource.ts.html +10 -10
  106. package/coverage/lcov-report/src/hooks/useWms.ts.html +1 -1
  107. package/coverage/lcov-report/src/index.html +1 -1
  108. package/coverage/lcov-report/src/index.ts.html +105 -12
  109. package/coverage/lcov.info +1038 -917
  110. package/dist/components/MapLibreMap/MapLibreMap.d.ts +3 -3
  111. package/dist/components/MapLibreMap/MapLibreMap.stories.d.ts +5 -0
  112. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +17 -15
  113. package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +2 -15
  114. package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +2 -15
  115. package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -0
  116. package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +2 -1
  117. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -0
  118. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +2 -1
  119. package/dist/components/MlCreatePdfForm/MlCreatePdfForm.d.ts +1 -0
  120. package/dist/components/MlCreatePdfForm/MlCreatePdfForm.stories.d.ts +2 -1
  121. package/dist/components/MlCreatePdfForm/lib/PdfForm.d.ts +1 -0
  122. package/dist/components/MlCreatePdfForm/lib/_PdfPreview.d.ts +1 -0
  123. package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +1 -0
  124. package/dist/components/MlFeatureEditor/lib/create_supplementary_points.d.ts +1 -1
  125. package/dist/components/MlFeatureEditor/lib/create_vertex.d.ts +1 -1
  126. package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +1 -0
  127. package/dist/components/MlFollowGps/MlFollowGps.d.ts +5 -23
  128. package/dist/components/MlFollowGps/MlFollowGps.stories.d.ts +2 -2
  129. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +1 -0
  130. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +2 -1
  131. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +1 -0
  132. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +1 -0
  133. package/dist/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.d.ts +4 -1
  134. package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +1 -0
  135. package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.d.ts +2 -1
  136. package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +1 -0
  137. package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +2 -1
  138. package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +1 -0
  139. package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +1 -0
  140. package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +1 -0
  141. package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +1 -0
  142. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +1 -0
  143. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +2 -1
  144. package/dist/components/MlLayer/MlLayer.d.ts +1 -0
  145. package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +2 -1
  146. package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +2 -1
  147. package/dist/components/MlMarker/MlMarker.d.ts +1 -0
  148. package/dist/components/MlMeasureTool/MlMeasureTool.d.ts +1 -0
  149. package/dist/components/MlNavigationCompass/MlNavigationCompass.d.ts +1 -0
  150. package/dist/components/MlNavigationTools/MlNavigationTools.d.ts +5 -0
  151. package/dist/components/MlScaleReference/MlScaleReference.d.ts +8 -1
  152. package/dist/components/MlShareMapState/MlShareMapState.d.ts +33 -13
  153. package/dist/components/MlShareMapState/MlShareMapState.stories.d.ts +16 -9
  154. package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +1 -0
  155. package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +1 -0
  156. package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +1 -0
  157. package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +1 -0
  158. package/dist/components/MlSketchTool/MlSketchTool.d.ts +1 -0
  159. package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +2 -1
  160. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +1 -0
  161. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +2 -1
  162. package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +1 -1
  163. package/dist/components/MlThreeJsLayer/MlThreeJsLayer.stories.d.ts +2 -1
  164. package/dist/components/MlThreeJsLayer/MlThreejsLayer.d.ts +30 -0
  165. package/dist/components/MlThreeJsLayer/lib/GLTFLoader.d.ts +2 -1
  166. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +1 -0
  167. package/dist/components/MlVectorTileLayer/MlVectorTileLayer.d.ts +3 -2
  168. package/dist/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.d.ts +2 -1
  169. package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +1 -0
  170. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +1 -0
  171. package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +2 -1
  172. package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +1 -0
  173. package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +1 -0
  174. package/dist/contexts/MapContext.d.ts +13 -2
  175. package/dist/decorators/EmptyMapDecorator.d.ts +2 -0
  176. package/dist/decorators/MapContextDecorator.d.ts +1 -1
  177. package/dist/decorators/MapContextDecoratorHooks.d.ts +1 -1
  178. package/dist/decorators/MultiMapContextDecorator.d.ts +1 -1
  179. package/dist/decorators/NoNavToolsDecorator.d.ts +1 -1
  180. package/dist/decorators/ThemeDecorator.d.ts +2 -0
  181. package/dist/hooks/useCameraFollowPath/useCameraFollowPath.stories.d.ts +2 -1
  182. package/dist/hooks/useExportMap/lib.d.ts +1 -1
  183. package/dist/hooks/useLayerFilter/useLayerFilter.stories.d.ts +2 -1
  184. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +1 -0
  185. package/dist/index.d.ts +25 -8
  186. package/dist/index.esm.css +0 -97
  187. package/dist/index.esm.js +2187 -9306
  188. package/dist/index.esm.js.map +1 -1
  189. package/dist/setupTests.d.ts +6 -6
  190. package/dist/ui_components/Dropzone.d.ts +1 -0
  191. package/dist/ui_components/ImageLoader.d.ts +1 -0
  192. package/dist/ui_components/LayerList/LayerList.d.ts +6 -0
  193. package/dist/ui_components/LayerList/LayerList.stories.d.ts +12 -0
  194. package/dist/ui_components/LayerList/LayerListFolder.d.ts +9 -0
  195. package/dist/ui_components/LayerList/LayerListItem.d.ts +18 -0
  196. package/dist/ui_components/LayerList/util/LayerListItemVectorLayer.d.ts +15 -0
  197. package/dist/ui_components/LayerList/util/LayerPropertyForm.d.ts +10 -0
  198. package/dist/ui_components/LayerList/util/input/ColorPicker.d.ts +10 -0
  199. package/dist/ui_components/LoadingOverlayContext.d.ts +0 -1
  200. package/dist/ui_components/MapcomponentsTheme.d.ts +7 -0
  201. package/dist/ui_components/Tooltip.d.ts +1 -0
  202. package/dist/ui_components/TopToolbar.d.ts +1 -0
  203. package/dist/ui_components/UploadButton.d.ts +1 -0
  204. package/dist/util/Instructions.d.ts +1 -0
  205. package/package.json +67 -67
  206. package/public/thumbnails/{MlGPXViewer.png → MlGpxViewer.png} +0 -0
  207. package/rollup.config.js +68 -50
  208. package/src/@types/assets/index.d.ts +20 -0
  209. package/src/App.css +0 -55
  210. package/src/components/MapLibreMap/MapLibreMap.stories.js +38 -32
  211. package/src/components/MapLibreMap/MapLibreMap.tsx +29 -21
  212. package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +50 -40
  213. package/src/components/MlCenterPosition/MlCenterPosition.tsx +22 -29
  214. package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +6 -6
  215. package/src/components/MlFollowGps/MlFollowGps.stories.js +28 -10
  216. package/src/components/MlFollowGps/MlFollowGps.tsx +38 -57
  217. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +1 -1
  218. package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.ts +16 -10
  219. package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +4 -13
  220. package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +3 -1
  221. package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +21 -17
  222. package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +3 -3
  223. package/src/components/MlNavigationTools/MlNavigationTools.stories.js +4 -5
  224. package/src/components/MlNavigationTools/MlNavigationTools.tsx +30 -54
  225. package/src/components/MlScaleReference/{MlScaleReference.js → MlScaleReference.tsx} +38 -31
  226. package/src/components/MlShareMapState/MlShareMapState.stories.tsx +100 -0
  227. package/src/components/MlShareMapState/{MlShareMapState.js → MlShareMapState.tsx} +94 -58
  228. package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +1 -1
  229. package/src/components/MlSketchTool/MlSketchTool.tsx +1 -1
  230. package/src/components/MlThreeJsLayer/MlThreejsLayer.tsx +228 -0
  231. package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +7 -3
  232. package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +3 -11
  233. package/src/components/MlWmsLoader/MlWmsLoader.tsx +7 -4
  234. package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +2 -2
  235. package/src/components/MlWmsLoader/utils/WMSLinks.tsx +1 -1
  236. package/src/contexts/MapContext.tsx +34 -20
  237. package/src/custom.d.ts +4 -0
  238. package/src/decorators/EmptyMapDecorator.js +38 -0
  239. package/src/decorators/MapContextDecorator.js +31 -26
  240. package/src/decorators/MapContextDecoratorHooks.js +29 -24
  241. package/src/decorators/MultiMapContextDecorator.js +71 -71
  242. package/src/decorators/NoNavToolsDecorator.js +25 -23
  243. package/src/decorators/ThemeDecorator.js +24 -0
  244. package/src/decorators/style.css +0 -2
  245. package/src/hooks/useCameraFollowPath/useCameraFollowPath.stories.tsx +13 -19
  246. package/src/hooks/useExportMap/lib.ts +1 -1
  247. package/src/hooks/useGpx/useGpx.stories.js +1 -1
  248. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +1 -1
  249. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +5 -4
  250. package/src/hooks/useMap.ts +1 -1
  251. package/src/hooks/useMapState.stories.js +1 -1
  252. package/src/hooks/useMapState.ts +6 -13
  253. package/src/hooks/useSource.ts +1 -1
  254. package/src/hooks/useSources.stories.js +1 -1
  255. package/src/index.ts +40 -8
  256. package/src/ui_components/LayerList/LayerList.stories.tsx +136 -0
  257. package/src/ui_components/LayerList/LayerList.tsx +12 -0
  258. package/src/ui_components/LayerList/LayerListFolder.tsx +82 -0
  259. package/src/ui_components/LayerList/LayerListItem.tsx +180 -0
  260. package/src/ui_components/LayerList/assets/sample_1.json +26 -0
  261. package/src/ui_components/LayerList/assets/sample_2.json +22 -0
  262. package/src/ui_components/LayerList/assets/sample_polygon_1.json +33 -0
  263. package/src/ui_components/LayerList/assets/style.json +2599 -0
  264. package/src/ui_components/LayerList/util/LayerListItemVectorLayer.tsx +92 -0
  265. package/src/ui_components/LayerList/util/LayerPropertyForm.tsx +125 -0
  266. package/src/ui_components/LayerList/util/input/ColorPicker.tsx +44 -0
  267. package/src/ui_components/MapcomponentsTheme.tsx +133 -0
  268. package/src/ui_components/Sidebar.tsx +16 -11
  269. package/src/ui_components/TopToolbar.tsx +1 -3
  270. package/src/util/BubbleForInstructions.js +14 -12
  271. package/tsconfig.json +3 -9
  272. package/dist/components/MlGPXViewer/MlGPXViewer.d.ts +0 -29
  273. package/dist/components/MlGPXViewer/MlGPXViewer.stories.d.ts +0 -16
  274. package/dist/components/MlGPXViewer/MlGPXViewer.test.d.ts +0 -1
  275. package/dist/components/MlGPXViewer/gpxConverter.d.ts +0 -11
  276. package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +0 -10
  277. package/dist/components/MlGPXViewer/util/GeoJsonProvider.d.ts +0 -4
  278. package/dist/components/MlLayer/MlLayer.stories.d.ts +0 -10
  279. package/dist/custom.d.d.ts +0 -22
  280. package/dist/decorators/ThemeWrapper.d.ts +0 -3
  281. package/dist/hooks/exportMap/index.d.ts +0 -11
  282. package/dist/hooks/exportMap/lib.d.ts +0 -36
  283. package/dist/ui_components/Legend.d.ts +0 -1
  284. package/dist/ui_components/LoadingOverlay.d.ts +0 -2
  285. package/src/components/MlShareMapState/MlShareMapState.stories.js +0 -100
  286. package/src/custom.d.tsx +0 -26
  287. package/src/decorators/ThemeWrapper.tsx +0 -9
@@ -2,11 +2,11 @@ import React, { useRef, useEffect, useState, useCallback, useMemo } from "react"
2
2
  import useMap from "../../hooks/useMap";
3
3
  import MlGeoJsonLayer from "../MlGeoJsonLayer/MlGeoJsonLayer";
4
4
 
5
- import { Button, SxProps } from "@mui/material";
6
- import GpsFixedIcon from "@mui/icons-material/GpsFixed";
5
+ import { Button } from '@mui/material';
6
+ import GpsFixedIcon from '@mui/icons-material/GpsFixed';
7
7
 
8
- import { point, circle, lineArc, Feature, Point } from "@turf/turf";
9
- import { CircleLayerSpecification, FillLayerSpecification } from "maplibre-gl";
8
+ import { point, circle, lineArc, Feature, Point } from '@turf/turf';
9
+ import { CircleLayerSpecification, FillLayerSpecification } from 'maplibre-gl';
10
10
 
11
11
  interface MlFollowGpsProps {
12
12
  /**
@@ -47,13 +47,13 @@ interface MlFollowGpsProps {
47
47
  * Use any available paint prop from layer type "fill".
48
48
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
49
49
  */
50
- orientationConePaint?: FillLayerSpecification["paint"];
50
+ orientationConePaint?: FillLayerSpecification['paint'];
51
51
  /**
52
52
  * Position circle paint property object, that is passed to the MlGeoJsonLayer responsible for drawing the position circle.
53
53
  * Use any available paint prop from layer type "circle".
54
54
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
55
55
  */
56
- circlePaint?: CircleLayerSpecification["paint"];
56
+ circlePaint?: CircleLayerSpecification['paint'];
57
57
  /**
58
58
  * Active button font color
59
59
  */
@@ -67,11 +67,7 @@ interface MlFollowGpsProps {
67
67
  * Use any available paint prop from layer type "fill".
68
68
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
69
69
  */
70
- accuracyPaint?: FillLayerSpecification["paint"];
71
- /**
72
- * CSS style object that is applied to the button component
73
- */
74
- buttonSx?: SxProps | any;
70
+ accuracyPaint?: FillLayerSpecification['paint'];
75
71
  }
76
72
 
77
73
  /**
@@ -93,7 +89,7 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
93
89
  const initiallyCentered = useRef(false);
94
90
 
95
91
  const getLocationSuccess = useCallback(
96
- (pos) => {
92
+ (pos: GeolocationPosition) => {
97
93
  if (!mapHook.map) return;
98
94
 
99
95
  if ((!props.centerUserPosition && !initiallyCentered.current) || props.centerUserPosition) {
@@ -119,7 +115,7 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
119
115
  );
120
116
 
121
117
  const getLocationError = () => {
122
- console.log("Access of user location denied");
118
+ console.log('Access of user location denied');
123
119
  setLocationAccessDenied(true);
124
120
  };
125
121
 
@@ -127,27 +123,29 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
127
123
  if (!userLocationGeoJson) {
128
124
  return undefined;
129
125
  }
130
- let radius = 0.02;
131
- let bearing1 = deviceOrientation - 15;
132
- let bearing2 = deviceOrientation + 15;
126
+ const radius = 0.02;
127
+ const bearing1 = deviceOrientation - 15;
128
+ const bearing2 = deviceOrientation + 15;
133
129
  const options = { steps: 65 };
134
- let arc = lineArc(userLocationGeoJson, radius, bearing1, bearing2, options);
135
- let copy = arc;
130
+ const arc = lineArc(userLocationGeoJson, radius, bearing1, bearing2, options);
131
+ const copy = arc;
136
132
  copy.geometry.coordinates.push(userLocationGeoJson.geometry.coordinates);
137
133
  copy.geometry.coordinates.slice(0, 0);
138
134
  return copy;
139
135
  }, [deviceOrientation, userLocationGeoJson]);
140
136
 
141
- const handleOrientation = (event: any) => {
142
- setDeviceOrientation(-event.alpha);
137
+ const handleOrientation = (event: DeviceOrientationEvent) => {
138
+ if (event?.alpha) {
139
+ setDeviceOrientation(-event.alpha);
140
+ }
143
141
  };
144
142
 
145
143
  useEffect(() => {
146
144
  if (isFollowed) {
147
- let _handleOrientation = handleOrientation;
148
- window.addEventListener("deviceorientation", _handleOrientation);
145
+ const _handleOrientation = handleOrientation;
146
+ window.addEventListener('deviceorientation', _handleOrientation);
149
147
  return () => {
150
- window.removeEventListener("deviceorientation", _handleOrientation);
148
+ window.removeEventListener('deviceorientation', _handleOrientation);
151
149
  };
152
150
  } else {
153
151
  initiallyCentered.current = false;
@@ -159,7 +157,7 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
159
157
  if (!mapHook.map) return;
160
158
 
161
159
  if (isFollowed) {
162
- let _watchId = navigator.geolocation.watchPosition(getLocationSuccess, getLocationError);
160
+ const _watchId = navigator.geolocation.watchPosition(getLocationSuccess, getLocationError);
163
161
 
164
162
  return () => {
165
163
  navigator.geolocation.clearWatch(_watchId);
@@ -173,10 +171,10 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
173
171
  {isFollowed && userLocationGeoJson && (
174
172
  <MlGeoJsonLayer
175
173
  geojson={accuracyGeoJson}
176
- type={"fill"}
174
+ type={'fill'}
177
175
  paint={{
178
- "fill-color": "#cbd300",
179
- "fill-opacity": 0.3,
176
+ 'fill-color': '#cbd300',
177
+ 'fill-opacity': 0.3,
180
178
  ...props.accuracyPaint,
181
179
  }}
182
180
  insertBeforeLayer={props.insertBeforeLayer}
@@ -186,11 +184,11 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
186
184
  {isFollowed && orientationCone && (
187
185
  <MlGeoJsonLayer
188
186
  geojson={orientationCone}
189
- type={"fill"}
187
+ type={'fill'}
190
188
  paint={{
191
- "fill-color": "#0000ff",
192
- "fill-antialias": false,
193
- "fill-opacity": 0.3,
189
+ 'fill-color': '#0000ff',
190
+ 'fill-antialias': false,
191
+ 'fill-opacity': 0.3,
194
192
  ...props.orientationConePaint,
195
193
  }}
196
194
  insertBeforeLayer={props.insertBeforeLayer}
@@ -200,12 +198,12 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
200
198
  {isFollowed && userLocationGeoJson && (
201
199
  <MlGeoJsonLayer
202
200
  geojson={userLocationGeoJson}
203
- type={"circle"}
201
+ type={'circle'}
204
202
  paint={{
205
- "circle-color": "#009ee0",
206
- "circle-radius": 5,
207
- "circle-stroke-color": "#fafaff",
208
- "circle-stroke-width": 1,
203
+ 'circle-color': '#009ee0',
204
+ 'circle-radius': 5,
205
+ 'circle-stroke-color': '#fafaff',
206
+ 'circle-stroke-width': 1,
209
207
  ...props.circlePaint,
210
208
  }}
211
209
  insertBeforeLayer={props.insertBeforeLayer}
@@ -213,20 +211,17 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
213
211
  )}
214
212
 
215
213
  <Button
214
+ variant="navtools"
216
215
  sx={{
217
216
  zIndex: 1002,
218
217
  color: isFollowed ? props.onColor : props.offColor,
219
- ...props.buttonSx,
220
218
  }}
221
219
  disabled={locationAccessDenied}
222
220
  onClick={() => {
223
221
  setIsFollowed(!isFollowed);
224
222
  }}
225
223
  >
226
- {" "}
227
- <GpsFixedIcon
228
- sx={{ ...(props.buttonSx?.fontSize ? { fontSize: props.buttonSx?.fontSize } : {}) }}
229
- />{" "}
224
+ <GpsFixedIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
230
225
  </Button>
231
226
  </>
232
227
  );
@@ -234,22 +229,8 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
234
229
 
235
230
  MlFollowGps.defaultProps = {
236
231
  mapId: undefined,
237
- buttonSx: {
238
- minWidth: "30px",
239
- minHeight: "30px",
240
- width: "30px",
241
- height: "30px",
242
- backgroundColor: "#414141",
243
- borderRadius: "23%",
244
- margin: 0.15,
245
- fontSize: "1.3em",
246
- ":hover": {
247
- backgroundColor: "#515151",
248
- color: "#ececec",
249
- },
250
- },
251
- onColor: "#ececec",
252
- offColor: "#666",
232
+ onColor: '#ececec',
233
+ offColor: '#666',
253
234
  showAccuracyCircle: true,
254
235
  showUserLocation: true,
255
236
  showOrientation: true,
@@ -115,7 +115,7 @@ const MlGeoJsonLayer = (props: MlGeoJsonLayerProps) => {
115
115
  layout: props.layout || {},
116
116
  ...props.options,
117
117
  type: layerType as LayerSpecification['type'],
118
- },
118
+ } as Partial<LayerSpecification>,
119
119
  insertBeforeLayer: props.insertBeforeLayer,
120
120
  onHover: props.onHover,
121
121
  onClick: props.onClick,
@@ -1,29 +1,35 @@
1
- const getDefaultPaintPropsByType:Function = (type:string, defaultPaintOverrides:any):any => {
1
+ import { LayerSpecification, RasterLayerSpecification } from 'maplibre-gl';
2
+
3
+ const getDefaultPaintPropsByType = (
4
+ type: string,
5
+ defaultPaintOverrides?: { [key: string]: unknown }
6
+ ): Exclude<LayerSpecification['paint'], RasterLayerSpecification['paint']> => {
2
7
  switch (type) {
3
- case "fill":
8
+ case 'fill':
4
9
  if (defaultPaintOverrides?.fill) {
5
10
  return defaultPaintOverrides.fill;
6
11
  }
7
12
  return {
8
- "fill-color": "rgba(10,240,256,0.6)",
13
+ 'fill-color': 'rgba(10,240,256,0.6)',
9
14
  };
10
- case "line":
15
+ case 'line':
11
16
  if (defaultPaintOverrides?.line) {
12
17
  return defaultPaintOverrides.line;
13
18
  }
14
19
  return {
15
- "line-color": "rgb(203,211,2)",
16
- "line-width": 5,
20
+ 'line-color': 'rgb(203,211,2)',
21
+ 'line-width': 5,
22
+ 'line-blur': 0,
17
23
  };
18
- case "circle":
24
+ case 'circle':
19
25
  default:
20
26
  if (defaultPaintOverrides?.circle) {
21
27
  return defaultPaintOverrides.circle;
22
28
  }
23
29
  return {
24
- "circle-color": "rgba(10,240,256,0.8)",
25
- "circle-stroke-color": "#fff",
26
- "circle-stroke-width": 2,
30
+ 'circle-color': 'rgba(10,240,256,0.8)',
31
+ 'circle-stroke-color': '#fff',
32
+ 'circle-stroke-width': 2,
27
33
  };
28
34
  }
29
35
  };
@@ -47,8 +47,8 @@ const Template = () => {
47
47
 
48
48
  return (
49
49
  <>
50
- <MlGpxViewerInstructions open={guide} />
51
- <MlGpxDemoLoader open={demoLoaderOpen} setOpen={setDemoLoaderOpen} setGpx={setGpxData} />
50
+ <MlGpxViewerInstructions open={guide} />
51
+ <MlGpxDemoLoader open={demoLoaderOpen} setOpen={setDemoLoaderOpen} setGpx={setGpxData} />
52
52
  <TopToolbar appBarStyle={{ zIndex: 500 }}>
53
53
  <Button variant="contained" onClick={handleClick2} sx={{ marginRight: '10px' }}>
54
54
  Guide me through
@@ -57,8 +57,7 @@ const Template = () => {
57
57
  Demo Mode
58
58
  </Button>
59
59
  </TopToolbar>
60
-
61
-
60
+
62
61
  <div
63
62
  style={{
64
63
  position: 'fixed',
@@ -73,12 +72,7 @@ const Template = () => {
73
72
  <UploadButton
74
73
  setData={setGpxData}
75
74
  buttonComponent={
76
- <IconButton
77
- style={{
78
- backgroundColor: 'rgba(255,255,255,1)',
79
- }}
80
- size="large"
81
- >
75
+ <IconButton size="large">
82
76
  <FileCopy />
83
77
  </IconButton>
84
78
  }
@@ -87,9 +81,6 @@ const Template = () => {
87
81
  onClick={() => {
88
82
  setMetadataDrawerOpen((prevState) => !prevState);
89
83
  }}
90
- style={{
91
- backgroundColor: 'rgba(255,255,255,1)',
92
- }}
93
84
  size="large"
94
85
  >
95
86
  <InfoIcon />
@@ -19,6 +19,7 @@ const modalStyle = {
19
19
  width: 350,
20
20
  height: 280,
21
21
  bgcolor: 'background.paper',
22
+ color: 'text.primary',
22
23
  boxShadow: 24,
23
24
  p: 4,
24
25
  };
@@ -30,6 +31,7 @@ const mobileStyle = {
30
31
  width: 200,
31
32
  height: 300,
32
33
  bgcolor: 'background.paper',
34
+ color: 'text.primary',
33
35
  boxShadow: 24,
34
36
  p: 4,
35
37
  };
@@ -101,7 +103,7 @@ const MlGpxDemoLoader = (props: MlGpxDemoLoaderProps) => {
101
103
  </Grid>
102
104
  <Grid item xs={2}>
103
105
  <Button onClick={handleClose}>
104
- <CloseIcon sx={{ color: 'black' }} />
106
+ <CloseIcon sx={{ color: 'text.primary' }} />
105
107
  </Button>
106
108
  </Grid>
107
109
  </Grid>
@@ -3,7 +3,7 @@ import React, { useContext, useCallback, useRef, useEffect, useState, useMemo }
3
3
  // @ts-ignore
4
4
  import syncMove from '@mapbox/mapbox-gl-sync-move';
5
5
  import './style.css';
6
- import MapContext from '../../contexts/MapContext';
6
+ import MapContext, { MapContextType } from '../../contexts/MapContext';
7
7
 
8
8
  export interface MlLayerMagnifyProps {
9
9
  /**
@@ -34,10 +34,10 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
34
34
  const syncMoveInitializedRef = useRef(false);
35
35
  const syncCleanupFunctionRef = useRef(() => {});
36
36
 
37
- const [swipeX, setSwipeX] = useState('50');
38
- const swipeXRef = useRef('50');
39
- const [swipeY, setSwipeY] = useState('50');
40
- const swipeYRef = useRef('50');
37
+ const [swipeX, setSwipeX] = useState(50);
38
+ const swipeXRef = useRef(50);
39
+ const [swipeY, setSwipeY] = useState(50);
40
+ const swipeYRef = useRef(50);
41
41
 
42
42
  const magnifierRadius = useMemo(() => {
43
43
  return props.magnifierRadius || 200;
@@ -60,7 +60,7 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
60
60
  onMove({
61
61
  clientX: swipeXRef.current,
62
62
  clientY: swipeYRef.current,
63
- });
63
+ } as (TouchEvent & MouseEvent));
64
64
  });
65
65
 
66
66
  useEffect(() => {
@@ -74,25 +74,25 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
74
74
  }, []);
75
75
 
76
76
  const onMove = useCallback(
77
- (e) => {
77
+ (e:(TouchEvent & MouseEvent)) => {
78
78
  if (!mapExists()) return;
79
79
 
80
80
  const bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
81
81
  let clientX =
82
- e.clientX ||
83
- (typeof e.touches !== 'undefined' && typeof e.touches[0] !== 'undefined'
84
- ? e.touches[0].clientX
82
+ e?.clientX ||
83
+ (typeof e?.touches !== 'undefined' && typeof e?.touches[0] !== 'undefined'
84
+ ? e?.touches[0].clientX
85
85
  : 0);
86
86
  let clientY =
87
- e.clientY ||
87
+ e?.clientY ||
88
88
  (typeof e.touches !== 'undefined' && typeof e.touches[0] !== 'undefined'
89
89
  ? e.touches[0].clientY
90
90
  : 0);
91
91
 
92
92
  clientX -= bounds.x;
93
93
  clientY -= bounds.y;
94
- const swipeX_tmp = ((clientX / bounds.width) * 100).toFixed(2);
95
- const swipeY_tmp = ((clientY / bounds.height) * 100).toFixed(2);
94
+ const swipeX_tmp = parseFloat(((clientX / bounds.width) * 100).toFixed(2));
95
+ const swipeY_tmp = parseFloat(((clientY / bounds.height) * 100).toFixed(2));
96
96
 
97
97
  if (swipeXRef.current !== swipeX_tmp || swipeYRef.current !== swipeY_tmp) {
98
98
  setSwipeX(swipeX_tmp);
@@ -102,9 +102,9 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
102
102
 
103
103
  mapContext.maps[props.map2Id].getContainer().style.clipPath =
104
104
  `circle(${magnifierRadius}px at ` +
105
- (parseFloat(swipeXRef.current) * bounds.width) / 100 +
105
+ (swipeXRef.current * bounds.width) / 100 +
106
106
  'px ' +
107
- (parseFloat(swipeYRef.current) * bounds.height) / 100 +
107
+ (swipeYRef.current * bounds.height) / 100 +
108
108
  'px)';
109
109
  }
110
110
  },
@@ -120,6 +120,10 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
120
120
  mapContext.getMap(props.map2Id).map
121
121
  );
122
122
 
123
+ onMove({
124
+ clientX: swipeXRef.current,
125
+ clientY: swipeYRef.current,
126
+ } as (TouchEvent & MouseEvent));
123
127
  /*
124
128
  automatically adjust radius for small screens
125
129
  if (
@@ -150,7 +154,7 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
150
154
  onMove({
151
155
  clientX: mapContext.maps[props.map1Id].getCanvas().clientWidth / 2,
152
156
  clientY: mapContext.maps[props.map1Id].getCanvas().clientHeight / 2,
153
- });
157
+ } as (TouchEvent & MouseEvent));
154
158
  }, [mapContext.mapIds, mapContext, mapExists, props, onMove]);
155
159
 
156
160
  const onDown = (e: React.MouseEvent | React.TouchEvent) => {
@@ -175,7 +179,7 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
175
179
 
176
180
  const onWheel = (e: React.WheelEvent) => {
177
181
  const evCopy = new WheelEvent(e.type, e as unknown as WheelEventInit);
178
- mapContext.map.getCanvas().dispatchEvent(evCopy);
182
+ mapContext.map?.map.getCanvas().dispatchEvent(evCopy);
179
183
  };
180
184
 
181
185
  return (
@@ -3,7 +3,7 @@ import React, { useContext, useCallback, useRef, useEffect, useState } from 'rea
3
3
  // @ts-ignore
4
4
  import syncMove from '@mapbox/mapbox-gl-sync-move';
5
5
  import './style.css';
6
- import MapContext from '../../contexts/MapContext';
6
+ import MapContext, { MapContextType } from '../../contexts/MapContext';
7
7
 
8
8
  export interface MlLayerSwipeProps {
9
9
  /**
@@ -48,7 +48,7 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
48
48
  };
49
49
 
50
50
  const onMove = useCallback(
51
- (e) => {
51
+ (e:(TouchEvent & MouseEvent)) => {
52
52
  if (!mapExists()) return;
53
53
 
54
54
  const bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
@@ -87,7 +87,7 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
87
87
  );
88
88
  onMove({
89
89
  clientX: mapContext.maps[props.map1Id].getCanvas().clientWidth / 2,
90
- });
90
+ } as (TouchEvent & MouseEvent));
91
91
  }, [mapContext.mapIds, mapContext, props, onMove, mapExists]);
92
92
 
93
93
  const onDown = (e: React.MouseEvent | React.TouchEvent) => {
@@ -7,7 +7,7 @@ import BuildIcon from "@mui/icons-material/Build";
7
7
  import Button from "@mui/material/Button";
8
8
 
9
9
  const storyoptions = {
10
- title: "MapComponents/MlNavigationTools",
10
+ title: 'MapComponents/MlNavigationTools',
11
11
  component: MlNavigationTools,
12
12
  argTypes: {
13
13
  url: {},
@@ -18,7 +18,6 @@ const storyoptions = {
18
18
  export default storyoptions;
19
19
 
20
20
  const Template = (args) => <MlNavigationTools {...args} />;
21
-
22
21
  export const DefaultConfig = Template.bind({});
23
22
  DefaultConfig.parameters = {};
24
23
  DefaultConfig.args = {};
@@ -39,7 +38,7 @@ ShowCenterLocationButton.args = {
39
38
  export const AlterToolPosition = Template.bind({});
40
39
  AlterToolPosition.parameters = {};
41
40
  AlterToolPosition.args = {
42
- sx: { top: "10px", right: "5px" },
41
+ sx: { top: '10px', right: '5px' },
43
42
  };
44
43
 
45
44
  export const NoZoomButtons = Template.bind({});
@@ -58,8 +57,8 @@ export const CustomButton = Template.bind({});
58
57
  CustomButton.parameters = {};
59
58
  CustomButton.args = {
60
59
  children: (
61
- <Button onClick={() => {}}>
62
- <BuildIcon sx={{ fontSize: "1em" }} />
60
+ <Button variant="navtools" onClick={() => {}}>
61
+ <BuildIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
63
62
  </Button>
64
63
  ),
65
64
  };
@@ -46,11 +46,16 @@ interface MlNavigationToolsProps {
46
46
  * Style attribute for NavigationTools container
47
47
  */
48
48
  sx?: SxProps;
49
+ /**
50
+ * Style attribute for NavigationTools container
51
+ */
52
+ mediaIsMobile?: boolean;
49
53
  }
50
54
 
51
55
  /**
52
56
  * @component
53
57
  */
58
+
54
59
  const MlNavigationTools = (props: MlNavigationToolsProps) => {
55
60
  const mapHook = useMap({
56
61
  mapId: props.mapId,
@@ -58,32 +63,13 @@ const MlNavigationTools = (props: MlNavigationToolsProps) => {
58
63
  });
59
64
 
60
65
  const [pitch, setPitch] = useState(0);
61
- const mediaIsMobile = useMediaQuery("(max-width:900px)");
62
- const buttonStyle = {
63
- minWidth: "20px",
64
- minHeight: "20px",
65
- width: mediaIsMobile ? "50px" : "30px",
66
- height: mediaIsMobile ? "50px" : "30px",
67
- backgroundColor: "#414141",
68
- borderRadius: "23%",
69
- //border: "1px solid #bbb",
70
- //boxShadow: "0px 0px 4px rgba(0,0,0,.5)",
71
- margin: 0.15,
72
- fontSize: mediaIsMobile ? "1.4em" : "1.2em",
73
- ":hover": {
74
- backgroundColor: "#515151",
75
- },
76
- color: "#ececec",
77
- };
78
- const iconStyle = {
79
- fontSize: buttonStyle.fontSize,
80
- };
66
+ const mediaIsMobile = useMediaQuery('(max-width:900px)');
81
67
 
82
68
  useEffect(() => {
83
69
  if (!mapHook.map) return;
84
70
 
85
71
  mapHook.map.on(
86
- "pitchend",
72
+ 'pitchend',
87
73
  () => {
88
74
  if (!mapHook.map) return;
89
75
 
@@ -124,63 +110,53 @@ const MlNavigationTools = (props: MlNavigationToolsProps) => {
124
110
  <Box
125
111
  sx={{
126
112
  zIndex: 501,
127
- position: "absolute",
128
- display: "flex",
129
- flexDirection: "column",
130
- ...(mediaIsMobile ? { margin: "20px 10px 20px 10px" } : {}),
113
+ position: 'absolute',
114
+ display: 'flex',
115
+ flexDirection: 'column',
116
+ ...(mediaIsMobile ? { margin: '20px 10px 20px 10px' } : {}),
131
117
  ...props.sx,
132
118
  }}
133
119
  >
134
120
  <MlNavigationCompass
135
121
  style={{
136
- width: "31px",
137
- position: "relative",
138
- height: mediaIsMobile ? "55px" : "45px",
139
- marginLeft: mediaIsMobile ? "3px" : "-5px",
140
- transform: mediaIsMobile ? "scale(1.6)" : "scale(1)",
122
+ width: '31px',
123
+ position: 'relative',
124
+ height: mediaIsMobile ? '55px' : '45px',
125
+ marginLeft: mediaIsMobile ? '3px' : '-5px',
126
+ transform: mediaIsMobile ? 'scale(1.6)' : 'scale(1)',
141
127
  }}
142
128
  backgroundStyle={{
143
- boxShadow: "0px 0px 18px rgba(0,0,0,.5)",
129
+ boxShadow: '0px 0px 18px rgba(0,0,0,.5)',
144
130
  }}
145
131
  />
146
132
  {props.show3DButton && (
147
- <Button
148
- sx={{ ...buttonStyle, fontSize: mediaIsMobile ? "1.4em" : "1em", fontWeight: 600 }}
149
- onClick={adjustPitch}
150
- >
151
- {pitch ? "2D" : "3D"}
133
+ <Button variant="navtools" onClick={adjustPitch}>
134
+ {pitch ? '2D' : '3D'}
152
135
  </Button>
153
136
  )}
154
- {props.showFollowGpsButton && (
155
- <MlFollowGps buttonSx={{ ...(({ color, ...rest }) => rest)(buttonStyle) }} />
156
- )}
157
- {props.showCenterLocationButton && (
158
- <MlCenterPosition style={{ ...(({ color, ...rest }) => rest)(buttonStyle) }} />
159
- )}
137
+ {props.showFollowGpsButton && <MlFollowGps />}
138
+ {props.showCenterLocationButton && <MlCenterPosition />}
160
139
  <ButtonGroup
161
140
  orientation="vertical"
162
141
  sx={{
163
- width: "50px",
164
- border: "none",
165
- Button: { minWidth: "20px !important", border: "none", padding: 0 },
166
- "Button:hover": { border: "none" },
142
+ width: '50px',
143
+ border: 'none',
144
+ Button: { minWidth: '20px !important', border: 'none', padding: 0 },
145
+ 'Button:hover': { border: 'none' },
167
146
  }}
168
147
  >
169
148
  {props.showZoomButtons && (
170
149
  <>
171
- <Button sx={{ ...buttonStyle }} onClick={zoomIn}>
172
- <ControlPointIcon sx={{ ...iconStyle }} />
150
+ <Button variant="navtools" onClick={zoomIn}>
151
+ <ControlPointIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
173
152
  </Button>
174
- <Button sx={{ ...buttonStyle }} onClick={zoomOut}>
175
- <RemoveCircleOutlineIcon sx={{ ...iconStyle }} />
153
+ <Button variant="navtools" onClick={zoomOut}>
154
+ <RemoveCircleOutlineIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
176
155
  </Button>
177
156
  </>
178
157
  )}
179
158
  </ButtonGroup>
180
- {props.children &&
181
- React.cloneElement(props.children, {
182
- sx: { ...buttonStyle },
183
- })}
159
+ {props.children && React.cloneElement(props.children, {})}
184
160
  </Box>
185
161
  );
186
162
  };