@geops/rvf-mobility-web-component 0.1.45 → 0.1.47-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.js +3 -1
- package/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/doc/package.json +4 -3
- package/doc/postcss.config.mjs +1 -1
- package/doc/src/app/components/GeopsMobilityDoc.tsx +13 -224
- package/doc/src/app/components/GeopsMobilitySearchDoc.tsx +11 -107
- package/doc/src/app/components/WebComponentDoc.tsx +45 -56
- package/doc/src/app/geops-mobility/page.tsx +7 -2
- package/doc/src/app/geops-mobility-search/page.tsx +6 -2
- package/doc/src/app/globals.css +47 -27
- package/doc/src/app/layout.tsx +4 -2
- package/docutils.js +33 -17
- package/eslint.config.mjs +28 -34
- package/iframe.html +5624 -201
- package/index.html +108 -88
- package/index.js +2229 -1976
- package/input.css +21 -3
- package/package.json +37 -40
- package/scripts/build.mjs +2 -2
- package/scripts/dev.mjs +3 -3
- package/search.html +70 -23
- package/src/BaseLayer/BaseLayer.tsx +2 -1
- package/src/Copyright/Copyright.tsx +4 -2
- package/src/DebugDeparture/DebugDeparture.tsx +16 -12
- package/src/DebugStop/DebugStop.tsx +2 -2
- package/src/Departure/Departure.tsx +2 -3
- package/src/EmbedNavigation/DragPanWarning.ts +125 -0
- package/src/EmbedNavigation/EmbedNavigation.tsx +52 -0
- package/src/EmbedNavigation/index.js +1 -0
- package/src/EmbedNavigation/index.tsx +1 -0
- package/src/GeolocationButton/GeolocationButton.tsx +11 -35
- package/src/GeolocationButton/index.tsx +1 -1
- package/src/Map/Map.tsx +5 -3
- package/src/MapDispatchEvents/MapDispatchEvents.tsx +78 -0
- package/src/MapDispatchEvents/index.tsx +1 -0
- package/src/MobilityMap/MobilityMap.tsx +117 -162
- package/src/MobilityMap/MobilityMapAttributes.test.ts +21 -0
- package/src/MobilityMap/MobilityMapAttributes.ts +243 -0
- package/src/MobilityMap/index.tsx +1 -0
- package/src/MobilitySearch/MobilitySearch.tsx +35 -0
- package/src/MobilitySearch/MobilitySearchAttributes.test.ts +21 -0
- package/src/MobilitySearch/MobilitySearchAttributes.ts +68 -0
- package/src/MobilitySearch/index.ts +2 -0
- package/src/NotificationLayer/NotificationLayer.tsx +27 -4
- package/src/Overlay/Overlay.tsx +24 -11
- package/src/Permalink/Permalink.tsx +77 -0
- package/src/Permalink/index.tsx +1 -0
- package/src/RealtimeLayer/RealtimeLayer.tsx +72 -33
- package/src/RouteDestination/RouteDestination.tsx +3 -3
- package/src/RouteIcon/RouteIcon.tsx +33 -25
- package/src/RouteIcon/index.tsx +1 -1
- package/src/RouteIdentifier/RouteIdentifer.tsx +6 -5
- package/src/RouteInfos/RouteInfos.tsx +7 -3
- package/src/RouteSchedule/RouteSchedule.tsx +3 -3
- package/src/RouteScheduleFooter/RouteScheduleFooter.tsx +1 -1
- package/src/RouteScheduleHeader/RouteScheduleHeader.tsx +7 -29
- package/src/RouteStop/RouteStop.tsx +8 -11
- package/src/RouteStopDelay/RouteStopDelay.tsx +2 -1
- package/src/RouteStopName/RouteStopName.tsx +2 -2
- package/src/RouteStopPlatform/RouteStopPlatform.tsx +2 -2
- package/src/RouteStopProgress/RouteStopProgress.tsx +2 -1
- package/src/RouteStopServices/RouteStopServices.tsx +2 -2
- package/src/RouteStopStation/RouteStopStation.tsx +8 -2
- package/src/RouteStopTime/RouteStopTime.tsx +2 -1
- package/src/RvfButton/RvfButton.tsx +14 -5
- package/src/RvfCheckbox/RvfCheckbox.tsx +8 -8
- package/src/RvfEmbedNavigation/DragPanWarning.ts +5 -5
- package/src/RvfEmbedNavigation/RvfEmbedNavigation.tsx +1 -0
- package/src/RvfExportMenu/RvfExportMenu.tsx +14 -12
- package/src/RvfExportMenuButton/RvfExportMenuButton.tsx +6 -7
- package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +5 -5
- package/src/RvfFeatureDetails/RvfLineNetworkDetails/RvfLineNetworkDetails.tsx +164 -138
- package/src/RvfFeatureDetails/RvfNotificationDetails/RvfNotificationDetails.tsx +151 -109
- package/src/RvfFeatureDetails/RvfSellingPointDetails/RvfSellingPointDetails.tsx +2 -2
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/FloatingVehiclesDetails/FloatingVehiclesDetails.tsx +3 -3
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/RvfSharedMobilityDetails.tsx +8 -6
- package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/StationDetails.tsx +5 -4
- package/src/RvfFeatureDetailsTitle/RvfFeatureDetailsTitle.tsx +81 -0
- package/src/RvfFeatureDetailsTitle/index.tsx +1 -0
- package/src/RvfFloatingMenu/RvfFloatingMenu.tsx +4 -4
- package/src/RvfGeolocationButton/GeolocationButton.tsx +98 -0
- package/src/RvfGeolocationButton/index.tsx +1 -0
- package/src/RvfIconButton/RvfIconButton.tsx +20 -9
- package/src/RvfInputCopy/RvfInputCopy.tsx +8 -8
- package/src/RvfLayerTree/RvfLayerTree.tsx +5 -2
- package/src/RvfLayerTree/TreeItem/TreeItem.tsx +13 -16
- package/src/RvfLayerTree/layersTreeReducer.ts +23 -18
- package/src/RvfLayerTreeButton/RvfLayerTreeButton.tsx +6 -6
- package/src/RvfLineNetworkPlanLayer/RvfLineNetworkPlanLayer.tsx +2 -1
- package/src/RvfLink/RvfLink.tsx +4 -3
- package/src/RvfMobilityMap/RvfMobilityMap.tsx +314 -322
- package/src/RvfModal/RvfModal.tsx +4 -3
- package/src/RvfOverlayContent/RvfOverlayContent.tsx +126 -0
- package/src/RvfOverlayContent/index.ts +0 -0
- package/src/RvfOverlayHeader/RvfOverlayHeader.tsx +13 -10
- package/src/RvfPermalink/RvfPermalink.tsx +2 -2
- package/src/RvfPoisLayer/RvfPoisLayer.tsx +2 -1
- package/src/RvfRadioButton/RvfRadioButton.tsx +1 -1
- package/src/RvfRouteIcon/RvfRouteIcon.tsx +10 -0
- package/src/RvfRouteIcon/index.tsx +1 -0
- package/src/RvfSearch/RvfSearch.tsx +4 -1
- package/src/RvfSearchButton/RvfSearchButton.tsx +27 -0
- package/src/RvfSearchButton/index.tsx +1 -0
- package/src/RvfSelect/RvfSelect.tsx +7 -5
- package/src/RvfSelectedFeatureHighlightLayer/RvfSelectedFeatureHighlightLayer.tsx +1 -2
- package/src/RvfSellingPointsLayer/RvfSellingPointsLayer.tsx +2 -1
- package/src/RvfShare/RvfPermalinkButton/RvfPermalinkButton.tsx +13 -12
- package/src/RvfShare/RvfShare.tsx +11 -10
- package/src/RvfShareMenuButton/RvfShareMenuButton.tsx +5 -5
- package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +25 -22
- package/src/RvfSingleClickListener/RvfSingleClickListener.tsx +46 -31
- package/src/RvfTarifZonenLayer/RvfTarifZonenLayer.tsx +2 -1
- package/src/RvfTopics/RvfTopics.tsx +6 -5
- package/src/RvfZoomButtons/RvfZoomButtons.tsx +3 -3
- package/src/ScaleLine/ScaleLine.tsx +5 -4
- package/src/ScrollableHandler/ScrollableHandler.tsx +2 -1
- package/src/ScrollableHandler/index.tsx +1 -1
- package/src/SingleClickListener/SingleClickListener.tsx +47 -4
- package/src/Station/Station.tsx +5 -5
- package/src/StationName/StationName.tsx +3 -3
- package/src/StationServices/StationServices.tsx +3 -3
- package/src/StationsLayer/StationsLayer.tsx +5 -4
- package/src/StopsSearch/StopsSearch.tsx +115 -84
- package/src/WindowMessageListener/WindowMessageListener.tsx +67 -0
- package/src/WindowMessageListener/index.tsx +1 -0
- package/src/icons/Airport/Airport.tsx +4 -4
- package/src/icons/ArrowDown/ArrowDown.tsx +1 -1
- package/src/icons/ArrowUp/ArrowUp.tsx +1 -1
- package/src/icons/ArrowUpRight/ArrowUpRight.tsx +1 -1
- package/src/icons/BarAndRestaurants/BarAndRestaurants.tsx +2 -2
- package/src/icons/Bathroom/Bathroom.tsx +1 -1
- package/src/icons/Copy/Copy.tsx +1 -1
- package/src/icons/Doc/Doc.tsx +1 -1
- package/src/icons/Email/Email.tsx +1 -1
- package/src/icons/FilePdf/FilePdf.tsx +1 -1
- package/src/icons/Geolocation/Geolocation.tsx +3 -5
- package/src/icons/Image/Image.tsx +1 -1
- package/src/icons/Menu/Menu.tsx +1 -1
- package/src/icons/Minus/Minus.tsx +1 -1
- package/src/icons/NoRealtime/NoRealtime.tsx +1 -1
- package/src/icons/Plus/Plus.tsx +1 -1
- package/src/icons/Police/Police.tsx +3 -3
- package/src/icons/Share/Share.tsx +1 -1
- package/src/icons/Stack/Stack.tsx +1 -1
- package/src/icons/Tracking/Tracking.tsx +29 -0
- package/src/icons/Tracking/airport-14-svgrepo-com.svg +41 -0
- package/src/icons/Tracking/index.tsx +1 -0
- package/src/icons/WaitingAreas/WaitingAreas.tsx +1 -1
- package/src/icons/WheelChair/WheelChair.tsx +1 -1
- package/src/index.tsx +8 -46
- package/src/indexDoc.ts +13 -0
- package/src/ui/Button/Button.tsx +57 -0
- package/src/ui/Button/index.tsx +1 -0
- package/src/ui/IconButton/IconButton.tsx +44 -0
- package/src/ui/IconButton/index.tsx +1 -0
- package/src/utils/MobilityEvent.ts +4 -3
- package/src/utils/applyInitialLayerVisibility.ts +3 -3
- package/src/utils/centerOnStation.ts +3 -2
- package/src/utils/centerOnVehicle.ts +5 -4
- package/src/utils/constants.ts +17 -3
- package/src/utils/exportPdf.ts +26 -20
- package/src/utils/fullTrajectoryStyle.ts +2 -2
- package/src/utils/getAllLayers.ts +4 -3
- package/src/utils/getDelayColor.test.ts +1 -0
- package/src/utils/getDelayColorForVehicle.test.ts +2 -0
- package/src/utils/getDelayString.test.ts +3 -0
- package/src/utils/getDelayTextForVehicle.test.ts +4 -0
- package/src/utils/getFullTrajectoryAndFit.ts +4 -3
- package/src/utils/getHoursAndMinutes.test.ts +1 -0
- package/src/utils/getLayersAsFlatArray.ts +2 -2
- package/src/utils/getLinkByDevice.ts +1 -1
- package/src/utils/getMainColorForVehicle.ts +3 -3
- package/src/utils/getPermalinkParameters.ts +2 -2
- package/src/utils/getStopStatus.test.ts +2 -1
- package/src/utils/getStopStatus.ts +1 -1
- package/src/utils/getTextForVehicle.ts +1 -1
- package/src/utils/hooks/useDeparture.tsx +6 -5
- package/src/utils/hooks/useI18n.tsx +6 -4
- package/src/utils/hooks/useInitialLayersVisiblity.tsx +2 -1
- package/src/utils/hooks/useLayerConfig.tsx +39 -0
- package/src/utils/hooks/useMapContext.tsx +30 -18
- package/src/utils/hooks/useRouteStop.tsx +3 -2
- package/src/utils/hooks/useRvfContext.tsx +11 -3
- package/src/utils/hooks/useStation.tsx +2 -1
- package/src/utils/hooks/useUpdatePermalink.tsx +25 -24
- package/src/utils/hooks/useZoom.tsx +4 -4
- package/src/utils/realtimeRVFStyle.ts +5 -4
- package/src/utils/sharingGraphqlUtils.ts +3 -2
- package/src/utils/sharingStylesUtils.ts +7 -7
- package/src/utils/sharingWFSUtils.ts +9 -15
- package/tailwind.config.mjs +1 -0
- package/tsconfig.json +1 -1
- package/doc/tailwind.config.ts +0 -20
- package/src/utils/getFeatureInformationTitle.tsx +0 -54
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import debounce from "lodash.debounce";
|
|
2
2
|
import { StopsAPI } from "mobility-toolbox-js/api";
|
|
3
|
-
import { StopsResponse } from "mobility-toolbox-js/types";
|
|
4
|
-
import { JSX, PreactDOMAttributes } from "preact";
|
|
5
3
|
import { memo } from "preact/compat";
|
|
6
4
|
import {
|
|
7
5
|
useCallback,
|
|
@@ -10,34 +8,42 @@ import {
|
|
|
10
8
|
useRef,
|
|
11
9
|
useState,
|
|
12
10
|
} from "preact/hooks";
|
|
11
|
+
import { twMerge } from "tailwind-merge";
|
|
13
12
|
|
|
14
13
|
import Cancel from "../icons/Cancel";
|
|
15
14
|
import Search from "../icons/Search";
|
|
16
|
-
|
|
17
|
-
import tailwind from "../style.css";
|
|
18
|
-
import i18n from "../utils/i18n";
|
|
15
|
+
import useI18n from "../utils/hooks/useI18n";
|
|
19
16
|
import MobilityEvent from "../utils/MobilityEvent";
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
import type { StopsParameters, StopsResponse } from "mobility-toolbox-js/types";
|
|
19
|
+
import type { HTMLAttributes, PreactDOMAttributes } from "preact";
|
|
20
|
+
|
|
21
|
+
export type StopsFeature = StopsResponse["features"];
|
|
22
|
+
|
|
23
|
+
export type StopsSearchProps = {
|
|
22
24
|
apikey: string;
|
|
23
25
|
bbox?: string;
|
|
26
|
+
className?: string;
|
|
24
27
|
countrycode?: string;
|
|
25
28
|
event?: string;
|
|
26
29
|
field?: string;
|
|
30
|
+
inputClassName?: string;
|
|
27
31
|
limit?: number;
|
|
28
32
|
mots?: string;
|
|
29
|
-
onselect?: (arg:
|
|
33
|
+
onselect?: (arg: StopsFeature) => void;
|
|
30
34
|
params?: string; // JSONstring
|
|
31
35
|
prefagencies?: string;
|
|
32
36
|
reflocation?: string;
|
|
37
|
+
resultClassName?: string;
|
|
38
|
+
resultsClassName?: string;
|
|
39
|
+
resultsContainerClassName?: string;
|
|
33
40
|
url: string;
|
|
34
|
-
|
|
41
|
+
withResultsClassName?: string;
|
|
42
|
+
} & HTMLAttributes<HTMLDivElement> &
|
|
35
43
|
PreactDOMAttributes;
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const getQueryForSelectedStation = (selectedStation: StationFeature) => {
|
|
40
|
-
return selectedStation.properties.name;
|
|
45
|
+
const getQueryForSelectedStation = (selectedStation?: StopsFeature): string => {
|
|
46
|
+
return selectedStation?.properties?.name || "";
|
|
41
47
|
};
|
|
42
48
|
|
|
43
49
|
/**
|
|
@@ -48,26 +54,32 @@ const getQueryForSelectedStation = (selectedStation: StationFeature) => {
|
|
|
48
54
|
function StopsSearch({
|
|
49
55
|
apikey,
|
|
50
56
|
bbox,
|
|
57
|
+
className,
|
|
51
58
|
countrycode,
|
|
52
59
|
event,
|
|
53
60
|
field,
|
|
61
|
+
inputClassName,
|
|
54
62
|
limit,
|
|
55
63
|
mots,
|
|
56
64
|
onselect,
|
|
57
65
|
params,
|
|
58
66
|
prefagencies,
|
|
59
67
|
reflocation,
|
|
68
|
+
resultClassName,
|
|
69
|
+
resultsClassName,
|
|
70
|
+
resultsContainerClassName,
|
|
60
71
|
url = "https://api.geops.io/stops/v1/",
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
withResultsClassName,
|
|
73
|
+
}: StopsSearchProps) {
|
|
74
|
+
const { t } = useI18n();
|
|
63
75
|
const [query, setQuery] = useState("");
|
|
64
|
-
const [selectedStation, setSelectedStation] = useState<
|
|
65
|
-
const [results, setResults] = useState<
|
|
76
|
+
const [selectedStation, setSelectedStation] = useState<StopsFeature>();
|
|
77
|
+
const [results, setResults] = useState<StopsFeature[] | undefined>();
|
|
66
78
|
const myRef = useRef<HTMLDivElement>();
|
|
67
79
|
|
|
68
80
|
useEffect(() => {
|
|
69
81
|
myRef.current?.dispatchEvent(
|
|
70
|
-
new MobilityEvent<
|
|
82
|
+
new MobilityEvent<StopsSearchProps>("mwc:attribute", {
|
|
71
83
|
apikey,
|
|
72
84
|
bbox,
|
|
73
85
|
countrycode,
|
|
@@ -102,8 +114,8 @@ function StopsSearch({
|
|
|
102
114
|
}, [apikey, url]);
|
|
103
115
|
|
|
104
116
|
const dispatchEvent = useCallback(
|
|
105
|
-
(station?:
|
|
106
|
-
const customEvt = new MobilityEvent<
|
|
117
|
+
(station?: StopsFeature) => {
|
|
118
|
+
const customEvt = new MobilityEvent<StopsFeature>(
|
|
107
119
|
event || "mwc:stopssearchselect",
|
|
108
120
|
station,
|
|
109
121
|
{
|
|
@@ -121,24 +133,25 @@ function StopsSearch({
|
|
|
121
133
|
);
|
|
122
134
|
|
|
123
135
|
const debouncedSearch = useMemo(() => {
|
|
124
|
-
let abortCtrl: AbortController;
|
|
125
|
-
|
|
136
|
+
let abortCtrl: AbortController | undefined;
|
|
137
|
+
|
|
138
|
+
return debounce((q) => {
|
|
126
139
|
abortCtrl?.abort();
|
|
127
140
|
abortCtrl = new AbortController();
|
|
141
|
+
|
|
142
|
+
const reqParams = {
|
|
143
|
+
bbox,
|
|
144
|
+
field,
|
|
145
|
+
limit,
|
|
146
|
+
mots,
|
|
147
|
+
prefagencies,
|
|
148
|
+
q,
|
|
149
|
+
ref_location: reflocation,
|
|
150
|
+
...JSON.parse(params || "{}"),
|
|
151
|
+
} as StopsParameters;
|
|
152
|
+
|
|
128
153
|
api
|
|
129
|
-
.search(
|
|
130
|
-
{
|
|
131
|
-
bbox,
|
|
132
|
-
field,
|
|
133
|
-
limit,
|
|
134
|
-
mots,
|
|
135
|
-
prefagencies,
|
|
136
|
-
q,
|
|
137
|
-
ref_location: reflocation,
|
|
138
|
-
...JSON.parse(params || "{}"),
|
|
139
|
-
},
|
|
140
|
-
{ signal: abortCtrl.signal },
|
|
141
|
-
)
|
|
154
|
+
.search(reqParams, { signal: abortCtrl.signal })
|
|
142
155
|
.then((res: StopsResponse) => {
|
|
143
156
|
setResults(
|
|
144
157
|
res.features.filter((f) => {
|
|
@@ -149,6 +162,7 @@ function StopsSearch({
|
|
|
149
162
|
.catch((e) => {
|
|
150
163
|
// AbortError is expected
|
|
151
164
|
if (e.code !== 20) {
|
|
165
|
+
// eslint-disable-next-line no-console
|
|
152
166
|
console.error("Failed to fetch stations", e);
|
|
153
167
|
return;
|
|
154
168
|
}
|
|
@@ -195,28 +209,31 @@ function StopsSearch({
|
|
|
195
209
|
|
|
196
210
|
return (
|
|
197
211
|
<>
|
|
198
|
-
<style>{tailwind}</style>
|
|
199
|
-
{/* <div className="relative z-0 rounded-md bg-white" > */}
|
|
200
212
|
<div
|
|
201
|
-
className={
|
|
202
|
-
"flex h-16 items-center gap-4 rounded-md bg-white p-4 pt-3.5 shadow"
|
|
203
|
-
|
|
213
|
+
className={twMerge(
|
|
214
|
+
"flex h-16 items-center gap-4 rounded-md bg-white p-4 pt-3.5 shadow",
|
|
215
|
+
className,
|
|
216
|
+
results ? withResultsClassName : "",
|
|
217
|
+
)}
|
|
204
218
|
ref={myRef}
|
|
205
219
|
>
|
|
206
|
-
<div className={"flex items-center
|
|
220
|
+
<div className={"text-grey flex items-center"}>
|
|
207
221
|
<Search className="size-4" />
|
|
208
222
|
</div>
|
|
209
223
|
<div className={"flex grow overflow-hidden border-b-2 border-solid"}>
|
|
210
224
|
<input
|
|
211
225
|
autoComplete="off"
|
|
212
|
-
className=
|
|
226
|
+
className={twMerge(
|
|
227
|
+
"h-8 flex-1 outline-0 placeholder:text-zinc-400",
|
|
228
|
+
inputClassName,
|
|
229
|
+
)}
|
|
213
230
|
id="searchfield"
|
|
214
|
-
onChange={(
|
|
231
|
+
onChange={(evt) => {
|
|
215
232
|
// @ts-expect-error target is missing
|
|
216
|
-
setQuery(
|
|
233
|
+
setQuery(evt.target.value);
|
|
217
234
|
}}
|
|
218
|
-
onKeyUp={(
|
|
219
|
-
if (
|
|
235
|
+
onKeyUp={(evt: JSX.TargetedKeyboardEvent<HTMLInputElement>) => {
|
|
236
|
+
if (evt.key === "Enter") {
|
|
220
237
|
if (results?.length > 0) {
|
|
221
238
|
setSelectedStation(results[0]);
|
|
222
239
|
}
|
|
@@ -224,7 +241,7 @@ function StopsSearch({
|
|
|
224
241
|
}}
|
|
225
242
|
placeholder={t("stops_search_placeholder")}
|
|
226
243
|
type="text"
|
|
227
|
-
value={query}
|
|
244
|
+
value={query || ""}
|
|
228
245
|
/>
|
|
229
246
|
{query.length > 0 && (
|
|
230
247
|
<button
|
|
@@ -234,50 +251,64 @@ function StopsSearch({
|
|
|
234
251
|
setResults(undefined);
|
|
235
252
|
}}
|
|
236
253
|
>
|
|
237
|
-
<Cancel className="size-4
|
|
254
|
+
<Cancel className="text-grey size-4" />
|
|
238
255
|
</button>
|
|
239
256
|
)}
|
|
240
257
|
</div>
|
|
241
258
|
</div>
|
|
242
259
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
<div
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
260
|
+
{results && (
|
|
261
|
+
<div
|
|
262
|
+
className={twMerge(
|
|
263
|
+
"flex grow overflow-auto rounded-md rounded-t-none bg-white shadow",
|
|
264
|
+
resultsContainerClassName,
|
|
265
|
+
)}
|
|
266
|
+
>
|
|
267
|
+
{results && results.length === 0 && (
|
|
268
|
+
<div
|
|
269
|
+
className={twMerge(
|
|
270
|
+
"flex grow gap-3 border border-solid p-3 pt-2 text-zinc-400",
|
|
271
|
+
resultsClassName,
|
|
272
|
+
)}
|
|
273
|
+
style={{ border: 1 }}
|
|
274
|
+
>
|
|
275
|
+
<div className="size-6"></div>
|
|
276
|
+
<div>{t("no_stops_found")}</div>
|
|
277
|
+
</div>
|
|
278
|
+
)}
|
|
279
|
+
{results && results.length > 0 && (
|
|
280
|
+
<ul
|
|
281
|
+
className={twMerge(
|
|
282
|
+
"grow rounded-md rounded-t-none border border-solid bg-white p-0",
|
|
283
|
+
resultsClassName,
|
|
284
|
+
)}
|
|
285
|
+
style={{ border: 1 }} // without this th ul is displayed 1 px on the right
|
|
286
|
+
>
|
|
287
|
+
{results?.map((station) => {
|
|
288
|
+
return (
|
|
289
|
+
<li
|
|
290
|
+
className={twMerge(
|
|
291
|
+
"border-b border-dashed border-slate-300 p-3 last:border-0",
|
|
292
|
+
resultClassName,
|
|
293
|
+
)}
|
|
294
|
+
key={station.properties.uid}
|
|
271
295
|
>
|
|
272
|
-
<
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
296
|
+
<button
|
|
297
|
+
className="flex w-full items-center gap-3 text-left"
|
|
298
|
+
onClick={() => {
|
|
299
|
+
setSelectedStation(station);
|
|
300
|
+
}}
|
|
301
|
+
>
|
|
302
|
+
<div className="size-6"></div>
|
|
303
|
+
<div className="grow">{station.properties.name}</div>
|
|
304
|
+
</button>
|
|
305
|
+
</li>
|
|
306
|
+
);
|
|
307
|
+
})}
|
|
308
|
+
</ul>
|
|
309
|
+
)}
|
|
310
|
+
</div>
|
|
311
|
+
)}
|
|
281
312
|
{/* </div> */}
|
|
282
313
|
</>
|
|
283
314
|
);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { memo } from "preact/compat";
|
|
2
|
+
import { useEffect } from "preact/hooks";
|
|
3
|
+
|
|
4
|
+
import useMapContext from "../utils/hooks/useMapContext";
|
|
5
|
+
|
|
6
|
+
import type MobilityEvent from "../utils/MobilityEvent";
|
|
7
|
+
|
|
8
|
+
const evtTypes = [
|
|
9
|
+
"mwc:permalink",
|
|
10
|
+
"mwc:selectedfeature",
|
|
11
|
+
"mwc:singleclick",
|
|
12
|
+
"mwc:attribute",
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This component propagate the web-components events to the parent window using messages events,
|
|
17
|
+
* and listen for messages from the parent window.
|
|
18
|
+
* @param param0
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
function WindowMessageListener({ eventNode }: { eventNode: HTMLElement }) {
|
|
22
|
+
const { setPreviewNotifications } = useMapContext();
|
|
23
|
+
|
|
24
|
+
// Listen to parent window message events
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const onMessage = (event) => {
|
|
27
|
+
if (event.data.situations) {
|
|
28
|
+
setPreviewNotifications(event.data.situations);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
window.addEventListener("message", onMessage);
|
|
32
|
+
return () => {
|
|
33
|
+
window.removeEventListener("message", onMessage);
|
|
34
|
+
};
|
|
35
|
+
}, [setPreviewNotifications]);
|
|
36
|
+
|
|
37
|
+
// Propagate wc events to the parent window
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!eventNode) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const postMessage = (evt: MobilityEvent<unknown>) => {
|
|
44
|
+
// Clean data before sending it to the parent
|
|
45
|
+
if (evt.type === "mwc:attribute") {
|
|
46
|
+
// @ts-expect-error children is the react property
|
|
47
|
+
delete evt.data.children;
|
|
48
|
+
}
|
|
49
|
+
window.parent?.postMessage({ data: evt.data, type: evt.type }, "*");
|
|
50
|
+
};
|
|
51
|
+
evtTypes.forEach((eventType) => {
|
|
52
|
+
eventNode.addEventListener(eventType, postMessage);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// warn the parent that the web component is listening
|
|
56
|
+
window.parent?.postMessage({ data: true, type: "mwc:messageready" }, "*");
|
|
57
|
+
|
|
58
|
+
return () => {
|
|
59
|
+
evtTypes.forEach((eventType) => {
|
|
60
|
+
eventNode.removeEventListener(eventType, postMessage);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
}, [eventNode]);
|
|
64
|
+
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
export default memo(WindowMessageListener);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./WindowMessageListener";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
function Airport({ ...props }) {
|
|
2
2
|
return (
|
|
3
3
|
<svg
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
version="1.1"
|
|
6
|
-
width="24"
|
|
7
|
-
height="24"
|
|
8
4
|
fill="currentColor"
|
|
5
|
+
height="24"
|
|
6
|
+
version="1.1"
|
|
9
7
|
viewBox="0 0 14 14"
|
|
8
|
+
width="24"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
10
|
{...props}
|
|
11
11
|
>
|
|
12
12
|
<path d="m 14,8 0,1 -6,-1 0,3 2,2 0,1 L 7,13 4,14 4,13 6,11 6,8 0,9 0,8 6,5 6,2 C 6,1 6.22222,0 7,0 7.77777,0 8,1 8,2 l 0,3 z" />
|
|
@@ -2,10 +2,10 @@ function BarAndRestaurants({ ...props }) {
|
|
|
2
2
|
return (
|
|
3
3
|
<svg
|
|
4
4
|
fill="currentColor"
|
|
5
|
-
width="24px"
|
|
6
5
|
height="24px"
|
|
7
|
-
viewBox="0 -3.84 122.88 122.88"
|
|
8
6
|
version="1.1"
|
|
7
|
+
viewBox="0 -3.84 122.88 122.88"
|
|
8
|
+
width="24px"
|
|
9
9
|
xmlns="http://www.w3.org/2000/svg"
|
|
10
10
|
{...props}
|
|
11
11
|
>
|
package/src/icons/Copy/Copy.tsx
CHANGED
package/src/icons/Doc/Doc.tsx
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function Geolocation(props: SVGProps<SVGSVGElement>) {
|
|
1
|
+
function Geolocation({ ...props }) {
|
|
4
2
|
return (
|
|
5
3
|
<svg
|
|
6
4
|
fill="currentColor"
|
|
7
5
|
focusable="false"
|
|
8
|
-
height="
|
|
6
|
+
height="24"
|
|
9
7
|
stroke="currentColor"
|
|
10
8
|
strokeWidth="0"
|
|
11
9
|
viewBox="0 0 512 512"
|
|
12
|
-
width="
|
|
10
|
+
width="24"
|
|
13
11
|
xmlns="http://www.w3.org/2000/svg"
|
|
14
12
|
{...props}
|
|
15
13
|
>
|
package/src/icons/Menu/Menu.tsx
CHANGED
package/src/icons/Plus/Plus.tsx
CHANGED
|
@@ -2,16 +2,16 @@ function Police({ ...props }) {
|
|
|
2
2
|
return (
|
|
3
3
|
<svg
|
|
4
4
|
fill="currentColor"
|
|
5
|
-
width="24px"
|
|
6
5
|
height="24px"
|
|
7
|
-
viewBox="0 0 15 15"
|
|
8
6
|
version="1.1"
|
|
7
|
+
viewBox="0 0 15 15"
|
|
8
|
+
width="24px"
|
|
9
9
|
xmlns="http://www.w3.org/2000/svg"
|
|
10
10
|
{...props}
|
|
11
11
|
>
|
|
12
12
|
<path
|
|
13
|
-
id="rect4718"
|
|
14
13
|
d="M5.5,1L6,2h5l0.5-1H5.5z M6,2.5v1.25c0,0,0,2.75,2.5,2.75S11,3.75,11,3.75V2.5H6z M1.9844,3.9863
	C1.4329,3.9949,0.9924,4.4485,1,5v4c-0.0001,0.6398,0.5922,1.1152,1.2168,0.9766L5,9.3574V14l5.8789-6.9297
	C10.7391,7.0294,10.5947,7,10.4414,7H6.5L3,7.7539V5C3.0077,4.4362,2.5481,3.9775,1.9844,3.9863z M11.748,7.7109L6.4121,14H12
	V8.5586C12,8.2451,11.9061,7.9548,11.748,7.7109z"
|
|
14
|
+
id="rect4718"
|
|
15
15
|
/>
|
|
16
16
|
</svg>
|
|
17
17
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function Tracking({ ...props }) {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
fill="none"
|
|
5
|
+
height="24"
|
|
6
|
+
part="svg"
|
|
7
|
+
viewBox="0 0 14 14"
|
|
8
|
+
width="24"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
clipRule="evenodd"
|
|
14
|
+
d="M7 0.333344C7.375 0.333344 7.66667 0.62501 7.66667 0.97921V2.35414C9.7292 2.66668 11.3333 4.27081 11.625 6.33334H13C13.375 6.33334 13.6667 6.62501 13.6667 7.00001C13.6667 7.37501 13.375 7.66668 13 7.66668H11.625C11.3333 9.70834 9.70833 11.3333 7.66667 11.625V13C7.66667 13.375 7.375 13.6667 7 13.6667C6.64587 13.6667 6.33333 13.375 6.33333 13V11.625C4.29167 11.3333 2.68747 9.70834 2.39587 7.66668H1C0.625 7.66668 0.333333 7.37501 0.333333 7.00001C0.333333 6.62501 0.625 6.33334 1 6.33334H2.39587C2.68747 4.27081 4.29167 2.66668 6.33333 2.35414V0.97921C6.33333 0.62501 6.64587 0.333344 7 0.333344ZM7 3.66668C5.16667 3.66668 3.66667 5.16668 3.66667 7.00001C3.66667 8.79168 5.08333 10.3125 7 10.3125C8.89587 10.3125 10.3333 8.81254 10.3333 7.00001C10.3333 5.16668 8.83333 3.66668 7 3.66668Z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
fillRule="evenodd"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
clipRule="evenodd"
|
|
20
|
+
d="M5.66667 7.00001C5.66667 6.27081 6.2708 5.66668 7 5.66668C7.7292 5.66668 8.33333 6.27081 8.33333 7.00001C8.33333 7.72921 7.7292 8.33334 7 8.33334C6.2708 8.33334 5.66667 7.72921 5.66667 7.00001Z"
|
|
21
|
+
fill="currentColor"
|
|
22
|
+
fillRule="evenodd"
|
|
23
|
+
part="circle"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default Tracking;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
5
|
+
<svg
|
|
6
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
7
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
8
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
9
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
version="1.1"
|
|
12
|
+
width="100%"
|
|
13
|
+
height="100%"
|
|
14
|
+
viewBox="0 0 14 14"
|
|
15
|
+
id="svg2">
|
|
16
|
+
<metadata
|
|
17
|
+
id="metadata8">
|
|
18
|
+
<rdf:RDF>
|
|
19
|
+
<cc:Work
|
|
20
|
+
rdf:about="">
|
|
21
|
+
<dc:format>image/svg+xml</dc:format>
|
|
22
|
+
<dc:type
|
|
23
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
24
|
+
<dc:title></dc:title>
|
|
25
|
+
</cc:Work>
|
|
26
|
+
</rdf:RDF>
|
|
27
|
+
</metadata>
|
|
28
|
+
<defs
|
|
29
|
+
id="defs6" />
|
|
30
|
+
<rect
|
|
31
|
+
width="14"
|
|
32
|
+
height="14"
|
|
33
|
+
x="0"
|
|
34
|
+
y="0"
|
|
35
|
+
id="canvas"
|
|
36
|
+
style="fill:none;stroke:none;visibility:hidden" />
|
|
37
|
+
<path
|
|
38
|
+
d="m 14,8 0,1 -6,-1 0,3 2,2 0,1 L 7,13 4,14 4,13 6,11 6,8 0,9 0,8 6,5 6,2 C 6,1 6.22222,0 7,0 7.77777,0 8,1 8,2 l 0,3 z"
|
|
39
|
+
id="airport"
|
|
40
|
+
style="fill:#000000;fill-opacity:1;stroke:none" />
|
|
41
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Tracking";
|