@opengeoweb/shared 2.12.0 → 2.13.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 from 'react';
3
- import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, Alert, AlertTitle, Grid, useTheme, Link, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListItemIcon, Checkbox, Select } from '@mui/material';
4
- import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, OptionKey, ArrowUp, ArrowDown, CommandKey, Options, Delete, VisibilityOff, Visibility } from '@opengeoweb/theme';
3
+ import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, Grid, useTheme, Link, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListItemIcon, Checkbox, Select } from '@mui/material';
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';
6
6
  import { isEmpty, errorMessages } from '@opengeoweb/form-fields';
7
7
  import makeStyles from '@mui/styles/makeStyles';
@@ -101,6 +101,20 @@ function __rest(s, e) {
101
101
  return t;
102
102
  }
103
103
 
104
+ var confirmStyle = {
105
+ width: {
106
+ xs: '100%',
107
+ sm: '150px'
108
+ },
109
+ marginLeft: {
110
+ xs: '0px!important',
111
+ sm: '8px!important'
112
+ },
113
+ marginTop: {
114
+ xs: 2,
115
+ sm: 0
116
+ }
117
+ };
104
118
  var ConfirmationDialog = function ConfirmationDialog(_a) {
105
119
  var open = _a.open,
106
120
  title = _a.title,
@@ -116,7 +130,9 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
116
130
  content = _a$content === void 0 ? null : _a$content,
117
131
  _a$disableAutoFocus = _a.disableAutoFocus,
118
132
  disableAutoFocus = _a$disableAutoFocus === void 0 ? false : _a$disableAutoFocus,
119
- other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus"]);
133
+ _a$isLoading = _a.isLoading,
134
+ isLoading = _a$isLoading === void 0 ? false : _a$isLoading,
135
+ other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"]);
120
136
 
121
137
  other.catchOnCancel;
122
138
  var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
@@ -200,29 +216,28 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
200
216
  return _onClose('CANCELLED');
201
217
  },
202
218
  disableFocusRipple: true
203
- }, cancelLabel), /*#__PURE__*/React.createElement(Button, {
219
+ }, cancelLabel), isLoading ? /*#__PURE__*/React.createElement(Box, {
220
+ "data-testid": "confirm-dialog-spinner",
221
+ sx: Object.assign(Object.assign({}, confirmStyle), {
222
+ height: '40px',
223
+ display: 'flex',
224
+ justifyContent: 'center',
225
+ alignItems: 'center'
226
+ })
227
+ }, /*#__PURE__*/React.createElement(CircularProgress, {
228
+ size: 40,
229
+ color: "secondary"
230
+ })) : /*#__PURE__*/React.createElement(Button, {
204
231
  "data-testid": "confirmationDialog-confirm",
205
232
  variant: "primary",
206
233
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
207
234
  sx: function sx(theme) {
208
- return {
209
- width: {
210
- xs: '100%',
211
- sm: '150px'
212
- },
213
- marginLeft: {
214
- xs: '0px!important',
215
- sm: '8px!important'
216
- },
217
- marginTop: {
218
- xs: 2,
219
- sm: 0
220
- },
235
+ return Object.assign(Object.assign({}, confirmStyle), {
221
236
  '&:focus': {
222
237
  outline: theme.palette.geowebColors.buttons.focusDefault.outline,
223
238
  borderColor: 'transparent'
224
239
  }
225
- };
240
+ });
226
241
  },
227
242
  onClick: onSubmit,
228
243
  autoFocus: !disableAutoFocus,
@@ -1049,12 +1064,12 @@ var ResizeComponent = function ResizeComponent(_a) {
1049
1064
  onResizeStop: onResizeStop,
1050
1065
  handleComponent: {
1051
1066
  bottomRight: /*#__PURE__*/React__default.createElement(Resize, {
1052
- isRightAligned: true,
1053
1067
  style: {
1054
1068
  fill: "".concat(theme.palette.geowebColors.buttons.flat["default"].color)
1055
1069
  }
1056
1070
  }),
1057
1071
  bottomLeft: /*#__PURE__*/React__default.createElement(Resize, {
1072
+ isRightAligned: true,
1058
1073
  style: {
1059
1074
  fill: "".concat(theme.palette.geowebColors.buttons.flat["default"].color)
1060
1075
  }
@@ -1407,11 +1422,6 @@ var ToolHeader = function ToolHeader(_ref) {
1407
1422
  _ref$leftComponent = _ref.leftComponent,
1408
1423
  leftComponent = _ref$leftComponent === void 0 ? null : _ref$leftComponent;
1409
1424
  var styles = getStyle(size);
1410
-
1411
- var onClickClose = function onClickClose() {
1412
- return onClose();
1413
- };
1414
-
1415
1425
  var columnSizeIcon = leftComponent ? 3 : 1;
1416
1426
  var columnSizeTitle = leftComponent ? 6 : 10;
1417
1427
  return /*#__PURE__*/React__default.createElement(Box, {
@@ -1479,7 +1489,8 @@ var ToolHeader = function ToolHeader(_ref) {
1479
1489
  }
1480
1490
  }, /*#__PURE__*/React__default.createElement(IconButton, {
1481
1491
  "data-testid": "closeBtn",
1482
- onClick: onClickClose,
1492
+ onClick: onClose,
1493
+ onTouchEnd: onClose,
1483
1494
  size: "large",
1484
1495
  sx: iconStyle
1485
1496
  }, /*#__PURE__*/React__default.createElement(Close, {
@@ -1860,7 +1871,7 @@ var shortcuts = [{
1860
1871
  type: "connect"
1861
1872
  }, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1862
1873
  type: "icon"
1863
- }, /*#__PURE__*/React__default.createElement(OptionKey, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1874
+ }, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1864
1875
  type: "connect"
1865
1876
  }, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1866
1877
  type: "icon"
@@ -1904,7 +1915,7 @@ var shortcuts = [{
1904
1915
  type: "connect"
1905
1916
  }, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1906
1917
  type: "icon"
1907
- }, /*#__PURE__*/React__default.createElement(OptionKey, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1918
+ }, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1908
1919
  type: "connect"
1909
1920
  }, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1910
1921
  type: "icon"
@@ -1924,7 +1935,7 @@ var shortcuts = [{
1924
1935
  }, /*#__PURE__*/React__default.createElement(ArrowDown, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "(when slider active)")),
1925
1936
  descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1926
1937
  type: "icon"
1927
- }, /*#__PURE__*/React__default.createElement(CommandKey, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1938
+ }, /*#__PURE__*/React__default.createElement(KeyCommand, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1928
1939
  type: "connect"
1929
1940
  }, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1930
1941
  type: "icon"
@@ -1952,7 +1963,7 @@ var shortcuts = [{
1952
1963
  }, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + Mouse scroll")),
1953
1964
  descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
1954
1965
  type: "icon"
1955
- }, /*#__PURE__*/React__default.createElement(CommandKey, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + Mouse scroll"))
1966
+ }, /*#__PURE__*/React__default.createElement(KeyCommand, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + Mouse scroll"))
1956
1967
  }];
1957
1968
  var getShortcutList = function getShortcutList(shortcutList) {
1958
1969
  var platform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'windows';
@@ -2490,10 +2501,10 @@ var ToggleMenu = function ToggleMenu(_ref) {
2490
2501
  var useStyles = makeStyles(function (theme) {
2491
2502
  return createStyles({
2492
2503
  button: {
2493
- height: 28,
2494
- width: 28,
2504
+ height: 24,
2505
+ width: 24,
2495
2506
  borderRadius: 5,
2496
- marginTop: 2,
2507
+ marginTop: 4,
2497
2508
  color: function color(_ref) {
2498
2509
  var isActive = _ref.isActive,
2499
2510
  isAccessible = _ref.isAccessible,
@@ -2602,12 +2613,7 @@ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
2602
2613
  return /*#__PURE__*/React.createElement(ManagerButton, {
2603
2614
  tooltipTitle: tooltipTitle,
2604
2615
  onClick: onClickDelete,
2605
- icon: /*#__PURE__*/React.createElement(Delete, {
2606
- sx: {
2607
- width: 20,
2608
- height: 20
2609
- }
2610
- }),
2616
+ icon: /*#__PURE__*/React.createElement(Delete, null),
2611
2617
  testId: "deleteButton",
2612
2618
  isEnabled: isEnabled
2613
2619
  });
package/index.umd.js CHANGED
@@ -159,6 +159,20 @@
159
159
  }, content));
160
160
  };
161
161
 
162
+ var confirmStyle = {
163
+ width: {
164
+ xs: '100%',
165
+ sm: '150px'
166
+ },
167
+ marginLeft: {
168
+ xs: '0px!important',
169
+ sm: '8px!important'
170
+ },
171
+ marginTop: {
172
+ xs: 2,
173
+ sm: 0
174
+ }
175
+ };
162
176
  var ConfirmationDialog = function ConfirmationDialog(_a) {
163
177
  var open = _a.open,
164
178
  title = _a.title,
@@ -174,7 +188,9 @@
174
188
  content = _e === void 0 ? null : _e,
175
189
  _f = _a.disableAutoFocus,
176
190
  disableAutoFocus = _f === void 0 ? false : _f,
177
- other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus"]);
191
+ _g = _a.isLoading,
192
+ isLoading = _g === void 0 ? false : _g,
193
+ other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"]);
178
194
 
179
195
  other.catchOnCancel;
180
196
  var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
@@ -258,29 +274,28 @@
258
274
  return _onClose('CANCELLED');
259
275
  },
260
276
  disableFocusRipple: true
261
- }, cancelLabel), /*#__PURE__*/React__namespace.createElement(material.Button, {
277
+ }, cancelLabel), isLoading ? /*#__PURE__*/React__namespace.createElement(material.Box, {
278
+ "data-testid": "confirm-dialog-spinner",
279
+ sx: __assign(__assign({}, confirmStyle), {
280
+ height: '40px',
281
+ display: 'flex',
282
+ justifyContent: 'center',
283
+ alignItems: 'center'
284
+ })
285
+ }, /*#__PURE__*/React__namespace.createElement(material.CircularProgress, {
286
+ size: 40,
287
+ color: "secondary"
288
+ })) : /*#__PURE__*/React__namespace.createElement(material.Button, {
262
289
  "data-testid": "confirmationDialog-confirm",
263
290
  variant: "primary",
264
291
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
265
292
  sx: function sx(theme) {
266
- return {
267
- width: {
268
- xs: '100%',
269
- sm: '150px'
270
- },
271
- marginLeft: {
272
- xs: '0px!important',
273
- sm: '8px!important'
274
- },
275
- marginTop: {
276
- xs: 2,
277
- sm: 0
278
- },
293
+ return __assign(__assign({}, confirmStyle), {
279
294
  '&:focus': {
280
295
  outline: theme.palette.geowebColors.buttons.focusDefault.outline,
281
296
  borderColor: 'transparent'
282
297
  }
283
- };
298
+ });
284
299
  },
285
300
  onClick: onSubmit,
286
301
  autoFocus: !disableAutoFocus,
@@ -918,12 +933,12 @@
918
933
  onResizeStop: onResizeStop,
919
934
  handleComponent: {
920
935
  bottomRight: /*#__PURE__*/React__default["default"].createElement(theme.Resize, {
921
- isRightAligned: true,
922
936
  style: {
923
937
  fill: "" + theme$1.palette.geowebColors.buttons.flat["default"].color
924
938
  }
925
939
  }),
926
940
  bottomLeft: /*#__PURE__*/React__default["default"].createElement(theme.Resize, {
941
+ isRightAligned: true,
927
942
  style: {
928
943
  fill: "" + theme$1.palette.geowebColors.buttons.flat["default"].color
929
944
  }
@@ -1268,11 +1283,6 @@
1268
1283
  _e = _a.leftComponent,
1269
1284
  leftComponent = _e === void 0 ? null : _e;
1270
1285
  var styles = getStyle(size);
1271
-
1272
- var onClickClose = function onClickClose() {
1273
- return onClose();
1274
- };
1275
-
1276
1286
  var columnSizeIcon = leftComponent ? 3 : 1;
1277
1287
  var columnSizeTitle = leftComponent ? 6 : 10;
1278
1288
  return /*#__PURE__*/React__default["default"].createElement(material.Box, {
@@ -1340,7 +1350,8 @@
1340
1350
  }
1341
1351
  }, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
1342
1352
  "data-testid": "closeBtn",
1343
- onClick: onClickClose,
1353
+ onClick: onClose,
1354
+ onTouchEnd: onClose,
1344
1355
  size: "large",
1345
1356
  sx: iconStyle
1346
1357
  }, /*#__PURE__*/React__default["default"].createElement(theme.Close, {
@@ -1721,7 +1732,7 @@
1721
1732
  type: "connect"
1722
1733
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1723
1734
  type: "icon"
1724
- }, /*#__PURE__*/React__default["default"].createElement(theme.OptionKey, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1735
+ }, /*#__PURE__*/React__default["default"].createElement(theme.KeyOption, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1725
1736
  type: "connect"
1726
1737
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1727
1738
  type: "icon"
@@ -1765,7 +1776,7 @@
1765
1776
  type: "connect"
1766
1777
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1767
1778
  type: "icon"
1768
- }, /*#__PURE__*/React__default["default"].createElement(theme.OptionKey, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1779
+ }, /*#__PURE__*/React__default["default"].createElement(theme.KeyOption, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1769
1780
  type: "connect"
1770
1781
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1771
1782
  type: "icon"
@@ -1785,7 +1796,7 @@
1785
1796
  }, /*#__PURE__*/React__default["default"].createElement(theme.ArrowDown, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, null, "(when slider active)")),
1786
1797
  descriptionMac: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1787
1798
  type: "icon"
1788
- }, /*#__PURE__*/React__default["default"].createElement(theme.CommandKey, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1799
+ }, /*#__PURE__*/React__default["default"].createElement(theme.KeyCommand, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1789
1800
  type: "connect"
1790
1801
  }, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1791
1802
  type: "icon"
@@ -1813,7 +1824,7 @@
1813
1824
  }, "Ctrl"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, null, " + Mouse scroll")),
1814
1825
  descriptionMac: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
1815
1826
  type: "icon"
1816
- }, /*#__PURE__*/React__default["default"].createElement(theme.CommandKey, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, null, " + Mouse scroll"))
1827
+ }, /*#__PURE__*/React__default["default"].createElement(theme.KeyCommand, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, null, " + Mouse scroll"))
1817
1828
  }];
1818
1829
  var getShortcutList = function getShortcutList(shortcutList, platform) {
1819
1830
  if (platform === void 0) {
@@ -2383,10 +2394,10 @@
2383
2394
  var useStyles = makeStyles__default["default"](function (theme) {
2384
2395
  return createStyles__default["default"]({
2385
2396
  button: {
2386
- height: 28,
2387
- width: 28,
2397
+ height: 24,
2398
+ width: 24,
2388
2399
  borderRadius: 5,
2389
- marginTop: 2,
2400
+ marginTop: 4,
2390
2401
  color: function color(_a) {
2391
2402
  var isActive = _a.isActive,
2392
2403
  isAccessible = _a.isAccessible,
@@ -2495,12 +2506,7 @@
2495
2506
  return /*#__PURE__*/React__namespace.createElement(ManagerButton, {
2496
2507
  tooltipTitle: tooltipTitle,
2497
2508
  onClick: onClickDelete,
2498
- icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, {
2499
- sx: {
2500
- width: 20,
2501
- height: 20
2502
- }
2503
- }),
2509
+ icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
2504
2510
  testId: "deleteButton",
2505
2511
  isEnabled: isEnabled
2506
2512
  });
@@ -13,6 +13,7 @@ interface ConfirmationDialogProps extends ConfirmationOptions {
13
13
  open: boolean;
14
14
  onSubmit: () => void;
15
15
  onClose: (reason: ConfirmationAction) => void;
16
+ isLoading?: boolean;
16
17
  }
17
18
  export declare const ConfirmationDialog: React.FC<ConfirmationDialogProps>;
18
19
  export default ConfirmationDialog;
@@ -4,6 +4,7 @@ declare const _default: {
4
4
  };
5
5
  export default _default;
6
6
  export declare const ConfirmationDialogCustom: () => React.ReactElement;
7
+ export declare const ConfirmationDialogLoading: () => React.ReactElement;
7
8
  export declare const ConfirmationDialogLight: {
8
9
  (): React.ReactElement;
9
10
  storyName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "2.12.0",
3
+ "version": "2.13.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,12 +14,12 @@
14
14
  "peerDependencies": {
15
15
  "react": "^17.0.2",
16
16
  "@mui/material": "^5.2.8",
17
- "@opengeoweb/theme": "2.12.0",
17
+ "@opengeoweb/theme": "2.13.0",
18
18
  "@mui/styles": "^5.2.3",
19
19
  "react-draggable": "^4.4.3",
20
20
  "re-resizable": "^6.9.0",
21
21
  "lodash": "^4.17.20",
22
- "@opengeoweb/form-fields": "2.12.0",
22
+ "@opengeoweb/form-fields": "2.13.0",
23
23
  "react-hook-form": "^6.12.1",
24
24
  "moment": "^2.29.0",
25
25
  "moment-timezone": "^0.5.31",