@primer/react 0.0.0-20260220144011 → 0.0.0-20260220144103

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,12 +1,12 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260220144011
3
+ ## 0.0.0-20260220144103
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Fake entry to force publishing
8
8
 
9
- - [#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
9
+ - [#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
10
10
 
11
11
  ## 38.13.0
12
12
 
@@ -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,GAAG,MAAM,IAAI,gBAAgB,CAC7E,EAAE,EACF,MAAM,EACN;IACE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGa,EAAE,SAAS,KAAK,CAAC,WAAW;WAP/B,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;WAFX,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;;;AAuBtB,wBAAoC"}
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,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E,EAAE,EACF,MAAM,EACN;IACE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGa,EAAE,SAAS,KAAK,CAAC,WAAW;WAP/B,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;WAFX,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;;;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":"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"}
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"}
@@ -15,13 +15,11 @@ function useScrollFlash(scrollContainerRef) {
15
15
  if (!scrollContainer) {
16
16
  return;
17
17
  }
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);
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;
25
23
  };
26
24
  t1 = [scrollContainerRef];
27
25
  $[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-20260220144011",
4
+ "version": "0.0.0-20260220144103",
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",