@opengeoweb/shared 2.0.1 → 2.1.3

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/shared.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { Box, Typography, makeStyles, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, SvgIcon, Grid, useTheme, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, withStyles, Slider } from '@material-ui/core';
3
+ import { Box, Typography, makeStyles, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, SvgIcon, Grid, useTheme, Link, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, withStyles, Slider, createStyles } from '@material-ui/core';
4
4
  import { Close, DragIndicator } from '@material-ui/icons';
5
5
  import { useFormContext } from 'react-hook-form';
6
6
  import { isEmpty, errorMessages } from '@opengeoweb/form-fields';
@@ -103,7 +103,7 @@ function __rest(s, e) {
103
103
  return t;
104
104
  }
105
105
 
106
- var useStyles$d = makeStyles(function () {
106
+ var useStyles$e = makeStyles(function () {
107
107
  return {
108
108
  dialogHeader: {
109
109
  zIndex: 1,
@@ -135,7 +135,7 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
135
135
  content = _a$content === void 0 ? null : _a$content,
136
136
  other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content"]);
137
137
 
138
- var classes = useStyles$d();
138
+ var classes = useStyles$e();
139
139
 
140
140
  other.catchOnCancel;
141
141
  var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
@@ -172,7 +172,8 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
172
172
  onClick: function onClick() {
173
173
  return onClose('CANCELLED');
174
174
  },
175
- autoFocus: true
175
+ autoFocus: true,
176
+ disableRipple: true
176
177
  }, cancelLabel), /*#__PURE__*/React.createElement(Button, {
177
178
  "data-testid": "conformationDialog-confirm",
178
179
  color: "secondary",
@@ -181,6 +182,28 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
181
182
  }, confirmLabel)));
182
183
  };
183
184
 
185
+ function _classCallCheck(instance, Constructor) {
186
+ if (!(instance instanceof Constructor)) {
187
+ throw new TypeError("Cannot call a class as a function");
188
+ }
189
+ }
190
+
191
+ function _defineProperties(target, props) {
192
+ for (var i = 0; i < props.length; i++) {
193
+ var descriptor = props[i];
194
+ descriptor.enumerable = descriptor.enumerable || false;
195
+ descriptor.configurable = true;
196
+ if ("value" in descriptor) descriptor.writable = true;
197
+ Object.defineProperty(target, descriptor.key, descriptor);
198
+ }
199
+ }
200
+
201
+ function _createClass(Constructor, protoProps, staticProps) {
202
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
203
+ if (staticProps) _defineProperties(Constructor, staticProps);
204
+ return Constructor;
205
+ }
206
+
184
207
  function _defineProperty(obj, key, value) {
185
208
  if (key in obj) {
186
209
  Object.defineProperty(obj, key, {
@@ -196,6 +219,85 @@ function _defineProperty(obj, key, value) {
196
219
  return obj;
197
220
  }
198
221
 
222
+ function _inherits(subClass, superClass) {
223
+ if (typeof superClass !== "function" && superClass !== null) {
224
+ throw new TypeError("Super expression must either be null or a function");
225
+ }
226
+
227
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
228
+ constructor: {
229
+ value: subClass,
230
+ writable: true,
231
+ configurable: true
232
+ }
233
+ });
234
+ if (superClass) _setPrototypeOf(subClass, superClass);
235
+ }
236
+
237
+ function _getPrototypeOf(o) {
238
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
239
+ return o.__proto__ || Object.getPrototypeOf(o);
240
+ };
241
+ return _getPrototypeOf(o);
242
+ }
243
+
244
+ function _setPrototypeOf(o, p) {
245
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
246
+ o.__proto__ = p;
247
+ return o;
248
+ };
249
+
250
+ return _setPrototypeOf(o, p);
251
+ }
252
+
253
+ function _isNativeReflectConstruct() {
254
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
255
+ if (Reflect.construct.sham) return false;
256
+ if (typeof Proxy === "function") return true;
257
+
258
+ try {
259
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
260
+ return true;
261
+ } catch (e) {
262
+ return false;
263
+ }
264
+ }
265
+
266
+ function _assertThisInitialized(self) {
267
+ if (self === void 0) {
268
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
269
+ }
270
+
271
+ return self;
272
+ }
273
+
274
+ function _possibleConstructorReturn(self, call) {
275
+ if (call && (typeof call === "object" || typeof call === "function")) {
276
+ return call;
277
+ }
278
+
279
+ return _assertThisInitialized(self);
280
+ }
281
+
282
+ function _createSuper(Derived) {
283
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
284
+
285
+ return function _createSuperInternal() {
286
+ var Super = _getPrototypeOf(Derived),
287
+ result;
288
+
289
+ if (hasNativeReflectConstruct) {
290
+ var NewTarget = _getPrototypeOf(this).constructor;
291
+
292
+ result = Reflect.construct(Super, arguments, NewTarget);
293
+ } else {
294
+ result = Super.apply(this, arguments);
295
+ }
296
+
297
+ return _possibleConstructorReturn(this, result);
298
+ };
299
+ }
300
+
199
301
  function _slicedToArray(arr, i) {
200
302
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
201
303
  }
@@ -552,7 +654,7 @@ var ConfirmationServiceProvider = function ConfirmationServiceProvider(_ref) {
552
654
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
553
655
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
554
656
  * */
555
- var useStyles$c = makeStyles(function () {
657
+ var useStyles$d = makeStyles(function () {
556
658
  return {
557
659
  title: {
558
660
  fontSize: '14px',
@@ -622,7 +724,7 @@ var AlertBanner = function AlertBanner(_ref) {
622
724
  info = _ref$info === void 0 ? '' : _ref$info,
623
725
  _ref$dataTestId = _ref.dataTestId,
624
726
  dataTestId = _ref$dataTestId === void 0 ? 'alert-banner' : _ref$dataTestId;
625
- var classes = useStyles$c();
727
+ var classes = useStyles$d();
626
728
  return /*#__PURE__*/React.createElement(Alert, {
627
729
  "data-testid": dataTestId,
628
730
  severity: severity,
@@ -650,7 +752,7 @@ var AlertBanner = function AlertBanner(_ref) {
650
752
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
651
753
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
652
754
  * */
653
- var useStyles$b = makeStyles(function () {
755
+ var useStyles$c = makeStyles(function () {
654
756
  return {
655
757
  wrapper: {
656
758
  height: '100vh',
@@ -667,7 +769,7 @@ var useStyles$b = makeStyles(function () {
667
769
  var AppLayout = function AppLayout(_ref) {
668
770
  var header = _ref.header,
669
771
  children = _ref.children;
670
- var classes = useStyles$b();
772
+ var classes = useStyles$c();
671
773
  return /*#__PURE__*/React__default.createElement("div", {
672
774
  className: classes.wrapper
673
775
  }, header, /*#__PURE__*/React__default.createElement("main", {
@@ -677,7 +779,7 @@ var AppLayout = function AppLayout(_ref) {
677
779
 
678
780
  var img = "data:image/svg+xml,%3c!--Licensed under the Apache License%2c Version 2.0 (the 'License')%3byou may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing%2c softwaredistributed under the License is distributed on an 'AS IS' BASIS%2cWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND%2c either express or implied.See the License for the specific language governing permissions andlimitations under the License.Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)Copyright 2021 - Finnish Meteorological Institute (FMI)--%3e%3csvg id='svg4550' xmlnsRdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns='http://www.w3.org/2000/svg' height='55.156mm' viewBox='0 0 289.84072 195.43326' width='81.799mm' version='1.1' xmlnsCc='http://creativecommons.org/ns%23' xmlnsXlink='http://www.w3.org/1999/xlink' xmlnsDc='http://purl.org/dc/elements/1.1/'%3e %3cdefs id='defs14'%3e %3clinearGradient id='linearGradient4263' y2='113.1' gradientUnits='userSpaceOnUse' y1='76.066' gradientTransform='translate(0 -.0012816)' x2='199.26' x1='160.9'%3e %3cstop id='stop4259' stop-color='white' stop-opacity='.33333' offset='0'/%3e %3cstop id='stop4261' stop-color='white' stop-opacity='0' offset='1'/%3e %3c/linearGradient%3e %3clinearGradient id='linearGradient4240' y2='79.833' gradientUnits='userSpaceOnUse' x2='120.82' y1='120.77' x1='128.56'%3e %3cstop id='stop4236' stop-color='white' stop-opacity='0' offset='0'/%3e %3cstop id='stop4238' stop-color='white' stop-opacity='.33333' offset='1'/%3e %3c/linearGradient%3e %3c/defs%3e %3cg id='layer1' transform='translate(353.49 -626.07)'%3e %3cg id='g4'%3e %3cpath id='path4220' d='m-207 679.86c-7.6546-3.9726-16.149-6.0541-24.773-6.0703-24.585 0.0315-46.045 16.665-52.207 40.465-2.23-0.35755-4.4838-0.54689-6.7422-0.56642-24.881-0.00043-45.051 20.17-45.051 45.051-0.00043 24.881 20.17 45.051 45.051 45.051 36.152-0.20272 72.845-0.0898 109.18-0.0898 8.9834 0 22.962 0.009 36.879 0.0165 9.7409 0.38215 35.645-0.43398 53.537-23.548 17.892-23.115 7.1203-72.79-0.31513-94.017s-30.566-42.361-53.247-42.361c-26.664 0-50.367 14.562-62.311 36.07z' style='color-rendering:auto%3bcolor:black%3bisolation:auto%3bmix-blend-mode:normal%3bshape-rendering:auto%3bsolid-color:black%3bimage-rendering:auto' fill='%230b9ee5'/%3e %3cpath id='path4220-7' opacity='.98' d='m-335.78 758.74c-0.00043 24.881 20.17 45.051 45.051 45.051 36.152-0.20272 72.845-0.0898 109.18-0.0898 10.101 0 27.126 0.009 42.523 0.0156 11.975-0.4199 32.775-4.017 47.893-23.547 4.439-5.7347 7.1108-13.107 8.5098-21.271-35.448-0.0105-239.67-0.15823-253.16-0.15823z' fill='%2360bce9'/%3e %3c/g%3e %3cpath id='path4220-2' d='m-144.69 643.79c-19.529 0-37.464 7.8167-50.359 20.447-4.6476 4.6419-8.6513 9.9041-11.953 15.623 0 40.944 0.0195 77.914 0.0195 123.83 8.4824 0.007 16.983 0.0137 25.438 0.0137 10.101 0 27.126 0.009 42.523 0.0156 11.975-0.4199 32.775-4.017 47.893-23.547 17.892-23.115 7.1209-72.791-0.31446-94.018s-30.565-42.361-53.246-42.361z' style='color-rendering:auto%3bcolor:black%3bisolation:auto%3bmix-blend-mode:normal%3bshape-rendering:auto%3bsolid-color:black%3bimage-rendering:auto' fill='white' fill-opacity='.31373'/%3e %3c/g%3e %3cg id='g4244' transform='translate(2.926 -1.3827)'%3e %3cpath id='path4329' style='color-rendering:auto%3bcolor:black%3bisolation:auto%3bmix-blend-mode:normal%3bshape-rendering:auto%3bsolid-color:black%3bimage-rendering:auto' fill='%23003232' d='m211.54 98.88c11.484 8.7901 14.857 8.43 22.486 19.238 3.6519 5.1733 5.5602 11.69 5.5645 18.164-0.00018 17.949-14.551 32.499-32.5 32.498-17.948-0.00018-32.498-14.55-32.498-32.498 0.006-0.50098 0.0236-1.0018 0.0527-1.502-3.4629-1.1175-6.9173-1.9297-9.6543-1.9297-2.7565 0-6.2409 0.82134-9.7285 1.9512 0.036 0.49286 0.0607 0.98649 0.0742 1.4805-0.00018 17.948-14.55 32.498-32.498 32.498-17.948-0.00019-32.498-14.55-32.498-32.498 0.006-3.5239 0.71774-6.9687 1.8781-10.26 5.474-20.521 8.7944-44.229 27.665-46.855 8.2552-1.1488 15.952 8.848 25.107 8.848 9.1558-0.00028 9.318-14.58 23.088-14.836 16.828-0.3123 31.185 16.304 43.462 25.701zm-4.7539 13.92c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-84.125 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z'/%3e %3cpath id='path4329-2' style='color-rendering:auto%3bcolor:black%3bisolation:auto%3bmix-blend-mode:normal%3bshape-rendering:auto%3bsolid-color:black%3bimage-rendering:auto' fill='url(%23linearGradient4263)' d='m157.24 77.869c-2.1199 2.1753-3.6401 4.4832-5.4018 6.5241-0.53185 0.61614-1.2448 1.3191-1.8477 1.7949-1.2058 0.9517-2.5477 1.6107-4.168 1.7793-0.27005 0.0281-0.54787 0.04296-0.83398 0.04297 5.0928 13.298 11.821 26.014 20 44.834 2.737 0 6.1914 0.8122 9.6543 1.9297-0.0291 0.5002-0.0467 1.001-0.0527 1.502 0 8.4131 3.196 16.08 8.4414 21.852 0.34969 0.38474 0.70861 0.75939 1.0762 1.127 5.881 5.8809 14.007 9.5194 22.98 9.5195 0.5609 0.00004 1.118-0.0149 1.6719-0.043 3.3236-0.16829 6.5154-0.83435 9.502-1.9277 0.99554-0.36446 1.9688-0.77802 2.916-1.2344 1.4208-0.68453 2.7833-1.4677 4.0801-2.3438 8.645-5.84 14.33-15.731 14.33-26.949-0.004-6.474-2.0849-12.873-5.5645-18.164-7.0668-10.745-14.684-12.763-22.486-19.238-11.815-9.8048-26.968-25.716-42.627-25.716-6.2104 0-9.3385 2.3185-11.67 4.7112zm49.543 34.924c4.9706 0 9.5876 1.5119 13.418 4.0996 0.6384 0.43129 1.255 0.89176 1.8476 1.3809 0.59266 0.4891 1.1622 1.0059 1.7051 1.5488 4.3431 4.3431 7.0293 10.343 7.0293 16.971 0 12.841-10.085 23.326-22.766 23.969-0.40906 0.0207-0.82015 0.0312-1.2344 0.0312-4.97 0-9.5878-1.5105-13.418-4.0976-0.00044-0.0003-0.002 0.00029-0.002 0-6.384-4.3129-10.58-11.618-10.58-19.902 0-6.6275 2.6862-12.628 7.0293-16.971 0.54288-0.54289 1.1124-1.0597 1.7051-1.5488 0.59266-0.4891 1.2073-0.94957 1.8457-1.3809 3.8304-2.5878 8.4493-4.0996 13.42-4.0996z'/%3e %3cpath id='path4329-7' style='color-rendering:auto%3bcolor:black%3bisolation:auto%3bmix-blend-mode:normal%3bshape-rendering:auto%3bsolid-color:black%3bimage-rendering:auto' d='m121.43 79.077c-0.51208-0.01011-1.027 0.01805-1.543 0.08985-18.871 2.626-22.19 26.335-27.664 46.856-1.1604 3.2913-1.8729 6.7359-1.8789 10.26 0 17.948 14.55 32.498 32.498 32.498s32.498-14.55 32.498-32.498c-0.0135-0.49402-0.0382-0.98762-0.0742-1.4805 3.5012-1.0071 5.7853-1.8693 9.6893-1.9248-4.8944-11.377-14.29-31.914-19.961-44.863-8.5828 0.000001-15.883-8.7859-23.565-8.9376zm1.2344 33.723c13.255 0 24 10.745 24 24s-10.745 24-24 24-24-10.745-24-24 10.745-24 24-24z' fill='url(%23linearGradient4240)'/%3e %3c/g%3e%3c/svg%3e";
679
781
 
680
- var useStyles$a = makeStyles(function (theme) {
782
+ var useStyles$b = makeStyles(function (theme) {
681
783
  var _header;
682
784
 
683
785
  return {
@@ -714,7 +816,7 @@ var AppHeader = function AppHeader(_ref) {
714
816
  userMenu = _ref.userMenu,
715
817
  _ref$title = _ref.title,
716
818
  title = _ref$title === void 0 ? 'GeoWeb' : _ref$title;
717
- var classes = useStyles$a();
819
+ var classes = useStyles$b();
718
820
  return /*#__PURE__*/React__default.createElement("header", {
719
821
  className: classes.header
720
822
  }, /*#__PURE__*/React__default.createElement(Grid, {
@@ -798,7 +900,7 @@ var DraggableComponent$1 = function DraggableComponent(_a) {
798
900
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
799
901
  * */
800
902
 
801
- var useStyles$9 = function useStyles(isRightAligned) {
903
+ var useStyles$a = function useStyles(isRightAligned) {
802
904
  return makeStyles(function () {
803
905
  return {
804
906
  icon: Object.assign(Object.assign({
@@ -812,7 +914,7 @@ var useStyles$9 = function useStyles(isRightAligned) {
812
914
  left: 10,
813
915
  transform: 'rotate(90deg)'
814
916
  }), {
815
- zIndex: 100
917
+ zIndex: 1
816
918
  })
817
919
  };
818
920
  });
@@ -821,7 +923,7 @@ var useStyles$9 = function useStyles(isRightAligned) {
821
923
  var ResizeHandle = function ResizeHandle(_ref2) {
822
924
  var isRightAligned = _ref2.isRightAligned;
823
925
  var theme = useTheme();
824
- var styles = useStyles$9(isRightAligned)();
926
+ var styles = useStyles$a(isRightAligned)();
825
927
  return /*#__PURE__*/React__default.createElement(SvgIcon, {
826
928
  className: styles.icon,
827
929
  "data-testid": "resizeHandle"
@@ -906,6 +1008,89 @@ var ResizeComponent = function ResizeComponent(_a) {
906
1008
  }, props), children);
907
1009
  };
908
1010
 
1011
+ /**
1012
+ * ErrorBoundary
1013
+ * Wrap this component around parts of your application. It will catch any uncaught errors and display an alert, and allows you to continue using the rest of your application.
1014
+ *
1015
+ * @example
1016
+ * ``` <ErrorBoundary><ExampleComponent /></ErrorBoundary> ```
1017
+ */
1018
+
1019
+ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
1020
+ _inherits(ErrorBoundary, _React$Component);
1021
+
1022
+ var _super = _createSuper(ErrorBoundary);
1023
+
1024
+ function ErrorBoundary(props) {
1025
+ var _this;
1026
+
1027
+ _classCallCheck(this, ErrorBoundary);
1028
+
1029
+ _this = _super.call(this, props);
1030
+ _this.state = {
1031
+ error: null,
1032
+ errorInfo: null
1033
+ };
1034
+ return _this;
1035
+ }
1036
+
1037
+ _createClass(ErrorBoundary, [{
1038
+ key: "componentDidCatch",
1039
+ value: function componentDidCatch(error, errorInfo) {
1040
+ var onError = this.props.onError;
1041
+ this.setState({
1042
+ error: error,
1043
+ errorInfo: errorInfo
1044
+ });
1045
+ onError(error, errorInfo);
1046
+ }
1047
+ }, {
1048
+ key: "render",
1049
+ value: function render() {
1050
+ var _this$state = this.state,
1051
+ error = _this$state.error,
1052
+ errorInfo = _this$state.errorInfo;
1053
+ var children = this.props.children;
1054
+
1055
+ if (error) {
1056
+ return /*#__PURE__*/React.createElement("div", {
1057
+ style: {
1058
+ whiteSpace: 'pre-wrap'
1059
+ }
1060
+ }, /*#__PURE__*/React.createElement(AlertBanner, {
1061
+ severity: "error",
1062
+ title: "Woops, an error has occurred. Please report the error shown below and reload the page if needed.",
1063
+ info: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("br", null), error.toString(), /*#__PURE__*/React.createElement("br", null), errorInfo && errorInfo.componentStack, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Link, {
1064
+ underline: "always",
1065
+ style: {
1066
+ cursor: 'pointer'
1067
+ },
1068
+ onClick: function onClick() {
1069
+ return window.location.reload();
1070
+ }
1071
+ }, "Reload page"))
1072
+ }));
1073
+ }
1074
+
1075
+ return children;
1076
+ }
1077
+ }], [{
1078
+ key: "getDerivedStateFromError",
1079
+ value: function getDerivedStateFromError(error) {
1080
+ return {
1081
+ error: error
1082
+ };
1083
+ }
1084
+ }]);
1085
+
1086
+ return ErrorBoundary;
1087
+ }(React.Component);
1088
+ ErrorBoundary.defaultProps = {
1089
+ onError: function onError() {
1090
+ return null;
1091
+ }
1092
+ };
1093
+
909
1094
  /* *
910
1095
  * Licensed under the Apache License, Version 2.0 (the "License");
911
1096
  * you may not use this file except in compliance with the License.
@@ -922,7 +1107,7 @@ var ResizeComponent = function ResizeComponent(_a) {
922
1107
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
923
1108
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
924
1109
  * */
925
- var useStyles$8 = makeStyles(function (theme) {
1110
+ var useStyles$9 = makeStyles(function (theme) {
926
1111
  return {
927
1112
  container: {
928
1113
  position: 'absolute',
@@ -970,7 +1155,7 @@ var UserMenu = function UserMenu(_ref) {
970
1155
  } : _ref$onClose,
971
1156
  children = _ref.children,
972
1157
  initials = _ref.initials;
973
- var classes = useStyles$8();
1158
+ var classes = useStyles$9();
974
1159
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
975
1160
  "data-testid": "userButton",
976
1161
  onClick: onToggle,
@@ -1050,7 +1235,7 @@ var MenuItemTheme = function MenuItemTheme() {
1050
1235
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1051
1236
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1052
1237
  * */
1053
- var useStyles$7 = makeStyles(function (theme) {
1238
+ var useStyles$8 = makeStyles(function (theme) {
1054
1239
  return {
1055
1240
  footer: {
1056
1241
  boxShadow: theme.shadows[1],
@@ -1063,7 +1248,7 @@ var useStyles$7 = makeStyles(function (theme) {
1063
1248
  }); // drag handles will be handled by DraggableResizable/Resizable
1064
1249
 
1065
1250
  var ToolFooter = function ToolFooter() {
1066
- var classes = useStyles$7();
1251
+ var classes = useStyles$8();
1067
1252
  return /*#__PURE__*/React__default.createElement("footer", {
1068
1253
  className: classes.footer
1069
1254
  });
@@ -1130,7 +1315,7 @@ var getStyle = function getStyle(size) {
1130
1315
  }
1131
1316
  };
1132
1317
 
1133
- var useStyles$6 = makeStyles(function (theme) {
1318
+ var useStyles$7 = makeStyles(function (theme) {
1134
1319
  return {
1135
1320
  header: {
1136
1321
  boxShadow: theme.shadows[1],
@@ -1180,7 +1365,7 @@ var ToolHeader = function ToolHeader(_ref) {
1180
1365
  _ref$className = _ref.className,
1181
1366
  className = _ref$className === void 0 ? '' : _ref$className;
1182
1367
  var styles = getStyle(size);
1183
- var classes = useStyles$6({
1368
+ var classes = useStyles$7({
1184
1369
  styles: styles,
1185
1370
  isDraggable: isDraggable
1186
1371
  });
@@ -1215,7 +1400,7 @@ var ToolHeader = function ToolHeader(_ref) {
1215
1400
  variant: "h2",
1216
1401
  className: classes.title
1217
1402
  }, title), size === 'xxs' && /*#__PURE__*/React__default.createElement(IconButton, {
1218
- "data-testid": "dragBtn",
1403
+ "data-testid": "dragBtn-xxs",
1219
1404
  className: classes.iconDragHorizontal,
1220
1405
  disableRipple: true,
1221
1406
  size: "small"
@@ -1247,7 +1432,7 @@ var ToolHeader = function ToolHeader(_ref) {
1247
1432
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1248
1433
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1249
1434
  * */
1250
- var useStyles$5 = makeStyles(function () {
1435
+ var useStyles$6 = makeStyles(function () {
1251
1436
  return {
1252
1437
  container: {
1253
1438
  overflow: 'hidden',
@@ -1285,7 +1470,7 @@ var ToolContainer = function ToolContainer(_a) {
1285
1470
  headerClassName = _a$headerClassName === void 0 ? '' : _a$headerClassName,
1286
1471
  props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName"]);
1287
1472
 
1288
- var classes = useStyles$5();
1473
+ var classes = useStyles$6();
1289
1474
  return /*#__PURE__*/React__default.createElement(Paper, Object.assign({
1290
1475
  elevation: elevation,
1291
1476
  className: classes.container
@@ -1474,7 +1659,7 @@ var DraggableComponent = function DraggableComponent(_a) {
1474
1659
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1475
1660
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1476
1661
  * */
1477
- var useStyles$4 = makeStyles(function (theme) {
1662
+ var useStyles$5 = makeStyles(function (theme) {
1478
1663
  return {
1479
1664
  icon: {
1480
1665
  backgroundColor: theme.palette.geowebColors.textInputField["default"].rgba,
@@ -1514,7 +1699,7 @@ var ShortCutSegment = function ShortCutSegment(_ref) {
1514
1699
  var _ref$type = _ref.type,
1515
1700
  type = _ref$type === void 0 ? 'text' : _ref$type,
1516
1701
  children = _ref.children;
1517
- var classes = useStyles$4();
1702
+ var classes = useStyles$5();
1518
1703
 
1519
1704
  if (type === 'divider') {
1520
1705
  return /*#__PURE__*/React__default.createElement(Typography, {
@@ -1564,7 +1749,7 @@ var ShortCutSegment = function ShortCutSegment(_ref) {
1564
1749
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1565
1750
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1566
1751
  * */
1567
- var useStyles$3 = makeStyles(function (theme) {
1752
+ var useStyles$4 = makeStyles(function (theme) {
1568
1753
  return {
1569
1754
  icon: {
1570
1755
  fill: theme.palette.geowebColors.typographyAndIcons.text
@@ -1572,7 +1757,7 @@ var useStyles$3 = makeStyles(function (theme) {
1572
1757
  };
1573
1758
  });
1574
1759
  var OptionIcon = function OptionIcon() {
1575
- var classes = useStyles$3();
1760
+ var classes = useStyles$4();
1576
1761
  return /*#__PURE__*/React__default.createElement(SvgIcon, {
1577
1762
  viewBox: "0 0 12 11",
1578
1763
  style: {
@@ -1595,7 +1780,7 @@ var OptionIcon = function OptionIcon() {
1595
1780
  }))));
1596
1781
  };
1597
1782
  var CommandIcon = function CommandIcon() {
1598
- var classes = useStyles$3();
1783
+ var classes = useStyles$4();
1599
1784
  return /*#__PURE__*/React__default.createElement(SvgIcon, {
1600
1785
  viewBox: "0 0 12 12",
1601
1786
  style: {
@@ -1618,7 +1803,7 @@ var CommandIcon = function CommandIcon() {
1618
1803
  }))));
1619
1804
  };
1620
1805
  var ArrowLeftIcon = function ArrowLeftIcon() {
1621
- var classes = useStyles$3();
1806
+ var classes = useStyles$4();
1622
1807
  return /*#__PURE__*/React__default.createElement(SvgIcon, {
1623
1808
  viewBox: "0 0 12 6",
1624
1809
  style: {
@@ -1642,7 +1827,7 @@ var ArrowLeftIcon = function ArrowLeftIcon() {
1642
1827
  }))));
1643
1828
  };
1644
1829
  var ArrowRightIcon = function ArrowRightIcon() {
1645
- var classes = useStyles$3();
1830
+ var classes = useStyles$4();
1646
1831
  return /*#__PURE__*/React__default.createElement(SvgIcon, {
1647
1832
  viewBox: "0 0 12 6",
1648
1833
  style: {
@@ -1666,7 +1851,7 @@ var ArrowRightIcon = function ArrowRightIcon() {
1666
1851
  }))));
1667
1852
  };
1668
1853
  var ArrowDownIcon = function ArrowDownIcon() {
1669
- var classes = useStyles$3();
1854
+ var classes = useStyles$4();
1670
1855
  return /*#__PURE__*/React__default.createElement(SvgIcon, {
1671
1856
  viewBox: "0 0 6 12",
1672
1857
  style: {
@@ -1689,7 +1874,7 @@ var ArrowDownIcon = function ArrowDownIcon() {
1689
1874
  }))));
1690
1875
  };
1691
1876
  var ArrowUpIcon = function ArrowUpIcon() {
1692
- var classes = useStyles$3();
1877
+ var classes = useStyles$4();
1693
1878
  return /*#__PURE__*/React__default.createElement(SvgIcon, {
1694
1879
  viewBox: "0 0 6 11",
1695
1880
  style: {
@@ -1856,7 +2041,7 @@ var getShortcutList = function getShortcutList(shortcutList) {
1856
2041
  });
1857
2042
  });
1858
2043
  };
1859
- var useStyles$2 = makeStyles(function () {
2044
+ var useStyles$3 = makeStyles(function () {
1860
2045
  return {
1861
2046
  row: {
1862
2047
  minHeight: 56
@@ -1876,7 +2061,7 @@ var useStyles$2 = makeStyles(function () {
1876
2061
  var ShortcutList = function ShortcutList(_ref2) {
1877
2062
  var _ref2$platform = _ref2.platform,
1878
2063
  platform = _ref2$platform === void 0 ? 'windows' : _ref2$platform;
1879
- var classes = useStyles$2();
2064
+ var classes = useStyles$3();
1880
2065
  var rows = getShortcutList(shortcuts, platform);
1881
2066
  return /*#__PURE__*/React__default.createElement(List, {
1882
2067
  "data-testid": "list-".concat(platform)
@@ -1913,7 +2098,7 @@ var TabPanel = function TabPanel(_ref) {
1913
2098
  }, value === index && children);
1914
2099
  };
1915
2100
 
1916
- var useStyles$1 = makeStyles(function () {
2101
+ var useStyles$2 = makeStyles(function () {
1917
2102
  return {
1918
2103
  container: {
1919
2104
  margin: '0px 20px'
@@ -1925,7 +2110,7 @@ var useStyles$1 = makeStyles(function () {
1925
2110
  });
1926
2111
 
1927
2112
  var CheatSheet = function CheatSheet() {
1928
- var classes = useStyles$1();
2113
+ var classes = useStyles$2();
1929
2114
 
1930
2115
  var _React$useState = React__default.useState(0),
1931
2116
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -1959,7 +2144,7 @@ var CheatSheet = function CheatSheet() {
1959
2144
  })));
1960
2145
  };
1961
2146
 
1962
- var useStyles = makeStyles(function () {
2147
+ var useStyles$1 = makeStyles(function () {
1963
2148
  return {
1964
2149
  backdrop: {
1965
2150
  zIndex: 1
@@ -1968,7 +2153,7 @@ var useStyles = makeStyles(function () {
1968
2153
  });
1969
2154
 
1970
2155
  var UserMenuItemCheatSheet = function UserMenuItemCheatSheet() {
1971
- var classes = useStyles();
2156
+ var classes = useStyles$1();
1972
2157
 
1973
2158
  var _React$useState = React__default.useState(false),
1974
2159
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -2133,25 +2318,17 @@ var CustomSliderComponent = withStyles(function (theme) {
2133
2318
  }
2134
2319
  };
2135
2320
  })(Slider);
2136
- var CustomSlider = function CustomSlider(_ref) {
2137
- var value = _ref.value,
2138
- onChange = _ref.onChange,
2139
- onKeyDown = _ref.onKeyDown,
2140
- _ref$dataTestId = _ref.dataTestId,
2141
- dataTestId = _ref$dataTestId === void 0 ? 'customSlider' : _ref$dataTestId,
2142
- _ref$orientation = _ref.orientation,
2143
- orientation = _ref$orientation === void 0 ? 'vertical' : _ref$orientation,
2144
- max = _ref.max,
2145
- min = _ref.min,
2146
- step = _ref.step,
2147
- _ref$marks = _ref.marks,
2148
- marks = _ref$marks === void 0 ? [] : _ref$marks,
2149
- _ref$disabled = _ref.disabled,
2150
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
2151
- ThumbComponent = _ref.ThumbComponent;
2152
- // Add custom class (for bold text) to label adjacent to thumb component.
2321
+ var CustomSlider = function CustomSlider(_a) {
2322
+ var value = _a.value,
2323
+ _a$orientation = _a.orientation,
2324
+ orientation = _a$orientation === void 0 ? 'vertical' : _a$orientation,
2325
+ _a$shouldAutoFocus = _a.shouldAutoFocus,
2326
+ shouldAutoFocus = _a$shouldAutoFocus === void 0 ? false : _a$shouldAutoFocus,
2327
+ props = __rest(_a, ["value", "orientation", "shouldAutoFocus"]); // Add custom class (for bold text) to label adjacent to thumb component.
2153
2328
  // Material UI doesn't support highlighing only adjacent label
2154
2329
  // when track is highlighted everywhere below selected value.
2330
+
2331
+
2155
2332
  var element = React.useRef(null);
2156
2333
  var themeContext = useThemeContext();
2157
2334
  React.useEffect(function () {
@@ -2166,21 +2343,115 @@ var CustomSlider = function CustomSlider(_ref) {
2166
2343
  rest.forEach(function (element) {
2167
2344
  return element.classList.remove('selectedLabel');
2168
2345
  });
2169
- }, [value, themeContext.isDark]);
2170
- return /*#__PURE__*/React.createElement(CustomSliderComponent, {
2346
+ }, [value, themeContext.isDark]); // autofocus
2347
+
2348
+ React.useEffect(function () {
2349
+ if (shouldAutoFocus && element.current) {
2350
+ var thumb = element.current.querySelector('.MuiSlider-thumb');
2351
+ thumb.focus();
2352
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
2353
+
2354
+ }, []);
2355
+ return /*#__PURE__*/React.createElement(CustomSliderComponent, Object.assign({
2171
2356
  ref: element,
2172
- "data-testid": dataTestId,
2173
- orientation: orientation,
2174
2357
  value: value,
2175
- step: step,
2176
- max: max,
2177
- min: min,
2178
- marks: marks,
2179
- onChange: onChange,
2180
- onKeyDown: onKeyDown,
2181
- disabled: disabled,
2182
- ThumbComponent: ThumbComponent
2358
+ orientation: orientation
2359
+ }, props));
2360
+ };
2361
+
2362
+ /* *
2363
+ * Licensed under the Apache License, Version 2.0 (the "License");
2364
+ * you may not use this file except in compliance with the License.
2365
+ * You may obtain a copy of the License at
2366
+ *
2367
+ * http://www.apache.org/licenses/LICENSE-2.0
2368
+ *
2369
+ * Unless required by applicable law or agreed to in writing, software
2370
+ * distributed under the License is distributed on an "AS IS" BASIS,
2371
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2372
+ * See the License for the specific language governing permissions and
2373
+ * limitations under the License.
2374
+ *
2375
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2376
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2377
+ * */
2378
+ var Z_INDEX_TOP = 600;
2379
+ var Z_INDEX_BOTTOM = 550;
2380
+ var useStyles = makeStyles(function (theme) {
2381
+ return createStyles({
2382
+ draggableDialog: function draggableDialog(props) {
2383
+ return {
2384
+ width: props.dialogWidth ? props.dialogWidth : '90%',
2385
+ position: 'absolute',
2386
+ top: props.dialogTop ? props.dialogTop : '2%',
2387
+ left: '5%',
2388
+ maxWidth: '90%',
2389
+ maxHeight: props.dialogMaxHeight ? props.dialogMaxHeight : '95%',
2390
+ display: 'flex',
2391
+ flexDirection: 'column',
2392
+ overflow: 'hidden',
2393
+ zIndex: props.zIndex
2394
+ };
2395
+ },
2396
+ dialogContent: {
2397
+ marginTop: '40px',
2398
+ overflowY: 'scroll'
2399
+ },
2400
+ dialogHeader: function dialogHeader(props) {
2401
+ return {
2402
+ position: 'absolute',
2403
+ display: 'flex',
2404
+ justifyContent: 'space-between',
2405
+ alignItems: 'center',
2406
+ boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.14)',
2407
+ width: '100%',
2408
+ backgroundColor: '#ffffff',
2409
+ zIndex: props.zIndex + 10
2410
+ };
2411
+ },
2412
+ iconClose: {
2413
+ padding: theme.spacing(1)
2414
+ },
2415
+ iconDrag: {
2416
+ padding: theme.spacing(1)
2417
+ }
2183
2418
  });
2419
+ });
2420
+
2421
+ var DraggableDialog = function DraggableDialog(_ref) {
2422
+ var handleClose = _ref.handleClose,
2423
+ title = _ref.title,
2424
+ children = _ref.children,
2425
+ _ref$dialogStyling = _ref.dialogStyling,
2426
+ dialogStyling = _ref$dialogStyling === void 0 ? {} : _ref$dialogStyling,
2427
+ _ref$zIndex = _ref.zIndex,
2428
+ zIndex = _ref$zIndex === void 0 ? Z_INDEX_TOP : _ref$zIndex;
2429
+ var classes = useStyles(Object.assign(Object.assign({}, dialogStyling), {
2430
+ zIndex: zIndex
2431
+ }));
2432
+ return /*#__PURE__*/React.createElement(Draggable, {
2433
+ handle: "strong",
2434
+ bounds: "body"
2435
+ }, /*#__PURE__*/React.createElement(Paper, {
2436
+ "data-testid": title,
2437
+ className: classes.draggableDialog,
2438
+ elevation: 24
2439
+ }, /*#__PURE__*/React.createElement("div", {
2440
+ className: classes.dialogHeader
2441
+ }, /*#__PURE__*/React.createElement("strong", null, /*#__PURE__*/React.createElement(IconButton, {
2442
+ "data-testid": "dragDialog",
2443
+ size: "small",
2444
+ className: classes.iconDrag
2445
+ }, /*#__PURE__*/React.createElement(DragIndicator, null))), /*#__PURE__*/React.createElement(Typography, {
2446
+ variant: "subtitle1"
2447
+ }, title), /*#__PURE__*/React.createElement(IconButton, {
2448
+ "data-testid": "closeDialog",
2449
+ size: "small",
2450
+ onClick: handleClose,
2451
+ className: classes.iconClose
2452
+ }, /*#__PURE__*/React.createElement(Close, null))), /*#__PURE__*/React.createElement("div", {
2453
+ className: classes.dialogContent
2454
+ }, children)));
2184
2455
  };
2185
2456
 
2186
2457
  /* *
@@ -2217,4 +2488,4 @@ var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
2217
2488
  return 'An error has occurred';
2218
2489
  };
2219
2490
 
2220
- export { AlertBanner, AppHeader, AppLayout, ConfirmationDialog, ConfirmationServiceProvider, CustomSlider, DraggableComponent$1 as Draggable, HIDDEN_INPUT_HELPER_IS_DRAFT, ResizeComponent as Resizable, StatusTag, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, getAxiosErrorMessage, getInitials, isAxiosError, showPrompt, sliderStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
2491
+ export { AlertBanner, AppHeader, AppLayout, ConfirmationDialog, ConfirmationServiceProvider, CustomSlider, DraggableComponent$1 as Draggable, DraggableDialog, ErrorBoundary, HIDDEN_INPUT_HELPER_IS_DRAFT, ResizeComponent as Resizable, StatusTag, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, Z_INDEX_BOTTOM, Z_INDEX_TOP, getAxiosErrorMessage, getInitials, isAxiosError, showPrompt, sliderStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };