@primer/react 38.47.0-rc.cdd1ab1f0 → 39.0.0-rc.00628b8df

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.
@@ -2,8 +2,6 @@ import { c } from "../utils/react-compiler-runtime.js";
2
2
  import { useId as useId$1 } from "../hooks/useId.js";
3
3
  import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
4
4
  import { useMergedRefs } from "../hooks/useMergedRefs.js";
5
- import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
6
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
7
5
  import { invariant } from "../utils/invariant.js";
8
6
  import { warning } from "../utils/warning.js";
9
7
  import Tooltip_module_css_default from "./Tooltip.module.css.js";
@@ -82,7 +80,7 @@ const isInteractive = (element) => {
82
80
  };
83
81
  const emptyKeybindingHints = [];
84
82
  const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
85
- const $ = c(60);
83
+ const $ = c(56);
86
84
  let children;
87
85
  let className;
88
86
  let id;
@@ -129,24 +127,20 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
129
127
  warning(isFragmentTrigger, "The `Tooltip` component does not support a React Fragment as its trigger. Pass a single interactive element instead.");
130
128
  const elementChild = /*#__PURE__*/ React.isValidElement(child) ? child : void 0;
131
129
  const childRef = reactMajorVersion > 18 ? elementChild === null || elementChild === void 0 ? void 0 : elementChild.props.ref : elementChild === null || elementChild === void 0 ? void 0 : elementChild.ref;
132
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
133
130
  const triggerRef = useRef(null);
134
131
  const mergedTriggerRef = useMergedRefs(triggerRef, useMergedRefs(forwardedRef, childRef));
135
- const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : childRef);
136
- const readTriggerRef = mergedRefEnabled ? triggerRef : providedOrCreatedRef;
137
- const appliedTriggerRef = mergedRefEnabled ? mergedTriggerRef : providedOrCreatedRef;
138
132
  const tooltipElRef = useRef(null);
139
133
  const [calculatedDirection, setCalculatedDirection] = useState(direction);
140
134
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
141
135
  const openTimeoutRef = React.useRef(null);
142
136
  const { safeSetTimeout, safeClearTimeout } = useSafeTimeout();
143
137
  let t6;
144
- if ($[11] !== _privateDisableTooltip || $[12] !== direction || $[13] !== readTriggerRef) {
138
+ if ($[11] !== _privateDisableTooltip || $[12] !== direction) {
145
139
  t6 = () => {
146
140
  try {
147
- if (tooltipElRef.current && readTriggerRef.current instanceof HTMLElement && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
141
+ if (tooltipElRef.current && triggerRef.current instanceof HTMLElement && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
148
142
  const tooltip = tooltipElRef.current;
149
- const trigger = readTriggerRef.current;
143
+ const trigger = triggerRef.current;
150
144
  tooltip.showPopover();
151
145
  setIsPopoverOpen(true);
152
146
  const settings = {
@@ -166,19 +160,18 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
166
160
  };
167
161
  $[11] = _privateDisableTooltip;
168
162
  $[12] = direction;
169
- $[13] = readTriggerRef;
170
- $[14] = t6;
171
- } else t6 = $[14];
163
+ $[13] = t6;
164
+ } else t6 = $[13];
172
165
  const openTooltip = t6;
173
166
  let t7;
174
- if ($[15] !== readTriggerRef || $[16] !== safeClearTimeout) {
167
+ if ($[14] !== safeClearTimeout) {
175
168
  t7 = () => {
176
169
  if (openTimeoutRef.current) {
177
170
  safeClearTimeout(openTimeoutRef.current);
178
171
  openTimeoutRef.current = null;
179
172
  }
180
173
  try {
181
- if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
174
+ if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
182
175
  tooltipElRef.current.hidePopover();
183
176
  setIsPopoverOpen(false);
184
177
  } else setIsPopoverOpen(false);
@@ -187,23 +180,22 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
187
180
  if (error_0 && typeof error_0 === "object" && "message" in error_0 && typeof error_0.message === "string" && error_0.message.includes("not a valid selector")) {} else throw error_0;
188
181
  }
189
182
  };
190
- $[15] = readTriggerRef;
191
- $[16] = safeClearTimeout;
192
- $[17] = t7;
193
- } else t7 = $[17];
183
+ $[14] = safeClearTimeout;
184
+ $[15] = t7;
185
+ } else t7 = $[15];
194
186
  const closeTooltip = t7;
195
187
  let t8;
196
- if ($[18] !== tooltipId) {
188
+ if ($[16] !== tooltipId) {
197
189
  t8 = { tooltipId };
198
- $[18] = tooltipId;
199
- $[19] = t8;
200
- } else t8 = $[19];
190
+ $[16] = tooltipId;
191
+ $[17] = t8;
192
+ } else t8 = $[17];
201
193
  const value = t8;
202
194
  let t9;
203
- if ($[20] !== readTriggerRef || $[21] !== type) {
195
+ if ($[18] !== type) {
204
196
  t9 = () => {
205
- if (!tooltipElRef.current || !readTriggerRef.current) return;
206
- const trigger_0 = readTriggerRef.current;
197
+ if (!tooltipElRef.current || !triggerRef.current) return;
198
+ const trigger_0 = triggerRef.current;
207
199
  const isInvalidTrigger = !(trigger_0 instanceof HTMLElement);
208
200
  warning(isInvalidTrigger, "The `Tooltip` component expects its trigger ref to resolve to an HTML element. Ensure the trigger forwards its ref to a single interactive element instead of a React Fragment.");
209
201
  if (isInvalidTrigger) return;
@@ -221,26 +213,23 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
221
213
  }
222
214
  tooltipElRef.current.setAttribute("popover", "auto");
223
215
  };
224
- $[20] = readTriggerRef;
225
- $[21] = type;
226
- $[22] = t9;
227
- } else t9 = $[22];
216
+ $[18] = type;
217
+ $[19] = t9;
218
+ } else t9 = $[19];
228
219
  let t10;
229
- if ($[23] !== direction || $[24] !== readTriggerRef || $[25] !== type) {
220
+ if ($[20] !== direction || $[21] !== type) {
230
221
  t10 = [
231
222
  tooltipElRef,
232
- readTriggerRef,
233
223
  direction,
234
224
  type
235
225
  ];
236
- $[23] = direction;
237
- $[24] = readTriggerRef;
238
- $[25] = type;
239
- $[26] = t10;
240
- } else t10 = $[26];
226
+ $[20] = direction;
227
+ $[21] = type;
228
+ $[22] = t10;
229
+ } else t10 = $[22];
241
230
  useEffect(t9, t10);
242
231
  let t11;
243
- if ($[27] !== _privateDisableTooltip || $[28] !== closeTooltip || $[29] !== isPopoverOpen) {
232
+ if ($[23] !== _privateDisableTooltip || $[24] !== closeTooltip || $[25] !== isPopoverOpen) {
244
233
  t11 = (event) => {
245
234
  if (isPopoverOpen) {
246
235
  if (!_privateDisableTooltip) {
@@ -250,32 +239,32 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
250
239
  closeTooltip();
251
240
  }
252
241
  };
253
- $[27] = _privateDisableTooltip;
254
- $[28] = closeTooltip;
255
- $[29] = isPopoverOpen;
256
- $[30] = t11;
257
- } else t11 = $[30];
242
+ $[23] = _privateDisableTooltip;
243
+ $[24] = closeTooltip;
244
+ $[25] = isPopoverOpen;
245
+ $[26] = t11;
246
+ } else t11 = $[26];
258
247
  let t12;
259
- if ($[31] !== _privateDisableTooltip || $[32] !== isPopoverOpen) {
248
+ if ($[27] !== _privateDisableTooltip || $[28] !== isPopoverOpen) {
260
249
  t12 = [isPopoverOpen, _privateDisableTooltip];
261
- $[31] = _privateDisableTooltip;
262
- $[32] = isPopoverOpen;
263
- $[33] = t12;
264
- } else t12 = $[33];
250
+ $[27] = _privateDisableTooltip;
251
+ $[28] = isPopoverOpen;
252
+ $[29] = t12;
253
+ } else t12 = $[29];
265
254
  useOnEscapePress(t11, t12);
266
255
  const platform = usePlatform();
267
256
  const hasAriaLabel_0 = "aria-label" in rest;
268
257
  let t13;
269
- if ($[34] !== keybindingHint) {
258
+ if ($[30] !== keybindingHint) {
270
259
  t13 = Array.isArray(keybindingHint) ? keybindingHint : [keybindingHint];
271
- $[34] = keybindingHint;
272
- $[35] = t13;
273
- } else t13 = $[35];
260
+ $[30] = keybindingHint;
261
+ $[31] = t13;
262
+ } else t13 = $[31];
274
263
  const keybindingHints = t13;
275
264
  if (isFragmentTrigger) return child;
276
265
  const t14 = TooltipContext;
277
266
  const t15 = /*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, {
278
- ref: appliedTriggerRef,
267
+ ref: mergedTriggerRef,
279
268
  "aria-describedby": (() => {
280
269
  if (type !== "description") return child.props["aria-describedby"];
281
270
  const existingDescribedBy = child.props["aria-describedby"];
@@ -317,15 +306,15 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
317
306
  }
318
307
  });
319
308
  let t17;
320
- if ($[36] !== className) {
309
+ if ($[32] !== className) {
321
310
  t17 = clsx(className, Tooltip_module_css_default.Tooltip);
322
- $[36] = className;
323
- $[37] = t17;
324
- } else t17 = $[37];
311
+ $[32] = className;
312
+ $[33] = t17;
313
+ } else t17 = $[33];
325
314
  const t18 = type === "description" ? "tooltip" : void 0;
326
315
  const t19 = hasAriaLabel_0 || keybindingHints.length === 0 ? tooltipId : void 0;
327
316
  let t20;
328
- if ($[38] !== hasAriaLabel_0 || $[39] !== keybindingHints || $[40] !== platform || $[41] !== text || $[42] !== tooltipId) {
317
+ if ($[34] !== hasAriaLabel_0 || $[35] !== keybindingHints || $[36] !== platform || $[37] !== text || $[38] !== tooltipId) {
329
318
  t20 = keybindingHints.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
330
319
  id: hasAriaLabel_0 ? void 0 : tooltipId,
331
320
  children: [text, /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
@@ -339,15 +328,15 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
339
328
  "data-component": "Tooltip.KeybindingHintContainer",
340
329
  children: keybindingHints.map(_temp4)
341
330
  })] }) : text;
342
- $[38] = hasAriaLabel_0;
343
- $[39] = keybindingHints;
344
- $[40] = platform;
345
- $[41] = text;
346
- $[42] = tooltipId;
347
- $[43] = t20;
348
- } else t20 = $[43];
331
+ $[34] = hasAriaLabel_0;
332
+ $[35] = keybindingHints;
333
+ $[36] = platform;
334
+ $[37] = text;
335
+ $[38] = tooltipId;
336
+ $[39] = t20;
337
+ } else t20 = $[39];
349
338
  let t21;
350
- if ($[44] !== calculatedDirection || $[45] !== closeTooltip || $[46] !== openTooltip || $[47] !== rest || $[48] !== t17 || $[49] !== t18 || $[50] !== t19 || $[51] !== t20) {
339
+ if ($[40] !== calculatedDirection || $[41] !== closeTooltip || $[42] !== openTooltip || $[43] !== rest || $[44] !== t17 || $[45] !== t18 || $[46] !== t19 || $[47] !== t20) {
351
340
  t21 = /* @__PURE__ */ jsx("span", {
352
341
  className: t17,
353
342
  ref: tooltipElRef,
@@ -361,34 +350,34 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
361
350
  id: t19,
362
351
  children: t20
363
352
  });
364
- $[44] = calculatedDirection;
365
- $[45] = closeTooltip;
366
- $[46] = openTooltip;
367
- $[47] = rest;
368
- $[48] = t17;
369
- $[49] = t18;
370
- $[50] = t19;
371
- $[51] = t20;
372
- $[52] = t21;
373
- } else t21 = $[52];
353
+ $[40] = calculatedDirection;
354
+ $[41] = closeTooltip;
355
+ $[42] = openTooltip;
356
+ $[43] = rest;
357
+ $[44] = t17;
358
+ $[45] = t18;
359
+ $[46] = t19;
360
+ $[47] = t20;
361
+ $[48] = t21;
362
+ } else t21 = $[48];
374
363
  let t22;
375
- if ($[53] !== t15 || $[54] !== t21) {
364
+ if ($[49] !== t15 || $[50] !== t21) {
376
365
  t22 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t15, t21] });
377
- $[53] = t15;
378
- $[54] = t21;
379
- $[55] = t22;
380
- } else t22 = $[55];
366
+ $[49] = t15;
367
+ $[50] = t21;
368
+ $[51] = t22;
369
+ } else t22 = $[51];
381
370
  let t23;
382
- if ($[56] !== t14.Provider || $[57] !== t22 || $[58] !== value) {
371
+ if ($[52] !== t14.Provider || $[53] !== t22 || $[54] !== value) {
383
372
  t23 = /* @__PURE__ */ jsx(t14.Provider, {
384
373
  value,
385
374
  children: t22
386
375
  });
387
- $[56] = t14.Provider;
388
- $[57] = t22;
389
- $[58] = value;
390
- $[59] = t23;
391
- } else t23 = $[59];
376
+ $[52] = t14.Provider;
377
+ $[53] = t22;
378
+ $[54] = value;
379
+ $[55] = t23;
380
+ } else t23 = $[55];
392
381
  return t23;
393
382
  });
394
383
  Tooltip.__SLOT__ = Symbol("Tooltip");
@@ -1,6 +1,6 @@
1
1
  import { c } from "../utils/react-compiler-runtime.js";
2
2
  import { getNextFocusableElement } from "./useRovingTabIndex.js";
3
- import { useEffect } from "react";
3
+ import { useEffect, useRef } from "react";
4
4
  import { isEditableElement } from "@primer/behaviors/utils";
5
5
  // src/TreeView/useTreeRovingTabIndex.ts
6
6
  const TREE_ITEM = "[role=\"treeitem\"]";
@@ -43,20 +43,21 @@ function useTreeRovingTabIndex(t0) {
43
43
  const $ = c(5);
44
44
  const { containerRef, mouseDownRef, preventScroll: t1 } = t0;
45
45
  const preventScroll = t1 === void 0 ? true : t1;
46
+ const tabStopRef = useRef(null);
46
47
  let t2;
47
48
  let t3;
48
49
  if ($[0] !== containerRef || $[1] !== mouseDownRef || $[2] !== preventScroll) {
49
50
  t2 = () => {
51
+ tabStopRef.current = null;
50
52
  const root = containerRef.current;
51
53
  if (!root) return;
52
54
  const container = root;
53
- let tabStop = null;
54
55
  const setTabStop = function setTabStop(element) {
55
- var _tabStop;
56
- if (element === tabStop) return;
57
- (_tabStop = tabStop) === null || _tabStop === void 0 || _tabStop.setAttribute("tabindex", "-1");
56
+ var _tabStopRef$current;
57
+ if (element === tabStopRef.current) return;
58
+ (_tabStopRef$current = tabStopRef.current) === null || _tabStopRef$current === void 0 || _tabStopRef$current.setAttribute("tabindex", "-1");
58
59
  element === null || element === void 0 || element.setAttribute("tabindex", "0");
59
- tabStop = element;
60
+ tabStopRef.current = element;
60
61
  };
61
62
  const getPreferredItem = function getPreferredItem(t4) {
62
63
  var _ref, _container$querySelec;
@@ -64,12 +65,12 @@ function useTreeRovingTabIndex(t0) {
64
65
  return (_ref = (_container$querySelec = container.querySelector(CURRENT_TREE_ITEM)) !== null && _container$querySelec !== void 0 ? _container$querySelec : candidate) !== null && _ref !== void 0 ? _ref : container.querySelector(TREE_ITEM);
65
66
  };
66
67
  const removeElementFromTabOrder = function removeElementFromTabOrder(element_0) {
67
- if (element_0.matches(NESTED_TABBABLE) || element_0 !== tabStop && element_0.matches(TABBABLE_TREE_ITEM)) element_0.setAttribute("tabindex", "-1");
68
+ if (element_0.matches(NESTED_TABBABLE) || element_0 !== tabStopRef.current && element_0.matches(TABBABLE_TREE_ITEM)) element_0.setAttribute("tabindex", "-1");
68
69
  };
69
70
  const removeFromTabOrder = function removeFromTabOrder(root_0) {
70
71
  removeElementFromTabOrder(root_0);
71
72
  for (const element_1 of root_0.querySelectorAll(NESTED_TABBABLE)) element_1.setAttribute("tabindex", "-1");
72
- for (const element_2 of root_0.querySelectorAll(TABBABLE_TREE_ITEM)) if (element_2 !== tabStop) element_2.setAttribute("tabindex", "-1");
73
+ for (const element_2 of root_0.querySelectorAll(TABBABLE_TREE_ITEM)) if (element_2 !== tabStopRef.current) element_2.setAttribute("tabindex", "-1");
73
74
  };
74
75
  const activeElement = document.activeElement;
75
76
  setTabStop(getPreferredItem(activeElement instanceof HTMLElement && container.contains(activeElement) && activeElement.getAttribute("role") === "treeitem" ? activeElement : null));
@@ -82,8 +83,8 @@ function useTreeRovingTabIndex(t0) {
82
83
  }
83
84
  for (const node of mutation.addedNodes) if (node instanceof Element) removeFromTabOrder(node);
84
85
  }
85
- if (!tabStop || !container.contains(tabStop)) {
86
- tabStop = null;
86
+ if (!tabStopRef.current || !container.contains(tabStopRef.current)) {
87
+ tabStopRef.current = null;
87
88
  setTabStop(getPreferredItem());
88
89
  }
89
90
  });
@@ -1,22 +1,16 @@
1
1
  import { c } from "../../utils/react-compiler-runtime.js";
2
2
  import { useMergedRefs } from "../../hooks/useMergedRefs.js";
3
- import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
4
- import { useFeatureFlag } from "../../FeatureFlags/useFeatureFlag.js";
5
3
  import { useRef } from "react";
6
4
  // src/experimental/Tabs/useTabList.ts
7
5
  function useTabList(props) {
8
- const $ = c(9);
6
+ const $ = c(8);
9
7
  const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": ariaOrientation } = props;
10
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
11
8
  const tabListRef = useRef(null);
12
9
  const mergedRef = useMergedRefs(tabListRef, props.ref);
13
- const providedOrCreatedRef = useProvidedRefOrCreate(props.ref);
14
- const readRef = mergedRefEnabled ? tabListRef : providedOrCreatedRef;
15
- const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
16
10
  let t0;
17
- if ($[0] !== ariaOrientation || $[1] !== readRef) {
11
+ if ($[0] !== ariaOrientation) {
18
12
  t0 = (event) => {
19
- const { current: tablist } = readRef;
13
+ const { current: tablist } = tabListRef;
20
14
  if (tablist === null) return;
21
15
  const tabs = getFocusableTabs(tablist);
22
16
  const getCurrentIndex = () => {
@@ -47,28 +41,27 @@ function useTabList(props) {
47
41
  }
48
42
  };
49
43
  $[0] = ariaOrientation;
50
- $[1] = readRef;
51
- $[2] = t0;
52
- } else t0 = $[2];
44
+ $[1] = t0;
45
+ } else t0 = $[1];
53
46
  const onKeyDown = t0;
54
47
  const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
55
48
  let t2;
56
- if ($[3] !== appliedRef || $[4] !== ariaLabel || $[5] !== ariaLabelledby || $[6] !== onKeyDown || $[7] !== t1) {
49
+ if ($[2] !== ariaLabel || $[3] !== ariaLabelledby || $[4] !== mergedRef || $[5] !== onKeyDown || $[6] !== t1) {
57
50
  t2 = { tabListProps: {
58
- ref: appliedRef,
51
+ ref: mergedRef,
59
52
  "aria-label": ariaLabel,
60
53
  "aria-labelledby": ariaLabelledby,
61
54
  "aria-orientation": t1,
62
55
  role: "tablist",
63
56
  onKeyDown
64
57
  } };
65
- $[3] = appliedRef;
66
- $[4] = ariaLabel;
67
- $[5] = ariaLabelledby;
68
- $[6] = onKeyDown;
69
- $[7] = t1;
70
- $[8] = t2;
71
- } else t2 = $[8];
58
+ $[2] = ariaLabel;
59
+ $[3] = ariaLabelledby;
60
+ $[4] = mergedRef;
61
+ $[5] = onKeyDown;
62
+ $[6] = t1;
63
+ $[7] = t2;
64
+ } else t2 = $[7];
72
65
  return t2;
73
66
  }
74
67
  function _temp(tab) {
@@ -20,7 +20,7 @@ const UnderlinePanelsContext = /*#__PURE__*/ createContext({
20
20
  loadingCounters: void 0
21
21
  });
22
22
  const UnderlinePanels = (t0) => {
23
- const $ = c(75);
23
+ const $ = c(71);
24
24
  let ariaLabel;
25
25
  let ariaLabelledBy;
26
26
  let children;
@@ -76,13 +76,17 @@ const UnderlinePanels = (t0) => {
76
76
  if (/*#__PURE__*/ isValidElement(child) && (child.type === Tab || isSlot(child, Tab))) {
77
77
  var _child$props$value;
78
78
  const value = (_child$props$value = child.props.value) !== null && _child$props$value !== void 0 ? _child$props$value : `${indices.tab}`;
79
- indices.tab = indices.tab + 1;
79
+ let t3 = indices.tab;
80
+ t3++;
81
+ indices.tab = t3;
80
82
  return /*#__PURE__*/ cloneElement(child, { value });
81
83
  }
82
84
  if (/*#__PURE__*/ isValidElement(child) && (child.type === Panel || isSlot(child, Panel))) {
83
85
  var _child$props$value2;
84
86
  const value_0 = (_child$props$value2 = child.props.value) !== null && _child$props$value2 !== void 0 ? _child$props$value2 : `${indices.panel}`;
85
- indices.panel = indices.panel + 1;
87
+ let t4 = indices.panel;
88
+ t4++;
89
+ indices.panel = t4;
86
90
  return /*#__PURE__*/ cloneElement(child, { value: value_0 });
87
91
  }
88
92
  return child;
@@ -282,71 +286,59 @@ const UnderlinePanels = (t0) => {
282
286
  $[51] = className;
283
287
  $[52] = t16;
284
288
  } else t16 = $[52];
285
- const t17 = tabListProps["aria-label"];
286
- const t18 = tabListProps["aria-labelledby"];
287
- const t19 = tabListProps["aria-orientation"];
288
- let t20;
289
- if ($[53] !== t17 || $[54] !== t18 || $[55] !== t19 || $[56] !== tabListProps.onKeyDown || $[57] !== tabListProps.role || $[58] !== tabs_0) {
290
- t20 = /* @__PURE__ */ jsx(UnderlineItemList, {
291
- ref: listRef,
292
- role: tabListProps.role,
293
- "aria-label": t17,
294
- "aria-labelledby": t18,
295
- "aria-orientation": t19,
296
- onKeyDown: tabListProps.onKeyDown,
289
+ let t17;
290
+ if ($[53] !== tabListProps || $[54] !== tabs_0) {
291
+ t17 = /* @__PURE__ */ jsx(UnderlineItemList, {
292
+ ...tabListProps,
297
293
  children: tabs_0
298
294
  });
299
- $[53] = t17;
300
- $[54] = t18;
301
- $[55] = t19;
302
- $[56] = tabListProps.onKeyDown;
303
- $[57] = tabListProps.role;
304
- $[58] = tabs_0;
305
- $[59] = t20;
306
- } else t20 = $[59];
307
- let t21;
308
- if ($[60] !== iconsVisible || $[61] !== props || $[62] !== t16 || $[63] !== t20) {
309
- t21 = /* @__PURE__ */ jsx(UnderlineWrapper, {
295
+ $[53] = tabListProps;
296
+ $[54] = tabs_0;
297
+ $[55] = t17;
298
+ } else t17 = $[55];
299
+ let t18;
300
+ if ($[56] !== iconsVisible || $[57] !== props || $[58] !== t16 || $[59] !== t17) {
301
+ t18 = /* @__PURE__ */ jsx(UnderlineWrapper, {
310
302
  ref: wrapperRef,
311
303
  "data-icons-visible": iconsVisible,
312
304
  className: t16,
313
305
  ...props,
314
- children: t20
306
+ children: t17
315
307
  });
316
- $[60] = iconsVisible;
317
- $[61] = props;
318
- $[62] = t16;
319
- $[63] = t20;
320
- $[64] = t21;
321
- } else t21 = $[64];
322
- let t22;
323
- if ($[65] !== activationMode || $[66] !== effectiveValue || $[67] !== parentId || $[68] !== t15 || $[69] !== t21 || $[70] !== tabPanels_0) {
324
- t22 = /* @__PURE__ */ jsxs(Tabs, {
308
+ $[56] = iconsVisible;
309
+ $[57] = props;
310
+ $[58] = t16;
311
+ $[59] = t17;
312
+ $[60] = t18;
313
+ } else t18 = $[60];
314
+ let t19;
315
+ if ($[61] !== activationMode || $[62] !== effectiveValue || $[63] !== parentId || $[64] !== t15 || $[65] !== t18 || $[66] !== tabPanels_0) {
316
+ t19 = /* @__PURE__ */ jsxs(Tabs, {
325
317
  id: parentId,
326
318
  value: effectiveValue,
327
319
  activationMode,
328
320
  onValueChange: t15,
329
- children: [t21, tabPanels_0]
321
+ children: [t18, tabPanels_0]
330
322
  });
331
- $[65] = activationMode;
332
- $[66] = effectiveValue;
333
- $[67] = parentId;
334
- $[68] = t15;
335
- $[69] = t21;
336
- $[70] = tabPanels_0;
337
- $[71] = t22;
338
- } else t22 = $[71];
339
- let t23;
340
- if ($[72] !== contextValue || $[73] !== t22) {
341
- t23 = /* @__PURE__ */ jsx(UnderlinePanelsContext.Provider, {
323
+ $[61] = activationMode;
324
+ $[62] = effectiveValue;
325
+ $[63] = parentId;
326
+ $[64] = t15;
327
+ $[65] = t18;
328
+ $[66] = tabPanels_0;
329
+ $[67] = t19;
330
+ } else t19 = $[67];
331
+ let t20;
332
+ if ($[68] !== contextValue || $[69] !== t19) {
333
+ t20 = /* @__PURE__ */ jsx(UnderlinePanelsContext.Provider, {
342
334
  value: contextValue,
343
- children: t22
335
+ children: t19
344
336
  });
345
- $[72] = contextValue;
346
- $[73] = t22;
347
- $[74] = t23;
348
- } else t23 = $[74];
349
- return t23;
337
+ $[68] = contextValue;
338
+ $[69] = t19;
339
+ $[70] = t20;
340
+ } else t20 = $[70];
341
+ return t20;
350
342
  };
351
343
  const TabImpl = (t0) => {
352
344
  const $ = c(24);
@@ -23,9 +23,9 @@ import { useImperativeHandle } from "react";
23
23
  function useRefObjectAsForwardedRef(forwardedRef, refObject) {
24
24
  const $ = c(2);
25
25
  let t0;
26
- if ($[0] !== refObject.current) {
26
+ if ($[0] !== refObject) {
27
27
  t0 = () => refObject.current;
28
- $[0] = refObject.current;
28
+ $[0] = refObject;
29
29
  $[1] = t0;
30
30
  } else t0 = $[1];
31
31
  useImperativeHandle(forwardedRef, t0);
@@ -12,23 +12,29 @@ import { useState } from "react";
12
12
  * This is adapted almost directly from https://beta.reactjs.org/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes
13
13
  */
14
14
  const useSyncedState = (initialValue, t0) => {
15
- const $ = c(2);
15
+ const $ = c(4);
16
16
  const { isPropUpdateDisabled: t1, isEqual: t2 } = t0 === void 0 ? {} : t0;
17
17
  const isPropUpdateDisabled = t1 === void 0 ? false : t1;
18
18
  const isEqual = t2 === void 0 ? Object.is : t2;
19
19
  const [state, setState] = useState(initialValue);
20
20
  const [previous, setPrevious] = useState(initialValue);
21
- const nextInitialValue = initialValue instanceof Function ? initialValue() : initialValue;
21
+ let t3;
22
+ if ($[0] !== initialValue) {
23
+ t3 = initialValue instanceof Function ? initialValue() : initialValue;
24
+ $[0] = initialValue;
25
+ $[1] = t3;
26
+ } else t3 = $[1];
27
+ const nextInitialValue = t3;
22
28
  if (!isPropUpdateDisabled && !isEqual(previous, nextInitialValue)) {
23
29
  setPrevious(nextInitialValue);
24
30
  setState(nextInitialValue);
25
31
  }
26
- let t3;
27
- if ($[0] !== state) {
28
- t3 = [state, setState];
29
- $[0] = state;
30
- $[1] = t3;
31
- } else t3 = $[1];
32
- return t3;
32
+ let t4;
33
+ if ($[2] !== state) {
34
+ t4 = [state, setState];
35
+ $[2] = state;
36
+ $[3] = t4;
37
+ } else t4 = $[3];
38
+ return t4;
33
39
  };
34
40
  export { useSyncedState };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.47.0-rc.cdd1ab1f0",
4
+ "version": "39.0.0-rc.00628b8df",
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",
@@ -87,10 +87,8 @@
87
87
  "deepmerge": "^4.3.1",
88
88
  "focus-visible": "^5.2.1",
89
89
  "history": "^5.0.0",
90
- "hsluv": "1.0.1",
91
90
  "lodash.isempty": "^4.4.0",
92
- "lodash.isobject": "^3.0.2",
93
- "react-intersection-observer": "^10.0.3"
91
+ "lodash.isobject": "^3.0.2"
94
92
  },
95
93
  "devDependencies": {
96
94
  "@actions/core": "1.11.1",
@@ -156,12 +154,13 @@
156
154
  "mdast-util-to-string": "4.0.0",
157
155
  "micromark-extension-frontmatter": "2.0.0",
158
156
  "micromark-extension-mdxjs": "3.0.0",
159
- "oxc-transform-react": "^0.155.0",
157
+ "oxc-transform-react": "^0.157.0",
160
158
  "postcss-preset-primer": "^0.0.0",
161
159
  "publint": "^0.3.15",
162
160
  "react": "18.3.1",
163
161
  "react-compiler-runtime": "^1.0.0",
164
162
  "react-dom": "18.3.1",
163
+ "react-intersection-observer": "^10.0.3",
165
164
  "react-is": "18.3.1",
166
165
  "recast": "0.23.7",
167
166
  "rimraf": "5.0.5",