@opengeoweb/snackbar 16.0.0 → 17.0.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 +36 -10
- package/package.json +4 -4
- package/src/index.d.ts +0 -1
- package/src/lib/components/Providers/Providers.d.ts +0 -11
- package/src/lib/components/Snackbar/SnackbarWrapper.d.ts +0 -11
- package/src/lib/components/Snackbar/SnackbarWrapper.spec.d.ts +0 -1
- package/src/lib/components/Snackbar/SnackbarWrapper.stories.d.ts +0 -8
- package/src/lib/components/Snackbar/SnackbarWrapperConnect.d.ts +0 -3
- package/src/lib/components/Snackbar/SnackbarWrapperConnect.spec.d.ts +0 -1
- package/src/lib/components/Snackbar/index.d.ts +0 -1
- package/src/lib/index.d.ts +0 -5
- package/src/lib/store/index.d.ts +0 -7
- package/src/lib/store/listener.d.ts +0 -3
- package/src/lib/store/listener.spec.d.ts +0 -1
- package/src/lib/store/reducer.d.ts +0 -10
- package/src/lib/store/reducer.spec.d.ts +0 -1
- package/src/lib/store/selectors.d.ts +0 -24
- package/src/lib/store/selectors.spec.d.ts +0 -1
- package/src/lib/store/store.d.ts +0 -7
- package/src/lib/store/types.d.ts +0 -27
- package/src/lib/utils/i18n.d.ts +0 -5
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
3
|
import { Snackbar } from '@mui/material';
|
|
4
4
|
import { CustomIconButton } from '@opengeoweb/shared';
|
|
@@ -6,6 +6,7 @@ import { Close } from '@opengeoweb/theme';
|
|
|
6
6
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
7
7
|
import 'i18next';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
9
10
|
|
|
10
11
|
var en = {
|
|
11
12
|
"snackbar-close": "Close"
|
|
@@ -324,6 +325,7 @@ function _regeneratorRuntime() {
|
|
|
324
325
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
325
326
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
326
327
|
* */
|
|
328
|
+
|
|
327
329
|
var snackbarAdapter = createEntityAdapter();
|
|
328
330
|
var initialState = snackbarAdapter.getInitialState();
|
|
329
331
|
var slice = createSlice({
|
|
@@ -367,6 +369,7 @@ var snackbarReducer = slice.reducer,
|
|
|
367
369
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
368
370
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
369
371
|
* */
|
|
372
|
+
|
|
370
373
|
var getSnackbarStore = function getSnackbarStore(store) {
|
|
371
374
|
if (store != null && store.snackbar) {
|
|
372
375
|
return store.snackbar;
|
|
@@ -410,15 +413,18 @@ var selectors = /*#__PURE__*/Object.freeze({
|
|
|
410
413
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
411
414
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
412
415
|
* */
|
|
413
|
-
|
|
414
|
-
|
|
416
|
+
|
|
417
|
+
var SnackbarMessageType = /*#__PURE__*/function (SnackbarMessageType) {
|
|
415
418
|
SnackbarMessageType["TRANSLATABLE_MESSAGE"] = "TRANSLATABLE_MESSAGE";
|
|
416
419
|
SnackbarMessageType["VERBATIM_MESSAGE"] = "VERBATIM_MESSAGE";
|
|
417
|
-
|
|
420
|
+
return SnackbarMessageType;
|
|
421
|
+
}({});
|
|
422
|
+
|
|
423
|
+
// actions
|
|
418
424
|
|
|
419
425
|
var types = /*#__PURE__*/Object.freeze({
|
|
420
426
|
__proto__: null,
|
|
421
|
-
|
|
427
|
+
SnackbarMessageType: SnackbarMessageType
|
|
422
428
|
});
|
|
423
429
|
|
|
424
430
|
var hideTime = 4000;
|
|
@@ -483,6 +489,7 @@ snackbarListener.startListening({
|
|
|
483
489
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
484
490
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
485
491
|
* */
|
|
492
|
+
|
|
486
493
|
var snackbarReducersMap = {
|
|
487
494
|
snackbar: snackbarReducer
|
|
488
495
|
};
|
|
@@ -515,6 +522,7 @@ var createMockStore = function createMockStore(mockState) {
|
|
|
515
522
|
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
516
523
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
517
524
|
* */
|
|
525
|
+
|
|
518
526
|
var SNACKBAR_NAMESPACE = 'snackbar';
|
|
519
527
|
var WORKSPACE_NAMESPACE = 'workspace';
|
|
520
528
|
var WARN_NAMESPACE = 'warn';
|
|
@@ -543,9 +551,9 @@ var SnackbarWrapper = function SnackbarWrapper(_ref) {
|
|
|
543
551
|
var _useSnackbarTranslati = useSnackbarTranslation(),
|
|
544
552
|
t = _useSnackbarTranslati.t;
|
|
545
553
|
var messageString = getMessageString(t, snackbarMessage);
|
|
546
|
-
return jsxs(Fragment, {
|
|
547
|
-
children: [children, jsx(Snackbar, Object.assign({
|
|
548
|
-
action: jsx(CustomIconButton, {
|
|
554
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
555
|
+
children: [children, /*#__PURE__*/jsx(Snackbar, Object.assign({
|
|
556
|
+
action: /*#__PURE__*/jsx(CustomIconButton, {
|
|
549
557
|
"aria-label": t('snackbar-close'),
|
|
550
558
|
"data-testid": "snackbarCloseButton",
|
|
551
559
|
onClick: onCloseSnackbar,
|
|
@@ -560,7 +568,7 @@ var SnackbarWrapper = function SnackbarWrapper(_ref) {
|
|
|
560
568
|
}
|
|
561
569
|
}
|
|
562
570
|
},
|
|
563
|
-
children: jsx(Close, {})
|
|
571
|
+
children: /*#__PURE__*/jsx(Close, {})
|
|
564
572
|
}),
|
|
565
573
|
autoHideDuration: null,
|
|
566
574
|
"data-testid": "snackbarComponent",
|
|
@@ -578,6 +586,24 @@ var SnackbarWrapper = function SnackbarWrapper(_ref) {
|
|
|
578
586
|
});
|
|
579
587
|
};
|
|
580
588
|
|
|
589
|
+
/* *
|
|
590
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
591
|
+
* you may not use this file except in compliance with the License.
|
|
592
|
+
* You may obtain a copy of the License at
|
|
593
|
+
*
|
|
594
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
595
|
+
*
|
|
596
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
597
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
598
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
599
|
+
* See the License for the specific language governing permissions and
|
|
600
|
+
* limitations under the License.
|
|
601
|
+
*
|
|
602
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
603
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
604
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
605
|
+
* */
|
|
606
|
+
|
|
581
607
|
var SnackbarWrapperConnect = function SnackbarWrapperConnect(props) {
|
|
582
608
|
var dispatch = useDispatch();
|
|
583
609
|
var onCloseSnackbar = function onCloseSnackbar() {
|
|
@@ -586,7 +612,7 @@ var SnackbarWrapperConnect = function SnackbarWrapperConnect(props) {
|
|
|
586
612
|
var currentSnackbarMessage = useSelector(function (store) {
|
|
587
613
|
return getFirstSnackbarMessage(store);
|
|
588
614
|
});
|
|
589
|
-
return jsx(SnackbarWrapper, Object.assign({
|
|
615
|
+
return /*#__PURE__*/jsx(SnackbarWrapper, Object.assign({
|
|
590
616
|
id: currentSnackbarMessage ? currentSnackbarMessage.id : '',
|
|
591
617
|
isOpen: !!currentSnackbarMessage,
|
|
592
618
|
onCloseSnackbar: onCloseSnackbar,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/snackbar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.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": "
|
|
12
|
-
"@opengeoweb/shared": "
|
|
11
|
+
"@opengeoweb/theme": "17.0.1",
|
|
12
|
+
"@opengeoweb/shared": "17.0.1",
|
|
13
13
|
"react-redux": "^9.2.0",
|
|
14
14
|
"@reduxjs/toolkit": "^2.6.1",
|
|
15
15
|
"i18next": "^25.0.1",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@emotion/styled": "*"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"eslint-plugin-storybook": "
|
|
25
|
+
"eslint-plugin-storybook": "10.3.3"
|
|
26
26
|
},
|
|
27
27
|
"module": "./index.esm.js",
|
|
28
28
|
"type": "module",
|
package/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Store } from '@reduxjs/toolkit';
|
|
2
|
-
interface SnackbarTranslationsWrapperProps {
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
export declare const DemoWrapper: React.FC<SnackbarTranslationsWrapperProps>;
|
|
6
|
-
interface ProviderProps {
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
store: Store;
|
|
9
|
-
}
|
|
10
|
-
export declare const DemoWrapperConnect: React.FC<ProviderProps>;
|
|
11
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SnackbarProps } from '@mui/material';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { snackbarTypes } from '../../store';
|
|
4
|
-
interface SnackBarWrapperProps extends SnackbarProps {
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
id: string;
|
|
7
|
-
snackbarMessage?: snackbarTypes.SnackbarMessage;
|
|
8
|
-
onCloseSnackbar: () => void;
|
|
9
|
-
}
|
|
10
|
-
export declare const SnackbarWrapper: React.FC<SnackBarWrapperProps>;
|
|
11
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { SnackbarWrapper } from './SnackbarWrapper';
|
|
3
|
-
type Story = StoryObj<typeof SnackbarWrapper>;
|
|
4
|
-
declare const meta: Meta<typeof SnackbarWrapper>;
|
|
5
|
-
export default meta;
|
|
6
|
-
export declare const Component: Story;
|
|
7
|
-
export declare const SnackbarDemo: Story;
|
|
8
|
-
export declare const TwoSnackbarsDemo: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SnackbarWrapperConnect } from './SnackbarWrapperConnect';
|
package/src/lib/index.d.ts
DELETED
package/src/lib/store/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { snackbarActions } from './reducer';
|
|
2
|
-
export * as snackbarSelectors from './selectors';
|
|
3
|
-
export * as snackbarTypes from './types';
|
|
4
|
-
export * from './store';
|
|
5
|
-
export { snackbarReducer } from './reducer';
|
|
6
|
-
export * from './listener';
|
|
7
|
-
export type { SnackbarModuleStore } from './types';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { SnackbarModuleStore } from './types';
|
|
2
|
-
export declare const hideTime = 4000;
|
|
3
|
-
export declare const snackbarListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<SnackbarModuleStore, import("redux-thunk").ThunkDispatch<SnackbarModuleStore, unknown, import("redux").UnknownAction>, unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PayloadAction, Draft } from '@reduxjs/toolkit';
|
|
2
|
-
import type { OpenSnackbarPayload, SnackbarItem, SnackbarState, TriggerOpenSnackbarByListenerPayload } from './types';
|
|
3
|
-
export declare const snackbarAdapter: import("@reduxjs/toolkit").EntityAdapter<SnackbarItem, string>;
|
|
4
|
-
export declare const initialState: SnackbarState;
|
|
5
|
-
export declare const snackbarReducer: import("redux").Reducer<SnackbarState>, snackbarActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
6
|
-
openSnackbar: (_draft: Draft<SnackbarState>, _action: PayloadAction<OpenSnackbarPayload>) => void;
|
|
7
|
-
triggerOpenSnackbarByListener: (draft: Draft<SnackbarState>, action: PayloadAction<TriggerOpenSnackbarByListenerPayload>) => void;
|
|
8
|
-
closeSnackbar: (draft: Draft<SnackbarState>) => void;
|
|
9
|
-
}, "snackbar">;
|
|
10
|
-
export type SnackbarActions = ReturnType<typeof snackbarActions.openSnackbar> | ReturnType<typeof snackbarActions.triggerOpenSnackbarByListener> | ReturnType<typeof snackbarActions.closeSnackbar>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { SnackbarModuleStore, SnackbarState } from './types';
|
|
2
|
-
export declare const getSnackbarStore: (store: SnackbarModuleStore) => SnackbarState;
|
|
3
|
-
export declare const getCurrentSnackbarMessages: (state: SnackbarModuleStore) => import("./types").SnackbarItem[];
|
|
4
|
-
export declare const getFirstSnackbarMessage: ((state: SnackbarModuleStore) => import("./types").SnackbarItem | undefined) & {
|
|
5
|
-
clearCache: () => void;
|
|
6
|
-
resultsCount: () => number;
|
|
7
|
-
resetResultsCount: () => void;
|
|
8
|
-
} & {
|
|
9
|
-
resultFunc: (resultFuncArgs_0: import("./types").SnackbarItem[]) => import("./types").SnackbarItem | undefined;
|
|
10
|
-
memoizedResultFunc: ((resultFuncArgs_0: import("./types").SnackbarItem[]) => import("./types").SnackbarItem | undefined) & {
|
|
11
|
-
clearCache: () => void;
|
|
12
|
-
resultsCount: () => number;
|
|
13
|
-
resetResultsCount: () => void;
|
|
14
|
-
};
|
|
15
|
-
lastResult: () => import("./types").SnackbarItem | undefined;
|
|
16
|
-
dependencies: [(state: SnackbarModuleStore) => import("./types").SnackbarItem[]];
|
|
17
|
-
recomputations: () => number;
|
|
18
|
-
resetRecomputations: () => void;
|
|
19
|
-
dependencyRecomputations: () => number;
|
|
20
|
-
resetDependencyRecomputations: () => void;
|
|
21
|
-
} & {
|
|
22
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
23
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/lib/store/store.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Store } from '@reduxjs/toolkit';
|
|
2
|
-
import type { SnackbarModuleStore } from './types';
|
|
3
|
-
export declare const snackbarReducersMap: {
|
|
4
|
-
snackbar: import("redux").Reducer<import("./types").SnackbarState>;
|
|
5
|
-
};
|
|
6
|
-
export declare const snackbarMiddlewares: import("@reduxjs/toolkit").ListenerMiddleware<SnackbarModuleStore, import("redux-thunk").ThunkDispatch<SnackbarModuleStore, unknown, import("redux").UnknownAction>, unknown>[];
|
|
7
|
-
export declare const createMockStore: (mockState?: SnackbarModuleStore) => Store;
|
package/src/lib/store/types.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { EntityState } from '@reduxjs/toolkit';
|
|
2
|
-
export interface SnackbarItem {
|
|
3
|
-
message: SnackbarMessage;
|
|
4
|
-
id: string;
|
|
5
|
-
}
|
|
6
|
-
export type SnackbarState = EntityState<SnackbarItem, string>;
|
|
7
|
-
export interface SnackbarModuleStore {
|
|
8
|
-
snackbar?: SnackbarState;
|
|
9
|
-
}
|
|
10
|
-
export declare enum SnackbarMessageType {
|
|
11
|
-
TRANSLATABLE_MESSAGE = "TRANSLATABLE_MESSAGE",
|
|
12
|
-
VERBATIM_MESSAGE = "VERBATIM_MESSAGE"
|
|
13
|
-
}
|
|
14
|
-
export interface TranslatableMessage {
|
|
15
|
-
type: SnackbarMessageType.TRANSLATABLE_MESSAGE;
|
|
16
|
-
key: string;
|
|
17
|
-
params?: Record<string, string | number> | undefined;
|
|
18
|
-
}
|
|
19
|
-
export interface VerbatimMessage {
|
|
20
|
-
type: SnackbarMessageType.VERBATIM_MESSAGE;
|
|
21
|
-
message: string;
|
|
22
|
-
}
|
|
23
|
-
export type SnackbarMessage = TranslatableMessage | VerbatimMessage;
|
|
24
|
-
export type OpenSnackbarPayload = SnackbarMessage;
|
|
25
|
-
export interface TriggerOpenSnackbarByListenerPayload {
|
|
26
|
-
snackbarContent: SnackbarItem;
|
|
27
|
-
}
|
package/src/lib/utils/i18n.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import i18n from 'i18next';
|
|
2
|
-
import type { UseTranslationResponse } from 'react-i18next';
|
|
3
|
-
export declare const SNACKBAR_NAMESPACE = "snackbar";
|
|
4
|
-
export declare const initSnackbarI18n: () => void;
|
|
5
|
-
export declare const useSnackbarTranslation: () => UseTranslationResponse<typeof SNACKBAR_NAMESPACE, typeof i18n>;
|