@mapcomponents/react-maplibre 0.1.67 → 0.1.69

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 (259) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/coverage/clover.xml +172 -174
  3. package/coverage/coverage-final.json +7 -7
  4. package/coverage/lcov-report/index.html +38 -38
  5. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +43 -25
  6. package/coverage/lcov-report/src/components/MapLibreMap/index.html +10 -10
  7. package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +30 -51
  8. package/coverage/lcov-report/src/components/MlCenterPosition/index.html +3 -3
  9. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
  10. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  11. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +1 -1
  12. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
  13. package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +1 -1
  14. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +1 -1
  15. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
  16. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  17. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  18. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +41 -98
  19. package/coverage/lcov-report/src/components/MlFollowGps/index.html +15 -15
  20. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +2 -2
  21. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  22. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +1 -1
  23. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +1 -1
  24. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +1 -1
  25. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +1 -1
  26. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +1 -1
  27. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
  28. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
  29. package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +1 -1
  30. package/coverage/lcov-report/src/components/MlGpxViewer/index.html +1 -1
  31. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
  32. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
  33. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  34. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  35. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +1 -1
  36. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
  37. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +1 -1
  38. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
  39. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  40. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
  41. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  42. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  43. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  44. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  45. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  46. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  47. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  48. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  49. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +41 -113
  50. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +15 -15
  51. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  52. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  53. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  54. package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.tsx.html +1 -1
  55. package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
  56. package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.tsx.html +1 -1
  57. package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
  58. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +1 -1
  59. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +1 -1
  60. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +1 -1
  61. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +2 -2
  62. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +1 -1
  63. package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +2 -2
  64. package/coverage/lcov-report/src/components/MlSketchTool/index.html +1 -1
  65. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +1 -1
  66. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
  67. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  68. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreejsLayer.tsx.html +1 -1
  69. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
  70. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
  71. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  72. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  73. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  74. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +22 -10
  75. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +13 -13
  76. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
  77. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
  78. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
  79. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
  80. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +1 -1
  81. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
  82. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +24 -3
  83. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  84. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  85. package/coverage/lcov-report/src/contexts/index.html +1 -1
  86. package/coverage/lcov-report/src/hooks/index.html +1 -1
  87. package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
  88. package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
  89. package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
  90. package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
  91. package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +2 -2
  92. package/coverage/lcov-report/src/hooks/useGpx/index.html +1 -1
  93. package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +1 -1
  94. package/coverage/lcov-report/src/hooks/useLayer.ts.html +1 -1
  95. package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
  96. package/coverage/lcov-report/src/hooks/useLayerFilter/index.html +1 -1
  97. package/coverage/lcov-report/src/hooks/useLayerFilter/useLayerFilter.ts.html +1 -1
  98. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +1 -1
  99. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +1 -1
  100. package/coverage/lcov-report/src/hooks/useMap.ts.html +1 -1
  101. package/coverage/lcov-report/src/hooks/useMapState.ts.html +1 -1
  102. package/coverage/lcov-report/src/hooks/useSource.ts.html +1 -1
  103. package/coverage/lcov-report/src/hooks/useWms.ts.html +1 -1
  104. package/coverage/lcov-report/src/index.html +1 -1
  105. package/coverage/lcov-report/src/index.ts.html +27 -3
  106. package/coverage/lcov.info +326 -342
  107. package/dist/components/MapLibreMap/MapLibreMap.d.ts +3 -3
  108. package/dist/components/MapLibreMap/MapLibreMap.stories.d.ts +2 -0
  109. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +1 -1
  110. package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +2 -15
  111. package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +1 -14
  112. package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -0
  113. package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +1 -0
  114. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -0
  115. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +1 -0
  116. package/dist/components/MlCreatePdfForm/MlCreatePdfForm.d.ts +1 -0
  117. package/dist/components/MlCreatePdfForm/MlCreatePdfForm.stories.d.ts +1 -0
  118. package/dist/components/MlCreatePdfForm/lib/PdfForm.d.ts +1 -0
  119. package/dist/components/MlCreatePdfForm/lib/_PdfPreview.d.ts +1 -0
  120. package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +1 -0
  121. package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +1 -0
  122. package/dist/components/MlFollowGps/MlFollowGps.d.ts +5 -23
  123. package/dist/components/MlFollowGps/MlFollowGps.stories.d.ts +2 -2
  124. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +1 -0
  125. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +1 -0
  126. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +1 -0
  127. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +1 -0
  128. package/dist/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.d.ts +4 -1
  129. package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +1 -0
  130. package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.d.ts +1 -0
  131. package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +1 -0
  132. package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +1 -0
  133. package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +1 -0
  134. package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +1 -0
  135. package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +1 -0
  136. package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +1 -0
  137. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +1 -0
  138. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +1 -0
  139. package/dist/components/MlLayer/MlLayer.d.ts +1 -0
  140. package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +1 -0
  141. package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +1 -0
  142. package/dist/components/MlMarker/MlMarker.d.ts +1 -0
  143. package/dist/components/MlMeasureTool/MlMeasureTool.d.ts +1 -0
  144. package/dist/components/MlNavigationCompass/MlNavigationCompass.d.ts +1 -0
  145. package/dist/components/MlNavigationTools/MlNavigationTools.d.ts +5 -0
  146. package/dist/components/MlScaleReference/MlScaleReference.d.ts +1 -0
  147. package/dist/components/MlShareMapState/MlShareMapState.d.ts +1 -0
  148. package/dist/components/MlShareMapState/MlShareMapState.stories.d.ts +1 -0
  149. package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +1 -0
  150. package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +1 -0
  151. package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +1 -0
  152. package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +1 -0
  153. package/dist/components/MlSketchTool/MlSketchTool.d.ts +1 -0
  154. package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +1 -0
  155. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +1 -0
  156. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +1 -0
  157. package/dist/components/MlThreeJsLayer/MlThreeJsLayer.stories.d.ts +1 -0
  158. package/dist/components/MlThreeJsLayer/MlThreejsLayer.d.ts +1 -0
  159. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +1 -0
  160. package/dist/components/MlVectorTileLayer/MlVectorTileLayer.d.ts +3 -2
  161. package/dist/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.d.ts +1 -0
  162. package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +1 -0
  163. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +1 -0
  164. package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +1 -0
  165. package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +1 -0
  166. package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +1 -0
  167. package/dist/decorators/EmptyMapDecorator.d.ts +2 -0
  168. package/dist/decorators/ThemeDecorator.d.ts +2 -0
  169. package/dist/hooks/useCameraFollowPath/useCameraFollowPath.stories.d.ts +1 -0
  170. package/dist/hooks/useExportMap/lib.d.ts +1 -1
  171. package/dist/hooks/useLayerFilter/useLayerFilter.stories.d.ts +1 -0
  172. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +1 -0
  173. package/dist/index.d.ts +7 -0
  174. package/dist/index.esm.css +0 -97
  175. package/dist/index.esm.js +5495 -14503
  176. package/dist/index.esm.js.map +1 -1
  177. package/dist/ui_components/Dropzone.d.ts +1 -0
  178. package/dist/ui_components/ImageLoader.d.ts +1 -0
  179. package/dist/ui_components/LayerList/LayerList.d.ts +6 -0
  180. package/dist/ui_components/LayerList/LayerList.stories.d.ts +12 -0
  181. package/dist/ui_components/LayerList/LayerListFolder.d.ts +9 -0
  182. package/dist/ui_components/LayerList/LayerListItem.d.ts +18 -0
  183. package/dist/ui_components/LayerList/util/LayerListItemVectorLayer.d.ts +15 -0
  184. package/dist/ui_components/LayerList/util/LayerPropertyForm.d.ts +10 -0
  185. package/dist/ui_components/LayerList/util/input/ColorPicker.d.ts +10 -0
  186. package/dist/ui_components/LoadingOverlayContext.d.ts +0 -1
  187. package/dist/ui_components/MapcomponentsTheme.d.ts +7 -0
  188. package/dist/ui_components/Tooltip.d.ts +1 -0
  189. package/dist/ui_components/TopToolbar.d.ts +1 -0
  190. package/dist/ui_components/UploadButton.d.ts +1 -0
  191. package/dist/util/Instructions.d.ts +1 -0
  192. package/package.json +20 -24
  193. package/rollup.config.js +61 -44
  194. package/src/@types/assets/index.d.ts +1 -1
  195. package/src/App.css +0 -55
  196. package/src/components/MapLibreMap/MapLibreMap.stories.js +36 -37
  197. package/src/components/MapLibreMap/MapLibreMap.tsx +23 -17
  198. package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +1 -1
  199. package/src/components/MlCenterPosition/MlCenterPosition.tsx +22 -29
  200. package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +6 -6
  201. package/src/components/MlFollowGps/MlFollowGps.stories.js +28 -10
  202. package/src/components/MlFollowGps/MlFollowGps.tsx +31 -50
  203. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +1 -1
  204. package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.ts +16 -10
  205. package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +4 -13
  206. package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +3 -1
  207. package/src/components/MlNavigationTools/MlNavigationTools.stories.js +4 -5
  208. package/src/components/MlNavigationTools/MlNavigationTools.tsx +30 -54
  209. package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +1 -1
  210. package/src/components/MlSketchTool/MlSketchTool.tsx +1 -1
  211. package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +7 -3
  212. package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +3 -11
  213. package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +2 -2
  214. package/src/components/MlWmsLoader/utils/WMSLinks.tsx +1 -1
  215. package/src/contexts/MapContext.tsx +8 -1
  216. package/src/custom.d.ts +4 -5
  217. package/src/decorators/EmptyMapDecorator.js +38 -0
  218. package/src/decorators/MapContextDecorator.js +10 -16
  219. package/src/decorators/MapContextDecoratorHooks.js +25 -30
  220. package/src/decorators/MultiMapContextDecorator.js +8 -18
  221. package/src/decorators/NoNavToolsDecorator.js +8 -15
  222. package/src/decorators/ThemeDecorator.js +24 -0
  223. package/src/decorators/style.css +0 -2
  224. package/src/hooks/useCameraFollowPath/useCameraFollowPath.stories.tsx +13 -19
  225. package/src/hooks/useExportMap/lib.ts +1 -1
  226. package/src/hooks/useGpx/useGpx.stories.js +1 -1
  227. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +1 -1
  228. package/src/hooks/useMapState.stories.js +1 -1
  229. package/src/hooks/useSources.stories.js +1 -1
  230. package/src/index.ts +9 -0
  231. package/src/ui_components/LayerList/LayerList.stories.tsx +136 -0
  232. package/src/ui_components/LayerList/LayerList.tsx +12 -0
  233. package/src/ui_components/LayerList/LayerListFolder.tsx +82 -0
  234. package/src/ui_components/LayerList/LayerListItem.tsx +180 -0
  235. package/src/ui_components/LayerList/assets/sample_1.json +26 -0
  236. package/src/ui_components/LayerList/assets/sample_2.json +22 -0
  237. package/src/ui_components/LayerList/assets/sample_polygon_1.json +33 -0
  238. package/src/ui_components/LayerList/assets/style.json +2599 -0
  239. package/src/ui_components/LayerList/util/LayerListItemVectorLayer.tsx +92 -0
  240. package/src/ui_components/LayerList/util/LayerPropertyForm.tsx +125 -0
  241. package/src/ui_components/LayerList/util/input/ColorPicker.tsx +44 -0
  242. package/src/ui_components/MapcomponentsTheme.tsx +133 -0
  243. package/src/ui_components/Sidebar.tsx +16 -11
  244. package/src/ui_components/TopToolbar.tsx +1 -3
  245. package/src/util/BubbleForInstructions.js +14 -12
  246. package/tsconfig.json +3 -10
  247. package/dist/components/MlGPXViewer/MlGPXViewer.d.ts +0 -29
  248. package/dist/components/MlGPXViewer/MlGPXViewer.stories.d.ts +0 -16
  249. package/dist/components/MlGPXViewer/MlGPXViewer.test.d.ts +0 -1
  250. package/dist/components/MlGPXViewer/gpxConverter.d.ts +0 -11
  251. package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +0 -10
  252. package/dist/components/MlGPXViewer/util/GeoJsonProvider.d.ts +0 -4
  253. package/dist/components/MlLayer/MlLayer.stories.d.ts +0 -10
  254. package/dist/custom.d.d.ts +0 -22
  255. package/dist/decorators/ThemeWrapper.d.ts +0 -1
  256. package/dist/hooks/exportMap/index.d.ts +0 -11
  257. package/dist/hooks/exportMap/lib.d.ts +0 -36
  258. package/dist/ui_components/Legend.d.ts +0 -1
  259. package/dist/ui_components/LoadingOverlay.d.ts +0 -2
@@ -0,0 +1,92 @@
1
+ import { ListItem, IconButton, ListItemIcon, Checkbox, ListItemText } from '@mui/material';
2
+ import React, { useEffect, useState } from 'react';
3
+ import LayerPropertyForm from './LayerPropertyForm';
4
+ import TuneIcon from '@mui/icons-material/Tune';
5
+ import { MlVectorTileLayerProps } from '../../../components/MlVectorTileLayer/MlVectorTileLayer';
6
+
7
+ type Props = {
8
+ id: string;
9
+ configurable?: boolean;
10
+ vtProps: MlVectorTileLayerProps;
11
+ setVtProps: ((state: unknown) => void) | undefined;
12
+ };
13
+
14
+ export default function LayerListItemVectorLayer({ configurable, vtProps, setVtProps, id }: Props) {
15
+ const [paintPropsFormVisible, setPaintPropsFormVisible] = useState(false);
16
+ const [visible, setVisible] = useState(true);
17
+ const [paintProps, setPaintProps] = useState(vtProps.layers[id].paint);
18
+
19
+ useEffect(() => {
20
+ if (!setVtProps) return;
21
+
22
+ const _layers = [...vtProps.layers];
23
+ if (!_layers[id].layout) {
24
+ _layers[id].layout = { visibility: visible ? 'visible' : 'none' };
25
+ } else {
26
+ _layers[id].layout.visibility = visible ? 'visible' : 'none';
27
+ }
28
+
29
+ setVtProps({ ...vtProps, layers: _layers });
30
+ }, [visible, id, setVtProps, vtProps]);
31
+
32
+ useEffect(() => {
33
+ if (!setVtProps) return;
34
+
35
+ const _paintProps = { ...paintProps };
36
+ const _layers = [...vtProps.layers];
37
+ _layers[id].paint = _paintProps;
38
+
39
+ setVtProps({ ...vtProps, layers: _layers });
40
+ }, [paintProps, id, setVtProps, vtProps]);
41
+
42
+ return (
43
+ <>
44
+ <ListItem
45
+ key={id}
46
+ sx={{
47
+ paddingRight: configurable ? '56px' : 0,
48
+ paddingLeft: 0,
49
+ paddingTop: 0,
50
+ paddingBottom: '4px',
51
+ }}
52
+ secondaryAction={
53
+ configurable ? (
54
+ <IconButton
55
+ edge="end"
56
+ aria-label="comments"
57
+ onClick={() => {
58
+ setPaintPropsFormVisible((current) => {
59
+ return !current;
60
+ });
61
+ }}
62
+ sx={{ padding: '4px', marginTop: '-3px' }}
63
+ >
64
+ <TuneIcon />
65
+ </IconButton>
66
+ ) : undefined
67
+ }
68
+ >
69
+ <ListItemIcon sx={{ minWidth: '30px' }}>
70
+ <Checkbox
71
+ checked={visible}
72
+ onClick={() => {
73
+ setVisible((val) => !val);
74
+ }}
75
+ />
76
+ </ListItemIcon>
77
+ <ListItemText primary={vtProps.layers[id].id} />
78
+ </ListItem>
79
+ {configurable && paintPropsFormVisible && (
80
+ <LayerPropertyForm
81
+ paintProps={paintProps}
82
+ setPaintProps={setPaintProps}
83
+ layerType={vtProps.layers[id].type}
84
+ />
85
+ )}
86
+ </>
87
+ );
88
+ }
89
+
90
+ LayerListItemVectorLayer.defaultProps = {
91
+ configurable: true,
92
+ };
@@ -0,0 +1,125 @@
1
+ import {
2
+ CircleLayerSpecification,
3
+ FillLayerSpecification,
4
+ LineLayerSpecification,
5
+ } from 'maplibre-gl';
6
+ import React, { useRef } from 'react';
7
+ import ColorPicker from './input/ColorPicker';
8
+ import { Box, ListItem, Paper, Slider, TextField, Typography } from '@mui/material';
9
+ import {useCallback} from 'react';
10
+
11
+ export type paintPropsType =
12
+ | CircleLayerSpecification['paint']
13
+ | FillLayerSpecification['paint']
14
+ | LineLayerSpecification['paint'];
15
+
16
+ type Props = {
17
+ paintProps: paintPropsType;
18
+ setPaintProps: (
19
+ paintProps: paintPropsType | ((current: paintPropsType) => paintPropsType)
20
+ ) => void;
21
+ layerType: string;
22
+ };
23
+
24
+ const mapPropKeyToFormInputType = {
25
+ 'fill-color': 'colorpicker',
26
+ 'line-color': 'colorpicker',
27
+ 'line-width': 'slider',
28
+ 'line-blur': 'slider',
29
+ };
30
+ const mapPropKeyToFormInputTypeKeys = Object.keys(mapPropKeyToFormInputType);
31
+
32
+ const inputPropsByPropKey = {
33
+ 'line-blur': {
34
+ step: 1,
35
+ min: 1,
36
+ max: 100,
37
+ },
38
+ 'line-width': {
39
+ step: 1,
40
+ min: 1,
41
+ max: 100,
42
+ },
43
+ };
44
+
45
+ export default function LayerPropertyForm({ paintProps = {}, setPaintProps }: Props) {
46
+ const key = useRef(Math.round(Math.random() * 10000000000));
47
+ //const onChange = (event) => {};
48
+
49
+ const getFormInputByType = useCallback((key: string) => {
50
+ if (mapPropKeyToFormInputTypeKeys.indexOf(key) !== -1) {
51
+ const label = (
52
+ <Typography id={key + '_label'} gutterBottom>
53
+ {key}
54
+ </Typography>
55
+ );
56
+ switch (mapPropKeyToFormInputType[key]) {
57
+ case 'slider':
58
+ return (
59
+ <>
60
+ {label}
61
+ <Slider
62
+ {...inputPropsByPropKey[key]}
63
+ inputProps={{ inputMode: 'decimal', pattern: '[0-9]*' }}
64
+ value={paintProps[key]}
65
+ onChange={(_ev: Event, value: number) => {
66
+ if (value) {
67
+ setPaintProps((current) => ({ ...current, [key]: value }));
68
+ }
69
+ }}
70
+ />
71
+ </>
72
+ );
73
+ break;
74
+ case 'numberfield':
75
+ return (
76
+ <>
77
+ {label}
78
+ <TextField
79
+ inputProps={{ inputMode: 'decimal', pattern: '[0-9]*' }}
80
+ value={paintProps[key]}
81
+ onChange={(ev: React.ChangeEvent<HTMLInputElement>) => {
82
+ if (ev?.target?.value) {
83
+ setPaintProps((current) => ({ ...current, [key]: parseInt(ev.target.value) }));
84
+ }
85
+ }}
86
+ />
87
+ </>
88
+ );
89
+ break;
90
+ case 'colorpicker':
91
+ return (
92
+ <>
93
+ {label}
94
+ <Box sx={{ '& > div': { width: 'initial !important' } }}>
95
+ <ColorPicker
96
+ key={key}
97
+ value={paintProps[key]}
98
+ propKey={key}
99
+ setPaintProps={setPaintProps}
100
+ />
101
+ </Box>
102
+ </>
103
+ );
104
+ break;
105
+ }
106
+ }
107
+ return null;
108
+ },[paintProps]);
109
+
110
+ return (
111
+ <>
112
+ <ListItem key={key + '_paintPropForm'}>
113
+ <Paper
114
+ sx={{
115
+ padding: '15px',
116
+ boxShadow: 'inset 0px 0px 10px rgb(50 50 50 / 10%)',
117
+ borderRadius: '5px',
118
+ }}
119
+ >
120
+ {Object.keys(paintProps).map((el: string) => getFormInputByType(el))}
121
+ </Paper>
122
+ </ListItem>
123
+ </>
124
+ );
125
+ }
@@ -0,0 +1,44 @@
1
+ import { ColorObject, ColorPicker, ColorValue } from 'mui-color';
2
+ import React from 'react'
3
+ import { paintPropsType } from '../LayerPropertyForm';
4
+
5
+ type Props = {
6
+ key: string;
7
+ value: string;
8
+ propKey: string;
9
+ setPaintProps: (
10
+ paintProps: paintPropsType | ((current: paintPropsType) => paintPropsType)
11
+ ) => void;
12
+ }
13
+
14
+ export default function PaintPropsColorPicker({propKey, value, setPaintProps}: Props) {
15
+
16
+ return (
17
+ <ColorPicker
18
+ value={value}
19
+ onChange={(value: (ColorObject & ColorValue)) => {
20
+ setPaintProps((current: paintPropsType): paintPropsType => {
21
+ if(!value?.rgb?.[0]){
22
+ return current;
23
+ }
24
+
25
+ const newProps = {
26
+ ...current,
27
+ [propKey]:
28
+ 'rgba(' +
29
+ value.rgb[0] +
30
+ ',' +
31
+ value.rgb[1] +
32
+ ',' +
33
+ value.rgb[2] +
34
+ ',' +
35
+ value.alpha +
36
+ ')',
37
+ };
38
+
39
+ return newProps;
40
+ });
41
+ }}
42
+ />
43
+ )
44
+ }
@@ -0,0 +1,133 @@
1
+ import { createTheme } from '@mui/material/styles';
2
+ import { Theme } from '@mui/system';
3
+
4
+ declare module '@mui/material/Button' {
5
+ interface ButtonPropsVariantOverrides {
6
+ navtools: true;
7
+ }
8
+ }
9
+
10
+ const lightDefault = createTheme({
11
+ palette: {
12
+ mode: 'light',
13
+ },
14
+ });
15
+ const darkDefault = createTheme({
16
+ palette: {
17
+ mode: 'dark',
18
+ },
19
+ });
20
+
21
+ const getDesignTokens = (mode: 'light' | 'dark') => ({
22
+ ...(mode === 'light' ? lightDefault : darkDefault),
23
+ palette: {
24
+ mode,
25
+ ...(mode === 'dark'
26
+ ? {
27
+ primary: {
28
+ main: '#009FE3',
29
+ },
30
+ background: {
31
+ default: '#121212',
32
+ paper: '#323232',
33
+ icon: '#525252',
34
+ },
35
+ text: {
36
+ secondary: '#fff',
37
+ contrast: '#121212',
38
+ },
39
+ }
40
+ : {
41
+ primary: {
42
+ main: '#009FE3',
43
+ },
44
+
45
+ background: {
46
+ default: '#fff',
47
+ paper: '#fdfdfd',
48
+ icon: '#bdbdbd',
49
+ },
50
+ text: {
51
+ primary: '#111',
52
+ secondary: '#121212',
53
+ contrast: '#fff',
54
+ },
55
+ }),
56
+ },
57
+ });
58
+ const getTheme = (mode: 'light' | 'dark') => {
59
+ const theme: Theme = getDesignTokens(mode);
60
+
61
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
62
+ // @ts-ignore
63
+ return createTheme(theme, {
64
+ components: {
65
+ MuiTypography: {
66
+ styleOverrides: {
67
+ root: {
68
+ },
69
+ },
70
+ },
71
+ MuiAppBar: {
72
+ styleOverrides: {
73
+ root: {
74
+ backgroundColor: theme.palette.background.default,
75
+ },
76
+ },
77
+ },
78
+ MuiIconButton: {
79
+ styleOverrides: {
80
+ root: {
81
+ color: theme.palette.text.primary,
82
+ backgroundColor: theme.palette.background.icon,
83
+ ':hover': {
84
+ backgroundColor: theme.palette.background.icon,
85
+ color: theme.palette.primary.main,
86
+ },
87
+ },
88
+ },
89
+ },
90
+ MuiButton: {
91
+ styleOverrides: {
92
+ backgroundColor: theme.palette.background.paper,
93
+ ':hover': {
94
+ backgroundColor: theme.palette.primary.main,
95
+ },
96
+ },
97
+ variants: [
98
+ {
99
+ props: { variant: 'navtools' },
100
+ style: {
101
+ minWidth: '20px',
102
+ minHeight: '20px',
103
+ fontWeight: 600,
104
+ [theme.breakpoints.down('md')]: {
105
+ width: '50px',
106
+ height: '50px',
107
+ fontSize: '1.4em',
108
+ },
109
+ [theme.breakpoints.up('md')]: {
110
+ width: '30px',
111
+ height: '30px',
112
+ fontSize: '1.2em',
113
+ },
114
+ backgroundColor: theme.palette.background.icon,
115
+ borderRadius: '23%',
116
+ //border: "1px solid #bbb",
117
+ //boxShadow: "0px 0px 4px rgba(0,0,0,.5)",
118
+ margin: '0.15px',
119
+ marginTop: '4px',
120
+ ':hover': {
121
+ color: theme.palette.primary.main,
122
+ backgroundColor: theme.palette.background.icon,
123
+ },
124
+ color: theme.palette.text.secondary,
125
+ },
126
+ },
127
+ ],
128
+ },
129
+ },
130
+ });
131
+ };
132
+
133
+ export default getTheme;
@@ -2,12 +2,10 @@ import React, { useState } from 'react';
2
2
  import { styled } from '@mui/material/styles';
3
3
  import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
4
4
  import MenuIcon from '@mui/icons-material/Menu';
5
- import { Drawer, IconButton, PaperProps, SxProps, DrawerProps} from '@mui/material';
5
+ import { Drawer, IconButton, PaperProps, SxProps, DrawerProps } from '@mui/material';
6
6
  import useMediaQuery from '@mui/material/useMediaQuery';
7
7
  import Box from '@mui/material/Box';
8
8
 
9
-
10
-
11
9
  const DrawerHeader = styled('div')(() => ({
12
10
  display: 'flex',
13
11
  alignItems: 'center',
@@ -20,7 +18,12 @@ interface SidebarProps {
20
18
  children?: React.ReactNode;
21
19
  }
22
20
 
23
- export default function Sidebar({ drawerPaperProps, drawerHeaderProps, drawerButtonStyle, ...props }: SidebarProps & DrawerProps) {
21
+ export default function Sidebar({
22
+ drawerPaperProps,
23
+ drawerHeaderProps,
24
+ drawerButtonStyle,
25
+ ...props
26
+ }: SidebarProps & DrawerProps) {
24
27
  const mediaIsMobile = useMediaQuery('(max-width:900px)');
25
28
 
26
29
  const [drawerOpen, setDrawerOpen] = useState(true);
@@ -39,9 +42,9 @@ export default function Sidebar({ drawerPaperProps, drawerHeaderProps, drawerBut
39
42
  sx={{
40
43
  zIndex: 101,
41
44
  position: 'relative',
42
- padding: '20px',
43
- ...drawerButtonStyle
44
- }}
45
+ margin: { lg: '20px', md: '20px', sm: '20px', xs: '10px' },
46
+ ...drawerButtonStyle,
47
+ }}
45
48
  >
46
49
  <MenuIcon />
47
50
  </IconButton>
@@ -51,21 +54,23 @@ export default function Sidebar({ drawerPaperProps, drawerHeaderProps, drawerBut
51
54
  anchor="left"
52
55
  open={drawerOpen}
53
56
  PaperProps={{
57
+ ...drawerPaperProps,
54
58
  sx: {
55
- maxWidth: '20%',
56
- padding: '40px'
59
+ maxWidth: { lg: '30%', md: '40%', sm: '50%', xs: '78%' },
60
+ padding: { lg: '20px', md: '20px', sm: '20px', xs: '10px' },
61
+ ...drawerPaperProps?.sx,
57
62
  },
58
- ...drawerPaperProps,
59
63
  }}
60
64
  sx={{
61
65
  flexGrow: 1,
62
66
  zIndex: 105,
63
67
  position: 'absolute',
64
68
  top: 0,
69
+ bottom: 0,
65
70
  backgroundColor: '#fafafa',
66
71
  display: 'flex',
67
72
  flexDirection: 'column',
68
- maxWidth: mediaIsMobile ? '90vw' : '20vw',
73
+ maxWidth: { lg: '30%', md: '40%', sm: '50%', xs: '78%' },
69
74
  ...(drawerOpen ? {} : { left: mediaIsMobile ? '-90vw' : '-20vw' }),
70
75
  }}
71
76
  {...props}
@@ -11,12 +11,10 @@ export default function TopToolbar({ toolbarProps, appBarStyle, ...props }: TopT
11
11
  <AppBar
12
12
  sx={{
13
13
  minHeight: '62px',
14
- backgroundColor: 'background.default',
15
14
  position: 'absolute',
16
15
  zIndex: 120,
17
- ...appBarStyle
16
+ ...appBarStyle,
18
17
  }}
19
- color="primary"
20
18
  position="static"
21
19
  {...props}
22
20
  >
@@ -1,37 +1,39 @@
1
1
  import React from 'react';
2
2
  import ReplyAllIcon from '@mui/icons-material/ReplyAll';
3
+ import { Box, Typography } from '@mui/material';
3
4
 
4
5
  function BubbleForInstruction(props) {
5
6
  return (
6
7
  <>
7
- <div
8
- style={{
8
+ <Box
9
+ sx={{
9
10
  width: '475px',
10
11
  height: '475px',
11
12
  position: 'fixed',
12
13
  display: 'block',
13
14
  borderRadius: '360px',
14
- backgroundColor: 'steelblue',
15
+ bgcolor: 'primary.main',
15
16
  right: props.bubbleRight,
16
17
  bottom: props.bubbleBottom,
17
18
  left: props.bubbleLeft,
18
19
  top: props.bubbleTop,
19
- zIndex: props.zIndex
20
+ zIndex: props.zIndex,
20
21
  }}
21
22
  >
22
- <h2
23
- style={{
23
+ <Typography
24
+ variant="h5"
25
+ sx={{
24
26
  marginTop: props.textMarginTop,
25
27
  marginLeft: props.textMarginLeft,
26
- color: 'white',
28
+ color: 'text.contrast',
27
29
  textAlign: 'left',
28
30
  }}
29
31
  >
30
- {props.children}
31
- </h2>
32
+ <b>{props.children}</b>
33
+ </Typography>
32
34
  <ReplyAllIcon
33
- style={{
34
- color: 'white',
35
+ sx={{
36
+ color: 'text.contrast',
35
37
  fontSize: '80px',
36
38
  position: 'absolute',
37
39
  transform: props.iconTransform,
@@ -39,7 +41,7 @@ function BubbleForInstruction(props) {
39
41
  marginLeft: props.iconMarginLeft,
40
42
  }}
41
43
  />
42
- </div>
44
+ </Box>
43
45
  </>
44
46
  );
45
47
  }
package/tsconfig.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "sourceMap": true,
10
10
  "strict": false,
11
11
  "types": ["node", "jest", "geojson", "cypress"],
12
- "typeRoots": ["./src/@types", "./node_modules/@types"],
12
+ "typeRoots": ["./src/@types", "./node_modules/@types"],
13
13
  "outDir": "build/esm",
14
14
  "module": "esnext",
15
15
  "target": "es5",
@@ -27,15 +27,8 @@
27
27
  "suppressImplicitAnyIndexErrors": true,
28
28
  "allowSyntheticDefaultImports": true,
29
29
  "allowJs": true,
30
- "baseUrl": ".",
31
- "paths": {
32
- "!maplibre-gl": ["node_modules/maplibre-gl"] // This mapping is relative to "baseUrl"
33
- }
30
+ "baseUrl": "."
34
31
  },
35
32
  "include": ["src", "src/custom.d.tsx"],
36
- "exclude": ["node_modules", "lib"],
37
- "typedocOptions": {
38
- "entryPoints": ["src/index.ts"],
39
- "out": "docs"
40
- }
33
+ "exclude": ["node_modules", "lib"]
41
34
  }
@@ -1,29 +0,0 @@
1
- interface MlGPXViewerProps {
2
- /**
3
- * Id of the target MapLibre instance in mapHook
4
- */
5
- mapId?: string;
6
- /**
7
- * The layerId of an existing layer this layer should be rendered visually beneath
8
- * https://maplibre.org/maplibre-gl-js-docs/api/map/#map#addlayer - see "beforeId" property
9
- */
10
- insertBeforeLayer?: string;
11
- /**
12
- * Prefix of the component id this component uses when adding elements to the MapLibreGl-instance
13
- */
14
- idPrefix?: string;
15
- /**
16
- * Sets the layers layout-property "visibility" to "none" if false or "visible" if true
17
- */
18
- visible?: boolean;
19
- }
20
- /**
21
- * MlGPXViewer returns a dropzone and a button to load a GPX Track into the map.
22
- */
23
- declare const MlGPXViewer: {
24
- (props: MlGPXViewerProps): JSX.Element;
25
- defaultProps: {
26
- visible: boolean;
27
- };
28
- };
29
- export default MlGPXViewer;
@@ -1,16 +0,0 @@
1
- export default storyoptions;
2
- export const ExampleConfig: any;
3
- declare namespace storyoptions {
4
- export const title: string;
5
- export { MlGPXViewer as component };
6
- export namespace argTypes {
7
- namespace options {
8
- namespace control {
9
- const type: string;
10
- }
11
- }
12
- }
13
- export { mapContextDecorator as decorators };
14
- }
15
- import MlGPXViewer from "./MlGPXViewer";
16
- import mapContextDecorator from "../../decorators/MapContextDecorator";
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- export default toGeoJSON;
2
- declare namespace toGeoJSON {
3
- function kml(doc: any): {
4
- type: string;
5
- features: never[];
6
- };
7
- function gpx(doc: any): {
8
- type: string;
9
- features: never[];
10
- };
11
- }
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import { FeatureCollection } from '@turf/turf';
3
- declare type ContextProps = {
4
- data: FeatureCollection;
5
- setData: Function;
6
- getEmptyFeatureCollection: Function;
7
- };
8
- declare const GeoJsonContext: React.Context<Partial<ContextProps>>;
9
- export declare const GeoJsonContextProvider: React.Provider<Partial<ContextProps>>;
10
- export default GeoJsonContext;
@@ -1,4 +0,0 @@
1
- declare const GeoJsonProvider: ({ children }: {
2
- children: JSX.Element;
3
- }) => JSX.Element;
4
- export default GeoJsonProvider;
@@ -1,10 +0,0 @@
1
- export default storyoptions;
2
- export const ExampleConfig: any;
3
- declare namespace storyoptions {
4
- export const title: string;
5
- export { MlLayer as component };
6
- export const argTypes: {};
7
- export { mapContextDecorator as decorators };
8
- }
9
- import MlLayer from "./MlLayer";
10
- import mapContextDecorator from "../../decorators/MapContextDecorator";
@@ -1,22 +0,0 @@
1
- declare module "*.svg" {
2
- const content: any;
3
- export default content;
4
- export { content as ReactComponent };
5
- }
6
- declare module "*.js" {
7
- const content: any;
8
- export default content;
9
- }
10
- declare type MapContextType = {
11
- mapIds: [string?];
12
- mapExists: Function;
13
- maps: [];
14
- map: any;
15
- getMap: Function;
16
- setMap: Function;
17
- };
18
- interface GeoJSON {
19
- type: string;
20
- features?: any;
21
- geometry?: any;
22
- }
@@ -1 +0,0 @@
1
- export default function ThemeWrapper(props: any): JSX.Element;