@stratakit/structures 0.5.4 → 0.5.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.5
4
+
5
+ - [#1174](https://github.com/iTwin/design-system/pull/1174): Fixed `DropdownMenu.Submenu` component to avoid removal of parent portal popover when unmounting.
6
+
3
7
  ## 0.5.4
4
8
 
5
9
  - [#1122](https://github.com/iTwin/design-system/pull/1122): Moved `@stratakit/foundations` from `peerDependencies` to direct `dependencies`.
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright © 2025 Bentley Systems, Incorporated. All rights reserved.
3
+ Copyright © 2024-2026 Bentley Systems, Incorporated. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
@@ -272,12 +272,16 @@ const DropdownMenuSubmenu = forwardRef(
272
272
  }, [store, setStore]);
273
273
  const parent = useMenuContext();
274
274
  const popoverElement = useStoreState(parent, "popoverElement");
275
+ const portalElement = React.useCallback(() => {
276
+ if (!popoverElement?.isConnected) return null;
277
+ return popoverElement;
278
+ }, [popoverElement]);
275
279
  return /* @__PURE__ */ jsx(MenuProvider, { store, children: /* @__PURE__ */ jsx(
276
280
  Menu,
277
281
  {
278
282
  store,
279
283
  portal: true,
280
- portalElement: popoverElement,
284
+ portalElement,
281
285
  preserveTabOrder: false,
282
286
  ...props,
283
287
  gutter: 2,
@@ -5,11 +5,11 @@ import {
5
5
  } from "@stratakit/foundations/secret-internals";
6
6
  import css from "./styles.css.js";
7
7
  const packageName = "@stratakit/structures";
8
- const key = `${packageName}@${"0.5.4"}`;
8
+ const key = `${packageName}@${"0.5.5"}`;
9
9
  function useInit() {
10
10
  const rootContext = useSafeContext(RootContext);
11
11
  if (!rootContext.versions?.has(packageName))
12
- rootContext.versions?.set(packageName, "0.5.4");
12
+ rootContext.versions?.set(packageName, "0.5.5");
13
13
  const { rootNode, loadStyles } = rootContext;
14
14
  React.useInsertionEffect(() => {
15
15
  if (!rootNode || !loadStyles) return;
@@ -241,12 +241,16 @@ const DropdownMenuSubmenu = forwardRef((props, forwardedRef) => {
241
241
  }, [store, setStore]);
242
242
  const parent = useMenuContext();
243
243
  const popoverElement = useStoreState(parent, "popoverElement");
244
+ const portalElement = React.useCallback(() => {
245
+ if (!popoverElement?.isConnected) return null;
246
+ return popoverElement;
247
+ }, [popoverElement]);
244
248
  return /* @__PURE__ */ jsx(MenuProvider, {
245
249
  store,
246
250
  children: /* @__PURE__ */ jsx(Menu, {
247
251
  store,
248
252
  portal: true,
249
- portalElement: popoverElement,
253
+ portalElement,
250
254
  preserveTabOrder: false,
251
255
  ...props,
252
256
  gutter: 2,
@@ -3,12 +3,12 @@ import * as React from "react";
3
3
  import { RootContext, useSafeContext } from "@stratakit/foundations/secret-internals";
4
4
  import css from "./styles.css.js";
5
5
  const packageName = "@stratakit/structures";
6
- const key = `${packageName}@${"0.5.4"}`;
6
+ const key = `${packageName}@${"0.5.5"}`;
7
7
  function useInit() {
8
8
  const $ = _c(4);
9
9
  const rootContext = useSafeContext(RootContext);
10
10
  if (!rootContext.versions?.has(packageName)) {
11
- rootContext.versions?.set(packageName, "0.5.4");
11
+ rootContext.versions?.set(packageName, "0.5.5");
12
12
  }
13
13
  const {
14
14
  rootNode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stratakit/structures",
3
3
  "type": "module",
4
- "version": "0.5.4",
4
+ "version": "0.5.5",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "types": "./dist/index.d.ts",
@@ -121,7 +121,7 @@
121
121
  "dependencies": {
122
122
  "@ariakit/react": "^0.4.20",
123
123
  "@stratakit/bricks": "^0.5.4",
124
- "@stratakit/foundations": "^0.4.4",
124
+ "@stratakit/foundations": "^0.4.5",
125
125
  "classnames": "^2.5.1",
126
126
  "react-compiler-runtime": "^1.0.0",
127
127
  "zustand": "^5.0.9"
@@ -131,10 +131,10 @@
131
131
  "@types/react": "^19.2.7",
132
132
  "@types/react-dom": "^19.2.3",
133
133
  "esbuild": "^0.27.0",
134
- "react": "^19.2.1",
135
- "react-dom": "^19.2.1",
134
+ "react": "^19.2.3",
135
+ "react-dom": "^19.2.3",
136
136
  "typescript": "~5.9.3",
137
- "@stratakit/foundations": "0.4.4"
137
+ "@stratakit/foundations": "0.4.5"
138
138
  },
139
139
  "peerDependencies": {
140
140
  "react": ">=18.0.0",