@opengeoweb/shared 4.1.0 → 4.2.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,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default from 'react';
2
+ import React__default, { useRef } from 'react';
3
3
  import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, Grid, useTheme, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListItemIcon, Checkbox, Select } 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 } from '@opengeoweb/theme';
5
5
  import { useFormContext } from 'react-hook-form';
@@ -488,7 +488,7 @@ function usePreventBrowserClose(shouldPreventClose) {
488
488
  * */
489
489
  var usePoller = function usePoller(deps, callback) {
490
490
  var pollingInterval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300000;
491
- var interval = React.useRef(null);
491
+ var interval = useRef(null);
492
492
  React.useEffect(function () {
493
493
  if (deps.filter(function (dep) {
494
494
  return dep !== null;
@@ -781,7 +781,11 @@ var AlertBanner = function AlertBanner(_ref) {
781
781
  isOpen = _React$useState2[0],
782
782
  setIsOpen = _React$useState2[1];
783
783
 
784
- return isOpen && /*#__PURE__*/React.createElement(Alert, {
784
+ if (!isOpen) {
785
+ return null;
786
+ }
787
+
788
+ return /*#__PURE__*/React.createElement(Alert, {
785
789
  "data-testid": dataTestId,
786
790
  severity: severity,
787
791
  icon: /*#__PURE__*/React.createElement(AlertIcon, {
@@ -1016,15 +1020,13 @@ var DraggableComponent$1 = function DraggableComponent(_a) {
1016
1020
  var ResizeComponent = function ResizeComponent(_a) {
1017
1021
  var _a$startPosition = _a.startPosition,
1018
1022
  startPosition = _a$startPosition === void 0 ? {
1019
- left: null,
1020
- right: null,
1021
- top: null
1023
+ left: undefined,
1024
+ right: undefined,
1025
+ top: undefined
1022
1026
  } : _a$startPosition,
1023
1027
  children = _a.children,
1024
1028
  _a$onResizeStart = _a.onResizeStart,
1025
- onResizeStart = _a$onResizeStart === void 0 ? function () {
1026
- return null;
1027
- } : _a$onResizeStart,
1029
+ onResizeStart = _a$onResizeStart === void 0 ? function () {} : _a$onResizeStart,
1028
1030
  size = _a.size,
1029
1031
  setSize = _a.setSize,
1030
1032
  _a$minHeight = _a.minHeight,
@@ -1113,8 +1115,8 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
1113
1115
 
1114
1116
  _this = _super.call(this, props);
1115
1117
  _this.state = {
1116
- error: null,
1117
- errorInfo: null
1118
+ error: undefined,
1119
+ errorInfo: undefined
1118
1120
  };
1119
1121
  return _this;
1120
1122
  }
@@ -1174,9 +1176,7 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
1174
1176
  return ErrorBoundary;
1175
1177
  }(React.Component);
1176
1178
  ErrorBoundary.defaultProps = {
1177
- onError: function onError() {
1178
- return null;
1179
- }
1179
+ onError: function onError() {}
1180
1180
  };
1181
1181
 
1182
1182
  /* *
@@ -1264,13 +1264,9 @@ var UserMenu = function UserMenu(_ref) {
1264
1264
  var _ref$isOpen = _ref.isOpen,
1265
1265
  isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
1266
1266
  _ref$onToggle = _ref.onToggle,
1267
- onToggle = _ref$onToggle === void 0 ? function () {
1268
- return null;
1269
- } : _ref$onToggle,
1267
+ onToggle = _ref$onToggle === void 0 ? function () {} : _ref$onToggle,
1270
1268
  _ref$onClose = _ref.onClose,
1271
- onClose = _ref$onClose === void 0 ? function () {
1272
- return null;
1273
- } : _ref$onClose,
1269
+ onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
1274
1270
  children = _ref.children,
1275
1271
  initials = _ref.initials;
1276
1272
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
@@ -1622,27 +1618,21 @@ var DraggableComponent = function DraggableComponent(_a) {
1622
1618
  } : _a$startSize,
1623
1619
  _a$startPosition = _a.startPosition,
1624
1620
  startPosition = _a$startPosition === void 0 ? {
1625
- left: null,
1626
- right: null,
1627
- top: null
1621
+ left: undefined,
1622
+ right: undefined,
1623
+ top: undefined
1628
1624
  } : _a$startPosition,
1629
1625
  children = _a.children,
1630
1626
  _a$isOpen = _a.isOpen,
1631
1627
  isOpen = _a$isOpen === void 0 ? true : _a$isOpen,
1632
1628
  _a$onClose = _a.onClose,
1633
- onClose = _a$onClose === void 0 ? function () {
1634
- return null;
1635
- } : _a$onClose,
1629
+ onClose = _a$onClose === void 0 ? function () {} : _a$onClose,
1636
1630
  _a$initialMaxHeight = _a.initialMaxHeight,
1637
1631
  defaultInitialMaxHeight = _a$initialMaxHeight === void 0 ? 'initial' : _a$initialMaxHeight,
1638
1632
  _a$onChangeSize = _a.onChangeSize,
1639
- onChangeSize = _a$onChangeSize === void 0 ? function () {
1640
- return null;
1641
- } : _a$onChangeSize,
1633
+ onChangeSize = _a$onChangeSize === void 0 ? function () {} : _a$onChangeSize,
1642
1634
  _a$onMouseDown = _a.onMouseDown,
1643
- onMouseDown = _a$onMouseDown === void 0 ? function () {
1644
- return null;
1645
- } : _a$onMouseDown,
1635
+ onMouseDown = _a$onMouseDown === void 0 ? function () {} : _a$onMouseDown,
1646
1636
  _a$order = _a.order,
1647
1637
  order = _a$order === void 0 ? 1 : _a$order,
1648
1638
  _a$source = _a.source,
@@ -2456,11 +2446,11 @@ var ToggleMenu = function ToggleMenu(_ref) {
2456
2446
  transition: 'none'
2457
2447
  }
2458
2448
  },
2459
- MenuListProps: children && {
2449
+ MenuListProps: Object.assign({}, children && {
2460
2450
  style: {
2461
2451
  padding: '0px'
2462
2452
  }
2463
- }
2453
+ })
2464
2454
  }, menuItems && menuItems.map(function (menuItem) {
2465
2455
  var text = menuItem.text,
2466
2456
  icon = menuItem.icon,
@@ -2790,7 +2780,7 @@ var TooltipSelect = function TooltipSelect(_a) {
2790
2780
  title: tooltip,
2791
2781
  placement: "top",
2792
2782
  open: tooltipOpen,
2793
- sx: noStyling ? undefined : tooltipContainerStyles(isEnabled, hasBackgroundColor)
2783
+ sx: noStyling ? undefined : tooltipContainerStyles(!!isEnabled, hasBackgroundColor)
2794
2784
  }, /*#__PURE__*/React.createElement(Select, Object.assign({
2795
2785
  onOpen: onOpen,
2796
2786
  onClose: onClose,
package/index.umd.js CHANGED
@@ -357,7 +357,7 @@
357
357
  pollingInterval = 300000;
358
358
  }
359
359
 
360
- var interval = React__namespace.useRef(null);
360
+ var interval = React.useRef(null);
361
361
  React__namespace.useEffect(function () {
362
362
  if (deps.filter(function (dep) {
363
363
  return dep !== null;
@@ -634,7 +634,11 @@
634
634
  isOpen = _h[0],
635
635
  setIsOpen = _h[1];
636
636
 
637
- return isOpen && /*#__PURE__*/React__namespace.createElement(material.Alert, {
637
+ if (!isOpen) {
638
+ return null;
639
+ }
640
+
641
+ return /*#__PURE__*/React__namespace.createElement(material.Alert, {
638
642
  "data-testid": dataTestId,
639
643
  severity: severity,
640
644
  icon: /*#__PURE__*/React__namespace.createElement(AlertIcon, {
@@ -887,15 +891,13 @@
887
891
  var ResizeComponent = function ResizeComponent(_a) {
888
892
  var _b = _a.startPosition,
889
893
  startPosition = _b === void 0 ? {
890
- left: null,
891
- right: null,
892
- top: null
894
+ left: undefined,
895
+ right: undefined,
896
+ top: undefined
893
897
  } : _b,
894
898
  children = _a.children,
895
899
  _c = _a.onResizeStart,
896
- onResizeStart = _c === void 0 ? function () {
897
- return null;
898
- } : _c,
900
+ onResizeStart = _c === void 0 ? function () {} : _c,
899
901
  size = _a.size,
900
902
  setSize = _a.setSize,
901
903
  _d = _a.minHeight,
@@ -981,8 +983,8 @@
981
983
  var _this = _super.call(this, props) || this;
982
984
 
983
985
  _this.state = {
984
- error: null,
985
- errorInfo: null
986
+ error: undefined,
987
+ errorInfo: undefined
986
988
  };
987
989
  return _this;
988
990
  }
@@ -1035,9 +1037,7 @@
1035
1037
  };
1036
1038
 
1037
1039
  ErrorBoundary.defaultProps = {
1038
- onError: function onError() {
1039
- return null;
1040
- }
1040
+ onError: function onError() {}
1041
1041
  };
1042
1042
  return ErrorBoundary;
1043
1043
  }(React__namespace.Component);
@@ -1111,13 +1111,9 @@
1111
1111
  var _b = _a.isOpen,
1112
1112
  isOpen = _b === void 0 ? false : _b,
1113
1113
  _c = _a.onToggle,
1114
- onToggle = _c === void 0 ? function () {
1115
- return null;
1116
- } : _c,
1114
+ onToggle = _c === void 0 ? function () {} : _c,
1117
1115
  _d = _a.onClose,
1118
- onClose = _d === void 0 ? function () {
1119
- return null;
1120
- } : _d,
1116
+ onClose = _d === void 0 ? function () {} : _d,
1121
1117
  children = _a.children,
1122
1118
  initials = _a.initials;
1123
1119
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
@@ -1488,27 +1484,21 @@
1488
1484
  } : _d,
1489
1485
  _e = _a.startPosition,
1490
1486
  startPosition = _e === void 0 ? {
1491
- left: null,
1492
- right: null,
1493
- top: null
1487
+ left: undefined,
1488
+ right: undefined,
1489
+ top: undefined
1494
1490
  } : _e,
1495
1491
  children = _a.children,
1496
1492
  _f = _a.isOpen,
1497
1493
  isOpen = _f === void 0 ? true : _f,
1498
1494
  _g = _a.onClose,
1499
- onClose = _g === void 0 ? function () {
1500
- return null;
1501
- } : _g,
1495
+ onClose = _g === void 0 ? function () {} : _g,
1502
1496
  _h = _a.initialMaxHeight,
1503
1497
  defaultInitialMaxHeight = _h === void 0 ? 'initial' : _h,
1504
1498
  _j = _a.onChangeSize,
1505
- onChangeSize = _j === void 0 ? function () {
1506
- return null;
1507
- } : _j,
1499
+ onChangeSize = _j === void 0 ? function () {} : _j,
1508
1500
  _k = _a.onMouseDown,
1509
- onMouseDown = _k === void 0 ? function () {
1510
- return null;
1511
- } : _k,
1501
+ onMouseDown = _k === void 0 ? function () {} : _k,
1512
1502
  _l = _a.order,
1513
1503
  order = _l === void 0 ? 1 : _l,
1514
1504
  _m = _a.source,
@@ -2319,11 +2309,11 @@
2319
2309
  transition: 'none'
2320
2310
  }
2321
2311
  },
2322
- MenuListProps: children && {
2312
+ MenuListProps: __assign({}, children && {
2323
2313
  style: {
2324
2314
  padding: '0px'
2325
2315
  }
2326
- }
2316
+ })
2327
2317
  }, menuItems && menuItems.map(function (menuItem) {
2328
2318
  var text = menuItem.text,
2329
2319
  icon = menuItem.icon,
@@ -2670,7 +2660,7 @@
2670
2660
  title: tooltip,
2671
2661
  placement: "top",
2672
2662
  open: tooltipOpen,
2673
- sx: noStyling ? undefined : tooltipContainerStyles(isEnabled, hasBackgroundColor)
2663
+ sx: noStyling ? undefined : tooltipContainerStyles(!!isEnabled, hasBackgroundColor)
2674
2664
  }, /*#__PURE__*/React__namespace.createElement(material.Select, __assign({
2675
2665
  onOpen: onOpen,
2676
2666
  onClose: onClose,
@@ -1,2 +1,2 @@
1
1
  import * as React from 'react';
2
- export declare const usePoller: (deps: unknown[], callback: () => void, pollingInterval?: number) => React.MutableRefObject<number>;
2
+ export declare const usePoller: (deps: unknown[], callback: () => void, pollingInterval?: number) => React.RefObject<ReturnType<typeof setTimeout>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "4.1.0",
3
+ "version": "4.2.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,11 +14,11 @@
14
14
  "peerDependencies": {
15
15
  "react": "^17.0.2",
16
16
  "@mui/material": "^5.2.8",
17
- "@opengeoweb/theme": "4.1.0",
17
+ "@opengeoweb/theme": "4.2.0",
18
18
  "react-draggable": "^4.4.3",
19
19
  "re-resizable": "^6.9.0",
20
20
  "lodash": "^4.17.20",
21
- "@opengeoweb/form-fields": "4.1.0",
21
+ "@opengeoweb/form-fields": "4.2.0",
22
22
  "react-hook-form": "^6.12.1",
23
23
  "moment": "^2.29.0",
24
24
  "moment-timezone": "^0.5.31",