@etsoo/notificationbase 1.1.18 → 1.1.20
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/__tests__/Notification.ts +2 -1
- package/lib/Notification.d.ts +13 -11
- package/lib/Notification.js +12 -12
- package/package.json +9 -9
- package/src/Notification.ts +17 -13
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataTypes } from '@etsoo/shared';
|
|
1
2
|
import {
|
|
2
3
|
INotificaseBase,
|
|
3
4
|
INotification,
|
|
@@ -36,7 +37,7 @@ jest.useFakeTimers();
|
|
|
36
37
|
|
|
37
38
|
test('Tests for basic data', () => {
|
|
38
39
|
expect(Object.keys(container.notifications).length).toBe(
|
|
39
|
-
|
|
40
|
+
DataTypes.getEnumKeys(NotificationAlign).length
|
|
40
41
|
);
|
|
41
42
|
});
|
|
42
43
|
|
package/lib/Notification.d.ts
CHANGED
|
@@ -2,16 +2,18 @@ import { DataTypes } from '@etsoo/shared';
|
|
|
2
2
|
/**
|
|
3
3
|
* Display align
|
|
4
4
|
*/
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
BottomLeft
|
|
12
|
-
BottomCenter
|
|
13
|
-
BottomRight
|
|
14
|
-
|
|
5
|
+
export declare const NotificationAlign: {
|
|
6
|
+
[x: number]: string;
|
|
7
|
+
TopLeft: DataTypes.PlacementEnum.TopLeft;
|
|
8
|
+
TopCenter: DataTypes.PlacementEnum.TopCenter;
|
|
9
|
+
TopRight: DataTypes.PlacementEnum.TopRight;
|
|
10
|
+
Center: DataTypes.PlacementEnum.Center;
|
|
11
|
+
BottomLeft: DataTypes.PlacementEnum.BottomLeft;
|
|
12
|
+
BottomCenter: DataTypes.PlacementEnum.BottomCenter;
|
|
13
|
+
BottomRight: DataTypes.PlacementEnum.BottomRight;
|
|
14
|
+
Unknown: DataTypes.PlacementEnum.Unknown;
|
|
15
|
+
};
|
|
16
|
+
export type NotificationAlign = Exclude<DataTypes.PlacementEnum, DataTypes.PlacementEnum.MiddleLeft | DataTypes.PlacementEnum.MiddleRight>;
|
|
15
17
|
/**
|
|
16
18
|
* Modal types
|
|
17
19
|
*/
|
|
@@ -112,7 +114,7 @@ export type NotificationCallProps = {
|
|
|
112
114
|
/**
|
|
113
115
|
* Notification render props
|
|
114
116
|
*/
|
|
115
|
-
export type NotificationRenderProps =
|
|
117
|
+
export type NotificationRenderProps = DataTypes.StringRecord;
|
|
116
118
|
/**
|
|
117
119
|
* Notification base interface
|
|
118
120
|
*/
|
package/lib/Notification.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Utils } from '@etsoo/shared';
|
|
1
|
+
import { DataTypes, Utils } from '@etsoo/shared';
|
|
2
|
+
// https://devimalplanet.com/typescript-how-to-extend-one-enum-from-another
|
|
3
|
+
// Number index keys are still there
|
|
4
|
+
const { MiddleLeft, MiddleRight, ...alignItems } = DataTypes.PlacementEnum;
|
|
5
|
+
const newItems = {
|
|
6
|
+
...alignItems
|
|
7
|
+
};
|
|
8
|
+
delete newItems[MiddleLeft];
|
|
9
|
+
delete newItems[MiddleRight];
|
|
2
10
|
/**
|
|
3
11
|
* Display align
|
|
4
12
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
NotificationAlign[NotificationAlign["TopCenter"] = 1] = "TopCenter";
|
|
9
|
-
NotificationAlign[NotificationAlign["TopRight"] = 2] = "TopRight";
|
|
10
|
-
NotificationAlign[NotificationAlign["Center"] = 3] = "Center";
|
|
11
|
-
NotificationAlign[NotificationAlign["Unknown"] = 4] = "Unknown";
|
|
12
|
-
NotificationAlign[NotificationAlign["BottomLeft"] = 5] = "BottomLeft";
|
|
13
|
-
NotificationAlign[NotificationAlign["BottomCenter"] = 6] = "BottomCenter";
|
|
14
|
-
NotificationAlign[NotificationAlign["BottomRight"] = 7] = "BottomRight";
|
|
15
|
-
})(NotificationAlign || (NotificationAlign = {}));
|
|
13
|
+
export const NotificationAlign = {
|
|
14
|
+
...newItems
|
|
15
|
+
};
|
|
16
16
|
/**
|
|
17
17
|
* Modal types
|
|
18
18
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/notificationbase",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "TypeScript notification component for extending with all features described and partially implemented",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -45,23 +45,23 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@etsoo/shared": "^1.1.
|
|
48
|
+
"@etsoo/shared": "^1.1.84"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@babel/core": "^7.20.
|
|
51
|
+
"@babel/core": "^7.20.5",
|
|
52
52
|
"@babel/plugin-transform-runtime": "^7.19.6",
|
|
53
53
|
"@babel/preset-env": "^7.20.2",
|
|
54
|
-
"@babel/runtime-corejs3": "^7.20.
|
|
55
|
-
"@types/jest": "^29.2.
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
57
|
-
"@typescript-eslint/parser": "^5.
|
|
54
|
+
"@babel/runtime-corejs3": "^7.20.6",
|
|
55
|
+
"@types/jest": "^29.2.4",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
|
57
|
+
"@typescript-eslint/parser": "^5.47.0",
|
|
58
58
|
"babel-jest": "^29.3.1",
|
|
59
|
-
"eslint": "^8.
|
|
59
|
+
"eslint": "^8.30.0",
|
|
60
60
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
61
61
|
"eslint-plugin-import": "^2.26.0",
|
|
62
62
|
"jest": "^29.3.1",
|
|
63
63
|
"jest-environment-jsdom": "^29.3.1",
|
|
64
64
|
"ts-jest": "^29.0.3",
|
|
65
|
-
"typescript": "^4.9.
|
|
65
|
+
"typescript": "^4.9.4"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/Notification.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { DataTypes, Utils } from '@etsoo/shared';
|
|
2
2
|
|
|
3
|
+
// https://devimalplanet.com/typescript-how-to-extend-one-enum-from-another
|
|
4
|
+
// Number index keys are still there
|
|
5
|
+
const { MiddleLeft, MiddleRight, ...alignItems } = DataTypes.PlacementEnum;
|
|
6
|
+
const newItems = {
|
|
7
|
+
...alignItems
|
|
8
|
+
};
|
|
9
|
+
delete newItems[MiddleLeft];
|
|
10
|
+
delete newItems[MiddleRight];
|
|
11
|
+
|
|
3
12
|
/**
|
|
4
13
|
* Display align
|
|
5
14
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
BottomLeft,
|
|
15
|
-
BottomCenter,
|
|
16
|
-
BottomRight
|
|
17
|
-
}
|
|
15
|
+
export const NotificationAlign = {
|
|
16
|
+
...newItems
|
|
17
|
+
};
|
|
18
|
+
export type NotificationAlign = Exclude<
|
|
19
|
+
DataTypes.PlacementEnum,
|
|
20
|
+
DataTypes.PlacementEnum.MiddleLeft | DataTypes.PlacementEnum.MiddleRight
|
|
21
|
+
>;
|
|
18
22
|
|
|
19
23
|
/**
|
|
20
24
|
* Modal types
|
|
@@ -122,7 +126,7 @@ export type NotificationCallProps = {
|
|
|
122
126
|
/**
|
|
123
127
|
* Notification render props
|
|
124
128
|
*/
|
|
125
|
-
export type NotificationRenderProps =
|
|
129
|
+
export type NotificationRenderProps = DataTypes.StringRecord;
|
|
126
130
|
|
|
127
131
|
/**
|
|
128
132
|
* Notification base interface
|