@opengeoweb/shared 4.15.1 → 4.17.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';
@@ -95,15 +95,16 @@ var CustomDialog = function CustomDialog(_a) {
95
95
  _a$actions = _a.actions,
96
96
  actions = _a$actions === void 0 ? null : _a$actions,
97
97
  children = _a.children,
98
- other = __rest(_a, ["title", "onClose", "description", "actions", "children"]);
98
+ sx = _a.sx,
99
+ other = __rest(_a, ["title", "onClose", "description", "actions", "children", "sx"]);
99
100
 
100
101
  return /*#__PURE__*/React.createElement(Dialog, Object.assign({
101
102
  "data-testid": "customDialog",
102
103
  PaperProps: {
103
- sx: {
104
+ sx: Object.assign({
104
105
  width: '560px',
105
106
  margin: 2.5
106
- }
107
+ }, sx)
107
108
  },
108
109
  // fix for briefly showing default options when closing dialog
109
110
  transitionDuration: 0,
@@ -122,14 +123,8 @@ var CustomDialog = function CustomDialog(_a) {
122
123
  }
123
124
  }, /*#__PURE__*/React.createElement(Typography, {
124
125
  sx: {
125
- fontSize: {
126
- xs: '16px',
127
- sm: '34px'
128
- },
129
- fontWeight: {
130
- xs: 500,
131
- sm: 400
132
- }
126
+ fontSize: '16px',
127
+ fontWeight: 500
133
128
  },
134
129
  "data-testid": "customDialog-title",
135
130
  component: "span"
@@ -602,45 +597,45 @@ var adjustPosition = function adjustPosition(bbox, containingView, position, set
602
597
  x: position.x + diffX,
603
598
  y: position.y + diffY
604
599
  });
605
- } // bottom right
606
- else if (bbox.right >= containingView.right && bbox.bottom >= containingView.bottom) {
607
- var _diffX = containingView.right - bbox.right;
600
+ } else if ( // bottom right
601
+ bbox.right >= containingView.right && bbox.bottom >= containingView.bottom) {
602
+ var _diffX = containingView.right - bbox.right;
608
603
 
609
- var _diffY = containingView.bottom - bbox.bottom;
604
+ var _diffY = containingView.bottom - bbox.bottom;
610
605
 
611
- setPosition({
612
- x: position.x + _diffX,
613
- y: position.y + _diffY
614
- });
615
- } // left screen
616
- else if (bbox.x < containingView.x || isHorizontallyLarger) {
617
- var _diffX2 = containingView.x - bbox.x;
618
-
619
- setPosition(Object.assign(Object.assign({}, position), {
620
- x: position.x + _diffX2
621
- }));
622
- } // right screen
623
- else if (bbox.right >= containingView.right) {
624
- var _diffX3 = containingView.right - bbox.right;
625
-
626
- setPosition(Object.assign(Object.assign({}, position), {
627
- x: position.x + _diffX3
628
- }));
629
- } // top screen
630
- else if (bbox.y < containingView.y || isVerticallyLarger) {
631
- var _diffY2 = containingView.y - bbox.y;
632
-
633
- setPosition(Object.assign(Object.assign({}, position), {
634
- y: position.y + _diffY2
635
- }));
636
- } // bottom screen
637
- else if (bbox.bottom >= containingView.bottom) {
638
- var _diffY3 = containingView.bottom - bbox.bottom;
639
-
640
- setPosition(Object.assign(Object.assign({}, position), {
641
- y: position.y + _diffY3
642
- }));
643
- }
606
+ setPosition({
607
+ x: position.x + _diffX,
608
+ y: position.y + _diffY
609
+ });
610
+ } else if (bbox.x < containingView.x || isHorizontallyLarger) {
611
+ // left screen
612
+ var _diffX2 = containingView.x - bbox.x;
613
+
614
+ setPosition(Object.assign(Object.assign({}, position), {
615
+ x: position.x + _diffX2
616
+ }));
617
+ } else if (bbox.right >= containingView.right) {
618
+ // right screen
619
+ var _diffX3 = containingView.right - bbox.right;
620
+
621
+ setPosition(Object.assign(Object.assign({}, position), {
622
+ x: position.x + _diffX3
623
+ }));
624
+ } else if (bbox.y < containingView.y || isVerticallyLarger) {
625
+ // top screen
626
+ var _diffY2 = containingView.y - bbox.y;
627
+
628
+ setPosition(Object.assign(Object.assign({}, position), {
629
+ y: position.y + _diffY2
630
+ }));
631
+ } else if (bbox.bottom >= containingView.bottom) {
632
+ // bottom screen
633
+ var _diffY3 = containingView.bottom - bbox.bottom;
634
+
635
+ setPosition(Object.assign(Object.assign({}, position), {
636
+ y: position.y + _diffY3
637
+ }));
638
+ }
644
639
  };
645
640
  var useMakeSureContainerStaysInsideWindow = function useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition) {
646
641
  var onResizeWindow = React__default.useCallback(function () {
@@ -964,14 +959,17 @@ var AppHeader = function AppHeader(_ref2) {
964
959
  userMenu = _ref2.userMenu,
965
960
  workspaceTopBar = _ref2.workspaceTopBar,
966
961
  _ref2$title = _ref2.title,
967
- title = _ref2$title === void 0 ? 'GeoWeb' : _ref2$title;
962
+ title = _ref2$title === void 0 ? 'GeoWeb' : _ref2$title,
963
+ onClick = _ref2.onClick;
968
964
  return /*#__PURE__*/React__default.createElement(Box, {
969
965
  component: "header",
970
966
  sx: styles$5.header
971
967
  }, /*#__PURE__*/React__default.createElement(Box, {
968
+ onClick: onClick,
972
969
  sx: {
973
970
  display: 'inherit',
974
- alignItems: 'center'
971
+ alignItems: 'center',
972
+ cursor: onClick ? 'pointer' : 'auto'
975
973
  }
976
974
  }, /*#__PURE__*/React__default.createElement(GeoWebLogo, {
977
975
  style: {
@@ -2699,6 +2697,8 @@ var ToggleMenu = function ToggleMenu(_ref) {
2699
2697
  buttonSx = _ref.buttonSx,
2700
2698
  _ref$tooltipTitle = _ref.tooltipTitle,
2701
2699
  tooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
2700
+ _ref$menuTitle = _ref.menuTitle,
2701
+ menuTitle = _ref$menuTitle === void 0 ? '' : _ref$menuTitle,
2702
2702
  variant = _ref.variant,
2703
2703
  _ref$isDefaultOpen = _ref.isDefaultOpen,
2704
2704
  isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
@@ -2759,7 +2759,13 @@ var ToggleMenu = function ToggleMenu(_ref) {
2759
2759
  padding: '0px'
2760
2760
  }
2761
2761
  })
2762
- }, menuItems && menuItems.map(function (menuItem) {
2762
+ }, menuTitle && /*#__PURE__*/React.createElement(ListSubheader, {
2763
+ "data-testid": "toggleMenuTitle"
2764
+ }, /*#__PURE__*/React.createElement(Typography, {
2765
+ sx: {
2766
+ fontSize: '12px'
2767
+ }
2768
+ }, menuTitle)), menuItems && menuItems.map(function (menuItem) {
2763
2769
  var text = menuItem.text,
2764
2770
  icon = menuItem.icon,
2765
2771
  action = menuItem.action;
@@ -2888,7 +2894,8 @@ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
2888
2894
  var tooltipTitle = _ref.tooltipTitle,
2889
2895
  onClickDelete = _ref.onClickDelete,
2890
2896
  _ref$isEnabled = _ref.isEnabled,
2891
- isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
2897
+ isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
2898
+ sx = _ref.sx;
2892
2899
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ManagerButton, {
2893
2900
  tooltipTitle: tooltipTitle,
2894
2901
  onClick: onClickDelete,
@@ -2900,15 +2907,16 @@ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
2900
2907
  variant: "tertiary",
2901
2908
  onClick: onClickDelete,
2902
2909
  startIcon: /*#__PURE__*/React.createElement(Delete, null),
2903
- sx: {
2910
+ sx: Object.assign({
2904
2911
  display: 'none'
2905
- }
2912
+ }, sx)
2906
2913
  }, "Delete")), /*#__PURE__*/React.createElement(ManagerButton, {
2907
2914
  tooltipTitle: tooltipTitle,
2908
2915
  onClick: onClickDelete,
2909
2916
  icon: /*#__PURE__*/React.createElement(Delete, null),
2910
2917
  testId: "deleteButton",
2911
- isEnabled: isEnabled
2918
+ isEnabled: isEnabled,
2919
+ sx: sx
2912
2920
  }));
2913
2921
  };
2914
2922
 
package/index.umd.js CHANGED
@@ -169,15 +169,16 @@
169
169
  _c = _a.actions,
170
170
  actions = _c === void 0 ? null : _c,
171
171
  children = _a.children,
172
- other = __rest(_a, ["title", "onClose", "description", "actions", "children"]);
172
+ sx = _a.sx,
173
+ other = __rest(_a, ["title", "onClose", "description", "actions", "children", "sx"]);
173
174
 
174
175
  return /*#__PURE__*/React__namespace.createElement(material.Dialog, __assign({
175
176
  "data-testid": "customDialog",
176
177
  PaperProps: {
177
- sx: {
178
+ sx: __assign({
178
179
  width: '560px',
179
180
  margin: 2.5
180
- }
181
+ }, sx)
181
182
  },
182
183
  // fix for briefly showing default options when closing dialog
183
184
  transitionDuration: 0,
@@ -196,14 +197,8 @@
196
197
  }
197
198
  }, /*#__PURE__*/React__namespace.createElement(material.Typography, {
198
199
  sx: {
199
- fontSize: {
200
- xs: '16px',
201
- sm: '34px'
202
- },
203
- fontWeight: {
204
- xs: 500,
205
- sm: 400
206
- }
200
+ fontSize: '16px',
201
+ fontWeight: 500
207
202
  },
208
203
  "data-testid": "customDialog-title",
209
204
  component: "span"
@@ -471,39 +466,39 @@
471
466
  x: position.x + diffX,
472
467
  y: position.y + diffY
473
468
  });
474
- } // bottom right
475
- else if (bbox.right >= containingView.right && bbox.bottom >= containingView.bottom) {
476
- var diffX = containingView.right - bbox.right;
477
- var diffY = containingView.bottom - bbox.bottom;
478
- setPosition({
479
- x: position.x + diffX,
480
- y: position.y + diffY
481
- });
482
- } // left screen
483
- else if (bbox.x < containingView.x || isHorizontallyLarger) {
484
- var diffX = containingView.x - bbox.x;
485
- setPosition(__assign(__assign({}, position), {
486
- x: position.x + diffX
487
- }));
488
- } // right screen
489
- else if (bbox.right >= containingView.right) {
490
- var diffX = containingView.right - bbox.right;
491
- setPosition(__assign(__assign({}, position), {
492
- x: position.x + diffX
493
- }));
494
- } // top screen
495
- else if (bbox.y < containingView.y || isVerticallyLarger) {
496
- var diffY = containingView.y - bbox.y;
497
- setPosition(__assign(__assign({}, position), {
498
- y: position.y + diffY
499
- }));
500
- } // bottom screen
501
- else if (bbox.bottom >= containingView.bottom) {
502
- var diffY = containingView.bottom - bbox.bottom;
503
- setPosition(__assign(__assign({}, position), {
504
- y: position.y + diffY
505
- }));
506
- }
469
+ } else if ( // bottom right
470
+ bbox.right >= containingView.right && bbox.bottom >= containingView.bottom) {
471
+ var diffX = containingView.right - bbox.right;
472
+ var diffY = containingView.bottom - bbox.bottom;
473
+ setPosition({
474
+ x: position.x + diffX,
475
+ y: position.y + diffY
476
+ });
477
+ } else if (bbox.x < containingView.x || isHorizontallyLarger) {
478
+ // left screen
479
+ var diffX = containingView.x - bbox.x;
480
+ setPosition(__assign(__assign({}, position), {
481
+ x: position.x + diffX
482
+ }));
483
+ } else if (bbox.right >= containingView.right) {
484
+ // right screen
485
+ var diffX = containingView.right - bbox.right;
486
+ setPosition(__assign(__assign({}, position), {
487
+ x: position.x + diffX
488
+ }));
489
+ } else if (bbox.y < containingView.y || isVerticallyLarger) {
490
+ // top screen
491
+ var diffY = containingView.y - bbox.y;
492
+ setPosition(__assign(__assign({}, position), {
493
+ y: position.y + diffY
494
+ }));
495
+ } else if (bbox.bottom >= containingView.bottom) {
496
+ // bottom screen
497
+ var diffY = containingView.bottom - bbox.bottom;
498
+ setPosition(__assign(__assign({}, position), {
499
+ y: position.y + diffY
500
+ }));
501
+ }
507
502
  };
508
503
  var useMakeSureContainerStaysInsideWindow = function useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition) {
509
504
  var onResizeWindow = React__default["default"].useCallback(function () {
@@ -844,14 +839,17 @@
844
839
  userMenu = _a.userMenu,
845
840
  workspaceTopBar = _a.workspaceTopBar,
846
841
  _b = _a.title,
847
- title = _b === void 0 ? 'GeoWeb' : _b;
842
+ title = _b === void 0 ? 'GeoWeb' : _b,
843
+ onClick = _a.onClick;
848
844
  return /*#__PURE__*/React__default["default"].createElement(material.Box, {
849
845
  component: "header",
850
846
  sx: styles$5.header
851
847
  }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
848
+ onClick: onClick,
852
849
  sx: {
853
850
  display: 'inherit',
854
- alignItems: 'center'
851
+ alignItems: 'center',
852
+ cursor: onClick ? 'pointer' : 'auto'
855
853
  }
856
854
  }, /*#__PURE__*/React__default["default"].createElement(theme.GeoWebLogo, {
857
855
  style: {
@@ -2571,19 +2569,21 @@
2571
2569
  buttonSx = _a.buttonSx,
2572
2570
  _d = _a.tooltipTitle,
2573
2571
  tooltipTitle = _d === void 0 ? '' : _d,
2572
+ _e = _a.menuTitle,
2573
+ menuTitle = _e === void 0 ? '' : _e,
2574
2574
  variant = _a.variant,
2575
- _e = _a.isDefaultOpen,
2576
- isDefaultOpen = _e === void 0 ? false : _e;
2575
+ _f = _a.isDefaultOpen,
2576
+ isDefaultOpen = _f === void 0 ? false : _f;
2577
2577
 
2578
- var _f = __read(React__namespace.useState(null), 2),
2579
- anchorEl = _f[0],
2580
- setAnchorEl = _f[1];
2578
+ var _g = __read(React__namespace.useState(null), 2),
2579
+ anchorEl = _g[0],
2580
+ setAnchorEl = _g[1];
2581
2581
 
2582
2582
  var isOpen = Boolean(anchorEl);
2583
2583
 
2584
- var _g = getPosition(menuPosition),
2585
- anchorOrigin = _g.anchorOrigin,
2586
- transformOrigin = _g.transformOrigin;
2584
+ var _h = getPosition(menuPosition),
2585
+ anchorOrigin = _h.anchorOrigin,
2586
+ transformOrigin = _h.transformOrigin;
2587
2587
 
2588
2588
  var handleClick = function handleClick(event) {
2589
2589
  event.stopPropagation();
@@ -2630,7 +2630,13 @@
2630
2630
  padding: '0px'
2631
2631
  }
2632
2632
  })
2633
- }, menuItems && menuItems.map(function (menuItem) {
2633
+ }, menuTitle && /*#__PURE__*/React__namespace.createElement(material.ListSubheader, {
2634
+ "data-testid": "toggleMenuTitle"
2635
+ }, /*#__PURE__*/React__namespace.createElement(material.Typography, {
2636
+ sx: {
2637
+ fontSize: '12px'
2638
+ }
2639
+ }, menuTitle)), menuItems && menuItems.map(function (menuItem) {
2634
2640
  var text = menuItem.text,
2635
2641
  icon = menuItem.icon,
2636
2642
  action = menuItem.action;
@@ -2759,7 +2765,8 @@
2759
2765
  var tooltipTitle = _a.tooltipTitle,
2760
2766
  onClickDelete = _a.onClickDelete,
2761
2767
  _b = _a.isEnabled,
2762
- isEnabled = _b === void 0 ? true : _b;
2768
+ isEnabled = _b === void 0 ? true : _b,
2769
+ sx = _a.sx;
2763
2770
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2764
2771
  tooltipTitle: tooltipTitle,
2765
2772
  onClick: onClickDelete,
@@ -2771,15 +2778,16 @@
2771
2778
  variant: "tertiary",
2772
2779
  onClick: onClickDelete,
2773
2780
  startIcon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
2774
- sx: {
2781
+ sx: __assign({
2775
2782
  display: 'none'
2776
- }
2783
+ }, sx)
2777
2784
  }, "Delete")), /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2778
2785
  tooltipTitle: tooltipTitle,
2779
2786
  onClick: onClickDelete,
2780
2787
  icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
2781
2788
  testId: "deleteButton",
2782
- isEnabled: isEnabled
2789
+ isEnabled: isEnabled,
2790
+ sx: sx
2783
2791
  }));
2784
2792
  };
2785
2793
 
@@ -4,6 +4,7 @@ interface AppHeaderProps {
4
4
  userMenu?: React.ReactNode;
5
5
  workspaceTopBar?: React.ReactNode;
6
6
  title?: string;
7
+ onClick?: () => void;
7
8
  }
8
9
  declare const AppHeader: React.FC<AppHeaderProps>;
9
10
  export default AppHeader;
@@ -1,7 +1,8 @@
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
- onClickDelete: () => void;
5
+ onClickDelete: (event: React.MouseEvent) => void;
5
6
  isEnabled?: boolean;
6
7
  }
7
8
  export declare const ManagerDeleteButton: React.FC<DeleteButtonProps>;
@@ -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.17.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.17.0",
18
18
  "react-draggable": "^4.4.5",
19
19
  "re-resizable": "^6.9.0",
20
20
  "@redux-eggs/core": "^2.2.0",