@opengeoweb/shared 12.2.0 → 12.4.1

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,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { Box, Typography, useTheme, Tooltip, IconButton, Menu, ListSubheader, MenuItem, Grid2, ListItemText, ListItemIcon, DialogTitle, Button, Dialog, DialogContent, DialogActions, Paper, CircularProgress, Alert, AlertTitle, Drawer, Link, Avatar as Avatar$1, ClickAwayListener, MenuList, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, styled, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment, Chip, Stack, debounce as debounce$1, ListItemButton, Checkbox } from '@mui/material';
2
+ import { Box, Typography, useTheme, Tooltip, IconButton, Menu, ListSubheader, MenuItem, Grid, ListItemText, ListItemIcon, DialogTitle, Button, Dialog, DialogContent, DialogActions, Paper, CircularProgress, Alert, AlertTitle, Drawer, Link, Avatar as Avatar$1, ClickAwayListener, MenuList, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, styled, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment, Chip, Stack, debounce as debounce$1, ListItemButton, Checkbox } from '@mui/material';
3
3
  import * as React from 'react';
4
4
  import React__default, { useRef, Component, useState } from 'react';
5
5
  import Draggable from 'react-draggable';
@@ -7,10 +7,10 @@ import { Resizable } from 're-resizable';
7
7
  import { Resize, Options, Close, ChevronLeft, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Admin, useThemeContext, ThemeTypes, KeyOption, ArrowLeft, ArrowRight, KeyCommand, ArrowUp, ArrowDown, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
8
8
  import 'i18next';
9
9
  import { initReactI18next, useTranslation } from 'react-i18next';
10
- import { throttle, escapeRegExp, debounce } from 'lodash';
10
+ import { throttle, merge, escapeRegExp, debounce } from 'lodash';
11
11
  import * as Sentry from '@sentry/react';
12
12
  import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInYears as differenceInYears$1, differenceInMonths as differenceInMonths$1, differenceInDays as differenceInDays$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, differenceInSeconds as differenceInSeconds$1, roundToNearestMinutes as roundToNearestMinutes$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$1, getHours as getHours$1, startOfDay, addMinutes, addHours, setSeconds as setSeconds$1, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
13
- import { configureStore } from '@reduxjs/toolkit';
13
+ import { fi as fi$1, nl as nl$1, nb, enGB } from 'date-fns/locale';
14
14
 
15
15
  var en = {
16
16
  "shared-choose-app-mode": "Choose your default app mode",
@@ -19,7 +19,7 @@ var en = {
19
19
  "shared-viewer": "Viewer",
20
20
  "shared-editor": "Editor",
21
21
  "shared-reload-page": "Reload page",
22
- "shared-search-label": "Search through services or enter a service URL",
22
+ "shared-search-services": "Search through services or enter a service URL",
23
23
  "shared-last-updated": "Last updated {{time}}",
24
24
  "shared-click-to-refresh": "Click to refresh",
25
25
  "shared-error-occurred": "Woops, an error has occurred. Please report the error shown below and reload the page if needed.",
@@ -82,7 +82,7 @@ var fi = {
82
82
  "shared-viewer": "Katselu",
83
83
  "shared-editor": "Muokkain",
84
84
  "shared-reload-page": "Lataa sivu uudelleen",
85
- "shared-search-label": "Etsi palveluista tai lisää palvelun URL-osoite",
85
+ "shared-search-services": "Etsi palveluista tai lisää palvelun URL-osoite",
86
86
  "shared-last-updated": "Päivitetty viimeksi {{time}}",
87
87
  "shared-click-to-refresh": "Napsauta päivittääksesi",
88
88
  "shared-error-occurred": "Hups, virhe havaittu. Ilmoita ongelmasta eteenpäin ja lataa sivu uudelleen tarvittaessa",
@@ -145,7 +145,7 @@ var no = {
145
145
  "shared-viewer": "Viewer",
146
146
  "shared-editor": "Editor",
147
147
  "shared-reload-page": "Last inn på nytt",
148
- "shared-search-label": "Søk gjennom tjenester eller legg inn URL",
148
+ "shared-search-services": "Søk gjennom tjenester eller legg inn URL",
149
149
  "shared-last-updated": "Sist oppdatert",
150
150
  "shared-click-to-refresh": "Trykk for å laste inn på nytt",
151
151
  "shared-error-occurred": "Woops, an error has occurred. Please report the error shown below and reload the page if needed.",
@@ -208,7 +208,7 @@ var nl = {
208
208
  "shared-viewer": "Kijker",
209
209
  "shared-editor": "Bewerker",
210
210
  "shared-reload-page": "Pagina vernieuwen",
211
- "shared-search-label": "Zoek door services of voer een service-URL in",
211
+ "shared-search-services": "Zoek door services of voer een service-URL in",
212
212
  "shared-last-updated": "Laatst bijgewerkt {{time}}",
213
213
  "shared-click-to-refresh": "Klik om te vernieuwen",
214
214
  "shared-error-occurred": "Oeps, er is een fout opgetreden. Rapporteer de onderstaande fout en herlaad de pagina indien nodig.",
@@ -1032,16 +1032,16 @@ var ToggleMenu = function ToggleMenu(_ref) {
1032
1032
  },
1033
1033
  disabled: isDisabled,
1034
1034
  selected: menuItem.isSelected,
1035
- children: jsxs(Grid2, {
1035
+ children: jsxs(Grid, {
1036
1036
  container: true,
1037
1037
  spacing: 2,
1038
1038
  justifyContent: "space-between",
1039
1039
  size: "grow",
1040
- children: [jsx(Grid2, {
1040
+ children: [jsx(Grid, {
1041
1041
  children: jsx(ListItemText, {
1042
1042
  children: text
1043
1043
  })
1044
- }), icon && jsx(Grid2, {
1044
+ }), icon && jsx(Grid, {
1045
1045
  alignItems: "flex-end",
1046
1046
  children: jsx(ListItemIcon, {
1047
1047
  sx: {
@@ -1157,7 +1157,7 @@ var CustomDialogHeader = function CustomDialogHeader(_ref2) {
1157
1157
  "data-testid": "CloseIcon"
1158
1158
  })
1159
1159
  })]
1160
- }) : jsxs(Grid2, {
1160
+ }) : jsxs(Grid, {
1161
1161
  container: true,
1162
1162
  "data-testid": "dialog-action-header",
1163
1163
  alignItems: "center",
@@ -1168,7 +1168,7 @@ var CustomDialogHeader = function CustomDialogHeader(_ref2) {
1168
1168
  zIndex: 1
1169
1169
  },
1170
1170
  "aria-label": "Dialog options header",
1171
- children: [jsx(Grid2, {
1171
+ children: [jsx(Grid, {
1172
1172
  size: 4,
1173
1173
  children: jsx(Button, {
1174
1174
  onClick: function onClick() {
@@ -1183,7 +1183,7 @@ var CustomDialogHeader = function CustomDialogHeader(_ref2) {
1183
1183
  },
1184
1184
  children: t('shared-customdialog-back')
1185
1185
  })
1186
- }), jsx(Grid2, {
1186
+ }), jsx(Grid, {
1187
1187
  sx: {
1188
1188
  display: 'flex',
1189
1189
  justifyContent: 'center',
@@ -1193,7 +1193,7 @@ var CustomDialogHeader = function CustomDialogHeader(_ref2) {
1193
1193
  children: title && jsx(Title, {
1194
1194
  title: title
1195
1195
  })
1196
- }), jsx(Grid2, {
1196
+ }), jsx(Grid, {
1197
1197
  size: 4,
1198
1198
  children: jsx(Box, {
1199
1199
  sx: {
@@ -2336,6 +2336,8 @@ var styles$4 = {
2336
2336
  backgroundColor: 'geowebColors.background.surface'
2337
2337
  },
2338
2338
  userMenu: {
2339
+ maxHeight: 'calc(100vh - 40px)',
2340
+ overflowY: 'auto',
2339
2341
  padding: 0,
2340
2342
  '& > li': {
2341
2343
  paddingTop: 3,
@@ -2356,8 +2358,10 @@ var UserMenu = function UserMenu(_ref) {
2356
2358
  initials = _ref.initials,
2357
2359
  _ref$isAdmin = _ref.isAdmin,
2358
2360
  isAdmin = _ref$isAdmin === void 0 ? false : _ref$isAdmin;
2361
+ var toggleRef = useRef(null);
2359
2362
  return jsxs(Fragment, {
2360
2363
  children: [jsx(CustomIconButton, {
2364
+ ref: toggleRef,
2361
2365
  "data-testid": "userButton",
2362
2366
  onClick: onToggle,
2363
2367
  sx: {
@@ -2393,7 +2397,13 @@ var UserMenu = function UserMenu(_ref) {
2393
2397
  sx: styles$4.container,
2394
2398
  "data-testid": "userMenu",
2395
2399
  children: jsx(ClickAwayListener, {
2396
- onClickAway: onClose,
2400
+ onClickAway: function onClickAway(event) {
2401
+ var _toggleRef$current;
2402
+ if ((_toggleRef$current = toggleRef.current) != null && _toggleRef$current.contains(event.target)) {
2403
+ return; // don't close here if clicking the toggle
2404
+ }
2405
+ onClose();
2406
+ },
2397
2407
  mouseEvent: "onMouseDown",
2398
2408
  children: jsx(MenuList, {
2399
2409
  sx: styles$4.userMenu,
@@ -2414,11 +2424,11 @@ var MenuItemTheme = function MenuItemTheme(_ref) {
2414
2424
  t = _useTranslation.t;
2415
2425
  return jsx(MenuItem, {
2416
2426
  divider: true,
2417
- children: jsxs(Grid2, {
2427
+ children: jsxs(Grid, {
2418
2428
  container: true,
2419
- children: [jsx(Grid2, {
2429
+ children: [jsx(Grid, {
2420
2430
  children: t('shared-choose-app-mode')
2421
- }), jsx(Grid2, {
2431
+ }), jsx(Grid, {
2422
2432
  children: jsxs(RadioGroup, {
2423
2433
  onChange: function onChange(event, value) {
2424
2434
  if (value && setThemeName) {
@@ -2569,7 +2579,7 @@ var ToolHeader = function ToolHeader(_ref) {
2569
2579
  }),
2570
2580
  role: "heading",
2571
2581
  "aria-label": "toolheader",
2572
- children: jsxs(Grid2, {
2582
+ children: jsxs(Grid, {
2573
2583
  container: true,
2574
2584
  alignItems: "center",
2575
2585
  sx: {
@@ -2577,14 +2587,14 @@ var ToolHeader = function ToolHeader(_ref) {
2577
2587
  height: styles.height
2578
2588
  },
2579
2589
  justifyContent: "space-between",
2580
- children: [jsx(Grid2, {
2590
+ children: [jsx(Grid, {
2581
2591
  className: "header-left",
2582
2592
  sx: {
2583
2593
  paddingRight: 1
2584
2594
  },
2585
2595
  size: columnSizeLeft,
2586
2596
  children: leftHeaderComponent && leftHeaderComponent
2587
- }), jsx(Grid2, {
2597
+ }), jsx(Grid, {
2588
2598
  className: "header-title",
2589
2599
  size: title ? columnSizeTitle : 0,
2590
2600
  container: true,
@@ -2606,7 +2616,7 @@ var ToolHeader = function ToolHeader(_ref) {
2606
2616
  role: "heading",
2607
2617
  children: title
2608
2618
  })
2609
- }), jsxs(Grid2, {
2619
+ }), jsxs(Grid, {
2610
2620
  className: "header-right",
2611
2621
  container: true,
2612
2622
  justifyContent: "flex-end",
@@ -3446,13 +3456,13 @@ var ShortcutList = function ShortcutList(_ref) {
3446
3456
  minHeight: 56
3447
3457
  },
3448
3458
  divider: index !== shortcuts.length - 1,
3449
- children: jsxs(Grid2, {
3459
+ children: jsxs(Grid, {
3450
3460
  container: true,
3451
3461
  direction: "row",
3452
3462
  justifyContent: "space-between",
3453
3463
  alignItems: "center",
3454
3464
  size: "grow",
3455
- children: [jsx(Grid2, {
3465
+ children: [jsx(Grid, {
3456
3466
  sx: {
3457
3467
  fontSize: 12,
3458
3468
  fontWeight: 300,
@@ -3460,7 +3470,7 @@ var ShortcutList = function ShortcutList(_ref) {
3460
3470
  opacity: 0.67
3461
3471
  },
3462
3472
  children: t(shortcut.titleKey)
3463
- }), jsx(Grid2, {
3473
+ }), jsx(Grid, {
3464
3474
  children: jsx(Box, {
3465
3475
  sx: {
3466
3476
  alignItems: 'center'
@@ -3546,9 +3556,9 @@ var UserMenuItemCheatSheet = function UserMenuItemCheatSheet() {
3546
3556
  "data-testid": "cheatsheet-btn",
3547
3557
  onClick: onOpen,
3548
3558
  divider: true,
3549
- children: jsx(Grid2, {
3559
+ children: jsx(Grid, {
3550
3560
  container: true,
3551
- children: jsx(Grid2, {
3561
+ children: jsx(Grid, {
3552
3562
  children: t('shared-cheat-sheet')
3553
3563
  })
3554
3564
  })
@@ -3689,9 +3699,9 @@ var UserMenuItemSentryRecording = function UserMenuItemSentryRecording(_ref) {
3689
3699
  "data-testid": "sentryRecording-btn",
3690
3700
  onClick: onOpen,
3691
3701
  divider: true,
3692
- children: jsx(Grid2, {
3702
+ children: jsx(Grid, {
3693
3703
  container: true,
3694
- children: jsx(Grid2, {
3704
+ children: jsx(Grid, {
3695
3705
  children: t('shared-sentry-recording')
3696
3706
  })
3697
3707
  })
@@ -3711,14 +3721,14 @@ var UserMenuItemSentryRecording = function UserMenuItemSentryRecording(_ref) {
3711
3721
  isOpen: true,
3712
3722
  onClose: onClose,
3713
3723
  bounds: "parent",
3714
- children: jsxs(Grid2, {
3724
+ children: jsxs(Grid, {
3715
3725
  container: true,
3716
3726
  spacing: 4,
3717
3727
  sx: {
3718
3728
  paddingLeft: '70px',
3719
3729
  paddingRight: '70px'
3720
3730
  },
3721
- children: [jsx(Grid2, {
3731
+ children: [jsx(Grid, {
3722
3732
  container: true,
3723
3733
  justifyContent: "center",
3724
3734
  sx: {
@@ -3727,7 +3737,7 @@ var UserMenuItemSentryRecording = function UserMenuItemSentryRecording(_ref) {
3727
3737
  children: jsx(Typography, {
3728
3738
  children: t('shared-sentry-information')
3729
3739
  })
3730
- }), jsx(Grid2, {
3740
+ }), jsx(Grid, {
3731
3741
  container: true,
3732
3742
  justifyContent: "center",
3733
3743
  sx: {
@@ -3736,7 +3746,7 @@ var UserMenuItemSentryRecording = function UserMenuItemSentryRecording(_ref) {
3736
3746
  children: jsx(Typography, {
3737
3747
  children: t('shared-sentry-enable-message')
3738
3748
  })
3739
- }), jsxs(Grid2, {
3749
+ }), jsxs(Grid, {
3740
3750
  container: true,
3741
3751
  alignItems: "center",
3742
3752
  direction: "column",
@@ -3749,7 +3759,7 @@ var UserMenuItemSentryRecording = function UserMenuItemSentryRecording(_ref) {
3749
3759
  }) : jsxs(Typography, {
3750
3760
  children: [" ", t('shared-sentry-enable')]
3751
3761
  })]
3752
- }), jsxs(Grid2, {
3762
+ }), jsxs(Grid, {
3753
3763
  container: true,
3754
3764
  alignItems: "center",
3755
3765
  direction: "column",
@@ -3773,7 +3783,7 @@ var UserMenuItemSentryRecording = function UserMenuItemSentryRecording(_ref) {
3773
3783
  children: ["(", t('shared-sentry-cors-wait'), ")"]
3774
3784
  })]
3775
3785
  })]
3776
- }), jsx(Grid2, {
3786
+ }), jsx(Grid, {
3777
3787
  container: true,
3778
3788
  justifyContent: "center",
3779
3789
  children: jsx(Typography, {
@@ -3858,7 +3868,7 @@ var getInitials = function getInitials(name) {
3858
3868
  }
3859
3869
  };
3860
3870
 
3861
- var _excluded$6 = ["value", "orientation", "shouldAutoFocus"];
3871
+ var _excluded$6 = ["value", "orientation", "shouldAutoFocus", "extraStyles"];
3862
3872
  var sliderHeaderStyle = {
3863
3873
  fontFamily: 'Roboto-Black, Roboto',
3864
3874
  fontSize: 12,
@@ -3915,6 +3925,8 @@ var CustomSlider = function CustomSlider(_ref) {
3915
3925
  orientation = _ref$orientation === void 0 ? 'vertical' : _ref$orientation,
3916
3926
  _ref$shouldAutoFocus = _ref.shouldAutoFocus,
3917
3927
  shouldAutoFocus = _ref$shouldAutoFocus === void 0 ? false : _ref$shouldAutoFocus,
3928
+ _ref$extraStyles = _ref.extraStyles,
3929
+ extraStyles = _ref$extraStyles === void 0 ? {} : _ref$extraStyles,
3918
3930
  props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
3919
3931
  // Add custom class (for bold text) to label adjacent to thumb component.
3920
3932
  // Material UI doesn't support highlighing only adjacent label
@@ -3944,8 +3956,9 @@ var CustomSlider = function CustomSlider(_ref) {
3944
3956
  }
3945
3957
  // eslint-disable-next-line react-hooks/exhaustive-deps
3946
3958
  }, []);
3959
+ var mergedStyles = merge(extraStyles, sliderStyle);
3947
3960
  return jsx(Slider, Object.assign({
3948
- sx: sliderStyle,
3961
+ sx: mergedStyles,
3949
3962
  ref: element,
3950
3963
  value: value,
3951
3964
  orientation: orientation,
@@ -4386,7 +4399,7 @@ var SearchFieldButton = function SearchFieldButton(_ref2) {
4386
4399
  setPopupIsOpen = _ref2.setPopupIsOpen;
4387
4400
  var _useSharedTranslation2 = useSharedTranslation(),
4388
4401
  t = _useSharedTranslation2.t;
4389
- if (isURL(localSearchString)) {
4402
+ if (isURL(localSearchString) && setPopupIsOpen) {
4390
4403
  return jsxs(Fragment, {
4391
4404
  children: [jsx("div", {
4392
4405
  style: {
@@ -4420,11 +4433,33 @@ var SearchFieldButton = function SearchFieldButton(_ref2) {
4420
4433
  });
4421
4434
  };
4422
4435
 
4436
+ var stylesSmall = {
4437
+ '.MuiInputLabel-root': {
4438
+ lineHeight: '16px',
4439
+ fontSize: '12px',
4440
+ top: '-6px',
4441
+ transform: 'translate(12px, 7px) scale(1)',
4442
+ ':not(.MuiInputLabel-shrink)': {
4443
+ transform: 'translate(12px, 10px) scale(1.6)'
4444
+ }
4445
+ },
4446
+ '.MuiFilledInput-input': {
4447
+ lineHeight: '20px',
4448
+ padding: '10px 0 1px 12px'
4449
+ },
4450
+ '.MuiButtonBase-root.MuiIconButton-root': {
4451
+ height: '32px!important',
4452
+ width: '32px!important',
4453
+ marginRight: '-4px!important'
4454
+ }
4455
+ };
4423
4456
  var SearchField$1 = function SearchField(_ref) {
4424
4457
  var searchFilter = _ref.searchFilter,
4425
4458
  label = _ref.label,
4426
4459
  setSearchFilter = _ref.setSearchFilter,
4427
- onOpenServicePopup = _ref.onOpenServicePopup;
4460
+ onOpenServicePopup = _ref.onOpenServicePopup,
4461
+ _ref$small = _ref.small,
4462
+ small = _ref$small === void 0 ? false : _ref$small;
4428
4463
  var _React$useState = React.useState(''),
4429
4464
  localSearchString = _React$useState[0],
4430
4465
  setLocalSearchString = _React$useState[1];
@@ -4433,7 +4468,7 @@ var SearchField$1 = function SearchField(_ref) {
4433
4468
  setUrlIsValid = _React$useState2[1];
4434
4469
  var _useTranslation = useTranslation(SHARED_NAMESPACE),
4435
4470
  t = _useTranslation.t;
4436
- var translatedLabel = label || t('shared-search-label');
4471
+ var translatedLabel = label || (onOpenServicePopup ? t('shared-search-services') : t('shared-search'));
4437
4472
  // eslint-disable-next-line react-hooks/exhaustive-deps
4438
4473
  var setSearchFilterDebounced = React.useCallback(debounce(setSearchFilter, 300), []);
4439
4474
  var handleChange = function handleChange(text) {
@@ -4453,7 +4488,7 @@ var SearchField$1 = function SearchField(_ref) {
4453
4488
  var keyDownHandler = function keyDownHandler(event) {
4454
4489
  if (event.key === 'Enter') {
4455
4490
  event.preventDefault();
4456
- if (urlIsValid) {
4491
+ if (urlIsValid && onOpenServicePopup) {
4457
4492
  onOpenServicePopup(localSearchString);
4458
4493
  setLocalSearchString('');
4459
4494
  }
@@ -4486,10 +4521,10 @@ var SearchField$1 = function SearchField(_ref) {
4486
4521
  endAdornment: jsx(InputAdornment, {
4487
4522
  position: "end",
4488
4523
  children: jsx(SearchFieldButton, {
4489
- setPopupIsOpen: function setPopupIsOpen() {
4524
+ setPopupIsOpen: onOpenServicePopup ? function () {
4490
4525
  onOpenServicePopup(localSearchString);
4491
4526
  setLocalSearchString('');
4492
- },
4527
+ } : undefined,
4493
4528
  localSearchString: localSearchString,
4494
4529
  onClickClear: function onClickClear() {
4495
4530
  setLocalSearchString('');
@@ -4499,7 +4534,8 @@ var SearchField$1 = function SearchField(_ref) {
4499
4534
  })
4500
4535
  })
4501
4536
  }
4502
- }
4537
+ },
4538
+ sx: small ? stylesSmall : {}
4503
4539
  });
4504
4540
  };
4505
4541
 
@@ -5271,6 +5307,18 @@ var DATE_FORMAT_NAME_OF_DAY = 'eee dd/MM/yyyy HH:mm';
5271
5307
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
5272
5308
  * */
5273
5309
  // eslint-disable-next-line no-restricted-imports
5310
+ var getDateFnsLocale = function getDateFnsLocale(locale) {
5311
+ if (locale === 'fi') {
5312
+ return fi$1;
5313
+ }
5314
+ if (locale === 'nl') {
5315
+ return nl$1;
5316
+ }
5317
+ if (locale === 'no') {
5318
+ return nb;
5319
+ }
5320
+ return enGB;
5321
+ };
5274
5322
  /**
5275
5323
  * Parsing date strings with geoweb dateUtils:
5276
5324
  *
@@ -5421,7 +5469,7 @@ var setUTCDate = function setUTCDate(inDate) {
5421
5469
  * @example
5422
5470
  * ``` dateToString(new Date(2022, 10, 12, 15, 30), 'dd MMM yyyy') ```
5423
5471
  */
5424
- var dateToString = function dateToString(inDate, strFormat, utc) {
5472
+ var dateToString = function dateToString(inDate, strFormat, utc, locale) {
5425
5473
  if (strFormat === void 0) {
5426
5474
  strFormat = DATE_FORMAT_UTC;
5427
5475
  }
@@ -5431,7 +5479,11 @@ var dateToString = function dateToString(inDate, strFormat, utc) {
5431
5479
  if (!inDate || !isValid(inDate)) {
5432
5480
  return undefined;
5433
5481
  }
5434
- var formattedDate = utc ? format(new Date(inDate.getUTCFullYear(), inDate.getUTCMonth(), inDate.getUTCDate(), inDate.getUTCHours(), inDate.getUTCMinutes(), inDate.getUTCSeconds()), strFormat) : format(inDate, strFormat);
5482
+ var formattedDate = utc ? format(new Date(inDate.getUTCFullYear(), inDate.getUTCMonth(), inDate.getUTCDate(), inDate.getUTCHours(), inDate.getUTCMinutes(), inDate.getUTCSeconds()), strFormat, {
5483
+ locale: getDateFnsLocale(locale)
5484
+ }) : format(inDate, strFormat, {
5485
+ locale: getDateFnsLocale(locale)
5486
+ });
5435
5487
  return formattedDate;
5436
5488
  };
5437
5489
  /**
@@ -5951,6 +6003,7 @@ var index = /*#__PURE__*/Object.freeze({
5951
6003
  differenceInYears: differenceInYears,
5952
6004
  fromUnix: fromUnix,
5953
6005
  getCurrentTimeAsString: getCurrentTimeAsString,
6006
+ getDateFnsLocale: getDateFnsLocale,
5954
6007
  getDay: getDay,
5955
6008
  getDayOfYear: getDayOfYear,
5956
6009
  getHours: getHours,
@@ -5985,33 +6038,6 @@ var index = /*#__PURE__*/Object.freeze({
5985
6038
  utc: utc
5986
6039
  });
5987
6040
 
5988
- /* *
5989
- * Licensed under the Apache License, Version 2.0 (the "License");
5990
- * you may not use this file except in compliance with the License.
5991
- * You may obtain a copy of the License at
5992
- *
5993
- * http://www.apache.org/licenses/LICENSE-2.0
5994
- *
5995
- * Unless required by applicable law or agreed to in writing, software
5996
- * distributed under the License is distributed on an "AS IS" BASIS,
5997
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5998
- * See the License for the specific language governing permissions and
5999
- * limitations under the License.
6000
- *
6001
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6002
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
6003
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
6004
- * */
6005
- var createToolkitMockStore = function createToolkitMockStore(storeConfig) {
6006
- var reducer = storeConfig.reducer,
6007
- preloadedState = storeConfig.preloadedState;
6008
- var store = configureStore(Object.assign({}, storeConfig, {
6009
- reducer: reducer,
6010
- preloadedState: preloadedState
6011
- }));
6012
- return store;
6013
- };
6014
-
6015
6041
  /* *
6016
6042
  * Licensed under the Apache License, Version 2.0 (the "License");
6017
6043
  * you may not use this file except in compliance with the License.
@@ -6156,6 +6182,83 @@ var RenderCounter = /*#__PURE__*/function () {
6156
6182
  }();
6157
6183
  var renderCounter = new RenderCounter();
6158
6184
 
6185
+ /* *
6186
+ * Licensed under the Apache License, Version 2.0 (the "License");
6187
+ * you may not use this file except in compliance with the License.
6188
+ * You may obtain a copy of the License at
6189
+ *
6190
+ * http://www.apache.org/licenses/LICENSE-2.0
6191
+ *
6192
+ * Unless required by applicable law or agreed to in writing, software
6193
+ * distributed under the License is distributed on an "AS IS" BASIS,
6194
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6195
+ * See the License for the specific language governing permissions and
6196
+ * limitations under the License.
6197
+ *
6198
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6199
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
6200
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
6201
+ * */
6202
+ var SessionStorageKey;
6203
+ (function (SessionStorageKey) {
6204
+ SessionStorageKey["CONFIG"] = "config";
6205
+ SessionStorageKey["OAUTH_STATE"] = "oauth_state";
6206
+ SessionStorageKey["OAUTH_CODE_VERIFIER"] = "code_verifier";
6207
+ SessionStorageKey["OAUTH_CODE_CHALLENGE"] = "code_challenge";
6208
+ SessionStorageKey["HAS_AUTHENTICATED"] = "has_authenticated";
6209
+ SessionStorageKey["CALLBACK_URL"] = "callback_url";
6210
+ })(SessionStorageKey || (SessionStorageKey = {}));
6211
+ var sessionStorageProvider = {
6212
+ setConfig: function setConfig(value) {
6213
+ return sessionStorage.setItem(SessionStorageKey.CONFIG, JSON.stringify(value));
6214
+ },
6215
+ getConfig: function getConfig() {
6216
+ return JSON.parse(sessionStorage.getItem(SessionStorageKey.CONFIG) || '{}');
6217
+ },
6218
+ setOauthState: function setOauthState(value) {
6219
+ return sessionStorage.setItem(SessionStorageKey.OAUTH_STATE, value);
6220
+ },
6221
+ getOauthState: function getOauthState() {
6222
+ return sessionStorage.getItem(SessionStorageKey.OAUTH_STATE);
6223
+ },
6224
+ removeOauthState: function removeOauthState() {
6225
+ return sessionStorage.removeItem(SessionStorageKey.OAUTH_STATE);
6226
+ },
6227
+ setOauthCodeVerifier: function setOauthCodeVerifier(value) {
6228
+ return sessionStorage.setItem(SessionStorageKey.OAUTH_CODE_VERIFIER, value);
6229
+ },
6230
+ getOauthCodeVerifier: function getOauthCodeVerifier() {
6231
+ return sessionStorage.getItem(SessionStorageKey.OAUTH_CODE_VERIFIER);
6232
+ },
6233
+ removeOauthCodeVerifier: function removeOauthCodeVerifier() {
6234
+ return sessionStorage.removeItem(SessionStorageKey.OAUTH_CODE_VERIFIER);
6235
+ },
6236
+ setOauthCodeChallenge: function setOauthCodeChallenge(value) {
6237
+ return sessionStorage.setItem(SessionStorageKey.OAUTH_CODE_CHALLENGE, value);
6238
+ },
6239
+ getOauthCodeChallenge: function getOauthCodeChallenge() {
6240
+ return sessionStorage.getItem(SessionStorageKey.OAUTH_CODE_CHALLENGE);
6241
+ },
6242
+ removeOauthCodeChallenge: function removeOauthCodeChallenge() {
6243
+ return sessionStorage.removeItem(SessionStorageKey.OAUTH_CODE_CHALLENGE);
6244
+ },
6245
+ setHasAuthenticated: function setHasAuthenticated(value) {
6246
+ return sessionStorage.setItem(SessionStorageKey.HAS_AUTHENTICATED, value);
6247
+ },
6248
+ getHasAuthenticated: function getHasAuthenticated() {
6249
+ return sessionStorage.getItem(SessionStorageKey.HAS_AUTHENTICATED);
6250
+ },
6251
+ removeHasAuthenticated: function removeHasAuthenticated() {
6252
+ return sessionStorage.removeItem(SessionStorageKey.HAS_AUTHENTICATED);
6253
+ },
6254
+ getCallbackUrl: function getCallbackUrl() {
6255
+ return sessionStorage.getItem(SessionStorageKey.CALLBACK_URL);
6256
+ },
6257
+ setCallbackUrl: function setCallbackUrl(value) {
6258
+ return sessionStorage.setItem(SessionStorageKey.CALLBACK_URL, value);
6259
+ }
6260
+ };
6261
+
6159
6262
  /* *
6160
6263
  * Licensed under the Apache License, Version 2.0 (the "License");
6161
6264
  * you may not use this file except in compliance with the License.
@@ -6179,4 +6282,4 @@ var SystemScope = {
6179
6282
  system: 'system'
6180
6283
  };
6181
6284
 
6182
- export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationButtons, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomDialogHeader, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, StorybookDocsWrapper, StyledSelect, SwitchButton, SystemScope, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createToolkitMockStore, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosAuthError, isAxiosError, loadAllTranslations, pollingIntervalTimeout, renderCounter, safelyInitI18nForTestsAndStories, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, useWheelStopPropagation };
6285
+ export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationButtons, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomDialogHeader, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, SessionStorageKey, StatusTag, StorybookDocsWrapper, StyledSelect, SwitchButton, SystemScope, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosAuthError, isAxiosError, loadAllTranslations, pollingIntervalTimeout, renderCounter, safelyInitI18nForTestsAndStories, sessionStorageProvider, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, useWheelStopPropagation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "12.2.0",
3
+ "version": "12.4.1",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,17 +8,16 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/theme": "12.2.0",
11
+ "@opengeoweb/theme": "12.4.1",
12
12
  "react-draggable": "^4.4.6",
13
13
  "re-resizable": "^6.9.11",
14
14
  "lodash": "^4.17.21",
15
15
  "axios": "^1.7.7",
16
16
  "date-fns": "^4.1.0",
17
- "@reduxjs/toolkit": "^1.9.7",
18
17
  "react-i18next": "^15.1.1",
19
- "i18next": "^23.11.5",
18
+ "i18next": "^25.0.1",
20
19
  "@sentry/react": "^8.34.0",
21
- "@mui/material": "^6.1.1"
20
+ "@mui/material": "^7.0.1"
22
21
  },
23
22
  "peerDependencies": {
24
23
  "react": "18",
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SliderProps } from '@mui/material';
2
+ import { SliderProps, SxProps } from '@mui/material';
3
3
  export declare const sliderHeaderStyle: {
4
4
  fontFamily: string;
5
5
  fontSize: number;
@@ -8,6 +8,7 @@ export declare const sliderHeaderStyle: {
8
8
  };
9
9
  interface CustomSliderProps extends SliderProps {
10
10
  shouldAutoFocus?: boolean;
11
+ extraStyles?: SxProps;
11
12
  }
12
13
  export declare const CustomSlider: React.FC<CustomSliderProps>;
13
14
  export default CustomSlider;
@@ -3,7 +3,8 @@ interface SearchFieldProps {
3
3
  searchFilter: string;
4
4
  label?: string;
5
5
  setSearchFilter: (filterText: string) => void;
6
- onOpenServicePopup: (url: string) => void;
6
+ onOpenServicePopup?: (url: string) => void;
7
+ small?: boolean;
7
8
  }
8
9
  export declare const SearchField: React.FC<SearchFieldProps>;
9
10
  export {};
@@ -3,7 +3,7 @@ export declare const isURL: (string: string) => boolean;
3
3
  interface FieldButtonProps {
4
4
  localSearchString: string;
5
5
  onClickClear: () => void;
6
- setPopupIsOpen: (value: boolean) => void;
6
+ setPopupIsOpen?: (value: boolean) => void;
7
7
  }
8
8
  export declare const SearchFieldButton: React.FC<FieldButtonProps>;
9
9
  export {};
@@ -1,4 +1,4 @@
1
- import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek, NearestMinutes } from 'date-fns';
1
+ import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek, NearestMinutes, Locale } from 'date-fns';
2
2
  export interface DateValues {
3
3
  year?: number;
4
4
  month?: number;
@@ -8,6 +8,7 @@ export interface DateValues {
8
8
  seconds?: number;
9
9
  milliseconds?: number;
10
10
  }
11
+ export declare const getDateFnsLocale: (locale?: string) => Locale;
11
12
  /**
12
13
  * Parsing date strings with geoweb dateUtils:
13
14
  *
@@ -107,7 +108,7 @@ export declare const setUTCDate: (inDate: Date | undefined) => Date | undefined;
107
108
  * @example
108
109
  * ``` dateToString(new Date(2022, 10, 12, 15, 30), 'dd MMM yyyy') ```
109
110
  */
110
- export declare const dateToString: (inDate: Date | undefined, strFormat?: string, utc?: boolean) => string | undefined;
111
+ export declare const dateToString: (inDate: Date | undefined, strFormat?: string, utc?: boolean, locale?: string) => string | undefined;
111
112
  /**
112
113
  * Find out if a date is between two other dates.
113
114
  *
@@ -1,5 +1,6 @@
1
1
  export * from './axiosErrorUtils';
2
2
  export * as dateUtils from './dateUtils';
3
- export * from './reduxTestUtils';
4
3
  export * from './mapProjections';
5
4
  export { renderCounter } from './renderCounter';
5
+ export { sessionStorageProvider, SessionStorageKey } from './sessionStorage';
6
+ export type { SessionStorageProvider } from './sessionStorage';
@@ -0,0 +1,28 @@
1
+ import { ConfigType } from '../types';
2
+ export interface SessionStorageProvider {
3
+ setConfig: (value: ConfigType) => void;
4
+ getConfig: () => ConfigType;
5
+ setOauthState: (value: string) => void;
6
+ getOauthState: () => string;
7
+ removeOauthState: () => void;
8
+ setOauthCodeVerifier: (value: string) => void;
9
+ getOauthCodeVerifier: () => string;
10
+ removeOauthCodeVerifier: () => void;
11
+ setOauthCodeChallenge: (value: string) => void;
12
+ getOauthCodeChallenge: () => string;
13
+ removeOauthCodeChallenge: () => void;
14
+ setHasAuthenticated: (value: string) => void;
15
+ getHasAuthenticated: () => string;
16
+ removeHasAuthenticated: () => void;
17
+ getCallbackUrl: () => string;
18
+ setCallbackUrl: (value: string) => void;
19
+ }
20
+ export declare enum SessionStorageKey {
21
+ CONFIG = "config",
22
+ OAUTH_STATE = "oauth_state",
23
+ OAUTH_CODE_VERIFIER = "code_verifier",
24
+ OAUTH_CODE_CHALLENGE = "code_challenge",
25
+ HAS_AUTHENTICATED = "has_authenticated",
26
+ CALLBACK_URL = "callback_url"
27
+ }
28
+ export declare const sessionStorageProvider: SessionStorageProvider;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +0,0 @@
1
- import { ConfigureStoreOptions, ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
2
- export declare const createToolkitMockStore: (storeConfig: ConfigureStoreOptions) => ToolkitStore;
@@ -1 +0,0 @@
1
- export * from './createMockStore';