react-spatial 2.0.3 → 2.1.6

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 (42) hide show
  1. package/README.md +1 -1
  2. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +79 -70
  3. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +2 -2
  4. package/components/BasicMap/BasicMap.js +2 -1
  5. package/components/BasicMap/BasicMap.js.map +1 -1
  6. package/components/CanvasSaveButton/CanvasSaveButton.js +10 -7
  7. package/components/CanvasSaveButton/CanvasSaveButton.js.map +2 -2
  8. package/components/Copyright/Copyright.js +5 -2
  9. package/components/Copyright/Copyright.js.map +2 -2
  10. package/components/FeatureExportButton/FeatureExportButton.js +5 -4
  11. package/components/FeatureExportButton/FeatureExportButton.js.map +2 -2
  12. package/components/FitExtent/FitExtent.js +5 -4
  13. package/components/FitExtent/FitExtent.js.map +2 -2
  14. package/components/Geolocation/Geolocation.js +6 -5
  15. package/components/Geolocation/Geolocation.js.map +2 -2
  16. package/components/LayerTree/LayerTree.js +68 -50
  17. package/components/LayerTree/LayerTree.js.map +2 -2
  18. package/components/MousePosition/MousePosition.js +12 -11
  19. package/components/MousePosition/MousePosition.js.map +2 -2
  20. package/components/NorthArrow/NorthArrow.js +5 -4
  21. package/components/NorthArrow/NorthArrow.js.map +2 -2
  22. package/components/Overlay/Overlay.js +43 -39
  23. package/components/Overlay/Overlay.js.map +1 -1
  24. package/components/Permalink/Permalink.js.map +2 -2
  25. package/components/Popup/Popup.js +28 -22
  26. package/components/Popup/Popup.js.map +2 -2
  27. package/components/ResizeHandler/ResizeHandler.js.map +1 -1
  28. package/components/RouteSchedule/RouteSchedule.js +82 -52
  29. package/components/RouteSchedule/RouteSchedule.js.map +2 -2
  30. package/components/ScaleLine/ScaleLine.js +2 -1
  31. package/components/ScaleLine/ScaleLine.js.map +2 -2
  32. package/components/StopsFinder/StopsFinder.js +23 -17
  33. package/components/StopsFinder/StopsFinder.js.map +2 -2
  34. package/components/StopsFinder/StopsFinderOption.js +18 -12
  35. package/components/StopsFinder/StopsFinderOption.js.map +2 -2
  36. package/components/Zoom/Zoom.js +16 -14
  37. package/components/Zoom/Zoom.js.map +2 -2
  38. package/package.json +59 -71
  39. package/setupTests.js +10 -1
  40. package/setupTests.js.map +2 -2
  41. package/utils/KML.js +3 -3
  42. package/utils/KML.js.map +2 -2
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
1
2
  import {
2
3
  realtimeConfig,
3
4
  RealtimeLayer as TrackerLayer
@@ -57,14 +58,14 @@ const defaultRenderStationImg = (stations, index, isStationPassed, isNotStation)
57
58
  } else if (isNotStation) {
58
59
  src = line.src || line;
59
60
  }
60
- return /* @__PURE__ */ React.createElement("img", { alt: "routeScheduleLine", className: "rt-route-icon", src });
61
+ return /* @__PURE__ */ jsx("img", { alt: "routeScheduleLine", className: "rt-route-icon", src });
61
62
  };
62
63
  const defaultRenderStationName = (stations, index, cancelled) => {
63
64
  const { stationName } = stations[index];
64
- return /* @__PURE__ */ React.createElement("div", { className: cancelled ? "rt-route-cancelled" : "" }, stationName);
65
+ return /* @__PURE__ */ jsx("div", { className: cancelled ? "rt-route-cancelled" : "", children: stationName });
65
66
  };
66
67
  const defaultRenderDelay = (delay, stop, getDelayString, getDelayColor) => {
67
- return /* @__PURE__ */ React.createElement("span", { style: { color: getDelayColor?.(delay, stop) || "inherit" } }, `${getDelayString?.(delay, stop) || ""}`);
68
+ return /* @__PURE__ */ jsx("span", { style: { color: getDelayColor?.(delay, stop) || "inherit" }, children: `${getDelayString?.(delay, stop) || ""}` });
68
69
  };
69
70
  const emptyFunc = () => {
70
71
  };
@@ -108,7 +109,7 @@ function RouteStop({
108
109
  clearInterval(timeout);
109
110
  };
110
111
  }, [stop, trackerLayer, stations, idx]);
111
- return /* @__PURE__ */ React.createElement(
112
+ return /* @__PURE__ */ jsxs(
112
113
  "div",
113
114
  {
114
115
  className: [
@@ -123,44 +124,52 @@ function RouteStop({
123
124
  return e.which === 13 && onStationClick(stop, e);
124
125
  },
125
126
  role: "button",
126
- tabIndex: 0
127
- },
128
- /* @__PURE__ */ React.createElement("div", { className: "rt-route-delay" }, arrivalDelay === void 0 || arrivalDelay === null || isFirstStation || cancelled ? "" : renderArrivalDelay(
129
- arrivalDelay,
130
- stop,
131
- getDelayString,
132
- getDelayColor
133
- ), departureDelay === void 0 || departureDelay === null || isLastStation || cancelled ? "" : renderDepartureDelay(
134
- departureDelay,
135
- stop,
136
- getDelayString,
137
- getDelayColor
138
- )),
139
- /* @__PURE__ */ React.createElement("div", { className: "rt-route-times" }, /* @__PURE__ */ React.createElement(
140
- "span",
141
- {
142
- className: `rt-route-time-arrival ${cancelled ? "rt-route-cancelled" : ""}`
143
- },
144
- getHoursAndMinutes(aimedArrivalTime)
145
- ), /* @__PURE__ */ React.createElement(
146
- "span",
147
- {
148
- className: `rt-route-time-departure ${cancelled ? "rt-route-cancelled" : ""}`
149
- },
150
- getHoursAndMinutes(aimedDepartureTime)
151
- )),
152
- renderStationImg(stations, idx, isStationPassed, isNotStation),
153
- renderStationName(stations, idx, cancelled)
127
+ tabIndex: 0,
128
+ children: [
129
+ /* @__PURE__ */ jsxs("div", { className: "rt-route-delay", children: [
130
+ arrivalDelay === void 0 || arrivalDelay === null || isFirstStation || cancelled ? "" : renderArrivalDelay(
131
+ arrivalDelay,
132
+ stop,
133
+ getDelayString,
134
+ getDelayColor
135
+ ),
136
+ departureDelay === void 0 || departureDelay === null || isLastStation || cancelled ? "" : renderDepartureDelay(
137
+ departureDelay,
138
+ stop,
139
+ getDelayString,
140
+ getDelayColor
141
+ )
142
+ ] }),
143
+ /* @__PURE__ */ jsxs("div", { className: "rt-route-times", children: [
144
+ /* @__PURE__ */ jsx(
145
+ "span",
146
+ {
147
+ className: `rt-route-time-arrival ${cancelled ? "rt-route-cancelled" : ""}`,
148
+ children: getHoursAndMinutes(aimedArrivalTime)
149
+ }
150
+ ),
151
+ /* @__PURE__ */ jsx(
152
+ "span",
153
+ {
154
+ className: `rt-route-time-departure ${cancelled ? "rt-route-cancelled" : ""}`,
155
+ children: getHoursAndMinutes(aimedDepartureTime)
156
+ }
157
+ )
158
+ ] }),
159
+ renderStationImg(stations, idx, isStationPassed, isNotStation),
160
+ renderStationName(stations, idx, cancelled)
161
+ ]
162
+ }
154
163
  );
155
164
  }
156
165
  const defaultRenderStation = (props) => {
157
166
  const { arrivalTime, departureTime, stationId, stationName } = props.stop;
158
- return /* @__PURE__ */ React.createElement(
167
+ return /* @__PURE__ */ jsx(
159
168
  RouteStop,
160
169
  {
161
- key: (stationId || stationName) + arrivalTime + departureTime,
162
170
  ...props
163
- }
171
+ },
172
+ (stationId || stationName) + arrivalTime + departureTime
164
173
  );
165
174
  };
166
175
  const defaultRenderRouteIdentifier = ({ longName, routeIdentifier }) => {
@@ -190,31 +199,48 @@ const defaultRenderHeader = ({
190
199
  type,
191
200
  vehicleType
192
201
  } = lineInfos;
193
- return /* @__PURE__ */ React.createElement("div", { className: "rt-route-header" }, /* @__PURE__ */ React.createElement(
194
- "span",
195
- {
196
- className: "rt-route-icon",
197
- style: {
198
- /* stylelint-disable-next-line value-keyword-case */
199
- backgroundColor: stroke || getBgColor(type || vehicleType),
200
- color: textColor || "black"
202
+ return /* @__PURE__ */ jsxs("div", { className: "rt-route-header", children: [
203
+ /* @__PURE__ */ jsx(
204
+ "span",
205
+ {
206
+ className: "rt-route-icon",
207
+ style: {
208
+ /* stylelint-disable-next-line value-keyword-case */
209
+ backgroundColor: stroke || getBgColor(type || vehicleType),
210
+ color: textColor || "black"
211
+ },
212
+ children: shortName
201
213
  }
202
- },
203
- shortName
204
- ), /* @__PURE__ */ React.createElement("div", { className: "rt-route-title" }, /* @__PURE__ */ React.createElement("span", { className: "rt-route-name" }, destination), /* @__PURE__ */ React.createElement("span", null, longName, renderRouteIdentifier(lineInfos))), /* @__PURE__ */ React.createElement("div", { className: "rt-route-buttons" }, renderHeaderButtons(routeIdentifier)));
214
+ ),
215
+ /* @__PURE__ */ jsxs("div", { className: "rt-route-title", children: [
216
+ /* @__PURE__ */ jsx("span", { className: "rt-route-name", children: destination }),
217
+ /* @__PURE__ */ jsxs("span", { children: [
218
+ longName,
219
+ renderRouteIdentifier(lineInfos)
220
+ ] })
221
+ ] }),
222
+ /* @__PURE__ */ jsx("div", { className: "rt-route-buttons", children: renderHeaderButtons(routeIdentifier) })
223
+ ] });
205
224
  };
206
225
  const defaultRenderLink = (text, url) => {
207
- return /* @__PURE__ */ React.createElement("div", { className: "rt-route-copyright-link" }, url ? /* @__PURE__ */ React.createElement("a", { href: url, rel: "noreferrer", target: "_blank" }, text) : text);
226
+ return /* @__PURE__ */ jsx("div", { className: "rt-route-copyright-link", children: url ? /* @__PURE__ */ jsx("a", { href: url, rel: "noreferrer", target: "_blank", children: text }) : text });
208
227
  };
209
228
  const defaultRenderCopyright = ({ lineInfos }) => {
210
- return /* @__PURE__ */ React.createElement("span", { className: "rt-route-copyright" }, 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 && ")");
229
+ return /* @__PURE__ */ jsxs("span", { className: "rt-route-copyright", children: [
230
+ lineInfos.operator && defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl),
231
+ lineInfos.operator && lineInfos.publisher && /* @__PURE__ */ jsx("span", { children: "\xA0-\xA0" }),
232
+ lineInfos.publisher && defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl),
233
+ lineInfos.license && /* @__PURE__ */ jsx("span", { children: "\xA0(" }),
234
+ lineInfos.license && defaultRenderLink(lineInfos.license, lineInfos.licenseUrl),
235
+ lineInfos.license && ")"
236
+ ] });
211
237
  };
212
238
  const defaultRenderFooter = (props) => {
213
239
  const { lineInfos, renderCopyright = defaultRenderCopyright } = props;
214
240
  if (!lineInfos.operator && !lineInfos.publisher) {
215
241
  return null;
216
242
  }
217
- return /* @__PURE__ */ React.createElement("div", { className: "rt-route-footer" }, renderCopyright({ ...props }));
243
+ return /* @__PURE__ */ jsx("div", { className: "rt-route-footer", children: renderCopyright({ ...props }) });
218
244
  };
219
245
  const propTypes = {
220
246
  /**
@@ -293,9 +319,13 @@ function RouteSchedule({
293
319
  if (!lineInfos) {
294
320
  return null;
295
321
  }
296
- return /* @__PURE__ */ React.createElement("div", { className }, renderHeader({ ...props }), /* @__PURE__ */ React.createElement("div", { className: "rt-route-body" }, lineInfos.stations.map((stop, idx) => {
297
- return renderStation({ ...props, idx, stop });
298
- })), renderFooter({ ...props }));
322
+ return /* @__PURE__ */ jsxs("div", { className, children: [
323
+ renderHeader({ ...props }),
324
+ /* @__PURE__ */ jsx("div", { className: "rt-route-body", children: lineInfos.stations.map((stop, idx) => {
325
+ return renderStation({ ...props, idx, stop });
326
+ }) }),
327
+ renderFooter({ ...props })
328
+ ] });
299
329
  }
300
330
  RouteSchedule.propTypes = propTypes;
301
331
  export default React.memo(RouteSchedule);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/RouteSchedule/RouteSchedule.js"],
4
- "sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\nimport {\n realtimeConfig,\n RealtimeLayer as TrackerLayer,\n} from \"mobility-toolbox-js/ol\";\nimport PropTypes from \"prop-types\";\n/* eslint-disable react/prop-types */\nimport React, { useEffect, useState } from \"react\";\n\nimport firstStation from \"../../images/RouteSchedule/firstStation.png\";\nimport lastStation from \"../../images/RouteSchedule/lastStation.png\";\nimport line from \"../../images/RouteSchedule/line.png\";\nimport station from \"../../images/RouteSchedule/station.png\";\nimport ReactTransitPropTypes from \"../../propTypes\";\nimport {\n getDelayString as defaultGetDelayString,\n getHoursAndMinutes,\n} from \"../../utils/timeUtils\";\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 defaultGetDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return \"rgb(237 0 76)\";\n }\n if (secs >= 500) {\n return \"rgb(232 0 0)\";\n }\n if (secs >= 300) {\n return \"rgb(255 74 0)\";\n }\n if (secs >= 180) {\n return \"rgb(247 191 0)\";\n }\n return \"rgb(0 160 12)\";\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 alt=\"routeScheduleLine\" className=\"rt-route-icon\" src={src} />;\n};\n\n/**\n * Returns an text.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} cancelled If the station is cancelled\n */\nconst defaultRenderStationName = (stations, index, cancelled) => {\n const { stationName } = stations[index];\n return (\n <div className={cancelled ? \"rt-route-cancelled\" : \"\"}>{stationName}</div>\n );\n};\n\n/**\n * Render a delay string.\n * @param {Number} delay The delay in ms to display.\n * @param {Boolean} stop The current stop object.\n * @param {Function} getDelayString Function to get string to display.\n * @param {Function} getColor Define the css color to use.\n *\n */\nconst defaultRenderDelay = (delay, stop, getDelayString, getDelayColor) => {\n return (\n <span style={{ color: getDelayColor?.(delay, stop) || \"inherit\" }}>\n {`${getDelayString?.(delay, stop) || \"\"}`}\n </span>\n );\n};\n\nconst emptyFunc = () => {};\n\nfunction RouteStop({\n getDelayColor = defaultGetDelayColor,\n getDelayString = defaultGetDelayString,\n idx,\n lineInfos,\n onStationClick = emptyFunc,\n renderArrivalDelay = defaultRenderDelay,\n renderDepartureDelay = defaultRenderDelay,\n renderStationImg = defaultRenderStationImg,\n renderStationName = defaultRenderStationName,\n stop,\n trackerLayer,\n}) {\n const {\n aimedArrivalTime,\n aimedDepartureTime,\n arrivalDelay,\n departureDelay,\n state,\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 isNotStation = isNotStop(stop);\n const [isStationPassed, setIsStationPassed] = useState(false);\n\n useEffect(() => {\n let timeout = null;\n const time = trackerLayer.time || trackerLayer.engine?.time || Date.now();\n\n const isStopPassed = isPassed(stop, time, stations, idx);\n setIsStationPassed(isStopPassed);\n\n // We have to refresh the stop when the state it's time_based\n if (stop.state === \"TIME_BASED\" && !isStopPassed) {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, trackerLayer, stations, idx]);\n\n return (\n <div\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 onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n role=\"button\"\n tabIndex={0}\n >\n <div className=\"rt-route-delay\">\n {arrivalDelay === undefined ||\n arrivalDelay === null ||\n isFirstStation ||\n cancelled\n ? \"\"\n : renderArrivalDelay(\n arrivalDelay,\n stop,\n getDelayString,\n getDelayColor,\n )}\n {departureDelay === undefined ||\n departureDelay === null ||\n isLastStation ||\n cancelled\n ? \"\"\n : renderDepartureDelay(\n departureDelay,\n stop,\n getDelayString,\n getDelayColor,\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 {renderStationName(stations, idx, cancelled)}\n </div>\n );\n}\n\nconst defaultRenderStation = (props) => {\n const { arrivalTime, departureTime, stationId, stationName } = props.stop;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return (\n <RouteStop\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 // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n />\n );\n};\n\nconst defaultRenderRouteIdentifier = ({ longName, routeIdentifier }) => {\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) && !Number.isNaN(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\nconst defaultRenderHeaderButtons = () => {\n return null;\n};\n\nconst defaultRenderHeader = ({\n lineInfos,\n renderHeaderButtons = defaultRenderHeaderButtons,\n renderRouteIdentifier = defaultRenderRouteIdentifier,\n}) => {\n const {\n destination,\n longName,\n routeIdentifier,\n shortName,\n stroke,\n text_color: textColor,\n type,\n vehicleType,\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 defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} rel=\"noreferrer\" target=\"_blank\">\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 defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright = defaultRenderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Function to get the delay color.\n */\n getDelayColor: PropTypes.func,\n\n /**\n * Function to get the delay string for stations.\n */\n getDelayString: PropTypes.func,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Render delay for arrival.\n */\n renderArrivalDelay: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render delay for departure.\n */\n renderDepartureDelay: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n\n /**\n * Render the route identifier in the header\n */\n renderRouteIdentifier: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station name.\n */\n renderStationName: PropTypes.func,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule({\n className = \"rt-route-schedule\",\n renderFooter = defaultRenderFooter,\n renderHeader = defaultRenderHeader,\n renderStation = defaultRenderStation,\n ...props\n}) {\n const { lineInfos } = 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, idx, stop });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\n\nexport default React.memo(RouteSchedule);\n"],
5
- "mappings": "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BAAkB,UAAU;AAAA;AAAA;AAAA;AAAA,EAK5B,mBAAmB,UAAU;AAAA;AAAA;AAAA;AAAA,EAK7B,cAAc,UAAU,WAAW,YAAY,EAAE;AACnD;AAKA,SAAS,cAAc;AAAA,EACrB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,GAAG;AACL,GAAG;AACD,QAAM,EAAE,UAAU,IAAI;AAEtB,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,SACE,oCAAC,SAAI,aACF,aAAa,EAAE,GAAG,MAAM,CAAC,GAC1B,oCAAC,SAAI,WAAU,mBACZ,UAAU,SAAS,IAAI,CAAC,MAAM,QAAQ;AACrC,WAAO,cAAc,EAAE,GAAG,OAAO,KAAK,KAAK,CAAC;AAAA,EAC9C,CAAC,CACH,GACC,aAAa,EAAE,GAAG,MAAM,CAAC,CAC5B;AAEJ;AAEA,cAAc,YAAY;AAE1B,eAAe,MAAM,KAAK,aAAa;",
4
+ "sourcesContent": ["import {\n realtimeConfig,\n RealtimeLayer as TrackerLayer,\n} from \"mobility-toolbox-js/ol\";\nimport PropTypes from \"prop-types\";\n/* eslint-disable react/prop-types */\nimport React, { useEffect, useState } from \"react\";\n\nimport firstStation from \"../../images/RouteSchedule/firstStation.png\";\nimport lastStation from \"../../images/RouteSchedule/lastStation.png\";\nimport line from \"../../images/RouteSchedule/line.png\";\nimport station from \"../../images/RouteSchedule/station.png\";\nimport ReactTransitPropTypes from \"../../propTypes\";\nimport {\n getDelayString as defaultGetDelayString,\n getHoursAndMinutes,\n} from \"../../utils/timeUtils\";\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 defaultGetDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return \"rgb(237 0 76)\";\n }\n if (secs >= 500) {\n return \"rgb(232 0 0)\";\n }\n if (secs >= 300) {\n return \"rgb(255 74 0)\";\n }\n if (secs >= 180) {\n return \"rgb(247 191 0)\";\n }\n return \"rgb(0 160 12)\";\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 alt=\"routeScheduleLine\" className=\"rt-route-icon\" src={src} />;\n};\n\n/**\n * Returns an text.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} cancelled If the station is cancelled\n */\nconst defaultRenderStationName = (stations, index, cancelled) => {\n const { stationName } = stations[index];\n return (\n <div className={cancelled ? \"rt-route-cancelled\" : \"\"}>{stationName}</div>\n );\n};\n\n/**\n * Render a delay string.\n * @param {Number} delay The delay in ms to display.\n * @param {Boolean} stop The current stop object.\n * @param {Function} getDelayString Function to get string to display.\n * @param {Function} getColor Define the css color to use.\n *\n */\nconst defaultRenderDelay = (delay, stop, getDelayString, getDelayColor) => {\n return (\n <span style={{ color: getDelayColor?.(delay, stop) || \"inherit\" }}>\n {`${getDelayString?.(delay, stop) || \"\"}`}\n </span>\n );\n};\n\nconst emptyFunc = () => {};\n\nfunction RouteStop({\n getDelayColor = defaultGetDelayColor,\n getDelayString = defaultGetDelayString,\n idx,\n lineInfos,\n onStationClick = emptyFunc,\n renderArrivalDelay = defaultRenderDelay,\n renderDepartureDelay = defaultRenderDelay,\n renderStationImg = defaultRenderStationImg,\n renderStationName = defaultRenderStationName,\n stop,\n trackerLayer,\n}) {\n const {\n aimedArrivalTime,\n aimedDepartureTime,\n arrivalDelay,\n departureDelay,\n state,\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 isNotStation = isNotStop(stop);\n const [isStationPassed, setIsStationPassed] = useState(false);\n\n useEffect(() => {\n let timeout = null;\n const time = trackerLayer.time || trackerLayer.engine?.time || Date.now();\n\n const isStopPassed = isPassed(stop, time, stations, idx);\n setIsStationPassed(isStopPassed);\n\n // We have to refresh the stop when the state it's time_based\n if (stop.state === \"TIME_BASED\" && !isStopPassed) {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, trackerLayer, stations, idx]);\n\n return (\n <div\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 onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n role=\"button\"\n tabIndex={0}\n >\n <div className=\"rt-route-delay\">\n {arrivalDelay === undefined ||\n arrivalDelay === null ||\n isFirstStation ||\n cancelled\n ? \"\"\n : renderArrivalDelay(\n arrivalDelay,\n stop,\n getDelayString,\n getDelayColor,\n )}\n {departureDelay === undefined ||\n departureDelay === null ||\n isLastStation ||\n cancelled\n ? \"\"\n : renderDepartureDelay(\n departureDelay,\n stop,\n getDelayString,\n getDelayColor,\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 {renderStationName(stations, idx, cancelled)}\n </div>\n );\n}\n\nconst defaultRenderStation = (props) => {\n const { arrivalTime, departureTime, stationId, stationName } = props.stop;\n\n return (\n <RouteStop\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 {...props}\n />\n );\n};\n\nconst defaultRenderRouteIdentifier = ({ longName, routeIdentifier }) => {\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) && !Number.isNaN(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\nconst defaultRenderHeaderButtons = () => {\n return null;\n};\n\nconst defaultRenderHeader = ({\n lineInfos,\n renderHeaderButtons = defaultRenderHeaderButtons,\n renderRouteIdentifier = defaultRenderRouteIdentifier,\n}) => {\n const {\n destination,\n longName,\n routeIdentifier,\n shortName,\n stroke,\n text_color: textColor,\n type,\n vehicleType,\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 defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} rel=\"noreferrer\" target=\"_blank\">\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 defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright = defaultRenderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Function to get the delay color.\n */\n getDelayColor: PropTypes.func,\n\n /**\n * Function to get the delay string for stations.\n */\n getDelayString: PropTypes.func,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Render delay for arrival.\n */\n renderArrivalDelay: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render delay for departure.\n */\n renderDepartureDelay: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n\n /**\n * Render the route identifier in the header\n */\n renderRouteIdentifier: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station name.\n */\n renderStationName: PropTypes.func,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule({\n className = \"rt-route-schedule\",\n renderFooter = defaultRenderFooter,\n renderHeader = defaultRenderHeader,\n renderStation = defaultRenderStation,\n ...props\n}) {\n const { lineInfos } = 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, idx, stop });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\n\nexport default React.memo(RouteSchedule);\n"],
5
+ "mappings": "AAoGS,cA+FH,YA/FG;AApGT;AAAA,EACE;AAAA,EACA,iBAAiB;AAAA,OACZ;AACP,OAAO,eAAe;AAEtB,OAAO,SAAS,WAAW,gBAAgB;AAE3C,OAAO,kBAAkB;AACzB,OAAO,iBAAiB;AACxB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,2BAA2B;AAClC;AAAA,EACE,kBAAkB;AAAA,EAClB;AAAA,OACK;AAEP,MAAM,EAAE,WAAW,IAAI;AAMvB,MAAM,uBAAuB,CA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A,EACrB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,GAAG;AACL,GAAG;AACD,QAAM,EAAE,UAAU,IAAI;AAEtB,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,SACE,qBAAC,SAAI,WACF;AAAA,iBAAa,EAAE,GAAG,MAAM,CAAC;AAAA,IAC1B,oBAAC,SAAI,WAAU,iBACZ,oBAAU,SAAS,IAAI,CAAC,MAAM,QAAQ;AACrC,aAAO,cAAc,EAAE,GAAG,OAAO,KAAK,KAAK,CAAC;AAAA,IAC9C,CAAC,GACH;AAAA,IACC,aAAa,EAAE,GAAG,MAAM,CAAC;AAAA,KAC5B;AAEJ;AAEA,cAAc,YAAY;AAE1B,eAAe,MAAM,KAAK,aAAa;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { jsx } from "react/jsx-runtime";
1
2
  import OLScaleLine from "ol/control/ScaleLine";
2
3
  import OLMap from "ol/Map";
3
4
  import PropTypes from "prop-types";
@@ -28,7 +29,7 @@ function ScaleLine({ map, options = defaultProps.options, ...other }) {
28
29
  map.removeControl(control);
29
30
  };
30
31
  }, [map, options]);
31
- return /* @__PURE__ */ React.createElement("div", { className: "rs-scale-line", ref, ...other });
32
+ return /* @__PURE__ */ jsx("div", { className: "rs-scale-line", ref, ...other });
32
33
  }
33
34
  ScaleLine.propTypes = propTypes;
34
35
  export default React.memo(ScaleLine);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/ScaleLine/ScaleLine.js"],
4
- "sourcesContent": ["import OLScaleLine from \"ol/control/ScaleLine\";\nimport OLMap from \"ol/Map\";\nimport PropTypes from \"prop-types\";\nimport React, { useEffect, useRef } from \"react\";\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 = defaultProps.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;\n\nexport default React.memo(ScaleLine);\n"],
5
- "mappings": "AAAA,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,cAAc;AAEzC,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjC,SAAS,UAAU;AACrB;AAEA,MAAM,eAAe;AAAA,EACnB,SAAS,CAAC;AACZ;AAOA,SAAS,UAAU,EAAE,KAAK,UAAU,aAAa,SAAS,GAAG,MAAM,GAAG;AACpE,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,SAAI,WAAU,iBAAgB,KAAW,GAAG,OAAO;AAC7D;AAEA,UAAU,YAAY;AAEtB,eAAe,MAAM,KAAK,SAAS;",
4
+ "sourcesContent": ["import OLScaleLine from \"ol/control/ScaleLine\";\nimport OLMap from \"ol/Map\";\nimport PropTypes from \"prop-types\";\nimport React, { useEffect, useRef } from \"react\";\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 = defaultProps.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 return <div className=\"rs-scale-line\" ref={ref} {...other} />;\n}\n\nScaleLine.propTypes = propTypes;\n\nexport default React.memo(ScaleLine);\n"],
5
+ "mappings": "AA0CS;AA1CT,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,cAAc;AAEzC,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjC,SAAS,UAAU;AACrB;AAEA,MAAM,eAAe;AAAA,EACnB,SAAS,CAAC;AACZ;AAOA,SAAS,UAAU,EAAE,KAAK,UAAU,aAAa,SAAS,GAAG,MAAM,GAAG;AACpE,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;AAEjB,SAAO,oBAAC,SAAI,WAAU,iBAAgB,KAAW,GAAG,OAAO;AAC7D;AAEA,UAAU,YAAY;AAEtB,eAAe,MAAM,KAAK,SAAS;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
2
  import {
2
3
  Autocomplete,
3
4
  autocompleteClasses,
@@ -11,11 +12,13 @@ import PropTypes from "prop-types";
11
12
  import React, { useEffect, useMemo, useState } from "react";
12
13
  import { FaSearch } from "react-icons/fa";
13
14
  import StopsFinderOption from "./StopsFinderOption";
14
- const StyledAutocomplete = styled(Autocomplete)(() => ({
15
- [`& .${autocompleteClasses.popupIndicatorOpen}`]: {
16
- transform: "rotate(0)"
17
- }
18
- }));
15
+ const StyledAutocomplete = styled(Autocomplete)(() => {
16
+ return {
17
+ [`& .${autocompleteClasses.popupIndicatorOpen}`]: {
18
+ transform: "rotate(0)"
19
+ }
20
+ };
21
+ });
19
22
  const defaultProps = {
20
23
  textFieldProps: {}
21
24
  };
@@ -56,14 +59,14 @@ function StopsFinder({
56
59
  const abortController = new AbortController();
57
60
  setLoading(true);
58
61
  const apiParams = {
59
- bbox: bbox && bbox.toString(),
60
- field: field && field.toString(),
62
+ bbox: bbox?.toString(),
63
+ field: field?.toString(),
61
64
  limit,
62
- mots: mots && mots.toString(),
63
- prefAgencies: agencies && agencies.toString(),
65
+ mots: mots?.toString(),
66
+ prefAgencies: agencies?.toString(),
64
67
  q: inputValue,
65
68
  radius,
66
- ref_location: refLocation && refLocation.toString()
69
+ ref_location: refLocation?.toString()
67
70
  };
68
71
  api.search(apiParams, abortController).then((featureCollection) => {
69
72
  setSuggestions(featureCollection?.features || []);
@@ -98,7 +101,7 @@ function StopsFinder({
98
101
  setLoading
99
102
  );
100
103
  }
101
- return /* @__PURE__ */ React.createElement(
104
+ return /* @__PURE__ */ jsx(
102
105
  StyledAutocomplete,
103
106
  {
104
107
  autoComplete: true,
@@ -112,9 +115,9 @@ function StopsFinder({
112
115
  onSelect(value, evt);
113
116
  }
114
117
  },
115
- popupIcon: /* @__PURE__ */ React.createElement(FaSearch, { focusable: false, size: 15 }),
118
+ popupIcon: /* @__PURE__ */ jsx(FaSearch, { focusable: false, size: 15 }),
116
119
  renderInput: (params) => {
117
- return /* @__PURE__ */ React.createElement(
120
+ return /* @__PURE__ */ jsx(
118
121
  TextField,
119
122
  {
120
123
  label: "Search stops",
@@ -122,19 +125,22 @@ function StopsFinder({
122
125
  ...textFieldProps,
123
126
  InputProps: {
124
127
  ...params.InputProps,
125
- endAdornment: /* @__PURE__ */ React.createElement(React.Fragment, null, isLoading && /* @__PURE__ */ React.createElement(CircularProgress, { size: 20 }), params.InputProps.endAdornment)
128
+ endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
129
+ isLoading && /* @__PURE__ */ jsx(CircularProgress, { size: 20 }),
130
+ params.InputProps.endAdornment
131
+ ] })
126
132
  }
127
133
  }
128
134
  );
129
135
  },
130
136
  renderOption: (liProps, option) => {
131
- return /* @__PURE__ */ React.createElement(
137
+ return /* @__PURE__ */ jsx(
132
138
  StopsFinderOption,
133
139
  {
134
- key: option.properties?.name,
135
140
  option,
136
141
  ...liProps
137
- }
142
+ },
143
+ option.properties?.name
138
144
  );
139
145
  },
140
146
  selectOnFocus: true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/StopsFinder/StopsFinder.js"],
4
- "sourcesContent": ["/* eslint-disable react/jsx-props-no-spreading */\nimport {\n Autocomplete,\n autocompleteClasses,\n styled,\n TextField,\n} from \"@mui/material\";\nimport CircularProgress from \"@mui/material/CircularProgress\";\nimport { StopsAPI } from \"mobility-toolbox-js/ol\";\nimport { Map } from \"ol\";\nimport PropTypes from \"prop-types\";\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport { FaSearch } from \"react-icons/fa\";\n\nimport StopsFinderOption from \"./StopsFinderOption\";\n\nconst StyledAutocomplete = styled(Autocomplete)(() => ({\n [`& .${autocompleteClasses.popupIndicatorOpen}`]: {\n transform: \"rotate(0)\",\n },\n}));\n\nconst defaultProps = {\n textFieldProps: {},\n};\n\nfunction StopsFinder({\n agencies,\n apiKey,\n bbox,\n field,\n limit,\n map,\n mots,\n onSelect,\n radius,\n refLocation,\n renderAutocomplete,\n textFieldProps = defaultProps.textFieldProps,\n url,\n ...props\n}) {\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 api = useMemo(() => {\n const options = { apiKey };\n if (url) {\n options.url = url;\n }\n return new StopsAPI(options);\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 const apiParams = {\n bbox: bbox && bbox.toString(),\n field: field && field.toString(),\n limit,\n mots: mots && mots.toString(),\n prefAgencies: agencies && agencies.toString(),\n q: inputValue,\n radius,\n ref_location: refLocation && refLocation.toString(),\n };\n api\n .search(apiParams, abortController)\n .then((featureCollection) => {\n setSuggestions(featureCollection?.features || []);\n setLoading(false);\n })\n .catch((error) => {\n // different from AbortError\n if (error.code !== 20) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n });\n return () => {\n abortController.abort();\n };\n }, [\n agencies,\n bbox,\n api,\n field,\n inputValue,\n limit,\n mots,\n radius,\n refLocation,\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 return (\n <StyledAutocomplete\n autoComplete\n autoHighlight\n fullWidth\n getOptionLabel={(option) => {\n return option.properties.name;\n }}\n onChange={(evt, value, reason) => {\n if (onSelect && reason === \"selectOption\") {\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 {...params}\n {...textFieldProps}\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={(liProps, option) => {\n return (\n <StopsFinderOption\n key={option.properties?.name}\n option={option}\n {...liProps}\n />\n );\n }}\n selectOnFocus\n {...props}\n inputValue={inputValue}\n loading={isLoading}\n onClose={() => {\n setOpen(false);\n }}\n onInputChange={(evt, val) => {\n setInputValue(val);\n }}\n onOpen={() => {\n setOpen(true);\n }}\n open={isOpen}\n options={suggestions}\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 * 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 * Properties apply to the default [MUI TextField component](https://material-ui.com/api/text-field/) used by the Autocomplete.\n */\n textFieldProps: PropTypes.object,\n\n /**\n * Url of the geOps StopsFinder service.\n */\n url: PropTypes.string,\n};\n\nexport default React.memo(StopsFinder);\n"],
5
- "mappings": "AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,sBAAsB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,SAAS,gBAAgB;AACpD,SAAS,gBAAgB;AAEzB,OAAO,uBAAuB;AAE9B,MAAM,qBAAqB,OAAO,YAAY,EAAE,OAAO;AAAA,EACrD,CAAC,MAAM,oBAAoB,kBAAkB,EAAE,GAAG;AAAA,IAChD,WAAW;AAAA,EACb;AACF,EAAE;AAEF,MAAM,eAAe;AAAA,EACnB,gBAAgB,CAAC;AACnB;AAEA,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,iBAAiB,aAAa;AAAA,EAC9B;AAAA,EACA,GAAG;AACL,GAAG;AACD,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,O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B,MAAM,UAAU,UAAU;AAAA,IACxB,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMD,OAAO,UAAU,UAAU;AAAA,IACzB,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA,EAKjB,KAAK,UAAU,WAAW,GAAG,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/B,MAAM,UAAU,UAAU;AAAA,IACxB,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,aAAa,UAAU,UAAU;AAAA,IAC/B,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,oBAAoB,UAAU;AAAA;AAAA;AAAA;AAAA,EAK9B,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA,EAK1B,KAAK,UAAU;AACjB;AAEA,eAAe,MAAM,KAAK,WAAW;",
4
+ "sourcesContent": ["import {\n Autocomplete,\n autocompleteClasses,\n styled,\n TextField,\n} from \"@mui/material\";\nimport CircularProgress from \"@mui/material/CircularProgress\";\nimport { StopsAPI } from \"mobility-toolbox-js/ol\";\nimport { Map } from \"ol\";\nimport PropTypes from \"prop-types\";\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport { FaSearch } from \"react-icons/fa\";\n\nimport StopsFinderOption from \"./StopsFinderOption\";\n\nconst StyledAutocomplete = styled(Autocomplete)(() => {\n return {\n [`& .${autocompleteClasses.popupIndicatorOpen}`]: {\n transform: \"rotate(0)\",\n },\n };\n});\n\nconst defaultProps = {\n textFieldProps: {},\n};\n\nfunction StopsFinder({\n agencies,\n apiKey,\n bbox,\n field,\n limit,\n map,\n mots,\n onSelect,\n radius,\n refLocation,\n renderAutocomplete,\n textFieldProps = defaultProps.textFieldProps,\n url,\n ...props\n}) {\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 api = useMemo(() => {\n const options = { apiKey };\n if (url) {\n options.url = url;\n }\n return new StopsAPI(options);\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 const apiParams = {\n bbox: bbox?.toString(),\n field: field?.toString(),\n limit,\n mots: mots?.toString(),\n prefAgencies: agencies?.toString(),\n q: inputValue,\n radius,\n ref_location: refLocation?.toString(),\n };\n api\n .search(apiParams, abortController)\n .then((featureCollection) => {\n setSuggestions(featureCollection?.features || []);\n setLoading(false);\n })\n .catch((error) => {\n // different from AbortError\n if (error.code !== 20) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n });\n return () => {\n abortController.abort();\n };\n }, [\n agencies,\n bbox,\n api,\n field,\n inputValue,\n limit,\n mots,\n radius,\n refLocation,\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 return (\n <StyledAutocomplete\n autoComplete\n autoHighlight\n fullWidth\n getOptionLabel={(option) => {\n return option.properties.name;\n }}\n onChange={(evt, value, reason) => {\n if (onSelect && reason === \"selectOption\") {\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 {...params}\n {...textFieldProps}\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={(liProps, option) => {\n return (\n <StopsFinderOption\n key={option.properties?.name}\n option={option}\n {...liProps}\n />\n );\n }}\n selectOnFocus\n {...props}\n inputValue={inputValue}\n loading={isLoading}\n onClose={() => {\n setOpen(false);\n }}\n onInputChange={(evt, val) => {\n setInputValue(val);\n }}\n onOpen={() => {\n setOpen(true);\n }}\n open={isOpen}\n options={suggestions}\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 * 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 * Properties apply to the default [MUI TextField component](https://material-ui.com/api/text-field/) used by the Autocomplete.\n */\n textFieldProps: PropTypes.object,\n\n /**\n * Url of the geOps StopsFinder service.\n */\n url: PropTypes.string,\n};\n\nexport default React.memo(StopsFinder);\n"],
5
+ "mappings": "AA8HiB,SAUD,UAVC,KAUD,YAVC;AA9HjB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,sBAAsB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,SAAS,gBAAgB;AACpD,SAAS,gBAAgB;AAEzB,OAAO,uBAAuB;AAE9B,MAAM,qBAAqB,OAAO,YAAY,EAAE,MAAM;AACpD,SAAO;AAAA,IACL,CAAC,MAAM,oBAAoB,kBAAkB,EAAE,GAAG;AAAA,MAChD,WAAW;AAAA,IACb;AAAA,EACF;AACF,CAAC;AAED,MAAM,eAAe;AAAA,EACnB,gBAAgB,CAAC;AACnB;AAEA,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,iBAAiB,aAAa;AAAA,EAC9B;AAAA,EACA,GAAG;AACL,GAAG;AACD,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,KAAK;AAExC,QAAM,MAAM,QAAQ,MAAM;AACxB,UAAM,UAAU,EAAE,OAAO;AACzB,QAAI,KAAK;AACP,cAAQ,MAAM;AAAA,IAChB;AACA,WAAO,IAAI,SAAS,OAAO;A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,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA,EAKjB,KAAK,UAAU,WAAW,GAAG,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/B,MAAM,UAAU,UAAU;AAAA,IACxB,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,aAAa,UAAU,UAAU;AAAA,IAC/B,UAAU;AAAA,IACV,UAAU,QAAQ,UAAU,MAAM;AAAA,EACpC,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,oBAAoB,UAAU;AAAA;AAAA;AAAA;AAAA,EAK9B,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA,EAK1B,KAAK,UAAU;AACjB;AAEA,eAAe,MAAM,KAAK,WAAW;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
1
2
  import { CircularProgress, styled } from "@mui/material";
2
3
  import PropTypes from "prop-types";
3
4
  import React, { lazy, Suspense } from "react";
@@ -17,19 +18,24 @@ const iconForMot = {};
17
18
  return import(`../../images/mots/${mot}${ext}`);
18
19
  });
19
20
  });
20
- const StyledFlex = styled("div")(() => ({
21
- alignItems: "center",
22
- display: "flex",
23
- gap: 5
24
- }));
21
+ const StyledFlex = styled("div")(() => {
22
+ return {
23
+ alignItems: "center",
24
+ display: "flex",
25
+ gap: 5
26
+ };
27
+ });
25
28
  function StopsFinderOption({ option, ...props }) {
26
- return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(CircularProgress, { size: 20 }) }, /* @__PURE__ */ React.createElement(StyledFlex, { ...props }, Object.entries(option.properties?.mot).map(([key, value]) => {
27
- if (value) {
28
- const MotIcon = iconForMot[key];
29
- return /* @__PURE__ */ React.createElement(StyledFlex, { key }, /* @__PURE__ */ React.createElement(MotIcon, null));
30
- }
31
- return null;
32
- }), /* @__PURE__ */ React.createElement("span", null, option.properties.name)));
29
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(CircularProgress, { size: 20 }), children: /* @__PURE__ */ jsxs(StyledFlex, { ...props, children: [
30
+ Object.entries(option.properties?.mot).map(([key, value]) => {
31
+ if (value) {
32
+ const MotIcon = iconForMot[key];
33
+ return /* @__PURE__ */ jsx(StyledFlex, { children: /* @__PURE__ */ jsx(MotIcon, {}) }, key);
34
+ }
35
+ return null;
36
+ }),
37
+ /* @__PURE__ */ jsx("span", { children: option.properties.name })
38
+ ] }) });
33
39
  }
34
40
  StopsFinderOption.propTypes = {
35
41
  option: PropTypes.object.isRequired
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/StopsFinder/StopsFinderOption.js"],
4
- "sourcesContent": ["/* eslint-disable react/jsx-props-no-spreading */\nimport { CircularProgress, styled } from \"@mui/material\";\nimport PropTypes from \"prop-types\";\nimport React, { lazy, Suspense } from \"react\";\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 StyledFlex = styled(\"div\")(() => ({\n alignItems: \"center\",\n display: \"flex\",\n gap: 5,\n}));\n\nfunction StopsFinderOption({ option, ...props }) {\n return (\n <Suspense fallback={<CircularProgress size={20} />}>\n <StyledFlex {...props}>\n {Object.entries(option.properties?.mot).map(([key, value]) => {\n if (value) {\n const MotIcon = iconForMot[key];\n return (\n <StyledFlex key={key}>\n <MotIcon />\n </StyledFlex>\n );\n }\n return null;\n })}\n <span>{option.properties.name}</span>\n </StyledFlex>\n </Suspense>\n );\n}\n\nStopsFinderOption.propTypes = {\n option: PropTypes.object.isRequired,\n};\n\nexport default React.memo(StopsFinderOption);\n"],
5
- "mappings": "AACA,SAAS,kBAAkB,cAAc;AACzC,OAAO,eAAe;AACtB,OAAO,SAAS,MAAM,gBAAgB;AAEtC,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,GAAG,IAAI,KAAK,MAAM;AAC3B,WAAO,OAAO,qBAAqB,GAAG,GAAG,GAAG;AAAA,EAC9C,CAAC;AACH,CAAC;AAED,MAAM,aAAa,OAAO,KAAK,EAAE,OAAO;AAAA,EACtC,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,KAAK;AACP,EAAE;AAEF,SAAS,kBAAkB,EAAE,QAAQ,GAAG,MAAM,GAAG;AAC/C,SACE,oCAAC,YAAS,UAAU,oCAAC,oBAAiB,MAAM,IAAI,KAC9C,oCAAC,cAAY,GAAG,SACb,OAAO,QAAQ,OAAO,YAAY,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAC5D,QAAI,OAAO;AACT,YAAM,UAAU,WAAW,GAAG;AAC9B,aACE,oCAAC,cAAW,OACV,oCAAC,aAAQ,CACX;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,CAAC,GACD,oCAAC,cAAM,OAAO,WAAW,IAAK,CAChC,CACF;AAEJ;AAEA,kBAAkB,YAAY;AAAA,EAC5B,QAAQ,UAAU,OAAO;AAC3B;AAEA,eAAe,MAAM,KAAK,iBAAiB;",
4
+ "sourcesContent": ["import { CircularProgress, styled } from \"@mui/material\";\nimport PropTypes from \"prop-types\";\nimport React, { lazy, Suspense } from \"react\";\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 StyledFlex = styled(\"div\")(() => {\n return {\n alignItems: \"center\",\n display: \"flex\",\n gap: 5,\n };\n});\n\nfunction StopsFinderOption({ option, ...props }) {\n return (\n <Suspense fallback={<CircularProgress size={20} />}>\n <StyledFlex {...props}>\n {Object.entries(option.properties?.mot).map(([key, value]) => {\n if (value) {\n const MotIcon = iconForMot[key];\n return (\n <StyledFlex key={key}>\n <MotIcon />\n </StyledFlex>\n );\n }\n return null;\n })}\n <span>{option.properties.name}</span>\n </StyledFlex>\n </Suspense>\n );\n}\n\nStopsFinderOption.propTypes = {\n option: PropTypes.object.isRequired,\n};\n\nexport default React.memo(StopsFinderOption);\n"],
5
+ "mappings": "AA+BwB,cAClB,YADkB;AA/BxB,SAAS,kBAAkB,cAAc;AACzC,OAAO,eAAe;AACtB,OAAO,SAAS,MAAM,gBAAgB;AAEtC,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,GAAG,IAAI,KAAK,MAAM;AAC3B,WAAO,OAAO,qBAAqB,GAAG,GAAG,GAAG;AAAA,EAC9C,CAAC;AACH,CAAC;AAED,MAAM,aAAa,OAAO,KAAK,EAAE,MAAM;AACrC,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,KAAK;AAAA,EACP;AACF,CAAC;AAED,SAAS,kBAAkB,EAAE,QAAQ,GAAG,MAAM,GAAG;AAC/C,SACE,oBAAC,YAAS,UAAU,oBAAC,oBAAiB,MAAM,IAAI,GAC9C,+BAAC,cAAY,GAAG,OACb;AAAA,WAAO,QAAQ,OAAO,YAAY,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAC5D,UAAI,OAAO;AACT,cAAM,UAAU,WAAW,GAAG;AAC9B,eACE,oBAAC,cACC,8BAAC,WAAQ,KADM,GAEjB;AAAA,MAEJ;AACA,aAAO;AAAA,IACT,CAAC;AAAA,IACD,oBAAC,UAAM,iBAAO,WAAW,MAAK;AAAA,KAChC,GACF;AAEJ;AAEA,kBAAkB,YAAY;AAAA,EAC5B,QAAQ,UAAU,OAAO;AAC3B;AAEA,eAAe,MAAM,KAAK,iBAAiB;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
1
2
  import { ZoomSlider } from "ol/control";
2
3
  import { easeOut } from "ol/easing";
3
4
  import OLMap from "ol/Map";
@@ -73,8 +74,8 @@ function Zoom({
73
74
  zoomIn: "Zoom in",
74
75
  zoomOut: "Zoom out"
75
76
  },
76
- zoomInChildren = /* @__PURE__ */ React.createElement(FaPlus, { focusable: false }),
77
- zoomOutChildren = /* @__PURE__ */ React.createElement(FaMinus, { focusable: false }),
77
+ zoomInChildren = /* @__PURE__ */ jsx(FaPlus, { focusable: false }),
78
+ zoomOutChildren = /* @__PURE__ */ jsx(FaMinus, { focusable: false }),
78
79
  zoomSlider = false,
79
80
  ...other
80
81
  }) {
@@ -126,9 +127,8 @@ function Zoom({
126
127
  }
127
128
  };
128
129
  }, [map, zoomSlider]);
129
- return (
130
- // eslint-disable-next-line react/jsx-props-no-spreading
131
- /* @__PURE__ */ React.createElement("div", { className: "rs-zooms-bar", ...other }, /* @__PURE__ */ React.createElement(
130
+ return /* @__PURE__ */ jsxs("div", { className: "rs-zooms-bar", ...other, children: [
131
+ /* @__PURE__ */ jsx(
132
132
  "button",
133
133
  {
134
134
  className: "rs-zoom-in",
@@ -137,10 +137,12 @@ function Zoom({
137
137
  onKeyPress: zoomIn,
138
138
  tabIndex: 0,
139
139
  title: titles.zoomIn,
140
- type: "button"
141
- },
142
- zoomInChildren
143
- ), zoomSlider ? /* @__PURE__ */ React.createElement("div", { className: "rs-zoomslider-wrapper", ref }) : null, /* @__PURE__ */ React.createElement(
140
+ type: "button",
141
+ children: zoomInChildren
142
+ }
143
+ ),
144
+ zoomSlider ? /* @__PURE__ */ jsx("div", { className: "rs-zoomslider-wrapper", ref }) : null,
145
+ /* @__PURE__ */ jsx(
144
146
  "button",
145
147
  {
146
148
  className: "rs-zoom-out",
@@ -149,11 +151,11 @@ function Zoom({
149
151
  onKeyPress: zoomOut,
150
152
  tabIndex: 0,
151
153
  title: titles.zoomOut,
152
- type: "button"
153
- },
154
- zoomOutChildren
155
- ))
156
- );
154
+ type: "button",
155
+ children: zoomOutChildren
156
+ }
157
+ )
158
+ ] });
157
159
  }
158
160
  Zoom.propTypes = propTypes;
159
161
  export default React.memo(Zoom);