@primer/react 0.0.0-20260219174000 → 0.0.0-20260219174016

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-20260219174000
3
+ ## 0.0.0-20260219174016
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
- - [#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
31
+ - [#7547](https://github.com/primer/react/pull/7547) [`36ee7ce`](https://github.com/primer/react/commit/36ee7ce5d5fd074e137d11338d6b852721130d29) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useScrollFlash): defer scroll read/write to requestAnimationFrame to avoid forced reflow
32
32
 
33
33
  ## 38.12.0
34
34
 
@@ -1,4 +1,4 @@
1
- import type React from 'react';
1
+ import 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,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAA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C,MAAM;;;;AAuBtB,wBAAoC"}
package/dist/Text/Text.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
+ import React from 'react';
3
4
  import classes from './Text.module.css.js';
4
5
  import { fixedForwardRef } from '../utils/modern-polymorphic.js';
5
6
  import { jsx } from 'react/jsx-runtime';
7
+ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
6
8
 
7
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
10
  function Text(props, ref) {
9
- const $ = c(15);
11
+ const $ = c(14);
10
12
  let className;
11
13
  let rest;
12
14
  let size;
@@ -34,6 +36,8 @@ function Text(props, ref) {
34
36
  weight = $[5];
35
37
  }
36
38
  const Component = t0 === undefined ? "span" : t0;
39
+ const innerRef = React.useRef(null);
40
+ useRefObjectAsForwardedRef(ref, innerRef);
37
41
  let t1;
38
42
  if ($[6] !== className) {
39
43
  t1 = clsx(className, classes.Text);
@@ -43,23 +47,22 @@ function Text(props, ref) {
43
47
  t1 = $[7];
44
48
  }
45
49
  let t2;
46
- if ($[8] !== Component || $[9] !== ref || $[10] !== rest || $[11] !== size || $[12] !== t1 || $[13] !== weight) {
50
+ if ($[8] !== Component || $[9] !== rest || $[10] !== size || $[11] !== t1 || $[12] !== weight) {
47
51
  t2 = /*#__PURE__*/jsx(Component, {
48
52
  className: t1,
49
53
  "data-size": size,
50
54
  "data-weight": weight,
51
55
  ...rest,
52
- ref: ref
56
+ ref: innerRef
53
57
  });
54
58
  $[8] = Component;
55
- $[9] = ref;
56
- $[10] = rest;
57
- $[11] = size;
58
- $[12] = t1;
59
- $[13] = weight;
60
- $[14] = t2;
59
+ $[9] = rest;
60
+ $[10] = size;
61
+ $[11] = t1;
62
+ $[12] = weight;
63
+ $[13] = t2;
61
64
  } else {
62
- t2 = $[14];
65
+ t2 = $[13];
63
66
  }
64
67
  return t2;
65
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollFlash.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollFlash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QAe7F"}
1
+ {"version":3,"file":"useScrollFlash.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollFlash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QAoB7F"}
@@ -15,11 +15,13 @@ function useScrollFlash(scrollContainerRef) {
15
15
  if (!scrollContainer) {
16
16
  return;
17
17
  }
18
- const currentScroll = scrollContainer.scrollTop;
19
- const maxScroll = scrollContainer.scrollHeight;
20
- const altScroll = currentScroll < Math.min(1, maxScroll) ? currentScroll + 1 : currentScroll - 1;
21
- scrollContainer.scrollTop = altScroll;
22
- scrollContainer.scrollTop = currentScroll;
18
+ const id = requestAnimationFrame(() => {
19
+ const currentScroll = scrollContainer.scrollTop;
20
+ const altScroll = currentScroll < 1 ? currentScroll + 1 : currentScroll - 1;
21
+ scrollContainer.scrollTop = altScroll;
22
+ scrollContainer.scrollTop = currentScroll;
23
+ });
24
+ return () => cancelAnimationFrame(id);
23
25
  };
24
26
  t1 = [scrollContainerRef];
25
27
  $[0] = scrollContainerRef;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260219174000",
4
+ "version": "0.0.0-20260219174016",
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",