@opengeoweb/shared 11.0.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid2, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, Menu, ListSubheader, ListItemText, ListItemIcon, styled, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment, Chip, Stack, debounce as debounce$1, ListItemButton, Checkbox } from '@mui/material';
3
- import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, Admin, useThemeContext, ThemeTypes, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
2
+ import { Box, Typography, Tooltip, IconButton, useTheme, Dialog, DialogTitle, DialogContent, DialogActions, Paper, Button, CircularProgress, Alert, AlertTitle, Drawer, Link, Avatar as Avatar$1, ClickAwayListener, MenuList, MenuItem, Grid2, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Switch, Slider, ToggleButton, Menu, ListSubheader, ListItemText, ListItemIcon, styled, Select, Accordion, AccordionSummary, AccordionDetails, FormLabel, TextField, InputAdornment, Chip, Stack, debounce as debounce$1, ListItemButton, Checkbox } from '@mui/material';
4
3
  import * as React from 'react';
5
4
  import React__default, { useRef, Component, useState } from 'react';
5
+ import { Resize, Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Admin, useThemeContext, ThemeTypes, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
6
+ import Draggable from 'react-draggable';
7
+ import { Resizable } from 're-resizable';
6
8
  import 'i18next';
7
9
  import { useTranslation } from 'react-i18next';
8
10
  import { throttle, escapeRegExp, debounce } from 'lodash';
9
- import Draggable from 'react-draggable';
10
- import { Resizable } from 're-resizable';
11
11
  import * as Sentry from '@sentry/react';
12
12
  import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInYears as differenceInYears$1, differenceInMonths as differenceInMonths$1, differenceInDays as differenceInDays$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, differenceInSeconds as differenceInSeconds$1, roundToNearestMinutes as roundToNearestMinutes$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$1, getHours as getHours$1, startOfDay, addMinutes, addHours, setSeconds as setSeconds$1, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
13
13
  import { configureStore } from '@reduxjs/toolkit';
@@ -748,18 +748,222 @@ var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref)
748
748
  });
749
749
  var CustomIconButton = /*#__PURE__*/React.memo(CustomIconButtonNoMemo);
750
750
 
751
- var _excluded$c = ["title", "onClose", "description", "actions", "children", "sx"];
752
- var CustomDialog = function CustomDialog(_ref) {
753
- var title = _ref.title,
754
- _onClose = _ref.onClose,
755
- _ref$description = _ref.description,
756
- description = _ref$description === void 0 ? '' : _ref$description,
757
- _ref$actions = _ref.actions,
758
- actions = _ref$actions === void 0 ? null : _ref$actions,
751
+ var _excluded$c = ["bounds", "setIsDragging", "children", "onStop"];
752
+ var DraggableComponent$1 = function DraggableComponent(_ref) {
753
+ var _ref$bounds = _ref.bounds,
754
+ bounds = _ref$bounds === void 0 ? 'body' : _ref$bounds,
755
+ setIsDragging = _ref.setIsDragging,
759
756
  children = _ref.children,
760
- sx = _ref.sx,
761
- other = _objectWithoutPropertiesLoose(_ref, _excluded$c);
762
- return jsxs(Dialog, Object.assign({
757
+ onStop = _ref.onStop,
758
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
759
+ var onDragStart = function onDragStart(e) {
760
+ // This makes sure that nothing is selected during drag
761
+ setIsDragging && setIsDragging(true);
762
+ e.preventDefault();
763
+ };
764
+ var onDragStop = function onDragStop(event, pos) {
765
+ setIsDragging && setIsDragging(false);
766
+ onStop && onStop(event, pos);
767
+ };
768
+ return jsx(Draggable, Object.assign({
769
+ bounds: bounds
770
+ }, props, {
771
+ onStop: function onStop(event, pos) {
772
+ return onDragStop(event, pos);
773
+ },
774
+ enableUserSelectHack: false,
775
+ onStart: onDragStart,
776
+ children: children
777
+ }));
778
+ };
779
+
780
+ var _excluded$b = ["children", "onResizeStart", "onResizeStop", "size", "setSize", "minHeight", "minWidth", "enable", "nodeRef"];
781
+ var isDraggingClassName = 'is-dragging';
782
+ var useBoundsProps = function useBoundsProps(nodeRef) {
783
+ var _React$useState = React__default.useState({}),
784
+ boundsProps = _React$useState[0],
785
+ setBoundsProps = _React$useState[1];
786
+ React__default.useEffect(function () {
787
+ if (nodeRef) {
788
+ var _nodeRef$current;
789
+ setBoundsProps({
790
+ bounds: nodeRef == null || (_nodeRef$current = nodeRef.current) == null ? void 0 : _nodeRef$current.parentNode,
791
+ boundsByDirection: true
792
+ });
793
+ }
794
+ // eslint-disable-next-line react-hooks/exhaustive-deps
795
+ }, []);
796
+ return boundsProps;
797
+ };
798
+ var ResizeComponent = function ResizeComponent(_ref) {
799
+ var children = _ref.children,
800
+ _ref$onResizeStart = _ref.onResizeStart,
801
+ onResizeStart = _ref$onResizeStart === void 0 ? function () {} : _ref$onResizeStart,
802
+ _ref$onResizeStop = _ref.onResizeStop,
803
+ onResizeStop = _ref$onResizeStop === void 0 ? function () {} : _ref$onResizeStop,
804
+ size = _ref.size,
805
+ _ref$setSize = _ref.setSize,
806
+ setSize = _ref$setSize === void 0 ? function () {} : _ref$setSize,
807
+ _ref$minHeight = _ref.minHeight,
808
+ minHeight = _ref$minHeight === void 0 ? 50 : _ref$minHeight,
809
+ _ref$minWidth = _ref.minWidth,
810
+ minWidth = _ref$minWidth === void 0 ? 50 : _ref$minWidth,
811
+ _ref$enable = _ref.enable,
812
+ enable = _ref$enable === void 0 ? {
813
+ top: false,
814
+ right: false,
815
+ bottom: false,
816
+ left: false,
817
+ topRight: true,
818
+ bottomRight: true,
819
+ bottomLeft: true,
820
+ topLeft: true
821
+ } : _ref$enable,
822
+ nodeRef = _ref.nodeRef,
823
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
824
+ var theme = useTheme();
825
+ var onStartResize = React__default.useCallback(function (event, _direction, node) {
826
+ event.stopPropagation();
827
+ node.classList.add(isDraggingClassName);
828
+ var _node$getBoundingClie = node.getBoundingClientRect(),
829
+ width = _node$getBoundingClie.width,
830
+ height = _node$getBoundingClie.height;
831
+ setSize({
832
+ width: width,
833
+ height: height
834
+ });
835
+ // fix for when initial maxHeight gets cleared
836
+ // eslint-disable-next-line no-param-reassign
837
+ node.style.height = height + "px";
838
+ onResizeStart();
839
+ }, [onResizeStart, setSize]);
840
+ var onStopResize = React__default.useCallback(function (event, direction, node, delta) {
841
+ node.classList.remove(isDraggingClassName);
842
+ if (!size) {
843
+ return;
844
+ }
845
+ var width = parseInt(size.width, 10) + delta.width;
846
+ var height = parseInt(size.height, 10) + delta.height;
847
+ setSize({
848
+ width: width,
849
+ height: height
850
+ });
851
+ onResizeStop(event, direction, node, delta);
852
+ }, [setSize, onResizeStop, size]);
853
+ var boundsProps = useBoundsProps(nodeRef);
854
+ return jsx(Resizable, Object.assign({
855
+ minHeight: minHeight,
856
+ minWidth: minWidth,
857
+ size: size,
858
+ onResizeStop: onStopResize
859
+ }, boundsProps, {
860
+ handleComponent: {
861
+ bottomRight: jsx(Resize, {
862
+ style: {
863
+ fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
864
+ },
865
+ sx: {
866
+ display: 'none'
867
+ },
868
+ className: "resizableHandle"
869
+ }),
870
+ bottomLeft: jsx(Resize, {
871
+ isRightAligned: true,
872
+ style: {
873
+ fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
874
+ },
875
+ sx: {
876
+ display: 'none'
877
+ },
878
+ className: "resizableHandle"
879
+ })
880
+ },
881
+ enable: enable,
882
+ onResizeStart: onStartResize
883
+ }, props, {
884
+ children: children
885
+ }));
886
+ };
887
+
888
+ var _excluded$a = ["defaultSize", "onResizeStop", "hasLayout"],
889
+ _excluded2$2 = ["title", "onClose", "description", "actions", "children", "sx", "resizableDefaultSize", "isResizable", "hasLayout", "shouldRenderInline", "slotProps"];
890
+ var PaperComponent = function PaperComponent(_ref) {
891
+ var _ref$defaultSize = _ref.defaultSize,
892
+ defaultSize = _ref$defaultSize === void 0 ? {
893
+ width: 'auto',
894
+ height: undefined
895
+ } : _ref$defaultSize,
896
+ onResize = _ref.onResizeStop,
897
+ _ref$hasLayout = _ref.hasLayout,
898
+ hasLayout = _ref$hasLayout === void 0 ? true : _ref$hasLayout,
899
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
900
+ var maxWidth = '98%';
901
+ var maxHeight = '98%';
902
+ return jsx(ResizeComponent, Object.assign({
903
+ size: defaultSize,
904
+ maxWidth: maxWidth,
905
+ maxHeight: maxHeight,
906
+ minHeight: 120,
907
+ minWidth: 280,
908
+ style: {
909
+ display: 'flex',
910
+ alignItems: 'center',
911
+ justifyContent: 'center'
912
+ }
913
+ }, onResize && {
914
+ onResizeStop: function onResizeStop(_event, _direction, elementRef) {
915
+ var _elementRef$getBoundi = elementRef.getBoundingClientRect(),
916
+ width = _elementRef$getBoundi.width,
917
+ height = _elementRef$getBoundi.height;
918
+ onResize({
919
+ width: width,
920
+ height: height
921
+ });
922
+ }
923
+ }, {
924
+ enable: {
925
+ top: true,
926
+ right: true,
927
+ bottom: true,
928
+ left: true,
929
+ topRight: true,
930
+ bottomRight: true,
931
+ bottomLeft: true,
932
+ topLeft: true
933
+ },
934
+ children: hasLayout ? jsx(Paper, Object.assign({}, props, {
935
+ sx: {
936
+ margin: '0px!important',
937
+ width: '100%!important',
938
+ height: '100%!important',
939
+ maxHeight: '100%!important',
940
+ maxWidth: '100%!important'
941
+ }
942
+ })) : props.children
943
+ }));
944
+ };
945
+ var CustomDialog = function CustomDialog(_ref2) {
946
+ var title = _ref2.title,
947
+ _onClose = _ref2.onClose,
948
+ _ref2$description = _ref2.description,
949
+ description = _ref2$description === void 0 ? '' : _ref2$description,
950
+ _ref2$actions = _ref2.actions,
951
+ actions = _ref2$actions === void 0 ? null : _ref2$actions,
952
+ children = _ref2.children,
953
+ sx = _ref2.sx,
954
+ resizableDefaultSize = _ref2.resizableDefaultSize,
955
+ _ref2$isResizable = _ref2.isResizable,
956
+ isResizable = _ref2$isResizable === void 0 ? false : _ref2$isResizable,
957
+ _ref2$hasLayout = _ref2.hasLayout,
958
+ hasLayout = _ref2$hasLayout === void 0 ? true : _ref2$hasLayout,
959
+ _ref2$shouldRenderInl = _ref2.shouldRenderInline,
960
+ shouldRenderInline = _ref2$shouldRenderInl === void 0 ? false : _ref2$shouldRenderInl,
961
+ slotProps = _ref2.slotProps,
962
+ other = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
963
+ var _React$useState = React.useState(resizableDefaultSize),
964
+ size = _React$useState[0],
965
+ setSize = _React$useState[1];
966
+ return jsx(Dialog, Object.assign({
763
967
  "data-testid": "customDialog",
764
968
  PaperProps: {
765
969
  sx: Object.assign({
@@ -772,58 +976,82 @@ var CustomDialog = function CustomDialog(_ref) {
772
976
  onClose: function onClose() {
773
977
  _onClose('CLOSED');
774
978
  },
775
- "aria-labelledby": "dialog-title"
776
- }, other, {
777
- children: [jsxs(DialogTitle, {
778
- id: "dialog-title",
779
- sx: {
780
- zIndex: 1,
781
- padding: 2,
782
- display: 'flex',
783
- justifyContent: 'space-between',
784
- alignItems: 'center'
979
+ "aria-labelledby": "dialog-title",
980
+ slotProps: Object.assign({}, slotProps, isResizable && {
981
+ paper: {
982
+ defaultSize: size,
983
+ onResizeStop: setSize,
984
+ hasLayout: hasLayout
985
+ }
986
+ }, shouldRenderInline && {
987
+ root: {
988
+ style: {
989
+ position: 'absolute'
990
+ }
785
991
  },
786
- children: [jsx(Typography, {
992
+ backdrop: {
993
+ style: {
994
+ position: 'absolute'
995
+ }
996
+ }
997
+ })
998
+ }, isResizable && {
999
+ PaperComponent: PaperComponent
1000
+ }, shouldRenderInline && {
1001
+ disablePortal: true
1002
+ }, other, {
1003
+ children: hasLayout ? jsxs(Fragment, {
1004
+ children: [jsxs(DialogTitle, {
1005
+ id: "dialog-title",
787
1006
  sx: {
788
- fontSize: '16px',
789
- fontWeight: 500
1007
+ zIndex: 1,
1008
+ padding: 2,
1009
+ display: 'flex',
1010
+ justifyContent: 'space-between',
1011
+ alignItems: 'center'
790
1012
  },
791
- "data-testid": "customDialog-title",
792
- component: "span",
793
- children: title
794
- }), jsx(CustomIconButton, {
795
- "data-testid": "customDialog-close",
796
- "aria-label": "close",
797
- onClick: function onClick() {
798
- return _onClose('CLOSED');
1013
+ children: [jsx(Typography, {
1014
+ sx: {
1015
+ fontSize: '16px',
1016
+ fontWeight: 500
1017
+ },
1018
+ "data-testid": "customDialog-title",
1019
+ component: "span",
1020
+ children: title
1021
+ }), jsx(CustomIconButton, {
1022
+ "data-testid": "customDialog-close",
1023
+ "aria-label": "close",
1024
+ onClick: function onClick() {
1025
+ return _onClose('CLOSED');
1026
+ },
1027
+ sx: {
1028
+ '&.MuiIconButton-root': {
1029
+ color: 'geowebColors.greys.accessible'
1030
+ }
1031
+ },
1032
+ children: jsx(Close, {
1033
+ "data-testid": "CloseIcon"
1034
+ })
1035
+ })]
1036
+ }), jsxs(DialogContent, {
1037
+ sx: {
1038
+ padding: '8px 16px'
799
1039
  },
1040
+ children: [description && jsx(Typography, {
1041
+ variant: "body1",
1042
+ children: description
1043
+ }), children]
1044
+ }), jsx(DialogActions, {
800
1045
  sx: {
801
- '&.MuiIconButton-root': {
802
- color: 'geowebColors.greys.accessible'
1046
+ padding: 2,
1047
+ flexDirection: {
1048
+ xs: 'column',
1049
+ sm: 'row'
803
1050
  }
804
1051
  },
805
- children: jsx(Close, {
806
- "data-testid": "CloseIcon"
807
- })
1052
+ children: actions
808
1053
  })]
809
- }), jsxs(DialogContent, {
810
- sx: {
811
- padding: '8px 16px'
812
- },
813
- children: [description && jsx(Typography, {
814
- variant: "body1",
815
- children: description
816
- }), children]
817
- }), jsx(DialogActions, {
818
- sx: {
819
- padding: 2,
820
- flexDirection: {
821
- xs: 'column',
822
- sm: 'row'
823
- }
824
- },
825
- children: actions
826
- })]
1054
+ }) : children
827
1055
  }));
828
1056
  };
829
1057
 
@@ -849,8 +1077,6 @@ var useSharedTranslation = function useSharedTranslation() {
849
1077
  return useTranslation([SHARED_NAMESPACE]);
850
1078
  };
851
1079
 
852
- var _excluded$b = ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"],
853
- _excluded2$1 = ["catchOnCancel"];
854
1080
  var confirmStyle = {
855
1081
  width: {
856
1082
  xs: '100%',
@@ -869,6 +1095,67 @@ var confirmStyle = {
869
1095
  sm: 0
870
1096
  }
871
1097
  };
1098
+ var ConfirmationButtons = function ConfirmationButtons(_ref) {
1099
+ var onClose = _ref.onClose,
1100
+ cancelLabel = _ref.cancelLabel,
1101
+ isLoading = _ref.isLoading,
1102
+ onSubmit = _ref.onSubmit,
1103
+ disableAutoFocus = _ref.disableAutoFocus,
1104
+ confirmLabel = _ref.confirmLabel;
1105
+ var _useSharedTranslation = useSharedTranslation(),
1106
+ t = _useSharedTranslation.t;
1107
+ return jsxs(Fragment, {
1108
+ children: [jsx(Button, {
1109
+ "data-testid": "confirmationDialog-cancel",
1110
+ variant: "tertiary",
1111
+ sx: function sx(theme) {
1112
+ return {
1113
+ width: {
1114
+ xs: '100%',
1115
+ sm: '150px'
1116
+ },
1117
+ '&:focus': {
1118
+ outline: theme.palette.geowebColors.buttons.primary.focus.outline,
1119
+ borderColor: 'transparent'
1120
+ }
1121
+ };
1122
+ },
1123
+ onClick: function onClick() {
1124
+ return onClose('CANCELLED');
1125
+ },
1126
+ children: cancelLabel != null ? cancelLabel : t('shared-confirmation-cancel')
1127
+ }), isLoading ? jsx(Box, {
1128
+ "data-testid": "confirm-dialog-spinner",
1129
+ sx: Object.assign({}, confirmStyle, {
1130
+ height: '40px',
1131
+ display: 'flex',
1132
+ justifyContent: 'center',
1133
+ alignItems: 'center'
1134
+ }),
1135
+ children: jsx(CircularProgress, {
1136
+ size: 40,
1137
+ color: "secondary"
1138
+ })
1139
+ }) : jsx(Button, {
1140
+ "data-testid": "confirmationDialog-confirm",
1141
+ variant: "primary",
1142
+ sx: function sx(theme) {
1143
+ return Object.assign({}, confirmStyle, {
1144
+ '&:focus': {
1145
+ outline: theme.palette.geowebColors.buttons.primary.focus.outline,
1146
+ borderColor: 'transparent'
1147
+ }
1148
+ });
1149
+ },
1150
+ onClick: onSubmit,
1151
+ autoFocus: !disableAutoFocus,
1152
+ children: confirmLabel != null ? confirmLabel : t('shared-confirmation-submit')
1153
+ })]
1154
+ });
1155
+ };
1156
+
1157
+ var _excluded$9 = ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"],
1158
+ _excluded2$1 = ["catchOnCancel"];
872
1159
  var ConfirmationDialog = function ConfirmationDialog(_ref) {
873
1160
  var open = _ref.open,
874
1161
  title = _ref.title,
@@ -883,7 +1170,7 @@ var ConfirmationDialog = function ConfirmationDialog(_ref) {
883
1170
  disableAutoFocus = _ref$disableAutoFocus === void 0 ? false : _ref$disableAutoFocus,
884
1171
  _ref$isLoading = _ref.isLoading,
885
1172
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
886
- other = _objectWithoutPropertiesLoose(_ref, _excluded$b);
1173
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$9);
887
1174
  other.catchOnCancel;
888
1175
  var rest = _objectWithoutPropertiesLoose(other, _excluded2$1); // remove unwanted props
889
1176
  var _useSharedTranslation = useSharedTranslation(),
@@ -894,55 +1181,13 @@ var ConfirmationDialog = function ConfirmationDialog(_ref) {
894
1181
  title: title,
895
1182
  description: description != null ? description : t('shared-confirmation-description'),
896
1183
  onClose: onClose,
897
- actions: jsxs(Fragment, {
898
- children: [jsx(Button, {
899
- "data-testid": "confirmationDialog-cancel",
900
- variant: "tertiary",
901
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
902
- sx: function sx(theme) {
903
- return {
904
- width: {
905
- xs: '100%',
906
- sm: '150px'
907
- },
908
- '&:focus': {
909
- outline: theme.palette.geowebColors.buttons.primary.focus.outline,
910
- borderColor: 'transparent'
911
- }
912
- };
913
- },
914
- onClick: function onClick() {
915
- return onClose('CANCELLED');
916
- },
917
- children: cancelLabel != null ? cancelLabel : t('shared-confirmation-cancel')
918
- }), isLoading ? jsx(Box, {
919
- "data-testid": "confirm-dialog-spinner",
920
- sx: Object.assign({}, confirmStyle, {
921
- height: '40px',
922
- display: 'flex',
923
- justifyContent: 'center',
924
- alignItems: 'center'
925
- }),
926
- children: jsx(CircularProgress, {
927
- size: 40,
928
- color: "secondary"
929
- })
930
- }) : jsx(Button, {
931
- "data-testid": "confirmationDialog-confirm",
932
- variant: "primary",
933
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
934
- sx: function sx(theme) {
935
- return Object.assign({}, confirmStyle, {
936
- '&:focus': {
937
- outline: theme.palette.geowebColors.buttons.primary.focus.outline,
938
- borderColor: 'transparent'
939
- }
940
- });
941
- },
942
- onClick: onSubmit,
943
- autoFocus: !disableAutoFocus,
944
- children: confirmLabel != null ? confirmLabel : t('shared-confirmation-submit')
945
- })]
1184
+ actions: jsx(ConfirmationButtons, {
1185
+ onClose: onClose,
1186
+ cancelLabel: cancelLabel,
1187
+ isLoading: isLoading,
1188
+ onSubmit: onSubmit,
1189
+ disableAutoFocus: disableAutoFocus,
1190
+ confirmLabel: confirmLabel
946
1191
  })
947
1192
  }, rest, {
948
1193
  children: content
@@ -1625,143 +1870,6 @@ var AppHeader = function AppHeader(_ref) {
1625
1870
  });
1626
1871
  };
1627
1872
 
1628
- var _excluded$a = ["bounds", "setIsDragging", "children", "onStop"];
1629
- var DraggableComponent$1 = function DraggableComponent(_ref) {
1630
- var _ref$bounds = _ref.bounds,
1631
- bounds = _ref$bounds === void 0 ? 'body' : _ref$bounds,
1632
- setIsDragging = _ref.setIsDragging,
1633
- children = _ref.children,
1634
- onStop = _ref.onStop,
1635
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
1636
- var onDragStart = function onDragStart(e) {
1637
- // This makes sure that nothing is selected during drag
1638
- setIsDragging && setIsDragging(true);
1639
- e.preventDefault();
1640
- };
1641
- var onDragStop = function onDragStop(event, pos) {
1642
- setIsDragging && setIsDragging(false);
1643
- onStop && onStop(event, pos);
1644
- };
1645
- return jsx(Draggable, Object.assign({
1646
- bounds: bounds
1647
- }, props, {
1648
- onStop: function onStop(event, pos) {
1649
- return onDragStop(event, pos);
1650
- },
1651
- enableUserSelectHack: false,
1652
- onStart: onDragStart,
1653
- children: children
1654
- }));
1655
- };
1656
-
1657
- var _excluded$9 = ["children", "onResizeStart", "onResizeStop", "size", "setSize", "minHeight", "minWidth", "enable", "nodeRef"];
1658
- var isDraggingClassName = 'is-dragging';
1659
- var useBoundsProps = function useBoundsProps(nodeRef) {
1660
- var _React$useState = React__default.useState({}),
1661
- boundsProps = _React$useState[0],
1662
- setBoundsProps = _React$useState[1];
1663
- React__default.useEffect(function () {
1664
- if (nodeRef) {
1665
- var _nodeRef$current;
1666
- setBoundsProps({
1667
- bounds: nodeRef == null || (_nodeRef$current = nodeRef.current) == null ? void 0 : _nodeRef$current.parentNode,
1668
- boundsByDirection: true
1669
- });
1670
- }
1671
- // eslint-disable-next-line react-hooks/exhaustive-deps
1672
- }, []);
1673
- return boundsProps;
1674
- };
1675
- var ResizeComponent = function ResizeComponent(_ref) {
1676
- var children = _ref.children,
1677
- _ref$onResizeStart = _ref.onResizeStart,
1678
- onResizeStart = _ref$onResizeStart === void 0 ? function () {} : _ref$onResizeStart,
1679
- _ref$onResizeStop = _ref.onResizeStop,
1680
- onResizeStop = _ref$onResizeStop === void 0 ? function () {} : _ref$onResizeStop,
1681
- size = _ref.size,
1682
- _ref$setSize = _ref.setSize,
1683
- setSize = _ref$setSize === void 0 ? function () {} : _ref$setSize,
1684
- _ref$minHeight = _ref.minHeight,
1685
- minHeight = _ref$minHeight === void 0 ? 50 : _ref$minHeight,
1686
- _ref$minWidth = _ref.minWidth,
1687
- minWidth = _ref$minWidth === void 0 ? 50 : _ref$minWidth,
1688
- _ref$enable = _ref.enable,
1689
- enable = _ref$enable === void 0 ? {
1690
- top: false,
1691
- right: false,
1692
- bottom: false,
1693
- left: false,
1694
- topRight: true,
1695
- bottomRight: true,
1696
- bottomLeft: true,
1697
- topLeft: true
1698
- } : _ref$enable,
1699
- nodeRef = _ref.nodeRef,
1700
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
1701
- var theme = useTheme();
1702
- var onStartResize = React__default.useCallback(function (event, _direction, node) {
1703
- event.stopPropagation();
1704
- node.classList.add(isDraggingClassName);
1705
- var _node$getBoundingClie = node.getBoundingClientRect(),
1706
- width = _node$getBoundingClie.width,
1707
- height = _node$getBoundingClie.height;
1708
- setSize({
1709
- width: width,
1710
- height: height
1711
- });
1712
- // fix for when initial maxHeight gets cleared
1713
- // eslint-disable-next-line no-param-reassign
1714
- node.style.height = height + "px";
1715
- onResizeStart();
1716
- }, [onResizeStart, setSize]);
1717
- var onStopResize = React__default.useCallback(function (event, direction, node, delta) {
1718
- node.classList.remove(isDraggingClassName);
1719
- if (!size) {
1720
- return;
1721
- }
1722
- var width = parseInt(size.width, 10) + delta.width;
1723
- var height = parseInt(size.height, 10) + delta.height;
1724
- setSize({
1725
- width: width,
1726
- height: height
1727
- });
1728
- onResizeStop(event, direction, node, delta);
1729
- }, [setSize, onResizeStop, size]);
1730
- var boundsProps = useBoundsProps(nodeRef);
1731
- return jsx(Resizable, Object.assign({
1732
- minHeight: minHeight,
1733
- minWidth: minWidth,
1734
- size: size,
1735
- onResizeStop: onStopResize
1736
- }, boundsProps, {
1737
- handleComponent: {
1738
- bottomRight: jsx(Resize, {
1739
- style: {
1740
- fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
1741
- },
1742
- sx: {
1743
- display: 'none'
1744
- },
1745
- className: "resizableHandle"
1746
- }),
1747
- bottomLeft: jsx(Resize, {
1748
- isRightAligned: true,
1749
- style: {
1750
- fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
1751
- },
1752
- sx: {
1753
- display: 'none'
1754
- },
1755
- className: "resizableHandle"
1756
- })
1757
- },
1758
- enable: enable,
1759
- onResizeStart: onStartResize
1760
- }, props, {
1761
- children: children
1762
- }));
1763
- };
1764
-
1765
1873
  // TODO: (Sander de Snaijer 2020-07-13) this error wrappper should get more (non-breaking?) logic when we have decided how to handle errors.
1766
1874
  /**
1767
1875
  * ErrorBoundary
@@ -2002,12 +2110,20 @@ var MenuItemTheme = function MenuItemTheme(_ref) {
2002
2110
  checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.DARK_THEME
2003
2111
  }),
2004
2112
  label: t('shared-dark')
2005
- }), enableSpecialThemes && jsx(FormControlLabel, {
2006
- value: ThemeTypes.XMAS2024_THEME,
2007
- control: jsx(Radio, {
2008
- checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.XMAS2024_THEME
2009
- }),
2010
- label: t('shared-xmas') + " 2024"
2113
+ }), enableSpecialThemes && jsxs(Fragment, {
2114
+ children: [jsx(FormControlLabel, {
2115
+ value: ThemeTypes.DEMO_THEME,
2116
+ control: jsx(Radio, {
2117
+ checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.DEMO_THEME
2118
+ }),
2119
+ label: "Demo"
2120
+ }), jsx(FormControlLabel, {
2121
+ value: ThemeTypes.XMAS2024_THEME,
2122
+ control: jsx(Radio, {
2123
+ checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.XMAS2024_THEME
2124
+ }),
2125
+ label: t('shared-xmas') + " 2024"
2126
+ })]
2011
2127
  })]
2012
2128
  })
2013
2129
  })]
@@ -5882,4 +5998,4 @@ var PresetScope = Object.assign({}, SystemScope, {
5882
5998
  shared: 'shared'
5883
5999
  });
5884
6000
 
5885
- export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, PROJECTION, PresetScope, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, StorybookDocsWrapper, SwitchButton, SystemScope, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createToolkitMockStore, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosAuthError, isAxiosError, pollingIntervalTimeout, renderCounter, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, useWheelStopPropagation };
6001
+ export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationButtons, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterOption, LastUpdateTime, PROJECTION, PresetScope, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, StorybookDocsWrapper, SwitchButton, SystemScope, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createToolkitMockStore, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosAuthError, isAxiosError, pollingIntervalTimeout, renderCounter, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, useWheelStopPropagation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "11.0.0",
3
+ "version": "11.1.0",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { DialogAction } from '../CustomDialog';
3
+ export type ConfirmationAction = 'CANCELLED' | DialogAction;
4
+ export interface ConfirmationButtonsProps {
5
+ confirmLabel?: string;
6
+ cancelLabel?: string;
7
+ disableAutoFocus?: boolean;
8
+ onSubmit: () => void;
9
+ onClose: (reason: ConfirmationAction) => void;
10
+ isLoading?: boolean;
11
+ }
12
+ export declare const ConfirmationButtons: React.FC<ConfirmationButtonsProps>;
@@ -0,0 +1,9 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { ConfirmationButtons } from './ConfirmationButtons';
3
+ declare const meta: Meta<typeof ConfirmationButtons>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ConfirmationButtons>;
6
+ export declare const Component: Story;
7
+ export declare const ComponentDark: Story;
8
+ export declare const Loading: Story;
9
+ export declare const CustomLabels: Story;
@@ -1,2 +1,3 @@
1
1
  export * from './ConfirmationDialog';
2
2
  export * from './ConfirmationService';
3
+ export { ConfirmationButtons } from './ConfirmationButtons';
@@ -1,10 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { DialogProps } from '@mui/material';
3
+ import { Size } from '../DraggableResizable';
3
4
  export type DialogAction = 'CLOSED';
4
5
  export interface CustomDialogProps extends DialogProps {
5
6
  description?: string;
6
7
  actions?: React.ReactNode;
7
8
  onClose: (reason: DialogAction) => void;
9
+ isResizable?: boolean;
10
+ resizableDefaultSize?: Size;
11
+ hasLayout?: boolean;
12
+ shouldRenderInline?: boolean;
8
13
  }
9
14
  export declare const CustomDialog: React.FC<CustomDialogProps>;
10
15
  export default CustomDialog;
@@ -1,13 +1,16 @@
1
1
  import * as React from 'react';
2
+ import type { StoryObj } from '@storybook/react';
3
+ import { CustomDialog } from './CustomDialog';
2
4
  declare const _default: {
3
5
  title: string;
4
- };
5
- export default _default;
6
- export declare const CustomDialogLight: {
7
- (): React.ReactElement;
8
- tags: string[];
9
- };
10
- export declare const CustomDialogDark: {
11
- (): React.ReactElement;
6
+ component: React.FC<import("./CustomDialog").CustomDialogProps>;
12
7
  tags: string[];
13
8
  };
9
+ export default _default;
10
+ type Story = StoryObj<typeof CustomDialog>;
11
+ export declare const CustomDialogLight: Story;
12
+ export declare const CustomDialogDark: Story;
13
+ export declare const CustomDialogResizable: Story;
14
+ export declare const CustomDialogResizableWithInitialSize: Story;
15
+ export declare const CustomDialogRenderInline: Story;
16
+ export declare const CustomDialogResizableNoLayout: Story;
@@ -33,6 +33,7 @@ export interface ConfigType {
33
33
  GW_FEATURE_DISPLAY_SEARCH_ON_MAP?: boolean;
34
34
  GW_FEATURE_INITIALIZE_SENTRY?: boolean;
35
35
  GW_FEATURE_ENABLE_SPECIAL_THEMES?: boolean;
36
+ GW_FEATURE_TAF_AUTOTAF_ENABLED?: boolean;
36
37
  GW_LANGUAGE?: string;
37
38
  }
38
39
  export interface TimeSeriesService {
@@ -80,6 +81,10 @@ export interface PlotParameter {
80
81
  collectionId: string;
81
82
  instanceId?: string;
82
83
  instances?: EDRInstance[];
84
+ dimension?: {
85
+ id: string;
86
+ value: string;
87
+ };
83
88
  }
84
89
  export type PlotType = 'bar' | 'line' | 'scatter';
85
90
  export interface EDRInstance {
@@ -115,3 +120,8 @@ export interface EDRInstance {
115
120
  };
116
121
  };
117
122
  }
123
+ export interface TimeSeriesPresetLocation {
124
+ lat: number;
125
+ lon: number;
126
+ name: string;
127
+ }