@opengeoweb/shared 10.0.0 → 10.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,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
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, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown, Search, Clear, Cached } from '@opengeoweb/theme';
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';
4
4
  import * as React from 'react';
5
5
  import React__default, { useRef, Component, useState } from 'react';
6
6
  import 'i18next';
@@ -9,7 +9,6 @@ import { throttle, escapeRegExp, debounce } from 'lodash';
9
9
  import Draggable from 'react-draggable';
10
10
  import { Resizable } from 're-resizable';
11
11
  import * as Sentry from '@sentry/react';
12
- import { useStore } from 'react-redux';
13
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';
14
13
  import { configureStore } from '@reduxjs/toolkit';
15
14
 
@@ -2104,8 +2103,6 @@ var ToolHeader = function ToolHeader(_ref) {
2104
2103
  leftHeaderComponent = _ref$leftHeaderCompon === void 0 ? null : _ref$leftHeaderCompon,
2105
2104
  _ref$rightHeaderCompo = _ref.rightHeaderComponent,
2106
2105
  rightHeaderComponent = _ref$rightHeaderCompo === void 0 ? null : _ref$rightHeaderCompo,
2107
- _ref$dragHandleIcon = _ref.dragHandleIcon,
2108
- dragHandleIcon = _ref$dragHandleIcon === void 0 ? jsx(DragHandle, {}) : _ref$dragHandleIcon,
2109
2106
  _ref$closeIcon = _ref.closeIcon,
2110
2107
  closeIcon = _ref$closeIcon === void 0 ? jsx(Close, {
2111
2108
  "data-testid": "CloseIcon"
@@ -2135,35 +2132,24 @@ var ToolHeader = function ToolHeader(_ref) {
2135
2132
  padding: styles.padding,
2136
2133
  height: styles.height
2137
2134
  },
2138
- children: [jsxs(Grid2, {
2135
+ justifyContent: "space-between",
2136
+ children: [jsx(Grid2, {
2139
2137
  className: "header-left",
2140
2138
  sx: {
2141
2139
  paddingRight: 1
2142
2140
  },
2143
- size: {
2144
- sm: columnSizeLeft
2145
- },
2146
- children: [isDraggable && size !== 'xxs' && !leftHeaderComponent && jsx(Grid2, {
2147
- container: true,
2148
- justifyContent: "flex-start",
2149
- size: "grow",
2150
- children: jsx(CustomIconButton, {
2151
- "data-testid": "dragBtn",
2152
- disableRipple: true,
2153
- sx: {
2154
- pointerEvents: 'none',
2155
- '&.MuiIconButton-root': iconStyle
2156
- },
2157
- children: dragHandleIcon
2158
- })
2159
- }), leftHeaderComponent && leftHeaderComponent]
2160
- }), jsxs(Grid2, {
2141
+ size: columnSizeLeft,
2142
+ children: leftHeaderComponent && leftHeaderComponent
2143
+ }), jsx(Grid2, {
2161
2144
  className: "header-title",
2162
2145
  size: title ? columnSizeTitle : 0,
2163
2146
  container: true,
2164
2147
  justifyContent: "center",
2165
2148
  alignItems: "center",
2166
- children: [title && jsx(Typography, {
2149
+ sx: {
2150
+ minHeight: 12
2151
+ },
2152
+ children: title && jsx(Typography, {
2167
2153
  variant: "h2",
2168
2154
  noWrap: true,
2169
2155
  sx: {
@@ -2175,19 +2161,7 @@ var ToolHeader = function ToolHeader(_ref) {
2175
2161
  },
2176
2162
  role: "heading",
2177
2163
  children: title
2178
- }), size === 'xxs' && jsx(CustomIconButton, {
2179
- "data-testid": "dragBtn-xxs",
2180
- disableRipple: true,
2181
- sx: {
2182
- pointerEvents: 'none',
2183
- right: -12,
2184
- transform: 'rotate(90deg)',
2185
- '&.MuiButtonBase-root.MuiIconButton-root': Object.assign({}, iconStyle, {
2186
- height: 12
2187
- })
2188
- },
2189
- children: dragHandleIcon
2190
- })]
2164
+ })
2191
2165
  }), jsxs(Grid2, {
2192
2166
  className: "header-right",
2193
2167
  container: true,
@@ -3934,24 +3908,6 @@ var tooltipContainerStyles = function tooltipContainerStyles(theme, isEnabled, h
3934
3908
  });
3935
3909
  };
3936
3910
 
3937
- function withEggs(eggs) {
3938
- return function (Component) {
3939
- var WithEggs = function WithEggs(props) {
3940
- var store = useStore();
3941
- var _React$useState = React.useState(function () {
3942
- return store.addEggs(eggs);
3943
- }),
3944
- remover = _React$useState[0];
3945
- React.useEffect(function () {
3946
- return remover;
3947
- }, [remover]);
3948
- return jsx(Component, Object.assign({}, props));
3949
- };
3950
- WithEggs.displayName = "withEggs(" + (Component.displayName || Component.name || 'Component') + ")";
3951
- return WithEggs;
3952
- };
3953
- }
3954
-
3955
3911
  var _excluded$3 = ["title", "title2", "defaultExpanded", "disableGutters", "expandedElevation", "collapsedElevation", "transitionDuration", "detailsSx", "CustomExpandIcon", "children", "amountOfItems"];
3956
3912
  var CustomAccordion = function CustomAccordion(_ref) {
3957
3913
  var title = _ref.title,
@@ -5751,16 +5707,6 @@ var index = /*#__PURE__*/Object.freeze({
5751
5707
  * Copyright 2024 - Finnish Meteorological Institute (FMI)
5752
5708
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
5753
5709
  * */
5754
- var createToolkitMockStoreWithEggs = function createToolkitMockStoreWithEggs(storeConfig) {
5755
- var reducer = storeConfig.reducer,
5756
- preloadedState = storeConfig.preloadedState;
5757
- var store = configureStore(Object.assign({}, storeConfig, {
5758
- reducer: reducer,
5759
- preloadedState: preloadedState
5760
- }));
5761
- store.addEggs = typeof jest !== 'undefined' ? jest.fn() : function () {}; // mocking the dynamic module loader
5762
- return store;
5763
- };
5764
5710
  var createToolkitMockStore = function createToolkitMockStore(storeConfig) {
5765
5711
  var reducer = storeConfig.reducer,
5766
5712
  preloadedState = storeConfig.preloadedState;
@@ -5915,4 +5861,4 @@ var RenderCounter = /*#__PURE__*/function () {
5915
5861
  }();
5916
5862
  var renderCounter = new RenderCounter();
5917
5863
 
5918
- 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, createToolkitMockStoreWithEggs, 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, withEggs };
5864
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "10.0.0",
3
+ "version": "10.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": {
@@ -12,10 +12,8 @@
12
12
  "react-draggable": "^4.4.6",
13
13
  "re-resizable": "^6.9.11",
14
14
  "lodash": "^4.17.21",
15
- "@redux-eggs/core": "^2.2.0",
16
- "react-redux": "^8.1.3",
17
15
  "axios": "^1.7.7",
18
- "date-fns": "^3.3.0",
16
+ "date-fns": "^4.1.0",
19
17
  "@reduxjs/toolkit": "^1.9.7",
20
18
  "react-i18next": "^15.1.1",
21
19
  "i18next": "^23.11.5",
@@ -13,7 +13,6 @@ export * from './ToggleMenu';
13
13
  export * from './AlertIcon';
14
14
  export * from './TooltipSelect';
15
15
  export * from './Avatar';
16
- export * from './WithEggs';
17
16
  export * from './CustomTooltip';
18
17
  export * from './CustomAccordion';
19
18
  export * from './CustomDialog';
@@ -0,0 +1,2 @@
1
+ import { ConfigureStoreOptions, ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
2
+ export declare const createToolkitMockStore: (storeConfig: ConfigureStoreOptions) => ToolkitStore;
@@ -1 +1 @@
1
- export * from './createMockStoreWithEggs';
1
+ export * from './createMockStore';
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- import { Egg } from '@redux-eggs/core';
3
- import { Theme } from '@mui/material';
4
- interface WithEggsProps {
5
- children: React.ReactElement;
6
- theme?: Theme;
7
- }
8
- export declare function withEggs(eggs: Egg[]): (Component: React.FC<WithEggsProps>) => React.FC<WithEggsProps>;
9
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { withEggs } from './WithEggs';
@@ -1,7 +0,0 @@
1
- import { ConfigureStoreOptions, ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
2
- interface ToolkitStoreWithEggs extends ToolkitStore {
3
- addEggs?: () => void;
4
- }
5
- export declare const createToolkitMockStoreWithEggs: (storeConfig: ConfigureStoreOptions) => ToolkitStoreWithEggs;
6
- export declare const createToolkitMockStore: (storeConfig: ConfigureStoreOptions) => ToolkitStore;
7
- export {};