@kaizen/components 1.70.4 → 1.70.6
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/cjs/KaizenProvider/KaizenProvider.cjs +2 -6
- package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.cjs +19 -17
- package/dist/esm/KaizenProvider/KaizenProvider.mjs +2 -6
- package/dist/esm/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.mjs +20 -18
- package/dist/styles.css +8573 -8573
- package/package.json +1 -1
- package/src/KaizenProvider/KaizenProvider.tsx +2 -4
- package/src/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.tsx +24 -25
- package/src/__rc__/Menu/MenuItem.module.css +1 -1
|
@@ -21,20 +21,16 @@ var KaizenProvider = function (_a) {
|
|
|
21
21
|
var _c = React.useState(false),
|
|
22
22
|
documentIsAvailable = _c[0],
|
|
23
23
|
setDocumentIsAvailable = _c[1];
|
|
24
|
-
var _d = React.useState(),
|
|
25
|
-
notificationsList = _d[0],
|
|
26
|
-
setNotificationsList = _d[1];
|
|
27
24
|
React.useEffect(function () {
|
|
28
25
|
// SSR does not have a document, which is required for ToastNotificationsList.
|
|
29
26
|
// Await document render before rendering the component.
|
|
30
27
|
if (document !== undefined) {
|
|
31
|
-
setNotificationsList(React__default.default.createElement(ToastNotificationsList.ToastNotificationsList, null));
|
|
32
28
|
setDocumentIsAvailable(true);
|
|
33
29
|
}
|
|
34
|
-
}, [
|
|
30
|
+
}, []);
|
|
35
31
|
return React__default.default.createElement(OptionalIntlProvider.OptionalIntlProvider, {
|
|
36
32
|
locale: locale
|
|
37
|
-
}, React__default.default.createElement(ToastNotificationContext.ToastNotificationProvider, null,
|
|
33
|
+
}, React__default.default.createElement(ToastNotificationContext.ToastNotificationProvider, null, documentIsAvailable && React__default.default.createElement(ToastNotificationsList.ToastNotificationsList, null), children), React__default.default.createElement(FontDefinitions.FontDefinitions, null));
|
|
38
34
|
};
|
|
39
35
|
KaizenProvider.displayName = 'KaizenProvider';
|
|
40
36
|
exports.KaizenProvider = KaizenProvider;
|
package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var ReactDOM = require('react-dom');
|
|
5
4
|
var ToastNotificationContext = require('../context/ToastNotificationContext.cjs');
|
|
6
5
|
var ToastNotificationsMap = require('./subcomponents/ToastNotificationsMap/ToastNotificationsMap.cjs');
|
|
7
6
|
var ToastNotificationsList_module = require('./ToastNotificationsList.module.scss.cjs');
|
|
@@ -11,28 +10,31 @@ function _interopDefault(e) {
|
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
12
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
|
+
var toastNotificationListId = 'toast-notifications-list';
|
|
14
14
|
var ToastNotificationsList = function () {
|
|
15
15
|
var _a = ToastNotificationContext.useToastNotificationContext(),
|
|
16
16
|
notifications = _a.notifications,
|
|
17
17
|
removeToastNotification = _a.removeToastNotification;
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
var _b = React.useState(null),
|
|
19
|
+
toastContainer = _b[0],
|
|
20
|
+
setToastContainer = _b[1];
|
|
21
|
+
React.useEffect(function () {
|
|
22
|
+
// this is to ensure that the container is created only once. Regardless of how many KaizenProvider is set up, they will also reuse the same container.
|
|
23
|
+
var container = document.querySelector("[id=\"".concat(toastNotificationListId, "\"]"));
|
|
24
|
+
if (!container) {
|
|
25
|
+
container = document.createElement('div');
|
|
26
|
+
container.setAttribute('id', toastNotificationListId);
|
|
27
|
+
container.setAttribute('role', 'status');
|
|
28
|
+
container.className = ToastNotificationsList_module.toastNotificationsList;
|
|
29
|
+
document.body.appendChild(container);
|
|
30
|
+
}
|
|
31
|
+
setToastContainer(container);
|
|
32
|
+
}, []);
|
|
33
|
+
return toastContainer ? React__default.default.createElement(ToastNotificationsMap.ToastNotificationsMap, {
|
|
32
34
|
notifications: notifications,
|
|
33
35
|
onHide: removeToastNotification,
|
|
34
|
-
container:
|
|
35
|
-
})
|
|
36
|
+
container: toastContainer
|
|
37
|
+
}) : React__default.default.createElement(React__default.default.Fragment, null);
|
|
36
38
|
};
|
|
37
39
|
ToastNotificationsList.displayName = 'ToastNotificationsList';
|
|
38
40
|
exports.ToastNotificationsList = ToastNotificationsList;
|
|
@@ -14,20 +14,16 @@ const KaizenProvider = /*#__PURE__*/function () {
|
|
|
14
14
|
var _c = useState(false),
|
|
15
15
|
documentIsAvailable = _c[0],
|
|
16
16
|
setDocumentIsAvailable = _c[1];
|
|
17
|
-
var _d = useState(),
|
|
18
|
-
notificationsList = _d[0],
|
|
19
|
-
setNotificationsList = _d[1];
|
|
20
17
|
useEffect(function () {
|
|
21
18
|
// SSR does not have a document, which is required for ToastNotificationsList.
|
|
22
19
|
// Await document render before rendering the component.
|
|
23
20
|
if (document !== undefined) {
|
|
24
|
-
setNotificationsList( /*#__PURE__*/React.createElement(ToastNotificationsList, null));
|
|
25
21
|
setDocumentIsAvailable(true);
|
|
26
22
|
}
|
|
27
|
-
}, [
|
|
23
|
+
}, []);
|
|
28
24
|
return /*#__PURE__*/React.createElement(OptionalIntlProvider, {
|
|
29
25
|
locale: locale
|
|
30
|
-
}, /*#__PURE__*/React.createElement(ToastNotificationProvider, null,
|
|
26
|
+
}, /*#__PURE__*/React.createElement(ToastNotificationProvider, null, documentIsAvailable && /*#__PURE__*/React.createElement(ToastNotificationsList, null), children), /*#__PURE__*/React.createElement(FontDefinitions, null));
|
|
31
27
|
};
|
|
32
28
|
KaizenProvider.displayName = 'KaizenProvider';
|
|
33
29
|
return KaizenProvider;
|
package/dist/esm/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.mjs
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
3
2
|
import { useToastNotificationContext } from '../context/ToastNotificationContext.mjs';
|
|
4
3
|
import { ToastNotificationsMap } from './subcomponents/ToastNotificationsMap/ToastNotificationsMap.mjs';
|
|
5
4
|
import styles from './ToastNotificationsList.module.scss.mjs';
|
|
5
|
+
var toastNotificationListId = 'toast-notifications-list';
|
|
6
6
|
const ToastNotificationsList = /*#__PURE__*/function () {
|
|
7
7
|
const ToastNotificationsList = function () {
|
|
8
8
|
var _a = useToastNotificationContext(),
|
|
9
9
|
notifications = _a.notifications,
|
|
10
10
|
removeToastNotification = _a.removeToastNotification;
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
var _b = useState(null),
|
|
12
|
+
toastContainer = _b[0],
|
|
13
|
+
setToastContainer = _b[1];
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
// this is to ensure that the container is created only once. Regardless of how many KaizenProvider is set up, they will also reuse the same container.
|
|
16
|
+
var container = document.querySelector("[id=\"".concat(toastNotificationListId, "\"]"));
|
|
17
|
+
if (!container) {
|
|
18
|
+
container = document.createElement('div');
|
|
19
|
+
container.setAttribute('id', toastNotificationListId);
|
|
20
|
+
container.setAttribute('role', 'status');
|
|
21
|
+
container.className = styles.toastNotificationsList;
|
|
22
|
+
document.body.appendChild(container);
|
|
23
|
+
}
|
|
24
|
+
setToastContainer(container);
|
|
25
|
+
}, []);
|
|
26
|
+
return toastContainer ? ( /*#__PURE__*/React.createElement(ToastNotificationsMap, {
|
|
25
27
|
notifications: notifications,
|
|
26
28
|
onHide: removeToastNotification,
|
|
27
|
-
container:
|
|
28
|
-
})),
|
|
29
|
+
container: toastContainer
|
|
30
|
+
})) : ( /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
29
31
|
};
|
|
30
32
|
ToastNotificationsList.displayName = 'ToastNotificationsList';
|
|
31
33
|
return ToastNotificationsList;
|