@primer/react 0.0.0-20260703001732 → 0.0.0-20260706213300

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,14 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260703001732
3
+ ## 0.0.0-20260706213300
4
+
5
+ ### Patch Changes
6
+
7
+ - Fake entry to force publishing
8
+
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
+
11
+ ## 38.31.0
4
12
 
5
13
  ### Minor Changes
6
14
 
@@ -8,23 +16,10 @@
8
16
 
9
17
  - [#8105](https://github.com/primer/react/pull/8105) [`be2950f`](https://github.com/primer/react/commit/be2950fd1ac268dd4e79258ab2cfe9241dd9e1c6) Thanks [@joshblack](https://github.com/joshblack)! - React Compiler: Enable compiler output for Banner, ConfirmationDialog, PageLayout, Pagination, UnderlineNav, `useMergedRefs`, and `useScrollFlash`
10
18
 
11
- - [#8112](https://github.com/primer/react/pull/8112) [`1f5d1c8`](https://github.com/primer/react/commit/1f5d1c87b1151c47914233306336fc4d5f2cad6b) Thanks [@llastflowers](https://github.com/llastflowers)! - Add data-component attributes and associated tests for:
12
-
13
- SplitPageLayout
14
- Stack
15
- StateLabel
16
- SubNav
17
- TabNav
18
- Text
19
- TextArea
20
- ThemeProvider
21
-
22
19
  ### Patch Changes
23
20
 
24
21
  - [#8066](https://github.com/primer/react/pull/8066) [`dd66aa2`](https://github.com/primer/react/commit/dd66aa27611f7ad56adb7429b50813d6af5a01d7) Thanks [@janmaarten-a11y](https://github.com/janmaarten-a11y)! - Fix invalid HTML nesting in `ActionList.Heading` by applying the visually-hidden styles directly to the heading element instead of wrapping it in a `span`.
25
22
 
26
- - Fake entry to force publishing
27
-
28
23
  - [#8054](https://github.com/primer/react/pull/8054) [`1775f2e`](https://github.com/primer/react/commit/1775f2e8b968d59a1189456b14cff15e527937cb) Thanks [@joshblack](https://github.com/joshblack)! - AvatarStack: Improve rendering performance with React Compiler support
29
24
 
30
25
  - [#8053](https://github.com/primer/react/pull/8053) [`b2151ae`](https://github.com/primer/react/commit/b2151ae2d5719f09efb0b89731e52e4ca50e8bf1) Thanks [@joshblack](https://github.com/joshblack)! - Checkbox, CheckboxGroup, and RadioGroup: Improve rendering performance with React Compiler support
@@ -4,12 +4,14 @@ import { ButtonComponent } from "../Button/Button.js";
4
4
  import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
5
5
  import { ActionList } from "../ActionList/index.js";
6
6
  import { ActionMenu } from "../ActionMenu/ActionMenu.js";
7
+ import { useIsClipped } from "../internal/hooks/useOverflowObserver.js";
8
+ import { OverflowObserverProvider } from "../internal/components/OverflowObserverProvider.js";
7
9
  import { createDescendantRegistry } from "../utils/descendant-registry.js";
8
10
  import ActionBar_module_css_default from "./ActionBar.module.css.js";
9
11
  import { c } from "react-compiler-runtime";
10
12
  import { clsx } from "clsx";
11
13
  import { jsx, jsxs } from "react/jsx-runtime";
12
- import React, { forwardRef, useCallback, useContext, useMemo, useRef, useState, useSyncExternalStore } from "react";
14
+ import React, { forwardRef, useCallback, useContext, useMemo, useRef, useState } from "react";
13
15
  import { KebabHorizontalIcon } from "@primer/octicons-react";
14
16
  //#region src/ActionBar/ActionBar.tsx
15
17
  const ActionBarContext = /*#__PURE__*/ React.createContext({ size: "medium" });
@@ -40,7 +42,7 @@ const renderMenuItem = (item, index) => {
40
42
  };
41
43
  renderMenuItem.displayName = "renderMenuItem";
42
44
  const ActionBar = (t0) => {
43
- const $ = c(40);
45
+ const $ = c(43);
44
46
  const { size: t1, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, flush: t2, className, gap: t3 } = t0;
45
47
  const size = t1 === void 0 ? "medium" : t1;
46
48
  const flush = t2 === void 0 ? false : t2;
@@ -90,56 +92,66 @@ const ActionBar = (t0) => {
90
92
  } else t11 = $[9];
91
93
  let t12;
92
94
  if ($[10] !== children || $[11] !== setChildRegistry) {
93
- t12 = /*#__PURE__*/ jsxs("div", {
94
- className: ActionBar_module_css_default.OverflowContainer,
95
- children: [t11, /*#__PURE__*/ jsx(ActionBarItemsRegistry.Provider, {
96
- setRegistry: setChildRegistry,
97
- children
98
- })]
95
+ t12 = /*#__PURE__*/ jsx(ActionBarItemsRegistry.Provider, {
96
+ setRegistry: setChildRegistry,
97
+ children
99
98
  });
100
99
  $[10] = children;
101
100
  $[11] = setChildRegistry;
102
101
  $[12] = t12;
103
102
  } else t12 = $[12];
104
- const t13 = `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`;
105
- const t14 = overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true;
106
- let t15;
107
- if ($[13] !== size || $[14] !== t13 || $[15] !== t14) {
108
- t15 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
103
+ let t13;
104
+ if ($[13] !== containerRef || $[14] !== t12) {
105
+ t13 = /*#__PURE__*/ jsxs("div", {
106
+ className: ActionBar_module_css_default.OverflowContainer,
107
+ children: [t11, /*#__PURE__*/ jsx(OverflowObserverProvider, {
108
+ rootRef: containerRef,
109
+ children: t12
110
+ })]
111
+ });
112
+ $[13] = containerRef;
113
+ $[14] = t12;
114
+ $[15] = t13;
115
+ } else t13 = $[15];
116
+ const t14 = `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`;
117
+ const t15 = overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true;
118
+ let t16;
119
+ if ($[16] !== size || $[17] !== t14 || $[18] !== t15) {
120
+ t16 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
109
121
  variant: "invisible",
110
- "aria-label": t13,
122
+ "aria-label": t14,
111
123
  icon: KebabHorizontalIcon,
112
124
  className: ActionBar_module_css_default.MoreButton,
113
- "data-more-button-inactive": t14,
125
+ "data-more-button-inactive": t15,
114
126
  size
115
127
  }) });
116
- $[13] = size;
117
- $[14] = t13;
118
- $[15] = t14;
119
- $[16] = t15;
120
- } else t15 = $[16];
121
- let t16;
122
- if ($[17] !== overflowItems) {
123
- t16 = overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map(_temp4);
124
- $[17] = overflowItems;
125
- $[18] = t16;
126
- } else t16 = $[18];
127
- let t17;
128
- if ($[19] !== t16) {
129
- t17 = /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: t16 }) });
128
+ $[16] = size;
129
+ $[17] = t14;
130
+ $[18] = t15;
130
131
  $[19] = t16;
131
- $[20] = t17;
132
- } else t17 = $[20];
132
+ } else t16 = $[19];
133
+ let t17;
134
+ if ($[20] !== overflowItems) {
135
+ t17 = overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map(_temp4);
136
+ $[20] = overflowItems;
137
+ $[21] = t17;
138
+ } else t17 = $[21];
133
139
  let t18;
134
- if ($[21] !== t15 || $[22] !== t17) {
135
- t18 = /*#__PURE__*/ jsxs(ActionMenu, { children: [t15, t17] });
136
- $[21] = t15;
140
+ if ($[22] !== t17) {
141
+ t18 = /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: t17 }) });
137
142
  $[22] = t17;
138
143
  $[23] = t18;
139
144
  } else t18 = $[23];
140
145
  let t19;
141
- if ($[24] !== ariaLabel || $[25] !== ariaLabelledBy || $[26] !== gap || $[27] !== size || $[28] !== t10 || $[29] !== t12 || $[30] !== t18 || $[31] !== t9) {
142
- t19 = /*#__PURE__*/ jsxs("div", {
146
+ if ($[24] !== t16 || $[25] !== t18) {
147
+ t19 = /*#__PURE__*/ jsxs(ActionMenu, { children: [t16, t18] });
148
+ $[24] = t16;
149
+ $[25] = t18;
150
+ $[26] = t19;
151
+ } else t19 = $[26];
152
+ let t20;
153
+ if ($[27] !== ariaLabel || $[28] !== ariaLabelledBy || $[29] !== gap || $[30] !== size || $[31] !== t10 || $[32] !== t13 || $[33] !== t19 || $[34] !== t9) {
154
+ t20 = /*#__PURE__*/ jsxs("div", {
143
155
  ref: t9,
144
156
  role: "toolbar",
145
157
  className: ActionBar_module_css_default.List,
@@ -148,87 +160,70 @@ const ActionBar = (t0) => {
148
160
  "data-gap": gap,
149
161
  "data-size": size,
150
162
  "data-has-overflow": t10,
151
- children: [t12, t18]
163
+ children: [t13, t19]
152
164
  });
153
- $[24] = ariaLabel;
154
- $[25] = ariaLabelledBy;
155
- $[26] = gap;
156
- $[27] = size;
157
- $[28] = t10;
158
- $[29] = t12;
159
- $[30] = t18;
160
- $[31] = t9;
161
- $[32] = t19;
162
- } else t19 = $[32];
163
- let t20;
164
- if ($[33] !== flush || $[34] !== t19 || $[35] !== t8) {
165
- t20 = /*#__PURE__*/ jsx("div", {
165
+ $[27] = ariaLabel;
166
+ $[28] = ariaLabelledBy;
167
+ $[29] = gap;
168
+ $[30] = size;
169
+ $[31] = t10;
170
+ $[32] = t13;
171
+ $[33] = t19;
172
+ $[34] = t9;
173
+ $[35] = t20;
174
+ } else t20 = $[35];
175
+ let t21;
176
+ if ($[36] !== flush || $[37] !== t20 || $[38] !== t8) {
177
+ t21 = /*#__PURE__*/ jsx("div", {
166
178
  className: t8,
167
179
  "data-component": "ActionBar",
168
180
  "data-flush": flush,
169
- children: t19
170
- });
171
- $[33] = flush;
172
- $[34] = t19;
173
- $[35] = t8;
174
- $[36] = t20;
175
- } else t20 = $[36];
176
- let t21;
177
- if ($[37] !== t20 || $[38] !== t7) {
178
- t21 = /*#__PURE__*/ jsx(ActionBarContext.Provider, {
179
- value: t7,
180
181
  children: t20
181
182
  });
183
+ $[36] = flush;
182
184
  $[37] = t20;
183
- $[38] = t7;
185
+ $[38] = t8;
184
186
  $[39] = t21;
185
187
  } else t21 = $[39];
186
- return t21;
188
+ let t22;
189
+ if ($[40] !== t21 || $[41] !== t7) {
190
+ t22 = /*#__PURE__*/ jsx(ActionBarContext.Provider, {
191
+ value: t7,
192
+ children: t21
193
+ });
194
+ $[40] = t21;
195
+ $[41] = t7;
196
+ $[42] = t22;
197
+ } else t22 = $[42];
198
+ return t22;
187
199
  };
188
200
  function useActionBarItem(ref, registryProps) {
189
201
  var _useContext;
190
- const $ = c(8);
202
+ const $ = c(5);
191
203
  const isGroupOverflowing = (_useContext = useContext(ActionBarGroupContext)) === null || _useContext === void 0 ? void 0 : _useContext.isOverflowing;
192
204
  const isInGroup = isGroupOverflowing !== void 0;
193
205
  let t0;
194
- if ($[0] !== isInGroup || $[1] !== ref) {
195
- t0 = (onChange) => {
196
- if (isInGroup) return _temp5;
197
- const observer = new IntersectionObserver(() => onChange(), { threshold: .75 });
198
- if (ref.current) observer.observe(ref.current);
199
- return () => observer.disconnect();
200
- };
206
+ if ($[0] !== isInGroup) {
207
+ t0 = { disabled: isInGroup };
201
208
  $[0] = isInGroup;
202
- $[1] = ref;
203
- $[2] = t0;
204
- } else t0 = $[2];
205
- const subscribeIntersectionObserver = t0;
206
- let t1;
207
- if ($[3] !== ref) {
208
- t1 = () => ref.current ? ref.current.offsetTop > 0 : false;
209
- $[3] = ref;
210
- $[4] = t1;
211
- } else t1 = $[4];
212
- const isItemOverflowing = useSyncExternalStore(subscribeIntersectionObserver, t1, _temp6);
209
+ $[1] = t0;
210
+ } else t0 = $[1];
211
+ const isItemOverflowing = useIsClipped(ref, t0);
213
212
  const isOverflowing = isGroupOverflowing || isItemOverflowing;
214
213
  ActionBarItemsRegistry.useRegisterDescendant(isOverflowing ? registryProps : null);
215
- const t2 = isOverflowing ? "" : void 0;
216
- let t3;
217
- if ($[5] !== isOverflowing || $[6] !== t2) {
218
- t3 = {
214
+ const t1 = isOverflowing ? "" : void 0;
215
+ let t2;
216
+ if ($[2] !== isOverflowing || $[3] !== t1) {
217
+ t2 = {
219
218
  isOverflowing,
220
- dataOverflowingAttr: t2
219
+ dataOverflowingAttr: t1
221
220
  };
222
- $[5] = isOverflowing;
223
- $[6] = t2;
224
- $[7] = t3;
225
- } else t3 = $[7];
226
- return t3;
227
- }
228
- function _temp6() {
229
- return false;
221
+ $[2] = isOverflowing;
222
+ $[3] = t1;
223
+ $[4] = t2;
224
+ } else t2 = $[4];
225
+ return t2;
230
226
  }
231
- function _temp5() {}
232
227
  const ActionBarIconButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props }, forwardedRef) => {
233
228
  const ref = useRef(null);
234
229
  const mergedRef = useMergedRefs(forwardedRef, ref);
@@ -444,7 +439,7 @@ const ActionBarMenu = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
444
439
  } else t4 = $[18];
445
440
  let t5;
446
441
  if ($[19] !== items) {
447
- t5 = items.map(_temp7);
442
+ t5 = items.map(_temp5);
448
443
  $[19] = items;
449
444
  $[20] = t5;
450
445
  } else t5 = $[20];
@@ -534,7 +529,7 @@ function _temp4(t0) {
534
529
  })] }, id);
535
530
  }
536
531
  }
537
- function _temp7(item, index) {
532
+ function _temp5(item, index) {
538
533
  return renderMenuItem(item, index);
539
534
  }
540
535
  //#endregion
@@ -17,7 +17,6 @@ type PageLayoutProps = {
17
17
  _slotsConfig?: Record<'header' | 'footer' | 'sidebar', React.ElementType>;
18
18
  className?: string;
19
19
  style?: React.CSSProperties;
20
- 'data-component'?: string;
21
20
  };
22
21
  type PageLayoutHeaderProps = {
23
22
  /**
@@ -48,7 +47,6 @@ type PageLayoutHeaderProps = {
48
47
  hidden?: boolean | ResponsiveValue<boolean>;
49
48
  className?: string;
50
49
  style?: React.CSSProperties;
51
- 'data-component'?: string;
52
50
  };
53
51
  type PageLayoutContentProps = {
54
52
  /**
@@ -69,7 +67,6 @@ type PageLayoutContentProps = {
69
67
  hidden?: boolean | ResponsiveValue<boolean>;
70
68
  className?: string;
71
69
  style?: React.CSSProperties;
72
- 'data-component'?: string;
73
70
  };
74
71
  type PageLayoutPaneBaseProps = {
75
72
  position?: 'start' | 'end' | ResponsiveValue<'start' | 'end'>;
@@ -143,7 +140,6 @@ type PageLayoutPaneBaseProps = {
143
140
  id?: string;
144
141
  className?: string;
145
142
  style?: React.CSSProperties;
146
- 'data-component'?: string;
147
143
  };
148
144
  type PageLayoutPaneProps = PageLayoutPaneBaseProps & ({
149
145
  /**
@@ -231,7 +227,6 @@ type PageLayoutSidebarBaseProps = {
231
227
  id?: string;
232
228
  className?: string;
233
229
  style?: React.CSSProperties;
234
- 'data-component'?: string;
235
230
  };
236
231
  type PageLayoutSidebarProps = PageLayoutSidebarBaseProps & ({
237
232
  /**
@@ -280,7 +275,6 @@ type PageLayoutFooterProps = {
280
275
  hidden?: boolean | ResponsiveValue<boolean>;
281
276
  className?: string;
282
277
  style?: React.CSSProperties;
283
- 'data-component'?: string;
284
278
  };
285
279
  declare const PageLayout: React.FC<React.PropsWithChildren<PageLayoutProps>> & {
286
280
  Header: FCWithSlotMarker<React.PropsWithChildren<PageLayoutHeaderProps>>;