@mapsindoors/map-template 1.95.8 → 1.95.10

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 (59) hide show
  1. package/dist/{GoogleMapsMap-mNXwkS5r.mjs → GoogleMapsMap-CwUKio6U.mjs} +2 -2
  2. package/dist/{MapboxMap-JSpSXMbZ.mjs → MapboxMap-C5oy5rc4.mjs} +2 -2
  3. package/dist/favicon.png +0 -0
  4. package/dist/logo-192.png +0 -0
  5. package/dist/manifest.json +21 -0
  6. package/dist/mapsindoors-react.es.js +1 -1
  7. package/dist/mapsindoors-react.umd.js +236 -198
  8. package/dist/mapsindoors-webcomponent.es.js +51235 -42443
  9. package/dist/reactcomponent-Dyc_LGHg.mjs +37841 -0
  10. package/dist/robots.txt +3 -0
  11. package/package.json +5 -7
  12. package/dist/_commonjsHelpers-B85MJLTf.js +0 -5
  13. package/dist/app-globals-DQuL1Twl.js +0 -3
  14. package/dist/combo-box-item.entry.js +0 -13
  15. package/dist/icon-DT_sDkmK.js +0 -11
  16. package/dist/index-BZQHyS7V.js +0 -1701
  17. package/dist/index.js +0 -1
  18. package/dist/loader.js +0 -11
  19. package/dist/mi-card_2.entry.js +0 -33
  20. package/dist/mi-chip.entry.js +0 -31
  21. package/dist/mi-column.entry.js +0 -52
  22. package/dist/mi-combo-box.entry.js +0 -449
  23. package/dist/mi-components.js +0 -21
  24. package/dist/mi-data-table.entry.js +0 -324
  25. package/dist/mi-distance_2.entry.js +0 -69
  26. package/dist/mi-dropdown-item.entry.js +0 -13
  27. package/dist/mi-dropdown.entry.js +0 -656
  28. package/dist/mi-floor-selector.entry.js +0 -209
  29. package/dist/mi-keyboard.entry.js +0 -261
  30. package/dist/mi-list-item-category.entry.js +0 -51
  31. package/dist/mi-list-item-location.entry.js +0 -177
  32. package/dist/mi-list.entry.js +0 -68
  33. package/dist/mi-location-booking.entry.js +0 -5218
  34. package/dist/mi-location-info.entry.js +0 -71
  35. package/dist/mi-map-googlemaps.entry.js +0 -795
  36. package/dist/mi-map-mapbox.entry.js +0 -530
  37. package/dist/mi-metric-card.entry.js +0 -61
  38. package/dist/mi-my-position.entry.js +0 -2457
  39. package/dist/mi-notification.entry.js +0 -137
  40. package/dist/mi-route-instructions-heading.entry.js +0 -78
  41. package/dist/mi-route-instructions-maneuver-legacy.entry.js +0 -86
  42. package/dist/mi-route-instructions-maneuver.entry.js +0 -86
  43. package/dist/mi-route-instructions-step-legacy.entry.js +0 -322
  44. package/dist/mi-route-instructions-step.entry.js +0 -342
  45. package/dist/mi-route-instructions.entry.js +0 -176
  46. package/dist/mi-scroll-buttons.entry.js +0 -120
  47. package/dist/mi-search.entry.js +0 -429
  48. package/dist/mi-share-sms.entry.js +0 -94
  49. package/dist/mi-step-switcher.entry.js +0 -40
  50. package/dist/mi-tab-panel.entry.js +0 -25
  51. package/dist/mi-tab.entry.js +0 -10
  52. package/dist/mi-tabs.entry.js +0 -49
  53. package/dist/mi-time.entry.js +0 -57
  54. package/dist/mi-variables-CDNvnTkH.js +0 -5
  55. package/dist/reactcomponent-BrPGG2Eb.mjs +0 -29048
  56. package/dist/route-travel-mode.enum-BvqP1fpw.js +0 -9
  57. package/dist/sort-order.enum-jsLAbYWg.js +0 -566
  58. package/dist/unit-system.enum-BwPgAWqL.js +0 -7
  59. package/dist/utils-DNHzysQ6.js +0 -61
@@ -1,322 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-BZQHyS7V.js';
2
- import { U as UnitSystem } from './unit-system.enum-BwPgAWqL.js';
3
- import { c as isInternetExplorer } from './utils-DNHzysQ6.js';
4
-
5
- const routeInstructionsStepLegacyCss = () => `:host{display:block;font-family:Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"}.step{display:grid;grid-template-columns:40px 1fr 40px;grid-template-areas:"actionicon heading heading" "modeicon description toggle" "modeicon substeps substeps"}.step__action-icon{-ms-grid-row:1;-ms-grid-column:1;display:flex;justify-content:center;align-items:center;grid-area:actionicon}.step__action-icon--circled{position:relative}.step__action-icon--circled::before{position:absolute;width:24px;height:24px;border:1px solid #1c1917;content:"";border-radius:50%}.step__action-icon mi-icon{display:block;width:12px;height:12px}.step__heading{-ms-grid-row:1;-ms-grid-column:2;-ms-grid-column-span:2;grid-area:heading;font-size:1rem;margin:0;border-bottom:1px solid #DCDCDF;border-top:1px solid #DCDCDF;padding:12px}.step__heading>span{font-size:0.875rem;color:#6b7280}.step__travel-mode{-ms-grid-row:2;-ms-grid-row-span:2;-ms-grid-column:1;grid-area:modeicon;display:flex;justify-content:center;align-items:center;position:relative;min-height:72px}.step__travel-mode::before{position:absolute;width:calc(50% - 2px);left:0;height:100%;content:""}.step__travel-mode--dotted::before{border-right:4px dotted #bfdbfe}.step__travel-mode--solid::before{border-right:4px solid #bfdbfe}.step__travel-mode-icon{position:absolute;left:50%;top:24px;transform:translateX(-50%);background-color:#fcfcfc;padding:3px;border-radius:4px}.step__travel-mode-icon mi-icon{width:16px;height:16px;background-color:#6b7280;display:block}.step__description{-ms-grid-row:2;-ms-grid-column:2;grid-area:description;padding:12px}.step__short-name{margin-right:4px;padding:2px 4px;font-size:0.875rem;color:#fcfcfc;background-color:#6b7280;border-radius:2px}.step__distance-duration{color:#6b7280;font-size:0.875rem}.step__toggle{-ms-grid-row:2;-ms-grid-column:3;grid-area:toggle;display:flex;justify-content:center;align-items:center;transition:transform 300ms;cursor:pointer}.step__toggle--open{transform:rotate(180deg)}.step__toggle mi-icon{width:16px;height:16px;display:block;background-color:#3b82f6}.step__substeps{-ms-grid-row:3;-ms-grid-column:2;-ms-grid-column-span:2;grid-area:substeps}`;
6
-
7
- const RouteInstructionsStepLegacy = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.stepClicked = createEvent(this, "stepClicked", 7);
11
- /**
12
- * If indoor substeps/maneuvers should be hidden.
13
- *
14
- * @type {boolean}
15
- */
16
- this.hideIndoorSubsteps = true;
17
- /**
18
- * The route context of previous step, if any.
19
- * @type {string}
20
- */
21
- this.fromRouteContext = '';
22
- /**
23
- * Set imperial or metric as default unit system.
24
- * @type {UnitSystem} 'imperial' or 'metric'
25
- */
26
- this.unit = UnitSystem.Metric;
27
- /**
28
- * Signifies wether substeps are open or not.
29
- */
30
- this.substepsAreOpen = false;
31
- this.isInternetExplorer = isInternetExplorer();
32
- }
33
- parseStepProp() {
34
- if (this.step) {
35
- this.stepData = JSON.parse(this.step);
36
- }
37
- }
38
- parseTranslationsProp() {
39
- if (this.translations) {
40
- this.translationsData = JSON.parse(this.translations);
41
- }
42
- }
43
- componentWillLoad() {
44
- this.parseStepProp();
45
- this.parseTranslationsProp();
46
- }
47
- /**
48
- * Render if there is step data.
49
- */
50
- render() {
51
- return this.stepData && this.translationsData ? this.renderStep() : null;
52
- }
53
- /**
54
- * Emits stepClicked event (if click target is not related to an action)
55
- * @param event Event
56
- */
57
- stepClickHandler(event) {
58
- // Don't emit click event if clicked on elements that are actions to other things
59
- if (Array.from(event.target.classList).includes('icon-toggle')) {
60
- return;
61
- }
62
- let maneuverIndex = null;
63
- if (event.target.dataset.maneuverIndex !== undefined) {
64
- maneuverIndex = parseInt(event.target.dataset.maneuverIndex);
65
- }
66
- this.stepClicked.emit({ maneuverIndex });
67
- }
68
- /**
69
- * Render step part depending on travel mode.
70
- *
71
- * @returns {JSX.Element}
72
- */
73
- renderStep() {
74
- switch (this.stepData.travel_mode.toUpperCase()) {
75
- case 'DRIVING':
76
- return this.renderDrivingStep();
77
- case 'WALKING':
78
- return this.renderWalkingStep();
79
- case 'BICYCLING':
80
- return this.renderBicyclingStep();
81
- case 'TRANSIT':
82
- return this.renderTransitStep();
83
- default:
84
- return h("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
85
- }
86
- }
87
- /**
88
- * Render the travel mode indicator and dotted/solid line.
89
- *
90
- * @returns {JSX.Element}
91
- */
92
- renderTravelMode() {
93
- if (this.isInternetExplorer) {
94
- return null;
95
- }
96
- let travelModeIcon;
97
- switch (this.stepData.travel_mode.toUpperCase()) {
98
- case 'DRIVING':
99
- travelModeIcon = 'car';
100
- break;
101
- case 'WALKING':
102
- travelModeIcon = 'walk';
103
- break;
104
- case 'BICYCLING':
105
- travelModeIcon = 'bike';
106
- break;
107
- case 'TRANSIT':
108
- travelModeIcon = this.getTransitVehicleIconName();
109
- break;
110
- }
111
- return (h("span", { part: "step-travel-mode", class: `step__travel-mode step__travel-mode--${this.stepData.travel_mode.toUpperCase() === 'TRANSIT' ? 'solid' : 'dotted'}` }, h("span", { class: "step__travel-mode-icon" }, h("mi-icon", { part: "step-travel-mode-icon", "icon-name": travelModeIcon }))));
112
- }
113
- /**
114
- * Get icon name for transit vehicle.
115
- *
116
- * @returns {string}
117
- */
118
- getTransitVehicleIconName() {
119
- var _a, _b;
120
- const stepTransitVehicleType = (_b = (_a = this.stepData.transit_information) === null || _a === void 0 ? void 0 : _a.line.vehicle) === null || _b === void 0 ? void 0 : _b.type.toLowerCase();
121
- const transitVehicleTypes = ['boat', 'bus', 'railway', 'train', 'subway']; // Supported Transit Vehicles
122
- return stepTransitVehicleType && transitVehicleTypes.some(type => type === stepTransitVehicleType) ? stepTransitVehicleType : 'transit';
123
- }
124
- /**
125
- * Toggles visibility of sub steps (steps in steps)
126
- */
127
- toggleSubsteps() {
128
- this.substepsAreOpen = !this.substepsAreOpen;
129
- }
130
- /**
131
- * Render substeps if they should be visible.
132
- *
133
- * @returns {JSX.Element}
134
- */
135
- renderSubsteps() {
136
- return this.substepsAreOpen === true ? h("div", { class: "step__substeps" }, this.stepData.steps.map((maneuver, index) => {
137
- return h("mi-route-instructions-maneuver-legacy", { "data-maneuver-index": index, maneuver: JSON.stringify(maneuver), translations: this.translations, unit: this.unit,
138
- // @ts-ignore
139
- exportparts: "\n maneuver-icon,\n maneuver-description,\n maneuver-description-distance,\n maneuver-description-distance-border" });
140
- })) : null;
141
- }
142
- /**
143
- * Render the toggle button for the sub step expander.
144
- *
145
- * @returns {JSX.Element}
146
- */
147
- renderToggleButton() {
148
- // Return null if none substeps/maneuvers is provided
149
- if (this.stepData.steps.length <= 0) {
150
- return null;
151
- }
152
- // Return null if indoor substeps/maneuvers should be hidden and if the step context corresponds to being inside a building
153
- if (this.hideIndoorSubsteps === true && this.stepData.route_context.toLowerCase() === 'insidebuilding') {
154
- return null;
155
- }
156
- return (h("span", { class: `step__toggle ${this.substepsAreOpen ? 'step__toggle--open' : ''}`, onClick: () => this.toggleSubsteps() }, this.isInternetExplorer ? '\u25BC' :
157
- h("mi-icon", { part: "step-toggle", "icon-name": "toggle" })));
158
- }
159
- /**
160
- * Render time and distance part.
161
- *
162
- * @returns {JSX.Element}
163
- */
164
- renderTimeAndDistance() {
165
- return h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), "\u00A0\u00B7\u00A0", h("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), h("br", null));
166
- }
167
- /**
168
- * Render a driving step.
169
- *
170
- * @returns {JSX.Element}
171
- */
172
- renderDrivingStep() {
173
- return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
174
- h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "car" })), h("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.translationsData.drive, h("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
175
- }
176
- /**
177
- * Get display heading.
178
- *
179
- * @returns {string}
180
- */
181
- getStepHeading() {
182
- var _a;
183
- const defaultHeadings = {
184
- 'driving': this.translationsData.drive,
185
- 'walking': this.translationsData.walk,
186
- 'bicycling': this.translationsData.bike
187
- };
188
- return ((_a = this.stepData.steps[0]) === null || _a === void 0 ? void 0 : _a.instructions) ?
189
- this.stepData.steps[0].instructions :
190
- defaultHeadings[this.stepData.travel_mode.toLowerCase()];
191
- }
192
- /**
193
- * Render a walking step.
194
- *
195
- *
196
- * @returns {JSX.Element}
197
- */
198
- renderWalkingStep() {
199
- let heading;
200
- let actionIconName;
201
- /*
202
- * Determine action heading:
203
- */
204
- if (this.stepData.parking === true) {
205
- // Park your vehicle
206
- heading = `${this.translationsData.park} ${this.stepData.label ? ` ${this.translationsData.at} ` + this.stepData.label : ''}`;
207
- actionIconName = 'park';
208
- }
209
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'STEPS') { // TODO: SDK, why is highway not always set?
210
- // Take stairs
211
- heading = `${this.translationsData.takeStaircaseToLevel} ${this.stepData.end_location.floor_name}`;
212
- actionIconName = 'stairs';
213
- }
214
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'LADDER') {
215
- // Take a laddder
216
- heading = `${this.translationsData.takeLadderToLevel} ${this.stepData.end_location.floor_name}`;
217
- actionIconName = 'ladder';
218
- }
219
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ESCALATOR') {
220
- // Take an escalator
221
- heading = `${this.translationsData.takeEscalatorToLevel} ${this.stepData.end_location.floor_name}`;
222
- actionIconName = 'escalator';
223
- }
224
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRRAMP') {
225
- // Take wheel chair ramp
226
- heading = `${this.translationsData.takeWheelchairRampToLevel} ${this.stepData.end_location.floor_name}`;
227
- actionIconName = 'wheelchair-ramp';
228
- }
229
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRLIFT') {
230
- // Take wheel chair lift
231
- heading = `${this.translationsData.takeWheelchairLiftToLevel} ${this.stepData.end_location.floor_name}`;
232
- actionIconName = 'wheelchair-lift';
233
- }
234
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ELEVATOR') {
235
- // Take elevator
236
- heading = `${this.translationsData.takeElevatorToLevel} ${this.stepData.end_location.floor_name}`;
237
- actionIconName = 'elevator';
238
- }
239
- else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'Outside') {
240
- // Exit from inside to outside
241
- heading = this.addStepContextNameToHeading(this.translationsData.exit, this.stepData.start_context);
242
- actionIconName = 'exit';
243
- }
244
- else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'InsideBuilding') {
245
- heading = this.getStepHeading();
246
- actionIconName = 'walk';
247
- }
248
- else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside' && this.fromTravelMode.toUpperCase() === 'TRANSIT') {
249
- // Switching between public transportation
250
- heading = this.fromTransitStop;
251
- actionIconName = 'transit-stop';
252
- }
253
- else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside') {
254
- heading = this.getStepHeading();
255
- actionIconName = 'walk';
256
- }
257
- else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'InsideBuilding') {
258
- // Enter from outside to inside
259
- heading = this.addStepContextNameToHeading(this.translationsData.enter, this.stepData.end_context);
260
- actionIconName = 'enter';
261
- }
262
- else {
263
- // Origin Location name or empty
264
- heading = this.fromRouteContext;
265
- actionIconName = 'circle';
266
- }
267
- return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
268
- h("span", { class: `step__action-icon ${actionIconName !== 'circle' ? 'step__action-icon--circled' : ''}` }, h("mi-icon", { "icon-name": actionIconName })), h("h3", { part: "step-heading", class: "step__heading" }, heading), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.translationsData.walk, h("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
269
- }
270
- /**
271
- * Add building or venue name to the step heading
272
- * @param {string} heading
273
- * @param {StepContext} stepContext
274
- * @returns
275
- */
276
- addStepContextNameToHeading(heading, stepContext) {
277
- if (stepContext) {
278
- if (stepContext.building) {
279
- heading += ` ${stepContext.building.buildingInfo.name} ${this.translationsData.building}`;
280
- }
281
- else if (stepContext.venue) {
282
- heading += ` ${stepContext.venue.venueInfo.name} ${this.translationsData.venue}`;
283
- }
284
- }
285
- return heading;
286
- }
287
- /**
288
- * Render a bicycling step.
289
- *
290
- * @returns {JSX.Element}
291
- */
292
- renderBicyclingStep() {
293
- return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
294
- h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "bike" })), h("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.translationsData.bike, h("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
295
- }
296
- /**
297
- * Render a transit step.
298
- *
299
- * @returns {JSX.Element}
300
- */
301
- renderTransitStep() {
302
- var _a, _b;
303
- return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
304
- h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "transit-stop" })), h("h3", { part: "step-heading", class: "step__heading" }, this.stepData.instructions), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.stepData.transit_information.line.short_name ?
305
- h("span", { class: "step__short-name", style: {
306
- backgroundColor: ((_a = this.stepData.transit_information.line) === null || _a === void 0 ? void 0 : _a.color) ? this.stepData.transit_information.line.color : null,
307
- color: ((_b = this.stepData.transit_information.line) === null || _b === void 0 ? void 0 : _b.text_color) ? this.stepData.transit_information.line.text_color : null
308
- } }, this.stepData.transit_information.line.short_name) :
309
- null, this.stepData.transit_information.headsign ? this.stepData.transit_information.headsign : null, h("br", null), h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), "\u00A0\u00B7\u00A0", this.stepData.transit_information.num_stops ? this.stepData.transit_information.num_stops : null, " ", this.translationsData.stops ? this.translationsData.stops : null)), this.renderToggleButton(), this.renderSubsteps());
310
- }
311
- static get watchers() { return {
312
- "step": [{
313
- "parseStepProp": 0
314
- }],
315
- "translations": [{
316
- "parseTranslationsProp": 0
317
- }]
318
- }; }
319
- };
320
- RouteInstructionsStepLegacy.style = routeInstructionsStepLegacyCss();
321
-
322
- export { RouteInstructionsStepLegacy as mi_route_instructions_step_legacy };
@@ -1,342 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-BZQHyS7V.js';
2
- import { U as UnitSystem } from './unit-system.enum-BwPgAWqL.js';
3
- import { c as isInternetExplorer } from './utils-DNHzysQ6.js';
4
-
5
- const routeInstructionsStepCss = () => `:host{display:block;font-family:Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"}.step{display:grid;gap:16px;justify-items:center}.step__info{display:grid;grid-auto-flow:column;align-items:center;justify-content:space-between;width:100%;position:sticky;top:50px;background:white;z-index:1000;padding-bottom:8px}.step__destination{display:grid;gap:8px;align-items:center;justify-content:center;grid-auto-flow:column}.step__heading{font-weight:500;font-size:1.25rem;margin:0}.step__heading>span{font-size:0.875rem;color:#6b7280}.step__travel-mode{display:flex;justify-content:center;align-items:center;position:relative;min-height:72px}.step__travel-mode::before{position:absolute;width:calc(50% - 2px);left:0;height:100%;content:""}.step__travel-mode--dotted::before{border-right:4px dotted #bfdbfe}.step__travel-mode--solid::before{border-right:4px solid #bfdbfe}.step__travel-mode-icon{position:absolute;left:50%;top:24px;transform:translateX(-50%);background-color:#fcfcfc;padding:3px;border-radius:4px}.step__travel-mode-icon mi-icon{width:16px;height:16px;background-color:#6b7280;display:block}.step__short-name{margin-right:4px;padding:2px 4px;font-size:0.875rem;color:#fcfcfc;background-color:#6b7280;border-radius:2px}.step__distance-duration{color:#6b7280;font-size:0.875rem}.step__transit-action{font-weight:400;font-size:0.875rem;color:#6b7280}.step__toggle{display:grid;justify-content:center}.step__toggle mi-icon{width:24px;height:24px;display:block}.step__details{display:grid;gap:24px;width:100%}`;
6
-
7
- const RouteInstructionsStep = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.stepClicked = createEvent(this, "stepClicked", 7);
11
- this.substepsToggled = createEvent(this, "substepsToggled", 7);
12
- /**
13
- * If indoor substeps/maneuvers should be hidden.
14
- *
15
- * @type {boolean}
16
- */
17
- this.hideIndoorSubsteps = true;
18
- /**
19
- * The route context of previous step, if any.
20
- *
21
- * @type {string}
22
- */
23
- this.fromRouteContext = '';
24
- /**
25
- * Set imperial or metric as default unit system. Default is Metric unless the browser is running US English. In that case Imperial.
26
- *
27
- * @type {UnitSystem}
28
- */
29
- this.unit = navigator.language === 'en-US' ? UnitSystem.Imperial : UnitSystem.Metric;
30
- /**
31
- * Indicates if it should show the toggle button.
32
- *
33
- * @type {boolean}
34
- */
35
- this.showToggleButton = true;
36
- /**
37
- * Signifies wether substeps are open or not.
38
- */
39
- this.substepsAreOpen = false;
40
- this.isInternetExplorer = isInternetExplorer();
41
- }
42
- parseStepProp() {
43
- if (this.step) {
44
- this.stepData = JSON.parse(this.step);
45
- }
46
- }
47
- parseTranslationsProp() {
48
- if (this.translations) {
49
- this.translationsData = JSON.parse(this.translations);
50
- }
51
- }
52
- /**
53
- * Programmatically open the substeps.
54
- */
55
- async openSubsteps() {
56
- this.substepsAreOpen = true;
57
- }
58
- /**
59
- * Programmatically close the substeps.
60
- */
61
- async closeSubsteps() {
62
- this.substepsAreOpen = false;
63
- }
64
- /**
65
- * Component will load.
66
- */
67
- componentWillLoad() {
68
- this.parseStepProp();
69
- this.parseTranslationsProp();
70
- }
71
- /**
72
- * Render if there is step data.
73
- *
74
- * @returns {JSX.Element}
75
- */
76
- render() {
77
- return this.stepData && this.translationsData ? this.renderStep() : null;
78
- }
79
- /**
80
- * Emits stepClicked event (if click target is not related to an action).
81
- *
82
- * @param event - Event.
83
- */
84
- stepClickHandler(event) {
85
- // Don't emit click event if clicked on elements that are actions to other things
86
- if (Array.from(event.target.classList).includes('icon-toggle')) {
87
- return;
88
- }
89
- let maneuverIndex = null;
90
- if (event.target.dataset.maneuverIndex !== undefined) {
91
- maneuverIndex = parseInt(event.target.dataset.maneuverIndex);
92
- }
93
- this.stepClicked.emit({ maneuverIndex });
94
- }
95
- /**
96
- * Render step part depending on travel mode.
97
- *
98
- * @returns {JSX.Element}
99
- */
100
- renderStep() {
101
- switch (this.stepData.travel_mode.toUpperCase()) {
102
- case 'DRIVING':
103
- return this.renderDrivingStep();
104
- case 'WALKING':
105
- return this.renderWalkingStep();
106
- case 'BICYCLING':
107
- return this.renderBicyclingStep();
108
- case 'TRANSIT':
109
- return this.renderTransitStep();
110
- default:
111
- return h("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
112
- }
113
- }
114
- /**
115
- * Render the travel mode indicator and dotted/solid line.
116
- *
117
- * @returns {JSX.Element}
118
- */
119
- renderTravelMode() {
120
- if (this.isInternetExplorer) {
121
- return null;
122
- }
123
- let travelModeIcon;
124
- switch (this.stepData.travel_mode.toUpperCase()) {
125
- case 'DRIVING':
126
- travelModeIcon = 'car';
127
- break;
128
- case 'WALKING':
129
- travelModeIcon = 'walk';
130
- break;
131
- case 'BICYCLING':
132
- travelModeIcon = 'bike';
133
- break;
134
- case 'TRANSIT':
135
- travelModeIcon = this.getTransitVehicleIconName();
136
- break;
137
- }
138
- return (h("span", { part: "step-travel-mode", class: `step__travel-mode step__travel-mode--${this.stepData.travel_mode.toUpperCase() === 'TRANSIT' ? 'solid' : 'dotted'}` }, h("span", { class: "step__travel-mode-icon" }, h("mi-icon", { part: "step-travel-mode-icon", "icon-name": travelModeIcon }))));
139
- }
140
- /**
141
- * Get icon name for transit vehicle.
142
- *
143
- * @returns {string}
144
- */
145
- getTransitVehicleIconName() {
146
- var _a, _b;
147
- const stepTransitVehicleType = (_b = (_a = this.stepData.transit_information) === null || _a === void 0 ? void 0 : _a.line.vehicle) === null || _b === void 0 ? void 0 : _b.type.toLowerCase();
148
- const transitVehicleTypes = ['boat', 'bus', 'railway', 'train', 'subway']; // Supported Transit Vehicles
149
- return stepTransitVehicleType && transitVehicleTypes.some(type => type === stepTransitVehicleType) ? stepTransitVehicleType : 'transit';
150
- }
151
- /**
152
- * Toggles visibility of sub steps (steps in steps).
153
- */
154
- toggleSubsteps() {
155
- this.substepsToggled.emit();
156
- this.substepsAreOpen = !this.substepsAreOpen;
157
- }
158
- /**
159
- * Render substeps if they should be visible.
160
- *
161
- * @returns {JSX.Element}
162
- */
163
- renderSubsteps() {
164
- var _a;
165
- return this.substepsAreOpen === true ? h("div", { class: "step__substeps" }, (_a = this.stepData.steps) === null || _a === void 0 ? void 0 : _a.map((maneuver, index) => {
166
- return h("mi-route-instructions-maneuver", { "data-maneuver-index": index, maneuver: JSON.stringify(maneuver), translations: this.translations, unit: this.unit,
167
- // @ts-ignore
168
- exportparts: "\n maneuver-icon,\n maneuver-description,\n maneuver-description-distance,\n maneuver-description-distance-border" });
169
- })) : null;
170
- }
171
- /**
172
- * Render the toggle button for the sub step expander.
173
- *
174
- * @returns {JSX.Element}
175
- */
176
- renderToggleButton() {
177
- var _a;
178
- // Return null if none substeps/maneuvers is provided,
179
- // or if the showToggleButton is set to false.
180
- if (((_a = this.stepData.steps) === null || _a === void 0 ? void 0 : _a.length) <= 0 || !this.showToggleButton) {
181
- return null;
182
- }
183
- return (h("span", { class: 'step__toggle', onClick: () => this.toggleSubsteps() }, this.substepsAreOpen ?
184
- h("mi-icon", { part: "step-toggle", "icon-name": "chevron-up" })
185
- :
186
- h("mi-icon", { part: "step-toggle", "icon-name": "chevron-down" })));
187
- }
188
- /**
189
- * Render distance part.
190
- *
191
- * @returns {JSX.Element}
192
- */
193
- renderDistance() {
194
- return h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), h("br", null));
195
- }
196
- /**
197
- * Render toggle and substeps.
198
- *
199
- * @returns {JSX.Element}
200
- */
201
- showSubsteps() {
202
- return h("div", { class: "step__details" }, this.renderSubsteps());
203
- }
204
- /**
205
- * Render a driving step.
206
- *
207
- * @returns {JSX.Element}
208
- */
209
- renderDrivingStep() {
210
- return h("div", { class: "step", onClick: (e) => this.stepClickHandler(e) }, h("div", { class: "step__info" }, h("div", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderToggleButton()), this.showSubsteps());
211
- }
212
- /**
213
- * Get display heading.
214
- *
215
- * @returns {string}
216
- */
217
- getStepHeading() {
218
- var _a;
219
- const defaultHeadings = {
220
- 'driving': this.translationsData.drive,
221
- 'walking': this.translationsData.walk,
222
- 'bicycling': this.translationsData.bike,
223
- };
224
- return ((_a = this.stepData.steps[0]) === null || _a === void 0 ? void 0 : _a.instructions) ?
225
- this.stepData.steps[0].instructions :
226
- defaultHeadings[this.stepData.travel_mode.toLowerCase()];
227
- }
228
- /**
229
- * Render a walking step.
230
- *
231
- *
232
- * @returns {JSX.Element}
233
- */
234
- renderWalkingStep() {
235
- let heading;
236
- /*
237
- * Determine action heading:
238
- */
239
- if (this.stepData.parking === true) {
240
- // Park your vehicle
241
- heading = `${this.translationsData.park} ${this.stepData.label ? ` ${this.translationsData.at} ` + this.stepData.label : ''}`;
242
- }
243
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'STEPS') { // TODO: SDK, why is highway not always set?
244
- // Take stairs
245
- heading = `${this.translationsData.takeStaircaseToLevel} ${this.stepData.end_location.floor_name}`;
246
- }
247
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'LADDER') {
248
- // Take a laddder
249
- heading = `${this.translationsData.takeLadderToLevel} ${this.stepData.end_location.floor_name}`;
250
- }
251
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ESCALATOR') {
252
- // Take an escalator
253
- heading = `${this.translationsData.takeEscalatorToLevel} ${this.stepData.end_location.floor_name}`;
254
- }
255
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRRAMP') {
256
- // Take wheel chair ramp
257
- heading = `${this.translationsData.takeWheelchairRampToLevel} ${this.stepData.end_location.floor_name}`;
258
- }
259
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRLIFT') {
260
- // Take wheel chair lift
261
- heading = `${this.translationsData.takeWheelchairLiftToLevel} ${this.stepData.end_location.floor_name}`;
262
- }
263
- else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ELEVATOR') {
264
- // Take elevator
265
- heading = `${this.translationsData.takeElevatorToLevel} ${this.stepData.end_location.floor_name}`;
266
- }
267
- else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'Outside') {
268
- // Exit from inside to outside
269
- heading = this.addStepContextNameToHeading(this.translationsData.exit, this.stepData.start_context);
270
- }
271
- else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'InsideBuilding') {
272
- heading = this.getStepHeading();
273
- }
274
- else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside' && this.fromTravelMode.toUpperCase() === 'TRANSIT') {
275
- // Switching between public transportation
276
- heading = this.fromTransitStop;
277
- }
278
- else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside') {
279
- heading = this.getStepHeading();
280
- }
281
- else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'InsideBuilding') {
282
- // Enter from outside to inside
283
- heading = this.addStepContextNameToHeading(this.translationsData.enter, this.stepData.end_context);
284
- }
285
- else {
286
- // Origin Location name or empty
287
- heading = this.fromRouteContext === 'InsideBuilding' ? 'Inside Building' : this.fromRouteContext;
288
- }
289
- return h("div", { class: "step", onClick: (e) => this.stepClickHandler(e) }, h("div", { class: "step__info" }, h("div", { part: "step-heading", class: "step__heading" }, heading), this.renderToggleButton()), this.showSubsteps());
290
- }
291
- /**
292
- * Add building or venue name to the step heading.
293
- *
294
- * @param {string} heading
295
- * @param {StepContext} stepContext
296
- * @returns {string}
297
- */
298
- addStepContextNameToHeading(heading, stepContext) {
299
- if (stepContext) {
300
- if (stepContext.building) {
301
- heading += ` ${stepContext.building.buildingInfo.name} ${this.translationsData.building}`;
302
- }
303
- else if (stepContext.venue) {
304
- heading += ` ${stepContext.venue.venueInfo.name} ${this.translationsData.venue}`;
305
- }
306
- }
307
- return heading;
308
- }
309
- /**
310
- * Render a bicycling step.
311
- *
312
- * @returns {JSX.Element}
313
- */
314
- renderBicyclingStep() {
315
- return h("div", { class: "step", onClick: (e) => this.stepClickHandler(e) }, h("div", { class: "step__info" }, h("div", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderToggleButton()), this.showSubsteps());
316
- }
317
- /**
318
- * Render a transit step. Inclusing BUSWAY instruction.
319
- *
320
- * @returns {JSX.Element}
321
- */
322
- renderTransitStep() {
323
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
324
- return h("div", { class: "step", onClick: (e) => this.stepClickHandler(e) }, h("div", { class: "step__info" }, h("h3", { part: "step-heading", class: "step__heading" }, this.stepData.travel_mode === 'TRANSIT' ? `${this.translationsData.rideTheBus}` : (_a = this.stepData) === null || _a === void 0 ? void 0 : _a.instructions), this.renderToggleButton()), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, ((_d = (_c = (_b = this.stepData) === null || _b === void 0 ? void 0 : _b.transit_information) === null || _c === void 0 ? void 0 : _c.line) === null || _d === void 0 ? void 0 : _d.short_name) ?
325
- h("span", { class: "step__short-name", style: {
326
- backgroundColor: ((_g = (_f = (_e = this.stepData) === null || _e === void 0 ? void 0 : _e.transit_information) === null || _f === void 0 ? void 0 : _f.line) === null || _g === void 0 ? void 0 : _g.color) ? (_k = (_j = (_h = this.stepData) === null || _h === void 0 ? void 0 : _h.transit_information) === null || _j === void 0 ? void 0 : _j.line) === null || _k === void 0 ? void 0 : _k.color : null,
327
- color: ((_o = (_m = (_l = this.stepData) === null || _l === void 0 ? void 0 : _l.transit_information) === null || _m === void 0 ? void 0 : _m.line) === null || _o === void 0 ? void 0 : _o.text_color) ? (_r = (_q = (_p = this.stepData) === null || _p === void 0 ? void 0 : _p.transit_information) === null || _q === void 0 ? void 0 : _q.line) === null || _r === void 0 ? void 0 : _r.text_color : null
328
- } }, (_u = (_t = (_s = this.stepData) === null || _s === void 0 ? void 0 : _s.transit_information) === null || _t === void 0 ? void 0 : _t.line) === null || _u === void 0 ? void 0 : _u.short_name) :
329
- null, ((_w = (_v = this.stepData) === null || _v === void 0 ? void 0 : _v.transit_information) === null || _w === void 0 ? void 0 : _w.headsign) ? (_y = (_x = this.stepData) === null || _x === void 0 ? void 0 : _x.transit_information) === null || _y === void 0 ? void 0 : _y.headsign : null, h("br", null), h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-time", { seconds: (_0 = (_z = this.stepData) === null || _z === void 0 ? void 0 : _z.duration) === null || _0 === void 0 ? void 0 : _0.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), "\u00A0\u00B7\u00A0", ((_2 = (_1 = this.stepData) === null || _1 === void 0 ? void 0 : _1.transit_information) === null || _2 === void 0 ? void 0 : _2.num_stops) ? (_4 = (_3 = this.stepData) === null || _3 === void 0 ? void 0 : _3.transit_information) === null || _4 === void 0 ? void 0 : _4.num_stops : null, " ", this.translationsData.stops ? this.translationsData.stops : null)), this.showSubsteps());
330
- }
331
- static get watchers() { return {
332
- "step": [{
333
- "parseStepProp": 0
334
- }],
335
- "translations": [{
336
- "parseTranslationsProp": 0
337
- }]
338
- }; }
339
- };
340
- RouteInstructionsStep.style = routeInstructionsStepCss();
341
-
342
- export { RouteInstructionsStep as mi_route_instructions_step };