@mapsindoors/map-template 1.95.1 → 1.95.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{GoogleMapsMap-C5n6Bgtp.mjs → GoogleMapsMap-Dkn60-_e.mjs} +2 -2
- package/dist/{MapboxMap-UCqzt1AC.mjs → MapboxMap-B1oo7IUm.mjs} +2 -2
- package/dist/_commonjsHelpers-B85MJLTf.js +5 -0
- package/dist/app-globals-DQuL1Twl.js +3 -0
- package/dist/combo-box-item.entry.js +8 -10
- package/dist/icon-DT_sDkmK.js +11 -0
- package/dist/index-BZQHyS7V.js +1701 -0
- package/dist/loader.js +7 -14
- package/dist/mapsindoors-react.es.js +1 -1
- package/dist/mapsindoors-react.umd.js +175 -175
- package/dist/mapsindoors-webcomponent.es.js +2916 -2904
- package/dist/mi-card_2.entry.js +23 -18
- package/dist/mi-chip.entry.js +25 -16
- package/dist/mi-column.entry.js +47 -23
- package/dist/mi-combo-box.entry.js +412 -379
- package/dist/mi-components.js +15 -12
- package/dist/mi-data-table.entry.js +298 -278
- package/dist/mi-distance_2.entry.js +58 -56
- package/dist/mi-dropdown-item.entry.js +8 -10
- package/dist/mi-dropdown.entry.js +525 -481
- package/dist/mi-floor-selector.entry.js +183 -180
- package/dist/mi-keyboard.entry.js +207 -186
- package/dist/mi-list-item-category.entry.js +44 -41
- package/dist/mi-list-item-location.entry.js +168 -162
- package/dist/mi-list.entry.js +56 -48
- package/dist/mi-location-booking.entry.js +320 -295
- package/dist/mi-location-info.entry.js +61 -53
- package/dist/mi-map-googlemaps.entry.js +369 -324
- package/dist/mi-map-mapbox.entry.js +502 -439
- package/dist/mi-metric-card.entry.js +50 -37
- package/dist/mi-my-position.entry.js +2341 -874
- package/dist/mi-notification.entry.js +112 -102
- package/dist/mi-route-instructions-heading.entry.js +70 -65
- package/dist/mi-route-instructions-maneuver-legacy.entry.js +80 -76
- package/dist/mi-route-instructions-maneuver.entry.js +80 -76
- package/dist/mi-route-instructions-step-legacy.entry.js +296 -282
- package/dist/mi-route-instructions-step.entry.js +313 -292
- package/dist/mi-route-instructions.entry.js +167 -150
- package/dist/mi-scroll-buttons.entry.js +104 -98
- package/dist/mi-search.entry.js +366 -325
- package/dist/mi-share-sms.entry.js +82 -70
- package/dist/mi-step-switcher.entry.js +34 -25
- package/dist/mi-tab-panel.entry.js +18 -18
- package/dist/mi-tab.entry.js +5 -7
- package/dist/mi-tabs.entry.js +42 -40
- package/dist/mi-time.entry.js +49 -49
- package/dist/mi-variables-CDNvnTkH.js +5 -0
- package/dist/{reactcomponent-DQsjxRIN.mjs → reactcomponent-2Oa1vSiK.mjs} +8996 -8660
- package/dist/route-travel-mode.enum-BvqP1fpw.js +9 -0
- package/dist/sort-order.enum-jsLAbYWg.js +566 -0
- package/dist/{unit-system.enum-eaefb53e.js → unit-system.enum-BwPgAWqL.js} +2 -2
- package/dist/utils-DNHzysQ6.js +61 -0
- package/package.json +1 -1
- package/dist/_commonjsHelpers-ba3f0406.js +0 -21
- package/dist/icon-b8d01d6f.js +0 -24
- package/dist/index-7e9696f3.js +0 -1678
- package/dist/mi-variables-9a6c8d4d.js +0 -6
- package/dist/polyfills/core-js.js +0 -11
- package/dist/polyfills/css-shim.js +0 -1
- package/dist/polyfills/dom.js +0 -79
- package/dist/polyfills/es5-html-element.js +0 -1
- package/dist/polyfills/index.js +0 -34
- package/dist/polyfills/system.js +0 -6
- package/dist/route-travel-mode.enum-7f4ce9c7.js +0 -9
- package/dist/sort-order.enum-64ce8998.js +0 -552
- package/dist/utils-ae714467.js +0 -61
|
@@ -1,157 +1,174 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-
|
|
2
|
-
import { R as RouteTravelMode } from './route-travel-mode.enum-
|
|
3
|
-
import { U as UnitSystem } from './unit-system.enum-
|
|
4
|
-
import { c as isInternetExplorer } from './utils-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-BZQHyS7V.js';
|
|
2
|
+
import { R as RouteTravelMode } from './route-travel-mode.enum-BvqP1fpw.js';
|
|
3
|
+
import { U as UnitSystem } from './unit-system.enum-BwPgAWqL.js';
|
|
4
|
+
import { c as isInternetExplorer } from './utils-DNHzysQ6.js';
|
|
5
5
|
|
|
6
|
-
const routeInstructionsCss =
|
|
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
7
|
|
|
8
8
|
const RouteInstructions = class {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.clicked = createEvent(this, "clicked", 7);
|
|
12
|
+
/**
|
|
13
|
+
* Set active step to populate it with an "active" class. Defaults to legIndex 0 and stepIndex 0.
|
|
14
|
+
* @type {{ legIndex: number, stepIndex: number }}
|
|
15
|
+
*/
|
|
16
|
+
this.activeStep = {
|
|
17
|
+
legIndex: 0,
|
|
18
|
+
stepIndex: 0
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Set imperial or metric as default unit system.
|
|
22
|
+
* @type {UnitSystem} 'imperial' or 'metric'
|
|
23
|
+
*/
|
|
24
|
+
this.unit = UnitSystem.Metric;
|
|
25
|
+
/**
|
|
26
|
+
* If indoor substeps/maneuvers should be hidden.
|
|
27
|
+
*
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
*/
|
|
30
|
+
this.hideIndoorSubsteps = false;
|
|
31
|
+
/**
|
|
32
|
+
* Set preferred travel mode. Defaults to "walking".
|
|
33
|
+
*
|
|
34
|
+
* @type {RouteTravelMode} 'walking', 'bicycling', 'transit', 'driving'.
|
|
35
|
+
*/
|
|
36
|
+
this.travelMode = RouteTravelMode.Walking;
|
|
37
|
+
/**
|
|
38
|
+
* Translations object for translatable labels.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
this.translations = {
|
|
42
|
+
walk: 'Walk',
|
|
43
|
+
bike: 'Bike',
|
|
44
|
+
transit: 'Transit',
|
|
45
|
+
drive: 'Drive',
|
|
46
|
+
leave: 'Leave',
|
|
47
|
+
from: 'From',
|
|
48
|
+
park: 'Park',
|
|
49
|
+
at: 'at',
|
|
50
|
+
building: 'Building',
|
|
51
|
+
venue: 'Venue',
|
|
52
|
+
takeStaircaseToLevel: 'Take staircase to level',
|
|
53
|
+
takeLadderToLevel: 'Take the ladder to level',
|
|
54
|
+
takeElevatorToLevel: 'Take elevator to level',
|
|
55
|
+
takeEscalatorToLevel: 'Take escalator to level',
|
|
56
|
+
takeWheelchairLiftToLevel: 'Take wheelchair lift to level',
|
|
57
|
+
takeWheelchairRampToLevel: 'Take wheelchair ramp to level',
|
|
58
|
+
exit: 'Exit',
|
|
59
|
+
enter: 'Enter',
|
|
60
|
+
stops: 'stops',
|
|
61
|
+
andContinue: 'and continue',
|
|
62
|
+
continueStraightAhead: 'Continue straight ahead',
|
|
63
|
+
goLeft: 'Go left',
|
|
64
|
+
goSharpLeft: 'Go sharp left',
|
|
65
|
+
goSlightLeft: 'Go slight left',
|
|
66
|
+
goRight: 'Go right',
|
|
67
|
+
goSharpRight: 'Go sharp right',
|
|
68
|
+
goSlightRight: 'Go slight right',
|
|
69
|
+
turnAround: 'Turn around',
|
|
70
|
+
days: 'd',
|
|
71
|
+
hours: 'h',
|
|
72
|
+
minutes: 'min',
|
|
73
|
+
rideTheBus: 'Ride the bus'
|
|
74
|
+
};
|
|
75
|
+
this.miStepElements = [];
|
|
76
|
+
this.lastStepRouteContext = null;
|
|
77
|
+
this.lastStepTravelMode = null;
|
|
78
|
+
this.lastStepTransitStop = null;
|
|
79
|
+
}
|
|
80
|
+
componentDidRender() {
|
|
81
|
+
this.miStepElements.forEach((element) => {
|
|
82
|
+
element.hideIndoorSubsteps = this.hideIndoorSubsteps;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Transform the step in legs to a flat array of steps.
|
|
87
|
+
*
|
|
88
|
+
* @returns {Step[]}
|
|
89
|
+
*/
|
|
90
|
+
getRouteSteps() {
|
|
91
|
+
if (!this.route) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
return this.route.legs.reduce((accummulator, leg, legIndex) => {
|
|
95
|
+
for (const stepIndex in leg.steps) {
|
|
96
|
+
const step = leg.steps[stepIndex];
|
|
97
|
+
step.originalLegIndex = legIndex;
|
|
98
|
+
step.originalStepIndex = parseInt(stepIndex);
|
|
99
|
+
accummulator.push(step);
|
|
100
|
+
}
|
|
101
|
+
return accummulator;
|
|
102
|
+
}, []);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Updates the activeStep attribute and emits an object with leg, step and maneuver index information.
|
|
106
|
+
*
|
|
107
|
+
* @param {CustomEvent<any>} event Step object.
|
|
108
|
+
* @param {number} stepIndex step index.
|
|
109
|
+
*/
|
|
110
|
+
stepClickedHandler(event, stepIndex) {
|
|
111
|
+
const originalStep = this.getRouteSteps()[stepIndex];
|
|
112
|
+
// Update activeStep attribute
|
|
113
|
+
this.activeStep = {
|
|
114
|
+
legIndex: originalStep.originalLegIndex,
|
|
115
|
+
stepIndex: originalStep.originalStepIndex
|
|
116
|
+
};
|
|
117
|
+
this.clicked.emit({
|
|
118
|
+
legIndex: originalStep.originalLegIndex,
|
|
119
|
+
stepIndex: originalStep.originalStepIndex,
|
|
120
|
+
maneuverIndex: event.detail.maneuverIndex
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Check if the step is active.
|
|
125
|
+
*
|
|
126
|
+
* @param {Step} step
|
|
127
|
+
* @returns {boolean}
|
|
128
|
+
*/
|
|
129
|
+
isActiveStep(step) {
|
|
130
|
+
// Check that activeStep attribute is set
|
|
131
|
+
if (!this.activeStep)
|
|
132
|
+
return false;
|
|
133
|
+
// Check that the indexes matches those set at the activeStep attribute
|
|
134
|
+
const isActiveStep = this.activeStep.legIndex === step.originalLegIndex &&
|
|
135
|
+
this.activeStep.stepIndex === step.originalStepIndex;
|
|
136
|
+
return isActiveStep;
|
|
137
|
+
}
|
|
138
|
+
render() {
|
|
139
|
+
return this.route ? this.renderInstructions() : null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Render instructions.
|
|
143
|
+
*
|
|
144
|
+
* @returns {JSX.Element}
|
|
145
|
+
*/
|
|
146
|
+
renderInstructions() {
|
|
147
|
+
return (h(Host, null, this.getRouteSteps().map((currentStep, stepIndex) => {
|
|
148
|
+
var _a, _b, _c, _d, _e;
|
|
149
|
+
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 || '';
|
|
150
|
+
const isFirstRouteStep = currentStep.originalLegIndex === 0 && currentStep.originalStepIndex === 0;
|
|
151
|
+
const lastStepRouteContext = isFirstRouteStep ? originName : this.lastStepRouteContext;
|
|
152
|
+
const lastTravelMode = this.lastStepTravelMode;
|
|
153
|
+
const lastTransitStop = this.lastStepTransitStop;
|
|
154
|
+
this.lastStepRouteContext = currentStep.route_context;
|
|
155
|
+
this.lastStepTravelMode = currentStep.travel_mode;
|
|
156
|
+
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;
|
|
157
|
+
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',
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
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" });
|
|
160
|
+
}), this.destinationLocation || this.destinationName ? this.renderDestination() : null));
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Render destination.
|
|
164
|
+
*
|
|
165
|
+
* @returns {JSX.Element}
|
|
166
|
+
*/
|
|
167
|
+
renderDestination() {
|
|
168
|
+
return (h("div", { class: "instructions-destination" }, h("div", { class: "instructions-destination-icon" }, isInternetExplorer() ? null :
|
|
169
|
+
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)));
|
|
76
170
|
}
|
|
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
171
|
};
|
|
155
|
-
RouteInstructions.style = routeInstructionsCss;
|
|
172
|
+
RouteInstructions.style = routeInstructionsCss();
|
|
156
173
|
|
|
157
174
|
export { RouteInstructions as mi_route_instructions };
|
|
@@ -1,112 +1,118 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-
|
|
1
|
+
import { r as registerInstance, h } from './index-BZQHyS7V.js';
|
|
2
2
|
|
|
3
|
-
const scrollButtonsCss =
|
|
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
4
|
|
|
5
5
|
const ScrollButtons = class {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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);
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
/**
|
|
9
|
+
* Determines how far to scroll when clicking one of the buttons. Default value is 100.
|
|
10
|
+
*
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
this.scrollLength = 100;
|
|
32
14
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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;
|
|
15
|
+
/**
|
|
16
|
+
* Update scroll buttons enabled/disabled states.
|
|
17
|
+
*/
|
|
18
|
+
async updateScrollButtons() {
|
|
19
|
+
this.updateScrollButtonsState();
|
|
56
20
|
}
|
|
57
|
-
|
|
58
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Watch for container scroll events.
|
|
23
|
+
*/
|
|
24
|
+
addScrollEventListener() {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
27
|
+
(_b = this.scrollContainerElementRef) === null || _b === void 0 ? void 0 : _b.addEventListener('scroll', () => {
|
|
28
|
+
this.updateScrollButtonsState();
|
|
29
|
+
});
|
|
30
|
+
if (this.scrollContainerElementRef) {
|
|
31
|
+
// Setup a ResizeObserver to update scroll buttons state whenever the dimensions of the scroll container changes.
|
|
32
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
33
|
+
this.updateScrollButtonsState();
|
|
34
|
+
});
|
|
35
|
+
this.resizeObserver.observe(this.scrollContainerElementRef);
|
|
36
|
+
}
|
|
59
37
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Adds scroll event listener to the container element when this component is first attached to the DOM.
|
|
40
|
+
*/
|
|
41
|
+
connectedCallback() {
|
|
42
|
+
this.addScrollEventListener();
|
|
64
43
|
}
|
|
65
|
-
|
|
66
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Disconnects ResizeObserver.
|
|
46
|
+
*/
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
var _a;
|
|
49
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
67
50
|
}
|
|
68
|
-
|
|
69
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Updates enable/disable state for scroll up and down buttons.
|
|
53
|
+
*
|
|
54
|
+
* @returns {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
async updateScrollButtonsState() {
|
|
57
|
+
// Disable or enable the scroll up button
|
|
58
|
+
if (this.scrollContainerElementRef.scrollTop === 0) {
|
|
59
|
+
this.upButtonElement.disabled = true;
|
|
60
|
+
}
|
|
61
|
+
else if (this.upButtonElement.disabled) {
|
|
62
|
+
this.upButtonElement.disabled = false;
|
|
63
|
+
}
|
|
64
|
+
// Disable or enable the scroll down button
|
|
65
|
+
if (this.scrollContainerElementRef.scrollHeight - this.scrollContainerElementRef.scrollTop === this.scrollContainerElementRef.clientHeight
|
|
66
|
+
&& this.upButtonElement.disabled === true) {
|
|
67
|
+
this.downButtonElement.disabled = true;
|
|
68
|
+
}
|
|
69
|
+
else if (this.scrollContainerElementRef.scrollHeight - this.scrollContainerElementRef.scrollTop > this.scrollContainerElementRef.clientHeight) {
|
|
70
|
+
this.downButtonElement.disabled = false;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.downButtonElement.disabled = true;
|
|
74
|
+
}
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Update scroll position.
|
|
78
|
+
*
|
|
79
|
+
* @param {number} value - Value to scroll.
|
|
80
|
+
*/
|
|
81
|
+
updateScrollPosition(value) {
|
|
82
|
+
if (!('scrollBehavior' in document.documentElement.style)) { // Internet Explorer feature check
|
|
83
|
+
this.scrollContainerElementRef.scrollTop = value;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.scrollContainerElementRef.scroll({
|
|
87
|
+
top: this.scrollContainerElementRef.scrollTop + value,
|
|
88
|
+
behavior: 'smooth'
|
|
89
|
+
});
|
|
90
|
+
}
|
|
80
91
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Render scroll buttons.
|
|
94
|
+
*
|
|
95
|
+
* @returns {JSX.Element}
|
|
96
|
+
*/
|
|
97
|
+
render() {
|
|
98
|
+
return (h("div", { key: '6e7798e435c65cf6546e4d3b7a5caaae8fbc8593', part: "container", class: "scroll-buttons" }, h("button", { key: 'eb9f16636f24fbd9f5552363939841f318d0af9e', part: "button button-up", class: "mi-button mi-button--base btn btn-up", type: "button", disabled: true, "aria-label": "Scroll Up", ref: (el) => {
|
|
99
|
+
this.upButtonElement = el;
|
|
100
|
+
}, onClick: (event) => {
|
|
101
|
+
event.stopPropagation();
|
|
102
|
+
this.updateScrollPosition(-this.scrollLength);
|
|
103
|
+
} }, h("mi-icon", { key: 'a6fa66568854de9e1372242d64b1f1b6101cac2c', "icon-name": "chevron-up" })), h("button", { key: '14647752d65d98c1a7ede9dfd25241bde764e7bc', part: "button button-down", class: "mi-button mi-button--base btn btn-down", type: "button", "aria-label": "Scroll Down", ref: (el) => {
|
|
104
|
+
this.downButtonElement = el;
|
|
105
|
+
}, onClick: (event) => {
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
this.updateScrollPosition(this.scrollLength);
|
|
108
|
+
} }, h("mi-icon", { key: '7f4a95d3be41402bebfe4ee48ed7d2576dc10018', "icon-name": "chevron-down" }))));
|
|
86
109
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
}; }
|
|
110
|
+
static get watchers() { return {
|
|
111
|
+
"scrollContainerElementRef": [{
|
|
112
|
+
"addScrollEventListener": 0
|
|
113
|
+
}]
|
|
114
|
+
}; }
|
|
109
115
|
};
|
|
110
|
-
ScrollButtons.style = scrollButtonsCss;
|
|
116
|
+
ScrollButtons.style = scrollButtonsCss();
|
|
111
117
|
|
|
112
118
|
export { ScrollButtons as mi_scroll_buttons };
|