@primer/react 0.0.0-20260324184905 → 0.0.0-20260324190422

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 (47) hide show
  1. package/CHANGELOG.md +1 -3
  2. package/dist/ActionBar/ActionBar.js +3 -3
  3. package/dist/ActionList/Heading.js +16 -17
  4. package/dist/ActionList/List.d.ts.map +1 -1
  5. package/dist/ActionList/List.js +41 -41
  6. package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
  7. package/dist/ActionMenu/ActionMenu.js +10 -7
  8. package/dist/AnchoredOverlay/AnchoredOverlay.d.ts +2 -2
  9. package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
  10. package/dist/AnchoredOverlay/AnchoredOverlay.js +7 -17
  11. package/dist/Autocomplete/AutocompleteInput.js +3 -3
  12. package/dist/Autocomplete/AutocompleteOverlay.js +3 -3
  13. package/dist/Button/ButtonBase.d.ts.map +1 -1
  14. package/dist/Button/ButtonBase.js +4 -3
  15. package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  16. package/dist/ButtonGroup/ButtonGroup.js +23 -23
  17. package/dist/Checkbox/Checkbox.d.ts.map +1 -1
  18. package/dist/Checkbox/Checkbox.js +5 -5
  19. package/dist/Dialog/Dialog.js +8 -9
  20. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  21. package/dist/FilteredActionList/FilteredActionList.js +8 -8
  22. package/dist/Heading/Heading.js +3 -3
  23. package/dist/Link/Link.d.ts.map +1 -1
  24. package/dist/Link/Link.js +4 -3
  25. package/dist/Overlay/Overlay.js +20 -21
  26. package/dist/PageHeader/PageHeader.d.ts.map +1 -1
  27. package/dist/PageHeader/PageHeader.js +30 -31
  28. package/dist/PageLayout/PageLayout.js +5 -5
  29. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  30. package/dist/SelectPanel/SelectPanel.js +4 -3
  31. package/dist/TextInput/TextInput.d.ts.map +1 -1
  32. package/dist/TextInput/TextInput.js +5 -6
  33. package/dist/TextInputWithTokens/TextInputWithTokens.js +90 -91
  34. package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
  35. package/dist/TooltipV2/Tooltip.js +4 -4
  36. package/dist/deprecated/ActionMenu.d.ts.map +1 -1
  37. package/dist/deprecated/ActionMenu.js +8 -7
  38. package/dist/deprecated/DialogV1/Dialog.js +9 -10
  39. package/dist/experimental/SelectPanel2/SelectPanel.d.ts.map +1 -1
  40. package/dist/experimental/SelectPanel2/SelectPanel.js +5 -5
  41. package/dist/experimental/Tabs/Tabs.d.ts +1 -1
  42. package/dist/experimental/Tabs/Tabs.d.ts.map +1 -1
  43. package/dist/experimental/Tabs/Tabs.js +16 -16
  44. package/dist/hooks/useAnchoredPosition.js +1 -1
  45. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  46. package/dist/hooks/useFocusTrap.js +1 -1
  47. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260324184905
3
+ ## 0.0.0-20260324190422
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -15,8 +15,6 @@
15
15
 
16
16
  ### Patch Changes
17
17
 
18
- - [#7645](https://github.com/primer/react/pull/7645) [`bdb0e39`](https://github.com/primer/react/commit/bdb0e39d56bfb13ab3e321622402369251cc3207) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Update internal implementations of combined refs to improve performance and add support for React 19 callback refs
19
-
20
18
  - Fake entry to force publishing
21
19
 
22
20
  - [#7510](https://github.com/primer/react/pull/7510) [`8fa988b`](https://github.com/primer/react/commit/8fa988ba613117874657af722ef6de768b0e0eb8) Thanks [@francinelucca](https://github.com/francinelucca)! - chore: ensure max-height does not surpass viewport height in Overlay, ActionMenu under feature flag
@@ -10,7 +10,7 @@ import styles from './ActionBar.module.css.js';
10
10
  import { clsx } from 'clsx';
11
11
  import { createDescendantRegistry } from '../utils/descendant-registry.js';
12
12
  import { jsxs, jsx } from 'react/jsx-runtime';
13
- import { useMergedRefs } from '../hooks/useMergedRefs.js';
13
+ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
14
14
  import { FocusKeys } from '@primer/behaviors';
15
15
  import { ActionMenu } from '../ActionMenu/ActionMenu.js';
16
16
 
@@ -423,7 +423,7 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef(({
423
423
  ...props
424
424
  }, forwardedRef) => {
425
425
  const ref = useRef(null);
426
- const mergedRef = useMergedRefs(ref, forwardedRef);
426
+ useRefObjectAsForwardedRef(forwardedRef, ref);
427
427
  const {
428
428
  size,
429
429
  isVisibleChild
@@ -453,7 +453,7 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef(({
453
453
  if (!isVisibleChild(id) || groupId && !isVisibleChild(groupId)) return null;
454
454
  return /*#__PURE__*/jsx(IconButton, {
455
455
  "aria-disabled": disabled,
456
- ref: mergedRef,
456
+ ref: ref,
457
457
  size: size,
458
458
  onClick: clickHandler,
459
459
  ...props,
@@ -7,12 +7,12 @@ import { invariant } from '../utils/invariant.js';
7
7
  import { clsx } from 'clsx';
8
8
  import classes from './Heading.module.css.js';
9
9
  import { jsx } from 'react/jsx-runtime';
10
- import { useMergedRefs } from '../hooks/useMergedRefs.js';
10
+ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
11
11
  import Heading$1 from '../Heading/Heading.js';
12
12
 
13
13
  const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
14
14
  var _props$id;
15
- const $ = c(21);
15
+ const $ = c(20);
16
16
  let as;
17
17
  let children;
18
18
  let className;
@@ -45,7 +45,7 @@ const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
45
45
  }
46
46
  const visuallyHidden = t1 === undefined ? false : t1;
47
47
  const innerRef = React.useRef(null);
48
- const mergedRef = useMergedRefs(forwardedRef, innerRef);
48
+ useRefObjectAsForwardedRef(forwardedRef, innerRef);
49
49
  const {
50
50
  headingId,
51
51
  variant: listVariant
@@ -65,11 +65,11 @@ const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
65
65
  t4 = $[8];
66
66
  }
67
67
  let t5;
68
- if ($[9] !== as || $[10] !== children || $[11] !== listVariant || $[12] !== mergedRef || $[13] !== props || $[14] !== size || $[15] !== t3 || $[16] !== t4) {
68
+ if ($[9] !== as || $[10] !== children || $[11] !== listVariant || $[12] !== props || $[13] !== size || $[14] !== t3 || $[15] !== t4) {
69
69
  t5 = /*#__PURE__*/jsx(Heading$1, {
70
70
  as: as,
71
71
  variant: size,
72
- ref: mergedRef,
72
+ ref: innerRef,
73
73
  id: t3,
74
74
  className: t4,
75
75
  "data-list-variant": listVariant,
@@ -79,26 +79,25 @@ const Heading = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
79
79
  $[9] = as;
80
80
  $[10] = children;
81
81
  $[11] = listVariant;
82
- $[12] = mergedRef;
83
- $[13] = props;
84
- $[14] = size;
85
- $[15] = t3;
86
- $[16] = t4;
87
- $[17] = t5;
82
+ $[12] = props;
83
+ $[13] = size;
84
+ $[14] = t3;
85
+ $[15] = t4;
86
+ $[16] = t5;
88
87
  } else {
89
- t5 = $[17];
88
+ t5 = $[16];
90
89
  }
91
90
  let t6;
92
- if ($[18] !== t2 || $[19] !== t5) {
91
+ if ($[17] !== t2 || $[18] !== t5) {
93
92
  t6 = /*#__PURE__*/jsx(VisuallyHidden, {
94
93
  isVisible: t2,
95
94
  children: t5
96
95
  });
97
- $[18] = t2;
98
- $[19] = t5;
99
- $[20] = t6;
96
+ $[17] = t2;
97
+ $[18] = t5;
98
+ $[19] = t6;
100
99
  } else {
101
- t6 = $[20];
100
+ t6 = $[19];
102
101
  }
103
102
  return t6;
104
103
  });
@@ -1 +1 @@
1
- {"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAuFrC,QAAA,MAAM,IAAI,GA3Ea,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;oDA2ER,CAAA;AAI3C,OAAO,EAAC,IAAI,EAAC,CAAA"}
1
+ {"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAuF7C,QAAA,MAAM,IAAI,GA3Ea,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;oDA2ER,CAAA;AAI3C,OAAO,EAAC,IAAI,EAAC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import React from 'react';
2
+ import React, { useRef } from 'react';
3
3
  import { fixedForwardRef } from '../utils/modern-polymorphic.js';
4
4
  import { ActionListContainerContext } from './ActionListContainerContext.js';
5
5
  import { useSlots } from '../hooks/useSlots.js';
@@ -10,12 +10,12 @@ import { useFocusZone } from '../hooks/useFocusZone.js';
10
10
  import { clsx } from 'clsx';
11
11
  import classes from './ActionList.module.css.js';
12
12
  import { jsx, jsxs } from 'react/jsx-runtime';
13
- import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
13
+ import { useMergedRefs } from '../hooks/useMergedRefs.js';
14
14
  import { FocusKeys } from '@primer/behaviors';
15
15
 
16
16
  const UnwrappedList = (props, forwardedRef) => {
17
17
  var _slots$heading$props$;
18
- const $ = c(37);
18
+ const $ = c(36);
19
19
  let className;
20
20
  let restProps;
21
21
  let role;
@@ -78,7 +78,8 @@ const UnwrappedList = (props, forwardedRef) => {
78
78
  } = React.useContext(ActionListContainerContext);
79
79
  const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
80
80
  const listRole = role || listRoleFromContainer;
81
- const listRef = useProvidedRefOrCreate(forwardedRef);
81
+ const listRef = useRef(null);
82
+ const mergedRef = useMergedRefs(forwardedRef, listRef);
82
83
  let enableFocusZone = false;
83
84
  if (enableFocusZoneFromContainer !== undefined) {
84
85
  enableFocusZone = enableFocusZoneFromContainer;
@@ -97,24 +98,23 @@ const UnwrappedList = (props, forwardedRef) => {
97
98
  const t5 = !enableFocusZone;
98
99
  const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : undefined;
99
100
  let t7;
100
- if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
101
+ if ($[11] !== t5 || $[12] !== t6) {
101
102
  t7 = {
102
103
  disabled: t5,
103
104
  containerRef: listRef,
104
105
  bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
105
106
  focusOutBehavior: t6
106
107
  };
107
- $[11] = listRef;
108
- $[12] = t5;
109
- $[13] = t6;
110
- $[14] = t7;
108
+ $[11] = t5;
109
+ $[12] = t6;
110
+ $[13] = t7;
111
111
  } else {
112
- t7 = $[14];
112
+ t7 = $[13];
113
113
  }
114
114
  useFocusZone(t7);
115
115
  const t8 = selectionVariant || containerSelectionVariant;
116
116
  let t9;
117
- if ($[15] !== headingId || $[16] !== listRole || $[17] !== showDividers || $[18] !== t8 || $[19] !== variant) {
117
+ if ($[14] !== headingId || $[15] !== listRole || $[16] !== showDividers || $[17] !== t8 || $[18] !== variant) {
118
118
  t9 = {
119
119
  variant,
120
120
  selectionVariant: t8,
@@ -122,62 +122,62 @@ const UnwrappedList = (props, forwardedRef) => {
122
122
  role: listRole,
123
123
  headingId
124
124
  };
125
- $[15] = headingId;
126
- $[16] = listRole;
127
- $[17] = showDividers;
128
- $[18] = t8;
129
- $[19] = variant;
130
- $[20] = t9;
125
+ $[14] = headingId;
126
+ $[15] = listRole;
127
+ $[16] = showDividers;
128
+ $[17] = t8;
129
+ $[18] = variant;
130
+ $[19] = t9;
131
131
  } else {
132
- t9 = $[20];
132
+ t9 = $[19];
133
133
  }
134
134
  const listContextValue = t9;
135
135
  const t10 = slots.heading;
136
136
  let t11;
137
- if ($[21] !== className) {
137
+ if ($[20] !== className) {
138
138
  t11 = clsx(classes.ActionList, className);
139
- $[21] = className;
140
- $[22] = t11;
139
+ $[20] = className;
140
+ $[21] = t11;
141
141
  } else {
142
- t11 = $[22];
142
+ t11 = $[21];
143
143
  }
144
144
  let t12;
145
- if ($[23] !== Component || $[24] !== ariaLabelledBy || $[25] !== childrenWithoutSlots || $[26] !== listRef || $[27] !== listRole || $[28] !== restProps || $[29] !== showDividers || $[30] !== t11 || $[31] !== variant) {
145
+ if ($[22] !== Component || $[23] !== ariaLabelledBy || $[24] !== childrenWithoutSlots || $[25] !== listRole || $[26] !== mergedRef || $[27] !== restProps || $[28] !== showDividers || $[29] !== t11 || $[30] !== variant) {
146
146
  t12 = /*#__PURE__*/jsx(Component, {
147
147
  className: t11,
148
148
  role: listRole,
149
149
  "aria-labelledby": ariaLabelledBy,
150
- ref: listRef,
150
+ ref: mergedRef,
151
151
  "data-dividers": showDividers,
152
152
  "data-variant": variant,
153
153
  ...restProps,
154
154
  children: childrenWithoutSlots
155
155
  });
156
- $[23] = Component;
157
- $[24] = ariaLabelledBy;
158
- $[25] = childrenWithoutSlots;
159
- $[26] = listRef;
160
- $[27] = listRole;
161
- $[28] = restProps;
162
- $[29] = showDividers;
163
- $[30] = t11;
164
- $[31] = variant;
165
- $[32] = t12;
156
+ $[22] = Component;
157
+ $[23] = ariaLabelledBy;
158
+ $[24] = childrenWithoutSlots;
159
+ $[25] = listRole;
160
+ $[26] = mergedRef;
161
+ $[27] = restProps;
162
+ $[28] = showDividers;
163
+ $[29] = t11;
164
+ $[30] = variant;
165
+ $[31] = t12;
166
166
  } else {
167
- t12 = $[32];
167
+ t12 = $[31];
168
168
  }
169
169
  let t13;
170
- if ($[33] !== listContextValue || $[34] !== slots.heading || $[35] !== t12) {
170
+ if ($[32] !== listContextValue || $[33] !== slots.heading || $[34] !== t12) {
171
171
  t13 = /*#__PURE__*/jsxs(ListContext.Provider, {
172
172
  value: listContextValue,
173
173
  children: [t10, t12]
174
174
  });
175
- $[33] = listContextValue;
176
- $[34] = slots.heading;
177
- $[35] = t12;
178
- $[36] = t13;
175
+ $[32] = listContextValue;
176
+ $[33] = slots.heading;
177
+ $[34] = t12;
178
+ $[35] = t13;
179
179
  } else {
180
- t13 = $[36];
180
+ t13 = $[35];
181
181
  }
182
182
  return t13;
183
183
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAGlF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAI5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAIrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAK/F,OAAO,KAAK,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,sBAAsB,CAAA;AAI1E,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE,cAAc,GAAG,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,aAAa,GAAG,YAAY,GAAG,OAAO,KAClG,IAAI,CAAA;AAET,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,oBAAoB,EACpB,WAAW,GAAG,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAC9D,GAAG;IACF,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAGD,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IAEH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,GA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GAAG,SAAS,GAAG,mBAAmB,CAAC,GAAG;IAC/E;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;CACpE,CAAA;AAsHH,eAAO,MAAM,UAAU;;;kBAnMP,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;aAC5B,MAAM;;;;CAkM4E,CAAA"}
@@ -1,4 +1,4 @@
1
- import React, { useContext, useState, useEffect, useCallback, useMemo } from 'react';
1
+ import React, { useContext, useRef, useState, useEffect, useCallback, useMemo } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
  import { ChevronRightIcon, TriangleDownIcon } from '@primer/octicons-react';
4
4
  import { Divider } from '../ActionList/Divider.js';
@@ -11,7 +11,7 @@ import { isSlot } from '../utils/is-slot.js';
11
11
  import { DialogContext } from '../Dialog/Dialog.js';
12
12
  import { jsx } from 'react/jsx-runtime';
13
13
  import { useProvidedStateOrCreate } from '../hooks/useProvidedStateOrCreate.js';
14
- import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
14
+ import { useMergedRefs } from '../hooks/useMergedRefs.js';
15
15
  import { useMenuKeyboardNavigation } from '../hooks/useMenuKeyboardNavigation.js';
16
16
  import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
17
17
  import { AnchoredOverlay } from '../AnchoredOverlay/AnchoredOverlay.js';
@@ -76,7 +76,8 @@ const Menu = ({
76
76
  }, [setCombinedOpenState, parentMenuContext, open, isNarrow]);
77
77
  const menuButtonChild = React.Children.toArray(children).find(child => /*#__PURE__*/React.isValidElement(child) && (child.type === MenuButton || child.type === Anchor || isSlot(child, Anchor) || isSlot(child, MenuButton)));
78
78
  const menuButtonChildId = /*#__PURE__*/React.isValidElement(menuButtonChild) ? menuButtonChild.props.id : undefined;
79
- const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
79
+ const anchorRef = useRef(null);
80
+ const mergedRef = useMergedRefs(anchorRef, externalAnchorRef);
80
81
  const anchorId = useId(menuButtonChildId);
81
82
  let renderAnchor = null;
82
83
  // 🚨 Hack for good API!
@@ -97,7 +98,7 @@ const Menu = ({
97
98
  }, anchorChildren.props));
98
99
  return /*#__PURE__*/React.cloneElement(child, {
99
100
  children: triggerButton,
100
- ref: anchorRef
101
+ ref: mergedRef
101
102
  });
102
103
  };
103
104
  }
@@ -119,7 +120,7 @@ const Menu = ({
119
120
  });
120
121
  return /*#__PURE__*/React.cloneElement(child, {
121
122
  children: tooltip,
122
- ref: anchorRef
123
+ ref: mergedRef
123
124
  });
124
125
  };
125
126
  }
@@ -226,7 +227,7 @@ const Overlay = ({
226
227
  // we typecast anchorRef as required instead of optional
227
228
  // because we know that we're setting it in context in Menu
228
229
  const {
229
- anchorRef,
230
+ anchorRef: contextAnchorRef,
230
231
  renderAnchor,
231
232
  anchorId,
232
233
  open,
@@ -234,6 +235,8 @@ const Overlay = ({
234
235
  onClose,
235
236
  isSubmenu = false
236
237
  } = React.useContext(MenuContext);
238
+ const anchorRef = useRef(null);
239
+ const mergedAnchorRef = useMergedRefs(anchorRef, contextAnchorRef);
237
240
  const containerRef = React.useRef(null);
238
241
  const isNarrow = useResponsiveValue({
239
242
  narrow: true
@@ -268,7 +271,7 @@ const Overlay = ({
268
271
  const featureFlagMaxHeightClampToViewport = useFeatureFlag('primer_react_overlay_max_height_clamp_to_viewport');
269
272
  const isInsideDialog = useContext(DialogContext) !== undefined;
270
273
  return /*#__PURE__*/jsx(AnchoredOverlay, {
271
- anchorRef: anchorRef,
274
+ anchorRef: mergedAnchorRef,
272
275
  renderAnchor: renderAnchor,
273
276
  anchorId: anchorId,
274
277
  open: open,
@@ -15,7 +15,7 @@ interface AnchoredOverlayPropsWithAnchor {
15
15
  /**
16
16
  * An override to the internal ref that will be spread on to the renderAnchor
17
17
  */
18
- anchorRef?: React.RefObject<HTMLElement | null>;
18
+ anchorRef?: React.Ref<HTMLElement | null>;
19
19
  /**
20
20
  * An override to the internal id that will be spread on to the renderAnchor
21
21
  */
@@ -31,7 +31,7 @@ interface AnchoredOverlayPropsWithoutAnchor {
31
31
  * An override to the internal renderAnchor ref that will be used to position the overlay.
32
32
  * When renderAnchor is null this can be used to make an anchor that is detached from ActionMenu.
33
33
  */
34
- anchorRef: React.RefObject<HTMLElement | null>;
34
+ anchorRef: React.Ref<HTMLElement | null>;
35
35
  /**
36
36
  * An override to the internal id that will be spread on to the renderAnchor
37
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAiC,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AAC9D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;AAM1D,UAAU,8BAA8B;IACtC;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,YAAY,GAAG,iBAAiB,CAAC,EAChG,KAAK,EAAE,CAAC,KACL,GAAG,CAAC,OAAO,CAAA;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAE/C;;OAEG;IACH,QAAQ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,EAAE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;IACnE;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC5C;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAoB9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA+KnF,CAAA"}
@@ -1,4 +1,4 @@
1
- import { useCallback, useRef, useEffect } from 'react';
1
+ import { useRef, useCallback, useEffect } from 'react';
2
2
  import { useFocusTrap } from '../hooks/useFocusTrap.js';
3
3
  import { useFocusZone } from '../hooks/useFocusZone.js';
4
4
  import { useId } from '../hooks/useId.js';
@@ -8,7 +8,7 @@ import classes from './AnchoredOverlay.module.css.js';
8
8
  import { clsx } from 'clsx';
9
9
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
10
10
  import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
11
- import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
11
+ import { useMergedRefs } from '../hooks/useMergedRefs.js';
12
12
  import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
13
13
  import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
14
14
  import Overlay from '../Overlay/Overlay.js';
@@ -60,8 +60,10 @@ const AnchoredOverlay = ({
60
60
  closeButtonProps = defaultCloseButtonProps
61
61
  }) => {
62
62
  const cssAnchorPositioning = useFeatureFlag('primer_react_css_anchor_positioning');
63
- const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
63
+ const anchorRef = useRef(null);
64
+ const mergedRef = useMergedRefs(anchorRef, externalAnchorRef);
64
65
  const [overlayRef, updateOverlayRef] = useRenderForcingRef();
66
+ const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
65
67
  const anchorId = useId(externalAnchorId);
66
68
  const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('click-outside'), [onClose]);
67
69
  const onEscape = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('escape'), [onClose]);
@@ -133,7 +135,7 @@ const AnchoredOverlay = ({
133
135
  } = overlayProps || {};
134
136
  const innerContent = /*#__PURE__*/jsxs(Fragment, {
135
137
  children: [renderAnchor && renderAnchor({
136
- ref: anchorRef,
138
+ ref: mergedRef,
137
139
  id: anchorId,
138
140
  'aria-haspopup': 'true',
139
141
  'aria-expanded': open,
@@ -160,12 +162,7 @@ const AnchoredOverlay = ({
160
162
  preventOverflow: preventOverflow,
161
163
  "data-component": "AnchoredOverlay",
162
164
  ...restOverlayProps,
163
- ref: node => {
164
- if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
165
- assignRef(overlayProps.ref, node);
166
- }
167
- updateOverlayRef(node);
168
- },
165
+ ref: mergedOverlayRef,
169
166
  "data-anchor-position": cssAnchorPositioning,
170
167
  "data-side": cssAnchorPositioning ? side : position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
171
168
  children: [showXIcon ? /*#__PURE__*/jsx("div", {
@@ -198,13 +195,6 @@ const AnchoredOverlay = ({
198
195
  }
199
196
  return innerContent;
200
197
  };
201
- function assignRef(ref, value) {
202
- if (typeof ref === 'function') {
203
- ref(value);
204
- } else if (ref) {
205
- ref.current = value;
206
- }
207
- }
208
198
  AnchoredOverlay.displayName = 'AnchoredOverlay';
209
199
 
210
200
  export { AnchoredOverlay };
@@ -1,6 +1,6 @@
1
1
  import React, { useContext, useState, useCallback, useEffect } from 'react';
2
2
  import { AutocompleteContext, AutocompleteInputContext } from './AutocompleteContext.js';
3
- import { useMergedRefs } from '../hooks/useMergedRefs.js';
3
+ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
4
4
  import useSafeTimeout from '../hooks/useSafeTimeout.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
  import TextInput from '../TextInput/TextInput.js';
@@ -36,7 +36,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
36
36
  inputValue = '',
37
37
  isMenuDirectlyActivated
38
38
  } = inputContext;
39
- const mergedRef = useMergedRefs(forwardedRef, inputRef);
39
+ useRefObjectAsForwardedRef(forwardedRef, inputRef);
40
40
  const [highlightRemainingText, setHighlightRemainingText] = useState(true);
41
41
  const {
42
42
  safeSetTimeout
@@ -130,7 +130,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
130
130
  onKeyDown: handleInputKeyDown,
131
131
  onKeyPress: onInputKeyPress,
132
132
  onKeyUp: handleInputKeyUp,
133
- ref: mergedRef,
133
+ ref: inputRef,
134
134
  "aria-controls": `${id}-listbox`,
135
135
  "aria-autocomplete": "both",
136
136
  role: "combobox",
@@ -1,6 +1,6 @@
1
1
  import { useContext, useRef, useEffect, useCallback } from 'react';
2
2
  import { AutocompleteContext } from './AutocompleteContext.js';
3
- import { useMergedRefs } from '../hooks/useMergedRefs.js';
3
+ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
4
4
  import VisuallyHidden from '../_VisuallyHidden.js';
5
5
  import classes from './AutocompleteOverlay.module.css.js';
6
6
  import { clsx } from 'clsx';
@@ -48,7 +48,7 @@ function AutocompleteOverlay({
48
48
  align: 'start',
49
49
  anchorElementRef: computedAnchorRef
50
50
  }, [showMenu, selectedItemLength]);
51
- const mergedRef = useMergedRefs(scrollContainerRef, floatingElementRef);
51
+ useRefObjectAsForwardedRef(scrollContainerRef, floatingElementRef);
52
52
  const closeOptionList = useCallback(() => {
53
53
  setShowMenu(false);
54
54
  }, [setShowMenu]);
@@ -60,7 +60,7 @@ function AutocompleteOverlay({
60
60
  preventFocusOnOpen: true,
61
61
  onClickOutside: closeOptionList,
62
62
  onEscape: closeOptionList,
63
- ref: mergedRef,
63
+ ref: floatingElementRef,
64
64
  top: position === null || position === void 0 ? void 0 : position.top,
65
65
  left: position === null || position === void 0 ? void 0 : position.left,
66
66
  className: clsx(classes.Overlay, className),
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,EA0JV,8BAA8B,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;AAEjE,OAAO,EAAC,UAAU,EAAC,CAAA"}
1
+ {"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,EA2JV,8BAA8B,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;AAEjE,OAAO,EAAC,UAAU,EAAC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef } from 'react';
2
- import { useMergedRefs } from '../hooks/useMergedRefs.js';
2
+ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
3
3
  import { ConditionalWrapper } from '../internal/components/ConditionalWrapper.js';
4
4
  import { clsx } from 'clsx';
5
5
  import classes from './ButtonBase.module.css.js';
@@ -46,7 +46,7 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
46
46
  ...rest
47
47
  } = props;
48
48
  const innerRef = React.useRef(null);
49
- const combinedRefs = useMergedRefs(forwardedRef, innerRef);
49
+ useRefObjectAsForwardedRef(forwardedRef, innerRef);
50
50
  const uuid = useId(id);
51
51
  const loadingAnnouncementID = `${uuid}-loading-announcement`;
52
52
 
@@ -74,7 +74,8 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
74
74
  children: [/*#__PURE__*/jsx(Component, {
75
75
  "aria-disabled": loading ? true : undefined,
76
76
  ...rest,
77
- ref: combinedRefs,
77
+ // @ts-ignore temporary disable as we migrate to css modules, until we remove PolymorphicForwardRefComponent
78
+ ref: innerRef,
78
79
  className: clsx(classes.ButtonBase, className),
79
80
  "data-block": block ? 'block' : null,
80
81
  "data-inactive": inactive ? true : undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAC,KAAK,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAKnD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;IAC/C,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,QAAA,MAAM,WAAW,EAoBX,8BAA8B,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAA;AAI7D,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAS,KAAK,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAK3D,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;IAC/C,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,QAAA,MAAM,WAAW,EAoBX,8BAA8B,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAA;AAI7D,eAAe,WAAW,CAAA"}
@@ -1,14 +1,14 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import React from 'react';
2
+ import React, { useRef } from 'react';
3
3
  import classes from './ButtonGroup.module.css.js';
4
4
  import { clsx } from 'clsx';
5
5
  import { useFocusZone } from '../hooks/useFocusZone.js';
6
6
  import { jsx } from 'react/jsx-runtime';
7
- import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
7
+ import { useMergedRefs } from '../hooks/useMergedRefs.js';
8
8
  import { FocusKeys } from '@primer/behaviors';
9
9
 
10
10
  const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwardRef) {
11
- const $ = c(20);
11
+ const $ = c(19);
12
12
  let children;
13
13
  let className;
14
14
  let rest;
@@ -45,49 +45,49 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwa
45
45
  t2 = $[7];
46
46
  }
47
47
  const buttons = t2;
48
- const buttonRef = useProvidedRefOrCreate(forwardRef);
48
+ const buttonRef = useRef(null);
49
+ const mergedRef = useMergedRefs(buttonRef, forwardRef);
49
50
  const t3 = role !== "toolbar";
50
51
  let t4;
51
- if ($[8] !== buttonRef || $[9] !== t3) {
52
+ if ($[8] !== t3) {
52
53
  t4 = {
53
54
  containerRef: buttonRef,
54
55
  disabled: t3,
55
56
  bindKeys: FocusKeys.ArrowHorizontal,
56
57
  focusOutBehavior: "wrap"
57
58
  };
58
- $[8] = buttonRef;
59
- $[9] = t3;
60
- $[10] = t4;
59
+ $[8] = t3;
60
+ $[9] = t4;
61
61
  } else {
62
- t4 = $[10];
62
+ t4 = $[9];
63
63
  }
64
64
  useFocusZone(t4);
65
65
  let t5;
66
- if ($[11] !== className) {
66
+ if ($[10] !== className) {
67
67
  t5 = clsx(className, classes.ButtonGroup);
68
- $[11] = className;
69
- $[12] = t5;
68
+ $[10] = className;
69
+ $[11] = t5;
70
70
  } else {
71
- t5 = $[12];
71
+ t5 = $[11];
72
72
  }
73
73
  let t6;
74
- if ($[13] !== BaseComponent || $[14] !== buttonRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
74
+ if ($[12] !== BaseComponent || $[13] !== buttons || $[14] !== mergedRef || $[15] !== rest || $[16] !== role || $[17] !== t5) {
75
75
  t6 = /*#__PURE__*/jsx(BaseComponent, {
76
- ref: buttonRef,
76
+ ref: mergedRef,
77
77
  className: t5,
78
78
  role: role,
79
79
  ...rest,
80
80
  children: buttons
81
81
  });
82
- $[13] = BaseComponent;
83
- $[14] = buttonRef;
84
- $[15] = buttons;
85
- $[16] = rest;
86
- $[17] = role;
87
- $[18] = t5;
88
- $[19] = t6;
82
+ $[12] = BaseComponent;
83
+ $[13] = buttons;
84
+ $[14] = mergedRef;
85
+ $[15] = rest;
86
+ $[16] = role;
87
+ $[17] = t5;
88
+ $[18] = t6;
89
89
  } else {
90
- t6 = $[19];
90
+ t6 = $[18];
91
91
  }
92
92
  return t6;
93
93
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAiD,KAAK,mBAAmB,EAAoB,MAAM,OAAO,CAAA;AAExH,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AAI7E,OAAO,KAAK,EAAC,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