@mapsindoors/map-template 1.93.2 → 1.94.0

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 (103) hide show
  1. package/dist/{GoogleMapsMap-982405ad.mjs → GoogleMapsMap-BqYRaFgc.mjs} +51 -62
  2. package/dist/MapboxMap-CUYrfLHY.mjs +34732 -0
  3. package/dist/_commonjsHelpers-ba3f0406.js +21 -0
  4. package/dist/combo-box-item.entry.js +15 -0
  5. package/dist/icon-b8d01d6f.js +24 -0
  6. package/dist/index-7e9696f3.js +1678 -0
  7. package/dist/index.js +1 -0
  8. package/dist/loader.js +18 -0
  9. package/dist/mapsindoors-react.es.js +3 -5
  10. package/dist/mapsindoors-react.umd.js +197 -582
  11. package/dist/mapsindoors-webcomponent.es.js +58512 -75790
  12. package/dist/mi-card_2.entry.js +28 -0
  13. package/dist/mi-chip.entry.js +22 -0
  14. package/dist/mi-column.entry.js +28 -0
  15. package/dist/mi-combo-box.entry.js +416 -0
  16. package/dist/mi-components.js +18 -0
  17. package/dist/mi-data-table.entry.js +302 -0
  18. package/dist/mi-distance_2.entry.js +67 -0
  19. package/dist/mi-dropdown-item.entry.js +15 -0
  20. package/dist/mi-dropdown.entry.js +610 -0
  21. package/dist/mi-floor-selector.entry.js +202 -0
  22. package/dist/mi-keyboard.entry.js +238 -0
  23. package/dist/mi-list-item-category.entry.js +48 -0
  24. package/dist/mi-list-item-location.entry.js +171 -0
  25. package/dist/mi-list.entry.js +56 -0
  26. package/dist/mi-location-booking.entry.js +5193 -0
  27. package/dist/mi-location-info.entry.js +63 -0
  28. package/dist/mi-map-googlemaps.entry.js +750 -0
  29. package/dist/mi-map-mapbox.entry.js +467 -0
  30. package/dist/mi-metric-card.entry.js +48 -0
  31. package/dist/mi-my-position.entry.js +986 -0
  32. package/dist/mi-notification.entry.js +127 -0
  33. package/dist/mi-route-instructions-heading.entry.js +73 -0
  34. package/dist/mi-route-instructions-maneuver-legacy.entry.js +82 -0
  35. package/dist/mi-route-instructions-maneuver.entry.js +82 -0
  36. package/dist/mi-route-instructions-step-legacy.entry.js +308 -0
  37. package/dist/mi-route-instructions-step.entry.js +321 -0
  38. package/dist/mi-route-instructions.entry.js +157 -0
  39. package/dist/mi-scroll-buttons.entry.js +112 -0
  40. package/dist/mi-search.entry.js +376 -0
  41. package/dist/mi-share-sms.entry.js +80 -0
  42. package/dist/mi-step-switcher.entry.js +31 -0
  43. package/dist/mi-tab-panel.entry.js +25 -0
  44. package/dist/mi-tab.entry.js +12 -0
  45. package/dist/mi-tabs.entry.js +47 -0
  46. package/dist/mi-time.entry.js +57 -0
  47. package/dist/mi-variables-9a6c8d4d.js +6 -0
  48. package/dist/polyfills/core-js.js +11 -0
  49. package/dist/polyfills/css-shim.js +1 -0
  50. package/dist/polyfills/dom.js +79 -0
  51. package/dist/polyfills/es5-html-element.js +1 -0
  52. package/dist/polyfills/index.js +34 -0
  53. package/dist/polyfills/system.js +6 -0
  54. package/dist/{reactcomponent-7fbbd9b2.mjs → reactcomponent-DTepe7hB.mjs} +14121 -14626
  55. package/dist/route-travel-mode.enum-7f4ce9c7.js +9 -0
  56. package/dist/sort-order.enum-64ce8998.js +552 -0
  57. package/dist/unit-system.enum-eaefb53e.js +7 -0
  58. package/dist/utils-ae714467.js +61 -0
  59. package/package.json +10 -6
  60. package/dist/MapboxMap-06ef82a3.mjs +0 -37815
  61. package/dist/_commonjsHelpers-ba3f0406-b96e6d6a.mjs +0 -22
  62. package/dist/combo-box-item.entry-d35f3d51.mjs +0 -15
  63. package/dist/icon-b8d01d6f-ddfa2c17.mjs +0 -25
  64. package/dist/mapsindoors-webcomponent.umd.js +0 -3245
  65. package/dist/mi-card_2.entry-fc772c35.mjs +0 -26
  66. package/dist/mi-chip.entry-81c742a1.mjs +0 -19
  67. package/dist/mi-column.entry-3a083282.mjs +0 -21
  68. package/dist/mi-combo-box.entry-cae6401a.mjs +0 -263
  69. package/dist/mi-data-table.entry-d4c3f445.mjs +0 -224
  70. package/dist/mi-distance_2.entry-a33ed69a.mjs +0 -339
  71. package/dist/mi-dropdown-item.entry-974d1e4f.mjs +0 -15
  72. package/dist/mi-dropdown.entry-5317db65.mjs +0 -349
  73. package/dist/mi-floor-selector.entry-185fbd8b.mjs +0 -115
  74. package/dist/mi-keyboard.entry-eaf4b9ef.mjs +0 -3103
  75. package/dist/mi-list-item-category.entry-9c95008c.mjs +0 -39
  76. package/dist/mi-list-item-location.entry-8b41e8f0.mjs +0 -137
  77. package/dist/mi-list.entry-1218d29d.mjs +0 -42
  78. package/dist/mi-location-booking.entry-270aaf5a.mjs +0 -4866
  79. package/dist/mi-location-info.entry-e4f7fd04.mjs +0 -32
  80. package/dist/mi-map-googlemaps.entry-81fa28d2.mjs +0 -467
  81. package/dist/mi-map-mapbox.entry-31821da3.mjs +0 -301
  82. package/dist/mi-metric-card.entry-40407f04.mjs +0 -29
  83. package/dist/mi-my-position.entry-bc48fe6e.mjs +0 -703
  84. package/dist/mi-notification.entry-9a2bc53b.mjs +0 -84
  85. package/dist/mi-route-instructions-heading.entry-e5b1ff04.mjs +0 -75
  86. package/dist/mi-route-instructions-maneuver-legacy.entry-2c3d73ab.mjs +0 -76
  87. package/dist/mi-route-instructions-maneuver.entry-c6f01024.mjs +0 -76
  88. package/dist/mi-route-instructions-step-legacy.entry-80bcf097.mjs +0 -202
  89. package/dist/mi-route-instructions-step.entry-db802e13.mjs +0 -231
  90. package/dist/mi-route-instructions.entry-62416e29.mjs +0 -143
  91. package/dist/mi-scroll-buttons.entry-92b62b21.mjs +0 -83
  92. package/dist/mi-search.entry-87f1e64a.mjs +0 -251
  93. package/dist/mi-share-sms.entry-b6725edb.mjs +0 -56
  94. package/dist/mi-step-switcher.entry-f8f6c040.mjs +0 -27
  95. package/dist/mi-tab-panel.entry-a89213c2.mjs +0 -22
  96. package/dist/mi-tab.entry-a2fb3f8c.mjs +0 -14
  97. package/dist/mi-tabs.entry-cd638ea7.mjs +0 -37
  98. package/dist/mi-time.entry-0b02870d.mjs +0 -46
  99. package/dist/mi-variables-9a6c8d4d-e06eec88.mjs +0 -8
  100. package/dist/route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs +0 -8
  101. package/dist/sort-order.enum-64ce8998-b75ac596.mjs +0 -318
  102. package/dist/unit-system.enum-eaefb53e-0f424da4.mjs +0 -8
  103. package/dist/utils-ae714467-b07fc3be.mjs +0 -37
@@ -0,0 +1,157 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-7e9696f3.js';
2
+ import { R as RouteTravelMode } from './route-travel-mode.enum-7f4ce9c7.js';
3
+ import { U as UnitSystem } from './unit-system.enum-eaefb53e.js';
4
+ import { c as isInternetExplorer } from './utils-ae714467.js';
5
+
6
+ const routeInstructionsCss = ":host{display:block;background-color:#fcfcfc;font-family:Figtree, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}:host mi-route-instructions-step:hover{cursor:pointer;background-color:#f9fafb;transition:300ms ease}:host mi-route-instructions-step.active{background-color:#f3f4f6;transition:none;cursor:default}:host .instructions-destination{display:flex}:host .instructions-destination-icon{width:40px;display:flex;justify-content:center;align-items:center}:host .instructions-destination-icon mi-icon{width:24px;height:24px;background-color:#1c1917}:host .instructions-destination-details{flex:1;padding:12px}:host .instructions-destination-details mi-location-info{font-size:0.875rem}";
7
+
8
+ const RouteInstructions = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ this.clicked = createEvent(this, "clicked", 7);
12
+ this.miStepElements = [];
13
+ this.lastStepRouteContext = null;
14
+ this.lastStepTravelMode = null;
15
+ this.lastStepTransitStop = null;
16
+ this.activeStep = {
17
+ legIndex: 0,
18
+ stepIndex: 0
19
+ };
20
+ this.unit = UnitSystem.Metric;
21
+ this.route = undefined;
22
+ this.hideIndoorSubsteps = false;
23
+ this.travelMode = RouteTravelMode.Walking;
24
+ this.originLocation = undefined;
25
+ this.originName = undefined;
26
+ this.destinationLocation = undefined;
27
+ this.destinationName = undefined;
28
+ this.translations = {
29
+ walk: 'Walk',
30
+ bike: 'Bike',
31
+ transit: 'Transit',
32
+ drive: 'Drive',
33
+ leave: 'Leave',
34
+ from: 'From',
35
+ park: 'Park',
36
+ at: 'at',
37
+ building: 'Building',
38
+ venue: 'Venue',
39
+ takeStaircaseToLevel: 'Take staircase to level',
40
+ takeLadderToLevel: 'Take the ladder to level',
41
+ takeElevatorToLevel: 'Take elevator to level',
42
+ takeEscalatorToLevel: 'Take escalator to level',
43
+ takeWheelchairLiftToLevel: 'Take wheelchair lift to level',
44
+ takeWheelchairRampToLevel: 'Take wheelchair ramp to level',
45
+ exit: 'Exit',
46
+ enter: 'Enter',
47
+ stops: 'stops',
48
+ andContinue: 'and continue',
49
+ continueStraightAhead: 'Continue straight ahead',
50
+ goLeft: 'Go left',
51
+ goSharpLeft: 'Go sharp left',
52
+ goSlightLeft: 'Go slight left',
53
+ goRight: 'Go right',
54
+ goSharpRight: 'Go sharp right',
55
+ goSlightRight: 'Go slight right',
56
+ turnAround: 'Turn around',
57
+ days: 'd',
58
+ hours: 'h',
59
+ minutes: 'min',
60
+ rideTheBus: 'Ride the bus'
61
+ };
62
+ }
63
+ componentDidRender() {
64
+ this.miStepElements.forEach((element) => {
65
+ element.hideIndoorSubsteps = this.hideIndoorSubsteps;
66
+ });
67
+ }
68
+ /**
69
+ * Transform the step in legs to a flat array of steps.
70
+ *
71
+ * @returns {Step[]}
72
+ */
73
+ getRouteSteps() {
74
+ if (!this.route) {
75
+ return [];
76
+ }
77
+ return this.route.legs.reduce((accummulator, leg, legIndex) => {
78
+ for (const stepIndex in leg.steps) {
79
+ const step = leg.steps[stepIndex];
80
+ step.originalLegIndex = legIndex;
81
+ step.originalStepIndex = parseInt(stepIndex);
82
+ accummulator.push(step);
83
+ }
84
+ return accummulator;
85
+ }, []);
86
+ }
87
+ /**
88
+ * Updates the activeStep attribute and emits an object with leg, step and maneuver index information.
89
+ *
90
+ * @param {CustomEvent<any>} event Step object.
91
+ * @param {number} stepIndex step index.
92
+ */
93
+ stepClickedHandler(event, stepIndex) {
94
+ const originalStep = this.getRouteSteps()[stepIndex];
95
+ // Update activeStep attribute
96
+ this.activeStep = {
97
+ legIndex: originalStep.originalLegIndex,
98
+ stepIndex: originalStep.originalStepIndex
99
+ };
100
+ this.clicked.emit({
101
+ legIndex: originalStep.originalLegIndex,
102
+ stepIndex: originalStep.originalStepIndex,
103
+ maneuverIndex: event.detail.maneuverIndex
104
+ });
105
+ }
106
+ /**
107
+ * Check if the step is active.
108
+ *
109
+ * @param {Step} step
110
+ * @returns {boolean}
111
+ */
112
+ isActiveStep(step) {
113
+ // Check that activeStep attribute is set
114
+ if (!this.activeStep)
115
+ return false;
116
+ // Check that the indexes matches those set at the activeStep attribute
117
+ const isActiveStep = this.activeStep.legIndex === step.originalLegIndex &&
118
+ this.activeStep.stepIndex === step.originalStepIndex;
119
+ return isActiveStep;
120
+ }
121
+ render() {
122
+ return this.route ? this.renderInstructions() : null;
123
+ }
124
+ /**
125
+ * Render instructions.
126
+ *
127
+ * @returns {JSX.Element}
128
+ */
129
+ renderInstructions() {
130
+ return (h(Host, null, this.getRouteSteps().map((currentStep, stepIndex) => {
131
+ var _a, _b, _c, _d, _e;
132
+ const originName = ((_b = (_a = this.originLocation) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.name) ? this.originLocation.properties.name : this.originName || '';
133
+ const isFirstRouteStep = currentStep.originalLegIndex === 0 && currentStep.originalStepIndex === 0;
134
+ const lastStepRouteContext = isFirstRouteStep ? originName : this.lastStepRouteContext;
135
+ const lastTravelMode = this.lastStepTravelMode;
136
+ const lastTransitStop = this.lastStepTransitStop;
137
+ this.lastStepRouteContext = currentStep.route_context;
138
+ this.lastStepTravelMode = currentStep.travel_mode;
139
+ this.lastStepTransitStop = ((_d = (_c = currentStep.transit_information) === null || _c === void 0 ? void 0 : _c.arrival_stop) === null || _d === void 0 ? void 0 : _d.name) ? (_e = currentStep.transit_information) === null || _e === void 0 ? void 0 : _e.arrival_stop.name : null;
140
+ return h("mi-route-instructions-step-legacy", { ref: (el) => this.miStepElements.push(el), "from-travel-mode": lastTravelMode, "from-route-context": lastStepRouteContext, "from-transit-stop": lastTransitStop, step: JSON.stringify(currentStep), translations: JSON.stringify(this.translations), unit: this.unit, onStepClicked: (event) => this.stepClickedHandler(event, stepIndex), class: this.isActiveStep(currentStep) ? 'active' : '', part: this.isActiveStep(currentStep) ? 'step active' : 'step',
141
+ // @ts-ignore
142
+ exportparts: "\n step-toggle,\n step-heading,\n step-description,\n step-info,\n step-travel-mode,\n step-travel-mode-icon,\n maneuver-icon,\n maneuver-description,\n maneuver-description-distance,\n maneuver-description-distance-border" });
143
+ }), this.destinationLocation || this.destinationName ? this.renderDestination() : null));
144
+ }
145
+ /**
146
+ * Render destination.
147
+ *
148
+ * @returns {JSX.Element}
149
+ */
150
+ renderDestination() {
151
+ return (h("div", { class: "instructions-destination" }, h("div", { class: "instructions-destination-icon" }, isInternetExplorer() ? null :
152
+ h("mi-icon", { "icon-name": "marker" })), h("div", { part: "instructions-destination", class: "instructions-destination-details" }, this.destinationLocation ? this.destinationLocation.properties.name : this.destinationName, this.destinationLocation ? h("mi-location-info", { part: "instructions-destination-info", location: this.destinationLocation }) : null)));
153
+ }
154
+ };
155
+ RouteInstructions.style = routeInstructionsCss;
156
+
157
+ export { RouteInstructions as mi_route_instructions };
@@ -0,0 +1,112 @@
1
+ import { r as registerInstance, h } from './index-7e9696f3.js';
2
+
3
+ const scrollButtonsCss = "a.mi-button{cursor:default}.mi-button{border-radius:4px;border-width:1px;border-style:solid;font-family:Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;font-weight:500;padding-left:16px;padding-right:16px;padding-top:12px;padding-bottom:12px;display:inline-flex;align-items:center}.mi-button:disabled{opacity:0.48;cursor:not-allowed}.mi-button object{filter:invert(9%) sepia(13%) saturate(692%) hue-rotate(185deg) brightness(98%) contrast(91%);width:16px;height:16px}.mi-button--small{padding-left:12px;padding-right:12px;padding-top:8px;padding-bottom:8px;font-size:0.875rem;height:32px}.mi-button--small object{width:16px;height:16px}.mi-button--large{padding-left:16px;padding-right:16px;font-size:1.25rem}.mi-button--large object{width:20px;height:20px}.mi-button--full-width{width:100%;justify-content:center}.mi-button--icon-left{padding-left:12px}.mi-button--icon-left object{margin-right:8px}.mi-button--icon-right{padding-right:12px}.mi-button--icon-right object{margin-left:8px}.mi-button--icon-both{padding-top:12px;padding-bottom:12px}.mi-button--icon-both object:first-of-type{margin-right:8px}.mi-button--icon-both object:last-of-type{margin-left:8px}.mi-button--base{background:linear-gradient(#f5f7fa, #ebeff5);color:#1e2025;border-color:#c8d0e0}.mi-button--base:not(:disabled):hover{background:linear-gradient(#ebeff5, #dee3ed);border-color:#aeb9cb}.mi-button--base:not(:disabled):active{background:linear-gradient(#dee3ed, #ebeff5)}.mi-button--primary{color:#ffffff;border-color:#20693e;background:linear-gradient(#3ba064, #2a844e)}.mi-button--primary object{filter:invert(100%) sepia(93%) saturate(0%) hue-rotate(201deg) brightness(106%) contrast(106%)}.mi-button--primary:not(:disabled):hover{background:linear-gradient(#2a844e, #20693e)}.mi-button--primary:not(:disabled):active{background:linear-gradient(#20693e, #2a844e)}.mi-button--delete{background:linear-gradient(#f55151, #de1b1b);color:#ffffff;border-color:#ba0d0d}.mi-button--delete object{filter:invert(100%) sepia(93%) saturate(0%) hue-rotate(201deg) brightness(106%) contrast(106%)}.mi-button--delete:not(:disabled):hover{background:linear-gradient(#de1b1b, #ba0d0d)}.mi-button--delete:not(:disabled):active{background:linear-gradient(#ba0d0d, #de1b1b)}.mi-button--outline{color:#3071d9;border-color:#3071d9;background-color:transparent}.mi-button--outline object{filter:invert(38%) sepia(97%) saturate(742%) hue-rotate(188deg) brightness(86%) contrast(97%)}.mi-button--outline:not(:disabled):hover{color:#1d5bbf;border-color:#1d5bbf;background-color:#eef4fc}.mi-button--outline:not(:disabled):active{color:#1d5bbf;border-color:#1d5bbf;background-color:#cfe0fc}.mi-button--link{color:#3071d9;border-style:none;background-color:transparent;cursor:pointer}.mi-button--link object{filter:invert(38%) sepia(97%) saturate(742%) hue-rotate(188deg) brightness(86%) contrast(97%)}.mi-button--link:not(:disabled):hover{color:#1d5bbf;border-color:#1d5bbf;background-color:#eef4fc}.mi-button--link:disabled:hover{cursor:not-allowed}.mi-button--link:not(:disabled):active{color:#1d5bbf;border-color:#1d5bbf;background-color:#cfe0fc}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}.scroll-buttons{height:100%;width:64px;display:flex;flex-direction:column;align-items:center;justify-content:center;row-gap:16px}.scroll-buttons .btn{margin:0;padding:0;background:none;width:64px;height:64px;background-color:#ffffff;border:none;border-radius:8px;display:flex;align-items:center;justify-content:center}.scroll-buttons .btn mi-icon{width:32px}.scroll-buttons .btn:hover{background:none;background-color:#ffffff;cursor:pointer}.scroll-buttons .btn:disabled{opacity:1}.scroll-buttons .btn:disabled mi-icon{background-color:#a5a9af}";
4
+
5
+ const ScrollButtons = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.scrollContainerElementRef = undefined;
9
+ this.scrollLength = 100;
10
+ }
11
+ /**
12
+ * Update scroll buttons enabled/disabled states.
13
+ */
14
+ async updateScrollButtons() {
15
+ this.updateScrollButtonsState();
16
+ }
17
+ /**
18
+ * Watch for container scroll events.
19
+ */
20
+ addScrollEventListener() {
21
+ var _a, _b;
22
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
23
+ (_b = this.scrollContainerElementRef) === null || _b === void 0 ? void 0 : _b.addEventListener('scroll', () => {
24
+ this.updateScrollButtonsState();
25
+ });
26
+ if (this.scrollContainerElementRef) {
27
+ // Setup a ResizeObserver to update scroll buttons state whenever the dimensions of the scroll container changes.
28
+ this.resizeObserver = new ResizeObserver(() => {
29
+ this.updateScrollButtonsState();
30
+ });
31
+ this.resizeObserver.observe(this.scrollContainerElementRef);
32
+ }
33
+ }
34
+ /**
35
+ * Adds scroll event listener to the container element when this component is first attached to the DOM.
36
+ */
37
+ connectedCallback() {
38
+ this.addScrollEventListener();
39
+ }
40
+ /**
41
+ * Disconnects ResizeObserver.
42
+ */
43
+ disconnectedCallback() {
44
+ var _a;
45
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
46
+ }
47
+ /**
48
+ * Updates enable/disable state for scroll up and down buttons.
49
+ *
50
+ * @returns {Promise<void>}
51
+ */
52
+ async updateScrollButtonsState() {
53
+ // Disable or enable the scroll up button
54
+ if (this.scrollContainerElementRef.scrollTop === 0) {
55
+ this.upButtonElement.disabled = true;
56
+ }
57
+ else if (this.upButtonElement.disabled) {
58
+ this.upButtonElement.disabled = false;
59
+ }
60
+ // Disable or enable the scroll down button
61
+ if (this.scrollContainerElementRef.scrollHeight - this.scrollContainerElementRef.scrollTop === this.scrollContainerElementRef.clientHeight
62
+ && this.upButtonElement.disabled === true) {
63
+ this.downButtonElement.disabled = true;
64
+ }
65
+ else if (this.scrollContainerElementRef.scrollHeight - this.scrollContainerElementRef.scrollTop > this.scrollContainerElementRef.clientHeight) {
66
+ this.downButtonElement.disabled = false;
67
+ }
68
+ else {
69
+ this.downButtonElement.disabled = true;
70
+ }
71
+ }
72
+ /**
73
+ * Update scroll position.
74
+ *
75
+ * @param {number} value - Value to scroll.
76
+ */
77
+ updateScrollPosition(value) {
78
+ if (!('scrollBehavior' in document.documentElement.style)) { // Internet Explorer feature check
79
+ this.scrollContainerElementRef.scrollTop = value;
80
+ }
81
+ else {
82
+ this.scrollContainerElementRef.scroll({
83
+ top: this.scrollContainerElementRef.scrollTop + value,
84
+ behavior: 'smooth'
85
+ });
86
+ }
87
+ }
88
+ /**
89
+ * Render scroll buttons.
90
+ *
91
+ * @returns {JSX.Element}
92
+ */
93
+ render() {
94
+ return (h("div", { part: "container", class: "scroll-buttons" }, h("button", { part: "button button-up", class: "mi-button mi-button--base btn btn-up", type: "button", disabled: true, "aria-label": "Scroll Up", ref: (el) => {
95
+ this.upButtonElement = el;
96
+ }, onClick: (event) => {
97
+ event.stopPropagation();
98
+ this.updateScrollPosition(-this.scrollLength);
99
+ } }, h("mi-icon", { "icon-name": "chevron-up" })), h("button", { part: "button button-down", class: "mi-button mi-button--base btn btn-down", type: "button", "aria-label": "Scroll Down", ref: (el) => {
100
+ this.downButtonElement = el;
101
+ }, onClick: (event) => {
102
+ event.stopPropagation();
103
+ this.updateScrollPosition(this.scrollLength);
104
+ } }, h("mi-icon", { "icon-name": "chevron-down" }))));
105
+ }
106
+ static get watchers() { return {
107
+ "scrollContainerElementRef": ["addScrollEventListener"]
108
+ }; }
109
+ };
110
+ ScrollButtons.style = scrollButtonsCss;
111
+
112
+ export { ScrollButtons as mi_scroll_buttons };
@@ -0,0 +1,376 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-7e9696f3.js';
2
+ import { c as createCommonjsModule, g as getDefaultExportFromCjs } from './_commonjsHelpers-ba3f0406.js';
3
+
4
+ var Debounce$1 = createCommonjsModule(function (module, exports) {
5
+
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports["default"] = outerDecorator;
10
+ exports.debounce = debounce;
11
+ var DEFAULT_DEBOUNCE_DURATION = 500;
12
+
13
+ exports.DEFAULT_DEBOUNCE_DURATION = DEFAULT_DEBOUNCE_DURATION;
14
+ /** Decorates a class method so that it is debounced by the specified duration */
15
+
16
+ function outerDecorator(duration) {
17
+ return function innerDecorator(target, key, descriptor) {
18
+ return {
19
+ configurable: true,
20
+ enumerable: descriptor.enumerable,
21
+ get: function getter() {
22
+ // Attach this function to the instance (not the class)
23
+ Object.defineProperty(this, key, {
24
+ configurable: true,
25
+ enumerable: descriptor.enumerable,
26
+ value: debounce(descriptor.value, duration)
27
+ });
28
+
29
+ return this[key];
30
+ }
31
+ };
32
+ };
33
+ }
34
+
35
+ /** Debounces the specified function and returns a wrapper function */
36
+
37
+ function debounce(method) {
38
+ var duration = arguments.length <= 1 || arguments[1] === undefined ? DEFAULT_DEBOUNCE_DURATION : arguments[1];
39
+
40
+ var timeoutId = undefined;
41
+
42
+ function debounceWrapper() {
43
+ var _this = this;
44
+
45
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
46
+ args[_key] = arguments[_key];
47
+ }
48
+
49
+ debounceWrapper.clear();
50
+
51
+ timeoutId = setTimeout(function () {
52
+ timeoutId = null;
53
+ method.apply(_this, args);
54
+ }, duration);
55
+ }
56
+
57
+ debounceWrapper.clear = function () {
58
+ if (timeoutId) {
59
+ clearTimeout(timeoutId);
60
+ timeoutId = null;
61
+ }
62
+ };
63
+
64
+ return debounceWrapper;
65
+ }
66
+ });
67
+
68
+ var dist = createCommonjsModule(function (module, exports) {
69
+
70
+ Object.defineProperty(exports, '__esModule', {
71
+ value: true
72
+ });
73
+
74
+ function _interopExportWildcard(obj, defaults) { var newObj = defaults({}, obj); delete newObj['default']; return newObj; }
75
+
76
+ function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
77
+
78
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
79
+
80
+
81
+
82
+ var _DebounceJs2 = _interopRequireDefault(Debounce$1);
83
+
84
+ exports['default'] = _DebounceJs2['default'];
85
+
86
+ _defaults(exports, _interopExportWildcard(Debounce$1, _defaults));
87
+ });
88
+
89
+ const Debounce = /*@__PURE__*/getDefaultExportFromCjs(dist);
90
+
91
+ const searchCss = "@charset \"UTF-8\";mi-search{display:block;position:relative;}mi-search input[type=search]{border-radius:8px;background-color:#ffffff;padding-left:2.5rem;min-height:3rem;height:auto;font-size:1rem;padding-right:2.5rem;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;position:relative;background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMS43MSAxMUgxMi41TDE3LjQ5IDE2TDE2IDE3LjQ5TDExIDEyLjVWMTEuNzFMMTAuNzMgMTEuNDNDOS41OSAxMi40MSA4LjExIDEzIDYuNSAxM0MyLjkxIDEzIDAgMTAuMDkgMCA2LjVDMCAyLjkxIDIuOTEgMCA2LjUgMEMxMC4wOSAwIDEzIDIuOTEgMTMgNi41QzEzIDguMTEgMTIuNDEgOS41OSAxMS40MyAxMC43M0wxMS43MSAxMVpNMiA2LjVDMiA4Ljk5IDQuMDEgMTEgNi41IDExQzguOTkgMTEgMTEgOC45OSAxMSA2LjVDMTEgNC4wMSA4Ljk5IDIgNi41IDJDNC4wMSAyIDIgNC4wMSAyIDYuNVoiIGZpbGw9IiM4RDk4QUEiLz4KPC9zdmc+Cg==\");background-repeat:no-repeat;background-position:1rem center;background-size:1.125rem 1.125rem;border-color:#E6E6E6;color:var(--tailwind-colors-neutral-500);border:1px solid var(--tailwind-colors-gray-200)}mi-search input[type=search]:-moz-placeholder-shown{padding-right:0.875rem}mi-search input[type=search]:placeholder-shown{padding-right:0.875rem}mi-search input[type=search]:focus{border-color:#3b82f6;box-shadow:0 0 0 2px #cfe0fc;}mi-search input[type=search][disabled]{pointer-events:none}mi-search input::-webkit-search-cancel-button{-webkit-appearance:none}mi-search input::-ms-clear{display:none}mi-search input::-moz-search-clear-button{-moz-appearance:none}mi-search button{position:absolute;right:0.875rem;top:50%;transform:translateY(-50%);width:1.25rem;height:1.25rem;background-color:#6b7280;border-radius:50%;padding:0;border-width:0;display:flex;align-items:center;justify-content:center}mi-search button:focus{outline:0}mi-search button svg{fill:white;width:0.625rem;height:0.625rem}";
92
+
93
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
94
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
95
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
96
+ r = Reflect.decorate(decorators, target, key, desc);
97
+ else
98
+ for (var i = decorators.length - 1; i >= 0; i--)
99
+ if (d = decorators[i])
100
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
101
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
102
+ };
103
+ const Search = class {
104
+ constructor(hostRef) {
105
+ registerInstance(this, hostRef);
106
+ this.results = createEvent(this, "results", 7);
107
+ this.cleared = createEvent(this, "cleared", 7);
108
+ this.componentRendered = createEvent(this, "componentRendered", 7);
109
+ this.shortInput = createEvent(this, "shortInput", 7);
110
+ this.changed = createEvent(this, "changed", 7);
111
+ /**
112
+ * Sets the prevention of the search.
113
+ */
114
+ this.preventSearch = false;
115
+ this.placeholder = '';
116
+ this.idAttribute = '';
117
+ this.dataAttributes = {};
118
+ this.mapsindoors = false;
119
+ this.google = false;
120
+ this.mapbox = false;
121
+ this.language = 'en';
122
+ this.miFields = 'name,description,aliases,categories,externalId';
123
+ this.miTake = undefined;
124
+ this.miSkip = undefined;
125
+ this.miOrder = undefined;
126
+ this.miCategories = undefined;
127
+ this.miNear = undefined;
128
+ this.miVenue = undefined;
129
+ this.gmCountryCode = undefined;
130
+ this.value = undefined;
131
+ this.disabled = false;
132
+ this.sessionToken = undefined;
133
+ this.userPosition = undefined;
134
+ }
135
+ valueChange(newValue) {
136
+ if (!newValue || !this.inputElement) {
137
+ return;
138
+ }
139
+ if (newValue !== this.inputElement.value) {
140
+ // If newValue is different from what is in the input element, we know it's set from outside the component.
141
+ this.inputElement.value = newValue;
142
+ if (!this.preventSearch) {
143
+ this.inputChanged();
144
+ }
145
+ }
146
+ }
147
+ /**
148
+ * Clear the input field.
149
+ */
150
+ async clear() {
151
+ this.inputElement.value = '';
152
+ this.value = '';
153
+ this.lastRequested = null;
154
+ this.cleared.emit();
155
+ }
156
+ /**
157
+ * Programmatically trigger the search.
158
+ */
159
+ triggerSearch() {
160
+ const inputValue = this.inputElement.value;
161
+ this.search(inputValue);
162
+ }
163
+ /**
164
+ * Sets text to be shown in the search field.
165
+ * Setting it will not perform a search.
166
+ */
167
+ setDisplayText(displayText) {
168
+ this.preventSearch = true;
169
+ this.inputElement.value = displayText;
170
+ this.value = displayText;
171
+ this.preventSearch = false;
172
+ }
173
+ /**
174
+ * Set focus on the input field.
175
+ * The preventScroll boolean is passed as true to prevent the browser
176
+ * from scrolling the document to bring the newly-focused element into view.
177
+ */
178
+ focusInput() {
179
+ this.inputElement.focus({ preventScroll: true });
180
+ }
181
+ /**
182
+ * Get hold of the search input field.
183
+ */
184
+ async getInputField() {
185
+ return this.inputElement;
186
+ }
187
+ /**
188
+ * Perform the search.
189
+ */
190
+ search(inputValue) {
191
+ Promise.all([
192
+ this.makeMapsIndoorsQuery(inputValue),
193
+ this.makeGooglePlacesQuery(inputValue),
194
+ this.getMapboxSearchResults(inputValue),
195
+ ])
196
+ .then(results => {
197
+ this.lastRequested = inputValue;
198
+ if (this.google) {
199
+ this.pushResults(results[0].concat(results[1]));
200
+ }
201
+ else if (this.mapbox && mapboxgl.accessToken) {
202
+ this.pushResults(results[0].concat(results[2]));
203
+ }
204
+ else {
205
+ this.pushResults(results[0]);
206
+ }
207
+ });
208
+ }
209
+ /**
210
+ * Handles incoming input change event, eg. input field value has changed.
211
+ * The function is debounced 500ms to avoid firing too many requests while typing.
212
+ */
213
+ inputChanged() {
214
+ const inputValue = this.inputElement.value;
215
+ this.value = inputValue; // reflect on value attribute
216
+ if (!this.preventSearch) {
217
+ if (inputValue.length < 2) {
218
+ this.lastRequested = null;
219
+ if (inputValue.length === 1) {
220
+ this.shortInput.emit();
221
+ }
222
+ else {
223
+ this.clear();
224
+ }
225
+ return;
226
+ }
227
+ if (inputValue.length > 1 && inputValue !== this.lastRequested) {
228
+ this.search(inputValue);
229
+ }
230
+ this.changed.emit();
231
+ }
232
+ }
233
+ /**
234
+ * Push the results via the results event.
235
+ * @param object[] Locations
236
+ */
237
+ pushResults(locations) {
238
+ this.results.emit(locations);
239
+ }
240
+ /**
241
+ * Make MapsIndoors locations request based on given search query.
242
+ * @param {string} query
243
+ * @return {Promise<any[]>}
244
+ */
245
+ makeMapsIndoorsQuery(query) {
246
+ if (!this.mapsindoors) {
247
+ return Promise.resolve([]);
248
+ }
249
+ // Transform miNear string attribute to object if it matches a latlng
250
+ let miNear;
251
+ if (this.miNear) {
252
+ miNear = this.miNear;
253
+ if (/^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$/.test(this.miNear)) {
254
+ const near = this.miNear.split(',');
255
+ miNear = { lat: parseFloat(near[0]), lng: parseFloat(near[1]) };
256
+ }
257
+ }
258
+ return mapsindoors.services.LocationsService.getLocations({
259
+ q: query.trim(),
260
+ fields: this.miFields,
261
+ take: this.miTake,
262
+ skip: this.miSkip,
263
+ orderBy: this.miOrder,
264
+ near: miNear,
265
+ venue: this.miVenue,
266
+ categories: this.miCategories
267
+ });
268
+ }
269
+ /**
270
+ * Make Google Places autocomplete suggestion request.
271
+ *
272
+ * @param {string} query
273
+ * @return {Promise<any>}
274
+ */
275
+ makeGooglePlacesQuery(query) {
276
+ if (this.google) {
277
+ if (!this.googleAutocompleteService) {
278
+ this.googleAutocompleteService = new google.maps.places.AutocompleteService();
279
+ }
280
+ }
281
+ else {
282
+ this.googleAutocompleteService = null;
283
+ }
284
+ if (!this.googleAutocompleteService) {
285
+ return Promise.resolve([]);
286
+ }
287
+ return new Promise((resolve) => {
288
+ const params = {
289
+ input: query,
290
+ language: this.language
291
+ };
292
+ if (this.gmCountryCode) {
293
+ params.componentRestrictions = { country: this.gmCountryCode };
294
+ }
295
+ this.googleAutocompleteService.getPlacePredictions(params, (results) => {
296
+ const places = (results || []).map((result) => ({
297
+ id: result.place_id,
298
+ type: 'Feature',
299
+ properties: {
300
+ type: 'google_places',
301
+ placeId: result.place_id,
302
+ name: result.structured_formatting.main_text,
303
+ subtitle: result.structured_formatting.secondary_text || '',
304
+ floor: 0
305
+ }
306
+ }));
307
+ resolve(places);
308
+ });
309
+ });
310
+ }
311
+ /**
312
+ * Get Mapbox Places results.
313
+ *
314
+ * @param {string} query
315
+ * @return {Promise<any>}
316
+ */
317
+ getMapboxSearchResults(query) {
318
+ if (this.mapbox && mapboxgl.accessToken) {
319
+ if (query) {
320
+ return new Promise((resolve) => {
321
+ const language = this.language.split('-')[0]; // Mapbox seemingly only supports the primary language subtag.
322
+ let url = `https://api.mapbox.com/search/searchbox/v1/suggest?q=${query}&session_token=${this.sessionToken}&access_token=${mapboxgl.accessToken}&language=${language}`;
323
+ if (this.userPosition) {
324
+ url = url.concat(`&proximity=${this.userPosition}`);
325
+ }
326
+ fetch(url)
327
+ .then((response) => {
328
+ return response.json();
329
+ })
330
+ .then((result) => {
331
+ const places = result.suggestions.map((result) => ({
332
+ id: result.mapbox_id,
333
+ type: 'Feature',
334
+ properties: {
335
+ type: 'mapbox_places',
336
+ placeId: result.mapbox_id,
337
+ name: result.name,
338
+ subtitle: result.place_formatted || '',
339
+ floor: 0
340
+ }
341
+ }));
342
+ resolve(places);
343
+ })
344
+ .catch(() => {
345
+ resolve([]);
346
+ });
347
+ });
348
+ }
349
+ }
350
+ else {
351
+ return Promise.resolve([]);
352
+ }
353
+ }
354
+ componentDidRender() {
355
+ if (this.dataAttributes) {
356
+ for (const key in this.dataAttributes) {
357
+ this.inputElement.setAttribute(key, this.dataAttributes[key]);
358
+ }
359
+ }
360
+ this.componentRendered.emit();
361
+ }
362
+ render() {
363
+ var _a;
364
+ return (h(Host, null, h("input", { disabled: this.disabled, id: this.idAttribute ? this.idAttribute : null, type: "search", ref: (el) => this.inputElement = el, onInput: () => this.inputChanged(), placeholder: this.placeholder, autocomplete: "off" }), ((_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value) &&
365
+ h("button", { type: "button", onClick: () => this.clear(), "aria-label": "Clear" }, h("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, 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" })))));
366
+ }
367
+ static get watchers() { return {
368
+ "value": ["valueChange"]
369
+ }; }
370
+ };
371
+ __decorate([
372
+ Debounce(500)
373
+ ], Search.prototype, "inputChanged", null);
374
+ Search.style = searchCss;
375
+
376
+ export { Search as mi_search };