@moneyforward/mfui-components 3.37.1 → 3.37.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.
@@ -4,7 +4,6 @@ import { toastSlotRecipe } from '../../../styled-system/recipes';
4
4
  import { ToastContainer } from '../ToastContainer/ToastContainer';
5
5
  import { generateRandomId } from '../helpers';
6
6
  import { getTargetDomNode } from '../../utilities/dom/getTargetDomNode';
7
- const rootId = 'mfui-toast-root';
8
7
  let toastList = [];
9
8
  let rootElement = null;
10
9
  let root = null;
@@ -13,6 +12,11 @@ let rootWrapper;
13
12
  * Get the toast root element.
14
13
  * If the root element does not exist, it will be created.
15
14
  *
15
+ * The container is always newly created and referenced only through this
16
+ * module's scope. Looking it up in the DOM (e.g. by id) is intentionally
17
+ * avoided: when multiple copies of this module coexist (such as two major
18
+ * versions installed via npm alias), a DOM lookup would adopt a container
19
+ * owned by another copy's React root and corrupt it (#2790).
16
20
  */
17
21
  const getToastRoot = () => {
18
22
  if (root) {
@@ -21,14 +25,11 @@ const getToastRoot = () => {
21
25
  if (!rootWrapper) {
22
26
  return;
23
27
  }
24
- rootElement = rootWrapper.querySelector(`#${rootId}`);
25
- if (!rootElement) {
26
- const classes = toastSlotRecipe();
27
- rootElement = document.createElement('div');
28
- rootElement.id = rootId;
29
- rootElement.className = classes.root;
30
- rootWrapper.append(rootElement);
31
- }
28
+ const classes = toastSlotRecipe();
29
+ rootElement = document.createElement('div');
30
+ rootElement.dataset['mfuiToastRoot'] = '';
31
+ rootElement.className = classes.root;
32
+ rootWrapper.append(rootElement);
32
33
  root = createRoot(rootElement);
33
34
  return root;
34
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneyforward/mfui-components",
3
- "version": "3.37.1",
3
+ "version": "3.37.2",
4
4
  "description": "React UI Component Library for all Money Forward products",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,8 +63,8 @@
63
63
  "@floating-ui/react-dom": "^2.1.2",
64
64
  "@tanstack/react-virtual": "^3.13.18",
65
65
  "dayjs": "^1.11.13",
66
- "@moneyforward/mfui-design-tokens": "^3.3.2",
67
- "@moneyforward/mfui-icons-react": "^3.7.0"
66
+ "@moneyforward/mfui-icons-react": "^3.7.0",
67
+ "@moneyforward/mfui-design-tokens": "^3.3.2"
68
68
  },
69
69
  "scripts": {
70
70
  "prepare:panda": "panda codegen",