@ttoss/react-notifications 2.1.0 → 2.1.2

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/dist/esm/index.js CHANGED
@@ -73,14 +73,14 @@ var NotificationsProvider = props => {
73
73
  const [isLoading, setLoading] = React.useState(false);
74
74
  const [notifications, setNotifications] = React.useState();
75
75
  const prefix = React.useId();
76
- const removeNotification = id => {
76
+ const removeNotification = React.useCallback(id => {
77
77
  setNotifications(prevNotifications => {
78
78
  return prevNotifications?.filter(notification => {
79
79
  return notification.id !== id;
80
80
  });
81
81
  });
82
- };
83
- const addNotification = notification => {
82
+ }, []);
83
+ const addNotification = React.useCallback(notification => {
84
84
  const newNotifications = (Array.isArray(notification) ? notification : [notification]).map(notification2 => {
85
85
  const id = notification2.id || `${prefix}-${Math.random()}`;
86
86
  return {
@@ -128,10 +128,10 @@ var NotificationsProvider = props => {
128
128
  });
129
129
  return [...oldNotifications, ...newNotifications];
130
130
  });
131
- };
132
- const clearNotifications = () => {
131
+ }, [prefix, props.defaultViewType, removeNotification]);
132
+ const clearNotifications = React.useCallback(() => {
133
133
  setNotifications(void 0);
134
- };
134
+ }, []);
135
135
  return /* @__PURE__ */jsxs2(NotificationsContext.Provider, {
136
136
  value: {
137
137
  isLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-notifications",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "ttoss notifications module for React apps.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -25,20 +25,20 @@
25
25
  "sideEffects": false,
26
26
  "peerDependencies": {
27
27
  "react": ">=16.8.0",
28
- "@ttoss/components": "^2.1.0",
28
+ "@ttoss/components": "^2.1.2",
29
29
  "@ttoss/react-icons": "^0.4.9",
30
- "@ttoss/ui": "^5.2.0"
30
+ "@ttoss/ui": "^5.2.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/react": "^19.0.2",
34
34
  "jest": "^29.7.0",
35
35
  "react": "^19.0.0",
36
36
  "tsup": "^8.3.5",
37
- "@ttoss/components": "^2.1.0",
37
+ "@ttoss/test-utils": "^2.1.22",
38
38
  "@ttoss/react-icons": "^0.4.9",
39
+ "@ttoss/components": "^2.1.2",
39
40
  "@ttoss/config": "^1.35.2",
40
- "@ttoss/ui": "^5.2.0",
41
- "@ttoss/test-utils": "^2.1.22"
41
+ "@ttoss/ui": "^5.2.1"
42
42
  },
43
43
  "keywords": [
44
44
  "React",