@primer/react 38.0.0-rc.9 → 38.0.0-rc.95d10bdfe

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +314 -0
  2. package/dist/ActionBar/{ActionBar-3069d5f1.css → ActionBar-8ed12fe7.css} +2 -2
  3. package/dist/ActionBar/ActionBar-8ed12fe7.css.map +1 -0
  4. package/dist/ActionBar/ActionBar.d.ts +3 -0
  5. package/dist/ActionBar/ActionBar.d.ts.map +1 -1
  6. package/dist/ActionBar/ActionBar.js +292 -305
  7. package/dist/ActionBar/ActionBar.module.css.js +2 -2
  8. package/dist/ActionBar/index.d.ts +3 -0
  9. package/dist/ActionBar/index.d.ts.map +1 -1
  10. package/dist/ActionBar/index.js +3 -2
  11. package/dist/ActionList/index.d.ts +1 -1
  12. package/dist/Autocomplete/Autocomplete.d.ts +1 -1
  13. package/dist/BaseStyles.d.ts +2 -3
  14. package/dist/BaseStyles.d.ts.map +1 -1
  15. package/dist/BaseStyles.js +35 -61
  16. package/dist/LabelGroup/LabelGroup.d.ts.map +1 -1
  17. package/dist/LabelGroup/LabelGroup.js +1 -2
  18. package/dist/NavList/NavList.d.ts +1 -1
  19. package/dist/Overlay/Overlay.d.ts.map +1 -1
  20. package/dist/Overlay/Overlay.js +3 -6
  21. package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  22. package/dist/SegmentedControl/SegmentedControl.js +15 -9
  23. package/dist/SegmentedControl/SegmentedControlButton.d.ts +3 -1
  24. package/dist/SegmentedControl/SegmentedControlButton.d.ts.map +1 -1
  25. package/dist/SegmentedControl/SegmentedControlButton.js +76 -69
  26. package/dist/TextInput/TextInput.d.ts +1 -1
  27. package/dist/TextInputWithTokens/TextInputWithTokens.d.ts +5 -5
  28. package/dist/TextInputWithTokens/TextInputWithTokens.d.ts.map +1 -1
  29. package/dist/TextInputWithTokens/TextInputWithTokens.js +229 -249
  30. package/dist/ThemeProvider.d.ts +0 -1
  31. package/dist/ThemeProvider.d.ts.map +1 -1
  32. package/dist/ThemeProvider.js +9 -8
  33. package/dist/deprecated/ActionList/Item.d.ts.map +1 -1
  34. package/dist/deprecated/ActionList/Item.js +66 -71
  35. package/dist/{DialogV1 → deprecated/DialogV1}/Dialog-dce13989.css +1 -1
  36. package/dist/deprecated/DialogV1/Dialog-dce13989.css.map +1 -0
  37. package/dist/{DialogV1 → deprecated/DialogV1}/Dialog.d.ts +1 -1
  38. package/dist/deprecated/DialogV1/Dialog.d.ts.map +1 -0
  39. package/dist/{DialogV1 → deprecated/DialogV1}/Dialog.js +3 -3
  40. package/dist/deprecated/DialogV1/Dialog.module.css.js +5 -0
  41. package/dist/deprecated/DialogV1/index.d.ts.map +1 -0
  42. package/dist/deprecated/index.d.ts +2 -2
  43. package/dist/deprecated/index.d.ts.map +1 -1
  44. package/dist/deprecated/index.js +1 -1
  45. package/dist/index.d.ts +1 -1
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +1 -1
  48. package/dist/internal/components/TextInputInnerAction.d.ts +1 -1
  49. package/generated/components.json +85 -110
  50. package/package.json +3 -18
  51. package/dist/ActionBar/ActionBar-3069d5f1.css.map +0 -1
  52. package/dist/Box/Box.d.ts +0 -18
  53. package/dist/Box/Box.d.ts.map +0 -1
  54. package/dist/Box/index.d.ts +0 -3
  55. package/dist/Box/index.d.ts.map +0 -1
  56. package/dist/DialogV1/Dialog-dce13989.css.map +0 -1
  57. package/dist/DialogV1/Dialog.d.ts.map +0 -1
  58. package/dist/DialogV1/Dialog.module.css.js +0 -5
  59. package/dist/DialogV1/index.d.ts.map +0 -1
  60. package/dist/constants.d.ts +0 -15
  61. package/dist/constants.d.ts.map +0 -1
  62. package/dist/constants.js +0 -28
  63. package/dist/sx.d.ts +0 -24
  64. package/dist/sx.d.ts.map +0 -1
  65. package/dist/utils/layout.d.ts +0 -21
  66. package/dist/utils/layout.d.ts.map +0 -1
  67. /package/dist/{DialogV1 → deprecated/DialogV1}/index.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import React, { forwardRef, useRef, useState, useId } from 'react';
2
+ import React, { forwardRef, useRef, useState, useCallback, useId } from 'react';
3
3
  import { KebabHorizontalIcon } from '@primer/octicons-react';
4
4
  import { ActionList } from '../ActionList/index.js';
5
5
  import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
@@ -10,7 +10,7 @@ import { IconButton } from '../Button/IconButton.js';
10
10
  import { useFocusZone } from '../hooks/useFocusZone.js';
11
11
  import styles from './ActionBar.module.css.js';
12
12
  import { clsx } from 'clsx';
13
- import { jsxs, jsx } from 'react/jsx-runtime';
13
+ import { jsx, jsxs } from 'react/jsx-runtime';
14
14
  import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
15
15
  import { FocusKeys } from '@primer/behaviors';
16
16
  import { ActionMenu } from '../ActionMenu/ActionMenu.js';
@@ -26,7 +26,8 @@ const ActionBarContext = /*#__PURE__*/React.createContext({
26
26
  size: 'medium',
27
27
  registerChild: () => {},
28
28
  unregisterChild: () => {},
29
- isVisibleChild: () => true
29
+ isVisibleChild: () => true,
30
+ groupId: undefined
30
31
  });
31
32
 
32
33
  /*
@@ -50,7 +51,7 @@ const calculatePossibleItems = (registryEntries, navWidth, gap, moreMenuWidth =
50
51
  return breakpoint;
51
52
  };
52
53
  const getMenuItems = (navWidth, moreMenuWidth, childRegistry, hasActiveMenu, gap) => {
53
- const registryEntries = Array.from(childRegistry).filter(entry => entry[1] !== null);
54
+ const registryEntries = Array.from(childRegistry).filter(entry => entry[1] !== null && (entry[1].type !== 'action' || entry[1].groupId === undefined));
54
55
  if (registryEntries.length === 0) return new Set();
55
56
  const numberOfItemsPossible = calculatePossibleItems(registryEntries, navWidth, gap);
56
57
  const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(registryEntries, navWidth, gap, moreMenuWidth || MORE_BTN_WIDTH);
@@ -85,285 +86,178 @@ const getMenuItems = (navWidth, moreMenuWidth, childRegistry, hasActiveMenu, gap
85
86
  }
86
87
  };
87
88
  const ActionBar = props => {
88
- const $ = c(40);
89
89
  const {
90
- size: t0,
90
+ size = 'medium',
91
91
  children,
92
- "aria-label": ariaLabel,
93
- "aria-labelledby": ariaLabelledBy,
94
- flush: t1,
92
+ 'aria-label': ariaLabel,
93
+ 'aria-labelledby': ariaLabelledBy,
94
+ flush = false,
95
95
  className,
96
- gap: t2
96
+ gap = 'condensed'
97
97
  } = props;
98
- const size = t0 === undefined ? "medium" : t0;
99
- const flush = t1 === undefined ? false : t1;
100
- const gap = t2 === undefined ? "condensed" : t2;
98
+
99
+ // We derive the numeric gap from computed style so layout math stays in sync with CSS
101
100
  const listRef = useRef(null);
102
101
  const [computedGap, setComputedGap] = useState(ACTIONBAR_ITEM_GAP);
103
- const [childRegistry, setChildRegistry] = useState(_temp);
104
- let t3;
105
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
106
- t3 = (id, childProps) => setChildRegistry(prev => new Map(prev).set(id, childProps));
107
- $[0] = t3;
108
- } else {
109
- t3 = $[0];
110
- }
111
- const registerChild = t3;
112
- let t4;
113
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
114
- t4 = id_0 => setChildRegistry(prev_0 => new Map(prev_0).set(id_0, null));
115
- $[1] = t4;
116
- } else {
117
- t4 = $[1];
118
- }
119
- const unregisterChild = t4;
120
- const [menuItemIds, setMenuItemIds] = useState(_temp2);
102
+ const [childRegistry, setChildRegistry] = useState(() => new Map());
103
+ const registerChild = useCallback((id, childProps) => setChildRegistry(prev => new Map(prev).set(id, childProps)), []);
104
+ const unregisterChild = useCallback(id_0 => setChildRegistry(prev_0 => new Map(prev_0).set(id_0, null)), []);
105
+ const [menuItemIds, setMenuItemIds] = useState(() => new Set());
121
106
  const navRef = useRef(null);
122
- let t5;
123
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
124
- t5 = () => {
125
- if (!listRef.current) {
126
- return;
127
- }
128
- const g = window.getComputedStyle(listRef.current).gap;
129
- const parsed = parseFloat(g);
130
- if (!Number.isNaN(parsed)) {
131
- setComputedGap(parsed);
132
- }
133
- };
134
- $[2] = t5;
135
- } else {
136
- t5 = $[2];
137
- }
138
- let t6;
139
- if ($[3] !== gap) {
140
- t6 = [gap];
141
- $[3] = gap;
142
- $[4] = t6;
143
- } else {
144
- t6 = $[4];
145
- }
146
- useIsomorphicLayoutEffect(t5, t6);
107
+ // measure gap after first render & whenever gap scale changes
108
+ useIsomorphicLayoutEffect(() => {
109
+ if (!listRef.current) return;
110
+ const g = window.getComputedStyle(listRef.current).gap;
111
+ const parsed = parseFloat(g);
112
+ if (!Number.isNaN(parsed)) setComputedGap(parsed);
113
+ }, [gap]);
147
114
  const moreMenuRef = useRef(null);
148
115
  const moreMenuBtnRef = useRef(null);
149
116
  const containerRef = React.useRef(null);
150
- let t7;
151
- if ($[5] !== childRegistry || $[6] !== computedGap || $[7] !== menuItemIds.size) {
152
- t7 = resizeObserverEntries => {
153
- var _moreMenuRef$current$, _moreMenuRef$current;
154
- const navWidth = resizeObserverEntries[0].contentRect.width;
155
- 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;
156
- const hasActiveMenu = menuItemIds.size > 0;
157
- if (navWidth > 0) {
158
- const newMenuItemIds = getMenuItems(navWidth, moreMenuWidth, childRegistry, hasActiveMenu, computedGap);
159
- if (newMenuItemIds) {
160
- setMenuItemIds(newMenuItemIds);
161
- }
162
- }
163
- };
164
- $[5] = childRegistry;
165
- $[6] = computedGap;
166
- $[7] = menuItemIds.size;
167
- $[8] = t7;
168
- } else {
169
- t7 = $[8];
170
- }
171
- useResizeObserver(t7, navRef);
172
- let t8;
173
- if ($[9] !== menuItemIds) {
174
- t8 = id_1 => !menuItemIds.has(id_1);
175
- $[9] = menuItemIds;
176
- $[10] = t8;
177
- } else {
178
- t8 = $[10];
179
- }
180
- const isVisibleChild = t8;
117
+ useResizeObserver(resizeObserverEntries => {
118
+ var _moreMenuRef$current$, _moreMenuRef$current;
119
+ const navWidth = resizeObserverEntries[0].contentRect.width;
120
+ 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;
121
+ const hasActiveMenu = menuItemIds.size > 0;
122
+ if (navWidth > 0) {
123
+ const newMenuItemIds = getMenuItems(navWidth, moreMenuWidth, childRegistry, hasActiveMenu, computedGap);
124
+ if (newMenuItemIds) setMenuItemIds(newMenuItemIds);
125
+ }
126
+ }, navRef);
127
+ const isVisibleChild = useCallback(id_1 => {
128
+ return !menuItemIds.has(id_1);
129
+ }, [menuItemIds]);
181
130
  const [isWidgetOpen, setIsWidgetOpen] = useState(false);
182
- let t9;
183
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
184
- t9 = () => {
185
- setIsWidgetOpen(false);
186
- };
187
- $[11] = t9;
188
- } else {
189
- t9 = $[11];
190
- }
191
- const closeOverlay = t9;
192
- let t10;
193
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
194
- t10 = () => {
195
- var _moreMenuBtnRef$curre;
196
- (_moreMenuBtnRef$curre = moreMenuBtnRef.current) === null || _moreMenuBtnRef$curre === void 0 ? void 0 : _moreMenuBtnRef$curre.focus();
197
- };
198
- $[12] = t10;
199
- } else {
200
- t10 = $[12];
201
- }
202
- const focusOnMoreMenuBtn = t10;
203
- let t11;
204
- let t12;
205
- if ($[13] !== isWidgetOpen) {
206
- t11 = event => {
207
- if (isWidgetOpen) {
208
- event.preventDefault();
209
- closeOverlay();
210
- focusOnMoreMenuBtn();
131
+ const closeOverlay = React.useCallback(() => {
132
+ setIsWidgetOpen(false);
133
+ }, [setIsWidgetOpen]);
134
+ const focusOnMoreMenuBtn = React.useCallback(() => {
135
+ var _moreMenuBtnRef$curre;
136
+ (_moreMenuBtnRef$curre = moreMenuBtnRef.current) === null || _moreMenuBtnRef$curre === void 0 ? void 0 : _moreMenuBtnRef$curre.focus();
137
+ }, []);
138
+ useOnEscapePress(event => {
139
+ if (isWidgetOpen) {
140
+ event.preventDefault();
141
+ closeOverlay();
142
+ focusOnMoreMenuBtn();
143
+ }
144
+ }, [isWidgetOpen]);
145
+ useOnOutsideClick({
146
+ onClickOutside: closeOverlay,
147
+ containerRef,
148
+ ignoreClickRefs: [moreMenuBtnRef]
149
+ });
150
+ useFocusZone({
151
+ containerRef: listRef,
152
+ bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
153
+ focusOutBehavior: 'wrap'
154
+ });
155
+ const groupedItems = React.useMemo(() => {
156
+ const groupedItemsMap = new Map();
157
+ for (const [key, childProps_0] of childRegistry) {
158
+ if ((childProps_0 === null || childProps_0 === void 0 ? void 0 : childProps_0.type) === 'action' && childProps_0.groupId) {
159
+ const existingGroup = groupedItemsMap.get(childProps_0.groupId) || [];
160
+ existingGroup.push([key, childProps_0]);
161
+ groupedItemsMap.set(childProps_0.groupId, existingGroup);
211
162
  }
212
- };
213
- t12 = [isWidgetOpen];
214
- $[13] = isWidgetOpen;
215
- $[14] = t11;
216
- $[15] = t12;
217
- } else {
218
- t11 = $[14];
219
- t12 = $[15];
220
- }
221
- useOnEscapePress(t11, t12);
222
- let t13;
223
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
224
- t13 = {
225
- onClickOutside: closeOverlay,
226
- containerRef,
227
- ignoreClickRefs: [moreMenuBtnRef]
228
- };
229
- $[16] = t13;
230
- } else {
231
- t13 = $[16];
232
- }
233
- useOnOutsideClick(t13);
234
- let t14;
235
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
236
- t14 = {
237
- containerRef: listRef,
238
- bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
239
- focusOutBehavior: "wrap"
240
- };
241
- $[17] = t14;
242
- } else {
243
- t14 = $[17];
244
- }
245
- useFocusZone(t14);
246
- let t15;
247
- if ($[18] !== isVisibleChild || $[19] !== size) {
248
- t15 = {
163
+ }
164
+ return groupedItemsMap;
165
+ }, [childRegistry]);
166
+ return /*#__PURE__*/jsx(ActionBarContext.Provider, {
167
+ value: {
249
168
  size,
250
169
  registerChild,
251
170
  unregisterChild,
252
171
  isVisibleChild
253
- };
254
- $[18] = isVisibleChild;
255
- $[19] = size;
256
- $[20] = t15;
257
- } else {
258
- t15 = $[20];
259
- }
260
- let t16;
261
- if ($[21] !== className) {
262
- t16 = clsx(className, styles.Nav);
263
- $[21] = className;
264
- $[22] = t16;
265
- } else {
266
- t16 = $[22];
267
- }
268
- let t17;
269
- if ($[23] !== ariaLabel || $[24] !== childRegistry || $[25] !== menuItemIds) {
270
- t17 = menuItemIds.size > 0 && /*#__PURE__*/jsxs(ActionMenu, {
271
- children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
272
- children: /*#__PURE__*/jsx(IconButton, {
273
- variant: "invisible",
274
- "aria-label": `More ${ariaLabel} items`,
275
- icon: KebabHorizontalIcon
276
- })
277
- }), /*#__PURE__*/jsx(ActionMenu.Overlay, {
278
- children: /*#__PURE__*/jsx(ActionList, {
279
- children: Array.from(menuItemIds).map(id_2 => {
280
- const menuItem = childRegistry.get(id_2);
281
- if (!menuItem) {
282
- return null;
283
- }
284
- if (menuItem.type === "divider") {
285
- return /*#__PURE__*/jsx(ActionList.Divider, {}, id_2);
286
- } else {
287
- const {
288
- onClick,
289
- icon: Icon,
290
- label,
291
- disabled
292
- } = menuItem;
293
- return /*#__PURE__*/jsxs(ActionList.Item, {
294
- onClick: event_0 => {
295
- closeOverlay();
296
- focusOnMoreMenuBtn();
297
- typeof onClick === "function" && onClick(event_0);
298
- },
299
- disabled: disabled,
300
- children: [/*#__PURE__*/jsx(ActionList.LeadingVisual, {
301
- children: /*#__PURE__*/jsx(Icon, {})
302
- }), label]
303
- }, label);
304
- }
305
- })
306
- })
307
- })]
308
- });
309
- $[23] = ariaLabel;
310
- $[24] = childRegistry;
311
- $[25] = menuItemIds;
312
- $[26] = t17;
313
- } else {
314
- t17 = $[26];
315
- }
316
- let t18;
317
- if ($[27] !== ariaLabel || $[28] !== ariaLabelledBy || $[29] !== children || $[30] !== gap || $[31] !== t17) {
318
- t18 = /*#__PURE__*/jsxs("div", {
319
- ref: listRef,
320
- role: "toolbar",
321
- className: styles.List,
322
- "aria-label": ariaLabel,
323
- "aria-labelledby": ariaLabelledBy,
324
- "data-gap": gap,
325
- children: [children, t17]
326
- });
327
- $[27] = ariaLabel;
328
- $[28] = ariaLabelledBy;
329
- $[29] = children;
330
- $[30] = gap;
331
- $[31] = t17;
332
- $[32] = t18;
333
- } else {
334
- t18 = $[32];
335
- }
336
- let t19;
337
- if ($[33] !== flush || $[34] !== t16 || $[35] !== t18) {
338
- t19 = /*#__PURE__*/jsx("div", {
172
+ },
173
+ children: /*#__PURE__*/jsx("div", {
339
174
  ref: navRef,
340
- className: t16,
175
+ className: clsx(className, styles.Nav),
341
176
  "data-flush": flush,
342
- children: t18
343
- });
344
- $[33] = flush;
345
- $[34] = t16;
346
- $[35] = t18;
347
- $[36] = t19;
348
- } else {
349
- t19 = $[36];
350
- }
351
- let t20;
352
- if ($[37] !== t15 || $[38] !== t19) {
353
- t20 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
354
- value: t15,
355
- children: t19
356
- });
357
- $[37] = t15;
358
- $[38] = t19;
359
- $[39] = t20;
360
- } else {
361
- t20 = $[39];
362
- }
363
- return t20;
177
+ children: /*#__PURE__*/jsxs("div", {
178
+ ref: listRef,
179
+ role: "toolbar",
180
+ className: styles.List,
181
+ "aria-label": ariaLabel,
182
+ "aria-labelledby": ariaLabelledBy,
183
+ "data-gap": gap,
184
+ children: [children, menuItemIds.size > 0 && /*#__PURE__*/jsxs(ActionMenu, {
185
+ children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
186
+ children: /*#__PURE__*/jsx(IconButton, {
187
+ variant: "invisible",
188
+ "aria-label": `More ${ariaLabel} items`,
189
+ icon: KebabHorizontalIcon
190
+ })
191
+ }), /*#__PURE__*/jsx(ActionMenu.Overlay, {
192
+ children: /*#__PURE__*/jsx(ActionList, {
193
+ children: Array.from(menuItemIds).map(id_2 => {
194
+ const menuItem = childRegistry.get(id_2);
195
+ if (!menuItem) return null;
196
+ if (menuItem.type === 'divider') {
197
+ return /*#__PURE__*/jsx(ActionList.Divider, {}, id_2);
198
+ } else if (menuItem.type === 'action') {
199
+ const {
200
+ onClick,
201
+ icon: Icon,
202
+ label,
203
+ disabled
204
+ } = menuItem;
205
+ return /*#__PURE__*/jsxs(ActionList.Item, {
206
+ // eslint-disable-next-line primer-react/prefer-action-list-item-onselect
207
+ onClick: event_0 => {
208
+ closeOverlay();
209
+ focusOnMoreMenuBtn();
210
+ typeof onClick === 'function' && onClick(event_0);
211
+ },
212
+ disabled: disabled,
213
+ children: [/*#__PURE__*/jsx(ActionList.LeadingVisual, {
214
+ children: /*#__PURE__*/jsx(Icon, {})
215
+ }), label]
216
+ }, label);
217
+ }
218
+
219
+ // Use the memoized map instead of filtering each time
220
+ const groupedMenuItems = groupedItems.get(id_2) || [];
221
+
222
+ // If we ever add additional types, this condition will be necessary
223
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
224
+ if (menuItem.type === 'group') {
225
+ return /*#__PURE__*/jsx(React.Fragment, {
226
+ children: groupedMenuItems.map(([key_0, childProps_1]) => {
227
+ if (childProps_1.type === 'action') {
228
+ const {
229
+ onClick: onClick_0,
230
+ icon: Icon_0,
231
+ label: label_0,
232
+ disabled: disabled_0
233
+ } = childProps_1;
234
+ return /*#__PURE__*/jsxs(ActionList.Item, {
235
+ onSelect: event_1 => {
236
+ closeOverlay();
237
+ focusOnMoreMenuBtn();
238
+ typeof onClick_0 === 'function' && onClick_0(event_1);
239
+ },
240
+ disabled: disabled_0,
241
+ children: [/*#__PURE__*/jsx(ActionList.LeadingVisual, {
242
+ children: /*#__PURE__*/jsx(Icon_0, {})
243
+ }), label_0]
244
+ }, key_0);
245
+ }
246
+ return null;
247
+ })
248
+ }, id_2);
249
+ }
250
+ })
251
+ })
252
+ })]
253
+ })]
254
+ })
255
+ })
256
+ });
364
257
  };
258
+ ActionBar.displayName = "ActionBar";
365
259
  const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
366
- const $ = c(26);
260
+ const $ = c(28);
367
261
  let disabled;
368
262
  let onClick;
369
263
  let props;
@@ -391,9 +285,12 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
391
285
  unregisterChild,
392
286
  isVisibleChild
393
287
  } = React.useContext(ActionBarContext);
288
+ const {
289
+ groupId
290
+ } = React.useContext(ActionBarGroupContext);
394
291
  const widthRef = useRef();
395
292
  let t1;
396
- if ($[4] !== disabled || $[5] !== id || $[6] !== onClick || $[7] !== props || $[8] !== registerChild || $[9] !== unregisterChild) {
293
+ if ($[4] !== disabled || $[5] !== groupId || $[6] !== id || $[7] !== onClick || $[8] !== props || $[9] !== registerChild || $[10] !== unregisterChild) {
397
294
  t1 = () => {
398
295
  var _ref$current, _props$ariaLabel;
399
296
  const width = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect().width;
@@ -409,37 +306,41 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
409
306
  icon: props.icon,
410
307
  disabled: !!disabled,
411
308
  onClick: onClick,
412
- width: widthRef.current
309
+ width: widthRef.current,
310
+ groupId: groupId !== null && groupId !== void 0 ? groupId : undefined
413
311
  });
414
- return () => unregisterChild(id);
312
+ return () => {
313
+ unregisterChild(id);
314
+ };
415
315
  };
416
316
  $[4] = disabled;
417
- $[5] = id;
418
- $[6] = onClick;
419
- $[7] = props;
420
- $[8] = registerChild;
421
- $[9] = unregisterChild;
422
- $[10] = t1;
317
+ $[5] = groupId;
318
+ $[6] = id;
319
+ $[7] = onClick;
320
+ $[8] = props;
321
+ $[9] = registerChild;
322
+ $[10] = unregisterChild;
323
+ $[11] = t1;
423
324
  } else {
424
- t1 = $[10];
325
+ t1 = $[11];
425
326
  }
426
327
  const t2 = props["aria-label"];
427
328
  let t3;
428
- if ($[11] !== disabled || $[12] !== onClick || $[13] !== props.icon || $[14] !== registerChild || $[15] !== t2 || $[16] !== unregisterChild) {
329
+ if ($[12] !== disabled || $[13] !== onClick || $[14] !== props.icon || $[15] !== registerChild || $[16] !== t2 || $[17] !== unregisterChild) {
429
330
  t3 = [registerChild, unregisterChild, t2, props.icon, disabled, onClick];
430
- $[11] = disabled;
431
- $[12] = onClick;
432
- $[13] = props.icon;
433
- $[14] = registerChild;
434
- $[15] = t2;
435
- $[16] = unregisterChild;
436
- $[17] = t3;
331
+ $[12] = disabled;
332
+ $[13] = onClick;
333
+ $[14] = props.icon;
334
+ $[15] = registerChild;
335
+ $[16] = t2;
336
+ $[17] = unregisterChild;
337
+ $[18] = t3;
437
338
  } else {
438
- t3 = $[17];
339
+ t3 = $[18];
439
340
  }
440
341
  useIsomorphicLayoutEffect(t1, t3);
441
342
  let t4;
442
- if ($[18] !== disabled || $[19] !== onClick) {
343
+ if ($[19] !== disabled || $[20] !== onClick) {
443
344
  t4 = event => {
444
345
  var _onClick;
445
346
  if (disabled) {
@@ -447,33 +348,125 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
447
348
  }
448
349
  (_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick(event);
449
350
  };
450
- $[18] = disabled;
451
- $[19] = onClick;
452
- $[20] = t4;
351
+ $[19] = disabled;
352
+ $[20] = onClick;
353
+ $[21] = t4;
453
354
  } else {
454
- t4 = $[20];
355
+ t4 = $[21];
455
356
  }
456
357
  const clickHandler = t4;
457
- if (!isVisibleChild(id)) {
358
+ if (!isVisibleChild(id) || groupId && !isVisibleChild(groupId)) {
458
359
  return null;
459
360
  }
460
361
  let t5;
461
- if ($[21] !== clickHandler || $[22] !== disabled || $[23] !== props || $[24] !== size) {
362
+ if ($[22] !== clickHandler || $[23] !== disabled || $[24] !== id || $[25] !== props || $[26] !== size) {
462
363
  t5 = /*#__PURE__*/jsx(IconButton, {
463
364
  "aria-disabled": disabled,
464
365
  ref: ref,
465
366
  size: size,
466
367
  onClick: clickHandler,
467
368
  ...props,
468
- variant: "invisible"
369
+ variant: "invisible",
370
+ "data-testid": id
469
371
  });
470
- $[21] = clickHandler;
471
- $[22] = disabled;
472
- $[23] = props;
473
- $[24] = size;
474
- $[25] = t5;
372
+ $[22] = clickHandler;
373
+ $[23] = disabled;
374
+ $[24] = id;
375
+ $[25] = props;
376
+ $[26] = size;
377
+ $[27] = t5;
475
378
  } else {
476
- t5 = $[25];
379
+ t5 = $[27];
380
+ }
381
+ return t5;
382
+ });
383
+ const ActionBarGroupContext = /*#__PURE__*/React.createContext({
384
+ groupId: null
385
+ });
386
+ const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
387
+ const $ = c(16);
388
+ const {
389
+ children
390
+ } = t0;
391
+ const backupRef = useRef(null);
392
+ const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
393
+ const id = useId();
394
+ const {
395
+ registerChild,
396
+ unregisterChild
397
+ } = React.useContext(ActionBarContext);
398
+ const widthRef = useRef();
399
+ let t1;
400
+ if ($[0] !== id || $[1] !== ref || $[2] !== registerChild || $[3] !== unregisterChild) {
401
+ t1 = () => {
402
+ var _ref$current2;
403
+ const width = (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getBoundingClientRect().width;
404
+ if (width) {
405
+ widthRef.current = width;
406
+ }
407
+ if (!widthRef.current) {
408
+ return;
409
+ }
410
+ registerChild(id, {
411
+ type: "group",
412
+ width: widthRef.current
413
+ });
414
+ return () => {
415
+ unregisterChild(id);
416
+ };
417
+ };
418
+ $[0] = id;
419
+ $[1] = ref;
420
+ $[2] = registerChild;
421
+ $[3] = unregisterChild;
422
+ $[4] = t1;
423
+ } else {
424
+ t1 = $[4];
425
+ }
426
+ let t2;
427
+ if ($[5] !== registerChild || $[6] !== unregisterChild) {
428
+ t2 = [registerChild, unregisterChild];
429
+ $[5] = registerChild;
430
+ $[6] = unregisterChild;
431
+ $[7] = t2;
432
+ } else {
433
+ t2 = $[7];
434
+ }
435
+ useIsomorphicLayoutEffect(t1, t2);
436
+ let t3;
437
+ if ($[8] !== id) {
438
+ t3 = {
439
+ groupId: id
440
+ };
441
+ $[8] = id;
442
+ $[9] = t3;
443
+ } else {
444
+ t3 = $[9];
445
+ }
446
+ let t4;
447
+ if ($[10] !== children || $[11] !== ref) {
448
+ t4 = /*#__PURE__*/jsx("div", {
449
+ className: styles.Group,
450
+ ref: ref,
451
+ children: children
452
+ });
453
+ $[10] = children;
454
+ $[11] = ref;
455
+ $[12] = t4;
456
+ } else {
457
+ t4 = $[12];
458
+ }
459
+ let t5;
460
+ if ($[13] !== t3 || $[14] !== t4) {
461
+ t5 = /*#__PURE__*/jsx(ActionBarGroupContext.Provider, {
462
+ value: t3,
463
+ children: t4
464
+ });
465
+ $[13] = t3;
466
+ $[14] = t4;
467
+ $[15] = t5;
468
+ } else {
469
+ t5 = $[15];
477
470
  }
478
471
  return t5;
479
472
  });
@@ -490,8 +483,8 @@ const VerticalDivider = () => {
490
483
  let t0;
491
484
  if ($[0] !== id || $[1] !== registerChild || $[2] !== unregisterChild) {
492
485
  t0 = () => {
493
- var _ref$current2;
494
- const width = (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getBoundingClientRect().width;
486
+ var _ref$current3;
487
+ const width = (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.getBoundingClientRect().width;
495
488
  if (width) {
496
489
  widthRef.current = width;
497
490
  }
@@ -538,11 +531,5 @@ const VerticalDivider = () => {
538
531
  }
539
532
  return t2;
540
533
  };
541
- function _temp() {
542
- return new Map();
543
- }
544
- function _temp2() {
545
- return new Set();
546
- }
547
534
 
548
- export { ActionBar, ActionBarIconButton, VerticalDivider };
535
+ export { ActionBar, ActionBarGroup, ActionBarIconButton, VerticalDivider };