@primer/react 38.24.0-rc.4089ee5c5 → 38.24.0-rc.76f4c2c0c

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,8 +22,6 @@
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
-
27
25
  - [#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.
28
26
 
29
27
  ### Patch Changes
@@ -0,0 +1,2 @@
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 */
@@ -0,0 +1 @@
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"]}
@@ -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;
123
+ export declare const VerticalDivider: () => React.JSX.Element | null;
124
124
  export {};
125
125
  //# sourceMappingURL=ActionBar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../src/ActionBar/ActionBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiF,MAAM,OAAO,CAAA;AAErG,OAAO,EAAa,KAAK,mBAAmB,EAAC,MAAM,eAAe,CAAA;AAElE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAA;AAmC9C,KAAK,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAExC,KAAK,SAAS,GACV;IACE,wDAAwD;IACxD,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IAChD,iBAAiB,CAAC,EAAE,SAAS,CAAA;CAC9B,GACD;IACE,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB;;OAEG;IACH,iBAAiB,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC3D,CAAA;AAEL,KAAK,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;AAEpC,MAAM,MAAM,cAAc,GAAG;IAC3B;;;SAGK;IACL,IAAI,CAAC,EAAE,IAAI,CAAA;IAEX,gCAAgC;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IAEzB;;;SAGK;IACL,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAA;CACf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F,eAAO,MAAM,aAAa;IA9YxB,2CAA2C;kBAC7B,MAAM;IACpB,+BAA+B;UACzB,wBAAwB,CAAC,MAAM,CAAC;WAC/B,sBAAsB,EAAE;IAC/B;;;OAGG;mBACY,wBAAwB,CAAC,MAAM,CAAC,GAAG,MAAM;IACxD;;OAEG;qBACc,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;;;;;;wGAgb9C,CAAA;AAED,eAAO,MAAM,eAAe,gCAY3B,CAAA"}
@@ -1,27 +1,53 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import React, { forwardRef, useRef, useState, useMemo, useCallback, useContext, useSyncExternalStore } from 'react';
2
+ import React, { useRef, useState, forwardRef, useMemo, useCallback } 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';
5
7
  import { IconButton } from '../Button/IconButton.js';
6
8
  import { useFocusZone } from '../hooks/useFocusZone.js';
7
9
  import styles from './ActionBar.module.css.js';
8
10
  import { clsx } from 'clsx';
9
11
  import { createDescendantRegistry } from '../utils/descendant-registry.js';
10
- import { jsx, jsxs } from 'react/jsx-runtime';
12
+ import { jsxs, jsx } from 'react/jsx-runtime';
11
13
  import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
12
14
  import { FocusKeys } from '@primer/behaviors';
13
15
  import { ActionMenu } from '../ActionMenu/ActionMenu.js';
14
16
 
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
+
15
24
  const ActionBarContext = /*#__PURE__*/React.createContext({
16
- size: 'medium'
25
+ size: 'medium',
26
+ isVisibleChild: () => true,
27
+ groupId: undefined
17
28
  });
18
29
 
19
30
  /*
20
31
  small (28px), medium (32px), large (40px)
21
32
  */
22
33
 
34
+ const MORE_BTN_WIDTH = 32;
23
35
  const ActionBarItemsRegistry = createDescendantRegistry();
24
- const FOCUSABLE_ITEM_SELECTOR = ':is(button, a, input, [tabindex]):not(:disabled):not([data-overflowing]):not([data-more-button-inactive])';
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
+ };
25
51
  const renderMenuItem = (item, index) => {
26
52
  if (item.type === 'divider') {
27
53
  return /*#__PURE__*/jsx(ActionList.Divider, {}, index);
@@ -70,258 +96,328 @@ const renderMenuItem = (item, index) => {
70
96
  }, label);
71
97
  };
72
98
  renderMenuItem.displayName = "renderMenuItem";
73
- const ActionBar = t0 => {
74
- const $ = c(40);
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);
75
137
  const {
76
- size: t1,
138
+ size: t0,
77
139
  children,
78
140
  "aria-label": ariaLabel,
79
141
  "aria-labelledby": ariaLabelledBy,
80
- flush: t2,
142
+ flush: t1,
81
143
  className,
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;
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);
87
151
  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
+ }
88
170
  let t4;
89
- if ($[0] !== childRegistry) {
90
- t4 = childRegistry && Array.from(childRegistry.entries()).filter(_temp);
91
- $[0] = childRegistry;
92
- $[1] = t4;
171
+ if ($[1] !== gap) {
172
+ t4 = [gap];
173
+ $[1] = gap;
174
+ $[2] = t4;
93
175
  } else {
94
- t4 = $[1];
176
+ t4 = $[2];
95
177
  }
96
- const overflowItems = t4;
178
+ useIsomorphicLayoutEffect(t3, t4);
179
+ const moreMenuRef = useRef(null);
97
180
  let t5;
98
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
99
- t5 = {
100
- bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
101
- focusOutBehavior: "wrap",
102
- focusableElementFilter: _temp2
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
+ }
103
193
  };
104
- $[2] = t5;
194
+ $[3] = childRegistry;
195
+ $[4] = computedGap;
196
+ $[5] = menuItemIds.size;
197
+ $[6] = t5;
105
198
  } else {
106
- t5 = $[2];
199
+ t5 = $[6];
107
200
  }
201
+ useResizeObserver(t5, navRef);
108
202
  let t6;
109
- if ($[3] !== overflowItems) {
110
- t6 = [overflowItems];
111
- $[3] = overflowItems;
112
- $[4] = t6;
203
+ if ($[7] !== menuItemIds) {
204
+ t6 = id => !menuItemIds.has(id);
205
+ $[7] = menuItemIds;
206
+ $[8] = t6;
113
207
  } else {
114
- t6 = $[4];
208
+ t6 = $[8];
115
209
  }
116
- const {
117
- containerRef
118
- } = useFocusZone(t5, t6);
210
+ const isVisibleChild = t6;
119
211
  let t7;
120
- if ($[5] !== size) {
212
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
121
213
  t7 = {
122
- size
214
+ containerRef: listRef,
215
+ bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
216
+ focusOutBehavior: "wrap"
123
217
  };
124
- $[5] = size;
125
- $[6] = t7;
126
- } else {
127
- t7 = $[6];
128
- }
129
- let t8;
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;
218
+ $[9] = t7;
145
219
  } 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;
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;
160
235
  } else {
161
- t12 = $[12];
236
+ groupedItemsMap = $[11];
162
237
  }
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
- });
238
+ const groupedItems = groupedItemsMap;
239
+ let t8;
240
+ if ($[12] !== isVisibleChild || $[13] !== size) {
241
+ t8 = {
242
+ size,
243
+ isVisibleChild
244
+ };
245
+ $[12] = isVisibleChild;
177
246
  $[13] = size;
178
- $[14] = t13;
179
- $[15] = t14;
180
- $[16] = t15;
247
+ $[14] = t8;
181
248
  } else {
182
- t15 = $[16];
249
+ t8 = $[14];
183
250
  }
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;
251
+ let t9;
252
+ if ($[15] !== className) {
253
+ t9 = clsx(className, styles.Nav);
254
+ $[15] = className;
255
+ $[16] = t9;
189
256
  } else {
190
- t16 = $[18];
257
+ t9 = $[16];
191
258
  }
192
- let t17;
193
- if ($[19] !== t16) {
194
- t17 = /*#__PURE__*/jsx(ActionMenu.Overlay, {
195
- children: /*#__PURE__*/jsx(ActionList, {
196
- children: t16
197
- })
259
+ let t10;
260
+ if ($[17] !== children || $[18] !== setChildRegistry) {
261
+ t10 = /*#__PURE__*/jsx(ActionBarItemsRegistry.Provider, {
262
+ setRegistry: setChildRegistry,
263
+ children: children
198
264
  });
199
- $[19] = t16;
200
- $[20] = t17;
265
+ $[17] = children;
266
+ $[18] = setChildRegistry;
267
+ $[19] = t10;
201
268
  } else {
202
- t17 = $[20];
269
+ t10 = $[19];
203
270
  }
204
- let t18;
205
- if ($[21] !== t15 || $[22] !== t17) {
206
- t18 = /*#__PURE__*/jsxs(ActionMenu, {
207
- children: [t15, t17]
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
+ })]
208
341
  });
209
- $[21] = t15;
210
- $[22] = t17;
211
- $[23] = t18;
342
+ $[20] = ariaLabel;
343
+ $[21] = childRegistry;
344
+ $[22] = groupedItems;
345
+ $[23] = menuItemIds;
346
+ $[24] = t11;
212
347
  } else {
213
- t18 = $[23];
348
+ t11 = $[24];
214
349
  }
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,
350
+ let t12;
351
+ if ($[25] !== ariaLabel || $[26] !== ariaLabelledBy || $[27] !== gap || $[28] !== t10 || $[29] !== t11) {
352
+ t12 = /*#__PURE__*/jsxs("div", {
353
+ ref: listRef,
219
354
  role: "toolbar",
220
355
  className: styles.List,
221
356
  "aria-label": ariaLabel,
222
357
  "aria-labelledby": ariaLabelledBy,
223
358
  "data-gap": gap,
224
- "data-size": size,
225
- "data-has-overflow": t10,
226
- children: [t12, t18]
359
+ children: [t10, t11]
227
360
  });
228
- $[24] = ariaLabel;
229
- $[25] = ariaLabelledBy;
230
- $[26] = gap;
231
- $[27] = size;
361
+ $[25] = ariaLabel;
362
+ $[26] = ariaLabelledBy;
363
+ $[27] = gap;
232
364
  $[28] = t10;
233
- $[29] = t12;
234
- $[30] = t18;
235
- $[31] = t9;
236
- $[32] = t19;
365
+ $[29] = t11;
366
+ $[30] = t12;
237
367
  } else {
238
- t19 = $[32];
368
+ t12 = $[30];
239
369
  }
240
- let t20;
241
- if ($[33] !== flush || $[34] !== t19 || $[35] !== t8) {
242
- t20 = /*#__PURE__*/jsx("div", {
243
- className: t8,
370
+ let t13;
371
+ if ($[31] !== flush || $[32] !== t12 || $[33] !== t9) {
372
+ t13 = /*#__PURE__*/jsx("div", {
373
+ ref: navRef,
374
+ className: t9,
244
375
  "data-component": "ActionBar",
245
376
  "data-flush": flush,
246
- children: t19
377
+ children: t12
247
378
  });
248
- $[33] = flush;
249
- $[34] = t19;
250
- $[35] = t8;
251
- $[36] = t20;
379
+ $[31] = flush;
380
+ $[32] = t12;
381
+ $[33] = t9;
382
+ $[34] = t13;
252
383
  } else {
253
- t20 = $[36];
384
+ t13 = $[34];
254
385
  }
255
- let t21;
256
- if ($[37] !== t20 || $[38] !== t7) {
257
- t21 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
258
- value: t7,
259
- children: t20
386
+ let t14;
387
+ if ($[35] !== t13 || $[36] !== t8) {
388
+ t14 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
389
+ value: t8,
390
+ children: t13
260
391
  });
261
- $[37] = t20;
262
- $[38] = t7;
263
- $[39] = t21;
392
+ $[35] = t13;
393
+ $[36] = t8;
394
+ $[37] = t14;
264
395
  } else {
265
- t21 = $[39];
396
+ t14 = $[37];
266
397
  }
267
- return t21;
398
+ return t14;
268
399
  };
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;
400
+ function useWidth(ref) {
401
+ const $ = c(3);
402
+ const [width, setWidth] = useState(-1);
274
403
  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;
295
404
  let t1;
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
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);
312
409
  };
313
- $[5] = isOverflowing;
314
- $[6] = t2;
315
- $[7] = t3;
410
+ t1 = [ref];
411
+ $[0] = ref;
412
+ $[1] = t0;
413
+ $[2] = t1;
316
414
  } else {
317
- t3 = $[7];
415
+ t0 = $[1];
416
+ t1 = $[2];
318
417
  }
319
- return t3;
320
- }
321
- function _temp6() {
322
- return false;
418
+ useIsomorphicLayoutEffect(t0, t1);
419
+ return width;
323
420
  }
324
- function _temp5() {}
325
421
  const ActionBarIconButton = /*#__PURE__*/forwardRef(({
326
422
  disabled,
327
423
  onClick,
@@ -330,36 +426,44 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef(({
330
426
  const ref = useRef(null);
331
427
  useRefObjectAsForwardedRef(forwardedRef, ref);
332
428
  const {
333
- size
429
+ size,
430
+ isVisibleChild
334
431
  } = React.useContext(ActionBarContext);
432
+ const {
433
+ groupId
434
+ } = React.useContext(ActionBarGroupContext);
435
+ const width = useWidth(ref);
335
436
  const {
336
437
  ['aria-label']: ariaLabel,
337
438
  icon
338
439
  } = props;
339
- const {
340
- dataOverflowingAttr
341
- } = useActionBarItem(ref, useMemo(() => ({
440
+ const registryProps = useMemo(() => ({
342
441
  type: 'action',
343
442
  label: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : '',
344
443
  icon,
345
444
  disabled: !!disabled,
346
- onClick: onClick
347
- }), [ariaLabel, icon, disabled, onClick]));
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);
348
450
  const clickHandler = useCallback(event => {
349
451
  if (disabled) return;
350
452
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
351
453
  }, [disabled, onClick]);
454
+ if (!isVisibleChild(id) || groupId && !isVisibleChild(groupId)) return null;
352
455
  return /*#__PURE__*/jsx(IconButton, {
353
456
  "aria-disabled": disabled,
354
457
  ref: ref,
355
458
  size: size,
356
459
  onClick: clickHandler,
357
460
  ...props,
358
- variant: "invisible",
359
- "data-overflowing": dataOverflowingAttr
461
+ variant: "invisible"
360
462
  });
361
463
  });
362
- const ActionBarGroupContext = /*#__PURE__*/React.createContext(null);
464
+ const ActionBarGroupContext = /*#__PURE__*/React.createContext({
465
+ groupId: null
466
+ });
363
467
  const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
364
468
  const $ = c(10);
365
469
  const {
@@ -367,40 +471,39 @@ const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
367
471
  } = t0;
368
472
  const backupRef = useRef(null);
369
473
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
474
+ const width = useWidth(ref);
370
475
  let t1;
371
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
476
+ if ($[0] !== width) {
372
477
  t1 = {
373
- type: "group"
478
+ type: "group",
479
+ width
374
480
  };
375
- $[0] = t1;
481
+ $[0] = width;
482
+ $[1] = t1;
376
483
  } else {
377
- t1 = $[0];
484
+ t1 = $[1];
378
485
  }
379
- const {
380
- dataOverflowingAttr,
381
- isOverflowing
382
- } = useActionBarItem(ref, t1);
486
+ const registryProps = t1;
487
+ const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
383
488
  let t2;
384
- if ($[1] !== isOverflowing) {
489
+ if ($[2] !== id) {
385
490
  t2 = {
386
- isOverflowing
491
+ groupId: id
387
492
  };
388
- $[1] = isOverflowing;
389
- $[2] = t2;
493
+ $[2] = id;
494
+ $[3] = t2;
390
495
  } else {
391
- t2 = $[2];
496
+ t2 = $[3];
392
497
  }
393
498
  let t3;
394
- if ($[3] !== children || $[4] !== dataOverflowingAttr || $[5] !== ref) {
499
+ if ($[4] !== children || $[5] !== ref) {
395
500
  t3 = /*#__PURE__*/jsx("div", {
396
501
  className: styles.Group,
397
502
  "data-component": "ActionBar.Group",
398
503
  ref: ref,
399
- "data-overflowing": dataOverflowingAttr,
400
504
  children: children
401
505
  });
402
- $[3] = children;
403
- $[4] = dataOverflowingAttr;
506
+ $[4] = children;
404
507
  $[5] = ref;
405
508
  $[6] = t3;
406
509
  } else {
@@ -454,12 +557,17 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
454
557
  }
455
558
  const backupRef = useRef(null);
456
559
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
560
+ const {
561
+ isVisibleChild
562
+ } = React.useContext(ActionBarContext);
457
563
  const [menuOpen, setMenuOpen] = useState(false);
564
+ const width = useWidth(ref);
458
565
  const t1 = overflowIcon ? overflowIcon : icon;
459
566
  let t2;
460
- if ($[7] !== ariaLabel || $[8] !== items || $[9] !== returnFocusRef || $[10] !== t1) {
567
+ if ($[7] !== ariaLabel || $[8] !== items || $[9] !== returnFocusRef || $[10] !== t1 || $[11] !== width) {
461
568
  t2 = {
462
569
  type: "menu",
570
+ width,
463
571
  label: ariaLabel,
464
572
  icon: t1,
465
573
  returnFocusRef,
@@ -469,27 +577,28 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
469
577
  $[8] = items;
470
578
  $[9] = returnFocusRef;
471
579
  $[10] = t1;
472
- $[11] = t2;
580
+ $[11] = width;
581
+ $[12] = t2;
473
582
  } else {
474
- t2 = $[11];
583
+ t2 = $[12];
584
+ }
585
+ const registryProps = t2;
586
+ const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
587
+ if (!isVisibleChild(id)) {
588
+ return null;
475
589
  }
476
- const {
477
- dataOverflowingAttr
478
- } = useActionBarItem(ref, t2);
479
590
  let t3;
480
- if ($[12] !== ariaLabel || $[13] !== dataOverflowingAttr || $[14] !== icon || $[15] !== props) {
591
+ if ($[13] !== ariaLabel || $[14] !== icon || $[15] !== props) {
481
592
  t3 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
482
593
  children: /*#__PURE__*/jsx(IconButton, {
483
594
  variant: "invisible",
484
595
  "aria-label": ariaLabel,
485
596
  icon: icon,
486
597
  ...props,
487
- "data-overflowing": dataOverflowingAttr,
488
598
  "data-component": "ActionBar.Menu.IconButton"
489
599
  })
490
600
  });
491
- $[12] = ariaLabel;
492
- $[13] = dataOverflowingAttr;
601
+ $[13] = ariaLabel;
493
602
  $[14] = icon;
494
603
  $[15] = props;
495
604
  $[16] = t3;
@@ -508,7 +617,7 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
508
617
  }
509
618
  let t5;
510
619
  if ($[19] !== items) {
511
- t5 = items.map(_temp7);
620
+ t5 = items.map(_temp4);
512
621
  $[19] = items;
513
622
  $[20] = t5;
514
623
  } else {
@@ -557,91 +666,68 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
557
666
  const VerticalDivider = () => {
558
667
  const $ = c(3);
559
668
  const ref = useRef(null);
669
+ const {
670
+ isVisibleChild
671
+ } = React.useContext(ActionBarContext);
672
+ const width = useWidth(ref);
560
673
  let t0;
561
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
674
+ if ($[0] !== width) {
562
675
  t0 = {
563
- type: "divider"
676
+ type: "divider",
677
+ width
564
678
  };
565
- $[0] = t0;
679
+ $[0] = width;
680
+ $[1] = t0;
566
681
  } else {
567
- t0 = $[0];
682
+ t0 = $[1];
683
+ }
684
+ const registryProps = t0;
685
+ const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
686
+ if (!isVisibleChild(id)) {
687
+ return null;
568
688
  }
569
- const {
570
- dataOverflowingAttr
571
- } = useActionBarItem(ref, t0);
572
689
  let t1;
573
- if ($[1] !== dataOverflowingAttr) {
690
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
574
691
  t1 = /*#__PURE__*/jsx("div", {
575
692
  ref: ref,
576
693
  "data-component": "ActionBar.VerticalDivider",
577
694
  "aria-hidden": "true",
578
- className: styles.Divider,
579
- "data-overflowing": dataOverflowingAttr
695
+ className: styles.Divider
580
696
  });
581
- $[1] = dataOverflowingAttr;
582
697
  $[2] = t1;
583
698
  } else {
584
699
  t1 = $[2];
585
700
  }
586
701
  return t1;
587
702
  };
588
- function _temp(entry) {
589
- return entry[1] !== null;
703
+ function _temp() {
704
+ return new Set();
590
705
  }
591
- function _temp2(element) {
592
- return element.matches(FOCUSABLE_ITEM_SELECTOR);
593
- }
594
- function _temp3(item, index) {
706
+ function _temp2(item, index) {
595
707
  return renderMenuItem(item, index);
596
708
  }
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") {
709
+ function _temp3(t0) {
710
+ const [key_0, childProps_0] = t0;
711
+ if (childProps_0.type === "action") {
603
712
  const {
604
- onClick,
605
- icon: Icon,
606
- label,
607
- disabled
608
- } = menuItem;
713
+ onClick: onClick_0,
714
+ icon: Icon_1,
715
+ label: label_1,
716
+ disabled: disabled_0
717
+ } = childProps_0;
609
718
  return /*#__PURE__*/jsxs(ActionList.Item, {
610
- onSelect: event => {
611
- typeof onClick === "function" && onClick(event);
719
+ onSelect: event_0 => {
720
+ typeof onClick_0 === "function" && onClick_0(event_0);
612
721
  },
613
- disabled: disabled,
722
+ disabled: disabled_0,
614
723
  children: [/*#__PURE__*/jsx(ActionList.LeadingVisual, {
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);
724
+ children: /*#__PURE__*/jsx(Icon_1, {})
725
+ }), label_1]
726
+ }, key_0);
642
727
  }
728
+ return null;
643
729
  }
644
- function _temp7(item, index) {
730
+ function _temp4(item, index) {
645
731
  return renderMenuItem(item, index);
646
732
  }
647
733
 
@@ -1,5 +1,5 @@
1
- import './ActionBar-e63def3c.css';
1
+ import './ActionBar-a41224b2.css';
2
2
 
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"};
3
+ var styles = {"List":"prc-ActionBar-List-9uz46","Divider":"prc-ActionBar-Divider-6V8yH","Nav":"prc-ActionBar-Nav-9spON","Group":"prc-ActionBar-Group-peNCk"};
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;
4
+ Divider: () => import("react").JSX.Element | null;
5
5
  Group: import("react").ForwardRefExoticComponent<{
6
6
  children?: import("react").ReactNode | undefined;
7
7
  } & import("react").RefAttributes<unknown>>;
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.4089ee5c5",
4
+ "version": "38.24.0-rc.76f4c2c0c",
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: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 */
@@ -1 +0,0 @@
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"]}