@primer/react 38.32.0 → 38.32.1-rc.3a244cb73
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,13 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
+
## 38.32.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#8064](https://github.com/primer/react/pull/8064) [`eb447fe`](https://github.com/primer/react/commit/eb447fef0f1565934dc38d09df21d8063957aa9d) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Update the ActionBar overflow menu anchor label to `More items`
|
|
8
|
+
|
|
9
|
+
- [#8116](https://github.com/primer/react/pull/8116) [`cade4af`](https://github.com/primer/react/commit/cade4af9a70f3fd2622031af585dc07dccd79e11) Thanks [@mattcosta7](https://github.com/mattcosta7)! - `useAnchoredPosition`: improve performance by caching the scrollable-ancestor walk per anchor, reducing repositioning work for overlays, menus, and tooltips.
|
|
10
|
+
|
|
3
11
|
## 38.32.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -74,7 +74,7 @@ const ActionBar = ({ size = "medium", children, "aria-label": ariaLabel, "aria-l
|
|
|
74
74
|
})]
|
|
75
75
|
}), /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
76
76
|
variant: "invisible",
|
|
77
|
-
"aria-label":
|
|
77
|
+
"aria-label": "More items",
|
|
78
78
|
icon: KebabHorizontalIcon,
|
|
79
79
|
className: ActionBar_module_css_default.MoreButton,
|
|
80
80
|
"data-more-button-inactive": overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true,
|
|
@@ -106,6 +106,10 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
106
106
|
}, [updatePosition]);
|
|
107
107
|
useResizeObserver(updatePosition, void 0, [], enabled);
|
|
108
108
|
useResizeObserver(updatePosition, floatingElementRef, [], enabled);
|
|
109
|
+
const scrollAncestorsCacheRef = React.useRef({
|
|
110
|
+
anchor: null,
|
|
111
|
+
scrollables: []
|
|
112
|
+
});
|
|
109
113
|
React.useEffect(() => {
|
|
110
114
|
if (!enabled) return;
|
|
111
115
|
const anchorEl = anchorElementRef.current;
|
|
@@ -118,7 +122,16 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
118
122
|
updatePosition();
|
|
119
123
|
});
|
|
120
124
|
};
|
|
121
|
-
const
|
|
125
|
+
const cache = scrollAncestorsCacheRef.current;
|
|
126
|
+
let scrollables;
|
|
127
|
+
if (cache.anchor === anchorEl) scrollables = cache.scrollables;
|
|
128
|
+
else {
|
|
129
|
+
scrollables = getScrollableAncestors(anchorEl);
|
|
130
|
+
scrollAncestorsCacheRef.current = {
|
|
131
|
+
anchor: anchorEl,
|
|
132
|
+
scrollables
|
|
133
|
+
};
|
|
134
|
+
}
|
|
122
135
|
for (const scrollable of scrollables) scrollable.addEventListener("scroll", handleScroll);
|
|
123
136
|
return () => {
|
|
124
137
|
for (const scrollable of scrollables) scrollable.removeEventListener("scroll", handleScroll);
|
package/package.json
CHANGED