@primer/react 0.0.0-20260706213300 → 0.0.0-20260707162214

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-20260706213300
3
+ ## 0.0.0-20260707162214
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -8,6 +8,8 @@
8
8
 
9
9
  - [#8035](https://github.com/primer/react/pull/8035) [`723f4d6`](https://github.com/primer/react/commit/723f4d6db12710e2b94f56b945a937158fcbb127) Thanks [@mattcosta7](https://github.com/mattcosta7)! - UnderlineNav, ActionBar: Detect item overflow with a single shared IntersectionObserver per component instead of one observer per item, reducing observer churn during resize. No public API changes.
10
10
 
11
+ - [#8023](https://github.com/primer/react/pull/8023) [`e2e7d77`](https://github.com/primer/react/commit/e2e7d7712b79dfe1c3c60d8b461e55a0e7cd8c58) Thanks [@mattcosta7](https://github.com/mattcosta7)! - FormControl: Avoid an extra re-render when showing a validation message.
12
+
11
13
  ## 38.31.0
12
14
 
13
15
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { useMergedRefs } from "../hooks/useMergedRefs.js";
1
+ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
2
  import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
3
3
  import { useId as useId$1 } from "../hooks/useId.js";
4
4
  import { warning } from "../utils/warning.js";
@@ -80,8 +80,7 @@ const emptyKeybindingHints = [];
80
80
  const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type = "description", children, id, className, keybindingHint = emptyKeybindingHints, delay = "short", _privateDisableTooltip = false, ...rest }, forwardedRef) => {
81
81
  const tooltipId = useId$1(id);
82
82
  const child = Children.only(children);
83
- const triggerRef = useRef(null);
84
- const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
83
+ const triggerRef = useProvidedRefOrCreate(forwardedRef);
85
84
  const tooltipElRef = useRef(null);
86
85
  const [calculatedDirection, setCalculatedDirection] = useState(direction);
87
86
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
@@ -158,7 +157,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
158
157
  return /*#__PURE__*/ jsx(TooltipContext.Provider, {
159
158
  value,
160
159
  children: /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, {
161
- ref: mergedTriggerRef,
160
+ ref: triggerRef,
162
161
  "aria-describedby": (() => {
163
162
  if (type !== "description") return child.props["aria-describedby"];
164
163
  const existingDescribedBy = child.props["aria-describedby"];
@@ -1,40 +1,44 @@
1
1
  import ValidationAnimationContainer_module_css_default from "./ValidationAnimationContainer.module.css.js";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import { jsx } from "react/jsx-runtime";
4
- import { useEffect, useState } from "react";
4
+ import { useState } from "react";
5
5
  //#region src/internal/components/ValidationAnimationContainer.tsx
6
6
  const ValidationAnimationContainer = (t0) => {
7
- const $ = c(10);
8
- const { show, children } = t0;
7
+ const $ = c(14);
8
+ let children;
9
+ let rest;
10
+ let show;
11
+ let style;
12
+ if ($[0] !== t0) {
13
+ ({show, children, style, ...rest} = t0);
14
+ $[0] = t0;
15
+ $[1] = children;
16
+ $[2] = rest;
17
+ $[3] = show;
18
+ $[4] = style;
19
+ } else {
20
+ children = $[1];
21
+ rest = $[2];
22
+ show = $[3];
23
+ style = $[4];
24
+ }
9
25
  const [shouldRender, setRender] = useState(show);
26
+ if (show && !shouldRender) setRender(true);
10
27
  let t1;
11
- let t2;
12
- if ($[0] !== show) {
28
+ if ($[5] !== show) {
13
29
  t1 = () => {
14
- if (show) setRender(true);
15
- };
16
- t2 = [show];
17
- $[0] = show;
18
- $[1] = t1;
19
- $[2] = t2;
20
- } else {
21
- t1 = $[1];
22
- t2 = $[2];
23
- }
24
- useEffect(t1, t2);
25
- let t3;
26
- if ($[3] !== show) {
27
- t3 = () => {
28
30
  if (!show) setRender(false);
29
31
  };
30
- $[3] = show;
31
- $[4] = t3;
32
- } else t3 = $[4];
33
- const onAnimationEnd = t3;
34
- let t4;
35
- if ($[5] !== children || $[6] !== onAnimationEnd || $[7] !== shouldRender || $[8] !== show) {
36
- t4 = shouldRender ? /*#__PURE__*/ jsx("div", {
32
+ $[5] = show;
33
+ $[6] = t1;
34
+ } else t1 = $[6];
35
+ const onAnimationEnd = t1;
36
+ let t2;
37
+ if ($[7] !== children || $[8] !== onAnimationEnd || $[9] !== rest || $[10] !== shouldRender || $[11] !== show || $[12] !== style) {
38
+ t2 = shouldRender ? /*#__PURE__*/ jsx("div", {
39
+ ...rest,
37
40
  style: {
41
+ ...style,
38
42
  height: show ? "auto" : 0,
39
43
  overflow: "hidden"
40
44
  },
@@ -45,13 +49,15 @@ const ValidationAnimationContainer = (t0) => {
45
49
  children
46
50
  })
47
51
  }) : null;
48
- $[5] = children;
49
- $[6] = onAnimationEnd;
50
- $[7] = shouldRender;
51
- $[8] = show;
52
- $[9] = t4;
53
- } else t4 = $[9];
54
- return t4;
52
+ $[7] = children;
53
+ $[8] = onAnimationEnd;
54
+ $[9] = rest;
55
+ $[10] = shouldRender;
56
+ $[11] = show;
57
+ $[12] = style;
58
+ $[13] = t2;
59
+ } else t2 = $[13];
60
+ return t2;
55
61
  };
56
62
  //#endregion
57
63
  export { ValidationAnimationContainer as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260706213300",
4
+ "version": "0.0.0-20260707162214",
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",