@primer/react 0.0.0-20260715153559 → 0.0.0-20260715165143

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +3 -15
  2. package/dist/ActionBar/ActionBar.js +1 -1
  3. package/dist/ActionList/Group.js +1 -1
  4. package/dist/ActionList/List.js +16 -10
  5. package/dist/AnchoredOverlay/AnchoredOverlay.js +9 -3
  6. package/dist/Autocomplete/AutocompleteInput.js +10 -7
  7. package/dist/ButtonGroup/ButtonGroup.js +12 -5
  8. package/dist/Checkbox/Checkbox.js +10 -3
  9. package/dist/Dialog/Dialog.js +9 -2
  10. package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
  11. package/dist/FilteredActionList/FilteredActionList.js +15 -4
  12. package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
  13. package/dist/Overlay/Overlay.js +1 -1
  14. package/dist/PageHeader/PageHeader.js +18 -9
  15. package/dist/PageLayout/PageLayout.js +247 -53
  16. package/dist/PageLayout/index.d.ts +1 -3
  17. package/dist/PageLayout/usePaneWidth.d.ts +1 -63
  18. package/dist/PageLayout/usePaneWidth.js +36 -52
  19. package/dist/SelectPanel/SelectPanel.js +1 -1
  20. package/dist/TextInput/TextInput.js +10 -3
  21. package/dist/TooltipV2/Tooltip.js +9 -2
  22. package/dist/experimental/Tabs/types.d.ts +2 -2
  23. package/dist/experimental/Tabs/useTabList.js +15 -7
  24. package/dist/experimental/index.js +3 -3
  25. package/dist/hooks/useAnchoredPosition.js +1 -14
  26. package/dist/hooks/useMergedRefs.d.ts +4 -4
  27. package/dist/hooks/useMergedRefs.js +8 -5
  28. package/dist/hooks/useProvidedRefOrCreate.d.ts +7 -10
  29. package/dist/hooks/useProvidedRefOrCreate.js +7 -10
  30. package/dist/index.d.ts +1 -3
  31. package/dist/index.js +1 -3
  32. package/package.json +1 -1
  33. package/dist/PageLayout/DragHandle.d.ts +0 -45
  34. package/dist/PageLayout/DragHandle.js +0 -224
package/CHANGELOG.md CHANGED
@@ -1,20 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260715153559
4
-
5
- ### Minor Changes
6
-
7
- - [#8160](https://github.com/primer/react/pull/8160) [`74c731b`](https://github.com/primer/react/commit/74c731b16478bd328eb44ca87d4eb66d43f56fd8) Thanks [@TylerJDev](https://github.com/TylerJDev)! - PageLayout: Export the resize primitives `usePaneWidth` and `DragHandle` (with `defaultPaneWidth` and related types) so pane-resize behavior can be reused outside of `PageLayout`.
8
-
9
- ### Patch Changes
10
-
11
- - [#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`
12
-
13
- - Fake entry to force publishing
14
-
15
- - [#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.
16
-
17
- ## 38.32.0
3
+ ## 0.0.0-20260715165143
18
4
 
19
5
  ### Minor Changes
20
6
 
@@ -33,6 +19,8 @@
33
19
 
34
20
  ### Patch Changes
35
21
 
22
+ - Fake entry to force publishing
23
+
36
24
  - [#7901](https://github.com/primer/react/pull/7901) [`8288ed9`](https://github.com/primer/react/commit/8288ed9d88668f93cf3b1eb70ee61edac6217367) Thanks [@mattcosta7](https://github.com/mattcosta7)! - PageHeader: improve rendering performance by removing expensive `:has()` selectors. No visual or API changes.
37
25
 
38
26
  - [#8115](https://github.com/primer/react/pull/8115) [`07c530a`](https://github.com/primer/react/commit/07c530a1686ef16b68b2f2fe692b7a3327bdc02b) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Improve rendering performance in Safari by removing expensive `:has()` selectors from ActionList/NavList, Breadcrumbs, SelectPanel, and SegmentedControl. No visual or API 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": "More items",
77
+ "aria-label": `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`,
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,
@@ -1,9 +1,9 @@
1
1
  import { useId as useId$1 } from "../hooks/useId.js";
2
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
2
3
  import { invariant } from "../utils/invariant.js";
3
4
  import { useSlots } from "../hooks/useSlots.js";
4
5
  import { ListContext } from "./shared.js";
5
6
  import ActionList_module_css_default from "./ActionList.module.css.js";
6
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
7
7
  import Group_module_css_default from "./Group.module.css.js";
8
8
  import { GroupHeadingTrailingAction } from "./GroupHeadingTrailingAction.js";
9
9
  import { GroupContext } from "./GroupContext.js";
@@ -1,6 +1,8 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
3
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
3
4
  import { useId as useId$1 } from "../hooks/useId.js";
5
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
4
6
  import { fixedForwardRef } from "../utils/modern-polymorphic.js";
5
7
  import { useSlots } from "../hooks/useSlots.js";
6
8
  import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
@@ -8,11 +10,10 @@ import { ActionListContainerContext } from "./ActionListContainerContext.js";
8
10
  import { ListContext } from "./shared.js";
9
11
  import { Heading } from "./Heading.js";
10
12
  import ActionList_module_css_default from "./ActionList.module.css.js";
11
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
12
13
  import { c } from "react-compiler-runtime";
13
14
  import { clsx } from "clsx";
14
15
  import { jsx, jsxs } from "react/jsx-runtime";
15
- import React from "react";
16
+ import React, { useRef } from "react";
16
17
  //#region src/ActionList/List.tsx
17
18
  const UnwrappedList = (props, forwardedRef) => {
18
19
  var _slots$heading$props$;
@@ -60,7 +61,12 @@ const UnwrappedList = (props, forwardedRef) => {
60
61
  const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
61
62
  const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
62
63
  const listRole = role || listRoleFromContainer;
63
- const listRef = useProvidedRefOrCreate(forwardedRef);
64
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
65
+ const internalRef = useRef(null);
66
+ const mergedRef = useMergedRefs(forwardedRef, internalRef);
67
+ const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
68
+ const listRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
69
+ const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
64
70
  const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
65
71
  let enableFocusZone = false;
66
72
  if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
@@ -111,7 +117,7 @@ const UnwrappedList = (props, forwardedRef) => {
111
117
  } else t9 = $[20];
112
118
  const listContextValue = t9;
113
119
  let t10;
114
- if ($[21] !== listRef) {
120
+ if ($[21] !== listRef.current) {
115
121
  t10 = () => {
116
122
  const list = listRef.current;
117
123
  if (!list) return;
@@ -120,7 +126,7 @@ const UnwrappedList = (props, forwardedRef) => {
120
126
  if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
121
127
  else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
122
128
  };
123
- $[21] = listRef;
129
+ $[21] = listRef.current;
124
130
  $[22] = t10;
125
131
  } else t10 = $[22];
126
132
  useIsomorphicLayoutEffect(t10);
@@ -133,12 +139,12 @@ const UnwrappedList = (props, forwardedRef) => {
133
139
  } else t12 = $[24];
134
140
  const t13 = itemGapEnabled ? "" : void 0;
135
141
  let t14;
136
- if ($[25] !== Component || $[26] !== ariaLabelledBy || $[27] !== childrenWithoutSlots || $[28] !== listRef || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
142
+ if ($[25] !== Component || $[26] !== appliedRef || $[27] !== ariaLabelledBy || $[28] !== childrenWithoutSlots || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
137
143
  t14 = /*#__PURE__*/ jsx(Component, {
138
144
  className: t12,
139
145
  role: listRole,
140
146
  "aria-labelledby": ariaLabelledBy,
141
- ref: listRef,
147
+ ref: appliedRef,
142
148
  "data-component": "ActionList",
143
149
  "data-dividers": showDividers,
144
150
  "data-variant": variant,
@@ -147,9 +153,9 @@ const UnwrappedList = (props, forwardedRef) => {
147
153
  children: childrenWithoutSlots
148
154
  });
149
155
  $[25] = Component;
150
- $[26] = ariaLabelledBy;
151
- $[27] = childrenWithoutSlots;
152
- $[28] = listRef;
156
+ $[26] = appliedRef;
157
+ $[27] = ariaLabelledBy;
158
+ $[28] = childrenWithoutSlots;
153
159
  $[29] = listRole;
154
160
  $[30] = restProps;
155
161
  $[31] = showDividers;
@@ -1,12 +1,13 @@
1
1
  import { reactMajorVersion } from "../utils/environment.js";
2
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
3
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
4
  import { useAnchoredPosition } from "../hooks/useAnchoredPosition.js";
4
5
  import { useRenderForcingRef } from "../hooks/useRenderForcingRef.js";
5
6
  import { useId as useId$1 } from "../hooks/useId.js";
7
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
6
8
  import { IconButton } from "../Button/IconButton.js";
7
9
  import { useFocusTrap } from "../hooks/useFocusTrap.js";
8
10
  import { useFocusZone } from "../hooks/useFocusZone.js";
9
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
10
11
  import Overlay from "../Overlay/Overlay.js";
11
12
  import AnchoredOverlay_module_css_default from "./AnchoredOverlay.module.css.js";
12
13
  import { widthMap } from "../Overlay/constants.js";
@@ -33,6 +34,8 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
33
34
  const [anchorElement, setAnchorElement] = useState(null);
34
35
  if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
35
36
  const [overlayRef, updateOverlayRef] = useRenderForcingRef();
37
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
38
+ const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
36
39
  const [overlayElement, setOverlayElement] = useState(null);
37
40
  const anchorId = useId$1(externalAnchorId);
38
41
  const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
@@ -190,9 +193,12 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
190
193
  ...restOverlayProps,
191
194
  ...shouldRenderAsPopover ? { id: popoverId } : {},
192
195
  ref: (node) => {
193
- if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
194
- updateOverlayRef(node);
195
196
  setOverlayElement(node);
197
+ if (mergedRefEnabled) assignRef(mergedOverlayRef, node);
198
+ else {
199
+ if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
200
+ updateOverlayRef(node);
201
+ }
196
202
  },
197
203
  "data-anchor-position": cssAnchorPositioning,
198
204
  "data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
@@ -20,9 +20,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
20
20
  if (openOnFocus) setShowMenu(true);
21
21
  };
22
22
  const handleInputBlur = useCallback((event) => {
23
- onBlur && onBlur(event);
23
+ onBlur === null || onBlur === void 0 || onBlur(event);
24
24
  safeSetTimeout(() => {
25
- if (document.activeElement !== inputRef.current) {
25
+ const nextFocusedElement = event.relatedTarget;
26
+ const menuElement = document.getElementById(`${id}-listbox`);
27
+ if (!nextFocusedElement || nextFocusedElement !== menuElement && !(menuElement !== null && menuElement !== void 0 && menuElement.contains(nextFocusedElement))) {
26
28
  setShowMenu(false);
27
29
  if (inputRef.current && autocompleteSuggestion && inputRef.current.value !== inputValue) inputRef.current.value = inputValue;
28
30
  }
@@ -33,16 +35,17 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
33
35
  inputRef,
34
36
  safeSetTimeout,
35
37
  autocompleteSuggestion,
36
- inputValue
38
+ inputValue,
39
+ id
37
40
  ]);
38
41
  const handleInputChange = (event) => {
39
- onChange && onChange(event);
42
+ onChange === null || onChange === void 0 || onChange(event);
40
43
  setInputValue(event.currentTarget.value);
41
44
  if (!showMenu) setShowMenu(true);
42
45
  };
43
46
  const handleInputKeyDown = useCallback((event) => {
44
47
  var _inputRef$current;
45
- onKeyDown && onKeyDown(event);
48
+ onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
46
49
  if (event.key === "Backspace") setHighlightRemainingText(false);
47
50
  if (event.key === "Escape" && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
48
51
  setInputValue("");
@@ -58,11 +61,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
58
61
  setShowMenu
59
62
  ]);
60
63
  const handleInputKeyUp = useCallback((event) => {
61
- onKeyUp && onKeyUp(event);
64
+ onKeyUp === null || onKeyUp === void 0 || onKeyUp(event);
62
65
  if (event.key === "Backspace") setHighlightRemainingText(true);
63
66
  }, [setHighlightRemainingText, onKeyUp]);
64
67
  const onInputKeyPress = useCallback((event) => {
65
- onKeyPress && onKeyPress(event);
68
+ onKeyPress === null || onKeyPress === void 0 || onKeyPress(event);
66
69
  if (showMenu && event.key === "Enter" && activeDescendantRef.current) {
67
70
  event.preventDefault();
68
71
  event.nativeEvent.stopImmediatePropagation();
@@ -1,10 +1,12 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
2
4
  import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
3
5
  import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
4
6
  import { c } from "react-compiler-runtime";
5
7
  import { clsx } from "clsx";
6
8
  import { jsx } from "react/jsx-runtime";
7
- import React from "react";
9
+ import React, { useRef } from "react";
8
10
  //#region src/ButtonGroup/ButtonGroup.tsx
9
11
  const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
10
12
  const $ = c(20);
@@ -29,6 +31,12 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
29
31
  t1 = $[5];
30
32
  }
31
33
  const BaseComponent = t1 === void 0 ? "div" : t1;
34
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
35
+ const internalRef = useRef(null);
36
+ const mergedRef = useMergedRefs(internalRef, forwardRef);
37
+ const providedOrCreatedRef = useProvidedRefOrCreate(forwardRef);
38
+ const buttonRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
39
+ const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
32
40
  let t2;
33
41
  if ($[6] !== children) {
34
42
  t2 = React.Children.map(children, _temp);
@@ -36,7 +44,6 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
36
44
  $[7] = t2;
37
45
  } else t2 = $[7];
38
46
  const buttons = t2;
39
- const buttonRef = useProvidedRefOrCreate(forwardRef);
40
47
  const t3 = role !== "toolbar";
41
48
  let t4;
42
49
  if ($[8] !== buttonRef || $[9] !== t3) {
@@ -58,9 +65,9 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
58
65
  $[12] = t5;
59
66
  } else t5 = $[12];
60
67
  let t6;
61
- if ($[13] !== BaseComponent || $[14] !== buttonRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
68
+ if ($[13] !== BaseComponent || $[14] !== appliedRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
62
69
  t6 = /*#__PURE__*/ jsx(BaseComponent, {
63
- ref: buttonRef,
70
+ ref: appliedRef,
64
71
  className: t5,
65
72
  role,
66
73
  ...rest,
@@ -68,7 +75,7 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
68
75
  children: buttons
69
76
  });
70
77
  $[13] = BaseComponent;
71
- $[14] = buttonRef;
78
+ $[14] = appliedRef;
72
79
  $[15] = buttons;
73
80
  $[16] = rest;
74
81
  $[17] = role;
@@ -1,17 +1,24 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
3
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
4
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
3
5
  import shared_module_css_default from "./shared.module.css.js";
4
6
  import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
5
7
  import Checkbox_module_css_default from "./Checkbox.module.css.js";
6
8
  import { clsx } from "clsx";
7
9
  import { jsx } from "react/jsx-runtime";
8
- import React, { useContext, useEffect } from "react";
10
+ import React, { useContext, useEffect, useRef } from "react";
9
11
  //#region src/Checkbox/Checkbox.tsx
10
12
  /**
11
13
  * An accessible, native checkbox component
12
14
  */
13
15
  const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
14
- const checkboxRef = useProvidedRefOrCreate(ref);
16
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
17
+ const internalRef = useRef(null);
18
+ const mergedRef = useMergedRefs(internalRef, ref);
19
+ const providedOrCreatedRef = useProvidedRefOrCreate(ref);
20
+ const checkboxRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
21
+ const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
15
22
  const checkboxGroupContext = useContext(CheckboxGroupContext);
16
23
  const handleOnChange = (e) => {
17
24
  checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
@@ -24,7 +31,7 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
24
31
  const inputProps = {
25
32
  type: "checkbox",
26
33
  disabled,
27
- ref: checkboxRef,
34
+ ref: appliedRef,
28
35
  checked: indeterminate ? false : checked,
29
36
  defaultChecked,
30
37
  required,
@@ -3,6 +3,7 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
3
  import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
4
4
  import { useResizeObserver } from "../hooks/useResizeObserver.js";
5
5
  import { useId as useId$1 } from "../hooks/useId.js";
6
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
6
7
  import { IconButton } from "../Button/IconButton.js";
7
8
  import { ButtonComponent } from "../Button/Button.js";
8
9
  import { useSlots } from "../hooks/useSlots.js";
@@ -244,7 +245,13 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
244
245
  Footer.displayName = "Dialog.Footer";
245
246
  const Buttons = ({ buttons }) => {
246
247
  var _buttons$find;
247
- const autoFocusRef = useProvidedRefOrCreate((_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
248
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
249
+ const providedButtonRef = (_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref;
250
+ const internalRef = useRef(null);
251
+ const mergedRef = useMergedRefs(internalRef, providedButtonRef);
252
+ const providedOrCreatedRef = useProvidedRefOrCreate(providedButtonRef);
253
+ const autoFocusRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
254
+ const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
248
255
  let autoFocusCount = 0;
249
256
  const [hasRendered, setHasRendered] = useState(0);
250
257
  useEffect(() => {
@@ -259,7 +266,7 @@ const Buttons = ({ buttons }) => {
259
266
  "data-component": "Dialog.FooterButton",
260
267
  ...buttonProps,
261
268
  variant: buttonType === "normal" ? "default" : buttonType,
262
- ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
269
+ ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, appliedRef) : null,
263
270
  children: content
264
271
  }, index);
265
272
  }) });
@@ -7,7 +7,8 @@ const DefaultFeatureFlags = FeatureFlagScope.create({
7
7
  primer_react_styled_react_use_primer_theme_providers: false,
8
8
  primer_react_action_list_group_heading_trailing_action: false,
9
9
  primer_react_action_list_item_gap: false,
10
- primer_react_timeline_list_semantics: false
10
+ primer_react_timeline_list_semantics: false,
11
+ primer_react_merged_forwarded_refs: false
11
12
  });
12
13
  //#endregion
13
14
  export { DefaultFeatureFlags };
@@ -1,7 +1,9 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
2
3
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
4
  import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
4
5
  import { useId as useId$1 } from "../hooks/useId.js";
6
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
5
7
  import { useFocusZone } from "../hooks/useFocusZone.js";
6
8
  import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
7
9
  import { ActionList } from "../ActionList/index.js";
@@ -34,8 +36,17 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
34
36
  }, [onFilterChange, setInternalFilterValue]);
35
37
  const inputAndListContainerRef = useRef(null);
36
38
  const listRef = useRef(null);
37
- const scrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
38
- const inputRef = useProvidedRefOrCreate(providedInputRef);
39
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
40
+ const internalScrollContainerRef = useRef(null);
41
+ const mergedScrollContainerRef = useMergedRefs(internalScrollContainerRef, providedScrollContainerRef);
42
+ const providedOrCreatedScrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
43
+ const scrollContainerRef = mergedRefEnabled ? internalScrollContainerRef : providedOrCreatedScrollContainerRef;
44
+ const appliedScrollContainerRef = mergedRefEnabled ? mergedScrollContainerRef : providedOrCreatedScrollContainerRef;
45
+ const internalInputRef = useRef(null);
46
+ const mergedInputRef = useMergedRefs(internalInputRef, providedInputRef);
47
+ const providedOrCreatedInputRef = useProvidedRefOrCreate(providedInputRef);
48
+ const inputRef = mergedRefEnabled ? internalInputRef : providedOrCreatedInputRef;
49
+ const appliedInputRef = mergedRefEnabled ? mergedInputRef : providedOrCreatedInputRef;
39
50
  const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
40
51
  const [listContainerElement, setListContainerElement] = useState(null);
41
52
  const activeDescendantRef = useRef();
@@ -290,7 +301,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
290
301
  "data-component": "FilteredActionList",
291
302
  children: [
292
303
  /*#__PURE__*/ jsx(FilteredActionListInput, {
293
- inputRef,
304
+ inputRef: appliedInputRef,
294
305
  value: filterValue,
295
306
  onInputChange,
296
307
  onInputKeyPress,
@@ -324,7 +335,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
324
335
  })]
325
336
  }),
326
337
  /*#__PURE__*/ jsx("div", {
327
- ref: scrollContainerRef,
338
+ ref: appliedScrollContainerRef,
328
339
  className: FilteredActionList_module_css_default.Container,
329
340
  children: getBodyContent()
330
341
  })
@@ -3,7 +3,7 @@ import React from "react";
3
3
 
4
4
  //#region src/FilteredActionList/FilteredActionListInput.d.ts
5
5
  interface FilteredActionListInputProps extends Partial<Omit<TextInputProps, 'onChange' | 'onKeyDown'>> {
6
- inputRef: React.RefObject<HTMLInputElement | null>;
6
+ inputRef: React.Ref<HTMLInputElement | null>;
7
7
  onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
8
  onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
9
9
  onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
@@ -1,8 +1,8 @@
1
1
  import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
2
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
3
3
  import { useOverlay } from "../hooks/useOverlay.js";
4
- import Portal_default from "../Portal/index.js";
5
4
  import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
5
+ import Portal_default from "../Portal/index.js";
6
6
  import Overlay_module_css_default from "./Overlay.module.css.js";
7
7
  import { clsx } from "clsx";
8
8
  import { jsx } from "react/jsx-runtime";
@@ -1,5 +1,7 @@
1
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
3
  import { warning } from "../utils/warning.js";
4
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
3
5
  import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
4
6
  import { isSlot } from "../utils/is-slot.js";
5
7
  import { getResponsiveAttributes } from "../internal/utils/getResponsiveAttributes.js";
@@ -10,7 +12,7 @@ import PageHeader_module_css_default from "./PageHeader.module.css.js";
10
12
  import { c } from "react-compiler-runtime";
11
13
  import { clsx } from "clsx";
12
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
- import React, { useEffect } from "react";
15
+ import React, { useEffect, useRef } from "react";
14
16
  import { ArrowLeftIcon } from "@primer/octicons-react";
15
17
  //#region src/PageHeader/PageHeader.tsx
16
18
  const hiddenOnRegularAndWide = {
@@ -27,7 +29,12 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
27
29
  const $ = c(17);
28
30
  const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
29
31
  const BaseComponent = t1 === void 0 ? "div" : t1;
30
- const rootRef = useProvidedRefOrCreate(forwardedRef);
32
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
33
+ const internalRef = useRef(null);
34
+ const mergedRef = useMergedRefs(internalRef, forwardedRef);
35
+ const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
36
+ const rootRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
37
+ const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
31
38
  const hoistChildState = (nodes) => {
32
39
  const result = { hasNavigation: false };
33
40
  for (const child of React.Children.toArray(nodes)) {
@@ -89,9 +96,9 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
89
96
  const t8 = getResponsiveAttributes("title-size-variant", titleVariant);
90
97
  const t9 = getNavHiddenDataAttributes(navigationHidden);
91
98
  let t10;
92
- if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t6 || $[13] !== t7 || $[14] !== t8 || $[15] !== t9) {
99
+ if ($[6] !== BaseComponent || $[7] !== appliedRef || $[8] !== ariaLabel || $[9] !== children || $[10] !== role || $[11] !== t4 || $[12] !== t6 || $[13] !== t7 || $[14] !== t8 || $[15] !== t9) {
93
100
  t10 = /*#__PURE__*/ jsx(BaseComponent, {
94
- ref: rootRef,
101
+ ref: appliedRef,
95
102
  className: t4,
96
103
  "data-component": t5,
97
104
  "data-has-border": t6,
@@ -103,10 +110,10 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
103
110
  children
104
111
  });
105
112
  $[6] = BaseComponent;
106
- $[7] = ariaLabel;
107
- $[8] = children;
108
- $[9] = role;
109
- $[10] = rootRef;
113
+ $[7] = appliedRef;
114
+ $[8] = ariaLabel;
115
+ $[9] = children;
116
+ $[10] = role;
110
117
  $[11] = t4;
111
118
  $[12] = t6;
112
119
  $[13] = t7;
@@ -295,7 +302,9 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
295
302
  const { children, className, hidden: t1, variant: t2 } = t0;
296
303
  const hidden = t1 === void 0 ? false : t1;
297
304
  const variant = t2 === void 0 ? "medium" : t2;
298
- const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
305
+ const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
306
+ const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
307
+ const titleAreaRef = mergedRefEnabled ? forwardedRef : providedOrCreatedRef;
299
308
  let t3;
300
309
  if ($[0] !== className) {
301
310
  t3 = clsx(PageHeader_module_css_default.TitleArea, className);