@opengeoweb/shared 4.18.0 → 4.19.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.
package/index.esm.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useRef } from 'react';
3
- import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListSubheader, ListItemIcon, Select, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
3
+ import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListSubheader, ListItemIcon, Select, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
4
4
  import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown } from '@opengeoweb/theme';
5
5
  import { throttle } from 'lodash';
6
6
  import Draggable from 'react-draggable';
7
7
  import { Resizable } from 're-resizable';
8
8
  import { useStore } from 'react-redux';
9
- import { parseISO, parse, format, isEqual, isBefore, isAfter } from 'date-fns';
9
+ import { parseISO, parse, format, isEqual, isBefore, isAfter, add as add$1, sub as sub$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1 } from 'date-fns';
10
10
 
11
11
  /*! *****************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -87,164 +87,6 @@ var StatusTag = function StatusTag(_a) {
87
87
  }, content));
88
88
  };
89
89
 
90
- var CustomDialog = function CustomDialog(_a) {
91
- var title = _a.title,
92
- _onClose = _a.onClose,
93
- _a$description = _a.description,
94
- description = _a$description === void 0 ? '' : _a$description,
95
- _a$actions = _a.actions,
96
- actions = _a$actions === void 0 ? null : _a$actions,
97
- children = _a.children,
98
- sx = _a.sx,
99
- other = __rest(_a, ["title", "onClose", "description", "actions", "children", "sx"]);
100
-
101
- return /*#__PURE__*/React.createElement(Dialog, Object.assign({
102
- "data-testid": "customDialog",
103
- PaperProps: {
104
- sx: Object.assign({
105
- width: '560px',
106
- margin: 2.5
107
- }, sx)
108
- },
109
- // fix for briefly showing default options when closing dialog
110
- transitionDuration: 0,
111
- onClose: function onClose() {
112
- _onClose('CLOSED');
113
- },
114
- "aria-labelledby": "dialog-title"
115
- }, other), /*#__PURE__*/React.createElement(DialogTitle, {
116
- id: "dialog-title",
117
- sx: {
118
- zIndex: 1,
119
- padding: 2,
120
- display: 'flex',
121
- justifyContent: 'space-between',
122
- alignItems: 'center'
123
- }
124
- }, /*#__PURE__*/React.createElement(Typography, {
125
- sx: {
126
- fontSize: '16px',
127
- fontWeight: 500
128
- },
129
- "data-testid": "customDialog-title",
130
- component: "span"
131
- }, title), /*#__PURE__*/React.createElement(IconButton, {
132
- "data-testid": "customDialog-close",
133
- "aria-label": "close",
134
- onClick: function onClick() {
135
- return _onClose('CLOSED');
136
- },
137
- size: "small"
138
- }, /*#__PURE__*/React.createElement(Close, {
139
- "data-testid": "CloseIcon"
140
- }))), /*#__PURE__*/React.createElement(DialogContent, {
141
- sx: {
142
- padding: '8px 16px'
143
- }
144
- }, description && /*#__PURE__*/React.createElement(Typography, {
145
- variant: "body1"
146
- }, description), children), /*#__PURE__*/React.createElement(DialogActions, {
147
- sx: {
148
- padding: 2,
149
- flexDirection: {
150
- xs: 'column',
151
- sm: 'row'
152
- }
153
- }
154
- }, actions));
155
- };
156
-
157
- var confirmStyle = {
158
- width: {
159
- xs: '100%',
160
- sm: '150px'
161
- },
162
- marginLeft: {
163
- xs: '0px!important',
164
- sm: '8px!important'
165
- },
166
- marginTop: {
167
- xs: 2,
168
- sm: 0
169
- }
170
- };
171
- var ConfirmationDialog = function ConfirmationDialog(_a) {
172
- var open = _a.open,
173
- title = _a.title,
174
- _a$description = _a.description,
175
- description = _a$description === void 0 ? 'Are you sure?' : _a$description,
176
- _a$confirmLabel = _a.confirmLabel,
177
- confirmLabel = _a$confirmLabel === void 0 ? 'Submit' : _a$confirmLabel,
178
- _a$cancelLabel = _a.cancelLabel,
179
- cancelLabel = _a$cancelLabel === void 0 ? 'Go back' : _a$cancelLabel,
180
- onSubmit = _a.onSubmit,
181
- onClose = _a.onClose,
182
- _a$content = _a.content,
183
- content = _a$content === void 0 ? null : _a$content,
184
- _a$disableAutoFocus = _a.disableAutoFocus,
185
- disableAutoFocus = _a$disableAutoFocus === void 0 ? false : _a$disableAutoFocus,
186
- _a$isLoading = _a.isLoading,
187
- isLoading = _a$isLoading === void 0 ? false : _a$isLoading,
188
- other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"]);
189
-
190
- other.catchOnCancel;
191
- var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
192
-
193
-
194
- return /*#__PURE__*/React.createElement(CustomDialog, Object.assign({
195
- "data-testid": "confirmationDialog",
196
- open: open,
197
- title: title,
198
- description: description,
199
- onClose: onClose,
200
- actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
201
- "data-testid": "confirmationDialog-cancel",
202
- variant: "tertiary",
203
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
204
- sx: function sx(theme) {
205
- return {
206
- width: {
207
- xs: '100%',
208
- sm: '150px'
209
- },
210
- '&:focus': {
211
- outline: theme.palette.geowebColors.buttons.focusDefault.outline,
212
- borderColor: 'transparent'
213
- }
214
- };
215
- },
216
- onClick: function onClick() {
217
- return onClose('CANCELLED');
218
- }
219
- }, cancelLabel), isLoading ? /*#__PURE__*/React.createElement(Box, {
220
- "data-testid": "confirm-dialog-spinner",
221
- sx: Object.assign(Object.assign({}, confirmStyle), {
222
- height: '40px',
223
- display: 'flex',
224
- justifyContent: 'center',
225
- alignItems: 'center'
226
- })
227
- }, /*#__PURE__*/React.createElement(CircularProgress, {
228
- size: 40,
229
- color: "secondary"
230
- })) : /*#__PURE__*/React.createElement(Button, {
231
- "data-testid": "confirmationDialog-confirm",
232
- variant: "primary",
233
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
234
- sx: function sx(theme) {
235
- return Object.assign(Object.assign({}, confirmStyle), {
236
- '&:focus': {
237
- outline: theme.palette.geowebColors.buttons.focusDefault.outline,
238
- borderColor: 'transparent'
239
- }
240
- });
241
- },
242
- onClick: onSubmit,
243
- autoFocus: !disableAutoFocus
244
- }, confirmLabel))
245
- }, rest), content);
246
- };
247
-
248
90
  function _classCallCheck(instance, Constructor) {
249
91
  if (!(instance instanceof Constructor)) {
250
92
  throw new TypeError("Cannot call a class as a function");
@@ -437,6 +279,247 @@ function _nonIterableRest() {
437
279
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
438
280
  }
439
281
 
282
+ var defaultDelay = 1000;
283
+ var useControlledTooltip = function useControlledTooltip() {
284
+ var _React$useState = React.useState(false),
285
+ _React$useState2 = _slicedToArray(_React$useState, 2),
286
+ tooltipOpen = _React$useState2[0],
287
+ setTooltipOpen = _React$useState2[1];
288
+
289
+ var _React$useState3 = React.useState(false),
290
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
291
+ delayedTooltip = _React$useState4[0],
292
+ setDelayedTooltip = _React$useState4[1];
293
+
294
+ React.useEffect(function () {
295
+ if (tooltipOpen === true) {
296
+ var timer = setTimeout(function () {
297
+ return setDelayedTooltip(true);
298
+ }, defaultDelay);
299
+ return function () {
300
+ clearTimeout(timer);
301
+ };
302
+ }
303
+
304
+ setDelayedTooltip(false);
305
+ return function () {};
306
+ }, [tooltipOpen]);
307
+ return [delayedTooltip, setTooltipOpen];
308
+ };
309
+ var CustomTooltip = function CustomTooltip(props) {
310
+ return /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, props, {
311
+ enterDelay: defaultDelay,
312
+ enterNextDelay: defaultDelay,
313
+ disableInteractive: true
314
+ }));
315
+ };
316
+
317
+ var CustomIconButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
318
+ var _a$tooltipTitle = _a.tooltipTitle,
319
+ tooltipTitle = _a$tooltipTitle === void 0 ? '' : _a$tooltipTitle,
320
+ _a$variant = _a.variant,
321
+ variant = _a$variant === void 0 ? 'flat' : _a$variant,
322
+ _a$isSelected = _a.isSelected,
323
+ isSelected = _a$isSelected === void 0 ? false : _a$isSelected,
324
+ _a$shouldShowAsDisabl = _a.shouldShowAsDisabled,
325
+ shouldShowAsDisabled = _a$shouldShowAsDisabl === void 0 ? false : _a$shouldShowAsDisabl,
326
+ _a$size = _a.size,
327
+ size = _a$size === void 0 ? 'small' : _a$size,
328
+ children = _a.children,
329
+ className = _a.className,
330
+ props = __rest(_a, ["tooltipTitle", "variant", "isSelected", "shouldShowAsDisabled", "size", "children", "className"]);
331
+
332
+ var classNames = [].concat(_toConsumableArray(className ? [className] : []), _toConsumableArray(isSelected ? ['Mui-selected'] : []), [variant]).join(' ');
333
+
334
+ var renderIconButton = function renderIconButton() {
335
+ return /*#__PURE__*/React.createElement(IconButton, Object.assign({
336
+ "aria-label": tooltipTitle
337
+ }, props, {
338
+ size: size,
339
+ className: classNames,
340
+ ref: ref,
341
+ sx: Object.assign(Object.assign({}, props.sx), shouldShowAsDisabled && {
342
+ '&.MuiIconButton-root': {
343
+ color: "geowebColors.iconButtons.".concat(variant, ".disabled.color")
344
+ },
345
+ '&.Mui-focusVisible': {
346
+ color: "geowebColors.iconButtons.".concat(variant, ".default.color")
347
+ }
348
+ })
349
+ }), children);
350
+ };
351
+
352
+ return tooltipTitle ? /*#__PURE__*/React.createElement(CustomTooltip, {
353
+ title: tooltipTitle,
354
+ placement: "top",
355
+ sx: {
356
+ pointerEvents: 'none'
357
+ }
358
+ }, renderIconButton()) : renderIconButton();
359
+ });
360
+
361
+ var CustomDialog = function CustomDialog(_a) {
362
+ var title = _a.title,
363
+ _onClose = _a.onClose,
364
+ _a$description = _a.description,
365
+ description = _a$description === void 0 ? '' : _a$description,
366
+ _a$actions = _a.actions,
367
+ actions = _a$actions === void 0 ? null : _a$actions,
368
+ children = _a.children,
369
+ sx = _a.sx,
370
+ other = __rest(_a, ["title", "onClose", "description", "actions", "children", "sx"]);
371
+
372
+ return /*#__PURE__*/React.createElement(Dialog, Object.assign({
373
+ "data-testid": "customDialog",
374
+ PaperProps: {
375
+ sx: Object.assign({
376
+ width: '560px',
377
+ margin: 2.5
378
+ }, sx)
379
+ },
380
+ // fix for briefly showing default options when closing dialog
381
+ transitionDuration: 0,
382
+ onClose: function onClose() {
383
+ _onClose('CLOSED');
384
+ },
385
+ "aria-labelledby": "dialog-title"
386
+ }, other), /*#__PURE__*/React.createElement(DialogTitle, {
387
+ id: "dialog-title",
388
+ sx: {
389
+ zIndex: 1,
390
+ padding: 2,
391
+ display: 'flex',
392
+ justifyContent: 'space-between',
393
+ alignItems: 'center'
394
+ }
395
+ }, /*#__PURE__*/React.createElement(Typography, {
396
+ sx: {
397
+ fontSize: '16px',
398
+ fontWeight: 500
399
+ },
400
+ "data-testid": "customDialog-title",
401
+ component: "span"
402
+ }, title), /*#__PURE__*/React.createElement(CustomIconButton, {
403
+ "data-testid": "customDialog-close",
404
+ "aria-label": "close",
405
+ onClick: function onClick() {
406
+ return _onClose('CLOSED');
407
+ },
408
+ sx: {
409
+ '&.MuiIconButton-root': {
410
+ color: 'geowebColors.greys.accessible'
411
+ }
412
+ }
413
+ }, /*#__PURE__*/React.createElement(Close, {
414
+ "data-testid": "CloseIcon"
415
+ }))), /*#__PURE__*/React.createElement(DialogContent, {
416
+ sx: {
417
+ padding: '8px 16px'
418
+ }
419
+ }, description && /*#__PURE__*/React.createElement(Typography, {
420
+ variant: "body1"
421
+ }, description), children), /*#__PURE__*/React.createElement(DialogActions, {
422
+ sx: {
423
+ padding: 2,
424
+ flexDirection: {
425
+ xs: 'column',
426
+ sm: 'row'
427
+ }
428
+ }
429
+ }, actions));
430
+ };
431
+
432
+ var confirmStyle = {
433
+ width: {
434
+ xs: '100%',
435
+ sm: '150px'
436
+ },
437
+ marginLeft: {
438
+ xs: '0px!important',
439
+ sm: '8px!important'
440
+ },
441
+ marginTop: {
442
+ xs: 2,
443
+ sm: 0
444
+ }
445
+ };
446
+ var ConfirmationDialog = function ConfirmationDialog(_a) {
447
+ var open = _a.open,
448
+ title = _a.title,
449
+ _a$description = _a.description,
450
+ description = _a$description === void 0 ? 'Are you sure?' : _a$description,
451
+ _a$confirmLabel = _a.confirmLabel,
452
+ confirmLabel = _a$confirmLabel === void 0 ? 'Submit' : _a$confirmLabel,
453
+ _a$cancelLabel = _a.cancelLabel,
454
+ cancelLabel = _a$cancelLabel === void 0 ? 'Go back' : _a$cancelLabel,
455
+ onSubmit = _a.onSubmit,
456
+ onClose = _a.onClose,
457
+ _a$content = _a.content,
458
+ content = _a$content === void 0 ? null : _a$content,
459
+ _a$disableAutoFocus = _a.disableAutoFocus,
460
+ disableAutoFocus = _a$disableAutoFocus === void 0 ? false : _a$disableAutoFocus,
461
+ _a$isLoading = _a.isLoading,
462
+ isLoading = _a$isLoading === void 0 ? false : _a$isLoading,
463
+ other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"]);
464
+
465
+ other.catchOnCancel;
466
+ var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
467
+
468
+
469
+ return /*#__PURE__*/React.createElement(CustomDialog, Object.assign({
470
+ "data-testid": "confirmationDialog",
471
+ open: open,
472
+ title: title,
473
+ description: description,
474
+ onClose: onClose,
475
+ actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
476
+ "data-testid": "confirmationDialog-cancel",
477
+ variant: "tertiary",
478
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
479
+ sx: function sx(theme) {
480
+ return {
481
+ width: {
482
+ xs: '100%',
483
+ sm: '150px'
484
+ },
485
+ '&:focus': {
486
+ outline: theme.palette.geowebColors.buttons.primary.focus.outline,
487
+ borderColor: 'transparent'
488
+ }
489
+ };
490
+ },
491
+ onClick: function onClick() {
492
+ return onClose('CANCELLED');
493
+ }
494
+ }, cancelLabel), isLoading ? /*#__PURE__*/React.createElement(Box, {
495
+ "data-testid": "confirm-dialog-spinner",
496
+ sx: Object.assign(Object.assign({}, confirmStyle), {
497
+ height: '40px',
498
+ display: 'flex',
499
+ justifyContent: 'center',
500
+ alignItems: 'center'
501
+ })
502
+ }, /*#__PURE__*/React.createElement(CircularProgress, {
503
+ size: 40,
504
+ color: "secondary"
505
+ })) : /*#__PURE__*/React.createElement(Button, {
506
+ "data-testid": "confirmationDialog-confirm",
507
+ variant: "primary",
508
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
509
+ sx: function sx(theme) {
510
+ return Object.assign(Object.assign({}, confirmStyle), {
511
+ '&:focus': {
512
+ outline: theme.palette.geowebColors.buttons.primary.focus.outline,
513
+ borderColor: 'transparent'
514
+ }
515
+ });
516
+ },
517
+ onClick: onSubmit,
518
+ autoFocus: !disableAutoFocus
519
+ }, confirmLabel))
520
+ }, rest), content);
521
+ };
522
+
440
523
  /* *
441
524
  * Licensed under the Apache License, Version 2.0 (the "License");
442
525
  * you may not use this file except in compliance with the License.
@@ -1264,8 +1347,8 @@ var Avatar = function Avatar(_ref) {
1264
1347
  * See the License for the specific language governing permissions and
1265
1348
  * limitations under the License.
1266
1349
  *
1267
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1268
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
1350
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1351
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
1269
1352
  * */
1270
1353
  var styles$3 = {
1271
1354
  container: {
@@ -1285,15 +1368,6 @@ var styles$3 = {
1285
1368
  paddingLeft: 2,
1286
1369
  paddingRight: 2
1287
1370
  }
1288
- },
1289
- button: {
1290
- padding: 0,
1291
- border: 'none',
1292
- background: 'transparent',
1293
- '&:hover': {
1294
- border: 'none',
1295
- background: 'transparent'
1296
- }
1297
1371
  }
1298
1372
  };
1299
1373
 
@@ -1306,11 +1380,19 @@ var UserMenu = function UserMenu(_ref) {
1306
1380
  onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
1307
1381
  children = _ref.children,
1308
1382
  initials = _ref.initials;
1309
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
1383
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CustomIconButton, {
1310
1384
  "data-testid": "userButton",
1311
1385
  onClick: onToggle,
1312
- sx: styles$3.button,
1313
- size: "large"
1386
+ sx: {
1387
+ '&.MuiButtonBase-root': {
1388
+ background: 'transparent',
1389
+ '&:hover': {
1390
+ border: 'none',
1391
+ background: 'transparent'
1392
+ }
1393
+ }
1394
+ },
1395
+ size: "medium"
1314
1396
  }, /*#__PURE__*/React__default.createElement(Avatar, null, initials)), isOpen && /*#__PURE__*/React__default.createElement(Paper, {
1315
1397
  sx: styles$3.container,
1316
1398
  "data-testid": "userMenu"
@@ -1400,41 +1482,6 @@ var ToolFooter = function ToolFooter() {
1400
1482
  });
1401
1483
  };
1402
1484
 
1403
- var defaultDelay = 1000;
1404
- var useControlledTooltip = function useControlledTooltip() {
1405
- var _React$useState = React.useState(false),
1406
- _React$useState2 = _slicedToArray(_React$useState, 2),
1407
- tooltipOpen = _React$useState2[0],
1408
- setTooltipOpen = _React$useState2[1];
1409
-
1410
- var _React$useState3 = React.useState(false),
1411
- _React$useState4 = _slicedToArray(_React$useState3, 2),
1412
- delayedTooltip = _React$useState4[0],
1413
- setDelayedTooltip = _React$useState4[1];
1414
-
1415
- React.useEffect(function () {
1416
- if (tooltipOpen === true) {
1417
- var timer = setTimeout(function () {
1418
- return setDelayedTooltip(true);
1419
- }, defaultDelay);
1420
- return function () {
1421
- clearTimeout(timer);
1422
- };
1423
- }
1424
-
1425
- setDelayedTooltip(false);
1426
- return function () {};
1427
- }, [tooltipOpen]);
1428
- return [delayedTooltip, setTooltipOpen];
1429
- };
1430
- var CustomTooltip = function CustomTooltip(props) {
1431
- return /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, props, {
1432
- enterDelay: defaultDelay,
1433
- enterNextDelay: defaultDelay,
1434
- disableInteractive: true
1435
- }));
1436
- };
1437
-
1438
1485
  /* *
1439
1486
  * Licensed under the Apache License, Version 2.0 (the "License");
1440
1487
  * you may not use this file except in compliance with the License.
@@ -1448,8 +1495,8 @@ var CustomTooltip = function CustomTooltip(props) {
1448
1495
  * See the License for the specific language governing permissions and
1449
1496
  * limitations under the License.
1450
1497
  *
1451
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1452
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
1498
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1499
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
1453
1500
  * */
1454
1501
 
1455
1502
  var getStyle = function getStyle(size) {
@@ -1547,13 +1594,13 @@ var ToolHeader = function ToolHeader(_ref) {
1547
1594
  }, isDraggable && size !== 'xxs' && !leftHeaderComponent && /*#__PURE__*/React__default.createElement(Grid, {
1548
1595
  container: true,
1549
1596
  justifyContent: "flex-start"
1550
- }, /*#__PURE__*/React__default.createElement(IconButton, {
1597
+ }, /*#__PURE__*/React__default.createElement(CustomIconButton, {
1551
1598
  "data-testid": "dragBtn",
1552
1599
  disableRipple: true,
1553
- size: "large",
1554
- sx: Object.assign(Object.assign({}, iconStyle), {
1555
- pointerEvents: 'none'
1556
- })
1600
+ sx: {
1601
+ pointerEvents: 'none',
1602
+ '&.MuiIconButton-root': iconStyle
1603
+ }
1557
1604
  }, /*#__PURE__*/React__default.createElement(DragHandle, null))), leftHeaderComponent && leftHeaderComponent), /*#__PURE__*/React__default.createElement(Grid, {
1558
1605
  className: "header-title",
1559
1606
  item: true,
@@ -1569,15 +1616,16 @@ var ToolHeader = function ToolHeader(_ref) {
1569
1616
  fontSize: styles.fontSize,
1570
1617
  fontWeight: styles.fontWeight
1571
1618
  }
1572
- }, title), size === 'xxs' && /*#__PURE__*/React__default.createElement(IconButton, {
1619
+ }, title), size === 'xxs' && /*#__PURE__*/React__default.createElement(CustomIconButton, {
1573
1620
  "data-testid": "dragBtn-xxs",
1574
1621
  disableRipple: true,
1575
- size: "small",
1576
- sx: Object.assign(Object.assign({}, iconStyle), {
1622
+ sx: {
1577
1623
  pointerEvents: 'none',
1578
1624
  transform: 'rotate(90deg)',
1579
- height: 12
1580
- })
1625
+ '&.MuiButtonBase-root.MuiIconButton-root': Object.assign(Object.assign({}, iconStyle), {
1626
+ height: 12
1627
+ })
1628
+ }
1581
1629
  }, /*#__PURE__*/React__default.createElement(DragHandle, null)))), /*#__PURE__*/React__default.createElement(Grid, {
1582
1630
  className: "header-right",
1583
1631
  item: true,
@@ -1590,12 +1638,13 @@ var ToolHeader = function ToolHeader(_ref) {
1590
1638
  sx: {
1591
1639
  pointerEvents: 'none'
1592
1640
  }
1593
- }, /*#__PURE__*/React__default.createElement(IconButton, {
1641
+ }, /*#__PURE__*/React__default.createElement(CustomIconButton, {
1594
1642
  "data-testid": "closeBtn",
1595
1643
  onClick: onClose,
1596
1644
  onTouchEnd: onClose,
1597
- size: "large",
1598
- sx: iconStyle
1645
+ sx: {
1646
+ '&.MuiButtonBase-root.MuiIconButton-root': iconStyle
1647
+ }
1599
1648
  }, /*#__PURE__*/React__default.createElement(Close, {
1600
1649
  "data-testid": "CloseIcon"
1601
1650
  }))))));
@@ -2782,7 +2831,7 @@ var ToggleMenu = function ToggleMenu(_ref) {
2782
2831
  sx: {
2783
2832
  fontSize: '12px'
2784
2833
  }
2785
- }, menuTitle)), menuItems && menuItems.map(function (menuItem) {
2834
+ }, menuTitle)), menuItems && menuItems.length ? menuItems.map(function (menuItem) {
2786
2835
  var text = menuItem.text,
2787
2836
  icon = menuItem.icon,
2788
2837
  action = menuItem.action;
@@ -2793,92 +2842,8 @@ var ToggleMenu = function ToggleMenu(_ref) {
2793
2842
  handleClose(event);
2794
2843
  }
2795
2844
  }, icon && /*#__PURE__*/React.createElement(ListItemIcon, null, icon), /*#__PURE__*/React.createElement(Typography, null, text));
2796
- }), children));
2797
- };
2798
-
2799
- /* *
2800
- * Licensed under the Apache License, Version 2.0 (the "License");
2801
- * you may not use this file except in compliance with the License.
2802
- * You may obtain a copy of the License at
2803
- *
2804
- * http://www.apache.org/licenses/LICENSE-2.0
2805
- *
2806
- * Unless required by applicable law or agreed to in writing, software
2807
- * distributed under the License is distributed on an "AS IS" BASIS,
2808
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2809
- * See the License for the specific language governing permissions and
2810
- * limitations under the License.
2811
- *
2812
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2813
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
2814
- * */
2815
-
2816
- var makeButtonStyles = function makeButtonStyles(isActive, isEnabled, isAccessible) {
2817
- return {
2818
- height: '24px',
2819
- width: '24px',
2820
- borderRadius: '5px',
2821
- marginTop: 'auto',
2822
- marginBottom: 'auto',
2823
- color: function color() {
2824
- if (!isEnabled) {
2825
- return 'geowebColors.buttons.flat.disabled.color';
2826
- }
2827
-
2828
- if (isAccessible) {
2829
- return 'geowebColors.greys.accessible';
2830
- }
2831
-
2832
- if (isActive) {
2833
- return 'common.white';
2834
- }
2835
-
2836
- return 'geowebColors.buttons.flat.default.color';
2837
- },
2838
- backgroundColor: function backgroundColor() {
2839
- return isActive ? 'geowebColors.buttons.primary.active.fill' : 'inherit';
2840
- },
2841
- '&:hover': {
2842
- backgroundColor: function backgroundColor() {
2843
- return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
2844
- }
2845
- }
2846
- };
2847
- };
2848
-
2849
- var ManagerButton = function ManagerButton(_a) {
2850
- var _a$tooltipTitle = _a.tooltipTitle,
2851
- tooltipTitle = _a$tooltipTitle === void 0 ? '' : _a$tooltipTitle,
2852
- _a$onClick = _a.onClick,
2853
- onClick = _a$onClick === void 0 ? function () {} : _a$onClick,
2854
- _a$isActive = _a.isActive,
2855
- isActive = _a$isActive === void 0 ? false : _a$isActive,
2856
- _a$isEnabled = _a.isEnabled,
2857
- isEnabled = _a$isEnabled === void 0 ? true : _a$isEnabled,
2858
- icon = _a.icon,
2859
- _a$isAccessible = _a.isAccessible,
2860
- isAccessible = _a$isAccessible === void 0 ? false : _a$isAccessible,
2861
- sx = _a.sx,
2862
- children = _a.children,
2863
- props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "isAccessible", "sx", "children"]);
2864
-
2865
- var buttonStyles = makeButtonStyles(isActive, isEnabled, isAccessible);
2866
-
2867
- var handleClick = function handleClick(event) {
2868
- onClick(event);
2869
- };
2870
-
2871
- return /*#__PURE__*/React.createElement(CustomTooltip, {
2872
- title: tooltipTitle,
2873
- placement: "top",
2874
- sx: {
2875
- pointerEvents: 'none'
2876
- }
2877
- }, children || /*#__PURE__*/React.createElement(IconButton, Object.assign({
2878
- size: "small",
2879
- onClick: handleClick,
2880
- sx: Object.assign(Object.assign({}, buttonStyles), sx)
2881
- }, props), icon));
2845
+ }) : /*#__PURE__*/React.createElement("div", null) // Needed to make the menu work without any menuItems
2846
+ , children));
2882
2847
  };
2883
2848
 
2884
2849
  /* *
@@ -2919,7 +2884,7 @@ var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
2919
2884
  },
2920
2885
  '&.Mui-focused .MuiSelect-select': {
2921
2886
  outline: function outline(theme) {
2922
- return theme.palette.geowebColors.buttons.focusDefault.outline;
2887
+ return theme.palette.geowebColors.buttons.tool.focus.outline;
2923
2888
  },
2924
2889
  borderRadius: 0
2925
2890
  },
@@ -2941,7 +2906,7 @@ var backgroundColor = {
2941
2906
  },
2942
2907
  '&.Mui-focused .MuiSelect-select': {
2943
2908
  outline: function outline(theme) {
2944
- return theme.palette.geowebColors.buttons.focusDefault.outline;
2909
+ return theme.palette.geowebColors.buttons.tool.focus.outline;
2945
2910
  },
2946
2911
  borderRadius: 0,
2947
2912
  backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
@@ -2951,7 +2916,7 @@ var backgroundColor = {
2951
2916
  },
2952
2917
  '&:focus&.MuiButton-root': {
2953
2918
  border: function border(theme) {
2954
- return theme.palette.geowebColors.buttons.focusDefault.outline;
2919
+ return theme.palette.geowebColors.buttons.tool.focus.outline;
2955
2920
  },
2956
2921
  backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill',
2957
2922
  transition: 'border'
@@ -3419,6 +3384,48 @@ var createDate = function createDate(yearOrIsoString, month, day) {
3419
3384
 
3420
3385
  return new Date(yearOrIsoString, month, day, hours, minutes, seconds, milliseconds);
3421
3386
  };
3387
+ /**
3388
+ *
3389
+ * @param date
3390
+ * @param duration
3391
+ * @returns {Date} the new Date
3392
+ */
3393
+
3394
+ var add = function add(date, duration) {
3395
+ return add$1(date, duration);
3396
+ };
3397
+ /**
3398
+ *
3399
+ * @param date
3400
+ * @param duration
3401
+ * @returns {Date} the new Date
3402
+ */
3403
+
3404
+ var sub = function sub(date, duration) {
3405
+ return sub$1(date, duration);
3406
+ };
3407
+ /**
3408
+ * Finds the number of minuts between to dates
3409
+ *
3410
+ * @param dateLeft - the later date
3411
+ * @param dateRight - the earlier date
3412
+ * @returns {number} the number of minutes
3413
+ */
3414
+
3415
+ var differenceInMinutes = function differenceInMinutes(dateLeft, dateRight) {
3416
+ return differenceInMinutes$1(dateLeft, dateRight);
3417
+ };
3418
+ /**
3419
+ * Finds the number of hours between to dates
3420
+ *
3421
+ * @param dateLeft - the later date
3422
+ * @param dateRight - the earlier date
3423
+ * @returns {number} the number of hours
3424
+ */
3425
+
3426
+ var differenceInHours = function differenceInHours(dateLeft, dateRight) {
3427
+ return differenceInHours$1(dateLeft, dateRight);
3428
+ };
3422
3429
 
3423
3430
  /* *
3424
3431
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3444,7 +3451,11 @@ var index = /*#__PURE__*/Object.freeze({
3444
3451
  setUTCDate: setUTCDate,
3445
3452
  dateToString: dateToString,
3446
3453
  isBetween: isBetween,
3447
- createDate: createDate
3454
+ createDate: createDate,
3455
+ add: add,
3456
+ sub: sub,
3457
+ differenceInMinutes: differenceInMinutes,
3458
+ differenceInHours: differenceInHours
3448
3459
  });
3449
3460
 
3450
- export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, ManagerButton, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getPosition, getWarningMessage, isAxiosError, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
3461
+ export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getPosition, getWarningMessage, isAxiosError, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };