react-spatial 1.5.3 → 1.5.4

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 (294) hide show
  1. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +231 -0
  2. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +7 -0
  3. package/components/BaseLayerSwitcher/index.js +1 -0
  4. package/components/BaseLayerSwitcher/index.js.map +7 -0
  5. package/components/BasicMap/BasicMap.js +278 -0
  6. package/components/BasicMap/BasicMap.js.map +7 -0
  7. package/components/BasicMap/index.js +1 -0
  8. package/components/BasicMap/index.js.map +7 -0
  9. package/{src/components → components}/CanvasSaveButton/CanvasSaveButton.js +93 -320
  10. package/components/CanvasSaveButton/CanvasSaveButton.js.map +7 -0
  11. package/components/CanvasSaveButton/index.js +1 -0
  12. package/components/CanvasSaveButton/index.js.map +7 -0
  13. package/components/Copyright/Copyright.js +55 -0
  14. package/components/Copyright/Copyright.js.map +7 -0
  15. package/components/Copyright/index.js +1 -0
  16. package/components/Copyright/index.js.map +7 -0
  17. package/components/FeatureExportButton/FeatureExportButton.js +62 -0
  18. package/components/FeatureExportButton/FeatureExportButton.js.map +7 -0
  19. package/components/FeatureExportButton/index.js +1 -0
  20. package/components/FeatureExportButton/index.js.map +7 -0
  21. package/components/FitExtent/FitExtent.js +32 -0
  22. package/components/FitExtent/FitExtent.js.map +7 -0
  23. package/components/FitExtent/index.js +1 -0
  24. package/components/FitExtent/index.js.map +7 -0
  25. package/{src/components → components}/Geolocation/Geolocation.js +61 -144
  26. package/components/Geolocation/Geolocation.js.map +7 -0
  27. package/components/Geolocation/index.js +1 -0
  28. package/components/Geolocation/index.js.map +7 -0
  29. package/components/LayerTree/LayerTree.js +278 -0
  30. package/components/LayerTree/LayerTree.js.map +7 -0
  31. package/components/LayerTree/index.js +1 -0
  32. package/components/LayerTree/index.js.map +7 -0
  33. package/components/MousePosition/MousePosition.js +110 -0
  34. package/components/MousePosition/MousePosition.js.map +7 -0
  35. package/components/MousePosition/index.js +1 -0
  36. package/components/MousePosition/index.js.map +7 -0
  37. package/components/NorthArrow/NorthArrow.js +43 -0
  38. package/components/NorthArrow/NorthArrow.js.map +7 -0
  39. package/components/NorthArrow/index.js +1 -0
  40. package/components/NorthArrow/index.js.map +7 -0
  41. package/components/Overlay/Overlay.js +122 -0
  42. package/components/Overlay/Overlay.js.map +7 -0
  43. package/components/Overlay/index.js +1 -0
  44. package/components/Overlay/index.js.map +7 -0
  45. package/components/Permalink/Permalink.js +206 -0
  46. package/components/Permalink/Permalink.js.map +7 -0
  47. package/components/Permalink/index.js +1 -0
  48. package/components/Permalink/index.js.map +7 -0
  49. package/{src/components → components}/Popup/Popup.js +55 -165
  50. package/components/Popup/Popup.js.map +7 -0
  51. package/components/Popup/index.js +1 -0
  52. package/components/Popup/index.js.map +7 -0
  53. package/{src/components → components}/ResizeHandler/ResizeHandler.js +15 -50
  54. package/components/ResizeHandler/ResizeHandler.js.map +7 -0
  55. package/components/ResizeHandler/index.js +1 -0
  56. package/components/ResizeHandler/index.js.map +7 -0
  57. package/components/RouteSchedule/RouteSchedule.js +223 -0
  58. package/components/RouteSchedule/RouteSchedule.js.map +7 -0
  59. package/components/RouteSchedule/index.js +1 -0
  60. package/components/RouteSchedule/index.js.map +7 -0
  61. package/components/ScaleLine/ScaleLine.js +32 -0
  62. package/components/ScaleLine/ScaleLine.js.map +7 -0
  63. package/components/ScaleLine/index.js +1 -0
  64. package/components/ScaleLine/index.js.map +7 -0
  65. package/components/StopsFinder/StopsFinder.js +210 -0
  66. package/components/StopsFinder/StopsFinder.js.map +7 -0
  67. package/components/StopsFinder/StopsFinderOption.js +51 -0
  68. package/components/StopsFinder/StopsFinderOption.js.map +7 -0
  69. package/components/StopsFinder/index.js +1 -0
  70. package/components/StopsFinder/index.js.map +7 -0
  71. package/components/Zoom/Zoom.js +130 -0
  72. package/components/Zoom/Zoom.js.map +7 -0
  73. package/components/Zoom/index.js +1 -0
  74. package/components/Zoom/index.js.map +7 -0
  75. package/package.json +1 -1
  76. package/{src/propTypes.js → propTypes.js} +12 -16
  77. package/propTypes.js.map +7 -0
  78. package/{src/setupTests.js → setupTests.js} +1 -1
  79. package/setupTests.js.map +7 -0
  80. package/utils/GlobalsForOle.js +94 -0
  81. package/utils/GlobalsForOle.js.map +7 -0
  82. package/utils/KML.js +412 -0
  83. package/utils/KML.js.map +7 -0
  84. package/utils/KMLFormat.js +69 -0
  85. package/utils/KMLFormat.js.map +7 -0
  86. package/{src/utils → utils}/Styles.js +14 -20
  87. package/utils/Styles.js.map +7 -0
  88. package/{src/utils → utils}/getPolygonPattern.js +6 -34
  89. package/utils/getPolygonPattern.js.map +7 -0
  90. package/{src/utils → utils}/timeUtils.js +5 -22
  91. package/utils/timeUtils.js.map +7 -0
  92. package/.github/workflows/conventional-pr-title.yml +0 -21
  93. package/.github/workflows/main.yml +0 -28
  94. package/.husky/commit-msg +0 -4
  95. package/.husky/post-checkout +0 -4
  96. package/.husky/post-merge +0 -4
  97. package/.husky/post-rebase +0 -4
  98. package/.husky/pre-commit +0 -4
  99. package/.nvmrc +0 -1
  100. package/.whitesource +0 -8
  101. package/CHANGELOG.md +0 -65
  102. package/DEVELOP.md +0 -113
  103. package/__mocks__/mapbox-gl.js +0 -11
  104. package/__mocks__/resize-observer-polyfill.js +0 -9
  105. package/babel.config.js +0 -3
  106. package/commitlint.config.js +0 -1
  107. package/data/topic1.js +0 -119
  108. package/data/topic2.js +0 -28
  109. package/doc/README.md +0 -21
  110. package/doc/doc-config.json +0 -4
  111. package/pull_request_template.md +0 -16
  112. package/renovate.json +0 -4
  113. package/scripts/read-pkg-json.js +0 -17
  114. package/src/components/BaseLayerSwitcher/BaseLayerSwitcher.js +0 -322
  115. package/src/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js +0 -69
  116. package/src/components/BaseLayerSwitcher/README.md +0 -61
  117. package/src/components/BaseLayerSwitcher/__snapshots__/BaseLayerSwitcher.test.js.snap +0 -88
  118. package/src/components/BaseLayerSwitcher/index.js +0 -1
  119. package/src/components/BasicMap/BasicMap.js +0 -413
  120. package/src/components/BasicMap/BasicMap.test.js +0 -281
  121. package/src/components/BasicMap/README.md +0 -18
  122. package/src/components/BasicMap/index.js +0 -1
  123. package/src/components/CanvasSaveButton/CanvasSaveButton.test.js +0 -148
  124. package/src/components/CanvasSaveButton/README.md +0 -76
  125. package/src/components/CanvasSaveButton/__snapshots__/CanvasSaveButton.test.js.snap +0 -76
  126. package/src/components/CanvasSaveButton/index.js +0 -1
  127. package/src/components/Copyright/Copyright.js +0 -89
  128. package/src/components/Copyright/Copyright.test.js +0 -134
  129. package/src/components/Copyright/README.md +0 -36
  130. package/src/components/Copyright/index.js +0 -1
  131. package/src/components/FeatureExportButton/FeatureExportButton.js +0 -118
  132. package/src/components/FeatureExportButton/FeatureExportButton.test.js +0 -417
  133. package/src/components/FeatureExportButton/README.md +0 -76
  134. package/src/components/FeatureExportButton/__snapshots__/FeatureExportButton.test.js.snap +0 -67
  135. package/src/components/FeatureExportButton/index.js +0 -1
  136. package/src/components/FitExtent/FitExtent.js +0 -62
  137. package/src/components/FitExtent/FitExtent.test.js +0 -48
  138. package/src/components/FitExtent/README.md +0 -34
  139. package/src/components/FitExtent/__snapshots__/FitExtent.test.js.snap +0 -13
  140. package/src/components/FitExtent/index.js +0 -1
  141. package/src/components/Geolocation/Geolocation.test.js +0 -267
  142. package/src/components/Geolocation/README.md +0 -25
  143. package/src/components/Geolocation/__snapshots__/Geolocation.test.js.snap +0 -92
  144. package/src/components/Geolocation/index.js +0 -1
  145. package/src/components/LayerTree/LayerTree.js +0 -487
  146. package/src/components/LayerTree/LayerTree.test.js +0 -337
  147. package/src/components/LayerTree/README.md +0 -92
  148. package/src/components/LayerTree/__snapshots__/LayerTree.test.js.snap +0 -1746
  149. package/src/components/LayerTree/index.js +0 -1
  150. package/src/components/MousePosition/MousePosition.js +0 -175
  151. package/src/components/MousePosition/MousePosition.test.js +0 -132
  152. package/src/components/MousePosition/README.md +0 -50
  153. package/src/components/MousePosition/__snapshots__/MousePosition.test.js.snap +0 -76
  154. package/src/components/MousePosition/index.js +0 -1
  155. package/src/components/NorthArrow/NorthArrow.js +0 -75
  156. package/src/components/NorthArrow/NorthArrow.test.js +0 -104
  157. package/src/components/NorthArrow/README.md +0 -59
  158. package/src/components/NorthArrow/__snapshots__/NorthArrow.test.js.snap +0 -117
  159. package/src/components/NorthArrow/index.js +0 -1
  160. package/src/components/Overlay/Overlay.js +0 -176
  161. package/src/components/Overlay/Overlay.test.js +0 -149
  162. package/src/components/Overlay/README.md +0 -59
  163. package/src/components/Overlay/__snapshots__/Overlay.test.js.snap +0 -9
  164. package/src/components/Overlay/index.js +0 -1
  165. package/src/components/Permalink/Permalink.js +0 -326
  166. package/src/components/Permalink/Permalink.test.js +0 -285
  167. package/src/components/Permalink/README.md +0 -105
  168. package/src/components/Permalink/index.js +0 -1
  169. package/src/components/Popup/Popup.test.js +0 -307
  170. package/src/components/Popup/README.md +0 -93
  171. package/src/components/Popup/__snapshots__/Popup.test.js.snap +0 -180
  172. package/src/components/Popup/index.js +0 -1
  173. package/src/components/README.md +0 -41
  174. package/src/components/ResizeHandler/ResizeHandler.test.js +0 -344
  175. package/src/components/ResizeHandler/index.js +0 -1
  176. package/src/components/RouteSchedule/README.md +0 -118
  177. package/src/components/RouteSchedule/RouteSchedule.js +0 -370
  178. package/src/components/RouteSchedule/RouteSchedule.test.js +0 -113
  179. package/src/components/RouteSchedule/__snapshots__/RouteSchedule.test.js.snap +0 -248
  180. package/src/components/RouteSchedule/index.js +0 -1
  181. package/src/components/ScaleLine/README.md +0 -29
  182. package/src/components/ScaleLine/ScaleLine.js +0 -50
  183. package/src/components/ScaleLine/ScaleLine.test.js +0 -30
  184. package/src/components/ScaleLine/__snapshots__/ScaleLine.test.js.snap +0 -7
  185. package/src/components/ScaleLine/index.js +0 -1
  186. package/src/components/StopsFinder/README.md +0 -50
  187. package/src/components/StopsFinder/StopsFinder.js +0 -284
  188. package/src/components/StopsFinder/StopsFinder.test.js +0 -17
  189. package/src/components/StopsFinder/StopsFinderOption.js +0 -61
  190. package/src/components/StopsFinder/__snapshots__/StopsFinder.test.js.snap +0 -133
  191. package/src/components/StopsFinder/index.js +0 -1
  192. package/src/components/Zoom/README.md +0 -25
  193. package/src/components/Zoom/Zoom.js +0 -180
  194. package/src/components/Zoom/Zoom.test.js +0 -141
  195. package/src/components/Zoom/__snapshots__/Zoom.test.js.snap +0 -201
  196. package/src/components/Zoom/index.js +0 -1
  197. package/src/styleguidist/ComponentsList.js +0 -52
  198. package/src/styleguidist/StyleGuide.js +0 -277
  199. package/src/styleguidist/styleguidist.css +0 -38
  200. package/src/utils/GlobalsForOle.js +0 -99
  201. package/src/utils/KML.js +0 -594
  202. package/src/utils/KML.test.js +0 -337
  203. package/src/utils/KMLFormat.js +0 -100
  204. package/src/utils/KMLFormat.test.js +0 -50
  205. package/src/utils/__snapshots__/KML.test.js.snap.KML-readFeatures()-and-writeFeatures()-should-read-and-write-lineDash-and-fillPattern-style-for-polygon.canvas-image.png +0 -0
  206. package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-2-(cross)-color-and-(light-blue)-opacity.canvas-image.png +0 -0
  207. package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-3-(diagonal-line-from-bottom-left-tot-top-right)-with-color-(light-blue)-and-opacity.canvas-image.png +0 -0
  208. package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-4-(diagonal-line-from-top-left-to-bottom-right)-with-color-(light-blue)-and-opacity.canvas-image.png +0 -0
  209. package/src/utils/getPolygonPattern.test.js +0 -61
  210. package/src/utils/timeUtils.test.js +0 -30
  211. package/styleguide.config.js +0 -251
  212. /package/{src/components → components}/BaseLayerSwitcher/BaseLayerSwitcher.md.scss +0 -0
  213. /package/{src/components → components}/BaseLayerSwitcher/BaseLayerSwitcher.scss +0 -0
  214. /package/{src/components → components}/BasicMap/BasicMap.md.scss +0 -0
  215. /package/{src/components → components}/CanvasSaveButton/CanvasSaveButton.md.scss +0 -0
  216. /package/{src/components → components}/Copyright/Copyright.md.scss +0 -0
  217. /package/{src/components → components}/FeatureExportButton/FeatureExportButton.md.scss +0 -0
  218. /package/{src/components → components}/FitExtent/FitExtent.md.scss +0 -0
  219. /package/{src/components → components}/Geolocation/Geolocation.md.scss +0 -0
  220. /package/{src/components → components}/Geolocation/Geolocation.scss +0 -0
  221. /package/{src/components → components}/LayerTree/LayerTree.md.scss +0 -0
  222. /package/{src/components → components}/LayerTree/LayerTree.scss +0 -0
  223. /package/{src/components → components}/MousePosition/MousePosition.md.scss +0 -0
  224. /package/{src/components → components}/NorthArrow/NorthArrow.scss +0 -0
  225. /package/{src/components → components}/Overlay/Overlay.md.scss +0 -0
  226. /package/{src/components → components}/Overlay/Overlay.scss +0 -0
  227. /package/{src/components → components}/Permalink/Permalink.md.scss +0 -0
  228. /package/{src/components → components}/Popup/Popup.md.scss +0 -0
  229. /package/{src/components → components}/Popup/Popup.scss +0 -0
  230. /package/{src/components → components}/RouteSchedule/RouteSchedule.md.scss +0 -0
  231. /package/{src/components → components}/RouteSchedule/RouteSchedule.scss +0 -0
  232. /package/{src/components → components}/ScaleLine/ScaleLine.scss +0 -0
  233. /package/{src/components → components}/Zoom/Zoom.md.scss +0 -0
  234. /package/{src/components → components}/Zoom/Zoom.scss +0 -0
  235. /package/{src/images → images}/RouteSchedule/firstStation.png +0 -0
  236. /package/{src/images → images}/RouteSchedule/lastStation.png +0 -0
  237. /package/{src/images → images}/RouteSchedule/line.png +0 -0
  238. /package/{src/images → images}/RouteSchedule/station.png +0 -0
  239. /package/{src/images → images}/baselayer/baselayer.basebright.png +0 -0
  240. /package/{src/images → images}/baselayer/baselayer.osm.png +0 -0
  241. /package/{src/images → images}/baselayer/baselayer.travic.png +0 -0
  242. /package/{src/images → images}/baselayer/open.topo.map.png +0 -0
  243. /package/{src/images → images}/baselayer/osm.baselayer.hot.png +0 -0
  244. /package/{src/images → images}/baselayer/osm.baselayer.png +0 -0
  245. /package/{src/images → images}/favicon.png +0 -0
  246. /package/{src/images → images}/geops_logo.png +0 -0
  247. /package/{src/images → images}/geops_logo.svg +0 -0
  248. /package/{src/images → images}/geops_qr.png +0 -0
  249. /package/{src/images → images}/mots/bus_poi-blue-01.svg +0 -0
  250. /package/{src/images → images}/mots/bus_poi-grey-01.svg +0 -0
  251. /package/{src/images → images}/mots/bus_round-blue-01.svg +0 -0
  252. /package/{src/images → images}/mots/bus_round-grey-01.svg +0 -0
  253. /package/{src/images → images}/mots/bus_square-blue-01.svg +0 -0
  254. /package/{src/images → images}/mots/bus_square-grey-01.svg +0 -0
  255. /package/{src/images → images}/mots/cable_car_poi-blue-01.svg +0 -0
  256. /package/{src/images → images}/mots/cable_car_poi-grey-01.svg +0 -0
  257. /package/{src/images → images}/mots/cable_car_round-blue-01.svg +0 -0
  258. /package/{src/images → images}/mots/cable_car_round-grey-01.svg +0 -0
  259. /package/{src/images → images}/mots/cable_car_square-blue-01.svg +0 -0
  260. /package/{src/images → images}/mots/cable_car_square-grey-01.svg +0 -0
  261. /package/{src/images → images}/mots/ferry_poi-blue-01.svg +0 -0
  262. /package/{src/images → images}/mots/ferry_poi-grey-01.svg +0 -0
  263. /package/{src/images → images}/mots/ferry_round-blue-01.svg +0 -0
  264. /package/{src/images → images}/mots/ferry_round-grey-01.svg +0 -0
  265. /package/{src/images → images}/mots/ferry_square-blue-01.svg +0 -0
  266. /package/{src/images → images}/mots/ferry_square-grey-01.svg +0 -0
  267. /package/{src/images → images}/mots/funicular_round-blue-01.svg +0 -0
  268. /package/{src/images → images}/mots/funicular_round-grey-01.svg +0 -0
  269. /package/{src/images → images}/mots/funicular_square-blue-01.svg +0 -0
  270. /package/{src/images → images}/mots/gondola_round-blue-01.svg +0 -0
  271. /package/{src/images → images}/mots/rail_poi-blue-01.svg +0 -0
  272. /package/{src/images → images}/mots/rail_poi-grey-01.svg +0 -0
  273. /package/{src/images → images}/mots/rail_round-blue-01.svg +0 -0
  274. /package/{src/images → images}/mots/rail_round-grey-01.svg +0 -0
  275. /package/{src/images → images}/mots/rail_square-blue-01.svg +0 -0
  276. /package/{src/images → images}/mots/rail_square-grey-01.svg +0 -0
  277. /package/{src/images → images}/mots/subway_round blue-01.svg +0 -0
  278. /package/{src/images → images}/mots/subway_round-blue-01.svg +0 -0
  279. /package/{src/images → images}/mots/tram_poi-blue-01.svg +0 -0
  280. /package/{src/images → images}/mots/tram_poi-grey-01.svg +0 -0
  281. /package/{src/images → images}/mots/tram_round-blue-01.svg +0 -0
  282. /package/{src/images → images}/mots/tram_round-grey-01.svg +0 -0
  283. /package/{src/images → images}/mots/tram_square-blue-01.svg +0 -0
  284. /package/{src/images → images}/mots/tram_square-grey-01.svg +0 -0
  285. /package/{src/images → images}/northArrow.svg +0 -0
  286. /package/{src/images → images}/northArrow.url.svg +0 -0
  287. /package/{src/images → images}/northArrowCircle.svg +0 -0
  288. /package/{src/images → images}/northArrowCircle.url.svg +0 -0
  289. /package/{src/themes → themes}/README.md +0 -0
  290. /package/{src/themes → themes}/default/components.scss +0 -0
  291. /package/{src/themes → themes}/default/examples.scss +0 -0
  292. /package/{src/themes → themes}/default/index.scss +0 -0
  293. /package/{src/themes → themes}/default/mixins.scss +0 -0
  294. /package/{src/themes → themes}/default/variables.scss +0 -0
@@ -0,0 +1,223 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import {
4
+ RealtimeLayer as TrackerLayer,
5
+ realtimeConfig
6
+ } from "mobility-toolbox-js/ol";
7
+ import { getHoursAndMinutes, getDelayString } from "../../utils/timeUtils";
8
+ import ReactTransitPropTypes from "../../propTypes";
9
+ import firstStation from "../../images/RouteSchedule/firstStation.png";
10
+ import station from "../../images/RouteSchedule/station.png";
11
+ import lastStation from "../../images/RouteSchedule/lastStation.png";
12
+ import line from "../../images/RouteSchedule/line.png";
13
+ const { getBgColor } = realtimeConfig;
14
+ const getDelayColor = (time) => {
15
+ const secs = Math.round(time / 1800 / 2 * 3600 / 1e3);
16
+ if (secs >= 3600) {
17
+ return "dark-red";
18
+ }
19
+ if (secs >= 500) {
20
+ return "middle-red";
21
+ }
22
+ if (secs >= 300) {
23
+ return "light-red";
24
+ }
25
+ if (secs >= 180) {
26
+ return "orange";
27
+ }
28
+ return "green";
29
+ };
30
+ const isNotStop = (stop) => {
31
+ return !stop.arrivalTime && !stop.departureTime;
32
+ };
33
+ const isPassed = (stop, time, stops, idx) => {
34
+ if (isNotStop(stop)) {
35
+ if (stops[idx - 1] && idx > 0) {
36
+ return isPassed(stops[idx - 1], time, stops, idx);
37
+ }
38
+ return true;
39
+ }
40
+ const timeToCompare = stop.aimedDepartureTime || stop.aimedArrivalTime || 0;
41
+ let delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;
42
+ if (delayToCompare < 0) {
43
+ delayToCompare = 0;
44
+ }
45
+ return timeToCompare + delayToCompare <= time;
46
+ };
47
+ const defaultRenderStationImg = (stations, index, isStationPassed, isNotStation) => {
48
+ const { length } = stations;
49
+ let src = station.src || station;
50
+ if (index === 0) {
51
+ src = firstStation.src || firstStation;
52
+ } else if (index === length - 1) {
53
+ src = lastStation.src || lastStation;
54
+ } else if (isNotStation) {
55
+ src = line.src || line;
56
+ }
57
+ return /* @__PURE__ */ React.createElement("img", {
58
+ src,
59
+ alt: "routeScheduleLine",
60
+ className: "rt-route-icon"
61
+ });
62
+ };
63
+ const defaultRenderStation = ({
64
+ lineInfos,
65
+ onStationClick,
66
+ trackerLayer,
67
+ renderStationImg,
68
+ stop,
69
+ idx
70
+ }) => {
71
+ const {
72
+ stationId,
73
+ arrivalDelay,
74
+ departureDelay,
75
+ arrivalTime,
76
+ departureTime,
77
+ state,
78
+ stationName,
79
+ aimedArrivalTime,
80
+ aimedDepartureTime
81
+ } = stop;
82
+ const cancelled = state === "JOURNEY_CANCELLED" || state === "STOP_CANCELLED";
83
+ const { stations } = lineInfos;
84
+ const isFirstStation = idx === 0;
85
+ const isLastStation = idx === stations.length - 1;
86
+ const isStationPassed = isPassed(stop, trackerLayer.time, stations, idx);
87
+ const isNotStation = isNotStop(stop);
88
+ return /* @__PURE__ */ React.createElement("div", {
89
+ key: (stationId || stationName) + arrivalTime + departureTime,
90
+ role: "button",
91
+ className: [
92
+ "rt-route-station",
93
+ isStationPassed ? " rt-passed" : "",
94
+ isNotStation ? " rt-no-stop" : ""
95
+ ].join(""),
96
+ onClick: (e) => {
97
+ return onStationClick(stop, e);
98
+ },
99
+ tabIndex: 0,
100
+ onKeyPress: (e) => {
101
+ return e.which === 13 && onStationClick(stop, e);
102
+ }
103
+ }, /* @__PURE__ */ React.createElement("div", {
104
+ className: "rt-route-delay"
105
+ }, typeof arrivalDelay === "undefined" || isFirstStation || cancelled ? "" : /* @__PURE__ */ React.createElement("span", {
106
+ className: `rt-route-delay-arrival${` ${getDelayColor(
107
+ arrivalDelay
108
+ )}`}`
109
+ }, `+${getDelayString(arrivalDelay)}`), typeof departureDelay === "undefined" || isLastStation || cancelled ? "" : /* @__PURE__ */ React.createElement("span", {
110
+ className: `rt-route-delay-departure${` ${getDelayColor(
111
+ departureDelay
112
+ )}`}`
113
+ }, `+${getDelayString(departureDelay)}`)), /* @__PURE__ */ React.createElement("div", {
114
+ className: "rt-route-times"
115
+ }, /* @__PURE__ */ React.createElement("span", {
116
+ className: `rt-route-time-arrival ${cancelled ? "rt-route-cancelled" : ""}`
117
+ }, getHoursAndMinutes(aimedArrivalTime)), /* @__PURE__ */ React.createElement("span", {
118
+ className: `rt-route-time-departure ${cancelled ? "rt-route-cancelled" : ""}`
119
+ }, getHoursAndMinutes(aimedDepartureTime))), renderStationImg(stations, idx, isStationPassed, isNotStation), /* @__PURE__ */ React.createElement("div", {
120
+ className: cancelled ? "rt-route-cancelled" : ""
121
+ }, stationName));
122
+ };
123
+ const renderRouteIdentifier = ({ routeIdentifier, longName }) => {
124
+ if (routeIdentifier) {
125
+ const id = parseInt(routeIdentifier.split(".")[0], 10);
126
+ if (!longName.includes(id)) {
127
+ return ` (${id})`;
128
+ }
129
+ }
130
+ return null;
131
+ };
132
+ const defaultRenderHeader = ({ lineInfos, renderHeaderButtons }) => {
133
+ const {
134
+ type,
135
+ vehicleType,
136
+ shortName,
137
+ longName,
138
+ stroke,
139
+ destination,
140
+ routeIdentifier,
141
+ text_color: textColor
142
+ } = lineInfos;
143
+ return /* @__PURE__ */ React.createElement("div", {
144
+ className: "rt-route-header"
145
+ }, /* @__PURE__ */ React.createElement("span", {
146
+ className: "rt-route-icon",
147
+ style: {
148
+ backgroundColor: stroke || getBgColor(type || vehicleType),
149
+ color: textColor || "black"
150
+ }
151
+ }, shortName), /* @__PURE__ */ React.createElement("div", {
152
+ className: "rt-route-title"
153
+ }, /* @__PURE__ */ React.createElement("span", {
154
+ className: "rt-route-name"
155
+ }, destination), /* @__PURE__ */ React.createElement("span", null, longName, renderRouteIdentifier(lineInfos))), /* @__PURE__ */ React.createElement("div", {
156
+ className: "rt-route-buttons"
157
+ }, renderHeaderButtons(routeIdentifier)));
158
+ };
159
+ const defaultRenderFooter = (props) => {
160
+ const { lineInfos, renderCopyright } = props;
161
+ if (!lineInfos.operator && !lineInfos.publisher) {
162
+ return null;
163
+ }
164
+ return /* @__PURE__ */ React.createElement("div", {
165
+ className: "rt-route-footer"
166
+ }, renderCopyright({ ...props }));
167
+ };
168
+ const defaultRenderLink = (text, url) => {
169
+ return /* @__PURE__ */ React.createElement("div", {
170
+ className: "rt-route-copyright-link"
171
+ }, url ? /* @__PURE__ */ React.createElement("a", {
172
+ href: url,
173
+ target: "_blank",
174
+ rel: "noreferrer"
175
+ }, text) : /* @__PURE__ */ React.createElement(React.Fragment, null, text));
176
+ };
177
+ const defaultRenderCopyright = ({ lineInfos }) => {
178
+ return /* @__PURE__ */ React.createElement("span", {
179
+ className: "rt-route-copyright"
180
+ }, lineInfos.operator && defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl), lineInfos.operator && lineInfos.publisher && /* @__PURE__ */ React.createElement("span", null, "\xA0-\xA0"), lineInfos.publisher && defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl), lineInfos.license && /* @__PURE__ */ React.createElement("span", null, "\xA0("), lineInfos.license && defaultRenderLink(lineInfos.license, lineInfos.licenseUrl), lineInfos.license && ")");
181
+ };
182
+ const propTypes = {
183
+ className: PropTypes.string,
184
+ lineInfos: ReactTransitPropTypes.lineInfos,
185
+ trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,
186
+ renderHeader: PropTypes.func,
187
+ renderFooter: PropTypes.func,
188
+ renderCopyright: PropTypes.func,
189
+ renderStationImg: PropTypes.func,
190
+ renderStation: PropTypes.func,
191
+ onStationClick: PropTypes.func,
192
+ renderHeaderButtons: PropTypes.func
193
+ };
194
+ const defaultProps = {
195
+ className: "rt-route-schedule",
196
+ lineInfos: null,
197
+ renderHeader: defaultRenderHeader,
198
+ renderStation: defaultRenderStation,
199
+ renderStationImg: defaultRenderStationImg,
200
+ renderCopyright: defaultRenderCopyright,
201
+ renderFooter: defaultRenderFooter,
202
+ renderHeaderButtons: () => {
203
+ return null;
204
+ },
205
+ onStationClick: () => {
206
+ }
207
+ };
208
+ function RouteSchedule(props) {
209
+ const { lineInfos, className, renderStation, renderHeader, renderFooter } = props;
210
+ if (!lineInfos) {
211
+ return null;
212
+ }
213
+ return /* @__PURE__ */ React.createElement("div", {
214
+ className
215
+ }, renderHeader({ ...props }), /* @__PURE__ */ React.createElement("div", {
216
+ className: "rt-route-body"
217
+ }, lineInfos.stations.map((stop, idx) => {
218
+ return renderStation({ ...props, stop, idx });
219
+ })), renderFooter({ ...props }));
220
+ }
221
+ RouteSchedule.propTypes = propTypes;
222
+ RouteSchedule.defaultProps = defaultProps;
223
+ export default React.memo(RouteSchedule);
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/RouteSchedule/RouteSchedule.js"],
4
+ "sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable react/prop-types */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n RealtimeLayer as TrackerLayer,\n realtimeConfig,\n} from 'mobility-toolbox-js/ol';\nimport { getHoursAndMinutes, getDelayString } from '../../utils/timeUtils';\nimport ReactTransitPropTypes from '../../propTypes';\nimport firstStation from '../../images/RouteSchedule/firstStation.png';\nimport station from '../../images/RouteSchedule/station.png';\nimport lastStation from '../../images/RouteSchedule/lastStation.png';\nimport line from '../../images/RouteSchedule/line.png';\n\nconst { getBgColor } = realtimeConfig;\n\n/**\n * Returns a color class to display the delay.\n * @param {Number} time Delay time in milliseconds.\n */\nconst getDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return 'dark-red';\n }\n if (secs >= 500) {\n return 'middle-red';\n }\n if (secs >= 300) {\n return 'light-red';\n }\n if (secs >= 180) {\n return 'orange';\n }\n return 'green';\n};\n\n/**\n * Returns true if the train doesn't stop to the station.\n * @param {Object} stop Station information.\n */\nconst isNotStop = (stop) => {\n return !stop.arrivalTime && !stop.departureTime;\n};\n\n/**\n * Returns if the station has already been passed by the vehicule.\n * @param {Object} stop Station information.\n * @param {number} time The current time to test in ms.\n * @param {Array<Object>} stops the list of all stops of the train.\n * @param {idx} idx The index of the stop object in the stops array.\n */\nconst isPassed = (stop, time, stops, idx) => {\n // If the train doesn't stop to the stop object, we test if the stop just before has been passed or not.\n // if yes the current stop is considered as passed.\n if (isNotStop(stop)) {\n if (stops[idx - 1] && idx > 0) {\n return isPassed(stops[idx - 1], time, stops, idx);\n }\n return true;\n }\n\n // Sometimes stop.departureDelay is undefined.\n const timeToCompare = stop.aimedDepartureTime || stop.aimedArrivalTime || 0;\n let delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n\n // It could happens that the delay is negative we simply ignores it.\n if (delayToCompare < 0) {\n delayToCompare = 0;\n }\n\n return timeToCompare + delayToCompare <= time;\n};\n\n/**\n * Returns an image for first, middle or last stations.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} isStationPassed If the train is already passed at this station.\n * @param {Boolean} isNotStation If the train doesn't stop to this station.\n */\nconst defaultRenderStationImg = (\n stations,\n index,\n isStationPassed,\n isNotStation,\n) => {\n const { length } = stations;\n let src = station.src || station;\n if (index === 0) {\n src = firstStation.src || firstStation;\n } else if (index === length - 1) {\n src = lastStation.src || lastStation;\n } else if (isNotStation) {\n src = line.src || line;\n }\n return <img src={src} alt=\"routeScheduleLine\" className=\"rt-route-icon\" />;\n};\n\nconst defaultRenderStation = ({\n lineInfos,\n onStationClick,\n trackerLayer,\n renderStationImg,\n stop,\n idx,\n}) => {\n const {\n stationId,\n arrivalDelay,\n departureDelay,\n arrivalTime,\n departureTime,\n state,\n stationName,\n aimedArrivalTime,\n aimedDepartureTime,\n } = stop;\n const cancelled = state === 'JOURNEY_CANCELLED' || state === 'STOP_CANCELLED';\n const { stations } = lineInfos;\n const isFirstStation = idx === 0;\n const isLastStation = idx === stations.length - 1;\n const isStationPassed = isPassed(stop, trackerLayer.time, stations, idx);\n const isNotStation = isNotStop(stop);\n return (\n <div\n // Train line can go in circle so begin and end have the same id,\n // using the time in the key should fix the issue.\n key={(stationId || stationName) + arrivalTime + departureTime}\n role=\"button\"\n className={[\n 'rt-route-station',\n isStationPassed ? ' rt-passed' : '',\n isNotStation ? ' rt-no-stop' : '',\n ].join('')}\n onClick={(e) => {\n return onStationClick(stop, e);\n }}\n tabIndex={0}\n onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n >\n <div className=\"rt-route-delay\">\n {typeof arrivalDelay === 'undefined' || isFirstStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {typeof departureDelay === 'undefined' || isLastStation || cancelled ? (\n ''\n ) : (\n <span\n className={`rt-route-delay-departure${` ${getDelayColor(\n departureDelay,\n )}`}`}\n >\n {`+${getDelayString(departureDelay)}`}\n </span>\n )}\n </div>\n <div className=\"rt-route-times\">\n <span\n className={`rt-route-time-arrival ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(aimedArrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? 'rt-route-cancelled' : ''\n }`}\n >\n {getHoursAndMinutes(aimedDepartureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n <div className={cancelled ? 'rt-route-cancelled' : ''}>{stationName}</div>\n </div>\n );\n};\n\nconst renderRouteIdentifier = ({ routeIdentifier, longName }) => {\n if (routeIdentifier) {\n // first part of the id, without leading zeros.\n const id = parseInt(routeIdentifier.split('.')[0], 10);\n if (!longName.includes(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\n\nconst defaultRenderHeader = ({ lineInfos, renderHeaderButtons }) => {\n const {\n type,\n vehicleType,\n shortName,\n longName,\n stroke,\n destination,\n routeIdentifier,\n text_color: textColor,\n } = lineInfos;\n return (\n <div className=\"rt-route-header\">\n <span\n className=\"rt-route-icon\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n backgroundColor: stroke || getBgColor(type || vehicleType),\n color: textColor || 'black',\n }}\n >\n {shortName}\n </span>\n <div className=\"rt-route-title\">\n <span className=\"rt-route-name\">{destination}</span>\n <span>\n {longName}\n {renderRouteIdentifier(lineInfos)}\n </span>\n </div>\n <div className=\"rt-route-buttons\">\n {renderHeaderButtons(routeIdentifier)}\n </div>\n </div>\n );\n};\n\nconst defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} target=\"_blank\" rel=\"noreferrer\">\n {text}\n </a>\n ) : (\n <>{text}</>\n )}\n </div>\n );\n};\n\nconst defaultRenderCopyright = ({ lineInfos }) => {\n return (\n <span className=\"rt-route-copyright\">\n {lineInfos.operator &&\n defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl)}\n {lineInfos.operator && lineInfos.publisher && <span>&nbsp;-&nbsp;</span>}\n {lineInfos.publisher &&\n defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl)}\n {lineInfos.license && <span>&nbsp;(</span>}\n {lineInfos.license &&\n defaultRenderLink(lineInfos.license, lineInfos.licenseUrl)}\n {lineInfos.license && ')'}\n </span>\n );\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n};\n\nconst defaultProps = {\n className: 'rt-route-schedule',\n lineInfos: null,\n renderHeader: defaultRenderHeader,\n renderStation: defaultRenderStation,\n renderStationImg: defaultRenderStationImg,\n renderCopyright: defaultRenderCopyright,\n renderFooter: defaultRenderFooter,\n renderHeaderButtons: () => {\n return null;\n },\n onStationClick: () => {},\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule(props) {\n const { lineInfos, className, renderStation, renderHeader, renderFooter } =\n props;\n\n if (!lineInfos) {\n return null;\n }\n\n return (\n <div className={className}>\n {renderHeader({ ...props })}\n <div className=\"rt-route-body\">\n {lineInfos.stations.map((stop, idx) => {\n return renderStation({ ...props, stop, idx });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\nRouteSchedule.defaultProps = defaultProps;\n\nexport default React.memo(RouteSchedule);\n"],
5
+ "mappings": "AAEA,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB;AAAA,EACE,iBAAiB;AAAA,EACjB;AAAA,OACK;AACP,SAAS,oBAAoB,sBAAsB;AACnD,OAAO,2BAA2B;AAClC,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,UAAU;AAEjB,MAAM,EAAE,WAAW,IAAI;AAMvB,MAAM,gBAAgB,CAAC,SAAS;AAC9B,QAAM,OAAO,KAAK,MAAQ,OAAO,OAAO,IAAK,OAAQ,GAAI;AACzD,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAMA,MAAM,YAAY,CAAC,SAAS;AAC1B,SAAO,CAAC,KAAK,eAAe,CAAC,KAAK;AACpC;AASA,MAAM,WAAW,CAAC,MAAM,MAAM,OAAO,QAAQ;AAG3C,MAAI,UAAU,IAAI,GAAG;AACnB,QAAI,MAAM,MAAM,MAAM,MAAM,GAAG;AAC7B,aAAO,SAAS,MAAM,MAAM,IAAI,MAAM,OAAO,GAAG;AAAA,IAClD;AACA,WAAO;AAAA,EACT;AAGA,QAAM,gBAAgB,KAAK,sBAAsB,KAAK,oBAAoB;AAC1E,MAAI,iBAAiB,KAAK,kBAAkB,KAAK,gBAAgB;AAGjE,MAAI,iBAAiB,GAAG;AACtB,qBAAiB;AAAA,EACnB;AAEA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AAkB,UAAU;AAAA,EAK5B,eAAe,UAAU;AAAA,EAKzB,gBAAgB,UAAU;AAAA,EAK1B,qBAAqB,UAAU;AACjC;AAEA,MAAM,eAAe;AAAA,EACnB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,qBAAqB,MAAM;AACzB,WAAO;AAAA,EACT;AAAA,EACA,gBAAgB,MAAM;AAAA,EAAC;AACzB;AAKA,SAAS,cAAc,OAAO;AAC5B,QAAM,EAAE,WAAW,WAAW,eAAe,cAAc,aAAa,IACtE;AAEF,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,SACE,oCAAC;AAAA,IAAI;AAAA,KACF,aAAa,EAAE,GAAG,MAAM,CAAC,GAC1B,oCAAC;AAAA,IAAI,WAAU;AAAA,KACZ,UAAU,SAAS,IAAI,CAAC,MAAM,QAAQ;AACrC,WAAO,cAAc,EAAE,GAAG,OAAO,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC,CACH,GACC,aAAa,EAAE,GAAG,MAAM,CAAC,CAC5B;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAE7B,eAAe,MAAM,KAAK,aAAa;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./RouteSchedule";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/RouteSchedule/index.js"],
4
+ "sourcesContent": ["export { default } from './RouteSchedule';\n"],
5
+ "mappings": "AAAA,wBAAwB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,32 @@
1
+ import React, { useRef, useEffect } from "react";
2
+ import PropTypes from "prop-types";
3
+ import OLScaleLine from "ol/control/ScaleLine";
4
+ import OLMap from "ol/Map";
5
+ const propTypes = {
6
+ map: PropTypes.instanceOf(OLMap).isRequired,
7
+ options: PropTypes.object
8
+ };
9
+ const defaultProps = {
10
+ options: {}
11
+ };
12
+ function ScaleLine({ map, options, ...other }) {
13
+ const ref = useRef();
14
+ useEffect(() => {
15
+ const control = new OLScaleLine({
16
+ ...options,
17
+ ...{ target: ref.current }
18
+ });
19
+ map.addControl(control);
20
+ return () => {
21
+ map.removeControl(control);
22
+ };
23
+ }, [map, options]);
24
+ return /* @__PURE__ */ React.createElement("div", {
25
+ className: "rs-scale-line",
26
+ ref,
27
+ ...other
28
+ });
29
+ }
30
+ ScaleLine.propTypes = propTypes;
31
+ ScaleLine.defaultProps = defaultProps;
32
+ export default React.memo(ScaleLine);
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/ScaleLine/ScaleLine.js"],
4
+ "sourcesContent": ["import React, { useRef, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport OLScaleLine from 'ol/control/ScaleLine';\nimport OLMap from 'ol/Map';\n\nconst propTypes = {\n /**\n * ol/map.\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Options for ol/control/ScaleLine.\n * See https://openlayers.org/en/latest/apidoc/module-ol_control_ScaleLine-ScaleLine.html\n */\n options: PropTypes.object,\n};\n\nconst defaultProps = {\n options: {},\n};\n\n/**\n * The ScaleLine component creates an\n * [ol/control/ScaleLine](https://openlayers.org/en/latest/apidoc/module-ol_control_ScaleLine-ScaleLine.html)\n * for an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nfunction ScaleLine({ map, options, ...other }) {\n const ref = useRef();\n\n useEffect(() => {\n const control = new OLScaleLine({\n ...options,\n ...{ target: ref.current },\n });\n\n map.addControl(control);\n return () => {\n map.removeControl(control);\n };\n }, [map, options]);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <div className=\"rs-scale-line\" ref={ref} {...other} />;\n}\n\nScaleLine.propTypes = propTypes;\nScaleLine.defaultProps = defaultProps;\n\nexport default React.memo(ScaleLine);\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,QAAQ,iBAAiB;AACzC,OAAO,eAAe;AACtB,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAElB,MAAM,YAAY;AAAA,EAIhB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA,EAMjC,SAAS,UAAU;AACrB;AAEA,MAAM,eAAe;AAAA,EACnB,SAAS,CAAC;AACZ;AAOA,SAAS,UAAU,EAAE,KAAK,YAAY,MAAM,GAAG;AAC7C,QAAM,MAAM,OAAO;AAEnB,YAAU,MAAM;AACd,UAAM,UAAU,IAAI,YAAY;AAAA,MAC9B,GAAG;AAAA,MACH,GAAG,EAAE,QAAQ,IAAI,QAAQ;AAAA,IAC3B,CAAC;AAED,QAAI,WAAW,OAAO;AACtB,WAAO,MAAM;AACX,UAAI,cAAc,OAAO;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,KAAK,OAAO,CAAC;AAGjB,SAAO,oCAAC;AAAA,IAAI,WAAU;AAAA,IAAgB;AAAA,IAAW,GAAG;AAAA,GAAO;AAC7D;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe;AAEzB,eAAe,MAAM,KAAK,SAAS;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./ScaleLine";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/ScaleLine/index.js"],
4
+ "sourcesContent": ["export { default } from './ScaleLine';\n"],
5
+ "mappings": "AAAA,wBAAwB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,210 @@
1
+ import React, { useMemo, useState, useEffect } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { Autocomplete } from "@material-ui/lab";
4
+ import { FaSearch } from "react-icons/fa";
5
+ import TextField from "@material-ui/core/TextField";
6
+ import CircularProgress from "@material-ui/core/CircularProgress";
7
+ import { StopFinderControl } from "mobility-toolbox-js/ol";
8
+ import { Map } from "ol";
9
+ import { makeStyles } from "@material-ui/core";
10
+ import StopsFinderOptions from "./StopsFinderOption";
11
+ const useStyles = makeStyles(() => {
12
+ return {
13
+ popupIndicatorOpen: {
14
+ transform: "rotate(0)"
15
+ }
16
+ };
17
+ });
18
+ function StopsFinder({
19
+ agencies,
20
+ apiKey,
21
+ autocompleteProps,
22
+ bbox,
23
+ field,
24
+ limit,
25
+ map,
26
+ mots,
27
+ onSelect,
28
+ radius,
29
+ refLocation,
30
+ renderAutocomplete,
31
+ url
32
+ }) {
33
+ const classes = useStyles();
34
+ const [inputValue, setInputValue] = useState("");
35
+ const [suggestions, setSuggestions] = useState([]);
36
+ const [isLoading, setLoading] = useState(false);
37
+ const [isOpen, setOpen] = useState(false);
38
+ const control = useMemo(() => {
39
+ return new StopFinderControl({
40
+ url,
41
+ apiKey,
42
+ target: document.createElement("div"),
43
+ element: document.createElement("div"),
44
+ render(newSuggestions = { features: [] }) {
45
+ setSuggestions(newSuggestions.features);
46
+ setLoading(false);
47
+ }
48
+ });
49
+ }, [apiKey, url]);
50
+ useEffect(() => {
51
+ if (!inputValue) {
52
+ setSuggestions([]);
53
+ setLoading(false);
54
+ return () => {
55
+ };
56
+ }
57
+ const abortController = new AbortController();
58
+ setLoading(true);
59
+ control.apiParams = {
60
+ prefAgencies: agencies && agencies.toString(),
61
+ bbox: bbox && bbox.toString(),
62
+ field: field && field.toString(),
63
+ limit,
64
+ mots: mots && mots.toString(),
65
+ radius,
66
+ ref_location: refLocation && refLocation.toString()
67
+ };
68
+ control.search(inputValue, abortController);
69
+ return () => {
70
+ abortController.abort();
71
+ };
72
+ }, [
73
+ agencies,
74
+ bbox,
75
+ control,
76
+ field,
77
+ inputValue,
78
+ limit,
79
+ mots,
80
+ radius,
81
+ refLocation
82
+ ]);
83
+ useEffect(() => {
84
+ if (!control) {
85
+ return () => {
86
+ };
87
+ }
88
+ control.map = map;
89
+ return () => {
90
+ control.map = null;
91
+ };
92
+ }, [map, control]);
93
+ if (!control) {
94
+ return null;
95
+ }
96
+ if (renderAutocomplete) {
97
+ return renderAutocomplete(
98
+ suggestions,
99
+ inputValue,
100
+ setInputValue,
101
+ isOpen,
102
+ setOpen,
103
+ isLoading,
104
+ setLoading
105
+ );
106
+ }
107
+ const textFieldProps = {
108
+ ...(autocompleteProps || {}).textFieldProps || {}
109
+ };
110
+ const autocProps = { ...autocompleteProps };
111
+ delete autocProps.textFieldProps;
112
+ return /* @__PURE__ */ React.createElement(Autocomplete, {
113
+ fullWidth: true,
114
+ autoComplete: true,
115
+ autoHighlight: true,
116
+ selectOnFocus: true,
117
+ getOptionLabel: (option) => {
118
+ return option.properties.name;
119
+ },
120
+ onChange: (evt, value, reason) => {
121
+ if (onSelect && reason === "select-option") {
122
+ onSelect(value, evt);
123
+ }
124
+ },
125
+ popupIcon: /* @__PURE__ */ React.createElement(FaSearch, {
126
+ focusable: false,
127
+ size: 15
128
+ }),
129
+ renderInput: (params) => {
130
+ return /* @__PURE__ */ React.createElement(TextField, {
131
+ label: "Search stops",
132
+ ...{
133
+ ...params,
134
+ ...textFieldProps
135
+ },
136
+ InputProps: {
137
+ ...params.InputProps,
138
+ endAdornment: /* @__PURE__ */ React.createElement(React.Fragment, null, isLoading && /* @__PURE__ */ React.createElement(CircularProgress, {
139
+ size: 20
140
+ }), params.InputProps.endAdornment)
141
+ }
142
+ });
143
+ },
144
+ renderOption: (option) => {
145
+ return /* @__PURE__ */ React.createElement(StopsFinderOptions, {
146
+ option
147
+ });
148
+ },
149
+ ...autocProps,
150
+ classes: { ...classes, ...autocompleteProps.classes },
151
+ inputValue,
152
+ open: isOpen,
153
+ options: suggestions,
154
+ loading: isLoading,
155
+ onOpen: () => {
156
+ setOpen(true);
157
+ },
158
+ onClose: () => {
159
+ setOpen(false);
160
+ },
161
+ onInputChange: (evt, val) => {
162
+ setInputValue(val);
163
+ }
164
+ });
165
+ }
166
+ StopsFinder.propTypes = {
167
+ agencies: PropTypes.oneOfType([
168
+ PropTypes.string,
169
+ PropTypes.arrayOf(PropTypes.string)
170
+ ]),
171
+ apiKey: PropTypes.string,
172
+ autocompleteProps: PropTypes.object,
173
+ bbox: PropTypes.oneOfType([
174
+ PropTypes.string,
175
+ PropTypes.arrayOf(PropTypes.number)
176
+ ]),
177
+ field: PropTypes.oneOfType([
178
+ PropTypes.string,
179
+ PropTypes.arrayOf(PropTypes.string)
180
+ ]),
181
+ limit: PropTypes.number,
182
+ map: PropTypes.instanceOf(Map).isRequired,
183
+ mots: PropTypes.oneOfType([
184
+ PropTypes.string,
185
+ PropTypes.arrayOf(PropTypes.string)
186
+ ]),
187
+ onSelect: PropTypes.func,
188
+ radius: PropTypes.number,
189
+ refLocation: PropTypes.oneOfType([
190
+ PropTypes.string,
191
+ PropTypes.arrayOf(PropTypes.number)
192
+ ]),
193
+ renderAutocomplete: PropTypes.func,
194
+ url: PropTypes.string
195
+ };
196
+ StopsFinder.defaultProps = {
197
+ agencies: null,
198
+ apiKey: null,
199
+ autocompleteProps: {},
200
+ bbox: null,
201
+ field: null,
202
+ limit: null,
203
+ mots: null,
204
+ onSelect: null,
205
+ radius: null,
206
+ refLocation: null,
207
+ url: null,
208
+ renderAutocomplete: null
209
+ };
210
+ export default StopsFinder;
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/StopsFinder/StopsFinder.js"],
4
+ "sourcesContent": ["import React, { useMemo, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { Autocomplete } from '@material-ui/lab';\nimport { FaSearch } from 'react-icons/fa';\nimport TextField from '@material-ui/core/TextField';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { StopFinderControl } from 'mobility-toolbox-js/ol';\nimport { Map } from 'ol';\nimport { makeStyles } from '@material-ui/core';\nimport StopsFinderOptions from './StopsFinderOption';\n\nconst useStyles = makeStyles(() => {\n return {\n popupIndicatorOpen: {\n transform: 'rotate(0)',\n },\n };\n});\n\nfunction StopsFinder({\n agencies,\n apiKey,\n autocompleteProps,\n bbox,\n field,\n limit,\n map,\n mots,\n onSelect,\n radius,\n refLocation,\n renderAutocomplete,\n url,\n}) {\n const classes = useStyles();\n const [inputValue, setInputValue] = useState('');\n const [suggestions, setSuggestions] = useState([]);\n const [isLoading, setLoading] = useState(false);\n const [isOpen, setOpen] = useState(false);\n\n const control = useMemo(() => {\n return new StopFinderControl({\n url,\n apiKey,\n target: document.createElement('div'),\n element: document.createElement('div'),\n render(newSuggestions = { features: [] }) {\n setSuggestions(newSuggestions.features);\n setLoading(false);\n },\n });\n }, [apiKey, url]);\n\n useEffect(() => {\n if (!inputValue) {\n setSuggestions([]);\n setLoading(false);\n return () => {};\n }\n const abortController = new AbortController();\n setLoading(true);\n control.apiParams = {\n prefAgencies: agencies && agencies.toString(),\n bbox: bbox && bbox.toString(),\n field: field && field.toString(),\n limit,\n mots: mots && mots.toString(),\n radius,\n ref_location: refLocation && refLocation.toString(),\n };\n control.search(inputValue, abortController);\n return () => {\n abortController.abort();\n };\n }, [\n agencies,\n bbox,\n control,\n field,\n inputValue,\n limit,\n mots,\n radius,\n refLocation,\n ]);\n\n // Ensure the control is not associated to the wrong map\n useEffect(() => {\n if (!control) {\n return () => {};\n }\n\n control.map = map;\n\n return () => {\n control.map = null;\n };\n }, [map, control]);\n\n if (!control) {\n return null;\n }\n\n if (renderAutocomplete) {\n return renderAutocomplete(\n suggestions,\n inputValue,\n setInputValue,\n isOpen,\n setOpen,\n isLoading,\n setLoading,\n );\n }\n const textFieldProps = {\n ...((autocompleteProps || {}).textFieldProps || {}),\n };\n const autocProps = { ...autocompleteProps };\n delete autocProps.textFieldProps;\n\n return (\n <Autocomplete\n fullWidth\n autoComplete\n autoHighlight\n selectOnFocus\n getOptionLabel={(option) => {\n return option.properties.name;\n }}\n onChange={(evt, value, reason) => {\n if (onSelect && reason === 'select-option') {\n onSelect(value, evt);\n }\n }}\n popupIcon={<FaSearch focusable={false} size={15} />}\n renderInput={(params) => {\n return (\n <TextField\n label=\"Search stops\"\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...{\n ...params,\n ...textFieldProps,\n }}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {isLoading && <CircularProgress size={20} />}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n />\n );\n }}\n renderOption={(option) => {\n return <StopsFinderOptions option={option} />;\n }}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...autocProps}\n classes={{ ...classes, ...autocompleteProps.classes }}\n inputValue={inputValue}\n open={isOpen}\n options={suggestions}\n loading={isLoading}\n onOpen={() => {\n setOpen(true);\n }}\n onClose={() => {\n setOpen(false);\n }}\n onInputChange={(evt, val) => {\n setInputValue(val);\n }}\n />\n );\n}\n\nStopsFinder.propTypes = {\n /**\n * Array or a comma separated list of agencies which should be available.\n * Order of these agencies chooses which agency will be preferred.\n * Available values : sbb, db\n */\n agencies: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n ]),\n\n /**\n * geOps api key to access the StopsFinder service.\n */\n apiKey: PropTypes.string,\n\n /**\n * Properties apply to the default [MUI Autocomplete component](https://material-ui.com/api/autocomplete/).\n * We add a custom properties textFieldProps for the default [MUI TextField component](https://material-ui.com/api/text-field/) used by the Autocomplete.\n */\n autocompleteProps: PropTypes.object,\n\n /**\n * minX,minY,maxX,maxY coordinates in WGS84 wherein the station should lie.\n */\n bbox: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.number),\n ]),\n\n /**\n * Array or a comma separated list of fields which should be used for look up.\n * Available values : id, name, coords\n */\n field: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n ]),\n\n /**\n * Control how many matches will be returned.\n */\n limit: PropTypes.number,\n\n /**\n * A map.\n */\n map: PropTypes.instanceOf(Map).isRequired,\n\n /**\n * Array or a comma separated list of mode of transpaorts which should be available.\n * Available values : bus, ferry, gondola, tram, rail, funicular, cable_car, subway\n */\n mots: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n ]),\n\n /**\n * Function called when a suggestion is selected.\n */\n onSelect: PropTypes.func,\n\n /**\n * Radius around refLocation in meters that is most relevant.\n * Used as granularity for location rank.\n */\n radius: PropTypes.number,\n\n /**\n * Coordinates in WGS84 (in lat,lon order) used to rank stops close to this position higher.\n * Available values : id, name, coords\n */\n refLocation: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.number),\n ]),\n\n /**\n * Function to render a different autocomplete input than the default one.\n */\n renderAutocomplete: PropTypes.func,\n\n /**\n * Url of the geOps StopsFinder service.\n */\n url: PropTypes.string,\n};\n\nStopsFinder.defaultProps = {\n agencies: null,\n apiKey: null,\n autocompleteProps: {},\n bbox: null,\n field: null,\n limit: null,\n mots: null,\n onSelect: null,\n radius: null,\n refLocation: null,\n url: null,\n renderAutocomplete: null,\n};\n\nexport default StopsFinder;\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,SAAS,UAAU,iBAAiB;AACpD,OAAO,eAAe;AACtB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,OAAO,eAAe;AACtB,OAAO,sBAAsB;AAC7B,SAAS,yBAAyB;AAClC,SAAS,WAAW;AACpB,SAAS,kBAAkB;AAC3B,OAAO,wBAAwB;AAE/B,MAAM,YAAY,WAAW,MAAM;AACjC,SAAO;AAAA,IACL,oBAAoB;AAAA,MAClB,WAAW;AAAA,IACb;AAAA,EACF;AACF,CAAC;AAED,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,UAAU,UAAU;AAC1B,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,EAAE;AAC/C,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,CAAC,CAAC;AACjD,QAAM,CAAC,WAAW,UAAU,IAAI,SAAS,KAAK;AAC9C,QAAM,CAAC,QAAQ,OAAO,IAAI,SAAS,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,eAAe,CAAC,KAAK,QAAQ;AAC3B,oBAAc,GAAG;AAAA,IACnB;AAAA,GACF;AAEJ;AAEA,YAAY,YAAY;AAAA,EAMtB,UAAU,UAAU,UAAU;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA,EAKD,QAAQ,UAAU;AAAA,EAMlB,mBAAmB,UAAU;AAAA,EAK7B,MAAM,UAAU,UAAU;AAAA,IACxB,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA,EAMD,OAAO,UAAU,UAAU;AAAA,IACzB,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA,EAKD,OAAO,UAAU;AAAA,EAKjB,KAAK,UAAU,WAAW,GAAG,EAAE;AAAA,EAM/B,MAAM,UAAU,UAAU;AAAA,IACxB,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA,EAKD,UAAU,UAAU;AAAA,EAMpB,QAAQ,UAAU;AAAA,EAMlB,aAAa,UAAU,UAAU;AAAA,IAC/B,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA,EAKD,oBAAoB,UAAU;AAAA,EAK9B,KAAK,UAAU;AACjB;AAEA,YAAY,eAAe;AAAA,EACzB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,mBAAmB,CAAC;AAAA,EACpB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,KAAK;AAAA,EACL,oBAAoB;AACtB;AAEA,eAAe;",
6
+ "names": []
7
+ }
@@ -0,0 +1,51 @@
1
+ import React, { lazy, Suspense } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { makeStyles } from "@material-ui/core";
4
+ const ext = "_round-blue-01.svg";
5
+ const iconForMot = {};
6
+ [
7
+ "bus",
8
+ "ferry",
9
+ "gondola",
10
+ "tram",
11
+ "rail",
12
+ "funicular",
13
+ "cable_car",
14
+ "subway"
15
+ ].forEach((mot) => {
16
+ iconForMot[mot] = lazy(() => {
17
+ return import(`../../images/mots/${mot}${ext}`);
18
+ });
19
+ });
20
+ const useStyles = makeStyles((theme) => {
21
+ return {
22
+ flex: {
23
+ display: "flex",
24
+ alignItems: "center"
25
+ },
26
+ icon: {
27
+ marginRight: theme.spacing(2)
28
+ }
29
+ };
30
+ });
31
+ function StopsFinderOption({ option }) {
32
+ const classes = useStyles();
33
+ return /* @__PURE__ */ React.createElement(Suspense, {
34
+ fallback: /* @__PURE__ */ React.createElement("div", null)
35
+ }, /* @__PURE__ */ React.createElement("div", {
36
+ className: classes.flex
37
+ }, Object.entries(option.properties.mot).map(([key, value]) => {
38
+ if (value) {
39
+ const MotIcon = iconForMot[key];
40
+ return /* @__PURE__ */ React.createElement("span", {
41
+ className: classes.icon,
42
+ key
43
+ }, /* @__PURE__ */ React.createElement(MotIcon, null));
44
+ }
45
+ return /* @__PURE__ */ React.createElement(React.Fragment, null);
46
+ }), /* @__PURE__ */ React.createElement("span", null, option.properties.name)));
47
+ }
48
+ StopsFinderOption.propTypes = {
49
+ option: PropTypes.object.isRequired
50
+ };
51
+ export default React.memo(StopsFinderOption);
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/StopsFinder/StopsFinderOption.js"],
4
+ "sourcesContent": ["import React, { lazy, Suspense } from 'react';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/core';\n\nconst ext = '_round-blue-01.svg';\nconst iconForMot = {};\n[\n 'bus',\n 'ferry',\n 'gondola',\n 'tram',\n 'rail',\n 'funicular',\n 'cable_car',\n 'subway',\n].forEach((mot) => {\n iconForMot[mot] = lazy(() => {\n return import(`../../images/mots/${mot}${ext}`);\n });\n});\n\nconst useStyles = makeStyles((theme) => {\n return {\n flex: {\n display: 'flex',\n alignItems: 'center',\n },\n icon: {\n marginRight: theme.spacing(2),\n },\n };\n});\n\nfunction StopsFinderOption({ option }) {\n const classes = useStyles();\n\n return (\n <Suspense fallback={<div />}>\n <div className={classes.flex}>\n {Object.entries(option.properties.mot).map(([key, value]) => {\n if (value) {\n const MotIcon = iconForMot[key];\n return (\n <span className={classes.icon} key={key}>\n <MotIcon />\n </span>\n );\n }\n return <></>;\n })}\n <span>{option.properties.name}</span>\n </div>\n </Suspense>\n );\n}\n\nStopsFinderOption.propTypes = {\n option: PropTypes.object.isRequired,\n};\n\nexport default React.memo(StopsFinderOption);\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,MAAM,gBAAgB;AACtC,OAAO,eAAe;AACtB,SAAS,kBAAkB;AAE3B,MAAM,MAAM;AACZ,MAAM,aAAa,CAAC;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,QAAQ,CAAC,QAAQ;AACjB,aAAW,OAAO,KAAK,MAAM;AAC3B,WAAO,OAAO,qBAAqB,MAAM;AAAA,EAC3C,CAAC;AACH,CAAC;AAED,MAAM,YAAY,WAAW,CAAC,UAAU;AACtC,SAAO;AAAA,IACL,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,YAAY;AAAA,IACd;AAAA,IACA,MAAM;AAAA,MACJ,aAAa,MAAM,QAAQ,CAAC;AAAA,IAC9B;AAAA,EACF;AACF,CAAC;AAED,SAAS,kBAAkB,EAAE,OAAO,GAAG;AACrC,QAAM,UAAU,UAAU;AAE1B,SACE,oCAAC;AAAA,IAAS,UAAU,oCAAC,WAAI;AAAA,KACvB,oCAAC;AAAA,IAAI,WAAW,QAAQ;AAAA,KACrB,OAAO,QAAQ,OAAO,WAAW,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAC3D,QAAI,OAAO;AACT,YAAM,UAAU,WAAW;AAC3B,aACE,oCAAC;AAAA,QAAK,WAAW,QAAQ;AAAA,QAAM;AAAA,SAC7B,oCAAC,aAAQ,CACX;AAAA,IAEJ;AACA,WAAO,wDAAE;AAAA,EACX,CAAC,GACD,oCAAC,cAAM,OAAO,WAAW,IAAK,CAChC,CACF;AAEJ;AAEA,kBAAkB,YAAY;AAAA,EAC5B,QAAQ,UAAU,OAAO;AAC3B;AAEA,eAAe,MAAM,KAAK,iBAAiB;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./StopsFinder";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/StopsFinder/index.js"],
4
+ "sourcesContent": ["export { default } from './StopsFinder';\n"],
5
+ "mappings": "AAAA,wBAAwB;",
6
+ "names": []
7
+ }