@opengeoweb/shared 2.5.0 → 2.6.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.
Files changed (29) hide show
  1. package/index.esm.js +306 -70
  2. package/index.umd.js +332 -78
  3. package/lib/components/AlertBanner/AlertBanner.d.ts +1 -0
  4. package/lib/components/AlertIcon/AlertIcon.d.ts +8 -0
  5. package/lib/components/AlertIcon/index.d.ts +1 -0
  6. package/lib/components/{Manager/EnableButton → EnableButton}/EnableButton.d.ts +0 -0
  7. package/lib/components/{Manager/EnableButton → EnableButton}/EnableButton.spec.d.ts +0 -0
  8. package/lib/components/{Manager/EnableButton → EnableButton}/EnableButton.stories.d.ts +0 -0
  9. package/lib/components/{Manager/EnableButton → EnableButton}/index.d.ts +0 -0
  10. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.d.ts +5 -0
  11. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.spec.d.ts +0 -0
  12. package/lib/components/{Manager/ManagerButton → ManagerButton}/ManagerButton.stories.d.ts +0 -0
  13. package/lib/components/{Manager/ManagerButton → ManagerButton}/index.d.ts +0 -0
  14. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.d.ts +0 -0
  15. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.spec.d.ts +0 -0
  16. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/ManagerDeleteButton.stories.d.ts +0 -0
  17. package/lib/components/{Manager/ManagerDeleteButton → ManagerDeleteButton}/index.d.ts +0 -0
  18. package/lib/components/ToolContainer/ToolContainerDraggable.d.ts +1 -0
  19. package/lib/components/ToolContainer/types.d.ts +1 -0
  20. package/lib/components/TooltipSelect/TooltipSelect.d.ts +16 -0
  21. package/lib/components/TooltipSelect/TooltipSelect.spec.d.ts +1 -0
  22. package/lib/components/TooltipSelect/TooltipSelect.stories.d.ts +13 -0
  23. package/lib/components/TooltipSelect/index.d.ts +2 -0
  24. package/lib/components/TooltipSelect/tooltipContainerStyles.d.ts +2 -0
  25. package/lib/components/index.d.ts +5 -1
  26. package/lib/hooks/useDraftFormHelpers/useDraftFormHelpers.d.ts +1 -1
  27. package/package.json +3 -3
  28. package/lib/components/Manager/index.d.ts +0 -4
  29. package/lib/components/Manager/styles.d.ts +0 -5
package/index.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, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, Alert, AlertTitle, SvgIcon, Grid, useTheme, Link, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Tooltip, Menu, ListItemIcon, Checkbox } from '@mui/material';
3
+ import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, SvgIcon, Alert, AlertTitle, Grid, useTheme, Link, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Tooltip, Menu, ListItemIcon, Checkbox, Select } from '@mui/material';
4
4
  import Close from '@mui/icons-material/Close';
5
5
  import { useFormContext } from 'react-hook-form';
6
6
  import { isEmpty, errorMessages } from '@opengeoweb/form-fields';
@@ -552,11 +552,17 @@ var useIsMounted = function useIsMounted() {
552
552
 
553
553
  var HIDDEN_INPUT_HELPER_IS_DRAFT = 'IS_DRAFT';
554
554
  var useDraftFormHelpers = function useDraftFormHelpers() {
555
+ var isDefaultDraft = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
556
+
555
557
  var _useFormContext = useFormContext(),
556
558
  getValues = _useFormContext.getValues,
557
559
  setValue = _useFormContext.setValue,
558
560
  register = _useFormContext.register;
559
561
 
562
+ React.useEffect(function () {
563
+ setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDefaultDraft); // eslint-disable-next-line react-hooks/exhaustive-deps
564
+ }, []);
565
+
560
566
  var isDraft = function isDraft() {
561
567
  return getValues(HIDDEN_INPUT_HELPER_IS_DRAFT) === true;
562
568
  };
@@ -574,9 +580,7 @@ var useDraftFormHelpers = function useDraftFormHelpers() {
574
580
  };
575
581
 
576
582
  var DraftFieldHelper = function DraftFieldHelper() {
577
- return /*#__PURE__*/React.createElement("input", Object.assign({
578
- defaultValue: "false"
579
- }, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
583
+ return /*#__PURE__*/React.createElement("input", Object.assign({}, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
580
584
  type: "hidden"
581
585
  }));
582
586
  };
@@ -683,24 +687,21 @@ var ConfirmationServiceProvider = function ConfirmationServiceProvider(_ref) {
683
687
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
684
688
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
685
689
  * */
686
- var useStyles$a = makeStyles(function () {
687
- return {
688
- title: {
689
- fontSize: '14px',
690
- fontWeight: 'normal',
691
- marginTop: '0px!important',
692
- paddingTop: '0px!important'
693
- },
694
- info: {
695
- fontSize: '16px'
696
- }
697
- };
698
- });
699
690
 
700
- var getIcon = function getIcon(severity) {
691
+ var AlertIcon = function AlertIcon(_ref) {
692
+ var _ref$severity = _ref.severity,
693
+ severity = _ref$severity === void 0 ? 'error' : _ref$severity,
694
+ _ref$dataTestId = _ref.dataTestId,
695
+ dataTestId = _ref$dataTestId === void 0 ? 'alert-icon' : _ref$dataTestId;
696
+
701
697
  switch (severity) {
702
698
  case 'info':
703
- return /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("rect", {
699
+ return /*#__PURE__*/React.createElement(SvgIcon, {
700
+ sx: {
701
+ color: 'geowebColors.functional.notification'
702
+ },
703
+ "data-testid": dataTestId
704
+ }, /*#__PURE__*/React.createElement("rect", {
704
705
  width: 24,
705
706
  height: 24,
706
707
  fill: "transparent"
@@ -710,7 +711,12 @@ var getIcon = function getIcon(severity) {
710
711
  }));
711
712
 
712
713
  case 'success':
713
- return /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("rect", {
714
+ return /*#__PURE__*/React.createElement(SvgIcon, {
715
+ sx: {
716
+ color: 'geowebColors.functional.success'
717
+ },
718
+ "data-testid": dataTestId
719
+ }, /*#__PURE__*/React.createElement("rect", {
714
720
  width: 24,
715
721
  height: 24,
716
722
  fill: "transparent"
@@ -720,7 +726,12 @@ var getIcon = function getIcon(severity) {
720
726
  }));
721
727
 
722
728
  case 'warning':
723
- return /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("rect", {
729
+ return /*#__PURE__*/React.createElement(SvgIcon, {
730
+ sx: {
731
+ color: 'geowebColors.functional.warning'
732
+ },
733
+ "data-testid": dataTestId
734
+ }, /*#__PURE__*/React.createElement("rect", {
724
735
  width: 24,
725
736
  height: 24,
726
737
  fill: "transparent"
@@ -731,7 +742,12 @@ var getIcon = function getIcon(severity) {
731
742
 
732
743
  case 'error':
733
744
  default:
734
- return /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("rect", {
745
+ return /*#__PURE__*/React.createElement(SvgIcon, {
746
+ sx: {
747
+ color: 'geowebColors.functional.error'
748
+ },
749
+ "data-testid": dataTestId
750
+ }, /*#__PURE__*/React.createElement("rect", {
735
751
  width: 24,
736
752
  height: 24,
737
753
  fill: "transparent"
@@ -751,12 +767,30 @@ var AlertBanner = function AlertBanner(_ref) {
751
767
  _ref$dataTestId = _ref.dataTestId,
752
768
  dataTestId = _ref$dataTestId === void 0 ? 'alert-banner' : _ref$dataTestId,
753
769
  _ref$isCompact = _ref.isCompact,
754
- isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact;
755
- var classes = useStyles$a();
756
- return /*#__PURE__*/React.createElement(Alert, {
770
+ isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact,
771
+ _ref$shouldClose = _ref.shouldClose,
772
+ shouldClose = _ref$shouldClose === void 0 ? false : _ref$shouldClose;
773
+
774
+ var _React$useState = React.useState(true),
775
+ _React$useState2 = _slicedToArray(_React$useState, 2),
776
+ isOpen = _React$useState2[0],
777
+ setIsOpen = _React$useState2[1];
778
+
779
+ return isOpen && /*#__PURE__*/React.createElement(Alert, {
757
780
  "data-testid": dataTestId,
758
781
  severity: severity,
759
- icon: getIcon(severity),
782
+ icon: /*#__PURE__*/React.createElement(AlertIcon, {
783
+ severity: severity
784
+ }),
785
+ action: shouldClose ? /*#__PURE__*/React.createElement(Button, {
786
+ variant: "flat",
787
+ onClick: function onClick() {
788
+ return setIsOpen(false);
789
+ },
790
+ sx: {
791
+ backgroundColor: 'transparent!important'
792
+ }
793
+ }, "CLOSE") : undefined,
760
794
  sx: isCompact ? {
761
795
  height: '32px',
762
796
  boxSizing: 'border-box',
@@ -773,11 +807,31 @@ var AlertBanner = function AlertBanner(_ref) {
773
807
  margin: '-3px 10px 0px 0px',
774
808
  padding: '0px'
775
809
  }
776
- } : {}
810
+ } : {
811
+ padding: '3px 16px',
812
+ '& .MuiAlert-message': {
813
+ padding: '8px 0'
814
+ },
815
+ '& .MuiAlert-icon': {
816
+ padding: '8px 0'
817
+ },
818
+ '& .MuiAlert-action': {
819
+ padding: 0
820
+ }
821
+ }
777
822
  }, /*#__PURE__*/React.createElement(AlertTitle, {
778
- className: classes.title
779
- }, title), info && /*#__PURE__*/React.createElement("div", {
780
- className: classes.info
823
+ sx: {
824
+ fontSize: '14px',
825
+ fontWeight: 'normal',
826
+ marginTop: '0px!important',
827
+ paddingTop: '0px!important',
828
+ marginBottom: '0px!important'
829
+ }
830
+ }, title), info && /*#__PURE__*/React.createElement(Box, {
831
+ sx: {
832
+ fontSize: '16px',
833
+ marginTop: 1
834
+ }
781
835
  }, info));
782
836
  };
783
837
 
@@ -797,7 +851,7 @@ var AlertBanner = function AlertBanner(_ref) {
797
851
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
798
852
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
799
853
  * */
800
- var useStyles$9 = makeStyles(function () {
854
+ var useStyles$8 = makeStyles(function () {
801
855
  return {
802
856
  wrapper: {
803
857
  height: '100vh',
@@ -814,7 +868,7 @@ var useStyles$9 = makeStyles(function () {
814
868
  var AppLayout = function AppLayout(_ref) {
815
869
  var header = _ref.header,
816
870
  children = _ref.children;
817
- var classes = useStyles$9();
871
+ var classes = useStyles$8();
818
872
  return /*#__PURE__*/React__default.createElement("div", {
819
873
  className: classes.wrapper
820
874
  }, header, /*#__PURE__*/React__default.createElement("main", {
@@ -824,7 +878,7 @@ var AppLayout = function AppLayout(_ref) {
824
878
 
825
879
  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";
826
880
 
827
- var useStyles$8 = makeStyles(function (theme) {
881
+ var useStyles$7 = makeStyles(function (theme) {
828
882
  var _header;
829
883
 
830
884
  return {
@@ -861,7 +915,7 @@ var AppHeader = function AppHeader(_ref) {
861
915
  userMenu = _ref.userMenu,
862
916
  _ref$title = _ref.title,
863
917
  title = _ref$title === void 0 ? 'GeoWeb' : _ref$title;
864
- var classes = useStyles$8();
918
+ var classes = useStyles$7();
865
919
  return /*#__PURE__*/React__default.createElement("header", {
866
920
  className: classes.header
867
921
  }, /*#__PURE__*/React__default.createElement(Grid, {
@@ -1143,7 +1197,7 @@ ErrorBoundary.defaultProps = {
1143
1197
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1144
1198
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1145
1199
  * */
1146
- var useStyles$7 = makeStyles(function (theme) {
1200
+ var useStyles$6 = makeStyles(function (theme) {
1147
1201
  return {
1148
1202
  container: {
1149
1203
  position: 'absolute',
@@ -1191,7 +1245,7 @@ var UserMenu = function UserMenu(_ref) {
1191
1245
  } : _ref$onClose,
1192
1246
  children = _ref.children,
1193
1247
  initials = _ref.initials;
1194
- var classes = useStyles$7();
1248
+ var classes = useStyles$6();
1195
1249
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
1196
1250
  "data-testid": "userButton",
1197
1251
  onClick: onToggle,
@@ -1274,7 +1328,7 @@ var MenuItemTheme = function MenuItemTheme() {
1274
1328
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1275
1329
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1276
1330
  * */
1277
- var useStyles$6 = makeStyles(function (theme) {
1331
+ var useStyles$5 = makeStyles(function (theme) {
1278
1332
  return {
1279
1333
  footer: {
1280
1334
  boxShadow: theme.shadows[1],
@@ -1287,7 +1341,7 @@ var useStyles$6 = makeStyles(function (theme) {
1287
1341
  }); // drag handles will be handled by DraggableResizable/Resizable
1288
1342
 
1289
1343
  var ToolFooter = function ToolFooter() {
1290
- var classes = useStyles$6();
1344
+ var classes = useStyles$5();
1291
1345
  return /*#__PURE__*/React__default.createElement("footer", {
1292
1346
  className: classes.footer
1293
1347
  });
@@ -1370,13 +1424,17 @@ var ToolHeader = function ToolHeader(_ref) {
1370
1424
  _ref$isDraggable = _ref.isDraggable,
1371
1425
  isDraggable = _ref$isDraggable === void 0 ? false : _ref$isDraggable,
1372
1426
  _ref$className = _ref.className,
1373
- className = _ref$className === void 0 ? '' : _ref$className;
1427
+ className = _ref$className === void 0 ? '' : _ref$className,
1428
+ _ref$leftComponent = _ref.leftComponent,
1429
+ leftComponent = _ref$leftComponent === void 0 ? null : _ref$leftComponent;
1374
1430
  var styles = getStyle(size);
1375
1431
 
1376
1432
  var onClickClose = function onClickClose() {
1377
1433
  return onClose();
1378
1434
  };
1379
1435
 
1436
+ var columnSizeIcon = leftComponent ? 3 : 1;
1437
+ var columnSizeTitle = leftComponent ? 6 : 10;
1380
1438
  return /*#__PURE__*/React__default.createElement(Box, {
1381
1439
  component: "header",
1382
1440
  className: className,
@@ -1392,26 +1450,27 @@ var ToolHeader = function ToolHeader(_ref) {
1392
1450
  alignItems: "center"
1393
1451
  }, /*#__PURE__*/React__default.createElement(Grid, {
1394
1452
  item: true,
1395
- xs: 1
1396
- }, /*#__PURE__*/React__default.createElement(Grid, {
1453
+ xs: columnSizeIcon
1454
+ }, isDraggable && size !== 'xxs' && !leftComponent && /*#__PURE__*/React__default.createElement(Grid, {
1397
1455
  container: true,
1398
1456
  justifyContent: "flex-start"
1399
- }, isDraggable && size !== 'xxs' && /*#__PURE__*/React__default.createElement(IconButton, {
1457
+ }, /*#__PURE__*/React__default.createElement(IconButton, {
1400
1458
  "data-testid": "dragBtn",
1401
1459
  disableRipple: true,
1402
1460
  size: "large",
1403
1461
  sx: Object.assign(Object.assign({}, iconStyle), {
1404
1462
  pointerEvents: 'none'
1405
1463
  })
1406
- }, /*#__PURE__*/React__default.createElement(DragIndicator, null)))), /*#__PURE__*/React__default.createElement(Grid, {
1464
+ }, /*#__PURE__*/React__default.createElement(DragIndicator, null))), leftComponent && leftComponent), /*#__PURE__*/React__default.createElement(Grid, {
1407
1465
  item: true,
1408
- xs: 10
1466
+ xs: columnSizeTitle
1409
1467
  }, /*#__PURE__*/React__default.createElement(Grid, {
1410
1468
  container: true,
1411
1469
  justifyContent: "center",
1412
1470
  alignItems: "center"
1413
1471
  }, title && /*#__PURE__*/React__default.createElement(Typography, {
1414
1472
  variant: "h2",
1473
+ noWrap: true,
1415
1474
  sx: {
1416
1475
  fontSize: styles.fontSize,
1417
1476
  fontWeight: styles.fontWeight
@@ -1427,7 +1486,7 @@ var ToolHeader = function ToolHeader(_ref) {
1427
1486
  })
1428
1487
  }, /*#__PURE__*/React__default.createElement(DragIndicator, null)))), /*#__PURE__*/React__default.createElement(Grid, {
1429
1488
  item: true,
1430
- xs: 1,
1489
+ xs: columnSizeIcon,
1431
1490
  container: true,
1432
1491
  justifyContent: "flex-end"
1433
1492
  }, onClose && /*#__PURE__*/React__default.createElement(IconButton, {
@@ -1454,22 +1513,20 @@ var ToolHeader = function ToolHeader(_ref) {
1454
1513
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1455
1514
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1456
1515
  * */
1457
- var useStyles$5 = makeStyles(function () {
1458
- return {
1459
- container: {
1460
- overflow: 'hidden',
1461
- borderRadius: 0,
1462
- display: 'flex',
1463
- flexDirection: 'column',
1464
- height: '100%'
1465
- },
1466
- content: {
1467
- flex: 1,
1468
- overflowY: 'auto',
1469
- position: 'relative'
1470
- }
1471
- };
1472
- });
1516
+ var styles$1 = {
1517
+ container: {
1518
+ overflow: 'hidden',
1519
+ borderRadius: 0,
1520
+ display: 'flex',
1521
+ flexDirection: 'column',
1522
+ height: '100%'
1523
+ },
1524
+ content: {
1525
+ flex: 1,
1526
+ overflowY: 'auto',
1527
+ position: 'relative'
1528
+ }
1529
+ };
1473
1530
  var BASE_ELEVATION = 5;
1474
1531
 
1475
1532
  var ToolContainer = function ToolContainer(_a) {
@@ -1489,20 +1546,22 @@ var ToolContainer = function ToolContainer(_a) {
1489
1546
  elevation = _a$elevation === void 0 ? BASE_ELEVATION : _a$elevation,
1490
1547
  _a$headerClassName = _a.headerClassName,
1491
1548
  headerClassName = _a$headerClassName === void 0 ? '' : _a$headerClassName,
1492
- props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName"]);
1549
+ _a$leftComponent = _a.leftComponent,
1550
+ leftComponent = _a$leftComponent === void 0 ? null : _a$leftComponent,
1551
+ props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName", "leftComponent"]);
1493
1552
 
1494
- var classes = useStyles$5();
1495
1553
  return /*#__PURE__*/React__default.createElement(Paper, Object.assign({
1496
1554
  elevation: elevation,
1497
- className: classes.container
1555
+ sx: styles$1.container
1498
1556
  }, props), /*#__PURE__*/React__default.createElement(ToolHeader, {
1499
1557
  title: title,
1500
1558
  size: size,
1501
1559
  isDraggable: isDraggable,
1502
1560
  onClose: onClose,
1503
- className: headerClassName
1504
- }), /*#__PURE__*/React__default.createElement("div", {
1505
- className: classes.content,
1561
+ className: headerClassName,
1562
+ leftComponent: leftComponent
1563
+ }), /*#__PURE__*/React__default.createElement(Box, {
1564
+ sx: styles$1.content,
1506
1565
  style: {
1507
1566
  maxHeight: maxHeight
1508
1567
  }
@@ -1561,7 +1620,9 @@ var DraggableComponent = function DraggableComponent(_a) {
1561
1620
  order = _a$order === void 0 ? 1 : _a$order,
1562
1621
  _a$source = _a.source,
1563
1622
  source = _a$source === void 0 ? 'app' : _a$source,
1564
- props = __rest(_a, ["title", "bounds", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "order", "source"]);
1623
+ _a$leftComponent = _a.leftComponent,
1624
+ leftComponent = _a$leftComponent === void 0 ? null : _a$leftComponent,
1625
+ props = __rest(_a, ["title", "bounds", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "order", "source", "leftComponent"]);
1565
1626
 
1566
1627
  var zIndex = (source === 'app' ? BASE_Z_INDEX : 1000) + order;
1567
1628
  var elevation = BASE_ELEVATION + order;
@@ -1673,7 +1734,8 @@ var DraggableComponent = function DraggableComponent(_a) {
1673
1734
  isDraggable: true,
1674
1735
  isResizable: true,
1675
1736
  elevation: elevation,
1676
- headerClassName: headerClassName
1737
+ headerClassName: headerClassName,
1738
+ leftComponent: leftComponent
1677
1739
  }, children)))) : null;
1678
1740
  };
1679
1741
 
@@ -2772,6 +2834,180 @@ var EnableButton = function EnableButton(_ref) {
2772
2834
  });
2773
2835
  };
2774
2836
 
2837
+ /* *
2838
+ * Licensed under the Apache License, Version 2.0 (the "License");
2839
+ * you may not use this file except in compliance with the License.
2840
+ * You may obtain a copy of the License at
2841
+ *
2842
+ * http://www.apache.org/licenses/LICENSE-2.0
2843
+ *
2844
+ * Unless required by applicable law or agreed to in writing, software
2845
+ * distributed under the License is distributed on an "AS IS" BASIS,
2846
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2847
+ * See the License for the specific language governing permissions and
2848
+ * limitations under the License.
2849
+ *
2850
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2851
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
2852
+ * */
2853
+ var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
2854
+ return {
2855
+ width: '100%',
2856
+ height: 32,
2857
+ fontWeight: 500,
2858
+ fontSize: function fontSize(theme) {
2859
+ return theme.palette.geowebColors.layerManager.tableRowDefaultText.fontSize;
2860
+ },
2861
+ color: isEnabled ? 'geowebColors.layerManager.tableRowDefaultText.rgba' : 'geowebColors.layerManager.tableRowDisabledText.rgba',
2862
+ '& .MuiOutlinedInput-input': {
2863
+ padding: '6px 24px 6px 8px'
2864
+ },
2865
+ '& .MuiOutlinedInput-notchedOutline': {
2866
+ borderColor: 'transparent!important'
2867
+ },
2868
+ '&:hover .MuiSelect-select': {
2869
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2870
+ },
2871
+ '&.Mui-focused .MuiSelect-select': {
2872
+ outline: function outline(theme) {
2873
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2874
+ },
2875
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2876
+ },
2877
+ '&:hover&.MuiButton-root': {
2878
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2879
+ },
2880
+ '&:focus&.MuiButton-root': {
2881
+ outline: function outline(theme) {
2882
+ return theme.palette.geowebColors.buttons.focusDefault.outline;
2883
+ },
2884
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2885
+ },
2886
+ '& .MuiSvgIcon-root': {
2887
+ transition: 'none',
2888
+ fill: function fill(theme) {
2889
+ return isEnabled ? theme.palette.geowebColors.buttons.flat["default"].color : theme.palette.geowebColors.buttons.flat.disabled.color;
2890
+ }
2891
+ },
2892
+ '&>div': {
2893
+ paddingLeft: 1
2894
+ }
2895
+ };
2896
+ };
2897
+
2898
+ var TooltipSelect = function TooltipSelect(_a) {
2899
+ var tooltip = _a.tooltip,
2900
+ _a$list = _a.list,
2901
+ list = _a$list === void 0 ? [] : _a$list,
2902
+ _a$currentIndex = _a.currentIndex,
2903
+ currentIndex = _a$currentIndex === void 0 ? -1 : _a$currentIndex,
2904
+ _a$onChangeMouseWheel = _a.onChangeMouseWheel,
2905
+ onChangeMouseWheel = _a$onChangeMouseWheel === void 0 ? function () {} : _a$onChangeMouseWheel,
2906
+ _a$requiresCtrlToChan = _a.requiresCtrlToChange,
2907
+ requiresCtrlToChange = _a$requiresCtrlToChan === void 0 ? false : _a$requiresCtrlToChan,
2908
+ isEnabled = _a.isEnabled,
2909
+ noStyling = _a.noStyling,
2910
+ props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling"]);
2911
+
2912
+ props.disableUnderline;
2913
+ var otherProps = __rest(props, ["disableUnderline"]);
2914
+
2915
+ var _React$useState = React.useState(false),
2916
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2917
+ selectOpen = _React$useState2[0],
2918
+ setSelectOpen = _React$useState2[1];
2919
+
2920
+ var _React$useState3 = React.useState(false),
2921
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
2922
+ tooltipOpen = _React$useState4[0],
2923
+ setTooltipOpen = _React$useState4[1];
2924
+
2925
+ var onWheel = React.useCallback(function (event) {
2926
+ if (requiresCtrlToChange && (event.ctrlKey || event.metaKey) || !requiresCtrlToChange) {
2927
+ if (selectOpen) return;
2928
+ var direction = event.deltaY < 0 ? 1 : -1;
2929
+ var newValue = list[Math.min(Math.max(currentIndex - direction, 0), list.length - 1)];
2930
+ onChangeMouseWheel(newValue);
2931
+ }
2932
+ }, [selectOpen, currentIndex, list, onChangeMouseWheel, requiresCtrlToChange]);
2933
+ var onOpen = React.useCallback(function () {
2934
+ setSelectOpen(true);
2935
+ setTooltipOpen(false);
2936
+ }, []);
2937
+ var onClose = React.useCallback(function () {
2938
+ setSelectOpen(false);
2939
+ }, []);
2940
+ var onMouseEnter = React.useCallback(function () {
2941
+ if (!selectOpen) setTooltipOpen(true);
2942
+ }, [selectOpen]);
2943
+ var onMouseLeave = React.useCallback(function () {
2944
+ setTooltipOpen(false);
2945
+ }, []);
2946
+ var onFocus = React.useCallback(function () {
2947
+ setTooltipOpen(true);
2948
+ }, []);
2949
+ var onBlur = React.useCallback(function () {
2950
+ setTooltipOpen(false);
2951
+ }, []);
2952
+ return /*#__PURE__*/React.createElement(Tooltip, {
2953
+ title: tooltip,
2954
+ placement: "top",
2955
+ open: tooltipOpen,
2956
+ sx: noStyling ? undefined : tooltipContainerStyles(isEnabled)
2957
+ }, /*#__PURE__*/React.createElement(Select, Object.assign({
2958
+ onOpen: onOpen,
2959
+ onClose: onClose,
2960
+ onMouseEnter: onMouseEnter,
2961
+ onMouseLeave: onMouseLeave,
2962
+ onFocus: onFocus,
2963
+ onBlur: onBlur,
2964
+ onWheel: onWheel,
2965
+ MenuProps: {
2966
+ BackdropProps: {
2967
+ sx: {
2968
+ '&.MuiBackdrop-root': {
2969
+ backgroundColor: 'transparent'
2970
+ }
2971
+ }
2972
+ },
2973
+ sx: {
2974
+ '& ul': {
2975
+ backgroundColor: 'geowebColors.background.surface'
2976
+ },
2977
+ '& li': {
2978
+ fontSize: '16px',
2979
+ padding: '12px',
2980
+ '&:hover': {
2981
+ backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
2982
+ },
2983
+ '&.Mui-selected': {
2984
+ color: 'geowebColors.buttons.tool.active.color',
2985
+ backgroundColor: 'geowebColors.buttons.tool.active.fill',
2986
+ boxShadow: "none",
2987
+ '&:hover': {
2988
+ backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
2989
+ },
2990
+ '&:focus': {
2991
+ backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
2992
+ }
2993
+ },
2994
+ '&:after': {
2995
+ background: 'none!important'
2996
+ },
2997
+ '&.Mui-disabled': {
2998
+ fontSize: '12px',
2999
+ opacity: 0.67,
3000
+ padding: '0px 12px',
3001
+ '&.MuiMenuItem-root': {
3002
+ minHeight: '30px!important'
3003
+ }
3004
+ }
3005
+ }
3006
+ }
3007
+ }
3008
+ }, otherProps)));
3009
+ };
3010
+
2775
3011
  /* *
2776
3012
  * Licensed under the Apache License, Version 2.0 (the "License");
2777
3013
  * you may not use this file except in compliance with the License.
@@ -2806,4 +3042,4 @@ var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
2806
3042
  return 'An error has occurred';
2807
3043
  };
2808
3044
 
2809
- export { AlertBanner, AppHeader, AppLayout, ConfirmationDialog, ConfirmationServiceProvider, CustomSlider, CustomToggleButton, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary, HIDDEN_INPUT_HELPER_IS_DRAFT, ManagerButton, ManagerDeleteButton, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, calculateDialogSizeAndPosition, getAxiosErrorMessage, getInitials, isAxiosError, showPrompt, sliderStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
3045
+ export { AlertBanner, AlertIcon, AppHeader, AppLayout, ConfirmationDialog, ConfirmationServiceProvider, CustomSlider, CustomToggleButton, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary, HIDDEN_INPUT_HELPER_IS_DRAFT, ManagerButton, ManagerDeleteButton, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, calculateDialogSizeAndPosition, getAxiosErrorMessage, getInitials, isAxiosError, showPrompt, sliderStyles, tooltipContainerStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };