@mapsindoors/map-template 1.0.0 → 1.1.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.
- package/README.md +1 -1
- package/package.json +2 -2
- package/dist/_commonjsHelpers-ba3f0406-b96e6d6a.mjs +0 -21
- package/dist/combo-box-item.entry-95ce1f59.mjs +0 -14
- package/dist/combo-box-item.entry-dbddbad6.mjs +0 -12
- package/dist/icon-b8d01d6f-ddfa2c17.mjs +0 -24
- package/dist/mapsindoors-react.es.js +0 -7
- package/dist/mapsindoors-react.umd.js +0 -1391
- package/dist/mapsindoors-webcomponent.es.js +0 -5
- package/dist/mapsindoors-webcomponent.umd.js +0 -1385
- package/dist/mi-card_2.entry-19c978a9.mjs +0 -25
- package/dist/mi-card_2.entry-edc337b6.mjs +0 -23
- package/dist/mi-chip.entry-4e72635b.mjs +0 -15
- package/dist/mi-chip.entry-a27bcae2.mjs +0 -13
- package/dist/mi-column.entry-f0216749.mjs +0 -20
- package/dist/mi-column.entry-fff64658.mjs +0 -18
- package/dist/mi-combo-box.entry-1df97caf.mjs +0 -262
- package/dist/mi-combo-box.entry-d5c49dbf.mjs +0 -260
- package/dist/mi-data-table.entry-075c3b63.mjs +0 -215
- package/dist/mi-data-table.entry-1a2a465b.mjs +0 -213
- package/dist/mi-distance_2.entry-67441b8d.mjs +0 -54
- package/dist/mi-distance_2.entry-99adc361.mjs +0 -56
- package/dist/mi-dropdown-item.entry-62debc4c.mjs +0 -14
- package/dist/mi-dropdown-item.entry-6c3c44c7.mjs +0 -12
- package/dist/mi-dropdown.entry-8eae4521.mjs +0 -298
- package/dist/mi-dropdown.entry-b0e299e8.mjs +0 -296
- package/dist/mi-keyboard.entry-b730227d.mjs +0 -2962
- package/dist/mi-keyboard.entry-e869affa.mjs +0 -2960
- package/dist/mi-list-item-category.entry-8896172f.mjs +0 -38
- package/dist/mi-list-item-category.entry-955e75d9.mjs +0 -36
- package/dist/mi-list-item-location.entry-da7df958.mjs +0 -127
- package/dist/mi-list-item-location.entry-f36e8cf1.mjs +0 -125
- package/dist/mi-list.entry-15713742.mjs +0 -41
- package/dist/mi-list.entry-6e9a5556.mjs +0 -39
- package/dist/mi-location-booking.entry-49bbfc83.mjs +0 -4863
- package/dist/mi-location-booking.entry-a8ab6205.mjs +0 -4865
- package/dist/mi-location-info.entry-366b91be.mjs +0 -24
- package/dist/mi-location-info.entry-ed98b07a.mjs +0 -22
- package/dist/mi-map-googlemaps.entry-172794d0.mjs +0 -396
- package/dist/mi-map-googlemaps.entry-a71fa364.mjs +0 -398
- package/dist/mi-map-mapbox.entry-45457559.mjs +0 -298
- package/dist/mi-map-mapbox.entry-c77a7266.mjs +0 -300
- package/dist/mi-metric-card.entry-32f831b0.mjs +0 -26
- package/dist/mi-metric-card.entry-55487c97.mjs +0 -28
- package/dist/mi-notification.entry-44dee5c8.mjs +0 -83
- package/dist/mi-notification.entry-eadf8dc9.mjs +0 -81
- package/dist/mi-route-instructions-heading.entry-a4e69ea6.mjs +0 -72
- package/dist/mi-route-instructions-heading.entry-e612f18b.mjs +0 -74
- package/dist/mi-route-instructions-maneuver_2.entry-9a0ff4c4.mjs +0 -115
- package/dist/mi-route-instructions-maneuver_2.entry-a8e830aa.mjs +0 -113
- package/dist/mi-route-instructions-step-legacy.entry-27292122.mjs +0 -201
- package/dist/mi-route-instructions-step-legacy.entry-4591ba3d.mjs +0 -199
- package/dist/mi-route-instructions-step.entry-09d5478d.mjs +0 -201
- package/dist/mi-route-instructions-step.entry-2cce3752.mjs +0 -199
- package/dist/mi-route-instructions.entry-2bc0ccf6.mjs +0 -141
- package/dist/mi-route-instructions.entry-b0cadde4.mjs +0 -139
- package/dist/mi-scroll-buttons.entry-1f0e7f57.mjs +0 -46
- package/dist/mi-scroll-buttons.entry-822cb937.mjs +0 -48
- package/dist/mi-search.entry-8462b146.mjs +0 -206
- package/dist/mi-search.entry-b0ed69a4.mjs +0 -208
- package/dist/mi-share-sms.entry-15b65316.mjs +0 -55
- package/dist/mi-share-sms.entry-f455e43c.mjs +0 -53
- package/dist/mi-step-switcher.entry-1a3cca1d.mjs +0 -26
- package/dist/mi-step-switcher.entry-5001def0.mjs +0 -24
- package/dist/mi-tab-panel.entry-4720796b.mjs +0 -21
- package/dist/mi-tab-panel.entry-e06e834d.mjs +0 -19
- package/dist/mi-tab.entry-93c67c99.mjs +0 -13
- package/dist/mi-tab.entry-a6fccd52.mjs +0 -11
- package/dist/mi-tabs.entry-0880cd97.mjs +0 -36
- package/dist/mi-tabs.entry-32262f70.mjs +0 -34
- package/dist/mi-variables-9a6c8d4d-e06eec88.mjs +0 -7
- package/dist/reactcomponent-2798f651.mjs +0 -27217
- package/dist/route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs +0 -7
- package/dist/sort-order.enum-64ce8998-b75ac596.mjs +0 -317
- package/dist/unit-system.enum-eaefb53e-0f424da4.mjs +0 -7
- package/dist/utils-ae714467-b07fc3be.mjs +0 -36
- package/dist/webcomponent-5ad04e2a.mjs +0 -31996
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { r as n, c as r, h as e } from "./reactcomponent-2798f651.mjs";
|
|
2
|
-
import { U as o } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
3
|
-
import { c as l } from "./utils-ae714467-b07fc3be.mjs";
|
|
4
|
-
import "react";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
const p = ':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}', d = class {
|
|
7
|
-
constructor(t) {
|
|
8
|
-
n(this, t), this.stepClicked = r(this, "stepClicked", 7), this.isInternetExplorer = l(), this.step = void 0, this.stepData = void 0, this.hideIndoorSubsteps = !0, this.fromRouteContext = "", this.fromTravelMode = void 0, this.fromTransitStop = void 0, this.unit = o.Metric, this.translations = void 0, this.translationsData = void 0, this.substepsAreOpen = !1;
|
|
9
|
-
}
|
|
10
|
-
parseStepProp() {
|
|
11
|
-
this.step && (this.stepData = JSON.parse(this.step));
|
|
12
|
-
}
|
|
13
|
-
parseTranslationsProp() {
|
|
14
|
-
this.translations && (this.translationsData = JSON.parse(this.translations));
|
|
15
|
-
}
|
|
16
|
-
componentWillLoad() {
|
|
17
|
-
this.parseStepProp(), this.parseTranslationsProp();
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Render if there is step data.
|
|
21
|
-
*/
|
|
22
|
-
render() {
|
|
23
|
-
return this.stepData && this.translationsData ? this.renderStep() : null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Emits stepClicked event (if click target is not related to an action)
|
|
27
|
-
* @param event Event
|
|
28
|
-
*/
|
|
29
|
-
stepClickHandler(t) {
|
|
30
|
-
if (Array.from(t.target.classList).includes("icon-toggle"))
|
|
31
|
-
return;
|
|
32
|
-
let s = null;
|
|
33
|
-
t.target.dataset.maneuverIndex !== void 0 && (s = parseInt(t.target.dataset.maneuverIndex)), this.stepClicked.emit({ maneuverIndex: s });
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Render step part depending on travel mode.
|
|
37
|
-
*
|
|
38
|
-
* @returns {JSX.Element}
|
|
39
|
-
*/
|
|
40
|
-
renderStep() {
|
|
41
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
42
|
-
case "DRIVING":
|
|
43
|
-
return this.renderDrivingStep();
|
|
44
|
-
case "WALKING":
|
|
45
|
-
return this.renderWalkingStep();
|
|
46
|
-
case "BICYCLING":
|
|
47
|
-
return this.renderBicyclingStep();
|
|
48
|
-
case "TRANSIT":
|
|
49
|
-
return this.renderTransitStep();
|
|
50
|
-
default:
|
|
51
|
-
return e("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Render the travel mode indicator and dotted/solid line.
|
|
56
|
-
*
|
|
57
|
-
* @returns {JSX.Element}
|
|
58
|
-
*/
|
|
59
|
-
renderTravelMode() {
|
|
60
|
-
if (this.isInternetExplorer)
|
|
61
|
-
return null;
|
|
62
|
-
let t;
|
|
63
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
64
|
-
case "DRIVING":
|
|
65
|
-
t = "car";
|
|
66
|
-
break;
|
|
67
|
-
case "WALKING":
|
|
68
|
-
t = "walk";
|
|
69
|
-
break;
|
|
70
|
-
case "BICYCLING":
|
|
71
|
-
t = "bike";
|
|
72
|
-
break;
|
|
73
|
-
case "TRANSIT":
|
|
74
|
-
t = this.getTransitVehicleIconName();
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
return e("span", { part: "step-travel-mode", class: `step__travel-mode step__travel-mode--${this.stepData.travel_mode.toUpperCase() === "TRANSIT" ? "solid" : "dotted"}` }, e("span", { class: "step__travel-mode-icon" }, e("mi-icon", { part: "step-travel-mode-icon", "icon-name": t })));
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get icon name for transit vehicle.
|
|
81
|
-
*
|
|
82
|
-
* @returns {string}
|
|
83
|
-
*/
|
|
84
|
-
getTransitVehicleIconName() {
|
|
85
|
-
var t, s;
|
|
86
|
-
const i = (s = (t = this.stepData.transit_information) === null || t === void 0 ? void 0 : t.line.vehicle) === null || s === void 0 ? void 0 : s.type.toLowerCase();
|
|
87
|
-
return i && ["boat", "bus", "railway", "train", "subway"].some((a) => a === i) ? i : "transit";
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Toggles visibility of sub steps (steps in steps)
|
|
91
|
-
*/
|
|
92
|
-
toggleSubsteps() {
|
|
93
|
-
this.substepsAreOpen = !this.substepsAreOpen;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Render substeps if they should be visible.
|
|
97
|
-
*
|
|
98
|
-
* @returns {JSX.Element}
|
|
99
|
-
*/
|
|
100
|
-
renderSubsteps() {
|
|
101
|
-
return this.substepsAreOpen === !0 ? e("div", { class: "step__substeps" }, this.stepData.steps.map((t, s) => e("mi-route-instructions-maneuver", {
|
|
102
|
-
"data-maneuver-index": s,
|
|
103
|
-
maneuver: JSON.stringify(t),
|
|
104
|
-
translations: this.translations,
|
|
105
|
-
unit: this.unit,
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
exportparts: `
|
|
108
|
-
maneuver-icon,
|
|
109
|
-
maneuver-description,
|
|
110
|
-
maneuver-description-distance,
|
|
111
|
-
maneuver-description-distance-border`
|
|
112
|
-
}))) : null;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Render the toggle button for the sub step expander.
|
|
116
|
-
*
|
|
117
|
-
* @returns {JSX.Element}
|
|
118
|
-
*/
|
|
119
|
-
renderToggleButton() {
|
|
120
|
-
return this.stepData.steps.length <= 0 || this.hideIndoorSubsteps === !0 && this.stepData.route_context.toLowerCase() === "insidebuilding" ? null : e("span", { class: `step__toggle ${this.substepsAreOpen ? "step__toggle--open" : ""}`, onClick: () => this.toggleSubsteps() }, this.isInternetExplorer ? "▼" : e("mi-icon", { part: "step-toggle", "icon-name": "toggle" }));
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Render time and distance part.
|
|
124
|
-
*
|
|
125
|
-
* @returns {JSX.Element}
|
|
126
|
-
*/
|
|
127
|
-
renderTimeAndDistance() {
|
|
128
|
-
return e("span", { part: "step-info", class: "step__distance-duration" }, e("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), " · ", e("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), e("br", null));
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Render a driving step.
|
|
132
|
-
*
|
|
133
|
-
* @returns {JSX.Element}
|
|
134
|
-
*/
|
|
135
|
-
renderDrivingStep() {
|
|
136
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "car" })), e("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.translationsData.drive, e("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Get display heading.
|
|
140
|
-
*
|
|
141
|
-
* @returns {string}
|
|
142
|
-
*/
|
|
143
|
-
getStepHeading() {
|
|
144
|
-
var t;
|
|
145
|
-
const s = {
|
|
146
|
-
driving: this.translationsData.drive,
|
|
147
|
-
walking: this.translationsData.walk,
|
|
148
|
-
bicycling: this.translationsData.bike
|
|
149
|
-
};
|
|
150
|
-
return !((t = this.stepData.steps[0]) === null || t === void 0) && t.instructions ? this.stepData.steps[0].instructions : s[this.stepData.travel_mode.toLowerCase()];
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Render a walking step.
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* @returns {JSX.Element}
|
|
157
|
-
*/
|
|
158
|
-
renderWalkingStep() {
|
|
159
|
-
let t, s;
|
|
160
|
-
return this.stepData.parking === !0 ? (t = `${this.translationsData.park} ${this.stepData.label ? ` ${this.translationsData.at} ` + this.stepData.label : ""}`, s = "park") : this.stepData.highway && this.stepData.highway.toUpperCase() === "STEPS" ? (t = `${this.translationsData.takeStaircaseToLevel} ${this.stepData.end_location.floor_name}`, s = "stairs") : this.stepData.highway && this.stepData.highway.toUpperCase() === "LADDER" ? (t = `${this.translationsData.takeLadderToLevel} ${this.stepData.end_location.floor_name}`, s = "ladder") : this.stepData.highway && this.stepData.highway.toUpperCase() === "ESCALATOR" ? (t = `${this.translationsData.takeEscalatorToLevel} ${this.stepData.end_location.floor_name}`, s = "escalator") : this.stepData.highway && this.stepData.highway.toUpperCase() === "WHEELCHAIRRAMP" ? (t = `${this.translationsData.takeWheelchairRampToLevel} ${this.stepData.end_location.floor_name}`, s = "wheelchair-ramp") : this.stepData.highway && this.stepData.highway.toUpperCase() === "WHEELCHAIRLIFT" ? (t = `${this.translationsData.takeWheelchairLiftToLevel} ${this.stepData.end_location.floor_name}`, s = "wheelchair-lift") : this.stepData.highway && this.stepData.highway.toUpperCase() === "ELEVATOR" ? (t = `${this.translationsData.takeElevatorToLevel} ${this.stepData.end_location.floor_name}`, s = "elevator") : this.fromRouteContext === "InsideBuilding" && this.stepData.route_context === "Outside" ? (t = this.addStepContextNameToHeading(this.translationsData.exit, this.stepData.start_context), s = "exit") : this.fromRouteContext === "InsideBuilding" && this.stepData.route_context === "InsideBuilding" ? (t = this.getStepHeading(), s = "walk") : this.fromRouteContext === "Outside" && this.stepData.route_context === "Outside" && this.fromTravelMode.toUpperCase() === "TRANSIT" ? (t = this.fromTransitStop, s = "transit-stop") : this.fromRouteContext === "Outside" && this.stepData.route_context === "Outside" ? (t = this.getStepHeading(), s = "walk") : this.fromRouteContext === "Outside" && this.stepData.route_context === "InsideBuilding" ? (t = this.addStepContextNameToHeading(this.translationsData.enter, this.stepData.end_context), s = "enter") : (t = this.fromRouteContext, s = "circle"), e("div", { class: "step", onClick: (i) => this.stepClickHandler(i) }, this.isInternetExplorer ? null : e("span", { class: `step__action-icon ${s !== "circle" ? "step__action-icon--circled" : ""}` }, e("mi-icon", { "icon-name": s })), e("h3", { part: "step-heading", class: "step__heading" }, t), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.translationsData.walk, e("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Add building or venue name to the step heading
|
|
164
|
-
* @param {string} heading
|
|
165
|
-
* @param {StepContext} stepContext
|
|
166
|
-
* @returns
|
|
167
|
-
*/
|
|
168
|
-
addStepContextNameToHeading(t, s) {
|
|
169
|
-
return s && (s.building ? t += ` ${s.building.buildingInfo.name} ${this.translationsData.building}` : s.venue && (t += ` ${s.venue.venueInfo.name} ${this.translationsData.venue}`)), t;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Render a bicycling step.
|
|
173
|
-
*
|
|
174
|
-
* @returns {JSX.Element}
|
|
175
|
-
*/
|
|
176
|
-
renderBicyclingStep() {
|
|
177
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "bike" })), e("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.translationsData.bike, e("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Render a transit step.
|
|
181
|
-
*
|
|
182
|
-
* @returns {JSX.Element}
|
|
183
|
-
*/
|
|
184
|
-
renderTransitStep() {
|
|
185
|
-
var t, s;
|
|
186
|
-
return e("div", { class: "step", onClick: (i) => this.stepClickHandler(i) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "transit-stop" })), e("h3", { part: "step-heading", class: "step__heading" }, this.stepData.instructions), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.stepData.transit_information.line.short_name ? e("span", { class: "step__short-name", style: {
|
|
187
|
-
backgroundColor: !((t = this.stepData.transit_information.line) === null || t === void 0) && t.color ? this.stepData.transit_information.line.color : null,
|
|
188
|
-
color: !((s = this.stepData.transit_information.line) === null || s === void 0) && s.text_color ? this.stepData.transit_information.line.text_color : null
|
|
189
|
-
} }, this.stepData.transit_information.line.short_name) : null, this.stepData.transit_information.headsign ? this.stepData.transit_information.headsign : null, e("br", null), e("span", { part: "step-info", class: "step__distance-duration" }, e("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), " · ", this.stepData.transit_information.num_stops ? this.stepData.transit_information.num_stops : null, " ", this.translationsData.stops ? this.translationsData.stops : null)), this.renderToggleButton(), this.renderSubsteps());
|
|
190
|
-
}
|
|
191
|
-
static get watchers() {
|
|
192
|
-
return {
|
|
193
|
-
step: ["parseStepProp"],
|
|
194
|
-
translations: ["parseTranslationsProp"]
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
d.style = p;
|
|
199
|
-
export {
|
|
200
|
-
d as mi_route_instructions_step_legacy
|
|
201
|
-
};
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { r as n, c as r, h as e } from "./webcomponent-5ad04e2a.mjs";
|
|
2
|
-
import { U as o } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
3
|
-
import { c as l } from "./utils-ae714467-b07fc3be.mjs";
|
|
4
|
-
const p = ':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}', d = class {
|
|
5
|
-
constructor(t) {
|
|
6
|
-
n(this, t), this.stepClicked = r(this, "stepClicked", 7), this.isInternetExplorer = l(), this.step = void 0, this.stepData = void 0, this.hideIndoorSubsteps = !0, this.fromRouteContext = "", this.fromTravelMode = void 0, this.fromTransitStop = void 0, this.unit = o.Metric, this.translations = void 0, this.translationsData = void 0, this.substepsAreOpen = !1;
|
|
7
|
-
}
|
|
8
|
-
parseStepProp() {
|
|
9
|
-
this.step && (this.stepData = JSON.parse(this.step));
|
|
10
|
-
}
|
|
11
|
-
parseTranslationsProp() {
|
|
12
|
-
this.translations && (this.translationsData = JSON.parse(this.translations));
|
|
13
|
-
}
|
|
14
|
-
componentWillLoad() {
|
|
15
|
-
this.parseStepProp(), this.parseTranslationsProp();
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Render if there is step data.
|
|
19
|
-
*/
|
|
20
|
-
render() {
|
|
21
|
-
return this.stepData && this.translationsData ? this.renderStep() : null;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Emits stepClicked event (if click target is not related to an action)
|
|
25
|
-
* @param event Event
|
|
26
|
-
*/
|
|
27
|
-
stepClickHandler(t) {
|
|
28
|
-
if (Array.from(t.target.classList).includes("icon-toggle"))
|
|
29
|
-
return;
|
|
30
|
-
let s = null;
|
|
31
|
-
t.target.dataset.maneuverIndex !== void 0 && (s = parseInt(t.target.dataset.maneuverIndex)), this.stepClicked.emit({ maneuverIndex: s });
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Render step part depending on travel mode.
|
|
35
|
-
*
|
|
36
|
-
* @returns {JSX.Element}
|
|
37
|
-
*/
|
|
38
|
-
renderStep() {
|
|
39
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
40
|
-
case "DRIVING":
|
|
41
|
-
return this.renderDrivingStep();
|
|
42
|
-
case "WALKING":
|
|
43
|
-
return this.renderWalkingStep();
|
|
44
|
-
case "BICYCLING":
|
|
45
|
-
return this.renderBicyclingStep();
|
|
46
|
-
case "TRANSIT":
|
|
47
|
-
return this.renderTransitStep();
|
|
48
|
-
default:
|
|
49
|
-
return e("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Render the travel mode indicator and dotted/solid line.
|
|
54
|
-
*
|
|
55
|
-
* @returns {JSX.Element}
|
|
56
|
-
*/
|
|
57
|
-
renderTravelMode() {
|
|
58
|
-
if (this.isInternetExplorer)
|
|
59
|
-
return null;
|
|
60
|
-
let t;
|
|
61
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
62
|
-
case "DRIVING":
|
|
63
|
-
t = "car";
|
|
64
|
-
break;
|
|
65
|
-
case "WALKING":
|
|
66
|
-
t = "walk";
|
|
67
|
-
break;
|
|
68
|
-
case "BICYCLING":
|
|
69
|
-
t = "bike";
|
|
70
|
-
break;
|
|
71
|
-
case "TRANSIT":
|
|
72
|
-
t = this.getTransitVehicleIconName();
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
return e("span", { part: "step-travel-mode", class: `step__travel-mode step__travel-mode--${this.stepData.travel_mode.toUpperCase() === "TRANSIT" ? "solid" : "dotted"}` }, e("span", { class: "step__travel-mode-icon" }, e("mi-icon", { part: "step-travel-mode-icon", "icon-name": t })));
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Get icon name for transit vehicle.
|
|
79
|
-
*
|
|
80
|
-
* @returns {string}
|
|
81
|
-
*/
|
|
82
|
-
getTransitVehicleIconName() {
|
|
83
|
-
var t, s;
|
|
84
|
-
const i = (s = (t = this.stepData.transit_information) === null || t === void 0 ? void 0 : t.line.vehicle) === null || s === void 0 ? void 0 : s.type.toLowerCase();
|
|
85
|
-
return i && ["boat", "bus", "railway", "train", "subway"].some((a) => a === i) ? i : "transit";
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Toggles visibility of sub steps (steps in steps)
|
|
89
|
-
*/
|
|
90
|
-
toggleSubsteps() {
|
|
91
|
-
this.substepsAreOpen = !this.substepsAreOpen;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Render substeps if they should be visible.
|
|
95
|
-
*
|
|
96
|
-
* @returns {JSX.Element}
|
|
97
|
-
*/
|
|
98
|
-
renderSubsteps() {
|
|
99
|
-
return this.substepsAreOpen === !0 ? e("div", { class: "step__substeps" }, this.stepData.steps.map((t, s) => e("mi-route-instructions-maneuver", {
|
|
100
|
-
"data-maneuver-index": s,
|
|
101
|
-
maneuver: JSON.stringify(t),
|
|
102
|
-
translations: this.translations,
|
|
103
|
-
unit: this.unit,
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
exportparts: `
|
|
106
|
-
maneuver-icon,
|
|
107
|
-
maneuver-description,
|
|
108
|
-
maneuver-description-distance,
|
|
109
|
-
maneuver-description-distance-border`
|
|
110
|
-
}))) : null;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Render the toggle button for the sub step expander.
|
|
114
|
-
*
|
|
115
|
-
* @returns {JSX.Element}
|
|
116
|
-
*/
|
|
117
|
-
renderToggleButton() {
|
|
118
|
-
return this.stepData.steps.length <= 0 || this.hideIndoorSubsteps === !0 && this.stepData.route_context.toLowerCase() === "insidebuilding" ? null : e("span", { class: `step__toggle ${this.substepsAreOpen ? "step__toggle--open" : ""}`, onClick: () => this.toggleSubsteps() }, this.isInternetExplorer ? "▼" : e("mi-icon", { part: "step-toggle", "icon-name": "toggle" }));
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Render time and distance part.
|
|
122
|
-
*
|
|
123
|
-
* @returns {JSX.Element}
|
|
124
|
-
*/
|
|
125
|
-
renderTimeAndDistance() {
|
|
126
|
-
return e("span", { part: "step-info", class: "step__distance-duration" }, e("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), " · ", e("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), e("br", null));
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Render a driving step.
|
|
130
|
-
*
|
|
131
|
-
* @returns {JSX.Element}
|
|
132
|
-
*/
|
|
133
|
-
renderDrivingStep() {
|
|
134
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "car" })), e("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.translationsData.drive, e("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Get display heading.
|
|
138
|
-
*
|
|
139
|
-
* @returns {string}
|
|
140
|
-
*/
|
|
141
|
-
getStepHeading() {
|
|
142
|
-
var t;
|
|
143
|
-
const s = {
|
|
144
|
-
driving: this.translationsData.drive,
|
|
145
|
-
walking: this.translationsData.walk,
|
|
146
|
-
bicycling: this.translationsData.bike
|
|
147
|
-
};
|
|
148
|
-
return !((t = this.stepData.steps[0]) === null || t === void 0) && t.instructions ? this.stepData.steps[0].instructions : s[this.stepData.travel_mode.toLowerCase()];
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Render a walking step.
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* @returns {JSX.Element}
|
|
155
|
-
*/
|
|
156
|
-
renderWalkingStep() {
|
|
157
|
-
let t, s;
|
|
158
|
-
return this.stepData.parking === !0 ? (t = `${this.translationsData.park} ${this.stepData.label ? ` ${this.translationsData.at} ` + this.stepData.label : ""}`, s = "park") : this.stepData.highway && this.stepData.highway.toUpperCase() === "STEPS" ? (t = `${this.translationsData.takeStaircaseToLevel} ${this.stepData.end_location.floor_name}`, s = "stairs") : this.stepData.highway && this.stepData.highway.toUpperCase() === "LADDER" ? (t = `${this.translationsData.takeLadderToLevel} ${this.stepData.end_location.floor_name}`, s = "ladder") : this.stepData.highway && this.stepData.highway.toUpperCase() === "ESCALATOR" ? (t = `${this.translationsData.takeEscalatorToLevel} ${this.stepData.end_location.floor_name}`, s = "escalator") : this.stepData.highway && this.stepData.highway.toUpperCase() === "WHEELCHAIRRAMP" ? (t = `${this.translationsData.takeWheelchairRampToLevel} ${this.stepData.end_location.floor_name}`, s = "wheelchair-ramp") : this.stepData.highway && this.stepData.highway.toUpperCase() === "WHEELCHAIRLIFT" ? (t = `${this.translationsData.takeWheelchairLiftToLevel} ${this.stepData.end_location.floor_name}`, s = "wheelchair-lift") : this.stepData.highway && this.stepData.highway.toUpperCase() === "ELEVATOR" ? (t = `${this.translationsData.takeElevatorToLevel} ${this.stepData.end_location.floor_name}`, s = "elevator") : this.fromRouteContext === "InsideBuilding" && this.stepData.route_context === "Outside" ? (t = this.addStepContextNameToHeading(this.translationsData.exit, this.stepData.start_context), s = "exit") : this.fromRouteContext === "InsideBuilding" && this.stepData.route_context === "InsideBuilding" ? (t = this.getStepHeading(), s = "walk") : this.fromRouteContext === "Outside" && this.stepData.route_context === "Outside" && this.fromTravelMode.toUpperCase() === "TRANSIT" ? (t = this.fromTransitStop, s = "transit-stop") : this.fromRouteContext === "Outside" && this.stepData.route_context === "Outside" ? (t = this.getStepHeading(), s = "walk") : this.fromRouteContext === "Outside" && this.stepData.route_context === "InsideBuilding" ? (t = this.addStepContextNameToHeading(this.translationsData.enter, this.stepData.end_context), s = "enter") : (t = this.fromRouteContext, s = "circle"), e("div", { class: "step", onClick: (i) => this.stepClickHandler(i) }, this.isInternetExplorer ? null : e("span", { class: `step__action-icon ${s !== "circle" ? "step__action-icon--circled" : ""}` }, e("mi-icon", { "icon-name": s })), e("h3", { part: "step-heading", class: "step__heading" }, t), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.translationsData.walk, e("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Add building or venue name to the step heading
|
|
162
|
-
* @param {string} heading
|
|
163
|
-
* @param {StepContext} stepContext
|
|
164
|
-
* @returns
|
|
165
|
-
*/
|
|
166
|
-
addStepContextNameToHeading(t, s) {
|
|
167
|
-
return s && (s.building ? t += ` ${s.building.buildingInfo.name} ${this.translationsData.building}` : s.venue && (t += ` ${s.venue.venueInfo.name} ${this.translationsData.venue}`)), t;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Render a bicycling step.
|
|
171
|
-
*
|
|
172
|
-
* @returns {JSX.Element}
|
|
173
|
-
*/
|
|
174
|
-
renderBicyclingStep() {
|
|
175
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "bike" })), e("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.translationsData.bike, e("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Render a transit step.
|
|
179
|
-
*
|
|
180
|
-
* @returns {JSX.Element}
|
|
181
|
-
*/
|
|
182
|
-
renderTransitStep() {
|
|
183
|
-
var t, s;
|
|
184
|
-
return e("div", { class: "step", onClick: (i) => this.stepClickHandler(i) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "transit-stop" })), e("h3", { part: "step-heading", class: "step__heading" }, this.stepData.instructions), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.stepData.transit_information.line.short_name ? e("span", { class: "step__short-name", style: {
|
|
185
|
-
backgroundColor: !((t = this.stepData.transit_information.line) === null || t === void 0) && t.color ? this.stepData.transit_information.line.color : null,
|
|
186
|
-
color: !((s = this.stepData.transit_information.line) === null || s === void 0) && s.text_color ? this.stepData.transit_information.line.text_color : null
|
|
187
|
-
} }, this.stepData.transit_information.line.short_name) : null, this.stepData.transit_information.headsign ? this.stepData.transit_information.headsign : null, e("br", null), e("span", { part: "step-info", class: "step__distance-duration" }, e("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), " · ", this.stepData.transit_information.num_stops ? this.stepData.transit_information.num_stops : null, " ", this.translationsData.stops ? this.translationsData.stops : null)), this.renderToggleButton(), this.renderSubsteps());
|
|
188
|
-
}
|
|
189
|
-
static get watchers() {
|
|
190
|
-
return {
|
|
191
|
-
step: ["parseStepProp"],
|
|
192
|
-
translations: ["parseTranslationsProp"]
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
d.style = p;
|
|
197
|
-
export {
|
|
198
|
-
d as mi_route_instructions_step_legacy
|
|
199
|
-
};
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { r, c as o, h as e } from "./reactcomponent-2798f651.mjs";
|
|
2
|
-
import { U as a } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
3
|
-
import { c as l } from "./utils-ae714467-b07fc3be.mjs";
|
|
4
|
-
import "react";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
const p = ':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:8px;justify-items:center}.step__info{display:grid;grid-auto-flow:column;gap:8px;align-items:center}.step__action-icon--circled{position:relative}.step__action-icon mi-icon{display:block;width:40px;height:40px}.step__heading{font-size:1.25rem;margin:0}.step__heading>span{font-size:0.875rem;color:#6b7280}.step__travel-mode{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__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{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{grid-area:substeps}', d = class {
|
|
7
|
-
constructor(t) {
|
|
8
|
-
r(this, t), this.stepClicked = o(this, "stepClicked", 7), this.isInternetExplorer = l(), this.step = void 0, this.stepData = void 0, this.hideIndoorSubsteps = !0, this.fromRouteContext = "", this.fromTravelMode = void 0, this.fromTransitStop = void 0, this.unit = navigator.language === "en-US" ? a.Imperial : a.Metric, this.translations = void 0, this.translationsData = void 0, this.substepsAreOpen = !1;
|
|
9
|
-
}
|
|
10
|
-
parseStepProp() {
|
|
11
|
-
this.step && (this.stepData = JSON.parse(this.step));
|
|
12
|
-
}
|
|
13
|
-
parseTranslationsProp() {
|
|
14
|
-
this.translations && (this.translationsData = JSON.parse(this.translations));
|
|
15
|
-
}
|
|
16
|
-
componentWillLoad() {
|
|
17
|
-
this.parseStepProp(), this.parseTranslationsProp();
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Render if there is step data.
|
|
21
|
-
*/
|
|
22
|
-
render() {
|
|
23
|
-
return this.stepData && this.translationsData ? this.renderStep() : null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Emits stepClicked event (if click target is not related to an action)
|
|
27
|
-
* @param event Event
|
|
28
|
-
*/
|
|
29
|
-
stepClickHandler(t) {
|
|
30
|
-
if (Array.from(t.target.classList).includes("icon-toggle"))
|
|
31
|
-
return;
|
|
32
|
-
let s = null;
|
|
33
|
-
t.target.dataset.maneuverIndex !== void 0 && (s = parseInt(t.target.dataset.maneuverIndex)), this.stepClicked.emit({ maneuverIndex: s });
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Render step part depending on travel mode.
|
|
37
|
-
*
|
|
38
|
-
* @returns {JSX.Element}
|
|
39
|
-
*/
|
|
40
|
-
renderStep() {
|
|
41
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
42
|
-
case "DRIVING":
|
|
43
|
-
return this.renderDrivingStep();
|
|
44
|
-
case "WALKING":
|
|
45
|
-
return this.renderWalkingStep();
|
|
46
|
-
case "BICYCLING":
|
|
47
|
-
return this.renderBicyclingStep();
|
|
48
|
-
case "TRANSIT":
|
|
49
|
-
return this.renderTransitStep();
|
|
50
|
-
default:
|
|
51
|
-
return e("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Render the travel mode indicator and dotted/solid line.
|
|
56
|
-
*
|
|
57
|
-
* @returns {JSX.Element}
|
|
58
|
-
*/
|
|
59
|
-
renderTravelMode() {
|
|
60
|
-
if (this.isInternetExplorer)
|
|
61
|
-
return null;
|
|
62
|
-
let t;
|
|
63
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
64
|
-
case "DRIVING":
|
|
65
|
-
t = "car";
|
|
66
|
-
break;
|
|
67
|
-
case "WALKING":
|
|
68
|
-
t = "walk";
|
|
69
|
-
break;
|
|
70
|
-
case "BICYCLING":
|
|
71
|
-
t = "bike";
|
|
72
|
-
break;
|
|
73
|
-
case "TRANSIT":
|
|
74
|
-
t = this.getTransitVehicleIconName();
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
return e("span", { part: "step-travel-mode", class: `step__travel-mode step__travel-mode--${this.stepData.travel_mode.toUpperCase() === "TRANSIT" ? "solid" : "dotted"}` }, e("span", { class: "step__travel-mode-icon" }, e("mi-icon", { part: "step-travel-mode-icon", "icon-name": t })));
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get icon name for transit vehicle.
|
|
81
|
-
*
|
|
82
|
-
* @returns {string}
|
|
83
|
-
*/
|
|
84
|
-
getTransitVehicleIconName() {
|
|
85
|
-
var t, s;
|
|
86
|
-
const i = (s = (t = this.stepData.transit_information) === null || t === void 0 ? void 0 : t.line.vehicle) === null || s === void 0 ? void 0 : s.type.toLowerCase();
|
|
87
|
-
return i && ["boat", "bus", "railway", "train", "subway"].some((n) => n === i) ? i : "transit";
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Toggles visibility of sub steps (steps in steps)
|
|
91
|
-
*/
|
|
92
|
-
toggleSubsteps() {
|
|
93
|
-
this.substepsAreOpen = !this.substepsAreOpen;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Render substeps if they should be visible.
|
|
97
|
-
*
|
|
98
|
-
* @returns {JSX.Element}
|
|
99
|
-
*/
|
|
100
|
-
renderSubsteps() {
|
|
101
|
-
return this.substepsAreOpen === !0 ? e("div", { class: "step__substeps" }, this.stepData.steps.map((t, s) => e("mi-route-instructions-maneuver", {
|
|
102
|
-
"data-maneuver-index": s,
|
|
103
|
-
maneuver: JSON.stringify(t),
|
|
104
|
-
translations: this.translations,
|
|
105
|
-
unit: this.unit,
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
exportparts: `
|
|
108
|
-
maneuver-icon,
|
|
109
|
-
maneuver-description,
|
|
110
|
-
maneuver-description-distance,
|
|
111
|
-
maneuver-description-distance-border`
|
|
112
|
-
}))) : null;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Render the toggle button for the sub step expander.
|
|
116
|
-
*
|
|
117
|
-
* @returns {JSX.Element}
|
|
118
|
-
*/
|
|
119
|
-
renderToggleButton() {
|
|
120
|
-
return this.stepData.steps.length <= 0 || this.hideIndoorSubsteps === !0 && this.stepData.route_context.toLowerCase() === "insidebuilding" ? null : e("span", { class: `step__toggle ${this.substepsAreOpen ? "step__toggle--open" : ""}`, onClick: () => this.toggleSubsteps() }, this.isInternetExplorer ? "▼" : e("mi-icon", { part: "step-toggle", "icon-name": "toggle" }));
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Render distance part.
|
|
124
|
-
*
|
|
125
|
-
* @returns {JSX.Element}
|
|
126
|
-
*/
|
|
127
|
-
renderDistance() {
|
|
128
|
-
return e("span", { part: "step-info", class: "step__distance-duration" }, e("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), e("br", null));
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Render a driving step.
|
|
132
|
-
*
|
|
133
|
-
* @returns {JSX.Element}
|
|
134
|
-
*/
|
|
135
|
-
renderDrivingStep() {
|
|
136
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "car" })), e("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.translationsData.drive, e("br", null), this.renderDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Get display heading.
|
|
140
|
-
*
|
|
141
|
-
* @returns {string}
|
|
142
|
-
*/
|
|
143
|
-
getStepHeading() {
|
|
144
|
-
var t;
|
|
145
|
-
const s = {
|
|
146
|
-
driving: this.translationsData.drive,
|
|
147
|
-
walking: this.translationsData.walk,
|
|
148
|
-
bicycling: this.translationsData.bike
|
|
149
|
-
};
|
|
150
|
-
return !((t = this.stepData.steps[0]) === null || t === void 0) && t.instructions ? this.stepData.steps[0].instructions : s[this.stepData.travel_mode.toLowerCase()];
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Render a walking step.
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* @returns {JSX.Element}
|
|
157
|
-
*/
|
|
158
|
-
renderWalkingStep() {
|
|
159
|
-
let t, s;
|
|
160
|
-
return this.stepData.parking === !0 ? (t = `${this.translationsData.park} ${this.stepData.label ? ` ${this.translationsData.at} ` + this.stepData.label : ""}`, s = "park") : this.stepData.highway && this.stepData.highway.toUpperCase() === "STEPS" ? (t = `${this.translationsData.takeStaircaseToLevel} ${this.stepData.end_location.floor_name}`, s = "stairs") : this.stepData.highway && this.stepData.highway.toUpperCase() === "LADDER" ? (t = `${this.translationsData.takeLadderToLevel} ${this.stepData.end_location.floor_name}`, s = "ladder") : this.stepData.highway && this.stepData.highway.toUpperCase() === "ESCALATOR" ? (t = `${this.translationsData.takeEscalatorToLevel} ${this.stepData.end_location.floor_name}`, s = "escalator") : this.stepData.highway && this.stepData.highway.toUpperCase() === "WHEELCHAIRRAMP" ? (t = `${this.translationsData.takeWheelchairRampToLevel} ${this.stepData.end_location.floor_name}`, s = "wheelchair-ramp") : this.stepData.highway && this.stepData.highway.toUpperCase() === "WHEELCHAIRLIFT" ? (t = `${this.translationsData.takeWheelchairLiftToLevel} ${this.stepData.end_location.floor_name}`, s = "wheelchair-lift") : this.stepData.highway && this.stepData.highway.toUpperCase() === "ELEVATOR" ? (t = `${this.translationsData.takeElevatorToLevel} ${this.stepData.end_location.floor_name}`, s = "elevator") : this.fromRouteContext === "InsideBuilding" && this.stepData.route_context === "Outside" ? (t = this.addStepContextNameToHeading(this.translationsData.exit, this.stepData.start_context), s = "exit") : this.fromRouteContext === "InsideBuilding" && this.stepData.route_context === "InsideBuilding" ? (t = this.getStepHeading(), s = "walk") : this.fromRouteContext === "Outside" && this.stepData.route_context === "Outside" && this.fromTravelMode.toUpperCase() === "TRANSIT" ? (t = this.fromTransitStop, s = "transit-stop") : this.fromRouteContext === "Outside" && this.stepData.route_context === "Outside" ? (t = this.getStepHeading(), s = "walk") : this.fromRouteContext === "Outside" && this.stepData.route_context === "InsideBuilding" ? (t = this.addStepContextNameToHeading(this.translationsData.enter, this.stepData.end_context), s = "enter") : (t = this.fromRouteContext, s = "circle"), e("div", { class: "step", onClick: (i) => this.stepClickHandler(i) }, e("div", { part: "step-description", class: "step__description" }, this.renderDistance()), e("div", { class: "step__info" }, this.isInternetExplorer ? null : e("span", { class: `step__action-icon ${s !== "circle" ? "step__action-icon--circled" : ""}` }, e("mi-icon", { "icon-name": s })), e("div", { part: "step-heading", class: "step__heading" }, t)));
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Add building or venue name to the step heading
|
|
164
|
-
* @param {string} heading
|
|
165
|
-
* @param {StepContext} stepContext
|
|
166
|
-
* @returns
|
|
167
|
-
*/
|
|
168
|
-
addStepContextNameToHeading(t, s) {
|
|
169
|
-
return s && (s.building ? t += ` ${s.building.buildingInfo.name} ${this.translationsData.building}` : s.venue && (t += ` ${s.venue.venueInfo.name} ${this.translationsData.venue}`)), t;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Render a bicycling step.
|
|
173
|
-
*
|
|
174
|
-
* @returns {JSX.Element}
|
|
175
|
-
*/
|
|
176
|
-
renderBicyclingStep() {
|
|
177
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "bike" })), e("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.translationsData.bike, e("br", null), this.renderDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Render a transit step.
|
|
181
|
-
*
|
|
182
|
-
* @returns {JSX.Element}
|
|
183
|
-
*/
|
|
184
|
-
renderTransitStep() {
|
|
185
|
-
var t, s;
|
|
186
|
-
return e("div", { class: "step", onClick: (i) => this.stepClickHandler(i) }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "transit-stop" })), e("h3", { part: "step-heading", class: "step__heading" }, this.stepData.instructions), this.renderTravelMode(), e("div", { part: "step-description", class: "step__description" }, this.stepData.transit_information.line.short_name ? e("span", { class: "step__short-name", style: {
|
|
187
|
-
backgroundColor: !((t = this.stepData.transit_information.line) === null || t === void 0) && t.color ? this.stepData.transit_information.line.color : null,
|
|
188
|
-
color: !((s = this.stepData.transit_information.line) === null || s === void 0) && s.text_color ? this.stepData.transit_information.line.text_color : null
|
|
189
|
-
} }, this.stepData.transit_information.line.short_name) : null, this.stepData.transit_information.headsign ? this.stepData.transit_information.headsign : null, e("br", null), e("span", { part: "step-info", class: "step__distance-duration" }, e("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), " · ", this.stepData.transit_information.num_stops ? this.stepData.transit_information.num_stops : null, " ", this.translationsData.stops ? this.translationsData.stops : null)), this.renderToggleButton(), this.renderSubsteps());
|
|
190
|
-
}
|
|
191
|
-
static get watchers() {
|
|
192
|
-
return {
|
|
193
|
-
step: ["parseStepProp"],
|
|
194
|
-
translations: ["parseTranslationsProp"]
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
d.style = p;
|
|
199
|
-
export {
|
|
200
|
-
d as mi_route_instructions_step
|
|
201
|
-
};
|