@geops/rvf-mobility-web-component 0.1.46 → 0.1.47
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 +12 -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 +181 -207
- package/index.html +108 -88
- package/index.js +2345 -1976
- package/input.css +21 -3
- package/package.json +39 -41
- 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 +252 -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 +36 -5
- 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 +25 -21
- package/src/RvfFeatureDetails/RvfLineNetworkDetails/RvfLineNetworkDetails.tsx +131 -127
- package/src/RvfFeatureDetails/RvfNotificationDetails/RvfNotificationDetails.tsx +309 -111
- 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/RvfFeatureDetailsFooter/RvfFeatureDetailsFooter.tsx +43 -0
- package/src/RvfFeatureDetailsFooter/index.tsx +1 -0
- 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 +324 -320
- package/src/RvfModal/RvfModal.tsx +4 -3
- package/src/RvfOverlayContent/RvfOverlayContent.tsx +128 -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 +102 -67
- 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 +143 -88
- package/src/WindowMessageListener/WindowMessageListener.tsx +68 -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/ArrowRight/ArrowRight.tsx +19 -0
- package/src/icons/ArrowRight/arrow-right.svg +16 -0
- package/src/icons/ArrowRight/index.tsx +1 -0
- 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/Search/Search.tsx +0 -1
- 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/Warning/Warning.tsx +56 -0
- package/src/icons/Warning/index.tsx +1 -0
- package/src/icons/Warning/info-achtung-kreisrot-rot.svg +28 -0
- 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 +27 -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 +40 -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,50 @@ 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
|
|
18
|
-
import i18n from "../utils/i18n";
|
|
15
|
+
import IconButton from "../ui/IconButton";
|
|
16
|
+
import useI18n from "../utils/hooks/useI18n";
|
|
19
17
|
import MobilityEvent from "../utils/MobilityEvent";
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
import type { StopsParameters, StopsResponse } from "mobility-toolbox-js/types";
|
|
20
|
+
import type {
|
|
21
|
+
HTMLAttributes,
|
|
22
|
+
PreactDOMAttributes,
|
|
23
|
+
TargetedKeyboardEvent,
|
|
24
|
+
} from "preact";
|
|
25
|
+
|
|
26
|
+
export type StopsFeature = StopsResponse["features"][0];
|
|
27
|
+
|
|
28
|
+
export type StopsSearchProps = {
|
|
22
29
|
apikey: string;
|
|
23
30
|
bbox?: string;
|
|
31
|
+
cancelButtonClassName?: string;
|
|
32
|
+
className?: string;
|
|
24
33
|
countrycode?: string;
|
|
25
34
|
event?: string;
|
|
26
35
|
field?: string;
|
|
36
|
+
inputClassName?: string;
|
|
37
|
+
inputContainerClassName?: string;
|
|
27
38
|
limit?: number;
|
|
28
39
|
mots?: string;
|
|
29
|
-
onselect?: (arg:
|
|
40
|
+
onselect?: (arg: StopsFeature) => void;
|
|
30
41
|
params?: string; // JSONstring
|
|
31
42
|
prefagencies?: string;
|
|
32
43
|
reflocation?: string;
|
|
44
|
+
resultClassName?: string;
|
|
45
|
+
resultsClassName?: string;
|
|
46
|
+
resultsContainerClassName?: string;
|
|
47
|
+
searchIconContainerClassName?: string;
|
|
33
48
|
url: string;
|
|
34
|
-
|
|
49
|
+
withResultsClassName?: string;
|
|
50
|
+
} & HTMLAttributes<HTMLDivElement> &
|
|
35
51
|
PreactDOMAttributes;
|
|
36
52
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const getQueryForSelectedStation = (selectedStation: StationFeature) => {
|
|
40
|
-
return selectedStation.properties.name;
|
|
53
|
+
const getQueryForSelectedStation = (selectedStation?: StopsFeature): string => {
|
|
54
|
+
return selectedStation?.properties?.name || "";
|
|
41
55
|
};
|
|
42
56
|
|
|
43
57
|
/**
|
|
@@ -48,26 +62,35 @@ const getQueryForSelectedStation = (selectedStation: StationFeature) => {
|
|
|
48
62
|
function StopsSearch({
|
|
49
63
|
apikey,
|
|
50
64
|
bbox,
|
|
65
|
+
cancelButtonClassName,
|
|
66
|
+
className,
|
|
51
67
|
countrycode,
|
|
52
68
|
event,
|
|
53
69
|
field,
|
|
70
|
+
inputClassName,
|
|
71
|
+
inputContainerClassName,
|
|
54
72
|
limit,
|
|
55
73
|
mots,
|
|
56
74
|
onselect,
|
|
57
75
|
params,
|
|
58
76
|
prefagencies,
|
|
59
77
|
reflocation,
|
|
78
|
+
resultClassName,
|
|
79
|
+
resultsClassName,
|
|
80
|
+
resultsContainerClassName,
|
|
81
|
+
searchIconContainerClassName,
|
|
60
82
|
url = "https://api.geops.io/stops/v1/",
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
withResultsClassName,
|
|
84
|
+
}: StopsSearchProps) {
|
|
85
|
+
const { t } = useI18n();
|
|
63
86
|
const [query, setQuery] = useState("");
|
|
64
|
-
const [selectedStation, setSelectedStation] = useState<
|
|
65
|
-
const [results, setResults] = useState<
|
|
87
|
+
const [selectedStation, setSelectedStation] = useState<StopsFeature>();
|
|
88
|
+
const [results, setResults] = useState<StopsFeature[] | undefined>();
|
|
66
89
|
const myRef = useRef<HTMLDivElement>();
|
|
67
90
|
|
|
68
91
|
useEffect(() => {
|
|
69
92
|
myRef.current?.dispatchEvent(
|
|
70
|
-
new MobilityEvent<
|
|
93
|
+
new MobilityEvent<StopsSearchProps>("mwc:attribute", {
|
|
71
94
|
apikey,
|
|
72
95
|
bbox,
|
|
73
96
|
countrycode,
|
|
@@ -102,8 +125,8 @@ function StopsSearch({
|
|
|
102
125
|
}, [apikey, url]);
|
|
103
126
|
|
|
104
127
|
const dispatchEvent = useCallback(
|
|
105
|
-
(station?:
|
|
106
|
-
const customEvt = new MobilityEvent<
|
|
128
|
+
(station?: StopsFeature) => {
|
|
129
|
+
const customEvt = new MobilityEvent<StopsFeature>(
|
|
107
130
|
event || "mwc:stopssearchselect",
|
|
108
131
|
station,
|
|
109
132
|
{
|
|
@@ -121,24 +144,25 @@ function StopsSearch({
|
|
|
121
144
|
);
|
|
122
145
|
|
|
123
146
|
const debouncedSearch = useMemo(() => {
|
|
124
|
-
let abortCtrl: AbortController;
|
|
125
|
-
|
|
147
|
+
let abortCtrl: AbortController | undefined;
|
|
148
|
+
|
|
149
|
+
return debounce((q) => {
|
|
126
150
|
abortCtrl?.abort();
|
|
127
151
|
abortCtrl = new AbortController();
|
|
152
|
+
|
|
153
|
+
const reqParams = {
|
|
154
|
+
bbox,
|
|
155
|
+
field,
|
|
156
|
+
limit,
|
|
157
|
+
mots,
|
|
158
|
+
prefagencies,
|
|
159
|
+
q,
|
|
160
|
+
ref_location: reflocation,
|
|
161
|
+
...JSON.parse(params || "{}"),
|
|
162
|
+
} as StopsParameters;
|
|
163
|
+
|
|
128
164
|
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
|
-
)
|
|
165
|
+
.search(reqParams, { signal: abortCtrl.signal })
|
|
142
166
|
.then((res: StopsResponse) => {
|
|
143
167
|
setResults(
|
|
144
168
|
res.features.filter((f) => {
|
|
@@ -149,6 +173,7 @@ function StopsSearch({
|
|
|
149
173
|
.catch((e) => {
|
|
150
174
|
// AbortError is expected
|
|
151
175
|
if (e.code !== 20) {
|
|
176
|
+
// eslint-disable-next-line no-console
|
|
152
177
|
console.error("Failed to fetch stations", e);
|
|
153
178
|
return;
|
|
154
179
|
}
|
|
@@ -195,28 +220,41 @@ function StopsSearch({
|
|
|
195
220
|
|
|
196
221
|
return (
|
|
197
222
|
<>
|
|
198
|
-
<style>{tailwind}</style>
|
|
199
|
-
{/* <div className="relative z-0 rounded-md bg-white" > */}
|
|
200
223
|
<div
|
|
201
|
-
className={
|
|
202
|
-
"flex h-16 items-center gap-4 rounded-md bg-white p-4 pt-3.5 shadow"
|
|
203
|
-
|
|
224
|
+
className={twMerge(
|
|
225
|
+
"flex h-16 items-center gap-4 rounded-md bg-white p-4 pt-3.5 shadow",
|
|
226
|
+
className,
|
|
227
|
+
results ? withResultsClassName : "",
|
|
228
|
+
)}
|
|
204
229
|
ref={myRef}
|
|
205
230
|
>
|
|
206
|
-
<div
|
|
231
|
+
<div
|
|
232
|
+
className={twMerge(
|
|
233
|
+
"text-grey flex items-center",
|
|
234
|
+
searchIconContainerClassName,
|
|
235
|
+
)}
|
|
236
|
+
>
|
|
207
237
|
<Search className="size-4" />
|
|
208
238
|
</div>
|
|
209
|
-
<div
|
|
239
|
+
<div
|
|
240
|
+
className={twMerge(
|
|
241
|
+
"@container/inputsearch flex grow items-center border-b-2 border-solid",
|
|
242
|
+
inputContainerClassName,
|
|
243
|
+
)}
|
|
244
|
+
>
|
|
210
245
|
<input
|
|
211
246
|
autoComplete="off"
|
|
212
|
-
className=
|
|
247
|
+
className={twMerge(
|
|
248
|
+
"h-8 flex-1 overflow-hidden text-ellipsis outline-0 placeholder:text-zinc-400",
|
|
249
|
+
inputClassName,
|
|
250
|
+
)}
|
|
213
251
|
id="searchfield"
|
|
214
|
-
onChange={(
|
|
252
|
+
onChange={(evt) => {
|
|
215
253
|
// @ts-expect-error target is missing
|
|
216
|
-
setQuery(
|
|
254
|
+
setQuery(evt.target.value);
|
|
217
255
|
}}
|
|
218
|
-
onKeyUp={(
|
|
219
|
-
if (
|
|
256
|
+
onKeyUp={(evt: TargetedKeyboardEvent<HTMLInputElement>) => {
|
|
257
|
+
if (evt.key === "Enter") {
|
|
220
258
|
if (results?.length > 0) {
|
|
221
259
|
setSelectedStation(results[0]);
|
|
222
260
|
}
|
|
@@ -224,60 +262,77 @@ function StopsSearch({
|
|
|
224
262
|
}}
|
|
225
263
|
placeholder={t("stops_search_placeholder")}
|
|
226
264
|
type="text"
|
|
227
|
-
value={query}
|
|
265
|
+
value={query || ""}
|
|
228
266
|
/>
|
|
229
267
|
{query.length > 0 && (
|
|
230
|
-
<
|
|
231
|
-
className=
|
|
268
|
+
<IconButton
|
|
269
|
+
className={twMerge(
|
|
270
|
+
"flex !size-[32px] items-center rounded-none border-none bg-transparent shadow-none",
|
|
271
|
+
cancelButtonClassName,
|
|
272
|
+
)}
|
|
232
273
|
onClick={() => {
|
|
233
274
|
setQuery("");
|
|
234
275
|
setResults(undefined);
|
|
235
276
|
}}
|
|
236
277
|
>
|
|
237
|
-
<Cancel
|
|
238
|
-
</
|
|
278
|
+
<Cancel />
|
|
279
|
+
</IconButton>
|
|
239
280
|
)}
|
|
240
281
|
</div>
|
|
241
282
|
</div>
|
|
242
283
|
|
|
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
|
-
|
|
284
|
+
{results && (
|
|
285
|
+
<div
|
|
286
|
+
className={twMerge(
|
|
287
|
+
"flex grow overflow-auto rounded-md rounded-t-none bg-white shadow",
|
|
288
|
+
resultsContainerClassName,
|
|
289
|
+
)}
|
|
290
|
+
>
|
|
291
|
+
{results && results.length === 0 && (
|
|
292
|
+
<div
|
|
293
|
+
className={twMerge(
|
|
294
|
+
"flex grow gap-3 border border-solid p-3 pt-2 text-zinc-400",
|
|
295
|
+
resultsClassName,
|
|
296
|
+
)}
|
|
297
|
+
style={{ border: 1 }}
|
|
298
|
+
>
|
|
299
|
+
<div className="size-6"></div>
|
|
300
|
+
<div>{t("no_stops_found")}</div>
|
|
301
|
+
</div>
|
|
302
|
+
)}
|
|
303
|
+
{results && results.length > 0 && (
|
|
304
|
+
<ul
|
|
305
|
+
className={twMerge(
|
|
306
|
+
"grow rounded-md rounded-t-none border border-solid bg-white p-0",
|
|
307
|
+
resultsClassName,
|
|
308
|
+
)}
|
|
309
|
+
style={{ border: 1 }} // without this th ul is displayed 1 px on the right
|
|
310
|
+
>
|
|
311
|
+
{results?.map((station) => {
|
|
312
|
+
return (
|
|
313
|
+
<li
|
|
314
|
+
className={twMerge(
|
|
315
|
+
"border-b border-dashed border-slate-300 p-3 last:border-0",
|
|
316
|
+
resultClassName,
|
|
317
|
+
)}
|
|
318
|
+
key={station.properties.uid}
|
|
271
319
|
>
|
|
272
|
-
<
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
320
|
+
<button
|
|
321
|
+
className="flex w-full items-center gap-3 text-left"
|
|
322
|
+
onClick={() => {
|
|
323
|
+
setSelectedStation(station);
|
|
324
|
+
}}
|
|
325
|
+
>
|
|
326
|
+
<div className="size-6"></div>
|
|
327
|
+
<div className="grow">{station.properties.name}</div>
|
|
328
|
+
</button>
|
|
329
|
+
</li>
|
|
330
|
+
);
|
|
331
|
+
})}
|
|
332
|
+
</ul>
|
|
333
|
+
)}
|
|
334
|
+
</div>
|
|
335
|
+
)}
|
|
281
336
|
{/* </div> */}
|
|
282
337
|
</>
|
|
283
338
|
);
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
console.log("Setting preview situations", event.data.situations);
|
|
29
|
+
setPreviewNotifications(event.data.situations);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
window.addEventListener("message", onMessage);
|
|
33
|
+
return () => {
|
|
34
|
+
window.removeEventListener("message", onMessage);
|
|
35
|
+
};
|
|
36
|
+
}, [setPreviewNotifications]);
|
|
37
|
+
|
|
38
|
+
// Propagate wc events to the parent window
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!eventNode) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const postMessage = (evt: MobilityEvent<unknown>) => {
|
|
45
|
+
// Clean data before sending it to the parent
|
|
46
|
+
if (evt.type === "mwc:attribute") {
|
|
47
|
+
// @ts-expect-error children is the react property
|
|
48
|
+
delete evt.data.children;
|
|
49
|
+
}
|
|
50
|
+
window.parent?.postMessage({ data: evt.data, type: evt.type }, "*");
|
|
51
|
+
};
|
|
52
|
+
evtTypes.forEach((eventType) => {
|
|
53
|
+
eventNode.addEventListener(eventType, postMessage);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// warn the parent that the web component is listening
|
|
57
|
+
window.parent?.postMessage({ data: true, type: "mwc:messageready" }, "*");
|
|
58
|
+
|
|
59
|
+
return () => {
|
|
60
|
+
evtTypes.forEach((eventType) => {
|
|
61
|
+
eventNode.removeEventListener(eventType, postMessage);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
}, [eventNode]);
|
|
65
|
+
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
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" />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SVGProps } from "preact/compat";
|
|
2
|
+
|
|
3
|
+
function ArrowRight(props: SVGProps<SVGSVGElement>) {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
fill="currentColor"
|
|
7
|
+
height="24px"
|
|
8
|
+
version="1.1"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
width="24px"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<path d="M13.2928932,5.29289322 C13.6834175,4.90236893 14.3165825,4.90236893 14.7071068,5.29289322 L20.7071068,11.2928932 C20.7355731,11.3213595 20.7623312,11.3515341 20.787214,11.3832499 C20.7927155,11.3901576 20.7982466,11.397397 20.8036654,11.4046934 C20.8215099,11.4288693 20.8382813,11.453725 20.8539326,11.4793398 C20.8613931,11.4913869 20.8685012,11.5036056 20.8753288,11.5159379 C20.8862061,11.5357061 20.8966234,11.5561086 20.9063462,11.5769009 C20.914321,11.5939015 20.9218036,11.6112044 20.9287745,11.628664 C20.9366843,11.6484208 20.9438775,11.6682023 20.9504533,11.6882636 C20.9552713,11.7031487 20.9599023,11.7185367 20.9641549,11.734007 C20.9701664,11.7555635 20.9753602,11.7772539 20.9798348,11.7992059 C20.9832978,11.8166247 20.9863719,11.834051 20.9889822,11.8515331 C20.9962388,11.8996379 21,11.9493797 21,12 L20.9962979,11.9137692 C20.9978436,11.9317345 20.9989053,11.9497336 20.9994829,11.9677454 L21,12 C21,12.0112225 20.9998151,12.0224019 20.9994483,12.0335352 C20.9988772,12.050591 20.997855,12.0679231 20.996384,12.0852242 C20.994564,12.1070574 20.9920941,12.1281144 20.9889807,12.1489612 C20.9863719,12.165949 20.9832978,12.1833753 20.9797599,12.2007258 C20.9753602,12.2227461 20.9701664,12.2444365 20.964279,12.2658396 C20.9599023,12.2814633 20.9552713,12.2968513 20.9502619,12.3121425 C20.9438775,12.3317977 20.9366843,12.3515792 20.928896,12.3710585 C20.9218036,12.3887956 20.914321,12.4060985 20.9063266,12.4232215 C20.8966234,12.4438914 20.8862061,12.4642939 20.8751242,12.484277 C20.8685012,12.4963944 20.8613931,12.5086131 20.8540045,12.5207088 C20.8382813,12.546275 20.8215099,12.5711307 20.8036865,12.5951593 C20.774687,12.6343256 20.7425008,12.6717127 20.7071068,12.7071068 L20.787214,12.6167501 C20.7849289,12.6196628 20.7826279,12.6225624 20.7803112,12.625449 L20.7071068,12.7071068 L14.7071068,18.7071068 C14.3165825,19.0976311 13.6834175,19.0976311 13.2928932,18.7071068 C12.9023689,18.3165825 12.9023689,17.6834175 13.2928932,17.2928932 L17.584,13 L4,13 C3.48716416,13 3.06449284,12.6139598 3.00672773,12.1166211 L3,12 C3,11.4477153 3.44771525,11 4,11 L17.586,11 L13.2928932,6.70710678 C12.9324093,6.34662282 12.9046797,5.77939176 13.2097046,5.38710056 Z"></path>
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default ArrowRight;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>arrow-right</title>
|
|
4
|
+
<defs>
|
|
5
|
+
<path d="M13.2928932,5.29289322 C13.6834175,4.90236893 14.3165825,4.90236893 14.7071068,5.29289322 L20.7071068,11.2928932 C20.7355731,11.3213595 20.7623312,11.3515341 20.787214,11.3832499 C20.7927155,11.3901576 20.7982466,11.397397 20.8036654,11.4046934 C20.8215099,11.4288693 20.8382813,11.453725 20.8539326,11.4793398 C20.8613931,11.4913869 20.8685012,11.5036056 20.8753288,11.5159379 C20.8862061,11.5357061 20.8966234,11.5561086 20.9063462,11.5769009 C20.914321,11.5939015 20.9218036,11.6112044 20.9287745,11.628664 C20.9366843,11.6484208 20.9438775,11.6682023 20.9504533,11.6882636 C20.9552713,11.7031487 20.9599023,11.7185367 20.9641549,11.734007 C20.9701664,11.7555635 20.9753602,11.7772539 20.9798348,11.7992059 C20.9832978,11.8166247 20.9863719,11.834051 20.9889822,11.8515331 C20.9962388,11.8996379 21,11.9493797 21,12 L20.9962979,11.9137692 C20.9978436,11.9317345 20.9989053,11.9497336 20.9994829,11.9677454 L21,12 C21,12.0112225 20.9998151,12.0224019 20.9994483,12.0335352 C20.9988772,12.050591 20.997855,12.0679231 20.996384,12.0852242 C20.994564,12.1070574 20.9920941,12.1281144 20.9889807,12.1489612 C20.9863719,12.165949 20.9832978,12.1833753 20.9797599,12.2007258 C20.9753602,12.2227461 20.9701664,12.2444365 20.964279,12.2658396 C20.9599023,12.2814633 20.9552713,12.2968513 20.9502619,12.3121425 C20.9438775,12.3317977 20.9366843,12.3515792 20.928896,12.3710585 C20.9218036,12.3887956 20.914321,12.4060985 20.9063266,12.4232215 C20.8966234,12.4438914 20.8862061,12.4642939 20.8751242,12.484277 C20.8685012,12.4963944 20.8613931,12.5086131 20.8540045,12.5207088 C20.8382813,12.546275 20.8215099,12.5711307 20.8036865,12.5951593 C20.774687,12.6343256 20.7425008,12.6717127 20.7071068,12.7071068 L20.787214,12.6167501 C20.7849289,12.6196628 20.7826279,12.6225624 20.7803112,12.625449 L20.7071068,12.7071068 L14.7071068,18.7071068 C14.3165825,19.0976311 13.6834175,19.0976311 13.2928932,18.7071068 C12.9023689,18.3165825 12.9023689,17.6834175 13.2928932,17.2928932 L17.584,13 L4,13 C3.48716416,13 3.06449284,12.6139598 3.00672773,12.1166211 L3,12 C3,11.4477153 3.44771525,11 4,11 L17.586,11 L13.2928932,6.70710678 C12.9324093,6.34662282 12.9046797,5.77939176 13.2097046,5.38710056 Z" id="path-1"></path>
|
|
6
|
+
</defs>
|
|
7
|
+
<g id="arrow-right" stroke="none" fill="none">
|
|
8
|
+
<mask id="mask-2" fill="white">
|
|
9
|
+
<use xlink:href="#path-1"></use>
|
|
10
|
+
</mask>
|
|
11
|
+
<use id="Combined-Shape" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
|
12
|
+
<g id="🎨Color" mask="url(#mask-2)" fill="#000000" fill-rule="evenodd">
|
|
13
|
+
<rect id="Rectangle" x="0" y="0" width="24" height="24"></rect>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ArrowRight";
|
|
@@ -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
|
);
|