@primer/react 0.0.0-20260219173954 → 0.0.0-20260219174000

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-20260219173954
3
+ ## 0.0.0-20260219174000
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -28,7 +28,7 @@
28
28
 
29
29
  - [#7548](https://github.com/primer/react/pull/7548) [`d4b32c3`](https://github.com/primer/react/commit/d4b32c3672d3d5421711324654c1028527dcdf38) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useIsMacOS): replace useState+useEffect with useSyncExternalStore to eliminate unnecessary re-render
30
30
 
31
- - [#7553](https://github.com/primer/react/pull/7553) [`82ec766`](https://github.com/primer/react/commit/82ec76665b5aaf6ff46404e5930f68013049b2ba) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useRefObjectAsForwardedRef): add dependency array to useImperativeHandle
31
+ - [#7551](https://github.com/primer/react/pull/7551) [`edb8eca`](https://github.com/primer/react/commit/edb8eca477e9bb940732bddfa83a294332f2381a) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Text): remove unnecessary useRef and useImperativeHandle hooks
32
32
 
33
33
  ## 38.12.0
34
34
 
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  import { type PolymorphicProps } from '../utils/modern-polymorphic';
3
3
  export type TextProps<As extends React.ElementType = 'span'> = PolymorphicProps<As, 'span', {
4
4
  size?: 'large' | 'medium' | 'small';
@@ -1 +1 @@
1
- {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW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M;;;;AAetB,wBAAoC"}
package/dist/Text/Text.js CHANGED
@@ -1,14 +1,12 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
- import React from 'react';
4
3
  import classes from './Text.module.css.js';
5
4
  import { fixedForwardRef } from '../utils/modern-polymorphic.js';
6
5
  import { jsx } from 'react/jsx-runtime';
7
- import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
8
6
 
9
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
8
  function Text(props, ref) {
11
- const $ = c(14);
9
+ const $ = c(15);
12
10
  let className;
13
11
  let rest;
14
12
  let size;
@@ -36,8 +34,6 @@ function Text(props, ref) {
36
34
  weight = $[5];
37
35
  }
38
36
  const Component = t0 === undefined ? "span" : t0;
39
- const innerRef = React.useRef(null);
40
- useRefObjectAsForwardedRef(ref, innerRef);
41
37
  let t1;
42
38
  if ($[6] !== className) {
43
39
  t1 = clsx(className, classes.Text);
@@ -47,22 +43,23 @@ function Text(props, ref) {
47
43
  t1 = $[7];
48
44
  }
49
45
  let t2;
50
- if ($[8] !== Component || $[9] !== rest || $[10] !== size || $[11] !== t1 || $[12] !== weight) {
46
+ if ($[8] !== Component || $[9] !== ref || $[10] !== rest || $[11] !== size || $[12] !== t1 || $[13] !== weight) {
51
47
  t2 = /*#__PURE__*/jsx(Component, {
52
48
  className: t1,
53
49
  "data-size": size,
54
50
  "data-weight": weight,
55
51
  ...rest,
56
- ref: innerRef
52
+ ref: ref
57
53
  });
58
54
  $[8] = Component;
59
- $[9] = rest;
60
- $[10] = size;
61
- $[11] = t1;
62
- $[12] = weight;
63
- $[13] = t2;
55
+ $[9] = ref;
56
+ $[10] = rest;
57
+ $[11] = size;
58
+ $[12] = t1;
59
+ $[13] = weight;
60
+ $[14] = t2;
64
61
  } else {
65
- t2 = $[13];
62
+ t2 = $[14];
66
63
  }
67
64
  return t2;
68
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useRefObjectAsForwardedRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefObjectAsForwardedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAGlD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAIjH"}
1
+ {"version":3,"file":"useRefObjectAsForwardedRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefObjectAsForwardedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAGlD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAEjH"}
@@ -9,7 +9,7 @@ import { useImperativeHandle } from 'react';
9
9
  * **NOTE**: The `refObject` should be passed to the underlying element, NOT the `forwardedRef`.
10
10
  */
11
11
  function useRefObjectAsForwardedRef(forwardedRef, refObject) {
12
- const $ = c(4);
12
+ const $ = c(2);
13
13
  let t0;
14
14
  if ($[0] !== refObject.current) {
15
15
  t0 = () => refObject.current;
@@ -18,15 +18,7 @@ function useRefObjectAsForwardedRef(forwardedRef, refObject) {
18
18
  } else {
19
19
  t0 = $[1];
20
20
  }
21
- let t1;
22
- if ($[2] !== refObject) {
23
- t1 = [refObject];
24
- $[2] = refObject;
25
- $[3] = t1;
26
- } else {
27
- t1 = $[3];
28
- }
29
- useImperativeHandle(forwardedRef, t0, t1);
21
+ useImperativeHandle(forwardedRef, t0);
30
22
  }
31
23
 
32
24
  export { useRefObjectAsForwardedRef };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260219173954",
4
+ "version": "0.0.0-20260219174000",
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",