@mapsindoors/map-template 1.95.1 → 1.95.2
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/dist/{GoogleMapsMap-C5n6Bgtp.mjs → GoogleMapsMap-Dkn60-_e.mjs} +2 -2
- package/dist/{MapboxMap-UCqzt1AC.mjs → MapboxMap-B1oo7IUm.mjs} +2 -2
- package/dist/_commonjsHelpers-B85MJLTf.js +5 -0
- package/dist/app-globals-DQuL1Twl.js +3 -0
- package/dist/combo-box-item.entry.js +8 -10
- package/dist/icon-DT_sDkmK.js +11 -0
- package/dist/index-BZQHyS7V.js +1701 -0
- package/dist/loader.js +7 -14
- package/dist/mapsindoors-react.es.js +1 -1
- package/dist/mapsindoors-react.umd.js +175 -175
- package/dist/mapsindoors-webcomponent.es.js +2916 -2904
- package/dist/mi-card_2.entry.js +23 -18
- package/dist/mi-chip.entry.js +25 -16
- package/dist/mi-column.entry.js +47 -23
- package/dist/mi-combo-box.entry.js +412 -379
- package/dist/mi-components.js +15 -12
- package/dist/mi-data-table.entry.js +298 -278
- package/dist/mi-distance_2.entry.js +58 -56
- package/dist/mi-dropdown-item.entry.js +8 -10
- package/dist/mi-dropdown.entry.js +525 -481
- package/dist/mi-floor-selector.entry.js +183 -180
- package/dist/mi-keyboard.entry.js +207 -186
- package/dist/mi-list-item-category.entry.js +44 -41
- package/dist/mi-list-item-location.entry.js +168 -162
- package/dist/mi-list.entry.js +56 -48
- package/dist/mi-location-booking.entry.js +320 -295
- package/dist/mi-location-info.entry.js +61 -53
- package/dist/mi-map-googlemaps.entry.js +369 -324
- package/dist/mi-map-mapbox.entry.js +502 -439
- package/dist/mi-metric-card.entry.js +50 -37
- package/dist/mi-my-position.entry.js +2341 -874
- package/dist/mi-notification.entry.js +112 -102
- package/dist/mi-route-instructions-heading.entry.js +70 -65
- package/dist/mi-route-instructions-maneuver-legacy.entry.js +80 -76
- package/dist/mi-route-instructions-maneuver.entry.js +80 -76
- package/dist/mi-route-instructions-step-legacy.entry.js +296 -282
- package/dist/mi-route-instructions-step.entry.js +313 -292
- package/dist/mi-route-instructions.entry.js +167 -150
- package/dist/mi-scroll-buttons.entry.js +104 -98
- package/dist/mi-search.entry.js +366 -325
- package/dist/mi-share-sms.entry.js +82 -70
- package/dist/mi-step-switcher.entry.js +34 -25
- package/dist/mi-tab-panel.entry.js +18 -18
- package/dist/mi-tab.entry.js +5 -7
- package/dist/mi-tabs.entry.js +42 -40
- package/dist/mi-time.entry.js +49 -49
- package/dist/mi-variables-CDNvnTkH.js +5 -0
- package/dist/{reactcomponent-DQsjxRIN.mjs → reactcomponent-2Oa1vSiK.mjs} +8996 -8660
- package/dist/route-travel-mode.enum-BvqP1fpw.js +9 -0
- package/dist/sort-order.enum-jsLAbYWg.js +566 -0
- package/dist/{unit-system.enum-eaefb53e.js → unit-system.enum-BwPgAWqL.js} +2 -2
- package/dist/utils-DNHzysQ6.js +61 -0
- package/package.json +1 -1
- package/dist/_commonjsHelpers-ba3f0406.js +0 -21
- package/dist/icon-b8d01d6f.js +0 -24
- package/dist/index-7e9696f3.js +0 -1678
- package/dist/mi-variables-9a6c8d4d.js +0 -6
- package/dist/polyfills/core-js.js +0 -11
- package/dist/polyfills/css-shim.js +0 -1
- package/dist/polyfills/dom.js +0 -79
- package/dist/polyfills/es5-html-element.js +0 -1
- package/dist/polyfills/index.js +0 -34
- package/dist/polyfills/system.js +0 -6
- package/dist/route-travel-mode.enum-7f4ce9c7.js +0 -9
- package/dist/sort-order.enum-64ce8998.js +0 -552
- package/dist/utils-ae714467.js +0 -61
|
@@ -1,127 +1,137 @@
|
|
|
1
|
-
import { r as registerInstance, f as forceUpdate, h, H as Host, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, f as forceUpdate, h, H as Host, g as getElement } from './index-BZQHyS7V.js';
|
|
2
2
|
|
|
3
3
|
var NotificationPosition;
|
|
4
4
|
(function (NotificationPosition) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
NotificationPosition["TOP_LEFT"] = "top-left";
|
|
6
|
+
NotificationPosition["TOP_CENTER"] = "top-center";
|
|
7
|
+
NotificationPosition["TOP_RIGHT"] = "top-right";
|
|
8
|
+
NotificationPosition["BOTTOM_CENTER"] = "bottom-center";
|
|
9
|
+
NotificationPosition["BOTTOM_LEFT"] = "bottom-left";
|
|
10
|
+
NotificationPosition["BOTTOM_RIGHT"] = "bottom-right";
|
|
11
11
|
})(NotificationPosition || (NotificationPosition = {}));
|
|
12
12
|
|
|
13
13
|
var NotificationType;
|
|
14
14
|
(function (NotificationType) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
NotificationType["Error"] = "error";
|
|
16
|
+
NotificationType["Info"] = "info";
|
|
17
|
+
NotificationType["Success"] = "success";
|
|
18
|
+
NotificationType["Warning"] = "warning";
|
|
19
|
+
NotificationType["None"] = "none";
|
|
20
20
|
})(NotificationType || (NotificationType = {}));
|
|
21
21
|
|
|
22
|
-
const notificationCss =
|
|
22
|
+
const notificationCss = () => `:host{padding:16px;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";position:fixed;z-index:1000;display:flex;flex-direction:column}:host(.top-left){top:0;left:0}:host(.top-center){top:0;align-items:center;left:50%;transform:translate(-50%, 0)}:host(.top-right){top:0;right:0;align-items:flex-end}:host(.bottom-left){bottom:0;left:0}:host(.bottom-center){bottom:0;align-items:center;left:50%;transform:translate(-50%, 0)}:host(.bottom-right){bottom:0;right:0;align-items:flex-end}.notification{margin-top:16px;display:flex;flex-direction:row;box-shadow:0px 4px 4px rgba(0, 0, 0, 0.16), 0px 2px 2px rgba(0, 0, 0, 0.18), 0px 1px 1px rgba(0, 0, 0, 0.2);border-radius:2px;background-color:#fcfcfc;overflow:hidden}.notification .icon{width:48px;display:flex;justify-content:center;align-items:center}.notification .icon-type--error{background-color:#ef4444}.notification .icon-type--success{background-color:#22c55e}.notification .icon-type--warning{background-color:#f59e0b}.notification .icon-type--info{background-color:#6b7280}.notification .label{padding-left:16px;flex:1;font-size:0.875rem}.notification .btn{padding-left:24px;padding-right:16px;display:flex;align-items:center;border:none;background-color:#fcfcfc}.notification .btn:focus{outline:none;box-shadow:none}`;
|
|
23
23
|
|
|
24
24
|
const Notification = class {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
constructor(hostRef) {
|
|
26
|
+
registerInstance(this, hostRef);
|
|
27
|
+
/**
|
|
28
|
+
* Where the notifications should be positioned.
|
|
29
|
+
*
|
|
30
|
+
* @type {NotificationPosition}
|
|
31
|
+
*/
|
|
32
|
+
this.position = NotificationPosition.BOTTOM_RIGHT;
|
|
33
|
+
/**
|
|
34
|
+
* Time the notification should be visible. Default value is 3.
|
|
35
|
+
*
|
|
36
|
+
* @type {number} - Duration in seconds.
|
|
37
|
+
*/
|
|
38
|
+
this.duration = 3;
|
|
39
|
+
/**
|
|
40
|
+
* List of currently displayed notifications.
|
|
41
|
+
*
|
|
42
|
+
* @type {NotificationMessage[]}
|
|
43
|
+
*/
|
|
44
|
+
this.notifications = [];
|
|
45
|
+
/**
|
|
46
|
+
* Used for setting a unique identifier for each notification.
|
|
47
|
+
*
|
|
48
|
+
* @type {number}
|
|
49
|
+
*/
|
|
50
|
+
this.notificationId = 0;
|
|
51
|
+
}
|
|
27
52
|
/**
|
|
28
|
-
*
|
|
53
|
+
* Show a notification.
|
|
29
54
|
*
|
|
30
|
-
* @
|
|
55
|
+
* @param {string} message - Message to display.
|
|
56
|
+
* @param {string} [type='none'] - Type of notification. Available types: 'info', 'warning', 'success', 'error' and 'none'.
|
|
57
|
+
* @param {boolean} [sticky=false] - Set message as sticky to prevent it from disappearing.
|
|
58
|
+
* @returns {Promise<void>}
|
|
31
59
|
*/
|
|
32
|
-
|
|
60
|
+
async push(message, type = 'none', sticky = false) {
|
|
61
|
+
if (typeof message !== 'string' || message.length < 1) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
// Check validity of type
|
|
65
|
+
const typeExist = Object.values(NotificationType)
|
|
66
|
+
.some((notificationType) => notificationType === type);
|
|
67
|
+
if (!typeExist) {
|
|
68
|
+
// eslint-disable-next-line no-console
|
|
69
|
+
console.error('Invalid notification type');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const notificationMessage = {
|
|
73
|
+
id: this.notificationId,
|
|
74
|
+
message: message,
|
|
75
|
+
sticky: sticky,
|
|
76
|
+
type: type,
|
|
77
|
+
};
|
|
78
|
+
if (sticky === false) {
|
|
79
|
+
notificationMessage.timer = window.setTimeout(() => this.dismiss(notificationMessage.id), (this.duration * 1000));
|
|
80
|
+
}
|
|
81
|
+
this.notificationId++;
|
|
82
|
+
this.notifications.push(notificationMessage);
|
|
83
|
+
forceUpdate(this.hostElement);
|
|
84
|
+
}
|
|
33
85
|
/**
|
|
34
|
-
*
|
|
86
|
+
* Clear all notifications.
|
|
35
87
|
*
|
|
36
|
-
* @
|
|
88
|
+
* @returns {Promise<void>}
|
|
37
89
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Show a notification.
|
|
44
|
-
*
|
|
45
|
-
* @param {string} message - Message to display.
|
|
46
|
-
* @param {string} [type='none'] - Type of notification. Available types: 'info', 'warning', 'success', 'error' and 'none'.
|
|
47
|
-
* @param {boolean} [sticky=false] - Set message as sticky to prevent it from disappearing.
|
|
48
|
-
* @returns {Promise<void>}
|
|
49
|
-
*/
|
|
50
|
-
async push(message, type = 'none', sticky = false) {
|
|
51
|
-
if (typeof message !== 'string' || message.length < 1) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
// Check validity of type
|
|
55
|
-
const typeExist = Object.values(NotificationType)
|
|
56
|
-
.some((notificationType) => notificationType === type);
|
|
57
|
-
if (!typeExist) {
|
|
58
|
-
// eslint-disable-next-line no-console
|
|
59
|
-
console.error('Invalid notification type');
|
|
60
|
-
return;
|
|
90
|
+
async clearAll() {
|
|
91
|
+
this.notifications = [];
|
|
92
|
+
forceUpdate(this.hostElement);
|
|
61
93
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Dismiss a single notification.
|
|
96
|
+
*
|
|
97
|
+
* @param {number} id
|
|
98
|
+
*/
|
|
99
|
+
dismiss(id) {
|
|
100
|
+
this.notifications = this.notifications.filter((notification) => notification.id !== id);
|
|
101
|
+
forceUpdate(this.hostElement);
|
|
70
102
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
forceUpdate(this.hostElement);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Clear all notifications.
|
|
77
|
-
*
|
|
78
|
-
* @returns {Promise<void>}
|
|
79
|
-
*/
|
|
80
|
-
async clearAll() {
|
|
81
|
-
this.notifications = [];
|
|
82
|
-
forceUpdate(this.hostElement);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Dismiss a single notification.
|
|
86
|
-
*
|
|
87
|
-
* @param {number} id
|
|
88
|
-
*/
|
|
89
|
-
dismiss(id) {
|
|
90
|
-
this.notifications = this.notifications.filter((notification) => notification.id !== id);
|
|
91
|
-
forceUpdate(this.hostElement);
|
|
92
|
-
}
|
|
93
|
-
render() {
|
|
94
|
-
return (h(Host, { class: this.position }, this.notifications.map((notification) => this.renderNotification(notification))));
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Get JSX for notification.
|
|
98
|
-
*
|
|
99
|
-
* @param {NotificationMessage} { id, message }
|
|
100
|
-
* @returns {JSX.Element}
|
|
101
|
-
*/
|
|
102
|
-
renderNotification({ id, message, type }) {
|
|
103
|
-
return (h("div", { class: "notification", role: "alert" }, type && type !== 'none' ? this.renderIcon(type) : null, h("p", { class: "label" }, message), h("button", { type: "button", "aria-label": "Dismiss notification", class: "btn", onClick: () => this.dismiss(id) }, h("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-hidden": "true", focusable: "false" }, h("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", fill: "#1E2025" })))));
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Get JSX for type-icon.
|
|
107
|
-
*
|
|
108
|
-
* @param {NotificationType} type
|
|
109
|
-
* @returns {JSX.Element}
|
|
110
|
-
*/
|
|
111
|
-
renderIcon(type) {
|
|
112
|
-
if (type === NotificationType.Error) {
|
|
113
|
-
return (h("div", { class: "icon icon-type--error" }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-hidden": "true", focusable: "false" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM9 15V13H11V15H9ZM9 5V11H11V5H9Z", fill: "#FCFCFC" }))));
|
|
103
|
+
render() {
|
|
104
|
+
return (h(Host, { key: 'df85a60b1ee91303adcae496907fb42839842de1', class: this.position }, this.notifications.map((notification) => this.renderNotification(notification))));
|
|
114
105
|
}
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Get JSX for notification.
|
|
108
|
+
*
|
|
109
|
+
* @param {NotificationMessage} { id, message }
|
|
110
|
+
* @returns {JSX.Element}
|
|
111
|
+
*/
|
|
112
|
+
renderNotification({ id, message, type }) {
|
|
113
|
+
return (h("div", { class: "notification", role: "alert" }, type && type !== 'none' ? this.renderIcon(type) : null, h("p", { class: "label" }, message), h("button", { type: "button", "aria-label": "Dismiss notification", class: "btn", onClick: () => this.dismiss(id) }, h("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-hidden": "true", focusable: "false" }, h("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", fill: "#1E2025" })))));
|
|
117
114
|
}
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Get JSX for type-icon.
|
|
117
|
+
*
|
|
118
|
+
* @param {NotificationType} type
|
|
119
|
+
* @returns {JSX.Element}
|
|
120
|
+
*/
|
|
121
|
+
renderIcon(type) {
|
|
122
|
+
if (type === NotificationType.Error) {
|
|
123
|
+
return (h("div", { class: "icon icon-type--error" }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-hidden": "true", focusable: "false" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM9 15V13H11V15H9ZM9 5V11H11V5H9Z", fill: "#FCFCFC" }))));
|
|
124
|
+
}
|
|
125
|
+
else if (type === NotificationType.Success) {
|
|
126
|
+
return (h("div", { class: "icon icon-type--success" }, h("svg", { width: "18", height: "14", viewBox: "0 0 18 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-hidden": "true", focusable: "false" }, h("path", { d: "M5.99997 11.17L1.82997 7L0.409973 8.41L5.99997 14L18 2L16.59 0.59L5.99997 11.17Z", fill: "#FCFCFC" }))));
|
|
127
|
+
}
|
|
128
|
+
else if (type === NotificationType.Warning) {
|
|
129
|
+
return (h("div", { class: "icon icon-type--warning" }, h("svg", { width: "22", height: "19", viewBox: "0 0 22 19", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-hidden": "true", focusable: "false" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M22 19L11 0L0 19H22ZM10 16V14H12V16H10ZM10 12H12V8H10V12Z", fill: "#FCFCFC" }))));
|
|
130
|
+
}
|
|
131
|
+
return (h("div", { class: "icon icon-type--info" }, h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-hidden": "true", focusable: "false" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM9 15V9H11V15H9ZM9 5V7H11V5H9Z", fill: "#FCFCFC" }))));
|
|
120
132
|
}
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
get hostElement() { return getElement(this); }
|
|
133
|
+
get hostElement() { return getElement(this); }
|
|
124
134
|
};
|
|
125
|
-
Notification.style = notificationCss;
|
|
135
|
+
Notification.style = notificationCss();
|
|
126
136
|
|
|
127
137
|
export { Notification as mi_notification };
|
|
@@ -1,73 +1,78 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-
|
|
2
|
-
import { R as RouteTravelMode } from './route-travel-mode.enum-
|
|
3
|
-
import { U as UnitSystem } from './unit-system.enum-
|
|
1
|
+
import { r as registerInstance, h } from './index-BZQHyS7V.js';
|
|
2
|
+
import { R as RouteTravelMode } from './route-travel-mode.enum-BvqP1fpw.js';
|
|
3
|
+
import { U as UnitSystem } from './unit-system.enum-BwPgAWqL.js';
|
|
4
4
|
|
|
5
|
-
const routeInstructionsHeadingCss =
|
|
5
|
+
const routeInstructionsHeadingCss = () => `.directions{border-bottom:1px solid #d1d5db;color:#1c1917;font-size:1rem;font-weight:400;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"}.directions-way-points{padding-top:24px;padding-bottom:24px;padding-left:16px;padding-right:16px;border-bottom:1px solid #f3f4f6}.directions-way-points span{display:block}.directions-way-points span:first-child{font-size:1.25rem;font-weight:500;line-height:1.5rem}.directions-way-points span:last-child{color:#6b7280}.directions-way-points span:last-child a{color:#3b82f6;text-decoration:none}.directions-details{padding:16px;display:flex;flex-direction:row;justify-content:space-between}.directions-details-numbers mi-time{font-weight:500}.directions-details-numbers-distance{color:#6b7280;font-size:0.875rem;font-weight:400;text-transform:lowercase}.directions-details-travel-mode-selector{display:flex;align-items:center;color:#3b82f6;text-decoration:none}.directions-details-travel-mode-selector mi-icon{width:24px;height:24px;margin-left:8px;background-color:#3b82f6}`;
|
|
6
6
|
|
|
7
7
|
const RouteInstructionsHeading = class {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*/
|
|
34
|
-
getTravelModeString() {
|
|
35
|
-
switch (this.travelMode) {
|
|
36
|
-
case RouteTravelMode.Walking: return this.translations.walk;
|
|
37
|
-
case RouteTravelMode.Driving: return this.translations.car;
|
|
38
|
-
case RouteTravelMode.Transit: return this.translations.transit;
|
|
39
|
-
case RouteTravelMode.Bicycling: return this.translations.bike;
|
|
40
|
-
default: return this.translations.walk;
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
registerInstance(this, hostRef);
|
|
10
|
+
/**
|
|
11
|
+
* Set preferred travel mode. Defaults to "walking".
|
|
12
|
+
*
|
|
13
|
+
* @type {RouteTravelMode} 'walking', 'bicycling', 'transit', 'driving'.
|
|
14
|
+
*/
|
|
15
|
+
this.travelMode = RouteTravelMode.Walking;
|
|
16
|
+
/**
|
|
17
|
+
* Set 'imperial' or 'metric' as default unit system.
|
|
18
|
+
* @type {UnitSystem} 'imperial' or 'metric'
|
|
19
|
+
*/
|
|
20
|
+
this.unit = UnitSystem.Metric;
|
|
21
|
+
this.translations = {
|
|
22
|
+
from: 'From',
|
|
23
|
+
to: 'To',
|
|
24
|
+
avoidStairs: 'Avoid stairs',
|
|
25
|
+
walk: 'Walk',
|
|
26
|
+
walking: 'Walking',
|
|
27
|
+
bike: 'Bike',
|
|
28
|
+
bicycling: 'Bicycling',
|
|
29
|
+
transit: 'Transit',
|
|
30
|
+
car: 'Car',
|
|
31
|
+
driving: 'Driving'
|
|
32
|
+
};
|
|
41
33
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Get travel mode as a string. Eg. "Walking", "Driving", "Transit", "Bicycling".
|
|
36
|
+
*
|
|
37
|
+
* @returns {string}
|
|
38
|
+
*/
|
|
39
|
+
getTravelModeString() {
|
|
40
|
+
switch (this.travelMode) {
|
|
41
|
+
case RouteTravelMode.Walking: return this.translations.walk;
|
|
42
|
+
case RouteTravelMode.Driving: return this.translations.car;
|
|
43
|
+
case RouteTravelMode.Transit: return this.translations.transit;
|
|
44
|
+
case RouteTravelMode.Bicycling: return this.translations.bike;
|
|
45
|
+
default: return this.translations.walk;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get icon name for travel mode.
|
|
50
|
+
*
|
|
51
|
+
* @returns {string}
|
|
52
|
+
*/
|
|
53
|
+
getTravelModeIconName() {
|
|
54
|
+
switch (this.travelMode) {
|
|
55
|
+
case RouteTravelMode.Walking: return 'walk';
|
|
56
|
+
case RouteTravelMode.Driving: return 'car';
|
|
57
|
+
case RouteTravelMode.Transit: return 'transit';
|
|
58
|
+
case RouteTravelMode.Bicycling: return 'bike';
|
|
59
|
+
default: return 'walk';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return (h("div", { key: '5d9148321941db7361dacfdf718c53a2da67db30', class: "directions" }, this.originName && this.destinationName ? this.renderWayPoints() : null, h("div", { key: 'bca5a290ac376323d54f7dabfcb6dad615e1a07c', class: "directions-details" }, this.totalTravelTime >= 0 || this.totalWalkingDistance >= 0 ?
|
|
64
|
+
h("div", { class: "directions-details-numbers" }, this.totalTravelTime >= 0 ? h("div", null, h("mi-time", { seconds: this.totalTravelTime })) : null, this.totalWalkingDistance >= 0 ? h("div", { class: "directions-details-numbers-distance" }, h("mi-distance", { meters: this.totalWalkingDistance }), " ", this.translations.walking.toLowerCase()) : null) :
|
|
65
|
+
null, h("a", { key: '5586c46b4ba42d150f34437ee8153239d9bfdf1f', href: "#", class: "directions-details-travel-mode-selector" }, this.getTravelModeString(), h("mi-icon", { key: 'ced88ceba183c370aa5e1e331596b0d5003d836c', "icon-name": this.getTravelModeIconName() })))));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Render direction way points.
|
|
69
|
+
*
|
|
70
|
+
* @returns {JSX.Element}
|
|
71
|
+
*/
|
|
72
|
+
renderWayPoints() {
|
|
73
|
+
return (h("div", { class: "directions-way-points" }, h("span", null, this.translations.to, " ", this.destinationName), h("span", null, this.translations.from, " ", h("a", { href: "#" }, this.originName))));
|
|
55
74
|
}
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
return (h("div", { class: "directions" }, this.originName && this.destinationName ? this.renderWayPoints() : null, h("div", { class: "directions-details" }, this.totalTravelTime >= 0 || this.totalWalkingDistance >= 0 ?
|
|
59
|
-
h("div", { class: "directions-details-numbers" }, this.totalTravelTime >= 0 ? h("div", null, h("mi-time", { seconds: this.totalTravelTime })) : null, this.totalWalkingDistance >= 0 ? h("div", { class: "directions-details-numbers-distance" }, h("mi-distance", { meters: this.totalWalkingDistance }), " ", this.translations.walking.toLowerCase()) : null) :
|
|
60
|
-
null, h("a", { href: "#", class: "directions-details-travel-mode-selector" }, this.getTravelModeString(), h("mi-icon", { "icon-name": this.getTravelModeIconName() })))));
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Render direction way points.
|
|
64
|
-
*
|
|
65
|
-
* @returns {JSX.Element}
|
|
66
|
-
*/
|
|
67
|
-
renderWayPoints() {
|
|
68
|
-
return (h("div", { class: "directions-way-points" }, h("span", null, this.translations.to, " ", this.destinationName), h("span", null, this.translations.from, " ", h("a", { href: "#" }, this.originName))));
|
|
69
|
-
}
|
|
70
75
|
};
|
|
71
|
-
RouteInstructionsHeading.style = routeInstructionsHeadingCss;
|
|
76
|
+
RouteInstructionsHeading.style = routeInstructionsHeadingCss();
|
|
72
77
|
|
|
73
78
|
export { RouteInstructionsHeading as mi_route_instructions_heading };
|
|
@@ -1,82 +1,86 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-
|
|
2
|
-
import { U as UnitSystem } from './unit-system.enum-
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-BZQHyS7V.js';
|
|
2
|
+
import { U as UnitSystem } from './unit-system.enum-BwPgAWqL.js';
|
|
3
3
|
|
|
4
|
-
const routeInstructionsManeuverLegacyCss =
|
|
4
|
+
const routeInstructionsManeuverLegacyCss = () => `:host{display:flex;padding-top:12px;padding-bottom:12px;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"}.icon{width:48px;display:flex;justify-content:center}.icon mi-icon{width:24px;height:24px}.description{display:flex;flex-direction:column;flex:1}.description p{margin:0;padding-right:16px;font-size:0.875rem;word-break:break-all}.description__distance{display:flex;align-items:center}.description__distance mi-distance{font-size:0.75rem;padding-right:12px}.description__distance-border{flex:1;width:100%;height:0;border-bottom:1px solid #e5e7eb}`;
|
|
5
5
|
|
|
6
6
|
const RouteInstructionsManeuverLegacy = class {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
/**
|
|
10
|
+
* Set imperial or metric as default unit system.
|
|
11
|
+
* @type {UnitSystem} 'imperial' or 'metric'
|
|
12
|
+
*/
|
|
13
|
+
this.unit = UnitSystem.Metric;
|
|
14
|
+
}
|
|
15
|
+
parseManeuverProp() {
|
|
16
|
+
this.maneuverData = JSON.parse(this.maneuver);
|
|
17
|
+
}
|
|
18
|
+
parseTranslationsProp() {
|
|
19
|
+
this.translationsData = JSON.parse(this.translations);
|
|
20
|
+
}
|
|
21
|
+
componentWillLoad() {
|
|
22
|
+
this.parseManeuverProp();
|
|
23
|
+
this.parseTranslationsProp();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get maneuver name.
|
|
27
|
+
*
|
|
28
|
+
* @returns {string}
|
|
29
|
+
*/
|
|
30
|
+
getManeuverName(maneuver) {
|
|
31
|
+
if (maneuver.includes('straight'))
|
|
32
|
+
return 'straight';
|
|
33
|
+
if (maneuver.includes('sharp right'))
|
|
34
|
+
return 'sharp-right';
|
|
35
|
+
if (maneuver.includes('sharp left'))
|
|
36
|
+
return 'sharp-left';
|
|
37
|
+
if (maneuver.includes('slight right'))
|
|
38
|
+
return 'slight-right';
|
|
39
|
+
if (maneuver.includes('slight left'))
|
|
40
|
+
return 'slight-left';
|
|
41
|
+
if (maneuver.includes('right'))
|
|
42
|
+
return 'right';
|
|
43
|
+
if (maneuver.includes('left'))
|
|
44
|
+
return 'left';
|
|
45
|
+
if (maneuver.includes('uturn'))
|
|
46
|
+
return 'u-turn';
|
|
47
|
+
if (maneuver.includes('depart'))
|
|
48
|
+
return 'straight';
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
return (this.maneuverData && this.translationsData ? this.renderManeuver() : null);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Render step.
|
|
55
|
+
*
|
|
56
|
+
* @returns {JSX.Element}
|
|
57
|
+
*/
|
|
58
|
+
renderManeuver() {
|
|
59
|
+
const maneuverStrings = {
|
|
60
|
+
'straight': this.translationsData.continueStraightAhead, // 'Continue straight ahead',
|
|
61
|
+
'left': `${this.translationsData.goLeft} ${this.translationsData.andContinue}`, // 'Go left and continue',
|
|
62
|
+
'sharp-left': `${this.translationsData.goSharpLeft} ${this.translationsData.andContinue}`, // 'Go sharp left and continue',
|
|
63
|
+
'slight-left': `${this.translationsData.goSlightLeft} ${this.translationsData.andContinue}`, // 'Go slight left and continue',
|
|
64
|
+
'right': `${this.translationsData.goRight} ${this.translationsData.andContinue}`, // 'Go right and continue',
|
|
65
|
+
'sharp-right': `${this.translationsData.goSharpRight} ${this.translationsData.andContinue}`, // 'Go sharp right and continue',
|
|
66
|
+
'slight-right': `${this.translationsData.goSlightRight} ${this.translationsData.andContinue}`, // 'Go slight right and continue',
|
|
67
|
+
'u-turn': `${this.translationsData.turnAround} ${this.translationsData.andContinue}`, // 'Turn around and continue'
|
|
68
|
+
};
|
|
69
|
+
const maneuver = this.getManeuverName(this.maneuverData.maneuver.toLowerCase());
|
|
70
|
+
const iconName = `arrow-${maneuver}`;
|
|
71
|
+
// Check if the instructions property has a value otherwise fallback to maneuver property
|
|
72
|
+
const translatedManeuver = this.maneuverData.instructions ? this.maneuverData.instructions : maneuverStrings[maneuver];
|
|
73
|
+
return (h(Host, null, h("div", { class: "icon" }, maneuver ? h("mi-icon", { part: "maneuver-icon", "icon-name": iconName }) : null), h("div", { class: "description" }, h("p", { part: "maneuver-description" }, translatedManeuver), h("div", { class: "description__distance" }, h("mi-distance", { part: "maneuver-description-distance", meters: this.maneuverData.distance.value, unit: this.unit }), h("span", { part: "maneuver-description-distance-border", class: "description__distance-border" })))));
|
|
74
|
+
}
|
|
75
|
+
static get watchers() { return {
|
|
76
|
+
"maneuver": [{
|
|
77
|
+
"parseManeuverProp": 0
|
|
78
|
+
}],
|
|
79
|
+
"translations": [{
|
|
80
|
+
"parseTranslationsProp": 0
|
|
81
|
+
}]
|
|
82
|
+
}; }
|
|
79
83
|
};
|
|
80
|
-
RouteInstructionsManeuverLegacy.style = routeInstructionsManeuverLegacyCss;
|
|
84
|
+
RouteInstructionsManeuverLegacy.style = routeInstructionsManeuverLegacyCss();
|
|
81
85
|
|
|
82
86
|
export { RouteInstructionsManeuverLegacy as mi_route_instructions_maneuver_legacy };
|