@opengeoweb/core 4.20.0 → 4.21.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 (19) hide show
  1. package/index.esm.js +237 -124
  2. package/index.umd.js +279 -165
  3. package/lib/components/TimeSliderLite/TimeSliderLite.d.ts +1 -0
  4. package/lib/components/TimeSliderLite/TimeSliderLiteBackground/TimeSliderLiteBackgroundSvg.d.ts +1 -0
  5. package/lib/components/TimeSliderLite/TimeSliderLiteButtons/ControlButtonGroup/ControlButtonGroup.d.ts +2 -2
  6. package/lib/components/TimeSliderLite/TimeSliderLiteButtons/PlayButton/PlayButton.d.ts +1 -0
  7. package/lib/components/TimeSliderLite/TimeSliderLiteButtons/StepButton/StepButton.d.ts +1 -0
  8. package/lib/components/TimeSliderLite/TimeSliderLiteConnect.d.ts +10 -2
  9. package/lib/components/TimeSliderLite/TimeSliderLiteOptionsMenu/SubmenuWrapper.d.ts +8 -0
  10. package/lib/components/TimeSliderLite/TimeSliderLiteOptionsMenu/TimeRangeOptions/DayHourSelector.d.ts +21 -0
  11. package/lib/components/TimeSliderLite/TimeSliderLiteOptionsMenu/TimeRangeOptions/DayHourSelector.spec.d.ts +1 -0
  12. package/lib/components/TimeSliderLite/TimeSliderLiteOptionsMenu/TimeRangeOptions/TimeRangeOptions.d.ts +15 -0
  13. package/lib/components/TimeSliderLite/TimeSliderLiteOptionsMenu/TimeSliderLiteOptionsMenu.d.ts +27 -0
  14. package/lib/components/TimeSliderLite/TimeSliderLiteOptionsMenu/TimeSliderLiteOptionsMenu.spec.d.ts +1 -0
  15. package/lib/components/TimeSliderLite/index.d.ts +2 -1
  16. package/lib/components/TimeSliderLite/timeSliderLiteUtils.d.ts +37 -1
  17. package/package.json +7 -7
  18. package/lib/components/LayerManager/LayerSelect/LayerList/SearchHighlight.d.ts +0 -7
  19. /package/lib/components/{LayerManager/LayerSelect/LayerList/SearchHighlight.spec.d.ts → TimeSliderLite/TimeSliderLiteOptionsMenu/SubmenuWrapper.spec.d.ts} +0 -0
package/index.esm.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createSlice, createSelector, createAction, createEntityAdapter } from '@reduxjs/toolkit';
2
- import _, { isEqual, debounce, compact, escapeRegExp, groupBy, throttle, range } from 'lodash';
2
+ import _, { isEqual, debounce, compact, groupBy, throttle, range } from 'lodash';
3
3
  import produce$1, { current, produce } from 'immer';
4
4
  import moment from 'moment';
5
5
  import * as React from 'react';
6
6
  import React__default, { Component, useRef, useState, useEffect, useCallback, useLayoutEffect } from 'react';
7
7
  import { takeLatest, put, select, call, takeEvery, all, delay } from 'redux-saga/effects';
8
8
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
9
- import { CustomIconButton, CustomTooltip, ToolContainerDraggable, TooltipSelect, AlertIcon, useControlledTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, CustomAccordion, AlertBanner, calculateDialogSizeAndPosition, CustomToggleButton, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
9
+ import { CustomIconButton, CustomTooltip, ToolContainerDraggable, TooltipSelect, AlertIcon, useControlledTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, CustomAccordion, AlertBanner, calculateDialogSizeAndPosition, CustomToggleButton, SearchHighlight, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
10
10
  import { Pause, Play, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Add, Copy, None, FastForward, AutoUpdateActive, Both, Visibility, VisibilityOff, Delete, DragHandle as DragHandle$1, Cached, Filter, Search, Clear, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Close, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateInActive, Speed, Clock, Now, Animation, Options, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ExitDomain, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
11
11
  import { Paper, Box, Typography, Grid, MenuItem, useTheme, Button, Popper, ListItemText, ListItemIcon, FormControl, InputLabel, List, ListItemButton, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, LinearProgress, Backdrop, ListItem, ListItemSecondaryAction, Checkbox, Switch, styled, Slider, Menu, Tooltip, IconButton, ButtonGroup, Divider, Snackbar } from '@mui/material';
12
12
  import { legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WMGetServiceFromStore, LayerType as LayerType$1, clearImageCache, getMapImageStore, WMBBOX, debug, DebugType, WMJSMap, WMLayer } from '@opengeoweb/webmap';
@@ -14664,43 +14664,6 @@ var sortByService = function sortByService(serviceObj) {
14664
14664
  }, {});
14665
14665
  };
14666
14666
 
14667
- var highlightStyle = {
14668
- background: '#ffeecc'
14669
- };
14670
-
14671
- var SearchHighlight = function SearchHighlight(_ref) {
14672
- var text = _ref.text,
14673
- search = _ref.search;
14674
-
14675
- if (search === '') {
14676
- return /*#__PURE__*/React__default.createElement("span", null, text);
14677
- }
14678
-
14679
- var searchWords = search.split(' ').reduce(function (words, word) {
14680
- return word ? [].concat(_toConsumableArray(words), [word.toLocaleLowerCase()]) : words;
14681
- }, []);
14682
- var searchRegex = searchWords.map(function (word) {
14683
- return escapeRegExp(word);
14684
- }).join('|');
14685
- var textParts = text.split(new RegExp("(".concat(searchRegex, ")"), 'gi'));
14686
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, textParts.map(function (part, index) {
14687
- var key = "".concat(part, "-").concat(index);
14688
-
14689
- if (searchWords.some(function (search) {
14690
- return part.toLocaleLowerCase().includes(search);
14691
- })) {
14692
- return /*#__PURE__*/React__default.createElement("mark", {
14693
- key: key,
14694
- style: highlightStyle
14695
- }, part);
14696
- }
14697
-
14698
- return /*#__PURE__*/React__default.createElement("span", {
14699
- key: key
14700
- }, part);
14701
- }));
14702
- };
14703
-
14704
14667
  /* *
14705
14668
  * Licensed under the Apache License, Version 2.0 (the "License");
14706
14669
  * you may not use this file except in compliance with the License.
@@ -26961,6 +26924,110 @@ var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
26961
26924
  });
26962
26925
  };
26963
26926
 
26927
+ var DAY_TO_MILLISECOND = 24 * 60 * 60 * 1000;
26928
+ var DAY_TO_SECOND = 86400;
26929
+ var MILLISECOND_TO_DAY = 1 / 86400000;
26930
+ var MILLISECOND_TO_SECOND = 1 / 1000;
26931
+ var MINUTE_TO_SECOND = 60;
26932
+ var SECOND_TO_MILLISECOND = 1000;
26933
+ var ONE_DAY_IN_SECONDS = DAY_TO_SECOND;
26934
+ /**
26935
+ * Reformats a date that has capitalized first letter and colon separator for time
26936
+ * @param dateString Date string from Date.toLocaleDateString
26937
+ * @returns Reformatted date string
26938
+ */
26939
+
26940
+ var reformatFinnishDateString = function reformatFinnishDateString(dateString) {
26941
+ var charPositionOfTimestamp = -4;
26942
+ return dateString.charAt(0).toUpperCase() + dateString.slice(1, charPositionOfTimestamp) + dateString.slice(charPositionOfTimestamp).replace('.', ':');
26943
+ };
26944
+ var getMonthChanges = function getMonthChanges(startDate, endDate) {
26945
+ var result = [];
26946
+ var currentDate = new Date(startDate.getTime());
26947
+ var lastDate = new Date(endDate.getTime());
26948
+ currentDate.setDate(1);
26949
+ currentDate.setHours(0, 0, 0, 0);
26950
+
26951
+ while (currentDate <= lastDate) {
26952
+ result.push(currentDate.getTime() * MILLISECOND_TO_SECOND);
26953
+ currentDate.setMonth(currentDate.getMonth() + 1);
26954
+ }
26955
+
26956
+ return result;
26957
+ };
26958
+ var getSelectedTimePx = function getSelectedTimePx(startTime, endTime, selectedTime, width) {
26959
+ var startDate = new Date(startTime * SECOND_TO_MILLISECOND);
26960
+ var startDateX = startDate.getTime() * MILLISECOND_TO_SECOND;
26961
+ var selectedTimeX = selectedTime - startDateX;
26962
+ var needleX = Math.floor(selectedTimeX / (endTime - startTime) * width);
26963
+ return needleX;
26964
+ };
26965
+ var boundedValue = function boundedValue(value, bounds) {
26966
+ var _bounds = _slicedToArray(bounds, 2),
26967
+ min = _bounds[0],
26968
+ max = _bounds[1];
26969
+
26970
+ return Math.max(min, Math.min(max, value));
26971
+ };
26972
+ var getSelectedTimeFromPx = function getSelectedTimeFromPx(startTime, endTime, selectedTimePx, width) {
26973
+ var startDate = new Date(startTime * SECOND_TO_MILLISECOND);
26974
+ var startDateX = startDate.getTime() * MILLISECOND_TO_SECOND;
26975
+ var selectedTimeX = Math.floor(selectedTimePx / width * (endTime - startTime));
26976
+ var selectedTime = selectedTimeX + startDateX;
26977
+ return selectedTime;
26978
+ };
26979
+ var TickMode;
26980
+
26981
+ (function (TickMode) {
26982
+ TickMode[TickMode["DAY"] = 1] = "DAY";
26983
+ TickMode[TickMode["HALF_A_DAY"] = 2] = "HALF_A_DAY";
26984
+ TickMode[TickMode["SIX_HOURS"] = 4] = "SIX_HOURS";
26985
+ TickMode[TickMode["THREE_HOURS"] = 8] = "THREE_HOURS";
26986
+ TickMode[TickMode["ONE_HOUR"] = 24] = "ONE_HOUR";
26987
+ TickMode[TickMode["HALF_AN_HOUR"] = 48] = "HALF_AN_HOUR";
26988
+ TickMode[TickMode["FIFTEEN_MINUTES"] = 96] = "FIFTEEN_MINUTES";
26989
+ })(TickMode || (TickMode = {}));
26990
+
26991
+ var subTicksPerDay = function subTicksPerDay(dayWidthInPixels) {
26992
+ if (dayWidthInPixels < 40) {
26993
+ return TickMode.DAY;
26994
+ }
26995
+
26996
+ if (dayWidthInPixels < 75) {
26997
+ return TickMode.HALF_A_DAY;
26998
+ }
26999
+
27000
+ if (dayWidthInPixels < 400) {
27001
+ return TickMode.SIX_HOURS;
27002
+ }
27003
+
27004
+ if (dayWidthInPixels < 800) {
27005
+ return TickMode.THREE_HOURS;
27006
+ }
27007
+
27008
+ if (dayWidthInPixels < 1600) {
27009
+ return TickMode.ONE_HOUR;
27010
+ }
27011
+
27012
+ if (dayWidthInPixels < 3200) {
27013
+ return TickMode.HALF_AN_HOUR;
27014
+ }
27015
+
27016
+ return TickMode.FIFTEEN_MINUTES;
27017
+ };
27018
+ var maxSubTicksPerDay = function maxSubTicksPerDay(dayWidthInPixels, timeStep) {
27019
+ return Math.min(subTicksPerDay(dayWidthInPixels), Math.floor(ONE_DAY_IN_SECONDS / timeStep));
27020
+ };
27021
+
27022
+ var Submenu;
27023
+
27024
+ (function (Submenu) {
27025
+ Submenu["TIME_RANGE"] = "Time range";
27026
+ Submenu["TIME_STEP"] = "Time step";
27027
+ Submenu["SPEED"] = "Speed";
27028
+ Submenu["UPDATE_INTERVAL"] = "Update interval";
27029
+ })(Submenu || (Submenu = {}));
27030
+
26964
27031
  /* *
26965
27032
  * Licensed under the Apache License, Version 2.0 (the "License");
26966
27033
  * you may not use this file except in compliance with the License.
@@ -27041,14 +27108,17 @@ var HideButton = function HideButton(_ref) {
27041
27108
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
27042
27109
  * */
27043
27110
 
27044
- var ControlButtonGroup = function ControlButtonGroup(_ref) {
27045
- var children = _ref.children,
27046
- right = _ref.right,
27047
- left = _ref.left;
27048
- return /*#__PURE__*/React__default.createElement(ButtonGroup, {
27111
+ var ControlButtonGroup = function ControlButtonGroup(_a) {
27112
+ var children = _a.children,
27113
+ right = _a.right,
27114
+ left = _a.left,
27115
+ props = __rest(_a, ["children", "right", "left"]);
27116
+
27117
+ return /*#__PURE__*/React__default.createElement(ButtonGroup, Object.assign({
27049
27118
  orientation: "horizontal",
27050
- fullWidth: true,
27051
- sx: Object.assign(Object.assign(Object.assign({}, right && {
27119
+ fullWidth: true
27120
+ }, props, {
27121
+ sx: Object.assign(Object.assign(Object.assign(Object.assign({}, right && {
27052
27122
  borderTopLeftRadius: 0,
27053
27123
  borderBottomLeftRadius: 0
27054
27124
  }), left && {
@@ -27061,8 +27131,8 @@ var ControlButtonGroup = function ControlButtonGroup(_ref) {
27061
27131
  justifyContent: 'center',
27062
27132
  padding: '4px',
27063
27133
  gap: '2px'
27064
- })
27065
- }, children);
27134
+ }), props.sx)
27135
+ }), children);
27066
27136
  };
27067
27137
 
27068
27138
  /* *
@@ -27081,7 +27151,11 @@ var ControlButtonGroup = function ControlButtonGroup(_ref) {
27081
27151
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
27082
27152
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
27083
27153
  * */
27084
- var TICK_HEIGHT = 8;
27154
+ var TICK_HEIGHT = 6;
27155
+ var HOUR_LABEL_OFFSET = 1.5;
27156
+ var MONTH_LABEL_BREAKPOINT = 65;
27157
+ var HOUR_LABEL_BREAKPOINT = 800;
27158
+ var HOUR_LABEL_EVERY_THIRD_HOUR_BREAKPOINT = 1600;
27085
27159
  var TIME_SLIDER_LITE_PADDING_RIGHT = 1;
27086
27160
 
27087
27161
  var TimeSliderLiteBackgroundSvg = function TimeSliderLiteBackgroundSvg(_ref) {
@@ -27089,6 +27163,7 @@ var TimeSliderLiteBackgroundSvg = function TimeSliderLiteBackgroundSvg(_ref) {
27089
27163
  height = _ref.height,
27090
27164
  startTime = _ref.startTime,
27091
27165
  endTime = _ref.endTime,
27166
+ timeStep = _ref.timeStep,
27092
27167
  style = _ref.style,
27093
27168
  locale = _ref.locale;
27094
27169
 
@@ -27103,15 +27178,23 @@ var TimeSliderLiteBackgroundSvg = function TimeSliderLiteBackgroundSvg(_ref) {
27103
27178
  } // Convert start and end time from Unix timestamp to JavaScript Date object
27104
27179
 
27105
27180
 
27106
- var startDate = new Date(startTime * 1000);
27107
- var endDate = new Date(endTime * 1000);
27108
- var totalDays = (endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24);
27181
+ var startDate = new Date(startTime * SECOND_TO_MILLISECOND);
27182
+ var endDate = new Date(endTime * SECOND_TO_MILLISECOND);
27183
+ var totalDays = (endDate.getTime() - startDate.getTime()) * MILLISECOND_TO_DAY;
27109
27184
  var tickSpacing = width / totalDays;
27110
- var tickOffset = (startDate.getHours() + startDate.getMinutes() / 60) / 24 * tickSpacing; // Set up variables for date labels and background colors
27185
+
27186
+ if (tickSpacing === Infinity || tickSpacing === -Infinity || isNaN(tickSpacing)) {
27187
+ return null;
27188
+ }
27189
+
27190
+ var tickOffset = (startDate.getHours() + startDate.getMinutes() / 60) / 24 * tickSpacing;
27191
+ var showMonthLabel = tickSpacing < MONTH_LABEL_BREAKPOINT;
27192
+ var showHourLabel = tickSpacing > HOUR_LABEL_BREAKPOINT;
27193
+ var showHourLabelEveryThirdHour = tickSpacing < HOUR_LABEL_EVERY_THIRD_HOUR_BREAKPOINT; // Set up variables for date labels and background colors
27111
27194
 
27112
27195
  var dayLabels = [];
27113
27196
  var currentDate = startDate;
27114
- var lastDayLabelDate = new Date(endDate.getTime() + 2 * 24 * 60 * 60 * 1000); // Append two more days
27197
+ var lastDayLabelDate = new Date(endDate.getTime() + 2 * DAY_TO_MILLISECOND); // Append two more days
27115
27198
 
27116
27199
  while (currentDate < lastDayLabelDate) {
27117
27200
  var dateString = currentDate.toLocaleDateString(locale, {
@@ -27124,17 +27207,38 @@ var TimeSliderLiteBackgroundSvg = function TimeSliderLiteBackgroundSvg(_ref) {
27124
27207
  currentDate.setDate(currentDate.getDate() + 1);
27125
27208
  }
27126
27209
 
27210
+ var monthChanges = getMonthChanges(startDate, endDate);
27211
+ var monthLabels = showMonthLabel ? monthChanges.map(function (monthChange) {
27212
+ var x = getSelectedTimePx(startTime, endTime, monthChange, width) + 4;
27213
+ var dateString = new Date(monthChange * 1000).toLocaleDateString(locale, {
27214
+ weekday: 'short',
27215
+ month: 'numeric',
27216
+ day: 'numeric'
27217
+ });
27218
+ var label = dateString.charAt(0).toUpperCase() + dateString.slice(1);
27219
+ return /*#__PURE__*/React__default.createElement("text", {
27220
+ x: x,
27221
+ y: 14,
27222
+ fill: timeSliderLite.timeline.fill,
27223
+ textAnchor: "left",
27224
+ fontSize: "12px",
27225
+ key: "".concat(monthChange, "-month-change-text"),
27226
+ style: {
27227
+ userSelect: 'none'
27228
+ }
27229
+ }, label);
27230
+ }) : null;
27127
27231
  var backgroundRectangles = dayLabels.map(function (label, index) {
27128
27232
  return /*#__PURE__*/React__default.createElement("rect", {
27129
- x: index * tickSpacing - tickOffset,
27233
+ x: Math.floor(index * tickSpacing - tickOffset),
27130
27234
  y: 0,
27131
- width: tickSpacing,
27235
+ width: Math.ceil(tickSpacing),
27132
27236
  height: height,
27133
27237
  fill: index % 2 === 0 ? timeSliderLite.timelineBackground.fill : timeSliderLite.timelineBackgroundAlternative.fill,
27134
27238
  key: "".concat(label, "-color")
27135
27239
  });
27136
27240
  });
27137
- var labels = dayLabels.map(function (label, index) {
27241
+ var dailyLabels = !showMonthLabel ? dayLabels.map(function (label, index) {
27138
27242
  return /*#__PURE__*/React__default.createElement("text", {
27139
27243
  x: index * tickSpacing + 8 - tickOffset,
27140
27244
  y: 14,
@@ -27146,8 +27250,35 @@ var TimeSliderLiteBackgroundSvg = function TimeSliderLiteBackgroundSvg(_ref) {
27146
27250
  userSelect: 'none'
27147
27251
  }
27148
27252
  }, dayLabels[index]);
27149
- });
27150
- var ticksPerDay = 4;
27253
+ }) : null;
27254
+ var hourLabelsPerDay = 24;
27255
+ var hourLabels = showHourLabel ? dayLabels.map(function (label, index) {
27256
+ return Array.from({
27257
+ length: hourLabelsPerDay
27258
+ }, function (_, value) {
27259
+ var defaultProps = {
27260
+ x: index * tickSpacing + value * (tickSpacing / hourLabelsPerDay) - tickOffset - HOUR_LABEL_OFFSET,
27261
+ y: height - 10,
27262
+ visibility: showHourLabelEveryThirdHour && value % 3 !== 0 ? 'hidden' : 'visible',
27263
+ fill: timeSliderLite.timeline.fill,
27264
+ fontSize: '12px'
27265
+ };
27266
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("text", Object.assign({}, defaultProps, {
27267
+ textAnchor: "end",
27268
+ key: "".concat(label, "-").concat(value, "-hour-label"),
27269
+ style: {
27270
+ userSelect: 'none'
27271
+ }
27272
+ }), value), /*#__PURE__*/React__default.createElement("text", Object.assign({}, defaultProps, {
27273
+ textAnchor: "start",
27274
+ key: "".concat(label, "-").concat(value, "-00-label"),
27275
+ style: {
27276
+ userSelect: 'none'
27277
+ }
27278
+ }), ":00"));
27279
+ });
27280
+ }).flat() : null;
27281
+ var ticksPerDay = timeStep ? maxSubTicksPerDay(tickSpacing, timeStep) : subTicksPerDay(tickSpacing);
27151
27282
  var tickMarks = dayLabels.map(function (label, index) {
27152
27283
  return Array.from({
27153
27284
  length: ticksPerDay + 1
@@ -27166,56 +27297,7 @@ var TimeSliderLiteBackgroundSvg = function TimeSliderLiteBackgroundSvg(_ref) {
27166
27297
  style: style,
27167
27298
  width: width + TIME_SLIDER_LITE_PADDING_RIGHT,
27168
27299
  height: height
27169
- }, backgroundRectangles, tickMarks, labels);
27170
- };
27171
-
27172
- /* *
27173
- * Licensed under the Apache License, Version 2.0 (the "License");
27174
- * you may not use this file except in compliance with the License.
27175
- * You may obtain a copy of the License at
27176
- *
27177
- * http://www.apache.org/licenses/LICENSE-2.0
27178
- *
27179
- * Unless required by applicable law or agreed to in writing, software
27180
- * distributed under the License is distributed on an "AS IS" BASIS,
27181
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27182
- * See the License for the specific language governing permissions and
27183
- * limitations under the License.
27184
- *
27185
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
27186
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
27187
- * */
27188
- var MILLISECOND_TO_SECOND = 1 / 1000;
27189
- /**
27190
- * Reformats a date that has capitalized first letter and colon separator for time
27191
- * @param dateString Date string from Date.toLocaleDateString
27192
- * @returns Reformatted date string
27193
- */
27194
-
27195
- var reformatFinnishDateString = function reformatFinnishDateString(dateString) {
27196
- var charPositionOfTimestamp = -4;
27197
- return dateString.charAt(0).toUpperCase() + dateString.slice(1, charPositionOfTimestamp) + dateString.slice(charPositionOfTimestamp).replace('.', ':');
27198
- };
27199
- var getSelectedTimePx = function getSelectedTimePx(startTime, endTime, selectedTime, width) {
27200
- var startDate = new Date(startTime * 1000);
27201
- var startDateX = startDate.getTime() * MILLISECOND_TO_SECOND;
27202
- var selectedTimeX = selectedTime - startDateX;
27203
- var needleX = Math.floor(selectedTimeX / (endTime - startTime) * width);
27204
- return needleX;
27205
- };
27206
- var boundedValue = function boundedValue(value, bounds) {
27207
- var _bounds = _slicedToArray(bounds, 2),
27208
- min = _bounds[0],
27209
- max = _bounds[1];
27210
-
27211
- return Math.max(min, Math.min(max, value));
27212
- };
27213
- var getSelectedTimeFromPx = function getSelectedTimeFromPx(startTime, endTime, selectedTimePx, width) {
27214
- var startDate = new Date(startTime * 1000);
27215
- var startDateX = startDate.getTime() * MILLISECOND_TO_SECOND;
27216
- var selectedTimeX = Math.floor(selectedTimePx / width * (endTime - startTime));
27217
- var selectedTime = selectedTimeX + startDateX;
27218
- return selectedTime;
27300
+ }, backgroundRectangles, tickMarks, monthLabels, dailyLabels, hourLabels);
27219
27301
  };
27220
27302
 
27221
27303
  /* *
@@ -27405,7 +27487,7 @@ var TimeSliderLiteBackground = function TimeSliderLiteBackground(_ref) {
27405
27487
  areaWidth = _React$useState2[0],
27406
27488
  setAreaWidth = _React$useState2[1];
27407
27489
 
27408
- var drawNeedle = selectedTime && areaWidth;
27490
+ var drawNeedle = selectedTime && areaWidth && startTime < endTime;
27409
27491
  useLayoutEffect(function () {
27410
27492
  var sliderArea = sliderAreaRef.current;
27411
27493
  setAreaWidth(sliderArea.clientWidth - TIME_SLIDER_LITE_PADDING_RIGHT);
@@ -27431,6 +27513,7 @@ var TimeSliderLiteBackground = function TimeSliderLiteBackground(_ref) {
27431
27513
  position: 'absolute',
27432
27514
  top: 0
27433
27515
  },
27516
+ timeStep: timeStep,
27434
27517
  width: areaWidth,
27435
27518
  height: height,
27436
27519
  startTime: startTime,
@@ -27479,7 +27562,8 @@ var StepButton = function StepButton(_ref) {
27479
27562
  isDisabled = _ref.isDisabled,
27480
27563
  _ref$onClick = _ref.onClick,
27481
27564
  onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
27482
- settings = _ref.settings;
27565
+ settings = _ref.settings,
27566
+ tooltipDelay = _ref.tooltipDelay;
27483
27567
 
27484
27568
  var _a, _b, _c, _d, _e, _f, _g, _h;
27485
27569
 
@@ -27492,7 +27576,9 @@ var StepButton = function StepButton(_ref) {
27492
27576
  "data-testid": "step-backward-svg-path"
27493
27577
  });
27494
27578
  return /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, timeSliderLiteTooltipDefaultProps, {
27495
- title: forward ? forwardTitle : backwardTitle
27579
+ title: forward ? forwardTitle : backwardTitle,
27580
+ enterDelay: tooltipDelay,
27581
+ enterNextDelay: tooltipDelay
27496
27582
  }), /*#__PURE__*/React.createElement(IconButton, Object.assign({}, timeSliderLiteButtonDefaultProps, {
27497
27583
  disabled: isDisabled,
27498
27584
  "aria-label": forward ? forwardTitle : backwardTitle,
@@ -27522,7 +27608,8 @@ var PlayButton = function PlayButton(_ref) {
27522
27608
  var isAnimating = _ref.isAnimating,
27523
27609
  isDisabled = _ref.isDisabled,
27524
27610
  onTogglePlayButton = _ref.onTogglePlayButton,
27525
- settings = _ref.settings;
27611
+ settings = _ref.settings,
27612
+ tooltipDelay = _ref.tooltipDelay;
27526
27613
 
27527
27614
  var _a, _b, _c, _d, _e, _f, _g, _h;
27528
27615
 
@@ -27531,7 +27618,10 @@ var PlayButton = function PlayButton(_ref) {
27531
27618
  var pauseIcon = (_f = (_e = settings === null || settings === void 0 ? void 0 : settings.icon) === null || _e === void 0 ? void 0 : _e.pause) !== null && _f !== void 0 ? _f : /*#__PURE__*/React__default.createElement(Pause, null);
27532
27619
  var playIcon = (_h = (_g = settings === null || settings === void 0 ? void 0 : settings.icon) === null || _g === void 0 ? void 0 : _g.play) !== null && _h !== void 0 ? _h : /*#__PURE__*/React__default.createElement(Play, null);
27533
27620
  return /*#__PURE__*/React__default.createElement(Tooltip, Object.assign({}, timeSliderLiteTooltipDefaultProps, {
27534
- title: isAnimating ? pauseTitle : playTitle
27621
+ title: isAnimating ? pauseTitle : playTitle,
27622
+ placement: "top",
27623
+ enterDelay: tooltipDelay,
27624
+ enterNextDelay: tooltipDelay
27535
27625
  }), /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, timeSliderLiteButtonDefaultProps, {
27536
27626
  sx: Object.assign(Object.assign({}, isAnimating && {
27537
27627
  backgroundColor: 'geowebColors.timeSliderLite.selected.backgroundColor'
@@ -27570,21 +27660,28 @@ var MenuButton = function MenuButton(_ref) {
27570
27660
 
27571
27661
  var title = (_a = settings === null || settings === void 0 ? void 0 : settings.label) !== null && _a !== void 0 ? _a : 'Animation options';
27572
27662
  var icon = (_b = settings === null || settings === void 0 ? void 0 : settings.icon) !== null && _b !== void 0 ? _b : /*#__PURE__*/React__default.createElement(Options, null);
27573
- return /*#__PURE__*/React__default.createElement(Tooltip, Object.assign({}, timeSliderLiteTooltipDefaultProps, {
27574
- title: title
27575
- }), /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, timeSliderLiteButtonDefaultProps, {
27663
+ var Button = /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, timeSliderLiteButtonDefaultProps, {
27576
27664
  sx: Object.assign(Object.assign({}, menuOpen && {
27577
27665
  backgroundColor: 'geowebColors.timeSliderLite.selected.backgroundColor'
27578
27666
  }), timeSliderLiteButtonDefaultProps.sx),
27579
27667
  "aria-selected": menuOpen,
27580
27668
  onClick: onClick,
27581
27669
  "data-testid": "TimeSliderLite-MenuButton"
27582
- }), icon));
27670
+ }), icon);
27671
+
27672
+ if (menuOpen) {
27673
+ return Button;
27674
+ }
27675
+
27676
+ return /*#__PURE__*/React__default.createElement(Tooltip, Object.assign({}, timeSliderLiteTooltipDefaultProps, {
27677
+ title: title
27678
+ }), Button);
27583
27679
  };
27584
27680
 
27585
27681
  var TIME_SLIDER_LITE_DEFAULT_HEIGHT = 40;
27586
27682
  var TIME_SLIDER_LITE_DEFAULT_LOCALE = 'en';
27587
27683
  var TIME_SLIDER_LITE_DEFAULT_TIME_STEP = 5;
27684
+ var TIME_SLIDER_LITE_TOOLTIP_DELAY = 3000;
27588
27685
  var styles$1 = {
27589
27686
  container: {
27590
27687
  display: 'grid',
@@ -27623,12 +27720,14 @@ var TimeSliderLite = function TimeSliderLite(_ref) {
27623
27720
  _ref$timeStep = _ref.timeStep,
27624
27721
  timeStep = _ref$timeStep === void 0 ? TIME_SLIDER_LITE_DEFAULT_TIME_STEP : _ref$timeStep;
27625
27722
 
27723
+ var _a, _b;
27724
+
27626
27725
  var _useState = useState(selectedTime),
27627
27726
  _useState2 = _slicedToArray(_useState, 2),
27628
27727
  rawSelectedTime = _useState2[0],
27629
27728
  setRawSelectedTime = _useState2[1];
27630
27729
 
27631
- var timeStepSeconds = timeStep * 60;
27730
+ var timeStepSeconds = timeStep * MINUTE_TO_SECOND;
27632
27731
  var roundedStartTime = Math.floor(startTime / timeStepSeconds) * timeStepSeconds;
27633
27732
  var roundedEndTime = Math.floor(endTime / timeStepSeconds) * timeStepSeconds;
27634
27733
  var runningExternalAnimation = overrideAnimation && isAnimating;
@@ -27677,12 +27776,19 @@ var TimeSliderLite = function TimeSliderLite(_ref) {
27677
27776
  if (isAnimating && onToggleAnimation) {
27678
27777
  onToggleAnimation();
27679
27778
  }
27680
- };
27779
+ }; // Handle time range selection
27780
+
27681
27781
 
27782
+ useEffect(function () {
27783
+ setRawSelectedTime(boundedValue(selectedTime, [roundedStartTime, roundedEndTime])); // eslint-disable-next-line react-hooks/exhaustive-deps
27784
+ }, [startTime, endTime]);
27785
+ var tooltipDelay = menuOpen ? TIME_SLIDER_LITE_TOOLTIP_DELAY : undefined;
27682
27786
  return /*#__PURE__*/React__default.createElement(Grid, {
27683
27787
  container: true,
27684
27788
  sx: Object.assign(Object.assign(Object.assign({}, styles$1.container), sx), {
27685
- gridTemplateColumns: isVisible ? 'auto 1fr auto' : "1fr auto"
27789
+ gridTemplateColumns: isVisible ? 'auto 1fr auto' : "1fr auto",
27790
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27791
+ boxShadow: isVisible ? (_a = sx) === null || _a === void 0 ? void 0 : _a.boxShadow : undefined
27686
27792
  }),
27687
27793
  "data-testid": "timeSliderLite-".concat(mapId)
27688
27794
  }, isVisible ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Grid, {
@@ -27705,18 +27811,21 @@ var TimeSliderLite = function TimeSliderLite(_ref) {
27705
27811
  }), /*#__PURE__*/React__default.createElement(PlayButton, {
27706
27812
  settings: settings === null || settings === void 0 ? void 0 : settings.playButton,
27707
27813
  isAnimating: isAnimating,
27708
- onTogglePlayButton: onToggleAnimation
27814
+ onTogglePlayButton: onToggleAnimation,
27815
+ tooltipDelay: tooltipDelay
27709
27816
  }), /*#__PURE__*/React__default.createElement(StepButton, {
27710
27817
  settings: settings === null || settings === void 0 ? void 0 : settings.stepButton,
27711
27818
  onClick: function onClick() {
27712
27819
  return handleTimeStep(-timeStepSeconds);
27713
- }
27820
+ },
27821
+ tooltipDelay: tooltipDelay
27714
27822
  }), /*#__PURE__*/React__default.createElement(StepButton, {
27715
27823
  forward: true,
27716
27824
  settings: settings === null || settings === void 0 ? void 0 : settings.stepButton,
27717
27825
  onClick: function onClick() {
27718
27826
  return handleTimeStep(timeStepSeconds);
27719
- }
27827
+ },
27828
+ tooltipDelay: tooltipDelay
27720
27829
  }))), /*#__PURE__*/React__default.createElement(Grid, {
27721
27830
  item: true
27722
27831
  }, /*#__PURE__*/React__default.createElement(TimeSliderLiteBackground, {
@@ -27737,9 +27846,13 @@ var TimeSliderLite = function TimeSliderLite(_ref) {
27737
27846
  }), /*#__PURE__*/React__default.createElement(Grid, {
27738
27847
  item: true,
27739
27848
  sx: {
27849
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27850
+ boxShadow: isVisible ? 'none' : (_b = sx) === null || _b === void 0 ? void 0 : _b.boxShadow,
27851
+ borderRadius: isVisible ? 'none' : '4px',
27740
27852
  height: "".concat(height, "px")
27741
27853
  }
27742
27854
  }, hideButton || /*#__PURE__*/React__default.createElement(ControlButtonGroup, {
27855
+ className: "timeSliderLite-hideButtonGroup-".concat(isVisible ? 'hide' : 'show'),
27743
27856
  right: isVisible
27744
27857
  }, /*#__PURE__*/React__default.createElement(HideButton, {
27745
27858
  settings: settings === null || settings === void 0 ? void 0 : settings.hideButton,