@opengeoweb/shared 2.14.0 → 4.0.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.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@opengeoweb/theme'), require('react-hook-form'), require('@opengeoweb/form-fields'), require('@mui/styles/makeStyles'), require('react-draggable'), require('re-resizable'), require('lodash'), require('@mui/styles/withStyles'), require('@mui/styles/createStyles')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@opengeoweb/theme', 'react-hook-form', '@opengeoweb/form-fields', '@mui/styles/makeStyles', 'react-draggable', 're-resizable', 'lodash', '@mui/styles/withStyles', '@mui/styles/createStyles'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.theme, global.reactHookForm, global.formFields, global.makeStyles, global.Draggable, global.reResizable, global.lodash, global.withStyles, global.createStyles));
5
- })(this, (function (exports, React, material, theme, reactHookForm, formFields, makeStyles, Draggable, reResizable, lodash, withStyles, createStyles) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@opengeoweb/theme'), require('react-hook-form'), require('@opengeoweb/form-fields'), require('react-draggable'), require('re-resizable'), require('lodash')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@opengeoweb/theme', 'react-hook-form', '@opengeoweb/form-fields', 'react-draggable', 're-resizable', 'lodash'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.theme, global.reactHookForm, global.formFields, global.Draggable, global.reResizable, global.lodash));
5
+ })(this, (function (exports, React, material, theme, reactHookForm, formFields, Draggable, reResizable, lodash) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -26,10 +26,7 @@
26
26
 
27
27
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
28
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
- var makeStyles__default = /*#__PURE__*/_interopDefaultLegacy(makeStyles);
30
29
  var Draggable__default = /*#__PURE__*/_interopDefaultLegacy(Draggable);
31
- var withStyles__default = /*#__PURE__*/_interopDefaultLegacy(withStyles);
32
- var createStyles__default = /*#__PURE__*/_interopDefaultLegacy(createStyles);
33
30
 
34
31
  /*! *****************************************************************************
35
32
  Copyright (c) Microsoft Corporation.
@@ -665,7 +662,7 @@
665
662
  }
666
663
  },
667
664
  '& .MuiAlert-icon': {
668
- margin: '-3px 10px 0px 0px',
665
+ marginTop: '-3px',
669
666
  padding: '0px'
670
667
  }
671
668
  } : {
@@ -686,13 +683,15 @@
686
683
  fontWeight: 'normal',
687
684
  marginTop: '0px!important',
688
685
  paddingTop: '0px!important',
689
- marginBottom: '0px!important'
686
+ marginBottom: '0px!important',
687
+ lineHeight: isCompact ? '18px' : '24px'
690
688
  }
691
689
  }, title), info && /*#__PURE__*/React__namespace.createElement(material.Box, {
692
690
  sx: {
693
691
  fontSize: '16px',
694
692
  marginTop: 1,
695
- wordBreak: 'break-word'
693
+ wordBreak: 'break-word',
694
+ lineHeight: '22px'
696
695
  }
697
696
  }, info), actionButtonProps && /*#__PURE__*/React__namespace.createElement(material.Button, {
698
697
  variant: "flat",
@@ -723,28 +722,23 @@
723
722
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
724
723
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
725
724
  * */
726
- var useStyles$7 = makeStyles__default["default"](function () {
727
- return {
728
- wrapper: {
725
+
726
+ var AppLayout = function AppLayout(_a) {
727
+ var header = _a.header,
728
+ children = _a.children;
729
+ return /*#__PURE__*/React__default["default"].createElement(material.Box, {
730
+ sx: {
729
731
  height: '100vh',
730
732
  display: 'flex',
731
733
  flexDirection: 'column'
732
734
  },
733
- main: {
735
+ "data-testid": "appLayout"
736
+ }, header, /*#__PURE__*/React__default["default"].createElement(material.Box, {
737
+ component: "main",
738
+ sx: {
734
739
  flex: 1,
735
740
  position: 'relative'
736
741
  }
737
- };
738
- });
739
-
740
- var AppLayout = function AppLayout(_a) {
741
- var header = _a.header,
742
- children = _a.children;
743
- var classes = useStyles$7();
744
- return /*#__PURE__*/React__default["default"].createElement("div", {
745
- className: classes.wrapper
746
- }, header, /*#__PURE__*/React__default["default"].createElement("main", {
747
- className: classes.main
748
742
  }, children));
749
743
  };
750
744
 
@@ -764,13 +758,13 @@
764
758
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
765
759
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
766
760
  * */
767
- var useStyles$6 = makeStyles__default["default"](function (theme) {
768
- var _a;
761
+ var styles$5 = {
762
+ header: function header(theme) {
763
+ var _a;
769
764
 
770
- return {
771
- header: (_a = {
765
+ return _a = {
772
766
  height: 40,
773
- background: theme.palette.geowebColors.brand.brand,
767
+ backgroundColor: theme.palette.geowebColors.brand.brand,
774
768
  color: theme.palette.common.white,
775
769
  boxShadow: theme.shadows[1],
776
770
  zIndex: 1000
@@ -778,31 +772,32 @@
778
772
  padding: '0 8px'
779
773
  }, _a[theme.breakpoints.up('sm')] = {
780
774
  padding: '0 24px'
781
- }, _a),
782
- title: {
783
- marginLeft: 6,
784
- fontSize: '1.25rem',
785
- fontWeight: 400,
786
- overflow: 'hidden',
787
- whiteSpace: 'nowrap',
788
- textOverflow: 'ellipsis'
789
- },
790
- container: {
791
- height: '100%'
792
- }
793
- };
794
- });
775
+ }, _a;
776
+ },
777
+ title: {
778
+ marginLeft: 1,
779
+ fontSize: '1.25rem',
780
+ fontWeight: 400,
781
+ overflow: 'hidden',
782
+ whiteSpace: 'nowrap',
783
+ textOverflow: 'ellipsis',
784
+ letterSpacing: '0.15px'
785
+ },
786
+ container: {
787
+ height: '100%'
788
+ }
789
+ };
795
790
 
796
791
  var AppHeader = function AppHeader(_a) {
797
792
  var menu = _a.menu,
798
793
  userMenu = _a.userMenu,
799
794
  _b = _a.title,
800
795
  title = _b === void 0 ? 'GeoWeb' : _b;
801
- var classes = useStyles$6();
802
- return /*#__PURE__*/React__default["default"].createElement("header", {
803
- className: classes.header
796
+ return /*#__PURE__*/React__default["default"].createElement(material.Box, {
797
+ component: "header",
798
+ sx: styles$5.header
804
799
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
805
- className: classes.container,
800
+ sx: styles$5.container,
806
801
  container: true,
807
802
  alignItems: "center"
808
803
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
@@ -823,7 +818,7 @@
823
818
  wrap: "nowrap"
824
819
  }, /*#__PURE__*/React__default["default"].createElement(theme.GeoWebLogo, null), /*#__PURE__*/React__default["default"].createElement(material.Typography, {
825
820
  variant: "h1",
826
- className: classes.title
821
+ sx: styles$5.title
827
822
  }, title))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
828
823
  item: true,
829
824
  xs: 1,
@@ -1036,6 +1031,35 @@
1036
1031
  return ErrorBoundary;
1037
1032
  }(React__namespace.Component);
1038
1033
 
1034
+ var styles$4 = {
1035
+ small: {
1036
+ height: 16,
1037
+ width: 16,
1038
+ fontSize: '0.5rem'
1039
+ },
1040
+ large: {
1041
+ height: 32,
1042
+ width: 32,
1043
+ fontSize: '0.938rem'
1044
+ }
1045
+ };
1046
+
1047
+ var Avatar = function Avatar(_a) {
1048
+ var children = _a.children,
1049
+ _b = _a.size,
1050
+ size = _b === void 0 ? 'large' : _b;
1051
+ return /*#__PURE__*/React__namespace.createElement(material.Avatar, {
1052
+ "data-testid": "avatar",
1053
+ sx: __assign(__assign({}, styles$4[size]), {
1054
+ fontWeight: 500,
1055
+ color: 'geowebColors.brand.brand',
1056
+ backgroundColor: 'common.white',
1057
+ border: '0.1px solid',
1058
+ borderColor: 'geowebColors.brand.brand'
1059
+ })
1060
+ }, children);
1061
+ };
1062
+
1039
1063
  /* *
1040
1064
  * Licensed under the Apache License, Version 2.0 (the "License");
1041
1065
  * you may not use this file except in compliance with the License.
@@ -1052,40 +1076,30 @@
1052
1076
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1053
1077
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1054
1078
  * */
1055
- var useStyles$5 = makeStyles__default["default"](function (theme) {
1056
- return {
1057
- container: {
1058
- position: 'absolute',
1059
- top: 38,
1060
- right: 20,
1061
- width: 256,
1062
- borderRadius: 0,
1063
- boxShadow: theme.shadows[5],
1064
- background: theme.palette.geowebColors.background.surface
1065
- },
1066
- userMenu: {
1067
- padding: 0,
1068
- '& > li': {
1069
- paddingTop: 24,
1070
- paddingBottom: 24,
1071
- paddingLeft: 16,
1072
- paddingRight: 16
1073
- }
1074
- },
1075
- button: {
1076
- color: theme.palette.common.white,
1077
- padding: 0
1078
- },
1079
- avatar: {
1080
- height: 32,
1081
- width: 32,
1082
- fontSize: '0.938rem',
1083
- fontWeight: 500,
1084
- color: theme.palette.geowebColors.brand.brand,
1085
- backgroundColor: theme.palette.common.white
1079
+ var styles$3 = {
1080
+ container: {
1081
+ position: 'absolute',
1082
+ top: 38,
1083
+ right: 20,
1084
+ width: 256,
1085
+ borderRadius: 0,
1086
+ boxShadow: 5,
1087
+ backgroundColor: 'geowebColors.background.surface'
1088
+ },
1089
+ userMenu: {
1090
+ padding: 0,
1091
+ '& > li': {
1092
+ paddingTop: 3,
1093
+ paddingBottom: 3,
1094
+ paddingLeft: 2,
1095
+ paddingRight: 2
1086
1096
  }
1087
- };
1088
- });
1097
+ },
1098
+ button: {
1099
+ color: 'common.white',
1100
+ padding: 0
1101
+ }
1102
+ };
1089
1103
 
1090
1104
  var UserMenu = function UserMenu(_a) {
1091
1105
  var _b = _a.isOpen,
@@ -1100,22 +1114,19 @@
1100
1114
  } : _d,
1101
1115
  children = _a.children,
1102
1116
  initials = _a.initials;
1103
- var classes = useStyles$5();
1104
1117
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
1105
1118
  "data-testid": "userButton",
1106
1119
  onClick: onToggle,
1107
- className: classes.button,
1120
+ sx: styles$3.button,
1108
1121
  size: "large"
1109
- }, /*#__PURE__*/React__default["default"].createElement(material.Avatar, {
1110
- className: classes.avatar
1111
- }, initials)), isOpen && /*#__PURE__*/React__default["default"].createElement(material.Paper, {
1112
- className: classes.container,
1122
+ }, /*#__PURE__*/React__default["default"].createElement(Avatar, null, initials)), isOpen && /*#__PURE__*/React__default["default"].createElement(material.Paper, {
1123
+ sx: styles$3.container,
1113
1124
  "data-testid": "userMenu"
1114
1125
  }, /*#__PURE__*/React__default["default"].createElement(material.ClickAwayListener, {
1115
1126
  onClickAway: onClose,
1116
1127
  mouseEvent: "onMouseDown"
1117
1128
  }, /*#__PURE__*/React__default["default"].createElement(material.MenuList, {
1118
- className: classes.userMenu,
1129
+ sx: styles$3.userMenu,
1119
1130
  variant: "menu"
1120
1131
  }, children))));
1121
1132
  };
@@ -1183,22 +1194,17 @@
1183
1194
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1184
1195
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1185
1196
  * */
1186
- var useStyles$4 = makeStyles__default["default"](function (theme) {
1187
- return {
1188
- footer: {
1189
- boxShadow: theme.shadows[1],
1190
- background: theme.palette.geowebColors.background.surface,
1197
+
1198
+ var ToolFooter = function ToolFooter() {
1199
+ return /*#__PURE__*/React__default["default"].createElement(material.Box, {
1200
+ component: "footer",
1201
+ sx: {
1202
+ boxShadow: 1,
1203
+ backgroundColor: 'geowebColors.background.surface',
1191
1204
  textAlign: 'right',
1192
1205
  height: 18,
1193
1206
  zIndex: 1
1194
1207
  }
1195
- };
1196
- }); // drag handles will be handled by DraggableResizable/Resizable
1197
-
1198
- var ToolFooter = function ToolFooter() {
1199
- var classes = useStyles$4();
1200
- return /*#__PURE__*/React__default["default"].createElement("footer", {
1201
- className: classes.footer
1202
1208
  });
1203
1209
  };
1204
1210
 
@@ -1375,7 +1381,7 @@
1375
1381
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1376
1382
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1377
1383
  * */
1378
- var styles$1 = {
1384
+ var styles$2 = {
1379
1385
  container: {
1380
1386
  overflow: 'hidden',
1381
1387
  borderRadius: 0,
@@ -1416,7 +1422,7 @@
1416
1422
 
1417
1423
  return /*#__PURE__*/React__default["default"].createElement(material.Paper, __assign({
1418
1424
  elevation: elevation,
1419
- sx: styles$1.container
1425
+ sx: styles$2.container
1420
1426
  }, props), /*#__PURE__*/React__default["default"].createElement(ErrorBoundary, null, /*#__PURE__*/React__default["default"].createElement(ToolHeader, {
1421
1427
  title: title,
1422
1428
  size: size,
@@ -1425,7 +1431,7 @@
1425
1431
  className: headerClassName,
1426
1432
  leftComponent: leftComponent
1427
1433
  })), /*#__PURE__*/React__default["default"].createElement(material.Box, {
1428
- sx: styles$1.content,
1434
+ sx: styles$2.content,
1429
1435
  style: {
1430
1436
  maxHeight: maxHeight
1431
1437
  }
@@ -1617,91 +1623,63 @@
1617
1623
  }, children)))) : null;
1618
1624
  };
1619
1625
 
1620
- /* *
1621
- * Licensed under the Apache License, Version 2.0 (the "License");
1622
- * you may not use this file except in compliance with the License.
1623
- * You may obtain a copy of the License at
1624
- *
1625
- * http://www.apache.org/licenses/LICENSE-2.0
1626
- *
1627
- * Unless required by applicable law or agreed to in writing, software
1628
- * distributed under the License is distributed on an "AS IS" BASIS,
1629
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1630
- * See the License for the specific language governing permissions and
1631
- * limitations under the License.
1632
- *
1633
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1634
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
1635
- * */
1636
- var useStyles$3 = makeStyles__default["default"](function (theme) {
1637
- return {
1638
- icon: {
1639
- backgroundColor: theme.palette.geowebColors.textInputField["default"].rgba,
1640
- width: 40,
1641
- height: 40,
1642
- display: 'inline-flex',
1643
- verticalAlign: 'middle',
1644
- alignItems: 'center',
1645
- borderRadius: theme.shape.borderRadius,
1646
- '&>span': {
1647
- textAlign: 'center',
1648
- fontSize: 14,
1649
- fontWeight: 500,
1650
- display: 'flex',
1651
- margin: 'auto',
1652
- letterSpacing: 0.25
1653
- }
1654
- },
1655
- segment: {
1656
- margin: '0 2px',
1657
- verticalAlign: 'middle',
1658
- fontSize: 14,
1659
- fontWeight: 500,
1660
- letterSpacing: 0.25
1661
- },
1662
- connect: {
1663
- fontSize: 18
1664
- },
1665
- divider: {
1666
- margin: '0 6px',
1667
- fontSize: 18
1668
- }
1669
- };
1670
- });
1626
+ var segmentStyle = {
1627
+ margin: '0 2px',
1628
+ verticalAlign: 'middle',
1629
+ fontSize: 14,
1630
+ fontWeight: 500,
1631
+ letterSpacing: 0.25,
1632
+ justifyContent: 'center'
1633
+ };
1634
+ var styles$1 = {
1635
+ icon: __assign(__assign({}, segmentStyle), {
1636
+ backgroundColor: 'geowebColors.textInputField.default.rgba',
1637
+ width: 40,
1638
+ height: 40,
1639
+ display: 'inline-flex',
1640
+ alignItems: 'center',
1641
+ borderRadius: 1
1642
+ }),
1643
+ connect: __assign(__assign({}, segmentStyle), {
1644
+ fontSize: 18
1645
+ }),
1646
+ divider: __assign(__assign({}, segmentStyle), {
1647
+ margin: '0 6px',
1648
+ fontSize: 18
1649
+ })
1650
+ };
1671
1651
 
1672
1652
  var ShortCutSegment = function ShortCutSegment(_a) {
1673
1653
  var _b = _a.type,
1674
1654
  type = _b === void 0 ? 'text' : _b,
1675
1655
  children = _a.children;
1676
- var classes = useStyles$3();
1677
1656
 
1678
1657
  if (type === 'divider') {
1679
1658
  return /*#__PURE__*/React__default["default"].createElement(material.Typography, {
1659
+ sx: styles$1.divider,
1680
1660
  "data-testid": "segment-divider",
1681
- className: classes.segment + " " + classes.divider,
1682
1661
  component: "span"
1683
1662
  }, children);
1684
1663
  }
1685
1664
 
1686
1665
  if (type === 'icon') {
1687
- return /*#__PURE__*/React__default["default"].createElement("span", {
1666
+ return /*#__PURE__*/React__default["default"].createElement(material.Typography, {
1667
+ sx: styles$1.icon,
1688
1668
  "data-testid": "segment-icon",
1689
- className: classes.segment + " " + classes.icon
1690
- }, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
1691
1669
  component: "span"
1692
- }, children));
1670
+ }, children);
1693
1671
  }
1694
1672
 
1695
1673
  if (type === 'connect') {
1696
1674
  return /*#__PURE__*/React__default["default"].createElement(material.Typography, {
1697
- className: classes.segment + " " + classes.connect,
1675
+ sx: styles$1.connect,
1698
1676
  "data-testid": "segment-connect",
1699
1677
  component: "span"
1700
1678
  }, children);
1701
1679
  }
1702
1680
 
1703
1681
  return /*#__PURE__*/React__default["default"].createElement(material.Typography, {
1704
- className: classes.segment,
1682
+ sx: segmentStyle,
1705
1683
  "data-testid": "segment-text",
1706
1684
  component: "span"
1707
1685
  }, children);
@@ -1845,33 +1823,18 @@
1845
1823
  });
1846
1824
  });
1847
1825
  };
1848
- var useStyles$2 = makeStyles__default["default"](function () {
1849
- return {
1850
- row: {
1851
- minHeight: 56
1852
- },
1853
- title: {
1854
- fontSize: 12,
1855
- fontWeight: 300,
1856
- letterSpacing: 0.4,
1857
- opacity: 0.67
1858
- },
1859
- description: {
1860
- alignItems: 'center'
1861
- }
1862
- };
1863
- });
1864
1826
 
1865
1827
  var ShortcutList = function ShortcutList(_a) {
1866
1828
  var _b = _a.platform,
1867
1829
  platform = _b === void 0 ? 'windows' : _b;
1868
- var classes = useStyles$2();
1869
1830
  var rows = getShortcutList(shortcuts, platform);
1870
1831
  return /*#__PURE__*/React__default["default"].createElement(material.List, {
1871
1832
  "data-testid": "list-" + platform
1872
1833
  }, rows.map(function (row, index) {
1873
1834
  return /*#__PURE__*/React__default["default"].createElement(material.ListItem, {
1874
- className: classes.row,
1835
+ sx: {
1836
+ minHeight: 56
1837
+ },
1875
1838
  divider: index !== rows.length - 1,
1876
1839
  key: row.title
1877
1840
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
@@ -1881,11 +1844,18 @@
1881
1844
  alignItems: "center"
1882
1845
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1883
1846
  item: true,
1884
- className: classes.title
1847
+ sx: {
1848
+ fontSize: 12,
1849
+ fontWeight: 300,
1850
+ letterSpacing: 0.4,
1851
+ opacity: 0.67
1852
+ }
1885
1853
  }, row.title), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
1886
1854
  item: true
1887
- }, /*#__PURE__*/React__default["default"].createElement("div", {
1888
- className: classes.description
1855
+ }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
1856
+ sx: {
1857
+ alignItems: 'center'
1858
+ }
1889
1859
  }, row.description))));
1890
1860
  }));
1891
1861
  };
@@ -1943,17 +1913,7 @@
1943
1913
  })));
1944
1914
  };
1945
1915
 
1946
- var useStyles$1 = makeStyles__default["default"](function () {
1947
- return {
1948
- backdrop: {
1949
- zIndex: 1
1950
- }
1951
- };
1952
- });
1953
-
1954
1916
  var UserMenuItemCheatSheet = function UserMenuItemCheatSheet() {
1955
- var classes = useStyles$1();
1956
-
1957
1917
  var _a = __read(React__default["default"].useState(false), 2),
1958
1918
  open = _a[0],
1959
1919
  setOpen = _a[1];
@@ -1977,7 +1937,9 @@
1977
1937
  }, "Cheat sheet"))), /*#__PURE__*/React__default["default"].createElement(material.Backdrop, {
1978
1938
  "data-testid": "cheatsheet-content",
1979
1939
  open: open,
1980
- className: classes.backdrop
1940
+ sx: {
1941
+ zIndex: 1
1942
+ }
1981
1943
  }, /*#__PURE__*/React__default["default"].createElement(DraggableComponent, {
1982
1944
  startSize: {
1983
1945
  width: 700
@@ -2078,65 +2040,56 @@
2078
2040
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2079
2041
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2080
2042
  * */
2081
- var sliderStyles = makeStyles__default["default"](function (theme) {
2082
- return {
2083
- sliderHeader: {
2084
- fontFamily: 'Roboto-Black, Roboto',
2085
- fontSize: 12,
2086
- color: theme.palette.geowebColors.typographyAndIcons.text,
2087
- padding: '11px 0 11px 16px'
2043
+ var sliderHeaderStyle = {
2044
+ fontFamily: 'Roboto-Black, Roboto',
2045
+ fontSize: 12,
2046
+ color: 'geowebColors.typographyAndIcons.text',
2047
+ padding: '11px 0 11px 16px'
2048
+ };
2049
+ var sliderStyle = {
2050
+ '& span.selectedLabel': {
2051
+ fontWeight: 'bold'
2052
+ },
2053
+ '& .MuiSlider-thumb': {
2054
+ backgroundColor: 'geowebColors.customSlider.thumb',
2055
+ boxShadow: '0px 3px 5px 1px rgba(0,0,0,0.3)',
2056
+ '&.Mui-focusVisible, &:hover, &:active': {
2057
+ boxShadow: '0px 3px 5px 2px rgba(0,0,0,0.4)'
2088
2058
  }
2089
- };
2090
- });
2091
- var CustomSliderComponent = withStyles__default["default"](function (theme) {
2092
- return {
2093
- root: {
2094
- // highlight selected label
2095
- '& span.selectedLabel': {
2096
- fontWeight: 'bold'
2097
- }
2098
- },
2099
- thumb: {
2100
- backgroundColor: theme.palette.geowebColors.customSlider.thumb,
2101
- '$disabled &': {
2102
- backgroundColor: theme.palette.geowebColors.customSlider.thumbDisabled
2103
- },
2104
- boxShadow: '0px 3px 5px 1px rgba(0,0,0,0.3)',
2105
- '&.Mui-focusVisible, &:hover, &:active': {
2106
- boxShadow: '0px 3px 5px 2px rgba(0,0,0,0.4)'
2107
- }
2108
- },
2109
- mark: {
2110
- backgroundColor: theme.palette.geowebColors.customSlider.mark,
2111
- '$disabled &': {
2112
- backgroundColor: theme.palette.geowebColors.customSlider.markDisabled
2113
- }
2114
- },
2115
- markLabel: {
2116
- fontFamily: 'Roboto-Black, Roboto',
2117
- fontSize: 12,
2118
- color: theme.palette.geowebColors.typographyAndIcons.text
2059
+ },
2060
+ '& .MuiSlider-mark': {
2061
+ backgroundColor: 'geowebColors.customSlider.mark'
2062
+ },
2063
+ '& .MuiSlider-markLabel': {
2064
+ fontFamily: 'Roboto-Black, Roboto',
2065
+ fontSize: 12,
2066
+ color: 'geowebColors.typographyAndIcons.text'
2067
+ },
2068
+ '& .MuiSlider-track': {
2069
+ color: 'geowebColors.customSlider.track',
2070
+ backgroundColor: 'geowebColors.customSlider.track'
2071
+ },
2072
+ '& .MuiSlider-rail': {
2073
+ backgroundColor: 'geowebColors.customSlider.rail',
2074
+ opacity: 1
2075
+ },
2076
+ '&.Mui-disabled': {
2077
+ '& .MuiSlider-thumb': {
2078
+ backgroundColor: 'geowebColors.customSlider.thumbDisabled'
2119
2079
  },
2120
- track: {
2121
- color: theme.palette.geowebColors.customSlider.track,
2122
- backgroundColor: theme.palette.geowebColors.customSlider.track,
2123
- '$disabled &': {
2124
- backgroundColor: theme.palette.geowebColors.customSlider.trackDisabled,
2125
- color: theme.palette.geowebColors.customSlider.trackDisabled
2126
- }
2080
+ '& .MuiSlider-mark': {
2081
+ backgroundColor: 'geowebColors.customSlider.markDisabled'
2127
2082
  },
2128
- rail: {
2129
- backgroundColor: theme.palette.geowebColors.customSlider.rail,
2130
- opacity: 1,
2131
- '$disabled &': {
2132
- backgroundColor: theme.palette.geowebColors.customSlider.railDisabled,
2133
- opacity: 1
2134
- }
2083
+ '& .MuiSlider-track': {
2084
+ backgroundColor: 'geowebColors.customSlider.trackDisabled',
2085
+ color: 'geowebColors.customSlider.trackDisabled'
2135
2086
  },
2136
- disabled: {// this has to exist, because otherwise '$disabled &' rules above has no effect ???
2087
+ '& .MuiSlider-rail': {
2088
+ backgroundColor: 'geowebColors.customSlider.railDisabled',
2089
+ opacity: 1
2137
2090
  }
2138
- };
2139
- })(material.Slider);
2091
+ }
2092
+ };
2140
2093
  var CustomSlider = function CustomSlider(_a) {
2141
2094
  var value = _a.value,
2142
2095
  _b = _a.orientation,
@@ -2170,7 +2123,8 @@
2170
2123
  } // eslint-disable-next-line react-hooks/exhaustive-deps
2171
2124
 
2172
2125
  }, []);
2173
- return /*#__PURE__*/React__namespace.createElement(CustomSliderComponent, __assign({
2126
+ return /*#__PURE__*/React__namespace.createElement(material.Slider, __assign({
2127
+ sx: sliderStyle,
2174
2128
  ref: element,
2175
2129
  value: value,
2176
2130
  orientation: orientation
@@ -2194,18 +2148,20 @@
2194
2148
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2195
2149
  * */
2196
2150
 
2197
- var CustomToggleButton = function CustomToggleButton(_a) {
2151
+ var CustomToggleButton = /*#__PURE__*/React__namespace.forwardRef(function (_a, ref) {
2198
2152
  var _b = _a.variant,
2199
2153
  variant = _b === void 0 ? 'primary' : _b,
2154
+ className = _a.className,
2200
2155
  _c = _a.value,
2201
2156
  value = _c === void 0 ? 0 : _c,
2202
- props = __rest(_a, ["variant", "value"]);
2157
+ props = __rest(_a, ["variant", "className", "value"]);
2203
2158
 
2204
2159
  return /*#__PURE__*/React__namespace.createElement(material.ToggleButton, __assign({
2205
- className: variant,
2160
+ ref: ref,
2161
+ className: variant + " " + className,
2206
2162
  value: value
2207
2163
  }, props));
2208
- };
2164
+ });
2209
2165
 
2210
2166
  /* *
2211
2167
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -2223,7 +2179,7 @@
2223
2179
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2224
2180
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2225
2181
  * */
2226
- var ToolButton = function ToolButton(_a) {
2182
+ var ToolButton = /*#__PURE__*/React__namespace.forwardRef(function (_a, ref) {
2227
2183
  var active = _a.active,
2228
2184
  _b = _a.width,
2229
2185
  width = _b === void 0 ? '24px' : _b,
@@ -2239,6 +2195,7 @@
2239
2195
  props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
2240
2196
 
2241
2197
  return /*#__PURE__*/React__namespace.createElement(CustomToggleButton, __assign({
2198
+ ref: ref,
2242
2199
  variant: variant,
2243
2200
  disableRipple: true,
2244
2201
  selected: active,
@@ -2253,7 +2210,7 @@
2253
2210
  }
2254
2211
  }, sx)
2255
2212
  }, props), children);
2256
- };
2213
+ });
2257
2214
 
2258
2215
  var getPosition = function getPosition(menuPosition) {
2259
2216
  switch (menuPosition) {
@@ -2337,14 +2294,14 @@
2337
2294
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
2338
2295
  placement: "top",
2339
2296
  title: tooltipTitle
2340
- }, /*#__PURE__*/React__namespace.createElement(material.Box, null, /*#__PURE__*/React__namespace.createElement(ToolButton, {
2297
+ }, /*#__PURE__*/React__namespace.createElement(ToolButton, {
2341
2298
  active: isOpen,
2342
2299
  sx: buttonSx,
2343
2300
  onClick: handleClick,
2344
2301
  "data-testid": buttonTestId,
2345
2302
  variant: variant,
2346
2303
  id: buttonTestId
2347
- }, /*#__PURE__*/React__namespace.createElement(theme.Options, null)))), /*#__PURE__*/React__namespace.createElement(material.Menu, {
2304
+ }, /*#__PURE__*/React__namespace.createElement(theme.Options, null))), /*#__PURE__*/React__namespace.createElement(material.Menu, {
2348
2305
  anchorEl: anchorEl,
2349
2306
  open: isOpen,
2350
2307
  onClose: handleClose,
@@ -2391,56 +2348,46 @@
2391
2348
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2392
2349
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
2393
2350
  * */
2394
- var useStyles = makeStyles__default["default"](function (theme) {
2395
- return createStyles__default["default"]({
2396
- button: {
2397
- height: 24,
2398
- width: 24,
2399
- borderRadius: 5,
2400
- marginTop: 4,
2401
- color: function color(_a) {
2402
- var isActive = _a.isActive,
2403
- isAccessible = _a.isAccessible,
2404
- isEnabled = _a.isEnabled;
2405
-
2406
- if (!isEnabled) {
2407
- return theme.palette.geowebColors.buttons.flat.disabled.color;
2408
- }
2409
2351
 
2410
- if (isAccessible) {
2411
- return theme.palette.geowebColors.greys.accessible;
2412
- }
2352
+ var makeButtonStyles = function makeButtonStyles(isActive, isEnabled, isAccessible) {
2353
+ return {
2354
+ height: '24px',
2355
+ width: '24px',
2356
+ borderRadius: '5px',
2357
+ marginTop: '4px',
2358
+ color: function color() {
2359
+ if (!isEnabled) {
2360
+ return 'geowebColors.buttons.flat.disabled.color';
2361
+ }
2413
2362
 
2414
- if (isActive) {
2415
- return theme.palette.common.white;
2416
- }
2363
+ if (isAccessible) {
2364
+ return 'geowebColors.greys.accessible';
2365
+ }
2417
2366
 
2418
- return theme.palette.geowebColors.buttons.flat["default"].color;
2419
- },
2420
- backgroundColor: function backgroundColor(_a) {
2421
- var isActive = _a.isActive;
2422
- return isActive ? theme.palette.geowebColors.buttons.primary.active.fill : 'inherit';
2423
- },
2424
- '&:focus': {
2425
- backgroundColor: function backgroundColor(_a) {
2426
- var isActive = _a.isActive;
2427
- return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
2428
- },
2429
- outline: theme.palette.geowebColors.buttons.focusDefault.outline,
2430
- borderRadius: 0
2431
- },
2432
- '&:hover': {
2433
- backgroundColor: function backgroundColor(_a) {
2434
- var isActive = _a.isActive;
2435
- return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
2436
- }
2367
+ if (isActive) {
2368
+ return 'common.white';
2437
2369
  }
2370
+
2371
+ return 'geowebColors.buttons.flat.default.color';
2438
2372
  },
2439
- popper: {
2440
- pointerEvents: 'none'
2373
+ backgroundColor: function backgroundColor() {
2374
+ return isActive ? 'geowebColors.buttons.primary.active.fill' : 'inherit';
2375
+ },
2376
+ '&:focus': {
2377
+ backgroundColor: function backgroundColor() {
2378
+ return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
2379
+ },
2380
+ outline: 'geowebColors.buttons.focusDefault.outline',
2381
+ borderRadius: 0
2382
+ },
2383
+ '&:hover': {
2384
+ backgroundColor: function backgroundColor() {
2385
+ return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
2386
+ }
2441
2387
  }
2442
- });
2443
- });
2388
+ };
2389
+ };
2390
+
2444
2391
  var ManagerButton = function ManagerButton(_a) {
2445
2392
  var _b = _a.tooltipTitle,
2446
2393
  tooltipTitle = _b === void 0 ? '' : _b,
@@ -2454,14 +2401,10 @@
2454
2401
  testId = _a.testId,
2455
2402
  _f = _a.isAccessible,
2456
2403
  isAccessible = _f === void 0 ? false : _f,
2457
- className = _a.className,
2458
- props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "className"]);
2404
+ sx = _a.sx,
2405
+ props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "sx"]);
2459
2406
 
2460
- var classes = useStyles({
2461
- isActive: isActive,
2462
- isEnabled: isEnabled,
2463
- isAccessible: isAccessible
2464
- });
2407
+ var buttonStyles = makeButtonStyles(isActive, isEnabled, isAccessible);
2465
2408
 
2466
2409
  var handleClick = function handleClick(event) {
2467
2410
  onClick(event);
@@ -2470,14 +2413,14 @@
2470
2413
  return /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
2471
2414
  title: tooltipTitle,
2472
2415
  placement: "top",
2473
- classes: {
2474
- popper: classes.popper
2416
+ sx: {
2417
+ pointerEvents: 'none'
2475
2418
  }
2476
2419
  }, /*#__PURE__*/React__namespace.createElement(material.IconButton, __assign({
2477
2420
  size: "small",
2478
2421
  onClick: handleClick,
2479
2422
  "data-testid": testId,
2480
- className: classes.button + " " + className,
2423
+ sx: __assign(__assign({}, buttonStyles), sx),
2481
2424
  disableFocusRipple: true
2482
2425
  }, props), icon));
2483
2426
  };
@@ -2792,7 +2735,8 @@
2792
2735
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2793
2736
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2794
2737
  * */
2795
- // Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
2738
+ var DEFAULT_ERROR_MESSAGE = 'An error has occurred'; // Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
2739
+
2796
2740
  var isAxiosError = function isAxiosError(error) {
2797
2741
  return error.isAxiosError !== undefined;
2798
2742
  };
@@ -2807,17 +2751,46 @@
2807
2751
  return data.message;
2808
2752
  }
2809
2753
 
2810
- return 'An error has occurred';
2754
+ if (error.message) {
2755
+ return error.message;
2756
+ }
2757
+
2758
+ return DEFAULT_ERROR_MESSAGE;
2759
+ };
2760
+ var getErrorMessage = function getErrorMessage(error) {
2761
+ if (isAxiosError(error)) {
2762
+ return getAxiosErrorMessage(error);
2763
+ }
2764
+
2765
+ return error.message || DEFAULT_ERROR_MESSAGE;
2766
+ };
2767
+ var getAxiosWarningMessage = function getAxiosWarningMessage(error) {
2768
+ var data = error.response && error.response.data;
2769
+
2770
+ if (data && data.WarningMessage && typeof data.WarningMessage === 'string') {
2771
+ return data.WarningMessage;
2772
+ }
2773
+
2774
+ return '';
2775
+ };
2776
+ var getWarningMessage = function getWarningMessage(error) {
2777
+ if (isAxiosError(error)) {
2778
+ return getAxiosWarningMessage(error);
2779
+ }
2780
+
2781
+ return '';
2811
2782
  };
2812
2783
 
2813
2784
  exports.AlertBanner = AlertBanner;
2814
2785
  exports.AlertIcon = AlertIcon;
2815
2786
  exports.AppHeader = AppHeader;
2816
2787
  exports.AppLayout = AppLayout;
2788
+ exports.Avatar = Avatar;
2817
2789
  exports.ConfirmationDialog = ConfirmationDialog;
2818
2790
  exports.ConfirmationServiceProvider = ConfirmationServiceProvider;
2819
2791
  exports.CustomSlider = CustomSlider;
2820
2792
  exports.CustomToggleButton = CustomToggleButton;
2793
+ exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
2821
2794
  exports.Draggable = DraggableComponent$1;
2822
2795
  exports.EnableButton = EnableButton;
2823
2796
  exports.ErrorBoundary = ErrorBoundary;
@@ -2838,11 +2811,14 @@
2838
2811
  exports.UserMenuItemTheme = MenuItemTheme;
2839
2812
  exports.calculateDialogSizeAndPosition = calculateDialogSizeAndPosition;
2840
2813
  exports.getAxiosErrorMessage = getAxiosErrorMessage;
2814
+ exports.getAxiosWarningMessage = getAxiosWarningMessage;
2815
+ exports.getErrorMessage = getErrorMessage;
2841
2816
  exports.getInitials = getInitials;
2842
2817
  exports.getPosition = getPosition;
2818
+ exports.getWarningMessage = getWarningMessage;
2843
2819
  exports.isAxiosError = isAxiosError;
2844
2820
  exports.showPrompt = showPrompt;
2845
- exports.sliderStyles = sliderStyles;
2821
+ exports.sliderHeaderStyle = sliderHeaderStyle;
2846
2822
  exports.tooltipContainerStyles = tooltipContainerStyles;
2847
2823
  exports.useConfirmationDialog = useConfirmationDialog;
2848
2824
  exports.useDialogActions = useDialogActions;