@primer/react 0.0.0-20260330232224 → 0.0.0-20260331001856

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,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260330232224
3
+ ## 0.0.0-20260331001856
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -8,8 +8,6 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
- - [#7652](https://github.com/primer/react/pull/7652) [`fbacefb`](https://github.com/primer/react/commit/fbacefb3aef577adb01500e30c1c6957a61491f1) Thanks [@owenniblock](https://github.com/owenniblock)! - useAnchoredPosition: recalculate overlay position when any scrollable ancestor (or the window) is scrolled.
12
-
13
11
  - [#7638](https://github.com/primer/react/pull/7638) [`f04e85d`](https://github.com/primer/react/commit/f04e85df536cd6e8047f70b070bd3cf7c0961f92) Thanks [@iansan5653](https://github.com/iansan5653)! - Update internal implementations of combined refs to improve performance and add support for React 19 callback refs
14
12
 
15
13
  - Fake entry to force publishing
@@ -1 +1 @@
1
- {"version":3,"file":"useAnchoredPosition.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnchoredPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AA0BvE,MAAM,WAAW,4BAA6B,SAAQ,OAAO,CAAC,gBAAgB,CAAC;IAC7E,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACpD,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IAClD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAA;CACl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reate } from './useProvidedRefOrCreate.js';
4
4
  import { useResizeObserver } from './useResizeObserver.js';
5
5
  import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
6
6
 
7
- /**
8
- * Returns all scrollable ancestor elements of the given element, plus the window.
9
- * An element is scrollable if its computed overflow/overflow-x/overflow-y is
10
- * 'auto', 'scroll', or 'overlay'.
11
- */
12
- function getScrollableAncestors(element) {
13
- const scrollables = [];
14
- let current = element.parentElement;
15
- while (current) {
16
- const style = getComputedStyle(current);
17
- const overflowY = style.overflowY;
18
- const overflowX = style.overflowX;
19
- if (/auto|scroll|overlay/.test(overflowY) || /auto|scroll|overlay/.test(overflowX)) {
20
- scrollables.push(current);
21
- }
22
- current = current.parentElement;
23
- }
24
- scrollables.push(window);
25
- return scrollables;
26
- }
27
7
  /**
28
8
  * Calculates the top and left values for an absolutely-positioned floating element
29
9
  * to be anchored to some anchor element. Returns refs for the floating element
@@ -96,33 +76,6 @@ function useAnchoredPosition(settings, dependencies = []) {
96
76
  useResizeObserver(updatePosition); // watches for changes in window size
97
77
  useResizeObserver(updatePosition, floatingElementRef); // watches for changes in floating element size
98
78
 
99
- // Recalculate position when any scrollable ancestor of the anchor scrolls.
100
- // Uses requestAnimationFrame to avoid layout thrashing during scroll.
101
- React.useEffect(() => {
102
- const anchorEl = anchorElementRef.current;
103
- if (!anchorEl) return;
104
- let rafId = null;
105
- const handleScroll = () => {
106
- if (rafId !== null) return;
107
- rafId = requestAnimationFrame(() => {
108
- rafId = null;
109
- updatePosition();
110
- });
111
- };
112
- const scrollables = getScrollableAncestors(anchorEl);
113
- for (const scrollable of scrollables) {
114
- // eslint-disable-next-line github/prefer-observers -- IntersectionObserver cannot detect continuous scroll position changes needed for repositioning
115
- scrollable.addEventListener('scroll', handleScroll);
116
- }
117
- return () => {
118
- for (const scrollable of scrollables) {
119
- scrollable.removeEventListener('scroll', handleScroll);
120
- }
121
- if (rafId !== null) {
122
- cancelAnimationFrame(rafId);
123
- }
124
- };
125
- }, [anchorElementRef, updatePosition]);
126
79
  return {
127
80
  floatingElementRef,
128
81
  anchorElementRef,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260330232224",
4
+ "version": "0.0.0-20260331001856",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",