@opengeoweb/shared 9.26.0 → 9.27.1

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
@@ -10,7 +10,7 @@ import Draggable from 'react-draggable';
10
10
  import { Resizable } from 're-resizable';
11
11
  import * as Sentry from '@sentry/react';
12
12
  import { useStore } from 'react-redux';
13
- 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, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$3, getHours as getHours$1, startOfDay, addMinutes, addHours, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
13
+ 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$3, getHours as getHours$1, startOfDay, addMinutes, addHours, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
14
14
  import configureStore from 'redux-mock-store';
15
15
  import { configureStore as configureStore$1 } from '@reduxjs/toolkit';
16
16
 
@@ -9029,6 +9029,15 @@ const differenceInHours = (dateLeft, dateRight, roundingMethod) => {
9029
9029
  const differenceInSeconds = (dateLeft, dateRight) => {
9030
9030
  return differenceInSeconds$1(dateLeft, dateRight);
9031
9031
  };
9032
+ /**
9033
+ *
9034
+ * @param date - the date to be rounded
9035
+ * @param options - the options for rounding
9036
+ * @returns the new date
9037
+ */
9038
+ const roundToNearestMinutes = (date, options) => {
9039
+ return roundToNearestMinutes$1(date, options);
9040
+ };
9032
9041
  /**
9033
9042
  *
9034
9043
  * @param date - the date that should be before the other one to return true
@@ -9374,6 +9383,7 @@ var index = /*#__PURE__*/Object.freeze({
9374
9383
  isoStringToDate: isoStringToDate,
9375
9384
  parseCustomDateString: parseCustomDateString,
9376
9385
  parseISO: parseISO,
9386
+ roundToNearestMinutes: roundToNearestMinutes,
9377
9387
  set: set,
9378
9388
  setUTCDate: setUTCDate,
9379
9389
  startOfDay: startOfDay,
@@ -9411,14 +9421,6 @@ const createMockStoreWithEggs = mockState => {
9411
9421
  store.addEggs = typeof jest !== 'undefined' ? jest.fn() : () => {}; // mocking the dynamic module loader
9412
9422
  return store;
9413
9423
  };
9414
- const createMockStoreWithEggsAndMiddleware = (mockState,
9415
- // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
9416
- middleware) => {
9417
- const mockStore = configureStore([middleware]);
9418
- const store = mockStore(mockState);
9419
- store.addEggs = typeof jest !== 'undefined' ? jest.fn() : () => {}; // mocking the dynamic module loader
9420
- return store;
9421
- };
9422
9424
  const createToolkitMockStoreWithEggs = storeConfig => {
9423
9425
  const {
9424
9426
  reducer,
@@ -9573,4 +9575,4 @@ class RenderCounter {
9573
9575
  }
9574
9576
  const renderCounter = new RenderCounter();
9575
9577
 
9576
- 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, FilterLabel, FilterListItem, LastUpdateTime, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createMockStoreWithEggs, createMockStoreWithEggsAndMiddleware, 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, withEggs };
9578
+ 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, FilterLabel, FilterListItem, LastUpdateTime, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createMockStoreWithEggs, 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, withEggs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "9.26.0",
3
+ "version": "9.27.1",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -24,7 +24,9 @@
24
24
  "@sentry/react": "^7.109.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "react": "18"
27
+ "react": "18",
28
+ "@emotion/react": "*",
29
+ "@emotion/styled": "*"
28
30
  },
29
31
  "module": "./index.esm.js",
30
32
  "type": "module",
@@ -1,4 +1,4 @@
1
- import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek } from 'date-fns';
1
+ import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek, NearestMinutes } from 'date-fns';
2
2
  export interface DateValues {
3
3
  year?: number;
4
4
  month?: number;
@@ -206,6 +206,15 @@ export declare const differenceInHours: (dateLeft: Date | number, dateRight: Dat
206
206
  * @returns {number} the number of minutes
207
207
  */
208
208
  export declare const differenceInSeconds: (dateLeft: Date | number, dateRight: Date | number) => number;
209
+ /**
210
+ *
211
+ * @param date - the date to be rounded
212
+ * @param options - the options for rounding
213
+ * @returns the new date
214
+ */
215
+ export declare const roundToNearestMinutes: (date: Date | number, options: {
216
+ nearestTo: NearestMinutes;
217
+ }) => Date;
209
218
  /**
210
219
  *
211
220
  * @param date - the date that should be before the other one to return true
@@ -1,5 +1,5 @@
1
1
  import { MockStoreEnhanced } from 'redux-mock-store';
2
- import { AnyAction, Dispatch, Middleware, Reducer, ReducersMapObject, ThunkMiddleware, StoreEnhancer } from '@reduxjs/toolkit';
2
+ import { AnyAction, Reducer, ReducersMapObject, ThunkMiddleware, StoreEnhancer } from '@reduxjs/toolkit';
3
3
  import { ConfigureStoreOptions, ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
4
4
  interface MockStoreWithEggs extends MockStoreEnhanced {
5
5
  addEggs?: () => void;
@@ -16,6 +16,5 @@ interface StoreConfig {
16
16
  ]> | object | undefined;
17
17
  }
18
18
  export declare const createMockStoreWithEggs: (mockState: unknown) => MockStoreWithEggs;
19
- export declare const createMockStoreWithEggsAndMiddleware: (mockState: unknown, middleware: Middleware<{}, any, Dispatch<AnyAction>>) => MockStoreWithEggs;
20
19
  export declare const createToolkitMockStoreWithEggs: (storeConfig: StoreConfig) => ToolkitStoreWithEggs;
21
20
  export {};