@primer/react 38.24.0-rc.76f4c2c0c → 38.24.0-rc.98bb12ac8

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
@@ -22,10 +22,14 @@
22
22
 
23
23
  - [#7776](https://github.com/primer/react/pull/7776) [`d6f61c1`](https://github.com/primer/react/commit/d6f61c1e197b52eb75cff97299bfac4caedcc1ac) Thanks [@llastflowers](https://github.com/llastflowers)! - Add `data-component` attributes for Blankslate, BranchName, Breadcrumbs, ButtonGroup, Checkbox, CheckboxGroup, CircleBadge, ConfirmationDialog, CounterLabel, and Dialog to provide stable selectors.
24
24
 
25
+ - [#7816](https://github.com/primer/react/pull/7816) [`aef8548`](https://github.com/primer/react/commit/aef85486a77a544ab36fcc18470dc06bf2502b09) Thanks [@iansan5653](https://github.com/iansan5653)! - Replace `ActionBar` overflow calculations with CSS wrapping approach to improve performance and stability
26
+
25
27
  - [#7819](https://github.com/primer/react/pull/7819) [`8ed6149`](https://github.com/primer/react/commit/8ed6149b45093449c6e12a71a374618fe282d6a1) Thanks [@llastflowers](https://github.com/llastflowers)! - Add `data-component` attributes for Details, Flash, FormControl (+ update InputValidation to forward from FormControl.Validation), Header, and Heading.
26
28
 
27
29
  ### Patch Changes
28
30
 
31
+ - [#7824](https://github.com/primer/react/pull/7824) [`6889235`](https://github.com/primer/react/commit/6889235fac93f17cfd0354758f4f9a1e6ff01942) Thanks [@jonrohan](https://github.com/jonrohan)! - Fix `usePaneWidth` triggering unnecessary React re-renders on every window resize
32
+
29
33
  - [#7833](https://github.com/primer/react/pull/7833) [`dfed7ca`](https://github.com/primer/react/commit/dfed7ca73532922ec0526dd85afcf7ae471c566e) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Timeline: Remove border override from TimelineBadge when variant is set
30
34
 
31
35
  ## 38.23.0
@@ -0,0 +1,2 @@
1
+ .prc-ActionBar-List-9uz46{align-items:flex-start;animation:prc-ActionBar-detect-overflow-mAuJu linear;display:flex;gap:var(--actionbar-gap,var(--stack-gap-condensed,.5rem));height:var(--actionbar-height,var(--control-small-size,1.75rem));list-style:none;margin-bottom:-1px;min-width:0;overflow:hidden;position:relative;animation-timeline:scroll(self block)}.prc-ActionBar-List-9uz46[data-has-overflow=true]{--morebutton-display:flex}.prc-ActionBar-List-9uz46:where([data-size=small]){--actionbar-height:var(--control-small-size,1.75rem)}.prc-ActionBar-List-9uz46:where([data-size=medium]){--actionbar-height:var(--control-medium-size,2rem)}.prc-ActionBar-List-9uz46:where([data-size=large]){--actionbar-height:var(--control-large-size,2.5rem)}.prc-ActionBar-List-9uz46:where([data-gap=none]){--actionbar-gap:0}.prc-ActionBar-List-9uz46:where([data-gap=none]) .prc-ActionBar-Divider-6V8yH{padding:0 var(--base-size-8,.5rem)}.prc-ActionBar-List-9uz46:where([data-gap=condensed]){--actionbar-gap:var(--stack-gap-condensed,0.5rem)}.prc-ActionBar-List-9uz46 [data-overflowing]{visibility:hidden!important}@keyframes prc-ActionBar-detect-overflow-mAuJu{0%,to{--morebutton-display:flex}}.prc-ActionBar-Nav-9spON{align-items:center;display:flex;justify-content:flex-end;padding-inline:var(--base-size-16,1rem)}.prc-ActionBar-Nav-9spON:where([data-flush=true]){padding-inline:0}.prc-ActionBar-Divider-6V8yH:before{background:var(--borderColor-muted,#d1d9e0b3);content:"";display:block;height:var(--base-size-20,1.25rem);margin-top:calc((var(--actionbar-height) - var(--base-size-20,1.25rem))/2);width:var(--borderWidth-thin,.0625rem)}.prc-ActionBar-Group-peNCk,.prc-ActionBar-OverflowContainer-AkYZs{display:flex;gap:inherit}.prc-ActionBar-OverflowContainer-AkYZs{flex-wrap:wrap;justify-content:flex-end;overflow:hidden}.prc-ActionBar-OverflowContainer-AkYZs .prc-ActionBar-OverflowSpacer-tbHkV{height:var(--actionbar-height)}.prc-ActionBar-MoreButton-RHqpx{display:var(--morebutton-display,none)}
2
+ /*# sourceMappingURL=ActionBar-e63def3c.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ActionBar/ActionBar.module.css.js"],"names":[],"mappings":"AAAA,0BASE,sBAAuB,CASvB,oDAAiC,CAhBjC,YAAa,CAQb,yDAAqD,CAGrD,gEAA0D,CAL1D,eAAgB,CADhB,kBAAmB,CAJnB,WAAY,CAQZ,eAAgB,CAVhB,iBAAkB,CAkBlB,qCAsCF,CAnCE,kDACE,yBACF,CAEA,mDACE,oDACF,CAEA,oDACE,kDACF,CAEA,mDACE,mDACF,CAGA,iDACE,iBAKF,CAHE,8EACE,kCACF,CAGF,sDACE,iDACF,CAEA,6CAIE,2BACF,CAGF,+CACE,MAEE,yBACF,CACF,CAEA,yBAIE,kBAAmB,CAHnB,YAAa,CAEb,wBAAyB,CADzB,uCAOF,CAHE,kDACE,gBACF,CAIA,oCAME,6CAAoC,CAFpC,UAAW,CAHX,aAAc,CAEd,kCAA2B,CAK3B,0EAAqE,CANrE,sCAOF,CAQF,kEAJE,YAAa,CACb,WAaF,CAVA,uCAEE,cAAe,CAEf,wBAAyB,CACzB,eAKF,CAHE,2EACE,8BACF,CAGF,gCACE,sCACF","file":"ActionBar-e63def3c.css","sourcesContent":[".List {\n position: relative;\n display: flex;\n min-width: 0;\n\n /* wonder why this is here */\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n list-style: none;\n align-items: flex-start;\n gap: var(--actionbar-gap, var(--stack-gap-condensed));\n overflow: hidden;\n /* Explicit height is required to clip wrapped items */\n height: var(--actionbar-height, var(--control-small-size));\n\n /* Scroll-based animations have no effect unless the container is scrollable (has overflow, even with overflow:hidden)\n so we can use them to detect overflow. It would be cleaner to use scroll-state container queries for this, but\n browser support for scroll-driven animations is slightly better. */\n animation: detect-overflow linear;\n animation-timeline: scroll(self block);\n\n /* After initial render, JS is used to control visibility which provides progressive enhancement for unsupported browsers */\n &[data-has-overflow='true'] {\n --morebutton-display: flex;\n }\n\n &:where([data-size='small']) {\n --actionbar-height: var(--control-small-size);\n }\n\n &:where([data-size='medium']) {\n --actionbar-height: var(--control-medium-size);\n }\n\n &:where([data-size='large']) {\n --actionbar-height: var(--control-large-size);\n }\n\n /* Gap scale (mirrors Stack) */\n &:where([data-gap='none']) {\n --actionbar-gap: 0;\n\n .Divider {\n padding: 0 var(--base-size-8);\n }\n }\n\n &:where([data-gap='condensed']) {\n --actionbar-gap: var(--stack-gap-condensed);\n }\n\n & [data-overflowing] {\n /* Hide overflowing items. Even though they are clipped by `overflow: hidden`, setting `visibility: hidden` ensures\n they can't accidentally be shown and also hides them from screen readers / keyboard nav. `!important` prevents\n consumers from unintentionally overriding this and breaking accessibility. */\n visibility: hidden !important;\n }\n}\n\n@keyframes detect-overflow {\n 0%,\n 100% {\n --morebutton-display: flex;\n }\n}\n\n.Nav {\n display: flex;\n padding-inline: var(--base-size-16);\n justify-content: flex-end;\n align-items: center;\n\n &:where([data-flush='true']) {\n padding-inline: 0;\n }\n}\n\n.Divider {\n &::before {\n display: block;\n width: var(--borderWidth-thin);\n height: var(--base-size-20);\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background: var(--borderColor-muted);\n /* stylelint-disable-next-line primer/spacing */\n margin-top: calc((var(--actionbar-height) - var(--base-size-20)) / 2);\n }\n}\n\n.Group {\n display: flex;\n gap: inherit;\n}\n\n.OverflowContainer {\n display: flex;\n flex-wrap: wrap;\n gap: inherit;\n justify-content: flex-end;\n overflow: hidden;\n\n .OverflowSpacer {\n height: var(--actionbar-height);\n }\n}\n\n.MoreButton {\n display: var(--morebutton-display, none);\n}\n"]}
@@ -120,6 +120,6 @@ export declare const ActionBarMenu: React.ForwardRefExoticComponent<{
120
120
  keyshortcuts?: string;
121
121
  keybindingHint?: string | string[];
122
122
  } & Omit<import("..").ButtonBaseProps, "aria-label" | "aria-labelledby"> & React.RefAttributes<unknown>>;
123
- export declare const VerticalDivider: () => React.JSX.Element | null;
123
+ export declare const VerticalDivider: () => React.JSX.Element;
124
124
  export {};
125
125
  //# sourceMappingURL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3B,CAAA"}
@@ -1,53 +1,27 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import React, { useRef, useState, forwardRef, useMemo, useCallback } from 'react';
2
+ import React, { forwardRef, useRef, useState, useMemo, useCallback, useContext, useSyncExternalStore } from 'react';
3
3
  import { KebabHorizontalIcon } from '@primer/octicons-react';
4
4
  import { ActionList } from '../ActionList/index.js';
5
- import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
6
- import { useResizeObserver } from '../hooks/useResizeObserver.js';
7
5
  import { IconButton } from '../Button/IconButton.js';
8
6
  import { useFocusZone } from '../hooks/useFocusZone.js';
9
7
  import styles from './ActionBar.module.css.js';
10
8
  import { clsx } from 'clsx';
11
9
  import { createDescendantRegistry } from '../utils/descendant-registry.js';
12
- import { jsxs, jsx } from 'react/jsx-runtime';
10
+ import { jsx, jsxs } from 'react/jsx-runtime';
13
11
  import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
14
12
  import { FocusKeys } from '@primer/behaviors';
15
13
  import { ActionMenu } from '../ActionMenu/ActionMenu.js';
16
14
 
17
- const ACTIONBAR_ITEM_GAP = 8;
18
-
19
- /**
20
- * Registry of descendants to render in the list or menu. To preserve insertion order across updates, children are
21
- * set to `null` when unregistered rather than fully dropped from the map.
22
- */
23
-
24
15
  const ActionBarContext = /*#__PURE__*/React.createContext({
25
- size: 'medium',
26
- isVisibleChild: () => true,
27
- groupId: undefined
16
+ size: 'medium'
28
17
  });
29
18
 
30
19
  /*
31
20
  small (28px), medium (32px), large (40px)
32
21
  */
33
22
 
34
- const MORE_BTN_WIDTH = 32;
35
23
  const ActionBarItemsRegistry = createDescendantRegistry();
36
- const calculatePossibleItems = (registryEntries, navWidth, gap, moreMenuWidth = 0) => {
37
- const widthToFit = navWidth - moreMenuWidth;
38
- let breakpoint = registryEntries.length; // assume all items will fit
39
- let sumsOfChildWidth = 0;
40
- for (const [index, [, child]] of registryEntries.entries()) {
41
- sumsOfChildWidth += index > 0 ? child.width + gap : child.width;
42
- if (sumsOfChildWidth > widthToFit) {
43
- breakpoint = index;
44
- break;
45
- } else {
46
- continue;
47
- }
48
- }
49
- return breakpoint;
50
- };
24
+ const FOCUSABLE_ITEM_SELECTOR = ':is(button, a, input, [tabindex]):not(:disabled):not([data-overflowing]):not([data-more-button-inactive])';
51
25
  const renderMenuItem = (item, index) => {
52
26
  if (item.type === 'divider') {
53
27
  return /*#__PURE__*/jsx(ActionList.Divider, {}, index);
@@ -96,328 +70,258 @@ const renderMenuItem = (item, index) => {
96
70
  }, label);
97
71
  };
98
72
  renderMenuItem.displayName = "renderMenuItem";
99
- const getMenuItems = (navWidth, moreMenuWidth, childRegistry, hasActiveMenu, gap) => {
100
- var _childRegistry$entrie;
101
- const registryEntries = Array.from((_childRegistry$entrie = childRegistry === null || childRegistry === void 0 ? void 0 : childRegistry.entries()) !== null && _childRegistry$entrie !== void 0 ? _childRegistry$entrie : []).filter(entry => entry[1] !== null && (entry[1].type !== 'action' || entry[1].groupId === undefined));
102
- if (registryEntries.length === 0) return new Set();
103
- const numberOfItemsPossible = calculatePossibleItems(registryEntries, navWidth, gap);
104
- const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(registryEntries, navWidth, gap, moreMenuWidth || MORE_BTN_WIDTH);
105
- const menuItems = new Set();
106
-
107
- // First, we check if we can fit all the items with their icons
108
- if (registryEntries.length >= numberOfItemsPossible) {
109
- /* Below is an accessibility requirement. Never show only one item in the overflow menu.
110
- * If there is only one item left to display in the overflow menu according to the calculation,
111
- * we need to pull another item from the list into the overflow menu.
112
- */
113
- const numberOfItemsInMenu = registryEntries.length - numberOfItemsPossibleWithMoreMenu;
114
- const numberOfListItems = numberOfItemsInMenu === 1 ? numberOfItemsPossibleWithMoreMenu - 1 : numberOfItemsPossibleWithMoreMenu;
115
- for (const [index, [id, child]] of registryEntries.entries()) {
116
- if (index < numberOfListItems) {
117
- continue;
118
- //if the last item is a divider
119
- } else if (child.type === 'divider') {
120
- if (index === numberOfListItems - 1 || index === numberOfListItems) {
121
- continue;
122
- } else {
123
- menuItems.add(id);
124
- }
125
- } else {
126
- menuItems.add(id);
127
- }
128
- }
129
- return menuItems;
130
- } else if (numberOfItemsPossible > registryEntries.length && hasActiveMenu) {
131
- /* If the items fit in the list and there are items in the overflow menu, we need to move them back to the list */
132
- return new Set();
133
- }
134
- };
135
- const ActionBar = props => {
136
- const $ = c(38);
73
+ const ActionBar = t0 => {
74
+ const $ = c(40);
137
75
  const {
138
- size: t0,
76
+ size: t1,
139
77
  children,
140
78
  "aria-label": ariaLabel,
141
79
  "aria-labelledby": ariaLabelledBy,
142
- flush: t1,
80
+ flush: t2,
143
81
  className,
144
- gap: t2
145
- } = props;
146
- const size = t0 === undefined ? "medium" : t0;
147
- const flush = t1 === undefined ? false : t1;
148
- const gap = t2 === undefined ? "condensed" : t2;
149
- const listRef = useRef(null);
150
- const [computedGap, setComputedGap] = useState(ACTIONBAR_ITEM_GAP);
82
+ gap: t3
83
+ } = t0;
84
+ const size = t1 === undefined ? "medium" : t1;
85
+ const flush = t2 === undefined ? false : t2;
86
+ const gap = t3 === undefined ? "condensed" : t3;
151
87
  const [childRegistry, setChildRegistry] = ActionBarItemsRegistry.useRegistryState();
152
- const [menuItemIds, setMenuItemIds] = useState(_temp);
153
- const navRef = useRef(null);
154
- let t3;
155
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
156
- t3 = () => {
157
- if (!listRef.current) {
158
- return;
159
- }
160
- const g = window.getComputedStyle(listRef.current).gap;
161
- const parsed = parseFloat(g);
162
- if (!Number.isNaN(parsed)) {
163
- setComputedGap(parsed);
164
- }
165
- };
166
- $[0] = t3;
167
- } else {
168
- t3 = $[0];
169
- }
170
88
  let t4;
171
- if ($[1] !== gap) {
172
- t4 = [gap];
173
- $[1] = gap;
174
- $[2] = t4;
89
+ if ($[0] !== childRegistry) {
90
+ t4 = childRegistry && Array.from(childRegistry.entries()).filter(_temp);
91
+ $[0] = childRegistry;
92
+ $[1] = t4;
175
93
  } else {
176
- t4 = $[2];
94
+ t4 = $[1];
177
95
  }
178
- useIsomorphicLayoutEffect(t3, t4);
179
- const moreMenuRef = useRef(null);
96
+ const overflowItems = t4;
180
97
  let t5;
181
- if ($[3] !== childRegistry || $[4] !== computedGap || $[5] !== menuItemIds.size) {
182
- t5 = resizeObserverEntries => {
183
- var _moreMenuRef$current$, _moreMenuRef$current;
184
- const navWidth = resizeObserverEntries[0].contentRect.width;
185
- const moreMenuWidth = (_moreMenuRef$current$ = (_moreMenuRef$current = moreMenuRef.current) === null || _moreMenuRef$current === void 0 ? void 0 : _moreMenuRef$current.getBoundingClientRect().width) !== null && _moreMenuRef$current$ !== void 0 ? _moreMenuRef$current$ : 0;
186
- const hasActiveMenu = menuItemIds.size > 0;
187
- if (navWidth > 0) {
188
- const newMenuItemIds = getMenuItems(navWidth, moreMenuWidth, childRegistry, hasActiveMenu, computedGap);
189
- if (newMenuItemIds) {
190
- setMenuItemIds(newMenuItemIds);
191
- }
192
- }
98
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
99
+ t5 = {
100
+ bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
101
+ focusOutBehavior: "wrap",
102
+ focusableElementFilter: _temp2
193
103
  };
194
- $[3] = childRegistry;
195
- $[4] = computedGap;
196
- $[5] = menuItemIds.size;
197
- $[6] = t5;
104
+ $[2] = t5;
198
105
  } else {
199
- t5 = $[6];
106
+ t5 = $[2];
200
107
  }
201
- useResizeObserver(t5, navRef);
202
108
  let t6;
203
- if ($[7] !== menuItemIds) {
204
- t6 = id => !menuItemIds.has(id);
205
- $[7] = menuItemIds;
206
- $[8] = t6;
109
+ if ($[3] !== overflowItems) {
110
+ t6 = [overflowItems];
111
+ $[3] = overflowItems;
112
+ $[4] = t6;
207
113
  } else {
208
- t6 = $[8];
114
+ t6 = $[4];
209
115
  }
210
- const isVisibleChild = t6;
116
+ const {
117
+ containerRef
118
+ } = useFocusZone(t5, t6);
211
119
  let t7;
212
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
120
+ if ($[5] !== size) {
213
121
  t7 = {
214
- containerRef: listRef,
215
- bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
216
- focusOutBehavior: "wrap"
122
+ size
217
123
  };
218
- $[9] = t7;
219
- } else {
220
- t7 = $[9];
221
- }
222
- useFocusZone(t7);
223
- let groupedItemsMap;
224
- if ($[10] !== childRegistry) {
225
- groupedItemsMap = new Map();
226
- for (const [key, childProps] of childRegistry !== null && childRegistry !== void 0 ? childRegistry : []) {
227
- if (childProps.type === "action" && childProps.groupId) {
228
- const existingGroup = groupedItemsMap.get(childProps.groupId) || [];
229
- existingGroup.push([key, childProps]);
230
- groupedItemsMap.set(childProps.groupId, existingGroup);
231
- }
232
- }
233
- $[10] = childRegistry;
234
- $[11] = groupedItemsMap;
124
+ $[5] = size;
125
+ $[6] = t7;
235
126
  } else {
236
- groupedItemsMap = $[11];
127
+ t7 = $[6];
237
128
  }
238
- const groupedItems = groupedItemsMap;
239
129
  let t8;
240
- if ($[12] !== isVisibleChild || $[13] !== size) {
241
- t8 = {
242
- size,
243
- isVisibleChild
244
- };
245
- $[12] = isVisibleChild;
130
+ if ($[7] !== className) {
131
+ t8 = clsx(className, styles.Nav);
132
+ $[7] = className;
133
+ $[8] = t8;
134
+ } else {
135
+ t8 = $[8];
136
+ }
137
+ const t9 = containerRef;
138
+ const t10 = overflowItems ? overflowItems.length > 0 : undefined;
139
+ let t11;
140
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
141
+ t11 = /*#__PURE__*/jsx("div", {
142
+ className: styles.OverflowSpacer
143
+ });
144
+ $[9] = t11;
145
+ } else {
146
+ t11 = $[9];
147
+ }
148
+ let t12;
149
+ if ($[10] !== children || $[11] !== setChildRegistry) {
150
+ t12 = /*#__PURE__*/jsxs("div", {
151
+ className: styles.OverflowContainer,
152
+ children: [t11, /*#__PURE__*/jsx(ActionBarItemsRegistry.Provider, {
153
+ setRegistry: setChildRegistry,
154
+ children: children
155
+ })]
156
+ });
157
+ $[10] = children;
158
+ $[11] = setChildRegistry;
159
+ $[12] = t12;
160
+ } else {
161
+ t12 = $[12];
162
+ }
163
+ const t13 = `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`;
164
+ const t14 = overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? undefined : true;
165
+ let t15;
166
+ if ($[13] !== size || $[14] !== t13 || $[15] !== t14) {
167
+ t15 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
168
+ children: /*#__PURE__*/jsx(IconButton, {
169
+ variant: "invisible",
170
+ "aria-label": t13,
171
+ icon: KebabHorizontalIcon,
172
+ className: styles.MoreButton,
173
+ "data-more-button-inactive": t14,
174
+ size: size
175
+ })
176
+ });
246
177
  $[13] = size;
247
- $[14] = t8;
178
+ $[14] = t13;
179
+ $[15] = t14;
180
+ $[16] = t15;
248
181
  } else {
249
- t8 = $[14];
182
+ t15 = $[16];
250
183
  }
251
- let t9;
252
- if ($[15] !== className) {
253
- t9 = clsx(className, styles.Nav);
254
- $[15] = className;
255
- $[16] = t9;
184
+ let t16;
185
+ if ($[17] !== overflowItems) {
186
+ t16 = overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map(_temp4);
187
+ $[17] = overflowItems;
188
+ $[18] = t16;
256
189
  } else {
257
- t9 = $[16];
190
+ t16 = $[18];
258
191
  }
259
- let t10;
260
- if ($[17] !== children || $[18] !== setChildRegistry) {
261
- t10 = /*#__PURE__*/jsx(ActionBarItemsRegistry.Provider, {
262
- setRegistry: setChildRegistry,
263
- children: children
192
+ let t17;
193
+ if ($[19] !== t16) {
194
+ t17 = /*#__PURE__*/jsx(ActionMenu.Overlay, {
195
+ children: /*#__PURE__*/jsx(ActionList, {
196
+ children: t16
197
+ })
264
198
  });
265
- $[17] = children;
266
- $[18] = setChildRegistry;
267
- $[19] = t10;
199
+ $[19] = t16;
200
+ $[20] = t17;
268
201
  } else {
269
- t10 = $[19];
202
+ t17 = $[20];
270
203
  }
271
- let t11;
272
- if ($[20] !== ariaLabel || $[21] !== childRegistry || $[22] !== groupedItems || $[23] !== menuItemIds) {
273
- t11 = menuItemIds.size > 0 && /*#__PURE__*/jsxs(ActionMenu, {
274
- children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
275
- children: /*#__PURE__*/jsx(IconButton, {
276
- variant: "invisible",
277
- "aria-label": `More ${ariaLabel} items`,
278
- icon: KebabHorizontalIcon
279
- })
280
- }), /*#__PURE__*/jsx(ActionMenu.Overlay, {
281
- children: /*#__PURE__*/jsx(ActionList, {
282
- children: Array.from(menuItemIds).map(id_0 => {
283
- const menuItem = childRegistry === null || childRegistry === void 0 ? void 0 : childRegistry.get(id_0);
284
- if (!menuItem) {
285
- return null;
286
- }
287
- if (menuItem.type === "divider") {
288
- return /*#__PURE__*/jsx(ActionList.Divider, {}, id_0);
289
- } else {
290
- if (menuItem.type === "action") {
291
- const {
292
- onClick,
293
- icon: Icon,
294
- label,
295
- disabled
296
- } = menuItem;
297
- return /*#__PURE__*/jsxs(ActionList.Item, {
298
- onSelect: event => {
299
- typeof onClick === "function" && onClick(event);
300
- },
301
- disabled: disabled,
302
- children: [/*#__PURE__*/jsx(ActionList.LeadingVisual, {
303
- children: /*#__PURE__*/jsx(Icon, {})
304
- }), label]
305
- }, label);
306
- }
307
- }
308
- if (menuItem.type === "menu") {
309
- const menuItems = menuItem.items;
310
- const {
311
- icon: Icon_0,
312
- label: label_0,
313
- returnFocusRef
314
- } = menuItem;
315
- return /*#__PURE__*/jsxs(ActionMenu, {
316
- children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
317
- children: /*#__PURE__*/jsxs(ActionList.Item, {
318
- children: [Icon_0 !== "none" ? /*#__PURE__*/jsx(ActionList.LeadingVisual, {
319
- children: /*#__PURE__*/jsx(Icon_0, {})
320
- }) : null, label_0]
321
- })
322
- }), /*#__PURE__*/jsx(ActionMenu.Overlay, {
323
- ...(returnFocusRef && {
324
- returnFocusRef
325
- }),
326
- children: /*#__PURE__*/jsx(ActionList, {
327
- children: menuItems.map(_temp2)
328
- })
329
- })]
330
- }, id_0);
331
- }
332
- const groupedMenuItems = groupedItems.get(id_0) || [];
333
- if (menuItem.type === "group") {
334
- return /*#__PURE__*/jsx(React.Fragment, {
335
- children: groupedMenuItems.map(_temp3)
336
- }, id_0);
337
- }
338
- })
339
- })
340
- })]
204
+ let t18;
205
+ if ($[21] !== t15 || $[22] !== t17) {
206
+ t18 = /*#__PURE__*/jsxs(ActionMenu, {
207
+ children: [t15, t17]
341
208
  });
342
- $[20] = ariaLabel;
343
- $[21] = childRegistry;
344
- $[22] = groupedItems;
345
- $[23] = menuItemIds;
346
- $[24] = t11;
209
+ $[21] = t15;
210
+ $[22] = t17;
211
+ $[23] = t18;
347
212
  } else {
348
- t11 = $[24];
213
+ t18 = $[23];
349
214
  }
350
- let t12;
351
- if ($[25] !== ariaLabel || $[26] !== ariaLabelledBy || $[27] !== gap || $[28] !== t10 || $[29] !== t11) {
352
- t12 = /*#__PURE__*/jsxs("div", {
353
- ref: listRef,
215
+ let t19;
216
+ if ($[24] !== ariaLabel || $[25] !== ariaLabelledBy || $[26] !== gap || $[27] !== size || $[28] !== t10 || $[29] !== t12 || $[30] !== t18 || $[31] !== t9) {
217
+ t19 = /*#__PURE__*/jsxs("div", {
218
+ ref: t9,
354
219
  role: "toolbar",
355
220
  className: styles.List,
356
221
  "aria-label": ariaLabel,
357
222
  "aria-labelledby": ariaLabelledBy,
358
223
  "data-gap": gap,
359
- children: [t10, t11]
224
+ "data-size": size,
225
+ "data-has-overflow": t10,
226
+ children: [t12, t18]
360
227
  });
361
- $[25] = ariaLabel;
362
- $[26] = ariaLabelledBy;
363
- $[27] = gap;
228
+ $[24] = ariaLabel;
229
+ $[25] = ariaLabelledBy;
230
+ $[26] = gap;
231
+ $[27] = size;
364
232
  $[28] = t10;
365
- $[29] = t11;
366
- $[30] = t12;
233
+ $[29] = t12;
234
+ $[30] = t18;
235
+ $[31] = t9;
236
+ $[32] = t19;
367
237
  } else {
368
- t12 = $[30];
238
+ t19 = $[32];
369
239
  }
370
- let t13;
371
- if ($[31] !== flush || $[32] !== t12 || $[33] !== t9) {
372
- t13 = /*#__PURE__*/jsx("div", {
373
- ref: navRef,
374
- className: t9,
240
+ let t20;
241
+ if ($[33] !== flush || $[34] !== t19 || $[35] !== t8) {
242
+ t20 = /*#__PURE__*/jsx("div", {
243
+ className: t8,
375
244
  "data-component": "ActionBar",
376
245
  "data-flush": flush,
377
- children: t12
246
+ children: t19
378
247
  });
379
- $[31] = flush;
380
- $[32] = t12;
381
- $[33] = t9;
382
- $[34] = t13;
248
+ $[33] = flush;
249
+ $[34] = t19;
250
+ $[35] = t8;
251
+ $[36] = t20;
383
252
  } else {
384
- t13 = $[34];
253
+ t20 = $[36];
385
254
  }
386
- let t14;
387
- if ($[35] !== t13 || $[36] !== t8) {
388
- t14 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
389
- value: t8,
390
- children: t13
255
+ let t21;
256
+ if ($[37] !== t20 || $[38] !== t7) {
257
+ t21 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
258
+ value: t7,
259
+ children: t20
391
260
  });
392
- $[35] = t13;
393
- $[36] = t8;
394
- $[37] = t14;
261
+ $[37] = t20;
262
+ $[38] = t7;
263
+ $[39] = t21;
395
264
  } else {
396
- t14 = $[37];
265
+ t21 = $[39];
397
266
  }
398
- return t14;
267
+ return t21;
399
268
  };
400
- function useWidth(ref) {
401
- const $ = c(3);
402
- const [width, setWidth] = useState(-1);
269
+ function useActionBarItem(ref, registryProps) {
270
+ var _useContext;
271
+ const $ = c(8);
272
+ const isGroupOverflowing = (_useContext = useContext(ActionBarGroupContext)) === null || _useContext === void 0 ? void 0 : _useContext.isOverflowing;
273
+ const isInGroup = isGroupOverflowing !== undefined;
403
274
  let t0;
275
+ if ($[0] !== isInGroup || $[1] !== ref) {
276
+ t0 = onChange => {
277
+ if (isInGroup) {
278
+ return _temp5;
279
+ }
280
+ const observer = new IntersectionObserver(() => onChange(), {
281
+ threshold: 0.75
282
+ });
283
+ if (ref.current) {
284
+ observer.observe(ref.current);
285
+ }
286
+ return () => observer.disconnect();
287
+ };
288
+ $[0] = isInGroup;
289
+ $[1] = ref;
290
+ $[2] = t0;
291
+ } else {
292
+ t0 = $[2];
293
+ }
294
+ const subscribeIntersectionObserver = t0;
404
295
  let t1;
405
- if ($[0] !== ref) {
406
- t0 = () => {
407
- var _ref$current$getBound, _ref$current;
408
- return setWidth((_ref$current$getBound = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect().width) !== null && _ref$current$getBound !== void 0 ? _ref$current$getBound : -1);
296
+ if ($[3] !== ref) {
297
+ t1 = () => ref.current ? ref.current.offsetTop > 0 : false;
298
+ $[3] = ref;
299
+ $[4] = t1;
300
+ } else {
301
+ t1 = $[4];
302
+ }
303
+ const isItemOverflowing = useSyncExternalStore(subscribeIntersectionObserver, t1, _temp6);
304
+ const isOverflowing = isGroupOverflowing || isItemOverflowing;
305
+ ActionBarItemsRegistry.useRegisterDescendant(isOverflowing ? registryProps : null);
306
+ const t2 = isOverflowing ? "" : undefined;
307
+ let t3;
308
+ if ($[5] !== isOverflowing || $[6] !== t2) {
309
+ t3 = {
310
+ isOverflowing,
311
+ dataOverflowingAttr: t2
409
312
  };
410
- t1 = [ref];
411
- $[0] = ref;
412
- $[1] = t0;
413
- $[2] = t1;
313
+ $[5] = isOverflowing;
314
+ $[6] = t2;
315
+ $[7] = t3;
414
316
  } else {
415
- t0 = $[1];
416
- t1 = $[2];
317
+ t3 = $[7];
417
318
  }
418
- useIsomorphicLayoutEffect(t0, t1);
419
- return width;
319
+ return t3;
320
+ }
321
+ function _temp6() {
322
+ return false;
420
323
  }
324
+ function _temp5() {}
421
325
  const ActionBarIconButton = /*#__PURE__*/forwardRef(({
422
326
  disabled,
423
327
  onClick,
@@ -426,44 +330,36 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef(({
426
330
  const ref = useRef(null);
427
331
  useRefObjectAsForwardedRef(forwardedRef, ref);
428
332
  const {
429
- size,
430
- isVisibleChild
333
+ size
431
334
  } = React.useContext(ActionBarContext);
432
- const {
433
- groupId
434
- } = React.useContext(ActionBarGroupContext);
435
- const width = useWidth(ref);
436
335
  const {
437
336
  ['aria-label']: ariaLabel,
438
337
  icon
439
338
  } = props;
440
- const registryProps = useMemo(() => ({
339
+ const {
340
+ dataOverflowingAttr
341
+ } = useActionBarItem(ref, useMemo(() => ({
441
342
  type: 'action',
442
343
  label: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : '',
443
344
  icon,
444
345
  disabled: !!disabled,
445
- onClick: onClick,
446
- width,
447
- groupId: groupId !== null && groupId !== void 0 ? groupId : undefined
448
- }), [ariaLabel, icon, disabled, onClick, groupId, width]);
449
- const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
346
+ onClick: onClick
347
+ }), [ariaLabel, icon, disabled, onClick]));
450
348
  const clickHandler = useCallback(event => {
451
349
  if (disabled) return;
452
350
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
453
351
  }, [disabled, onClick]);
454
- if (!isVisibleChild(id) || groupId && !isVisibleChild(groupId)) return null;
455
352
  return /*#__PURE__*/jsx(IconButton, {
456
353
  "aria-disabled": disabled,
457
354
  ref: ref,
458
355
  size: size,
459
356
  onClick: clickHandler,
460
357
  ...props,
461
- variant: "invisible"
358
+ variant: "invisible",
359
+ "data-overflowing": dataOverflowingAttr
462
360
  });
463
361
  });
464
- const ActionBarGroupContext = /*#__PURE__*/React.createContext({
465
- groupId: null
466
- });
362
+ const ActionBarGroupContext = /*#__PURE__*/React.createContext(null);
467
363
  const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
468
364
  const $ = c(10);
469
365
  const {
@@ -471,39 +367,40 @@ const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
471
367
  } = t0;
472
368
  const backupRef = useRef(null);
473
369
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
474
- const width = useWidth(ref);
475
370
  let t1;
476
- if ($[0] !== width) {
371
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
477
372
  t1 = {
478
- type: "group",
479
- width
373
+ type: "group"
480
374
  };
481
- $[0] = width;
482
- $[1] = t1;
375
+ $[0] = t1;
483
376
  } else {
484
- t1 = $[1];
377
+ t1 = $[0];
485
378
  }
486
- const registryProps = t1;
487
- const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
379
+ const {
380
+ dataOverflowingAttr,
381
+ isOverflowing
382
+ } = useActionBarItem(ref, t1);
488
383
  let t2;
489
- if ($[2] !== id) {
384
+ if ($[1] !== isOverflowing) {
490
385
  t2 = {
491
- groupId: id
386
+ isOverflowing
492
387
  };
493
- $[2] = id;
494
- $[3] = t2;
388
+ $[1] = isOverflowing;
389
+ $[2] = t2;
495
390
  } else {
496
- t2 = $[3];
391
+ t2 = $[2];
497
392
  }
498
393
  let t3;
499
- if ($[4] !== children || $[5] !== ref) {
394
+ if ($[3] !== children || $[4] !== dataOverflowingAttr || $[5] !== ref) {
500
395
  t3 = /*#__PURE__*/jsx("div", {
501
396
  className: styles.Group,
502
397
  "data-component": "ActionBar.Group",
503
398
  ref: ref,
399
+ "data-overflowing": dataOverflowingAttr,
504
400
  children: children
505
401
  });
506
- $[4] = children;
402
+ $[3] = children;
403
+ $[4] = dataOverflowingAttr;
507
404
  $[5] = ref;
508
405
  $[6] = t3;
509
406
  } else {
@@ -557,17 +454,12 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
557
454
  }
558
455
  const backupRef = useRef(null);
559
456
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
560
- const {
561
- isVisibleChild
562
- } = React.useContext(ActionBarContext);
563
457
  const [menuOpen, setMenuOpen] = useState(false);
564
- const width = useWidth(ref);
565
458
  const t1 = overflowIcon ? overflowIcon : icon;
566
459
  let t2;
567
- if ($[7] !== ariaLabel || $[8] !== items || $[9] !== returnFocusRef || $[10] !== t1 || $[11] !== width) {
460
+ if ($[7] !== ariaLabel || $[8] !== items || $[9] !== returnFocusRef || $[10] !== t1) {
568
461
  t2 = {
569
462
  type: "menu",
570
- width,
571
463
  label: ariaLabel,
572
464
  icon: t1,
573
465
  returnFocusRef,
@@ -577,28 +469,27 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
577
469
  $[8] = items;
578
470
  $[9] = returnFocusRef;
579
471
  $[10] = t1;
580
- $[11] = width;
581
- $[12] = t2;
472
+ $[11] = t2;
582
473
  } else {
583
- t2 = $[12];
584
- }
585
- const registryProps = t2;
586
- const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
587
- if (!isVisibleChild(id)) {
588
- return null;
474
+ t2 = $[11];
589
475
  }
476
+ const {
477
+ dataOverflowingAttr
478
+ } = useActionBarItem(ref, t2);
590
479
  let t3;
591
- if ($[13] !== ariaLabel || $[14] !== icon || $[15] !== props) {
480
+ if ($[12] !== ariaLabel || $[13] !== dataOverflowingAttr || $[14] !== icon || $[15] !== props) {
592
481
  t3 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
593
482
  children: /*#__PURE__*/jsx(IconButton, {
594
483
  variant: "invisible",
595
484
  "aria-label": ariaLabel,
596
485
  icon: icon,
597
486
  ...props,
487
+ "data-overflowing": dataOverflowingAttr,
598
488
  "data-component": "ActionBar.Menu.IconButton"
599
489
  })
600
490
  });
601
- $[13] = ariaLabel;
491
+ $[12] = ariaLabel;
492
+ $[13] = dataOverflowingAttr;
602
493
  $[14] = icon;
603
494
  $[15] = props;
604
495
  $[16] = t3;
@@ -617,7 +508,7 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
617
508
  }
618
509
  let t5;
619
510
  if ($[19] !== items) {
620
- t5 = items.map(_temp4);
511
+ t5 = items.map(_temp7);
621
512
  $[19] = items;
622
513
  $[20] = t5;
623
514
  } else {
@@ -666,68 +557,91 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
666
557
  const VerticalDivider = () => {
667
558
  const $ = c(3);
668
559
  const ref = useRef(null);
669
- const {
670
- isVisibleChild
671
- } = React.useContext(ActionBarContext);
672
- const width = useWidth(ref);
673
560
  let t0;
674
- if ($[0] !== width) {
561
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
675
562
  t0 = {
676
- type: "divider",
677
- width
563
+ type: "divider"
678
564
  };
679
- $[0] = width;
680
- $[1] = t0;
565
+ $[0] = t0;
681
566
  } else {
682
- t0 = $[1];
683
- }
684
- const registryProps = t0;
685
- const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
686
- if (!isVisibleChild(id)) {
687
- return null;
567
+ t0 = $[0];
688
568
  }
569
+ const {
570
+ dataOverflowingAttr
571
+ } = useActionBarItem(ref, t0);
689
572
  let t1;
690
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
573
+ if ($[1] !== dataOverflowingAttr) {
691
574
  t1 = /*#__PURE__*/jsx("div", {
692
575
  ref: ref,
693
576
  "data-component": "ActionBar.VerticalDivider",
694
577
  "aria-hidden": "true",
695
- className: styles.Divider
578
+ className: styles.Divider,
579
+ "data-overflowing": dataOverflowingAttr
696
580
  });
581
+ $[1] = dataOverflowingAttr;
697
582
  $[2] = t1;
698
583
  } else {
699
584
  t1 = $[2];
700
585
  }
701
586
  return t1;
702
587
  };
703
- function _temp() {
704
- return new Set();
588
+ function _temp(entry) {
589
+ return entry[1] !== null;
705
590
  }
706
- function _temp2(item, index) {
591
+ function _temp2(element) {
592
+ return element.matches(FOCUSABLE_ITEM_SELECTOR);
593
+ }
594
+ function _temp3(item, index) {
707
595
  return renderMenuItem(item, index);
708
596
  }
709
- function _temp3(t0) {
710
- const [key_0, childProps_0] = t0;
711
- if (childProps_0.type === "action") {
597
+ function _temp4(t0) {
598
+ const [id, menuItem] = t0;
599
+ if (menuItem.type === "divider") {
600
+ return /*#__PURE__*/jsx(ActionList.Divider, {}, id);
601
+ }
602
+ if (menuItem.type === "action") {
712
603
  const {
713
- onClick: onClick_0,
714
- icon: Icon_1,
715
- label: label_1,
716
- disabled: disabled_0
717
- } = childProps_0;
604
+ onClick,
605
+ icon: Icon,
606
+ label,
607
+ disabled
608
+ } = menuItem;
718
609
  return /*#__PURE__*/jsxs(ActionList.Item, {
719
- onSelect: event_0 => {
720
- typeof onClick_0 === "function" && onClick_0(event_0);
610
+ onSelect: event => {
611
+ typeof onClick === "function" && onClick(event);
721
612
  },
722
- disabled: disabled_0,
613
+ disabled: disabled,
723
614
  children: [/*#__PURE__*/jsx(ActionList.LeadingVisual, {
724
- children: /*#__PURE__*/jsx(Icon_1, {})
725
- }), label_1]
726
- }, key_0);
615
+ children: /*#__PURE__*/jsx(Icon, {})
616
+ }), label]
617
+ }, label);
618
+ }
619
+ if (menuItem.type === "menu") {
620
+ const menuItems = menuItem.items;
621
+ const {
622
+ icon: Icon_0,
623
+ label: label_0,
624
+ returnFocusRef
625
+ } = menuItem;
626
+ return /*#__PURE__*/jsxs(ActionMenu, {
627
+ children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
628
+ children: /*#__PURE__*/jsxs(ActionList.Item, {
629
+ children: [Icon_0 !== "none" ? /*#__PURE__*/jsx(ActionList.LeadingVisual, {
630
+ children: /*#__PURE__*/jsx(Icon_0, {})
631
+ }) : null, label_0]
632
+ })
633
+ }), /*#__PURE__*/jsx(ActionMenu.Overlay, {
634
+ ...(returnFocusRef && {
635
+ returnFocusRef
636
+ }),
637
+ children: /*#__PURE__*/jsx(ActionList, {
638
+ children: menuItems.map(_temp3)
639
+ })
640
+ })]
641
+ }, id);
727
642
  }
728
- return null;
729
643
  }
730
- function _temp4(item, index) {
644
+ function _temp7(item, index) {
731
645
  return renderMenuItem(item, index);
732
646
  }
733
647
 
@@ -1,5 +1,5 @@
1
- import './ActionBar-a41224b2.css';
1
+ import './ActionBar-e63def3c.css';
2
2
 
3
- var styles = {"List":"prc-ActionBar-List-9uz46","Divider":"prc-ActionBar-Divider-6V8yH","Nav":"prc-ActionBar-Nav-9spON","Group":"prc-ActionBar-Group-peNCk"};
3
+ var styles = {"List":"prc-ActionBar-List-9uz46","detect-overflow":"prc-ActionBar-detect-overflow-mAuJu","Divider":"prc-ActionBar-Divider-6V8yH","Nav":"prc-ActionBar-Nav-9spON","Group":"prc-ActionBar-Group-peNCk","OverflowContainer":"prc-ActionBar-OverflowContainer-AkYZs","OverflowSpacer":"prc-ActionBar-OverflowSpacer-tbHkV","MoreButton":"prc-ActionBar-MoreButton-RHqpx"};
4
4
 
5
5
  export { styles as default };
@@ -1,7 +1,7 @@
1
1
  export type { ActionBarProps, ActionBarMenuProps, ActionBarMenuItemProps } from './ActionBar';
2
2
  declare const ActionBar: import("react").FC<import("react").PropsWithChildren<import("./ActionBar").ActionBarProps>> & {
3
3
  IconButton: import("react").ForwardRefExoticComponent<import("./ActionBar").ActionBarIconButtonProps & import("react").RefAttributes<unknown>>;
4
- Divider: () => import("react").JSX.Element | null;
4
+ Divider: () => import("react").JSX.Element;
5
5
  Group: import("react").ForwardRefExoticComponent<{
6
6
  children?: import("react").ReactNode | undefined;
7
7
  } & import("react").RefAttributes<unknown>>;
@@ -1 +1 @@
1
- {"version":3,"file":"usePaneWidth.d.ts","sourceRoot":"","sources":["../../src/PageLayout/usePaneWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAQrD,KAAK,WAAW,GAAG,GAAG,MAAM,IAAI,CAAA;AAEhC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,WAAW,CAAA;IAChB,OAAO,EAAE,WAAW,CAAA;IACpB,GAAG,EAAE,WAAW,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEpD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GA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;;GAGG;AACH,eAAO,MAAM,cAAc,IAAI,CAAA;AAE/B,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAyC,CAAA;AAKhG,eAAO,MAAM,oBAAoB,GAAI,OAAO,cAAc,KAAG,KAAK,IAAI,kBAErE,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,cAAc,KAAG,KAAK,IAAI,SAE5D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,GAAG,cAAc,KAAG,MAOvD,CAAA;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,CAGpD;AAID,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,WAAW,GAAG,IAAI,EAC1B,QAAQ;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAC,SASvD,CAAA;AA8BD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,eAAe,EACf,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,mBAA2B,EAC3B,WAAW,EACX,YAAY,EAAE,eAAe,GAC9B,EAAE,mBAAmB,GAAG,kBAAkB,CAkR1C"}
@@ -246,6 +246,7 @@ function usePaneWidth(t0) {
246
246
  t6 = $[16];
247
247
  }
248
248
  const [maxPaneWidth, setMaxPaneWidth] = React.useState(t6);
249
+ const maxPaneWidthRef = React.useRef(maxPaneWidth);
249
250
  let t7;
250
251
  let t8;
251
252
  if ($[17] !== currentWidth) {
@@ -335,15 +336,20 @@ function usePaneWidth(t0) {
335
336
  max: actualMax,
336
337
  current: currentWidthRef.current
337
338
  });
338
- startTransition(() => {
339
- setMaxPaneWidth(actualMax);
340
- if (wasClamped) {
341
- setCurrentWidthState(actualMax);
342
- }
343
- });
339
+ const maxChanged = actualMax !== maxPaneWidthRef.current;
340
+ if (maxChanged || wasClamped) {
341
+ maxPaneWidthRef.current = actualMax;
342
+ startTransition(() => {
343
+ setMaxPaneWidth(actualMax);
344
+ if (wasClamped) {
345
+ setCurrentWidthState(actualMax);
346
+ }
347
+ });
348
+ }
344
349
  };
345
350
  maxWidthDiffRef.current = getMaxWidthDiffFromViewport();
346
351
  const initialMax = getMaxPaneWidthRef.current();
352
+ maxPaneWidthRef.current = initialMax;
347
353
  setMaxPaneWidth(initialMax);
348
354
  (_paneRef$current3 = paneRef.current) === null || _paneRef$current3 === void 0 ? void 0 : _paneRef$current3.style.setProperty("--pane-max-width", `${initialMax}px`);
349
355
  updateAriaValues(handleRef.current, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.24.0-rc.76f4c2c0c",
4
+ "version": "38.24.0-rc.98bb12ac8",
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",
@@ -1,2 +0,0 @@
1
- .prc-ActionBar-List-9uz46{align-items:center;display:flex;gap:var(--actionbar-gap,var(--stack-gap-condensed,.5rem));list-style:none;margin-bottom:-1px;min-width:0;position:relative;white-space:nowrap}.prc-ActionBar-List-9uz46:where([data-gap=none]){--actionbar-gap:0}.prc-ActionBar-List-9uz46:where([data-gap=none]) .prc-ActionBar-Divider-6V8yH{padding:0 var(--base-size-8,.5rem)}.prc-ActionBar-List-9uz46:where([data-gap=condensed]){--actionbar-gap:var(--stack-gap-condensed,0.5rem)}.prc-ActionBar-Nav-9spON{align-items:center;display:flex;justify-content:flex-end;padding-inline:var(--base-size-16,1rem)}.prc-ActionBar-Nav-9spON:where([data-flush=true]){padding-inline:0}.prc-ActionBar-Divider-6V8yH:before{background:var(--borderColor-muted,#d1d9e0b3);content:"";display:block;height:var(--base-size-20,1.25rem);width:var(--borderWidth-thin,.0625rem)}.prc-ActionBar-Group-peNCk{display:flex;gap:inherit}
2
- /*# sourceMappingURL=ActionBar-a41224b2.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ActionBar/ActionBar.module.css.js"],"names":[],"mappings":"AAAA,0BAUE,kBAAmB,CARnB,YAAa,CASb,yDAAqD,CAFrD,eAAgB,CAFhB,kBAAmB,CAJnB,WAAY,CAFZ,iBAAkB,CAOlB,kBAiBF,CAXE,iDACE,iBAKF,CAHE,8EACE,kCACF,CAGF,sDACE,iDACF,CAGF,yBAIE,kBAAmB,CAHnB,YAAa,CAEb,wBAAyB,CADzB,uCAOF,CAHE,kDACE,gBACF,CAIA,oCAME,6CAAoC,CAFpC,UAAW,CAHX,aAAc,CAEd,kCAA2B,CAD3B,sCAKF,CAGF,2BACE,YAAa,CACb,WACF","file":"ActionBar-a41224b2.css","sourcesContent":[".List {\n position: relative;\n display: flex;\n min-width: 0;\n\n /* wonder why this is here */\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n white-space: nowrap;\n list-style: none;\n align-items: center;\n gap: var(--actionbar-gap, var(--stack-gap-condensed));\n\n /* Gap scale (mirrors Stack) */\n &:where([data-gap='none']) {\n --actionbar-gap: 0;\n\n .Divider {\n padding: 0 var(--base-size-8);\n }\n }\n\n &:where([data-gap='condensed']) {\n --actionbar-gap: var(--stack-gap-condensed);\n }\n}\n\n.Nav {\n display: flex;\n padding-inline: var(--base-size-16);\n justify-content: flex-end;\n align-items: center;\n\n &:where([data-flush='true']) {\n padding-inline: 0;\n }\n}\n\n.Divider {\n &::before {\n display: block;\n width: var(--borderWidth-thin);\n height: var(--base-size-20);\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background: var(--borderColor-muted);\n }\n}\n\n.Group {\n display: flex;\n gap: inherit;\n}\n"]}