@primer/react 0.0.0-20260715165143 → 0.0.0-20260715185830

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260715165143
3
+ ## 0.0.0-20260715185830
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -62,10 +62,10 @@ const UnwrappedList = (props, forwardedRef) => {
62
62
  const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
63
63
  const listRole = role || listRoleFromContainer;
64
64
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
65
- const internalRef = useRef(null);
66
- const mergedRef = useMergedRefs(forwardedRef, internalRef);
65
+ const listRef = useRef(null);
66
+ const mergedRef = useMergedRefs(forwardedRef, listRef);
67
67
  const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
68
- const listRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
68
+ const readRef = mergedRefEnabled ? listRef : providedOrCreatedRef;
69
69
  const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
70
70
  const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
71
71
  let enableFocusZone = false;
@@ -85,14 +85,14 @@ const UnwrappedList = (props, forwardedRef) => {
85
85
  const t5 = !enableFocusZone;
86
86
  const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : void 0;
87
87
  let t7;
88
- if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
88
+ if ($[11] !== readRef || $[12] !== t5 || $[13] !== t6) {
89
89
  t7 = {
90
90
  disabled: t5,
91
- containerRef: listRef,
91
+ containerRef: readRef,
92
92
  bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
93
93
  focusOutBehavior: t6
94
94
  };
95
- $[11] = listRef;
95
+ $[11] = readRef;
96
96
  $[12] = t5;
97
97
  $[13] = t6;
98
98
  $[14] = t7;
@@ -117,16 +117,16 @@ const UnwrappedList = (props, forwardedRef) => {
117
117
  } else t9 = $[20];
118
118
  const listContextValue = t9;
119
119
  let t10;
120
- if ($[21] !== listRef.current) {
120
+ if ($[21] !== readRef.current) {
121
121
  t10 = () => {
122
- const list = listRef.current;
122
+ const list = readRef.current;
123
123
  if (!list) return;
124
124
  const hasMixed = list.querySelector("[data-has-description=\"true\"]") !== null && list.querySelector("[data-has-description=\"false\"]") !== null;
125
125
  const current = list.getAttribute("data-mixed-descriptions");
126
126
  if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
127
127
  else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
128
128
  };
129
- $[21] = listRef.current;
129
+ $[21] = readRef.current;
130
130
  $[22] = t10;
131
131
  } else t10 = $[22];
132
132
  useIsomorphicLayoutEffect(t10);
@@ -32,10 +32,10 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
32
32
  }
33
33
  const BaseComponent = t1 === void 0 ? "div" : t1;
34
34
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
35
- const internalRef = useRef(null);
36
- const mergedRef = useMergedRefs(internalRef, forwardRef);
35
+ const buttonRef = useRef(null);
36
+ const mergedRef = useMergedRefs(buttonRef, forwardRef);
37
37
  const providedOrCreatedRef = useProvidedRefOrCreate(forwardRef);
38
- const buttonRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
38
+ const readRef = mergedRefEnabled ? buttonRef : providedOrCreatedRef;
39
39
  const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
40
40
  let t2;
41
41
  if ($[6] !== children) {
@@ -46,14 +46,14 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
46
46
  const buttons = t2;
47
47
  const t3 = role !== "toolbar";
48
48
  let t4;
49
- if ($[8] !== buttonRef || $[9] !== t3) {
49
+ if ($[8] !== readRef || $[9] !== t3) {
50
50
  t4 = {
51
- containerRef: buttonRef,
51
+ containerRef: readRef,
52
52
  disabled: t3,
53
53
  bindKeys: FocusKeys.ArrowHorizontal,
54
54
  focusOutBehavior: "wrap"
55
55
  };
56
- $[8] = buttonRef;
56
+ $[8] = readRef;
57
57
  $[9] = t3;
58
58
  $[10] = t4;
59
59
  } else t4 = $[10];
@@ -14,18 +14,18 @@ import React, { useContext, useEffect, useRef } from "react";
14
14
  */
15
15
  const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
16
16
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
17
- const internalRef = useRef(null);
18
- const mergedRef = useMergedRefs(internalRef, ref);
17
+ const checkboxRef = useRef(null);
18
+ const mergedRef = useMergedRefs(checkboxRef, ref);
19
19
  const providedOrCreatedRef = useProvidedRefOrCreate(ref);
20
- const checkboxRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
20
+ const readRef = mergedRefEnabled ? checkboxRef : providedOrCreatedRef;
21
21
  const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
22
22
  const checkboxGroupContext = useContext(CheckboxGroupContext);
23
23
  const handleOnChange = (e) => {
24
24
  checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
25
25
  onChange && onChange(e);
26
- if (indeterminate && checkboxRef.current) {
27
- checkboxRef.current.indeterminate = true;
28
- checkboxRef.current.setAttribute("aria-checked", "mixed");
26
+ if (indeterminate && readRef.current) {
27
+ readRef.current.indeterminate = true;
28
+ readRef.current.setAttribute("aria-checked", "mixed");
29
29
  }
30
30
  };
31
31
  const inputProps = {
@@ -43,14 +43,14 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
43
43
  ...rest
44
44
  };
45
45
  useIsomorphicLayoutEffect(() => {
46
- if (checkboxRef.current) checkboxRef.current.indeterminate = indeterminate || false;
46
+ if (readRef.current) readRef.current.indeterminate = indeterminate || false;
47
47
  }, [
48
48
  indeterminate,
49
49
  checked,
50
- checkboxRef
50
+ readRef
51
51
  ]);
52
52
  useEffect(() => {
53
- const { current: checkbox } = checkboxRef;
53
+ const { current: checkbox } = readRef;
54
54
  if (!checkbox) return;
55
55
  if (indeterminate) checkbox.setAttribute("aria-checked", "mixed");
56
56
  else checkbox.setAttribute("aria-checked", checkbox.checked ? "true" : "false");
@@ -247,19 +247,19 @@ const Buttons = ({ buttons }) => {
247
247
  var _buttons$find;
248
248
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
249
249
  const providedButtonRef = (_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref;
250
- const internalRef = useRef(null);
251
- const mergedRef = useMergedRefs(internalRef, providedButtonRef);
250
+ const autoFocusRef = useRef(null);
251
+ const mergedRef = useMergedRefs(autoFocusRef, providedButtonRef);
252
252
  const providedOrCreatedRef = useProvidedRefOrCreate(providedButtonRef);
253
- const autoFocusRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
253
+ const readRef = mergedRefEnabled ? autoFocusRef : providedOrCreatedRef;
254
254
  const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
255
255
  let autoFocusCount = 0;
256
256
  const [hasRendered, setHasRendered] = useState(0);
257
257
  useEffect(() => {
258
258
  if (hasRendered === 1) {
259
- var _autoFocusRef$current;
260
- (_autoFocusRef$current = autoFocusRef.current) === null || _autoFocusRef$current === void 0 || _autoFocusRef$current.focus();
259
+ var _readRef$current;
260
+ (_readRef$current = readRef.current) === null || _readRef$current === void 0 || _readRef$current.focus();
261
261
  } else setHasRendered(hasRendered + 1);
262
- }, [autoFocusRef, hasRendered]);
262
+ }, [readRef, hasRendered]);
263
263
  return /*#__PURE__*/ jsx(Fragment, { children: buttons.map((dialogButtonProps, index) => {
264
264
  const { content, buttonType = "default", autoFocus = false, ...buttonProps } = dialogButtonProps;
265
265
  return /*#__PURE__*/ jsx(ButtonComponent, {
@@ -37,15 +37,15 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
37
37
  const inputAndListContainerRef = useRef(null);
38
38
  const listRef = useRef(null);
39
39
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
40
- const internalScrollContainerRef = useRef(null);
41
- const mergedScrollContainerRef = useMergedRefs(internalScrollContainerRef, providedScrollContainerRef);
40
+ const scrollContainerRef = useRef(null);
41
+ const mergedScrollContainerRef = useMergedRefs(scrollContainerRef, providedScrollContainerRef);
42
42
  const providedOrCreatedScrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
43
- const scrollContainerRef = mergedRefEnabled ? internalScrollContainerRef : providedOrCreatedScrollContainerRef;
43
+ const readScrollContainerRef = mergedRefEnabled ? scrollContainerRef : providedOrCreatedScrollContainerRef;
44
44
  const appliedScrollContainerRef = mergedRefEnabled ? mergedScrollContainerRef : providedOrCreatedScrollContainerRef;
45
- const internalInputRef = useRef(null);
46
- const mergedInputRef = useMergedRefs(internalInputRef, providedInputRef);
45
+ const inputRef = useRef(null);
46
+ const mergedInputRef = useMergedRefs(inputRef, providedInputRef);
47
47
  const providedOrCreatedInputRef = useProvidedRefOrCreate(providedInputRef);
48
- const inputRef = mergedRefEnabled ? internalInputRef : providedOrCreatedInputRef;
48
+ const readInputRef = mergedRefEnabled ? inputRef : providedOrCreatedInputRef;
49
49
  const appliedInputRef = mergedRefEnabled ? mergedInputRef : providedOrCreatedInputRef;
50
50
  const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
51
51
  const [listContainerElement, setListContainerElement] = useState(null);
@@ -100,12 +100,12 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
100
100
  onListContainerRefChanged === null || onListContainerRefChanged === void 0 || onListContainerRefChanged(node);
101
101
  }, [onListContainerRefChanged]);
102
102
  useEffect(() => {
103
- onInputRefChanged === null || onInputRefChanged === void 0 || onInputRefChanged(inputRef);
104
- }, [inputRef, onInputRefChanged]);
103
+ onInputRefChanged === null || onInputRefChanged === void 0 || onInputRefChanged(readInputRef);
104
+ }, [readInputRef, onInputRefChanged]);
105
105
  const DEFAULT_VIRTUAL_ITEM_HEIGHT = 32;
106
106
  const virtualizer = useVirtualizer({
107
107
  count: items.length,
108
- getScrollElement: () => scrollContainerRef.current,
108
+ getScrollElement: () => readScrollContainerRef.current,
109
109
  estimateSize: () => DEFAULT_VIRTUAL_ITEM_HEIGHT,
110
110
  overscan: 10,
111
111
  enabled: isVirtualized,
@@ -139,7 +139,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
139
139
  focusableElementFilter: (element) => {
140
140
  return !(element instanceof HTMLInputElement);
141
141
  },
142
- activeDescendantFocus: inputRef,
142
+ activeDescendantFocus: readInputRef,
143
143
  onActiveDescendantChanged: (current, previous, directlyActivated) => {
144
144
  activeDescendantRef.current = current;
145
145
  if (isVirtualized && current) {
@@ -147,7 +147,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
147
147
  const range = virtualizer.range;
148
148
  if (index !== null && range && (Number(index) < range.startIndex || Number(index) >= range.endIndex)) virtualizer.scrollToIndex(Number(index), { align: "auto" });
149
149
  }
150
- if (current && scrollContainerRef.current && (directlyActivated || focusPrependedElements)) scrollIntoView(current, scrollContainerRef.current, {
150
+ if (current && readScrollContainerRef.current && (directlyActivated || focusPrependedElements)) scrollIntoView(current, readScrollContainerRef.current, {
151
151
  ...menuScrollMargins,
152
152
  behavior: scrollBehavior
153
153
  });
@@ -164,14 +164,14 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
164
164
  isVirtualized
165
165
  ]);
166
166
  useEffect(() => {
167
- if (activeDescendantRef.current && scrollContainerRef.current) scrollIntoView(activeDescendantRef.current, scrollContainerRef.current, {
167
+ if (activeDescendantRef.current && readScrollContainerRef.current) scrollIntoView(activeDescendantRef.current, readScrollContainerRef.current, {
168
168
  ...menuScrollMargins,
169
169
  behavior: scrollBehavior
170
170
  });
171
171
  }, [
172
172
  items,
173
- inputRef,
174
- scrollContainerRef,
173
+ readInputRef,
174
+ readScrollContainerRef,
175
175
  scrollBehavior
176
176
  ]);
177
177
  useEffect(() => {
@@ -181,7 +181,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
181
181
  const list = listRef.current;
182
182
  if (!list) return;
183
183
  const handleFocusIn = (event) => {
184
- if (event.target === inputRef.current || list.contains(event.target)) setIsInputFocused(inputRef.current && inputRef.current === document.activeElement ? true : false);
184
+ if (event.target === readInputRef.current || list.contains(event.target)) setIsInputFocused(readInputRef.current && readInputRef.current === document.activeElement ? true : false);
185
185
  };
186
186
  inputAndListContainerElement.addEventListener("focusin", handleFocusIn);
187
187
  return () => {
@@ -190,26 +190,26 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
190
190
  }
191
191
  }, [
192
192
  items,
193
- inputRef,
193
+ readInputRef,
194
194
  listContainerElement,
195
195
  usingRovingTabindex
196
196
  ]);
197
197
  useEffect(() => {
198
- if (usingRovingTabindex && !loading) setIsInputFocused(inputRef.current && inputRef.current === document.activeElement ? true : false);
198
+ if (usingRovingTabindex && !loading) setIsInputFocused(readInputRef.current && readInputRef.current === document.activeElement ? true : false);
199
199
  }, [
200
200
  loading,
201
- inputRef,
201
+ readInputRef,
202
202
  usingRovingTabindex
203
203
  ]);
204
- useAnnouncements(items, usingRovingTabindex ? listRef : { current: listContainerElement }, inputRef, announcementsEnabled, loading, messageText, _PrivateFocusManagement);
205
- useScrollFlash(scrollContainerRef);
204
+ useAnnouncements(items, usingRovingTabindex ? listRef : { current: listContainerElement }, readInputRef, announcementsEnabled, loading, messageText, _PrivateFocusManagement);
205
+ useScrollFlash(readScrollContainerRef);
206
206
  const handleSelectAllChange = useCallback((e) => {
207
207
  if (onSelectAllChange) onSelectAllChange(e.target.checked);
208
208
  }, [onSelectAllChange]);
209
209
  function getBodyContent() {
210
- if (loading && scrollContainerRef.current && loadingType.appearsInBody) return /*#__PURE__*/ jsx(FilteredActionListBodyLoader, {
210
+ if (loading && readScrollContainerRef.current && loadingType.appearsInBody) return /*#__PURE__*/ jsx(FilteredActionListBodyLoader, {
211
211
  loadingType,
212
- height: scrollContainerRef.current.clientHeight
212
+ height: readScrollContainerRef.current.clientHeight
213
213
  });
214
214
  if (message) return message;
215
215
  let firstGroupIndex = 0;
@@ -30,10 +30,10 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
30
30
  const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
31
31
  const BaseComponent = t1 === void 0 ? "div" : t1;
32
32
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
33
- const internalRef = useRef(null);
34
- const mergedRef = useMergedRefs(internalRef, forwardedRef);
33
+ const rootRef = useRef(null);
34
+ const mergedRef = useMergedRefs(rootRef, forwardedRef);
35
35
  const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
36
- const rootRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
36
+ const readRef = mergedRefEnabled ? rootRef : providedOrCreatedRef;
37
37
  const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
38
38
  const hoistChildState = (nodes) => {
39
39
  const result = { hasNavigation: false };
@@ -61,12 +61,12 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
61
61
  const isInteractive = _temp;
62
62
  let t2;
63
63
  let t3;
64
- if ($[0] !== children || $[1] !== rootRef) {
64
+ if ($[0] !== children || $[1] !== readRef) {
65
65
  t2 = function validateInteractiveElementsInTitle() {
66
66
  let hasContextArea = false;
67
67
  let hasLeadingAction = false;
68
- if (!rootRef.current || rootRef.current.children.length <= 0) return;
69
- const titleArea = Array.from(rootRef.current.children).find(_temp2);
68
+ if (!readRef.current || readRef.current.children.length <= 0) return;
69
+ const titleArea = Array.from(readRef.current.children).find(_temp2);
70
70
  if (!titleArea) return;
71
71
  for (const child_1 of React.Children.toArray(children)) {
72
72
  if (/*#__PURE__*/ React.isValidElement(child_1) && (child_1.type === ContextArea || isSlot(child_1, ContextArea))) hasContextArea = true;
@@ -74,9 +74,9 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
74
74
  }
75
75
  warning(Array.from(titleArea.childNodes).some((child_2) => child_2 instanceof HTMLElement && isInteractive(child_2) || Array.from(child_2.childNodes).some((child_3) => child_3 instanceof HTMLElement && isInteractive(child_3))) && (hasContextArea || hasLeadingAction), "When PageHeader.ContextArea or PageHeader.LeadingAction is present, we recommended not to include any interactive items in the PageHeader.TitleArea to make sure the focus order is logical.");
76
76
  };
77
- t3 = [children, rootRef];
77
+ t3 = [children, readRef];
78
78
  $[0] = children;
79
- $[1] = rootRef;
79
+ $[1] = readRef;
80
80
  $[2] = t2;
81
81
  $[3] = t3;
82
82
  } else {
@@ -304,7 +304,7 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
304
304
  const variant = t2 === void 0 ? "medium" : t2;
305
305
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
306
306
  const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
307
- const titleAreaRef = mergedRefEnabled ? forwardedRef : providedOrCreatedRef;
307
+ const appliedRef = mergedRefEnabled ? forwardedRef : providedOrCreatedRef;
308
308
  let t3;
309
309
  if ($[0] !== className) {
310
310
  t3 = clsx(PageHeader_module_css_default.TitleArea, className);
@@ -324,20 +324,20 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
324
324
  $[5] = t5;
325
325
  } else t5 = $[5];
326
326
  let t6;
327
- if ($[6] !== children || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== titleAreaRef) {
327
+ if ($[6] !== appliedRef || $[7] !== children || $[8] !== t3 || $[9] !== t4 || $[10] !== t5) {
328
328
  t6 = /*#__PURE__*/ jsx("div", {
329
329
  className: t3,
330
- ref: titleAreaRef,
330
+ ref: appliedRef,
331
331
  "data-component": "TitleArea",
332
332
  ...t4,
333
333
  ...t5,
334
334
  children
335
335
  });
336
- $[6] = children;
337
- $[7] = t3;
338
- $[8] = t4;
339
- $[9] = t5;
340
- $[10] = titleAreaRef;
336
+ $[6] = appliedRef;
337
+ $[7] = children;
338
+ $[8] = t3;
339
+ $[9] = t4;
340
+ $[10] = t5;
341
341
  $[11] = t6;
342
342
  } else t6 = $[11];
343
343
  return t6;
@@ -21,10 +21,10 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
21
21
  var _counter$isOverLimit;
22
22
  const [isInputFocused, setIsInputFocused] = useState(false);
23
23
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
24
- const internalRef = useRef(null);
25
- const mergedRef = useMergedRefs(internalRef, ref);
24
+ const inputRef = useRef(null);
25
+ const mergedRef = useMergedRefs(inputRef, ref);
26
26
  const providedOrCreatedRef = useProvidedRefOrCreate(ref);
27
- const inputRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
27
+ const readRef = mergedRefEnabled ? inputRef : providedOrCreatedRef;
28
28
  const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
29
29
  const isControlled = value !== void 0;
30
30
  const [uncontrolledLength, setUncontrolledLength] = useState(() => defaultValue !== void 0 ? String(defaultValue).length : 0);
@@ -36,9 +36,9 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
36
36
  const showTrailingLoadingIndicator = loading && (loaderPosition === "trailing" || Boolean(loaderPosition === "auto" && !LeadingVisual));
37
37
  const isSegmentedInputType = type === "date" || type === "time" || type === "datetime-local";
38
38
  const focusInput = (e) => {
39
- if (e.target !== inputRef.current || !isSegmentedInputType) {
40
- var _inputRef$current;
41
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
39
+ if (e.target !== readRef.current || !isSegmentedInputType) {
40
+ var _readRef$current;
41
+ (_readRef$current = readRef.current) === null || _readRef$current === void 0 || _readRef$current.focus();
42
42
  }
43
43
  };
44
44
  const leadingVisualId = useId();
@@ -83,10 +83,10 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
83
83
  const tooltipId = useId$1(id);
84
84
  const child = Children.only(children);
85
85
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
86
- const internalRef = useRef(null);
87
- const mergedTriggerRef = useMergedRefs(internalRef, forwardedRef);
86
+ const triggerRef = useRef(null);
87
+ const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
88
88
  const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
89
- const triggerRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
89
+ const readTriggerRef = mergedRefEnabled ? triggerRef : providedOrCreatedRef;
90
90
  const appliedTriggerRef = mergedRefEnabled ? mergedTriggerRef : providedOrCreatedRef;
91
91
  const tooltipElRef = useRef(null);
92
92
  const [calculatedDirection, setCalculatedDirection] = useState(direction);
@@ -95,9 +95,9 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
95
95
  const { safeSetTimeout, safeClearTimeout } = useSafeTimeout();
96
96
  const openTooltip = () => {
97
97
  try {
98
- if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
98
+ if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
99
99
  const tooltip = tooltipElRef.current;
100
- const trigger = triggerRef.current;
100
+ const trigger = readTriggerRef.current;
101
101
  tooltip.showPopover();
102
102
  setIsPopoverOpen(true);
103
103
  const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, {
@@ -119,7 +119,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
119
119
  openTimeoutRef.current = null;
120
120
  }
121
121
  try {
122
- if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
122
+ if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
123
123
  tooltipElRef.current.hidePopover();
124
124
  setIsPopoverOpen(false);
125
125
  } else setIsPopoverOpen(false);
@@ -129,16 +129,16 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
129
129
  };
130
130
  const value = useMemo(() => ({ tooltipId }), [tooltipId]);
131
131
  useEffect(() => {
132
- if (!tooltipElRef.current || !triggerRef.current) return;
133
- const isTriggerInteractive = isInteractive(triggerRef.current);
134
- const triggerChildren = triggerRef.current.childNodes;
132
+ if (!tooltipElRef.current || !readTriggerRef.current) return;
133
+ const isTriggerInteractive = isInteractive(readTriggerRef.current);
134
+ const triggerChildren = readTriggerRef.current.childNodes;
135
135
  const hasInteractiveDescendant = Array.from(triggerChildren).some((child) => {
136
136
  return child instanceof HTMLElement && isInteractive(child) || Array.from(child.childNodes).some((grandChild) => grandChild instanceof HTMLElement && isInteractive(grandChild));
137
137
  });
138
138
  !(isTriggerInteractive || hasInteractiveDescendant) && invariant(false, "The `Tooltip` component expects a single React element that contains interactive content. Consider using a `<button>` or equivalent interactive element instead.");
139
139
  if (type === "label") {
140
- const hasAriaLabel = triggerRef.current.hasAttribute("aria-label");
141
- const hasAriaLabelInChildren = Array.from(triggerRef.current.childNodes).some((child) => child instanceof HTMLElement && child.hasAttribute("aria-label"));
140
+ const hasAriaLabel = readTriggerRef.current.hasAttribute("aria-label");
141
+ const hasAriaLabelInChildren = Array.from(readTriggerRef.current.childNodes).some((child) => child instanceof HTMLElement && child.hasAttribute("aria-label"));
142
142
  warning(hasAriaLabel || hasAriaLabelInChildren, "The label type `Tooltip` is going to be used here to label the trigger element. Please remove the aria-label from the trigger element.");
143
143
  }
144
144
  if (typeof window !== "undefined") {
@@ -147,7 +147,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
147
147
  tooltipElRef.current.setAttribute("popover", "auto");
148
148
  }, [
149
149
  tooltipElRef,
150
- triggerRef,
150
+ readTriggerRef,
151
151
  direction,
152
152
  type
153
153
  ]);
@@ -8,15 +8,15 @@ function useTabList(props) {
8
8
  const $ = c(9);
9
9
  const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": ariaOrientation } = props;
10
10
  const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
11
- const internalRef = useRef(null);
12
- const mergedRef = useMergedRefs(internalRef, props.ref);
11
+ const tabListRef = useRef(null);
12
+ const mergedRef = useMergedRefs(tabListRef, props.ref);
13
13
  const providedOrCreatedRef = useProvidedRefOrCreate(props.ref);
14
- const ref = mergedRefEnabled ? internalRef : providedOrCreatedRef;
14
+ const readRef = mergedRefEnabled ? tabListRef : providedOrCreatedRef;
15
15
  const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
16
16
  let t0;
17
- if ($[0] !== ariaOrientation || $[1] !== ref) {
17
+ if ($[0] !== ariaOrientation || $[1] !== readRef) {
18
18
  t0 = (event) => {
19
- const { current: tablist } = ref;
19
+ const { current: tablist } = readRef;
20
20
  if (tablist === null) return;
21
21
  const tabs = getFocusableTabs(tablist);
22
22
  const isVertical = ariaOrientation === "vertical";
@@ -41,7 +41,7 @@ function useTabList(props) {
41
41
  }
42
42
  };
43
43
  $[0] = ariaOrientation;
44
- $[1] = ref;
44
+ $[1] = readRef;
45
45
  $[2] = t0;
46
46
  } else t0 = $[2];
47
47
  const onKeyDown = t0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260715165143",
4
+ "version": "0.0.0-20260715185830",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",