@opengeoweb/shared 10.2.1-spike-ol.3 → 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';
@@ -35,7 +35,6 @@ var en = {
35
35
  "shared-toggle-timeslider": "Toggle hide/show time slider",
36
36
  "shared-timeslider-scale": "Change time slider scale (visible timespan)",
37
37
  "shared-expand-timeslider-scale": "Expand/shrink time slider scale (visible timespan)",
38
- "shared-toggle-layerinformation": "Toggle hide/show layer information",
39
38
  "shared-mouseover-selected-time": "Mouseover to change selected time",
40
39
  "shared-mouseover-on-off": "Mouseover switch on/off",
41
40
  "shared-change-timestep-or-speed": "Change time step or animation speed",
@@ -96,7 +95,6 @@ var fi = {
96
95
  "shared-toggle-timeslider": "Kytke TimeSlider näkyville/pois näkyvistä",
97
96
  "shared-timeslider-scale": "Muuta TimeSliderin näkyvää aikaväliä",
98
97
  "shared-expand-timeslider-scale": "Laajenna/kutista TimeSliderin mittakaavaa (näkyvää aikaväliä)",
99
- "shared-toggle-layerinformation": "Kytke karttatasojen pikanäyttö näkyville/pois näkyvistä",
100
98
  "shared-mouseover-selected-time": "Osoita ja liikuta hiirtä muuttaaksesi valittua aikaa",
101
99
  "shared-mouseover-on-off": "Kytke hiiren vaikutus TimeSlideriin päälle/pois päältä",
102
100
  "shared-change-timestep-or-speed": "Muuta aika-askelta tai animaation nopeutta",
@@ -157,7 +155,6 @@ var no = {
157
155
  "shared-toggle-timeslider": "Vis/skjul tidslinje",
158
156
  "shared-timeslider-scale": "Endre tidsseriens skala (synlig tidsperiode)",
159
157
  "shared-expand-timeslider-scale": "Utvid/krymp tidsseriens skala (synlig tidsperiode)",
160
- "shared-toggle-layerinformation": "Vis/skjul laginformasjon",
161
158
  "shared-mouseover-selected-time": "Mouseover for å endre valgt tid",
162
159
  "shared-mouseover-on-off": "Mouseover av/på",
163
160
  "shared-change-timestep-or-speed": "Endre tidssteg eller animasjonsfart",
@@ -218,7 +215,6 @@ var nl = {
218
215
  "shared-toggle-timeslider": "Timeslider verbergen/tonen",
219
216
  "shared-timeslider-scale": "Timeslider zichtbare periode wijzigen",
220
217
  "shared-expand-timeslider-scale": "Timeslider zichtbare periode vergroten/verkleinen",
221
- "shared-toggle-layerinformation": "Laag informatie verbergen/tonen",
222
218
  "shared-mouseover-selected-time": "Mouseover om de geselecteerde tijd te wijzigen",
223
219
  "shared-mouseover-on-off": "Mouseover aan / uit zetten",
224
220
  "shared-change-timestep-or-speed": "Wijzig tijdsinterval of animatiesnelheid",
@@ -752,18 +748,222 @@ var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref)
752
748
  });
753
749
  var CustomIconButton = /*#__PURE__*/React.memo(CustomIconButtonNoMemo);
754
750
 
755
- var _excluded$c = ["title", "onClose", "description", "actions", "children", "sx"];
756
- var CustomDialog = function CustomDialog(_ref) {
757
- var title = _ref.title,
758
- _onClose = _ref.onClose,
759
- _ref$description = _ref.description,
760
- description = _ref$description === void 0 ? '' : _ref$description,
761
- _ref$actions = _ref.actions,
762
- 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,
763
756
  children = _ref.children,
764
- sx = _ref.sx,
765
- other = _objectWithoutPropertiesLoose(_ref, _excluded$c);
766
- 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({
767
967
  "data-testid": "customDialog",
768
968
  PaperProps: {
769
969
  sx: Object.assign({
@@ -776,58 +976,82 @@ var CustomDialog = function CustomDialog(_ref) {
776
976
  onClose: function onClose() {
777
977
  _onClose('CLOSED');
778
978
  },
779
- "aria-labelledby": "dialog-title"
780
- }, other, {
781
- children: [jsxs(DialogTitle, {
782
- id: "dialog-title",
783
- sx: {
784
- zIndex: 1,
785
- padding: 2,
786
- display: 'flex',
787
- justifyContent: 'space-between',
788
- 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
+ }
789
991
  },
790
- 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",
791
1006
  sx: {
792
- fontSize: '16px',
793
- fontWeight: 500
1007
+ zIndex: 1,
1008
+ padding: 2,
1009
+ display: 'flex',
1010
+ justifyContent: 'space-between',
1011
+ alignItems: 'center'
794
1012
  },
795
- "data-testid": "customDialog-title",
796
- component: "span",
797
- children: title
798
- }), jsx(CustomIconButton, {
799
- "data-testid": "customDialog-close",
800
- "aria-label": "close",
801
- onClick: function onClick() {
802
- 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'
803
1039
  },
1040
+ children: [description && jsx(Typography, {
1041
+ variant: "body1",
1042
+ children: description
1043
+ }), children]
1044
+ }), jsx(DialogActions, {
804
1045
  sx: {
805
- '&.MuiIconButton-root': {
806
- color: 'geowebColors.greys.accessible'
1046
+ padding: 2,
1047
+ flexDirection: {
1048
+ xs: 'column',
1049
+ sm: 'row'
807
1050
  }
808
1051
  },
809
- children: jsx(Close, {
810
- "data-testid": "CloseIcon"
811
- })
1052
+ children: actions
812
1053
  })]
813
- }), jsxs(DialogContent, {
814
- sx: {
815
- padding: '8px 16px'
816
- },
817
- children: [description && jsx(Typography, {
818
- variant: "body1",
819
- children: description
820
- }), children]
821
- }), jsx(DialogActions, {
822
- sx: {
823
- padding: 2,
824
- flexDirection: {
825
- xs: 'column',
826
- sm: 'row'
827
- }
828
- },
829
- children: actions
830
- })]
1054
+ }) : children
831
1055
  }));
832
1056
  };
833
1057
 
@@ -853,8 +1077,6 @@ var useSharedTranslation = function useSharedTranslation() {
853
1077
  return useTranslation([SHARED_NAMESPACE]);
854
1078
  };
855
1079
 
856
- var _excluded$b = ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"],
857
- _excluded2$1 = ["catchOnCancel"];
858
1080
  var confirmStyle = {
859
1081
  width: {
860
1082
  xs: '100%',
@@ -873,6 +1095,67 @@ var confirmStyle = {
873
1095
  sm: 0
874
1096
  }
875
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"];
876
1159
  var ConfirmationDialog = function ConfirmationDialog(_ref) {
877
1160
  var open = _ref.open,
878
1161
  title = _ref.title,
@@ -887,7 +1170,7 @@ var ConfirmationDialog = function ConfirmationDialog(_ref) {
887
1170
  disableAutoFocus = _ref$disableAutoFocus === void 0 ? false : _ref$disableAutoFocus,
888
1171
  _ref$isLoading = _ref.isLoading,
889
1172
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
890
- other = _objectWithoutPropertiesLoose(_ref, _excluded$b);
1173
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$9);
891
1174
  other.catchOnCancel;
892
1175
  var rest = _objectWithoutPropertiesLoose(other, _excluded2$1); // remove unwanted props
893
1176
  var _useSharedTranslation = useSharedTranslation(),
@@ -898,55 +1181,13 @@ var ConfirmationDialog = function ConfirmationDialog(_ref) {
898
1181
  title: title,
899
1182
  description: description != null ? description : t('shared-confirmation-description'),
900
1183
  onClose: onClose,
901
- actions: jsxs(Fragment, {
902
- children: [jsx(Button, {
903
- "data-testid": "confirmationDialog-cancel",
904
- variant: "tertiary",
905
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
906
- sx: function sx(theme) {
907
- return {
908
- width: {
909
- xs: '100%',
910
- sm: '150px'
911
- },
912
- '&:focus': {
913
- outline: theme.palette.geowebColors.buttons.primary.focus.outline,
914
- borderColor: 'transparent'
915
- }
916
- };
917
- },
918
- onClick: function onClick() {
919
- return onClose('CANCELLED');
920
- },
921
- children: cancelLabel != null ? cancelLabel : t('shared-confirmation-cancel')
922
- }), isLoading ? jsx(Box, {
923
- "data-testid": "confirm-dialog-spinner",
924
- sx: Object.assign({}, confirmStyle, {
925
- height: '40px',
926
- display: 'flex',
927
- justifyContent: 'center',
928
- alignItems: 'center'
929
- }),
930
- children: jsx(CircularProgress, {
931
- size: 40,
932
- color: "secondary"
933
- })
934
- }) : jsx(Button, {
935
- "data-testid": "confirmationDialog-confirm",
936
- variant: "primary",
937
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
938
- sx: function sx(theme) {
939
- return Object.assign({}, confirmStyle, {
940
- '&:focus': {
941
- outline: theme.palette.geowebColors.buttons.primary.focus.outline,
942
- borderColor: 'transparent'
943
- }
944
- });
945
- },
946
- onClick: onSubmit,
947
- autoFocus: !disableAutoFocus,
948
- children: confirmLabel != null ? confirmLabel : t('shared-confirmation-submit')
949
- })]
1184
+ actions: jsx(ConfirmationButtons, {
1185
+ onClose: onClose,
1186
+ cancelLabel: cancelLabel,
1187
+ isLoading: isLoading,
1188
+ onSubmit: onSubmit,
1189
+ disableAutoFocus: disableAutoFocus,
1190
+ confirmLabel: confirmLabel
950
1191
  })
951
1192
  }, rest, {
952
1193
  children: content
@@ -1629,143 +1870,6 @@ var AppHeader = function AppHeader(_ref) {
1629
1870
  });
1630
1871
  };
1631
1872
 
1632
- var _excluded$a = ["bounds", "setIsDragging", "children", "onStop"];
1633
- var DraggableComponent$1 = function DraggableComponent(_ref) {
1634
- var _ref$bounds = _ref.bounds,
1635
- bounds = _ref$bounds === void 0 ? 'body' : _ref$bounds,
1636
- setIsDragging = _ref.setIsDragging,
1637
- children = _ref.children,
1638
- onStop = _ref.onStop,
1639
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
1640
- var onDragStart = function onDragStart(e) {
1641
- // This makes sure that nothing is selected during drag
1642
- setIsDragging && setIsDragging(true);
1643
- e.preventDefault();
1644
- };
1645
- var onDragStop = function onDragStop(event, pos) {
1646
- setIsDragging && setIsDragging(false);
1647
- onStop && onStop(event, pos);
1648
- };
1649
- return jsx(Draggable, Object.assign({
1650
- bounds: bounds
1651
- }, props, {
1652
- onStop: function onStop(event, pos) {
1653
- return onDragStop(event, pos);
1654
- },
1655
- enableUserSelectHack: false,
1656
- onStart: onDragStart,
1657
- children: children
1658
- }));
1659
- };
1660
-
1661
- var _excluded$9 = ["children", "onResizeStart", "onResizeStop", "size", "setSize", "minHeight", "minWidth", "enable", "nodeRef"];
1662
- var isDraggingClassName = 'is-dragging';
1663
- var useBoundsProps = function useBoundsProps(nodeRef) {
1664
- var _React$useState = React__default.useState({}),
1665
- boundsProps = _React$useState[0],
1666
- setBoundsProps = _React$useState[1];
1667
- React__default.useEffect(function () {
1668
- if (nodeRef) {
1669
- var _nodeRef$current;
1670
- setBoundsProps({
1671
- bounds: nodeRef == null || (_nodeRef$current = nodeRef.current) == null ? void 0 : _nodeRef$current.parentNode,
1672
- boundsByDirection: true
1673
- });
1674
- }
1675
- // eslint-disable-next-line react-hooks/exhaustive-deps
1676
- }, []);
1677
- return boundsProps;
1678
- };
1679
- var ResizeComponent = function ResizeComponent(_ref) {
1680
- var children = _ref.children,
1681
- _ref$onResizeStart = _ref.onResizeStart,
1682
- onResizeStart = _ref$onResizeStart === void 0 ? function () {} : _ref$onResizeStart,
1683
- _ref$onResizeStop = _ref.onResizeStop,
1684
- onResizeStop = _ref$onResizeStop === void 0 ? function () {} : _ref$onResizeStop,
1685
- size = _ref.size,
1686
- _ref$setSize = _ref.setSize,
1687
- setSize = _ref$setSize === void 0 ? function () {} : _ref$setSize,
1688
- _ref$minHeight = _ref.minHeight,
1689
- minHeight = _ref$minHeight === void 0 ? 50 : _ref$minHeight,
1690
- _ref$minWidth = _ref.minWidth,
1691
- minWidth = _ref$minWidth === void 0 ? 50 : _ref$minWidth,
1692
- _ref$enable = _ref.enable,
1693
- enable = _ref$enable === void 0 ? {
1694
- top: false,
1695
- right: false,
1696
- bottom: false,
1697
- left: false,
1698
- topRight: true,
1699
- bottomRight: true,
1700
- bottomLeft: true,
1701
- topLeft: true
1702
- } : _ref$enable,
1703
- nodeRef = _ref.nodeRef,
1704
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
1705
- var theme = useTheme();
1706
- var onStartResize = React__default.useCallback(function (event, _direction, node) {
1707
- event.stopPropagation();
1708
- node.classList.add(isDraggingClassName);
1709
- var _node$getBoundingClie = node.getBoundingClientRect(),
1710
- width = _node$getBoundingClie.width,
1711
- height = _node$getBoundingClie.height;
1712
- setSize({
1713
- width: width,
1714
- height: height
1715
- });
1716
- // fix for when initial maxHeight gets cleared
1717
- // eslint-disable-next-line no-param-reassign
1718
- node.style.height = height + "px";
1719
- onResizeStart();
1720
- }, [onResizeStart, setSize]);
1721
- var onStopResize = React__default.useCallback(function (event, direction, node, delta) {
1722
- node.classList.remove(isDraggingClassName);
1723
- if (!size) {
1724
- return;
1725
- }
1726
- var width = parseInt(size.width, 10) + delta.width;
1727
- var height = parseInt(size.height, 10) + delta.height;
1728
- setSize({
1729
- width: width,
1730
- height: height
1731
- });
1732
- onResizeStop(event, direction, node, delta);
1733
- }, [setSize, onResizeStop, size]);
1734
- var boundsProps = useBoundsProps(nodeRef);
1735
- return jsx(Resizable, Object.assign({
1736
- minHeight: minHeight,
1737
- minWidth: minWidth,
1738
- size: size,
1739
- onResizeStop: onStopResize
1740
- }, boundsProps, {
1741
- handleComponent: {
1742
- bottomRight: jsx(Resize, {
1743
- style: {
1744
- fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
1745
- },
1746
- sx: {
1747
- display: 'none'
1748
- },
1749
- className: "resizableHandle"
1750
- }),
1751
- bottomLeft: jsx(Resize, {
1752
- isRightAligned: true,
1753
- style: {
1754
- fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
1755
- },
1756
- sx: {
1757
- display: 'none'
1758
- },
1759
- className: "resizableHandle"
1760
- })
1761
- },
1762
- enable: enable,
1763
- onResizeStart: onStartResize
1764
- }, props, {
1765
- children: children
1766
- }));
1767
- };
1768
-
1769
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.
1770
1874
  /**
1771
1875
  * ErrorBoundary
@@ -1974,7 +2078,8 @@ var UserMenu = function UserMenu(_ref) {
1974
2078
  });
1975
2079
  };
1976
2080
 
1977
- var MenuItemTheme = function MenuItemTheme() {
2081
+ var MenuItemTheme = function MenuItemTheme(_ref) {
2082
+ var enableSpecialThemes = _ref.enableSpecialThemes;
1978
2083
  var _useThemeContext = useThemeContext(),
1979
2084
  namedTheme = _useThemeContext.namedTheme,
1980
2085
  setThemeName = _useThemeContext.setThemeName;
@@ -2005,12 +2110,20 @@ var MenuItemTheme = function MenuItemTheme() {
2005
2110
  checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.DARK_THEME
2006
2111
  }),
2007
2112
  label: t('shared-dark')
2008
- }), jsx(FormControlLabel, {
2009
- value: ThemeTypes.XMAS2024_THEME,
2010
- control: jsx(Radio, {
2011
- checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.XMAS2024_THEME
2012
- }),
2013
- 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
+ })]
2014
2127
  })]
2015
2128
  })
2016
2129
  })]
@@ -2861,12 +2974,6 @@ var ShortcutList = function ShortcutList(_ref) {
2861
2974
  children: jsx(ArrowLeft, {})
2862
2975
  })]
2863
2976
  })
2864
- }, {
2865
- titleKey: 'shared-toggle-layerinformation',
2866
- description: jsx(ShortCutSegment, {
2867
- type: "icon",
2868
- children: "D"
2869
- })
2870
2977
  }, {
2871
2978
  titleKey: 'shared-change-layer-values-scrolling',
2872
2979
  description: jsxs(Fragment, {
@@ -5864,4 +5971,31 @@ var RenderCounter = /*#__PURE__*/function () {
5864
5971
  }();
5865
5972
  var renderCounter = new RenderCounter();
5866
5973
 
5867
- 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, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, StorybookDocsWrapper, SwitchButton, 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 };
5974
+ /* *
5975
+ * Licensed under the Apache License, Version 2.0 (the "License");
5976
+ * you may not use this file except in compliance with the License.
5977
+ * You may obtain a copy of the License at
5978
+ *
5979
+ * http://www.apache.org/licenses/LICENSE-2.0
5980
+ *
5981
+ * Unless required by applicable law or agreed to in writing, software
5982
+ * distributed under the License is distributed on an "AS IS" BASIS,
5983
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5984
+ * See the License for the specific language governing permissions and
5985
+ * limitations under the License.
5986
+ *
5987
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5988
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
5989
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
5990
+ * */
5991
+ // eslint-disable-next-line no-redeclare
5992
+ var SystemScope = {
5993
+ user: 'user',
5994
+ system: 'system'
5995
+ };
5996
+ // eslint-disable-next-line no-redeclare
5997
+ var PresetScope = Object.assign({}, SystemScope, {
5998
+ shared: 'shared'
5999
+ });
6000
+
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": "10.2.1-spike-ol.3",
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": {
@@ -8,26 +8,22 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@emotion/react": "11.14.0",
12
- "@emotion/styled": "11.14.0",
13
- "@mui/material": "^6.1.1",
14
- "@mui/system": "6.4.3",
15
- "@mui/x-date-pickers": "7.26.0",
16
- "@reduxjs/toolkit": "^1.9.7",
17
- "@sentry/react": "^8.34.0",
18
- "@storybook/react": "8.4.2",
19
- "@testing-library/react": "16.0.1",
20
- "@testing-library/user-event": "14.5.2",
11
+ "@opengeoweb/theme": "*",
12
+ "react-draggable": "^4.4.6",
13
+ "re-resizable": "^6.9.11",
14
+ "lodash": "^4.17.21",
21
15
  "axios": "^1.7.7",
22
16
  "date-fns": "^4.1.0",
17
+ "@reduxjs/toolkit": "^1.9.7",
18
+ "react-i18next": "^15.1.1",
23
19
  "i18next": "^23.11.5",
24
- "jest-date-mock": "1.0.10",
25
- "lodash": "^4.17.21",
26
- "msw": "1.3.3",
27
- "re-resizable": "^6.9.11",
28
- "react": "18.3.1",
29
- "react-draggable": "^4.4.6",
30
- "react-i18next": "^15.1.1"
20
+ "@sentry/react": "^8.34.0",
21
+ "@mui/material": "^6.1.1"
22
+ },
23
+ "peerDependencies": {
24
+ "react": "18",
25
+ "@emotion/react": "*",
26
+ "@emotion/styled": "*"
31
27
  },
32
28
  "module": "./index.esm.js",
33
29
  "type": "module",
@@ -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;
@@ -1,3 +1,6 @@
1
1
  import React from 'react';
2
- declare const MenuItemTheme: React.FC;
2
+ interface MenuItemThemeProps {
3
+ enableSpecialThemes?: boolean;
4
+ }
5
+ declare const MenuItemTheme: React.FC<MenuItemThemeProps>;
3
6
  export default MenuItemTheme;
@@ -32,6 +32,8 @@ export interface ConfigType {
32
32
  GW_FEATURE_MENU_FE_VERSION?: boolean;
33
33
  GW_FEATURE_DISPLAY_SEARCH_ON_MAP?: boolean;
34
34
  GW_FEATURE_INITIALIZE_SENTRY?: boolean;
35
+ GW_FEATURE_ENABLE_SPECIAL_THEMES?: boolean;
36
+ GW_FEATURE_TAF_AUTOTAF_ENABLED?: boolean;
35
37
  GW_LANGUAGE?: string;
36
38
  }
37
39
  export interface TimeSeriesService {
@@ -40,10 +42,20 @@ export interface TimeSeriesService {
40
42
  url: string;
41
43
  type: ServiceInterface;
42
44
  name: string;
43
- scope?: TimeseriesServiceScope;
45
+ scope?: SystemScope;
44
46
  }
45
47
  export type ServiceInterface = 'EDR' | 'OGC';
46
- export type TimeseriesServiceScope = 'user' | 'system';
48
+ export type SystemScope = 'user' | 'system';
49
+ export declare const SystemScope: {
50
+ readonly user: SystemScope;
51
+ readonly system: SystemScope;
52
+ };
53
+ export type PresetScope = SystemScope | 'shared';
54
+ export declare const PresetScope: {
55
+ readonly shared: PresetScope;
56
+ readonly user: SystemScope;
57
+ readonly system: SystemScope;
58
+ };
47
59
  export interface PlotPreset {
48
60
  connectedMap?: string;
49
61
  mapId: string;
@@ -69,6 +81,10 @@ export interface PlotParameter {
69
81
  collectionId: string;
70
82
  instanceId?: string;
71
83
  instances?: EDRInstance[];
84
+ dimension?: {
85
+ id: string;
86
+ value: string;
87
+ };
72
88
  }
73
89
  export type PlotType = 'bar' | 'line' | 'scatter';
74
90
  export interface EDRInstance {
@@ -104,3 +120,8 @@ export interface EDRInstance {
104
120
  };
105
121
  };
106
122
  }
123
+ export interface TimeSeriesPresetLocation {
124
+ lat: number;
125
+ lon: number;
126
+ name: string;
127
+ }