@ttoss/react-notifications 1.20.14 → 1.20.15

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
@@ -4,7 +4,7 @@
4
4
  import * as React from "react";
5
5
  import { Flex, InfiniteLinearProgress } from "@ttoss/ui";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
- var NotificationsContext = React.createContext({
7
+ var NotificationsContext = /*#__PURE__*/React.createContext({
8
8
  isLoading: false,
9
9
  setLoading: () => {
10
10
  return void 0;
@@ -19,25 +19,31 @@ var NotificationsProvider = ({
19
19
  }) => {
20
20
  const [isLoading, setLoading] = React.useState(false);
21
21
  const [notifications, setNotifications] = React.useState();
22
- return /* @__PURE__ */ jsxs(
23
- NotificationsContext.Provider,
24
- {
25
- value: {
26
- isLoading,
27
- setLoading,
28
- setNotifications,
29
- notifications,
30
- enableNotificationBox
22
+ return /* @__PURE__ */jsxs(NotificationsContext.Provider, {
23
+ value: {
24
+ isLoading,
25
+ setLoading,
26
+ setNotifications,
27
+ notifications,
28
+ enableNotificationBox
29
+ },
30
+ children: [isLoading && /* @__PURE__ */jsx(Flex, {
31
+ sx: {
32
+ position: "absolute",
33
+ width: "100%",
34
+ top: 0
31
35
  },
32
- children: [
33
- isLoading && /* @__PURE__ */ jsx(Flex, { sx: { position: "absolute", width: "100%", top: 0 }, children: /* @__PURE__ */ jsx(InfiniteLinearProgress, {}) }),
34
- children
35
- ]
36
- }
37
- );
36
+ children: /* @__PURE__ */jsx(InfiniteLinearProgress, {})
37
+ }), children]
38
+ });
38
39
  };
39
40
  var useNotifications = () => {
40
- const { isLoading, setLoading, notifications, setNotifications } = React.useContext(NotificationsContext);
41
+ const {
42
+ isLoading,
43
+ setLoading,
44
+ notifications,
45
+ setNotifications
46
+ } = React.useContext(NotificationsContext);
41
47
  return {
42
48
  isLoading,
43
49
  setLoading,
@@ -50,14 +56,14 @@ var useNotifications = () => {
50
56
  import { Box } from "@ttoss/ui";
51
57
  import { jsx as jsx2 } from "react/jsx-runtime";
52
58
  var NotificationBox = () => {
53
- const { notifications } = useNotifications();
59
+ const {
60
+ notifications
61
+ } = useNotifications();
54
62
  if (!notifications) {
55
63
  return null;
56
64
  }
57
- return /* @__PURE__ */ jsx2(Box, { children: JSON.stringify(notifications, null, 2) });
58
- };
59
- export {
60
- NotificationBox,
61
- NotificationsProvider,
62
- useNotifications
65
+ return /* @__PURE__ */jsx2(Box, {
66
+ children: JSON.stringify(notifications, null, 2)
67
+ });
63
68
  };
69
+ export { NotificationBox, NotificationsProvider, useNotifications };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
2
  "use strict";
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,26 +8,32 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
12
15
  };
13
16
  var __copyProps = (to, from, except, desc) => {
14
17
  if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
18
22
  }
19
23
  return to;
20
24
  };
21
25
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
+ value: mod,
32
+ enumerable: true
33
+ }) : target, mod));
34
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
35
+ value: true
36
+ }), mod);
30
37
 
31
38
  // src/index.ts
32
39
  var src_exports = {};
@@ -56,25 +63,31 @@ var NotificationsProvider = ({
56
63
  }) => {
57
64
  const [isLoading, setLoading] = React.useState(false);
58
65
  const [notifications, setNotifications] = React.useState();
59
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
60
- NotificationsContext.Provider,
61
- {
62
- value: {
63
- isLoading,
64
- setLoading,
65
- setNotifications,
66
- notifications,
67
- enableNotificationBox
66
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(NotificationsContext.Provider, {
67
+ value: {
68
+ isLoading,
69
+ setLoading,
70
+ setNotifications,
71
+ notifications,
72
+ enableNotificationBox
73
+ },
74
+ children: [isLoading && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ui.Flex, {
75
+ sx: {
76
+ position: "absolute",
77
+ width: "100%",
78
+ top: 0
68
79
  },
69
- children: [
70
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Flex, { sx: { position: "absolute", width: "100%", top: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.InfiniteLinearProgress, {}) }),
71
- children
72
- ]
73
- }
74
- );
80
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ui.InfiniteLinearProgress, {})
81
+ }), children]
82
+ });
75
83
  };
76
84
  var useNotifications = () => {
77
- const { isLoading, setLoading, notifications, setNotifications } = React.useContext(NotificationsContext);
85
+ const {
86
+ isLoading,
87
+ setLoading,
88
+ notifications,
89
+ setNotifications
90
+ } = React.useContext(NotificationsContext);
78
91
  return {
79
92
  isLoading,
80
93
  setLoading,
@@ -87,15 +100,19 @@ var useNotifications = () => {
87
100
  var import_ui2 = require("@ttoss/ui");
88
101
  var import_jsx_runtime2 = require("react/jsx-runtime");
89
102
  var NotificationBox = () => {
90
- const { notifications } = useNotifications();
103
+ const {
104
+ notifications
105
+ } = useNotifications();
91
106
  if (!notifications) {
92
107
  return null;
93
108
  }
94
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Box, { children: JSON.stringify(notifications, null, 2) });
109
+ return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui2.Box, {
110
+ children: JSON.stringify(notifications, null, 2)
111
+ });
95
112
  };
96
113
  // Annotate the CommonJS export names for ESM import in node:
97
114
  0 && (module.exports = {
98
115
  NotificationBox,
99
116
  NotificationsProvider,
100
117
  useNotifications
101
- });
118
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-notifications",
3
- "version": "1.20.14",
3
+ "version": "1.20.15",
4
4
  "description": "ttoss notifications module for React apps.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -20,14 +20,14 @@
20
20
  "sideEffects": false,
21
21
  "typings": "dist/index.d.ts",
22
22
  "dependencies": {
23
- "@ttoss/components": "^1.26.14"
23
+ "@ttoss/components": "^1.26.15"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@ttoss/ui": "^1.25.1",
27
27
  "react": ">=16.8.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@ttoss/config": "^1.29.1",
30
+ "@ttoss/config": "^1.29.2",
31
31
  "jest": "^29.5.0",
32
32
  "react": "^18.2.0"
33
33
  },
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "ee0c2e51d38f37f997c020d4303cf90be720ecb0"
41
+ "gitHead": "0609bb0f6e6a1c0999c29e7a5c8f8ebb1c6d3d7a"
42
42
  }