@opengeoweb/snackbar 14.1.0 → 14.2.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
@@ -1,11 +1,11 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { useDispatch, useSelector } from 'react-redux';
3
3
  import { Snackbar } from '@mui/material';
4
- import { Close } from '@opengeoweb/theme';
5
4
  import { CustomIconButton } from '@opengeoweb/shared';
5
+ import { Close } from '@opengeoweb/theme';
6
+ import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, combineReducers, configureStore } from '@reduxjs/toolkit';
6
7
  import 'i18next';
7
8
  import { useTranslation } from 'react-i18next';
8
- import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, combineReducers, configureStore } from '@reduxjs/toolkit';
9
9
 
10
10
  var en = {
11
11
  "snackbar-close": "Close"
@@ -307,34 +307,6 @@ function _regeneratorRuntime() {
307
307
  })();
308
308
  }
309
309
 
310
- /* *
311
- * Licensed under the Apache License, Version 2.0 (the "License");
312
- * you may not use this file except in compliance with the License.
313
- * You may obtain a copy of the License at
314
- *
315
- * http://www.apache.org/licenses/LICENSE-2.0
316
- *
317
- * Unless required by applicable law or agreed to in writing, software
318
- * distributed under the License is distributed on an "AS IS" BASIS,
319
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
320
- * See the License for the specific language governing permissions and
321
- * limitations under the License.
322
- *
323
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
324
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
325
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
326
- * */
327
- var SNACKBAR_NAMESPACE = 'snackbar';
328
- var WORKSPACE_NAMESPACE = 'workspace';
329
- var WARN_NAMESPACE = 'warn';
330
- var LAYER_SELECT_NAMESPACE = 'layerselect';
331
- var AUTH_NAMESPACE = 'auth';
332
- var useSnackbarTranslation = function useSnackbarTranslation() {
333
- return useTranslation([SNACKBAR_NAMESPACE, WORKSPACE_NAMESPACE, WARN_NAMESPACE, LAYER_SELECT_NAMESPACE, AUTH_NAMESPACE], {
334
- nsMode: 'fallback'
335
- });
336
- };
337
-
338
310
  /* *
339
311
  * Licensed under the Apache License, Version 2.0 (the "License");
340
312
  * you may not use this file except in compliance with the License.
@@ -396,7 +368,7 @@ var snackbarReducer = slice.reducer,
396
368
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
397
369
  * */
398
370
  var getSnackbarStore = function getSnackbarStore(store) {
399
- if (store && store.snackbar) {
371
+ if (store != null && store.snackbar) {
400
372
  return store.snackbar;
401
373
  }
402
374
  return null;
@@ -526,6 +498,34 @@ var createMockStore = function createMockStore(mockState) {
526
498
  });
527
499
  };
528
500
 
501
+ /* *
502
+ * Licensed under the Apache License, Version 2.0 (the "License");
503
+ * you may not use this file except in compliance with the License.
504
+ * You may obtain a copy of the License at
505
+ *
506
+ * http://www.apache.org/licenses/LICENSE-2.0
507
+ *
508
+ * Unless required by applicable law or agreed to in writing, software
509
+ * distributed under the License is distributed on an "AS IS" BASIS,
510
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
511
+ * See the License for the specific language governing permissions and
512
+ * limitations under the License.
513
+ *
514
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
515
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
516
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
517
+ * */
518
+ var SNACKBAR_NAMESPACE = 'snackbar';
519
+ var WORKSPACE_NAMESPACE = 'workspace';
520
+ var WARN_NAMESPACE = 'warn';
521
+ var LAYER_SELECT_NAMESPACE = 'layerselect';
522
+ var AUTH_NAMESPACE = 'auth';
523
+ var useSnackbarTranslation = function useSnackbarTranslation() {
524
+ return useTranslation([SNACKBAR_NAMESPACE, WORKSPACE_NAMESPACE, WARN_NAMESPACE, LAYER_SELECT_NAMESPACE, AUTH_NAMESPACE], {
525
+ nsMode: 'fallback'
526
+ });
527
+ };
528
+
529
529
  var _excluded = ["children", "isOpen", "onCloseSnackbar", "id", "snackbarMessage"];
530
530
  var getMessageString = function getMessageString(t, snackbarMessage) {
531
531
  if (!snackbarMessage) {
@@ -545,18 +545,6 @@ var SnackbarWrapper = function SnackbarWrapper(_ref) {
545
545
  var messageString = getMessageString(t, snackbarMessage);
546
546
  return jsxs(Fragment, {
547
547
  children: [children, jsx(Snackbar, Object.assign({
548
- message: messageString,
549
- "data-testid": "snackbarComponent",
550
- open: isOpen,
551
- onClose: onCloseSnackbar,
552
- autoHideDuration: null,
553
- slotProps: {
554
- clickAwayListener: function clickAwayListener() {
555
- return {
556
- mouseEvent: false
557
- };
558
- }
559
- },
560
548
  action: jsx(CustomIconButton, {
561
549
  "aria-label": t('snackbar-close'),
562
550
  "data-testid": "snackbarCloseButton",
@@ -573,7 +561,19 @@ var SnackbarWrapper = function SnackbarWrapper(_ref) {
573
561
  }
574
562
  },
575
563
  children: jsx(Close, {})
576
- })
564
+ }),
565
+ autoHideDuration: null,
566
+ "data-testid": "snackbarComponent",
567
+ message: messageString,
568
+ onClose: onCloseSnackbar,
569
+ open: isOpen,
570
+ slotProps: {
571
+ clickAwayListener: function clickAwayListener() {
572
+ return {
573
+ mouseEvent: false
574
+ };
575
+ }
576
+ }
577
577
  }, props), id)]
578
578
  });
579
579
  };
@@ -587,10 +587,10 @@ var SnackbarWrapperConnect = function SnackbarWrapperConnect(props) {
587
587
  return getFirstSnackbarMessage(store);
588
588
  });
589
589
  return jsx(SnackbarWrapper, Object.assign({
590
+ id: currentSnackbarMessage ? currentSnackbarMessage.id : '',
590
591
  isOpen: !!currentSnackbarMessage,
591
592
  onCloseSnackbar: onCloseSnackbar,
592
- snackbarMessage: currentSnackbarMessage == null ? void 0 : currentSnackbarMessage.message,
593
- id: currentSnackbarMessage ? currentSnackbarMessage.id : ''
593
+ snackbarMessage: currentSnackbarMessage == null ? void 0 : currentSnackbarMessage.message
594
594
  }, props));
595
595
  };
596
596
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/snackbar",
3
- "version": "14.1.0",
3
+ "version": "14.2.1",
4
4
  "description": "GeoWeb snackbar library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,8 +8,8 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/theme": "14.1.0",
12
- "@opengeoweb/shared": "14.1.0",
11
+ "@opengeoweb/theme": "14.2.1",
12
+ "@opengeoweb/shared": "14.2.1",
13
13
  "react-redux": "^9.2.0",
14
14
  "@reduxjs/toolkit": "^2.6.1",
15
15
  "i18next": "^25.0.1",
@@ -1,5 +1,4 @@
1
- import * as React from 'react';
2
- import { Store } from '@reduxjs/toolkit';
1
+ import type { Store } from '@reduxjs/toolkit';
3
2
  interface SnackbarTranslationsWrapperProps {
4
3
  children?: React.ReactNode;
5
4
  }
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
2
- import { SnackbarProps } from '@mui/material';
1
+ import type { SnackbarProps } from '@mui/material';
2
+ import React from 'react';
3
3
  import { snackbarTypes } from '../../store';
4
4
  interface SnackBarWrapperProps extends SnackbarProps {
5
5
  isOpen: boolean;
@@ -1,3 +1,3 @@
1
- import * as React from 'react';
2
- import { SnackbarProps } from '@mui/material';
1
+ import type { SnackbarProps } from '@mui/material';
2
+ import React from 'react';
3
3
  export declare const SnackbarWrapperConnect: React.FC<SnackbarProps>;
@@ -1,3 +1,3 @@
1
- import { SnackbarModuleStore } from './types';
1
+ import type { SnackbarModuleStore } from './types';
2
2
  export declare const hideTime = 4000;
3
3
  export declare const snackbarListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<SnackbarModuleStore, import("redux-thunk").ThunkDispatch<SnackbarModuleStore, unknown, import("redux").UnknownAction>, unknown>;
@@ -1,5 +1,5 @@
1
- import { PayloadAction, Draft } from '@reduxjs/toolkit';
2
- import { OpenSnackbarPayload, SnackbarItem, SnackbarState, TriggerOpenSnackbarByListenerPayload } from './types';
1
+ import type { PayloadAction, Draft } from '@reduxjs/toolkit';
2
+ import type { OpenSnackbarPayload, SnackbarItem, SnackbarState, TriggerOpenSnackbarByListenerPayload } from './types';
3
3
  export declare const snackbarAdapter: import("@reduxjs/toolkit").EntityAdapter<SnackbarItem, string>;
4
4
  export declare const initialState: SnackbarState;
5
5
  export declare const snackbarReducer: import("redux").Reducer<SnackbarState>, snackbarActions: import("@reduxjs/toolkit").CaseReducerActions<{
@@ -1,4 +1,4 @@
1
- import { SnackbarModuleStore, SnackbarState } from './types';
1
+ import type { SnackbarModuleStore, SnackbarState } from './types';
2
2
  export declare const getSnackbarStore: (store: SnackbarModuleStore) => SnackbarState;
3
3
  export declare const getCurrentSnackbarMessages: (state: SnackbarModuleStore) => import("./types").SnackbarItem[];
4
4
  export declare const getFirstSnackbarMessage: ((state: SnackbarModuleStore) => import("./types").SnackbarItem | undefined) & {
@@ -1,5 +1,5 @@
1
- import { Store } from '@reduxjs/toolkit';
2
- import { SnackbarModuleStore } from './types';
1
+ import type { Store } from '@reduxjs/toolkit';
2
+ import type { SnackbarModuleStore } from './types';
3
3
  export declare const snackbarReducersMap: {
4
4
  snackbar: import("redux").Reducer<import("./types").SnackbarState>;
5
5
  };
@@ -1,4 +1,4 @@
1
- import { EntityState } from '@reduxjs/toolkit';
1
+ import type { EntityState } from '@reduxjs/toolkit';
2
2
  export interface SnackbarItem {
3
3
  message: SnackbarMessage;
4
4
  id: string;
@@ -1,5 +1,5 @@
1
1
  import i18n from 'i18next';
2
- import { UseTranslationResponse } from 'react-i18next';
2
+ import type { UseTranslationResponse } from 'react-i18next';
3
3
  export declare const SNACKBAR_NAMESPACE = "snackbar";
4
4
  export declare const initSnackbarI18n: () => void;
5
5
  export declare const useSnackbarTranslation: () => UseTranslationResponse<typeof SNACKBAR_NAMESPACE, typeof i18n>;