@mapsindoors/map-template 1.95.0 → 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.
Files changed (66) hide show
  1. package/dist/{GoogleMapsMap-BIUan6Mh.mjs → GoogleMapsMap-Dkn60-_e.mjs} +2 -2
  2. package/dist/{MapboxMap-BwTFmd5b.mjs → MapboxMap-B1oo7IUm.mjs} +3 -3
  3. package/dist/_commonjsHelpers-B85MJLTf.js +5 -0
  4. package/dist/app-globals-DQuL1Twl.js +3 -0
  5. package/dist/combo-box-item.entry.js +8 -10
  6. package/dist/icon-DT_sDkmK.js +11 -0
  7. package/dist/index-BZQHyS7V.js +1701 -0
  8. package/dist/loader.js +7 -14
  9. package/dist/mapsindoors-react.es.js +1 -1
  10. package/dist/mapsindoors-react.umd.js +175 -175
  11. package/dist/mapsindoors-webcomponent.es.js +2919 -2907
  12. package/dist/mi-card_2.entry.js +23 -18
  13. package/dist/mi-chip.entry.js +25 -16
  14. package/dist/mi-column.entry.js +47 -23
  15. package/dist/mi-combo-box.entry.js +412 -379
  16. package/dist/mi-components.js +15 -12
  17. package/dist/mi-data-table.entry.js +298 -278
  18. package/dist/mi-distance_2.entry.js +58 -56
  19. package/dist/mi-dropdown-item.entry.js +8 -10
  20. package/dist/mi-dropdown.entry.js +525 -481
  21. package/dist/mi-floor-selector.entry.js +183 -180
  22. package/dist/mi-keyboard.entry.js +207 -186
  23. package/dist/mi-list-item-category.entry.js +44 -41
  24. package/dist/mi-list-item-location.entry.js +168 -162
  25. package/dist/mi-list.entry.js +56 -48
  26. package/dist/mi-location-booking.entry.js +320 -295
  27. package/dist/mi-location-info.entry.js +61 -53
  28. package/dist/mi-map-googlemaps.entry.js +369 -324
  29. package/dist/mi-map-mapbox.entry.js +502 -439
  30. package/dist/mi-metric-card.entry.js +50 -37
  31. package/dist/mi-my-position.entry.js +2341 -874
  32. package/dist/mi-notification.entry.js +112 -102
  33. package/dist/mi-route-instructions-heading.entry.js +70 -65
  34. package/dist/mi-route-instructions-maneuver-legacy.entry.js +80 -76
  35. package/dist/mi-route-instructions-maneuver.entry.js +80 -76
  36. package/dist/mi-route-instructions-step-legacy.entry.js +296 -282
  37. package/dist/mi-route-instructions-step.entry.js +313 -292
  38. package/dist/mi-route-instructions.entry.js +167 -150
  39. package/dist/mi-scroll-buttons.entry.js +104 -98
  40. package/dist/mi-search.entry.js +366 -325
  41. package/dist/mi-share-sms.entry.js +82 -70
  42. package/dist/mi-step-switcher.entry.js +34 -25
  43. package/dist/mi-tab-panel.entry.js +18 -18
  44. package/dist/mi-tab.entry.js +5 -7
  45. package/dist/mi-tabs.entry.js +42 -40
  46. package/dist/mi-time.entry.js +49 -49
  47. package/dist/mi-variables-CDNvnTkH.js +5 -0
  48. package/dist/{reactcomponent-D3K1zzGs.mjs → reactcomponent-2Oa1vSiK.mjs} +8996 -8660
  49. package/dist/route-travel-mode.enum-BvqP1fpw.js +9 -0
  50. package/dist/sort-order.enum-jsLAbYWg.js +566 -0
  51. package/dist/{unit-system.enum-eaefb53e.js → unit-system.enum-BwPgAWqL.js} +2 -2
  52. package/dist/utils-DNHzysQ6.js +61 -0
  53. package/package.json +1 -1
  54. package/dist/_commonjsHelpers-ba3f0406.js +0 -21
  55. package/dist/icon-b8d01d6f.js +0 -24
  56. package/dist/index-7e9696f3.js +0 -1678
  57. package/dist/mi-variables-9a6c8d4d.js +0 -6
  58. package/dist/polyfills/core-js.js +0 -11
  59. package/dist/polyfills/css-shim.js +0 -1
  60. package/dist/polyfills/dom.js +0 -79
  61. package/dist/polyfills/es5-html-element.js +0 -1
  62. package/dist/polyfills/index.js +0 -34
  63. package/dist/polyfills/system.js +0 -6
  64. package/dist/route-travel-mode.enum-7f4ce9c7.js +0 -9
  65. package/dist/sort-order.enum-64ce8998.js +0 -552
  66. package/dist/utils-ae714467.js +0 -61
@@ -1,48 +1,51 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-7e9696f3.js';
2
- import { m as midtIcon } from './icon-b8d01d6f.js';
3
- import { b as appendMapsIndoorsImageQueryParameters } from './utils-ae714467.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-BZQHyS7V.js';
2
+ import { m as midtIcon } from './icon-DT_sDkmK.js';
3
+ import { b as appendMapsIndoorsImageQueryParameters } from './utils-DNHzysQ6.js';
4
4
 
5
- const listItemCategoryCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{color:#1c1917;transition:300ms ease;display:flex;align-items:center;cursor:pointer}:host img{-o-object-fit:cover;object-fit:cover}:host([orientation=horizontal]){width:100%;height:100%;float:left;flex-direction:column;justify-content:center}:host([orientation=horizontal]) img{width:48px;height:48px}:host([orientation=horizontal]) p{height:16px;overflow:visible;font-size:0.875rem;line-height:1rem;text-align:center}:host([orientation=vertical]){padding:16px;flex-direction:row;font-size:1rem;font-weight:500;line-height:1.25rem}:host([orientation=vertical]) img{width:24px;height:24px}:host([orientation=vertical]) p{margin:0;padding-left:16px}:host(:hover){background-color:#fcfcfc}";
5
+ const listItemCategoryCss = () => `html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{color:#1c1917;transition:300ms ease;display:flex;align-items:center;cursor:pointer}:host img{-o-object-fit:cover;object-fit:cover}:host([orientation=horizontal]){width:100%;height:100%;float:left;flex-direction:column;justify-content:center}:host([orientation=horizontal]) img{width:48px;height:48px}:host([orientation=horizontal]) p{height:16px;overflow:visible;font-size:0.875rem;line-height:1rem;text-align:center}:host([orientation=vertical]){padding:16px;flex-direction:row;font-size:1rem;font-weight:500;line-height:1.25rem}:host([orientation=vertical]) img{width:24px;height:24px}:host([orientation=vertical]) p{margin:0;padding-left:16px}:host(:hover){background-color:#fcfcfc}`;
6
6
 
7
7
  const ListItemCategory = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.categoryClicked = createEvent(this, "categoryClicked", 7);
11
- this.listItemDidRender = createEvent(this, "listItemDidRender", 7);
12
- this.category = undefined;
13
- this.orientation = 'vertical';
14
- }
15
- componentDidRender() {
16
- this.listItemDidRender.emit();
17
- // IE fallback for 'object-fit' css property
18
- if ('objectFit' in document.documentElement.style === false) {
19
- this.objectFitImage(this.image);
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.categoryClicked = createEvent(this, "categoryClicked", 7);
11
+ this.listItemDidRender = createEvent(this, "listItemDidRender", 7);
12
+ /**
13
+ * @description List orientation. Accepts the following values: 'vertical' and 'horizontal'.
14
+ * @type {string}
15
+ */
16
+ this.orientation = 'vertical';
17
+ }
18
+ componentDidRender() {
19
+ this.listItemDidRender.emit();
20
+ // IE fallback for 'object-fit' css property
21
+ if ('objectFit' in document.documentElement.style === false) {
22
+ this.objectFitImage(this.image);
23
+ }
24
+ }
25
+ /**
26
+ * @description Emits the category object to event listeners.
27
+ * @private
28
+ * @param {*} category - Category object.
29
+ * @memberof ListItemCategory
30
+ */
31
+ categoryClickedHandler(category) {
32
+ this.categoryClicked.emit(category);
33
+ }
34
+ /**
35
+ * @description Set image as background image.
36
+ * @private
37
+ * @param {HTMLImageElement} image
38
+ */
39
+ objectFitImage(image) {
40
+ image.setAttribute('style', `background: no-repeat center center url("${this.category.iconUrl}"); background-size: cover;`);
41
+ image.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${image.width}' height='${image.height}'%3E%3C/svg%3E`;
42
+ }
43
+ render() {
44
+ const iconDisplaySize = this.orientation.toUpperCase() === 'VERTICAL' ? parseInt(midtIcon.icon.size.medium.value) : parseInt(midtIcon.icon.size['xx-large'].value);
45
+ const iconURL = appendMapsIndoorsImageQueryParameters(this.category.iconUrl, iconDisplaySize);
46
+ return (h(Host, { key: '0d80164dcd89d3430160c26ce6d15b0cd593491d', onClick: () => this.categoryClickedHandler(this.category) }, h("img", { key: '56f677da7b6df7a41024758601de03b696223de2', ref: (el) => this.image = el, src: iconURL }), h("p", { key: '9ecddbeeace860ed594cf0900f707d69bc4237c9' }, this.category.name)));
20
47
  }
21
- }
22
- /**
23
- * @description Emits the category object to event listeners.
24
- * @private
25
- * @param {*} category - Category object.
26
- * @memberof ListItemCategory
27
- */
28
- categoryClickedHandler(category) {
29
- this.categoryClicked.emit(category);
30
- }
31
- /**
32
- * @description Set image as background image.
33
- * @private
34
- * @param {HTMLImageElement} image
35
- */
36
- objectFitImage(image) {
37
- image.setAttribute('style', `background: no-repeat center center url("${this.category.iconUrl}"); background-size: cover;`);
38
- image.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${image.width}' height='${image.height}'%3E%3C/svg%3E`;
39
- }
40
- render() {
41
- const iconDisplaySize = this.orientation.toUpperCase() === 'VERTICAL' ? parseInt(midtIcon.icon.size.medium.value) : parseInt(midtIcon.icon.size['xx-large'].value);
42
- const iconURL = appendMapsIndoorsImageQueryParameters(this.category.iconUrl, iconDisplaySize);
43
- return (h(Host, { onClick: () => this.categoryClickedHandler(this.category) }, h("img", { ref: (el) => this.image = el, src: iconURL }), h("p", null, this.category.name)));
44
- }
45
48
  };
46
- ListItemCategory.style = listItemCategoryCss;
49
+ ListItemCategory.style = listItemCategoryCss();
47
50
 
48
51
  export { ListItemCategory as mi_list_item_category };
@@ -1,171 +1,177 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-7e9696f3.js';
2
- import { m as midtIcon } from './icon-b8d01d6f.js';
3
- import { b as appendMapsIndoorsImageQueryParameters } from './utils-ae714467.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-BZQHyS7V.js';
2
+ import { m as midtIcon } from './icon-DT_sDkmK.js';
3
+ import { b as appendMapsIndoorsImageQueryParameters } from './utils-DNHzysQ6.js';
4
4
 
5
- const listItemLocationCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{padding:1rem;font-size:1rem;font-weight:500;line-height:1rem;transition:300ms ease;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\";border-radius:8px;background-color:#f9fafb;display:flex;flex-direction:row;align-items:center;cursor:pointer;gap:1rem;border:1px solid #e5e7eb}:host(:hover),:host(.hovered){background-color:var(--tailwind-colors-gray-200);border:1px solid #d1d5db}.img-container{width:2rem;height:2rem;display:flex;justify-content:center;align-items:center;flex-shrink:0}img{border-radius:8px;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.details{padding-right:1rem;flex:1;min-width:0;display:grid;gap:0.25rem}.details-title{margin:0;padding:0}.distance{font-weight:400}mi-location-info{color:#6b7280}";
5
+ const listItemLocationCss = () => `html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{padding:1rem;font-size:1rem;font-weight:500;line-height:1rem;transition:300ms ease;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";border-radius:8px;background-color:#f9fafb;display:flex;flex-direction:row;align-items:center;cursor:pointer;gap:1rem;border:1px solid #e5e7eb}:host(:hover),:host(.hovered){background-color:var(--tailwind-colors-gray-200);border:1px solid #d1d5db}.img-container{width:2rem;height:2rem;display:flex;justify-content:center;align-items:center;flex-shrink:0}img{border-radius:8px;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.details{padding-right:1rem;flex:1;min-width:0;display:grid;gap:0.25rem}.details-title{margin:0;padding:0}.distance{font-weight:400}mi-location-info{color:#6b7280}`;
6
6
 
7
7
  const ListItemLocation = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.locationClicked = createEvent(this, "locationClicked", 7);
11
- this.listItemDidRender = createEvent(this, "listItemDidRender", 7);
12
- this.iconDisplaySize = parseInt(midtIcon.icon.size.medium.value);
13
- this.location = undefined;
14
- this.showExternalId = true;
15
- this.unit = undefined;
16
- this.icon = undefined;
17
- this.level = 'Level';
18
- this.iconBadge = undefined;
19
- this.iconBadgeValue = undefined;
20
- this.iconURLToRender = undefined;
21
- }
22
- iconChanged() {
23
- var _a;
24
- this.iconURLToRender = this.icon ? this.icon : (_a = this.location) === null || _a === void 0 ? void 0 : _a.properties.imageURL;
25
- this.updateBadge();
26
- }
27
- iconBadgeChanged() {
28
- this.updateBadge();
29
- }
30
- iconBadgeValueChanged() {
31
- this.updateBadge();
32
- }
33
- /**
34
- * @description Emits the location to event listeners.
35
- * @param {*} location - Location object.
36
- * @memberof List
37
- */
38
- locationClickedHandler(location) {
39
- this.locationClicked.emit(location);
40
- }
41
- /**
42
- * Called once just after the component is first connected to the DOM.
43
- */
44
- componentWillLoad() {
45
- var _a;
46
- this.iconURLToRender = this.icon ? this.icon : (_a = this.location) === null || _a === void 0 ? void 0 : _a.properties.imageURL;
47
- this.updateBadge();
48
- }
49
- /**
50
- * Called after every render().
51
- */
52
- componentDidRender() {
53
- if (!this.location) {
54
- return;
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.locationClicked = createEvent(this, "locationClicked", 7);
11
+ this.listItemDidRender = createEvent(this, "listItemDidRender", 7);
12
+ /**
13
+ * Whether to show the External ID.
14
+ */
15
+ this.showExternalId = true;
16
+ /**
17
+ * @description The word used for "Level" when showing level info. Default is "Level".
18
+ */
19
+ this.level = 'Level';
20
+ this.iconDisplaySize = parseInt(midtIcon.icon.size.medium.value);
55
21
  }
56
- this.infoElement.location = this.location;
57
- this.listItemDidRender.emit();
58
- // IE fallback for 'object-fit' css property
59
- if (this.imageElement && 'objectFit' in document.documentElement.style === false) {
60
- this.objectFitImage(this.imageElement);
22
+ iconChanged() {
23
+ var _a;
24
+ this.iconURLToRender = this.icon ? this.icon : (_a = this.location) === null || _a === void 0 ? void 0 : _a.properties.imageURL;
25
+ this.updateBadge();
61
26
  }
62
- }
63
- /**
64
- * Apply badge to location icon.
65
- */
66
- updateBadge() {
67
- if (this.iconBadge && this.iconBadgeValue && this.iconURLToRender) {
68
- this.applyBadgeToIcon();
27
+ iconBadgeChanged() {
28
+ this.updateBadge();
69
29
  }
70
- }
71
- /**
72
- * @description Set image as background image.
73
- * @param {HTMLImageElement} image
74
- */
75
- objectFitImage(image) {
76
- image.setAttribute('style', `background: no-repeat center center url("${this.iconURLToRender}"); background-size: cover;`);
77
- image.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${image.width}' height='${image.height}'%3E%3C/svg%3E`;
78
- }
79
- /**
80
- * Apply badge to location icon.
81
- * Will make the original icon appear the intended size even though the badge exceeds its bounds.
82
- */
83
- applyBadgeToIcon() {
84
- let originalIconScale;
85
- this.iconURLToRender = this.icon ? this.icon : this.location.properties.imageURL;
86
- const iconURL = appendMapsIndoorsImageQueryParameters(this.iconURLToRender, this.iconDisplaySize);
87
- this.getImageFromUrl(iconURL).then(image => {
88
- originalIconScale = image.width / 24;
89
- switch (this.iconBadge.toLowerCase()) {
90
- case 'availability':
91
- if (this.iconBadgeValue === 'true') {
92
- return mapsindoors.BadgeRenderer.AvailableBadge.overlay(image);
93
- }
94
- else if (this.iconBadgeValue === 'false') {
95
- return mapsindoors.BadgeRenderer.UnavailableBadge.overlay(image);
96
- }
97
- break;
98
- case 'occupancy':
99
- return mapsindoors.BadgeRenderer.TextBadge.overlay(image, {
100
- text: this.iconBadgeValue.toString()
101
- });
102
- }
103
- }).then(badgedImage => {
104
- if (badgedImage) {
105
- this.iconURLToRender = badgedImage.src;
106
- // Badged image must be moved so the original image aligns with other.
107
- const translateIcon = (badgedImage.width - 24) / -2;
108
- this.iconAttributes = {
109
- style: {
110
- transform: 'translateX(' + translateIcon + 'px)',
111
- width: badgedImage.width / originalIconScale + 'px',
112
- height: badgedImage.height / originalIconScale + 'px'
113
- }
114
- };
115
- }
116
- });
117
- }
118
- /**
119
- * Create and return an Image from URL.
120
- *
121
- * @param {string} url
122
- * @returns {Image}
123
- */
124
- async getImageFromUrl(url) {
125
- return fetch(url)
126
- .then(res => res.blob())
127
- .then(blob => URL.createObjectURL(blob))
128
- .then(objUrl => {
129
- return new Promise((resolve) => {
130
- const image = new Image();
131
- image.width = this.iconDisplaySize;
132
- image.height = this.iconDisplaySize;
133
- image.onload = () => resolve(image);
134
- image.onerror = () => resolve(null);
135
- image.src = objUrl;
136
- });
137
- });
138
- }
139
- /**
140
- * Render location list-item.
141
- *
142
- * @description Render location list-item.
143
- * @returns {JSX.Element}
144
- */
145
- render() {
146
- return this.location && (h(Host, { role: "listitem", onClick: () => this.locationClickedHandler(this.location) }, this.iconURLToRender ? this.renderIcon() : null, h("div", { class: "details" }, h("p", { class: "details-title" }, this.location.properties.name), h("mi-location-info", { level: this.level, ref: (el) => this.infoElement = el, showExternalId: this.showExternalId })), this.location.properties.geodesicDistance && this.renderDistance()));
147
- }
148
- /**
149
- * @description Get JSX template for icon.
150
- * @returns {JSX.Element}
151
- */
152
- renderIcon() {
153
- const iconURL = appendMapsIndoorsImageQueryParameters(this.iconURLToRender, this.iconDisplaySize);
154
- return (h("div", { class: "img-container" }, h("img", Object.assign({}, this.iconAttributes, { ref: (el) => this.imageElement = el, src: iconURL }))));
155
- }
156
- /**
157
- * @description Get JSX template for distance.
158
- * @returns {JSX.Element}
159
- */
160
- renderDistance() {
161
- return (h("div", { class: "distance" }, h("mi-distance", { meters: this.location.properties.geodesicDistance, unit: this.unit })));
162
- }
163
- static get watchers() { return {
164
- "icon": ["iconChanged"],
165
- "iconBadge": ["iconBadgeChanged"],
166
- "iconBadgeValue": ["iconBadgeValueChanged"]
167
- }; }
30
+ iconBadgeValueChanged() {
31
+ this.updateBadge();
32
+ }
33
+ /**
34
+ * @description Emits the location to event listeners.
35
+ * @param {*} location - Location object.
36
+ * @memberof List
37
+ */
38
+ locationClickedHandler(location) {
39
+ this.locationClicked.emit(location);
40
+ }
41
+ /**
42
+ * Called once just after the component is first connected to the DOM.
43
+ */
44
+ componentWillLoad() {
45
+ var _a;
46
+ this.iconURLToRender = this.icon ? this.icon : (_a = this.location) === null || _a === void 0 ? void 0 : _a.properties.imageURL;
47
+ this.updateBadge();
48
+ }
49
+ /**
50
+ * Called after every render().
51
+ */
52
+ componentDidRender() {
53
+ if (!this.location) {
54
+ return;
55
+ }
56
+ this.infoElement.location = this.location;
57
+ this.listItemDidRender.emit();
58
+ // IE fallback for 'object-fit' css property
59
+ if (this.imageElement && 'objectFit' in document.documentElement.style === false) {
60
+ this.objectFitImage(this.imageElement);
61
+ }
62
+ }
63
+ /**
64
+ * Apply badge to location icon.
65
+ */
66
+ updateBadge() {
67
+ if (this.iconBadge && this.iconBadgeValue && this.iconURLToRender) {
68
+ this.applyBadgeToIcon();
69
+ }
70
+ }
71
+ /**
72
+ * @description Set image as background image.
73
+ * @param {HTMLImageElement} image
74
+ */
75
+ objectFitImage(image) {
76
+ image.setAttribute('style', `background: no-repeat center center url("${this.iconURLToRender}"); background-size: cover;`);
77
+ image.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${image.width}' height='${image.height}'%3E%3C/svg%3E`;
78
+ }
79
+ /**
80
+ * Apply badge to location icon.
81
+ * Will make the original icon appear the intended size even though the badge exceeds its bounds.
82
+ */
83
+ applyBadgeToIcon() {
84
+ let originalIconScale;
85
+ this.iconURLToRender = this.icon ? this.icon : this.location.properties.imageURL;
86
+ const iconURL = appendMapsIndoorsImageQueryParameters(this.iconURLToRender, this.iconDisplaySize);
87
+ this.getImageFromUrl(iconURL).then(image => {
88
+ originalIconScale = image.width / 24;
89
+ switch (this.iconBadge.toLowerCase()) {
90
+ case 'availability':
91
+ if (this.iconBadgeValue === 'true') {
92
+ return mapsindoors.BadgeRenderer.AvailableBadge.overlay(image);
93
+ }
94
+ else if (this.iconBadgeValue === 'false') {
95
+ return mapsindoors.BadgeRenderer.UnavailableBadge.overlay(image);
96
+ }
97
+ break;
98
+ case 'occupancy':
99
+ return mapsindoors.BadgeRenderer.TextBadge.overlay(image, {
100
+ text: this.iconBadgeValue.toString()
101
+ });
102
+ }
103
+ }).then(badgedImage => {
104
+ if (badgedImage) {
105
+ this.iconURLToRender = badgedImage.src;
106
+ // Badged image must be moved so the original image aligns with other.
107
+ const translateIcon = (badgedImage.width - 24) / -2;
108
+ this.iconAttributes = {
109
+ style: {
110
+ transform: 'translateX(' + translateIcon + 'px)',
111
+ width: badgedImage.width / originalIconScale + 'px',
112
+ height: badgedImage.height / originalIconScale + 'px'
113
+ }
114
+ };
115
+ }
116
+ });
117
+ }
118
+ /**
119
+ * Create and return an Image from URL.
120
+ *
121
+ * @param {string} url
122
+ * @returns {Image}
123
+ */
124
+ async getImageFromUrl(url) {
125
+ return fetch(url)
126
+ .then(res => res.blob())
127
+ .then(blob => URL.createObjectURL(blob))
128
+ .then(objUrl => {
129
+ return new Promise((resolve) => {
130
+ const image = new Image();
131
+ image.width = this.iconDisplaySize;
132
+ image.height = this.iconDisplaySize;
133
+ image.onload = () => resolve(image);
134
+ image.onerror = () => resolve(null);
135
+ image.src = objUrl;
136
+ });
137
+ });
138
+ }
139
+ /**
140
+ * Render location list-item.
141
+ *
142
+ * @description Render location list-item.
143
+ * @returns {JSX.Element}
144
+ */
145
+ render() {
146
+ return this.location && (h(Host, { key: '5aef44556a0231b84c5d287630b7c0b1e942337b', role: "listitem", onClick: () => this.locationClickedHandler(this.location) }, this.iconURLToRender ? this.renderIcon() : null, h("div", { key: '2d04abcf241d6f4ffd18a3750e6c97a2e390f0dd', class: "details" }, h("p", { key: '67fb00fa0af9f721d5e25c01d04408d1bb218397', class: "details-title" }, this.location.properties.name), h("mi-location-info", { key: '84a8de0de326865bd51904dba3ed732df429bdd0', level: this.level, ref: (el) => this.infoElement = el, showExternalId: this.showExternalId })), typeof this.location.properties.geodesicDistance === 'number' && this.renderDistance()));
147
+ }
148
+ /**
149
+ * @description Get JSX template for icon.
150
+ * @returns {JSX.Element}
151
+ */
152
+ renderIcon() {
153
+ const iconURL = appendMapsIndoorsImageQueryParameters(this.iconURLToRender, this.iconDisplaySize);
154
+ return (h("div", { class: "img-container" }, h("img", Object.assign({}, this.iconAttributes, { ref: (el) => this.imageElement = el, src: iconURL }))));
155
+ }
156
+ /**
157
+ * @description Get JSX template for distance.
158
+ * @returns {JSX.Element}
159
+ */
160
+ renderDistance() {
161
+ return (h("div", { class: "distance" }, h("mi-distance", { meters: this.location.properties.geodesicDistance, unit: this.unit })));
162
+ }
163
+ static get watchers() { return {
164
+ "icon": [{
165
+ "iconChanged": 0
166
+ }],
167
+ "iconBadge": [{
168
+ "iconBadgeChanged": 0
169
+ }],
170
+ "iconBadgeValue": [{
171
+ "iconBadgeValueChanged": 0
172
+ }]
173
+ }; }
168
174
  };
169
- ListItemLocation.style = listItemLocationCss;
175
+ ListItemLocation.style = listItemLocationCss();
170
176
 
171
177
  export { ListItemLocation as mi_list_item_location };
@@ -1,56 +1,64 @@
1
- import { r as registerInstance, h } from './index-7e9696f3.js';
1
+ import { r as registerInstance, h } from './index-BZQHyS7V.js';
2
2
 
3
- const listCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{display:block;height:100%;width:100%}.container{height:100%;display:flex}.container .scroll-container{width:100%;overflow-y:auto}";
3
+ const listCss = () => `html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{display:block;height:100%;width:100%}.container{height:100%;display:flex}.container .scroll-container{width:100%;overflow-y:auto}`;
4
4
 
5
5
  const List = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- this.scrollButtonsEnabled = false;
9
- this.scrollLength = 100;
10
- }
11
- componentDidLoad() {
12
- this.addIntersectionObserver();
13
- if (this.scrollButtonsEnabled) {
14
- this.setScrollContainerElementRef();
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ /**
9
+ * @description Determines if the MI Scroll Buttons Component should be rendered.
10
+ * @type {boolean}
11
+ */
12
+ this.scrollButtonsEnabled = false;
13
+ /**
14
+ * @description Determines how far to scroll when clicking one of the buttons from the MI Scroll Buttons Component.
15
+ * @type {number}
16
+ */
17
+ this.scrollLength = 100;
15
18
  }
16
- }
17
- /**
18
- * @description Update state of scroll buttons when a "listItemDidRender" event is fired.
19
- * @private
20
- */
21
- updateScrollButtonsState() {
22
- if (this.scrollButtonsEnabled && this.miScrollButtonsElement.scrollContainerElementRef) {
23
- this.miScrollButtonsElement.updateScrollButtonsState();
19
+ componentDidLoad() {
20
+ this.addIntersectionObserver();
21
+ if (this.scrollButtonsEnabled) {
22
+ this.setScrollContainerElementRef();
23
+ }
24
+ }
25
+ /**
26
+ * @description Update state of scroll buttons when a "listItemDidRender" event is fired.
27
+ * @private
28
+ */
29
+ updateScrollButtonsState() {
30
+ if (this.scrollButtonsEnabled && this.miScrollButtonsElement.scrollContainerElementRef) {
31
+ this.miScrollButtonsElement.updateScrollButtonsState();
32
+ }
33
+ }
34
+ /**
35
+ * @description Set scrollContainerElementRef attribute on miScrollButtonsElement.
36
+ * @private
37
+ */
38
+ setScrollContainerElementRef() {
39
+ this.miScrollButtonsElement.scrollContainerElementRef = this.scrollContainerElement;
40
+ }
41
+ /**
42
+ * @description Add intersection observer and update scroll buttons state on intersection – workaround to avoid the element not having any dimensions before it's shown.
43
+ * @private
44
+ */
45
+ addIntersectionObserver() {
46
+ this.intersectionObserver = new IntersectionObserver((entries) => {
47
+ if (entries[0].intersectionRatio <= 0) {
48
+ return;
49
+ }
50
+ // Disable scroll buttons if container element doesn't have scroll
51
+ if (this.scrollContainerElement.scrollHeight - this.scrollContainerElement.scrollTop === this.scrollContainerElement.clientHeight) {
52
+ this.updateScrollButtonsState();
53
+ }
54
+ this.intersectionObserver.disconnect();
55
+ });
56
+ this.intersectionObserver.observe(this.scrollContainerElement);
57
+ }
58
+ render() {
59
+ return (h("div", { key: '8d38719fbe1586826bc34884d7687fcfbdd23a4d', class: "container" }, h("div", { key: '704dd6782c94e34e6bc368771499898b7184e4e5', role: "list", class: "scroll-container", ref: (el) => this.scrollContainerElement = el }, h("slot", { key: 'ad4da577575a168ef3e8e56735e4b359e084c616' })), this.scrollButtonsEnabled ? h("mi-scroll-buttons", { scrollLength: this.scrollLength, ref: (el) => this.miScrollButtonsElement = el }) : null));
24
60
  }
25
- }
26
- /**
27
- * @description Set scrollContainerElementRef attribute on miScrollButtonsElement.
28
- * @private
29
- */
30
- setScrollContainerElementRef() {
31
- this.miScrollButtonsElement.scrollContainerElementRef = this.scrollContainerElement;
32
- }
33
- /**
34
- * @description Add intersection observer and update scroll buttons state on intersection – workaround to avoid the element not having any dimensions before it's shown.
35
- * @private
36
- */
37
- addIntersectionObserver() {
38
- this.intersectionObserver = new IntersectionObserver((entries) => {
39
- if (entries[0].intersectionRatio <= 0) {
40
- return;
41
- }
42
- // Disable scroll buttons if container element doesn't have scroll
43
- if (this.scrollContainerElement.scrollHeight - this.scrollContainerElement.scrollTop === this.scrollContainerElement.clientHeight) {
44
- this.updateScrollButtonsState();
45
- }
46
- this.intersectionObserver.disconnect();
47
- });
48
- this.intersectionObserver.observe(this.scrollContainerElement);
49
- }
50
- render() {
51
- return (h("div", { class: "container" }, h("div", { role: "list", class: "scroll-container", ref: (el) => this.scrollContainerElement = el }, h("slot", null)), this.scrollButtonsEnabled ? h("mi-scroll-buttons", { scrollLength: this.scrollLength, ref: (el) => this.miScrollButtonsElement = el }) : null));
52
- }
53
61
  };
54
- List.style = listCss;
62
+ List.style = listCss();
55
63
 
56
64
  export { List as mi_list };