@primer/react 0.0.0-20260722112739 → 0.0.0-20260722195949

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 (69) hide show
  1. package/CHANGELOG.md +13 -9
  2. package/dist/ActionBar/ActionBar.js +4 -0
  3. package/dist/ActionBar/index.d.ts +4 -1
  4. package/dist/ActionList/Description.js +1 -0
  5. package/dist/ActionList/Divider.js +1 -0
  6. package/dist/ActionList/Group.js +1 -1
  7. package/dist/ActionList/List.js +20 -14
  8. package/dist/ActionList/TrailingAction.js +1 -0
  9. package/dist/AnchoredOverlay/AnchoredOverlay.js +6 -3
  10. package/dist/Autocomplete/AutocompleteInput.js +10 -7
  11. package/dist/Banner/Banner.js +2 -2
  12. package/dist/Blankslate/Blankslate.d.ts +15 -0
  13. package/dist/Blankslate/Blankslate.js +5 -0
  14. package/dist/ButtonGroup/ButtonGroup.js +15 -8
  15. package/dist/Checkbox/Checkbox.js +16 -9
  16. package/dist/DataTable/ErrorDialog.d.ts +3 -0
  17. package/dist/DataTable/ErrorDialog.js +1 -0
  18. package/dist/DataTable/Pagination.d.ts +3 -0
  19. package/dist/DataTable/Pagination.js +1 -0
  20. package/dist/DataTable/Table.d.ts +33 -0
  21. package/dist/DataTable/Table.js +13 -0
  22. package/dist/Details/Details.js +1 -1
  23. package/dist/Dialog/Dialog.js +12 -5
  24. package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
  25. package/dist/FilteredActionList/FilteredActionList.js +31 -20
  26. package/dist/FilteredActionList/FilteredActionListInput.d.ts +4 -1
  27. package/dist/FilteredActionList/FilteredActionListInput.js +1 -0
  28. package/dist/FilteredActionList/FilteredActionListLoaders.d.ts +3 -0
  29. package/dist/FilteredActionList/FilteredActionListLoaders.js +1 -0
  30. package/dist/FormControl/FormControlCaption.d.ts +1 -0
  31. package/dist/FormControl/FormControlCaption.js +1 -0
  32. package/dist/FormControl/FormControlLabel.js +1 -0
  33. package/dist/FormControl/FormControlLeadingVisual.js +1 -0
  34. package/dist/Overlay/Overlay.js +1 -1
  35. package/dist/PageHeader/PageHeader.js +32 -23
  36. package/dist/PageLayout/PageLayout.js +2 -2
  37. package/dist/SegmentedControl/{SegmentedControl-a004561f.css → SegmentedControl-de65527b.css} +2 -2
  38. package/dist/SegmentedControl/{SegmentedControl-a004561f.css.map → SegmentedControl-de65527b.css.map} +1 -1
  39. package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
  40. package/dist/SegmentedControl/SegmentedControlButton.js +2 -1
  41. package/dist/SegmentedControl/SegmentedControlIconButton.js +2 -1
  42. package/dist/SelectPanel/SelectPanel.d.ts +3 -0
  43. package/dist/SelectPanel/SelectPanel.js +2 -1
  44. package/dist/SelectPanel/SelectPanelMessage.js +1 -0
  45. package/dist/Stack/Stack.js +1 -0
  46. package/dist/TextInput/TextInput.js +13 -6
  47. package/dist/ThemeProvider.d.ts +4 -1
  48. package/dist/ThemeProvider.js +76 -43
  49. package/dist/Timeline/Timeline.js +3 -3
  50. package/dist/TooltipV2/Tooltip.js +19 -11
  51. package/dist/TopicTag/TopicTagGroup.d.ts +3 -0
  52. package/dist/TopicTag/TopicTagGroup.js +1 -0
  53. package/dist/experimental/Tabs/Tabs.js +3 -2
  54. package/dist/experimental/Tabs/types.d.ts +10 -3
  55. package/dist/experimental/Tabs/useTabList.js +18 -10
  56. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +69 -42
  57. package/dist/experimental/index.js +5 -5
  58. package/dist/hooks/useMergedRefs.d.ts +4 -4
  59. package/dist/hooks/useMergedRefs.js +8 -5
  60. package/dist/hooks/useProvidedRefOrCreate.d.ts +7 -10
  61. package/dist/hooks/useProvidedRefOrCreate.js +7 -10
  62. package/dist/index.d.ts +2 -2
  63. package/dist/legacy-theme/ts/color-schemes.js +4252 -0
  64. package/dist/theme.d.ts +1142 -1
  65. package/dist/theme.js +3 -1
  66. package/dist/useTheme.d.ts +3 -1
  67. package/dist/utils/types/KeyPaths.d.ts +4 -0
  68. package/generated/hooks.json +15 -0
  69. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -1,14 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260722112739
4
-
5
- ### Major Changes
6
-
7
- - [#8212](https://github.com/primer/react/pull/8212) [`6a4c131`](https://github.com/primer/react/commit/6a4c1319a70a5f3b5abc7b81b044bd26d042aa75) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ThemeProvider: Remove `colorSchemes` from the default `theme` and stop merging
8
- color scheme values into the theme context. Color schemes are applied via CSS
9
- variables instead, and passing an unknown color scheme no longer logs an error.
10
- `useTheme()` no longer returns `theme` or `resolvedColorScheme`. The
11
- `ThemeColorPaths` and `ThemeShadowPaths` types are also no longer exported.
3
+ ## 0.0.0-20260722195949
12
4
 
13
5
  ### Minor Changes
14
6
 
@@ -16,12 +8,24 @@
16
8
 
17
9
  ### Patch Changes
18
10
 
11
+ - [#7871](https://github.com/primer/react/pull/7871) [`43545dd`](https://github.com/primer/react/commit/43545ddd2188ccb62338467101543d4077767987) Thanks [@adierkens](https://github.com/adierkens)! - Normalise component `displayName` strings to the canonical `Parent.Slot` convention, and add `displayName` to compound sub-components and `forwardRef`-wrapped components that were missing it.
12
+
13
+ - Renames sub-component `displayName` strings that were using camelCase without a separator to the canonical `Parent.Slot` convention: `BannerPrimaryAction` → `Banner.PrimaryAction`, `BannerSecondaryAction` → `Banner.SecondaryAction`, `Summary` → `Details.Summary`, `TimelineItem|Body|Break` → `Timeline.Item|Body|Break`, `ParentLink|TitleArea` → `PageHeader.ParentLink|TitleArea`, `HorizontalDivider|VerticalDivider` → `PageLayout.HorizontalDivider|VerticalDivider`.
14
+ - Adds `displayName` to compound sub-components where the runtime function name doesn't match the canonical name users see (e.g. `Visual` → `Blankslate.Visual`, `SegmentedControlButton` → `SegmentedControl.Button`, `Panel` → `SelectPanel`, `FormControlCaption` → `FormControl.Caption`, etc.) and to `forwardRef`-wrapped components with anonymous inner arrow functions where DevTools would otherwise show `ForwardRef`.
15
+ - Adds a contributor skill at `.github/skills/display-name/SKILL.md` documenting when `displayName` is required vs redundant, the canonical naming convention, and how it interacts with the slot system.
16
+
17
+ No runtime behaviour changes.
18
+
19
19
  - Fake entry to force publishing
20
20
 
21
21
  - [#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
22
22
 
23
+ - [#8196](https://github.com/primer/react/pull/8196) [`e24effd`](https://github.com/primer/react/commit/e24effd440d69f0068a89aba26bae9e39fb3254e) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Use `aria-pressed` instead of `aria-current` on `SegmentedControl.Button` and `SegmentedControl.IconButton` so JAWS announces the selected state when a segment is activated.
24
+
23
25
  - [#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.
24
26
 
27
+ - [#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.
28
+
25
29
  ## 38.33.0
26
30
 
27
31
  ### Minor Changes
@@ -238,5 +238,9 @@ const VerticalDivider = () => {
238
238
  });
239
239
  };
240
240
  VerticalDivider.displayName = "VerticalDivider";
241
+ ActionBarIconButton.displayName = "ActionBar.IconButton";
242
+ ActionBarGroup.displayName = "ActionBar.Group";
243
+ ActionBarMenu.displayName = "ActionBar.Menu";
244
+ VerticalDivider.displayName = "ActionBar.VerticalDivider";
241
245
  //#endregion
242
246
  export { ActionBar, ActionBarButton, ActionBarGroup, ActionBarIconButton, ActionBarMenu, VerticalDivider };
@@ -24,7 +24,10 @@ declare const ActionBar: import("react").FC<import("react").PropsWithChildren<Ac
24
24
  inactive?: boolean;
25
25
  labelWrap?: boolean;
26
26
  } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<unknown>>;
27
- Divider: () => import("react").JSX.Element;
27
+ Divider: {
28
+ (): import("react").JSX.Element;
29
+ displayName: string;
30
+ };
28
31
  Group: import("react").ForwardRefExoticComponent<{
29
32
  children?: import("react").ReactNode | undefined;
30
33
  } & import("react").RefAttributes<unknown>>;
@@ -114,6 +114,7 @@ const Description = (t0) => {
114
114
  return t6;
115
115
  }
116
116
  };
117
+ Description.displayName = "ActionList.Description";
117
118
  Description.__SLOT__ = Symbol("ActionList.Description");
118
119
  //#endregion
119
120
  export { Description };
@@ -29,6 +29,7 @@ const Divider = (t0) => {
29
29
  } else t2 = $[4];
30
30
  return t2;
31
31
  };
32
+ Divider.displayName = "ActionList.Divider";
32
33
  Divider.__SLOT__ = Symbol("ActionList.Divider");
33
34
  //#endregion
34
35
  export { Divider };
@@ -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";
3
4
  import { invariant } from "../utils/invariant.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,18 +1,19 @@
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";
4
5
  import { useSlots } from "../hooks/useSlots.js";
6
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
5
7
  import { fixedForwardRef } from "../utils/modern-polymorphic.js";
6
8
  import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
7
9
  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 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;
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;
@@ -79,14 +85,14 @@ const UnwrappedList = (props, forwardedRef) => {
79
85
  const t5 = !enableFocusZone;
80
86
  const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : void 0;
81
87
  let t7;
82
- if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
88
+ if ($[11] !== readRef || $[12] !== t5 || $[13] !== t6) {
83
89
  t7 = {
84
90
  disabled: t5,
85
- containerRef: listRef,
91
+ containerRef: readRef,
86
92
  bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
87
93
  focusOutBehavior: t6
88
94
  };
89
- $[11] = listRef;
95
+ $[11] = readRef;
90
96
  $[12] = t5;
91
97
  $[13] = t6;
92
98
  $[14] = t7;
@@ -111,16 +117,16 @@ 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] !== readRef.current) {
115
121
  t10 = () => {
116
- const list = listRef.current;
122
+ const list = readRef.current;
117
123
  if (!list) return;
118
124
  const hasMixed = list.querySelector("[data-has-description=\"true\"]") !== null && list.querySelector("[data-has-description=\"false\"]") !== null;
119
125
  const current = list.getAttribute("data-mixed-descriptions");
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] = readRef.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;
@@ -100,6 +100,7 @@ const TrailingAction = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
100
100
  } else t6 = $[24];
101
101
  return t6;
102
102
  });
103
+ TrailingAction.displayName = "ActionList.TrailingAction";
103
104
  TrailingAction.__SLOT__ = Symbol("ActionList.TrailingAction");
104
105
  //#endregion
105
106
  export { TrailingAction };
@@ -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,7 +34,9 @@ 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");
36
38
  const [overlayElement, setOverlayElement] = useState(null);
39
+ const mergedOverlayRef = useMergedRefs(updateOverlayRef, useMergedRefs(overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref, setOverlayElement));
37
40
  const anchorId = useId$1(externalAnchorId);
38
41
  const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
39
42
  const onEscape = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("escape"), [onClose]);
@@ -190,10 +193,10 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
190
193
  ...shouldRenderAsPopover ? { popover: "manual" } : {},
191
194
  ...restOverlayProps,
192
195
  ...shouldRenderAsPopover ? { id: popoverId } : {},
193
- ref: (node) => {
196
+ ref: mergedRefEnabled ? mergedOverlayRef : (node) => {
197
+ setOverlayElement(node);
194
198
  if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
195
199
  updateOverlayRef(node);
196
- setOverlayElement(node);
197
200
  },
198
201
  "data-anchor-position": cssAnchorPositioning,
199
202
  "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();
@@ -418,7 +418,7 @@ const BannerPrimaryAction = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
418
418
  } else t2 = $[10];
419
419
  return t2;
420
420
  });
421
- BannerPrimaryAction.displayName = "BannerPrimaryAction";
421
+ BannerPrimaryAction.displayName = "Banner.PrimaryAction";
422
422
  const BannerSecondaryAction = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
423
423
  const $ = c(11);
424
424
  let children;
@@ -459,6 +459,6 @@ const BannerSecondaryAction = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
459
459
  } else t2 = $[10];
460
460
  return t2;
461
461
  });
462
- BannerSecondaryAction.displayName = "BannerSecondaryAction";
462
+ BannerSecondaryAction.displayName = "Banner.SecondaryAction";
463
463
  //#endregion
464
464
  export { Banner, BannerActions, BannerDescription, BannerPrimaryAction, BannerSecondaryAction, BannerTitle };
@@ -38,6 +38,9 @@ declare function Visual({
38
38
  className,
39
39
  ...rest
40
40
  }: BlankslateVisualProps): React.JSX.Element;
41
+ declare namespace Visual {
42
+ var displayName: string;
43
+ }
41
44
  type BlankslateHeadingProps = React.HTMLAttributes<HTMLElement> & {
42
45
  as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
43
46
  };
@@ -47,12 +50,18 @@ declare function Heading({
47
50
  className,
48
51
  ...rest
49
52
  }: BlankslateHeadingProps): React.JSX.Element;
53
+ declare namespace Heading {
54
+ var displayName: string;
55
+ }
50
56
  type BlankslateDescriptionProps = React.HTMLAttributes<HTMLElement>;
51
57
  declare function Description({
52
58
  children,
53
59
  className,
54
60
  ...rest
55
61
  }: BlankslateDescriptionProps): React.JSX.Element;
62
+ declare namespace Description {
63
+ var displayName: string;
64
+ }
56
65
  type BlankslatePrimaryActionProps = (React.PropsWithChildren<{
57
66
  href?: never;
58
67
  }> & React.ComponentPropsWithoutRef<'button'>) | React.PropsWithChildren<{
@@ -63,6 +72,9 @@ declare function PrimaryAction({
63
72
  href,
64
73
  ...props
65
74
  }: BlankslatePrimaryActionProps): React.JSX.Element;
75
+ declare namespace PrimaryAction {
76
+ var displayName: string;
77
+ }
66
78
  type BlankslateSecondaryActionProps = React.PropsWithChildren<{
67
79
  href: string;
68
80
  }>;
@@ -70,5 +82,8 @@ declare function SecondaryAction({
70
82
  children,
71
83
  href
72
84
  }: BlankslateSecondaryActionProps): React.JSX.Element;
85
+ declare namespace SecondaryAction {
86
+ var displayName: string;
87
+ }
73
88
  //#endregion
74
89
  export { Blankslate, type BlankslateDescriptionProps, type BlankslateHeadingProps, type BlankslatePrimaryActionProps, type BlankslateProps, type BlankslateSecondaryActionProps, type BlankslateVisualProps, Description, Heading, PrimaryAction, SecondaryAction, Visual };
@@ -281,5 +281,10 @@ function SecondaryAction(t0) {
281
281
  } else t2 = $[3];
282
282
  return t2;
283
283
  }
284
+ Visual.displayName = "Blankslate.Visual";
285
+ Heading.displayName = "Blankslate.Heading";
286
+ Description.displayName = "Blankslate.Description";
287
+ PrimaryAction.displayName = "Blankslate.PrimaryAction";
288
+ SecondaryAction.displayName = "Blankslate.SecondaryAction";
284
289
  //#endregion
285
290
  export { Blankslate, Description, Heading, PrimaryAction, SecondaryAction, Visual };
@@ -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 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;
32
40
  let t2;
33
41
  if ($[6] !== children) {
34
42
  t2 = React.Children.map(children, _temp);
@@ -36,17 +44,16 @@ 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
- if ($[8] !== buttonRef || $[9] !== t3) {
49
+ if ($[8] !== readRef || $[9] !== t3) {
43
50
  t4 = {
44
- containerRef: buttonRef,
51
+ containerRef: readRef,
45
52
  disabled: t3,
46
53
  bindKeys: FocusKeys.ArrowHorizontal,
47
54
  focusOutBehavior: "wrap"
48
55
  };
49
- $[8] = buttonRef;
56
+ $[8] = readRef;
50
57
  $[9] = t3;
51
58
  $[10] = t4;
52
59
  } else t4 = $[10];
@@ -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,30 +1,37 @@
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 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;
15
22
  const checkboxGroupContext = useContext(CheckboxGroupContext);
16
23
  const handleOnChange = (e) => {
17
24
  checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
18
25
  onChange && onChange(e);
19
- if (indeterminate && checkboxRef.current) {
20
- checkboxRef.current.indeterminate = true;
21
- checkboxRef.current.setAttribute("aria-checked", "mixed");
26
+ if (indeterminate && readRef.current) {
27
+ readRef.current.indeterminate = true;
28
+ readRef.current.setAttribute("aria-checked", "mixed");
22
29
  }
23
30
  };
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,
@@ -36,14 +43,14 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
36
43
  ...rest
37
44
  };
38
45
  useIsomorphicLayoutEffect(() => {
39
- if (checkboxRef.current) checkboxRef.current.indeterminate = indeterminate || false;
46
+ if (readRef.current) readRef.current.indeterminate = indeterminate || false;
40
47
  }, [
41
48
  indeterminate,
42
49
  checked,
43
- checkboxRef
50
+ readRef
44
51
  ]);
45
52
  useEffect(() => {
46
- const { current: checkbox } = checkboxRef;
53
+ const { current: checkbox } = readRef;
47
54
  if (!checkbox) return;
48
55
  if (indeterminate) checkbox.setAttribute("aria-checked", "mixed");
49
56
  else checkbox.setAttribute("aria-checked", checkbox.checked ? "true" : "false");
@@ -22,5 +22,8 @@ declare function ErrorDialog({
22
22
  onRetry,
23
23
  onDismiss
24
24
  }: TableErrorDialogProps): React.JSX.Element;
25
+ declare namespace ErrorDialog {
26
+ var displayName: string;
27
+ }
25
28
  //#endregion
26
29
  export { ErrorDialog, TableErrorDialogProps };
@@ -32,5 +32,6 @@ function ErrorDialog(t0) {
32
32
  } else t3 = $[6];
33
33
  return t3;
34
34
  }
35
+ ErrorDialog.displayName = "Table.ErrorDialog";
35
36
  //#endregion
36
37
  export { ErrorDialog };
@@ -43,6 +43,9 @@ declare function Pagination({
43
43
  showPages,
44
44
  totalCount
45
45
  }: PaginationProps): React.JSX.Element;
46
+ declare namespace Pagination {
47
+ var displayName: string;
48
+ }
46
49
  type PaginationState = {
47
50
  /**
48
51
  * The index of currently selected page
@@ -473,5 +473,6 @@ function usePagination(config) {
473
473
  } else t4 = $[23];
474
474
  return t4;
475
475
  }
476
+ Pagination.displayName = "Table.Pagination";
476
477
  //#endregion
477
478
  export { Pagination };
@@ -46,10 +46,16 @@ type TableHeadProps = React.ComponentPropsWithoutRef<'thead'>;
46
46
  declare function TableHead({
47
47
  children
48
48
  }: TableHeadProps): JSX.Element;
49
+ declare namespace TableHead {
50
+ var displayName: string;
51
+ }
49
52
  type TableBodyProps = React.ComponentPropsWithoutRef<'tbody'>;
50
53
  declare function TableBody({
51
54
  children
52
55
  }: TableBodyProps): JSX.Element;
56
+ declare namespace TableBody {
57
+ var displayName: string;
58
+ }
53
59
  type TableHeaderProps = Omit<React.ComponentPropsWithoutRef<'th'>, 'align'> & {
54
60
  /**
55
61
  * The horizontal alignment of the cell's content
@@ -61,11 +67,17 @@ declare function TableHeader({
61
67
  children,
62
68
  ...rest
63
69
  }: TableHeaderProps): JSX.Element;
70
+ declare namespace TableHeader {
71
+ var displayName: string;
72
+ }
64
73
  type TableRowProps = React.ComponentPropsWithoutRef<'tr'>;
65
74
  declare function TableRow({
66
75
  children,
67
76
  ...rest
68
77
  }: TableRowProps): JSX.Element;
78
+ declare namespace TableRow {
79
+ var displayName: string;
80
+ }
69
81
  type TableCellProps = Omit<React.ComponentPropsWithoutRef<'td'>, 'align'> & {
70
82
  /**
71
83
  * The horizontal alignment of the cell's content
@@ -84,10 +96,16 @@ declare function TableCell({
84
96
  scope,
85
97
  ...rest
86
98
  }: TableCellProps): JSX.Element;
99
+ declare namespace TableCell {
100
+ var displayName: string;
101
+ }
87
102
  type TableCellPlaceholderProps = React.PropsWithChildren;
88
103
  declare function TableCellPlaceholder({
89
104
  children
90
105
  }: TableCellPlaceholderProps): JSX.Element;
106
+ declare namespace TableCellPlaceholder {
107
+ var displayName: string;
108
+ }
91
109
  type TableContainerProps<As extends React.ElementType = 'div'> = PolymorphicProps<As, 'div'> & React.PropsWithChildren;
92
110
  declare function TableContainer<As extends React.ElementType = 'div'>({
93
111
  children,
@@ -95,6 +113,9 @@ declare function TableContainer<As extends React.ElementType = 'div'>({
95
113
  as,
96
114
  ...rest
97
115
  }: TableContainerProps<As>): JSX.Element;
116
+ declare namespace TableContainer {
117
+ var displayName: string;
118
+ }
98
119
  type TableTitleProps = React.PropsWithChildren<{
99
120
  /**
100
121
  * Provide an alternate element or component to use as the container for
@@ -127,11 +148,20 @@ declare function TableSubtitle({
127
148
  children,
128
149
  id
129
150
  }: TableSubtitleProps): JSX.Element;
151
+ declare namespace TableSubtitle {
152
+ var displayName: string;
153
+ }
130
154
  declare function TableDivider(): JSX.Element;
155
+ declare namespace TableDivider {
156
+ var displayName: string;
157
+ }
131
158
  type TableActionsProps = React.PropsWithChildren;
132
159
  declare function TableActions({
133
160
  children
134
161
  }: TableActionsProps): JSX.Element;
162
+ declare namespace TableActions {
163
+ var displayName: string;
164
+ }
135
165
  type TableSkeletonProps<Data extends UniqueRow> = React.ComponentPropsWithoutRef<'table'> & {
136
166
  /**
137
167
  * Specify the amount of space that should be available around the contents of
@@ -155,5 +185,8 @@ declare function TableSkeleton<Data extends UniqueRow>({
155
185
  rows,
156
186
  ...rest
157
187
  }: TableSkeletonProps<Data>): JSX.Element;
188
+ declare namespace TableSkeleton {
189
+ var displayName: string;
190
+ }
158
191
  //#endregion
159
192
  export { Table, TableActions, TableActionsProps, TableBody, TableBodyProps, TableCell, TableCellPlaceholder, TableCellProps, TableContainer, TableContainerProps, TableDivider, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, TableSkeleton, TableSkeletonProps, TableSubtitle, TableSubtitleProps, TableTitle, TableTitleProps };
@@ -556,5 +556,18 @@ function _temp(column, i) {
556
556
  return /*#__PURE__*/ jsx(TableHeader, { children: typeof column.header === "string" ? column.header : column.header() }, i);
557
557
  }
558
558
  _temp.displayName = "_temp";
559
+ TableHead.displayName = "Table.Head";
560
+ TableBody.displayName = "Table.Body";
561
+ TableHeader.displayName = "Table.Header";
562
+ TableSortHeader.displayName = "Table.SortHeader";
563
+ TableRow.displayName = "Table.Row";
564
+ TableCell.displayName = "Table.Cell";
565
+ TableCellPlaceholder.displayName = "Table.CellPlaceholder";
566
+ TableContainer.displayName = "Table.Container";
567
+ TableTitle.displayName = "Table.Title";
568
+ TableSubtitle.displayName = "Table.Subtitle";
569
+ TableDivider.displayName = "Table.Divider";
570
+ TableActions.displayName = "Table.Actions";
571
+ TableSkeleton.displayName = "Table.Skeleton";
559
572
  //#endregion
560
573
  export { Table, TableActions, TableBody, TableCell, TableCellPlaceholder, TableContainer, TableDivider, TableHead, TableHeader, TableRow, TableSkeleton, TableSortHeader, TableSubtitle, TableTitle };