@opentripplanner/core-utils 4.11.6-alpha.1 → 5.0.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 (70) hide show
  1. package/esm/deprecated-with-types.js +47 -0
  2. package/esm/deprecated-with-types.js.map +1 -0
  3. package/esm/index.js +0 -4
  4. package/esm/index.js.map +1 -1
  5. package/esm/itinerary.js +1 -1
  6. package/esm/itinerary.js.map +1 -1
  7. package/esm/map.js +4 -9
  8. package/esm/map.js.map +1 -1
  9. package/esm/route.js +5 -3
  10. package/esm/route.js.map +1 -1
  11. package/esm/storage.js +1 -0
  12. package/esm/storage.js.map +1 -1
  13. package/esm/time.js +6 -36
  14. package/esm/time.js.map +1 -1
  15. package/esm/ui.js +1 -1
  16. package/esm/ui.js.map +1 -1
  17. package/lib/deprecated-with-types.d.ts +23 -0
  18. package/lib/deprecated-with-types.d.ts.map +1 -0
  19. package/lib/deprecated-with-types.js +61 -0
  20. package/lib/deprecated-with-types.js.map +1 -0
  21. package/lib/index.d.ts +19 -0
  22. package/lib/index.d.ts.map +1 -0
  23. package/lib/index.js +0 -6
  24. package/lib/index.js.map +1 -1
  25. package/lib/itinerary.d.ts +113 -0
  26. package/lib/itinerary.d.ts.map +1 -0
  27. package/lib/itinerary.js +2 -1
  28. package/lib/itinerary.js.map +1 -1
  29. package/lib/map.d.ts +30 -0
  30. package/lib/map.d.ts.map +1 -0
  31. package/lib/map.js +3 -8
  32. package/lib/map.js.map +1 -1
  33. package/lib/route.d.ts +98 -0
  34. package/lib/route.d.ts.map +1 -0
  35. package/lib/route.js +5 -3
  36. package/lib/route.js.map +1 -1
  37. package/lib/storage.d.ts +19 -0
  38. package/lib/storage.d.ts.map +1 -0
  39. package/lib/storage.js +2 -0
  40. package/lib/storage.js.map +1 -1
  41. package/lib/time.d.ts +65 -0
  42. package/lib/time.d.ts.map +1 -0
  43. package/lib/time.js +22 -39
  44. package/lib/time.js.map +1 -1
  45. package/lib/ui.d.ts +13 -0
  46. package/lib/ui.d.ts.map +1 -0
  47. package/lib/ui.js +1 -1
  48. package/lib/ui.js.map +1 -1
  49. package/package.json +4 -1
  50. package/src/__tests__/__snapshots__/route.js.snap +30 -30
  51. package/src/deprecated-with-types.ts +62 -0
  52. package/src/{index.js → index.ts} +0 -4
  53. package/src/{itinerary.js → itinerary.ts} +70 -36
  54. package/src/{map.js → map.ts} +43 -31
  55. package/src/{route.js → route.ts} +52 -28
  56. package/src/{storage.js → storage.ts} +6 -5
  57. package/src/{time.js → time.ts} +28 -46
  58. package/src/{ui.js → ui.ts} +8 -8
  59. package/tsconfig.json +15 -0
  60. package/tsconfig.tsbuildinfo +4921 -0
  61. package/esm/messages.js +0 -25
  62. package/esm/messages.js.map +0 -1
  63. package/esm/types.js +0 -560
  64. package/esm/types.js.map +0 -1
  65. package/lib/messages.js +0 -29
  66. package/lib/messages.js.map +0 -1
  67. package/lib/types.js +0 -661
  68. package/lib/types.js.map +0 -1
  69. package/src/messages.js +0 -20
  70. package/src/types.js +0 -605
package/esm/messages.js DELETED
@@ -1,25 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
-
7
- // This entire file can be removed once deprecation goes forward
8
- import { logDeprecationWarning } from "./deprecated";
9
- /**
10
- * Takes component's default props messages and its instance props messages and
11
- * returns the merged messages. The returned object will ensure that the default
12
- * messages are substituted for any translation strings that were missing in the
13
- * props. Note: this does not account for messages in nested objects (e.g.,
14
- * messages.header.description).
15
- */
16
-
17
- /* eslint-disable import/prefer-default-export */
18
-
19
- export function mergeMessages(defaultPropsMessages, propsMessages) {
20
- logDeprecationWarning("mergeMessages");
21
- var defaultMessages = defaultPropsMessages || {};
22
- var instanceMessages = propsMessages || {};
23
- return _objectSpread(_objectSpread({}, defaultMessages), instanceMessages);
24
- }
25
- //# sourceMappingURL=messages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/messages.js"],"names":["logDeprecationWarning","mergeMessages","defaultPropsMessages","propsMessages","defaultMessages","instanceMessages"],"mappings":";;;;;;AAAA;AACA,SAASA,qBAAT,QAAsC,cAAtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AACA,OAAO,SAASC,aAAT,CAAuBC,oBAAvB,EAA6CC,aAA7C,EAA4D;AACjEH,EAAAA,qBAAqB,CAAC,eAAD,CAArB;AAEA,MAAMI,eAAe,GAAGF,oBAAoB,IAAI,EAAhD;AACA,MAAMG,gBAAgB,GAAGF,aAAa,IAAI,EAA1C;AACA,yCACKC,eADL,GAEKC,gBAFL;AAID","sourcesContent":["// This entire file can be removed once deprecation goes forward\nimport { logDeprecationWarning } from \"./deprecated\";\n/**\n * Takes component's default props messages and its instance props messages and\n * returns the merged messages. The returned object will ensure that the default\n * messages are substituted for any translation strings that were missing in the\n * props. Note: this does not account for messages in nested objects (e.g.,\n * messages.header.description).\n */\n/* eslint-disable import/prefer-default-export */\nexport function mergeMessages(defaultPropsMessages, propsMessages) {\n logDeprecationWarning(\"mergeMessages\");\n\n const defaultMessages = defaultPropsMessages || {};\n const instanceMessages = propsMessages || {};\n return {\n ...defaultMessages,\n ...instanceMessages\n };\n}\n"],"file":"messages.js"}
package/esm/types.js DELETED
@@ -1,560 +0,0 @@
1
- import PropTypes from "prop-types";
2
- import { ReactPropTypeLocationNames } from "react";
3
- import { isValidLatLng } from "./map";
4
- export var companyType = PropTypes.shape({
5
- id: PropTypes.string.isRequired,
6
- label: PropTypes.string.isRequired,
7
-
8
- /* a comma-separated string listing the modes that this company has */
9
- modes: PropTypes.string.isRequired
10
- });
11
- /**
12
- * Leaflet path properties to use to style a CircleMarker, Marker or Polyline.
13
- *
14
- * See https://leafletjs.com/reference-1.6.0.html#path
15
- */
16
-
17
- export var leafletPathType = PropTypes.shape({
18
- bubblingMouseEvents: PropTypes.bool,
19
- color: PropTypes.string,
20
- className: PropTypes.string,
21
- dashArray: PropTypes.string,
22
- dashOffset: PropTypes.string,
23
- fill: PropTypes.bool,
24
- fillColor: PropTypes.string,
25
- fillOpacity: PropTypes.number,
26
- fillRule: PropTypes.string,
27
- lineCap: PropTypes.string,
28
- lineJoin: PropTypes.string,
29
- opacity: PropTypes.number,
30
- renderer: PropTypes.func,
31
- stroke: PropTypes.bool,
32
- weight: PropTypes.number
33
- });
34
- /**
35
- * Describes some options to help display data about a transit agency that is
36
- * configured in an opentripplanner instance.
37
- */
38
-
39
- export var transitOperatorType = PropTypes.shape({
40
- agencyId: PropTypes.string.isRequired,
41
- defaultRouteColor: PropTypes.string,
42
- defaultRouteTextColor: PropTypes.string,
43
- feedId: PropTypes.string.isRequired,
44
- logo: PropTypes.string,
45
- longNameSplitter: PropTypes.string,
46
- name: PropTypes.string,
47
- order: PropTypes.number
48
- });
49
- export var languageConfigType = PropTypes.shape({
50
- stopViewer: PropTypes.string
51
- });
52
- /**
53
- * Defines which symbol to render based on a zoom level, and optionally by entity type.
54
- * (Only one symbol is rendered for any zoom level.)
55
- */
56
-
57
- export var zoomBasedSymbolType = PropTypes.shape({
58
- /**
59
- * A function with the signature (entity: object) => string
60
- * that determines the type of an entity.
61
- * symbolByType and getType must be either be both specified or both omitted.
62
- */
63
- getType: PropTypes.func,
64
-
65
- /**
66
- * The zoom level beginning at which the marker is drawn,
67
- * unless another marker with a higher minZoom is met.
68
- */
69
- minZoom: PropTypes.number.isRequired,
70
-
71
- /**
72
- * The symbol-representing component to draw, with the signature
73
- * ({ entity: object, zoom: number }) => Element
74
- * where entity must have an id attribute and contain coordinates information for placement on the map.
75
- */
76
- symbol: PropTypes.elementType.isRequired,
77
-
78
- /**
79
- * The symbol-representing component to draw for each entity type,
80
- * with the same signature as symbol. If a type returned by getType() is not listed,
81
- * then the component defined in the 'symbol' attribute will be rendered by default.
82
- * symbolByType and getType must be either be both specified or both omitted.
83
- */
84
- symbolByType: PropTypes.objectOf(PropTypes.elementType)
85
- });
86
- /** describes the objects from the real-time vehicle service */
87
-
88
- export var transitVehicleType = PropTypes.shape({
89
- routeShortName: PropTypes.string,
90
- routeLongName: PropTypes.string,
91
- routeType: PropTypes.string,
92
- status: PropTypes.string,
93
- reportDate: PropTypes.string,
94
- seconds: PropTypes.number,
95
- stopSequence: PropTypes.number,
96
- stopId: PropTypes.string,
97
- vehicleId: PropTypes.string,
98
- tripId: PropTypes.string,
99
- blockId: PropTypes.string,
100
- lat: PropTypes.number,
101
- lon: PropTypes.number,
102
- heading: PropTypes.number
103
- });
104
- export var vehicleRentalMapOverlaySymbolsType = PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
105
- dockStrokeColor: PropTypes.string,
106
- fillColor: PropTypes.string,
107
- minZoom: PropTypes.number.isRequired,
108
- pixels: PropTypes.number,
109
- type: PropTypes.string.isRequired
110
- }), zoomBasedSymbolType]).isRequired);
111
- /**
112
- * Represents the expected configuration of the webapp.
113
- *
114
- * Note: this is an incomplete type mapping.
115
- */
116
-
117
- export var configType = PropTypes.shape({
118
- companies: PropTypes.arrayOf(companyType.isRequired),
119
- dateTime: PropTypes.shape({
120
- timeFormat: PropTypes.string,
121
- dateFormat: PropTypes.string,
122
- longDateFormat: PropTypes.string
123
- }),
124
- // TODO: add full typing
125
- map: PropTypes.shape({
126
- overlays: PropTypes.arrayOf(PropTypes.shape({
127
- /**
128
- * The applicable companies this overlay covers. Only applicable in
129
- * certain vehicle rental overlays.
130
- */
131
- companies: PropTypes.arrayOf(PropTypes.string.isRequired),
132
- name: PropTypes.string.isRequired,
133
-
134
- /**
135
- * The applicable map symbols. Only applicable in vehicle rental
136
- * overlays.
137
- */
138
- mapSymbols: vehicleRentalMapOverlaySymbolsType,
139
-
140
- /**
141
- * Only used during park and ride queries. This will filter out P&Rs
142
- * that are further than the specified number of meters from a transit
143
- * stop.
144
- */
145
- maxTransitDistance: PropTypes.number,
146
-
147
- /**
148
- * The applicable modes this overlay covers. Only applicable in certain
149
- * vehicle rental overlays.
150
- */
151
- modes: PropTypes.arrayOf(PropTypes.string.isRequired),
152
-
153
- /**
154
- * The type of overlay. Currently valid values include:
155
- *
156
- * "bike-rental", "car-rental", "micromobility-rental", "park-and-ride",
157
- * "stops", "tile"
158
- */
159
- type: PropTypes.string.isRequired
160
- }))
161
- }),
162
- transitOperators: PropTypes.arrayOf(transitOperatorType)
163
- });
164
- var feedScopedIdType = PropTypes.shape({
165
- agencyId: PropTypes.string,
166
- id: PropTypes.string
167
- });
168
- export var encodedPolylineType = PropTypes.shape({
169
- length: PropTypes.number.isRequired,
170
- points: PropTypes.string.isRequired
171
- });
172
- var elevationData = PropTypes.arrayOf(PropTypes.shape({
173
- first: PropTypes.number.isRequired,
174
- second: PropTypes.number.isRequired
175
- }).isRequired);
176
- var alertType = PropTypes.shape({
177
- alertHeaderText: PropTypes.string,
178
- alertDescriptionText: PropTypes.string,
179
- alertUrl: PropTypes.string,
180
- effectiveStartDate: PropTypes.number
181
- });
182
- /**
183
- * Represents steps in a leg in an itinerary of an OTP plan response. These are
184
- * only for non-transit modes.
185
- * See documentation here: http://otp-docs.ibi-transit.com/api/json_WalkStep.html
186
- */
187
-
188
- export var stepsType = PropTypes.arrayOf(PropTypes.shape({
189
- absoluteDirection: PropTypes.string,
190
- alerts: PropTypes.arrayOf(alertType),
191
- area: PropTypes.bool.isRequired,
192
- bogusName: PropTypes.bool.isRequired,
193
- distance: PropTypes.number.isRequired,
194
- elevation: elevationData.isRequired,
195
- lat: PropTypes.number.isRequired,
196
- lon: PropTypes.number.isRequired,
197
- relativeDirection: PropTypes.string.isRequired,
198
- stayOn: PropTypes.bool.isRequired,
199
- streetName: PropTypes.string.isRequired
200
- }));
201
- export var placeType = PropTypes.shape({
202
- arrival: PropTypes.number,
203
- departure: PropTypes.number,
204
- lat: PropTypes.number.isRequired,
205
- lon: PropTypes.number.isRequired,
206
- name: PropTypes.string.isRequired,
207
- networks: PropTypes.arrayOf(PropTypes.string.isRequired),
208
- stopCode: PropTypes.string,
209
- stopId: PropTypes.string,
210
- stopIndex: PropTypes.number,
211
- stopSequence: PropTypes.number,
212
- vertexType: PropTypes.string.isRequired,
213
- zoneId: PropTypes.string
214
- });
215
- /**
216
- * Represents a leg in an itinerary of an OTP plan response. Each leg represents
217
- * a portion of the overall itinerary that is done until either reaching the
218
- * destination or transitioning to another mode of travel. See OTP webservice
219
- * documentation here:
220
- * http://otp-docs.ibi-transit.com/api/json_Leg.html
221
- */
222
-
223
- export var legType = PropTypes.shape({
224
- agencyId: PropTypes.string,
225
- agencyName: PropTypes.string,
226
- agencyTimeZoneOffset: PropTypes.number.isRequired,
227
- agencyUrl: PropTypes.string,
228
- alerts: PropTypes.arrayOf(alertType),
229
- arrivalDelay: PropTypes.number.isRequired,
230
- departureDelay: PropTypes.number.isRequired,
231
- distance: PropTypes.number.isRequired,
232
- duration: PropTypes.number.isRequired,
233
- endTime: PropTypes.number.isRequired,
234
- from: placeType.isRequired,
235
- hailedCar: PropTypes.bool,
236
- headsign: PropTypes.string,
237
- interlineWithPreviousLeg: PropTypes.bool.isRequired,
238
- intermediateStops: PropTypes.arrayOf(placeType).isRequired,
239
- interStopGeometry: PropTypes.arrayOf(encodedPolylineType),
240
- legGeometry: encodedPolylineType.isRequired,
241
- mode: PropTypes.string.isRequired,
242
- pathway: PropTypes.bool.isRequired,
243
- realTime: PropTypes.bool.isRequired,
244
- rentedBike: PropTypes.bool.isRequired,
245
- rentedCar: PropTypes.bool.isRequired,
246
- rentedVehicle: PropTypes.bool.isRequired,
247
- route: PropTypes.string,
248
- routeId: PropTypes.string,
249
- routeType: PropTypes.number,
250
- serviceDate: PropTypes.string,
251
- startTime: PropTypes.number.isRequired,
252
- steps: stepsType.isRequired,
253
- tncData: PropTypes.shape({
254
- company: PropTypes.string.isRequired,
255
- currency: PropTypes.string.isRequired,
256
- displayName: PropTypes.string.isRequired,
257
- estimatedArrival: PropTypes.number.isRequired,
258
- maxCost: PropTypes.number.isRequired,
259
- minCost: PropTypes.number.isRequired,
260
- productId: PropTypes.string.isRequired,
261
- travelDuration: PropTypes.number.isRequired
262
- }),
263
- to: placeType.isRequired,
264
- transitLeg: PropTypes.bool.isRequired,
265
- tripBlockId: PropTypes.string,
266
- tripId: PropTypes.string
267
- });
268
- var moneyType = PropTypes.shape({
269
- cents: PropTypes.number.isRequired,
270
- currency: PropTypes.shape({
271
- defaultFractionDigits: PropTypes.number.isRequired,
272
- currencyCode: PropTypes.string.isRequired,
273
- symbol: PropTypes.string.isRequired,
274
- currency: PropTypes.string.isRequired
275
- }).isRequired
276
- });
277
- /**
278
- * Represents the fare component of an itinerary of an OTP plan response. See
279
- * detailed documentation in OTP webservice documentation here:
280
- * http://otp-docs.ibi-transit.com/api/json_Fare.html
281
- *
282
- * NOTE: so far the fare includes ONLY a fare encountered on public transit and
283
- * not any bike rental or TNC rental fees.
284
- */
285
-
286
- export var fareType = PropTypes.shape({
287
- details: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.shape({
288
- fareId: PropTypes.oneOfType([PropTypes.string, feedScopedIdType]).isRequired,
289
- price: moneyType.isRequired,
290
- routes: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, feedScopedIdType])).isRequired
291
- })).isRequired),
292
- fare: PropTypes.objectOf(moneyType)
293
- });
294
- /**
295
- * Represents an itinerary of an OTP plan response. See detailed documentation
296
- * in OTP webservice documentation here:
297
- * http://otp-docs.ibi-transit.com/api/json_Itinerary.html
298
- */
299
-
300
- export var itineraryType = PropTypes.shape({
301
- duration: PropTypes.number.isRequired,
302
- elevationGained: PropTypes.number.isRequired,
303
- elevationLost: PropTypes.number.isRequired,
304
- endTime: PropTypes.number.isRequired,
305
- fare: fareType,
306
- legs: PropTypes.arrayOf(legType).isRequired,
307
- startTime: PropTypes.number.isRequired,
308
- tooSloped: PropTypes.bool,
309
- transfers: PropTypes.number.isRequired,
310
- transitTime: PropTypes.number.isRequired,
311
- waitingTime: PropTypes.number.isRequired,
312
- walkDistance: PropTypes.number.isRequired,
313
- walkLimitExceeded: PropTypes.bool.isRequired,
314
- walkTime: PropTypes.number.isRequired
315
- });
316
- /**
317
- * Used to model a location that is used in planning a trip.
318
- */
319
-
320
- export var locationType = PropTypes.shape({
321
- lat: PropTypes.number.isRequired,
322
- lon: PropTypes.number.isRequired,
323
- name: PropTypes.string.isRequired,
324
-
325
- /**
326
- * This is only used location that a user has saved. Can be either:
327
- * "home" or "work"
328
- */
329
- type: PropTypes.string
330
- });
331
- /**
332
- * Used to help display the time of day within the context of a particular itinerary.
333
- */
334
-
335
- export var timeOptionsType = PropTypes.shape({
336
- /**
337
- * A format string template to be used to display a date using moment.js
338
- */
339
- format: PropTypes.string,
340
-
341
- /*
342
- * The timezone offset in milliseconds if any should be added. This is
343
- * typically calculated using the itinerary.js#getTimeZoneOffset function.
344
- */
345
- offset: PropTypes.number
346
- });
347
- /**
348
- * This models data about a stop and it's associated routes that is obtained
349
- * from a transit index API.
350
- */
351
-
352
- export var transitIndexStopWithRoutes = PropTypes.shape({
353
- /**
354
- * The stop code if the stop has one
355
- */
356
- code: PropTypes.string,
357
-
358
- /**
359
- * The distance from the user to the stop in meters
360
- */
361
- dist: PropTypes.number,
362
- lat: PropTypes.number,
363
- lon: PropTypes.number,
364
- name: PropTypes.string,
365
- routes: PropTypes.arrayOf(PropTypes.shape({
366
- longName: PropTypes.string,
367
- shortName: PropTypes.string
368
- }))
369
- });
370
- export var stopLayerStopType = PropTypes.shape({
371
- id: PropTypes.string.isRequired,
372
- name: PropTypes.string.isRequired,
373
- lat: PropTypes.number.isRequired,
374
- lon: PropTypes.number.isRequired
375
- });
376
- var transitivePlaceType = PropTypes.shape({
377
- place_id: PropTypes.string.isRequired,
378
- type: PropTypes.string.isRequired
379
- });
380
- export var transitiveDataType = PropTypes.shape({
381
- journeys: PropTypes.arrayOf(PropTypes.shape({
382
- journey_id: PropTypes.string.isRequired,
383
- journey_name: PropTypes.string.isRequired,
384
- segments: PropTypes.arrayOf(PropTypes.shape({
385
- arc: PropTypes.bool,
386
- from: transitivePlaceType,
387
- patterns: PropTypes.arrayOf(PropTypes.shape({
388
- pattern_id: PropTypes.string.isRequired,
389
- from_stop_index: PropTypes.number.isRequired,
390
- to_stop_index: PropTypes.number.isRequired
391
- })),
392
- streetEdges: PropTypes.arrayOf(PropTypes.number),
393
- to: transitivePlaceType,
394
- type: PropTypes.string.isRequired
395
- })).isRequired
396
- })).isRequired,
397
- patterns: PropTypes.arrayOf(PropTypes.shape({
398
- pattern_id: PropTypes.string.isRequired,
399
- pattern_name: PropTypes.string.isRequired,
400
- route_id: PropTypes.string.isRequired,
401
- stops: PropTypes.arrayOf(PropTypes.shape({
402
- geometry: PropTypes.string,
403
- stop_id: PropTypes.string.isRequired
404
- })).isRequired
405
- })).isRequired,
406
- places: PropTypes.arrayOf(PropTypes.shape({
407
- place_id: PropTypes.string.isRequired,
408
- place_lat: PropTypes.number.isRequired,
409
- place_lon: PropTypes.number.isRequired,
410
- place_name: PropTypes.string
411
- })).isRequired,
412
- routes: PropTypes.arrayOf(PropTypes.shape({
413
- agency_id: PropTypes.string.isRequired,
414
- route_id: PropTypes.string.isRequired,
415
- route_short_name: PropTypes.string.isRequired,
416
- route_long_name: PropTypes.string.isRequired,
417
- route_type: PropTypes.number.isRequired,
418
- route_color: PropTypes.string
419
- })).isRequired,
420
- stops: PropTypes.arrayOf(PropTypes.shape({
421
- stop_id: PropTypes.string.isRequired,
422
- stop_name: PropTypes.string.isRequired,
423
- stop_lat: PropTypes.number.isRequired,
424
- stop_lon: PropTypes.number.isRequired
425
- })).isRequired,
426
- streetEdges: PropTypes.arrayOf(PropTypes.shape({
427
- edge_id: PropTypes.number.isRequired,
428
- geometry: encodedPolylineType
429
- })).isRequired
430
- });
431
- /**
432
- * This models data about a vehicle rental station as obtained from various
433
- * vehicle rental API endpoints from OTP.
434
- */
435
-
436
- export var stationType = PropTypes.shape({
437
- bikesAvailable: PropTypes.number,
438
- id: PropTypes.string.isRequired,
439
- isFloatingBike: PropTypes.bool,
440
- isFloatingCar: PropTypes.bool,
441
- isFloatingVehicle: PropTypes.bool,
442
- name: PropTypes.string,
443
- networks: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
444
- spacesAvailable: PropTypes.number,
445
- x: PropTypes.number.isRequired,
446
- y: PropTypes.number.isRequired
447
- });
448
- /**
449
- * Utility function to help create chained validators
450
- * per https://www.ian-thomas.net/custom-proptype-validation-with-react/
451
- * @param {*} validator The validator to use.
452
- */
453
-
454
- export function createChainableTypeChecker(validator) {
455
- function checkType(isRequired, props, propName, componentName, location) {
456
- componentName = componentName || "ANONYMOUS";
457
-
458
- if (props[propName] == null) {
459
- if (isRequired) {
460
- var locationName = ReactPropTypeLocationNames[location];
461
- return new Error("Required '".concat(locationName, "/").concat(propName, "' was not specified in '").concat(componentName, "'."));
462
- }
463
-
464
- return null;
465
- }
466
-
467
- return validator(props, propName, componentName, location);
468
- }
469
-
470
- var chainedCheckType = checkType.bind(null, false);
471
- chainedCheckType.isRequired = checkType.bind(null, true);
472
- return chainedCheckType;
473
- }
474
- export var latlngType = createChainableTypeChecker(function (props, propName) {
475
- // Source: https://reactjs.org/docs/typechecking-with-proptypes.html#react.proptypes
476
- if (!isValidLatLng(props[propName])) {
477
- return new Error("".concat(propName, " needs to be a [lat, lng] array"));
478
- }
479
-
480
- return null;
481
- });
482
- export var modeOptionType = PropTypes.shape({
483
- id: PropTypes.string.isRequired,
484
- selected: PropTypes.bool,
485
- showTitle: PropTypes.bool,
486
- text: PropTypes.node.isRequired,
487
- title: PropTypes.string
488
- });
489
- export var modeSelectorOptionsType = PropTypes.shape({
490
- primary: modeOptionType,
491
- secondary: PropTypes.arrayOf(modeOptionType),
492
- tertiary: PropTypes.arrayOf(modeOptionType)
493
- });
494
- export var configuredModeType = PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
495
- mode: PropTypes.string.isRequired,
496
- label: PropTypes.string.isRequired,
497
- company: PropTypes.string
498
- })]);
499
- export var configuredModesType = PropTypes.shape({
500
- transitModes: PropTypes.arrayOf(configuredModeType),
501
- accessModes: PropTypes.arrayOf(configuredModeType),
502
- exclusiveModes: PropTypes.arrayOf(configuredModeType),
503
- bicycleModes: PropTypes.arrayOf(configuredModeType),
504
- micromobilityModes: PropTypes.arrayOf(configuredModeType)
505
- });
506
- export var configuredCompanyType = PropTypes.shape({
507
- /**
508
- * The id of the company. This is typically in all-caps.
509
- */
510
- id: PropTypes.string.isRequired,
511
-
512
- /**
513
- * A human readable text value that can be displayed to users.
514
- */
515
- label: PropTypes.string.isRequired,
516
-
517
- /**
518
- * A comma-separated list of applicable modes of travel that the company
519
- * offers.
520
- */
521
- modes: PropTypes.string.isRequired
522
- });
523
- /**
524
- * Depending on the geocoder that is used, more properties than just the `label`
525
- * property might be provided by the geocoder. For example, with the Pelias
526
- * geocoder, properties such as `id`, `layer`, `source` are also included.
527
- */
528
-
529
- export var geocodedFeatureType = PropTypes.shape({
530
- geometry: PropTypes.shape({
531
- coordinates: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired,
532
- type: PropTypes.string.isRequired
533
- }).isRequired,
534
- properties: PropTypes.shape({
535
- label: PropTypes.string.isRequired
536
- }).isRequired
537
- });
538
- export var userLocationType = PropTypes.shape({
539
- id: PropTypes.string,
540
-
541
- /**
542
- * Can be either 'home', 'work', or null
543
- */
544
- icon: PropTypes.string,
545
- lat: PropTypes.number.isRequired,
546
- lon: PropTypes.number.isRequired,
547
- name: PropTypes.string.isRequired,
548
-
549
- /**
550
- * This represents the last time that this location was selected in a
551
- * search
552
- */
553
- timestamp: PropTypes.number,
554
-
555
- /**
556
- * One of: 'home', 'work', 'stop' or 'recent'
557
- */
558
- type: PropTypes.string.isRequired
559
- });
560
- //# sourceMappingURL=types.js.map