@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,28 @@
|
|
|
1
|
+
import { r as e, h as i, H as o } from "./reactcomponent-2f9f051f.mjs";
|
|
2
|
+
import { a as s, f as n } from "./utils-ae714467-b07fc3be.mjs";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
const r = ':host{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";flex-shrink:0;flex-grow:1}:host mi-card{position:relative;overflow:hidden;min-width:312px}:host mi-card .content h1{display:inline-flex;cursor:default;align-items:center;text-transform:uppercase;white-space:nowrap;margin:0;font-size:1rem;font-weight:600;color:#6b7280;margin-bottom:8px}:host mi-card .content h1 svg{fill:#9ca3af;width:16px;height:16px;margin-left:8px}:host mi-card .content section{position:relative}:host mi-card .content section p{margin:0;font-size:3rem;line-height:3rem;font-weight:500;color:#1c1917}:host mi-card .content section p.error{font-size:1rem;font-weight:500;color:#6b7280}:host mi-card .content section p.hidden{visibility:hidden}:host mi-card .content section p.tool-tip{box-sizing:border-box;visibility:hidden;overflow:hidden;position:absolute;top:0px;right:0px;bottom:0px;left:0px;opacity:0;transition:all 100ms;z-index:700;background-color:#ffffff;font-size:0.875rem;font-weight:400;line-height:1rem;margin:0}:host mi-card .content section p.tool-tip.visible{opacity:1;visibility:visible}:host mi-card .content section mi-spinner{display:inline-block;vertical-align:middle;width:100%}', l = class {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
e(this, t), this.showToolTip = !1, this.label = "", this.value = "", this.tip = void 0, this.spinner = !1, this.error = void 0;
|
|
8
|
+
}
|
|
9
|
+
render() {
|
|
10
|
+
return i(o, null, i("mi-card", null, this.renderContent()));
|
|
11
|
+
}
|
|
12
|
+
renderToolTip() {
|
|
13
|
+
if (this.tip > "")
|
|
14
|
+
return i("p", { class: { "tool-tip": !0, visible: this.tip && this.showToolTip } }, this.tip);
|
|
15
|
+
}
|
|
16
|
+
getInfoIcon() {
|
|
17
|
+
if (this.tip > "")
|
|
18
|
+
return i("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24" }, i("path", { d: "M0 0h24v24H0V0z", fill: "none" }), i("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92c-.5.51-.86.97-1.04 1.69-.08.32-.13.68-.13 1.14h-2v-.5c0-.46.08-.9.22-1.31.2-.58.53-1.1.95-1.52l1.24-1.26c.46-.44.68-1.1.55-1.8-.13-.72-.69-1.33-1.39-1.53-1.11-.31-2.14.32-2.47 1.27-.12.37-.43.65-.82.65h-.3C8.4 9 8 8.44 8.16 7.88c.43-1.47 1.68-2.59 3.23-2.83 1.52-.24 2.97.55 3.87 1.8 1.18 1.63.83 3.38-.19 4.4z" }));
|
|
19
|
+
}
|
|
20
|
+
renderContent() {
|
|
21
|
+
let t;
|
|
22
|
+
return this.value ? t = s(this.value) ? n(this.value) : this.value : this.error ? t = this.error : this.spinner ? t = i("mi-spinner", null) : t = " ", i("div", { class: "content" }, i("h1", { onMouseOver: () => this.showToolTip = !0, onMouseOut: () => this.showToolTip = !1 }, this.label, " ", this.getInfoIcon()), i("section", null, this.renderToolTip(), i("p", { class: { error: !!this.error, hidden: this.tip && this.showToolTip } }, t)));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
l.style = r;
|
|
26
|
+
export {
|
|
27
|
+
l as mi_metric_card
|
|
28
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { r as e, h as i, H as o } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
+
import { a as s, f as n } from "./utils-ae714467-b07fc3be.mjs";
|
|
3
|
+
const r = ':host{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";flex-shrink:0;flex-grow:1}:host mi-card{position:relative;overflow:hidden;min-width:312px}:host mi-card .content h1{display:inline-flex;cursor:default;align-items:center;text-transform:uppercase;white-space:nowrap;margin:0;font-size:1rem;font-weight:600;color:#6b7280;margin-bottom:8px}:host mi-card .content h1 svg{fill:#9ca3af;width:16px;height:16px;margin-left:8px}:host mi-card .content section{position:relative}:host mi-card .content section p{margin:0;font-size:3rem;line-height:3rem;font-weight:500;color:#1c1917}:host mi-card .content section p.error{font-size:1rem;font-weight:500;color:#6b7280}:host mi-card .content section p.hidden{visibility:hidden}:host mi-card .content section p.tool-tip{box-sizing:border-box;visibility:hidden;overflow:hidden;position:absolute;top:0px;right:0px;bottom:0px;left:0px;opacity:0;transition:all 100ms;z-index:700;background-color:#ffffff;font-size:0.875rem;font-weight:400;line-height:1rem;margin:0}:host mi-card .content section p.tool-tip.visible{opacity:1;visibility:visible}:host mi-card .content section mi-spinner{display:inline-block;vertical-align:middle;width:100%}', l = class {
|
|
4
|
+
constructor(t) {
|
|
5
|
+
e(this, t), this.showToolTip = !1, this.label = "", this.value = "", this.tip = void 0, this.spinner = !1, this.error = void 0;
|
|
6
|
+
}
|
|
7
|
+
render() {
|
|
8
|
+
return i(o, null, i("mi-card", null, this.renderContent()));
|
|
9
|
+
}
|
|
10
|
+
renderToolTip() {
|
|
11
|
+
if (this.tip > "")
|
|
12
|
+
return i("p", { class: { "tool-tip": !0, visible: this.tip && this.showToolTip } }, this.tip);
|
|
13
|
+
}
|
|
14
|
+
getInfoIcon() {
|
|
15
|
+
if (this.tip > "")
|
|
16
|
+
return i("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24" }, i("path", { d: "M0 0h24v24H0V0z", fill: "none" }), i("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92c-.5.51-.86.97-1.04 1.69-.08.32-.13.68-.13 1.14h-2v-.5c0-.46.08-.9.22-1.31.2-.58.53-1.1.95-1.52l1.24-1.26c.46-.44.68-1.1.55-1.8-.13-.72-.69-1.33-1.39-1.53-1.11-.31-2.14.32-2.47 1.27-.12.37-.43.65-.82.65h-.3C8.4 9 8 8.44 8.16 7.88c.43-1.47 1.68-2.59 3.23-2.83 1.52-.24 2.97.55 3.87 1.8 1.18 1.63.83 3.38-.19 4.4z" }));
|
|
17
|
+
}
|
|
18
|
+
renderContent() {
|
|
19
|
+
let t;
|
|
20
|
+
return this.value ? t = s(this.value) ? n(this.value) : this.value : this.error ? t = this.error : this.spinner ? t = i("mi-spinner", null) : t = " ", i("div", { class: "content" }, i("h1", { onMouseOver: () => this.showToolTip = !0, onMouseOut: () => this.showToolTip = !1 }, this.label, " ", this.getInfoIcon()), i("section", null, this.renderToolTip(), i("p", { class: { error: !!this.error, hidden: this.tip && this.showToolTip } }, t)));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
l.style = r;
|
|
24
|
+
export {
|
|
25
|
+
l as mi_metric_card
|
|
26
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { r as c, f as r, h as i, H as f, g as d } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
+
var l;
|
|
3
|
+
(function(t) {
|
|
4
|
+
t.TOP_LEFT = "top-left", t.TOP_CENTER = "top-center", t.TOP_RIGHT = "top-right", t.BOTTOM_CENTER = "bottom-center", t.BOTTOM_LEFT = "bottom-left", t.BOTTOM_RIGHT = "bottom-right";
|
|
5
|
+
})(l || (l = {}));
|
|
6
|
+
var n;
|
|
7
|
+
(function(t) {
|
|
8
|
+
t.Error = "error", t.Info = "info", t.Success = "success", t.Warning = "warning", t.None = "none";
|
|
9
|
+
})(n || (n = {}));
|
|
10
|
+
const h = ':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}', g = class {
|
|
11
|
+
constructor(t) {
|
|
12
|
+
c(this, t), this.notifications = [], this.notificationId = 0, this.position = l.BOTTOM_RIGHT, this.duration = 3;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Show a notification.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} message - Message to display.
|
|
18
|
+
* @param {string} [type='none'] - Type of notification. Available types: 'info', 'warning', 'success', 'error' and 'none'.
|
|
19
|
+
* @param {boolean} [sticky=false] - Set message as sticky to prevent it from disappearing.
|
|
20
|
+
* @returns {Promise<void>}
|
|
21
|
+
*/
|
|
22
|
+
async push(t, e = "none", o = !1) {
|
|
23
|
+
if (typeof t != "string" || t.length < 1)
|
|
24
|
+
return;
|
|
25
|
+
if (!Object.values(n).some((a) => a === e)) {
|
|
26
|
+
console.error("Invalid notification type");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const s = {
|
|
30
|
+
id: this.notificationId,
|
|
31
|
+
message: t,
|
|
32
|
+
sticky: o,
|
|
33
|
+
type: e
|
|
34
|
+
};
|
|
35
|
+
o === !1 && (s.timer = window.setTimeout(() => this.dismiss(s.id), this.duration * 1e3)), this.notificationId++, this.notifications.push(s), r(this.hostElement);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Clear all notifications.
|
|
39
|
+
*
|
|
40
|
+
* @returns {Promise<void>}
|
|
41
|
+
*/
|
|
42
|
+
async clearAll() {
|
|
43
|
+
this.notifications = [], r(this.hostElement);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Dismiss a single notification.
|
|
47
|
+
*
|
|
48
|
+
* @param {number} id
|
|
49
|
+
*/
|
|
50
|
+
dismiss(t) {
|
|
51
|
+
this.notifications = this.notifications.filter((e) => e.id !== t), r(this.hostElement);
|
|
52
|
+
}
|
|
53
|
+
render() {
|
|
54
|
+
return i(f, { class: this.position }, this.notifications.map((t) => this.renderNotification(t)));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get JSX for notification.
|
|
58
|
+
*
|
|
59
|
+
* @param {NotificationMessage} { id, message }
|
|
60
|
+
* @returns {JSX.Element}
|
|
61
|
+
*/
|
|
62
|
+
renderNotification({ id: t, message: e, type: o }) {
|
|
63
|
+
return i("div", { class: "notification", role: "alert" }, o && o !== "none" ? this.renderIcon(o) : null, i("p", { class: "label" }, e), i("button", { type: "button", "aria-label": "Dismiss notification", class: "btn", onClick: () => this.dismiss(t) }, i("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" }, i("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" }))));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get JSX for type-icon.
|
|
67
|
+
*
|
|
68
|
+
* @param {NotificationType} type
|
|
69
|
+
* @returns {JSX.Element}
|
|
70
|
+
*/
|
|
71
|
+
renderIcon(t) {
|
|
72
|
+
return t === n.Error ? i("div", { class: "icon icon-type--error" }, i("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" }, i("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" }))) : t === n.Success ? i("div", { class: "icon icon-type--success" }, i("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" }, i("path", { d: "M5.99997 11.17L1.82997 7L0.409973 8.41L5.99997 14L18 2L16.59 0.59L5.99997 11.17Z", fill: "#FCFCFC" }))) : t === n.Warning ? i("div", { class: "icon icon-type--warning" }, i("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" }, i("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M22 19L11 0L0 19H22ZM10 16V14H12V16H10ZM10 12H12V8H10V12Z", fill: "#FCFCFC" }))) : i("div", { class: "icon icon-type--info" }, i("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" }, i("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" })));
|
|
73
|
+
}
|
|
74
|
+
get hostElement() {
|
|
75
|
+
return d(this);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
g.style = h;
|
|
79
|
+
export {
|
|
80
|
+
g as mi_notification
|
|
81
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { r as c, f as r, h as i, H as f, g as d } from "./reactcomponent-2f9f051f.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
var l;
|
|
5
|
+
(function(t) {
|
|
6
|
+
t.TOP_LEFT = "top-left", t.TOP_CENTER = "top-center", t.TOP_RIGHT = "top-right", t.BOTTOM_CENTER = "bottom-center", t.BOTTOM_LEFT = "bottom-left", t.BOTTOM_RIGHT = "bottom-right";
|
|
7
|
+
})(l || (l = {}));
|
|
8
|
+
var n;
|
|
9
|
+
(function(t) {
|
|
10
|
+
t.Error = "error", t.Info = "info", t.Success = "success", t.Warning = "warning", t.None = "none";
|
|
11
|
+
})(n || (n = {}));
|
|
12
|
+
const h = ':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}', p = class {
|
|
13
|
+
constructor(t) {
|
|
14
|
+
c(this, t), this.notifications = [], this.notificationId = 0, this.position = l.BOTTOM_RIGHT, this.duration = 3;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Show a notification.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} message - Message to display.
|
|
20
|
+
* @param {string} [type='none'] - Type of notification. Available types: 'info', 'warning', 'success', 'error' and 'none'.
|
|
21
|
+
* @param {boolean} [sticky=false] - Set message as sticky to prevent it from disappearing.
|
|
22
|
+
* @returns {Promise<void>}
|
|
23
|
+
*/
|
|
24
|
+
async push(t, e = "none", o = !1) {
|
|
25
|
+
if (typeof t != "string" || t.length < 1)
|
|
26
|
+
return;
|
|
27
|
+
if (!Object.values(n).some((a) => a === e)) {
|
|
28
|
+
console.error("Invalid notification type");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const s = {
|
|
32
|
+
id: this.notificationId,
|
|
33
|
+
message: t,
|
|
34
|
+
sticky: o,
|
|
35
|
+
type: e
|
|
36
|
+
};
|
|
37
|
+
o === !1 && (s.timer = window.setTimeout(() => this.dismiss(s.id), this.duration * 1e3)), this.notificationId++, this.notifications.push(s), r(this.hostElement);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Clear all notifications.
|
|
41
|
+
*
|
|
42
|
+
* @returns {Promise<void>}
|
|
43
|
+
*/
|
|
44
|
+
async clearAll() {
|
|
45
|
+
this.notifications = [], r(this.hostElement);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Dismiss a single notification.
|
|
49
|
+
*
|
|
50
|
+
* @param {number} id
|
|
51
|
+
*/
|
|
52
|
+
dismiss(t) {
|
|
53
|
+
this.notifications = this.notifications.filter((e) => e.id !== t), r(this.hostElement);
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return i(f, { class: this.position }, this.notifications.map((t) => this.renderNotification(t)));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get JSX for notification.
|
|
60
|
+
*
|
|
61
|
+
* @param {NotificationMessage} { id, message }
|
|
62
|
+
* @returns {JSX.Element}
|
|
63
|
+
*/
|
|
64
|
+
renderNotification({ id: t, message: e, type: o }) {
|
|
65
|
+
return i("div", { class: "notification", role: "alert" }, o && o !== "none" ? this.renderIcon(o) : null, i("p", { class: "label" }, e), i("button", { type: "button", "aria-label": "Dismiss notification", class: "btn", onClick: () => this.dismiss(t) }, i("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" }, i("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" }))));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get JSX for type-icon.
|
|
69
|
+
*
|
|
70
|
+
* @param {NotificationType} type
|
|
71
|
+
* @returns {JSX.Element}
|
|
72
|
+
*/
|
|
73
|
+
renderIcon(t) {
|
|
74
|
+
return t === n.Error ? i("div", { class: "icon icon-type--error" }, i("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" }, i("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" }))) : t === n.Success ? i("div", { class: "icon icon-type--success" }, i("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" }, i("path", { d: "M5.99997 11.17L1.82997 7L0.409973 8.41L5.99997 14L18 2L16.59 0.59L5.99997 11.17Z", fill: "#FCFCFC" }))) : t === n.Warning ? i("div", { class: "icon icon-type--warning" }, i("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" }, i("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M22 19L11 0L0 19H22ZM10 16V14H12V16H10ZM10 12H12V8H10V12Z", fill: "#FCFCFC" }))) : i("div", { class: "icon icon-type--info" }, i("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" }, i("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" })));
|
|
75
|
+
}
|
|
76
|
+
get hostElement() {
|
|
77
|
+
return d(this);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
p.style = h;
|
|
81
|
+
export {
|
|
82
|
+
p as mi_notification
|
|
83
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { r as s, h as i } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
+
import { R as t } from "./route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs";
|
|
3
|
+
import { U as n } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
4
|
+
const a = '.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}', r = class {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
s(this, e), this.originName = void 0, this.destinationName = void 0, this.totalTravelTime = void 0, this.totalWalkingDistance = void 0, this.travelMode = t.Walking, this.unit = n.Metric, this.translations = {
|
|
7
|
+
from: "From",
|
|
8
|
+
to: "To",
|
|
9
|
+
avoidStairs: "Avoid stairs",
|
|
10
|
+
walk: "Walk",
|
|
11
|
+
walking: "Walking",
|
|
12
|
+
bike: "Bike",
|
|
13
|
+
bicycling: "Bicycling",
|
|
14
|
+
transit: "Transit",
|
|
15
|
+
car: "Car",
|
|
16
|
+
driving: "Driving"
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get travel mode as a string. Eg. "Walking", "Driving", "Transit", "Bicycling".
|
|
21
|
+
*
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
getTravelModeString() {
|
|
25
|
+
switch (this.travelMode) {
|
|
26
|
+
case t.Walking:
|
|
27
|
+
return this.translations.walk;
|
|
28
|
+
case t.Driving:
|
|
29
|
+
return this.translations.car;
|
|
30
|
+
case t.Transit:
|
|
31
|
+
return this.translations.transit;
|
|
32
|
+
case t.Bicycling:
|
|
33
|
+
return this.translations.bike;
|
|
34
|
+
default:
|
|
35
|
+
return this.translations.walk;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get icon name for travel mode.
|
|
40
|
+
*
|
|
41
|
+
* @returns {string}
|
|
42
|
+
*/
|
|
43
|
+
getTravelModeIconName() {
|
|
44
|
+
switch (this.travelMode) {
|
|
45
|
+
case t.Walking:
|
|
46
|
+
return "walk";
|
|
47
|
+
case t.Driving:
|
|
48
|
+
return "car";
|
|
49
|
+
case t.Transit:
|
|
50
|
+
return "transit";
|
|
51
|
+
case t.Bicycling:
|
|
52
|
+
return "bike";
|
|
53
|
+
default:
|
|
54
|
+
return "walk";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
return i("div", { class: "directions" }, this.originName && this.destinationName ? this.renderWayPoints() : null, i("div", { class: "directions-details" }, this.totalTravelTime >= 0 || this.totalWalkingDistance >= 0 ? i("div", { class: "directions-details-numbers" }, this.totalTravelTime >= 0 ? i("div", null, i("mi-time", { seconds: this.totalTravelTime })) : null, this.totalWalkingDistance >= 0 ? i("div", { class: "directions-details-numbers-distance" }, i("mi-distance", { meters: this.totalWalkingDistance }), " ", this.translations.walking.toLowerCase()) : null) : null, i("a", { href: "#", class: "directions-details-travel-mode-selector" }, this.getTravelModeString(), i("mi-icon", { "icon-name": this.getTravelModeIconName() }))));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Render direction way points.
|
|
62
|
+
*
|
|
63
|
+
* @returns {JSX.Element}
|
|
64
|
+
*/
|
|
65
|
+
renderWayPoints() {
|
|
66
|
+
return i("div", { class: "directions-way-points" }, i("span", null, this.translations.to, " ", this.destinationName), i("span", null, this.translations.from, " ", i("a", { href: "#" }, this.originName)));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
r.style = a;
|
|
70
|
+
export {
|
|
71
|
+
r as mi_route_instructions_heading
|
|
72
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { r as s, h as i } from "./reactcomponent-2f9f051f.mjs";
|
|
2
|
+
import { R as t } from "./route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs";
|
|
3
|
+
import { U as n } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
4
|
+
import "react";
|
|
5
|
+
import "react-dom";
|
|
6
|
+
const a = '.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}', r = class {
|
|
7
|
+
constructor(e) {
|
|
8
|
+
s(this, e), this.originName = void 0, this.destinationName = void 0, this.totalTravelTime = void 0, this.totalWalkingDistance = void 0, this.travelMode = t.Walking, this.unit = n.Metric, this.translations = {
|
|
9
|
+
from: "From",
|
|
10
|
+
to: "To",
|
|
11
|
+
avoidStairs: "Avoid stairs",
|
|
12
|
+
walk: "Walk",
|
|
13
|
+
walking: "Walking",
|
|
14
|
+
bike: "Bike",
|
|
15
|
+
bicycling: "Bicycling",
|
|
16
|
+
transit: "Transit",
|
|
17
|
+
car: "Car",
|
|
18
|
+
driving: "Driving"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get travel mode as a string. Eg. "Walking", "Driving", "Transit", "Bicycling".
|
|
23
|
+
*
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
getTravelModeString() {
|
|
27
|
+
switch (this.travelMode) {
|
|
28
|
+
case t.Walking:
|
|
29
|
+
return this.translations.walk;
|
|
30
|
+
case t.Driving:
|
|
31
|
+
return this.translations.car;
|
|
32
|
+
case t.Transit:
|
|
33
|
+
return this.translations.transit;
|
|
34
|
+
case t.Bicycling:
|
|
35
|
+
return this.translations.bike;
|
|
36
|
+
default:
|
|
37
|
+
return this.translations.walk;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get icon name for travel mode.
|
|
42
|
+
*
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
getTravelModeIconName() {
|
|
46
|
+
switch (this.travelMode) {
|
|
47
|
+
case t.Walking:
|
|
48
|
+
return "walk";
|
|
49
|
+
case t.Driving:
|
|
50
|
+
return "car";
|
|
51
|
+
case t.Transit:
|
|
52
|
+
return "transit";
|
|
53
|
+
case t.Bicycling:
|
|
54
|
+
return "bike";
|
|
55
|
+
default:
|
|
56
|
+
return "walk";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
return i("div", { class: "directions" }, this.originName && this.destinationName ? this.renderWayPoints() : null, i("div", { class: "directions-details" }, this.totalTravelTime >= 0 || this.totalWalkingDistance >= 0 ? i("div", { class: "directions-details-numbers" }, this.totalTravelTime >= 0 ? i("div", null, i("mi-time", { seconds: this.totalTravelTime })) : null, this.totalWalkingDistance >= 0 ? i("div", { class: "directions-details-numbers-distance" }, i("mi-distance", { meters: this.totalWalkingDistance }), " ", this.translations.walking.toLowerCase()) : null) : null, i("a", { href: "#", class: "directions-details-travel-mode-selector" }, this.getTravelModeString(), i("mi-icon", { "icon-name": this.getTravelModeIconName() }))));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Render direction way points.
|
|
64
|
+
*
|
|
65
|
+
* @returns {JSX.Element}
|
|
66
|
+
*/
|
|
67
|
+
renderWayPoints() {
|
|
68
|
+
return i("div", { class: "directions-way-points" }, i("span", null, this.translations.to, " ", this.destinationName), i("span", null, this.translations.from, " ", i("a", { href: "#" }, this.originName)));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
r.style = a;
|
|
72
|
+
export {
|
|
73
|
+
r as mi_route_instructions_heading
|
|
74
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { r as l, h as s, H as h } from "./reactcomponent-2f9f051f.mjs";
|
|
2
|
+
import { U as u } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
const d = ':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}', c = class {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
l(this, t), this.maneuver = void 0, this.maneuverData = void 0, this.translations = void 0, this.translationsData = void 0, this.unit = u.Metric;
|
|
8
|
+
}
|
|
9
|
+
parseManeuverProp() {
|
|
10
|
+
this.maneuverData = JSON.parse(this.maneuver);
|
|
11
|
+
}
|
|
12
|
+
parseTranslationsProp() {
|
|
13
|
+
this.translationsData = JSON.parse(this.translations);
|
|
14
|
+
}
|
|
15
|
+
componentWillLoad() {
|
|
16
|
+
this.parseManeuverProp(), this.parseTranslationsProp();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get maneuver name.
|
|
20
|
+
*
|
|
21
|
+
* @returns {string}
|
|
22
|
+
*/
|
|
23
|
+
getManeuverName(t) {
|
|
24
|
+
if (t.includes("straight"))
|
|
25
|
+
return "straight";
|
|
26
|
+
if (t.includes("sharp right"))
|
|
27
|
+
return "sharp-right";
|
|
28
|
+
if (t.includes("sharp left"))
|
|
29
|
+
return "sharp-left";
|
|
30
|
+
if (t.includes("slight right"))
|
|
31
|
+
return "slight-right";
|
|
32
|
+
if (t.includes("slight left"))
|
|
33
|
+
return "slight-left";
|
|
34
|
+
if (t.includes("right"))
|
|
35
|
+
return "right";
|
|
36
|
+
if (t.includes("left"))
|
|
37
|
+
return "left";
|
|
38
|
+
if (t.includes("uturn"))
|
|
39
|
+
return "u-turn";
|
|
40
|
+
if (t.includes("depart"))
|
|
41
|
+
return "straight";
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return this.maneuverData && this.translationsData ? this.renderManeuver() : null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Render step.
|
|
48
|
+
*
|
|
49
|
+
* @returns {JSX.Element}
|
|
50
|
+
*/
|
|
51
|
+
renderManeuver() {
|
|
52
|
+
const t = {
|
|
53
|
+
straight: this.translationsData.continueStraightAhead,
|
|
54
|
+
left: `${this.translationsData.goLeft} ${this.translationsData.andContinue}`,
|
|
55
|
+
"sharp-left": `${this.translationsData.goSharpLeft} ${this.translationsData.andContinue}`,
|
|
56
|
+
"slight-left": `${this.translationsData.goSlightLeft} ${this.translationsData.andContinue}`,
|
|
57
|
+
right: `${this.translationsData.goRight} ${this.translationsData.andContinue}`,
|
|
58
|
+
"sharp-right": `${this.translationsData.goSharpRight} ${this.translationsData.andContinue}`,
|
|
59
|
+
"slight-right": `${this.translationsData.goSlightRight} ${this.translationsData.andContinue}`,
|
|
60
|
+
"u-turn": `${this.translationsData.turnAround} ${this.translationsData.andContinue}`
|
|
61
|
+
// 'Turn around and continue'
|
|
62
|
+
}, n = this.getManeuverName(this.maneuverData.maneuver.toLowerCase()), i = `arrow-${n}`, a = this.maneuverData.instructions ? this.maneuverData.instructions : t[n];
|
|
63
|
+
return s(h, null, s("div", { class: "icon" }, n ? s("mi-icon", { part: "maneuver-icon", "icon-name": i }) : null), s("div", { class: "description" }, s("p", { part: "maneuver-description" }, a), s("div", { class: "description__distance" }, s("mi-distance", { part: "maneuver-description-distance", meters: this.maneuverData.distance.value, unit: this.unit }), s("span", { part: "maneuver-description-distance-border", class: "description__distance-border" }))));
|
|
64
|
+
}
|
|
65
|
+
static get watchers() {
|
|
66
|
+
return {
|
|
67
|
+
maneuver: ["parseManeuverProp"],
|
|
68
|
+
translations: ["parseTranslationsProp"]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
c.style = d;
|
|
73
|
+
const D = class {
|
|
74
|
+
constructor(t) {
|
|
75
|
+
l(this, t), this.seconds = void 0, this.translations = void 0, this.translationsData = void 0;
|
|
76
|
+
}
|
|
77
|
+
setTranslations() {
|
|
78
|
+
this.translations ? this.translationsData = JSON.parse(this.translations) : this.translationsData = { days: "d", hours: "h", minutes: "min" };
|
|
79
|
+
}
|
|
80
|
+
componentWillLoad() {
|
|
81
|
+
this.setTranslations();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get display string in days, hours, and minutes, eg. "1 d 23 h 4 min".
|
|
85
|
+
* Minimum display value is 1 minute.
|
|
86
|
+
*
|
|
87
|
+
* @param {number} seconds Duration in seconds.
|
|
88
|
+
* @returns {string}
|
|
89
|
+
*/
|
|
90
|
+
getDurationDisplayString(t) {
|
|
91
|
+
const n = Math.floor(t / 86400), i = Math.floor(t % 86400 / 3600), a = Math.floor(t % 86400 % 3600 / 60), r = n > 0 ? `${n} ${this.translationsData.days} ` : "", o = i > 0 ? `${i} ${this.translationsData.hours} ` : "";
|
|
92
|
+
let e = a > 0 ? `${a} ${this.translationsData.minutes}` : "";
|
|
93
|
+
return !r && !o && !e && (e = "1 min"), `${r}${o}${e}`.trim();
|
|
94
|
+
}
|
|
95
|
+
render() {
|
|
96
|
+
return this.seconds >= 0 && this.translationsData ? this.renderDuration() : null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Render formatted duration string.
|
|
100
|
+
*
|
|
101
|
+
* @returns {JSX.Element}
|
|
102
|
+
*/
|
|
103
|
+
renderDuration() {
|
|
104
|
+
return s("span", null, this.getDurationDisplayString(this.seconds));
|
|
105
|
+
}
|
|
106
|
+
static get watchers() {
|
|
107
|
+
return {
|
|
108
|
+
translations: ["setTranslations"]
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
export {
|
|
113
|
+
c as mi_route_instructions_maneuver,
|
|
114
|
+
D as mi_time
|
|
115
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { r as l, h as s, H as h } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
+
import { U as u } from "./unit-system.enum-eaefb53e-0f424da4.mjs";
|
|
3
|
+
const d = ':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}', c = class {
|
|
4
|
+
constructor(t) {
|
|
5
|
+
l(this, t), this.maneuver = void 0, this.maneuverData = void 0, this.translations = void 0, this.translationsData = void 0, this.unit = u.Metric;
|
|
6
|
+
}
|
|
7
|
+
parseManeuverProp() {
|
|
8
|
+
this.maneuverData = JSON.parse(this.maneuver);
|
|
9
|
+
}
|
|
10
|
+
parseTranslationsProp() {
|
|
11
|
+
this.translationsData = JSON.parse(this.translations);
|
|
12
|
+
}
|
|
13
|
+
componentWillLoad() {
|
|
14
|
+
this.parseManeuverProp(), this.parseTranslationsProp();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get maneuver name.
|
|
18
|
+
*
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
getManeuverName(t) {
|
|
22
|
+
if (t.includes("straight"))
|
|
23
|
+
return "straight";
|
|
24
|
+
if (t.includes("sharp right"))
|
|
25
|
+
return "sharp-right";
|
|
26
|
+
if (t.includes("sharp left"))
|
|
27
|
+
return "sharp-left";
|
|
28
|
+
if (t.includes("slight right"))
|
|
29
|
+
return "slight-right";
|
|
30
|
+
if (t.includes("slight left"))
|
|
31
|
+
return "slight-left";
|
|
32
|
+
if (t.includes("right"))
|
|
33
|
+
return "right";
|
|
34
|
+
if (t.includes("left"))
|
|
35
|
+
return "left";
|
|
36
|
+
if (t.includes("uturn"))
|
|
37
|
+
return "u-turn";
|
|
38
|
+
if (t.includes("depart"))
|
|
39
|
+
return "straight";
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
return this.maneuverData && this.translationsData ? this.renderManeuver() : null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Render step.
|
|
46
|
+
*
|
|
47
|
+
* @returns {JSX.Element}
|
|
48
|
+
*/
|
|
49
|
+
renderManeuver() {
|
|
50
|
+
const t = {
|
|
51
|
+
straight: this.translationsData.continueStraightAhead,
|
|
52
|
+
left: `${this.translationsData.goLeft} ${this.translationsData.andContinue}`,
|
|
53
|
+
"sharp-left": `${this.translationsData.goSharpLeft} ${this.translationsData.andContinue}`,
|
|
54
|
+
"slight-left": `${this.translationsData.goSlightLeft} ${this.translationsData.andContinue}`,
|
|
55
|
+
right: `${this.translationsData.goRight} ${this.translationsData.andContinue}`,
|
|
56
|
+
"sharp-right": `${this.translationsData.goSharpRight} ${this.translationsData.andContinue}`,
|
|
57
|
+
"slight-right": `${this.translationsData.goSlightRight} ${this.translationsData.andContinue}`,
|
|
58
|
+
"u-turn": `${this.translationsData.turnAround} ${this.translationsData.andContinue}`
|
|
59
|
+
// 'Turn around and continue'
|
|
60
|
+
}, n = this.getManeuverName(this.maneuverData.maneuver.toLowerCase()), i = `arrow-${n}`, a = this.maneuverData.instructions ? this.maneuverData.instructions : t[n];
|
|
61
|
+
return s(h, null, s("div", { class: "icon" }, n ? s("mi-icon", { part: "maneuver-icon", "icon-name": i }) : null), s("div", { class: "description" }, s("p", { part: "maneuver-description" }, a), s("div", { class: "description__distance" }, s("mi-distance", { part: "maneuver-description-distance", meters: this.maneuverData.distance.value, unit: this.unit }), s("span", { part: "maneuver-description-distance-border", class: "description__distance-border" }))));
|
|
62
|
+
}
|
|
63
|
+
static get watchers() {
|
|
64
|
+
return {
|
|
65
|
+
maneuver: ["parseManeuverProp"],
|
|
66
|
+
translations: ["parseTranslationsProp"]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
c.style = d;
|
|
71
|
+
const m = class {
|
|
72
|
+
constructor(t) {
|
|
73
|
+
l(this, t), this.seconds = void 0, this.translations = void 0, this.translationsData = void 0;
|
|
74
|
+
}
|
|
75
|
+
setTranslations() {
|
|
76
|
+
this.translations ? this.translationsData = JSON.parse(this.translations) : this.translationsData = { days: "d", hours: "h", minutes: "min" };
|
|
77
|
+
}
|
|
78
|
+
componentWillLoad() {
|
|
79
|
+
this.setTranslations();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get display string in days, hours, and minutes, eg. "1 d 23 h 4 min".
|
|
83
|
+
* Minimum display value is 1 minute.
|
|
84
|
+
*
|
|
85
|
+
* @param {number} seconds Duration in seconds.
|
|
86
|
+
* @returns {string}
|
|
87
|
+
*/
|
|
88
|
+
getDurationDisplayString(t) {
|
|
89
|
+
const n = Math.floor(t / 86400), i = Math.floor(t % 86400 / 3600), a = Math.floor(t % 86400 % 3600 / 60), r = n > 0 ? `${n} ${this.translationsData.days} ` : "", o = i > 0 ? `${i} ${this.translationsData.hours} ` : "";
|
|
90
|
+
let e = a > 0 ? `${a} ${this.translationsData.minutes}` : "";
|
|
91
|
+
return !r && !o && !e && (e = "1 min"), `${r}${o}${e}`.trim();
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
return this.seconds >= 0 && this.translationsData ? this.renderDuration() : null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Render formatted duration string.
|
|
98
|
+
*
|
|
99
|
+
* @returns {JSX.Element}
|
|
100
|
+
*/
|
|
101
|
+
renderDuration() {
|
|
102
|
+
return s("span", null, this.getDurationDisplayString(this.seconds));
|
|
103
|
+
}
|
|
104
|
+
static get watchers() {
|
|
105
|
+
return {
|
|
106
|
+
translations: ["setTranslations"]
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
c as mi_route_instructions_maneuver,
|
|
112
|
+
m as mi_time
|
|
113
|
+
};
|