@opengeoweb/shared 11.0.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.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,6 +35,7 @@ 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",
38
39
  "shared-mouseover-selected-time": "Mouseover to change selected time",
39
40
  "shared-mouseover-on-off": "Mouseover switch on/off",
40
41
  "shared-change-timestep-or-speed": "Change time step or animation speed",
@@ -95,6 +96,7 @@ var fi = {
95
96
  "shared-toggle-timeslider": "Kytke TimeSlider näkyville/pois näkyvistä",
96
97
  "shared-timeslider-scale": "Muuta TimeSliderin näkyvää aikaväliä",
97
98
  "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ä",
98
100
  "shared-mouseover-selected-time": "Osoita ja liikuta hiirtä muuttaaksesi valittua aikaa",
99
101
  "shared-mouseover-on-off": "Kytke hiiren vaikutus TimeSlideriin päälle/pois päältä",
100
102
  "shared-change-timestep-or-speed": "Muuta aika-askelta tai animaation nopeutta",
@@ -155,6 +157,7 @@ var no = {
155
157
  "shared-toggle-timeslider": "Vis/skjul tidslinje",
156
158
  "shared-timeslider-scale": "Endre tidsseriens skala (synlig tidsperiode)",
157
159
  "shared-expand-timeslider-scale": "Utvid/krymp tidsseriens skala (synlig tidsperiode)",
160
+ "shared-toggle-layerinformation": "Vis/skjul laginformasjon",
158
161
  "shared-mouseover-selected-time": "Mouseover for å endre valgt tid",
159
162
  "shared-mouseover-on-off": "Mouseover av/på",
160
163
  "shared-change-timestep-or-speed": "Endre tidssteg eller animasjonsfart",
@@ -215,6 +218,7 @@ var nl = {
215
218
  "shared-toggle-timeslider": "Timeslider verbergen/tonen",
216
219
  "shared-timeslider-scale": "Timeslider zichtbare periode wijzigen",
217
220
  "shared-expand-timeslider-scale": "Timeslider zichtbare periode vergroten/verkleinen",
221
+ "shared-toggle-layerinformation": "Laag informatie verbergen/tonen",
218
222
  "shared-mouseover-selected-time": "Mouseover om de geselecteerde tijd te wijzigen",
219
223
  "shared-mouseover-on-off": "Mouseover aan / uit zetten",
220
224
  "shared-change-timestep-or-speed": "Wijzig tijdsinterval of animatiesnelheid",
@@ -748,18 +752,222 @@ var CustomIconButtonNoMemo = /*#__PURE__*/React.forwardRef(function (_ref, ref)
748
752
  });
749
753
  var CustomIconButton = /*#__PURE__*/React.memo(CustomIconButtonNoMemo);
750
754
 
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,
755
+ var _excluded$c = ["bounds", "setIsDragging", "children", "onStop"];
756
+ var DraggableComponent$1 = function DraggableComponent(_ref) {
757
+ var _ref$bounds = _ref.bounds,
758
+ bounds = _ref$bounds === void 0 ? 'body' : _ref$bounds,
759
+ setIsDragging = _ref.setIsDragging,
759
760
  children = _ref.children,
760
- sx = _ref.sx,
761
- other = _objectWithoutPropertiesLoose(_ref, _excluded$c);
762
- return jsxs(Dialog, Object.assign({
761
+ onStop = _ref.onStop,
762
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
763
+ var onDragStart = function onDragStart(e) {
764
+ // This makes sure that nothing is selected during drag
765
+ setIsDragging && setIsDragging(true);
766
+ e.preventDefault();
767
+ };
768
+ var onDragStop = function onDragStop(event, pos) {
769
+ setIsDragging && setIsDragging(false);
770
+ onStop && onStop(event, pos);
771
+ };
772
+ return jsx(Draggable, Object.assign({
773
+ bounds: bounds
774
+ }, props, {
775
+ onStop: function onStop(event, pos) {
776
+ return onDragStop(event, pos);
777
+ },
778
+ enableUserSelectHack: false,
779
+ onStart: onDragStart,
780
+ children: children
781
+ }));
782
+ };
783
+
784
+ var _excluded$b = ["children", "onResizeStart", "onResizeStop", "size", "setSize", "minHeight", "minWidth", "enable", "nodeRef"];
785
+ var isDraggingClassName = 'is-dragging';
786
+ var useBoundsProps = function useBoundsProps(nodeRef) {
787
+ var _React$useState = React__default.useState({}),
788
+ boundsProps = _React$useState[0],
789
+ setBoundsProps = _React$useState[1];
790
+ React__default.useEffect(function () {
791
+ if (nodeRef) {
792
+ var _nodeRef$current;
793
+ setBoundsProps({
794
+ bounds: nodeRef == null || (_nodeRef$current = nodeRef.current) == null ? void 0 : _nodeRef$current.parentNode,
795
+ boundsByDirection: true
796
+ });
797
+ }
798
+ // eslint-disable-next-line react-hooks/exhaustive-deps
799
+ }, []);
800
+ return boundsProps;
801
+ };
802
+ var ResizeComponent = function ResizeComponent(_ref) {
803
+ var children = _ref.children,
804
+ _ref$onResizeStart = _ref.onResizeStart,
805
+ onResizeStart = _ref$onResizeStart === void 0 ? function () {} : _ref$onResizeStart,
806
+ _ref$onResizeStop = _ref.onResizeStop,
807
+ onResizeStop = _ref$onResizeStop === void 0 ? function () {} : _ref$onResizeStop,
808
+ size = _ref.size,
809
+ _ref$setSize = _ref.setSize,
810
+ setSize = _ref$setSize === void 0 ? function () {} : _ref$setSize,
811
+ _ref$minHeight = _ref.minHeight,
812
+ minHeight = _ref$minHeight === void 0 ? 50 : _ref$minHeight,
813
+ _ref$minWidth = _ref.minWidth,
814
+ minWidth = _ref$minWidth === void 0 ? 50 : _ref$minWidth,
815
+ _ref$enable = _ref.enable,
816
+ enable = _ref$enable === void 0 ? {
817
+ top: false,
818
+ right: false,
819
+ bottom: false,
820
+ left: false,
821
+ topRight: true,
822
+ bottomRight: true,
823
+ bottomLeft: true,
824
+ topLeft: true
825
+ } : _ref$enable,
826
+ nodeRef = _ref.nodeRef,
827
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
828
+ var theme = useTheme();
829
+ var onStartResize = React__default.useCallback(function (event, _direction, node) {
830
+ event.stopPropagation();
831
+ node.classList.add(isDraggingClassName);
832
+ var _node$getBoundingClie = node.getBoundingClientRect(),
833
+ width = _node$getBoundingClie.width,
834
+ height = _node$getBoundingClie.height;
835
+ setSize({
836
+ width: width,
837
+ height: height
838
+ });
839
+ // fix for when initial maxHeight gets cleared
840
+ // eslint-disable-next-line no-param-reassign
841
+ node.style.height = height + "px";
842
+ onResizeStart();
843
+ }, [onResizeStart, setSize]);
844
+ var onStopResize = React__default.useCallback(function (event, direction, node, delta) {
845
+ node.classList.remove(isDraggingClassName);
846
+ if (!size) {
847
+ return;
848
+ }
849
+ var width = parseInt(size.width, 10) + delta.width;
850
+ var height = parseInt(size.height, 10) + delta.height;
851
+ setSize({
852
+ width: width,
853
+ height: height
854
+ });
855
+ onResizeStop(event, direction, node, delta);
856
+ }, [setSize, onResizeStop, size]);
857
+ var boundsProps = useBoundsProps(nodeRef);
858
+ return jsx(Resizable, Object.assign({
859
+ minHeight: minHeight,
860
+ minWidth: minWidth,
861
+ size: size,
862
+ onResizeStop: onStopResize
863
+ }, boundsProps, {
864
+ handleComponent: {
865
+ bottomRight: jsx(Resize, {
866
+ style: {
867
+ fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
868
+ },
869
+ sx: {
870
+ display: 'none'
871
+ },
872
+ className: "resizableHandle"
873
+ }),
874
+ bottomLeft: jsx(Resize, {
875
+ isRightAligned: true,
876
+ style: {
877
+ fill: "" + theme.palette.geowebColors.buttons.flat["default"].color
878
+ },
879
+ sx: {
880
+ display: 'none'
881
+ },
882
+ className: "resizableHandle"
883
+ })
884
+ },
885
+ enable: enable,
886
+ onResizeStart: onStartResize
887
+ }, props, {
888
+ children: children
889
+ }));
890
+ };
891
+
892
+ var _excluded$a = ["defaultSize", "onResizeStop", "hasLayout"],
893
+ _excluded2$2 = ["title", "onClose", "description", "actions", "children", "sx", "resizableDefaultSize", "isResizable", "hasLayout", "shouldRenderInline", "slotProps"];
894
+ var PaperComponent = function PaperComponent(_ref) {
895
+ var _ref$defaultSize = _ref.defaultSize,
896
+ defaultSize = _ref$defaultSize === void 0 ? {
897
+ width: 'auto',
898
+ height: undefined
899
+ } : _ref$defaultSize,
900
+ onResize = _ref.onResizeStop,
901
+ _ref$hasLayout = _ref.hasLayout,
902
+ hasLayout = _ref$hasLayout === void 0 ? true : _ref$hasLayout,
903
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
904
+ var maxWidth = '98%';
905
+ var maxHeight = '98%';
906
+ return jsx(ResizeComponent, Object.assign({
907
+ size: defaultSize,
908
+ maxWidth: maxWidth,
909
+ maxHeight: maxHeight,
910
+ minHeight: 120,
911
+ minWidth: 280,
912
+ style: {
913
+ display: 'flex',
914
+ alignItems: 'center',
915
+ justifyContent: 'center'
916
+ }
917
+ }, onResize && {
918
+ onResizeStop: function onResizeStop(_event, _direction, elementRef) {
919
+ var _elementRef$getBoundi = elementRef.getBoundingClientRect(),
920
+ width = _elementRef$getBoundi.width,
921
+ height = _elementRef$getBoundi.height;
922
+ onResize({
923
+ width: width,
924
+ height: height
925
+ });
926
+ }
927
+ }, {
928
+ enable: {
929
+ top: true,
930
+ right: true,
931
+ bottom: true,
932
+ left: true,
933
+ topRight: true,
934
+ bottomRight: true,
935
+ bottomLeft: true,
936
+ topLeft: true
937
+ },
938
+ children: hasLayout ? jsx(Paper, Object.assign({}, props, {
939
+ sx: {
940
+ margin: '0px!important',
941
+ width: '100%!important',
942
+ height: '100%!important',
943
+ maxHeight: '100%!important',
944
+ maxWidth: '100%!important'
945
+ }
946
+ })) : props.children
947
+ }));
948
+ };
949
+ var CustomDialog = function CustomDialog(_ref2) {
950
+ var title = _ref2.title,
951
+ _onClose = _ref2.onClose,
952
+ _ref2$description = _ref2.description,
953
+ description = _ref2$description === void 0 ? '' : _ref2$description,
954
+ _ref2$actions = _ref2.actions,
955
+ actions = _ref2$actions === void 0 ? null : _ref2$actions,
956
+ children = _ref2.children,
957
+ sx = _ref2.sx,
958
+ resizableDefaultSize = _ref2.resizableDefaultSize,
959
+ _ref2$isResizable = _ref2.isResizable,
960
+ isResizable = _ref2$isResizable === void 0 ? false : _ref2$isResizable,
961
+ _ref2$hasLayout = _ref2.hasLayout,
962
+ hasLayout = _ref2$hasLayout === void 0 ? true : _ref2$hasLayout,
963
+ _ref2$shouldRenderInl = _ref2.shouldRenderInline,
964
+ shouldRenderInline = _ref2$shouldRenderInl === void 0 ? false : _ref2$shouldRenderInl,
965
+ slotProps = _ref2.slotProps,
966
+ other = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
967
+ var _React$useState = React.useState(resizableDefaultSize),
968
+ size = _React$useState[0],
969
+ setSize = _React$useState[1];
970
+ return jsx(Dialog, Object.assign({
763
971
  "data-testid": "customDialog",
764
972
  PaperProps: {
765
973
  sx: Object.assign({
@@ -772,58 +980,82 @@ var CustomDialog = function CustomDialog(_ref) {
772
980
  onClose: function onClose() {
773
981
  _onClose('CLOSED');
774
982
  },
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'
983
+ "aria-labelledby": "dialog-title",
984
+ slotProps: Object.assign({}, slotProps, isResizable && {
985
+ paper: {
986
+ defaultSize: size,
987
+ onResizeStop: setSize,
988
+ hasLayout: hasLayout
989
+ }
990
+ }, shouldRenderInline && {
991
+ root: {
992
+ style: {
993
+ position: 'absolute'
994
+ }
785
995
  },
786
- children: [jsx(Typography, {
996
+ backdrop: {
997
+ style: {
998
+ position: 'absolute'
999
+ }
1000
+ }
1001
+ })
1002
+ }, isResizable && {
1003
+ PaperComponent: PaperComponent
1004
+ }, shouldRenderInline && {
1005
+ disablePortal: true
1006
+ }, other, {
1007
+ children: hasLayout ? jsxs(Fragment, {
1008
+ children: [jsxs(DialogTitle, {
1009
+ id: "dialog-title",
787
1010
  sx: {
788
- fontSize: '16px',
789
- fontWeight: 500
1011
+ zIndex: 1,
1012
+ padding: 2,
1013
+ display: 'flex',
1014
+ justifyContent: 'space-between',
1015
+ alignItems: 'center'
790
1016
  },
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');
1017
+ children: [jsx(Typography, {
1018
+ sx: {
1019
+ fontSize: '16px',
1020
+ fontWeight: 500
1021
+ },
1022
+ "data-testid": "customDialog-title",
1023
+ component: "span",
1024
+ children: title
1025
+ }), jsx(CustomIconButton, {
1026
+ "data-testid": "customDialog-close",
1027
+ "aria-label": "close",
1028
+ onClick: function onClick() {
1029
+ return _onClose('CLOSED');
1030
+ },
1031
+ sx: {
1032
+ '&.MuiIconButton-root': {
1033
+ color: 'geowebColors.greys.accessible'
1034
+ }
1035
+ },
1036
+ children: jsx(Close, {
1037
+ "data-testid": "CloseIcon"
1038
+ })
1039
+ })]
1040
+ }), jsxs(DialogContent, {
1041
+ sx: {
1042
+ padding: '8px 16px'
799
1043
  },
1044
+ children: [description && jsx(Typography, {
1045
+ variant: "body1",
1046
+ children: description
1047
+ }), children]
1048
+ }), jsx(DialogActions, {
800
1049
  sx: {
801
- '&.MuiIconButton-root': {
802
- color: 'geowebColors.greys.accessible'
1050
+ padding: 2,
1051
+ flexDirection: {
1052
+ xs: 'column',
1053
+ sm: 'row'
803
1054
  }
804
1055
  },
805
- children: jsx(Close, {
806
- "data-testid": "CloseIcon"
807
- })
1056
+ children: actions
808
1057
  })]
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
- })]
1058
+ }) : children
827
1059
  }));
828
1060
  };
829
1061
 
@@ -849,8 +1081,6 @@ var useSharedTranslation = function useSharedTranslation() {
849
1081
  return useTranslation([SHARED_NAMESPACE]);
850
1082
  };
851
1083
 
852
- var _excluded$b = ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"],
853
- _excluded2$1 = ["catchOnCancel"];
854
1084
  var confirmStyle = {
855
1085
  width: {
856
1086
  xs: '100%',
@@ -869,6 +1099,67 @@ var confirmStyle = {
869
1099
  sm: 0
870
1100
  }
871
1101
  };
1102
+ var ConfirmationButtons = function ConfirmationButtons(_ref) {
1103
+ var onClose = _ref.onClose,
1104
+ cancelLabel = _ref.cancelLabel,
1105
+ isLoading = _ref.isLoading,
1106
+ onSubmit = _ref.onSubmit,
1107
+ disableAutoFocus = _ref.disableAutoFocus,
1108
+ confirmLabel = _ref.confirmLabel;
1109
+ var _useSharedTranslation = useSharedTranslation(),
1110
+ t = _useSharedTranslation.t;
1111
+ return jsxs(Fragment, {
1112
+ children: [jsx(Button, {
1113
+ "data-testid": "confirmationDialog-cancel",
1114
+ variant: "tertiary",
1115
+ sx: function sx(theme) {
1116
+ return {
1117
+ width: {
1118
+ xs: '100%',
1119
+ sm: '150px'
1120
+ },
1121
+ '&:focus': {
1122
+ outline: theme.palette.geowebColors.buttons.primary.focus.outline,
1123
+ borderColor: 'transparent'
1124
+ }
1125
+ };
1126
+ },
1127
+ onClick: function onClick() {
1128
+ return onClose('CANCELLED');
1129
+ },
1130
+ children: cancelLabel != null ? cancelLabel : t('shared-confirmation-cancel')
1131
+ }), isLoading ? jsx(Box, {
1132
+ "data-testid": "confirm-dialog-spinner",
1133
+ sx: Object.assign({}, confirmStyle, {
1134
+ height: '40px',
1135
+ display: 'flex',
1136
+ justifyContent: 'center',
1137
+ alignItems: 'center'
1138
+ }),
1139
+ children: jsx(CircularProgress, {
1140
+ size: 40,
1141
+ color: "secondary"
1142
+ })
1143
+ }) : jsx(Button, {
1144
+ "data-testid": "confirmationDialog-confirm",
1145
+ variant: "primary",
1146
+ sx: function sx(theme) {
1147
+ return Object.assign({}, confirmStyle, {
1148
+ '&:focus': {
1149
+ outline: theme.palette.geowebColors.buttons.primary.focus.outline,
1150
+ borderColor: 'transparent'
1151
+ }
1152
+ });
1153
+ },
1154
+ onClick: onSubmit,
1155
+ autoFocus: !disableAutoFocus,
1156
+ children: confirmLabel != null ? confirmLabel : t('shared-confirmation-submit')
1157
+ })]
1158
+ });
1159
+ };
1160
+
1161
+ var _excluded$9 = ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"],
1162
+ _excluded2$1 = ["catchOnCancel"];
872
1163
  var ConfirmationDialog = function ConfirmationDialog(_ref) {
873
1164
  var open = _ref.open,
874
1165
  title = _ref.title,
@@ -883,7 +1174,7 @@ var ConfirmationDialog = function ConfirmationDialog(_ref) {
883
1174
  disableAutoFocus = _ref$disableAutoFocus === void 0 ? false : _ref$disableAutoFocus,
884
1175
  _ref$isLoading = _ref.isLoading,
885
1176
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
886
- other = _objectWithoutPropertiesLoose(_ref, _excluded$b);
1177
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$9);
887
1178
  other.catchOnCancel;
888
1179
  var rest = _objectWithoutPropertiesLoose(other, _excluded2$1); // remove unwanted props
889
1180
  var _useSharedTranslation = useSharedTranslation(),
@@ -894,55 +1185,13 @@ var ConfirmationDialog = function ConfirmationDialog(_ref) {
894
1185
  title: title,
895
1186
  description: description != null ? description : t('shared-confirmation-description'),
896
1187
  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
- })]
1188
+ actions: jsx(ConfirmationButtons, {
1189
+ onClose: onClose,
1190
+ cancelLabel: cancelLabel,
1191
+ isLoading: isLoading,
1192
+ onSubmit: onSubmit,
1193
+ disableAutoFocus: disableAutoFocus,
1194
+ confirmLabel: confirmLabel
946
1195
  })
947
1196
  }, rest, {
948
1197
  children: content
@@ -1625,143 +1874,6 @@ var AppHeader = function AppHeader(_ref) {
1625
1874
  });
1626
1875
  };
1627
1876
 
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
1877
  // 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
1878
  /**
1767
1879
  * ErrorBoundary
@@ -2002,12 +2114,20 @@ var MenuItemTheme = function MenuItemTheme(_ref) {
2002
2114
  checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.DARK_THEME
2003
2115
  }),
2004
2116
  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"
2117
+ }), enableSpecialThemes && jsxs(Fragment, {
2118
+ children: [jsx(FormControlLabel, {
2119
+ value: ThemeTypes.DEMO_THEME,
2120
+ control: jsx(Radio, {
2121
+ checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.DEMO_THEME
2122
+ }),
2123
+ label: "Demo"
2124
+ }), jsx(FormControlLabel, {
2125
+ value: ThemeTypes.XMAS2024_THEME,
2126
+ control: jsx(Radio, {
2127
+ checked: (namedTheme == null ? void 0 : namedTheme.name) === ThemeTypes.XMAS2024_THEME
2128
+ }),
2129
+ label: t('shared-xmas') + " 2024"
2130
+ })]
2011
2131
  })]
2012
2132
  })
2013
2133
  })]
@@ -2858,6 +2978,12 @@ var ShortcutList = function ShortcutList(_ref) {
2858
2978
  children: jsx(ArrowLeft, {})
2859
2979
  })]
2860
2980
  })
2981
+ }, {
2982
+ titleKey: 'shared-toggle-layerinformation',
2983
+ description: jsx(ShortCutSegment, {
2984
+ type: "icon",
2985
+ children: "D"
2986
+ })
2861
2987
  }, {
2862
2988
  titleKey: 'shared-change-layer-values-scrolling',
2863
2989
  description: jsxs(Fragment, {
@@ -5882,4 +6008,4 @@ var PresetScope = Object.assign({}, SystemScope, {
5882
6008
  shared: 'shared'
5883
6009
  });
5884
6010
 
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 };
6011
+ 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": "12.0.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,22 +8,25 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/theme": "*",
12
- "react-draggable": "^4.4.6",
13
- "re-resizable": "^6.9.11",
14
- "lodash": "^4.17.21",
11
+ "@emotion/react": "11.14.0",
12
+ "@emotion/styled": "11.14.0",
13
+ "@mui/material": "^6.1.1",
14
+ "@mui/system": "6.4.6",
15
+ "@mui/x-date-pickers": "7.27.1",
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",
15
21
  "axios": "^1.7.7",
16
22
  "date-fns": "^4.1.0",
17
- "@reduxjs/toolkit": "^1.9.7",
18
- "react-i18next": "^15.1.1",
19
23
  "i18next": "^23.11.5",
20
- "@sentry/react": "^8.34.0",
21
- "@mui/material": "^6.1.1"
22
- },
23
- "peerDependencies": {
24
- "react": "18",
25
- "@emotion/react": "*",
26
- "@emotion/styled": "*"
24
+ "jest-date-mock": "1.0.10",
25
+ "lodash": "^4.17.21",
26
+ "re-resizable": "^6.9.11",
27
+ "react": "18.3.1",
28
+ "react-draggable": "^4.4.6",
29
+ "react-i18next": "^15.1.1"
27
30
  },
28
31
  "module": "./index.esm.js",
29
32
  "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;
@@ -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
+ }