@primer/react 38.34.0-rc.dad320815 → 38.34.0-rc.f86dc8614

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
@@ -8,12 +8,8 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
- - [#8211](https://github.com/primer/react/pull/8211) [`a3e669f`](https://github.com/primer/react/commit/a3e669fa551a7d07841ce20224199d172905860f) Thanks [@francinelucca](https://github.com/francinelucca)! - Link: Remove unnecessary `data-hover-color` attribute from rendered DOM element
12
-
13
11
  - [#8169](https://github.com/primer/react/pull/8169) [`1d6f559`](https://github.com/primer/react/commit/1d6f5593f5e482d1d03027522bc882560c7b1f06) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Timeline: `Timeline.Actions` now wraps onto a new row below `Timeline.Body`, left-aligned with the body content, when `Timeline.Item` is narrower than 480px.
14
12
 
15
- - [#8214](https://github.com/primer/react/pull/8214) [`41705f4`](https://github.com/primer/react/commit/41705f430ce0f64eb61c2665313f36a88cf6f16c) Thanks [@rickyzhangca](https://github.com/rickyzhangca)! - UnderlinePanels: The experimental `UnderlinePanels` component is now built on the experimental `Tabs` component instead of `@github/tab-container-element`. Its public API and behavior are unchanged.
16
-
17
13
  ## 38.33.0
18
14
 
19
15
  ### Minor Changes
@@ -1,9 +1,9 @@
1
1
  import { useId as useId$1 } from "../hooks/useId.js";
2
2
  import { useSlots } from "../hooks/useSlots.js";
3
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
4
3
  import { invariant } from "../utils/invariant.js";
5
4
  import { ListContext } from "./shared.js";
6
5
  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,19 +1,18 @@
1
- import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
1
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
2
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
4
3
  import { useId as useId$1 } from "../hooks/useId.js";
5
4
  import { useSlots } from "../hooks/useSlots.js";
6
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
7
5
  import { fixedForwardRef } from "../utils/modern-polymorphic.js";
8
6
  import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
9
7
  import { ActionListContainerContext } from "./ActionListContainerContext.js";
10
8
  import { ListContext } from "./shared.js";
11
9
  import { Heading } from "./Heading.js";
12
10
  import ActionList_module_css_default from "./ActionList.module.css.js";
11
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
13
12
  import { c } from "react-compiler-runtime";
14
13
  import { clsx } from "clsx";
15
14
  import { jsx, jsxs } from "react/jsx-runtime";
16
- import React, { useRef } from "react";
15
+ import React from "react";
17
16
  //#region src/ActionList/List.tsx
18
17
  const UnwrappedList = (props, forwardedRef) => {
19
18
  var _slots$heading$props$;
@@ -61,12 +60,7 @@ const UnwrappedList = (props, forwardedRef) => {
61
60
  const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
62
61
  const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
63
62
  const listRole = role || listRoleFromContainer;
64
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
65
- const listRef = useRef(null);
66
- const mergedRef = useMergedRefs(listRef, forwardedRef);
67
- const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
68
- const readRef = mergedRefEnabled ? listRef : providedOrCreatedRef;
69
- const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
63
+ const listRef = useProvidedRefOrCreate(forwardedRef);
70
64
  const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
71
65
  let enableFocusZone = false;
72
66
  if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
@@ -85,14 +79,14 @@ const UnwrappedList = (props, forwardedRef) => {
85
79
  const t5 = !enableFocusZone;
86
80
  const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : void 0;
87
81
  let t7;
88
- if ($[11] !== readRef || $[12] !== t5 || $[13] !== t6) {
82
+ if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
89
83
  t7 = {
90
84
  disabled: t5,
91
- containerRef: readRef,
85
+ containerRef: listRef,
92
86
  bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
93
87
  focusOutBehavior: t6
94
88
  };
95
- $[11] = readRef;
89
+ $[11] = listRef;
96
90
  $[12] = t5;
97
91
  $[13] = t6;
98
92
  $[14] = t7;
@@ -117,16 +111,16 @@ const UnwrappedList = (props, forwardedRef) => {
117
111
  } else t9 = $[20];
118
112
  const listContextValue = t9;
119
113
  let t10;
120
- if ($[21] !== readRef.current) {
114
+ if ($[21] !== listRef) {
121
115
  t10 = () => {
122
- const list = readRef.current;
116
+ const list = listRef.current;
123
117
  if (!list) return;
124
118
  const hasMixed = list.querySelector("[data-has-description=\"true\"]") !== null && list.querySelector("[data-has-description=\"false\"]") !== null;
125
119
  const current = list.getAttribute("data-mixed-descriptions");
126
120
  if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
127
121
  else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
128
122
  };
129
- $[21] = readRef.current;
123
+ $[21] = listRef;
130
124
  $[22] = t10;
131
125
  } else t10 = $[22];
132
126
  useIsomorphicLayoutEffect(t10);
@@ -139,12 +133,12 @@ const UnwrappedList = (props, forwardedRef) => {
139
133
  } else t12 = $[24];
140
134
  const t13 = itemGapEnabled ? "" : void 0;
141
135
  let t14;
142
- if ($[25] !== Component || $[26] !== appliedRef || $[27] !== ariaLabelledBy || $[28] !== childrenWithoutSlots || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
136
+ if ($[25] !== Component || $[26] !== ariaLabelledBy || $[27] !== childrenWithoutSlots || $[28] !== listRef || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
143
137
  t14 = /*#__PURE__*/ jsx(Component, {
144
138
  className: t12,
145
139
  role: listRole,
146
140
  "aria-labelledby": ariaLabelledBy,
147
- ref: appliedRef,
141
+ ref: listRef,
148
142
  "data-component": "ActionList",
149
143
  "data-dividers": showDividers,
150
144
  "data-variant": variant,
@@ -153,9 +147,9 @@ const UnwrappedList = (props, forwardedRef) => {
153
147
  children: childrenWithoutSlots
154
148
  });
155
149
  $[25] = Component;
156
- $[26] = appliedRef;
157
- $[27] = ariaLabelledBy;
158
- $[28] = childrenWithoutSlots;
150
+ $[26] = ariaLabelledBy;
151
+ $[27] = childrenWithoutSlots;
152
+ $[28] = listRef;
159
153
  $[29] = listRole;
160
154
  $[30] = restProps;
161
155
  $[31] = showDividers;
@@ -1,13 +1,12 @@
1
1
  import { reactMajorVersion } from "../utils/environment.js";
2
- import { useMergedRefs } from "../hooks/useMergedRefs.js";
3
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
4
3
  import { useAnchoredPosition } from "../hooks/useAnchoredPosition.js";
5
4
  import { useRenderForcingRef } from "../hooks/useRenderForcingRef.js";
6
5
  import { useId as useId$1 } from "../hooks/useId.js";
7
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
8
6
  import { IconButton } from "../Button/IconButton.js";
9
7
  import { useFocusTrap } from "../hooks/useFocusTrap.js";
10
8
  import { useFocusZone } from "../hooks/useFocusZone.js";
9
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
11
10
  import Overlay from "../Overlay/Overlay.js";
12
11
  import AnchoredOverlay_module_css_default from "./AnchoredOverlay.module.css.js";
13
12
  import { widthMap } from "../Overlay/constants.js";
@@ -34,9 +33,7 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
34
33
  const [anchorElement, setAnchorElement] = useState(null);
35
34
  if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
36
35
  const [overlayRef, updateOverlayRef] = useRenderForcingRef();
37
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
38
36
  const [overlayElement, setOverlayElement] = useState(null);
39
- const mergedOverlayRef = useMergedRefs(updateOverlayRef, useMergedRefs(overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref, setOverlayElement));
40
37
  const anchorId = useId$1(externalAnchorId);
41
38
  const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
42
39
  const onEscape = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("escape"), [onClose]);
@@ -193,10 +190,10 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
193
190
  ...shouldRenderAsPopover ? { popover: "manual" } : {},
194
191
  ...restOverlayProps,
195
192
  ...shouldRenderAsPopover ? { id: popoverId } : {},
196
- ref: mergedRefEnabled ? mergedOverlayRef : (node) => {
197
- setOverlayElement(node);
193
+ ref: (node) => {
198
194
  if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
199
195
  updateOverlayRef(node);
196
+ setOverlayElement(node);
200
197
  },
201
198
  "data-anchor-position": cssAnchorPositioning,
202
199
  "data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
@@ -20,11 +20,9 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
20
20
  if (openOnFocus) setShowMenu(true);
21
21
  };
22
22
  const handleInputBlur = useCallback((event) => {
23
- onBlur === null || onBlur === void 0 || onBlur(event);
23
+ onBlur && onBlur(event);
24
24
  safeSetTimeout(() => {
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))) {
25
+ if (document.activeElement !== inputRef.current) {
28
26
  setShowMenu(false);
29
27
  if (inputRef.current && autocompleteSuggestion && inputRef.current.value !== inputValue) inputRef.current.value = inputValue;
30
28
  }
@@ -35,17 +33,16 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
35
33
  inputRef,
36
34
  safeSetTimeout,
37
35
  autocompleteSuggestion,
38
- inputValue,
39
- id
36
+ inputValue
40
37
  ]);
41
38
  const handleInputChange = (event) => {
42
- onChange === null || onChange === void 0 || onChange(event);
39
+ onChange && onChange(event);
43
40
  setInputValue(event.currentTarget.value);
44
41
  if (!showMenu) setShowMenu(true);
45
42
  };
46
43
  const handleInputKeyDown = useCallback((event) => {
47
44
  var _inputRef$current;
48
- onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
45
+ onKeyDown && onKeyDown(event);
49
46
  if (event.key === "Backspace") setHighlightRemainingText(false);
50
47
  if (event.key === "Escape" && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
51
48
  setInputValue("");
@@ -61,11 +58,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
61
58
  setShowMenu
62
59
  ]);
63
60
  const handleInputKeyUp = useCallback((event) => {
64
- onKeyUp === null || onKeyUp === void 0 || onKeyUp(event);
61
+ onKeyUp && onKeyUp(event);
65
62
  if (event.key === "Backspace") setHighlightRemainingText(true);
66
63
  }, [setHighlightRemainingText, onKeyUp]);
67
64
  const onInputKeyPress = useCallback((event) => {
68
- onKeyPress === null || onKeyPress === void 0 || onKeyPress(event);
65
+ onKeyPress && onKeyPress(event);
69
66
  if (showMenu && event.key === "Enter" && activeDescendantRef.current) {
70
67
  event.preventDefault();
71
68
  event.nativeEvent.stopImmediatePropagation();
@@ -1,12 +1,10 @@
1
- import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
1
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
4
2
  import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
5
3
  import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
6
4
  import { c } from "react-compiler-runtime";
7
5
  import { clsx } from "clsx";
8
6
  import { jsx } from "react/jsx-runtime";
9
- import React, { useRef } from "react";
7
+ import React from "react";
10
8
  //#region src/ButtonGroup/ButtonGroup.tsx
11
9
  const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
12
10
  const $ = c(20);
@@ -31,12 +29,6 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
31
29
  t1 = $[5];
32
30
  }
33
31
  const BaseComponent = t1 === void 0 ? "div" : t1;
34
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
35
- const buttonRef = useRef(null);
36
- const mergedRef = useMergedRefs(buttonRef, forwardRef);
37
- const providedOrCreatedRef = useProvidedRefOrCreate(forwardRef);
38
- const readRef = mergedRefEnabled ? buttonRef : providedOrCreatedRef;
39
- const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
40
32
  let t2;
41
33
  if ($[6] !== children) {
42
34
  t2 = React.Children.map(children, _temp);
@@ -44,16 +36,17 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
44
36
  $[7] = t2;
45
37
  } else t2 = $[7];
46
38
  const buttons = t2;
39
+ const buttonRef = useProvidedRefOrCreate(forwardRef);
47
40
  const t3 = role !== "toolbar";
48
41
  let t4;
49
- if ($[8] !== readRef || $[9] !== t3) {
42
+ if ($[8] !== buttonRef || $[9] !== t3) {
50
43
  t4 = {
51
- containerRef: readRef,
44
+ containerRef: buttonRef,
52
45
  disabled: t3,
53
46
  bindKeys: FocusKeys.ArrowHorizontal,
54
47
  focusOutBehavior: "wrap"
55
48
  };
56
- $[8] = readRef;
49
+ $[8] = buttonRef;
57
50
  $[9] = t3;
58
51
  $[10] = t4;
59
52
  } else t4 = $[10];
@@ -65,9 +58,9 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
65
58
  $[12] = t5;
66
59
  } else t5 = $[12];
67
60
  let t6;
68
- if ($[13] !== BaseComponent || $[14] !== appliedRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
61
+ if ($[13] !== BaseComponent || $[14] !== buttonRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
69
62
  t6 = /*#__PURE__*/ jsx(BaseComponent, {
70
- ref: appliedRef,
63
+ ref: buttonRef,
71
64
  className: t5,
72
65
  role,
73
66
  ...rest,
@@ -75,7 +68,7 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
75
68
  children: buttons
76
69
  });
77
70
  $[13] = BaseComponent;
78
- $[14] = appliedRef;
71
+ $[14] = buttonRef;
79
72
  $[15] = buttons;
80
73
  $[16] = rest;
81
74
  $[17] = role;
@@ -1,37 +1,30 @@
1
- import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
1
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
2
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
4
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
5
3
  import shared_module_css_default from "./shared.module.css.js";
6
4
  import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
7
5
  import Checkbox_module_css_default from "./Checkbox.module.css.js";
8
6
  import { clsx } from "clsx";
9
7
  import { jsx } from "react/jsx-runtime";
10
- import React, { useContext, useEffect, useRef } from "react";
8
+ import React, { useContext, useEffect } from "react";
11
9
  //#region src/Checkbox/Checkbox.tsx
12
10
  /**
13
11
  * An accessible, native checkbox component
14
12
  */
15
13
  const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
16
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
17
- const checkboxRef = useRef(null);
18
- const mergedRef = useMergedRefs(checkboxRef, ref);
19
- const providedOrCreatedRef = useProvidedRefOrCreate(ref);
20
- const readRef = mergedRefEnabled ? checkboxRef : providedOrCreatedRef;
21
- const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
14
+ const checkboxRef = useProvidedRefOrCreate(ref);
22
15
  const checkboxGroupContext = useContext(CheckboxGroupContext);
23
16
  const handleOnChange = (e) => {
24
17
  checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
25
18
  onChange && onChange(e);
26
- if (indeterminate && readRef.current) {
27
- readRef.current.indeterminate = true;
28
- readRef.current.setAttribute("aria-checked", "mixed");
19
+ if (indeterminate && checkboxRef.current) {
20
+ checkboxRef.current.indeterminate = true;
21
+ checkboxRef.current.setAttribute("aria-checked", "mixed");
29
22
  }
30
23
  };
31
24
  const inputProps = {
32
25
  type: "checkbox",
33
26
  disabled,
34
- ref: appliedRef,
27
+ ref: checkboxRef,
35
28
  checked: indeterminate ? false : checked,
36
29
  defaultChecked,
37
30
  required,
@@ -43,14 +36,14 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
43
36
  ...rest
44
37
  };
45
38
  useIsomorphicLayoutEffect(() => {
46
- if (readRef.current) readRef.current.indeterminate = indeterminate || false;
39
+ if (checkboxRef.current) checkboxRef.current.indeterminate = indeterminate || false;
47
40
  }, [
48
41
  indeterminate,
49
42
  checked,
50
- readRef
43
+ checkboxRef
51
44
  ]);
52
45
  useEffect(() => {
53
- const { current: checkbox } = readRef;
46
+ const { current: checkbox } = checkboxRef;
54
47
  if (!checkbox) return;
55
48
  if (indeterminate) checkbox.setAttribute("aria-checked", "mixed");
56
49
  else checkbox.setAttribute("aria-checked", checkbox.checked ? "true" : "false");
@@ -4,7 +4,6 @@ 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
6
  import { useSlots } from "../hooks/useSlots.js";
7
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
8
7
  import { IconButton } from "../Button/IconButton.js";
9
8
  import { ButtonComponent } from "../Button/Button.js";
10
9
  import { useFocusTrap } from "../hooks/useFocusTrap.js";
@@ -245,28 +244,22 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
245
244
  Footer.displayName = "Dialog.Footer";
246
245
  const Buttons = ({ buttons }) => {
247
246
  var _buttons$find;
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 autoFocusRef = useRef(null);
251
- const mergedRef = useMergedRefs(autoFocusRef, providedButtonRef);
252
- const providedOrCreatedRef = useProvidedRefOrCreate(providedButtonRef);
253
- const readRef = mergedRefEnabled ? autoFocusRef : providedOrCreatedRef;
254
- const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
247
+ const autoFocusRef = useProvidedRefOrCreate((_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
255
248
  let autoFocusCount = 0;
256
249
  const [hasRendered, setHasRendered] = useState(0);
257
250
  useEffect(() => {
258
251
  if (hasRendered === 1) {
259
- var _readRef$current;
260
- (_readRef$current = readRef.current) === null || _readRef$current === void 0 || _readRef$current.focus();
252
+ var _autoFocusRef$current;
253
+ (_autoFocusRef$current = autoFocusRef.current) === null || _autoFocusRef$current === void 0 || _autoFocusRef$current.focus();
261
254
  } else setHasRendered(hasRendered + 1);
262
- }, [readRef, hasRendered]);
255
+ }, [autoFocusRef, hasRendered]);
263
256
  return /*#__PURE__*/ jsx(Fragment, { children: buttons.map((dialogButtonProps, index) => {
264
257
  const { content, buttonType = "default", autoFocus = false, ...buttonProps } = dialogButtonProps;
265
258
  return /*#__PURE__*/ jsx(ButtonComponent, {
266
259
  "data-component": "Dialog.FooterButton",
267
260
  ...buttonProps,
268
261
  variant: buttonType === "normal" ? "default" : buttonType,
269
- ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, appliedRef) : null,
262
+ ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
270
263
  children: content
271
264
  }, index);
272
265
  }) });
@@ -7,8 +7,7 @@ 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,
11
- primer_react_merged_forwarded_refs: false
10
+ primer_react_timeline_list_semantics: false
12
11
  });
13
12
  //#endregion
14
13
  export { DefaultFeatureFlags };
@@ -1,9 +1,7 @@
1
- import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
1
  import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
3
2
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
4
3
  import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
5
4
  import { useId as useId$1 } from "../hooks/useId.js";
6
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
7
5
  import { useFocusZone } from "../hooks/useFocusZone.js";
8
6
  import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
9
7
  import { ActionList } from "../ActionList/index.js";
@@ -36,17 +34,8 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
36
34
  }, [onFilterChange, setInternalFilterValue]);
37
35
  const inputAndListContainerRef = useRef(null);
38
36
  const listRef = useRef(null);
39
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
40
- const scrollContainerRef = useRef(null);
41
- const mergedScrollContainerRef = useMergedRefs(scrollContainerRef, providedScrollContainerRef);
42
- const providedOrCreatedScrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
43
- const readScrollContainerRef = mergedRefEnabled ? scrollContainerRef : providedOrCreatedScrollContainerRef;
44
- const appliedScrollContainerRef = mergedRefEnabled ? mergedScrollContainerRef : providedOrCreatedScrollContainerRef;
45
- const inputRef = useRef(null);
46
- const mergedInputRef = useMergedRefs(inputRef, providedInputRef);
47
- const providedOrCreatedInputRef = useProvidedRefOrCreate(providedInputRef);
48
- const readInputRef = mergedRefEnabled ? inputRef : providedOrCreatedInputRef;
49
- const appliedInputRef = mergedRefEnabled ? mergedInputRef : providedOrCreatedInputRef;
37
+ const scrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
38
+ const inputRef = useProvidedRefOrCreate(providedInputRef);
50
39
  const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
51
40
  const [listContainerElement, setListContainerElement] = useState(null);
52
41
  const activeDescendantRef = useRef();
@@ -100,12 +89,12 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
100
89
  onListContainerRefChanged === null || onListContainerRefChanged === void 0 || onListContainerRefChanged(node);
101
90
  }, [onListContainerRefChanged]);
102
91
  useEffect(() => {
103
- onInputRefChanged === null || onInputRefChanged === void 0 || onInputRefChanged(readInputRef);
104
- }, [readInputRef, onInputRefChanged]);
92
+ onInputRefChanged === null || onInputRefChanged === void 0 || onInputRefChanged(inputRef);
93
+ }, [inputRef, onInputRefChanged]);
105
94
  const DEFAULT_VIRTUAL_ITEM_HEIGHT = 32;
106
95
  const virtualizer = useVirtualizer({
107
96
  count: items.length,
108
- getScrollElement: () => readScrollContainerRef.current,
97
+ getScrollElement: () => scrollContainerRef.current,
109
98
  estimateSize: () => DEFAULT_VIRTUAL_ITEM_HEIGHT,
110
99
  overscan: 10,
111
100
  enabled: isVirtualized,
@@ -139,7 +128,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
139
128
  focusableElementFilter: (element) => {
140
129
  return !(element instanceof HTMLInputElement);
141
130
  },
142
- activeDescendantFocus: readInputRef,
131
+ activeDescendantFocus: inputRef,
143
132
  onActiveDescendantChanged: (current, previous, directlyActivated) => {
144
133
  activeDescendantRef.current = current;
145
134
  if (isVirtualized && current) {
@@ -147,7 +136,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
147
136
  const range = virtualizer.range;
148
137
  if (index !== null && range && (Number(index) < range.startIndex || Number(index) >= range.endIndex)) virtualizer.scrollToIndex(Number(index), { align: "auto" });
149
138
  }
150
- if (current && readScrollContainerRef.current && (directlyActivated || focusPrependedElements)) scrollIntoView(current, readScrollContainerRef.current, {
139
+ if (current && scrollContainerRef.current && (directlyActivated || focusPrependedElements)) scrollIntoView(current, scrollContainerRef.current, {
151
140
  ...menuScrollMargins,
152
141
  behavior: scrollBehavior
153
142
  });
@@ -164,14 +153,14 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
164
153
  isVirtualized
165
154
  ]);
166
155
  useEffect(() => {
167
- if (activeDescendantRef.current && readScrollContainerRef.current) scrollIntoView(activeDescendantRef.current, readScrollContainerRef.current, {
156
+ if (activeDescendantRef.current && scrollContainerRef.current) scrollIntoView(activeDescendantRef.current, scrollContainerRef.current, {
168
157
  ...menuScrollMargins,
169
158
  behavior: scrollBehavior
170
159
  });
171
160
  }, [
172
161
  items,
173
- readInputRef,
174
- readScrollContainerRef,
162
+ inputRef,
163
+ scrollContainerRef,
175
164
  scrollBehavior
176
165
  ]);
177
166
  useEffect(() => {
@@ -181,7 +170,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
181
170
  const list = listRef.current;
182
171
  if (!list) return;
183
172
  const handleFocusIn = (event) => {
184
- if (event.target === readInputRef.current || list.contains(event.target)) setIsInputFocused(readInputRef.current && readInputRef.current === document.activeElement ? true : false);
173
+ if (event.target === inputRef.current || list.contains(event.target)) setIsInputFocused(inputRef.current && inputRef.current === document.activeElement ? true : false);
185
174
  };
186
175
  inputAndListContainerElement.addEventListener("focusin", handleFocusIn);
187
176
  return () => {
@@ -190,26 +179,26 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
190
179
  }
191
180
  }, [
192
181
  items,
193
- readInputRef,
182
+ inputRef,
194
183
  listContainerElement,
195
184
  usingRovingTabindex
196
185
  ]);
197
186
  useEffect(() => {
198
- if (usingRovingTabindex && !loading) setIsInputFocused(readInputRef.current && readInputRef.current === document.activeElement ? true : false);
187
+ if (usingRovingTabindex && !loading) setIsInputFocused(inputRef.current && inputRef.current === document.activeElement ? true : false);
199
188
  }, [
200
189
  loading,
201
- readInputRef,
190
+ inputRef,
202
191
  usingRovingTabindex
203
192
  ]);
204
- useAnnouncements(items, usingRovingTabindex ? listRef : { current: listContainerElement }, readInputRef, announcementsEnabled, loading, messageText, _PrivateFocusManagement);
205
- useScrollFlash(readScrollContainerRef);
193
+ useAnnouncements(items, usingRovingTabindex ? listRef : { current: listContainerElement }, inputRef, announcementsEnabled, loading, messageText, _PrivateFocusManagement);
194
+ useScrollFlash(scrollContainerRef);
206
195
  const handleSelectAllChange = useCallback((e) => {
207
196
  if (onSelectAllChange) onSelectAllChange(e.target.checked);
208
197
  }, [onSelectAllChange]);
209
198
  function getBodyContent() {
210
- if (loading && readScrollContainerRef.current && loadingType.appearsInBody) return /*#__PURE__*/ jsx(FilteredActionListBodyLoader, {
199
+ if (loading && scrollContainerRef.current && loadingType.appearsInBody) return /*#__PURE__*/ jsx(FilteredActionListBodyLoader, {
211
200
  loadingType,
212
- height: readScrollContainerRef.current.clientHeight
201
+ height: scrollContainerRef.current.clientHeight
213
202
  });
214
203
  if (message) return message;
215
204
  let firstGroupIndex = 0;
@@ -301,7 +290,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
301
290
  "data-component": "FilteredActionList",
302
291
  children: [
303
292
  /*#__PURE__*/ jsx(FilteredActionListInput, {
304
- inputRef: appliedInputRef,
293
+ inputRef,
305
294
  value: filterValue,
306
295
  onInputChange,
307
296
  onInputKeyPress,
@@ -335,7 +324,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
335
324
  })]
336
325
  }),
337
326
  /*#__PURE__*/ jsx("div", {
338
- ref: appliedScrollContainerRef,
327
+ ref: scrollContainerRef,
339
328
  className: FilteredActionList_module_css_default.Container,
340
329
  children: getBodyContent()
341
330
  })
@@ -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.Ref<HTMLInputElement | null>;
6
+ inputRef: React.RefObject<HTMLInputElement | null>;
7
7
  onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
8
  onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
9
9
  onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;