@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.
Files changed (195) hide show
  1. package/.prettierrc.js +3 -1
  2. package/CHANGELOG.md +7 -0
  3. package/README.md +1 -1
  4. package/doc/package.json +4 -3
  5. package/doc/postcss.config.mjs +1 -1
  6. package/doc/src/app/components/GeopsMobilityDoc.tsx +13 -224
  7. package/doc/src/app/components/GeopsMobilitySearchDoc.tsx +11 -107
  8. package/doc/src/app/components/WebComponentDoc.tsx +45 -56
  9. package/doc/src/app/geops-mobility/page.tsx +7 -2
  10. package/doc/src/app/geops-mobility-search/page.tsx +6 -2
  11. package/doc/src/app/globals.css +47 -27
  12. package/doc/src/app/layout.tsx +4 -2
  13. package/docutils.js +33 -17
  14. package/eslint.config.mjs +28 -34
  15. package/iframe.html +5624 -201
  16. package/index.html +108 -88
  17. package/index.js +2229 -1976
  18. package/input.css +21 -3
  19. package/package.json +37 -40
  20. package/scripts/build.mjs +2 -2
  21. package/scripts/dev.mjs +3 -3
  22. package/search.html +70 -23
  23. package/src/BaseLayer/BaseLayer.tsx +2 -1
  24. package/src/Copyright/Copyright.tsx +4 -2
  25. package/src/DebugDeparture/DebugDeparture.tsx +16 -12
  26. package/src/DebugStop/DebugStop.tsx +2 -2
  27. package/src/Departure/Departure.tsx +2 -3
  28. package/src/EmbedNavigation/DragPanWarning.ts +125 -0
  29. package/src/EmbedNavigation/EmbedNavigation.tsx +52 -0
  30. package/src/EmbedNavigation/index.js +1 -0
  31. package/src/EmbedNavigation/index.tsx +1 -0
  32. package/src/GeolocationButton/GeolocationButton.tsx +11 -35
  33. package/src/GeolocationButton/index.tsx +1 -1
  34. package/src/Map/Map.tsx +5 -3
  35. package/src/MapDispatchEvents/MapDispatchEvents.tsx +78 -0
  36. package/src/MapDispatchEvents/index.tsx +1 -0
  37. package/src/MobilityMap/MobilityMap.tsx +117 -162
  38. package/src/MobilityMap/MobilityMapAttributes.test.ts +21 -0
  39. package/src/MobilityMap/MobilityMapAttributes.ts +243 -0
  40. package/src/MobilityMap/index.tsx +1 -0
  41. package/src/MobilitySearch/MobilitySearch.tsx +35 -0
  42. package/src/MobilitySearch/MobilitySearchAttributes.test.ts +21 -0
  43. package/src/MobilitySearch/MobilitySearchAttributes.ts +68 -0
  44. package/src/MobilitySearch/index.ts +2 -0
  45. package/src/NotificationLayer/NotificationLayer.tsx +27 -4
  46. package/src/Overlay/Overlay.tsx +24 -11
  47. package/src/Permalink/Permalink.tsx +77 -0
  48. package/src/Permalink/index.tsx +1 -0
  49. package/src/RealtimeLayer/RealtimeLayer.tsx +72 -33
  50. package/src/RouteDestination/RouteDestination.tsx +3 -3
  51. package/src/RouteIcon/RouteIcon.tsx +33 -25
  52. package/src/RouteIcon/index.tsx +1 -1
  53. package/src/RouteIdentifier/RouteIdentifer.tsx +6 -5
  54. package/src/RouteInfos/RouteInfos.tsx +7 -3
  55. package/src/RouteSchedule/RouteSchedule.tsx +3 -3
  56. package/src/RouteScheduleFooter/RouteScheduleFooter.tsx +1 -1
  57. package/src/RouteScheduleHeader/RouteScheduleHeader.tsx +7 -29
  58. package/src/RouteStop/RouteStop.tsx +8 -11
  59. package/src/RouteStopDelay/RouteStopDelay.tsx +2 -1
  60. package/src/RouteStopName/RouteStopName.tsx +2 -2
  61. package/src/RouteStopPlatform/RouteStopPlatform.tsx +2 -2
  62. package/src/RouteStopProgress/RouteStopProgress.tsx +2 -1
  63. package/src/RouteStopServices/RouteStopServices.tsx +2 -2
  64. package/src/RouteStopStation/RouteStopStation.tsx +8 -2
  65. package/src/RouteStopTime/RouteStopTime.tsx +2 -1
  66. package/src/RvfButton/RvfButton.tsx +14 -5
  67. package/src/RvfCheckbox/RvfCheckbox.tsx +8 -8
  68. package/src/RvfEmbedNavigation/DragPanWarning.ts +5 -5
  69. package/src/RvfEmbedNavigation/RvfEmbedNavigation.tsx +1 -0
  70. package/src/RvfExportMenu/RvfExportMenu.tsx +14 -12
  71. package/src/RvfExportMenuButton/RvfExportMenuButton.tsx +6 -7
  72. package/src/RvfFeatureDetails/RvfFeatureDetails.tsx +5 -5
  73. package/src/RvfFeatureDetails/RvfLineNetworkDetails/RvfLineNetworkDetails.tsx +164 -138
  74. package/src/RvfFeatureDetails/RvfNotificationDetails/RvfNotificationDetails.tsx +151 -109
  75. package/src/RvfFeatureDetails/RvfSellingPointDetails/RvfSellingPointDetails.tsx +2 -2
  76. package/src/RvfFeatureDetails/RvfSharedMobilityDetail/FloatingVehiclesDetails/FloatingVehiclesDetails.tsx +3 -3
  77. package/src/RvfFeatureDetails/RvfSharedMobilityDetail/RvfSharedMobilityDetails.tsx +8 -6
  78. package/src/RvfFeatureDetails/RvfSharedMobilityDetail/StationDetails/StationDetails.tsx +5 -4
  79. package/src/RvfFeatureDetailsTitle/RvfFeatureDetailsTitle.tsx +81 -0
  80. package/src/RvfFeatureDetailsTitle/index.tsx +1 -0
  81. package/src/RvfFloatingMenu/RvfFloatingMenu.tsx +4 -4
  82. package/src/RvfGeolocationButton/GeolocationButton.tsx +98 -0
  83. package/src/RvfGeolocationButton/index.tsx +1 -0
  84. package/src/RvfIconButton/RvfIconButton.tsx +20 -9
  85. package/src/RvfInputCopy/RvfInputCopy.tsx +8 -8
  86. package/src/RvfLayerTree/RvfLayerTree.tsx +5 -2
  87. package/src/RvfLayerTree/TreeItem/TreeItem.tsx +13 -16
  88. package/src/RvfLayerTree/layersTreeReducer.ts +23 -18
  89. package/src/RvfLayerTreeButton/RvfLayerTreeButton.tsx +6 -6
  90. package/src/RvfLineNetworkPlanLayer/RvfLineNetworkPlanLayer.tsx +2 -1
  91. package/src/RvfLink/RvfLink.tsx +4 -3
  92. package/src/RvfMobilityMap/RvfMobilityMap.tsx +314 -322
  93. package/src/RvfModal/RvfModal.tsx +4 -3
  94. package/src/RvfOverlayContent/RvfOverlayContent.tsx +126 -0
  95. package/src/RvfOverlayContent/index.ts +0 -0
  96. package/src/RvfOverlayHeader/RvfOverlayHeader.tsx +13 -10
  97. package/src/RvfPermalink/RvfPermalink.tsx +2 -2
  98. package/src/RvfPoisLayer/RvfPoisLayer.tsx +2 -1
  99. package/src/RvfRadioButton/RvfRadioButton.tsx +1 -1
  100. package/src/RvfRouteIcon/RvfRouteIcon.tsx +10 -0
  101. package/src/RvfRouteIcon/index.tsx +1 -0
  102. package/src/RvfSearch/RvfSearch.tsx +4 -1
  103. package/src/RvfSearchButton/RvfSearchButton.tsx +27 -0
  104. package/src/RvfSearchButton/index.tsx +1 -0
  105. package/src/RvfSelect/RvfSelect.tsx +7 -5
  106. package/src/RvfSelectedFeatureHighlightLayer/RvfSelectedFeatureHighlightLayer.tsx +1 -2
  107. package/src/RvfSellingPointsLayer/RvfSellingPointsLayer.tsx +2 -1
  108. package/src/RvfShare/RvfPermalinkButton/RvfPermalinkButton.tsx +13 -12
  109. package/src/RvfShare/RvfShare.tsx +11 -10
  110. package/src/RvfShareMenuButton/RvfShareMenuButton.tsx +5 -5
  111. package/src/RvfSharedMobilityLayerGroup/RvfSharedMobilityLayerGroup.tsx +25 -22
  112. package/src/RvfSingleClickListener/RvfSingleClickListener.tsx +46 -31
  113. package/src/RvfTarifZonenLayer/RvfTarifZonenLayer.tsx +2 -1
  114. package/src/RvfTopics/RvfTopics.tsx +6 -5
  115. package/src/RvfZoomButtons/RvfZoomButtons.tsx +3 -3
  116. package/src/ScaleLine/ScaleLine.tsx +5 -4
  117. package/src/ScrollableHandler/ScrollableHandler.tsx +2 -1
  118. package/src/ScrollableHandler/index.tsx +1 -1
  119. package/src/SingleClickListener/SingleClickListener.tsx +47 -4
  120. package/src/Station/Station.tsx +5 -5
  121. package/src/StationName/StationName.tsx +3 -3
  122. package/src/StationServices/StationServices.tsx +3 -3
  123. package/src/StationsLayer/StationsLayer.tsx +5 -4
  124. package/src/StopsSearch/StopsSearch.tsx +115 -84
  125. package/src/WindowMessageListener/WindowMessageListener.tsx +67 -0
  126. package/src/WindowMessageListener/index.tsx +1 -0
  127. package/src/icons/Airport/Airport.tsx +4 -4
  128. package/src/icons/ArrowDown/ArrowDown.tsx +1 -1
  129. package/src/icons/ArrowUp/ArrowUp.tsx +1 -1
  130. package/src/icons/ArrowUpRight/ArrowUpRight.tsx +1 -1
  131. package/src/icons/BarAndRestaurants/BarAndRestaurants.tsx +2 -2
  132. package/src/icons/Bathroom/Bathroom.tsx +1 -1
  133. package/src/icons/Copy/Copy.tsx +1 -1
  134. package/src/icons/Doc/Doc.tsx +1 -1
  135. package/src/icons/Email/Email.tsx +1 -1
  136. package/src/icons/FilePdf/FilePdf.tsx +1 -1
  137. package/src/icons/Geolocation/Geolocation.tsx +3 -5
  138. package/src/icons/Image/Image.tsx +1 -1
  139. package/src/icons/Menu/Menu.tsx +1 -1
  140. package/src/icons/Minus/Minus.tsx +1 -1
  141. package/src/icons/NoRealtime/NoRealtime.tsx +1 -1
  142. package/src/icons/Plus/Plus.tsx +1 -1
  143. package/src/icons/Police/Police.tsx +3 -3
  144. package/src/icons/Share/Share.tsx +1 -1
  145. package/src/icons/Stack/Stack.tsx +1 -1
  146. package/src/icons/Tracking/Tracking.tsx +29 -0
  147. package/src/icons/Tracking/airport-14-svgrepo-com.svg +41 -0
  148. package/src/icons/Tracking/index.tsx +1 -0
  149. package/src/icons/WaitingAreas/WaitingAreas.tsx +1 -1
  150. package/src/icons/WheelChair/WheelChair.tsx +1 -1
  151. package/src/index.tsx +8 -46
  152. package/src/indexDoc.ts +13 -0
  153. package/src/ui/Button/Button.tsx +57 -0
  154. package/src/ui/Button/index.tsx +1 -0
  155. package/src/ui/IconButton/IconButton.tsx +44 -0
  156. package/src/ui/IconButton/index.tsx +1 -0
  157. package/src/utils/MobilityEvent.ts +4 -3
  158. package/src/utils/applyInitialLayerVisibility.ts +3 -3
  159. package/src/utils/centerOnStation.ts +3 -2
  160. package/src/utils/centerOnVehicle.ts +5 -4
  161. package/src/utils/constants.ts +17 -3
  162. package/src/utils/exportPdf.ts +26 -20
  163. package/src/utils/fullTrajectoryStyle.ts +2 -2
  164. package/src/utils/getAllLayers.ts +4 -3
  165. package/src/utils/getDelayColor.test.ts +1 -0
  166. package/src/utils/getDelayColorForVehicle.test.ts +2 -0
  167. package/src/utils/getDelayString.test.ts +3 -0
  168. package/src/utils/getDelayTextForVehicle.test.ts +4 -0
  169. package/src/utils/getFullTrajectoryAndFit.ts +4 -3
  170. package/src/utils/getHoursAndMinutes.test.ts +1 -0
  171. package/src/utils/getLayersAsFlatArray.ts +2 -2
  172. package/src/utils/getLinkByDevice.ts +1 -1
  173. package/src/utils/getMainColorForVehicle.ts +3 -3
  174. package/src/utils/getPermalinkParameters.ts +2 -2
  175. package/src/utils/getStopStatus.test.ts +2 -1
  176. package/src/utils/getStopStatus.ts +1 -1
  177. package/src/utils/getTextForVehicle.ts +1 -1
  178. package/src/utils/hooks/useDeparture.tsx +6 -5
  179. package/src/utils/hooks/useI18n.tsx +6 -4
  180. package/src/utils/hooks/useInitialLayersVisiblity.tsx +2 -1
  181. package/src/utils/hooks/useLayerConfig.tsx +39 -0
  182. package/src/utils/hooks/useMapContext.tsx +30 -18
  183. package/src/utils/hooks/useRouteStop.tsx +3 -2
  184. package/src/utils/hooks/useRvfContext.tsx +11 -3
  185. package/src/utils/hooks/useStation.tsx +2 -1
  186. package/src/utils/hooks/useUpdatePermalink.tsx +25 -24
  187. package/src/utils/hooks/useZoom.tsx +4 -4
  188. package/src/utils/realtimeRVFStyle.ts +5 -4
  189. package/src/utils/sharingGraphqlUtils.ts +3 -2
  190. package/src/utils/sharingStylesUtils.ts +7 -7
  191. package/src/utils/sharingWFSUtils.ts +9 -15
  192. package/tailwind.config.mjs +1 -0
  193. package/tsconfig.json +1 -1
  194. package/doc/tailwind.config.ts +0 -20
  195. package/src/utils/getFeatureInformationTitle.tsx +0 -54
package/.prettierrc.js CHANGED
@@ -1 +1,3 @@
1
- export default {};
1
+ export default {
2
+ plugins: ["prettier-plugin-tailwindcss"],
3
+ };
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.46](https://github.com/geops/rvf-mobility-web-component/compare/v0.1.45...v0.1.46) (2025-08-01)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * use good style ([f54b312](https://github.com/geops/rvf-mobility-web-component/commit/f54b312c8bbedcbaa686aff08d69959a52d8fc6b))
11
+
5
12
  ### [0.1.45](https://github.com/geops/rvf-mobility-web-component/compare/v0.1.44...v0.1.45) (2025-07-30)
6
13
 
7
14
 
package/README.md CHANGED
@@ -71,7 +71,7 @@ Here an exhaustive list of the `<geops-mobility>` web component attributes avail
71
71
  - [`mots="rail,bus"`](https://mobility-web-component.geops.io/?mots=rail,bus): list of commas separated mots to display on the Realtime layer ( rail, bus, coach, foot, tram, subway, gondola, funicular, ferry, car).
72
72
  - [`notification="false"`](https://mobility-web-component.geops.io/?notification=true): display the notification layer or not (true or false). Default to true.
73
73
  - [`notificationat="2025-01-01T12:00:00Z"`](https://mobility-web-component.geops.io/?notificationat=2025-01-01T12:00:00Z): a ISO date string used to display active notification at this date in the notification layer.
74
- - [`notificationbeforelayerid=`](https://mobility-web-component.geops.io/?notificationbeforelayerid=): the style layer's id before which the notification layer will be added. By default the layer will be added on top.
74
+ - [`notificationtenant=`](https://mobility-web-component.geops.io/?notificationtenant=): the MOCO notification tenant to get the notifications from.
75
75
  - [`notificationurl=`](https://mobility-web-component.geops.io/?notificationurl=): the MOCO notification url to get the notifications from.
76
76
  - [`permalink="true"`](https://mobility-web-component.geops.io/?permalink=true): add automatically an `x`,`y` an `z` URL parameters to the URL to allow to share the current map view. Default to false.
77
77
  - [`realtime="false"`](https://mobility-web-component.geops.io/?realtime=false): display the realtime layer or not (true or false). Default to true.
package/doc/package.json CHANGED
@@ -19,6 +19,7 @@
19
19
  "typeface-lato": "^1.1.13"
20
20
  },
21
21
  "devDependencies": {
22
+ "@tailwindcss/postcss": "^4.1.11",
22
23
  "@types/node": "^22.10.1",
23
24
  "@types/react": "^18.3.13",
24
25
  "@types/react-dom": "^18",
@@ -27,9 +28,9 @@
27
28
  "eslint-config-next": "15.0.3",
28
29
  "eslint-config-prettier": "^9.1.0",
29
30
  "generact": "^0.4.0",
30
- "postcss": "^8.4.49",
31
- "tailwindcss": "^3.4.16",
32
- "typescript": "^5.7.2"
31
+ "postcss": "^8.5.6",
32
+ "tailwindcss": "^4.1.11",
33
+ "typescript": "^5.8.3"
33
34
  },
34
35
  "scripts": {
35
36
  "build": "next build",
@@ -1,7 +1,7 @@
1
1
  /** @type {import('postcss-load-config').Config} */
2
2
  const config = {
3
3
  plugins: {
4
- tailwindcss: {},
4
+ "@tailwindcss/postcss": {},
5
5
  },
6
6
  };
7
7
 
@@ -1,235 +1,24 @@
1
- import { Typography } from "@mui/material";
1
+ "use client";
2
2
  import { Suspense } from "react";
3
3
 
4
4
  import useIsFullScreen from "../hooks/useIsFullScreen";
5
- import GeopsAPIKeyLink from "./GeopsAPIKeyLink";
6
- import GeopsMapsAPILink from "./GeopsMapsAPILink";
7
5
  import GeopsMobility from "./GeopsMobility";
8
- import GeopsRealtimeAPILink from "./GeopsRealtimeAPILink";
9
- import GeopsStopsAPILink from "./GeopsStopsAPILink";
10
- import Link from "./Link";
11
6
  import WebComponentDoc, { AttrConfig } from "./WebComponentDoc";
12
7
 
13
- const attrsConfig: Record<string, AttrConfig> = {
14
- apikey: {
15
- description: (
16
- <Typography>
17
- Your <GeopsAPIKeyLink />.
18
- </Typography>
19
- ),
20
- type: "textfield",
21
- },
22
- baselayer: {
23
- defaultValue: "travic_v2",
24
- description: (
25
- <Typography>
26
- The style&apos;s name from the <GeopsMapsAPILink />
27
- (base_dark_v2, base_bright_v2, ...).
28
- </Typography>
29
- ),
30
- type: "select",
31
- },
32
- center: {
33
- defaultValue: "831634,5933959",
34
- description: (
35
- <Typography>The center of the map in EPSG:3857 coordinates.</Typography>
36
- ),
37
- type: "textfield",
38
- },
39
- extent: {
40
- description: (
41
- <Typography>
42
- The extent of the map in EPSG:3857 coordinates (ex:
43
- 830634,5923959,831634,5933959). It has the priority over center and zoom
44
- attributes.
45
- </Typography>
46
- ),
47
- type: "textfield",
48
- },
49
- geolocation: {
50
- defaultValue: "true",
51
- description: (
52
- <Typography>
53
- Display the geolocation button or not (true or false).
54
- </Typography>
55
- ),
56
- type: "checkbox",
57
- },
58
- mapsurl: {
59
- defaultValue: "https://maps.geops.io",
60
- description: (
61
- <Typography>
62
- The <GeopsMapsAPILink /> url to use.
63
- </Typography>
64
- ),
65
- type: "textfield",
66
- },
67
- maxextent: {
68
- description: (
69
- <Typography>
70
- Constraint the map in a specific extent in EPSG:3857 coordinates, the
71
- user can not navigate outside this extent.
72
- </Typography>
73
- ),
74
- type: "textfield",
75
- },
76
- maxzoom: {
77
- description: <Typography>Define the max zoom level of the map.</Typography>,
78
- props: {
79
- slotProps: {
80
- input: {
81
- max: 22,
82
- min: 0,
83
- step: 1,
84
- },
85
- },
86
- type: "number",
87
- },
88
- type: "textfield",
89
- },
90
- minzoom: {
91
- description: <Typography>Define the min zoom level of the map.</Typography>,
92
- props: {
93
- slotProps: {
94
- input: {
95
- max: 22,
96
- min: 0,
97
- step: 1,
98
- },
99
- },
100
- type: "number",
101
- },
102
- type: "textfield",
103
- },
104
- mots: {
105
- description: (
106
- <Typography>
107
- Commas separated list of mots to display on the Realtime layer (rail,
108
- bus, coach, foot, tram, subway, gondola, funicular, ferry, car).
109
- </Typography>
110
- ),
111
- type: "textfield",
112
- },
113
- notification: {
114
- defaultValue: "true",
115
- description: (
116
- <Typography>
117
- Display the notification layer or not (true or false). This layer will
118
- display informations about disruptions on the network. Data comes from
119
- our{" "}
120
- <Link href="https://geops.com/en/solution/disruption-information">
121
- geOps MOCO tool
122
- </Link>
123
- . It works it combination with `notificationurl`.
124
- </Typography>
125
- ),
126
- type: "checkbox",
127
- },
128
- notificationat: {
129
- description: (
130
- <Typography>
131
- An ISO date string used to display active notification at this date in
132
- the notification layer. If not defined the current date will be used.
133
- </Typography>
134
- ),
135
- type: "textfield",
136
- },
137
- notificationbeforelayerid: {
138
- description: (
139
- <Typography>
140
- The style layer&apos;s id before which the notification layer will be
141
- added. By default the layer will be added on top.
142
- </Typography>
143
- ),
144
- type: "textfield",
145
- },
146
- notificationurl: {
147
- description: (
148
- <Typography>
149
- The{" "}
150
- <Link href="https://geops.com/en/solution/disruption-information">
151
- geOps MOCO API
152
- </Link>{" "}
153
- url to get the notifications from.
154
- </Typography>
155
- ),
156
- type: "textfield",
157
- },
158
- // x,y,z are not applies on refresh
159
- // permalink: {
160
- // defaultValue: "false",
161
- // description: (
162
- // <Typography>
163
- // Add automatically an `x`,`y` an `z` URL parameters to the URL to allow
164
- // to share the current mapview. Default to false.
165
- // </Typography>
166
- // ),
167
- // type: "checkbox",
168
- // },
169
- realtime: {
170
- defaultValue: "true",
171
- description: (
172
- <Typography>
173
- Display the realtime layer or not (true or false). This layer display
174
- realtime vehicles on the map using the <GeopsRealtimeAPILink />.
175
- </Typography>
176
- ),
177
- type: "checkbox",
178
- },
179
- realtimeurl: {
180
- defaultValue: "wss://api.geops.io/tracker-ws/v1/ws",
181
- description: (
182
- <Typography>
183
- The <GeopsRealtimeAPILink /> url to use.
184
- </Typography>
185
- ),
186
- type: "textfield",
187
- },
188
- search: {
189
- defaultValue: "true",
190
- description: (
191
- <Typography>
192
- Display the search stops input or not (true or false).
193
- </Typography>
194
- ),
195
- type: "checkbox",
196
- },
197
- stopsurl: {
198
- defaultValue: "https://api.geops.io/stops/v1/",
199
- description: (
200
- <Typography>
201
- The <GeopsStopsAPILink /> url to use.
202
- </Typography>
203
- ),
204
- type: "textfield",
205
- },
206
- tenant: {
207
- description: (
208
- <Typography>
209
- The tenant name to use to filter the Realtime vehicles available.
210
- </Typography>
211
- ),
212
- type: "textfield",
213
- },
214
- zoom: {
215
- defaultValue: "13",
216
- description: <Typography>The initial zoom level of the map.</Typography>,
217
- props: {
218
- slotProps: {
219
- input: {
220
- max: 22,
221
- min: 0,
222
- step: 1,
223
- },
224
- },
225
- type: "number",
226
- },
227
- type: "textfield",
228
- },
229
- };
8
+ let attrsConfig: Record<string, AttrConfig>;
9
+
230
10
  function GeopsMobilityDoc() {
231
11
  const isFullScreen = useIsFullScreen();
232
12
 
13
+ if (typeof window !== undefined) {
14
+ // @ts-expect-error - MobilityMapAttributes is added via a script file.
15
+ attrsConfig = window.MobilityMapAttributes;
16
+ }
17
+
18
+ if (!attrsConfig) {
19
+ return null;
20
+ }
21
+
233
22
  return (
234
23
  <Suspense>
235
24
  <WebComponentDoc
@@ -238,7 +27,7 @@ function GeopsMobilityDoc() {
238
27
  Comp={GeopsMobility}
239
28
  compProps={{
240
29
  class: isFullScreen
241
- ? "fixed inset-0 w-screen h-sccreen z-[9000] bg-white"
30
+ ? "fixed inset-0 w-screen h-sccreen z-9000 bg-white"
242
31
  : "block h-96 max-w-full resize overflow-auto bg-white",
243
32
  }}
244
33
  tagName="geops-mobility"
@@ -1,117 +1,21 @@
1
- import { Typography } from "@mui/material";
1
+ "use client";
2
2
  import { Suspense } from "react";
3
3
 
4
- import GeopsAPIKeyLink from "./GeopsAPIKeyLink";
5
4
  import GeopsMobilitySearch from "./GeopsMobilitySearch";
6
- import GeopsStopsAPILink from "./GeopsStopsAPILink";
7
5
  import WebComponentDoc, { AttrConfig } from "./WebComponentDoc";
8
6
 
9
- const attrsConfig: Record<string, AttrConfig> = {
10
- apikey: {
11
- description: (
12
- <Typography>
13
- Your <GeopsAPIKeyLink />.
14
- </Typography>
15
- ),
16
- type: "textfield",
17
- },
18
- bbox: {
19
- description: (
20
- <Typography>
21
- The extent where to search the stops (minx,miny,maxx,maxy).
22
- </Typography>
23
- ),
24
- type: "textfield",
25
- },
26
- countrycode: {
27
- description: (
28
- <Typography>
29
- The country code to filter the results (IT, DE, CH ...)
30
- </Typography>
31
- ),
32
- type: "textfield",
33
- },
34
- event: {
35
- defaultValue: "mwc:stopssearchselect",
36
- description: (
37
- <Typography>
38
- The event&pos;s name to listen to when a stop is selected.
39
- </Typography>
40
- ),
41
- type: "textfield",
42
- },
43
- field: {
44
- description: (
45
- <Typography>
46
- Which field to look up, default all of them, Possible values:id, name,
47
- coords.
48
- </Typography>
49
- ),
50
- type: "textfield",
51
- },
52
- limit: {
53
- defaultValue: "5",
54
- description: <Typography>The number of suggestions to show.</Typography>,
55
- props: {
56
- slotProps: {
57
- input: {
58
- max: 100,
59
- min: 0,
60
- step: 1,
61
- },
62
- },
63
- type: "number",
64
- },
65
- type: "textfield",
66
- },
67
- mots: {
68
- description: (
69
- <Typography>
70
- Commas separated list of mots used to filter the results (rail, bus,
71
- coach, foot, tram, subway, gondola, funicular, ferry, car).
72
- </Typography>
73
- ),
74
- type: "textfield",
75
- },
76
- params: {
77
- description: (
78
- <Typography>
79
- JSON string with additional parameters to pass to the request to the
80
- API. Ex: {"{ 'key': 'value' }"}
81
- </Typography>
82
- ),
83
- type: "textfield",
84
- },
85
- prefagencies: {
86
- description: (
87
- <Typography>
88
- Comma seperated list, order chooses which agency will be preferred as
89
- ident_source (for id and code fields). Possible values: sbb, db.
90
- </Typography>
91
- ),
92
- type: "textfield",
93
- },
94
- reflocation: {
95
- description: (
96
- <Typography>
97
- Coordinates in WGS84 (in lat,lon order) used to rank stops close to this
98
- position higher
99
- </Typography>
100
- ),
101
- type: "textfield",
102
- },
103
- url: {
104
- defaultValue: "https://api.geops.io/stops/v1/",
105
- description: (
106
- <Typography>
107
- The <GeopsStopsAPILink /> url to use.
108
- </Typography>
109
- ),
110
- type: "textfield",
111
- },
112
- };
7
+ let attrsConfig: Record<string, AttrConfig>;
113
8
 
114
9
  function GeopsMobilitySearchDoc() {
10
+ if (typeof window !== undefined) {
11
+ // @ts-expect-error - MobilitySearchAttributes is added via a script file.
12
+ attrsConfig = window.MobilitySearchAttributes;
13
+ }
14
+
15
+ if (!attrsConfig) {
16
+ return null;
17
+ }
18
+
115
19
  return (
116
20
  <Suspense>
117
21
  <WebComponentDoc
@@ -2,8 +2,6 @@
2
2
  import {
3
3
  Button,
4
4
  Checkbox,
5
- MenuItem,
6
- Select,
7
5
  TextField,
8
6
  TextFieldProps,
9
7
  Typography,
@@ -26,7 +24,7 @@ export interface AttrConfig {
26
24
  defaultValue?: string;
27
25
  description: ReactNode;
28
26
  props?: TextFieldProps;
29
- type: "checkbox" | "date" | "select" | "textfield";
27
+ type?: "boolean";
30
28
  }
31
29
 
32
30
  function WebComponentDoc({
@@ -175,7 +173,7 @@ function WebComponentDoc({
175
173
  HTML code
176
174
  </Typography>
177
175
  <br />
178
- <SyntaxHighlighter className="!m-0" language="xml">
176
+ <SyntaxHighlighter className="m-0!" language="xml">
179
177
  {code}
180
178
  </SyntaxHighlighter>
181
179
  <br />
@@ -196,9 +194,8 @@ function WebComponentDoc({
196
194
  <table className="w-full">
197
195
  <thead>
198
196
  <tr>
199
- <th className="w-[15%] border px-4 py-2">Name</th>
200
- <th className="w-2/5 border px-4 py-2">Value</th>
201
- <th className="w-[45%] border px-4 py-2">Description</th>
197
+ <th className="w-1/5 border px-4 py-2">Name</th>
198
+ <th className="w-4/5 border px-4 py-2">Description</th>
202
199
  </tr>
203
200
  </thead>
204
201
  <tbody>
@@ -218,21 +215,19 @@ function WebComponentDoc({
218
215
  } = attrsConfig[key] || {};
219
216
  return (
220
217
  <tr key={key}>
221
- <td className="border px-4 py-2">{key}</td>
222
- <td className="border px-4 py-2">
223
- {type === "textfield" && (
224
- <div>
225
- <TextField
226
- defaultValue={attributes[key]}
227
- fullWidth
228
- id={key}
229
- placeholder={defaultValue}
230
- variant="standard"
231
- {...props}
232
- />
233
- <div className="mt-2">
218
+ <td className="w-1/5 border p-4">{key}</td>
219
+ <td className="w-2/5 border p-4">
220
+ <div className="flex flex-col gap-4 justify-start">
221
+ {!type && (
222
+ <div className="flex gap-2">
223
+ <TextField
224
+ defaultValue={attributes[key]}
225
+ id={key}
226
+ placeholder={defaultValue}
227
+ variant="outlined"
228
+ {...props}
229
+ />
234
230
  <Button
235
- fullWidth
236
231
  onClick={() => {
237
232
  onChange(
238
233
  key,
@@ -247,42 +242,36 @@ function WebComponentDoc({
247
242
  Apply
248
243
  </Button>
249
244
  </div>
245
+ )}
246
+ {type === "boolean" && (
247
+ <Checkbox
248
+ className="w-8"
249
+ defaultChecked={
250
+ (searchParams.get(key) || defaultValue) === "true"
251
+ }
252
+ onChange={(evt) => {
253
+ onChange(
254
+ key,
255
+ evt.target.checked ? "true" : "false",
256
+ );
257
+ }}
258
+ />
259
+ )}
260
+ <div>
261
+ {typeof description !== "string" ? (
262
+ description
263
+ ) : (
264
+ <Typography
265
+ dangerouslySetInnerHTML={{ __html: description }}
266
+ />
267
+ )}{" "}
268
+ {defaultValue && (
269
+ <>
270
+ <i>Default to &quot;{defaultValue}&quot;</i>
271
+ </>
272
+ )}
250
273
  </div>
251
- )}
252
-
253
- {type === "checkbox" && (
254
- <Checkbox
255
- defaultChecked={
256
- (searchParams.get(key) || defaultValue) === "true"
257
- }
258
- onChange={(evt) => {
259
- onChange(key, evt.target.checked ? "true" : "false");
260
- }}
261
- />
262
- )}
263
-
264
- {type === "select" && (
265
- <Select
266
- defaultValue={searchParams.get(key) || defaultValue}
267
- fullWidth
268
- onChange={(evt) => {
269
- onChange(key, evt.target.value);
270
- }}
271
- variant="standard"
272
- >
273
- <MenuItem value="travic_v2">Travic v2</MenuItem>
274
- <MenuItem value="base_dark_v2">Dark v2</MenuItem>
275
- </Select>
276
- )}
277
- </td>
278
- <td className="border p-4">
279
- {description}{" "}
280
- {defaultValue && (
281
- <>
282
- <br />
283
- <i>Default to &quot;{defaultValue}&quot;</i>
284
- </>
285
- )}
274
+ </div>
286
275
  </td>
287
276
  </tr>
288
277
  );
@@ -1,6 +1,11 @@
1
1
  "use client";
2
- import GeopsMobilityDoc from "../components/GeopsMobilityDoc";
2
+ import dynamic from "next/dynamic";
3
+
4
+ const DynamicComponentWithNoSSR = dynamic(
5
+ () => import("../components/GeopsMobilityDoc"),
6
+ { ssr: false },
7
+ );
3
8
 
4
9
  export default function GeopsMobility() {
5
- return <GeopsMobilityDoc />;
10
+ return <DynamicComponentWithNoSSR />;
6
11
  }
@@ -1,7 +1,11 @@
1
1
  "use client";
2
+ import dynamic from "next/dynamic";
2
3
 
3
- import GeopsMobilitySearchDoc from "../components/GeopsMobilitySearchDoc";
4
+ const DynamicComponentWithNoSSR = dynamic(
5
+ () => import("../components/GeopsMobilitySearchDoc"),
6
+ { ssr: false },
7
+ );
4
8
 
5
9
  export default function GeopsMobilitySearch() {
6
- return <GeopsMobilitySearchDoc />;
10
+ return <DynamicComponentWithNoSSR />;
7
11
  }