@primer/react 0.0.0-20260218212008 → 0.0.0-20260218214256

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +24 -4
  2. package/dist/ActionList/Description.d.ts.map +1 -1
  3. package/dist/ActionList/Description.js +150 -36
  4. package/dist/ActionList/Divider.js +30 -11
  5. package/dist/ActionList/Group.js +294 -117
  6. package/dist/ActionList/Heading.js +77 -22
  7. package/dist/ActionList/Item.d.ts.map +1 -1
  8. package/dist/ActionList/Item.js +205 -99
  9. package/dist/ActionList/LinkItem.js +80 -24
  10. package/dist/ActionList/List.js +143 -33
  11. package/dist/ActionList/Selection.js +78 -30
  12. package/dist/ActionList/TrailingAction.js +83 -23
  13. package/dist/ActionList/Visuals.js +162 -64
  14. package/dist/ActionList/shared.d.ts +1 -0
  15. package/dist/ActionList/shared.d.ts.map +1 -1
  16. package/dist/Banner/Banner.d.ts.map +1 -1
  17. package/dist/Banner/Banner.js +72 -62
  18. package/dist/Button/Button.js +34 -11
  19. package/dist/Button/ButtonBase.d.ts.map +1 -1
  20. package/dist/Button/ButtonBase.js +9 -14
  21. package/dist/Button/IconButton.js +140 -51
  22. package/dist/Button/LinkButton.js +39 -11
  23. package/dist/FilteredActionList/FilteredActionList-02db90c6.css +2 -0
  24. package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +1 -0
  25. package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
  26. package/dist/PageLayout/PageLayout-cb491b47.css +2 -0
  27. package/dist/PageLayout/PageLayout-cb491b47.css.map +1 -0
  28. package/dist/PageLayout/PageLayout.d.ts +2 -72
  29. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  30. package/dist/PageLayout/PageLayout.js +44 -497
  31. package/dist/PageLayout/PageLayout.module.css.js +2 -2
  32. package/dist/PageLayout/usePaneWidth.d.ts +5 -18
  33. package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
  34. package/dist/PageLayout/usePaneWidth.js +111 -125
  35. package/dist/SplitPageLayout/SplitPageLayout.d.ts +1 -4
  36. package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
  37. package/dist/SplitPageLayout/SplitPageLayout.js +2 -54
  38. package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  39. package/dist/UnderlineNav/UnderlineNav.js +11 -4
  40. package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +2 -0
  41. package/dist/experimental/SelectPanel2/{SelectPanel-1f8c23b5.css.map → SelectPanel-f0c4b9ca.css.map} +1 -1
  42. package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
  43. package/dist/hooks/useIsMacOS.d.ts +15 -3
  44. package/dist/hooks/useIsMacOS.d.ts.map +1 -1
  45. package/dist/hooks/useIsMacOS.js +24 -26
  46. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
  47. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
  48. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
  49. package/dist/live-region/Announce.d.ts.map +1 -1
  50. package/dist/live-region/Announce.js +7 -4
  51. package/generated/components.json +2 -188
  52. package/package.json +2 -2
  53. package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +0 -2
  54. package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +0 -1
  55. package/dist/PageLayout/PageLayout-06f4c069.css +0 -2
  56. package/dist/PageLayout/PageLayout-06f4c069.css.map +0 -1
  57. package/dist/experimental/SelectPanel2/SelectPanel-1f8c23b5.css +0 -2
  58. package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css +0 -2
  59. package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css.map +0 -1
  60. package/dist/utils/environment.js +0 -9
package/CHANGELOG.md CHANGED
@@ -1,10 +1,32 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260218212008
3
+ ## 0.0.0-20260218214256
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - [#7521](https://github.com/primer/react/pull/7521) [`1e09366`](https://github.com/primer/react/commit/1e09366be1ea47056d29de22316b6501b4125eb3) Thanks [@TylerJDev](https://github.com/TylerJDev)! - PageLayout: Add `PageLayout.Sidebar` sub-component
7
+ - [#7099](https://github.com/primer/react/pull/7099) [`4720c2f`](https://github.com/primer/react/commit/4720c2f27cfacc7600244422ee22af9104b5aa09) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Banner: Use `aria-labelledby` to reference the title for the landmark region instead of generic variant labels.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#7537](https://github.com/primer/react/pull/7537) [`4fd987c`](https://github.com/primer/react/commit/4fd987c4194f51dc7e66f16895542a1e4678bde7) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(ActionList): enable React Compiler
12
+
13
+ - [#7546](https://github.com/primer/react/pull/7546) [`86d6897`](https://github.com/primer/react/commit/86d68971a602be6c99535eb01227bf48dd87cfdc) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Announce): skip getComputedStyle when there is no text content to announce
14
+
15
+ - [#7552](https://github.com/primer/react/pull/7552) [`551ec63`](https://github.com/primer/react/commit/551ec6338af5c45e3f549245d85a4dd5a708df47) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Button): fix CounterLabel remount and remove conditional DEV hook
16
+
17
+ - [#7529](https://github.com/primer/react/pull/7529) [`7b11c23`](https://github.com/primer/react/commit/7b11c23088e9887608d28b8198f3370425f4cd8a) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add keyboard-accessible tooltip for truncated ActionList.Description
18
+
19
+ - [#7504](https://github.com/primer/react/pull/7504) [`d91e78e`](https://github.com/primer/react/commit/d91e78e8d1e69915222354b95d09d93d269dbd8b) Thanks [@TylerJDev](https://github.com/TylerJDev)! - UnderlineNav: Adds `overflow: hidden` when the "More" button isn't present
20
+
21
+ - [#7526](https://github.com/primer/react/pull/7526) [`0c2358a`](https://github.com/primer/react/commit/0c2358aa12a409f7cbcf15ce4fd41cbb9eee4b6c) Thanks [@hectahertz](https://github.com/hectahertz)! - Add `content-visibility: auto` to ActionList items to improve rendering performance for large lists by allowing the browser to skip layout and paint for off-screen items.
22
+
23
+ - Fake entry to force publishing
24
+
25
+ - [#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
26
+
27
+ ## 38.12.0
28
+
29
+ ### Minor Changes
8
30
 
9
31
  - [#7348](https://github.com/primer/react/pull/7348) [`3c160b2`](https://github.com/primer/react/commit/3c160b26bded975de6175ccf04272e8946cef54e) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Add `currentWidth` and `onResizeEnd` props to PageLayout.Pane for controlled resizable width
10
32
 
@@ -50,8 +72,6 @@
50
72
 
51
73
  ### Patch Changes
52
74
 
53
- - Fake entry to force publishing
54
-
55
75
  - [#7527](https://github.com/primer/react/pull/7527) [`c87db98`](https://github.com/primer/react/commit/c87db981280090cdccc84d19c607d1462212d223) Thanks [@llastflowers](https://github.com/llastflowers)! - Update PageHeader story to have semantic headings
56
76
 
57
77
  - [#7535](https://github.com/primer/react/pull/7535) [`d86c970`](https://github.com/primer/react/commit/d86c970be94dc47da55d492dc978d63d3f9ca005) Thanks [@francinelucca](https://github.com/francinelucca)! - fix: ActionBar overflow menu not closing on select
@@ -1 +1 @@
1
- {"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAgD7F,CAAA"}
1
+ {"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAuE7F,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import React from 'react';
2
3
  import { ItemContext } from './shared.js';
3
4
  import classes from './ActionList.module.css.js';
@@ -5,48 +6,161 @@ import { clsx } from 'clsx';
5
6
  import { jsx } from 'react/jsx-runtime';
6
7
  import Truncate from '../Truncate/Truncate.js';
7
8
 
8
- const Description = ({
9
- variant = 'inline',
10
- className,
11
- truncate,
12
- style,
13
- ...props
14
- }) => {
9
+ const Description = t0 => {
10
+ const $ = c(31);
11
+ let className;
12
+ let props;
13
+ let style;
14
+ let t1;
15
+ let truncate;
16
+ if ($[0] !== t0) {
17
+ ({
18
+ variant: t1,
19
+ className,
20
+ truncate,
21
+ style,
22
+ ...props
23
+ } = t0);
24
+ $[0] = t0;
25
+ $[1] = className;
26
+ $[2] = props;
27
+ $[3] = style;
28
+ $[4] = t1;
29
+ $[5] = truncate;
30
+ } else {
31
+ className = $[1];
32
+ props = $[2];
33
+ style = $[3];
34
+ t1 = $[4];
35
+ truncate = $[5];
36
+ }
37
+ const variant = t1 === undefined ? "inline" : t1;
15
38
  const {
16
39
  blockDescriptionId,
17
- inlineDescriptionId
40
+ inlineDescriptionId,
41
+ setTruncatedText
18
42
  } = React.useContext(ItemContext);
19
43
  const containerRef = React.useRef(null);
20
- const [computedTitle, setComputedTitle] = React.useState('');
21
-
22
- // Extract text content from rendered DOM for tooltip
23
- React.useEffect(() => {
24
- if (truncate && containerRef.current) {
25
- const textContent = containerRef.current.textContent || '';
26
- setComputedTitle(textContent);
44
+ const [computedTitle, setComputedTitle] = React.useState("");
45
+ let t2;
46
+ if ($[6] !== truncate) {
47
+ t2 = () => {
48
+ if (truncate && containerRef.current) {
49
+ const textContent = containerRef.current.textContent || "";
50
+ setComputedTitle(textContent);
51
+ }
52
+ };
53
+ $[6] = truncate;
54
+ $[7] = t2;
55
+ } else {
56
+ t2 = $[7];
57
+ }
58
+ let t3;
59
+ if ($[8] !== props.children || $[9] !== truncate) {
60
+ t3 = [truncate, props.children];
61
+ $[8] = props.children;
62
+ $[9] = truncate;
63
+ $[10] = t3;
64
+ } else {
65
+ t3 = $[10];
66
+ }
67
+ React.useEffect(t2, t3);
68
+ const effectiveTitle = typeof props.children === "string" ? props.children : computedTitle;
69
+ let t4;
70
+ let t5;
71
+ if ($[11] !== effectiveTitle || $[12] !== setTruncatedText || $[13] !== truncate) {
72
+ t4 = () => {
73
+ if (!truncate || !containerRef.current || !setTruncatedText) {
74
+ return;
75
+ }
76
+ const isContentTruncated = function isContentTruncated() {
77
+ const el = containerRef.current;
78
+ if (!el) {
79
+ return false;
80
+ }
81
+ return el.scrollWidth > el.clientWidth;
82
+ };
83
+ setTruncatedText(isContentTruncated() ? effectiveTitle : undefined);
84
+ const observer = new ResizeObserver(() => {
85
+ setTruncatedText(isContentTruncated() ? effectiveTitle : undefined);
86
+ });
87
+ observer.observe(containerRef.current);
88
+ return () => {
89
+ observer.disconnect();
90
+ };
91
+ };
92
+ t5 = [truncate, effectiveTitle, setTruncatedText];
93
+ $[11] = effectiveTitle;
94
+ $[12] = setTruncatedText;
95
+ $[13] = truncate;
96
+ $[14] = t4;
97
+ $[15] = t5;
98
+ } else {
99
+ t4 = $[14];
100
+ t5 = $[15];
101
+ }
102
+ React.useEffect(t4, t5);
103
+ if (variant === "block" || !truncate) {
104
+ const t6 = variant === "block" ? blockDescriptionId : inlineDescriptionId;
105
+ let t7;
106
+ if ($[16] !== className) {
107
+ t7 = clsx(className, classes.Description);
108
+ $[16] = className;
109
+ $[17] = t7;
110
+ } else {
111
+ t7 = $[17];
27
112
  }
28
- }, [truncate, props.children]);
29
- const effectiveTitle = typeof props.children === 'string' ? props.children : computedTitle;
30
- if (variant === 'block' || !truncate) {
31
- return /*#__PURE__*/jsx("span", {
32
- id: variant === 'block' ? blockDescriptionId : inlineDescriptionId,
33
- className: clsx(className, classes.Description),
34
- style: style,
35
- "data-component": "ActionList.Description",
36
- children: props.children
37
- });
113
+ let t8;
114
+ if ($[18] !== props.children || $[19] !== style || $[20] !== t6 || $[21] !== t7) {
115
+ t8 = /*#__PURE__*/jsx("span", {
116
+ id: t6,
117
+ className: t7,
118
+ style: style,
119
+ "data-component": "ActionList.Description",
120
+ children: props.children
121
+ });
122
+ $[18] = props.children;
123
+ $[19] = style;
124
+ $[20] = t6;
125
+ $[21] = t7;
126
+ $[22] = t8;
127
+ } else {
128
+ t8 = $[22];
129
+ }
130
+ return t8;
38
131
  } else {
39
- return /*#__PURE__*/jsx(Truncate, {
40
- ref: containerRef,
41
- id: inlineDescriptionId,
42
- className: clsx(className, classes.Description),
43
- style: style,
44
- title: effectiveTitle,
45
- inline: true,
46
- maxWidth: "100%",
47
- "data-component": "ActionList.Description",
48
- children: props.children
49
- });
132
+ let t6;
133
+ if ($[23] !== className) {
134
+ t6 = clsx(className, classes.Description);
135
+ $[23] = className;
136
+ $[24] = t6;
137
+ } else {
138
+ t6 = $[24];
139
+ }
140
+ const t7 = setTruncatedText ? "" : effectiveTitle;
141
+ let t8;
142
+ if ($[25] !== inlineDescriptionId || $[26] !== props.children || $[27] !== style || $[28] !== t6 || $[29] !== t7) {
143
+ t8 = /*#__PURE__*/jsx(Truncate, {
144
+ ref: containerRef,
145
+ id: inlineDescriptionId,
146
+ className: t6,
147
+ style: style,
148
+ title: t7,
149
+ inline: true,
150
+ maxWidth: "100%",
151
+ "data-component": "ActionList.Description",
152
+ children: props.children
153
+ });
154
+ $[25] = inlineDescriptionId;
155
+ $[26] = props.children;
156
+ $[27] = style;
157
+ $[28] = t6;
158
+ $[29] = t7;
159
+ $[30] = t8;
160
+ } else {
161
+ t8 = $[30];
162
+ }
163
+ return t8;
50
164
  }
51
165
  };
52
166
  Description.__SLOT__ = Symbol('ActionList.Description');
@@ -1,3 +1,4 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import { clsx } from 'clsx';
2
3
  import classes from './ActionList.module.css.js';
3
4
  import { jsx } from 'react/jsx-runtime';
@@ -5,18 +6,36 @@ import { jsx } from 'react/jsx-runtime';
5
6
  /**
6
7
  * Visually separates `Items` or `Groups` in an `ActionList`.
7
8
  */
8
- const Divider = ({
9
- className,
10
- style
11
- }) => {
12
- return /*#__PURE__*/jsx("li", {
13
- className: clsx(className, classes.Divider),
14
- style: style,
15
- "aria-hidden": "true",
16
- "data-component": "ActionList.Divider"
17
- });
9
+ const Divider = t0 => {
10
+ const $ = c(5);
11
+ const {
12
+ className,
13
+ style
14
+ } = t0;
15
+ let t1;
16
+ if ($[0] !== className) {
17
+ t1 = clsx(className, classes.Divider);
18
+ $[0] = className;
19
+ $[1] = t1;
20
+ } else {
21
+ t1 = $[1];
22
+ }
23
+ let t2;
24
+ if ($[2] !== style || $[3] !== t1) {
25
+ t2 = /*#__PURE__*/jsx("li", {
26
+ className: t1,
27
+ style: style,
28
+ "aria-hidden": "true",
29
+ "data-component": "ActionList.Divider"
30
+ });
31
+ $[2] = style;
32
+ $[3] = t1;
33
+ $[4] = t2;
34
+ } else {
35
+ t2 = $[4];
36
+ }
37
+ return t2;
18
38
  };
19
- Divider.displayName = "Divider";
20
39
  Divider.__SLOT__ = Symbol('ActionList.Divider');
21
40
 
22
41
  export { Divider };