@mapsindoors/map-template 1.0.0-rc.1
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 +123 -0
- package/dist/_commonjsHelpers-ba3f0406-b96e6d6a.mjs +21 -0
- package/dist/combo-box-item.entry-92232c29.mjs +12 -0
- package/dist/combo-box-item.entry-f244c01a.mjs +14 -0
- package/dist/icon-b8d01d6f-ddfa2c17.mjs +24 -0
- package/dist/mapsindoors-react.es.js +7 -0
- package/dist/mapsindoors-react.umd.js +1391 -0
- package/dist/mapsindoors-webcomponent.es.js +5 -0
- package/dist/mapsindoors-webcomponent.umd.js +1385 -0
- package/dist/mi-card_2.entry-508f65b2.mjs +23 -0
- package/dist/mi-card_2.entry-d24478d0.mjs +25 -0
- package/dist/mi-chip.entry-74b3118c.mjs +15 -0
- package/dist/mi-chip.entry-8bfee95c.mjs +13 -0
- package/dist/mi-column.entry-f66623b9.mjs +20 -0
- package/dist/mi-column.entry-f901d5d1.mjs +18 -0
- package/dist/mi-combo-box.entry-0e6d9797.mjs +262 -0
- package/dist/mi-combo-box.entry-69a04955.mjs +260 -0
- package/dist/mi-data-table.entry-6cae08b0.mjs +215 -0
- package/dist/mi-data-table.entry-7fe09cbe.mjs +213 -0
- package/dist/mi-distance_2.entry-dca308c3.mjs +54 -0
- package/dist/mi-distance_2.entry-dffb2e64.mjs +56 -0
- package/dist/mi-dropdown-item.entry-508c6605.mjs +12 -0
- package/dist/mi-dropdown-item.entry-b6aa9d36.mjs +14 -0
- package/dist/mi-dropdown.entry-43258637.mjs +296 -0
- package/dist/mi-dropdown.entry-e1325610.mjs +298 -0
- package/dist/mi-keyboard.entry-60e47fb9.mjs +2962 -0
- package/dist/mi-keyboard.entry-c97c80e8.mjs +2960 -0
- package/dist/mi-list-item-category.entry-b0f61751.mjs +38 -0
- package/dist/mi-list-item-category.entry-bcac342a.mjs +36 -0
- package/dist/mi-list-item-location.entry-15ec9c7e.mjs +125 -0
- package/dist/mi-list-item-location.entry-ee56967a.mjs +127 -0
- package/dist/mi-list.entry-656130ea.mjs +41 -0
- package/dist/mi-list.entry-c8f1f377.mjs +39 -0
- package/dist/mi-location-booking.entry-a5b9b331.mjs +4863 -0
- package/dist/mi-location-booking.entry-ea841d6e.mjs +4865 -0
- package/dist/mi-location-info.entry-89b37774.mjs +22 -0
- package/dist/mi-location-info.entry-fe2c6c32.mjs +24 -0
- package/dist/mi-map-googlemaps.entry-6cb264de.mjs +398 -0
- package/dist/mi-map-googlemaps.entry-8877f16d.mjs +396 -0
- package/dist/mi-map-mapbox.entry-7a41963d.mjs +298 -0
- package/dist/mi-map-mapbox.entry-928da21a.mjs +300 -0
- package/dist/mi-metric-card.entry-51daca25.mjs +28 -0
- package/dist/mi-metric-card.entry-95dbb9f1.mjs +26 -0
- package/dist/mi-notification.entry-29b28ba8.mjs +81 -0
- package/dist/mi-notification.entry-f7677761.mjs +83 -0
- package/dist/mi-route-instructions-heading.entry-79c22cdd.mjs +72 -0
- package/dist/mi-route-instructions-heading.entry-a4c7f18f.mjs +74 -0
- package/dist/mi-route-instructions-maneuver_2.entry-383704ad.mjs +115 -0
- package/dist/mi-route-instructions-maneuver_2.entry-80c51e6a.mjs +113 -0
- package/dist/mi-route-instructions-step-legacy.entry-785cb60b.mjs +199 -0
- package/dist/mi-route-instructions-step-legacy.entry-eff068ed.mjs +201 -0
- package/dist/mi-route-instructions-step.entry-272e3c84.mjs +199 -0
- package/dist/mi-route-instructions-step.entry-95f5dc43.mjs +201 -0
- package/dist/mi-route-instructions.entry-0628d220.mjs +139 -0
- package/dist/mi-route-instructions.entry-1b4fb352.mjs +141 -0
- package/dist/mi-scroll-buttons.entry-274b003f.mjs +48 -0
- package/dist/mi-scroll-buttons.entry-6132935b.mjs +46 -0
- package/dist/mi-search.entry-994c0189.mjs +206 -0
- package/dist/mi-search.entry-d0e582d1.mjs +208 -0
- package/dist/mi-share-sms.entry-ae15cf77.mjs +53 -0
- package/dist/mi-share-sms.entry-ced7f275.mjs +55 -0
- package/dist/mi-step-switcher.entry-812a5096.mjs +24 -0
- package/dist/mi-step-switcher.entry-c9e28e79.mjs +26 -0
- package/dist/mi-tab-panel.entry-63c34f28.mjs +19 -0
- package/dist/mi-tab-panel.entry-bde9bd39.mjs +21 -0
- package/dist/mi-tab.entry-1767468e.mjs +13 -0
- package/dist/mi-tab.entry-b5ac50ac.mjs +11 -0
- package/dist/mi-tabs.entry-1b8327bf.mjs +34 -0
- package/dist/mi-tabs.entry-bd190e21.mjs +36 -0
- package/dist/mi-variables-9a6c8d4d-e06eec88.mjs +7 -0
- package/dist/reactcomponent-2f9f051f.mjs +27190 -0
- package/dist/route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs +7 -0
- package/dist/sort-order.enum-64ce8998-b75ac596.mjs +317 -0
- package/dist/unit-system.enum-eaefb53e-0f424da4.mjs +7 -0
- package/dist/utils-ae714467-b07fc3be.mjs +36 -0
- package/dist/webcomponent-a10be1e6.mjs +31969 -0
- package/package.json +53 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { r as n, c as r, h as e } from "./webcomponent-a10be1e6.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
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { r as n, c as r, h as e } from "./reactcomponent-2f9f051f.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
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { r, c as o, h as e } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
+
import { U as a } 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;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 {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
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;
|
|
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((n) => n === 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 distance part.
|
|
122
|
+
*
|
|
123
|
+
* @returns {JSX.Element}
|
|
124
|
+
*/
|
|
125
|
+
renderDistance() {
|
|
126
|
+
return e("span", { part: "step-info", class: "step__distance-duration" }, 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.renderDistance()), 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) }, 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)));
|
|
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.renderDistance()), 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
|
|
199
|
+
};
|