@primer/react 0.0.0-20260225195902 → 0.0.0-20260225200356

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 (75) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/dist/ActionBar/ActionBar.d.ts.map +1 -1
  3. package/dist/ActionBar/ActionBar.js +397 -304
  4. package/dist/ActionList/ActionList-c04a02d6.css +2 -0
  5. package/dist/ActionList/ActionList-c04a02d6.css.map +1 -0
  6. package/dist/ActionList/ActionList.module.css.js +1 -1
  7. package/dist/ActionList/Item.d.ts.map +1 -1
  8. package/dist/ActionList/Item.js +1 -0
  9. package/dist/Autocomplete/Autocomplete.js +76 -159
  10. package/dist/Autocomplete/AutocompleteMenu.js +128 -333
  11. package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
  12. package/dist/Banner/Banner.js +64 -238
  13. package/dist/Blankslate/{Blankslate-f5a9755a.css → Blankslate-a039d79a.css} +2 -2
  14. package/dist/Blankslate/Blankslate-a039d79a.css.map +1 -0
  15. package/dist/Blankslate/Blankslate.module.css.js +1 -1
  16. package/dist/Button/ButtonBase.d.ts.map +1 -1
  17. package/dist/Button/ButtonBase.js +9 -14
  18. package/dist/Checkbox/Checkbox.js +55 -163
  19. package/dist/Dialog/Dialog.js +105 -347
  20. package/dist/FilteredActionList/FilteredActionList-02db90c6.css +2 -0
  21. package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +1 -0
  22. package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
  23. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  24. package/dist/FilteredActionList/FilteredActionList.js +147 -42
  25. package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
  26. package/dist/PageLayout/PageLayout-06f4c069.css +2 -0
  27. package/dist/PageLayout/PageLayout-06f4c069.css.map +1 -0
  28. package/dist/PageLayout/PageLayout.d.ts +72 -2
  29. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  30. package/dist/PageLayout/PageLayout.js +750 -1235
  31. package/dist/PageLayout/PageLayout.module.css.js +2 -2
  32. package/dist/PageLayout/usePaneWidth.d.ts +18 -5
  33. package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
  34. package/dist/PageLayout/usePaneWidth.js +125 -111
  35. package/dist/SelectPanel/SelectPanel.d.ts +1 -1
  36. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  37. package/dist/SelectPanel/SelectPanel.js +3 -1
  38. package/dist/SplitPageLayout/SplitPageLayout.d.ts +4 -1
  39. package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
  40. package/dist/SplitPageLayout/SplitPageLayout.js +54 -2
  41. package/dist/Text/Text.d.ts +1 -1
  42. package/dist/Text/Text.d.ts.map +1 -1
  43. package/dist/Text/Text.js +10 -13
  44. package/dist/Timeline/Timeline-c328e93a.css +2 -0
  45. package/dist/Timeline/Timeline-c328e93a.css.map +1 -0
  46. package/dist/Timeline/Timeline.module.css.js +1 -1
  47. package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
  48. package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +2 -0
  49. package/dist/experimental/SelectPanel2/{SelectPanel-1f8c23b5.css.map → SelectPanel-f0c4b9ca.css.map} +1 -1
  50. package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
  51. package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
  52. package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
  53. package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
  54. package/dist/hooks/useScrollFlash.d.ts.map +1 -1
  55. package/dist/hooks/useScrollFlash.js +14 -22
  56. package/dist/hooks/useSlots.d.ts +50 -6
  57. package/dist/hooks/useSlots.d.ts.map +1 -1
  58. package/dist/hooks/useSlots.js +114 -36
  59. package/dist/live-region/Announce.d.ts.map +1 -1
  60. package/dist/live-region/Announce.js +7 -4
  61. package/generated/components.json +194 -2
  62. package/package.json +3 -3
  63. package/dist/ActionList/ActionList-f4ac3b54.css +0 -2
  64. package/dist/ActionList/ActionList-f4ac3b54.css.map +0 -1
  65. package/dist/Blankslate/Blankslate-f5a9755a.css.map +0 -1
  66. package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +0 -2
  67. package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +0 -1
  68. package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
  69. package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
  70. package/dist/Timeline/Timeline-116393ee.css +0 -2
  71. package/dist/Timeline/Timeline-116393ee.css.map +0 -1
  72. package/dist/experimental/SelectPanel2/SelectPanel-1f8c23b5.css +0 -2
  73. package/dist/utils/descendant-registry.d.ts +0 -33
  74. package/dist/utils/descendant-registry.d.ts.map +0 -1
  75. package/dist/utils/descendant-registry.js +0 -241
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import React, { useRef, useState, forwardRef } from 'react';
2
+ import React, { useRef, useState, forwardRef, 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';
@@ -8,7 +8,6 @@ import { IconButton } from '../Button/IconButton.js';
8
8
  import { useFocusZone } from '../hooks/useFocusZone.js';
9
9
  import styles from './ActionBar.module.css.js';
10
10
  import { clsx } from 'clsx';
11
- import { createDescendantRegistry } from '../utils/descendant-registry.js';
12
11
  import { jsxs, jsx } from 'react/jsx-runtime';
13
12
  import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
14
13
  import { FocusKeys } from '@primer/behaviors';
@@ -23,6 +22,8 @@ const ACTIONBAR_ITEM_GAP = 8;
23
22
 
24
23
  const ActionBarContext = /*#__PURE__*/React.createContext({
25
24
  size: 'medium',
25
+ registerChild: () => {},
26
+ unregisterChild: () => {},
26
27
  isVisibleChild: () => true,
27
28
  groupId: undefined
28
29
  });
@@ -32,7 +33,6 @@ small (28px), medium (32px), large (40px)
32
33
  */
33
34
 
34
35
  const MORE_BTN_WIDTH = 32;
35
- const ActionBarItemsRegistry = createDescendantRegistry();
36
36
  const calculatePossibleItems = (registryEntries, navWidth, gap, moreMenuWidth = 0) => {
37
37
  const widthToFit = navWidth - moreMenuWidth;
38
38
  let breakpoint = registryEntries.length; // assume all items will fit
@@ -97,8 +97,7 @@ const renderMenuItem = (item, index) => {
97
97
  };
98
98
  renderMenuItem.displayName = "renderMenuItem";
99
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));
100
+ const registryEntries = Array.from(childRegistry).filter(entry => entry[1] !== null && (entry[1].type !== 'action' || entry[1].groupId === undefined));
102
101
  if (registryEntries.length === 0) return new Set();
103
102
  const numberOfItemsPossible = calculatePossibleItems(registryEntries, navWidth, gap);
104
103
  const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(registryEntries, navWidth, gap, moreMenuWidth || MORE_BTN_WIDTH);
@@ -133,7 +132,7 @@ const getMenuItems = (navWidth, moreMenuWidth, childRegistry, hasActiveMenu, gap
133
132
  }
134
133
  };
135
134
  const ActionBar = props => {
136
- const $ = c(38);
135
+ const $ = c(37);
137
136
  const {
138
137
  size: t0,
139
138
  children,
@@ -148,12 +147,28 @@ const ActionBar = props => {
148
147
  const gap = t2 === undefined ? "condensed" : t2;
149
148
  const listRef = useRef(null);
150
149
  const [computedGap, setComputedGap] = useState(ACTIONBAR_ITEM_GAP);
151
- const [childRegistry, setChildRegistry] = ActionBarItemsRegistry.useRegistryState();
152
- const [menuItemIds, setMenuItemIds] = useState(_temp);
153
- const navRef = useRef(null);
150
+ const [childRegistry, setChildRegistry] = useState(_temp);
154
151
  let t3;
155
152
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
156
- t3 = () => {
153
+ t3 = (id, childProps) => setChildRegistry(prev => new Map(prev).set(id, childProps));
154
+ $[0] = t3;
155
+ } else {
156
+ t3 = $[0];
157
+ }
158
+ const registerChild = t3;
159
+ let t4;
160
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
161
+ t4 = id_0 => setChildRegistry(prev_0 => new Map(prev_0).set(id_0, null));
162
+ $[1] = t4;
163
+ } else {
164
+ t4 = $[1];
165
+ }
166
+ const unregisterChild = t4;
167
+ const [menuItemIds, setMenuItemIds] = useState(_temp2);
168
+ const navRef = useRef(null);
169
+ let t5;
170
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
171
+ t5 = () => {
157
172
  if (!listRef.current) {
158
173
  return;
159
174
  }
@@ -163,23 +178,23 @@ const ActionBar = props => {
163
178
  setComputedGap(parsed);
164
179
  }
165
180
  };
166
- $[0] = t3;
181
+ $[2] = t5;
167
182
  } else {
168
- t3 = $[0];
183
+ t5 = $[2];
169
184
  }
170
- let t4;
171
- if ($[1] !== gap) {
172
- t4 = [gap];
173
- $[1] = gap;
174
- $[2] = t4;
185
+ let t6;
186
+ if ($[3] !== gap) {
187
+ t6 = [gap];
188
+ $[3] = gap;
189
+ $[4] = t6;
175
190
  } else {
176
- t4 = $[2];
191
+ t6 = $[4];
177
192
  }
178
- useIsomorphicLayoutEffect(t3, t4);
193
+ useIsomorphicLayoutEffect(t5, t6);
179
194
  const moreMenuRef = useRef(null);
180
- let t5;
181
- if ($[3] !== childRegistry || $[4] !== computedGap || $[5] !== menuItemIds.size) {
182
- t5 = resizeObserverEntries => {
195
+ let t7;
196
+ if ($[5] !== childRegistry || $[6] !== computedGap || $[7] !== menuItemIds.size) {
197
+ t7 = resizeObserverEntries => {
183
198
  var _moreMenuRef$current$, _moreMenuRef$current;
184
199
  const navWidth = resizeObserverEntries[0].contentRect.width;
185
200
  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;
@@ -191,86 +206,76 @@ const ActionBar = props => {
191
206
  }
192
207
  }
193
208
  };
194
- $[3] = childRegistry;
195
- $[4] = computedGap;
196
- $[5] = menuItemIds.size;
197
- $[6] = t5;
209
+ $[5] = childRegistry;
210
+ $[6] = computedGap;
211
+ $[7] = menuItemIds.size;
212
+ $[8] = t7;
198
213
  } else {
199
- t5 = $[6];
214
+ t7 = $[8];
200
215
  }
201
- useResizeObserver(t5, navRef);
202
- let t6;
203
- if ($[7] !== menuItemIds) {
204
- t6 = id => !menuItemIds.has(id);
205
- $[7] = menuItemIds;
206
- $[8] = t6;
216
+ useResizeObserver(t7, navRef);
217
+ let t8;
218
+ if ($[9] !== menuItemIds) {
219
+ t8 = id_1 => !menuItemIds.has(id_1);
220
+ $[9] = menuItemIds;
221
+ $[10] = t8;
207
222
  } else {
208
- t6 = $[8];
223
+ t8 = $[10];
209
224
  }
210
- const isVisibleChild = t6;
211
- let t7;
212
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
213
- t7 = {
225
+ const isVisibleChild = t8;
226
+ let t9;
227
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
228
+ t9 = {
214
229
  containerRef: listRef,
215
230
  bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
216
231
  focusOutBehavior: "wrap"
217
232
  };
218
- $[9] = t7;
233
+ $[11] = t9;
219
234
  } else {
220
- t7 = $[9];
235
+ t9 = $[11];
221
236
  }
222
- useFocusZone(t7);
237
+ useFocusZone(t9);
223
238
  let groupedItemsMap;
224
- if ($[10] !== childRegistry) {
239
+ if ($[12] !== childRegistry) {
225
240
  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);
241
+ for (const [key, childProps_0] of childRegistry) {
242
+ if ((childProps_0 === null || childProps_0 === void 0 ? void 0 : childProps_0.type) === "action" && childProps_0.groupId) {
243
+ const existingGroup = groupedItemsMap.get(childProps_0.groupId) || [];
244
+ existingGroup.push([key, childProps_0]);
245
+ groupedItemsMap.set(childProps_0.groupId, existingGroup);
231
246
  }
232
247
  }
233
- $[10] = childRegistry;
234
- $[11] = groupedItemsMap;
248
+ $[12] = childRegistry;
249
+ $[13] = groupedItemsMap;
235
250
  } else {
236
- groupedItemsMap = $[11];
251
+ groupedItemsMap = $[13];
237
252
  }
238
253
  const groupedItems = groupedItemsMap;
239
- let t8;
240
- if ($[12] !== isVisibleChild || $[13] !== size) {
241
- t8 = {
254
+ let t10;
255
+ if ($[14] !== isVisibleChild || $[15] !== size) {
256
+ t10 = {
242
257
  size,
258
+ registerChild,
259
+ unregisterChild,
243
260
  isVisibleChild
244
261
  };
245
- $[12] = isVisibleChild;
246
- $[13] = size;
247
- $[14] = t8;
248
- } else {
249
- t8 = $[14];
250
- }
251
- let t9;
252
- if ($[15] !== className) {
253
- t9 = clsx(className, styles.Nav);
254
- $[15] = className;
255
- $[16] = t9;
262
+ $[14] = isVisibleChild;
263
+ $[15] = size;
264
+ $[16] = t10;
256
265
  } else {
257
- t9 = $[16];
266
+ t10 = $[16];
258
267
  }
259
- let t10;
260
- if ($[17] !== children || $[18] !== setChildRegistry) {
261
- t10 = /*#__PURE__*/jsx(ActionBarItemsRegistry.Provider, {
262
- setRegistry: setChildRegistry,
263
- children: children
264
- });
265
- $[17] = children;
266
- $[18] = setChildRegistry;
267
- $[19] = t10;
268
+ let t11;
269
+ if ($[17] !== className) {
270
+ t11 = clsx(className, styles.Nav);
271
+ $[17] = className;
272
+ $[18] = t11;
268
273
  } else {
269
- t10 = $[19];
274
+ t11 = $[18];
270
275
  }
271
- let t11;
272
- if ($[20] !== ariaLabel || $[21] !== childRegistry || $[22] !== groupedItems || $[23] !== menuItemIds) {
273
- t11 = menuItemIds.size > 0 && /*#__PURE__*/jsxs(ActionMenu, {
276
+ let t12;
277
+ if ($[19] !== ariaLabel || $[20] !== childRegistry || $[21] !== groupedItems || $[22] !== menuItemIds) {
278
+ t12 = menuItemIds.size > 0 && /*#__PURE__*/jsxs(ActionMenu, {
274
279
  children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
275
280
  children: /*#__PURE__*/jsx(IconButton, {
276
281
  variant: "invisible",
@@ -279,13 +284,13 @@ const ActionBar = props => {
279
284
  })
280
285
  }), /*#__PURE__*/jsx(ActionMenu.Overlay, {
281
286
  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);
287
+ children: Array.from(menuItemIds).map(id_2 => {
288
+ const menuItem = childRegistry.get(id_2);
284
289
  if (!menuItem) {
285
290
  return null;
286
291
  }
287
292
  if (menuItem.type === "divider") {
288
- return /*#__PURE__*/jsx(ActionList.Divider, {}, id_0);
293
+ return /*#__PURE__*/jsx(ActionList.Divider, {}, id_2);
289
294
  } else {
290
295
  if (menuItem.type === "action") {
291
296
  const {
@@ -324,107 +329,80 @@ const ActionBar = props => {
324
329
  returnFocusRef
325
330
  }),
326
331
  children: /*#__PURE__*/jsx(ActionList, {
327
- children: menuItems.map(_temp2)
332
+ children: menuItems.map(_temp3)
328
333
  })
329
334
  })]
330
- }, id_0);
335
+ }, id_2);
331
336
  }
332
- const groupedMenuItems = groupedItems.get(id_0) || [];
337
+ const groupedMenuItems = groupedItems.get(id_2) || [];
333
338
  if (menuItem.type === "group") {
334
339
  return /*#__PURE__*/jsx(React.Fragment, {
335
- children: groupedMenuItems.map(_temp3)
336
- }, id_0);
340
+ children: groupedMenuItems.map(_temp4)
341
+ }, id_2);
337
342
  }
338
343
  })
339
344
  })
340
345
  })]
341
346
  });
342
- $[20] = ariaLabel;
343
- $[21] = childRegistry;
344
- $[22] = groupedItems;
345
- $[23] = menuItemIds;
346
- $[24] = t11;
347
+ $[19] = ariaLabel;
348
+ $[20] = childRegistry;
349
+ $[21] = groupedItems;
350
+ $[22] = menuItemIds;
351
+ $[23] = t12;
347
352
  } else {
348
- t11 = $[24];
353
+ t12 = $[23];
349
354
  }
350
- let t12;
351
- if ($[25] !== ariaLabel || $[26] !== ariaLabelledBy || $[27] !== gap || $[28] !== t10 || $[29] !== t11) {
352
- t12 = /*#__PURE__*/jsxs("div", {
355
+ let t13;
356
+ if ($[24] !== ariaLabel || $[25] !== ariaLabelledBy || $[26] !== children || $[27] !== gap || $[28] !== t12) {
357
+ t13 = /*#__PURE__*/jsxs("div", {
353
358
  ref: listRef,
354
359
  role: "toolbar",
355
360
  className: styles.List,
356
361
  "aria-label": ariaLabel,
357
362
  "aria-labelledby": ariaLabelledBy,
358
363
  "data-gap": gap,
359
- children: [t10, t11]
364
+ children: [children, t12]
360
365
  });
361
- $[25] = ariaLabel;
362
- $[26] = ariaLabelledBy;
366
+ $[24] = ariaLabel;
367
+ $[25] = ariaLabelledBy;
368
+ $[26] = children;
363
369
  $[27] = gap;
364
- $[28] = t10;
365
- $[29] = t11;
366
- $[30] = t12;
370
+ $[28] = t12;
371
+ $[29] = t13;
367
372
  } else {
368
- t12 = $[30];
373
+ t13 = $[29];
369
374
  }
370
- let t13;
371
- if ($[31] !== flush || $[32] !== t12 || $[33] !== t9) {
372
- t13 = /*#__PURE__*/jsx("div", {
375
+ let t14;
376
+ if ($[30] !== flush || $[31] !== t11 || $[32] !== t13) {
377
+ t14 = /*#__PURE__*/jsx("div", {
373
378
  ref: navRef,
374
- className: t9,
379
+ className: t11,
375
380
  "data-flush": flush,
376
- children: t12
377
- });
378
- $[31] = flush;
379
- $[32] = t12;
380
- $[33] = t9;
381
- $[34] = t13;
382
- } else {
383
- t13 = $[34];
384
- }
385
- let t14;
386
- if ($[35] !== t13 || $[36] !== t8) {
387
- t14 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
388
- value: t8,
389
381
  children: t13
390
382
  });
391
- $[35] = t13;
392
- $[36] = t8;
393
- $[37] = t14;
383
+ $[30] = flush;
384
+ $[31] = t11;
385
+ $[32] = t13;
386
+ $[33] = t14;
387
+ } else {
388
+ t14 = $[33];
389
+ }
390
+ let t15;
391
+ if ($[34] !== t10 || $[35] !== t14) {
392
+ t15 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
393
+ value: t10,
394
+ children: t14
395
+ });
396
+ $[34] = t10;
397
+ $[35] = t14;
398
+ $[36] = t15;
394
399
  } else {
395
- t14 = $[37];
400
+ t15 = $[36];
396
401
  }
397
- return t14;
402
+ return t15;
398
403
  };
399
- function useWidth(ref) {
400
- const $ = c(3);
401
- const widthRef = useRef(-1);
402
- let t0;
403
- if ($[0] !== ref) {
404
- t0 = () => {
405
- var _ref$current;
406
- const width = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect().width;
407
- if (width) {
408
- widthRef.current = width;
409
- }
410
- };
411
- $[0] = ref;
412
- $[1] = t0;
413
- } else {
414
- t0 = $[1];
415
- }
416
- let t1;
417
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
418
- t1 = [];
419
- $[2] = t1;
420
- } else {
421
- t1 = $[2];
422
- }
423
- useIsomorphicLayoutEffect(t0, t1);
424
- return widthRef;
425
- }
426
404
  const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
427
- const $ = c(18);
405
+ const $ = c(27);
428
406
  let disabled;
429
407
  let onClick;
430
408
  let props;
@@ -445,19 +423,29 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
445
423
  }
446
424
  const ref = useRef(null);
447
425
  useRefObjectAsForwardedRef(forwardedRef, ref);
426
+ const id = useId();
448
427
  const {
449
428
  size,
429
+ registerChild,
430
+ unregisterChild,
450
431
  isVisibleChild
451
432
  } = React.useContext(ActionBarContext);
452
433
  const {
453
434
  groupId
454
435
  } = React.useContext(ActionBarGroupContext);
455
- const widthRef = useWidth(ref);
436
+ const widthRef = useRef();
456
437
  let t1;
457
- if ($[4] !== disabled || $[5] !== groupId || $[6] !== onClick || $[7] !== props || $[8] !== widthRef) {
438
+ if ($[4] !== disabled || $[5] !== groupId || $[6] !== id || $[7] !== onClick || $[8] !== props || $[9] !== registerChild || $[10] !== unregisterChild) {
458
439
  t1 = () => {
459
- var _props$ariaLabel;
460
- return {
440
+ var _ref$current, _props$ariaLabel;
441
+ const width = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect().width;
442
+ if (width) {
443
+ widthRef.current = width;
444
+ }
445
+ if (!widthRef.current) {
446
+ return;
447
+ }
448
+ registerChild(id, {
461
449
  type: "action",
462
450
  label: (_props$ariaLabel = props["aria-label"]) !== null && _props$ariaLabel !== void 0 ? _props$ariaLabel : "",
463
451
  icon: props.icon,
@@ -465,41 +453,59 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
465
453
  onClick: onClick,
466
454
  width: widthRef.current,
467
455
  groupId: groupId !== null && groupId !== void 0 ? groupId : undefined
456
+ });
457
+ return () => {
458
+ unregisterChild(id);
468
459
  };
469
460
  };
470
461
  $[4] = disabled;
471
462
  $[5] = groupId;
472
- $[6] = onClick;
473
- $[7] = props;
474
- $[8] = widthRef;
475
- $[9] = t1;
463
+ $[6] = id;
464
+ $[7] = onClick;
465
+ $[8] = props;
466
+ $[9] = registerChild;
467
+ $[10] = unregisterChild;
468
+ $[11] = t1;
476
469
  } else {
477
- t1 = $[9];
470
+ t1 = $[11];
478
471
  }
479
- const registryProps = t1;
480
- const id = ActionBarItemsRegistry.useRegisterDescendantCallback(registryProps);
481
- let t2;
482
- if ($[10] !== disabled || $[11] !== onClick) {
483
- t2 = event => {
472
+ const t2 = props["aria-label"];
473
+ let t3;
474
+ if ($[12] !== disabled || $[13] !== onClick || $[14] !== props.icon || $[15] !== registerChild || $[16] !== t2 || $[17] !== unregisterChild) {
475
+ t3 = [registerChild, unregisterChild, t2, props.icon, disabled, onClick];
476
+ $[12] = disabled;
477
+ $[13] = onClick;
478
+ $[14] = props.icon;
479
+ $[15] = registerChild;
480
+ $[16] = t2;
481
+ $[17] = unregisterChild;
482
+ $[18] = t3;
483
+ } else {
484
+ t3 = $[18];
485
+ }
486
+ useIsomorphicLayoutEffect(t1, t3);
487
+ let t4;
488
+ if ($[19] !== disabled || $[20] !== onClick) {
489
+ t4 = event => {
484
490
  var _onClick;
485
491
  if (disabled) {
486
492
  return;
487
493
  }
488
494
  (_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick(event);
489
495
  };
490
- $[10] = disabled;
491
- $[11] = onClick;
492
- $[12] = t2;
496
+ $[19] = disabled;
497
+ $[20] = onClick;
498
+ $[21] = t4;
493
499
  } else {
494
- t2 = $[12];
500
+ t4 = $[21];
495
501
  }
496
- const clickHandler = t2;
502
+ const clickHandler = t4;
497
503
  if (!isVisibleChild(id) || groupId && !isVisibleChild(groupId)) {
498
504
  return null;
499
505
  }
500
- let t3;
501
- if ($[13] !== clickHandler || $[14] !== disabled || $[15] !== props || $[16] !== size) {
502
- t3 = /*#__PURE__*/jsx(IconButton, {
506
+ let t5;
507
+ if ($[22] !== clickHandler || $[23] !== disabled || $[24] !== props || $[25] !== size) {
508
+ t5 = /*#__PURE__*/jsx(IconButton, {
503
509
  "aria-disabled": disabled,
504
510
  ref: ref,
505
511
  size: size,
@@ -507,79 +513,108 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
507
513
  ...props,
508
514
  variant: "invisible"
509
515
  });
510
- $[13] = clickHandler;
511
- $[14] = disabled;
512
- $[15] = props;
513
- $[16] = size;
514
- $[17] = t3;
516
+ $[22] = clickHandler;
517
+ $[23] = disabled;
518
+ $[24] = props;
519
+ $[25] = size;
520
+ $[26] = t5;
515
521
  } else {
516
- t3 = $[17];
522
+ t5 = $[26];
517
523
  }
518
- return t3;
524
+ return t5;
519
525
  });
520
526
  const ActionBarGroupContext = /*#__PURE__*/React.createContext({
521
527
  groupId: null
522
528
  });
523
529
  const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
524
- const $ = c(10);
530
+ const $ = c(16);
525
531
  const {
526
532
  children
527
533
  } = t0;
528
534
  const backupRef = useRef(null);
529
535
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
530
- const widthRef = useWidth(ref);
536
+ const id = useId();
537
+ const {
538
+ registerChild,
539
+ unregisterChild
540
+ } = React.useContext(ActionBarContext);
541
+ const widthRef = useRef();
531
542
  let t1;
532
- if ($[0] !== widthRef) {
533
- t1 = () => ({
534
- type: "group",
535
- width: widthRef.current
536
- });
537
- $[0] = widthRef;
538
- $[1] = t1;
543
+ if ($[0] !== id || $[1] !== ref || $[2] !== registerChild || $[3] !== unregisterChild) {
544
+ t1 = () => {
545
+ var _ref$current2;
546
+ const width = (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getBoundingClientRect().width;
547
+ if (width) {
548
+ widthRef.current = width;
549
+ }
550
+ if (!widthRef.current) {
551
+ return;
552
+ }
553
+ registerChild(id, {
554
+ type: "group",
555
+ width: widthRef.current
556
+ });
557
+ return () => {
558
+ unregisterChild(id);
559
+ };
560
+ };
561
+ $[0] = id;
562
+ $[1] = ref;
563
+ $[2] = registerChild;
564
+ $[3] = unregisterChild;
565
+ $[4] = t1;
539
566
  } else {
540
- t1 = $[1];
567
+ t1 = $[4];
541
568
  }
542
- const registryProps = t1;
543
- const id = ActionBarItemsRegistry.useRegisterDescendantCallback(registryProps);
544
569
  let t2;
545
- if ($[2] !== id) {
546
- t2 = {
570
+ if ($[5] !== registerChild || $[6] !== unregisterChild) {
571
+ t2 = [registerChild, unregisterChild];
572
+ $[5] = registerChild;
573
+ $[6] = unregisterChild;
574
+ $[7] = t2;
575
+ } else {
576
+ t2 = $[7];
577
+ }
578
+ useIsomorphicLayoutEffect(t1, t2);
579
+ let t3;
580
+ if ($[8] !== id) {
581
+ t3 = {
547
582
  groupId: id
548
583
  };
549
- $[2] = id;
550
- $[3] = t2;
584
+ $[8] = id;
585
+ $[9] = t3;
551
586
  } else {
552
- t2 = $[3];
587
+ t3 = $[9];
553
588
  }
554
- let t3;
555
- if ($[4] !== children || $[5] !== ref) {
556
- t3 = /*#__PURE__*/jsx("div", {
589
+ let t4;
590
+ if ($[10] !== children || $[11] !== ref) {
591
+ t4 = /*#__PURE__*/jsx("div", {
557
592
  className: styles.Group,
558
593
  ref: ref,
559
594
  children: children
560
595
  });
561
- $[4] = children;
562
- $[5] = ref;
563
- $[6] = t3;
596
+ $[10] = children;
597
+ $[11] = ref;
598
+ $[12] = t4;
564
599
  } else {
565
- t3 = $[6];
600
+ t4 = $[12];
566
601
  }
567
- let t4;
568
- if ($[7] !== t2 || $[8] !== t3) {
569
- t4 = /*#__PURE__*/jsx(ActionBarGroupContext.Provider, {
570
- value: t2,
571
- children: t3
602
+ let t5;
603
+ if ($[13] !== t3 || $[14] !== t4) {
604
+ t5 = /*#__PURE__*/jsx(ActionBarGroupContext.Provider, {
605
+ value: t3,
606
+ children: t4
572
607
  });
573
- $[7] = t2;
574
- $[8] = t3;
575
- $[9] = t4;
608
+ $[13] = t3;
609
+ $[14] = t4;
610
+ $[15] = t5;
576
611
  } else {
577
- t4 = $[9];
612
+ t5 = $[15];
578
613
  }
579
- return t4;
614
+ return t5;
580
615
  });
581
616
  const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
582
- const $ = c(32);
617
+ const $ = c(42);
583
618
  let ariaLabel;
584
619
  let icon;
585
620
  let items;
@@ -612,39 +647,70 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
612
647
  }
613
648
  const backupRef = useRef(null);
614
649
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
650
+ const id = useId();
615
651
  const {
652
+ registerChild,
653
+ unregisterChild,
616
654
  isVisibleChild
617
655
  } = React.useContext(ActionBarContext);
618
656
  const [menuOpen, setMenuOpen] = useState(false);
619
- const widthRef = useWidth(ref);
657
+ const widthRef = useRef();
620
658
  let t1;
621
- if ($[7] !== ariaLabel || $[8] !== icon || $[9] !== items || $[10] !== overflowIcon || $[11] !== returnFocusRef || $[12] !== widthRef) {
622
- t1 = () => ({
623
- type: "menu",
624
- width: widthRef.current,
625
- label: ariaLabel,
626
- icon: overflowIcon ? overflowIcon : icon,
627
- returnFocusRef,
628
- items
629
- });
659
+ if ($[7] !== ariaLabel || $[8] !== icon || $[9] !== id || $[10] !== items || $[11] !== overflowIcon || $[12] !== ref || $[13] !== registerChild || $[14] !== returnFocusRef || $[15] !== unregisterChild) {
660
+ t1 = () => {
661
+ var _ref$current3;
662
+ const width = (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.getBoundingClientRect().width;
663
+ if (width) {
664
+ widthRef.current = width;
665
+ }
666
+ if (!widthRef.current) {
667
+ return;
668
+ }
669
+ registerChild(id, {
670
+ type: "menu",
671
+ width: widthRef.current,
672
+ label: ariaLabel,
673
+ icon: overflowIcon ? overflowIcon : icon,
674
+ returnFocusRef,
675
+ items
676
+ });
677
+ return () => {
678
+ unregisterChild(id);
679
+ };
680
+ };
630
681
  $[7] = ariaLabel;
631
682
  $[8] = icon;
632
- $[9] = items;
633
- $[10] = overflowIcon;
634
- $[11] = returnFocusRef;
635
- $[12] = widthRef;
636
- $[13] = t1;
683
+ $[9] = id;
684
+ $[10] = items;
685
+ $[11] = overflowIcon;
686
+ $[12] = ref;
687
+ $[13] = registerChild;
688
+ $[14] = returnFocusRef;
689
+ $[15] = unregisterChild;
690
+ $[16] = t1;
637
691
  } else {
638
- t1 = $[13];
692
+ t1 = $[16];
639
693
  }
640
- const registryProps = t1;
641
- const id = ActionBarItemsRegistry.useRegisterDescendantCallback(registryProps);
694
+ let t2;
695
+ if ($[17] !== ariaLabel || $[18] !== icon || $[19] !== items || $[20] !== overflowIcon || $[21] !== registerChild || $[22] !== unregisterChild) {
696
+ t2 = [registerChild, unregisterChild, ariaLabel, overflowIcon, icon, items];
697
+ $[17] = ariaLabel;
698
+ $[18] = icon;
699
+ $[19] = items;
700
+ $[20] = overflowIcon;
701
+ $[21] = registerChild;
702
+ $[22] = unregisterChild;
703
+ $[23] = t2;
704
+ } else {
705
+ t2 = $[23];
706
+ }
707
+ useIsomorphicLayoutEffect(t1, t2);
642
708
  if (!isVisibleChild(id)) {
643
709
  return null;
644
710
  }
645
- let t2;
646
- if ($[14] !== ariaLabel || $[15] !== icon || $[16] !== props) {
647
- t2 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
711
+ let t3;
712
+ if ($[24] !== ariaLabel || $[25] !== icon || $[26] !== props) {
713
+ t3 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
648
714
  children: /*#__PURE__*/jsx(IconButton, {
649
715
  variant: "invisible",
650
716
  "aria-label": ariaLabel,
@@ -652,123 +718,150 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
652
718
  ...props
653
719
  })
654
720
  });
655
- $[14] = ariaLabel;
656
- $[15] = icon;
657
- $[16] = props;
658
- $[17] = t2;
721
+ $[24] = ariaLabel;
722
+ $[25] = icon;
723
+ $[26] = props;
724
+ $[27] = t3;
659
725
  } else {
660
- t2 = $[17];
726
+ t3 = $[27];
661
727
  }
662
- let t3;
663
- if ($[18] !== returnFocusRef) {
664
- t3 = returnFocusRef && {
728
+ let t4;
729
+ if ($[28] !== returnFocusRef) {
730
+ t4 = returnFocusRef && {
665
731
  returnFocusRef
666
732
  };
667
- $[18] = returnFocusRef;
668
- $[19] = t3;
733
+ $[28] = returnFocusRef;
734
+ $[29] = t4;
669
735
  } else {
670
- t3 = $[19];
671
- }
672
- let t4;
673
- if ($[20] !== items) {
674
- t4 = items.map(_temp4);
675
- $[20] = items;
676
- $[21] = t4;
677
- } else {
678
- t4 = $[21];
736
+ t4 = $[29];
679
737
  }
680
738
  let t5;
681
- if ($[22] !== t4) {
682
- t5 = /*#__PURE__*/jsx(ActionList, {
683
- children: t4
684
- });
685
- $[22] = t4;
686
- $[23] = t5;
739
+ if ($[30] !== items) {
740
+ t5 = items.map(_temp5);
741
+ $[30] = items;
742
+ $[31] = t5;
687
743
  } else {
688
- t5 = $[23];
744
+ t5 = $[31];
689
745
  }
690
746
  let t6;
691
- if ($[24] !== t3 || $[25] !== t5) {
692
- t6 = /*#__PURE__*/jsx(ActionMenu.Overlay, {
693
- ...t3,
747
+ if ($[32] !== t5) {
748
+ t6 = /*#__PURE__*/jsx(ActionList, {
694
749
  children: t5
695
750
  });
696
- $[24] = t3;
697
- $[25] = t5;
698
- $[26] = t6;
751
+ $[32] = t5;
752
+ $[33] = t6;
699
753
  } else {
700
- t6 = $[26];
754
+ t6 = $[33];
701
755
  }
702
756
  let t7;
703
- if ($[27] !== menuOpen || $[28] !== ref || $[29] !== t2 || $[30] !== t6) {
704
- t7 = /*#__PURE__*/jsxs(ActionMenu, {
757
+ if ($[34] !== t4 || $[35] !== t6) {
758
+ t7 = /*#__PURE__*/jsx(ActionMenu.Overlay, {
759
+ ...t4,
760
+ children: t6
761
+ });
762
+ $[34] = t4;
763
+ $[35] = t6;
764
+ $[36] = t7;
765
+ } else {
766
+ t7 = $[36];
767
+ }
768
+ let t8;
769
+ if ($[37] !== menuOpen || $[38] !== ref || $[39] !== t3 || $[40] !== t7) {
770
+ t8 = /*#__PURE__*/jsxs(ActionMenu, {
705
771
  anchorRef: ref,
706
772
  open: menuOpen,
707
773
  onOpenChange: setMenuOpen,
708
- children: [t2, t6]
774
+ children: [t3, t7]
709
775
  });
710
- $[27] = menuOpen;
711
- $[28] = ref;
712
- $[29] = t2;
713
- $[30] = t6;
714
- $[31] = t7;
776
+ $[37] = menuOpen;
777
+ $[38] = ref;
778
+ $[39] = t3;
779
+ $[40] = t7;
780
+ $[41] = t8;
715
781
  } else {
716
- t7 = $[31];
782
+ t8 = $[41];
717
783
  }
718
- return t7;
784
+ return t8;
719
785
  });
720
786
  const VerticalDivider = () => {
721
- const $ = c(3);
787
+ const $ = c(8);
722
788
  const ref = useRef(null);
789
+ const id = useId();
723
790
  const {
791
+ registerChild,
792
+ unregisterChild,
724
793
  isVisibleChild
725
794
  } = React.useContext(ActionBarContext);
726
- const widthRef = useWidth(ref);
795
+ const widthRef = useRef();
727
796
  let t0;
728
- if ($[0] !== widthRef) {
729
- t0 = () => ({
730
- type: "divider",
731
- width: widthRef.current
732
- });
733
- $[0] = widthRef;
734
- $[1] = t0;
797
+ if ($[0] !== id || $[1] !== registerChild || $[2] !== unregisterChild) {
798
+ t0 = () => {
799
+ var _ref$current4;
800
+ const width = (_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.getBoundingClientRect().width;
801
+ if (width) {
802
+ widthRef.current = width;
803
+ }
804
+ if (!widthRef.current) {
805
+ return;
806
+ }
807
+ registerChild(id, {
808
+ type: "divider",
809
+ width: widthRef.current
810
+ });
811
+ return () => unregisterChild(id);
812
+ };
813
+ $[0] = id;
814
+ $[1] = registerChild;
815
+ $[2] = unregisterChild;
816
+ $[3] = t0;
817
+ } else {
818
+ t0 = $[3];
819
+ }
820
+ let t1;
821
+ if ($[4] !== registerChild || $[5] !== unregisterChild) {
822
+ t1 = [registerChild, unregisterChild];
823
+ $[4] = registerChild;
824
+ $[5] = unregisterChild;
825
+ $[6] = t1;
735
826
  } else {
736
- t0 = $[1];
827
+ t1 = $[6];
737
828
  }
738
- const registryProps = t0;
739
- const id = ActionBarItemsRegistry.useRegisterDescendantCallback(registryProps);
829
+ useIsomorphicLayoutEffect(t0, t1);
740
830
  if (!isVisibleChild(id)) {
741
831
  return null;
742
832
  }
743
- let t1;
744
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
745
- t1 = /*#__PURE__*/jsx("div", {
833
+ let t2;
834
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
835
+ t2 = /*#__PURE__*/jsx("div", {
746
836
  ref: ref,
747
837
  "data-component": "ActionBar.VerticalDivider",
748
838
  "aria-hidden": "true",
749
839
  className: styles.Divider
750
840
  });
751
- $[2] = t1;
841
+ $[7] = t2;
752
842
  } else {
753
- t1 = $[2];
843
+ t2 = $[7];
754
844
  }
755
- return t1;
845
+ return t2;
756
846
  };
757
847
  function _temp() {
848
+ return new Map();
849
+ }
850
+ function _temp2() {
758
851
  return new Set();
759
852
  }
760
- function _temp2(item, index) {
853
+ function _temp3(item, index) {
761
854
  return renderMenuItem(item, index);
762
855
  }
763
- function _temp3(t0) {
764
- const [key_0, childProps_0] = t0;
765
- if (childProps_0.type === "action") {
856
+ function _temp4(t0) {
857
+ const [key_0, childProps_1] = t0;
858
+ if (childProps_1.type === "action") {
766
859
  const {
767
860
  onClick: onClick_0,
768
861
  icon: Icon_1,
769
862
  label: label_1,
770
863
  disabled: disabled_0
771
- } = childProps_0;
864
+ } = childProps_1;
772
865
  return /*#__PURE__*/jsxs(ActionList.Item, {
773
866
  onSelect: event_0 => {
774
867
  typeof onClick_0 === "function" && onClick_0(event_0);
@@ -781,7 +874,7 @@ function _temp3(t0) {
781
874
  }
782
875
  return null;
783
876
  }
784
- function _temp4(item, index) {
877
+ function _temp5(item, index) {
785
878
  return renderMenuItem(item, index);
786
879
  }
787
880