@opengeoweb/shared 4.17.0 → 4.18.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,7 +1,7 @@
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, Checkbox, Select, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
4
- import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, Delete, VisibilityOff, Visibility, ChevronDown } from '@opengeoweb/theme';
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';
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';
@@ -215,8 +215,7 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
215
215
  },
216
216
  onClick: function onClick() {
217
217
  return onClose('CANCELLED');
218
- },
219
- disableFocusRipple: true
218
+ }
220
219
  }, cancelLabel), isLoading ? /*#__PURE__*/React.createElement(Box, {
221
220
  "data-testid": "confirm-dialog-spinner",
222
221
  sx: Object.assign(Object.assign({}, confirmStyle), {
@@ -241,8 +240,7 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
241
240
  });
242
241
  },
243
242
  onClick: onSubmit,
244
- autoFocus: !disableAutoFocus,
245
- disableFocusRipple: true
243
+ autoFocus: !disableAutoFocus
246
244
  }, confirmLabel))
247
245
  }, rest), content);
248
246
  };
@@ -639,7 +637,10 @@ var adjustPosition = function adjustPosition(bbox, containingView, position, set
639
637
  };
640
638
  var useMakeSureContainerStaysInsideWindow = function useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition) {
641
639
  var onResizeWindow = React__default.useCallback(function () {
642
- if (!nodeRef.current) return;
640
+ if (!nodeRef.current) {
641
+ return;
642
+ }
643
+
643
644
  var bbox = nodeRef.current.firstChild.getBoundingClientRect();
644
645
  var containingView = nodeRef.current.parentElement.getBoundingClientRect();
645
646
  adjustPosition(bbox, containingView, position, setPosition);
@@ -1179,8 +1180,8 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
1179
1180
  return /*#__PURE__*/React.createElement(Box, {
1180
1181
  sx: {
1181
1182
  whiteSpace: 'pre-wrap',
1182
- width: 'inherit',
1183
- height: 'inherit',
1183
+ width: '100%',
1184
+ height: '100%',
1184
1185
  overflowY: 'scroll'
1185
1186
  }
1186
1187
  }, /*#__PURE__*/React.createElement(AlertBanner, {
@@ -1892,6 +1893,10 @@ var DraggableComponent = function DraggableComponent(_a) {
1892
1893
  onResizeStop = _a$onResizeStop === void 0 ? function () {} : _a$onResizeStop,
1893
1894
  _a$onDragEnd = _a.onDragEnd,
1894
1895
  onDragEnd = _a$onDragEnd === void 0 ? function () {} : _a$onDragEnd,
1896
+ _a$onFocus = _a.onFocus,
1897
+ onFocus = _a$onFocus === void 0 ? function () {} : _a$onFocus,
1898
+ _a$onBlur = _a.onBlur,
1899
+ onBlur = _a$onBlur === void 0 ? function () {} : _a$onBlur,
1895
1900
  _a$order = _a.order,
1896
1901
  order = _a$order === void 0 ? 1 : _a$order,
1897
1902
  _a$source = _a.source,
@@ -1903,7 +1908,7 @@ var DraggableComponent = function DraggableComponent(_a) {
1903
1908
  className = _a.className,
1904
1909
  _a$sx = _a.sx,
1905
1910
  sx = _a$sx === void 0 ? {} : _a$sx,
1906
- props = __rest(_a, ["title", "bounds", "cancel", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "onResizeStop", "onDragEnd", "order", "source", "leftHeaderComponent", "rightHeaderComponent", "className", "sx"]);
1911
+ props = __rest(_a, ["title", "bounds", "cancel", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "onResizeStop", "onDragEnd", "onFocus", "onBlur", "order", "source", "leftHeaderComponent", "rightHeaderComponent", "className", "sx"]);
1907
1912
 
1908
1913
  var zIndex = (source === 'app' ? BASE_Z_INDEX : 1000) + order;
1909
1914
  var elevation = BASE_ELEVATION + order;
@@ -1978,6 +1983,9 @@ var DraggableComponent = function DraggableComponent(_a) {
1978
1983
  handle: ".".concat(headerClassName),
1979
1984
  onMouseDown: onMouseDown
1980
1985
  }, /*#__PURE__*/React__default.createElement(Box, {
1986
+ tabIndex: -1,
1987
+ onFocus: onFocus,
1988
+ onBlur: onBlur,
1981
1989
  sx: Object.assign(Object.assign(Object.assign({
1982
1990
  position: 'absolute',
1983
1991
  pointerEvents: 'all',
@@ -2461,7 +2469,10 @@ var useUserMenu = function useUserMenu() {
2461
2469
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2462
2470
  * */
2463
2471
  var getInitials = function getInitials(name) {
2464
- if (!name) return '';
2472
+ if (!name) {
2473
+ return '';
2474
+ }
2475
+
2465
2476
  var nameWithoutEmail = name.split('@')[0];
2466
2477
  var array = nameWithoutEmail.split('.');
2467
2478
 
@@ -2545,7 +2556,10 @@ var CustomSlider = function CustomSlider(_a) {
2545
2556
  first = _reverse2[0],
2546
2557
  rest = _reverse2.slice(1);
2547
2558
 
2548
- if (first) first.classList.add('selectedLabel');
2559
+ if (first) {
2560
+ first.classList.add('selectedLabel');
2561
+ }
2562
+
2549
2563
  rest.forEach(function (element) {
2550
2564
  return element.classList.remove('selectedLabel');
2551
2565
  });
@@ -2743,7 +2757,10 @@ var ToggleMenu = function ToggleMenu(_ref) {
2743
2757
  anchorEl: anchorEl,
2744
2758
  open: isOpen,
2745
2759
  onClose: function onClose(event, reason) {
2746
- if (reason === 'tabKeyDown') return;
2760
+ if (reason === 'tabKeyDown') {
2761
+ return;
2762
+ }
2763
+
2747
2764
  handleClose(event);
2748
2765
  },
2749
2766
  anchorOrigin: anchorOrigin,
@@ -2821,13 +2838,6 @@ var makeButtonStyles = function makeButtonStyles(isActive, isEnabled, isAccessib
2821
2838
  backgroundColor: function backgroundColor() {
2822
2839
  return isActive ? 'geowebColors.buttons.primary.active.fill' : 'inherit';
2823
2840
  },
2824
- '&:focus': {
2825
- backgroundColor: function backgroundColor() {
2826
- return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
2827
- },
2828
- outline: 'geowebColors.buttons.focusDefault.outline',
2829
- borderRadius: 0
2830
- },
2831
2841
  '&:hover': {
2832
2842
  backgroundColor: function backgroundColor() {
2833
2843
  return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
@@ -2846,12 +2856,11 @@ var ManagerButton = function ManagerButton(_a) {
2846
2856
  _a$isEnabled = _a.isEnabled,
2847
2857
  isEnabled = _a$isEnabled === void 0 ? true : _a$isEnabled,
2848
2858
  icon = _a.icon,
2849
- testId = _a.testId,
2850
2859
  _a$isAccessible = _a.isAccessible,
2851
2860
  isAccessible = _a$isAccessible === void 0 ? false : _a$isAccessible,
2852
2861
  sx = _a.sx,
2853
2862
  children = _a.children,
2854
- props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "sx", "children"]);
2863
+ props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "isAccessible", "sx", "children"]);
2855
2864
 
2856
2865
  var buttonStyles = makeButtonStyles(isActive, isEnabled, isAccessible);
2857
2866
 
@@ -2868,117 +2877,10 @@ var ManagerButton = function ManagerButton(_a) {
2868
2877
  }, children || /*#__PURE__*/React.createElement(IconButton, Object.assign({
2869
2878
  size: "small",
2870
2879
  onClick: handleClick,
2871
- "data-testid": testId,
2872
- sx: Object.assign(Object.assign({}, buttonStyles), sx),
2873
- disableFocusRipple: true
2880
+ sx: Object.assign(Object.assign({}, buttonStyles), sx)
2874
2881
  }, props), icon));
2875
2882
  };
2876
2883
 
2877
- /* *
2878
- * Licensed under the Apache License, Version 2.0 (the "License");
2879
- * you may not use this file except in compliance with the License.
2880
- * You may obtain a copy of the License at
2881
- *
2882
- * http://www.apache.org/licenses/LICENSE-2.0
2883
- *
2884
- * Unless required by applicable law or agreed to in writing, software
2885
- * distributed under the License is distributed on an "AS IS" BASIS,
2886
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2887
- * See the License for the specific language governing permissions and
2888
- * limitations under the License.
2889
- *
2890
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2891
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
2892
- * */
2893
- var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
2894
- var tooltipTitle = _ref.tooltipTitle,
2895
- onClickDelete = _ref.onClickDelete,
2896
- _ref$isEnabled = _ref.isEnabled,
2897
- isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
2898
- sx = _ref.sx;
2899
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ManagerButton, {
2900
- tooltipTitle: tooltipTitle,
2901
- onClick: onClickDelete,
2902
- testId: "deleteButtonMedium",
2903
- isEnabled: isEnabled,
2904
- icon: /*#__PURE__*/React.createElement(Delete, null)
2905
- }, /*#__PURE__*/React.createElement(Button, {
2906
- className: "deleteBtnMedium",
2907
- variant: "tertiary",
2908
- onClick: onClickDelete,
2909
- startIcon: /*#__PURE__*/React.createElement(Delete, null),
2910
- sx: Object.assign({
2911
- display: 'none'
2912
- }, sx)
2913
- }, "Delete")), /*#__PURE__*/React.createElement(ManagerButton, {
2914
- tooltipTitle: tooltipTitle,
2915
- onClick: onClickDelete,
2916
- icon: /*#__PURE__*/React.createElement(Delete, null),
2917
- testId: "deleteButton",
2918
- isEnabled: isEnabled,
2919
- sx: sx
2920
- }));
2921
- };
2922
-
2923
- /* *
2924
- * Licensed under the Apache License, Version 2.0 (the "License");
2925
- * you may not use this file except in compliance with the License.
2926
- * You may obtain a copy of the License at
2927
- *
2928
- * http://www.apache.org/licenses/LICENSE-2.0
2929
- *
2930
- * Unless required by applicable law or agreed to in writing, software
2931
- * distributed under the License is distributed on an "AS IS" BASIS,
2932
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2933
- * See the License for the specific language governing permissions and
2934
- * limitations under the License.
2935
- *
2936
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2937
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
2938
- * */
2939
- var EnableButton = function EnableButton(_ref) {
2940
- var isEnabled = _ref.isEnabled,
2941
- title = _ref.title,
2942
- onChangeEnableLayer = _ref.onChangeEnableLayer,
2943
- className = _ref.className,
2944
- _ref$id = _ref.id,
2945
- id = _ref$id === void 0 ? 'enableButton' : _ref$id;
2946
-
2947
- var onClick = function onClick(event) {
2948
- event.stopPropagation();
2949
- onChangeEnableLayer(!isEnabled);
2950
- };
2951
-
2952
- return /*#__PURE__*/React.createElement(ManagerButton, {
2953
- tooltipTitle: title,
2954
- onClick: onClick,
2955
- icon: /*#__PURE__*/React.createElement(Checkbox, {
2956
- sx: {
2957
- color: 'inherit',
2958
- padding: 0.5,
2959
- borderRadius: 1.25,
2960
- '&.Mui-focusVisible': {
2961
- backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2962
- },
2963
- '&:hover': {
2964
- backgroundColor: 'transparent!important'
2965
- },
2966
- '&.Mui-checked': {
2967
- color: 'inherit'
2968
- }
2969
- },
2970
- icon: /*#__PURE__*/React.createElement(VisibilityOff, null),
2971
- checkedIcon: /*#__PURE__*/React.createElement(Visibility, null),
2972
- checked: isEnabled,
2973
- disableFocusRipple: true,
2974
- tabIndex: -1
2975
- }),
2976
- testId: id,
2977
- isEnabled: isEnabled,
2978
- className: className
2979
- });
2980
- };
2981
-
2982
2884
  /* *
2983
2885
  * Licensed under the Apache License, Version 2.0 (the "License");
2984
2886
  * you may not use this file except in compliance with the License.
@@ -3083,7 +2985,10 @@ var TooltipSelect = function TooltipSelect(_a) {
3083
2985
 
3084
2986
  var onWheel = React.useCallback(function (event) {
3085
2987
  if (requiresCtrlToChange && (event.ctrlKey || event.metaKey) || !requiresCtrlToChange) {
3086
- if (selectOpen) return;
2988
+ if (selectOpen) {
2989
+ return;
2990
+ }
2991
+
3087
2992
  var direction = event.deltaY < 0 ? 1 : -1;
3088
2993
  var newIndex = currentIndex - direction;
3089
2994
 
@@ -3102,7 +3007,9 @@ var TooltipSelect = function TooltipSelect(_a) {
3102
3007
  setSelectOpen(false);
3103
3008
  }, []);
3104
3009
  var onMouseEnter = React.useCallback(function () {
3105
- if (!selectOpen) setTooltipOpen(true);
3010
+ if (!selectOpen) {
3011
+ setTooltipOpen(true);
3012
+ }
3106
3013
  }, [selectOpen, setTooltipOpen]);
3107
3014
  var onMouseLeave = React.useCallback(function () {
3108
3015
  setTooltipOpen(false);
@@ -3154,6 +3061,9 @@ var TooltipSelect = function TooltipSelect(_a) {
3154
3061
  },
3155
3062
  '&:focus': {
3156
3063
  backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
3064
+ },
3065
+ '.MuiListItemIcon-root': {
3066
+ color: 'geowebColors.buttons.tool.active.color'
3157
3067
  }
3158
3068
  },
3159
3069
  '&:after': {
@@ -3537,4 +3447,4 @@ var index = /*#__PURE__*/Object.freeze({
3537
3447
  createDate: createDate
3538
3448
  });
3539
3449
 
3540
- export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary, ManagerButton, ManagerDeleteButton, 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 };
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 };
package/index.umd.js CHANGED
@@ -289,8 +289,7 @@
289
289
  },
290
290
  onClick: function onClick() {
291
291
  return onClose('CANCELLED');
292
- },
293
- disableFocusRipple: true
292
+ }
294
293
  }, cancelLabel), isLoading ? /*#__PURE__*/React__namespace.createElement(material.Box, {
295
294
  "data-testid": "confirm-dialog-spinner",
296
295
  sx: __assign(__assign({}, confirmStyle), {
@@ -315,8 +314,7 @@
315
314
  });
316
315
  },
317
316
  onClick: onSubmit,
318
- autoFocus: !disableAutoFocus,
319
- disableFocusRipple: true
317
+ autoFocus: !disableAutoFocus
320
318
  }, confirmLabel))
321
319
  }, rest), content);
322
320
  };
@@ -502,7 +500,10 @@
502
500
  };
503
501
  var useMakeSureContainerStaysInsideWindow = function useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition) {
504
502
  var onResizeWindow = React__default["default"].useCallback(function () {
505
- if (!nodeRef.current) return;
503
+ if (!nodeRef.current) {
504
+ return;
505
+ }
506
+
506
507
  var bbox = nodeRef.current.firstChild.getBoundingClientRect();
507
508
  var containingView = nodeRef.current.parentElement.getBoundingClientRect();
508
509
  adjustPosition(bbox, containingView, position, setPosition);
@@ -1059,8 +1060,8 @@
1059
1060
  return /*#__PURE__*/React__namespace.createElement(material.Box, {
1060
1061
  sx: {
1061
1062
  whiteSpace: 'pre-wrap',
1062
- width: 'inherit',
1063
- height: 'inherit',
1063
+ width: '100%',
1064
+ height: '100%',
1064
1065
  overflowY: 'scroll'
1065
1066
  }
1066
1067
  }, /*#__PURE__*/React__namespace.createElement(AlertBanner, {
@@ -1689,8 +1690,8 @@
1689
1690
  * See the License for the specific language governing permissions and
1690
1691
  * limitations under the License.
1691
1692
  *
1692
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1693
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
1693
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1694
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
1694
1695
  * */
1695
1696
 
1696
1697
  var calculateDialogSizeAndPosition = function calculateDialogSizeAndPosition() {
@@ -1766,33 +1767,37 @@
1766
1767
  onResizeStop = _m === void 0 ? function () {} : _m,
1767
1768
  _o = _a.onDragEnd,
1768
1769
  onDragEnd = _o === void 0 ? function () {} : _o,
1769
- _p = _a.order,
1770
- order = _p === void 0 ? 1 : _p,
1771
- _q = _a.source,
1772
- source = _q === void 0 ? 'app' : _q,
1773
- _r = _a.leftHeaderComponent,
1774
- leftHeaderComponent = _r === void 0 ? null : _r,
1775
- _s = _a.rightHeaderComponent,
1776
- rightHeaderComponent = _s === void 0 ? null : _s,
1770
+ _p = _a.onFocus,
1771
+ onFocus = _p === void 0 ? function () {} : _p,
1772
+ _q = _a.onBlur,
1773
+ onBlur = _q === void 0 ? function () {} : _q,
1774
+ _r = _a.order,
1775
+ order = _r === void 0 ? 1 : _r,
1776
+ _s = _a.source,
1777
+ source = _s === void 0 ? 'app' : _s,
1778
+ _t = _a.leftHeaderComponent,
1779
+ leftHeaderComponent = _t === void 0 ? null : _t,
1780
+ _u = _a.rightHeaderComponent,
1781
+ rightHeaderComponent = _u === void 0 ? null : _u,
1777
1782
  className = _a.className,
1778
- _t = _a.sx,
1779
- sx = _t === void 0 ? {} : _t,
1780
- props = __rest(_a, ["title", "bounds", "cancel", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "onResizeStop", "onDragEnd", "order", "source", "leftHeaderComponent", "rightHeaderComponent", "className", "sx"]);
1783
+ _v = _a.sx,
1784
+ sx = _v === void 0 ? {} : _v,
1785
+ props = __rest(_a, ["title", "bounds", "cancel", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "onResizeStop", "onDragEnd", "onFocus", "onBlur", "order", "source", "leftHeaderComponent", "rightHeaderComponent", "className", "sx"]);
1781
1786
 
1782
1787
  var zIndex = (source === 'app' ? BASE_Z_INDEX : 1000) + order;
1783
1788
  var elevation = BASE_ELEVATION + order;
1784
1789
  var nodeRef = React__default["default"].useRef(null);
1785
1790
 
1786
- var _u = __read(React__default["default"].useState({
1791
+ var _w = __read(React__default["default"].useState({
1787
1792
  x: 0,
1788
1793
  y: 0
1789
1794
  }), 2),
1790
- position = _u[0],
1791
- setPosition = _u[1];
1795
+ position = _w[0],
1796
+ setPosition = _w[1];
1792
1797
 
1793
- var _v = __read(React__default["default"].useState(startSize), 2),
1794
- size = _v[0],
1795
- setSize = _v[1];
1798
+ var _x = __read(React__default["default"].useState(startSize), 2),
1799
+ size = _x[0],
1800
+ setSize = _x[1];
1796
1801
 
1797
1802
  var isRightAligned = startPosition && startPosition.right !== null && startPosition.right !== undefined;
1798
1803
  var onStopDrag = React__default["default"].useCallback(function (_event, position) {
@@ -1800,9 +1805,9 @@
1800
1805
  onDragEnd(position, size);
1801
1806
  }, [setPosition, onDragEnd, size]);
1802
1807
 
1803
- var _w = __read(React__default["default"].useState(defaultInitialMaxHeight), 2),
1804
- initialMaxHeight = _w[0],
1805
- setInitialMaxHeight = _w[1];
1808
+ var _y = __read(React__default["default"].useState(defaultInitialMaxHeight), 2),
1809
+ initialMaxHeight = _y[0],
1810
+ setInitialMaxHeight = _y[1];
1806
1811
 
1807
1812
  var onStartResize = function onStartResize() {
1808
1813
  setInitialMaxHeight('initial');
@@ -1849,6 +1854,9 @@
1849
1854
  handle: "." + headerClassName,
1850
1855
  onMouseDown: onMouseDown
1851
1856
  }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
1857
+ tabIndex: -1,
1858
+ onFocus: onFocus,
1859
+ onBlur: onBlur,
1852
1860
  sx: __assign(__assign(__assign({
1853
1861
  position: 'absolute',
1854
1862
  pointerEvents: 'all',
@@ -2318,7 +2326,10 @@
2318
2326
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2319
2327
  * */
2320
2328
  var getInitials = function getInitials(name) {
2321
- if (!name) return '';
2329
+ if (!name) {
2330
+ return '';
2331
+ }
2332
+
2322
2333
  var nameWithoutEmail = name.split('@')[0];
2323
2334
  var array = nameWithoutEmail.split('.');
2324
2335
 
@@ -2417,7 +2428,10 @@
2417
2428
  first = _a[0],
2418
2429
  rest = _a.slice(1);
2419
2430
 
2420
- if (first) first.classList.add('selectedLabel');
2431
+ if (first) {
2432
+ first.classList.add('selectedLabel');
2433
+ }
2434
+
2421
2435
  rest.forEach(function (element) {
2422
2436
  return element.classList.remove('selectedLabel');
2423
2437
  });
@@ -2614,7 +2628,10 @@
2614
2628
  anchorEl: anchorEl,
2615
2629
  open: isOpen,
2616
2630
  onClose: function onClose(event, reason) {
2617
- if (reason === 'tabKeyDown') return;
2631
+ if (reason === 'tabKeyDown') {
2632
+ return;
2633
+ }
2634
+
2618
2635
  handleClose(event);
2619
2636
  },
2620
2637
  anchorOrigin: anchorOrigin,
@@ -2692,13 +2709,6 @@
2692
2709
  backgroundColor: function backgroundColor() {
2693
2710
  return isActive ? 'geowebColors.buttons.primary.active.fill' : 'inherit';
2694
2711
  },
2695
- '&:focus': {
2696
- backgroundColor: function backgroundColor() {
2697
- return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
2698
- },
2699
- outline: 'geowebColors.buttons.focusDefault.outline',
2700
- borderRadius: 0
2701
- },
2702
2712
  '&:hover': {
2703
2713
  backgroundColor: function backgroundColor() {
2704
2714
  return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
@@ -2717,12 +2727,11 @@
2717
2727
  _e = _a.isEnabled,
2718
2728
  isEnabled = _e === void 0 ? true : _e,
2719
2729
  icon = _a.icon,
2720
- testId = _a.testId,
2721
2730
  _f = _a.isAccessible,
2722
2731
  isAccessible = _f === void 0 ? false : _f,
2723
2732
  sx = _a.sx,
2724
2733
  children = _a.children,
2725
- props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "sx", "children"]);
2734
+ props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "isAccessible", "sx", "children"]);
2726
2735
 
2727
2736
  var buttonStyles = makeButtonStyles(isActive, isEnabled, isAccessible);
2728
2737
 
@@ -2739,117 +2748,10 @@
2739
2748
  }, children || /*#__PURE__*/React__namespace.createElement(material.IconButton, __assign({
2740
2749
  size: "small",
2741
2750
  onClick: handleClick,
2742
- "data-testid": testId,
2743
- sx: __assign(__assign({}, buttonStyles), sx),
2744
- disableFocusRipple: true
2751
+ sx: __assign(__assign({}, buttonStyles), sx)
2745
2752
  }, props), icon));
2746
2753
  };
2747
2754
 
2748
- /* *
2749
- * Licensed under the Apache License, Version 2.0 (the "License");
2750
- * you may not use this file except in compliance with the License.
2751
- * You may obtain a copy of the License at
2752
- *
2753
- * http://www.apache.org/licenses/LICENSE-2.0
2754
- *
2755
- * Unless required by applicable law or agreed to in writing, software
2756
- * distributed under the License is distributed on an "AS IS" BASIS,
2757
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2758
- * See the License for the specific language governing permissions and
2759
- * limitations under the License.
2760
- *
2761
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2762
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
2763
- * */
2764
- var ManagerDeleteButton = function ManagerDeleteButton(_a) {
2765
- var tooltipTitle = _a.tooltipTitle,
2766
- onClickDelete = _a.onClickDelete,
2767
- _b = _a.isEnabled,
2768
- isEnabled = _b === void 0 ? true : _b,
2769
- sx = _a.sx;
2770
- return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2771
- tooltipTitle: tooltipTitle,
2772
- onClick: onClickDelete,
2773
- testId: "deleteButtonMedium",
2774
- isEnabled: isEnabled,
2775
- icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null)
2776
- }, /*#__PURE__*/React__namespace.createElement(material.Button, {
2777
- className: "deleteBtnMedium",
2778
- variant: "tertiary",
2779
- onClick: onClickDelete,
2780
- startIcon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
2781
- sx: __assign({
2782
- display: 'none'
2783
- }, sx)
2784
- }, "Delete")), /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2785
- tooltipTitle: tooltipTitle,
2786
- onClick: onClickDelete,
2787
- icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
2788
- testId: "deleteButton",
2789
- isEnabled: isEnabled,
2790
- sx: sx
2791
- }));
2792
- };
2793
-
2794
- /* *
2795
- * Licensed under the Apache License, Version 2.0 (the "License");
2796
- * you may not use this file except in compliance with the License.
2797
- * You may obtain a copy of the License at
2798
- *
2799
- * http://www.apache.org/licenses/LICENSE-2.0
2800
- *
2801
- * Unless required by applicable law or agreed to in writing, software
2802
- * distributed under the License is distributed on an "AS IS" BASIS,
2803
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2804
- * See the License for the specific language governing permissions and
2805
- * limitations under the License.
2806
- *
2807
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2808
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
2809
- * */
2810
- var EnableButton = function EnableButton(_a) {
2811
- var isEnabled = _a.isEnabled,
2812
- title = _a.title,
2813
- onChangeEnableLayer = _a.onChangeEnableLayer,
2814
- className = _a.className,
2815
- _b = _a.id,
2816
- id = _b === void 0 ? 'enableButton' : _b;
2817
-
2818
- var onClick = function onClick(event) {
2819
- event.stopPropagation();
2820
- onChangeEnableLayer(!isEnabled);
2821
- };
2822
-
2823
- return /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2824
- tooltipTitle: title,
2825
- onClick: onClick,
2826
- icon: /*#__PURE__*/React__namespace.createElement(material.Checkbox, {
2827
- sx: {
2828
- color: 'inherit',
2829
- padding: 0.5,
2830
- borderRadius: 1.25,
2831
- '&.Mui-focusVisible': {
2832
- backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2833
- },
2834
- '&:hover': {
2835
- backgroundColor: 'transparent!important'
2836
- },
2837
- '&.Mui-checked': {
2838
- color: 'inherit'
2839
- }
2840
- },
2841
- icon: /*#__PURE__*/React__namespace.createElement(theme.VisibilityOff, null),
2842
- checkedIcon: /*#__PURE__*/React__namespace.createElement(theme.Visibility, null),
2843
- checked: isEnabled,
2844
- disableFocusRipple: true,
2845
- tabIndex: -1
2846
- }),
2847
- testId: id,
2848
- isEnabled: isEnabled,
2849
- className: className
2850
- });
2851
- };
2852
-
2853
2755
  /* *
2854
2756
  * Licensed under the Apache License, Version 2.0 (the "License");
2855
2757
  * you may not use this file except in compliance with the License.
@@ -2971,7 +2873,10 @@
2971
2873
 
2972
2874
  var onWheel = React__namespace.useCallback(function (event) {
2973
2875
  if (requiresCtrlToChange && (event.ctrlKey || event.metaKey) || !requiresCtrlToChange) {
2974
- if (selectOpen) return;
2876
+ if (selectOpen) {
2877
+ return;
2878
+ }
2879
+
2975
2880
  var direction = event.deltaY < 0 ? 1 : -1;
2976
2881
  var newIndex = currentIndex - direction;
2977
2882
 
@@ -2990,7 +2895,9 @@
2990
2895
  setSelectOpen(false);
2991
2896
  }, []);
2992
2897
  var onMouseEnter = React__namespace.useCallback(function () {
2993
- if (!selectOpen) setTooltipOpen(true);
2898
+ if (!selectOpen) {
2899
+ setTooltipOpen(true);
2900
+ }
2994
2901
  }, [selectOpen, setTooltipOpen]);
2995
2902
  var onMouseLeave = React__namespace.useCallback(function () {
2996
2903
  setTooltipOpen(false);
@@ -3042,6 +2949,9 @@
3042
2949
  },
3043
2950
  '&:focus': {
3044
2951
  backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
2952
+ },
2953
+ '.MuiListItemIcon-root': {
2954
+ color: 'geowebColors.buttons.tool.active.color'
3045
2955
  }
3046
2956
  },
3047
2957
  '&:after': {
@@ -3461,10 +3371,8 @@
3461
3371
  exports.CustomTooltip = CustomTooltip;
3462
3372
  exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
3463
3373
  exports.Draggable = DraggableComponent$1;
3464
- exports.EnableButton = EnableButton;
3465
3374
  exports.ErrorBoundary = ErrorBoundary;
3466
3375
  exports.ManagerButton = ManagerButton;
3467
- exports.ManagerDeleteButton = ManagerDeleteButton;
3468
3376
  exports.Resizable = ResizeComponent;
3469
3377
  exports.StatusTag = StatusTag;
3470
3378
  exports.ToggleMenu = ToggleMenu;
@@ -2,11 +2,9 @@ import * as React from 'react';
2
2
  import { IconButtonProps } from '@mui/material';
3
3
  export interface ManagerButtonProps extends IconButtonProps {
4
4
  tooltipTitle: string;
5
- onClick?: (event: React.MouseEvent) => void;
6
5
  isActive?: boolean;
7
6
  isEnabled?: boolean;
8
7
  icon: React.ReactNode;
9
- testId: string;
10
8
  isAccessible?: boolean;
11
9
  children?: React.ReactElement;
12
10
  }
@@ -20,6 +20,8 @@ interface DraggableComponentProps extends Omit<ResizableComponentProps, 'bounds'
20
20
  onChangeSize?: (size: Size) => void;
21
21
  onDragEnd?: (position: DraggablePosition, size: Size) => void;
22
22
  onMouseDown?: (event: MouseEvent) => void;
23
+ onFocus?: (event: React.FocusEvent<HTMLElement>) => void;
24
+ onBlur?: (event: React.FocusEvent<HTMLElement>) => void;
23
25
  bounds?: 'parent' | string;
24
26
  cancel?: string;
25
27
  order?: number;
@@ -12,8 +12,6 @@ export * from './CustomToggleButton';
12
12
  export * from './ToolButton';
13
13
  export * from './ToggleMenu';
14
14
  export * from './ManagerButton';
15
- export * from './ManagerDeleteButton';
16
- export * from './EnableButton';
17
15
  export * from './AlertIcon';
18
16
  export * from './TooltipSelect';
19
17
  export * from './Avatar';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "4.17.0",
3
+ "version": "4.18.0",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  "peerDependencies": {
15
15
  "react": "^18.2.0",
16
16
  "@mui/material": "^5.10.8",
17
- "@opengeoweb/theme": "4.17.0",
17
+ "@opengeoweb/theme": "4.18.0",
18
18
  "react-draggable": "^4.4.5",
19
19
  "re-resizable": "^6.9.0",
20
20
  "@redux-eggs/core": "^2.2.0",
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- interface EnableLayerProps {
3
- isEnabled?: boolean;
4
- title: string;
5
- onChangeEnableLayer: (enable: boolean) => void;
6
- className?: string;
7
- id?: string;
8
- }
9
- export declare const EnableButton: React.FC<EnableLayerProps>;
10
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const EnableButtonLight: {
7
- (): React.ReactElement;
8
- storyName: string;
9
- };
10
- export declare const EnableButtonDark: {
11
- (): React.ReactElement;
12
- storyName: string;
13
- };
@@ -1 +0,0 @@
1
- export * from './EnableButton';
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- import { IconButtonProps } from '@mui/material';
3
- interface DeleteButtonProps extends IconButtonProps {
4
- tooltipTitle: string;
5
- onClickDelete: (event: React.MouseEvent) => void;
6
- isEnabled?: boolean;
7
- }
8
- export declare const ManagerDeleteButton: React.FC<DeleteButtonProps>;
9
- export {};
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const ManagerDeleteButtonLight: {
7
- (): React.ReactElement;
8
- storyName: string;
9
- };
10
- export declare const ManagerDeleteButtonDark: {
11
- (): React.ReactElement;
12
- storyName: string;
13
- };
@@ -1 +0,0 @@
1
- export * from './ManagerDeleteButton';