@opengeoweb/shared 4.15.1 → 4.16.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,6 +1,6 @@
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, ListItemIcon, Checkbox, Select, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
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
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';
5
5
  import { throttle } from 'lodash';
6
6
  import Draggable from 'react-draggable';
@@ -2699,6 +2699,8 @@ var ToggleMenu = function ToggleMenu(_ref) {
2699
2699
  buttonSx = _ref.buttonSx,
2700
2700
  _ref$tooltipTitle = _ref.tooltipTitle,
2701
2701
  tooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
2702
+ _ref$menuTitle = _ref.menuTitle,
2703
+ menuTitle = _ref$menuTitle === void 0 ? '' : _ref$menuTitle,
2702
2704
  variant = _ref.variant,
2703
2705
  _ref$isDefaultOpen = _ref.isDefaultOpen,
2704
2706
  isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
@@ -2759,7 +2761,13 @@ var ToggleMenu = function ToggleMenu(_ref) {
2759
2761
  padding: '0px'
2760
2762
  }
2761
2763
  })
2762
- }, menuItems && menuItems.map(function (menuItem) {
2764
+ }, menuTitle && /*#__PURE__*/React.createElement(ListSubheader, {
2765
+ "data-testid": "toggleMenuTitle"
2766
+ }, /*#__PURE__*/React.createElement(Typography, {
2767
+ sx: {
2768
+ fontSize: '12px'
2769
+ }
2770
+ }, menuTitle)), menuItems && menuItems.map(function (menuItem) {
2763
2771
  var text = menuItem.text,
2764
2772
  icon = menuItem.icon,
2765
2773
  action = menuItem.action;
@@ -2888,7 +2896,8 @@ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
2888
2896
  var tooltipTitle = _ref.tooltipTitle,
2889
2897
  onClickDelete = _ref.onClickDelete,
2890
2898
  _ref$isEnabled = _ref.isEnabled,
2891
- isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
2899
+ isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
2900
+ sx = _ref.sx;
2892
2901
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ManagerButton, {
2893
2902
  tooltipTitle: tooltipTitle,
2894
2903
  onClick: onClickDelete,
@@ -2900,15 +2909,16 @@ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
2900
2909
  variant: "tertiary",
2901
2910
  onClick: onClickDelete,
2902
2911
  startIcon: /*#__PURE__*/React.createElement(Delete, null),
2903
- sx: {
2912
+ sx: Object.assign({
2904
2913
  display: 'none'
2905
- }
2914
+ }, sx)
2906
2915
  }, "Delete")), /*#__PURE__*/React.createElement(ManagerButton, {
2907
2916
  tooltipTitle: tooltipTitle,
2908
2917
  onClick: onClickDelete,
2909
2918
  icon: /*#__PURE__*/React.createElement(Delete, null),
2910
2919
  testId: "deleteButton",
2911
- isEnabled: isEnabled
2920
+ isEnabled: isEnabled,
2921
+ sx: sx
2912
2922
  }));
2913
2923
  };
2914
2924
 
package/index.umd.js CHANGED
@@ -2571,19 +2571,21 @@
2571
2571
  buttonSx = _a.buttonSx,
2572
2572
  _d = _a.tooltipTitle,
2573
2573
  tooltipTitle = _d === void 0 ? '' : _d,
2574
+ _e = _a.menuTitle,
2575
+ menuTitle = _e === void 0 ? '' : _e,
2574
2576
  variant = _a.variant,
2575
- _e = _a.isDefaultOpen,
2576
- isDefaultOpen = _e === void 0 ? false : _e;
2577
+ _f = _a.isDefaultOpen,
2578
+ isDefaultOpen = _f === void 0 ? false : _f;
2577
2579
 
2578
- var _f = __read(React__namespace.useState(null), 2),
2579
- anchorEl = _f[0],
2580
- setAnchorEl = _f[1];
2580
+ var _g = __read(React__namespace.useState(null), 2),
2581
+ anchorEl = _g[0],
2582
+ setAnchorEl = _g[1];
2581
2583
 
2582
2584
  var isOpen = Boolean(anchorEl);
2583
2585
 
2584
- var _g = getPosition(menuPosition),
2585
- anchorOrigin = _g.anchorOrigin,
2586
- transformOrigin = _g.transformOrigin;
2586
+ var _h = getPosition(menuPosition),
2587
+ anchorOrigin = _h.anchorOrigin,
2588
+ transformOrigin = _h.transformOrigin;
2587
2589
 
2588
2590
  var handleClick = function handleClick(event) {
2589
2591
  event.stopPropagation();
@@ -2630,7 +2632,13 @@
2630
2632
  padding: '0px'
2631
2633
  }
2632
2634
  })
2633
- }, menuItems && menuItems.map(function (menuItem) {
2635
+ }, menuTitle && /*#__PURE__*/React__namespace.createElement(material.ListSubheader, {
2636
+ "data-testid": "toggleMenuTitle"
2637
+ }, /*#__PURE__*/React__namespace.createElement(material.Typography, {
2638
+ sx: {
2639
+ fontSize: '12px'
2640
+ }
2641
+ }, menuTitle)), menuItems && menuItems.map(function (menuItem) {
2634
2642
  var text = menuItem.text,
2635
2643
  icon = menuItem.icon,
2636
2644
  action = menuItem.action;
@@ -2759,7 +2767,8 @@
2759
2767
  var tooltipTitle = _a.tooltipTitle,
2760
2768
  onClickDelete = _a.onClickDelete,
2761
2769
  _b = _a.isEnabled,
2762
- isEnabled = _b === void 0 ? true : _b;
2770
+ isEnabled = _b === void 0 ? true : _b,
2771
+ sx = _a.sx;
2763
2772
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2764
2773
  tooltipTitle: tooltipTitle,
2765
2774
  onClick: onClickDelete,
@@ -2771,15 +2780,16 @@
2771
2780
  variant: "tertiary",
2772
2781
  onClick: onClickDelete,
2773
2782
  startIcon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
2774
- sx: {
2783
+ sx: __assign({
2775
2784
  display: 'none'
2776
- }
2785
+ }, sx)
2777
2786
  }, "Delete")), /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2778
2787
  tooltipTitle: tooltipTitle,
2779
2788
  onClick: onClickDelete,
2780
2789
  icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
2781
2790
  testId: "deleteButton",
2782
- isEnabled: isEnabled
2791
+ isEnabled: isEnabled,
2792
+ sx: sx
2783
2793
  }));
2784
2794
  };
2785
2795
 
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- interface DeleteButtonProps {
2
+ import { IconButtonProps } from '@mui/material';
3
+ interface DeleteButtonProps extends IconButtonProps {
3
4
  tooltipTitle: string;
4
5
  onClickDelete: () => void;
5
6
  isEnabled?: boolean;
@@ -15,6 +15,7 @@ interface ToggleMenuProps {
15
15
  buttonTestId?: string;
16
16
  menuPosition?: MenuPosition;
17
17
  menuItems?: MenuItemType[];
18
+ menuTitle?: string;
18
19
  children?: React.ReactNode;
19
20
  buttonSx?: SxProps<Theme>;
20
21
  tooltipTitle?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "4.15.1",
3
+ "version": "4.16.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.15.1",
17
+ "@opengeoweb/theme": "4.16.0",
18
18
  "react-draggable": "^4.4.5",
19
19
  "re-resizable": "^6.9.0",
20
20
  "@redux-eggs/core": "^2.2.0",