@mapsindoors/map-template 1.93.2 → 1.94.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 (103) hide show
  1. package/dist/{GoogleMapsMap-982405ad.mjs → GoogleMapsMap-BqYRaFgc.mjs} +51 -62
  2. package/dist/MapboxMap-CUYrfLHY.mjs +34732 -0
  3. package/dist/_commonjsHelpers-ba3f0406.js +21 -0
  4. package/dist/combo-box-item.entry.js +15 -0
  5. package/dist/icon-b8d01d6f.js +24 -0
  6. package/dist/index-7e9696f3.js +1678 -0
  7. package/dist/index.js +1 -0
  8. package/dist/loader.js +18 -0
  9. package/dist/mapsindoors-react.es.js +3 -5
  10. package/dist/mapsindoors-react.umd.js +197 -582
  11. package/dist/mapsindoors-webcomponent.es.js +58512 -75790
  12. package/dist/mi-card_2.entry.js +28 -0
  13. package/dist/mi-chip.entry.js +22 -0
  14. package/dist/mi-column.entry.js +28 -0
  15. package/dist/mi-combo-box.entry.js +416 -0
  16. package/dist/mi-components.js +18 -0
  17. package/dist/mi-data-table.entry.js +302 -0
  18. package/dist/mi-distance_2.entry.js +67 -0
  19. package/dist/mi-dropdown-item.entry.js +15 -0
  20. package/dist/mi-dropdown.entry.js +610 -0
  21. package/dist/mi-floor-selector.entry.js +202 -0
  22. package/dist/mi-keyboard.entry.js +238 -0
  23. package/dist/mi-list-item-category.entry.js +48 -0
  24. package/dist/mi-list-item-location.entry.js +171 -0
  25. package/dist/mi-list.entry.js +56 -0
  26. package/dist/mi-location-booking.entry.js +5193 -0
  27. package/dist/mi-location-info.entry.js +63 -0
  28. package/dist/mi-map-googlemaps.entry.js +750 -0
  29. package/dist/mi-map-mapbox.entry.js +467 -0
  30. package/dist/mi-metric-card.entry.js +48 -0
  31. package/dist/mi-my-position.entry.js +986 -0
  32. package/dist/mi-notification.entry.js +127 -0
  33. package/dist/mi-route-instructions-heading.entry.js +73 -0
  34. package/dist/mi-route-instructions-maneuver-legacy.entry.js +82 -0
  35. package/dist/mi-route-instructions-maneuver.entry.js +82 -0
  36. package/dist/mi-route-instructions-step-legacy.entry.js +308 -0
  37. package/dist/mi-route-instructions-step.entry.js +321 -0
  38. package/dist/mi-route-instructions.entry.js +157 -0
  39. package/dist/mi-scroll-buttons.entry.js +112 -0
  40. package/dist/mi-search.entry.js +376 -0
  41. package/dist/mi-share-sms.entry.js +80 -0
  42. package/dist/mi-step-switcher.entry.js +31 -0
  43. package/dist/mi-tab-panel.entry.js +25 -0
  44. package/dist/mi-tab.entry.js +12 -0
  45. package/dist/mi-tabs.entry.js +47 -0
  46. package/dist/mi-time.entry.js +57 -0
  47. package/dist/mi-variables-9a6c8d4d.js +6 -0
  48. package/dist/polyfills/core-js.js +11 -0
  49. package/dist/polyfills/css-shim.js +1 -0
  50. package/dist/polyfills/dom.js +79 -0
  51. package/dist/polyfills/es5-html-element.js +1 -0
  52. package/dist/polyfills/index.js +34 -0
  53. package/dist/polyfills/system.js +6 -0
  54. package/dist/{reactcomponent-7fbbd9b2.mjs → reactcomponent-DTepe7hB.mjs} +14121 -14626
  55. package/dist/route-travel-mode.enum-7f4ce9c7.js +9 -0
  56. package/dist/sort-order.enum-64ce8998.js +552 -0
  57. package/dist/unit-system.enum-eaefb53e.js +7 -0
  58. package/dist/utils-ae714467.js +61 -0
  59. package/package.json +10 -6
  60. package/dist/MapboxMap-06ef82a3.mjs +0 -37815
  61. package/dist/_commonjsHelpers-ba3f0406-b96e6d6a.mjs +0 -22
  62. package/dist/combo-box-item.entry-d35f3d51.mjs +0 -15
  63. package/dist/icon-b8d01d6f-ddfa2c17.mjs +0 -25
  64. package/dist/mapsindoors-webcomponent.umd.js +0 -3245
  65. package/dist/mi-card_2.entry-fc772c35.mjs +0 -26
  66. package/dist/mi-chip.entry-81c742a1.mjs +0 -19
  67. package/dist/mi-column.entry-3a083282.mjs +0 -21
  68. package/dist/mi-combo-box.entry-cae6401a.mjs +0 -263
  69. package/dist/mi-data-table.entry-d4c3f445.mjs +0 -224
  70. package/dist/mi-distance_2.entry-a33ed69a.mjs +0 -339
  71. package/dist/mi-dropdown-item.entry-974d1e4f.mjs +0 -15
  72. package/dist/mi-dropdown.entry-5317db65.mjs +0 -349
  73. package/dist/mi-floor-selector.entry-185fbd8b.mjs +0 -115
  74. package/dist/mi-keyboard.entry-eaf4b9ef.mjs +0 -3103
  75. package/dist/mi-list-item-category.entry-9c95008c.mjs +0 -39
  76. package/dist/mi-list-item-location.entry-8b41e8f0.mjs +0 -137
  77. package/dist/mi-list.entry-1218d29d.mjs +0 -42
  78. package/dist/mi-location-booking.entry-270aaf5a.mjs +0 -4866
  79. package/dist/mi-location-info.entry-e4f7fd04.mjs +0 -32
  80. package/dist/mi-map-googlemaps.entry-81fa28d2.mjs +0 -467
  81. package/dist/mi-map-mapbox.entry-31821da3.mjs +0 -301
  82. package/dist/mi-metric-card.entry-40407f04.mjs +0 -29
  83. package/dist/mi-my-position.entry-bc48fe6e.mjs +0 -703
  84. package/dist/mi-notification.entry-9a2bc53b.mjs +0 -84
  85. package/dist/mi-route-instructions-heading.entry-e5b1ff04.mjs +0 -75
  86. package/dist/mi-route-instructions-maneuver-legacy.entry-2c3d73ab.mjs +0 -76
  87. package/dist/mi-route-instructions-maneuver.entry-c6f01024.mjs +0 -76
  88. package/dist/mi-route-instructions-step-legacy.entry-80bcf097.mjs +0 -202
  89. package/dist/mi-route-instructions-step.entry-db802e13.mjs +0 -231
  90. package/dist/mi-route-instructions.entry-62416e29.mjs +0 -143
  91. package/dist/mi-scroll-buttons.entry-92b62b21.mjs +0 -83
  92. package/dist/mi-search.entry-87f1e64a.mjs +0 -251
  93. package/dist/mi-share-sms.entry-b6725edb.mjs +0 -56
  94. package/dist/mi-step-switcher.entry-f8f6c040.mjs +0 -27
  95. package/dist/mi-tab-panel.entry-a89213c2.mjs +0 -22
  96. package/dist/mi-tab.entry-a2fb3f8c.mjs +0 -14
  97. package/dist/mi-tabs.entry-cd638ea7.mjs +0 -37
  98. package/dist/mi-time.entry-0b02870d.mjs +0 -46
  99. package/dist/mi-variables-9a6c8d4d-e06eec88.mjs +0 -8
  100. package/dist/route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs +0 -8
  101. package/dist/sort-order.enum-64ce8998-b75ac596.mjs +0 -318
  102. package/dist/unit-system.enum-eaefb53e-0f424da4.mjs +0 -8
  103. package/dist/utils-ae714467-b07fc3be.mjs +0 -37
@@ -0,0 +1,308 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-7e9696f3.js';
2
+ import { U as UnitSystem } from './unit-system.enum-eaefb53e.js';
3
+ import { c as isInternetExplorer } from './utils-ae714467.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
+ this.isInternetExplorer = isInternetExplorer();
12
+ this.step = undefined;
13
+ this.stepData = undefined;
14
+ this.hideIndoorSubsteps = true;
15
+ this.fromRouteContext = '';
16
+ this.fromTravelMode = undefined;
17
+ this.fromTransitStop = undefined;
18
+ this.unit = UnitSystem.Metric;
19
+ this.translations = undefined;
20
+ this.translationsData = undefined;
21
+ this.substepsAreOpen = false;
22
+ }
23
+ parseStepProp() {
24
+ if (this.step) {
25
+ this.stepData = JSON.parse(this.step);
26
+ }
27
+ }
28
+ parseTranslationsProp() {
29
+ if (this.translations) {
30
+ this.translationsData = JSON.parse(this.translations);
31
+ }
32
+ }
33
+ componentWillLoad() {
34
+ this.parseStepProp();
35
+ this.parseTranslationsProp();
36
+ }
37
+ /**
38
+ * Render if there is step data.
39
+ */
40
+ render() {
41
+ return this.stepData && this.translationsData ? this.renderStep() : null;
42
+ }
43
+ /**
44
+ * Emits stepClicked event (if click target is not related to an action)
45
+ * @param event Event
46
+ */
47
+ stepClickHandler(event) {
48
+ // Don't emit click event if clicked on elements that are actions to other things
49
+ if (Array.from(event.target.classList).includes('icon-toggle')) {
50
+ return;
51
+ }
52
+ let maneuverIndex = null;
53
+ if (event.target.dataset.maneuverIndex !== undefined) {
54
+ maneuverIndex = parseInt(event.target.dataset.maneuverIndex);
55
+ }
56
+ this.stepClicked.emit({ maneuverIndex });
57
+ }
58
+ /**
59
+ * Render step part depending on travel mode.
60
+ *
61
+ * @returns {JSX.Element}
62
+ */
63
+ renderStep() {
64
+ switch (this.stepData.travel_mode.toUpperCase()) {
65
+ case 'DRIVING':
66
+ return this.renderDrivingStep();
67
+ case 'WALKING':
68
+ return this.renderWalkingStep();
69
+ case 'BICYCLING':
70
+ return this.renderBicyclingStep();
71
+ case 'TRANSIT':
72
+ return this.renderTransitStep();
73
+ default:
74
+ return h("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
75
+ }
76
+ }
77
+ /**
78
+ * Render the travel mode indicator and dotted/solid line.
79
+ *
80
+ * @returns {JSX.Element}
81
+ */
82
+ renderTravelMode() {
83
+ if (this.isInternetExplorer) {
84
+ return null;
85
+ }
86
+ let travelModeIcon;
87
+ switch (this.stepData.travel_mode.toUpperCase()) {
88
+ case 'DRIVING':
89
+ travelModeIcon = 'car';
90
+ break;
91
+ case 'WALKING':
92
+ travelModeIcon = 'walk';
93
+ break;
94
+ case 'BICYCLING':
95
+ travelModeIcon = 'bike';
96
+ break;
97
+ case 'TRANSIT':
98
+ travelModeIcon = this.getTransitVehicleIconName();
99
+ break;
100
+ }
101
+ 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 }))));
102
+ }
103
+ /**
104
+ * Get icon name for transit vehicle.
105
+ *
106
+ * @returns {string}
107
+ */
108
+ getTransitVehicleIconName() {
109
+ var _a, _b;
110
+ 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();
111
+ const transitVehicleTypes = ['boat', 'bus', 'railway', 'train', 'subway']; // Supported Transit Vehicles
112
+ return stepTransitVehicleType && transitVehicleTypes.some(type => type === stepTransitVehicleType) ? stepTransitVehicleType : 'transit';
113
+ }
114
+ /**
115
+ * Toggles visibility of sub steps (steps in steps)
116
+ */
117
+ toggleSubsteps() {
118
+ this.substepsAreOpen = !this.substepsAreOpen;
119
+ }
120
+ /**
121
+ * Render substeps if they should be visible.
122
+ *
123
+ * @returns {JSX.Element}
124
+ */
125
+ renderSubsteps() {
126
+ return this.substepsAreOpen === true ? h("div", { class: "step__substeps" }, this.stepData.steps.map((maneuver, index) => {
127
+ return h("mi-route-instructions-maneuver-legacy", { "data-maneuver-index": index, maneuver: JSON.stringify(maneuver), translations: this.translations, unit: this.unit,
128
+ // @ts-ignore
129
+ exportparts: "\n maneuver-icon,\n maneuver-description,\n maneuver-description-distance,\n maneuver-description-distance-border" });
130
+ })) : null;
131
+ }
132
+ /**
133
+ * Render the toggle button for the sub step expander.
134
+ *
135
+ * @returns {JSX.Element}
136
+ */
137
+ renderToggleButton() {
138
+ // Return null if none substeps/maneuvers is provided
139
+ if (this.stepData.steps.length <= 0) {
140
+ return null;
141
+ }
142
+ // Return null if indoor substeps/maneuvers should be hidden and if the step context corresponds to being inside a building
143
+ if (this.hideIndoorSubsteps === true && this.stepData.route_context.toLowerCase() === 'insidebuilding') {
144
+ return null;
145
+ }
146
+ return (h("span", { class: `step__toggle ${this.substepsAreOpen ? 'step__toggle--open' : ''}`, onClick: () => this.toggleSubsteps() }, this.isInternetExplorer ? '\u25BC' :
147
+ h("mi-icon", { part: "step-toggle", "icon-name": "toggle" })));
148
+ }
149
+ /**
150
+ * Render time and distance part.
151
+ *
152
+ * @returns {JSX.Element}
153
+ */
154
+ renderTimeAndDistance() {
155
+ 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));
156
+ }
157
+ /**
158
+ * Render a driving step.
159
+ *
160
+ * @returns {JSX.Element}
161
+ */
162
+ renderDrivingStep() {
163
+ return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
164
+ 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());
165
+ }
166
+ /**
167
+ * Get display heading.
168
+ *
169
+ * @returns {string}
170
+ */
171
+ getStepHeading() {
172
+ var _a;
173
+ const defaultHeadings = {
174
+ 'driving': this.translationsData.drive,
175
+ 'walking': this.translationsData.walk,
176
+ 'bicycling': this.translationsData.bike
177
+ };
178
+ return ((_a = this.stepData.steps[0]) === null || _a === void 0 ? void 0 : _a.instructions) ?
179
+ this.stepData.steps[0].instructions :
180
+ defaultHeadings[this.stepData.travel_mode.toLowerCase()];
181
+ }
182
+ /**
183
+ * Render a walking step.
184
+ *
185
+ *
186
+ * @returns {JSX.Element}
187
+ */
188
+ renderWalkingStep() {
189
+ let heading;
190
+ let actionIconName;
191
+ /*
192
+ * Determine action heading:
193
+ */
194
+ if (this.stepData.parking === true) {
195
+ // Park your vehicle
196
+ heading = `${this.translationsData.park} ${this.stepData.label ? ` ${this.translationsData.at} ` + this.stepData.label : ''}`;
197
+ actionIconName = 'park';
198
+ }
199
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'STEPS') { // TODO: SDK, why is highway not always set?
200
+ // Take stairs
201
+ heading = `${this.translationsData.takeStaircaseToLevel} ${this.stepData.end_location.floor_name}`;
202
+ actionIconName = 'stairs';
203
+ }
204
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'LADDER') {
205
+ // Take a laddder
206
+ heading = `${this.translationsData.takeLadderToLevel} ${this.stepData.end_location.floor_name}`;
207
+ actionIconName = 'ladder';
208
+ }
209
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ESCALATOR') {
210
+ // Take an escalator
211
+ heading = `${this.translationsData.takeEscalatorToLevel} ${this.stepData.end_location.floor_name}`;
212
+ actionIconName = 'escalator';
213
+ }
214
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRRAMP') {
215
+ // Take wheel chair ramp
216
+ heading = `${this.translationsData.takeWheelchairRampToLevel} ${this.stepData.end_location.floor_name}`;
217
+ actionIconName = 'wheelchair-ramp';
218
+ }
219
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRLIFT') {
220
+ // Take wheel chair lift
221
+ heading = `${this.translationsData.takeWheelchairLiftToLevel} ${this.stepData.end_location.floor_name}`;
222
+ actionIconName = 'wheelchair-lift';
223
+ }
224
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ELEVATOR') {
225
+ // Take elevator
226
+ heading = `${this.translationsData.takeElevatorToLevel} ${this.stepData.end_location.floor_name}`;
227
+ actionIconName = 'elevator';
228
+ }
229
+ else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'Outside') {
230
+ // Exit from inside to outside
231
+ heading = this.addStepContextNameToHeading(this.translationsData.exit, this.stepData.start_context);
232
+ actionIconName = 'exit';
233
+ }
234
+ else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'InsideBuilding') {
235
+ heading = this.getStepHeading();
236
+ actionIconName = 'walk';
237
+ }
238
+ else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside' && this.fromTravelMode.toUpperCase() === 'TRANSIT') {
239
+ // Switching between public transportation
240
+ heading = this.fromTransitStop;
241
+ actionIconName = 'transit-stop';
242
+ }
243
+ else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside') {
244
+ heading = this.getStepHeading();
245
+ actionIconName = 'walk';
246
+ }
247
+ else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'InsideBuilding') {
248
+ // Enter from outside to inside
249
+ heading = this.addStepContextNameToHeading(this.translationsData.enter, this.stepData.end_context);
250
+ actionIconName = 'enter';
251
+ }
252
+ else {
253
+ // Origin Location name or empty
254
+ heading = this.fromRouteContext;
255
+ actionIconName = 'circle';
256
+ }
257
+ return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
258
+ 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());
259
+ }
260
+ /**
261
+ * Add building or venue name to the step heading
262
+ * @param {string} heading
263
+ * @param {StepContext} stepContext
264
+ * @returns
265
+ */
266
+ addStepContextNameToHeading(heading, stepContext) {
267
+ if (stepContext) {
268
+ if (stepContext.building) {
269
+ heading += ` ${stepContext.building.buildingInfo.name} ${this.translationsData.building}`;
270
+ }
271
+ else if (stepContext.venue) {
272
+ heading += ` ${stepContext.venue.venueInfo.name} ${this.translationsData.venue}`;
273
+ }
274
+ }
275
+ return heading;
276
+ }
277
+ /**
278
+ * Render a bicycling step.
279
+ *
280
+ * @returns {JSX.Element}
281
+ */
282
+ renderBicyclingStep() {
283
+ return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
284
+ 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());
285
+ }
286
+ /**
287
+ * Render a transit step.
288
+ *
289
+ * @returns {JSX.Element}
290
+ */
291
+ renderTransitStep() {
292
+ var _a, _b;
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": "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 ?
295
+ h("span", { class: "step__short-name", style: {
296
+ backgroundColor: ((_a = this.stepData.transit_information.line) === null || _a === void 0 ? void 0 : _a.color) ? this.stepData.transit_information.line.color : null,
297
+ color: ((_b = this.stepData.transit_information.line) === null || _b === void 0 ? void 0 : _b.text_color) ? this.stepData.transit_information.line.text_color : null
298
+ } }, this.stepData.transit_information.line.short_name) :
299
+ 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());
300
+ }
301
+ static get watchers() { return {
302
+ "step": ["parseStepProp"],
303
+ "translations": ["parseTranslationsProp"]
304
+ }; }
305
+ };
306
+ RouteInstructionsStepLegacy.style = routeInstructionsStepLegacyCss;
307
+
308
+ export { RouteInstructionsStepLegacy as mi_route_instructions_step_legacy };
@@ -0,0 +1,321 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-7e9696f3.js';
2
+ import { U as UnitSystem } from './unit-system.enum-eaefb53e.js';
3
+ import { c as isInternetExplorer } from './utils-ae714467.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
+ this.isInternetExplorer = isInternetExplorer();
13
+ this.step = undefined;
14
+ this.stepData = undefined;
15
+ this.hideIndoorSubsteps = true;
16
+ this.fromRouteContext = '';
17
+ this.fromTravelMode = undefined;
18
+ this.fromTransitStop = undefined;
19
+ this.unit = navigator.language === 'en-US' ? UnitSystem.Imperial : UnitSystem.Metric;
20
+ this.showToggleButton = true;
21
+ this.translations = undefined;
22
+ this.translationsData = undefined;
23
+ this.substepsAreOpen = false;
24
+ }
25
+ parseStepProp() {
26
+ if (this.step) {
27
+ this.stepData = JSON.parse(this.step);
28
+ }
29
+ }
30
+ parseTranslationsProp() {
31
+ if (this.translations) {
32
+ this.translationsData = JSON.parse(this.translations);
33
+ }
34
+ }
35
+ /**
36
+ * Programmatically open the substeps.
37
+ */
38
+ openSubsteps() {
39
+ this.substepsAreOpen = true;
40
+ }
41
+ /**
42
+ * Programmatically close the substeps.
43
+ */
44
+ closeSubsteps() {
45
+ this.substepsAreOpen = false;
46
+ }
47
+ /**
48
+ * Component will load.
49
+ */
50
+ componentWillLoad() {
51
+ this.parseStepProp();
52
+ this.parseTranslationsProp();
53
+ }
54
+ /**
55
+ * Render if there is step data.
56
+ *
57
+ * @returns {JSX.Element}
58
+ */
59
+ render() {
60
+ return this.stepData && this.translationsData ? this.renderStep() : null;
61
+ }
62
+ /**
63
+ * Emits stepClicked event (if click target is not related to an action).
64
+ *
65
+ * @param event - Event.
66
+ */
67
+ stepClickHandler(event) {
68
+ // Don't emit click event if clicked on elements that are actions to other things
69
+ if (Array.from(event.target.classList).includes('icon-toggle')) {
70
+ return;
71
+ }
72
+ let maneuverIndex = null;
73
+ if (event.target.dataset.maneuverIndex !== undefined) {
74
+ maneuverIndex = parseInt(event.target.dataset.maneuverIndex);
75
+ }
76
+ this.stepClicked.emit({ maneuverIndex });
77
+ }
78
+ /**
79
+ * Render step part depending on travel mode.
80
+ *
81
+ * @returns {JSX.Element}
82
+ */
83
+ renderStep() {
84
+ switch (this.stepData.travel_mode.toUpperCase()) {
85
+ case 'DRIVING':
86
+ return this.renderDrivingStep();
87
+ case 'WALKING':
88
+ return this.renderWalkingStep();
89
+ case 'BICYCLING':
90
+ return this.renderBicyclingStep();
91
+ case 'TRANSIT':
92
+ return this.renderTransitStep();
93
+ default:
94
+ return h("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
95
+ }
96
+ }
97
+ /**
98
+ * Render the travel mode indicator and dotted/solid line.
99
+ *
100
+ * @returns {JSX.Element}
101
+ */
102
+ renderTravelMode() {
103
+ if (this.isInternetExplorer) {
104
+ return null;
105
+ }
106
+ let travelModeIcon;
107
+ switch (this.stepData.travel_mode.toUpperCase()) {
108
+ case 'DRIVING':
109
+ travelModeIcon = 'car';
110
+ break;
111
+ case 'WALKING':
112
+ travelModeIcon = 'walk';
113
+ break;
114
+ case 'BICYCLING':
115
+ travelModeIcon = 'bike';
116
+ break;
117
+ case 'TRANSIT':
118
+ travelModeIcon = this.getTransitVehicleIconName();
119
+ break;
120
+ }
121
+ 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 }))));
122
+ }
123
+ /**
124
+ * Get icon name for transit vehicle.
125
+ *
126
+ * @returns {string}
127
+ */
128
+ getTransitVehicleIconName() {
129
+ var _a, _b;
130
+ 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();
131
+ const transitVehicleTypes = ['boat', 'bus', 'railway', 'train', 'subway']; // Supported Transit Vehicles
132
+ return stepTransitVehicleType && transitVehicleTypes.some(type => type === stepTransitVehicleType) ? stepTransitVehicleType : 'transit';
133
+ }
134
+ /**
135
+ * Toggles visibility of sub steps (steps in steps).
136
+ */
137
+ toggleSubsteps() {
138
+ this.substepsToggled.emit();
139
+ this.substepsAreOpen = !this.substepsAreOpen;
140
+ }
141
+ /**
142
+ * Render substeps if they should be visible.
143
+ *
144
+ * @returns {JSX.Element}
145
+ */
146
+ renderSubsteps() {
147
+ var _a;
148
+ return this.substepsAreOpen === true ? h("div", { class: "step__substeps" }, (_a = this.stepData.steps) === null || _a === void 0 ? void 0 : _a.map((maneuver, index) => {
149
+ return h("mi-route-instructions-maneuver", { "data-maneuver-index": index, maneuver: JSON.stringify(maneuver), translations: this.translations, unit: this.unit,
150
+ // @ts-ignore
151
+ exportparts: "\n maneuver-icon,\n maneuver-description,\n maneuver-description-distance,\n maneuver-description-distance-border" });
152
+ })) : null;
153
+ }
154
+ /**
155
+ * Render the toggle button for the sub step expander.
156
+ *
157
+ * @returns {JSX.Element}
158
+ */
159
+ renderToggleButton() {
160
+ var _a;
161
+ // Return null if none substeps/maneuvers is provided,
162
+ // or if the showToggleButton is set to false.
163
+ if (((_a = this.stepData.steps) === null || _a === void 0 ? void 0 : _a.length) <= 0 || !this.showToggleButton) {
164
+ return null;
165
+ }
166
+ return (h("span", { class: 'step__toggle', onClick: () => this.toggleSubsteps() }, this.substepsAreOpen ?
167
+ h("mi-icon", { part: "step-toggle", "icon-name": "chevron-up" })
168
+ :
169
+ h("mi-icon", { part: "step-toggle", "icon-name": "chevron-down" })));
170
+ }
171
+ /**
172
+ * Render distance part.
173
+ *
174
+ * @returns {JSX.Element}
175
+ */
176
+ renderDistance() {
177
+ return h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), h("br", null));
178
+ }
179
+ /**
180
+ * Render toggle and substeps.
181
+ *
182
+ * @returns {JSX.Element}
183
+ */
184
+ showSubsteps() {
185
+ return h("div", { class: "step__details" }, this.renderSubsteps());
186
+ }
187
+ /**
188
+ * Render a driving step.
189
+ *
190
+ * @returns {JSX.Element}
191
+ */
192
+ renderDrivingStep() {
193
+ 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());
194
+ }
195
+ /**
196
+ * Get display heading.
197
+ *
198
+ * @returns {string}
199
+ */
200
+ getStepHeading() {
201
+ var _a;
202
+ const defaultHeadings = {
203
+ 'driving': this.translationsData.drive,
204
+ 'walking': this.translationsData.walk,
205
+ 'bicycling': this.translationsData.bike,
206
+ };
207
+ return ((_a = this.stepData.steps[0]) === null || _a === void 0 ? void 0 : _a.instructions) ?
208
+ this.stepData.steps[0].instructions :
209
+ defaultHeadings[this.stepData.travel_mode.toLowerCase()];
210
+ }
211
+ /**
212
+ * Render a walking step.
213
+ *
214
+ *
215
+ * @returns {JSX.Element}
216
+ */
217
+ renderWalkingStep() {
218
+ let heading;
219
+ /*
220
+ * Determine action heading:
221
+ */
222
+ if (this.stepData.parking === true) {
223
+ // Park your vehicle
224
+ heading = `${this.translationsData.park} ${this.stepData.label ? ` ${this.translationsData.at} ` + this.stepData.label : ''}`;
225
+ }
226
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'STEPS') { // TODO: SDK, why is highway not always set?
227
+ // Take stairs
228
+ heading = `${this.translationsData.takeStaircaseToLevel} ${this.stepData.end_location.floor_name}`;
229
+ }
230
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'LADDER') {
231
+ // Take a laddder
232
+ heading = `${this.translationsData.takeLadderToLevel} ${this.stepData.end_location.floor_name}`;
233
+ }
234
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ESCALATOR') {
235
+ // Take an escalator
236
+ heading = `${this.translationsData.takeEscalatorToLevel} ${this.stepData.end_location.floor_name}`;
237
+ }
238
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRRAMP') {
239
+ // Take wheel chair ramp
240
+ heading = `${this.translationsData.takeWheelchairRampToLevel} ${this.stepData.end_location.floor_name}`;
241
+ }
242
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRLIFT') {
243
+ // Take wheel chair lift
244
+ heading = `${this.translationsData.takeWheelchairLiftToLevel} ${this.stepData.end_location.floor_name}`;
245
+ }
246
+ else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ELEVATOR') {
247
+ // Take elevator
248
+ heading = `${this.translationsData.takeElevatorToLevel} ${this.stepData.end_location.floor_name}`;
249
+ }
250
+ else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'Outside') {
251
+ // Exit from inside to outside
252
+ heading = this.addStepContextNameToHeading(this.translationsData.exit, this.stepData.start_context);
253
+ }
254
+ else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'InsideBuilding') {
255
+ heading = this.getStepHeading();
256
+ }
257
+ else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside' && this.fromTravelMode.toUpperCase() === 'TRANSIT') {
258
+ // Switching between public transportation
259
+ heading = this.fromTransitStop;
260
+ }
261
+ else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside') {
262
+ heading = this.getStepHeading();
263
+ }
264
+ else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'InsideBuilding') {
265
+ // Enter from outside to inside
266
+ heading = this.addStepContextNameToHeading(this.translationsData.enter, this.stepData.end_context);
267
+ }
268
+ else {
269
+ // Origin Location name or empty
270
+ heading = this.fromRouteContext === 'InsideBuilding' ? 'Inside Building' : this.fromRouteContext;
271
+ }
272
+ 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());
273
+ }
274
+ /**
275
+ * Add building or venue name to the step heading.
276
+ *
277
+ * @param {string} heading
278
+ * @param {StepContext} stepContext
279
+ * @returns {string}
280
+ */
281
+ addStepContextNameToHeading(heading, stepContext) {
282
+ if (stepContext) {
283
+ if (stepContext.building) {
284
+ heading += ` ${stepContext.building.buildingInfo.name} ${this.translationsData.building}`;
285
+ }
286
+ else if (stepContext.venue) {
287
+ heading += ` ${stepContext.venue.venueInfo.name} ${this.translationsData.venue}`;
288
+ }
289
+ }
290
+ return heading;
291
+ }
292
+ /**
293
+ * Render a bicycling step.
294
+ *
295
+ * @returns {JSX.Element}
296
+ */
297
+ renderBicyclingStep() {
298
+ 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());
299
+ }
300
+ /**
301
+ * Render a transit step. Inclusing BUSWAY instruction.
302
+ *
303
+ * @returns {JSX.Element}
304
+ */
305
+ renderTransitStep() {
306
+ 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;
307
+ 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) ?
308
+ h("span", { class: "step__short-name", style: {
309
+ 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,
310
+ 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
311
+ } }, (_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) :
312
+ 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());
313
+ }
314
+ static get watchers() { return {
315
+ "step": ["parseStepProp"],
316
+ "translations": ["parseTranslationsProp"]
317
+ }; }
318
+ };
319
+ RouteInstructionsStep.style = routeInstructionsStepCss;
320
+
321
+ export { RouteInstructionsStep as mi_route_instructions_step };