@mapsindoors/map-template 1.16.0 → 1.17.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 +4 -4
- package/dist/{combo-box-item.entry-48605f24.mjs → combo-box-item.entry-3bdf398c.mjs} +1 -1
- package/dist/mapsindoors-react.es.js +2 -2
- package/dist/mapsindoors-react.umd.js +58 -58
- package/dist/mapsindoors-webcomponent.es.js +49608 -3
- package/dist/mapsindoors-webcomponent.umd.js +82 -82
- package/dist/{mi-card_2.entry-c2d6e4cb.mjs → mi-card_2.entry-40da4c22.mjs} +1 -1
- package/dist/{mi-chip.entry-220d7527.mjs → mi-chip.entry-8361080b.mjs} +1 -1
- package/dist/{mi-column.entry-07e53d71.mjs → mi-column.entry-1a4d1bd7.mjs} +1 -1
- package/dist/{mi-combo-box.entry-4633c7be.mjs → mi-combo-box.entry-3512ddbe.mjs} +1 -1
- package/dist/{mi-data-table.entry-07472817.mjs → mi-data-table.entry-3220f2be.mjs} +1 -1
- package/dist/{mi-distance_2.entry-e986eb84.mjs → mi-distance_2.entry-dcbb24c5.mjs} +1 -1
- package/dist/{mi-dropdown-item.entry-b9ca8157.mjs → mi-dropdown-item.entry-280ba4ce.mjs} +1 -1
- package/dist/{mi-dropdown.entry-08e0244a.mjs → mi-dropdown.entry-6c8f21d6.mjs} +1 -1
- package/dist/{mi-floor-selector.entry-b5ab3ede.mjs → mi-floor-selector.entry-5305d533.mjs} +5 -3
- package/dist/{mi-keyboard.entry-3ab79e44.mjs → mi-keyboard.entry-fcd58e0d.mjs} +1 -1
- package/dist/{mi-list-item-category.entry-99c79322.mjs → mi-list-item-category.entry-01d06afa.mjs} +1 -1
- package/dist/{mi-list-item-location.entry-e4973248.mjs → mi-list-item-location.entry-71cad82b.mjs} +9 -9
- package/dist/{mi-list.entry-c3fa0533.mjs → mi-list.entry-6b662039.mjs} +1 -1
- package/dist/{mi-location-booking.entry-e9fb4056.mjs → mi-location-booking.entry-3ede4961.mjs} +1 -1
- package/dist/{mi-location-info.entry-281b75cd.mjs → mi-location-info.entry-bc94c6aa.mjs} +1 -1
- package/dist/{mi-map-googlemaps.entry-2cc3d7bd.mjs → mi-map-googlemaps.entry-92d13571.mjs} +1 -1
- package/dist/{mi-map-mapbox.entry-c19c1c01.mjs → mi-map-mapbox.entry-793e7606.mjs} +1 -1
- package/dist/{mi-metric-card.entry-0333ee8a.mjs → mi-metric-card.entry-517557b8.mjs} +1 -1
- package/dist/{mi-my-position.entry-25e1230b.mjs → mi-my-position.entry-f10f3919.mjs} +1 -1
- package/dist/{mi-notification.entry-eb6fb735.mjs → mi-notification.entry-cc765c3c.mjs} +1 -1
- package/dist/{mi-route-instructions-heading.entry-bf1207a4.mjs → mi-route-instructions-heading.entry-4d3417ae.mjs} +1 -1
- package/dist/{mi-route-instructions-maneuver-legacy.entry-176db576.mjs → mi-route-instructions-maneuver-legacy.entry-ff7e6758.mjs} +1 -1
- package/dist/{mi-route-instructions-maneuver.entry-b34bfa44.mjs → mi-route-instructions-maneuver.entry-5d1bf1ef.mjs} +1 -1
- package/dist/{mi-route-instructions-step-legacy.entry-e4e2120f.mjs → mi-route-instructions-step-legacy.entry-9c75f214.mjs} +1 -1
- package/dist/{mi-route-instructions-step.entry-f780f5aa.mjs → mi-route-instructions-step.entry-b5588bd5.mjs} +1 -1
- package/dist/{mi-route-instructions.entry-b29c7a01.mjs → mi-route-instructions.entry-71ff4605.mjs} +1 -1
- package/dist/{mi-scroll-buttons.entry-8f20f782.mjs → mi-scroll-buttons.entry-312b45dd.mjs} +1 -1
- package/dist/{mi-search.entry-c699085d.mjs → mi-search.entry-a7b3ccc6.mjs} +1 -1
- package/dist/{mi-share-sms.entry-1e719dbf.mjs → mi-share-sms.entry-89c98479.mjs} +1 -1
- package/dist/{mi-step-switcher.entry-929d9c22.mjs → mi-step-switcher.entry-a5889eaf.mjs} +1 -1
- package/dist/{mi-tab-panel.entry-d60faca8.mjs → mi-tab-panel.entry-065b3497.mjs} +1 -1
- package/dist/{mi-tab.entry-be23d7c0.mjs → mi-tab.entry-44ba1f0f.mjs} +1 -1
- package/dist/{mi-tabs.entry-8c7a7879.mjs → mi-tabs.entry-9b0f103f.mjs} +1 -1
- package/dist/{mi-time.entry-646cf512.mjs → mi-time.entry-591fe0bd.mjs} +1 -1
- package/dist/{reactcomponent-f1212b63.mjs → reactcomponent-2fa842c6.mjs} +11114 -10904
- package/package.json +4 -1
- package/dist/combo-box-item.entry-f9f13752.mjs +0 -12
- package/dist/mi-card_2.entry-1a72c651.mjs +0 -23
- package/dist/mi-chip.entry-f647e52f.mjs +0 -16
- package/dist/mi-column.entry-4ffe12c8.mjs +0 -18
- package/dist/mi-combo-box.entry-e13b79dd.mjs +0 -260
- package/dist/mi-data-table.entry-69d09420.mjs +0 -213
- package/dist/mi-distance_2.entry-4c4448a4.mjs +0 -54
- package/dist/mi-dropdown-item.entry-c2a28628.mjs +0 -12
- package/dist/mi-dropdown.entry-1a63efa5.mjs +0 -296
- package/dist/mi-floor-selector.entry-688f9b1a.mjs +0 -110
- package/dist/mi-keyboard.entry-4dd75752.mjs +0 -2960
- package/dist/mi-list-item-category.entry-fa0d749e.mjs +0 -36
- package/dist/mi-list-item-location.entry-8ce424e5.mjs +0 -134
- package/dist/mi-list.entry-79bbeb09.mjs +0 -39
- package/dist/mi-location-booking.entry-3ea227d8.mjs +0 -4863
- package/dist/mi-location-info.entry-da932325.mjs +0 -29
- package/dist/mi-map-googlemaps.entry-ed869826.mjs +0 -396
- package/dist/mi-map-mapbox.entry-64063ac6.mjs +0 -298
- package/dist/mi-metric-card.entry-c7e0ead2.mjs +0 -26
- package/dist/mi-my-position.entry-39daf02a.mjs +0 -1396
- package/dist/mi-notification.entry-ebcbc0cd.mjs +0 -81
- package/dist/mi-route-instructions-heading.entry-343f11db.mjs +0 -72
- package/dist/mi-route-instructions-maneuver-legacy.entry-85fdbc9b.mjs +0 -73
- package/dist/mi-route-instructions-maneuver.entry-e9c4bf8d.mjs +0 -73
- package/dist/mi-route-instructions-step-legacy.entry-0f55fb47.mjs +0 -199
- package/dist/mi-route-instructions-step.entry-5f4cd9de.mjs +0 -234
- package/dist/mi-route-instructions.entry-ece4fa37.mjs +0 -140
- package/dist/mi-scroll-buttons.entry-9f426250.mjs +0 -46
- package/dist/mi-search.entry-81d35326.mjs +0 -240
- package/dist/mi-share-sms.entry-994a87b1.mjs +0 -53
- package/dist/mi-step-switcher.entry-b53eb2bc.mjs +0 -24
- package/dist/mi-tab-panel.entry-464dc246.mjs +0 -19
- package/dist/mi-tab.entry-4da5bba3.mjs +0 -11
- package/dist/mi-tabs.entry-cbe62a06.mjs +0 -34
- package/dist/mi-time.entry-7b94fad6.mjs +0 -43
- package/dist/webcomponent-e45720b9.mjs +0 -36539
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { r as o, c as a, h as e } from "./webcomponent-e45720b9.mjs";
|
|
2
|
-
import { U as n } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
3
|
-
import { c as p } from "./utils-ae714467-b07fc3be.mjs";
|
|
4
|
-
const l = ':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__info.destination{grid-auto-flow:row;justify-items:center}.step__destination{display:grid;gap:8px;align-items:center;justify-content:center;grid-auto-flow:column}.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{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{display:grid;justify-content:center}.step__toggle mi-icon{width:24px;height:24px;display:block}.step__substeps{display:grid;gap:32px}.step__details{display:grid;gap:24px;width:100%}', d = class {
|
|
5
|
-
constructor(t) {
|
|
6
|
-
o(this, t), this.stepClicked = a(this, "stepClicked", 7), this.substepsToggled = a(this, "substepsToggled", 7), this.isInternetExplorer = p(), this.step = void 0, this.stepData = void 0, this.hideIndoorSubsteps = !0, this.fromRouteContext = "", this.fromTravelMode = void 0, this.fromTransitStop = void 0, this.destinationLocation = void 0, this.unit = navigator.language === "en-US" ? n.Imperial : n.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
|
-
/**
|
|
15
|
-
* Programmatically open the substeps.
|
|
16
|
-
*/
|
|
17
|
-
openSubsteps() {
|
|
18
|
-
this.substepsAreOpen = !0;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Programmatically close the substeps.
|
|
22
|
-
*/
|
|
23
|
-
closeSubsteps() {
|
|
24
|
-
this.substepsAreOpen = !1;
|
|
25
|
-
}
|
|
26
|
-
componentWillLoad() {
|
|
27
|
-
this.parseStepProp(), this.parseTranslationsProp();
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Render if there is step data.
|
|
31
|
-
*/
|
|
32
|
-
render() {
|
|
33
|
-
return this.stepData && this.translationsData ? this.renderStep() : null;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Emits stepClicked event (if click target is not related to an action)
|
|
37
|
-
* @param event Event
|
|
38
|
-
*/
|
|
39
|
-
stepClickHandler(t) {
|
|
40
|
-
if (Array.from(t.target.classList).includes("icon-toggle"))
|
|
41
|
-
return;
|
|
42
|
-
let s = null;
|
|
43
|
-
t.target.dataset.maneuverIndex !== void 0 && (s = parseInt(t.target.dataset.maneuverIndex)), this.stepClicked.emit({ maneuverIndex: s });
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Render step part depending on travel mode.
|
|
47
|
-
*
|
|
48
|
-
* @returns {JSX.Element}
|
|
49
|
-
*/
|
|
50
|
-
renderStep() {
|
|
51
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
52
|
-
case "DRIVING":
|
|
53
|
-
return this.renderDrivingStep();
|
|
54
|
-
case "WALKING":
|
|
55
|
-
return this.renderWalkingStep();
|
|
56
|
-
case "BICYCLING":
|
|
57
|
-
return this.renderBicyclingStep();
|
|
58
|
-
case "TRANSIT":
|
|
59
|
-
return this.renderTransitStep();
|
|
60
|
-
case "DESTINATION":
|
|
61
|
-
return this.renderDestinationStep();
|
|
62
|
-
default:
|
|
63
|
-
return e("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Render the travel mode indicator and dotted/solid line.
|
|
68
|
-
*
|
|
69
|
-
* @returns {JSX.Element}
|
|
70
|
-
*/
|
|
71
|
-
renderTravelMode() {
|
|
72
|
-
if (this.isInternetExplorer)
|
|
73
|
-
return null;
|
|
74
|
-
let t;
|
|
75
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
76
|
-
case "DRIVING":
|
|
77
|
-
t = "car";
|
|
78
|
-
break;
|
|
79
|
-
case "WALKING":
|
|
80
|
-
t = "walk";
|
|
81
|
-
break;
|
|
82
|
-
case "BICYCLING":
|
|
83
|
-
t = "bike";
|
|
84
|
-
break;
|
|
85
|
-
case "TRANSIT":
|
|
86
|
-
t = this.getTransitVehicleIconName();
|
|
87
|
-
break;
|
|
88
|
-
case "DESTINATION":
|
|
89
|
-
t = "logo";
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
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 })));
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Get icon name for transit vehicle.
|
|
96
|
-
*
|
|
97
|
-
* @returns {string}
|
|
98
|
-
*/
|
|
99
|
-
getTransitVehicleIconName() {
|
|
100
|
-
var t, s;
|
|
101
|
-
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();
|
|
102
|
-
return i && ["boat", "bus", "railway", "train", "subway"].some((r) => r === i) ? i : "transit";
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Toggles visibility of sub steps (steps in steps)
|
|
106
|
-
*/
|
|
107
|
-
toggleSubsteps() {
|
|
108
|
-
this.substepsToggled.emit(), this.substepsAreOpen = !this.substepsAreOpen;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Render substeps if they should be visible.
|
|
112
|
-
*
|
|
113
|
-
* @returns {JSX.Element}
|
|
114
|
-
*/
|
|
115
|
-
renderSubsteps() {
|
|
116
|
-
var t;
|
|
117
|
-
return this.substepsAreOpen === !0 ? e("div", { class: "step__substeps" }, (t = this.stepData.steps) === null || t === void 0 ? void 0 : t.map((s, i) => e("mi-route-instructions-maneuver", {
|
|
118
|
-
"data-maneuver-index": i,
|
|
119
|
-
maneuver: JSON.stringify(s),
|
|
120
|
-
translations: this.translations,
|
|
121
|
-
unit: this.unit,
|
|
122
|
-
// @ts-ignore
|
|
123
|
-
exportparts: `
|
|
124
|
-
maneuver-icon,
|
|
125
|
-
maneuver-description,
|
|
126
|
-
maneuver-description-distance,
|
|
127
|
-
maneuver-description-distance-border`
|
|
128
|
-
}))) : null;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Render the toggle button for the sub step expander.
|
|
132
|
-
*
|
|
133
|
-
* @returns {JSX.Element}
|
|
134
|
-
*/
|
|
135
|
-
renderToggleButton() {
|
|
136
|
-
var t;
|
|
137
|
-
return ((t = this.stepData.steps) === null || t === void 0 ? void 0 : t.length) <= 0 ? null : e("span", { class: "step__toggle", onClick: () => this.toggleSubsteps() }, this.substepsAreOpen ? e("mi-icon", { part: "step-toggle", "icon-name": "minimize" }) : e("mi-icon", { part: "step-toggle", "icon-name": "maximize" }));
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Render distance part.
|
|
141
|
-
*
|
|
142
|
-
* @returns {JSX.Element}
|
|
143
|
-
*/
|
|
144
|
-
renderDistance() {
|
|
145
|
-
return e("span", { part: "step-info", class: "step__distance-duration" }, e("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), e("br", null));
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Render toggle and substeps.
|
|
149
|
-
*
|
|
150
|
-
* @returns {JSX.Element}
|
|
151
|
-
*/
|
|
152
|
-
renderToggleAndSubsteps() {
|
|
153
|
-
return e("div", { class: "step__details" }, this.renderToggleButton(), this.renderSubsteps());
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Render a driving step.
|
|
157
|
-
*
|
|
158
|
-
* @returns {JSX.Element}
|
|
159
|
-
*/
|
|
160
|
-
renderDrivingStep() {
|
|
161
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, e("div", { part: "step-description", class: "step__description" }, this.renderDistance()), e("div", { class: "step__info" }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "car" })), e("div", { part: "step-heading", class: "step__heading" }, this.getStepHeading())), this.renderToggleAndSubsteps());
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Get display heading.
|
|
165
|
-
*
|
|
166
|
-
* @returns {string}
|
|
167
|
-
*/
|
|
168
|
-
getStepHeading() {
|
|
169
|
-
var t;
|
|
170
|
-
const s = {
|
|
171
|
-
driving: this.translationsData.drive,
|
|
172
|
-
walking: this.translationsData.walk,
|
|
173
|
-
bicycling: this.translationsData.bike
|
|
174
|
-
};
|
|
175
|
-
return !((t = this.stepData.steps[0]) === null || t === void 0) && t.instructions ? this.stepData.steps[0].instructions : s[this.stepData.travel_mode.toLowerCase()];
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Render a walking step.
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* @returns {JSX.Element}
|
|
182
|
-
*/
|
|
183
|
-
renderWalkingStep() {
|
|
184
|
-
let t, s;
|
|
185
|
-
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)), this.renderToggleAndSubsteps());
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Add building or venue name to the step heading
|
|
189
|
-
* @param {string} heading
|
|
190
|
-
* @param {StepContext} stepContext
|
|
191
|
-
* @returns
|
|
192
|
-
*/
|
|
193
|
-
addStepContextNameToHeading(t, s) {
|
|
194
|
-
return s && (s.building ? t += ` ${s.building.buildingInfo.name} ${this.translationsData.building}` : s.venue && (t += ` ${s.venue.venueInfo.name} ${this.translationsData.venue}`)), t;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Render a bicycling step.
|
|
198
|
-
*
|
|
199
|
-
* @returns {JSX.Element}
|
|
200
|
-
*/
|
|
201
|
-
renderBicyclingStep() {
|
|
202
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, e("div", { part: "step-description", class: "step__description" }, this.renderDistance()), e("div", { class: "step__info" }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "bike" })), e("div", { part: "step-heading", class: "step__heading" }, this.getStepHeading())), this.renderToggleAndSubsteps());
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Render the destination step.
|
|
206
|
-
*
|
|
207
|
-
* @returns {JSX.Element}
|
|
208
|
-
*/
|
|
209
|
-
renderDestinationStep() {
|
|
210
|
-
return e("div", { class: "step", onClick: (t) => this.stepClickHandler(t) }, e("div", { class: "step__info destination" }, e("div", { class: "step__destination" }, this.isInternetExplorer ? null : e("span", { class: "step__action-icon step__action-icon--circled" }, e("mi-icon", { "icon-name": "logo" })), e("div", { part: "step-heading", class: "step__heading" }, this.translationsData.destination)), e("div", { part: "step-location", class: "step__location" }, this.destinationLocation)), this.renderToggleAndSubsteps());
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Render a transit step.
|
|
214
|
-
*
|
|
215
|
-
* @returns {JSX.Element}
|
|
216
|
-
*/
|
|
217
|
-
renderTransitStep() {
|
|
218
|
-
var t, s;
|
|
219
|
-
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: {
|
|
220
|
-
backgroundColor: !((t = this.stepData.transit_information.line) === null || t === void 0) && t.color ? this.stepData.transit_information.line.color : null,
|
|
221
|
-
color: !((s = this.stepData.transit_information.line) === null || s === void 0) && s.text_color ? this.stepData.transit_information.line.text_color : null
|
|
222
|
-
} }, 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.renderToggleAndSubsteps());
|
|
223
|
-
}
|
|
224
|
-
static get watchers() {
|
|
225
|
-
return {
|
|
226
|
-
step: ["parseStepProp"],
|
|
227
|
-
translations: ["parseTranslationsProp"]
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
d.style = l;
|
|
232
|
-
export {
|
|
233
|
-
d as mi_route_instructions_step
|
|
234
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { r as u, c as g, h as s, H as v } from "./webcomponent-e45720b9.mjs";
|
|
2
|
-
import { R as m } from "./route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs";
|
|
3
|
-
import { U as f } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
4
|
-
import { c as S } from "./utils-ae714467-b07fc3be.mjs";
|
|
5
|
-
const x = ':host{display:block;background-color:#fcfcfc;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"}:host mi-route-instructions-step:hover{cursor:pointer;background-color:#f9fafb;transition:300ms ease}:host mi-route-instructions-step.active{background-color:#f3f4f6;transition:none;cursor:default}:host .instructions-destination{display:flex}:host .instructions-destination-icon{width:40px;display:flex;justify-content:center;align-items:center}:host .instructions-destination-icon mi-icon{width:24px;height:24px;background-color:#1c1917}:host .instructions-destination-details{flex:1;padding:12px}:host .instructions-destination-details mi-location-info{font-size:0.875rem}', I = class {
|
|
6
|
-
constructor(t) {
|
|
7
|
-
u(this, t), this.clicked = g(this, "clicked", 7), this.miStepElements = [], this.lastStepRouteContext = null, this.lastStepTravelMode = null, this.lastStepTransitStop = null, this.activeStep = {
|
|
8
|
-
legIndex: 0,
|
|
9
|
-
stepIndex: 0
|
|
10
|
-
}, this.unit = f.Metric, this.route = void 0, this.hideIndoorSubsteps = !1, this.travelMode = m.Walking, this.originLocation = void 0, this.originName = void 0, this.destinationLocation = void 0, this.destinationName = void 0, this.translations = {
|
|
11
|
-
walk: "Walk",
|
|
12
|
-
bike: "Bike",
|
|
13
|
-
transit: "Transit",
|
|
14
|
-
drive: "Drive",
|
|
15
|
-
destination: "You have arrived",
|
|
16
|
-
leave: "Leave",
|
|
17
|
-
from: "From",
|
|
18
|
-
park: "Park",
|
|
19
|
-
at: "at",
|
|
20
|
-
building: "Building",
|
|
21
|
-
venue: "Venue",
|
|
22
|
-
takeStaircaseToLevel: "Take staircase to level",
|
|
23
|
-
takeLadderToLevel: "Take the ladder to level",
|
|
24
|
-
takeElevatorToLevel: "Take elevator to level",
|
|
25
|
-
takeEscalatorToLevel: "Take escalator to level",
|
|
26
|
-
takeWheelchairLiftToLevel: "Take wheelchair lift to level",
|
|
27
|
-
takeWheelchairRampToLevel: "Take wheelchair ramp to level",
|
|
28
|
-
exit: "Exit",
|
|
29
|
-
enter: "Enter",
|
|
30
|
-
stops: "stops",
|
|
31
|
-
andContinue: "and continue",
|
|
32
|
-
continueStraightAhead: "Continue straight ahead",
|
|
33
|
-
goLeft: "Go left",
|
|
34
|
-
goSharpLeft: "Go sharp left",
|
|
35
|
-
goSlightLeft: "Go slight left",
|
|
36
|
-
goRight: "Go right",
|
|
37
|
-
goSharpRight: "Go sharp right",
|
|
38
|
-
goSlightRight: "Go slight right",
|
|
39
|
-
turnAround: "Turn around",
|
|
40
|
-
days: "d",
|
|
41
|
-
hours: "h",
|
|
42
|
-
minutes: "min"
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
componentDidRender() {
|
|
46
|
-
this.miStepElements.forEach((t) => {
|
|
47
|
-
t.hideIndoorSubsteps = this.hideIndoorSubsteps;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Transform the step in legs to a flat array of steps.
|
|
52
|
-
*
|
|
53
|
-
* @returns {Step[]}
|
|
54
|
-
*/
|
|
55
|
-
getRouteSteps() {
|
|
56
|
-
return this.route ? this.route.legs.reduce((t, i, e) => {
|
|
57
|
-
for (const o in i.steps) {
|
|
58
|
-
const n = i.steps[o];
|
|
59
|
-
n.originalLegIndex = e, n.originalStepIndex = parseInt(o), t.push(n);
|
|
60
|
-
}
|
|
61
|
-
return t;
|
|
62
|
-
}, []) : [];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Updates the activeStep attribute and emits an object with leg, step and maneuver index information.
|
|
66
|
-
*
|
|
67
|
-
* @param {CustomEvent<any>} event Step object.
|
|
68
|
-
* @param {number} stepIndex step index.
|
|
69
|
-
*/
|
|
70
|
-
stepClickedHandler(t, i) {
|
|
71
|
-
const e = this.getRouteSteps()[i];
|
|
72
|
-
this.activeStep = {
|
|
73
|
-
legIndex: e.originalLegIndex,
|
|
74
|
-
stepIndex: e.originalStepIndex
|
|
75
|
-
}, this.clicked.emit({
|
|
76
|
-
legIndex: e.originalLegIndex,
|
|
77
|
-
stepIndex: e.originalStepIndex,
|
|
78
|
-
maneuverIndex: t.detail.maneuverIndex
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Check if the step is active.
|
|
83
|
-
*
|
|
84
|
-
* @param {Step} step
|
|
85
|
-
* @returns {boolean}
|
|
86
|
-
*/
|
|
87
|
-
isActiveStep(t) {
|
|
88
|
-
return this.activeStep ? this.activeStep.legIndex === t.originalLegIndex && this.activeStep.stepIndex === t.originalStepIndex : !1;
|
|
89
|
-
}
|
|
90
|
-
render() {
|
|
91
|
-
return this.route ? this.renderInstructions() : null;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Render instructions.
|
|
95
|
-
*
|
|
96
|
-
* @returns {JSX.Element}
|
|
97
|
-
*/
|
|
98
|
-
renderInstructions() {
|
|
99
|
-
return s(v, null, this.getRouteSteps().map((t, i) => {
|
|
100
|
-
var e, o, n, a, r;
|
|
101
|
-
const d = !((o = (e = this.originLocation) === null || e === void 0 ? void 0 : e.properties) === null || o === void 0) && o.name ? this.originLocation.properties.name : this.originName || "", c = t.originalLegIndex === 0 && t.originalStepIndex === 0 ? d : this.lastStepRouteContext, p = this.lastStepTravelMode, h = this.lastStepTransitStop;
|
|
102
|
-
return this.lastStepRouteContext = t.route_context, this.lastStepTravelMode = t.travel_mode, this.lastStepTransitStop = !((a = (n = t.transit_information) === null || n === void 0 ? void 0 : n.arrival_stop) === null || a === void 0) && a.name ? (r = t.transit_information) === null || r === void 0 ? void 0 : r.arrival_stop.name : null, s("mi-route-instructions-step-legacy", {
|
|
103
|
-
ref: (l) => this.miStepElements.push(l),
|
|
104
|
-
"from-travel-mode": p,
|
|
105
|
-
"from-route-context": c,
|
|
106
|
-
"from-transit-stop": h,
|
|
107
|
-
step: JSON.stringify(t),
|
|
108
|
-
translations: JSON.stringify(this.translations),
|
|
109
|
-
unit: this.unit,
|
|
110
|
-
onStepClicked: (l) => this.stepClickedHandler(l, i),
|
|
111
|
-
class: this.isActiveStep(t) ? "active" : "",
|
|
112
|
-
part: this.isActiveStep(t) ? "step active" : "step",
|
|
113
|
-
// @ts-ignore
|
|
114
|
-
exportparts: `
|
|
115
|
-
step-toggle,
|
|
116
|
-
step-heading,
|
|
117
|
-
step-description,
|
|
118
|
-
step-info,
|
|
119
|
-
step-travel-mode,
|
|
120
|
-
step-travel-mode-icon,
|
|
121
|
-
maneuver-icon,
|
|
122
|
-
maneuver-description,
|
|
123
|
-
maneuver-description-distance,
|
|
124
|
-
maneuver-description-distance-border`
|
|
125
|
-
});
|
|
126
|
-
}), this.destinationLocation || this.destinationName ? this.renderDestination() : null);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Render destination.
|
|
130
|
-
*
|
|
131
|
-
* @returns {JSX.Element}
|
|
132
|
-
*/
|
|
133
|
-
renderDestination() {
|
|
134
|
-
return s("div", { class: "instructions-destination" }, s("div", { class: "instructions-destination-icon" }, S() ? null : s("mi-icon", { "icon-name": "marker" })), s("div", { part: "instructions-destination", class: "instructions-destination-details" }, this.destinationLocation ? this.destinationLocation.properties.name : this.destinationName, this.destinationLocation ? s("mi-location-info", { part: "instructions-destination-info", location: this.destinationLocation }) : null));
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
I.style = x;
|
|
138
|
-
export {
|
|
139
|
-
I as mi_route_instructions
|
|
140
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { r as o, h as e } from "./webcomponent-e45720b9.mjs";
|
|
2
|
-
const n = '@charset "UTF-8";a.mi-button{cursor:default}.mi-button{border-radius:4px;border-width:1px;border-style:solid;font-family:Inter, -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";font-size:1rem;font-weight:500;padding-left:16px;padding-right:16px;padding-top:12px;padding-bottom:12px;display:inline-flex;align-items:center}.mi-button:disabled{opacity:0.48;cursor:not-allowed}.mi-button object{filter:invert(9%) sepia(13%) saturate(692%) hue-rotate(185deg) brightness(98%) contrast(91%);width:16px;height:16px}.mi-button--small{padding-left:12px;padding-right:12px;padding-top:8px;padding-bottom:8px;font-size:0.875rem;height:32px}.mi-button--small object{width:16px;height:16px}.mi-button--large{padding-left:16px;padding-right:16px;font-size:1.25rem}.mi-button--large object{width:20px;height:20px}.mi-button--full-width{width:100%;justify-content:center}.mi-button--icon-left{padding-left:12px}.mi-button--icon-left object{margin-right:8px}.mi-button--icon-right{padding-right:12px}.mi-button--icon-right object{margin-left:8px}.mi-button--icon-both{padding-top:12px;padding-bottom:12px}.mi-button--icon-both object:first-of-type{margin-right:8px}.mi-button--icon-both object:last-of-type{margin-left:8px}.mi-button--base{background:linear-gradient(#f5f7fa, #ebeff5);color:#1e2025;border-color:#c8d0e0}.mi-button--base:not(:disabled):hover{background:linear-gradient(#ebeff5, #dee3ed);border-color:#aeb9cb}.mi-button--base:not(:disabled):active{background:linear-gradient(#dee3ed, #ebeff5)}.mi-button--primary{color:#ffffff;border-color:#20693e;background:linear-gradient(#3ba064, #2a844e)}.mi-button--primary object{filter:invert(100%) sepia(93%) saturate(0%) hue-rotate(201deg) brightness(106%) contrast(106%)}.mi-button--primary:not(:disabled):hover{background:linear-gradient(#2a844e, #20693e)}.mi-button--primary:not(:disabled):active{background:linear-gradient(#20693e, #2a844e)}.mi-button--delete{background:linear-gradient(#f55151, #de1b1b);color:#ffffff;border-color:#ba0d0d}.mi-button--delete object{filter:invert(100%) sepia(93%) saturate(0%) hue-rotate(201deg) brightness(106%) contrast(106%)}.mi-button--delete:not(:disabled):hover{background:linear-gradient(#de1b1b, #ba0d0d)}.mi-button--delete:not(:disabled):active{background:linear-gradient(#ba0d0d, #de1b1b)}.mi-button--outline{color:#3071d9;border-color:#3071d9;background-color:transparent}.mi-button--outline object{filter:invert(38%) sepia(97%) saturate(742%) hue-rotate(188deg) brightness(86%) contrast(97%)}.mi-button--outline:not(:disabled):hover{color:#1d5bbf;border-color:#1d5bbf;background-color:#eef4fc}.mi-button--outline:not(:disabled):active{color:#1d5bbf;border-color:#1d5bbf;background-color:#cfe0fc}.mi-button--link{color:#3071d9;border-style:none;background-color:transparent;cursor:pointer}.mi-button--link object{filter:invert(38%) sepia(97%) saturate(742%) hue-rotate(188deg) brightness(86%) contrast(97%)}.mi-button--link:not(:disabled):hover{color:#1d5bbf;border-color:#1d5bbf;background-color:#eef4fc}.mi-button--link:disabled:hover{cursor:not-allowed}.mi-button--link:not(:disabled):active{color:#1d5bbf;border-color:#1d5bbf;background-color:#cfe0fc}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}.scroll-buttons{height:100%;width:64px;background-color:#f9fafb;border-left:solid;border-color:#e5e7eb;border-width:1px;display:flex;flex-direction:column;align-items:center;justify-content:center}.scroll-buttons .btn{margin:8px}.scroll-buttons .btn-up::after{content:"↑"}.scroll-buttons .btn-down::after{content:"↓"}', r = class {
|
|
3
|
-
constructor(t) {
|
|
4
|
-
o(this, t), this.scrollContainerElementRef = void 0, this.scrollLength = 100;
|
|
5
|
-
}
|
|
6
|
-
addScrollEventListener() {
|
|
7
|
-
this.scrollContainerElementRef.addEventListener("scroll", () => {
|
|
8
|
-
this.updateScrollButtonsState();
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Adds scroll event listener to the container element when this component is first attached to the DOM.
|
|
13
|
-
*/
|
|
14
|
-
connectedCallback() {
|
|
15
|
-
this.addScrollEventListener();
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Updates enable/disable state for scroll up and down buttons.
|
|
19
|
-
* @returns {Promise<void>}
|
|
20
|
-
*/
|
|
21
|
-
async updateScrollButtonsState() {
|
|
22
|
-
this.scrollContainerElementRef.scrollTop === 0 ? this.upButtonElement.disabled = !0 : this.upButtonElement.disabled && (this.upButtonElement.disabled = !1), this.scrollContainerElementRef.scrollHeight - this.scrollContainerElementRef.scrollTop === this.scrollContainerElementRef.clientHeight ? this.downButtonElement.disabled = !0 : this.downButtonElement.disabled && (this.downButtonElement.disabled = !1);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Update scroll position.
|
|
26
|
-
* @param {number} value - Value to scroll.
|
|
27
|
-
*/
|
|
28
|
-
updateScrollPosition(t) {
|
|
29
|
-
"scrollBehavior" in document.documentElement.style ? this.scrollContainerElementRef.scroll({
|
|
30
|
-
top: this.scrollContainerElementRef.scrollTop + t,
|
|
31
|
-
behavior: "smooth"
|
|
32
|
-
}) : this.scrollContainerElementRef.scrollTop = t;
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
return e("div", { class: "scroll-buttons" }, e("button", { class: "mi-button mi-button--base btn btn-up", type: "button", disabled: !0, "aria-label": "Scroll Up", ref: (t) => this.upButtonElement = t, onClick: () => this.updateScrollPosition(-this.scrollLength) }), e("button", { class: "mi-button mi-button--base btn btn-down", type: "button", "aria-label": "Scroll Down", ref: (t) => this.downButtonElement = t, onClick: () => this.updateScrollPosition(this.scrollLength) }));
|
|
36
|
-
}
|
|
37
|
-
static get watchers() {
|
|
38
|
-
return {
|
|
39
|
-
scrollContainerElementRef: ["addScrollEventListener"]
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
r.style = n;
|
|
44
|
-
export {
|
|
45
|
-
r as mi_scroll_buttons
|
|
46
|
-
};
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { r as v, c as d, h as p, H as M } from "./webcomponent-e45720b9.mjs";
|
|
2
|
-
import { c as f, g as x } from "./_commonjsHelpers-ba3f0406-b96e6d6a.mjs";
|
|
3
|
-
var g = f(function(e, t) {
|
|
4
|
-
Object.defineProperty(t, "__esModule", {
|
|
5
|
-
value: !0
|
|
6
|
-
}), t.default = r, t.debounce = o;
|
|
7
|
-
var s = 500;
|
|
8
|
-
t.DEFAULT_DEBOUNCE_DURATION = s;
|
|
9
|
-
function r(i) {
|
|
10
|
-
return function(a, u, l) {
|
|
11
|
-
return {
|
|
12
|
-
configurable: !0,
|
|
13
|
-
enumerable: l.enumerable,
|
|
14
|
-
get: function() {
|
|
15
|
-
return Object.defineProperty(this, u, {
|
|
16
|
-
configurable: !0,
|
|
17
|
-
enumerable: l.enumerable,
|
|
18
|
-
value: o(l.value, i)
|
|
19
|
-
}), this[u];
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function o(i) {
|
|
25
|
-
var n = arguments.length <= 1 || arguments[1] === void 0 ? s : arguments[1], a = void 0;
|
|
26
|
-
function u() {
|
|
27
|
-
for (var l = this, c = arguments.length, h = Array(c), m = 0; m < c; m++)
|
|
28
|
-
h[m] = arguments[m];
|
|
29
|
-
u.clear(), a = setTimeout(function() {
|
|
30
|
-
a = null, i.apply(l, h);
|
|
31
|
-
}, n);
|
|
32
|
-
}
|
|
33
|
-
return u.clear = function() {
|
|
34
|
-
a && (clearTimeout(a), a = null);
|
|
35
|
-
}, u;
|
|
36
|
-
}
|
|
37
|
-
}), I = f(function(e, t) {
|
|
38
|
-
Object.defineProperty(t, "__esModule", {
|
|
39
|
-
value: !0
|
|
40
|
-
});
|
|
41
|
-
function s(n, a) {
|
|
42
|
-
var u = a({}, n);
|
|
43
|
-
return delete u.default, u;
|
|
44
|
-
}
|
|
45
|
-
function r(n, a) {
|
|
46
|
-
for (var u = Object.getOwnPropertyNames(a), l = 0; l < u.length; l++) {
|
|
47
|
-
var c = u[l], h = Object.getOwnPropertyDescriptor(a, c);
|
|
48
|
-
h && h.configurable && n[c] === void 0 && Object.defineProperty(n, c, h);
|
|
49
|
-
}
|
|
50
|
-
return n;
|
|
51
|
-
}
|
|
52
|
-
function o(n) {
|
|
53
|
-
return n && n.__esModule ? n : { default: n };
|
|
54
|
-
}
|
|
55
|
-
var i = o(g);
|
|
56
|
-
t.default = i.default, r(t, s(g, r));
|
|
57
|
-
});
|
|
58
|
-
const D = /* @__PURE__ */ x(I), E = 'mi-search{display:block;position:relative;}mi-search input[type=search]{border-radius:8px;background-color:#ffffff;padding-left:40px;height:48px;font-size:1rem;padding-right:40px;font-family:-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";-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;position:relative;background-image:url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMS43MSAxMUgxMi41TDE3LjQ5IDE2TDE2IDE3LjQ5TDExIDEyLjVWMTEuNzFMMTAuNzMgMTEuNDNDOS41OSAxMi40MSA4LjExIDEzIDYuNSAxM0MyLjkxIDEzIDAgMTAuMDkgMCA2LjVDMCAyLjkxIDIuOTEgMCA2LjUgMEMxMC4wOSAwIDEzIDIuOTEgMTMgNi41QzEzIDguMTEgMTIuNDEgOS41OSAxMS40MyAxMC43M0wxMS43MSAxMVpNMiA2LjVDMiA4Ljk5IDQuMDEgMTEgNi41IDExQzguOTkgMTEgMTEgOC45OSAxMSA2LjVDMTEgNC4wMSA4Ljk5IDIgNi41IDJDNC4wMSAyIDIgNC4wMSAyIDYuNVoiIGZpbGw9IiM4RDk4QUEiLz4KPC9zdmc+Cg==");background-repeat:no-repeat;background-position:16px center;border-color:#E6E6E6;color:var(--tailwind-colors-neutral-500);border:1px solid var(--tailwind-colors-gray-200)}mi-search input[type=search]:focus{border-color:#3b82f6;box-shadow:0 0 0 2px #cfe0fc;}mi-search input[type=search][disabled]{pointer-events:none}mi-search input::-webkit-search-cancel-button{-webkit-appearance:none}mi-search input::-ms-clear{display:none}mi-search input::-moz-search-clear-button{-moz-appearance:none}mi-search button{position:absolute;right:14px;top:50%;transform:translateY(-50%);width:20px;height:20px;background-color:#6b7280;border-radius:50%;padding:0;border-width:0;display:flex;align-items:center;justify-content:center}mi-search button:focus{outline:0}mi-search button svg{fill:white;width:10px;height:10px}';
|
|
59
|
-
var A = function(e, t, s, r) {
|
|
60
|
-
var o = arguments.length, i = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, s) : r, n;
|
|
61
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
62
|
-
i = Reflect.decorate(e, t, s, r);
|
|
63
|
-
else
|
|
64
|
-
for (var a = e.length - 1; a >= 0; a--)
|
|
65
|
-
(n = e[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(t, s, i) : n(t, s)) || i);
|
|
66
|
-
return o > 3 && i && Object.defineProperty(t, s, i), i;
|
|
67
|
-
};
|
|
68
|
-
const b = class {
|
|
69
|
-
constructor(e) {
|
|
70
|
-
v(this, e), this.results = d(this, "results", 7), this.cleared = d(this, "cleared", 7), this.componentRendered = d(this, "componentRendered", 7), this.shortInput = d(this, "shortInput", 7), this.changed = d(this, "changed", 7), this.preventSearch = !1, this.placeholder = "", this.idAttribute = "", this.dataAttributes = {}, this.mapsindoors = !1, this.google = !1, this.mapbox = !1, this.miFields = "name,description,aliases,categories,externalId", this.miTake = void 0, this.miSkip = void 0, this.miOrder = void 0, this.miCategories = void 0, this.miNear = void 0, this.miVenue = void 0, this.gmCountryCode = void 0, this.value = void 0, this.disabled = !1, this.sessionToken = void 0, this.userPosition = void 0;
|
|
71
|
-
}
|
|
72
|
-
valueChange(e) {
|
|
73
|
-
!e || !this.inputElement || e !== this.inputElement.value && (this.inputElement.value = e, this.preventSearch || this.inputChanged());
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Clear the input field.
|
|
77
|
-
*/
|
|
78
|
-
async clear() {
|
|
79
|
-
this.inputElement.value = "", this.value = "", this.lastRequested = null, this.cleared.emit();
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Programmatically trigger the search.
|
|
83
|
-
*/
|
|
84
|
-
triggerSearch() {
|
|
85
|
-
const e = this.inputElement.value;
|
|
86
|
-
this.search(e);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Sets text to be shown in the search field.
|
|
90
|
-
* Setting it will not perform a search.
|
|
91
|
-
*/
|
|
92
|
-
setDisplayText(e) {
|
|
93
|
-
this.preventSearch = !0, this.value = e, this.preventSearch = !1;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Set focus on the input field.
|
|
97
|
-
* The preventScroll boolean is passed as true to prevent the browser
|
|
98
|
-
* from scrolling the document to bring the newly-focused element into view.
|
|
99
|
-
*/
|
|
100
|
-
focusInput() {
|
|
101
|
-
this.inputElement.focus({ preventScroll: !0 });
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Perform the search.
|
|
105
|
-
*/
|
|
106
|
-
search(e) {
|
|
107
|
-
Promise.all([
|
|
108
|
-
this.makeMapsIndoorsQuery(e),
|
|
109
|
-
this.makeGooglePlacesQuery(e),
|
|
110
|
-
this.getMapboxSearchResults(e)
|
|
111
|
-
]).then((t) => {
|
|
112
|
-
this.lastRequested = e, this.google ? this.pushResults(t[0].concat(t[1])) : this.mapbox && mapboxgl.accessToken ? this.pushResults(t[0].concat(t[2])) : this.pushResults(t[0]);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Handles incoming input change event, eg. input field value has changed.
|
|
117
|
-
* The function is debounced 500ms to avoid firing too many requests while typing.
|
|
118
|
-
*/
|
|
119
|
-
inputChanged() {
|
|
120
|
-
const e = this.inputElement.value;
|
|
121
|
-
if (this.value = e, !this.preventSearch) {
|
|
122
|
-
if (e.length < 2) {
|
|
123
|
-
this.lastRequested = null, e.length === 1 ? this.shortInput.emit() : this.clear();
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
e.length > 1 && e !== this.lastRequested && this.search(e), this.changed.emit();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Push the results via the results event.
|
|
131
|
-
* @param object[] Locations
|
|
132
|
-
*/
|
|
133
|
-
pushResults(e) {
|
|
134
|
-
this.results.emit(e);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Make MapsIndoors locations request based on given search query.
|
|
138
|
-
* @param {string} query
|
|
139
|
-
* @return {Promise<any[]>}
|
|
140
|
-
*/
|
|
141
|
-
makeMapsIndoorsQuery(e) {
|
|
142
|
-
if (!this.mapsindoors)
|
|
143
|
-
return Promise.resolve([]);
|
|
144
|
-
let t;
|
|
145
|
-
if (this.miNear && (t = this.miNear, /^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$/.test(this.miNear))) {
|
|
146
|
-
const s = this.miNear.split(",");
|
|
147
|
-
t = { lat: parseFloat(s[0]), lng: parseFloat(s[1]) };
|
|
148
|
-
}
|
|
149
|
-
return mapsindoors.services.LocationsService.getLocations({
|
|
150
|
-
q: e.trim(),
|
|
151
|
-
fields: this.miFields,
|
|
152
|
-
take: this.miTake,
|
|
153
|
-
skip: this.miSkip,
|
|
154
|
-
orderBy: this.miOrder,
|
|
155
|
-
near: t,
|
|
156
|
-
venue: this.miVenue,
|
|
157
|
-
categories: this.miCategories
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Make Google Places autocomplete suggestion request.
|
|
162
|
-
*
|
|
163
|
-
* @param {string} query
|
|
164
|
-
* @return {Promise<any>}
|
|
165
|
-
*/
|
|
166
|
-
makeGooglePlacesQuery(e) {
|
|
167
|
-
return this.google ? this.googleAutocompleteService || (this.googleAutocompleteService = new google.maps.places.AutocompleteService()) : this.googleAutocompleteService = null, this.googleAutocompleteService ? new Promise((t) => {
|
|
168
|
-
const s = {
|
|
169
|
-
input: e
|
|
170
|
-
};
|
|
171
|
-
this.gmCountryCode && (s.componentRestrictions = { country: this.gmCountryCode }), this.googleAutocompleteService.getPlacePredictions(s, (r) => {
|
|
172
|
-
const o = (r || []).map((i) => ({
|
|
173
|
-
id: i.place_id,
|
|
174
|
-
type: "Feature",
|
|
175
|
-
properties: {
|
|
176
|
-
type: "google_places",
|
|
177
|
-
placeId: i.place_id,
|
|
178
|
-
name: i.structured_formatting.main_text,
|
|
179
|
-
subtitle: i.structured_formatting.secondary_text || "",
|
|
180
|
-
floor: 0
|
|
181
|
-
}
|
|
182
|
-
}));
|
|
183
|
-
t(o);
|
|
184
|
-
});
|
|
185
|
-
}) : Promise.resolve([]);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Get Mapbox Places results.
|
|
189
|
-
*
|
|
190
|
-
* @param {string} query
|
|
191
|
-
* @return {Promise<any>}
|
|
192
|
-
*/
|
|
193
|
-
getMapboxSearchResults(e) {
|
|
194
|
-
if (this.mapbox && mapboxgl.accessToken) {
|
|
195
|
-
if (e)
|
|
196
|
-
return new Promise((t) => {
|
|
197
|
-
let s = `https://api.mapbox.com/search/searchbox/v1/suggest?q=${e}&session_token=${this.sessionToken}&access_token=${mapboxgl.accessToken}`;
|
|
198
|
-
this.userPosition && (s = s.concat(`&proximity=${this.userPosition}`)), fetch(s).then((r) => r.json()).then((r) => {
|
|
199
|
-
const o = r.suggestions.map((i) => ({
|
|
200
|
-
id: i.mapbox_id,
|
|
201
|
-
type: "Feature",
|
|
202
|
-
properties: {
|
|
203
|
-
type: "mapbox_places",
|
|
204
|
-
placeId: i.mapbox_id,
|
|
205
|
-
name: i.name,
|
|
206
|
-
subtitle: i.place_formatted || "",
|
|
207
|
-
floor: 0
|
|
208
|
-
}
|
|
209
|
-
}));
|
|
210
|
-
t(o);
|
|
211
|
-
}).catch(() => {
|
|
212
|
-
t([]);
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
} else
|
|
216
|
-
return Promise.resolve([]);
|
|
217
|
-
}
|
|
218
|
-
componentDidRender() {
|
|
219
|
-
if (this.dataAttributes)
|
|
220
|
-
for (const e in this.dataAttributes)
|
|
221
|
-
this.inputElement.setAttribute(e, this.dataAttributes[e]);
|
|
222
|
-
this.componentRendered.emit();
|
|
223
|
-
}
|
|
224
|
-
render() {
|
|
225
|
-
var e;
|
|
226
|
-
return p(M, null, p("input", { disabled: this.disabled, id: this.idAttribute ? this.idAttribute : null, type: "search", ref: (t) => this.inputElement = t, onInput: () => this.inputChanged(), placeholder: this.placeholder, autocomplete: "off" }), ((e = this.inputElement) === null || e === void 0 ? void 0 : e.value) && p("button", { type: "button", onClick: () => this.clear(), "aria-label": "Clear" }, p("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, p("path", { d: "M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" }))));
|
|
227
|
-
}
|
|
228
|
-
static get watchers() {
|
|
229
|
-
return {
|
|
230
|
-
value: ["valueChange"]
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
A([
|
|
235
|
-
D(500)
|
|
236
|
-
], b.prototype, "inputChanged", null);
|
|
237
|
-
b.style = E;
|
|
238
|
-
export {
|
|
239
|
-
b as mi_search
|
|
240
|
-
};
|